sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0a83a080d8336f4794f7171ba140d0f047892889cd3ea48f93a11b58b2987ffc
Python
3,029
89
# 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...
2b73bcdf8b0bffc3578469b90c218e703580228f4f9ae909a29fbb808ba07b82
Python
3,029
89
# SPDX-License-Identifier: LGPL-3.0-or-later """Folding the case embedding of a fitting into its first layer. The case embedding is the same block of input columns for every atom, so the fold moves its product with the first-layer weight into the bias. The folded fitting carries no case embedding and gives the outputs...
548a4c070fe41b1c6dfe2ee6251599fd36d70931b288e30f0b369664dc22624a
Python
3,030
107
# 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...
a55a7cb72f2d9ee7d43635dbf0d1a753e418b13fe4d01485ba569bd2a2f8fe55
Python
3,030
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...
332a75c01cfad7a48186da768f2f5d8e17dbd8769d9c5e8870d2325c30a95238
Python
3,031
110
# 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...
fbf9a56d804e3bb39d03994a38e67557e447dc25f28b74822c7553bde702ba8a
Python
3,033
78
from __future__ import division import mkl mkl.set_num_threads(1) import sys import numpy as np from SPHARM.lib import spharm import SPHARM.lib.parallel as prl from SPHARM.lib import plotting as plt import SPHARM.lib.segmentation as sgm import SPHARM.lib.vrml_parse as vr ################################# args = sy...
07d64982daa86bd13570b41f14c853c7aa1c7ef720b58497e1ae170d6c24999a
Python
3,036
80
# 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...
70fa68ed4bf022e329d2d079d1cc49eb036f67b5b537a958d1c5104ed29b9455
Python
3,036
90
#------------------------------------------------------------------------------- # elftools: dwarf/abbrevtable.py # # DWARF abbreviation table # # Eli Bendersky (eliben@gmail.com) # This code is in the public domain #------------------------------------------------------------------------------- from __future__ import ...
55b1c6617d371a21af53c0f8a8ad175962796a70548713931588cbe7ab6fa559
Python
3,037
76
# 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...
b229dfea2b27ff7fe1e2676ac4821626da41807ec2187f95b8047962c9008bfe
Python
3,037
54
# aggregating the main steps of ontology-based and weakly supervised rare disease identification from clincal notes # ruuning step1 requires SemEHR-processed output from subprocess import Popen, STDOUT import argparse import time start_time = time.time() parser = argparse.ArgumentParser(description="an implement...
754ebac2f4f1cea518fb852ab2f1213ef719cf0cfef004e7ddfd0c6faf646db8
Python
3,038
90
"""Global Alignment Kernel from tslearn.""" __author__ = ["fkiraly"] from sktime.dists_kernels.base import BasePairwiseTransformerPanel from sktime.dists_kernels.base.adapters import _TslearnPwTrafoAdapter class GAKernel(_TslearnPwTrafoAdapter, BasePairwiseTransformerPanel): r"""Global Alignment Kernel, from ts...
2d77e4914c87f0726eb1e68d5aab189f043a376290bb87fce164b4397f5918f8
Python
3,041
87
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def model_predict(model, X, label): '''Predict class for data''' y = model.predict(X) # Get resutls back to categories y = label[y] # ypA_rfrg results back to a data frame/series y = pd.Series(y) # Recover original ...
5fa4db61287d68ba6d2588c5c387f3dda036aab269f45e36404d77d34d65e48a
Python
3,041
71
from torch import nn import torch from vp_suite.base import VPModelBlock class ConvLSTM(VPModelBlock): r""" This class implements a convolutional LSTM, as introduced in Shi et al. (https://arxiv.org/abs/1506.04214) and implemented in https://github.com/Hzzone/Precipitation-Nowcasting. This is the 'origin...
4a17cc2f52957f1bfa5228cbc38cc801ae900efa31c95452a25c779c5963a9dd
Python
3,043
79
# 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...
874fdb56e533dd4a6b40f44f9b5912b89cd1991e1ca9f7c59645c99e6ee36192
Python
3,045
101
# 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 from onnx.helper import make_tensor class LabelEncoder(Base): @staticmeth...
f3cd6a77c6683ffaf62b5b8ab86eea9b70f8d4d3aa0992e8b0813ae75e18db14
Python
3,045
77
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 mpl.rcParams['ps.fonttype'] = 42 mpl.rcParams['font.family'] = 'Arial' # settings cellclass_ordered_v2 = ["Cycling Dorsal NEC", "Cycling Ventral NEC", "Cycling NE...
7a5081c5fba01bfb85c2770aae8d2f02a04f248de46a0f10013090528bc4dcc2
Python
3,046
97
from __future__ import annotations from pathlib import Path import numpy as np import pytest from jetnet.datasets import QuarkGluon from pytest import approx # TODO: use checksum for downloaded files test_file_list_withbc = [ "QG_jets_withbc_0.npz", "QG_jets_withbc_1.npz", ] test_file_list_withoutbc = [ ...
bd3f59fa6c14bce250e42f9028e02f09e4fb74afa8fed765bc8336e45a1f61d4
Python
3,046
82
import json import logging import os import urllib from pathlib import Path import numpy as np import torch.utils.data.dataloader from torch.utils.data import Dataset from tqdm import tqdm from flair.data import Corpus, DataPair, FlairDataset, Image, Sentence from flair.file_utils import cached_path log = logging.ge...
734bd3b01af3aae588c9c6b398d6e3cd73f0b5a40d2299c00f9efba426a7280f
Python
3,047
72
# 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...
07def4f0a796ea9b81f3be26be67d8141c9f98156d486a2dba4e04d8c130fbf5
Python
3,049
98
# 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 # # ...
735d9d450175d74a7363804a8393ea2f1a677915c5542bb9e1a537866cfd1301
Python
3,049
85
import os import dotenv as de import numpy as np import pandas as pd 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_TransformSMP(object): def ...
6c6e1806cc2d8f675e8507add01af53e2bc2be79c4e115b78aef0ac29d5464c3
Python
3,056
92
#!/usr/bin/env python from __future__ import print_function import sys,os import argparse import logging desc = 'Summarize PAF file generated by minimap2' epi = """DESCRIPTION: Summarize PAF file (see https://github.com/lh3/miniasm/blob/master/PAF.md) to get information such as: * chimeric contig (Supplementary align...
ac74b99e3ade43a952b22dc1a519e396fcf82dd00fd72a4af8aa7c8fbae34b69
Python
3,058
90
# 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...
ae33b9c2e1388b80d5f59b851953c14176d4315c2dfd33192e9641bb29cc152f
Python
3,058
69
import numpy as np def attribution_correction(attr_score): return attr_score - np.mean(attr_score, axis=2, keepdims=True) def cosine_similarity(x1, x2): scalar_product = np.average(np.sum(np.sum(np.multiply(x1, x2), axis=2), axis=1)/(np.sqrt(np.sum(np.sum(np.multiply(x1,x1), axis=2), axis=1)) * np.sqrt(np....
09731dada56411269726ec26c801f027107d47cc0ef63dc1517b79d53b944583
Python
3,059
106
""" Tutorial demonstrating a network with electrical synapses, both bidirectional and rectified. """ from sns_toolbox.connections import ElectricalSynapse, NonSpikingTransmissionSynapse from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.networks import Network from sns_toolbox.renderer import render im...
ad70b553197bae27ce3e6855f3af8fe7829b7dc5e609211979cf44593adf388f
Python
3,060
93
# 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...
d4b5580d7e01be0786bb1a38c24658ccee61956f5e08c5df90d3779981bcbf92
Python
3,060
78
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import torch.nn.functional as F from mmcls.utils import get_root_logger from ..builder import HEADS from .vision_transformer_head import VisionTransformerClsHead @HEADS.register_module() class DeiTClsHead(VisionTransformerClsHead): def __init...
4d1561156f04f13e91dc68eea5fa33ff4c22e9980036767dbe3401fd86addfce
Python
3,061
104
# Mocapy: A parallelized Dynamic Bayesian Network toolkit # # Copyright (C) 2004 Thomas Hamelryck # # This library is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License...
7431f9441aeefe0c37272bd5c107e32aae3bafa7f7e9e9b31fb95e2992273771
Python
3,063
86
# 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...
ddc3b9c33d8e31b2c02329b2c6654b9ad9bd93cc44884e5a3a9e3ab2bfec4d02
Python
3,064
115
""" Django settings for web project. Generated by 'django-admin startproject' using Django 4.1.5. For more information on this file, see https://docs.djangoproject.com/en/4.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.1/ref/settings/ """ from pathlib imp...
6b96aadcf77821753b987dd0a2912808b1a11167dc2defd30a101936afc85b19
Python
3,065
87
# 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...
471fa887978b2d52b820b3383c095413dd40707393b423a9ebdf2afcc0c23807
Python
3,067
88
# 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...
749ea1d9183f22d377c6941db739620e97d12ca44ac475bb8a591845aa111461
Python
3,067
112
# 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...
638ee5959b562d12c7ec7742fb38e0c36d079b8efdd0c3c1301cd8979a68d2ac
Python
3,069
84
from typing import Callable, Iterable, List, Tuple import numpy as np from sklearn.metrics import accuracy_score, f1_score from torch_geometric.data import HeteroData f_score = lambda x, y: f1_score(x, y, zero_division=1) EPS_ZERO = 1e-8 def color_agreement(color_true: List[int], color_pred: List[float], metric_f:...
9c609f5073fe9057429a7787343d8a4e0943b436fd00a32e983c0d132a658ad7
Python
3,071
94
# 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...
a51439cc612651fb4fd54e2718e17436fb6f573c4e112f6bb1770082e8090a0f
Python
3,071
107
#!/usr/bin/env python import click from functools import partial from multiprocessing import Pool import numpy as np import os import pandas as pd from sklearn.preprocessing import quantile_transform import subprocess as sp from tqdm import tqdm bar_format = "{percentage:3.0f}%|{bar:20}{r_bar}" # Globals scripts_dir ...
c90d9d723dbd3a8213351c54e4cbe6a1060e012f53f4f3b0e4b3d8c0c24cf761
Python
3,071
127
import itertools import numpy as np def ell(i, x): r = np.linspace(0, 1, 4) ind = list(set(range(4)) - set([i])) num = (x - r[ind[0]]) * (x - r[ind[1]]) * (x - r[ind[2]]) den = (r[i] - r[ind[0]]) * (r[i] - r[ind[1]]) * (r[i] - r[ind[2]]) return num / den def psi(i, x): ind = [0, 1, 2, 3] ...
530bc5b2f8ac90a8212d2e73bbf79d9e5bc7d0b22912e2d0b279425513954676
Python
3,073
92
#!/usr/bin/env python3 """ Generate a script to move files and update import iris. """ import os from IPython import embed #source locations TODO we should support arbitrary bases here and enforce subfolder namespace purity GIT_BASE = '~/git/NIF-Ontology/' GIT_FOLDER = os.path.expanduser(GIT_BASE + '.git/') with...
b1bc5707d0b61170041ca70fc25121d95a6dcc873594a89f7d3aff3f1a51fd46
Python
3,073
77
# 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...
f96a424b74bedd77372fb7e28b28dfc3b38df04f8c652bec71e817703248a1d9
Python
3,075
95
from matplotlib import pyplot as plt import numpy as np def plot_overlay(t, lfp, mantle, savename=None): fig, ax = plt.subplots(figsize=(6,4)) ax.plot(t, lfp, color="blue") ax.set_xlabel("sec") ax.set_ylabel("V") ax2 = ax.twinx() ax2.plot(t, mantle, color="orange") ax2.set_ylabel("a.u.") ...
fb608cecf8d8e9d848cb633840a2ddb3f26e3d7abd42e186fda1c20552eeb270
Python
3,078
90
# 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 # # ...
232d147652b6069a01c1dddd50755ed4e96e2d57c3b284a70e54c78a6e888d3e
Python
3,079
132
import sys import _pickle as pickle import numpy print('\n$1 NETWORK_PATH (col1: gene; col2: gene)\n$2 EXP_POOL_PATH (col 1: gene; other col: exp value)\n$3 OUT_DATA_PATH\n') NETWORK_PATH=sys.argv[1] EXP_POOL_PATH=sys.argv[2] OUT_DATA_PATH=sys.argv[3] SPLIT=':' class Person_PCC_Data: def __init__(self, EXP, POOL...
6f20554139c722f3a5fffde57ad97c377275b3c56b05d6a42e1ec6b98d39cf2c
Python
3,079
100
from __future__ import print_function """ Utility class for spawning and controlling CLI processes. See: http://stackoverflow.com/questions/375427/non-blocking-read-on-a-subprocess-pipe-in-python """ import sys, time from subprocess import PIPE, Popen from threading import Thread try: from Queue import Queue, Em...
2a513bdb0454121fd6e506cf35b9ea5f8836284c7c458671c17f52657f7df9cf
Python
3,080
97
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import Any import numpy as np class SVMAttributes: def __init__(self): self._names = [] def add(self, name: str, value: Any) -> None: if isinstance(value, list) an...
42d7c9deb2cfa747d0c802da676fe383631ae817cce4a8faf6707352c47292ae
Python
3,080
91
from __future__ import print_function import numpy as np from .augment import Augment, Blend from .perturb import Grayscale from .section import Section, PartialSection, MixedSection __all__ = ['Grayscale2D', 'Grayscale3D', 'GrayscaleMixed', 'PartialGrayscale2D', 'MixedGrayscale2D'] class Grayscale3D(Au...
6724d53656c0ef94d1d3ca775b1b3c638d9340f87c7c5e94120ae30567ceb0f7
Python
3,080
55
import argparse import sys import JH_error_list def net_param_setting(net_type, dataset): # =====================================================================================================================# # ==================================== Hyper Parameter of Network ==================================...
bcd25a7ccc37db979c48ef54c602a55c9a496ddb488d01cbcea7bff90a434b54
Python
3,080
89
# 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...
a19df9a252c4430109c11b9de24232686bc5745656069462c14caa73b4693ca1
Python
3,082
85
"""Build a tiny Hugging Face snapshot of the Tabby backbone. The release ships no checkpoints, and ``*.safetensors`` is git-ignored, so the checkpoint-loading tests generate their own sample snapshot instead of reading one from the repository. The layout produced here is the one the loaders accept in production -- a ...
b4a615c944158e70740667084349d201da80a7085f31197f5605ea9c4b1f0419
Python
3,082
99
# -*- 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 ...
f85dba90e5f4a95dd3132b1bca29255bae3aba752f86714bcb846de2e9269999
Python
3,082
87
# 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 # # ...
c128886236314e90d0215ae7c634d8b46524ce8f2f24409e58ebabd78ed48147
Python
3,083
89
#======================================================================================================================= # Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller # Computer Vision Studio # Friedrich Miescher Laboratory of the Max Planck Society # Systems Biology of Development, Univer...
93d9500d090d472a4e6d163275721431d80e6c42b3abc35ded8dafe345446932
Python
3,084
102
# 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...
98fb46970724c1e68d816eafd9601d70c9ec7143d7d36f7c0a61d333a630f1ec
Python
3,084
76
import pytest import numpy as np import pandas as pd import scanpy as sc from anndata import AnnData from pandas.testing import assert_frame_equal from palantir.utils import determine_multiscale_space def test_determine_multiscale_space_with_dict(mock_dm_res): """Test determine_multiscale_space with dictionary i...
75927cc892a1a604f698d991769e064d98165395ad6535d7e325e17f5387ccb8
Python
3,085
96
"""decoder.py""" """ Author: Yimin Yang Last revision date: Jan 18, 2022 Function: Decoder of AA_TransUNet """ import torch import torch.nn as nn class SingleConv(nn.Module): """ Double convolution block that keeps that spatial sizes the same """ def __init__(self, in_ch, out_ch, norm_layer=None): ...
78b391b92fad559d24538ce28fa4afd5cb86d9e6979ee42534f268ad08be9929
Python
3,085
64
import numpy as np import os import torch from tqdm import tqdm from atom3d.util.transforms import prot_graph_transform, mol_graph_transform, PairedGraphTransform from atom3d.datasets import LMDBDataset from torch_geometric.data import Data, Batch, DataLoader import atom3d.util.graph as gr class GNNTransformLEP(o...
1c0c146abd9412eb3c394098987690dee0575c8d969a6e1c13e18b59d100d4a2
Python
3,086
86
import face_recognition import cv2 # This is a demo of running face recognition on a video file and saving the results to a new video file. # # PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam. # OpenCV is *not* required to use the face_recognition library. It...
b65f1ed01deb85ac82e6cf0f5aa7c0030e827e199b597354f27a043a2c38c6e5
Python
3,086
94
# 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...
cc7e924359b8a0ce6176be1a5d1e56ae24f7385937191164a61010bd46337a0d
Python
3,091
71
# Copyright 2007 Zachary Pincus # This file is part of CellTool. # # CellTool is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. def procustes_alignment(points, reference, weights = None, allow_ref...
e507035001deb9abcc5177ea40b88580e4b9eb78723685fac503427bdfa25389
Python
3,091
104
# 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 ReduceLogSum(Base): @staticmethod def export_nokeepdims() -> N...
cb88e3c17bed312368baeb188bf6a955a38dc2771d600741db507629537c82c2
Python
3,092
109
""" test_simple_synapses Test synapses between cell types. Usage: python test_synapses.py <pre_celltype> <post_celltype> Supported cell types: sgc, bushy, tstellate, dstellate, tuberculoventral, pyramidal """ import sys import argparse import pyqtgraph as pg from cnmodel.protocols.simple_synapse_test import ...
89184311720ae4c5c0995b598834dace802607061a28af3f5efbf8ae1ca96c34
Python
3,093
95
""" Used as a master args reader for scripts that read, add, and update Interlex data through its API Usage: api_wrapper.py [-h | --help] api_wrapper.py [-v | --version] api_wrapper.py <argument> [-f=<path>] [-o=<path>] [-p | -b] Arugments: addTerms Add terms|cdes|annotatio...
383fd9f816fb575d8b18e229cea4f3fcee2ac3417d486a15d40a46ff69a56743
Python
3,095
102
from __future__ import annotations from io import BytesIO from typing import TYPE_CHECKING from optuna._experimental import experimental_class from optuna._imports import try_import from optuna.artifacts.exceptions import ArtifactNotFound if TYPE_CHECKING: from typing import BinaryIO with try_import() as _impo...
d41dbe7ae3a54b45ea20ebeec7205052048ef66d4a45b8bf5f9101c717ebeec9
Python
3,096
83
# 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...
5123dde171fafc9ea19e1caeadc961978a251749f967f474dc4508a2e4aeb9d5
Python
3,097
83
import numpy as np ORIENTATION = { 'coronal': "COR", 'axial': "AXI", 'sagital': "SAG" } def rotate_orientation(volume_data, volume_label, orientation=ORIENTATION['coronal']): if orientation == ORIENTATION['coronal']: return volume_data.transpose((2, 0, 1)), volume_label.transpose((2, 0, 1)) ...
fad36998b6207d27e56cb1ae03bee1155e54f4194fc1036757d1a6384d242858
Python
3,098
74
# 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...
f2aa83601aee1017c17ad71387a8bf65f4a03053590b8185a7d44390b50f8b3f
Python
3,101
83
# 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...
bf734c3eca8153b19bd5ff5197678e4a7584895594367c8bade63afa4a1890e9
Python
3,102
95
"""Critical-difference diagram evaluator for benchmark results.""" __all__ = ["CriticalDifferenceDiagram"] from skbase.utils.dependencies import _check_soft_dependencies from sktime.benchmarking.analysis._base import BaseBenchmarkAnalyzer class CriticalDifferenceDiagram(BaseBenchmarkAnalyzer): """Critical-diff...
6a3e932a75c7268f672731079083d0e91337ab74c1eda13616829aa22fe002c3
Python
3,103
105
import pytest import importlib import atom3d.util.formats as fo # -- Reading PDB-like formats -- numres = {'103l':290,'117e':1029,'11as':740,'2olx':4} def test_read_any_pdb(): for c in numres.keys(): bp = fo.read_any('tests/test_data/pdb/'+c+'.pdb') nr = len([r for r in bp.get_residues()]) ...
10d5a416caa51521aad5f8170852487cad8498bc0a881f1061e54778089428ff
Python
3,104
102
import sys import numpy as np Pposition={} Lposition={} ResinameP={} ResinameL={} Atomline=[] residuePair=[] if len(sys.argv) <1 : print("python python2_L.py xxx") filebase=sys.argv[1] print(filebase) for line in open(filebase+'_w.pdb'): tem_B=' ' if len(line)>16: tem_B=line[16]...
91ccfd48bd34bcb04fad7c3cd56ede8ad3a49d6c09274b8dc43930bdda416022
Python
3,104
102
import sys import numpy as np Pposition={} Lposition={} ResinameP={} ResinameL={} Atomline=[] residuePair=[] if len(sys.argv) <1 : print("python python2_L.py xxx") filebase=sys.argv[1] print(filebase) for line in open(filebase+'_w.pdb'): tem_B=' ' if len(line)>16: tem_B=line[16]...
d504b25dbe990f87793dbd0ce1598a7e1788d242774e85608f20c9011055a5e9
Python
3,104
88
"""Independent t-test evaluator for benchmark results.""" __all__ = ["TwoSampleTTest"] import itertools import numpy as np import pandas as pd from sktime.benchmarking.analysis._base import BaseBenchmarkAnalyzer class TwoSampleTTest(BaseBenchmarkAnalyzer): """Independent two-sample t-test on each ordered pair...
dbed157b735a699a32b4379a99324b2dbae01284faa7e1f4d90105bb09d33115
Python
3,109
92
import html from typing import Union from flair.data import Sentence TAGGED_ENTITY = """ <mark class="entity" style="background: {color}; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 3; border-radius: 0.35em; box-decoration-break: clone; -webkit-box-decoration-break: clone"> {entity} <span style="fon...
e4c9ff9c5a6e5ff0e665d615bbaba6e68ff6cd7d6feb216fb0abb4b4d0c05458
Python
3,112
85
from flair.data import Dictionary, Sentence from flair.embeddings import WordEmbeddings from flair.models import TokenClassifier, SequenceTagger from flair.tokenization import SpaceTokenizer, StaccatoTokenizer def test_prediction_changes_tokenization(): # simple dummy model dictionary = Dictionary() dict...
46e693c27c2557c4764e8ae999c35a871da8d1353855322d896a57b0cd214485
Python
3,113
67
import numpy as np import ast import scipy import matplotlib.pyplot as plt import cv2 from keras.applications.resnet50 import ResNet50, preprocess_input from keras.preprocessing import image from keras.models import Model import sys def pretrained_path_to_tensor(img_path): # loads RGB image as PIL.I...
1be1b552673b743157c63c56e3aae4b34217567c207ff0c6018bd2aab0ac05a3
Python
3,116
81
import logging from pathlib import Path from transformer_smaller_training_vocab import reduce_train_vocab from flair.embeddings import Embeddings, StackedEmbeddings, TransformerEmbeddings from flair.models import FewshotClassifier from flair.nn import Model from flair.nn.model import ReduceTransformerVocabMixin from ...
80ac39947a67bf630f122c9ba23207822a500dc0f287b23790a6c2ab220e897a
Python
3,116
60
import re import unittest from pathlib import Path import pytest from pyontutils.utils import get_working_dir from nifstd_tools.docs import FixLinks working_dir = get_working_dir(__file__) if working_dir is None: name = 'pyontutils' else: name = working_dir.name base = ('/' + name + '/nifstd/test' + '/') gitb...
1eacc485afeb6291208fa9ef0f2f648144034c2f204cae130d4142640a1f7126
Python
3,117
103
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) # Ported from skchange (BSD-3-Clause), original authors: johannvk """L1 (absolute difference) cost function.""" __author__ = ["johannvk"] import numpy as np from sktime.detection._utils import check_mean from sktime.detection.costs._base import ...
b146c1bb6d417f42808901a56a8265665febf3b38af197fed18bb2ccd6ae1e32
Python
3,117
74
""" Train models on synthetic data. """ import os import numpy as np from six.moves import cPickle from tensorflow import keras from gradient_correction import helper, model_zoo #------------------------------------------------------------------------ num_trials = 50 model_names = ['cnn_deep', 'cnn_shallow'] activa...
37a3e47ea8cf575acb4e81de3ffeef640814a50a9a6799473a7446d660a3b99c
Python
3,118
109
from __future__ import print_function from collections import OrderedDict import numpy as np from . import utils class Augment(object): """ Abstract interface. """ def __init__(self): raise NotImplementedError def prepare(self, spec, **kwargs): return dict(spec) def __call__...
54b5613a24777c073e9b49fad950d70cbf3b484fda2779445a9264dfa1f9ad65
Python
3,118
85
import torch import logging import models.modules.RCAN_arch as RCAN_arch import models.modules.RNAN_arch as RNAN_arch import models.modules.UAN_arch as UAN_arch import models.modules.TTSR_arch as TTSR_arch import models.modules.DEFIAN_arch as DEFIAN_arch import models.modules.discriminator_vgg_arch as SRGAN_arch import...
04c281c3b4713c62d163fe142c3f8653f28a4d4235086df5ac5aeb69f3432a5a
Python
3,119
94
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmcls.models.backbones import RegNet regnet_test_data = [ ('regnetx_400mf', dict(w0=24, wa=24.48, wm=2.54, group_w=16, depth=22, bot_mul=1.0), [32, 64, 160, 384]), ('regnetx_800mf', dict(w0=56, wa=35.73, wm=2.2...
0ec0d31f61aea0e6102c43bf85a06ac4021f829a999910346fb692535c944f7e
Python
3,123
90
import numpy as np from scipy.sparse import csr_matrix # SAFE TEAM # # # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) # # def __padAndFilter(input_pairs, input_labels, max_num_vertices): output_pairs = [] output_labels = [] output_len = [] ...
b7a2b7faceff21153d96c1c5663e048e1056e253339ce4bb72d68bdb9301c04a
Python
3,125
64
"""Export run-level scores, seed summaries and every defined cluster point.""" import argparse import json from pathlib import Path import numpy as np import pandas as pd def export_tables(root): root = Path(root) runs, points = [], [] for path in sorted(root.glob("*/*/*/result.json")): record = ...
3f071d359cd6a3d2deaffbe4c5b57327c8dfd56c476206117f689ddde4a3e047
Python
3,128
90
# 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...
e7c871bc23c12eb34f9b349f3caa524d54ffdf02cc960847b9a28fa119fc41a4
Python
3,129
118
""" A toy model of a soma plus a tapering dendrite, with synaptic inputs scattered along the dendrite. This is to investigate how dendritic electrotonus and tapering affect the shape of the EPSC at the soma as recorded under voltage clamp """ import sys import os import numpy as np import matplotlib.pyplot as mpl impor...
bc0b271963c3b4fb058461eae9c9110eb897ee2611a49f1b2e21c7d0af388f8d
Python
3,132
114
#!/usr/bin/env python import os import sys import re import subprocess import numpy import logging BIN = os.path.join(os.path.dirname(__file__), "jpegdir", "jpeg") if not os.path.exists(BIN): print("jpeg is not built yet; use 'cd jpegdir; make' first") sys.exit(0) # sample output #> GW:1979 GH:4349 R:0 #>>...
c80649d43e2f3edcf3f455d8b5a7d529d422cbf366bf8efd548cbbe71fe7daa8
Python
3,132
88
# 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...
0c32038886b73062ecdc3a4a6927a908af0e6fafaf1f09aa43131c0a55624c95
Python
3,133
111
#!/usr/bin/env python3 """ api access for google sheets (and friends) Usage: googapis auth (sheets|docs|drive)... [options] [--drive-scope=<SCOPE>...] Examples: googapis auth sheets Options: --store-file=<PATH>... write to a specific store file -n --readonly set the readonly scope -...
203962cde75ffb75cb0b5d8094ef23b3b9c3200cc9489931347211fb38761ea2
Python
3,133
88
# 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...
2a2dca93fbbefcd1f650918582ba55dbe56c6c9f0bd582aab224099ca5992c6d
Python
3,140
90
""" This scripts plots figure 6b from the paper. This is the accumualtor model output for the trained mice. Internal notes: """ import pandas as pd import pickle as pkl import numpy as np import os import glob import matplotlib.pyplot as plt import matplotlib as mpl from tqdm import tqdm # Plotting import sciplotli...
35f2a146bf147b483aced0007fd5bca2c3b307c69ba838d9be698150028d5498
Python
3,140
86
# 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 DynamicQuantizeLinear(Base): @staticmethod def export() -> Non...
9f6f289e643ac88ba5801a3ba998ae92b73cbcf492869b7d15c089246632e969
Python
3,140
68
import os import numpy as np import nibabel as nib from os.path import join as pjoin from had_utils import save2cifti from scipy.stats import pearsonr from sklearn.preprocessing import StandardScaler # define path # make sure the dataset_path are modified based on your personal dataset downloading directory dataset_pa...
1e11a49336151481389d5d1eb20776a126e78f0b7ddbda77d8a6d89c6b52b559
Python
3,141
90
# 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...
bf7c735db3bebe30df476869e6eefb915fdc6cc7b95e4f452f2f5297bf1c4738
Python
3,141
79
import face_recognition import cv2 import numpy as np # This is a super simple (but slow) example of running face recognition on live video from your webcam. # There's a second example that's a little more complicated but runs faster. # PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed onl...
06454ad82cab7a3b8617610da6bcdcc30264c146809e5f4cd45264651cc7561d
Python
3,142
116
import resource from time import sleep from pyarrow import Table from pyarrow import csv import pyarrow as pa from pyarrow.parquet import ParquetWriter import pandas as pd import sys from datetime import timedelta from timeit import time import pathlib file = sys.argv[1] output_dir = sys.argv[2] name_of_smiles_col...
60e75a46bc3af962026a79a81a43f54f6fc4b1de34893ed3137a4918dd05ab04
Python
3,143
77
# Copyright 2019 Google Inc. 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 applicable law or a...
4e106ece432b5ef276a557632dd225bf08416b6a60b1934d38411a297c1e6829
Python
3,146
97
# 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...
3d68a8b8099e56333e0e22f9a92828de03655b6dc000c254ba74cb763b8dc07b
Python
3,147
90
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) # Ported from skchange (BSD-3-Clause), original authors: Tveten """Tests for the CircularBinarySegmentation detector.""" import numpy as np import pandas as pd import pytest from sktime.detection._change_scores._from_cost import ChangeScore from ...
ba2afcf2ca26f6bf0b34fa4212ba58a9fc6a0bcc3e81f1d090e28b0e7a8e36d3
Python
3,147
91
import numpy as np import matplotlib.pyplot as plt def count_accuracy(W_true, W_est, W_und=None): """ Compute FDR, TPR, and FPR for B, or optionally for CPDAG B + B_und. Args: W_true: ground truth graph W_est: predicted graph W_und: predicted undirected edges in CPDAG, asymmetric ...
f9b5e113af0b79c18e61effac6ea3283891824b9fbc5c00ad33c0b4326b02d4c
Python
3,148
131
import _pickle as pickle import sys from scipy import stats import numpy import multiprocessing print('''$1: Index Data\n$2: Output file''') INDEX_DATA_FILE=sys.argv[1] OUT_FILE=sys.argv[2] SPLIT=':' class Person_PCC_Data: import numpy def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header): self.EXP =...