sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3107acac476cddd3491a363b357f3ed3f9d9df776651d8223315e541a85240f5 | Python | 10,494 | 290 | """Multi-scale Attention Convolutional Neural Classifier."""
from copy import deepcopy
from sklearn.utils import check_random_state
from sktime.classification.deep_learning.base import BaseDeepClassifier
from sktime.networks.macnn import MACNNNetwork
class MACNNClassifier(BaseDeepClassifier):
"""Multi-Scale At... |
a9a0458395b3b89d53e76f6ec800329a0d3b100e4608f0527c37645479ece5a5 | Python | 10,495 | 236 | import torch
import torch.nn as nn
import logging
from cormorant.cg_lib import CGModule, SphericalHarmonicsRel
from cormorant.nn import RadialFilters
from cormorant.nn import InputLinear, InputMPNN
from cormorant.nn import OutputSoftmax, GetScalarsAtom
from cormorant.nn import NoLayer
from atom3d.models.enn import ... |
2ec49cfa3ba53b18cee4b97c2c6326ad74ee7c4af81162d7a9e80c1d82dcec50 | Python | 10,507 | 233 | import torch
import torch.nn as nn
import logging
from cormorant.cg_lib import CGModule, SphericalHarmonicsRel
from cormorant.nn import RadialFilters
from cormorant.nn import BasicMLP
from cormorant.nn import InputLinear, InputMPNN
from cormorant.nn import OutputLinear, OutputPMLP, OutputSoftmax, OutputLinearOnce, O... |
3ad04c03829832fdff26299b42cde6eca165e995674a9e9aebbacfa26120abb9 | Python | 10,507 | 381 | import os
from os import linesep
import torch
import numpy as np
import torch.nn as nn
cwd = os.getcwd()
# torch.set_default_dtype(torch.float64)
mytype = torch.float
def calculate_flowrate(info):
Q = (torch.sqrt(2*info.Psub/info.rho) * info.area_min_value)
info.Q = Q
return info
... |
bf0e8ed8e01f7d2dc0bcbd0fe7c4e4ee6e06cbde9e2026761d136f51bde0670b | Python | 10,511 | 276 | import argparse
import datetime
import json
import os
import time
import tqdm
import numpy as np
import pandas as pd
import sklearn.metrics as sm
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from atom3d.datasets import LMDBDataset
from scipy.stats import spearmanr
from model import CNN... |
18d95dd75389843a562bd5ae0fd9464a4c4fee51051e7304c6590548ca5a7dbb | Python | 10,513 | 265 | """
- Cortical thickness distribution profiles are extracted and plotted for all convex (gyr), concave (sulc), and saddle (neg) shaped points.
- Gaussian curvature is used to determine saddle shaped points and principal curvatures are used to determine convex and concave shaped points.
- Effect sizes for each distribu... |
ff058a8a6721f5c60ca608034713a67619e6bb9d45549c53b7e5aff2d73c359d | Python | 10,514 | 314 | import glob
import os
import shutil
import joblib
import numpy as np
import cv2
import torch
import sys
sys.path.append("../")
def normalize(mask, dtype=np.uint8):
return (255 * mask / np.amax(mask)).astype(dtype)
def get_bounding_box(img):
rows = np.any(img, axis=1)
cols = np.any(img, axis=0)
rmi... |
4664ba6f878822db126f96772b068ddd910028e44e54868ca5d36343b317d1aa | Python | 10,519 | 313 | from typing import Optional
from utils.jet_analysis.utils import get_jet_name, NUM_BINS, PLOT_FONT_SIZE
from utils.utils import make_dir
import os.path as osp
import numpy as np
import matplotlib.pyplot as plt
FIGSIZE = (16, 4)
LABELS_CARTESIAN_ABS_COORD = (
r"$M$ (GeV)",
r"$P_x$ (GeV)",
r"$P_y$ (GeV)",
... |
1e3df10f4d4f311f81f42740d04f116e214f43a593f8ad8713e0eb1e5ed37b39 | Python | 10,520 | 230 | #!/usr/bin/env python
import sys
import os
import math
import subprocess
#import pandas as pd
from os.path import isfile, join, isdir
from kn_common import pipetools,pipedef
from kn_pipeline_class import CPipeError,CPipeStep
import hashlib
class CPipeStepFmap(CPipeStep):
reg_name = "img3D_bg_TC_org.nii.gz"
... |
bad67c4714341299617ca513f4869d6e01f404b8e42687410a46fe95682a734c | Python | 10,521 | 213 | '''
generate_predictions_util.py
Util functions for generating predictions
'''
##########################
# Loading packages #
##########################
# 1. Load packages
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
from torch import randn
... |
8827c3d27132b6069d7276c5e5a4fe9bc14cf2ffc426828ff25e2b6a7daa8150 | Python | 10,522 | 253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 12 09:29:03 2022
@author: Mesfin Diro
"""
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter
from torch_geometric.nn import MessagePassing
from torch_geometric.nn.inits import zeros, glorot
from t... |
69e8aee7526466d2a08bd031380885906b43669958b704135ed927e9b38f6846 | Python | 10,523 | 201 | """
NOTE: FIle superseeded by cell_config.py
"""
# synconfig consists of a list of tuples.
# Each element in the list corresponds to one terminal and all of it's active zones
# each tuple consists of N sites (calculated from area * average synapses/um2)
# delay, and SR
# the 4th and 5th entries in t... |
e473f8943ced73e1aac1f295d96c0dbbf2e7584270f3b00968a7f1634c94afb2 | Python | 10,531 | 308 | """Machine type converters for Series to Panel.
Exports conversion functions for conversions between series scitypes:
convert_Series_to_Panel(obj, store=None)
converts obj of Series mtype to "adjacent" Panel mtype (e.g., numpy to numpy)
convert_Panel_to_Series(obj, store=None)
converts obj of Panel mtype to "... |
0cfdabd491f37f611b81d67237f6ae1432641b302e38483ddfcfb85ff3d93400 | Python | 10,538 | 315 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
e11efe98d5e9428c17531fff9207390e6d4272cf5fec9a004111b7292cf1a5dd | Python | 10,538 | 285 | # SPDX-License-Identifier: LGPL-3.0-or-later
from typing import (
Any,
NoReturn,
)
from deepmd.dpmodel import (
DEFAULT_PRECISION,
)
from deepmd.dpmodel.array_api import (
Array,
)
from deepmd.dpmodel.common import (
cast_precision,
)
from deepmd.dpmodel.output_def import (
FittingOutputDef,
... |
3be647ba98de07f80aa1f9ffc9fa894fe8cdcf83b3142eaff1a7beb2f7c40c37 | Python | 10,539 | 293 | import numpy as np
from scipy import ndimage
from bcblib.tools.arrays_utils import coord_in_array
from bcblib.tools.blob_robot_core import (check_rule, create_neighbours_array,
create_spawnable_neighbours_array, cell_array_to_state_array)
# TODO there could be a bunch of oth... |
2c8e1310c7f2a01cb01913498c076f432a8f36077f39af1d52c49aebfb7a08fc | Python | 10,542 | 240 | """
T5 / R2 / R3 -- pass@k crossover: the CORE, novel result (not in Winner-Take-All).
R2 Bound: #(pass@k crossings between base and RL) <= S-(G),
G(p) = F_tau(p) - F_0(p), the CDF difference of per-prompt success.
Proof route: Δ_k = -k ∫ (1-p)^{k-1} G(p) dp; the kernel is totally
... |
e1cd4622b71e2c63e8bcf68ec3666561323f4f4b8d204f38d74ef95b8521c506 | Python | 10,543 | 277 | import argparse
import datetime
import json
import os
import time
import tqdm
import numpy as np
import pandas as pd
import sklearn.metrics as sm
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from atom3d.datasets import LMDBDataset
from scipy.stats import spearmanr
from model import CNN... |
272e3d204fc88bc29b2e1cecf927a921048cf9bca2a4079fdf92a5a6dcd2c6dc | Python | 10,549 | 226 | """
Neurons are the computational nodes of an SNS, and can be either spiking or non-spiking.
"""
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IMPORTS
"""
from typing import Dict, Any
import warnings
import numbers
import sys
from sns_too... |
ff52c871bf08cc0f454e01118cdfe6d4d5dc4c0e2915abedfed6405fef55dc87 | Python | 10,549 | 178 | # this program calculates (for radiology reports)
# (i) the mention-level rare disease phenotype extraction (precision and pseudo-recall)
# (ii) the final patient-level ORDO concept extraction results by aggregating the mention-level predictions
from sklearn.metrics import accuracy_score, precision_score, recall_s... |
946add5323a249747e9bbc656c9cd696dfc6d38a1752901ad6afb9ab4b49a4c4 | Python | 10,552 | 304 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
9d9de0af6cc29e81d970c63c3148011611e72225173980b3b5586d7b172125ab | Python | 10,553 | 363 | import unittest
import pytest
import pathlib
import rdflib
from pyontutils.core import OntGraph, ilxtr
from pyontutils.identity_bnode import IdentityBNode, idf, it as ibn_it
class TestOntGraph(unittest.TestCase):
def test_subjectGraph(self):
ge = OntGraph().parse(pathlib.Path('ttlser/test/evil.ttl'))
... |
90a42c59d731559301a585705373e51b33c6af43f47161b59fa4802af7790bfe | Python | 10,555 | 283 | # s_DeepDTI_trainCNN.py
#
# A script for trian the convolutional neural network in DeepDTI.
#
# Source code:
# https://github.com/qiyuantian/DeepDTI/blob/main/s_DeepDTI_trainCNN.py
#
# Reference:
# [1] Tian Q, Bilgic B, Fan Q, Liao C, Ngamsombat C, Hu Y, Witzel T,
# Setsompop K, Polimeni JR, Hua... |
dad52be6567cc46bd62b000778aaefe45b234934e24cc5d5fe10e127b6297ac5 | Python | 10,556 | 316 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 12 13:34:50 2020
@author: user
"""
""" Convert imageJ file to .swc with correct radii thickness
read in file
output file
"""
import glob, os
import numpy as np
from natsort import natsort_keygen, ns
natsort_key1 = natsort_keygen(k... |
74a7a8526a8793078766a141168ab79c6edd774399015afff9fe973d6473ab19 | Python | 10,558 | 233 | import torch
import torch.nn as nn
import logging
from cormorant.cg_lib import CGModule, SphericalHarmonicsRel
from cormorant.nn import RadialFilters
from cormorant.nn import InputLinear, InputMPNN
from cormorant.nn import OutputLinear, OutputPMLP, OutputSoftmax, OutputSoftmaxPMLP
from cormorant.nn import GetScalars... |
84d75be21f54bccd66731f29019e74224980c27fdd7a9c9c87bc07a34f73d864 | Python | 10,558 | 240 | import argparse
import math
import os
import pdb
import pickle
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from sklearn import metrics
from torch.utils.data import DataLoader
from tqdm import tqdm
import src.model.metrics as module_metric
from src.utils.config import process_co... |
cdf0db9f5f5dd5e660e46442ebcb8850e406603dedfb66b05d34b725e4f07f7f | Python | 10,560 | 271 | import numpy as np
from akkadian.hmm import hmm_train, hmm_viterbi
from akkadian.data import load_object_from_file, logits_to_trans
from akkadian.memm import memm_greedy, build_extra_decoding_arguments
def sentence_to_HMM_format(sentence):
"""
Transform the sentence to HMM format
:param sentence: the sent... |
64bb5de286b2491f56dc1aad22abd63147668432696f4225fef962783d9f6db5 | Python | 10,562 | 252 | from src.data.process_ephys_data import ephys_mat_to_pkl
import os
from src.utils import get_project_root
import numpy as np
import pandas as pd
import pdb
# Local data
# root = get_project_root()
# External Data
root = '/media/timsit/Partition 1/'
# Local Data
# ACTIVE_EPHYS_MAT_PATH = 'data/raw/active-m2-ephys-goo... |
386a1f0b9074b5739d59a5076ce23b70b3a9720a7326661e046b23faeab1c0e9 | Python | 10,577 | 232 | import pytest
import torch
import flair
from flair.data import Sentence
from flair.datasets import ClassificationCorpus
from flair.embeddings import TransformerDocumentEmbeddings
from flair.models import TextClassifier
from flair.nn import DeepNCMDecoder
from flair.trainers import ModelTrainer
from flair.trainers.plug... |
53eeb190bd1d407be46b31d4ccea7ebf4d6fefa15196ce20aaf7b79c6a28f90a | Python | 10,583 | 185 | import unittest
import os
import csv
from dendrogram_tools import dend_json_2_nodes_n_edges
from nomenclature_tools import nomenclature_2_nodes_n_edges
from template_generation_utils import get_synonyms_from_taxonomy, get_synonym_pairs, \
PAIR_SEPARATOR, OR_SEPARATOR, read_taxonomy_config, get_subtrees, read_dendro... |
8985daf52e359f2110affec86fc59da3b20138f34bc595b0bffc41f275f1305b | Python | 10,583 | 408 | # Copyright 2023 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
af858e6a8d21c2b7c2dfd88a14154d3f58660d71e546f632c533b4bab5fa7e32 | Python | 10,587 | 229 | #!/usr/bin/env python
import sys
import os
import math
import subprocess
#import pandas as pd
from os.path import isfile, join, isdir
from kn_common import pipetools,pipedef
from kn_pipeline_class import CPipeError,CPipeStep
import hashlib
class CPipeStepFmap(CPipeStep):
reg_name = "img3D_bg_TC_org.nii.gz"
... |
1dd99eedb1da0df4dc50d4a832b66ac4c09d1c4af3978b52c7a3d22182a8a34b | Python | 10,593 | 252 | from __future__ import division
import os
import sys
import numpy as np
import pandas as pd
import seaborn as sns
import pylab as plt
import mkl
from SPHARM.lib import classification
from helper_lib import filelib
import helper_lib.parallel as prl
import warnings
warnings.simplefilter(action='ignore', category=Warni... |
4c74abb6f5d10a2ff3ec3a73aacd9f7591541c0bf92df191d264b6a52418ed46 | Python | 10,594 | 276 | import pytest
import numpy as np
from ardent.utilities import _validate_scalar_to_multi
from ardent.utilities import _validate_ndarray
from ardent.utilities import _validate_xyz_resolution
from ardent.utilities import _compute_axes
from ardent.utilities import _compute_coords
from ardent.utilities import _multiply_by... |
500d7b306282d3cb77f523bf550b059bb3a1a71aede0821c4283de6a3431bec8 | Python | 10,598 | 224 | import argparse
import torch
import torch.nn.functional as F
from sklearn.model_selection import train_test_split
import numpy as np
import pandas as pd
import cv2
import adabound
from torch.optim import lr_scheduler
import torch.optim as optim
import collections
from matplotlib import pyplot as plt
def str2bool(v):
... |
200036fb588c56be897541ee5291302de333a714338745b26043370c5393713b | Python | 10,613 | 351 | # tifffile/_imagecodecs.py
# Copyright (c) 2008-2022, Christoph Gohlke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice... |
2a71ca7528d834ab96d48dbb93654e25b3534ce10455d7a42119694ad2711e45 | Python | 10,615 | 216 | import torch
import torch.nn as nn
from torch.utils.data.dataloader import DataLoader
from torch.optim.optimizer import Optimizer
from tqdm import tqdm
from vp_suite.utils.utils import set_from_kwarg, get_public_attrs
from vp_suite.measure.loss_provider import PredictionLossProvider
from vp_suite.base import VPData
c... |
998e069319afdc343a864e3e2512db9bd9e51fad1b4656a143f5ddf906704c5f | Python | 10,625 | 218 | import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]= "4,5,6"
import torch
import torch.nn as nn
torch.set_num_threads(6)
from torch.utils import data
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset, TensorDataset
import math
import scipy
import pi... |
372d7e8df57081873cbf53a0e5e9b22bab34e1c2b4ec7ba0dc079f32a6f0dfd6 | Python | 10,631 | 271 | #!/usr/bin/env python
# coding: utf-8
import os
from scipy import sparse
import argparse
import logging
import pandas as pd
import numpy as np
import anndata
from robustlink import utils
from robustlink import enhancer_gene_utils
logger = utils.create_logger()
def pipe_corr_analysis_mc(
common_rna_cells, co... |
f0d2051f103d4380a2b108c02c649b159e40031d4583df23f0f61929aa1b0877 | Python | 10,635 | 284 | import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.distributions import Bernoulli
from models.conv2d_mtl import Conv2dMtl
from .resnet import resnet18ori
import pdb
import torchvision.models as models
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
r... |
f3a64fbe4a64fecbe8a668086b6cc700348f8db7cfc185b1330aeb9a7d2cfdc5 | Python | 10,640 | 394 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
3605eaaa58b19d0b694fc6168f986c38783b167aef08f29a3bfc281e10f08b65 | Python | 10,644 | 291 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
53ed72004517bd6636ad0b462ba3ae48048cc6402fac9a0633f0953912b9973d | Python | 10,647 | 288 | #!/usr/bin/env python
# dx_to_vgp_s3_file_transfer.py
from __future__ import print_function
import os
import dxpy
import subprocess
import shutil
import time
# This part with break as new Cloud Service Providers are added. In future versions
# Select instance based on requirements
INSTANCES = {
'NORMAL': 'mem1_ss... |
7d3c7b2483964c30309e30ad4feec3efa5fe842725b7614270851de7e7cc954b | Python | 10,656 | 253 | ########################## LICENCE ###############################
# Copyright (c) 2005-2012, Michele Simionato
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# Redistributions of so... |
5144789007bf5fc9af8de00ec98ffe32e789462ff247d3483ccc9e168ef1a4a3 | Python | 10,667 | 337 | #%% [markdown]
# # Simulation
#%%
import datetime
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspologic.simulations import er_corr
from pkg.io import FIG_PATH, OUT_PATH
from pkg.io import glue as default_glue
from pkg.io import savefig
from pkg.match... |
125f38b3e84a2aed0a8ca4416cb51e8557bfa2cdbf0898cad98893bc6a647bfe | Python | 10,677 | 286 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
cac53818493543e72bb6870adacd6219a839a2c3692312e39d4bb36e86b3871d | Python | 10,679 | 295 | # -*- coding: utf-8 -*-
"""
plot a pretty confusion matrix with seaborn
Created on Mon Jun 25 14:17:37 2018
@author: Wagner Cipriano - wagnerbhbr - gmail - CEFETMG / MMC
REFerences:
https://www.mathworks.com/help/nnet/ref/plotconfusion.html
https://stackoverflow.com/questions/28200786/how-to-plot-scikit-learn-class... |
69b63120f1e4abd5b1dccb92a744a9f7ca15cc6e7e5239cffe6ee1c81cfd4b6d | Python | 10,680 | 249 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
from io import BytesIO
from os.path import join
fro... |
0113961538e7d74c724c900df3bfe902100fa57402116518c56b0b1cf912816b | Python | 10,685 | 265 | """Pipelines for pairwise panel transformers."""
__author__ = ["fkiraly"]
from sktime.base import _HeterogenousMetaEstimator
from sktime.dists_kernels.base import BasePairwiseTransformerPanel
from sktime.transformations.base import BaseTransformer
from sktime.transformations.compose import TransformerPipeline
SUPPOR... |
70bf7f1b59b6dd285dbe8534faf2a6183a25bea34cd1edfd82d36f883a2f01c1 | Python | 10,689 | 283 | """ Embeddings module """
import math
import warnings
import torch
import torch.nn as nn
from onmt.modules.util_class import Elementwise
class PositionalEncoding(nn.Module):
"""Sinusoidal positional encoding for non-recurrent neural networks.
Implementation based on "Attention Is All You Need"
:cite:`D... |
b92343ac6c2c164926a2ac77a6dfc894fef24684fefe82057ccd5abf49a5b420 | Python | 10,696 | 190 | """
@file: mxnet_alpha_zero.py
Created on 02.09.18
@project: jc39qevo-deep-learning-project
@author: queensgambit
Description of the alpha zero architecture for mxnet:
Mastering the game of Go without
human knowledge, Silver et al.
'The input features st are processed by a residual tower that consists of a single
co... |
5de01b55a9764c3cbada059d51b8fab3871bda954bda8bdc77293ef150085073 | Python | 10,697 | 242 | from pathlib import Path
from unittest import mock
import genomic_benchmarks.loc2seq
import genomic_benchmarks.utils.datasets
import pytest
import yaml
from genomic_benchmarks.loc2seq import download_dataset, remove_dataset_from_disk
from genomic_benchmarks.loc2seq.cloud_caching import CLOUD_CACHE
from genomic_benchma... |
58f50227d1f878c3e72eb3170cb472a99b07a31e42897a718ff77f789dcac26b | Python | 10,698 | 241 | import cv2
_cv_ver = int(cv2.__version__[0])
import numpy as np
from skimage.external import tifffile
from skimage import feature
from skimage.exposure import equalize_adapthist as clahe
from skimage.morphology import square, dilation
import pylab as pl
def circularity(contours):
"""
A Hu moment invariant as a... |
9fc74a59774ff6985a5cfe02502ed430660d29e257e8e33b2a8dd18244c30e9e | Python | 10,698 | 304 | from torch import nn
import torch
class E_GCL(nn.Module):
"""
E(n) Equivariant Convolutional Layer
re
"""
def __init__(self, input_nf, output_nf, hidden_nf, edges_in_d=0, act_fn=nn.SiLU(), residual=True, attention=False, normalize=False, coords_agg='mean', tanh=False):
super(E_GCL, self).... |
d45cf03288b18b0d41b9dee668029c3f66ad25bd7245978700f3635361edf5ea | Python | 10,703 | 338 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 16:14:01 2021
@author: robert.mok
"""
import os
import sys
import torch
import matplotlib.pyplot as plt
import pickle
sys.path.append('/Users/robert.mok/Documents/GitHub/multiunit-cluster')
from MultiUnitClusterNBanks import (MultiUnitClusterN... |
1459e6b01aaaa79f71360cc69172bc3e526d71ba1c13134ae72d653eee3f49fa | Python | 10,711 | 371 | """
Shared input/output helpers for corset-tools.
The original standalone scripts each carried their own copy of the Corset
cluster-map reader, the FASTA loader and the FASTA line-wrapper. Those
implementations disagreed in small ways (delimiters, wrap width, error
handling); this module is the single implementation u... |
7ffe6745ebcdd2380d9b4c2ac199db406e986e36a0f1aaaff7860a429bf2a82b | Python | 10,711 | 326 | import os.path as osp
import argparse
import logging
from pathlib import Path
import torch
import numpy as np
from utils.argparse_utils import get_bool, get_device, get_dtype
from utils.argparse_utils import parse_model_settings, parse_eval_settings
from utils.jet_analysis import plot_p, get_ROC_AUC, anomaly_scores_sig... |
53a9e20d697a2863e553c871cd05d7418b71326f1d6153148a9b2d53f3f3e849 | Python | 10,714 | 310 | import torch
import torch.nn as nn
from lgn.g_lib import GScalar
class RadPolyTrig(nn.Module):
"""
A variation/generalization of spherical bessel functions.
Rather than than introducing the bessel functions explicitly we just write out a basis
that can produce them. Then, when apply a weight mixing m... |
076a42e84288e300cac7239802b9be8ae29fbab8692831a8eef797dc3d4884e3 | Python | 10,725 | 283 | """
@file: vision_transformer3.py
Created on 21.08.22
@project: CrazyAra
@author: queensgambit
Vision transformer network architecture.
Based on:
https://github.com/jeonsworld/ViT-pytorch/blob/460a162767de1722a014ed2261463dbbc01196b6/models/modeling.py#L230
"""
# coding=utf-8
from __future__ import absolute_import
fro... |
7e86a2ebc748d5f959017f2f6403383936b5b5c841140c40409cd1162584e158 | Python | 10,727 | 290 | #!/usr/bin/env python
from __future__ import print_function
import sys,os
import re
import argparse
import logging
import subprocess
import collections
from subprocess import Popen, PIPE
desc = 'Summarizing snakemake log'
epi = """DESCRIPTION:
Creates a table summarizing the snakemake run log.
"""
parser = argparse.A... |
f3d7adfb28ee3e1699000d09ecdf05fa832e5a240e9b9d333a2f3089a1769d2c | Python | 10,730 | 283 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
48221ee9f442f4d77f13ec271e35394212305529b9611ef37b2ab49cf44ae3b3 | Python | 10,733 | 282 | import torch
from torch import Tensor
import torch.nn as nn
from typing import Type, Any, Callable, Union, List, Optional
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',
'wide_resnet50_2', 'wide_resnet101_2']
model_urls ... |
1b96d3b0e358a5f9786f59f2201f36a26d1603eb0bcfc35b702240eb2748c8c4 | Python | 10,744 | 300 | """Test suite for numba pairwise distances."""
__author__ = ["chrisholder"]
from collections.abc import Callable
import numpy as np
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.dists_kernels._numba_distances._distance import (
_METRIC_INFOS,
pairwise_distance,
)
f... |
6e308309d4cbb04ffa0e01c6d7df3b934df5ec9177ec382dddb71c9025d529aa | Python | 10,745 | 318 | #!/usr/bin/python
"""
Test adex model
"""
import numpy as np
from neuron import h
import neuron
import matplotlib.pyplot as plt
from collections import OrderedDict
import weave
from .gif.Filter_Rect_LogSpaced import *
class AdEx():
def __init__(self):
pass
self.dt = 0.025
self.tstop = 2... |
1db8ffb2b37ab9ed6888ffa9f869cb4bc41350f85afe1c68c59346f2fcfeff1e | Python | 10,747 | 284 | from __init__ import *
import numpy as np
import pandas as pd
import logging
from sklearn.utils.sparsefuncs import mean_variance_axis
from scipy.stats import kruskal
import basic_utils
def select_hvg(gbc_cpm, percentile=30, n_qcut=20,):
# further select highly variable genes
# variance/mean
mean_cpm, var_... |
c1cb36d2ce8321690260ef2b971dd5ece3b0da5b0623e96137eccb62b8413bbb | Python | 10,752 | 302 | #!/usr/bin/env python
# coding: utf-8
""" Python module with utility functions for handling and analysing fMRI data
Run as:
python Visualize/plot_PLSC.py
"""
import numpy as np
import pandas as pd
import os.path as op
def get_roi_name(labelname):
""" Get the ROI name following the "Hemisphere_Network_*Regi... |
550f02637631efa872bc0b70f1e2d202e602534b44c349c77b1d9aef5af45f71 | Python | 10,753 | 261 | #!/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements forecaster for selecting among different model classes."""
from sktime.base import _HeterogenousMetaEstimator
from sktime.datatypes import ALL_TIME_SERIES_MTYPES
from sktime.forecasting.base._base import Bas... |
3686ba52cb93c3504f291cfaffbc36d2dfbcf82a368a24cf80d8f2abef17938e | Python | 10,757 | 300 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
4b289b3cb41ce5db9e5f3a90e3aba2143635e4abd71755c473a26733ce7e3c5d | Python | 10,763 | 341 | import argparse
import os
import pickle
import timeit
import autokeras as ak
import numpy as np
import tensorflow as tf
import trainer
from utils import data_dict_to_array, set_random_seed_tf
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Code for: Progressive Subsampling for O... |
09358440c08db763dcbb86461328397822fcfe261b379a52585c3b9b16f633c4 | Python | 10,765 | 230 | # Copyright (c) 2021. Martin Haesemeyer. All rights reserved.
#
# Licensced under the MIT license. See LICENSE
"""
Functions for Caiman based analysis into experiment classes
"""
from experiment import Experiment2P
from utilities import get_component_centroids, get_component_coordinates, TailData
from experiment_pa... |
2e434cacd7dcb6064f5cf7b3c1f52ffbf37b9d10f0e299c02550f04fe36cb900 | Python | 10,767 | 300 | """LongShort Term Memory Fully Convolutional Network (LSTM-FCN)."""
__all__ = ["LSTMFCNClassifier"]
from copy import deepcopy
from sklearn.utils import check_random_state
from sktime.classification.deep_learning.base import BaseDeepClassifier
from sktime.networks.lstmfcn import LSTMFCNNetwork
class LSTMFCNClassif... |
ded15162b4e42fa4b37e9d1960cba9ad4ec252507c35b8d70b632390268527e0 | Python | 10,768 | 247 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Extension template for transformers, SIMPLE version.
For series-to-features transformations that transform a time series to a feature vector,
e.g., summary statistics, word counts, or other tabular outputs.
For series-to-series transformations... |
e502b0a2b8d0a6070cf0fa09e3313ae1d89df52378379ba6f0e3c13f2389c089 | Python | 10,768 | 278 | #-------------------------------------------------------------------------------
# elftools: dwarf/typeunit.py
#
# DWARF type unit
#
# Dinkar Khandalekar (contact@dinkar.dev)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ import annot... |
f4425c679302cb07da425f01a762c636d2657f3fdcd874b0a179a0b821af8acc | Python | 10,770 | 327 | # SPDX-License-Identifier: LGPL-3.0-or-later
import json
import os
import shutil
import tempfile
import unittest
from copy import (
deepcopy,
)
from pathlib import (
Path,
)
import numpy as np
import paddle
from deepmd.infer.deep_eval import (
DeepEval,
)
from deepmd.pd.entrypoints.main import (
get_t... |
f7dcdf0c0165e38649ea67ba953ddda3939762010dff1387c856aebc7c51e69e | Python | 10,770 | 306 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import ModuleList, Sequential
from ..builder import BACKBONES
from .resnet import Bottleneck as _Bottleneck
from .... |
fd2836e463b21b4ca8d41d9c4a4f2b1218c61248c21090f614e9940f5ad29e13 | Python | 10,774 | 252 | #-------------------------------------------------------------------------------
# elftools: dwarf/ranges.py
#
# DWARF ranges section decoding (.debug_ranges)
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __... |
4496c9a091f24820c4c64c2f7e8a5cfe6dffdeaa3f05453e489d9396d24cda96 | Python | 10,784 | 302 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
432737860042a5692a25e79004e6734a0fff6abdd0197356c8b189ce647f22c9 | Python | 10,785 | 247 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Extension template for transformers, SIMPLE version.
For series-to-series transformations, that transform a time series to another
time series, e.g., smoothing, deseasonalization, exponentiation.
For transformations that transform a time serie... |
4bdb76a7e525a78bc0b562d2a0d2c66daa95ce6443d7e368f0af295551cc7928 | Python | 10,787 | 214 | """
@file: train_config.py
Created on 01.11.19
@project: CrazyAra
@author: queensgambit
Training configuration file
"""
from dataclasses import dataclass
@dataclass
class TrainConfig:
"""Class which stores all training configurations"""
info_div_factor: str = "div factor is a constant which can be used to r... |
81673d25e4160f2434123e35a9a49b89dddf9a8fa0817e6cfdc9789aebfed7fb | Python | 10,788 | 210 | import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as kernel_regression
import src.models.psth_regression as psth_regression
import src.visualization.vizregression as vizregression
import src.visualization.vizmodel as vizmodel
import src.data.process_ephys_data as ... |
cc72b67a44c690b22e717c6bad1d802792bd3643f3f8ba680e9a43e021caa726 | Python | 10,796 | 210 | import numpy as np
import scipy.spatial as ss
import torch
import torch.nn.functional as F
from torch_geometric.utils import to_undirected
from torch_sparse import coalesce
import atom3d.util.formats as fo
# PDB atom names -- these include co-crystallized metals
prot_atoms = ['C', 'H', 'O', 'N', 'S', 'P', 'ZN', 'NA',... |
db87b2f4924886d6f856a5eb8b61a93cd989f8fce10adae899d51c3e906d1f29 | Python | 10,803 | 303 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""LMDB data adapter for the pt_expt backend.
pt_expt does not use ``torch.utils.data.DataLoader``; its trainer calls
``data_sys.get_batch()`` directly and expects a numpy dict in the
``DeepmdDataSystem`` shape (the shape consumed by
``deepmd.dpmodel.utils.batch.normalize_b... |
1f83aeb549cce868fb9fd1f361dde43bad51c4ce1592eb4a2fe698f4aa3d83a0 | Python | 10,808 | 285 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
813aec9d49d8656654fd950897d96006d44f01584b2b48432dd370a091a05a00 | Python | 10,813 | 275 | # In order to work with the Cambridge University MWS server
import sys
sys.path.append("/var/www/default/docroot/cuneifyplus")
import cgi
import os
from collections import OrderedDict
from html import escape
from traceback import format_exc
from urllib.parse import quote
from cuneify_interface import (
Translit... |
f8cdc447705b12d11e2d39d112b7303b574c7322419e626daba2124b229ec75d | Python | 10,813 | 280 | # -*-coding:utf-8-*-
# from __future__ import absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
from networks.ShakeDrop import ShakeDrop
def conv1x1 (in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kerne... |
ccb0e8921452456929dbec35864bdf9d13447b816cdc79dc41d7d37d9f4283d9 | Python | 10,816 | 258 | # Standard
from os import environ, mkdir, listdir
from os.path import isfile, join, dirname, basename, isdir
from time import time
import shutil
import numpy as np
import pickle
# Random seeds
from random import seed as rseed
# Metrics
from sklearn.metrics import roc_curve, roc_auc_score, f1_score, accura... |
195cfc41b2d98e9396820a43132b376e51d8f6049322776bf0c8c5cf870f603c | Python | 10,817 | 268 | """Time Convolutional Neural Network (CNN) for classification in PyTorch."""
__all__ = ["CNNClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.cnn import CNNNetworkTorch
class CNNClassifierTo... |
49ca630fd5bec3e94bc5d1baab8d997f2a9ef0b5b826f6a8ac87678b1b8fce8e | Python | 10,818 | 297 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICE... |
c77dc300da4439e2aa7670b03ed3db33353b9b6cc27683a6a09fb154d3108c92 | Python | 10,832 | 256 | """Module for the conversion between different kinds of atomic data.
functions:
confs_to_mol_list: Converts the conformers inside a rdkit.Mol object to a list
of separate rdkit.Mol objects.
rdkit_mol_to_ase_atoms: Converts a rdkit.Mol object into ase.Atoms object.
add_special_atoms: Allows ase to use custom elemen... |
78b3a22a326b79d8fa0d064497d69ce2b69b28be23812dcd506771a668c51acc | Python | 10,834 | 295 | #!/usr/bin/env python3
import os
import csv
import json
from pathlib import Path
from datetime import date
import rdflib
from rdflib.extras import infixowl
from pyontutils.core import makeGraph
from pyontutils.config import auth
from pyontutils.scigraph import Vocabulary
from pyontutils.namespaces import makePrefixes
t... |
c159679ef7e86f5b0bd7839aa72b499e6c156c9ec19d5338cf68be5af0cd7c60 | Python | 10,843 | 296 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class PreCalc:
def __init__(self, pos1=0, pos2=0, pos3=0, pos4=0, w1=0, w2=0, w3=0, w4=0):
self.pos1 = pos1
self.pos2 = p... |
e6d435bb0ff8cfc3c56cb11819fb21617ab59f1b1738300a5c042869e9d0067e | Python | 10,844 | 276 | import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
import models.modules.module_util as mutil
__all__ = [
"ResidualDenseBlock", "ResidualInResidualDenseBlock",
"ReceptiveFieldBlock", "ReceptiveFieldDenseBlock", "ResidualOfReceptiveFieldDenseBlock",
"UpsamplingModule",
"... |
b34024139796e22fafd969ddf0c6fc94395c6f465d74556c33d4d9535899af11 | Python | 10,845 | 285 | import torch
from torch import nn
torch.cuda.empty_cache()
import datasets
import transformers
from transformers import activations
import pandas as pd
import numpy as np
from transformers import DistilBertTokenizer, \
DistilBertForSequenceClassification, DistilBertModel, DistilBertPreTrainedModel, Trainer, TrainingArg... |
e6fe06e43adddb271653bc1dc68716494cf972605dbe3248e0ceeb0fadfa8b00 | Python | 10,845 | 285 | import torch
from torch import nn
torch.cuda.empty_cache()
import datasets
import transformers
from transformers import activations
import pandas as pd
import numpy as np
from transformers import DistilBertTokenizer, \
DistilBertForSequenceClassification, DistilBertModel, DistilBertPreTrainedModel, Trainer, TrainingArg... |
9b1db18b7689443457cecbef1af523845cee0777053f08132166fd180cbd0819 | Python | 10,850 | 321 | """
Functionality to compute Gromov-Wasserstein distances\
using algorithms in Peyre et al. ICML 2016
"""
# std lib dependencies
import itertools as it
import time
import csv
from typing import List, Iterator, TypeVar, Optional
from math import sqrt, ceil
# external dependencies
import ot
import numpy as np
import nu... |
000aebbc3750e6210831896b5df155ffc5cb3db3942432614dc76ea79d9af251 | Python | 10,851 | 278 | import sys
from typing import List, Union
from datetime import datetime
import subprocess
import inspect
from pathlib import Path
from tqdm import tqdm
import cv2
import numpy as np
import torch
import torch.nn as nn
def most(l: List[bool], factor: float = 0.67):
r"""
Args:
l (List[bool]): The input ... |
5fbf9a78fab2e2394e2db5f2c0fa25b20960971640044fed2f22acf8405b4aff | Python | 10,853 | 266 | from __future__ import annotations
from copy import copy
from typing import Callable
import numpy as np
from .dataset import JetDataset
from .normalisations import FeaturewiseLinearBounded, NormaliseABC
from .utils import (
checkConvertElements,
checkDownloadZenodoDataset,
checkListNotEmpty,
checkStr... |
f91d29180e54497df1b3cb37edebebe82b075d7acc3f0ba93ddefb1fc45d3b8c | Python | 10,857 | 295 | """Dataclasses for benchmarking."""
import copy
from collections.abc import Callable
from dataclasses import dataclass, field, fields
import numpy as np
import pandas as pd
from sktime.split.base._base_splitter import BaseSplitter
from sktime.split.singlewindow import SingleWindowSplitter
def _coerce_data_for_eval... |
899bf21028d198dd60f3882ef0b762900a73d2bcc39d1fb80539a8b5fcfb1b89 | Python | 10,868 | 258 | """
Copyright (c) 2021 txWang
the original source code of def cal_sample_weight, cosine_distance_torch, to_sparse, cal_adj_mat_parameter, graph_from_dist_tensor, gen_adj_mat_tensor, gen_val_adj_mat_tensor is released under the MIT License
https://github.com/txWang/MOGONET/blob/main/LICENSE
"""
import os
import numpy as... |
8700bed188a6197fd0ec58e51caff5dda82aa682f38619455cad3e314f844549 | Python | 10,876 | 291 | # Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
import abc
import inspect
import logging
import six
import tensorflow as tf
l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.