sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3d9a52a56cc41afdbe34112ab93b730a0fdf8f16180816b8c6385934de033df7
Python
4,037
115
import os import numpy as np import torch from sklearn.utils import shuffle def normalization(data, test_data=None): for feature_index in range(data.shape[2]): mean_values = np.mean(data[:, :, feature_index]) var_values = np.var(data[:, :, feature_index]) data[:, :, feature...
5a1e64b75a352f63bdd220eed8567d52ff009418c11c40b3dd19c6c8d70c8853
Python
4,039
108
import pytest import pathlib import hashlib import numpy as np from pciSeq.src.core.main import VarBayes from pciSeq.app import parse_args, stage_data from pciSeq.src.validation.config_manager import ConfigManager from pciSeq.src.validation.input_validation import InputValidator from constants import EXPECTED_AREA_METR...
b2ac524c72408f0ffecdd814b32568c7d568d38511ba2106ba17e73055fa55cd
Python
4,041
121
# 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 gather_nd_impl( data: np.ndarray, indices: np.ndarray, batch_dims: i...
de2cae3a8075711333dc030e5909cd23ef731a24e78e0cef4fa693b085603ba7
Python
4,042
104
"""Longest Common Subsequence similarity distance, from tslearn.""" __author__ = ["fkiraly"] from sktime.dists_kernels.base import BasePairwiseTransformerPanel from sktime.dists_kernels.base.adapters import _TslearnPwTrafoAdapter class LcssTslearn(_TslearnPwTrafoAdapter, BasePairwiseTransformerPanel): """Longes...
f10d794ae085d4bd264b34b788d84e881908dfa7f07d56d13ab724b57c161059
Python
4,042
98
import numpy as np import os import torch from tqdm import tqdm from atom3d.util.transforms import prot_graph_transform, PairedGraphTransform from atom3d.datasets import LMDBDataset from torch_geometric.data import Data, Dataset, Batch from torch.utils.data import DataLoader import atom3d.util.graph as gr class G...
e00f4acfefe36d264d20e76a6a26ab836cac50e5026c41d4aa7e4fb8f7f64c12
Python
4,046
109
import shutil import os import pyvips import logging stage_image_logger = logging.getLogger(__name__) def split_image(im): # DEPRECATED to be removed ''' you can just do: im.dzsave('./out', suffix='.tif', skip_blanks=-1, background=0, depth='one', overlap=0, tile_size=2000, layout='google') to...
517420c046d7dd4efefdc6b4d6616702c58ef578ec981a4722aaaf9c3eff2c57
Python
4,048
105
# 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...
8c822bd57a60ffc70e168fdf7454c38e3d4c9f0ed5e24a7c0fd4b6e316fa8166
Python
4,048
109
import os import dotenv as de import numpy as np import pandas as pd import torch from atom3d.datasets import LMDBDataset from atom3d.util.voxelize import dotdict, get_center, gen_rot_matrix, get_grid from torch.utils.data import DataLoader de.load_dotenv(de.find_dotenv(usecwd=True)) class CNN3D_TransformLEP(obje...
6cd3668bc9fd00c932b128e0c0a97fe8ffef7f864ef44ff918f432b95311d6ba
Python
4,050
91
""" This module parses the arguments given through the torchserve command-line. This is used by model-server at runtime. """ import argparse # noinspection PyTypeChecker class ArgParser(object): """ Argument parser for torchserve and torchserve-export commands TODO : Add readme url """ @staticm...
39927a254758cd2aad02b5272218c7da0fd17aae6be6abeb2487f506d4ab756e
Python
4,051
119
"""Tests for bycycle.features.shape.""" import pytest import numpy as np from bycycle.features.shape import * ################################################################################################### ################################################################################################### @pyte...
d7b692070f7916c250e06b6c741cb3d24fa9bbdc13b5edf267f82631ead81d3b
Python
4,051
123
import os import shutil from pathlib import Path import numpy as np from asreview.state import JSONState, HDF5State, DictState from asreview.state import open_state, state_from_asreview_file from asreview.settings import ASReviewSettings def test_read_json_state(tmpdir): state_fp = Path("tests", "state_files",...
02982235d1bd633d9064eb9d1ba53adbad8b38c91af32840837b77d93e757b0f
Python
4,052
108
import data_adapter import numpy as np from scipy import io as sio from tensorpac import Pac, EventRelatedPac, PreferredPhase from tensorpac.utils import PeakLockedTF, PSD, ITC, BinAmplitude import matplotlib.pyplot as plt import time from multiprocessing import Pool import signal_tools import argparse def erpac(x,ch,...
6afdfa748bd7a941d2f63d3ce1eaa6d1129ab368f4dde5afa22fa5904663312d
Python
4,055
119
# 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...
78d0617047b527b8d89429faa028dce9bfaa14ebe38666823395a3a823f9c55f
Python
4,056
134
import numpy as np import pandas as pd import pytest from numpy.testing import assert_array_equal from seaborn._core.groupby import GroupBy @pytest.fixture def df(): return pd.DataFrame( columns=["a", "b", "x", "y"], data=[ ["a", "g", 1, .2], ["b", "h", 3, .5], ...
99f07303e9f2e400d79c8413856d5d282b9f6b0a68157d9e6e713c102ea75529
Python
4,056
110
# 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 # # ...
bca6a4af05bfe1c26ac67a97fc4fed934bd050edeb0f8a860a27788f23cd25c4
Python
4,056
104
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 29 15:46:05 2020 @author: sam """ import os import argparse from pipeline_utils import submit_job from pipeline_utils import check_filedeps import configparser as ConfigParser import glob import h5py import numpy as np if __name__ == '__main__': ...
4f2d7827b5424112b83f83f8d2578fde36e46bfdb356e1382e98eb9b078274d1
Python
4,058
120
import torch import torch.nn as nn import torch.nn.functional as F from utils.func import one_hot from utils.const import regression_loss class WarpedLoss(): def __init__(self, loss_function, criterion): self.loss_function = loss_function self.criterion = criterion self.squeeze = True if...
1d280a097deddcfb14203d51a30800ace620545aa7c709bd1fa126a5bdc1f552
Python
4,061
123
# 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...
a8a6c223c2a296eb3a9be883303da6b93c76c936a16e83b52f69f6e4a04d6c73
Python
4,061
129
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...
daabbc97ba3f9d75e610d31ab29b70bf6557167aed5e6385150eccbd3a472121
Python
4,061
112
import sys import socket import struct import numpy as np from datetime import datetime, timedelta from functools import reduce import random from math import pi, sin from time import sleep from parameterSetup import ParameterSetup # sends mock signal to online.py by connectin to networkServer args = sys...
e2d034f7bb26ed448909a3687649a5c05914793048d215a77e74f9d67d7eeb0e
Python
4,061
131
# 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...
e1edf2dce41c797d039d72beb73cef2d8f229a897c26f4cfd36965899f1a068a
Python
4,063
119
import numpy as np import pandas as pd import statsmodels.api as sm from features import * def get_model(promoter='u6', classifier=False, path='../Saved models/CRISPRedict'): ''' Loads the appropriate model for the chosen task. :parameter promoter: gRNA transcription method to load the suitable model ('u6', 't...
0ff59e00b7bfe5f8f2b22b523845a6743bd4d23ebbf0fb6dfda95c9aad19e924
Python
4,064
104
import face_recognition import cv2 import numpy as np # This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the # other example, but it includes some basic performance tweaks to make things run a lot faster: # 1. Process each video frame at 1/4 resolution (t...
a8662eaa20a2479e3e96b1bd24ef9f9853d4067f42da936f30448c84b1087901
Python
4,064
95
import os from os import path from lfads_tf2.defaults import get_cfg_defaults from lfads_tf2.tuples import BatchInput from lfads_tf2.utils import unflatten from ray import tune from yacs.config import CfgNode as CN def create_trainable_class(epochs_per_generation=50): """Creates a tuneLFADS class with specified ...
b1d502dd92d9e6a9d7547c8bde0ba029dbe3f7f534e598836323006779edabf0
Python
4,064
129
# 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 tensorflow as tf class CalibrationLayer(tf.keras.layers.Layer): ""...
5fbdbd882cab2dc54bcc1658a62c506d6d70ca224aafcccbb12c92adb62b5f1d
Python
4,065
113
# 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...
dee57dd9ba9c38de4a44f8f6869355570f8de55eded4a8821a764fca34dfa550
Python
4,066
98
# 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...
687d4b77895ee3f7fb8dba50d7e0bb955e2263a165f2ec7d2fd1f364673ca05e
Python
4,067
119
# ---------------------------------------------------------------------------- # 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. # ------------------------------------------------...
44eb6cca239f2ffa828c70d9fe2e929251a646d14381a017ee188fbd3f8f811f
Python
4,068
95
import itertools import random import numpy as np import pandas as pd from lee_et_al_2023.src import base def center_model(model): """Center a model.""" new_model = model.copy() all_ratings = new_model[base.MONELL_CLASS_LIST].values bias = np.mean(all_ratings, axis=0) new_model[base.MONELL_CLASS_...
28a0c3da80da130bf9ecb6b6ce15ec5ac32ede6f318138cbd59180c683c57867
Python
4,069
131
# SPDX-License-Identifier: LGPL-3.0-or-later """Testing of models predicting charge density on grid points.""" from deepmd.infer.model_test.base import ( ChunkContext, ModelTester, _write_per_frame_details, ) from deepmd.utils.data import ( DeepmdData, ) from deepmd.utils.eval_metrics import ( mae,...
c1a5ba5ed3b6290e73ed81f2ae83f71b77b2eb172eb771995c4de3794f6826cc
Python
4,069
139
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmcv.utils.parrots_wrapper import _BatchNorm from mmcls.models.backbones import VGG def check_norm_state(modules, train_state): """Check if norm layer is in correct train state.""" for mod in modules: if isinstance(mod, _...
62770a004dbe0d7ee117d6f0b818bb71167735cae7cff002f0bd06b593d55d65
Python
4,071
116
def _add_axis_arrows(ax, dims=None, origin=None, azim=0, elev=0, **kwargs): """ Plots arrows to show the 3d Axis. Parameters --------------------- ax : matplotlib ax dims : list, string LR, AP, SI, 'all', None origin : list (len of 3) Origin of center of arrow axes. ...
ee74aa1d30c8e2146fbd1f988aae5ef5d919c3ce4f6ac635978cc52615a208a7
Python
4,074
137
from __future__ import annotations import functools import textwrap from typing import Any from typing import TYPE_CHECKING from typing import TypeVar import warnings from optuna._warnings import optuna_warn from optuna.exceptions import ExperimentalWarning if TYPE_CHECKING: from collections.abc import Callable...
46a849cca62a3368a7d9706fd096c88bcd62967d990145918593d48a955667bc
Python
4,075
114
import torch from torch.utils.data.sampler import Sampler class WarmupLRScheduler(): def __init__(self, optimizer, warmup_epochs, initial_lr): self.epoch = 0 self.optimizer = optimizer self.warmup_epochs = warmup_epochs self.initial_lr = initial_lr def step(self): if s...
f8cf6f8ba7c7d27c2f02cbf922301c724e0a4e0c69672b1e2f1663ec2579f440
Python
4,075
137
import numpy as np import pandas as pd import statsmodels.api as sm from features import * def get_training_data(promoter='u6', classifier=False, add_constant=True, path='../Data/2. Training datasets'): ''' Loads training dataset for the corresponding model. :parameter promoter: gRNA transcription method to co...
b5cd8dd3474711ff44173a94e1fb8cc2b9aaae91645ed135f6f0e321e7b2a6f4
Python
4,076
99
import pytest import flair.datasets from flair.data import Sentence from flair.embeddings import DocumentRNNEmbeddings, FlairEmbeddings, WordEmbeddings from flair.models import TextClassifier from flair.samplers import ImbalancedClassificationDatasetSampler from flair.trainers import ModelTrainer from tests.model_test...
ecd59f5e577d07baac589b76016944c516a7fbedf16471847ddc2ece9d2a3126
Python
4,078
105
# Copyright 2018-2023 # 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...
cb5dc005b5cff1d62d56112eddd659be9ce382a384ebf0eca068ea6048bde6bf
Python
4,081
126
# 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...
826989da89c8e2191085d60ceb0203a0093cc6b7e0f37aca2bdbbf61c08ea0f5
Python
4,084
181
"""Tests for time series k-means.""" import numpy as np import pytest from sklearn import metrics from sktime.clustering.k_means import TimeSeriesKMeans from sktime.datasets import load_basic_motions from sktime.tests.test_switch import run_test_for_class expected_results = { "mean": [ 2, 2, ...
96c3aff48723e4d3f87f0d8ec480195f534178c9c99980d4c3e2501bcadf90e8
Python
4,084
117
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os from collections import OrderedDict import torch def get_layer_maps(layer_num, with_bn): layer_maps = {'conv': {}, 'bn': {}} if with_bn: if layer_num == 11: layer_idxs = [0, 4, 8, 11, 15, 18, 22, 25] elif la...
a48ea2bdfb02464aeed9eb7407021833fd2442f9cd8b239577c8c10e7f8847e7
Python
4,086
112
# 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...
d157cc336a279bd8f3ad4c840c047e54a371e9658d5251ecd4b5fd79cfb78984
Python
4,086
114
""" Define some data structures that are used in multiple analysis locations """ from dataclasses import dataclass, field import numpy as np def def_empty_np(): return np.array(0) def def_empty_list(): return [] def def_empty_dict(): return {} @dataclass() class PData: """ data class for some ...
06228f5507a672d23776693883eeaeb93aa580636090a8385f5f2dd5e6faac57
Python
4,087
116
# Copyright 2018-2026 # 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...
f590f6887ad731f622abfec8f78e422e602ad32d902071f10f2330878886bf34
Python
4,087
114
# 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...
907cc4ac435c90b3f67b3421be5ad252ee3a27a8b29c7855f276c1abf391afcc
Python
4,089
123
# 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...
46060106b78bb110638e3d61ae80dfb39127b28fb41f89470ddd7c81dd78270a
Python
4,093
139
"""Tests for E-Agglo (agglomerative clustering algorithm).""" __author__ = ["KatieBuc"] import numpy as np import pandas as pd import pytest from sktime.detection.eagglo import EAgglo from sktime.tests.test_switch import run_test_for_class @pytest.mark.skipif( not run_test_for_class(EAgglo), reason="run te...
6c84d4f7c4c62196b1d7ded5b315621fd2aceff43119809f982fe13391c0a5f3
Python
4,094
127
import math import torch.nn as nn def default_conv(in_channels, out_channels, kernel_size, bias=True): return nn.Conv2d( in_channels, out_channels, kernel_size, padding=(kernel_size//2), bias=bias) class Upsampler(nn.Sequential): def __init__(self, conv, scale, n_feat, bn=False, act=False, b...
92aa195cd59c45bcc59d0751ecb1134560a11d492073992520ca91cf0a922f51
Python
4,096
120
#!/usr/bin/env python3 #!/usr/bin/env pypy3 """Set qnames based on the curies defined for a given ontology. Usage: qnamefix [options] qnamefix [options] (-x <prefix>)... qnamefix [options] <file>... qnamefix [options] (-x <prefix>)... <file>... Options: -h --help print this -k --keep ...
a043b8cea9e7015fc07aadfb281be3a23ddac5a1f8bf15750ddea84dc62dfc2b
Python
4,101
139
""" A simple module to allow tracking and timing of calls using decorators. This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (Spirou, Manis, Ellisman), DC R01 DC004551 (Manis, 2013-2019, Early development) DC R01 DC019053 (Manis, 2020-2025, Later development) Copyright 2017-2...
f649e29d122b470865fc7d350deedf15c522a474d00eda4bbf57276a0a2cf12d
Python
4,102
166
#%% [markdown] # # Matching when including the contralateral connections #%% [markdown] # ## Preliminaries #%% import datetime import os import time from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from giskard.plot import adjplot, matched_stripplot,...
01ee6cae9715d9aef6a1e25a63004f1cf5120f83f7b314af8035ee7e5090ba29
Python
4,104
109
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl from onnx.reference.ops.aionnxml.op_tree_ensemble_helper import TreeEnsemble class TreeEnsembleRegressor(OpRun...
4afb7afd41ac9f3f6f48a1b9501875e57b02cc77747c8c077c6c0b1819d2872f
Python
4,107
113
""" Test sounds and plot waveforms. This script tests the sound waveform generator for a variety of sounds """ import numpy as np import pyqtgraph as pg from cnmodel.util import sound from collections import OrderedDict import scipy.signal import sys try: import PySounds HAVE_PYSOUNDS = True except ImportErro...
b5bff261c6fc0ba73a473e68312b1dd139c83cb85dc02daa24dae9fb7a3ccf46
Python
4,108
136
import matplotlib.pyplot as plt import numpy as np from brian2 import * # import matplotlib.pyplot as plt import time import pickle import brian2cuda set_device("cuda_standalone", build_on_run=False) """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
78863288b3f41e63f795245cac5b29eea4530e2899272b798fae83b654d740c2
Python
4,112
149
# 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...
8b7cb650a55f1d5d3658365137c6c3dd740527a40acfef98307ebe6142fa50d4
Python
4,112
120
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains from sciunit.models import RunnableModel from networkunit.plots.rasterplot import rasterplot from neo.core import SpikeTrain from copy import copy import numpy as np import neo class loaded_spiketrains(RunnableModel, ProducesSpikeTrains): ...
92aad5060a2ea8a66864ec74106bdc35db88702b358e4ab3cd253871a4f753fb
Python
4,113
124
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import pytest from onnx.reference.ops._op_list import load_op from onnx.reference.ops.op_attention import _compute_attention def test_attention_reference_uses_versioned_implementati...
4e154b7ec8fc5621a3f3ecb638ec33fb5a90d8b6a08dd2f7d06289d057e79145
Python
4,116
121
from __future__ import print_function import numpy as np from .augment import Augment, Compose from .perturb import Perturb class Section(Augment): """Perturb random sections in a training sample. Args: perturb (``Perturb``): ``Perturb`` class. maxsec (int): prob (float, optional): ...
251abc8b1aff61a5f18d317a947a04e9c6165732064960cb385ef7af2e26c694
Python
4,117
110
__all__ = ['import_features', 'get_data'] from collections.abc import Iterable from pathlib import Path from traceback import print_exc import nibabel import numpy as np from graynet import config_graynet as cfg _base_feature_list = ['thickness', 'curv', 'sulc', 'area', 'area.pial', 'jacobian_...
1fc010fd78b591ad10d33899e6c67dcc1915e54892ada0fda4addb2945ef82f2
Python
4,119
172
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### This is using Keras for Keras" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from keras import layers, models" ] }, { "cell_type": "markdown", "...
d2d18f2c3811e8e9033c0d9ad9b42f5f89f65979da1db7d602c80fd5ad5f4035
Python
4,120
115
# 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...
7fa70da7555e1d7f0d2114bdcf66dce608b2f733e903fb12a759eec61732a0c9
Python
4,124
135
""" Context object of incoming request """ class Context(object): """ Context stores model relevant worker information Some fixed during load times and some """ def __init__(self, model_name, model_dir, manifest, batch_size, gpu, mms_version): self.model_name = model_name self.m...
aece97737431759b703eaca5adffe2c96d73a3ca0c8d726c26a997cb62d19462
Python
4,125
111
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file) """Base class for data types.""" __author__ = ["fkiraly"] from sktime.datatypes._base import BaseDatatype class ScitypePanel(BaseDatatype): r"""Panel data type. Represents a panel (flat collection) of time series. The ``Panel`` data typ...
c69c8c3077f4cecdcdf11bd08e36e0bc269dcb1999bff72091a1adfdfdd84f0c
Python
4,125
119
"""Test the distance calculations are correct. Compare the distance calculations on the 1D and 2D (d,m) format input against the results generated with tsml, in distances.tests.TestDistances. """ __author__ = ["chrisholder", "TonyBagnall", "fkiraly"] import pytest from numpy.testing import assert_almost_equal from s...
f14810d2370b56c7f9b477ffa7a75de7485787d8591d1bde4fe263e3b2a20776
Python
4,128
151
# 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 StringSplit(Base): @staticmethod def export_basic() -> None: ...
3fe7206d457b841e209776af488ac2ec90ad222a487149a85dd3eb7fe8ee75c9
Python
4,130
112
# 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 def topk_sorted_implementation(X, k, axis, largest): """See function `_kneighbors_reduce_func <https://github.com/scikit-learn/scikit...
1fb16c711582609879b67c7980056e7877cd27c8538eeb01bb919dafb893201d
Python
4,136
86
import logging logger = logging.getLogger('DockOnSurf') def select_stable_confs(conf_list, energy_cutoff): """From a list of atomic configurations selects the most stable ones. Given a list of ase.Atoms configurations and an energy cutoff, selects all the structures that have an energy lower than, the e...
bba98c4af534053ba36d128bb4d087faeaacbd720bddaaae91e5cf644b1646e0
Python
4,137
113
# Copyright (c) OpenMMLab. All rights reserved. import argparse from collections import OrderedDict import torch def convert_conv1(model_key, model_weight, state_dict, converted_names): if model_key.find('conv1.0') >= 0: new_key = model_key.replace('conv1.0', 'backbone.conv1.conv') else: new_...
88ef1de10921a5f77337547eec6adc1902e2b052454bdd56462c11f6e3c3f8d1
Python
4,138
115
import numpy as np import tensorflow as tf from utils import dipole_kernel from utils import dxp, dyp, dzp # #Description: #Loss function for training QSMnet and DIAM-CNN # # Copyright @ Yanqiu Feng # Laboratory for Medical Imaging and Diagnostic Technology # Southern Medical University # email: foree@163.com # def l...
08cf05647dae721a955d4ce2257c24dd2fe63ff3a9b091980d798532dd0d31ca
Python
4,141
97
from open_spiel.python.rl_environment import Environment, TimeStep, StepType class ValidActionsMaskEnvironment(Environment): def step(self, actions): """Updates the environment according to `actions` and returns a `TimeStep`. If the environment returned a `TimeStep` with `StepType.LAST` at the ...
9b4f3bd4cde4df76ebfd60f3cd1e77364e5fb2bd582f08ecd3eb045714cc694f
Python
4,141
118
import numpy as np from tensorflow import keras import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten from tensorflow.keras.layers import Convolution2D, MaxPooling2D import matplotlib.pyplot as plt from tensorflow.keras import laye...
e210cf3552af1ef91aed51203bb0c48fd3e758308f4ffb04d6bbc4db3f59949e
Python
4,142
105
# 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...
d85bc046ace6174bde21abeefb49f0fdd525570cf009b51c56d9ec54761566cf
Python
4,147
89
import argparse import os from os import path from typing import Any class CheckArgs(argparse.Action): """ Check our command line arguments for validity """ def __init__(self, option_strings, dest, nargs=None, **kwargs): if nargs is not None: raise ValueError("nargs not allowed") ...
4d2bf6fc3a9085124fbe031e750ed9b61543b6d3a9967d4e204c93516dedff55
Python
4,151
130
import re import os import sys from setuptools import setup def abspath(relpath, _dir=os.path.dirname(__file__)): return os.path.join(_dir, relpath) def find_version(filename): abs_filename = abspath(filename) _version_re = re.compile(r"__version__ = ['\"](.*)['\"]") last = None # match python sema...
71e42db250c15c2907be560ec83a111d19953f808a0f2457b2e7bb7b19a7e950
Python
4,151
135
"""Tests for spatio-temporal DBSCAN.""" import numpy as np import pytest from sktime.clustering.spatio_temporal import STDBSCAN from sktime.clustering.utils.toy_data_generation._make_moving_blobs import ( make_moving_blobs, ) def _rename_labels(X, centers_origin, y_pred, n_labels): """Rename cluster labels ...
420342ca580b9e3f279425c423c6d0fccddd2e8fe1f953c8f50ef97759791afb
Python
4,152
120
#!/usr/bin/env python # # Copyright 2008, Google Inc. # 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 source code must retain the above copyright # notice, this list...
bd0b55b559184e652b534f7d72970be1093c8e106dc854ba5a7dbd6f6f13c1c8
Python
4,152
115
# -*- coding: utf-8 -*- # # Copyright © 2023 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://www.mozilla.org/MPL/2.0/. # import glob import logging import os from ..in...
54fa3f33785cac827cc37bd641239bc41024bb7a5a1484339c89cde6c61630c0
Python
4,153
83
"""Functions for RATA analysis""" from pathlib import Path import IPython.display import pandas as pd import seaborn as sns DATA_PATH = Path(__file__).parent.parent / 'data' FIGURE_PATH = Path(__file__).parent.parent / 'figures' ODOR_LABEL_LIST = [ u'alcoholic', u'aldehydic', u'alliaceous', u'almond', u'amber', u'...
836795236f90180fb014a52bb2381ace8522118195cc59d0b7e8c90a1a3e204b
Python
4,153
116
# Copyright (c) OpenMMLab. All rights reserved. import argparse import warnings import mmcv import numpy as np from mmcv import DictAction from mmcv.parallel import MMDataParallel from mmcls.apis import single_gpu_test from mmcls.core.export import ONNXRuntimeClassifier, TensorRTClassifier from mmcls.datasets import ...
222aa7b103c6aa0a1bef7281478ae326616e2a5f1f353b45acae4a27eed45dcf
Python
4,158
107
# 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...
bc60f05f171c0adf7a00f43777b2dd245c461b5071137c787b13c8a947bbb5c0
Python
4,158
108
""" Create a network with excitatory, inhibitory, and modulatory connections. Add input sources and output monitors, and simulate using numpy. William Nourse December 1st, 2021 """ """Imports""" # Import packages and modules for designing the network from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.co...
9f7913f8329444e778d9b44ff394f2130d60d64ce350fd400967c192f6a15c52
Python
4,160
71
""" @file: run_cutechess_experiments Created on 03.10.2023 @project: CrazyAra @author: Felix Executes cutechess commands in the shell """ import subprocess from datetime import datetime device = 0 player_a = "correct_phases" player_b = "no_phases" batch_size_options = [64] use960 = False movetime_options = [100, 20...
e64d9424f93e9f7ed789b86d26f20e72b6453a4f89af4447e532e54a7398d570
Python
4,161
120
# 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...
5cff9f2e528db5ec5bdc2e3c925887230b1c4ca5249836ed370b4d345d457d4e
Python
4,162
105
""" multi_run does multiple runs with the models OBSELETE 3/2020 """ from __future__ import print_function import os.path import model_run as MR import pprint import json pp = pprint.PrettyPrinter(indent=4, width=60) # create an instance of the modelrunner for each cell configuration # population the configuration ...
57bad0a81f93369d00addda76e93ca4b566faf9c906b53898fb059e69f41ab7e
Python
4,163
122
# Copyright 2022 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...
e29be5ea96015cefe898292a9d94b65d54a97d7ab8e9efe64d2e51069eb8c6ee
Python
4,166
99
import numpy as np import pytest import torch from short2long.competitive_model import CompetitiveAllocationNet, multinomial_nll_terms, unsmoothed_cluster_targets GROUPS = np.array([0, 0, 1, 1, 1]) STRUCTURES = ["g0|chr1|+|10-20", "g0|chr1|+|10-30", "g1|chr2|-|40-60", "g1|chr2|-|40-80", "g1|chr2|-|50-9...
09cc0dac126bd31a0d106926f76926aa412355c037fee33248fd6bf8c5803b28
Python
4,167
110
"""This is the template script for running PBT with lfads_tf2. Please copy and modify this script to suit your needs. """ import shutil from os import path import ray import yaml from lfads_tf2.defaults import DEFAULT_CONFIG_DIR from lfads_tf2.utils import flatten from ray import tune from tune_tf2.models import crea...
c2e4cfcbbf95413dbdc8d783054776f976750177a0e94d279f988f17e19f0efc
Python
4,168
133
import numpy as np import pandas as pd import logomaker import matplotlib.pyplot as plt # MOANA (MOtif ANAlysis) def activation_pwm(fmap, X, threshold=0.5, window=20): # Set the left and right window sizes window_left = int(window/2) window_right = window - window_left N, L, A = X.shape # assume thi...
380e6f970febe4406fdd1b4026fd9d7ccc7d7aed37cf67de21194a1956a625cc
Python
4,170
111
# 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 agreed to in writing, software # distributed under t...
dd1e829e5a453503cf8aa8db91e5307bfc5afa6df777f13cac2f89a5dde4eac1
Python
4,172
90
import functools import torch import torch.nn as nn import torch.nn.functional as F import models.modules.module_util as mutil class ResidualDenseBlock_5C(nn.Module): def __init__(self, nf=64, gc=32, bias=True): '''def __init__(self, nc, kernel_size=3, gc=32, stride=1, bias=True, pad_type='zero', \ ...
15947c58bf3f312ab4cdf6410edbf2e73be5664059d04f27a7052eef8a8fa446
Python
4,175
119
# 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...
72b91e7ff448a68ffe58e6436c2cc0a798628da8230047d1c072019a79fdc396
Python
4,176
103
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import math import numpy as np from onnx.reference.op_run import OpRun class MaxUnpool(OpRun): def _run( self, X, indices, output_shape=None, kernel_shape=None, pads=None, strides=None ...
6ba35048061256611fb849d45836d2da58fdb70252e7cf995dcf1ee3ea2eb690
Python
4,177
115
#!/usr/bin/env python import pandas as pd import numpy as np import os import shutil import sys # Analyze the Orthofinder results OGTSVPATH="./fasta/OrthoFinder/Results_Jul02/Orthogroups/Orthogroups.tsv" sp_to_chrom = { "CFR": "../../genomes/for_odp/creolimax/CFR.chrom", "CLA": "../../genomes/for_odp/cladorhi...
17789aaff8022a3a6221199d48e367f0c5b5fad7f4c2388f10076bec9a5aeb54
Python
4,180
95
import logging import os import re from base.processor_base import Processor from onmt.bin.preprocess import preprocess as onmt_preprocess from rdkit import Chem from typing import Dict, List def smi_tokenizer(smi: str): """Tokenize a SMILES molecule or reaction, adapted from https://github.com/pschwllr/Molecular...
069fea93c90dbdefd89f024ec48fcf5717adc4610e281510cc058e0ba431b66e
Python
4,181
126
# 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...
10cb774c53d2029e9e9be4d5acb2a49ffbd8c9a344badb38778b3063516a6696
Python
4,181
123
#!/usr/bin/env python """ Script: run_dataset_splitting.py Description: CLI for balanced dataset splitting via Monte Carlo permutation search. Reads a CSV file with one row per subject, runs permutation_balanced_splits, and writes the same CSV with an added 'fold' column (0-indexe...
144928866eb88a69d942b57ccb10a79067a0f98ca7b499f9c2caa05c77e23b86
Python
4,181
118
# -*- coding: utf-8 -*- # # Copyright © 2013 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://www.mozilla.org/MPL/2.0/. # import logging import os from ..interfaces imp...
1b1353555c1ef33da17c1f59eb0ee68a1a62f923c9541127a1169b1c035cdd91
Python
4,183
152
import matplotlib.pyplot as plt import mcubes import nibabel as nib import numpy as np from scipy.ndimage import label from skimage import measure import os def marching_cubes(res, name='vessel', level=1, spacing=(0.3, 0.3, 0.3), gradient_direction='descent', offset=0): verts, faces, normals, values = measure.mar...
b67813a8936744321c5aaa1e3173c33458b8b65d7399e885f9491e84349d6a26
Python
4,184
136
# -*- coding: utf-8 -*- """ Created on Fri Jan 24 15:14:41 2020 @author: daniel """ from mpi4py import MPI import d1msn as msn import plasticity_experiment as pe import parameters as pp import numpy as np import pickle import json import scipy.signal as ss import sys comm = MPI.COMM_WORLD rank = comm.Get_rank() npr...
6715b4eeb4faa1c78eebff1dec349beb61cf3bec451b6bb14618d0a2444ce078
Python
4,185
103
import os.path as osp import logging import time import argparse from collections import OrderedDict import options.options as option import utils.util as util from data.util import bgr2ycbcr from data import create_dataset, create_dataloader from models import create_model #### options parser = argparse.ArgumentPars...
7f96f56c0e29e02fc2227209155b4645f0245bcb3192d8adf5a10a182ed13feb
Python
4,187
141
#!/usr/bin/env python import click from functools import partial from multiprocessing import Pool import numpy as np import os import pandas as pd import pickle from pybedtools import BedTool from pybedtools.helpers import cleanup import re import subprocess as sp from tqdm import tqdm import warnings warnings.filterw...