sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b5fdb7763c4c954a31bac942b5128953ae6f792cdb84ddd82900a8646e76d7bb
Python
2,599
84
import logging from typing import Any from flair.trainers.plugins.base import TrainerPlugin log = logging.getLogger("flair") class WandbLoggingHandler(logging.Handler): def __init__(self, wandb, *args, **kwargs) -> None: super().__init__(*args, **kwargs) self.wandb = wandb def emit(self, r...
2f70d39a7a69f3802f5dfc4d34faa830d40d94a3f2dc96bf88ec1b2811868d9b
Python
2,600
60
from __future__ import print_function import sys from os import listdir import pickle import string import random from functools import reduce from parameterSetup import ParameterSetup from classifierTrainer import connectSamplesAndTrain from fileManagement import fileIDs2triplets from tester import test_by_classifierI...
31cd0b7ae2634ae102ba1ff45c9dd3c30947bd90cb83e4bbb6f7277ad41cfae6
Python
2,600
78
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., 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 # # ...
dbe503741ae1c298fa5bc2a3364aebf40191f08a9016a0a805cb6f8a922f68bf
Python
2,600
81
# 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...
ecc4e95aea717a65848ae7cde722e667b8ead23bf90d3c7beb77296a6de01322
Python
2,600
78
# 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...
332f9366d50e20ebb9621c81164c4ee98c928e93b6da45e850812ca6454f5ce1
Python
2,601
86
import sys import numpy as np import nengo import time import pickle import matplotlib.pyplot as plt from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network class SpikingNeuronsWithSynapticInput(nengo.Process): def __init__(se...
933bf7159e211476829f6d90c09eaa0397d64a1e06d3d8e30d7cb0e9aca42fbc
Python
2,603
62
""" Train models on synthetic data, with angle regularization. """ import os import numpy as np from six.moves import cPickle from tensorflow import keras from gradient_correction import helper, model_zoo, regul #------------------------------------------------------------------------ num_trials = 20 ...
5395a7a9039c3d5f84fc9491e52a3d21d053e7f7f72a3aee130447544446fd85
Python
2,604
73
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Sub(Base): @staticmethod def export() -> None: node = ...
a5bf75496021c2cbcdc1b695bd13a5728da4a2baed557d91baf6c22d395a6517
Python
2,604
72
# -*- coding: utf-8 -*- from __future__ import print_function import click import os import re import face_recognition.api as face_recognition import multiprocessing import sys import itertools def print_result(filename, location): top, right, bottom, left = location print("{},{},{},{},{}".format(filename, to...
4b2b98c29800197fa9ae9ba09c7a4380e7bbc0d6965427e0b9a22b367d009051
Python
2,607
57
#!/usr/bin/env python3 from pyontutils.config import auth __doc__ = f""" Create nginx configs for resolver. Usage: make_config [options] Options: -l --git-local=LBASE local git folder [default: {auth.get_path('git-local-base')}] -d --debug call IPython embed when done "...
7df5bcdda1dea0bc20bcfba2fbd9e0b8815e52dbf1152c05e2a79cca52f8419d
Python
2,607
66
#!/usr/bin/env python3 """Check that a Linux release binary is portable. packaging/linux/check_binary.py <bin/baysor> Fails unless * every NEEDED entry is a glibc library, * no required GLIBC_ symbol version is newer than GLIBC_FLOOR (the glibc of the manylinux_2_28 build image), * no libstdc++/libgcc s...
8daea1def0a846bd611828ac2bc200470cf8c97cd45ccc1c8f3e82c4f0c23f38
Python
2,607
78
# -*- coding: utf-8 -*- """ Created on Thu December 10 11:41:02 2022 @author: Pawan Panwar, Quanpeng Yang, Ashlie Martini PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini This file is part of PyL3dMD. PyL3dMD is free software: you ...
ae7b3a3d3ec984d95c5d5abc2fe1dc75c242c57e6e16da697accc08c0c93bf31
Python
2,607
70
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import mmcv import numpy as np from ..builder import PIPELINES @PIPELINES.register_module() class LoadImageFromFile(object): """Load an image from file. Required keys are "img_prefix" and "img_info" (a dict that must contain the key ...
8326087b69a5bd4c8b2a6ead6272deb953fa3fffa9f8836324a3f5aa3a491df3
Python
2,608
76
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
409a3d0d4524bef851c21ebd552fef08b11f99e1ef646c21273698d3ddf5b2c6
Python
2,609
58
# 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...
2b841b7f4ce3361da6be1822f9929a73c363dfd3cbe794d4411c9733fb6aa995
Python
2,610
70
import time import numpy as np from fig import Config as C class SingleThreadedClientSim(object): def __init__(self, client_config): """Creates a new detection source that implements the `poll` function. Detections are for the MOT16 dataset, sourced from a Faster RCNN model. The MOTClient ...
e7a148bcb35ce26f2175b4039957c79cd234e2859875bd80c4607138b3643a9b
Python
2,612
67
import pytest from vp_suite.measure import METRIC_CLASSES, LOSS_CLASSES import torch """ These tests are prob. useless since they check the metric axioms on single instances """ AVAILABLE_MEASURES = {**METRIC_CLASSES, **LOSS_CLASSES} measure_names = list(AVAILABLE_MEASURES.keys()) measure_classes = list(AVAILABLE_...
70aaaa5a1599a1a8d8506805a510b0be214baadfb921c5883c0bc73a33a8a6fd
Python
2,615
75
import os import shutil from glob import glob import numpy as np from ray import tune def uniform(min_bound, max_bound): """ returns a uniform sampling function for `hyperparam_mutations` """ return lambda: float(np.random.uniform(min_bound, max_bound)) def loguniform(min_bound, max_bound, base=10): ""...
d3814ec29fe8c55b87e1a3c30fa497724cac2785b0f54a058caa43ac8f09ff5d
Python
2,616
64
#!/usr/bin/env python # arima_mapping 0.0.1 # Generated by dx-app-wizard. # # Basic execution pattern: Your app will run on a single machine from # beginning to end. # # See https://wiki.dnanexus.com/Developer-Portal for documentation and # tutorials on how to modify this file. # # DNAnexus Python Bindings (dxpy) docum...
6a6edf1ad57e6d9bf1d54700da48a6a0ced1df6fc0705b81099681bdb9943f9b
Python
2,618
88
""" Provides basic spike detection, spike shape analysis, and IV analysis if appropriate. We use readmodel (ReadModel) to read the pickled data file into acq4 format, then we can use the ephys analysis tools to analyze the data This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (Spirou,...
bc11497f58a6fff11fc0c7201ffd40de45489acac4302fc71d51c5f477868ce5
Python
2,619
102
from __future__ import annotations import io from typing import IO, TYPE_CHECKING from .binary import decode_bin, encode_bin if TYPE_CHECKING: from typing import Self from typing_extensions import Buffer # 3.12+ class BitStream(io.RawIOBase, IO[bytes]): __slots__ = ("substream",) def __init__(s...
de5a8e2a1fc25ef465c9f24d734f3295270117bd36a852abef2f7e80f925d7c7
Python
2,619
79
import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaimin...
2217f3a4dd7533b62521ff7f49ef667cce0e539b8100e629f59efb14816a359f
Python
2,622
75
__author__ = ["chrisholder", "TonyBagnall"] """Factory module that adds 3D vectorization to all exported distances. Applies pairwise_distance to all distances exported by module, so exported distances function with 1D, 2D and 3D input. """ import numpy as np from sktime.dists_kernels._numba_distances._distance i...
75ca8366ee08b8b8c6fbb3fe3dd12ba3d7bdaf0157d77db828c488f64a46c2d2
Python
2,623
87
# dncnn.py # # DnCNN model from Zhang et al., 2016 for denoising diffusion MRI data in DeepDTI from Tian et al., 2020. # # (c) Qiyuan Tian, Harvard, 2021 from keras.models import Model from keras.layers import Input, Conv3D, BatchNormalization, Activation, concatenate from keras.utils import plot_model def dncnn_mo...
2ecf74d72af96f51af747d36e005a5f20e95119de2a21cab78e2690415890ebe
Python
2,624
89
# Hack to avoid circular imports from lgn.g_lib import g_tau, g_tensor, g_torch from lgn.g_lib import g_scalar, g_wigner_d GTau = g_tau.GTau GTensor = g_tensor.GTensor GScalar = g_scalar.GScalar GWignerD = g_wigner_d.GWignerD class GVec(GTensor): """ Core class for creating and tracking G Vectors (aka G repr...
757f333a22359883132f5fb5dff9ecb15517c34dc12117cfdfe81fc9b2258d82
Python
2,624
78
import numpy as np from keras.models import * from keras.optimizers import * from sklearn.metrics import mean_squared_error, r2_score import scipy as sp from scripts import models_util def scheduler(epoch, lr): learning_rate = 0.01 # initial learning rate decay_rate = 0.03 lrate = learning_rate ...
85babfc18c40a5705de65066543ee213f680ac13bfb89215841ca0e8e7f80a47
Python
2,625
88
import matplotlib.pyplot as plt import numpy as np from Historia.ep import solver as solep from Historia.shared.plot_utils import get_col, interp_col def main(): # --------------------------------------------------------------- # Electrophysiology rat = "sham" hz = 6 nbeats = 1 E = solep.EPS...
12d182e6877b0a4a6a16801db5a91da3c9dc9ddb9d67aeb19458e25e29a0215b
Python
2,626
54
from tensorflow.keras.models import Model from tensorflow.keras.layers import Dense, Activation, Permute, Dropout from tensorflow.keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, Convolution2D from tensorflow.keras.layers import SeparableConv2D, DepthwiseConv2D from tensorflow.keras.layers import BatchNormal...
ce75b8a001edd6e1a3765cf34cca08ecf2ff5233c9293d2f9b73ebda62600e8b
Python
2,627
82
# SPDX-License-Identifier: LGPL-3.0-or-later from typing import ( Any, ) from torch.utils.data import ( Dataset, ) from deepmd.pt.modifier import ( BaseModifier, ) from deepmd.pt.utils.env import ( NUM_WORKERS, ) from deepmd.utils.data import ( DataRequirementItem, DeepmdData, ) class Deep...
f1c460de47646cda23135cb9173a87e1b9e787e9b8485922324f62f5353c7b35
Python
2,628
74
#!/usr/bin/env python #------------------------------------------------------------------------------- # test/run_examples_test.py # # Run the examples and compare their output to a reference # # Seva Alekseyev (sevaa@sprynet.com) # This code is in the public domain # # This runs and times in-memory firehose DWARF pars...
dd69ad0065b8999baa30fb05497e1a758f9505f7a6df9d7e75f73d4e51aa1a1d
Python
2,629
78
#!/usr/bin/env python3 """ Script for deploying files from github to the nifstd ftp. Must be run from the root of the ontology directory so we can glob files. NOTE: you can shoot yourself in the foot with this. Usage: deploy [--branch=BRANCH] <path>... deploy [--commit=COMMIT] <path>... deploy <path>... Opt...
46c29e03aa7491cd946cf52e436e34e4e791bab36e099236d8189591d5261b6c
Python
2,630
65
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score import tensorflow as tf from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D, concatenate, Dense, Flatten, Dropout from tensorflow.keras.models import Model from tensorflow.keras.applications impo...
15beae6cd24dd69b4bf2dea03544d961d5904fe5616dd34e31ae1f45ffa17a8d
Python
2,632
104
import random import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as TvT from torch.autograd import Variable from spikingjelly.clock_driven import functional from spikingjelly.clock_driven import neuron from network_3d.poolingNet_cat_1res import NeuronPool_...
1e097eed029c76c65ffe47d037e75b40b4b985975d3bb54f62199b9e70028446
Python
2,632
72
import pickle import numpy as np from ksstatistics import StatisticalTester from fileManagement import readStandardMice, getFileIDs from parameterSetup import ParameterSetup eegFilePrefix = 'eegAndStage' params = ParameterSetup() pickledDir = params.pickledDir standardMiceData, standardMiceFileFullNames = readStandard...
b7894f9830e728f837554fba1305583a56204881ad07dce22f6439cbe4fe4e75
Python
2,633
65
"""Base module for statistical transformations.""" from __future__ import annotations from collections.abc import Iterable from dataclasses import dataclass from typing import ClassVar, Any import warnings from typing import TYPE_CHECKING if TYPE_CHECKING: from pandas import DataFrame from seaborn._core.groupb...
ca7eefe4f95afa9ba18c564977a8e2b97613c9845f976c11dda69e97bfeae746
Python
2,634
77
# 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...
e1e513c88fb2c2cf6f57435d69652a6c1654c76563f76436203d568cd6b3c3fa
Python
2,634
91
import numpy as np from sklearn.linear_model import LinearRegression from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.preprocessing import PolynomialFeatures from scipy.spatial.distance import pdist, squareform def BIC_input_graph(X, g, reg_type='LR', score_type='BIC'): """cal BIC score ...
8dd547375d555fdf1c3fc071a9809647bbabed1d0d9e01db571bea74b2cdfcc8
Python
2,639
86
"""Tests for tabular-to-panel distance aggregation/reduction.""" import numpy as np import pytest from sktime.datatypes import convert_to from sktime.dists_kernels.compose_tab_to_panel import AggrDist from sktime.dists_kernels.scipy_dist import ScipyDist from sktime.registry import all_estimators from sktime.tests.te...
555bbbcced95febe6cc3a875c5bdb051f59ab1b9f2d9c170dc4c93d9f0a22f30
Python
2,641
66
# 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...
2f9f6eaa529819e413a10362da4b8cd1d8d6dbeb26a6e074eb36f1f23658a0cd
Python
2,642
64
import torch from collections import OrderedDict from torch import nn class IntermediateLayerGetter(nn.ModuleDict): """ IntermediateLayerGetter is the direct copy of torchvision.models.segmentation/_utils/IntermediateLayerGetter. We had to copy here as it is a protected class. Module wrapper that ret...
9a46055c09c968a1ba83473dc7c691bad27977c0892d2f82a69bac2568b80fcb
Python
2,644
82
from __future__ import annotations import numpy as np import matplotlib as mpl from seaborn.utils import _version_predates def norm_from_scale(scale, norm): """Produce a Normalize object given a Scale and min/max domain limits.""" # This is an internal maplotlib function that simplifies things to access ...
b31fc5bb7bc9f785a5cc976f975a9a90cbd542763af59ddf4aba8ae7a3a124fc
Python
2,645
57
# Copyright 2019-2020 The ASReview Authors. 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...
c82b1cee83e74b1014d937e13ca9c22fd4ce08474fd647ecdeb11849ce523c81
Python
2,645
77
#!/usr/bin/env python # encoding: utf-8 """ expfitting.py Provide single or double exponential fits to data. """ import lmfit import numpy as np import scipy.optimize class ExpFitting: """ Parameters ---------- nexp : int 1 or 2 for single or double exponential fit initpars : dict ...
6c34f811c061d7b219e1abceaf1d616440d5cd30d5b56b980e84493643dfe8b0
Python
2,646
73
from networkunit.tests.two_sample_test import two_sample_test from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains from networkunit.utils import use_cache, filter_valid_params, parallelize from elephant.statistics import time_histogram from elephant.spectral import welch_psd from elephant.signal...
f5090a78bdd5620d66dc791a899bbf64839a498e23ec7dd99eeb9d7b983d5705
Python
2,646
83
import pytest import numpy as np import pandas as pd import scanpy as sc from scipy.sparse import csr_matrix from palantir.utils import run_magic_imputation @pytest.fixture def mock_dm_res(): rng = np.random.default_rng() return {"T": csr_matrix(rng.random((50, 50)))} # Test with numpy ndarray def test_run...
4da5e000520adc3d2b5140ca11c34186102c6f1ee4b8a77a5de6c9bae90fb381
Python
2,647
91
# Data Technqiues str_default = "default" str_atacseq = "atacseq" str_dbitseq = "dbitseq" str_dlpfc = "dlpfc" str_patchseq = "patchseq" # Model Configs str_input = "input" str_output = "output" str_hiddens = "hiddens" str_use_biases = "use_biases" str_dropouts = "dropouts" str_use_batch_norms = "use_batch_norms" str_u...
a0f98741d22212d43585b25f46d9bbc25895452de141ca5a28fa3af291248c78
Python
2,647
84
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
b62938209e9828431ea80639218ae749cb9b2fc3f5fcf18473fc6c2734455c33
Python
2,647
78
#Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. #This program is free software; #you can redistribute it and/or modify #it under the terms of the MIT License. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHA...
b390b64df64cda628c3d504a6dbd8224c83eec2ed2abfb762c1796bbd05cf43c
Python
2,648
81
import argparse import torch import onmt import onmt.model_builder import onmt.inputters as inputters import onmt.opts from onmt.utils.misc import use_gpu from onmt.utils.logging import init_logger, logger parser = argparse.ArgumentParser(description='translate.py') parser.add_argument('-model', required=True, ...
7c191352e8d41dd71fcc5d643ef313578c78d552573d42792dba6bfe0e06c583
Python
2,649
89
# 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...
b82c8ce1b4e3bb3fd974eab018db7167998db4c0bb947c5ce800b3c8666430aa
Python
2,649
64
import unittest import os import pandas as pd from ddt import ddt import shutil import site import SPHARM.lib.vrml_parse as vr @ddt class TestVRML(unittest.TestCase): def test_extract_node_names(self): path = site.getsitepackages()[0] + '/SPHARM/tests/' vr.extract_node_names(path + 'data/test_v...
d5ea60c6dd1088933de1cdeab71b0078f35ebe892813ccf73f4530f5e75fb7ef
Python
2,649
97
""" An implementation of sparsemax (Martins & Astudillo, 2016). See :cite:`DBLP:journals/corr/MartinsA16` for detailed description. By Ben Peters and Vlad Niculae """ import torch from torch.autograd import Function import torch.nn as nn def _make_ix_like(input, dim=0): d = input.size(dim) rho = torch.arang...
2183782af27cae4731a04a6f89fde5040965c274f9c15aa42363845978c02f92
Python
2,650
92
import numpy as np from brian2 import * # import matplotlib.pyplot as plt import time import pickle # Personal stuff to send an email once data collection is finished import sys sys.path.extend(['/home/will']) from email_utils import send_email """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
f9150c8c07939f49c0310854307d1fbf95a7b6f2de14afdd02427fa2f4cb1eac
Python
2,650
70
import time import numpy as np class MOTClient(object): def __init__(self, client_config): """Creates a new detection source that implements the `poll` function. Detections are for the MOT16 dataset, sourced from a Faster RCNN model. The MOTClient object implements a configurable latency, ...
0bbdc25eeda379c7ebd8bbd7776b75cc7fd18ffae861b3a34afc7b077191081e
Python
2,654
96
from typing import Sequence from itertools import chain import torch import torch.nn as nn from torchvision import models from .utils import normalize_activation def get_network(net_type: str): if net_type == 'alex': return AlexNet() elif net_type == 'squeeze': return SqueezeNet() elif ...
5bbd51491ffbc27c2ef54ddb5d298e24c71f5fa2f8feb13db7ed6fb07f00c881
Python
2,655
93
# SPDX-License-Identifier: LGPL-3.0-or-later import numpy as np _RANDOM_GENERATOR = np.random.RandomState() def choice( a: np.ndarray | int, size: int | tuple[int, ...] | None = None, replace: bool = True, p: np.ndarray | None = None, ) -> np.ndarray | int: """Generates a random sample from a gi...
c66d57ca839196eafe14c4d1428d48ca150da25eef723c467abcc17d5ba5791e
Python
2,656
72
# 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...
9d355e91b7f8c01e209f85b22ace1f641865f96be7b65af7fcf3814d7284e829
Python
2,657
54
# 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 # from ampligraph.latent_features.layers.scoring import DistMult import pytest ...
200ea0131f769ccfa3ebb08a7972a9ed7daa4e8ede796c6a0cab4ed6f0cf6edd
Python
2,659
53
from __future__ import print_function import numpy as np from freqAnalysisTools import band from featureExtractor import FeatureExtractor class FeatureExtractorClassical(FeatureExtractor): def __init__(self, params): self.params = params self.extractorType = 'classical' def getFeatures(self, ...
727d203a2834ca06b681246fae9f8ded10e06e6e0d0e4fd2852c4d2925687e00
Python
2,659
92
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def hardmax(x: np.ndarray, axis: int = -1) -> np.ndarray: x_argmax = np....
693ebcd88a2c89819102351807e1f62dd30e57d2c67fe69962c829265396cb92
Python
2,662
96
# SPDX-License-Identifier: LGPL-3.0-or-later from copy import ( deepcopy, ) from typing import ( Any, ) import torch from deepmd.pt.model.atomic_model import ( DPDensityAtomicModel, ) from deepmd.pt.model.model.model import ( BaseModel, ) from .dp_model import ( DPModelCommon, ) from .make_densit...
6ca19e9fb4023650249c2a54f80892e6fa83e072bf143a7440f85965542d168c
Python
2,662
86
# 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...
dfea03cb203657687791cfdc08a6fa721764c9b769ebcf8b3abb3e211acc0810
Python
2,662
90
__all__ = [ "convert_dict", ] from skbase.utils.dependencies import _check_soft_dependencies from sktime.datatypes._convert_utils._coerce import _coerce_df_dtypes from sktime.datatypes._convert_utils._convert import _extend_conversions # this needs to be refactored with the convert module MTYPE_LIST_HIERARCHICAL...
3b9ef7f972f5b63b8e30c88fabe06d0acd465a7d75d8c39feb3c78effc46f1e3
Python
2,664
73
import unittest import os import pandas as pd from ddt import ddt import shutil import site from SPHARM.lib import spharm import SPHARM.lib.parallel as prl @ddt class TestSPHARM(unittest.TestCase): def test_spharm_batch(self): path = site.getsitepackages()[0] + '/SPHARM/tests/' prl.run_parallel...
580beba4cf422c61661246a8d20e0eb7dc82b9281b5fc42113311a56d235928e
Python
2,665
82
import numpy as np from cnmodel.util import sound def test_conversions(): pa = np.array([3990.5, 20, 0.3639, 2e-5]) db = np.array([ 166, 120, 85.2, 0]) assert np.allclose(sound.pa_to_dbspl(pa), db, atol=0.1, rtol=0.002) assert np.allclose(sound.dbspl_to_pa(db), pa, atol=0.1, rtol=0.002) ...
c7b869c387ab0a8bbe0dd446fc0e06732981d2c004da9cc080ef25c4ab9c460a
Python
2,667
73
import os, sys import numpy as np import torch import pytorch_lightning as pl from six.moves import cPickle from evoaug import evoaug sys.path.append('../../evoaug_analysis') import utils from model_zoo import DeepSTARR device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') # load data expt_name = '...
a6c30830a4c10193b012fee4eb01ffaaa90354fac06eef46d45966807fdbca57
Python
2,668
84
# 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...
cf53506d82e1f990e4e41597bc1f3befc319cc8a3eea45f6dc943df8208b8a3f
Python
2,669
92
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect # The below GatherElements' numpy implementation is from https://stackoverfl...
b5c34e81cf7b69225fbbc6cf92529632a1eba09b8e3e7bda5e88da61f977e036
Python
2,672
76
""" @file: rl_config.py Created on 01.04.2021 @project: CrazyAra @author: queensgambit, maxalexger Configuration file for Reinforcement Learning """ from dataclasses import dataclass @dataclass class RLConfig: """Dataclass storing the options (except UCI options) for executing reinforcement learning.""" # Ho...
8944ef27f57e01a327bc6fa0c68b65f1f91fc9a78d617d85d059690eaf80c72d
Python
2,673
103
#!/usr/bin/env python __doc__ = """ Sample Specification Nicholas Turner <nturner@cs.princeton.edu>, 2017 """ class SampleSpec(object): """ Class specifying the purpose of each volume within a dataset sample The three possible classes are: input, label, mask Links each label to a mask if it exists ...
cab9a0f97245fba0fdc786e88ff4c1eba462aba7add87153be69381847bf4db7
Python
2,674
84
# 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...
e4af67a8219857f9a71dd04c1c2cc30aba8ae748358277d9e608cb1df3994399
Python
2,675
49
{'config-search-paths': ['{:user-config-path}/pyontutils/config.yaml',], 'auth-variables': {'curies': ['../nifstd/scigraph/curie_map.yaml', # git '{:cwd}/share/pyontutils/curie_map.yaml', # ebuild testing '{:user-config-path}/pyontutils/curie_map.yaml', # config '{:user-data-...
5c263fb825f9be22b36ac2fb8b3edc794cb5060dd10b7a7671aa8cf9652e77e9
Python
2,682
66
import sys sys.path.insert(0, "../src") from pymatgen.core.periodic_table import Element from pymatgen.core.structure import Structure from pymatgen.analysis.adsorption import AdsorbateSiteFinder from gnn_eads.functions import get_voronoi_neighbourlist from pymatgen.io.ase import AseAtomsAdaptor def get_act_sites(meta...
0fd7f1f9b87caf11b7d836c037680132fea1ed6c7c0e7d730e7a231b8f122f81
Python
2,684
89
from __future__ import absolute_import, print_function import time import numpy as np import pandas as pd from tqdm import tqdm def get_data_df(fpath='data_processed.csv'): return pd.read_csv(fpath) def split_data_df(data, val_frac=0.1, test_frac=0.1, shuffle=False, seed=None): # Define shuffling if sh...
45ada0b6f145a1d17c4481afd10c61a115f0993d1687b67ea46178287905fbb9
Python
2,684
75
# Copyright 2019-2020 The ASReview Authors. 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...
f052a41e3f75e8b8f397cb14cd9562a6ca3e9d847477663e1bbff19d3b990d3b
Python
2,686
91
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def softmax(x: np.ndarray, axis: int = -1) -> np.ndarray: x_max = np.max...
a935fe9a3dcbdf20bfe331370909b924de8dcad2577195389bbd6bd9349fbff5
Python
2,687
92
from __future__ import print_function import numpy as np from .augment import Augment, Compose __all__ = ['Flip', 'Transpose', 'FlipRotate'] class Flip(Augment): """Random flip. Args: axis (int): prob (float, optional): """ def __init__(self, axis, prob=0.5): self.axis = ax...
a96d8468c681a8f9683f99358593a2dd5f3c729c621bf991cd3e2bf5d1e9aed6
Python
2,688
78
"""precipitation_lightning.py""" """ Author: Yimin Yang Last revision date: Jan 18, 2022 Function: Essential TransUnet_base for using pytorch_lightning Ref: https://github.com/HansBambel/SmaAt-UNet """ from torch import nn, optim import torch.nn.functional import pytorch_lightning as pl class AA_TransUnet_base(pl.L...
d69e2414f097a2ba490057e1236ad546958b877538f07bb09cc72675d28e9569
Python
2,688
87
# 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...
16c8b012e2da63cdcd5584e9d45e281a55d9b294856eb5a30efa40f293cfef2c
Python
2,691
83
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys sys.path.append("/public/siwenbin/DLQSM_YH/") # # Description: # Testing code of QSMnet # # Copyright @ Yanqiu Feng # Laboratory for Medical Imaging and Diagnostic Technology # Southern Medical University # email: foree@163.com # from utils import * from ca...
2a28ba8dc8e96c6b1a1ed068c3286f5efc1e954401cfc7ccaf6d008fb3c5aa7a
Python
2,691
55
from expert.src.evaluator import Evaluator import pandas as pd import os from expert.src.utils import get_dmax from tqdm import trange import numpy as np from joblib import Parallel def evaluate(cfg, args): layers = [os.path.join(args.input, i) for i in sorted(os.listdir(args.input), key=lambda x: int(x...
0827020ac57c92699ee910bed7add393fb23212da3bb3c8fb91a31e8bf2a602d
Python
2,692
63
from tqdm import tqdm import torch def update_bn(loader, model, device=None, tune_bert=False): r"""Updates BatchNorm running_mean, running_var buffers in the model. It performs one pass over data in `loader` to estimate the activation statistics for BatchNorm layers in the model. Arguments: loa...
706228d63b8317537e06b239c337f94bf7f1939ed66409c7cfd355dadba15e0a
Python
2,692
66
import torch import torch.nn as nn class CNN3D(nn.Module): """Base 3D convolutional neural network architecture for molecular data, consisting of six layers of 3D convolutions, each followed by batch normalization, ReLU activation, and optionally dropout. This network uses strided convolutions to downsample t...
b3514d2bd71cf36e61d845591902c245bb0477f9d5ab20493dc2a07a88ced0e6
Python
2,693
87
import sciunit import quantities as pq from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains class nest_simulation(sciunit.models.RunnableModel, ProducesSpikeTrains): # ToDo: How to use attrs? nest_instance = None def __init__(self, name, nest_instance=None, attrs=None, model_param...
0bae0b0e44e34abe378b04c0938e0b7f16e46167bf0b7dff2c0dd87faa322ec8
Python
2,696
67
# -*- coding: utf-8 -*- # Written (W) 2008-2012 Christian Widmer # Written (W) 2008-2010 Cheng Soon Ong # Written (W) 2012-2014 Daniel Blanchard, dblanchard@ets.org # Copyright (C) 2008-2012 Max-Planck-Society, 2012-2014 ETS # This file is part of GridMap. # GridMap is free software: you can redistribute it and/or m...
fcb80570ee676feef619c684d256d022698a46f16512120adcd727f6793bd60a
Python
2,696
82
import unittest from pathlib import Path import pytest from pyontutils.utils import get_working_dir from pyontutils.config import auth from pyontutils.integration_test_helper import _TestScriptsBase, Folders, Repo import neurondm class TestScripts(Folders, _TestScriptsBase): """ woo! """ only = tuple() lasts =...
08dd4e782b168adf2fa6ec7f7ab411db98aafc127fad4bb5e54c6fda6f8c095c
Python
2,697
91
from torch import nn import torch class Compressor(nn.Module): def __init__(self, n_channels: int, amp: float = 0.0): super().__init__() self.slope = nn.Parameter(amp * torch.randn(1, n_channels, 1)) def forward(self, x): eps = 1e-8 slope_ = torch.exp(self.slope) ret...
3f012b4d180d01044d35b1327b358c4e8f8db672b9043f688fcfe510a13346b8
Python
2,698
92
# Copyright (c) OpenMMLab. All rights reserved. from copy import deepcopy import pytest import torch from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.backbones import Conformer def is_norm(modules): """Check if is one of the norms.""" if isinstance(m...
1f232d95ce57499a1fa217efa8c2e856eaf326c6f6139611fab6e9c3dd549c05
Python
2,699
82
# 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...
3302d87d349a7ebd7c3d4fa051715bdd84537cf2ed9525c8c497b49e7d98b6fa
Python
2,699
77
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING from onnx.reference.op_run import OpRun if TYPE_CHECKING: import numpy as np class If(OpRun): def __init__(self, onnx_node, run_params): OpRun.__init...
3a5decef171adafd272ee3d93c34d1fef54ee188593cfb6fef6f51648180108a
Python
2,699
97
# -*- coding: utf-8 -*- """! @file util.py @brief Utility functions for gammacal, hopefully temporary. @author Perry Hargrave @date 2016-05-05 A temporary file while re-factoring old gammacal code bits. """ from datetime import datetime import logging from matplotlib import pyplot as plt import numpy a...
c4df2c675bf7144d2ea4015a5e5810a158b3e8ee8f40c0dcfabc47d64a14bed3
Python
2,699
63
# 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...
8883982b60462fdd1bd32a7e20f63becbd072d6c4aee571253d434ec6a9888e6
Python
2,700
64
# 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...
5846c6ad0258221c96aa192940304ebff241e8bd8388379b935587609a9591bb
Python
2,701
53
import numpy as np from Bio import SeqIO import pickle def create_test_file(filename): # these lsit below contains actual sequences from SignalP 6.0 dataset. Please process your files with e.g. biopython # for fasta files, pickle for binaries, pandas for CSV/excel files; After you find a suitable way to extr...
9eb45d42cd861acf51721ee02430086b59c9d0719ebde798c1391584a89746d5
Python
2,702
60
# Copyright 2019 The TensorFlow Authors. 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 applica...
1881f6dfbf31e4792b991074f3c038806c4a376672db50f67b46c1ec52f49f21
Python
2,705
72
import torch.nn as nn import torch import torch.nn.functional as F from torch.distributions import Bernoulli from torch.autograd import Variable from scipy.special import gamma import numpy as np import math import pdb from .ResNetFeat import create_feature_extractor class FeatureNet(nn.Module): def __init__(sel...
be7c31b7cce15de534967a354c6ecc5f959c36e6bb3837ea1a714eb7316678cc
Python
2,705
87
# 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...
0b56fb503068a053d714015b556e9f7075f681fb25699026259858a1d19056e3
Python
2,706
89
import ast import unittest from datetime import datetime, date from pyontutils import utils from pyontutils.utils import injective_dict, Async, deferred, listIn, asStr class TestInjectiveDict(unittest.TestCase): def setUp(self): self.test_funcs = ( lambda d: injective_dict(d), lamb...
a1a1fbb731cecadb908ba41d817b1de3d8cb0c61a1e1705281ad2335a7d8efae
Python
2,706
86
import setuptools import sys def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(None, parent_package, top_path) config.set_options( ignore_setup_xxx_py=True, assume_default_configuration=True, delegat...
4d7d03ac36ccc14d1d13cedab53cf288e705dc80b07402ecb7e0e9ca9613487f
Python
2,707
67
"""precipitation_lightning_base.py""" """ Author: Yimin Yang Last revision date: Jan 18, 2022 Function: precipitation maps dataloader for training sets, test sets and validation sets Ref: https://github.com/HansBambel/SmaAt-UNet """ import torch from torch.utils.data import SubsetRandomSampler import numpy as np from...