sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c425ce7e0f2b97123ec3715d6bc78f950f47ed755a4308a4bca1852e6c92fa4a
Python
716
37
""" Dimension class for model server metrics """ class Dimension(object): """ Dimension class defining key value pair """ def __init__(self, name, value): """ Constructor for Dimension class Parameters ---------- name: str NAme of dimension ...
08e19c99e93fbec420836bf4667f8b14dde3a0e6390a5d95feb0ee13e7125373
Python
717
28
"""Plaid dataset.""" from sktime.datasets._single_problem_loaders import load_plaid from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class PLAID(_ClassificationDatasetFromLoader): """PLAID time series classification problem. Example of a univariate problem with unequal lengt...
482dd8e750699266f31624df7515ce916cdc70ef5b69df96c0f3ca1f4cc892a9
Python
717
23
from src.cajal.sample_mesh import ( compute_icdm_all, _connect_helper, cell_generator, get_geodesic, sample_vertices, ) import os def test(): for b in [True, False]: for s in ["euclidean", "geodesic"]: outcsv = "tests/mesh_icdm_" + str(b) + s + "heat" + ".csv" ...
bc9db2d79db45cb6d61636bd8fd3a13fd2ae555269a19632ac5db1f1e2f40ad6
Python
717
19
import numpy as np import atom3d.util.results as res import atom3d.util.metrics as met cutoff='06' maxnumat='600' for id_split in ['30','60']: name = 'lba-id'+id_split+'-siamese_cutoff-'+cutoff+'_maxnumat-'+maxnumat print(name) rloader = res.ResultsENN(name, reps=[1,2,3]) results = rloader.get_all_pre...
4a71a4796232a3b5cbd400c8a5ecb9bfe48a2b385ff6a37f12bf3c238efe2ed7
Python
719
30
"""Custom exceptions for ParaDime. """ class NotTrainedError(Exception): """Method of DR instance called before training.""" class RelationsNotComputedError(Exception): """Attempted to access relation data before computation.""" class NoDatasetRegisteredError(Exception): """Attempted to access the dat...
edc5c1499b47adff10eaa9b2b77d31baff9fc3dfce2d63ac25bc90fadbc43400
Python
720
24
import torch import numpy as np import atom3d.datasets as da from pathlib import Path class MockDataset(torch.utils.data.Dataset): def __init__(self): self.data = np.arange(30) self.year = 2020-np.arange(30) self.scaf = [0]*10 + [1]*5 + [2]*3 + [3,4,5]*2 + [6,7,8,9,10,11] np.random....
4cbc8f2a59c8fd664e43e4b8937ae845787aa280a684ff0cb1f2fe5a126d9c5e
Python
721
18
# 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 # # ...
90892ae69baa3880bd5df54a803feef0c1f6e8233bb12b962d53379950f1ec48
Python
721
28
"""Tests for base change point detection class.""" import numpy as np import pytest from sktime.tests.test_switch import run_test_module_changed @pytest.mark.skipif( not run_test_module_changed("sktime.detection"), reason="module not changed", ) def test_fit_transform_numpy(): """Test that numpy input w...
ad12530e4f6434fd1c1cd787633ccf9ef338a64f9c1e596ce3e3d7994ef44d50
Python
721
24
# 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 class Concat(OpRun): def _preprocess(self, a: np.ndarray, axis: int) -> np.ndarray: rank = len(a.shape) if rank == 0: ...
ef76d52dafe8037a89c3dc073196b6018ac3b58e533c56fc6d4e7823e546a27b
Python
722
19
# 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 # # ...
fc83b3f611598422d23cf0230de2509ba775ecaf975bbdc3d0445f4f827200f2
Python
722
22
"""Dictionary based time series classifiers.""" __all__ = [ "IndividualBOSS", "BOSSEnsemble", "BOSSVSClassifierPyts", "ContractableBOSS", "TemporalDictionaryEnsemble", "IndividualTDE", "WEASEL", "MUSE", ] from sktime.classification.dictionary_based._boss import BOSSEnsemble, Individual...
1f264ef89fbdfc7e53ee7d5be7ff7f91a1626f69203f9146b1caefe2612941d9
Python
723
26
# 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 NonZero(Base): @staticmethod def export() -> None: nod...
2a392f29c23fb8cc6c4acc59159af5636690b91a8ceb2514dfb2051cfce1e602
Python
723
28
# 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 Atan(Base): @staticmethod def export() -> None: node =...
cfc673511186ca69df042bc59ca7fb6f37ca15de3d79b926276d782b56612f3d
Python
723
20
# 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 # # ...
e11ecadee8962e0f8bf794aad808526daafe719b9d227602b84df699e199c646
Python
723
19
# 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 # # ...
e74bf8ed5ab64de8316fe001a8e4345134d682f1fea42fa6f05298c548a31fc4
Python
723
20
# 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 # # ...
d281c383b3ddb67d96b107629186fe3bdd2b75365fc8a4d50f01ba18bc67c2ad
Python
724
17
# 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 # # ...
423455760b5f855a1b6d5b264ce44622bb16f16229e52da4094375d40013538c
Python
725
20
# 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 # # ...
3826e20ddad8c8a51eb5014828ab382f6b42b818761401e21642700a974caa8d
Python
726
28
# 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 Acos(Base): @staticmethod def export() -> None: node =...
d7540d273890d015adb94e97e6302cbc41ece689433f2cc3b71e320c1aa411d1
Python
726
28
# 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 Asin(Base): @staticmethod def export() -> None: node =...
c607edcdb1fd49ba4581b41c0d175e07cd2a489e7429d64b94deacb5ad4db74c
Python
727
17
# from src.configs.atacseq import atacseq_config # from src.configs.atacseq_classify_only import atacseq_clonly_config # from src.configs.atacseq_no_alternating import atacseq_all_config # # from src.configs.atacseq import atacseq_config # from src.configs.default import default_config # from src.configs.dlpfc im...
899629df970611d3cbba387871fc930824aa1214cb7e36fa886616cf9d0f1e3f
Python
728
19
# coding = utf-8 # Copyright (C) 2022. 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 # ...
6b351ea2c39356726cd637dddd86e274d2c012addd02512cdb639c8affca7223
Python
729
25
# 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 OpRunBinaryNumpy class Max(OpRunBinaryNumpy): def __init__(self, onnx_node, run_params): OpRunBinaryNumpy.__init__(self, np.maximum, o...
dcd8571997d5f8320676d4d8a4b45beb8b041264d6e17fb8d7d93b4308d8058b
Python
729
25
# 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 OpRunBinaryNumpy class Min(OpRunBinaryNumpy): def __init__(self, onnx_node, run_params): OpRunBinaryNumpy.__init__(self, np.minimum, o...
393799199107aab7cd393e806bc9aac28b16621b07ed1472859e19f1b7089a42
Python
730
40
from itertools import combinations, product def subset_generator(s): """ a generator to generate all subset of s, also contains Ø. Parameters ---------- s: iterable a set of nodes """ for i in range(len(s) + 1): if i == 0: yield set() else: ...
8e69cd2a821728da7fb326c181b9b09377ef8b2c5ccea475a3107082f00adbf8
Python
730
17
def train_model(config, DataHandler, model, callback_list, verbose=0): if verbose > 0: print('Start training') train_input, y_train = [DataHandler['X_train'], DataHandler['dg_train']], DataHandler['y_train'] valid_input, y_val = [DataHandler['X_valid'], DataHandler['dg_valid']], DataHandler['y_valid...
9ceb50c57020a25300fb000837023c2d0a87fd8df01a612d069380e8ae017cd8
Python
734
30
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def hardswish(x: np.ndarray) -> np.ndarray: alfa = float(1 / 6) beta...
ab6b875bcb1ed8ddc0fc323e42fe756d20283ed01be2ce8b3fe20b11869e8684
Python
734
27
import numpy as np from scipy import ndimage as ndi def NCC_3D(I, J, ws): """ I, J: np.ndarray (3D) ws: local window size """ # Use float64 I = I.astype(np.float64) J = J.astype(np.float64) kernel = np.ones((ws,)*I.ndim) I_bar = I - ndi.convolve(I, kernel, mode="reflect") / kernel...
f45e29ff59adc2625404c1f12d4485e19bf13926da0011e43cea1b0d9b801fa9
Python
738
21
# 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...
845b0561357e35bdd0cd9afb972bc0304bfc5432eeef6224ec9b965fea410cb5
Python
739
24
import sys import numpy as np import torch import atom3d.util.results as res import atom3d.util.metrics as met seqid = sys.argv[1] # Define the training run name = f'logs/lba_test_withH_{seqid}/lba' print(name) # Load training results rloader = res.ResultsGNN(name, reps=[0,1,2]) results = rloader.get_all_prediction...
8b40b30d8186fb8194cf0fee36ac71a7c43343eef02f641e16ddbfbb588aea74
Python
739
29
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 29 15:08:27 2019 @author: wanglab """ import numpy as np, os, tifffile src = "/home/wanglab/mounts/wang/pisano/tracing_output/retro_4x/20180313_jg_bl6f_prv_23/full_sizedatafld/20180313_jg23_4x_647_008na_1hfds_z7d5um_300msec_10povlp_ch00" #trying ...
a18c2e81a000f52345133488eabc760ef057da15c99d2ede103ca0c65ec64888
Python
739
38
""" plot_timeline ============= .. autofunction:: optuna.visualization.plot_timeline :no-index: The following code snippet shows how to plot the timeline of a study. Timeline plot can visualize trials with overlapping execution time (e.g., in distributed environments). .. _visualization-plot-timeline-plotly-con...
324d9c21ffb94f62aa34464d399fef267f38013640cafab3008ee61b78a0a8c0
Python
741
27
""" FacetGrid with custom projection ================================ _thumb: .33, .5 """ import numpy as np import pandas as pd import seaborn as sns sns.set() # Generate an example radial datast r = np.linspace(0, 10, num=100) df = pd.DataFrame({'r': r, 'slow': r, 'medium': 2 * r, 'fast': 4 * r}) # Convert the d...
c0ff53eaeed4de50213d7f4132699d3dd1ce9d071d7276929ba863a825a70ae6
Python
741
28
""" Different cubehelix palettes ============================ _thumb: .4, .65 """ import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set(style="dark") rs = np.random.RandomState(50) # Set up the matplotlib figure f, axes = plt.subplots(3, 3, figsize=(9, 9), sharex=True, sharey=True) # Rota...
e640bdb305c42dbdbac47d13473d58665bd64c222bcb0624b9175a1ab8b07cca
Python
741
22
# SPDX-License-Identifier: LGPL-3.0-or-later """Check style registration without requiring a model or inference backend. CI loads the runtime plugin through LAMMPS_PLUGIN_PATH. A standalone plugin can instead be loaded explicitly with DEEPMD_TEST_PLUGIN. """ import os from lammps import ( lammps, ) def test_dp...
183ac09203f2fa2a149ab7fa8ed9f89c2ab63a06393f4ce899b0c5f3e72aa5a5
Python
742
33
''' @author: Nicholas Browning ''' # #SUPPORTED OPERATOR TYPES# import evaluators as evals # terrible version of Enum struct as python 2.7 doesn't have it # crossover types SBX = 'sbx' UNI_X = "uniform_crossover" # mutator types POLY_M = 'polynomial_mutation' UNI_M = 'uniform_mutation' # replacer types SWAP = 'swap'...
f6fafd6b815d9fc52ad1b323ffe0ae97ec82e0a6764ae49f4e3f78ed9c90aba0
Python
743
31
""" Horizontal boxplot with observations ==================================== _thumb: .7, .37 """ import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="ticks") # Initialize the figure with a logarithmic x axis f, ax = plt.subplots(figsize=(7, 6)) ax.set_xscale("log") # Load the example planets ...
a0600d18a09be97841684be5e01629ea83bdf5d9901ee8fd63f15fc54103c096
Python
744
24
from rxnebm.proposer.gln_config import gln_config from rxnebm.proposer.gln_proposer import GLNProposer def test(): proposer = GLNProposer(gln_config) product_smiles = [ "[Br:1][CH2:2]/[CH:3]=[CH:4]/[C:5](=[O:6])[O:7][Si:8]([CH3:9])([CH3:10])[CH3:11]", "[Br:1][c:12]1[cH:11][cH:10][c:9]([OH:15])...
f2542f524fa7d4f4c7e334a3963b734ed6354588f2d81395feabf70c33403667
Python
744
20
import numpy as np import tensorflow as tf import constants import dataset es = constants.ExperimentSettings() model_prefix = constants.model_name(es) for fold in range(constants.n_folds): # Load de encoder filename = constants.classifier_filename(model_prefix, es, fold) model = tf.keras.models.load_model(...
3836a0c0835ed2e512d495aff64f1e85b5b9023ca039aa6a65ad121b71b70dea
Python
746
37
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np def _get_indices(i, shape): res = np.empty((len(shape),), dtype=np.int64) k = len(shape) - 1 while k > 0: m = i % shape[k] res[k] = m i -= m ...
7215b00e828b516773b02119eb71b6433ee02a9a0302f69f920463fa72d04f11
Python
747
25
# Visualize integrated datasets import numpy as np import matplotlib.pyplot as plt import seaborn as sns import anndata as ad import scanpy as sc from matplotlib.colors import ListedColormap def main(): sns.set_context("poster") sns.set_palette("Set2") data_dir = "./data/anndata/" fig_dir = "./figures...
8e45f3f54da93efbed594330176d91f6fc445f65067f7bc38ba61e03066fdbb9
Python
747
27
""" FacetGrid with custom projection ================================ _thumb: .33, .5 """ import numpy as np import pandas as pd import seaborn as sns sns.set_theme() # Generate an example radial datast r = np.linspace(0, 10, num=100) df = pd.DataFrame({'r': r, 'slow': r, 'medium': 2 * r, 'fast': 4 * r}) # Convert...
d2c6378ab9aa1c2e3d0b04ed146953dd712067ecdd220f5e3006a892ae8a5e6c
Python
747
28
import ast import configparser from collections.abc import Mapping class Settings(Mapping): def __init__(self, setting_file='settings.ini'): config = configparser.ConfigParser() config.read(setting_file) self.settings_dict = _parse_values(config) def __getitem__(self, key): re...
72196798daad68feb3d914b2aa44485be8ec987a480696f10e150639c1c81680
Python
748
22
# -*-coding:Utf-8 -* import os import nipype.interfaces.ants as ants import bcblib.tools.constants as cst proba = os.path.join(cst.get_ants_priors_folder(), "brainPrior.nii.gz") temp = os.path.join(cst.get_ants_priors_folder(), "brainWithSkullTemplate.nii.gz") def skull_strip(dim, anatomical, brain_proba=proba, te...
a9157f3f4df7e5be0b9d232238d469482e1e946724a741579ad273fd042e54b0
Python
748
17
# 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...
407bc19b0ddc93c07627ff073fdbf351ec9dc900850085bc88d7a3e26d57c1d2
Python
749
20
# 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 configuration(parent_package='',top_path=None): from numpy.d...
e558df00736ff8e9ff17b3f1b802cfa29eec1dd19d652d4e0b485854525d7700
Python
749
21
# Import seaborn objects from .rcmod import * # noqa: F401,F403 from .utils import * # noqa: F401,F403 from .palettes import * # noqa: F401,F403 from .relational import * # noqa: F401,F403 from .regression import * # noqa: F401,F403 from .categorical import * # noqa: F401,F403 from .distributions import * # noqa...
fe7a8fe8b3be6eff0a6b4a8c9a16ed27a05b70dc7ccd212a282f992537805990
Python
749
28
# 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 Ceil(Base): @staticmethod def export() -> None: node =...
948370ce9d60b8803a31e559efd3470081a1bcb1cab3ed0a4f1dafac6557f08e
Python
750
28
# 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 Neg(Base): @staticmethod def export() -> None: node = ...
8f4b543b4e926361b785cc07fb850b484ab09f802565767ac1cc3b0f4f2560e7
Python
751
30
""" Horizontal boxplot with observations ==================================== _thumb: .7, .37 """ import seaborn as sns import matplotlib.pyplot as plt sns.set(style="ticks") # Initialize the figure with a logarithmic x axis f, ax = plt.subplots(figsize=(7, 6)) ax.set_xscale("log") # Load the example planets datase...
02ba90fc1f02fceeb5280e05937868f24b1c91b8cbbbe08e3a53c6897c9ff0b1
Python
752
17
# 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...
4350dc47b775668a518c059d7f5dc788bef9c1a247bc8aad4623c160c796a966
Python
752
28
import numpy as np import poisson_disc as pd import nibabel as nib import pyvista if __name__ == '__main__': file = 'estimated_cortex.nii.gz' img = nib.load(file).get_fdata() volume = np.sum(img) dims3d = np.array(img.shape) box_volume = np.prod(dims3d + 1) n = 30000 box_n = int(n * box_v...
72fb445db760b2a16c8d9cd87c1e13fa8a51a98eb8d3baf64b68798420951d50
Python
753
33
from pyhanlp import HanLP from snownlp import SnowNLP import pkuseg # Chinese segmentation def zh_segmentator(line): return " ".join(pkuseg.pkuseg().cut(line)) # Chinese simplify -> Chinese traditional standard def zh_traditional_standard(line): return HanLP.convertToTraditionalChinese(line) # Chinese sim...
b8cbe01a47894209c6cf4caae4b3891d146f6cb8bb1711fc7e8ce5260c2a0196
Python
754
22
# Copyright (c) OpenMMLab. All rights reserved. import random import string import tempfile from mmcls.datasets.utils import check_integrity, rm_suffix def test_dataset_utils(): # test rm_suffix assert rm_suffix('a.jpg') == 'a' assert rm_suffix('a.bak.jpg') == 'a.bak' assert rm_suffix('a.bak.jpg', su...
c9104e17a1bd51611e9ea283e2cbe8bca8112092e8c8103280a5926b4d0a36c3
Python
754
28
# 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 Log(Base): @staticmethod def export() -> None: node = ...
cf5fd279ca4a7250debbbe90ae385e4c0e77d74d91861332b5b430f5b33c99dd
Python
754
27
import unittest from neurondm import OntTerm as OntTerm_ from neurondm.core import OntTermOntologyOnly from pyontutils.core import OntGraph from pyontutils.namespaces import partOf from .common import skipif_no_net @skipif_no_net class TriplesSimple: OntTerm = None def test_part_of(self): eeeee = self...
e198f92d6620c8a7fa6ba18dc93a61aa351dec264b4ca49d0fcbf16675dfafdb
Python
754
33
""" plot_hypervolume_history ======================== .. autofunction:: optuna.visualization.matplotlib.plot_hypervolume_history :no-index: The following code snippet shows how to plot optimization history. .. _visualization-plot-hypervolume-history-matplotlib-content: """ import optuna import matplotlib.pypl...
f7f8ef3529d4a993fedfd40eaa5cd1d848259397d42561818ebad32d3155577d
Python
754
22
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class ReverseSequence(OpRun): def _run(self, data, sequence_lens, batch_axis=None, time_axis=None): index = [slice(0, s) for s in data.shape] ...
2ba2312e3fc4e626fc69637f7837c50663e1af89c08360a3dcb87b51a3961f7b
Python
755
21
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import onnx import onnx.onnx_cpp2py_export.printer as C # noqa: N812 def to_text( proto: onnx.ModelProto | onnx.FunctionProto | onnx.GraphProto | onnx.NodeProto, ) -> str: if isinstance(proto...
34d871f342f65594ac8e4a6b8fc592811c4c514fb250c6f64810667af8a34201
Python
755
40
# SPDX-License-Identifier: LGPL-3.0-or-later from .dipole_fitting import ( DipoleFitting, ) from .dos_fitting import ( DOSFittingNet, ) from .dpa4_ener import ( SeZMEnergyFittingNet, ) from .ener_fitting import ( EnergyFittingNet, ) from .invar_fitting import ( InvarFitting, ) from .latent_charge im...
7227af1b7e0785a5806c1f3e940ca89b14553becc369be953043ece6112805c3
Python
756
29
import sys fi=open(sys.argv[1]) fo=open(sys.argv[1]+'.ucscInter.bed','w') i=1 for line in fi: seq=line.rstrip().split('\t') c1=seq[0] s1=seq[1] e1=seq[2] c2=seq[3] s2=seq[4] e2=seq[5] if c1==c2: signal=str(min([int(seq[6]),1000])) this_chr=c1 this_start=str(m...
b7b0cb1a3715787e8eca88850ed11c864deef77295f43cc63978690cfc70142e
Python
756
23
import concurrent.futures import multiprocessing def get_process_pool_executor(max_workers=multiprocessing.cpu_count()): return concurrent.futures.ProcessPoolExecutor(max_workers) def execute_task_in_parallel( task_fn, inputs, max_workers=multiprocessing.cpu_count() ): results = {} with get_process_...
c15099c9cf056cbfb708d337e6d3f97dfc48a3cb4d8c9a89c78df7dc5feb1403
Python
757
17
# 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...
e27c1fa76de073e01d2d958e4bd1165ff638eb5018a4888c5503d78320e8affe
Python
757
28
import torch from torch import nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 32, 3, 1) self.conv2 = nn.Conv2d(32, 64, 3, 1) self.dropout1 = nn.Dropout2d(0.25) self.dropout2 = nn.Dropout2d(0...
1a65ce0f01fdd1f4e749b62c3cf0ed098dbb7b48dc8b4faddad3adaad0f55923
Python
758
28
# 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 Sqrt(Base): @staticmethod def export() -> None: node =...
44190a5ea9c99028fda5a37fbab130d6fbc59200cd07df573575fd285d7dc73e
Python
758
24
import os from translate_common import translation, detokenize_translation from translate_from_transliteration import translate_transliteration_base def translate_transliteration(sentence): tmp_file = "transliteration.tmp" with open(tmp_file, "w") as f: f.write(sentence) raw_result = translate_tr...
4708a7c3fab8b858d7fa91bb10ccfbcb142396944f70bd6ffe9d5b63664318be
Python
761
28
# 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 Exp(Base): @staticmethod def export() -> None: node = ...
a74b72c2cc9cfe4814c7052b05171e36983b137572e7bc5504b68b017042cf96
Python
761
28
from q2_matchmaker._stats import hotelling_ttest, spherical_test import numpy as np import unittest class TestStats(unittest.TestCase): def setUp(self): np.random.seed(1) n, p = 100, 50 self.Xrand = np.random.randn(n, p) self.Xreal = np.random.randn(n, p) self.Xreal[:, 0] +...
b804944936037fb543f2b4de625afa3088d64fb39674a3541fd7c8010fd75fbf
Python
762
28
# 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 Floor(Base): @staticmethod def export() -> None: node ...
7806994d424f62872f10c3aecebe4d8e953302514b13ec543d9eafdf0b9fceb3
Python
766
28
"""Arsenal test code.""" import pytest from sktime.classification.kernel_based import Arsenal from sktime.datasets import load_unit_test from sktime.tests.test_switch import run_test_for_class @pytest.mark.skipif( not run_test_for_class(Arsenal), reason="run test only if softdeps are present and incremental...
cd6f3ced21f6b7122651fbd4f3493cdcd6f1c6794795b77306376bc98fb7fb8f
Python
766
16
# 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...
fa4c6f6dcb32ae6340de1ff8e9aa20a027fa6eaa7aad658d2bc39cf82d5ef9c6
Python
766
21
# 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 # # ...
0777f5186c02d5816f684795c87531ece4dfbac53a653b6770fb7dc91b602d52
Python
768
28
# 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 Tanh(Base): @staticmethod def export() -> None: node =...
2543abeb5291ad6c8669fa2d63bd4306be37d51892a77b65e53c79721f26375b
Python
769
25
""" Scatterplot with multiple semantics =================================== _thumb: .45, .5 """ import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="whitegrid") # Load the example diamonds dataset diamonds = sns.load_dataset("diamonds") # Draw a scatter plot while assigning point colors and si...
26c4969b8040f1d601793643afcbc4a0552bf3ee4dd0732868c9388b5752a287
Python
769
28
# 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 Cosh(Base): @staticmethod def export() -> None: node =...
f27e23471ea9304402cbff127b93259998d4b59afd09799d16220736fdd48460
Python
769
24
from pathlib import Path from setuptools import find_packages, setup required = Path("requirements.txt").read_text(encoding="utf-8").split("\n") setup( name="flair", version="0.15.1", description="A very simple framework for state-of-the-art NLP", long_description=Path("README.md").read_text(encoding...
4ceaa5d41f1a8738a10ab307268b8178f81780c0a35f89270941a08ec0500342
Python
770
18
from __future__ import print_function import numpy as np from featureExtractor import FeatureExtractor from featureDownSampler import FeatureDownSampler class FeatureExtractorRealFourierDownSampled(FeatureExtractor): def __init__(self, params): self.params = params self.extractorType = 'realFourie...
7bf286d8d6fbb69ec9df285005b2700773d6e313631ff60211376acf3878149b
Python
770
28
# 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 Sinh(Base): @staticmethod def export() -> None: node =...
7c6aed1f2186fb0347f4fd36ff39f4bb2b582095d1d1e6439e75e09cd903acf6
Python
773
27
"""Collections of estimators, datasets, and metrics.""" from sktime.catalogues.classification import ( BakeOffCatalogue, DummyClassificationCatalogue, ) from sktime.catalogues.forecasting import ( DummyForecastingCatalogue, M4CompetitionCatalogueDaily, M4CompetitionCatalogueHourly, M4Competitio...
7d08a48847e8557dc6b8125c382cabf13d19b38a025640abb19866281e98c902
Python
773
29
"""ContinuousIntervalTree test code.""" import numpy as np import pytest from sktime.classification.sklearn import ContinuousIntervalTree from sktime.tests.test_switch import run_test_for_class @pytest.mark.skipif( not run_test_for_class(ContinuousIntervalTree), reason="run test only if softdeps are present...
a532a292f66f696b2c155db62e0f662bc15459a311f6beb7003630be1b39538b
Python
773
36
import numpy as np a = np.load('056_500probs_test.npy') b = a[:, :, 1] c = a[:, :, 2] d = a[:, :, 3] probs = b+c+d probs = np.reshape(probs, (56,5852)) edges_train= probs/56 results=np.zeros((5852)) for i in range(56): results=results+edges_train[i,:] index=results<(0.5) results[index]= 0 genes=77 edges_resul...
9d85bcbf2fd85bc9296d7f6b91572848a890cc6d4ccdc89dc7af447340fcd9ad
Python
775
25
# ---------------------------------------------------------------------------- # Copyright (c) 2017-2026, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
7f85ea9f0f1f17adf1c40ad02e310b051181123901eea160d666159618e17b82
Python
776
33
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 11 09:24:34 2022 @author: nagehan """ import matplotlib.pyplot as plt import numpy as np import scipy import scipy.stats gi = np.array([1.03, 1.69, 1.85, 1.83, 1.77, 2.11, 2.33, 2.21, 2.53]) gi_zilles = np.array([1.17, 1.60, 1.75, 1.97, 1.87, 2.31...
10aa5378ccce6567674b6d1557ff675fc9f7b55b033005dfe26a430655716408
Python
777
17
"""M4 forecasting competition catalogue.""" from sktime.catalogues.forecasting.M4._daily import M4CompetitionCatalogueDaily from sktime.catalogues.forecasting.M4._hourly import M4CompetitionCatalogueHourly from sktime.catalogues.forecasting.M4._monthly import M4CompetitionCatalogueMonthly from sktime.catalogues.foreca...
2446b70df995664bc47e89544b930feb1f89480136357168d01c597046fb55e9
Python
777
17
# 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...
bc945b2c84e1d7eb95bd30f95e149c625c411d35ec66a94a8456dc35cd862199
Python
777
28
# 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 Softsign(Base): @staticmethod def export() -> None: no...
4c93f898be7ddb9dd284261aaf88679aabd796dcbfaabf4d5e3359730894bbb1
Python
778
21
from __future__ import print_function import sys import json from os import listdir from parameterSetup import ParameterSetup from classifierTrainer import trainClassifier args = sys.argv optionType = args[1] if len(args) > 2 else '' optionVals = args[2:] if len(args) > 2 else [0] print('optionType =', optionType, ', ...
8826a1215824438a067116d9e28eb4b62b72937914790cdad24e9b1d468eacbd
Python
778
21
# 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.latent_features.layers.corruption_generation import Corruption...
b6a6d13c9c03bc8b0fcab6619f22df107f2b1ea8b9f13c9183b555ca643e4ef7
Python
780
31
#!/usr/bin/env python # cloud_workstation 1.0.0 # Generated by dx-app-wizard. # # Basic execution pattern: Your app will run on a single machine from # beginning to end. # # See https://wiki.dnanexus.com/Developer-Portal for documentation and # tutorials on how to modify this file. # # DNAnexus Python Bindings (dxpy) d...
bc6280555a16d123e9f957be2b056987447dabbc2a74cd6359b78a61fa9bc046
Python
780
28
# 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 Asinh(Base): @staticmethod def export() -> None: node ...
d5c6b0195044650b5a38a01e9e57f514fbe59b515ef48d2b64c848aac49cfcad
Python
780
40
""" Collect process memory usage metrics here Pass a json, collection of pids and gpuID """ import logging import psutil def get_cpu_usage(pid): """ use psutil for cpu memory :param pid: str :return: int """ try: process = psutil.Process(int(pid)) except psutil.Error: ...
12008536be3c94a4534ed63c38e38f61641a9c6a8b8066b54a2445197a9908c2
Python
781
28
# 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.reference.ops.aionnxml.op_binarizer import compute_binarizer class ...
5c101e626e16dc795b5ac2adb7c80ec2a13f1629c8118ed1740e91838636ef90
Python
781
17
# 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...
f1fdbe2ed22d7447f524553c811d5a41d332a27ee55347c2d67d686c3ed478e6
Python
781
32
import pytest import os from pathlib import Path import atom3d.util.file as fi pdb_path = 'tests/test_data/pdb' test_file_list = [pdb_path+'/103l.pdb', pdb_path+'/117e.pdb', pdb_path+'/11as.pdb', pdb_path+'/2olx.pdb'] def test_find_files(): file_lis...
2fe651c65c3020323537ba36303eb40a5dfe4f271bf4e1646760f4990b185560
Python
783
26
import pickle as pkl import numpy as np import os def main(): FOLDER = "data/tl_train/U6T7/xu2015TrainHl60/set0/10_fold/0_fold/" FOLDER_2 = "data/tl_train/U6T7/xu2015TrainHl60/set1/10_fold/0_fold/" FILE_NAME = "X_biofeat_train.pkl" with open(os.path.join(FOLDER, FILE_NAME), "rb") as fp: X_bio...
5c7a24b1de8783cd574cd02ef2053a6230b7e56bd3b6b89c455b5fae81050178
Python
784
25
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging from logging.handlers import RotatingFileHandler logger = logging.getLogger() def init_logger(log_file=None, log_file_level=logging.NOTSET): log_format = logging.Formatter("[%(asctime)s %(levelname)s] %(message)s") logger = logging...
c3901f3012bbba297e3f9fa7e08f560c4169717093d6de03ea48f5c2a5bed1f3
Python
784
28
from __future__ import print_function from __future__ import absolute_import from __future__ import division import argparse import logging import numpy as np import torch import torch.nn as nn t_float = torch.float32 np_float = np.float32 str_float = "float32" opts = argparse.ArgumentParser(description='gpu option...
1ac7e7dcadaed8598f71e77f38bdf9d36903ec558c24f91fad2d0702ddc55feb
Python
786
27
from collections.abc import Iterable from typing import Union from flair.data import Corpus, MultiCorpus from flair.models import MultitaskModel from flair.nn import Classifier, Model def make_multitask_model_and_corpus( mapping: Iterable[Union[tuple[Classifier, Corpus], tuple[Classifier, Corpus, float]]] ) -> t...
1c322edbb7c2d35148c30b855e1eb6c4e1d0102d0d9ee3222f3b120c6dae4282
Python
787
25
import os from translate_common import translation, detokenize_translation from translate_from_cuneiform import translate_cuneiform_base def translate_cuneiform(sentence): tmp_file = "cuneiform.tmp" with open(tmp_file, "w") as f: f.write(sentence) raw_result = translate_cuneiform_base(tmp_file, T...
cae4844e0ffbf270b14b9732d0c43615293c963c56947882173b52ad75cbca5f
Python
789
21
import pandas as pd import numpy as np import os file_names = [i for i in os.listdir('results/') if i.endswith('_cellclass_2.txt')] timepoints = [i.split('_')[1] for i in file_names] fdr_vals = [i.split('_')[3] for i in file_names] sources = ['Engineered' if 'Engineered' in i else 'Donor' for i in file_names] df_comb...