sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c357c33fd1c32242d8061799b58ede9dcb56f00598004e78191c6391aa674dd1
Python
2,395
71
""" Summary This script is somewhat the same as the 3_postprocess_data.py script, with the only exception that the decision whether a paper must be removed is solely based on the author. If the 4_seperate_authors.py script found that it is likely that multiple authors (persons) are associated with the same name, the au...
9320f8dc3a642db7cdb15b03e9c5f0abeb1d8530cb6d21e4560d4d5ef2654871
Python
2,396
72
# Copyright 2019 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
36189cc2375dc864fae37052b0e9fb80279b591c05e127973d5e04f40c42b6bb
Python
2,399
64
from os.path import isdir, join from os import mkdir from preprocess import PreProcessor from keras.layers import GRU from models.RNN import RNN import itertools def RNN_args(): """ Get GNN model and hyperparameters """ train_args = dict(layers=3, recurrent_layer=GRU, bidirect=False, ...
6ba800147f645d8a925359901bfb9fc2a18d15a9571515154d0b3b5119b1914e
Python
2,399
72
from anndata._core.anndata import AnnData from pandas.core.frame import DataFrame import pytest import pandas as pd import scanpy as sc from anndata import AnnData import numpy as np from palantir.utils import ( run_density, run_low_density_variability, run_density_evaluation, ) @pytest.fixture def mock_...
ce0532dbc55d0a2d0a5901784af5c2467a7d009049d28ac04cae2ac6c70c8625
Python
2,399
70
""" run cmd """ import os, argparse, subprocess, re def run_cmd(args): # input cmd = args.cmd projectdir = args.projectdir # subject if args.subject: subjects = args.subject else: subjects = [sub.replace("sub-", "") for sub in os.listdir(os.path.join(projectdir, 'data', 'b...
fc1b7903a93a8793981c243b14cb6f2d3b6566518cd6217e10cca9a00b0d9bda
Python
2,399
75
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRun def _slice( data: np.ndarray, starts: np.ndarray, ends: np.ndarray, axes: np.ndarray | None = None, steps: np.ndarray | ...
0fd49c14929fd5533d3262b547c6b65117e39e4a4ea6ddf80c79b5fc42954cbe
Python
2,400
70
# 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 STFT(Base): @staticmethod def export() -> None: signal...
67eba35084099bffaaa90bfcd3ef3d5dbf484540293fe77be1216b3fe75efef0
Python
2,400
38
from sklearn.metrics import precision_score, recall_score, f1_score, confusion_matrix import numpy as np # input gold labels and pred labels # display prec,rec,F1 and confusion matrix # also return the prec,rec,F1 def get_and_display_results(y_true, y_pred, report_confusion_mat = False): prec, rec, f1 = pre...
9aa3f94da1e4d62419a1b52c6a0c214a6a96b9fc5cf2680bf7d9c13b0a822be9
Python
2,401
70
# 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...
dd8bd4766c825eb46da0dc339a3758a8f1397b714507ece06169b99ac21b220a
Python
2,402
59
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Clone plugin for preserving pretrained state in estimators.""" from copy import deepcopy from skbase.base._clone_plugins import BaseCloner, _default_clone class _PretrainedCloner(BaseCloner): """Clone plugin that preserves pretrained sta...
436428cb60b4ed27034ad31b1c6f5651b6fde72b847b34ed462d674a0bf8e115
Python
2,403
68
import unittest from pathlib import Path import pytest from pyontutils.utils import get_working_dir from pyontutils.config import auth from pyontutils.integration_test_helper import _TestScriptsBase, Folders, Repo import neurondm class TestScripts(Folders, _TestScriptsBase): """ woo! """ only = tuple() lasts =...
114f550824f34d444bbab26f5d91780494b61cfc46ea203a1ef6450034a9df95
Python
2,404
72
from flair.data import Sentence from flair.datasets import ClassificationCorpus from flair.models import TARSClassifier from flair.trainers import ModelTrainer def test_init_tars_and_switch(tasks_base_path): # test corpus corpus = ClassificationCorpus(tasks_base_path / "imdb") # create a TARS classifier ...
ae7fa106888aea76161d6b9ffe3c9378fc9175fa5be99914ce8c455e9e0fa069
Python
2,406
58
import torch.nn.functional as F import torch.nn as nn from Sublayers import FeedForward, MultiHeadAttention, Norm import sys import importlib config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else "" attention_setting = importlib.import_module(config_path+"attention_setting") class EncoderLa...
482eb8626876fe3d1483b7435bed2fb66b4e15229fa1ddb14c9bef243493d335
Python
2,410
75
"""Implementation of the NetworkX libraries for pyRDTP """ import networkx as nx import matplotlib.pyplot as plt def generate(mol, voronoi=False): """Generate a graph using the given molecule, the connectivity between the atoms of the molecule is needed in order to create the graph. Args: mol (ob...
f8170018aac2ee0f9c5419565f07f7c0ceff0249c3423bf141a8e893f36c8d0b
Python
2,410
81
"""evaluate_cloud_cover.py""" """ Author: Yimin Yang Last revision date: Jan 18, 2022 Function: Run this to evaluate the trained model Ref: https://github.com/HansBambel/SmaAt-UNet """ import torch from torch import nn import numpy as np import os import pickle from tqdm import tqdm def compute_loss(model, test_dl, ...
10e4e68347bee1d4a893152f6826f17fd56d0deab2b717c4ff1290ac6993d7c2
Python
2,411
71
# 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...
98ba5fc0914fd27bcfd109590f06c8e4eae3bc9427f5eee7f49d6d32be06b640
Python
2,411
73
#!/usr/bin/env python from __future__ import print_function import sys,os import re import argparse import logging import functools import gzip import pandas as pd desc = 'Combine ref genomes in MG sample' epi = """DESCRIPTION: Just combining ref genomes selected to be included in the simulated metagenome sample """ p...
42ebbfce74371cf1ae5878ee74483db56601ced9564ef311ed097d4092fe42bd
Python
2,412
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...
04d7f3a1a53e1feea17f974199416d34bc70fd1ba051a326b64ea26fbfd169f0
Python
2,413
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...
27be99ec3f345dbd0280732fb944236682edc68222ce77f150c3c0342e108abc
Python
2,413
73
# -*- 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 ...
b68cf7d07a5172081d2cb2cf85eaeb9a67b53eee0927175b340a24f8cf8a812b
Python
2,413
77
import copy import json import numbers import os from datetime import datetime import numpy as np import yaml def ensure_dir(file_path): directory = os.path.dirname(file_path) if not os.path.exists(directory): os.makedirs(directory, exist_ok=True) def with_base_config(base_config, extra_config): ...
f6a2432140476d5379eda034800cc589883a3daa4b470cb22d68457430acbc3d
Python
2,413
73
# -*- 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...
a0d58a7e4cf314991e22120096af02e337dc33767d5d80ccd0552c0958515570
Python
2,414
68
# 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...
c8ceb58848856e4c56d5a00c87e57a108f602fee7acf4d0f4f4f6e40dcfecb87
Python
2,414
86
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) """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEURON AND SYNAPSE DEFINI...
af831ec25bd6688e9e355e19cf8e112b105ad112db44126dbe2dfb5bf27f5cae
Python
2,415
67
from collections import defaultdict from ilxutils.interlex_sql import IlxSql from ilxutils.mydifflib import ratio from ilxutils.tools import open_pickle, create_pickle import os import pandas as pd from pathlib import Path from sys import exit sql = IlxSql(db_url=os.environ.get('SCICRUNCH_DB_URL_PRODUCTION')) data = ...
a72b7182715657651693baeff133765513d868e95cc7a4264311a53b7dead991
Python
2,416
81
import unittest import rdflib from neurondm.core import (Config, LabelMaker, Phenotype, NegPhenotype, Neuron, LogicalPhenotype, AND, ...
1d2ac5bcc081a1ddae49a7808041047faaa8e531f42192585161fe0462e50a39
Python
2,420
97
import numpy as np import cv2 import sys from time import time import kcftracker selectingObject = False initTracking = False onTracking = False ix, iy, cx, cy = -1, -1, -1, -1 w, h = 0, 0 inteval = 1 duration = 0.01 # mouse callback function def draw_boundingbox(event, x, y, flags, param): global selectingObject...
0d7a587cd7ec8cc2594f3ee25d2972f008673a44f9885317d2b7869dc4e73d73
Python
2,421
66
# 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...
d082b4fc3a55ad471a995f4fc37bf13e02d0663eb1682620f823b2b787156438
Python
2,422
50
#======================================================================================================================= # 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...
951f40195b368e70727913046183d6def2b00b8d08462e30240fa333da839df0
Python
2,424
77
import dolfin as df import os # set path to solver from ffian import flow_model, zero_flow_model from plotter import Plotter def run_model(model_v, j_in, Tstop, stim_start, stim_end, stim_protocol): """ Arguments: model_v (str): model version j_in (float): constant input in input zone (mol/(m...
dc21eb04c1665f2d34fadc7dd19b3ab57dd8ceee0bd7a7c17932c57a88cee3b7
Python
2,424
82
# 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. import traceback import sys from celltool.utility import warn_tools i...
067c6ac323f722515dfe59f736600706cfecc662b1f0f6c145c1be1ba73ba689
Python
2,425
65
import joblib import contextlib from rdkit import rdBase class without_rdkit_log: # https://github.com/rdkit/rdkit/issues/2320 """Context manager to disable RDKit logs. By default all logs are disabled.""" def __init__( self, mute_errors: bool = True, mute_warning: bool = True, ...
cb3b7df800cfec86e49c29fef5f131125eac345e5543797173233a3d0ca7ee24
Python
2,426
55
import face_recognition import cv2 # This code finds all faces in a list of images using the CNN model. # # This demo is for the _special case_ when you need to find faces in LOTS of images very quickly and all the images # are the exact same size. This is common in video processing applications where you have lots of...
66a0e1e864062c1db0021c8377c2ae0b03444ac3805801e119cae3b52ad8f46f
Python
2,427
82
# small RetinaNet num_classes=3 # model settings model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='...
7ac42637542a03e5724178be92a24ba20b234de3c0d43dc68c5a0a71f4f5bb7c
Python
2,427
81
import matplotlib as mpl import seaborn as sns preset_themes = {} preset_themes["light_edge"] = { "axes.spines.right": False, "axes.spines.top": False, "axes.spines.left": True, "axes.spines.bottom": True, "axes.edgecolor": "lightgrey", "ytick.color": "grey", "xtick.color": "grey", "ax...
210fe054c012a3d8a83eaf57aff8931a291a0faf6486d2a82a474b24c90456c1
Python
2,428
55
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # (C) Copyright 2015 Frankfurt Institute for Advanced Studies # (C) Copyright 2016 Max-Planck Institute for Brain Research # # Author: Philipp Huelsdunk <huelsdunk@fias.uni-frankfurt.de> # # Redistribution and use in source and binary forms, with or without # modificat...
aa733d37728b1ee5d758f96cee3a280a63a2be994fb9f911f4b1a36379f826be
Python
2,428
89
"""Unit tests for the BaseCatalogue class.""" __author__ = ["jgyasu"] import pytest from sktime.catalogues.base import BaseCatalogue class DummyCatalogue(BaseCatalogue): """Minimal subclass for testing BaseCatalogue behavior.""" def _get(self): """Return dummy catalogue contents.""" return...
be31c9b05213d7ef55fa0611e2a48cda2e3f1f8cf99164f679706ae94aa0a28a
Python
2,429
51
# 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...
170958cf67a949b786c22cd863fe189c5c3ed79054c95ea43bd8b4cf882324eb
Python
2,430
63
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
37f5a779c0e3867aa399300dd4a59c99478e1f684d18e149846dde48e1436809
Python
2,430
65
# 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 numpy as np import pytest import pandas as pd from ampligraph.datasets i...
1cfde7417f0663b054df827a244a273bdc1cd5e297dbc33a1af47a269830ec10
Python
2,431
71
# Copyright (c) OpenMMLab. All rights reserved. import argparse import mmcv from mmcv import Config, DictAction from mmcls.datasets import build_dataset def parse_args(): parser = argparse.ArgumentParser(description='Evaluate metric of the ' 'results saved in pkl format') ...
c2bdd90212becf6d67092afa097e306621180356761f40dc7c1278b62583d7dc
Python
2,431
68
# 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...
03f10ad0e2e2511ef2217b6d65c376e07f2bba2af7fa79cec5cf85e89e4dd47d
Python
2,432
97
# Expose base classses from flair.embeddings.transformer import ( TransformerEmbeddings, TransformerJitDocumentEmbeddings, TransformerJitWordEmbeddings, TransformerOnnxDocumentEmbeddings, TransformerOnnxWordEmbeddings, ) from .base import Embeddings, ScalarMix # Expose document embedding classes f...
bf61766f537ac874f8a4be0d193bd92ecd91c92cdf22a2cf480a369cb87346a7
Python
2,432
65
import argparse import biom import pandas as pd import numpy as np import xarray as xr from q2_differential._model import SingleDESeq2 from birdman.model_util import concatenate_inferences from birdman import ModelIterator import time import logging import subprocess, os import tempfile from multiprocessing import Pool...
49926264fa82fcc82f5c918dda83b2dc95b67347260d5106ed68b326779c3578
Python
2,436
78
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import json import os import onnx.backend.test.case.node from onnx.backend.test.case.test_case import TestCase from onnx.backend.test.case.utils import import_recursive DATA_DIR = os.path.join( os....
233c84fe3ff3fcb34aa20672d0e9cbec041d8f8cedbe0ee11794ed24965896e8
Python
2,437
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...
40a4a22c2fea53c772363194dd2cef360fb6d70ab1d76c21982d3971cb914995
Python
2,437
49
import numpy as np import pandas as pd # findPathCoM(pathLUT, AtlasToPathLUT, NetworkDataGeneral['NetworkDataGeneral'][0,0]['Schaefer400x7']['CoM'][0, 0]) def findPathCoM(pathLUT, AtlasToPathLUT, AtlasCoM): """Function to find the Center of Mass for Pathology Regions in Atlas Args: pathLUT (Dataframe)...
67f331b1e431612f0c93c11e945b6ddb9bdcb1da956b892fe83c379b48b0ea28
Python
2,437
73
import numpy as np from scipy import ndimage def create_hypersphere_shape(radius, n_dim=3): """ Create an ND binary array with a hyperspherical shape. Parameters ---------- radius : int The radius of the hypersphere. n_dim : int The number of dimensions. Default is 3. Ret...
6a5bc99517aae7efa2cca97788a11f9e82e4aa8da5467b4049550f150924eb3b
Python
2,437
89
"""Module exports: data type definitions, checks, validation, fixtures, converters.""" from sktime.datatypes._check import ( check_is_error_msg, check_is_mtype, check_is_scitype, check_raise, mtype, scitype, ) from sktime.datatypes._convert import convert, convert_to from sktime.datatypes._exam...
3f67df42894e3dc7061a3aedd575888e56a7b8929c05e6b64acac743264bd12b
Python
2,438
74
# -*- 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 ...
3090474870a389dcb9f97db46e35567606e0ead43961779af2c37f14d97d5f6d
Python
2,439
69
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import xml.etree.ElementTree as ET import mmcv import numpy as np from .builder import DATASETS from .multi_label import MultiLabelDataset @DATASETS.register_module() class VOC(MultiLabelDataset): """`Pascal VOC <http://host.robots.ox.ac.uk/p...
34a3f2a5daebe07181d5ec8da0b7891e5832db0bb79763376363f678bb0c1377
Python
2,439
58
""" Short Summary This script merges the training and testdata of the Reuters 50/50 dataset. This is required to try a different train/test split (e.g. 90/10) for comparison with other works from the literature. The output is written to dataset-reuters/ """ import os import numpy as np def concatenateFiles(fname): ...
f516b26777460ddd4a7075ad483b207b72f20c400fd7e9ce776bd7c219728371
Python
2,440
71
#!/usr/bin/env python3 # -*- 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 argparse import s...
55ae283fbae5edd4b645ea584bcca4da7ae9c6e74d5fce135b9b379dfe2291eb
Python
2,441
60
# 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...
a5675bf3f70713dfb48b3cd58b78d56a2e66a2f3b37f5fd30ee9aa2e425e3ec3
Python
2,443
67
from __future__ import print_function from os.path import splitext from parameterSetup import ParameterSetup import numpy as np import json class SDFilter(object): def __init__(self): params = ParameterSetup() pickledDir = params.pickledDir self.fileIDs_L = [] try: sd_t...
6c8f36a22617632f92f7ec18735de0ca89753a376e3bd505f97168ca6790e7cf
Python
2,445
52
import numpy as np import os import sys from tqdm import tqdm import torch from atom3d.util.transforms import prot_graph_transform, mol_graph_transform from atom3d.datasets import LMDBDataset from torch_geometric.data import Data, Dataset, DataLoader import atom3d.util.graph as gr class GNNTransformLBA(object): ...
b93ca7bdde55054093aea0b43488ed90700a5af46324e0c59bd987039c69ab6e
Python
2,445
67
# 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...
0fa789074551d13297aeda0b3fd05d8b903768524c782b73faa1b378d3987baa
Python
2,446
80
# SPDX-License-Identifier: LGPL-3.0-or-later import deepmd.tf2.descriptor as _tf2_descriptor # noqa: F401 import deepmd.tf2.fitting.fitting as _tf2_fitting # noqa: F401 import deepmd.tf2.utils.exclude_mask as _tf2_exclude_mask # noqa: F401 from deepmd.dpmodel.atomic_model.dp_atomic_model import DPAtomicModel as DPAt...
be83bd1cf9f16891fc40f12d0e2fed2190da01d7778380226a11e67b594f2360
Python
2,446
76
import numpy as np import torch import pandas as pd import scipy def check_species_dict(species_dict): assert "name" in species_dict, "name is missing from dictionary" assert "column" in species_dict, "column is missing from dictionary" def update_weights_focal(true, preds, n_classes, weight): acc_dict ...
9144badc7bc2e82e2a269afcd950f63ef0cd145517087273b638d2b815f862cd
Python
2,447
73
# 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...
b8b70571001945c7562aacc52dc7a4b20ac1f595cba1eb28039461a4d61f5305
Python
2,449
66
# Copyright 2018-2025 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICE...
8189f68b09b3767efed2784c63a7e22fc4e87103d3d385bb016665aaea5a1f47
Python
2,450
77
import timeit # Note: This example is only tested with Python 3 (not Python 2) # This is a very simple benchmark to give you an idea of how fast each step of face recognition will run on your system. # Notice that face detection gets very slow at large image sizes. So you might consider running face detection on a # ...
6a960d90277067d701ef8390c41a24d0799f997a7b97a9e23092fc0b75ee2153
Python
2,451
81
# Copyright 2026 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
ab9f283af54760c50261ff72f48d32af43c933e71cf5fac06b501a72e729044c
Python
2,451
79
import os import dill import json from typing import List from torch_geometric.data import HeteroData from molucn.utils.utils import read_list_targets from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import DataStructs import numpy as np from rdkit.Chem.Draw import IPythonConsole from rdkit.Chem im...
78f4d584f6ba91096b56667e3503edba6a1ebbd3044669527406daf47712454d
Python
2,452
82
# -*- coding: utf-8 -*- # Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www....
cf2013f2af2aebd650234469cf446c63a19da150ec3e1ef9b1c844e798f787fb
Python
2,452
68
# 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 Greater(Base): @staticmethod def export() -> None: nod...
f2e8ee389badf8748c03518b9124ae6c6dc8393868f961f69d82048254f855b9
Python
2,452
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...
6c7c10daf6decc8bd0bd789033f83a2e25cf8f3184c0803f93bb1458eef797de
Python
2,453
89
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 5 15:30:40 2019 @author: reiters """ import cv2 import numpy as np import moving_least_squares import os.path import h5py import matplotlib.pyplot as plt import pandas as pd import glob import time def norm(data): with np.errstate(invali...
9f8df21bcdb26a6e1a4137e0741c402a410d6890598d93c48fb2b96ef55c7879
Python
2,453
65
from typing import Union import time import pytest import siibra from siibra.core.structure import BrainStructure from siibra.core.space import Space from siibra.features.image.image import Image all_image_features = [f for ft in siibra.features.Feature._SUBCLASSES[siibra.features.image.image.Image] for f in ft._get_...
98090b6b94b8f81e963eaa8619ef19b9f90cf2c275cd605768d5578c7cc5f7ff
Python
2,454
68
import torch from torch.utils.data import Dataset import os import pickle import numpy as np import networkx as nx import dgl from collections import Counter class RetroCenterDatasets(Dataset): def __init__(self, root, data_split): self.root = root self.data_split = data_split self.data_...
716567e7295191830d20fbdea54a870a07a103f6908f3423e545e705d108eeb1
Python
2,461
83
import numpy as np import pandas as pd import pytest from numpy.testing import assert_array_equal from seaborn._core.groupby import GroupBy from seaborn._stats.order import Perc class Fixtures: @pytest.fixture def df(self, rng): return pd.DataFrame(dict(x="", y=rng.normal(size=30))) def get_g...
a987b36df037840cdc39025cfa22d4579617b99c245369e9eaa50ec3f4284efd
Python
2,461
88
"""NIfTI format conversion and image creation utilities.""" import os from pathlib import Path from typing import Optional, Sequence, Tuple, Union import numpy as np import nibabel as nib from bcblib.imaging._types import NiftiLike from bcblib.imaging.io import load_nifti # ----------------------------------------...
f9ba3b5cbb21bb8d8fbc3d67615826c2782016ccbaad115a84ac7ba8bbeafb83
Python
2,463
86
from sklearn import cluster from scipy.spatial import distance import sklearn.datasets import matplotlib.pyplot as plt import numpy as np def compute_bic(kmeans,X): """ FROM: https://stats.stackexchange.com/questions/90769/using-bic-to-estimate-the-number-of-k-in-kmeans?utm_medium=organic&utm_source=goog...
c1f9377a3ec5bbfcbdbdad3cb0304095d3809d09835a8f20665d0174b73c0e6c
Python
2,466
81
import numpy as np import h5py import os from mvsec_fcns import * from joblib import Parallel, delayed def get_events_flow_mask(idx): # Events ts = timestamps[idx] beg_time = ts - nframes * dt frame_seq = np.zeros((2, nframes, H, W)) for f in range(nframes): event_window = events[(event...
cb17ab2b1fa0db592dc5f5d59b2f5f56ddb66c203fae9d88991b18df080b9b79
Python
2,466
84
# 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...
977bfa227a81051db664582e2b7aecc123802b59b55a439a8fb4851e6206386d
Python
2,467
82
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining def _apply_momentum(r, t, x, g, v, norm_coefficient, alpha, beta): # Add gradient of regularization term. g...
729435c6f9314bbcabdc1133f56680f5bb2be16efc09d0145247710e4cfb9cc3
Python
2,468
72
# \author Hans J. Johnson # This file will help store new data # in a publicly available web location # for the purpose of allowing larger # testing data to be separate from # the source tree. # # NOTE: This is not a global solution # for any developer. Only members # of the Iowa PINC lab have access # ...
86568fe87c6f5f161d1ae0cde5f80f39d76a2209dfba007dddc5243dc7cd7607
Python
2,468
72
from pathlib import Path import numpy as np from asreview.review.factory import get_reviewer from asreview.data import ASReviewData data_fp = Path("tests", "demo_data", "generic_labels.csv") def test_init_seed(): base_start_idx = None n_test = 4 seeds = np.random.randint(0, 2**63, 5) for _ in rang...
ac6a0f0fb6700292d93066d88e5ca2b88854752b3aef9a28b72afc0eb3009b48
Python
2,469
57
#------------------------------------------------------------------------------ # elftools tests # # Seva Alekseyev (sevaa@sprynet.com) # This code is in the public domain # # Making sure the two ways of iterating through DIEs (linear and by tree) # return an identically built tree (parents, children, terminators). # #...
56c44d595de9c944af0768c646655bdb59e1e34f19d99878c1dc8a6c8cd957bc
Python
2,472
62
# 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...
98c37d2ecb61681095202f2eda5ecbe3c5b5915cc6edc440cb36894a7458632c
Python
2,473
75
#!/usr/bin/env python3 import csv import pickle from os.path import expanduser import requests from pyontutils.utils import chunk_list try: breakpoint except NameError: from IPython import embed as breakpoint def main(): with open('nlx_properties', 'rt') as f: properties = [l.strip() for l in f.r...
c83728bac245ffbf0c074e052c54c8a154d806fdf3fa866adedfe22879ebb0b4
Python
2,473
73
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # from functools import partial import tensorflow as tf def LP_regularizer(tr...
04194652b1e7cea19630c84b034374ef3e6fda530d8c6757f5976e8033d1429c
Python
2,474
64
# tifffile/examples/issues125.py """Create a fsspec ReferenceFileSystem for a sequence of TIFF files on S3 This Python script uses the tifffile and fsspec libraries to create a multiscale ReferenceFileSystem JSON file for a sequence of cloud optimized GeoTIFF (COG) files stored on S3. The tiles of the COG files are u...
1a86aab7b89ac6b4f0197c33ad8a23b360b969501e94abbda7b26c05e06d37f0
Python
2,477
49
# 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...
08f6eef364dde8dd2ddbc18d0803178e5de94f0b103f19570939447687ced008
Python
2,478
78
# In these examples we demonstrate how different templates import numpy as np import netplotbrain import pandas as pd import matplotlib.pyplot as plt np.random.seed(2021) n = 10 # number of nodes m = 20 # number of edges # Different tepmlates have different coordinate systems. # We generate the same type of data ...
cddedd63354ceeec3b9c58503dbb3548fb6544901ce346c0bbf9c9bc49830916
Python
2,478
76
import random import pdb import re import numpy as np import torch from torch.utils.data.dataset import Dataset class TISDataset(Dataset): def read_dna_file(self, file_location, class_id): current_file = open(file_location) dna_list = [] for line in current_file: stripped_lin...
d130b960b669360ab7273ebf06d95587256b90cde6a1ae73ce65fc55de799f78
Python
2,478
77
# 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...
6d2ab8241156be14122f124c4c83c521c22f1c40405c0d21b3155d20653a3889
Python
2,480
60
# 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...
c2a5717e77fd714d54f913d612f73923924fdb41da1d712ed50e82e999c6627f
Python
2,482
76
# 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 Or(Base): @staticmethod def export() -> None: node = o...
65b7ca00a5726e6049054d1085ff90adc06d084178dda0d49e2e86c3f1adc4cb
Python
2,483
87
""" Metric class for model server """ import time import socket from collections import OrderedDict from builtins import str from ts.metrics.unit import Units MetricUnit = Units() class Metric(object): """ Class for generating metrics and printing it to stdout of the worker """ def __init__(self...
b6a6330c465053edc3f5429114504a8d9090b74d4225c89b49503ebf9914a0d7
Python
2,483
68
import dolfin as df from .model_base import ModelBase class Model(ModelBase): """ Model setup with input zone in the middle of the domain. """ def __init__(self, model_v, mesh, L, t_PDE, j_in_const, stim_start, stim_end, stim_protocol='constant'): ModelBase.__init__(self, model_v, mesh, L, t_PDE) ...
142e8a431eb67ad073e510427e4c201b325b942990944b1a9bc3ffaefbf28a92
Python
2,485
69
# 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 # # ...
c0a8d597f07025313cdfc241d15109c8b6eea64ed742df15efbaaf1bbd54a04c
Python
2,488
48
# 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...
4d5a3670e7b70e61e6fdfb4eb3321c95e807c2ce0a5dfc92101771fe16182347
Python
2,489
99
"""ProbabilityThresholdEarlyClassifier test code.""" import numpy as np import pytest from numpy import testing from sktime.classification.early_classification import ( ProbabilityThresholdEarlyClassifier, ) from sktime.classification.interval_based import TimeSeriesForestClassifier from sktime.datasets import lo...
447d6ea90921cceaacdf99229d530213260c7031562315e24793ee55699adeaf
Python
2,490
75
import logging from typing import Union import numpy as np import torch from torch.utils.data import Dataset class JetMomentaDataset(Dataset): """ PyTorch dataset for GNN autoencoder. """ def __init__( self, data: Union[torch.Tensor, np.ndarray], vec_dims: int = 3, p...
74f3aca0cbabbcf1b92fef0d004bded7452452635269b6a629f474a83863f521
Python
2,490
89
import numpy as np def make_pulse(stim): """ Generate a pulse train for current / voltage command. Returns a tuple. Parameters ---------- stim : dict Holds parameters that determine stimulus shape: * delay : time before first pulse * Sfreq : frequency of ...
f782720b9e107b080317a86e23199a12d30e677b0a3178197c3db814e6296ce6
Python
2,492
64
import qiime2 import numpy as np import pandas as pd import arviz as az from q2_matchmaker._matching import _matchmaker from typing import List from q2_matchmaker._stan import _case_control_data from q2_matchmaker._stan import _case_control_full def negative_binomial_case_control( table: pd.DataFrame, ...
3f1678f039661542a252604c48f43ae59ca42bd9861c220485d71cf9e25eb7a3
Python
2,494
84
import pandas as pd import numpy as np import yaml from types import SimpleNamespace def generate_data(std_flag): """ Generate data for the toy task Parameters - std_flag: when the flag is one, data will be standardized Returns - (traindata,trainfdata,trainldata): train dataset (his...
5f1e9ae7f8b929d8df4c0ca918da23e6d3604002fc5aa54c406645d06d8f6d55
Python
2,495
93
# 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 # # ...
be0b294793e64186ccb35aa94c800185ef3d49a0c9a8d1a36eaba77cd11aabf7
Python
2,495
65
# 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...