sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d1cb73df61dafee48d655e1b12745b50da95215064f9edc4b67dfc2b20a76dec
Python
6,256
148
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from .resnet import Bottleneck as _Bottleneck from .resnet import ResLayer, ResNet class Bottleneck(_Bottleneck): """Bottleneck block for ResNeXt. Args: in_channels...
d4576e4d8d9679abe79eccae5f64d7a767a3cc1f7045f6fdd685c8e4bdee89dd
Python
6,256
185
import argparse import re import os import pickle import numpy as np from tqdm import tqdm from rdkit import Chem from collections import Counter import torch import random from typing import Optional def seed_everything(seed: Optional[int] = 0) -> None: torch.manual_seed(seed) random.seed(seed...
cca0c65fbf6702192d566c74b3ca62ee875a1537611e6e3c2191862f18bea601
Python
6,257
169
""" plot_conflict_weight.py Produce circular scatter plots showing the change in bearing between rolls three and four of the data generated by conflict_weight.py. """ import json import numpy as np import itertools import matplotlib.pyplot as plt from test_utilities import circ_scatter, k, circmean import dict_key_de...
f73d6f183754346a60007498ba192e06663d198e84da6dc7b610f42c73185a41
Python
6,257
154
# 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...
c94ffe03360cd9c318f8dc942fe855d4ed3d3ab90d4f2830f95fbac4ef1bd208
Python
6,258
170
""" plot_conflict_weight.py Produce circular scatter plots showing the change in bearing between rolls three and four of the data generated by conflict_weight.py. """ import json import numpy as np import itertools import matplotlib.pyplot as plt from test_utilities import circ_scatter, k, circmean import dict_key_de...
1c8225a9d07dcdfb514e4d85dfbac443465f7ac8922358d72d6704a0b49e09f3
Python
6,259
161
# Copyright (c) OpenMMLab. All rights reserved. import functools from inspect import getfullargspec import torch from .utils import cast_tensor_type def auto_fp16(apply_to=None, out_fp32=False): """Decorator to enable fp16 training automatically. This decorator is useful when you write custom modules and w...
f2289157a973a44dbd4a3179a981203b9a4eda037b1a61406d877308b79f342c
Python
6,259
154
# -*- coding: utf-8 -*- """Package `cma` implements the CMA-ES (Covariance Matrix Adaptation Evolution Strategy). CMA-ES is a stochastic optimizer for robust non-linear non-convex derivative- and function-value-free numerical optimization. This release was tested with Python versions 3.8 to 3.13. The implementation i...
ef535c85c0f6de6d3f6d9be40c282173d813a21b922cc4cb93457d9610a4af26
Python
6,266
202
# 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 pad_impl(data, raw_pads, mode, constant_values=0.0, axes=None): inpu...
f86aba37eb186db0af7abc718ef6fee794c499a3992d8b75c310c8a456343f97
Python
6,268
158
# -*- encoding: utf-8 -*- from __future__ import print_function import sys import numpy as np import pyqtgraph as pg import neuron import cnmodel import cnmodel.cells as cells from cnmodel.protocols import SynapseTest from cnmodel.util import random_seed, reset from cnmodel import data """ Check that sgc PSDs have co...
53ab09035f03f8e33fe8592f587dbd26c1a2d1c909d58a509b70dccc1a019ed6
Python
6,270
133
# ---------------------------------------------------------------------------- # Copyright (c) 2017-2026, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
742863e8485607c7d0de0e5063b7cdf1ed61368c108b7ace391e0ef6bb6f56b9
Python
6,279
219
import os import random import time from datetime import datetime import numpy as np import pandas as pd import torch def seed_everything(seed: int = 42): random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.backends.cudnn.deterministic = True torc...
3663cef2559d2cb3e2543cc33061be6e3f6954ae1d31d403fee7bc6f184c0b15
Python
6,280
175
import os import random import shutil from collections import OrderedDict import numpy as np import torch import torch.nn as nn from imgaug import imgaug as ia from termcolor import colored from torch.autograd import Variable #### def check_manual_seed(seed): """ If manual seed is not specified, choose a ...
8843fcc85e8c942af53750b5297e9098c0e8b90e994c170f55461e1ca2ab580e
Python
6,283
191
# 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...
810048f50505e09424879041d5fbfd857a210052d4de62f175f0acaad962ceda
Python
6,284
181
"""Classifier Experiments: code to run experiments as an alternative to orchestration. This file is configured for runs of the main method with command line arguments, or for single debugging runs. Results are written in a standard format. """ __author__ = ["TonyBagnall"] import os import sys import numpy as np os...
337fa291b23342ba7d0737e1cd69329ee10a6a00dc00e31abe3fa4dccd506af1
Python
6,285
156
import numpy as np import matplotlib.pyplot as plt from matplotlib import gridspec import os from scipy.stats import norm import sys from numpy import nan import numpy.ma as ma import seaborn as sns import panel as pn sys.path.insert(1, "/Users/hyung/Research23_Network_Analysis/mBIN/Python/NetworkAnalysisGeneral/Code/...
64112512aa125a02b0f5342613a61065f1b8e2593bab91274cf545b334479d07
Python
6,294
181
# 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 from onnx.reference.ops import op_grid_sample def _deform_conv_implementation( X, W, offset, B, mask, dilations, group, kernel_shape, of...
4b4f99c768c70ae2322c73ada2591b805a36f6ce891d459b2c6fca903fef3d97
Python
6,295
184
import sys import numpy as np import torch from torch_scatter import scatter from torch_geometric.nn import radius_graph import dgl from dgl.nn.pytorch import GraphConv, NNConv from torch import nn from torch.nn import functional as F from typing import Dict, Tuple, List from models.se3transformer_layers.modules imp...
f0a69ad19c879b5b5a79f785661ff0dc052b642503365f48475a611921989d34
Python
6,296
138
#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...
5c42fe250f72d7f4569cd496754b3d2d990a90906e13ae5504f4ffa0543d5aae
Python
6,297
154
#!/usr/bin/env python import pandas as pd import numpy as np import torch import torch.utils.data import pickle import h5py as h5 import os import argparse import pyBigWig ''' Script for preprocessing input epigenomic tracks (from .bigWig file) and target Hi-C data (from diagonal.txt file). Usage example: python /t...
6c5dcc9173fa03cb5ac0c922cb19a8bbe3da7963f02121d832575d12f6df18c3
Python
6,302
140
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
7ec6c4aeca0daff8fc8912deb360381f301a086c9449f593919382de1af99c7b
Python
6,302
177
#!/usr/bin/env python3 import csv from posixpath import split import sys import pandas as pd from sys import argv import argparse from pickle import TRUE import re csv.field_size_limit(sys.maxsize) parser = argparse.ArgumentParser(add_help=TRUE) parser.add_argument("--blastout", help="output from submit_mito_blast2...
4e0c5103ad0f0cb29392698cc57b6bc79fe3b3a455ab961d593e53b558612dff
Python
6,305
154
import numpy as np import gym from collections import OrderedDict import logging from mprl.rl.envs.stratego.stratego_multiagent_env import STRATEGO_ENV from mprl.utility_services.cloud_storage import upload_file, maybe_download_object, get_default_path_on_disk_for_minio_key from mprl.utils import datetime_str import os...
d932c5f7286bfb3899f4e3095155c49356172bf7893f56b63d3c008d576c146e
Python
6,306
191
#!/usr/bin/env python # coding: utf-8 import os import scipy.spatial import atom3d.util.file as fi import atom3d.util.formats as ft import get_labels as lab from rdkit import Chem import Bio.PDB from Bio.PDB.PDBIO import Select from tqdm import tqdm import argparse def get_ligand(ligfile): """ Read liga...
53bbb1e99b3a9336ca3cd85ec1f7c3a51d4d36210abad5006437241e2c9cf79e
Python
6,307
191
""" codes for generating synthetic datasets """ import numpy as np from copy import deepcopy from sklearn.preprocessing import PolynomialFeatures def generate_W(d=6, prob=0.5, low=0.5, high=2.0): """ generate a random weighted adjaceecy matrix :param d: number of nodes :param prob: prob of existing an...
cf60c3f016569c9343e622f321ece6549af428774bcf447dffa54998a0118b2a
Python
6,307
146
import os.path as osp import os import tqdm import json import numpy as np import torch import torch.nn.functional as F from PIL import Image from models.Network import FeatureNet import torchvision.models as models import pdb import random import cv2 src = './' class ZoneClassifier(object): def __init__(self, ar...
d591654294c124de7fce809e60e2313ce34eb59315d2f02ecd4e17a20e8aaeaf
Python
6,308
160
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import six import argparse import torch from onmt.utils.logging import init_logger, logger from onmt.inputters.inputter import _old_style_vocab def get_vocabs(dict_path): fields = torch.load(dict_path) vocs = [] for side in ['s...
08c9c7b5a7beb75235df86129624110ea87f466f5b738214db46ec3d37535268
Python
6,310
234
# 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 # # ...
230d22ae9cbef9763a473d96ec596f3cf33cf58348fb22930c1f92727a32f3d9
Python
6,311
140
""" Evaluate models on synthetic data: classification and interpretability performance. """ import os, h5py import numpy as np from six.moves import cPickle from tensorflow import keras from gradient_correction import helper, explain, model_zoo, geomath import tfomics #------------------------------------------------...
4142ab1df9cfeb638c16807b6afb222014bbddceb0b83ec8be178dd99068c2be
Python
6,311
137
import logging logger = logging.getLogger(__name__) def create_reference_policy_update_callback_for_self_play_eval(trainable_policy_key: str, reference_policy_key: str, new_policy_accept_score=None, ...
9eb639e10e48292401e68c0cf2d182b0f574fe32ea58cc17124e766e6aeda3ea
Python
6,313
193
#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...
6343f58442fb2844b1020b7380baf89deec9719881c2b1cfba58f0f5425409fa
Python
6,317
149
# 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...
d37eaae35ab83f35d4250ed0b91b59b5debc63aa8959d176aab78a5eb63516bd
Python
6,317
178
# 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 # Layer normalization's reference implementation def _layer_normalization(X,...
f338f1219eef944f5f05d6c2f93487ebc0b88fa166ad1ce7fbb14f5508e0ae5d
Python
6,320
118
""" This module parses the arguments given through the torch-model-archiver command-line. """ import argparse import os from .manifest_components.manifest import RuntimeType # noinspection PyTypeChecker class ArgParser(object): """ Argument parser for torch-model-archiver commands """ @staticmeth...
69311e1d305740d98c01b2a36e471364ca080ac8d764ad4bb21c4e1e0c4c0289
Python
6,324
125
import pytest from e2e.util import check_duplicate import siibra from siibra.locations import Location, PointCloud from siibra.livequeries.bigbrain import WagstylProfileLoader from siibra.features.feature import CompoundFeature import numpy as np # We get all registered subclasses of Feature @pytest.mark.parametriz...
2c3f0ff47b4bbbb2e16092822e78b58afb63e2116f62ded896c078fae6373723
Python
6,326
206
# 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...
5bcd85c1063f1f8c57a03ee03669eb742eee53719876955cb4731f78038a53ea
Python
6,330
184
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import pytest from onnx import checker, inliner, parser class TestInliner: def test_basic(self): model = parser.parse_model( """ <ir_version: 8, opset_import: [ "" ...
a1ce498728b99b6b2fb519f3ee7836b5d422db1f83bab8dee4218c882b96c914
Python
6,330
171
"""CLI: bcb-lf-preprocess — normalise lesions and compute disconnectomes.""" import argparse import sys from pathlib import Path _BIDS_SUFFIX = "*_label-lesion_mask.nii.gz" _FLAT_SUFFIX = "*_lesion_mask.nii.gz" def _build_parser(): p = argparse.ArgumentParser( prog="bcb-lf-preprocess", descripti...
65baeb0ad020eb4f5cfca9ac159243511183e419916932237aadae3e42321099
Python
6,331
152
import re import pandas as pd from config import Config class Dataset(Config): """ Attributes ---------- ukbb_vars: list Variable names based on user selections as coded in the Biobank. recoded_vars: list Variable names based on user selections as will be recoded. ...
232391fc36a27e6791c6d97a1a0324a36d0e2c6d0b140e3d02e6d5d10e509a54
Python
6,333
209
# 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...
f6c3c6d2dd927eb651772c30dbc46d91b44d9a0e7ad5f3d8cfae5e1df73bf47d
Python
6,333
174
#!/usr/bin/env python3 from pathlib import Path import rdflib from pyontutils.core import Ont, OntGraph from pyontutils.config import auth from pyontutils.sheets import Sheet from pyontutils.namespaces import owl, rdf, rdfs, ilxtr, NIFRID, OntCuries, skos, makeNamespaces from neurondm import OntTerm, OntId from neuron...
621ff2a37253789ec8e4da4deabb82e4648a1e05087b9df4b2b189f2036b6c50
Python
6,335
190
""" Build the list of matched transcript pairs to align. Pairs come either from an explicit two-column table supplied by the user, or are derived from reciprocal best BLAST hits between the two transcriptomes. """ from collections import Counter import logging import os from typing import Optional from ..exceptions ...
43a2767121820433452bcb7878f8e69c53d82ccdc1ca77e67a822178a838171c
Python
6,337
161
from itertools import product from scipy.spatial import Voronoi import networkx as nx import ase import numpy as np import json as js # Atomic radii from Cordero CORDERO = {'Ac': 2.15, 'Al': 1.21, 'Am': 1.80, 'Sb': 1.39, 'Ar': 1.06, 'As': 1.19, 'At': 1.50, 'Ba': 2.15, 'Be': 0.96, 'Bi': 1.48, 'B' ...
8c83f418b35af0bcaf79cf80fd2a39323f40c659d6225d67ddd4b54eff9eb5e9
Python
6,341
209
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx import helper from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def dropout(X, drop_probability=0.5, seed=0, trainin...
4bf317c7fb06fa973fcf1770a7f8c9e468abf46e0ef4d4d48b507a1886ac01f0
Python
6,346
159
import os import numpy as np import torch from torch.utils.data import Dataset from torch_geometric.data import Data from torch_geometric.loader import DataLoader as PyGDataLoader from dataset.utils import anidataloader ATOM_DICT = {('Br', -1): 0, ('Br', 0): 1, ('C', -1): 2, ('C', 0): 3, ('C', 1): 4, ('Ca', 2): 5, ('...
b8396ded6925a06493cb88302920cbe5e5058ee3c6000b449b83557cf01d0d00
Python
6,348
182
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 19 13:53:51 2018 @author: wanglab """ import os, numpy as np, sys, time, shutil import collections import tifffile import torch from torch import sigmoid import dataprovider3 as dp import forward import utils def main(noeval, **args): #args...
eb48cf4c03a29b39f1020cb92632057bdeeeb4d1d28631d9b0602529aa6ae9a4
Python
6,353
172
# SAFE TEAM # # # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) # # from FunctionAnalyzerRadare import RadareFunctionAnalyzer import json import multiprocessing from multiprocessing import Pool from multiprocessing.dummy import Pool as ThreadPool import os ...
89a63c82d8927f03da37060ff189070b91330b8af2a9c6b1993edfbe5d2d121d
Python
6,355
164
# -*- coding: utf-8 -*- #import os #os.environ["CUDA_VISIBLE_DEVICES"]= "3" # # Description : # Patching training data for DIAM-CNN # # Input : # RDF : the tissue field # QSM : the COSMOS susceptibility # x : Serial number of subjects # y : the orientation of each subject # z : the number for dat...
c20473d1bf41b3364c375bef354f0b19df3a5ce93e1f9f40725fbcab0de83c13
Python
6,355
151
from __future__ import annotations from typing import TYPE_CHECKING, Any from .enums import Units from .formatting import CONVERSION_FACTORS, FormattingOptions if TYPE_CHECKING: from .layer_info import LayerInfo class ModelStatistics: """Class for storing results of the summary.""" def __init__( ...
e7b95e98de1c66c046f15bed43bf7359ff174228372b2c9ccc9b6680150d9141
Python
6,355
201
# Copyright 2024 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...
7add9a36033dd83a3da85ec6bea6dd9fd4e3a0ed78b47f801559067bfa8d56e4
Python
6,356
175
""" @file: sf_cz_game_generator.py Created on 31.12.18 @project: CrazyAra @author: queensgambit Script to generate self played games by stockfish. The script is basic wrapper for the cutechess-cli executable. For transferability a fixed node count is used for every game for BLACK and WHITE. The fixed node count is de...
ee39b0da952436ce64508d36794fe85ca3c34754915f0cf84c3af53d779bc84c
Python
6,356
190
import os from collections import defaultdict import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache from matplotlib import cm from matplotlib.colors import Normalize from matplotlib.ticker import FormatStrForma...
8fd58402afd6efd251f9b78f7a20746bf1e9e2e43e405cfecff4a5f9663d3968
Python
6,357
131
#======================================================================================================================= #Copyright #======================================================================================================================= # Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick ...
13658d9ecb2e30a2b41968534a41f6387597ed67492778979329684ee7caa71c
Python
6,361
182
import argparse import re import os import pickle import numpy as np from tqdm import tqdm from rdkit import Chem from collections import Counter import torch import random from typing import Optional def seed_everything(seed: Optional[int] = 0) -> None: torch.manual_seed(seed) random.seed(seed) os.enviro...
3bd87de1ba6598628a74efa89f8e3de137c6ad776197aa64a95b09ee64a07272
Python
6,361
259
#!/usr/bin/env python __doc__ = """ Symmetric 3d U-Net implemented in PyTorch (Optional) Factorized 3D convolution Extra residual connections Nicholas Turner <nturner@cs.princeton.edu>, 2017 Based on an architecture by Kisuk Lee <kisuklee@mit.edu>, 2017 """ import torch from torch import nn from torch.nn import functi...
7edc0306d5ea8f18fd04b96a2c299d2907baf9264f53fa31b33fc9ec0982dcb3
Python
6,361
174
import os, time import multiprocessing import subprocess from dataclasses import dataclass, field from typing import List @dataclass class ANTSStage: transform: str transform_args: str metrics: str metrics_args: str convergence: str shrink_factors: str smoothing_sigmas: str @dataclass clas...
b748b1efda580a984c936c63a1efdaf1e69740315adbf7d8800c886553028b74
Python
6,361
212
# 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...
79a8dbf79e2ca7d773ba74446dcbcfcc7012f9975f45af97fd3c1a68886da731
Python
6,367
176
"""Catch22 Classifier. Pipeline classifier using the Catch22 transformer and an estimator. """ __author__ = ["MatthewMiddlehurst", "RavenRudi", "fkiraly"] __all__ = ["Catch22Classifier"] from sklearn.ensemble import RandomForestClassifier from sktime.base._base import _clone_estimator from sktime.classification._de...
b9173d76dec230cacabbea02e15ca0e51480d1c9ad784ca87d919d4b4e84f9df
Python
6,367
220
"""Utility functions for unit vectors.""" import math import numpy as np import pyrr as pr def fibonacci(num_points): """ Create an approximately uniform grid on the unit sphere. Adapted from http://matplotlib.1069221.n5.nabble.com/ Generating-N-regularly-spaced-points-on-a-sphere-td20763.html ...
f2f4720919ca960b4a75d6ad1afcadcb938aefbe470fd4f2adbe9e0b0835e3a9
Python
6,368
159
""" To quick test Elastic to make sure it's behaving normally Usage: elastic_search.py [-h | --help] elastic_search.py [-v | --version] elastic_search.py [--username=<path>] [--password=<path>] Options: -h, --help Display this help message -v, --version Current version o...
5955adfa1d66d8fbe3cf3cfbd329d501e8eaf680dc6f28dc2686b9008577ac97
Python
6,369
208
# SPDX-License-Identifier: LGPL-3.0-or-later import copy import unittest import numpy as np import paddle from deepmd.pd.model.model import ( get_model, ) from deepmd.pd.utils import ( env, ) from deepmd.pd.utils.utils import ( to_numpy_array, ) from ...seed import ( GLOBAL_SEED, ) dtype = paddle.fl...
c8d180457e32fc8939065e2275dec669a74150a457f5e866ecfa14af402d81b2
Python
6,369
170
import sciunit import seaborn as sns from uuid import uuid4 from networkunit.plots.sample_histogram import sample_histogram from networkunit.utils import use_cache from elephant.parallel import SingleProcess sns.set_palette('colorblind') class two_sample_test(sciunit.Test): """ Parent class for specific two s...
8f9d425eb6dbf7fee95a5eb8147a20d3045a490273a5667afac9957bbc2805e2
Python
6,370
205
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.backbones import ShuffleNetV2 from mmcls.models.backbones.shufflenet_v2 import InvertedResidual def is_block(modules): """Check if ...
1e393709f4f3e630e2d7ff48bb414c6d117818f05a1506678910d35a24fe01a6
Python
6,372
155
import tensorflow as tf import numpy as np import keras from keras.optimizers import * # my scripts # General scripts from scripts import models_util import os # Transfer learning scripts from scripts_tl import configurations_tl as cfg_tl from scripts_tl import preprocess_tl from scripts_tl import data...
93ea0b06b54a497f52cfe76d9ab9712a5e6d1fc19ee0fec3a5e9520133446559
Python
6,373
236
# 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 # # ...
a2a29cb47569e6dcd5ce46bba3efa98c114823e9f52d8b6fed625b8b4f71c917
Python
6,374
135
# SAFE TEAM # # # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) # # import argparse import time import os import logging def getLogger(logfile): logger = logging.getLogger(__name__) hdlr = logging.FileHandler(logfile) formatter = logging.Forma...
62e1dd937b748f02990fc3f1943682012666198cd3b29b5784266f66787743bb
Python
6,375
136
import pandas as pd import os import re import numpy as np from livingTree import SuperTree from functools import reduce class Proportions: def __init__(self, read_from: str): path = read_from path_dir = os.listdir(read_from) path_dir = [i for i in path_dir if re.match('.*csv', i)] ...
3fc49d69c0b44fa0e5ce7b43cc519933705ee45334d8189456ccf54f2c616e12
Python
6,378
184
#%% [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...
7e3a66fb0cc21ae89927198acb9485e2a95bb9560cb94a4a8e81eed411334d4b
Python
6,378
161
import os import numpy as np import torch from torch.utils.data import Dataset from torch_geometric.data import Data from torch_geometric.loader import DataLoader as PyGDataLoader from rdkit import Chem ATOM_DICT = {1: 'H', 6: 'C', 7: 'N', 8: 'O'} PAIR_DICT = {('Br', -1): 0, ('Br', 0): 1, ('C', -1): 2, ('C', 0): 3, ('...
f8e22c69323b8fadea4a18c3150645cbb125c17040937bc44dc18f37ff28a622
Python
6,378
197
import os import os.path as osp import time import dill import numpy as np import pandas as pd import torch from sklearn.model_selection import train_test_split from torch.optim.lr_scheduler import ReduceLROnPlateau from torch_geometric.data import DataLoader from molucn.dataset.pair import get_num_features from molu...
617cb37fc8c13c0cb8f317f8e638b602ee4dc2a4bae596c14d4f72cefaaa55ce
Python
6,381
142
# 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...
ab7e8ddd0412e40ee78eed711a36b0320d47184c2cdfa8aede387c728bfc311a
Python
6,381
135
""" Tests the validity of scicrunch_client and not the data outputed itselfself. Output tests not needed bc data is collected and replaced instead of built. Only known bug is tid->superclass_tid change & is corrected in dictlib. Crawl option is tested in test_addTerms function. Usage: scicrunch_client_tes...
8e8f21564b8c27e8f7fadd1d3fa71f8180bf96306fdda658b9045d408edf4bae
Python
6,388
208
from typing import Any import numpy as np import pytorch_lightning as pl import torch from sklearn.metrics import balanced_accuracy_score from torch import nn from .arch import create_model, ARModel def step(model, loss_module, batch, use_mixup: bool): """Forward pass for non-recursive model""" x, y = batch...
b7f1e9ba888abe96c148a89e494b855609bc79eed444ecc0824fe174b3ddedfd
Python
6,389
208
import pandas as pd import numpy as np from functools import reduce from livingTree import SuperTree import os from tqdm import tqdm from collections import OrderedDict from pandas.io.json._normalize import nested_to_record def get_dmax(path): with pd.HDFStore(path) as hdf: dmax = len(hdf.keys()) #h...
2edd1f307eb219d64e728f7e5c97808c03c97a3db226cfdfddd80d6ad60ddecb
Python
6,396
156
# SPDX-License-Identifier: LGPL-3.0-or-later """Sampling probabilities shared by data formats and training backends.""" from collections.abc import ( Sequence, ) import numpy as np from deepmd.utils import random as dp_random def process_sys_probs( sys_probs: Sequence[float], nbatch: Sequence[int] | np.nda...
3b92c9dcf38f46d058ade309568b3cd7b1f170441829f7861219cc2042e17bea
Python
6,397
151
# 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...
fac69d04e21590f6a00028aa1fc481ba6ca4080b30e90f1c1b6432f199729abb
Python
6,398
171
# 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...
80a206eb8bce19ab415fd68f4171d5059cd960d6305d2f9d9f92561f798810eb
Python
6,401
171
import numpy as np from sklearn.linear_model import LinearRegression from scipy.linalg import expm as matrix_exponential from scipy.spatial.distance import pdist, squareform from sklearn.gaussian_process import GaussianProcessRegressor as GPR from sklearn.preprocessing import PolynomialFeatures import logging class g...
c3b564d92e01472697df6b44b76432976995d887c8cd2e5b49b1531bc8cfbb7e
Python
6,402
200
# @requirements: # pip3 install --upgrade pip # pip3 install pyedflib # pip3 install -U wxPython # @description # Tool for (1) identifying all unique .edf channel names in a specified directory and # (2) creating categories to group like channels for processing in a pipeline. # Creates json file for with fields named b...
f8143456417a83df9ceca2c994c43efd555583615abaf2bc1681e70c2c2fe292
Python
6,402
278
# -*- coding: utf-8 -*- """ Created on Wed Oct 26 13:51:51 2022 @author: M. Agustina Frechou """ ''' Bootstrapping code and preprocessing to analyze tuning data ''' import os import glob import scipy.io import numpy as np import random from random import choices import csv #%% ''' Functions ''' def get_fi(fil...
85120f2c63ded2761f28ae6344cbfe8838ac2e686e6636c97a097677d0499f26
Python
6,404
200
import os import os.path from neuron import h import numpy as np import scipy import scipy.integrate import scipy.stats from .protocol import Protocol try: import pyqtgraph as pg HAVE_PG = True except ImportError: HAVE_PG = False from ..util import custom_init from ..util.stim import make_pulse #import ...
b00115943a8b381c2650d40833854527ebf9f2e12a20cc1114e117bb30a2ca3d
Python
6,405
178
#!/usr/bin/env python3 from pathlib import Path import rdflib from pyontutils.core import Ont, OntGraph from pyontutils.config import auth from pyontutils.sheets import Sheet from pyontutils.namespaces import owl, rdf, rdfs, ilxtr, NIFRID, OntCuries, skos, makeNamespaces from neurondm import OntTerm, OntId from neuron...
5964b64818f2f4a7a8635f5ba1759a8cb7375e4d1c99914f16c9f3a3c34e40c3
Python
6,406
152
# Definition of # 3D UNet # Author: Zhe Liu (zl376@cornell.edu) # Modified by: Jinwei Zhang (jz853@cornell.edu) # Date: 2018-08-27 from keras import backend as K from keras.layers import Activation from keras.layers import Input from keras.layers import BatchNormalization from keras.layers import MaxPooling3D from k...
23ac917e2ecbd5fcd9fe0d6dca2dfacfbe4f051ff9c31c036910ecd574232b0f
Python
6,408
190
# This is meant to be run in Jupyter or IPython in combination with whole.py # It assumes an X and y and various models import shap #background = shap.maskers.Independent(test_features,max_samples=100) #explainer = shap.Explainer(rf,background) language_map = {'LowpH': 'Lowest pH', 'HighpH': 'Highest pH', 'H...
bc585ca0fa251e9b73c63b66d7742d8d98d0c2775c1369b3264014eb3b3b7381
Python
6,412
187
""" ======== numpydoc ======== Sphinx extension that handles docstrings in the Numpy standard format. [1] It will: - Convert Parameters etc. sections to field lists. - Convert See Also section to a See also entry. - Renumber references. - Extract the signature from the docstring, if it can't be determined otherwise....
49d6859647c4ec9cf6dd6104c4d4a2c8460fc78c388566a3df76a919259654af
Python
6,413
196
# SPDX-License-Identifier: LGPL-3.0-or-later """Shared training-data helpers for backend entrypoints.""" from __future__ import ( annotations, ) import inspect from dataclasses import ( dataclass, ) from typing import ( TYPE_CHECKING, Any, ) from deepmd.utils.data import ( DataRequirementItem, ...
c04722fe048ed6606fdf196c252417cda7c64e9cb2a73d2703c60b0ddb76006b
Python
6,415
190
# 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...
409fd6090c72cd52f649395f5376eedccccde52d8bc3fca2b083039c182e6c16
Python
6,416
185
# Copyright (c) OpenMMLab. All rights reserved. import codecs import os import os.path as osp import numpy as np import torch import torch.distributed as dist from mmcv.runner import get_dist_info, master_only from .base_dataset import BaseDataset from .builder import DATASETS from .utils import download_and_extract_...
d34ec10d74d57e4d652fe985ea2a737e399a652b26df5c1f3f9fdc137ec99574
Python
6,416
184
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set() import json from cplAE_TE.utils.load_helpers import get_paths def get_spc_names_v2(): """Parse sparse pc names from .json generated by Nathan, for revised dataset in Gouwens et al. 2020. Returns: ...
5875bfdaabdeb257c4120c90b2b4093281ccf7093df64a3ba6ddda949490bd61
Python
6,419
170
"""Tests for feature importances in time series forests.""" import numpy as np import pytest from sklearn.base import clone from sklearn.pipeline import FeatureUnion, Pipeline from sklearn.preprocessing import FunctionTransformer from sklearn.tree import DecisionTreeClassifier from sktime.classification.ensemble._cts...
a537e48952aa7c1583819163342b8c224a1ca9f57817e2b5215c8fca941d9952
Python
6,423
173
#!/usr/bin/env python3 """Find dead ids in an ontology and raise them to be owl:Classes again. Also build a list of classes that may be banished to the shadow realm of oboInOwl:hasAlternativeId in the near future. Usage: necromancy [options] <file-or-url>... Options: -h --help print this -v --verbos...
eb3641636afd05fba0b4b732cdebccbc037155bb6fca329704f47bbae4372154
Python
6,424
203
# -*-coding:utf-8-*- # from __future__ import absolute_import import torch.nn as nn import torch.nn.functional as F import math def conv1x1 (in_planes, out_planes, stride=1): return nn.Conv1d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) def conv1x3 (in_planes, out_planes, stride=1): re...
73911839d9190cb7da2e3f54802f101f64a398e92d82fc7f0028b30316358a28
Python
6,425
154
""" Processing Tools for all datasets. """ import os,json,pdb,argparse import os.path as osp import numpy as np from PIL import Image import torch def CommonLoad(args, dataset, label_id_dict): data,label = [],[] THE_PATH = osp.join(args.dataset_dir, dataset) this_folder = osp.join(THE_PATH, 'membranes') ...
87032407bfce04efa689d1a1b707bd5c5b1ea478b7c8ad372b94d49706e1a3e0
Python
6,426
274
# SPDX-License-Identifier: LGPL-3.0-or-later import glob import json import os import platform import shutil import warnings from hashlib import ( sha1, ) from pathlib import ( Path, ) from typing import ( TYPE_CHECKING, Any, TypeVar, get_args, ) try: from typing import Literal # python >=...
77a6e43a8a5ffbf57d2c2f41399b8b2fcfd8616c53bb281a597982b23953f2b7
Python
6,427
160
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 28 14:39:11 2020 @author: user """ from functional.plot_functions_CLEANED import * import matplotlib.pyplot as plt """ Tracker class """ class tracker(): def __init__(self, batch_size, test_size, mean_arr, std_arr, idx_train, idx_valid, d...
9c79fa254eb251751ec66130eb1c75b43e6a1490c22369820e51c1c140dee1e1
Python
6,428
186
# 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...
6488cbf454018e43c302bdb89a387209f2af7d5efaa5751ab05cf893476bb213
Python
6,436
195
# 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...
7524e420142a71d0bf4a32486f067ccb27a12542c4ac2aa7093c6418e84052a1
Python
6,437
175
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.backbones import MobileNetV3 from mmcls.models.utils import InvertedResidual def is_norm(modules): """Check if is one of the norms....
c8f3b910193195a2a9a19ac21c6056dbcf9857ea54d9d5ac4d29d37d0052fd06
Python
6,437
268
#!/usr/bin/env python __doc__ = """ Symmetric 3d U-Net implemented in PyTorch (Optional) Factorized 3D convolution Extra residual connections Nicholas Turner <nturner@cs.princeton.edu>, 2017 Based on an architecture by Kisuk Lee <kisuklee@mit.edu>, 2017 """ import torch from torch import nn from torch.nn import fun...
f8a978f6039f4eccde2ce10589d6100f7decebeddbd8650ea720a4870aed12cf
Python
6,439
210
import torch from torch import nn from lgn.cg_lib import CGDict class CGModule(nn.Module): """ Clebsch-Gordan module. This functions identically to a normal PyTorch nn.Module, except for it adds the ability to specify a Clebsch-Gordan dictionary, and has additional tracking behavior set up to all...
13f205789f82921740463f3f9bfc2413d458864e319ccb88160b1605c6b7fae5
Python
6,440
211
import torch from torch import nn from lgn.cg_lib import CGDict class CGModule(nn.Module): """ Clebsch-Gordan module. This functions identically to a normal PyTorch nn.Module, except for it adds the ability to specify a Clebsch-Gordan dictionary, and has additional tracking behavior set up to all...