sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4bbf77dfba73e2db1c41900c3d88c4cad9075b40a2cda3f7d37757259b981439
Python
1,448
50
import re from setuptools import setup def find_version(filename): _version_re = re.compile(r"__version__ = '(.*)'") for line in open(filename): version_match = _version_re.match(line) if version_match: return version_match.group(1) __version__ = find_version('librdflib/__init__....
15e3647457c7c32a1e11085d28c2d382e85b2c58c003d17af6f6d3e54dda9bbc
Python
1,449
61
# 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 scatter_elements(data, indices, updates, axis=0, reduction=None): """Scatter elements. :: for 3-dim and axis=0 ...
321cc44ba2bfbd0451b641e36c181c2b586924c4d78566a3d9152d45c6c16e1a
Python
1,450
33
from expert.src.utils import samples_to_countmatrix, merge_countmatrices, scale_abundance from expert.src.preprocessing import Transformer from expert.CLI.CLI_utils import find_pkg_resource import pandas as pd from tqdm import tqdm import numpy as np def convert(cfg, args): print('running...') print('Read...
521ae46ca293ceda33f82fa54d7fa9406cda4095c06276f35b6e9d5a35003b5c
Python
1,450
45
def convert_gluonts_result_to_multiindex(gluonts_result): """Back Convert from Gluonts to sktime. Convert the output of Gluonts's prediction to a multiindex dataframe compatible with sktime. Parameters ---------- gluonts_result: The first element of the tuple resulting from running `make_e...
6a5de0cd0a3f8c4ec0bbd292e059799a4e545a7b57d9b30b99813bdf291e6dc0
Python
1,450
44
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmcls.models.backbones import ResNeSt from mmcls.models.backbones.resnest import Bottleneck as BottleneckS def test_bottleneck(): with pytest.raises(AssertionError): # Style must be in ['pytorch', 'caffe'] BottleneckS...
914172475ab7341e31b108bfbb7f94736029afca7b1d229e9b9153bae27e29c0
Python
1,452
43
# 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 Selu(Base): @staticmethod def export() -> None: node =...
604e80eebde5a3770e0ab5cdabecf6a1fc7295fc83ae010dfdb7d7075c888476
Python
1,453
46
# Copyright (c) OpenMMLab. All rights reserved. import json import logging from collections import defaultdict from mmcv.utils import get_logger def get_root_logger(log_file=None, log_level=logging.INFO): return get_logger('mmcls', log_file, log_level) def load_json_log(json_log): """load and convert json_...
64f4bbc5a721c5baf51160ef51783d976d9e632d3b732f4e399e39f3f4d2a147
Python
1,453
47
"""Wilcoxon rank-sum test evaluator for benchmark results.""" __all__ = ["RankSumTest"] import itertools import pandas as pd from sktime.benchmarking.analysis._base import BaseBenchmarkAnalyzer class RankSumTest(BaseBenchmarkAnalyzer): """Wilcoxon rank-sum test on each ordered pair of estimators. Non-par...
66aea61d101eafe54a87bc155da9b50d85ecf8d279400727ea7f4d4a21a57619
Python
1,454
52
import os import random import logging import torch import numpy as np from sklearn.metrics import f1_score from transformers.tokenization_bert import BertTokenizer ADDITIONAL_SPECIAL_TOKENS = ["<e1>", "</e1>", "<e2>", "</e2>"] def get_label(args): return [label.strip() for label in open(os.path.join(args.data_...
2043821b5c1b9bfeb2712f2a54732da6ca1f543a95244300b918e28ab8a33cd8
Python
1,456
33
import matplotlib.pyplot as plt from baseline_utils import load_annotations, sanity_plot, combine_and_split, compute_baseline, mean_test_error # Python file replicating notebook that generates baseline plots # Configure annotations and root paths before running # file path for annotations left_annotations_file = '../...
e05da956c4232303deb5b956eea0c8f5fe3920c6e5d9a6a10b1862390aaefaf3
Python
1,457
52
""" Utility functions specific to cnn_sta_test and mine_edf to avoid circular imports """ import numpy as np import utilities def sta_nonlin(x: np.ndarray) -> np.ndarray: return x / (1+np.exp(-5*x)) def stc_nonlin(x: np.ndarray) -> np.ndarray: # constant multiplier puts output of nonlinear filter in # ...
332089171a29151ecf132dffcd9488a48478b11224db78bcdab18fe8f7d3143c
Python
1,458
50
import MDAnalysis as mda import numpy as np from MDAnalysis.lib.mdamath import make_whole from MDAnalysis.analysis.distances import self_distance_array import sys def calc_fragment_dimensions(listFragments): x=None for frag in listFragments: if x is None: x = make_whole(frag) else:...
e034c6f41f2d3b77427866c098da87c02c0aa99e4ee7d878ba221e365a5f082c
Python
1,460
50
""" Functions for preprocessing of single cell RNA-seq counts """ import numpy as np import anndata from scipy.sparse import issparse def filter_counts_data(data, cell_min_molecules=1000, genes_min_cells=10): """Remove low molecule count cells and low detection genes :param data: Counts matrix: Cells x Gene...
942afb33b7e0b80f309da0951c9b1282acce7ac72a7efc66a1a802a6b3040b46
Python
1,462
54
import io from unittest.mock import patch import uuid import pytest from optuna.artifacts import Backoff from optuna.artifacts.exceptions import ArtifactNotFound from .stubs import FailArtifactStore from .stubs import InMemoryArtifactStore def test_backoff_time() -> None: backend = Backoff( backend=Fai...
a87cb9de243ffbf45dd2832b0901299ef2be75bf9e21d456e74dd9554ecb7ab9
Python
1,462
32
# 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...
37f73c4f75e5889b8d4be99a98d50fa0b1024318f106a513824fb16114f88609
Python
1,463
48
# 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...
76de5afa5a3de01bcd8baa059e0f53cca55bbc93fb1d9a36ade0cf951d859906
Python
1,464
33
# 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...
c92af0dd5077994897e8c297f81862712b0791feb408837090e751df52d33936
Python
1,465
44
#------------------------------------------------------------------------------- # elftools tests # # Test 'R_ARM_CALL' relocation type support. # Compare the '.text' section data of ELF file that was relocated by elftools # with an ELF file that was relocated by linker. # # Dmitry Koltunov (koltunov@ispras.ru) # This ...
cb44be304cd8737f3768d46edf9c759fff1512ff0bbd7fbb95e23fd8b066b791
Python
1,465
41
# Copyright 2019-2021 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...
ef37bba007bbe487505bbb0b39ec31689952d29233254e0775dcab7fcad9d1cf
Python
1,466
45
"""Rotation Forest test code.""" import numpy as np import pytest from sklearn.utils.estimator_checks import parametrize_with_checks from sktime.classification.sklearn import RotationForest from sktime.datasets import load_unit_test from sktime.tests.test_switch import run_test_for_class @pytest.mark.skipif( no...
10b12d398de9a2eab5734754c15835bcf04e4d52221403b78237914c80032878
Python
1,467
36
import os import unittest from elftools.elf.elffile import ELFFile address_a = 0x112f address_b = 0x1154 class TestRangeLists(unittest.TestCase): def test_arange_absent(self): with open(os.path.join('test', 'testfiles_for_unittests', 'aranges_absent.so.elf'), 'rb') as f: elffile = ELFFile(f) ...
6ea4a8d55d8819b5f2b701ebe6629c5865a8b1e7df79ffcca2b01e08ebf63ef5
Python
1,467
38
from networkunit.tests.correlation_test import correlation_test from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains from scipy.linalg import eigh from networkunit.utils import use_cache from quantities import ms class eigenvalue_test(correlation_test): """ Test to compare the eigenvalu...
a1b89e79edc7911294b073a323a2800c4eca19369d8feaf93dedbb58a027112e
Python
1,467
41
# 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...
c9c030d2b6b365694953d66d4511929f0e847e7033099f381dc4af4b9840fef0
Python
1,468
45
"""BasicMotions dataset.""" from sktime.datasets._single_problem_loaders import load_basic_motions from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class BasicMotions(_ClassificationDatasetFromLoader): """BasicMotions time series classification problem. Example of a multivar...
7e6f66684f4cb4977f8576088b6181dde5be39d30c49b61763ddeef0d2dc6ade
Python
1,470
46
""" This scripts generates figure S7a of the paper This is the full model error (AV + interaction term) + movement vs. additive model error + movement interaction, during active conditions """ import pandas as pd import matplotlib.pyplot as plt import sciplotlib.style as splstyle import numpy as np import os data_fo...
8c4dded682f1e3216727d92bf7fb3690f49091cc286e632458c3fc4406a6e1ba
Python
1,470
55
import matplotlib.pyplot as plt import numpy as np import seaborn as sns def matched_stripplot( data, x=None, y=None, jitter=0.2, hue=None, match=None, ax=None, matchline_kws=None, order=None, **kwargs, ): data = data.copy() if ax is None: ax = plt.gca() if...
ff0c99c116b6f5ee65a26e1572f275d9447babbfde763f184175156075ecee42
Python
1,472
30
# 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...
523c1e5b4dbba1870822aa9a209e5ed223d91d49283e4ee63c2f7d84da9a58cb
Python
1,473
63
"""Distance computation.""" __author__ = ["chrisholder", "TonyBagnall"] __all__ = [ "DISTANCES_SUPPORTED", "distance", "distance_factory", "pairwise_distance", "euclidean_distance", "squared_distance", "dtw_distance", "ddtw_distance", "wdtw_distance", "wddtw_distance", "edr_...
7357f59fa6b5e3b961ae3d2ff22638b3186b2a9304eae19b3fcbe8b5f8f4ab2f
Python
1,473
49
""" Example of the SMOTE for compositional data, applied on synthetic data generated with the function smote_cd.dataset_generation.generate_dataset, having 2 features and 2 classes. """ import numpy as np import matplotlib.pyplot as plt import smote_cd def create_imbalanced_dataset(): n_features=2 n_cl...
6c90cb0881858992a4364d6027de703a60c3dbec3e3fd27bfb91aaf20980710a
Python
1,475
55
"""Airline dataset.""" from sktime.datasets._single_problem_loaders import load_airline from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader __all__ = ["Airline"] class Airline(_ForecastingDatasetFromLoader): """Load the airline univariate time series dataset [1]. Examples ------...
ee9dbb7af17ef4945cd03db3cabc39b66289e5cad1f482868839cc3bd758398a
Python
1,476
49
from setuptools import find_packages, setup from glob import glob classes = """ Development Status :: 3 - Alpha License :: OSI Approved :: BSD License Topic :: Software Development :: Libraries Topic :: Scientific/Engineering Topic :: Scientific/Engineering :: Bio-Informatics Programming Langua...
1cddcfb40488d7dcd7d2adcd601c5195438539000d5770a442eb2d75fa6b85f4
Python
1,478
39
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Oct 3 13:11:59 2018 @author: wanglab """ import subprocess as sp def transfer(src, dest, label, pull = True, other_endpoint = False): '''Tranfers files from tigress to local/jukebox locations. Inputs: src = tigress source path ...
63d4022268a48dc0f478e103e1a38bbcd0f348a668bd6a197007a02391650829
Python
1,478
40
"""Tests for bycycle.plts.features.""" import numpy as np from bycycle.burst import detect_bursts_cycles from bycycle.tests.tutils import plot_test from bycycle.tests.tsettings import TEST_PLOTS_PATH from bycycle.plts.features import * ###############################################################################...
dbac224d035bb3e69abb5b197fc7f2eafee834715a260ad04ed63578807c2038
Python
1,480
51
############################################################################### # DoC Stage 3 ############################################################################### from camstim.change import DoCTask, DoCImageStimulus, DoCTrialGenerator from camstim import Window, Experiment from psychopy import visual import...
070bff560540b2591dbc26399e83a9c74c535cf64bc3680dddb8c2526b2cb079
Python
1,482
40
import functools from typing import Callable, Optional, Iterable, Iterator import numpy as np from rdkit import Chem, DataStructs import rdkit.Chem.rdMolDescriptors # rdkit's DataStructs.ExplicitBitVect is more efficient for rdkit-internal use. get_morgan_fp: Callable[[Chem.Mol], DataStructs.ExplicitBitVect] = functo...
f58588e2b144b2253d2e0f77ee612a8180f3a4c6f53dde9f222bc30d0e59acbb
Python
1,482
42
import torch import atom3d.datasets.datasets as da import click import logging import os logger = logging.getLogger(__name__) def read_split_file(txt): split_indices = [] with open(txt) as f: for line in f: split_indices.append(int(line.strip())) return split_indices @click.comman...
2709a7f8c0c1ecdb0d0639abf5df9ffd967538efc650ceffd477975cc122ef4e
Python
1,483
44
import rdflib from pyontutils.core import OntResIri, OntResPath, OntGraph from pyontutils.namespaces import rdf, rdfs, owl from pyontutils.config import auth def main(): olr = auth.get_path('ontology-local-repo') ori = OntResIri('http://purl.obolibrary.org/obo/doid.owl') orp = OntResPath(olr / 'ttl/extern...
2a43affafe4cff9544d870aeda0bf898eacbb3199bf2851084bb17f9a5ef875f
Python
1,483
48
import pytest import torch from torch_geometric.data import DataLoader from molgnn.pygdata import RedDB from molgat.models import MolGAT import os.path as osp from molgnn.molfeatures import GenMolFeatures @pytest.fixture def dataloader(): ## Load the RedDB dataset in PyG graph format path = osp.join(osp.dirna...
8e02cbc8ab638e0e35d450d657f0d5eed2b5477a60d1236e057846e80b8f4b85
Python
1,484
44
import argparse from models.gln_model.gln_proposer import GLNProposer def parse_args(): parser = argparse.ArgumentParser("gln_proposer_sample.py") parser.add_argument("--model_name", help="model name", type=str, default="gln") parser.add_argument("--processed_data_path", help="output path for processed da...
2994131bd731393507b0180fd446c22764ab062266e15f22d0ca67bcafcfb7a4
Python
1,486
41
from netplotbrain import plot as npbplot import pytest import pandas as pd import numpy as np # Create 100 random edges. Setting negative ones to 0 for simplicity np.random.seed(2022) xtriu, ytriu = np.triu_indices(100, k=1) weights = np.random.normal(-.5, 0.5, len(xtriu)) graph = np.zeros([100, 100]) graph[xtriu, ytr...
05ab64cbda4d147eb67980475b5c286d7cf2d03ed126ccaa22320c6e8021b2d5
Python
1,487
52
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 15 15:01:52 2018 @author: wanglab """ import tifffile as tif import numpy as np import time def pad(src, start): img = tif.imread(src).astype("float32") print(img.shape, img.dtype) imgshp = img.shape ptchsz = (20,192,192)...
5e96d19f4096d1f9852a991ca22f88fad5054d7985e26d347621290205f557b7
Python
1,487
44
# Copyright 2019-2021 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 tensorflow as tf from ampligraph.latent_features impo...
2f01520703035c30b5890da9ba3c298432eee9783c558c0a765f0a1bc8d4c6e8
Python
1,489
52
"""PBS dataset.""" from sktime.datasets._single_problem_loaders import load_PBS_dataset from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader __all__ = ["PBS"] class PBS(_ForecastingDatasetFromLoader): """Load the Pharmaceutical Benefit Scheme (PBS) univariate time series dataset [1]_. ...
471109297f648ae39bada1858657c35cfaa2b97812f83d0e76557415ec2bba9e
Python
1,489
50
# Copyright 2019-2021 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 logging SUBJECT = 0 PREDICATE = 1 OBJECT = 2 DEBUG =...
6d91228697ee3a7d9923c681426668cb789135d889feb9e825aae019817135bb
Python
1,489
43
# Copyright 2019-2021 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...
cc71b68fcc3faab0f2e0514c16431584e5d009727478b156082dbd316222d28f
Python
1,490
38
""" Utilities for plotting neural activity. """ from matplotlib import pyplot as plt def spike_raster_plot(t,data,colors=None,offset=0) -> None: """ Plot spike rasters of spiking data. :param t: vector of timesteps. :type t: List, np.ndarray, or torch.tensor :param data: 2D vector of spikin...
57b3f0549a01253dbc3b6a119b6fc8c072764c76529aa79169d1365841a42c06
Python
1,492
44
"""Sign test evaluator for benchmark results.""" __all__ = ["SignTest"] import itertools import numpy as np import pandas as pd from sktime.benchmarking.analysis._base import BaseBenchmarkAnalyzer class SignTest(BaseBenchmarkAnalyzer): """Sign test for consistent differences between estimator pairs. Non-...
5dfd9dab71513a71c988408021b3770c312bd19d2aa8e53021093a78863f14be
Python
1,492
36
import shutil from pathlib import Path import urllib.request import shutil # files are cached on Zenodo: https://zenodo.org/records/16605299 CLOUD_CACHE = { ("human_nontata_promoters", 0): "https://zenodo.org/records/16605299", ("demo_coding_vs_intergenomic_seqs", 0): "https://zenodo.org/records/16605299", ...
959d069d1a960e48df2fcc2d6f8787151848b976313823bd61f94fc0dc82be89
Python
1,492
45
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from ..builder import NECKS @NECKS.register_module() class GlobalAveragePooling(nn.Module): """Global Average Pooling neck. Note that we use `view` to remove extra channel after pooling. We do not use `squeeze` as it will...
e8ec0bee1bf413b1d49c54e0aec5fb975ce6deb8e115a880f067b84fa5d4015d
Python
1,492
41
#------------------------------------------------------------------------------- # elftools example: elf_relocations.py # # An example of obtaining a relocation section from an ELF file and examining # the relocation entries it contains. # # Eli Bendersky (eliben@gmail.com) # This code is in the public domain #--------...
4833b0c26df6945e1369c211ddd652e53c97b506da0e3ac4693e3a545abc64da
Python
1,493
42
from __future__ import print_function from __future__ import division import numpy as np from sklearn.utils.validation import check_array from sklearn.model_selection import StratifiedShuffleSplit class GroupShuffleSplitStratified(StratifiedShuffleSplit): def __init__(self, n_splits=5, test_size=2, train_size=...
935ae3da7c552dccc2bef65b67605dc634d75daa425966787e1e401d3fab4b22
Python
1,493
38
import torch import torch.nn as nn import torch.nn.functional as F class TPerceptualLoss(nn.Module): def __init__(self, use_S=True, type='l2'): super(TPerceptualLoss, self).__init__() self.use_S = use_S self.type = type def gram_matrix(self, x): b, ch, h, w = x.size(...
cd7919c6802ee6b9a3b6f9f4e44d6c2f1de6e1b2f06ed02b804deb1d743f2e19
Python
1,493
37
import subprocess from pathlib import Path from translation_tokenize import tokenize from translate_common import source, translation, detokenize_cuneiform, detokenize_translation def translate_cuneiform_base(file, capture_output=False): tokenize("signs_char", file, False, Path("NMT_input/tokenization"), Path("")...
6beb1a22806d2d867fd8f6d5773f7c254853a005d117bc387dde00ba75ab40ce
Python
1,494
45
""" plot_terminator_improvement =========================== .. autofunction:: optuna.visualization.plot_terminator_improvement :no-index: The following code snippet shows how to plot improvement potentials, together with cross-validation errors. .. _visualization-plot-terminator-improvement-plotly-content: """...
c8b1a7d81f885510d7f6d48d825e8830d4c6e66796b2568e89c2c985cbc03053
Python
1,495
56
import torch import torch.nn as nn import torch.optim as optim import torch.backends.cudnn as cudnn import torchvision.transforms as transforms import torchvision.datasets as datasets import argparse import numpy as np import JH_utile # import JH_DataAug import JH_net_param_setting as NetSet import sys import math imp...
d3db9748260f686e331b47f705887cb00a5a0a2b18c32fd5850b50fff8a5c725
Python
1,496
47
"""ACSF1 dataset.""" from sktime.datasets._single_problem_loaders import load_acsf1 from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class ACSF1(_ClassificationDatasetFromLoader): """ACSF1 time series classification problem. Example of a univariate classification dataset wit...
02207fc81be6fb6c5fc6333caff489ceeb445f2bef10c3f68ea90079f13faa3d
Python
1,497
59
"""Utilities to handle checks and conversions between output formats of detectors.""" import pandas as pd def _is_valid_detection(obj, type="points"): """Check if the input is valid common output format. Parameters ---------- obj : pd.DataFrame Output of a detector to check for validity ...
16a48d3ff7f458cb523f3f10de27173e36b4d67dffef846bdc9cf89437d9d1c3
Python
1,498
57
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Nov 20 15:13:29 2018 @author: wanglab """ import os import h5py from augmentor import Augment from dataprovider3 import DataProvider, Dataset class Sampler(object): def __init__(self, datadir, spec, vols=[], mode="train", aug=None): as...
29008a1ce97ef11592081e5739f9180a76f5b08cbba0a41f56decaa904961f19
Python
1,498
51
# 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...
2ec59ec1c814d85f69abeb6e2af65f02d8318ca4aae4f9ea078af7c6cd104a57
Python
1,498
46
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch.utils.data import DistributedSampler as _DistributedSampler from mmcls.datasets import SAMPLERS @SAMPLERS.register_module() class DistributedSampler(_DistributedSampler): def __init__(self, dataset, num_rep...
c5551b2efbeeecd9d89ac480dcee8386b207b5f0bf69f52c071365bfc285be06
Python
1,498
41
from setuptools import setup, find_packages def readme_file_contents(): with open('README.rst') as f: data = f.read() return data setup( name='sns_toolbox', version='1.5.2', packages=find_packages(), url='https://github.com/wnourse05/SNS-Toolbox', license='Apache v2.0', author...
47f456a070cd6fe1395f7fb1eb3161ef700a33aabc759ed414d8fe75609ff7f0
Python
1,504
78
configs = dict() configs["beta_gamma"] = { "betas": [0.55, 0.5], "gammas": [0.5, 0.55], "beta_sharpness": None, "phase": None, "pac": None, "cross_pac": None, "phase_shift": None, "burst_length": None, } configs["beta_sharpness"] = { "betas": None, "gammas": None, "beta_sha...
738d7f1d61763e215fbc50864f411e80b6900069ede78f20d4ce13eeb3f44d3e
Python
1,504
40
# 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...
d5062d100e9de9e573f0fa7c73087c5bd70c46805fa7e77abfdb116f11b2471b
Python
1,504
47
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import inspect from collections import defaultdict from textwrap import dedent from typing import Any, ClassVar import numpy as np def process_snippet(op_name: str, name: str, export: Any) -> tuple[st...
f2da7cd6dfebf353bdce1ff2dae2287e79e76d47ce1c8f07ab16704028d14ed7
Python
1,504
52
############################################################################### # DoC Stage 3 ############################################################################### from camstim.change import DoCTask, DoCImageStimulus, DoCTrialGenerator from camstim import Window, Experiment from psychopy import visual import...
b7456f2c15fc9f3750f5dbe0713c3fc71e1176b9af7d22647218d46f3bdcf859
Python
1,508
47
"""Wilcoxon signed-rank test evaluator for benchmark results.""" __all__ = ["WilcoxonSignedRankTest"] import itertools import pandas as pd from sktime.benchmarking.analysis._base import BaseBenchmarkAnalyzer class WilcoxonSignedRankTest(BaseBenchmarkAnalyzer): """Wilcoxon signed-rank test on each unique pair ...
e049454e9216c50b22150417d257c7361c39e9ba589f11f263bec21af921bc4a
Python
1,508
39
import unittest import numpy as np from ddt import ddt from sklearn import svm from sklearn.model_selection import cross_val_score from scipy import ndimage from SPHARM.classes.stratified_group_shuffle_split import GroupShuffleSplitStratified @ddt class TestCrossval(unittest.TestCase): def test_crossval(self):...
a05d534ddcae13834bff1ce67658aa9d2814a50ff8ffd5726a08df7361de91f1
Python
1,510
32
# 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...
f611310ef1f82f567f8c31e2f41c3195d7524bcf72db8bf3b0ffacc751770bc0
Python
1,510
44
""" plot_terminator_improvement =========================== .. autofunction:: optuna.visualization.matplotlib.plot_terminator_improvement :no-index: The following code snippet shows how to plot improvement potentials, together with cross-validation errors. .. _visualization-plot-terminator-improvement-matplotli...
74147a78fece8d78f26a5a3580ee20cede38f175387ee7d69d838060388c1b37
Python
1,511
41
import numpy as np import pandas as pd class CachedValues(): """Class for mapping keys to pre-computed values. Keys are hashable objects in numpy arrays, for example, SMILES strings. """ def __init__(self, keys: np.ndarray, values: np.ndarray): if len(set(keys)) != len(keys): raise ValueError('All...
8793027fd2cd0dd09363930ceccf4d6e4c28502abebc49eaf5762113230eff3f
Python
1,512
66
from pygel3d import hmesh from utils import * from center_points import CenterPoints import numpy as np if __name__ == '__main__': input_path = 'artery_mesh.obj' output_path = 'artery_centerline_raw' original_file = 'artery_seg.nii.gz' saved_vtk = 'artery_centerline_filtered.vtk' m = hmesh.lo...
ddf6952d6b7bc773f4dc83bf72259de47bd3c61ddcf4aeadad45c2e828448b4d
Python
1,512
48
# 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...
f0e3cbbbb7189a60b7240a074abfc56d57016ec997bcf9cf1727076287e30f64
Python
1,512
44
# 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...
eef16b50f02ae2094b7f2bdb705be44630a2d7ff70c2d683e3b672f05392203c
Python
1,513
44
import logging from typing import Any from flair.trainers.plugins.base import TrainerPlugin log = logging.getLogger("flair") class CheckpointPlugin(TrainerPlugin): def __init__( self, save_model_each_k_epochs, save_optimizer_state, base_path, ) -> None: super().__init...
53bdb76f34c84859b19959eb1da2b75e158867db6fab79d0de715ff3d6d90840
Python
1,514
44
# 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...
95d4283872f41d460a69c55e568f162824881ea92b5fbce269ef4b6506efee48
Python
1,515
45
# 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...
9df13eaeeabbfcc4243342753ea4ead4341688f1be413a9aabb70476418ad014
Python
1,515
42
# 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 OpRunBinaryNum class BitShift(OpRunBinaryNum): def __init__(self, onnx_node, run_params): OpRunBinaryNum.__init__(self, onnx_node, run...
fb97cc075a35a99839bf18e5ea0a31ca2390230811a979473d81d2a02cf5767a
Python
1,516
48
from setuptools import find_packages, setup from glob import glob classes = """ Development Status :: 3 - Alpha License :: OSI Approved :: BSD License Topic :: Software Development :: Libraries Topic :: Scientific/Engineering Topic :: Scientific/Engineering :: Bio-Informatics Programming Langua...
08cc6f2d12b8873efa93d38ed343ab12620ed32149c0e9f27160fd2b62347fa6
Python
1,517
45
# 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...
d3d8fb06c466928ec40d34053e58284e0c1bd50a333ac5e3bfaa167d15d34b98
Python
1,517
46
# 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...
118c7d027db752d9df64b6b9df49ccbffbf5c4cda8d3c4a2b6847a16748c08b0
Python
1,519
38
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # from ampligraph.datasets import load_fb15k_237 from ampligraph.latent_features...
2cf2e9bd893f83a780411cd26ede7ddb36188509c41869d8adfecc569736a7b9
Python
1,519
46
# # # Visualizing a single network # # [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/plot_dmn.ipynb) # # ## Goal # Here we are going to take a atlas from templateflow and only visualize the default mode network # # Import packages import templateflow....
611f98c5724f70bcf6fd1243153b6106524f15f3df1731dbcce4757e4e74f858
Python
1,521
59
""" """ import pickle import yaml def dict2types(input_dict): """ Converts a dictionary into a matching dictionary of just its types. """ output_dict = {} for k, v in input_dict.items(): if isinstance(v, dict): output_dict[k] = dict2types(v) elif isinstance(v, ...
6bbb3031310977e0ef4feee72b66a663c9570e186641e15fdcafc5de7507289e
Python
1,521
57
"""File-related utilities.""" import os from pathlib import Path import subprocess def find_files(path, suffix, relative=None): """ Find all files in path with given suffix. = :param path: Directory in which to find files. :type path: Union[str, Path] :param suffix: Suffix determining file type t...
602c4b06e2701b20a2ea5ce2a1005f37b15025b78054356c5da4ac53fa080a0e
Python
1,522
59
from utils import * import pandas as pd import numpy as np import torch.utils.data import torch import pickle import h5py as h5 import os from model import * def make_chip(): chroms = ["chr" + str(i) for i in range(1,23)][::-1] for cell in ['GM12878']: chipseq_path = os.path.join('./GM12878/') ...
3015349705bce53ed2f83dcc9f311636a967322a01f14d108b32170fd48dee5d
Python
1,523
69
# SPDX-License-Identifier: LGPL-3.0-or-later """The model that takes the coordinates, cell and atom types as input and predicts some property. The models are automatically generated from atomic models by the `deepmd.dpmodel.make_model` method. The `make_model` method does the reduction, auto-differentiation (dummy for...
6b252885a406fae3492d3590cf9b9a2312bcb1c06a18793de916714dbd1220e5
Python
1,523
53
# from src.cajal.sample_swc import compute_icdm_all_euclidean, compute_icdm_all_geodesic from src.cajal.swc import get_filenames, default_name_validate from src.cajal.sample_swc import ( read_preprocess_compute_geodesic, read_preprocess_compute_euclidean, compute_icdm_all_euclidean, compute_icdm_a...
af3bab351981b5e67e4294185cae844f1a7c02543d5830a8454f3ff5354e0fcd
Python
1,525
46
"""ArrowHead dataset.""" from sktime.datasets._single_problem_loaders import load_arrow_head from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class ArrowHead(_ClassificationDatasetFromLoader): """ArrowHead time series classification problem. Example of a univariate problem w...
cc88f23ea204e9b5272d2f774cc8397db9a7cad1341f5aa6eefc6bab5e065aa7
Python
1,526
46
"""Util function for reading tsv files.""" __author__ = ["TonyBagnall"] __all__ = ["load_from_ucr_tsv_to_dataframe"] import pandas as pd from sktime.datasets._readers_writers.utils import get_path # TODO: original author didn't add test for this function def load_from_ucr_tsv_to_dataframe( full_file_path_and_n...
9fe3da0339816dac64af5db0edf29b0ab07bce426f4b03efa0e5f57466f36fb1
Python
1,527
44
__author__ = ["chrisholder"] import numpy as np from sktime.utils.numba.njit import njit @njit(fastmath=True) def _dba_update( center: np.ndarray, X: np.ndarray, path_callable ) -> tuple[np.ndarray, float]: """Perform an update iteration for dba. Parameters ---------- center: np.ndarray (2d arr...
e05a3ab0fafa33e0ef5dd404c54a722266fb1aeb91b48db7625a04452ae5c971
Python
1,527
40
from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV import sklearn.metrics as metrics def gridSearchRF(XA_train, yA_train, seed, n_jobs): # Build classificer model rf = RandomForestClassifier(random_state=seed) # Create the parameter grid based on the resu...
c04ef196d72203efcff48bd50d2cc7ee2b05f19dbbadd1ebf93b069b65a0a5ce
Python
1,528
54
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING from onnx.reference.op_run import OpRun if TYPE_CHECKING: import numpy as np class SplitToSequence(OpRun): def common_run( self, mat: np.ndarray, spli...
ed5c32559e97aae16e8be550f2e8f48b011066233668776f00ffd92916f0327a
Python
1,528
44
"""Util function for reading long format files.""" __author__ = ["TonyBagnall", "AidenRushbrooke", "Markus Löning"] __all__ = ["load_from_long_to_dataframe"] import pandas as pd from sktime.datasets._readers_writers.utils import get_path from sktime.datatypes._panel._convert import from_long_to_nested # TODO: orig...
12876d92161b49cdc4f59244c48dcc5117a65bbbb56d97ceed0a8ad39981a75a
Python
1,531
34
#!/usr/bin/python from __future__ import print_function import os import subprocess import logging logging.basicConfig(filename='george_run.log',level=logging.DEBUG, format='%(asctime)s %(message)s', filemode='w') cells = [9, 14, 16, 17, 18, 19, 20, 21, 22] missingcells =[11] runid = '' for cellno in cells: cmdin...
b957d8c2b1a6eec564bef279e238f3f2e1e674d7c69e31b59f89fc7b31c2c172
Python
1,532
50
import importlib import inspect from collections.abc import Iterable from types import ModuleType from typing import Any, Optional, Protocol, TypeVar, Union, overload T = TypeVar("T") class StringLike(Protocol): def __str__(self) -> str: ... def get_non_abstract_subclasses(cls: type[T]) -> Iterable[type[T]]: ...
8cca1d5f5490334058fd23add21b935e0f4a2c52095099298b9f502c044ac939
Python
1,533
46
import torch from torch import nn class DiceLoss(nn.Module): """ Code borrowed from kaggle segmentation dataset """ def __init__(self, sigmoid_required=False): super(DiceLoss, self).__init__() self.smooth = 1.0 self.normalization = None if sigmoid_required: ...
fb95f92d4e724eca9ded68d788b55311da7f8de39ab03bae9a918df26d40f811
Python
1,533
68
# 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 # """Support for loading and managing datasets.""" from .datasets import ( _l...
9ddd028b39f5564d354aec5d7137481f67b163a0ab47b946922db33d8bc86b0c
Python
1,535
51
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class CommonSplit(OpRun): def __init__(self, onnx_node, run_params): OpRun.__init__(self, onnx_node, run_params) self.n_outputs = len(onnx_no...
15ef7d9f9e8777d00da020f5ca6903e1ca071303205bb57e99e8bcda021566d4
Python
1,539
56
# 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 BlackmanWindow(Base): @staticmethod def export() -> None: ...
52f0270fe9e3b62dd9590034088da4bc72bec88caf9c24bf089d22034d9db714
Python
1,539
54
#!/usr/bin/env python3 """Report on overlaping triples between all pairs of ontology files. Usage: overlaps [options] <file>... Options: -h --help print this -v --verbose do something fun! """ import os import rdflib from docopt import docopt from pyontutils.core import makeGraph try: break...