sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1d3a9e1412c2e394f9ee4d9ae9bb40ec81c1067b1c66b998a2ca8f81f963ebb9
Python
638
27
""" This script tests StaticDecisionTree in staticDecisionTreeClasifier module """ # Authors: Taro Tezuka <tez@sings.jp> from __future__ import division import numpy as np from staticDecisionTreeClassifier import StaticDecisionTreeClassifier X_train = np.array([[3,2,5,1,1,1,3,2,5,4], [7,3,1,-2,6,5,-5,8,1,6], [2,5,...
533b13b7753139afc929a97a92bb3f8ce5b00fe0f551fa333e64c08fa1100ac5
Python
638
27
""" plot_optimization_history ========================= .. autofunction:: optuna.visualization.matplotlib.plot_optimization_history :no-index: The following code snippet shows how to plot optimization history. .. _visualization-plot-optimization-history-matplotlib-content: """ import optuna def objective(tri...
55b90416f11ab7cef42eb540a342aab2abb944664d80856f985d4b5d55312463
Python
639
17
# 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...
a85323fe993e6c2194986b7edacc3600f238ca650e773dda17ca2f0880b764aa
Python
641
23
"""Base class and type for numba distances.""" __author__ = ["chrisholder", "TonyBagnall"] __all__ = [ "NumbaDistance", "DistanceCallable", "DistanceFactoryCallable", "DistancePairwiseCallable", "ValidCallableTypes", "MetricInfo", "DistanceAlignmentPathCallable", "AlignmentPathReturn", ...
b2fd560e95eb0216f29a324b4792441623f15b35c9372d7667136fa2bd110e6b
Python
642
32
""" plot_timeline ============= .. autofunction:: optuna.visualization.matplotlib.plot_timeline :no-index: The following code snippet shows how to plot the timeline of a study. .. _visualization-plot-timeline-matplotlib-content: """ import time import optuna def objective(trial): x = trial.suggest_float...
1252a372581f3b2f62d982490bfd1c9566fb75d528c8726afc13272c5d1a128b
Python
643
26
import datamol as dm from rdkit.Chem import rdMolDescriptors dm.disable_rdkit_log() def smiles_to_fingerprint(smiles, fp_size, fp_radius): mol = dm.to_mol(str(smiles), ordered=True) fingerprint_function = rdMolDescriptors.GetMorganFingerprintAsBitVect pars = { "radius": fp_radius, "nBit...
19bb667d85d948815b3e2df6a4607e535f8eb35fe735a4cc5e16aa7b558d3b3b
Python
643
17
"""utility functions for benchmarking module.""" import re def _check_id_format(id_format: str, id: str) -> None: """Check if given input ID follows regex specified in id_format.""" if id_format is not None: if not isinstance(id_format, str): raise TypeError(f"id_format must be str but re...
3aec6abf54ff61dd48532db606981c00d45aadb02ba1b7ec3e1dfc50c2bf36d0
Python
643
33
#!/usr/bin/env python3 # tifffile/lsm2bin.py """Convert TZCYX LSM file to series of BIN files. Usage: lsm2bin lsm_filename [bin_filename] """ import sys try: from .tifffile import lsm2bin except ImportError: try: from tifffile.tifffile import lsm2bin except ImportError: from tifffile im...
598adb4086091c96d5d45190702a88b73e4caf26f370d0c3a5760a17af9e3ec8
Python
643
27
""" Cache test datasets before running tests / building docs. Avoids race conditions that would arise from parallelization. """ import pathlib import re from seaborn import load_dataset path = pathlib.Path(".") py_files = path.rglob("*.py") ipynb_files = path.rglob("*.ipynb") datasets = [] for fname in py_files: ...
cf02cd8c5466eb90a4cdcc217866a27270a47c9bc472313060055fb421565ca0
Python
644
22
import scipy as sp import numpy as np def get_spearmanr(all_models, DataHandler): predictions = [] test_input = [DataHandler['X_test'], DataHandler['dg_test']] test_true_label = DataHandler['y_test'] for ind, model in enumerate(all_models): test_prediction = model.predict(test_input) ...
f46cf6eb4b86ee58ec04320515969786d94e6373943aea973c36cf8b86116efa
Python
644
26
import torch import numpy as np def gunpowder_balance(labels, mask=None, thresh=0.): if mask is not None: bmsk = (mask > 0) nmsk = bmsk.sum().item() assert(nmsk > 0) else: bmsk = torch.ones_like(labels, dtype=torch.uint8) nmsk = np.prod(bmsk.size()) lpos = (torch....
afc520116c095d34477c5ef2577f0442b8eb578d4d26db4b2e92e257f6e9876b
Python
646
21
# 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 InstanceNormalization(OpRun): def _run(self, x, s, bias, epsilon=None): dims_x = len(x.shape) axis = tuple(range(2,...
c9cb777183208050f0b96413e0b54076f2652f7cd06ed0d947bfdc8888fd7124
Python
648
33
""" plot_rank ========= .. autofunction:: optuna.visualization.plot_rank :no-index: The following code snippet shows how to plot the parameter relationship as a rank plot. .. _visualization-plot-rank-plotly-content: """ import optuna def objective(trial): x = trial.suggest_float("x", -100, 100) y = ...
64eae3ed69edf1a1b2e116fcc45efa566f8006f7056727b7439f6e8ce437a38b
Python
649
12
"""Regenerate every result and figure, then verify. Fixed seeds throughout.""" import subprocess, sys, os HERE = os.path.dirname(os.path.abspath(__file__)) for script in ["t5_passk_crossover.py", "t2_t6.py", "t1_t3_t4_bridge.py", "c6_correction.py", "t_star.py", "empirical.py", "make_figur...
8ecb50a5e05e6e7f7be17840bd320b19b81962936664ece7c999303d2bc460a9
Python
653
16
# 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 # # ...
517504c9a584cbaa161929e7519fb24163d7c2b116ef81b1964abb8df3457aec
Python
654
16
# 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 # # ...
c35037b951d3e866709bc27bd4be4eab541c01675804da6c94c67b0e93e857a9
Python
654
23
# 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 Mish(Base): @staticmethod def export() -> None: node =...
cf1a4e2861da90c9a2691d747406650558b780b05eafa47f177f8ca215fd69da
Python
654
15
# 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...
0621ceb8d19f7ca46851af7b217026fc6ca6214a190321c375743101994710c6
Python
655
16
# 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 # # ...
077ab23e695baad135d2dd360d3325e268c0d14de41a9748e210a58a920d702d
Python
655
16
# 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 # # ...
6ca1e67f5c6075b1d48d614a972c1b5d24e99e9a154e076414892264aa9e669a
Python
655
16
# 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 # # ...
511e0ce11851b452c2dc11cd52a3c1fbd247ce63a40b10b74c4e57f103c24b4e
Python
657
16
# 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 # # ...
8db1f903a58ad336a27e3952061888fe8c81b6e7376cbda890874e09be723bbd
Python
657
30
""" plot_param_importances ====================== .. autofunction:: optuna.visualization.plot_param_importances :no-index: The following code snippet shows how to plot hyperparameter importances. .. _visualization-plot-param-importances-plotly-content: """ import optuna def objective(trial): x = trial.s...
53c1f533937bf30044e6bfc385f8adab21809a76e0f78162700ac0c4788934ae
Python
658
42
# SPDX-License-Identifier: LGPL-3.0-or-later from .charge import ( GridDensityLoss, ) from .dens import ( DeNSLoss, ) from .dos import ( DOSLoss, ) from .ener import ( EnergyHessianStdLoss, EnergyStdLoss, ) from .ener_spin import ( EnergySpinLoss, ) from .loss import ( TaskLoss, ) from .popu...
5db02ced90724a7967b78953b3c42f42c884848ad32c41bab56425d112d259db
Python
658
16
# 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...
7595628eaf0094b4ab630f4729dd6703adb937847c15961e7db876d967b7fac3
Python
658
16
# 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 # # ...
f07fd32840890b90b1544954f819bfeef42eda9e11264ef3ae76c7460fb246d6
Python
658
32
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 2 13:59:29 2022 @author: sam """ import h5py import glob import matplotlib.pyplot as plt import os dirname='/home/sam/bucket/octopus/8k/oct_456' file = dirname + '/htFlip.csv' af = sorted(glob.glob(dirname + '/' + '*.reg')) #df = pd.DataFrame(dat...
0ef4f1b6ecad6254488320d63d39d7594758a8ab221f25252c77a379c63e0cc6
Python
659
15
import os import torch import torchvision class ImageFolderWithPaths(torchvision.datasets.ImageFolder): """Custom dataset that includes image file paths. Extends torchvision.datasets.ImageFolder""" # override the __getitem__ method. this is the method that dataloader calls def __getitem__(self, index): ...
659f515a8282bc3d5cde1c982a20a386359414c3990d1e0b778ffef0c44ddfff
Python
659
22
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'web.settings') try: from django.core.management import execute_from_command_line except ImportEr...
78a8bc8d54bfe16c67753221f7fb71a3445882e23ed9ef774a0c2fc4fe10de64
Python
659
22
import numpy as np import pandas as pd import seaborn as sns from graspologic.simulations import sbm def sample_toy_networks(seed=888888, ns=None, B=None): np.random.seed(seed) if ns is None: ns = [5, 6, 7] if B is None: B = np.array([[0.8, 0.2, 0.05], [0.05, 0.9, 0.2], [0.05, 0.05, 0.7]])...
f71299fedd0ce3158bb774be5e7b995b6f35bc2c724f13c46cccdcc8fe16406b
Python
659
21
"""Concrete catalgue classes for forecasting experiments.""" from sktime.catalogues.forecasting.dummy import DummyForecastingCatalogue from sktime.catalogues.forecasting.M4 import ( M4CompetitionCatalogueDaily, M4CompetitionCatalogueHourly, M4CompetitionCatalogueMonthly, M4CompetitionCatalogueQuarterly...
9b69b8f28fc3614c90ac6745c45bb798d3e547a6d45dd7f96b2fd0d52e2c0c24
Python
660
15
# 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...
283c47b148738549b802b7ed2acd7e0b9a21599428bdde325004f4c89be30c36
Python
661
23
from sciunit.models.backends import Backend import os class storage(Backend): name = 'storage' def _backend_run(self): try: data = self.model.load() except Exception as e: print(e) raise NotImplementedError('Hint: the model class must define a ' ...
f20df4abeddad84352a1dbdc86f1e366ac3b5d8ebf2c0bea42c82e7f604173a1
Python
661
29
""" plot_parallel_coordinate ======================== .. autofunction:: optuna.visualization.plot_parallel_coordinate :no-index: The following code snippet shows how to plot the high-dimensional parameter relationships. .. _visualization-plot-parallel-coordinate-plotly-content: """ import optuna def objecti...
931ab8932d6d7e9f5a8ad1540eea5fec52a0d7ce7374b0ba41efd1940d6d9514
Python
662
21
import os import torch.nn.functional as F import torch from torch_geometric.nn import GCNConv from collections import Counter class Net(torch.nn.Module): def __init__(self, in_size=16, hid_size=8, out_size=2): super(Net, self).__init__() self.conv1 = GCNConv(in_size, hid_size) self.conv2 = ...
48c37e43e02e84bf472e037a7ecc825c84442aa0906a53d588ef9b0a1b667e50
Python
663
24
class Solution(): #structure of the solution def __init__(self): self.num_features = None self.num_agents = None self.max_iter = None self.obj_function = None self.execution_time = None self.convergence_curve = {} self.best_agent = None self.b...
2b32f29b42f15799cc67494858c0d435e857022af3dbd4a7bc13867a9eeddfec
Python
664
32
""" plot_rank ========= .. autofunction:: optuna.visualization.matplotlib.plot_rank :no-index: The following code snippet shows how to plot the parameter relationship as a rank plot. .. _visualization-plot-rank-matplotlib-content: """ import optuna def objective(trial): x = trial.suggest_float("x", -100...
6da0cf58cb92ee9f3eebc2f50e96321cbde5f96cac57be245d75cbf72b2408a2
Python
664
16
# 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 # # ...
3be1886072b8bb647d90fbec01d8a637d044663a717d4a2f341d4510e6aa611a
Python
665
16
# 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 # # ...
6dad9e5d36d7cdb21b65fbb5b8a57f562ed992568aad3009f4f795b05a13e79f
Python
665
16
# 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 # # ...
edd7cf90de8200801baadb6e08eba0623c5c0f712e34547c5d28e0f3f4a3e368
Python
665
18
# 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 # """AmpliGraph is a library for relational learning on knowledge graphs.""" impo...
e3ab847346d41539e5171290b261dda01bbbf23d95ec85bbb4baf216e5d520f8
Python
666
16
# 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 # # ...
6ed739bb366fb94d563530a0ba6edf9b8f3c3ead313e235077739cf741f980c8
Python
668
24
""" These are the plotting functions used by many ODP programs """ import matplotlib def format_matplotlib(): """format the fonts and print options for the plots""" font = {'family' : 'sans-serif', 'sans-serif' : 'Helvetica', 'weight' : 'normal', 'size' : 12} matplot...
3c8d445540fb91dd885708439085f5bb8e018a6218691deff45bd405bec6d9d1
Python
669
26
# roifile/tests/conftest.py """Pytest configuration.""" import os import sys if os.environ.get('VSCODE_CWD'): # work around pytest not using PYTHONPATH in VSCode sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) ) def pytest_report_header(config: object) -> str:...
93ac1f9eb46800448ebfadd9021ea3c4dc7516e69b70f40650b63a23ba8d1d87
Python
669
16
# 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 # # ...
0d62d14c9189df95bd98822e2edcad6443cb3ae91eba9b5627c545103de4904c
Python
670
9
#======================================================================================================================= #Copyright #======================================================================================================================= # Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick ...
2fe2970be5629f77fbf34b9f91e65786b20c7f3b24429f6d051ffc38ac18532b
Python
670
20
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op_common_window import _CommonWindow class HannWindow(_CommonWindow): r"""Returns :math:`\\omega_n = \\sin^2\\left( \\frac{\\pi n}{N-1} \\right)` where...
9b41c79dd31fc13002255e0a8bdbbdb7ce2132b35a7da33cb9a0ac941081019e
Python
670
16
# 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 # # ...
d38e8a29cbed15bd2eee5a27aaea291f3ee2bf6d40a1427ad11a428453798fa6
Python
671
20
import ontquery as oq from pyontutils.core import OntTerm import os TEST = 'https://test3.scicrunch.org/api/1/' PRODUCTION = 'https://scicrunch.org/api/1/' InterLexRemote = oq.plugin.get('InterLex') interlex_remote_production = InterLexRemote( # When ready, should be changed to 'https://scicrunch.org/api/1/' for ...
f9f013342a36d379cef35b1bdfabbb976c313de028c88e8afeb5b450fdc465f5
Python
671
16
# 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 # # ...
907db71da62e0c6da4c804d0168594dd0712ceb84694dc2b4aff320360c2898b
Python
673
29
""" plot_param_importances ====================== .. autofunction:: optuna.visualization.matplotlib.plot_param_importances :no-index: The following code snippet shows how to plot hyperparameter importances. .. _visualization-plot-param-importances-matplotlib-content: """ import optuna def objective(trial): ...
0182a285f3084d930e9da5e93b1af1daa50a4bde10356ca70b8914901801dedc
Python
674
32
#!/usr/bin/env python import unittest from hbip.tests.test_example import TestExample from hbip.tests.test_load_test_data import TestLoadTestData from hbip.tests.test_main import TestMain class CountSuite(object): def __init__(self): self.count = 0 self.s = unittest.TestSuite() def add(self,...
f65b6234135bcd0c268357afa4e32e73e75d43d4cf5eb47f6d9199b4daac6bfa
Python
674
21
"""Tests for bycycle.utils.timeseries.""" import numpy as np from bycycle.utils.timeseries import * ################################################################################################### ################################################################################################### def test_limit_s...
c9caa8cbd6cede06d19b79942d3cb6286153d2c1d9d732bfcd34fde4847e4703
Python
675
15
# 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...
04067f6de6c0c66f3d852f2bf52526db4b898523c7862fd162a511cee58411ce
Python
677
28
""" plot_parallel_coordinate ======================== .. autofunction:: optuna.visualization.matplotlib.plot_parallel_coordinate :no-index: The following code snippet shows how to plot the high-dimensional parameter relationships. .. _visualization-plot-parallel-coordinate-matplotlib-content: """ import optun...
31ae999022bf9444a5ea43406b34bfad41f9ad0da93b6a148a9d351feb222a62
Python
679
23
import torch import torch.nn as nn import torch.nn.functional as F from .resnet import resnet18ori import pdb class FeatureNet(nn.Module): def __init__(self, args, n_class=2): super(FeatureNet,self).__init__() self.args = args self.n_class = n_class self.encoder = resnet18...
63b198a74ab3cd0d76cb4020ca185befe13d07117737b34fbf4ddc729ccfb44e
Python
679
27
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.helper import np_dtype_to_tensor_dtype from onnx.reference.op_run import OpRun from onnx.reference.ops.op_cast import cast_to def _cast_like(x, y, saturate: bool): return (cast_to(x, np_d...
8363d283c7e9f87995fcecffcfb138a18c0dbe9bfebd5e33e95085f69aa98ff9
Python
679
20
import inspect def list_classes_from_module(module, parent_class=None): """ Parse user defined module to get all model service classes in it. :param module: :param parent_class: :return: List of model service class definitions """ # Parsing the module to get all defined classes class...
8cce2865f1b881719f5352b70d1f9c66e8b38961438dcd64854134944cc85865
Python
679
27
# -*- coding: utf-8 -*- """ Created on Wed Jan 23 18:55:32 2019 @author: daniel """ class Synapse(object): """Generic synapse class.""" def __init__(self): self.type = None self.sec = None self.pos = None self.spinepos = None self.obj = None self.source = None ...
7750664f6d488b90551d0ec72b5aeacaa4eb18f02a7570438350fbdc7193f3ae
Python
680
27
# 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 OpRunUnaryNum def sigmoid(x: np.ndarray) -> np.ndarray: """Numerically stable sigmoid implementation that supports scalars and nd-arrays.""" ...
96e394cf03c5568116f30228d25372ef671ea0c137043cb7b0cee5e1650faa6e
Python
680
26
from setuptools import find_packages, setup setup( name="lfads_tf2", version="0.1.0", packages=find_packages(), install_requires=[ "tensorflow-gpu==2.0.0", "tensorflow-probability==0.8.0", "tensorflow-addons==0.6", "tensorboard==2.0.2", "yacs==0.1.6", "Py...
1a92041dee5e2e117d9ed1e9a14ff5f425dd2e27f91cad6fa6ad3b0b5e7a95b3
Python
682
13
import torch.nn as nn class VPModelBlock(nn.Module): r""" This class implements the base class for many model blocks used by this package's prediction models. The named constants exposed in this base class provide convenient ways to implement model blocks that match official implementations. """ ...
3b139140a3df24576be3d913aa4c9df320dfaa6a627f91a2d69f3cdc83b26bc5
Python
682
23
from torchvision import datasets, transforms from src.base import BaseDataLoader class DataLoader(BaseDataLoader): """ Something interesting. """ def __init__(self, data_dir, batch_size, shuffle, validation_split, num_workers, training=True): trsfm = transforms.Compose([ transform...
dc07357ed51eebc4eb6dcb1fd1f29c58976491e78ea767f504b5265265ec70a4
Python
682
24
import pytest import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'helpers')) def pytest_addoption(parser): parser.addoption( "--runslow", action="store_true", default=False, help="run slow tests" ) def pytest_configure(config): config.addinivalue_line("markers", "slo...
9b4148b2b9c7c172a00c2fb1ecbac815bfa6aa1cb4c14b70b00243492709c9da
Python
686
16
# 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 # # ...
5f30bf90447ef62fefffa1682f936acb067700517ee242c8229c6041f22c4bee
Python
689
28
"""Import commonly used libraries""" import time import logging import glob import os import numpy as np import pandas as pd import collections # from natsort import natsorted # matplotlib import matplotlib as mpl import matplotlib.pyplot as plt mpl.rcParams['pdf.fonttype'] = 42 # editable text in matplotlib mpl.rcPa...
bc3064801541c2edb256ad381c01520ccd016043fbe78afeee5b5a07acf5f417
Python
689
32
""" plot_hypervolume_history ======================== .. autofunction:: optuna.visualization.plot_hypervolume_history :no-index: The following code snippet shows how to plot optimization history. .. _visualization-plot-hypervolume-history-plotly-content: """ import optuna def objective(trial): x = trial...
0dc13a5fb77cd90121fd4b684ec3985095c77090a42b51e7ade3c0d81d71b3ae
Python
690
20
# 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...
53dd8042c36de5cb4816673767fd8889cb7c222a9292d66eebdfa77aa3f592aa
Python
691
16
# 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 # # ...
e2bc1b7242d833f4e62106b24e17fb93e9049e40890399f56504794118c68c98
Python
692
31
import cv2 import numpy as np def main(): img = cv2.imread("Boom_LO350.jpg", cv2.IMREAD_COLOR) assert img.shape[2] == 3, img.shape[2] n = 581.0/1200 time_for_conv = np.ones(shape=(1, 1, 224, 224), dtype=np.float32) * n time_for_fc = np.ones(shape=(1,1), dtype=np.float32) * n ...
21cf06eba32f03b99c1fa887f5f47d5a2e8e186e797c988c63d10e1af91f0363
Python
693
27
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import argparse from onnx import NodeProto, checker, load def check_model() -> None: parser = argparse.ArgumentParser("check-model") parser.add_argument("model_pb", type=argparse.FileType("rb...
658f3f97fc54090b018685a57e8fb42f86c62bca3c02dcc4853132fd86dfb24f
Python
695
14
""" Modules for translation """ from onmt.translate.translator import Translator from onmt.translate.translation import Translation, TranslationBuilder from onmt.translate.beam_search import BeamSearch, GNMTGlobalScorer from onmt.translate.decode_strategy import DecodeStrategy from onmt.translate.greedy_search import G...
89ccee241da3512f7bfe9802f46d99b7e0ca2cede2019cc4609d15ab265af7ce
Python
696
26
""" Joint and marginal histograms ============================= _thumb: .52, .505 """ import seaborn as sns sns.set_theme(style="ticks") # Load the planets dataset and initialize the figure planets = sns.load_dataset("planets") g = sns.JointGrid(data=planets, x="year", y="distance", marginal_ticks=True) # Set a log...
0970c65af58e3685f8e2ea7a921768f9042b47336f844d60624d8c0712039bee
Python
697
16
"""Module defining encoders.""" from onmt.encoders.encoder import EncoderBase from onmt.encoders.transformer import TransformerEncoder from onmt.encoders.rnn_encoder import RNNEncoder from onmt.encoders.cnn_encoder import CNNEncoder from onmt.encoders.mean_encoder import MeanEncoder from onmt.encoders.audio_encoder imp...
536aee258f75c2528c244f6161a038dcd619ff2542108a91c825b93a059c3bb8
Python
697
37
from Cython.Build import cythonize from setuptools import setup, Extension, find_packages requirements = [ 'numpy', 'scipy', 'Cython', ] extensions = [ Extension( 'augmentor.warping._warping', sources = ['augmentor/warping/*.pyx'] ), ] setup( # Metadata name='augmentor'...
93f93c5a6919f3d3fa0b99cc8a8914c95c02dbefe42c3bc5e5ee228459a8defa
Python
698
16
# 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...
ab8995a0d573f4f476b2424ded133ed0a2d3b6444e4f1fc71810b9b72060ba91
Python
698
18
import sys from typing import NewType import numpy as np import numpy.typing as npt if sys.version_info >= (3, 10): from typing import TypeAlias Distribution: TypeAlias = npt.NDArray[np.float64] # A DistanceMatrix is a square symmetric matrix with zeros along the diagonal # and nonnegative entries. DistanceMatrix...
6f8ebe374a3bf8eacae2627e33e5cd0f562102803b7b3eef66e6eca237659cf5
Python
699
14
from setuptools import setup setup(name='prediction', version='1.0', description='Python package for CRISPR/Cas9 single guide RNA on- and off-target activities prediction', url='https://github.com/Peppags/CRISPRont-CRISPRofft', author='Guishan Zhang', author_email='gszhang@stu.edu....
f67718c0144d4790be8dcbd9c517b6ac279a1660dbfda211a3d2fe5fbd291759
Python
699
19
#!/usr/bin/env python3 import rdflib from pyontutils.core import makeGraph from pyontutils.namespaces import makePrefixes def main(): PREFIXES = makePrefixes('NIFGA', 'NIFSTD', 'owl') g = rdflib.Graph() g.parse('http://purl.obolibrary.org/obo/uberon/bridge/uberon-bridge-to-nifstd.owl', format='xml') ...
389759a1523b9e0c4af6015c4f5de64f4ab9ede7f4dba1fcb998321e72912059
Python
702
21
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # """AmpliGraph is a library for relational learning on knowledge graphs.""" im...
3ad6a5e18ada6ec8ddab33c96ac3839b84cdf31e7da09a73131ca1335c43fd80
Python
703
29
# 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 # """This module contains utility functions for neural knowledge graph embeddi...
1deb0d14177d261c4259013338c93b90499a859454a3212c559d20ffae1ffea3
Python
705
26
import numpy as np import hashlib, struct _current_seed = 0 def set_seed(seed): """ Set the random seed to be used globally. If a string is supplied, it will be converted to int using hash(). This immediately seeds the numpy RNG. Any other RNGs must be seeded using current_seed() """ ...
e76eaaaeaf35f6290f280ef1f501bdbac02f4bc626bd444b1a7ce0d7caf84383
Python
705
21
import numpy as np import pandas as pd import os deg_files = [i for i in os.listdir('time_samplegroup_celltype_KO') if (i.startswith('d') and i.endswith('.txt'))] df_combined = pd.DataFrame() for deg_file in deg_files: timepoint = deg_file.split('_')[0] cell_type = deg_file.split('_')[1] source = deg_fil...
5e9c8c9ae031fba03e23d246a0bd8f03c07ad1c9064280c3177fb7f17c187e78
Python
706
16
# 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 # # ...
6c7f24237f95b2143e379889abce6565deb54d08338c72ee1cee6472a1a446bb
Python
706
22
import rpy2.robjects.packages as rpackages utils = rpackages.importr('utils') pck_names = ['Matrix', 'mgcv', 'codetools', 'rpart', 'glmnet', 'mboost', 'CAM'] for pck_name in pck_names: if rpackages.isinstalled(pck_name): continue if pck_name != 'CAM': utils.install_packages(pck_name) else...
3a2f98b4b1c4786b170e03fac847cd9a48bd63a4f87e9ee3aede4516c72e4852
Python
708
23
# 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 _acceptable_str_dtypes = ("U", "O") class StringConcat(OpRun): def _run(self, x, y): if ( x.dtype.kind not in _accep...
e338ae4376d7f5d668286556e66ac7d901861330a990b83c23c38d0d23a49086
Python
708
23
import argparse import logging import yaml from mprl.utility_services.manager.manager import ManagerServer from mprl.utility_services.utils import pretty_print logger = logging.getLogger(__name__) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", help="path ...
13d5b9925244b113aede999fccced935c6d2ac4713742bceb03ad04d6171ca84
Python
709
22
#!/usr/bin/python # # Synapse definitions for models. # # This file includes a number of different synapse definitions and default conductances # for point models. Most are models from the lab for neurons of the cochlear nucleus. # the synaptic receptor models are gleaned from the literature and sometimes fitted to the...
29c6b106c6d45e63deee8ffba725303959edcd5cbafa92dde9872f866b21bbb5
Python
709
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+'_cutoff-'+cutoff+'_maxnumat-'+maxnumat print(name) rloader = res.ResultsENN(name, reps=[1,2,3]) results = rloader.get_all_predictions...
d9041c978581f46c88860b673a7443bc6706f2da92a4f1f04f1783bc3df38bae
Python
709
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 # # ...
105f9e27ab81f0bf1b8a07559c9ec9bbb81e77b064e593ce3686b24158837edf
Python
710
27
""" Environment-specific commands """ import os import socket from cuneify_interface import FileCuneiformCache if not "mws" in socket.gethostname().lower(): raise RuntimeError( "Unrecognised environment: {}".format(socket.gethostname().lower()) ) MY_URL = "http://cuneifyplus.arch.cam.ac.uk" def ...
a91788e3a352731afde9810bffa9c7ec43dda70840509f5c62a6ec3b5a4b5497
Python
710
21
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Change score functions for change point detection.""" from sktime.detection._change_scores._continuous_linear_trend_score import ( ContinuousLinearTrendScore, ) from sktime.detection._change_scores._cusum import CUSUM from sktime.detection....
b5ca1459af631e8c650a28edb614473663570de5bdaac94026dec2d013fa962a
Python
711
17
from pathlib import Path from vcnmodel.util.parse_hoc import ParseHoc import toml config = toml.load("wheres_my_data.toml") import re from pathlib import Path pathn = Path(config['disk'], config['cellDataDirectory']) cellname = 'VCN_c08' refpts = {'VCN_c11': 'first', 'VCN_c08': 'first', 'VCN_c09': 'last', 'VCN_c14': '...
1b2de9b6e8bf54a9b214ddb586bf13de71543ebd3d3e43bbede04b8890df1f2d
Python
712
24
# Copyright (c) OpenMMLab. All rights reserved. from collections import abc import numpy as np import torch def cast_tensor_type(inputs, src_type, dst_type): if isinstance(inputs, torch.Tensor): return inputs.to(dst_type) elif isinstance(inputs, str): return inputs elif isinstance(inputs,...
7d4993c45d296665f381f74e6eaec383901d9a26aba95a2d3b44b28548ce0bd5
Python
712
16
# Copyright 2026 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...
9a7b94206a58a929dec709eb4f74420622f259ef5b8c2c012f7635745f8a3b15
Python
712
27
"""lesion_features — BIDS-compatible lesion and disconnectome feature extraction.""" from bcblib.tools.lesion_features._bids import ( parse_bids_entities, build_lf_csv_path, build_lf_tsv_path, build_prep_path, iter_bids_lesions, ) from bcblib.tools.lesion_features._constants import EBRAINS_ATLAS_SP...
2e9b9295e8a41ab2567bcfb53e8f0037be95dbc637bcf53de4c6fa918eb4d667
Python
713
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 Tan(Base): @staticmethod def export() -> None: node = ...
5518ce09dd6fb341426344acf50ae75e9cea3184d0f2bcbb568a92480c3bbf69
Python
713
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 Cos(Base): @staticmethod def export() -> None: node = ...
cad40b0eac67891e8131ca354d29cb40c09d633bb6a4aebcdf27c267f8c9f099
Python
713
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 Sin(Base): @staticmethod def export() -> None: node = ...
6905930766301aee5f90e60b2cb3ac30a3df535c5d7592d4ed3ce9c65825b471
Python
714
16
# 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...