sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
afb28bf72cec30c531e7100a081c7caffd04dd32df4f71747ce18b17a024946d
Python
326
16
""" Contains commong functions useful throughout the application """ import os def create_if_not(path): """ Creates a folder at the given path if one doesnt exist before === :param path: destination to check for existense :return: None """ if not os.path.exists(path): os.makedirs(...
2c7b4b918b57eaf36adfaa10c27abcd35d2d70ec0b6954102043bc765a3c8c60
Python
328
12
""" Linear regression with marginal distributions ============================================= _thumb: .65, .65 """ import seaborn as sns sns.set(style="darkgrid") tips = sns.load_dataset("tips") g = sns.jointplot("total_bill", "tip", data=tips, kind="reg", xlim=(0, 60), ylim=(0, 12), color="m", he...
e9cc65b31f29d1c2b790768f449c5921d1b2495663c542456967ce0a6afdf2b5
Python
328
14
# for analyzers # from . import analyze_run # from . import analyze_PSCVariations # from . import sac # from . import sac_cython # from . import analysis # from . import analyze_run # from . import isi_cv # from . import reverse_correlation # from . import spikestatistics # from . import sttc # from . import vector_str...
efaad8ab81fb4fabab1b25fd76918eebc98065c6827713b6810d9e6a56c3e20c
Python
328
11
"""Abstract base class for deep learning neural network classifiers.""" __all__ = [ "BaseDeepClassifier", "BaseDeepClassifierPytorch", ] from sktime.classification.deep_learning.base._base_tf import BaseDeepClassifier from sktime.classification.deep_learning.base._base_torch import ( BaseDeepClassifierPyt...
13c09ee5e258c32153f6c26430d9fcd871c5e2f9a014969645f6448df6535844
Python
329
14
""" Facetting histograms by subsets of data ======================================= _thumb: .33, .57 """ import seaborn as sns sns.set_theme(style="darkgrid") df = sns.load_dataset("penguins") sns.displot( df, x="flipper_length_mm", col="species", row="sex", binwidth=3, height=3, facet_kws=dict(margin_titles=...
203e4f453944dd2d516ad780d4c085e67563321c8cd00b2a5f8fd4a3933a6cc9
Python
329
13
# 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 Selu(OpRun): def _run(self, x, alpha=None, gamma=None): return ((np.where(x > 0, x, alpha * np.expm1(x)) * gamma).astype(x....
a2cd82403ed99e4793827f54f078687cb96c7b247130e3188f72711cffa5fbd3
Python
329
21
fi=open('ics_out/UNIQ_LOOP.txt') fo=open('scATAC_RefLoop.bed','w') fi.readline() i=1 for line in fi: #seq=line.rstrip().split('\t') info=line.split('\t') p1=info[0] p2=info[1] out=p1.split('-')+p2.split('-') #out.append('PE'+str(i)) fo.write('\t'.join(out)+'\n') i=i+1 fo.close() fi....
0fe646bf83546f8544b1397a6a3c9f6477c7dc9cba27ef3e8cd89611f37597a4
Python
331
4
SAC_ARCH1_MODEL_CONFIG_KEY = "population_server/model_configs/sac_arch1.json" SAC_ARCH1P_MODEL_CONFIG_KEY = "population_server/model_configs/sac_arch1P.json" SAC_ARCH1P_FIVES_MODEL_CONFIG_KEY = "population_server/model_configs/sac_arch1p_fives.json" POKER_ARCH1_MODEL_CONFIG_KEY = "population_server/model_configs/poker_...
9a9d8316f42844a08bfff64f55745f944d0d147681701b896b1063b3cb16ad0b
Python
331
19
# Preprocess turtle data: # raw to h5ad import numpy as np import anndata as ad import pandas as pd def main(): datadir = "./data/raw/tosches/" savedir = "./data/anndata/" # Load the data anndata = ad.read_h5ad(datadir + "turtle.h5ad") print(anndata) return 0 if __name__ == "__main__":...
1177010c5887cacedec0a2568f67d275c9eded4052dea1595b2295287e7efbf8
Python
332
13
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class OptionalGetElement(OpRun): def _run(self, x): if x is None: raise ValueError("The requested optional input has no value.") ...
7088bee19873b3ef70428581cee2ef75345bcacfc2e1cf91bc83ecfdaa4fff9a
Python
332
10
# 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 .EmbeddingLookupLayer import EmbeddingLookupLayer __all__ = ["EmbeddingLo...
8fffe1b52bc9fdeddc549f4588fb49bcbd46e4ce2659b61e1135db2e2e913b84
Python
332
16
from pathlib import Path import time import datetime from dataclasses import dataclass, field from typing import Union, List import operator import model_params import toml @dataclass class SIM: name:Union[Path, str, None] = None date:float = 0.0 datestr:str = '' dendscaling: bool=False somascaling...
2701e3a9038d68a7b801689e3d752fb14312575387b4ce9310b0f0d3c3957c41
Python
333
17
times = 10 with open('src-train-aug-err-old.txt') as f: srcs = f.readlines() with open('tgt-train-aug-err-old.txt') as f: tgts = f.readlines() with open('src-train-aug-err.txt', 'w') as f: for t in range(times): f.writelines(srcs) with open('tgt-train-aug-err.txt', 'w') as f: for t in range(times): f.writ...
1b1becc8dc15dfbfe2efac9bac2d858e7f40acb2e6c43e14a7fbc47eeebf3d5c
Python
335
16
from setuptools import find_packages, setup REQUIRED_PACKAGES = [ "graspologic", ] setup( name="pkg", packages=find_packages(), version="0.1.0", description="Local package for bilateral matching paper", author="Neurodata", license="MIT", install_requires=REQUIRED_PACKAGES, dependen...
7f34e93df9dfcaa4fc6ee696c62ef0f514c59d4dc2a04f40fff3de6135f9be00
Python
336
19
import sys fi=open(sys.argv[1]) fo=open(sys.argv[1]+'.TSS.bed','w') for line in fi: seq=line.rstrip().split('\t') if seq[5]=='+': loc=int(seq[1])+1 if seq[5]=='-': loc=int(seq[2]) this_out=[seq[0],str(loc-1),str(loc),seq[3],seq[4],seq[5]] fo.write('\t'.join(this_out)+'\n') fi.close...
80ede76e31e84c74d532d195d0828e6af25e23beb76b7918aa02451e5474b060
Python
336
13
from .input_preprocessing import ( inverse_asinh_normalize, make_cpm_prediction_mask, mask_aware_normalize_for_inference, mask_aware_normalize_for_training, ) __all__ = [ "inverse_asinh_normalize", "make_cpm_prediction_mask", "mask_aware_normalize_for_inference", "mask_aware_normalize_f...
de23d212d0224d53ef0571de723d77858d984dd52a271d1d226c9afc36ef37ff
Python
336
9
''' This module contains trained models reported in the paper "Quo Vadis, Action Recognition? A New Model and the Kinetics Dataset" (https://arxiv.org/abs/1705.07750) by Joao Carreira and Andrew Zisserman. The code of the private module '_pytorch_i3d' is based on Deepmind's Kinetics-I3D (https://github.com/deepmind/ki...
3223a7a76ef8539e6b261bee265bd663bf8683f5c8cfbea8cc1a09b8c0523d48
Python
337
16
#!/usr/bin/env python3 """ Code to systematically find the most stable geometry for molecules on surfaces """ from src.dockonsurf.dos_input import read_input from src.dockonsurf.screening import run_screening def dockonsurf(file): inp_vars = read_input(file) surf_ads_list = run_screening(inp_vars) ret...
3337957c3e528b6a1b6578353ef42de20789ab5aa385ba50a3d249ebcb6ce3ff
Python
337
13
import distutils.core packages = ''' celltool celltool.command_line celltool.command_line.plugins celltool.contour celltool.numerics celltool.plot celltool.utility '''.strip().split() distutils.core.setup(name='celltool', version='2.1', description='celltool package', packages=packages, scripts=['celltool/command_...
6b874101297859043b54bc2d0612048deac3c5da97f3f1174970e4b5aedae4e5
Python
338
16
import torch import transformers import flair def main(): print("#### Versions:") print(f"##### Flair\n{flair.__version__}") print(f"##### Pytorch\n{torch.__version__}") print(f"##### Transformers\n{transformers.__version__}") print(f"#### GPU\n{torch.cuda.is_available()}") if __name__ == "__ma...
9aff44ba6c903e8086d1b015816ed3f2208ae4909280f1fefb2dc5be76091d57
Python
338
12
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl class Scaler(OpRunAiOnnxMl): def _run(self, x, offset=None, scale=None): dx = x - offset return ((dx * scale)....
f0386134ea282d937e8873d6f309583887d72320fce1e39ac21b990d57eeef4a
Python
338
13
# 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 Add(OpRunBinaryNumpy): def __init__(self, onnx_node, run_params): OpRunBinaryNumpy.__init__(self, np.add, onnx_...
f0e1aef3a232e92f51fe85309581bbf220ed6c4db4e641419d3b181d65399a2e
Python
338
8
#!/usr/bin/env python3 -u # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Implements base classes for detection tasks in sktime.""" __all__ = ["BaseDetector", "BaseIntervalScorer"] from sktime.detection.base._base import BaseDetector from sktime.detection.base._base_interval_scorer import B...
0cfc493fcdef97a254f8f9478eb2c650dd8f3a1a9d2b474c9ad2e147144c6363
Python
339
6
# ruff: noqa: F401 # Legacy re-export module; imported names are part of the public API. from .binary import bin_to_int, decode_bin, encode_bin, int_to_bin, swap_bytes from .bitstream import BitStreamReader, BitStreamWriter from .container import Container, FlagsContainer, LazyContainer, ListContainer from .hex import ...
774a3e3e8acce23a97024d60b1a57596bbc732b0a8f934a001652e9e334e4b41
Python
340
16
# 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 class Softsign(OpRunUnaryNum): def _run(self, X): tmp = np.abs(X) tmp += 1 np.divide(X, tmp, out=tmp) ...
536a869ebc4a47c7ff63fbf7ea10c8d58dfeb37fffd12d86f4c0df10393e7634
Python
341
12
# vcnmodel.util from . import combine_pdfs from . import hoc_swc_sectionmap from . import mpl_colormaps from . import readmodel from . import params # from . import render # from . import show_swc # from . import swc_to_hoc # this belongs in neuronvis, and so there it is... # from . import vcn_cell_hoc_rename # from ...
548ecfa872459553620ab7c4bce16ada6c796a64a92e352b2e7a08b70a8c5a19
Python
341
13
"""GRU deep learning classifiers. This subpackage provides GRU and GRU-FCN classifiers implemented in PyTorch. """ __all__ = [ "GRUClassifier", "GRUFCNNClassifier", ] from sktime.classification.deep_learning.gru._gru_fcnn_torch import GRUFCNNClassifier from sktime.classification.deep_learning.gru._gru_torch ...
4f238133c9c81bb082f3607bc63505aeb054a960818386fd56fd6c377aec5d4d
Python
342
14
# 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 class Reciprocal(OpRunUnaryNum): def _run(self, x): with np.errstate(divide="ignore"): return (np.reciprocal...
9409bae4c77af72e57bf50f16ddc491197200a9b35031345e22420154f38fd19
Python
342
14
#from pathlib import Path #ROOT_DIR = Path(__file__).resolve() from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Explore the predictability of various psychiatric diagnoses based on neuroimaging features', author='Richard Gaus',...
358df012dc21f53fa864f79b279fba14acda21582dca0d59d875a37a1a05f638
Python
343
13
# 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 Mul(OpRunBinaryNumpy): def __init__(self, onnx_node, run_params): OpRunBinaryNumpy.__init__(self, np.multiply, ...
64dc9d8727c6747833e3ed938592e26077a9fa2d7bd66bc91586baada180c879
Python
343
13
# 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 Sub(OpRunBinaryNumpy): def __init__(self, onnx_node, run_params): OpRunBinaryNumpy.__init__(self, np.subtract, ...
cf54e2f929e647639fe28d787ab8443f0339ed42642b9fe53a6294791d9bacb7
Python
345
14
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class Mean(OpRun): def _run(self, *args): res = args[0].copy() for m in args[1:]: res = res + m return ((res / len(args))...
39e5e065b18c719f9a9bfbd691bae12519e2baab32a697eb80d8abc5482a80ae
Python
346
11
retrosim_config = { "topk": 200, "max_prec": 200, "similarity_type": 'Tanimoto', "fp_type": "Morgan2Feat", # try to use absolute path if possible "input_data_folder": "./rxnebm/data/cleaned_data", "input_data_file_prefix": "50k_clean_rxnsmi_noreagent_allmapped", "output_folder": None, ...
5ea07aaf15992281bf8220b85a46aaa6753743d636f53a3d0a979534a4c26058
Python
348
11
"""Composition for outlier, changepoint, segmentation estimators.""" # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) from sktime.detection.compose._as_transform import DetectorAsTransformer from sktime.detection.compose._pipeline import DetectorPipeline __all__ = [ "DetectorAsTransformer"...
8fea4644a8a2b8c5480a8b8b6e7f5098b1b4c0d02d397a1509e7831d211aacb3
Python
348
14
"""Execute the scripts that comprise the example gallery in the online docs.""" from glob import glob import matplotlib.pyplot as plt if __name__ == "__main__": fnames = sorted(glob("examples/*.py")) for fname in fnames: print(f"- {fname}") with open(fname) as fid: exec(fid.read(...
9474da9d659feb9758275b9dd742f4bac9ea99f9194117f645bf7d7bfe7dd0da
Python
348
15
import os from glob import glob import pyrosetta from pyrosetta import pose_from_pdb pyrosetta.init() pdbs = glob('../cleaned/*.pdb') for f in pdbs: p = pose_from_pdb(f) # print(os.path.join('../cleaned_pyro', os.path.basename(f))) p.dump_pdb(os.path.join('../cleaned_pyro', os.path.basename(f))) pri...
07802c36bb224d64108798bd2576e4536f45dde942efb37048155917cf944abb
Python
349
7
# ---------------------------------------------------------------------------- # 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. # ------------------------------------------------...
50e3c36b64dbfcf1d0de199667555af13b0b64b1ea3ebb27c09c27ac5988cf92
Python
349
13
# __init__ # IMPORTANT: evaluation has to be imported first since energyflow must be imported before torch # See https://github.com/pkomiske/EnergyFlow/issues/24 import jetnet.evaluation import jetnet.datasets import jetnet.losses import jetnet.utils import jetnet.datasets.utils import jetnet.datasets.normalisations ...
1fcb9f965ea93f9077f1218755d6dd89e06344e72f1fe71bf630a3e916db6013
Python
350
10
# 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 .ScoringBasedEmbeddingModel import ScoringBasedEmbeddingModel __all__ = [...
160af652b67b4d9f75ad9d01576b5b173b2f57dd1efca5685f9e5f7503b2eadf
Python
352
16
""" Plotting model residuals ======================== """ import numpy as np import seaborn as sns sns.set(style="whitegrid") # Make an example dataset with y ~ x rs = np.random.RandomState(7) x = rs.normal(2, 1, 75) y = 2 + 1.5 * x + rs.normal(0, 2, 75) # Plot the residuals after fitting a linear model sns.residplo...
9c4a0751676d0bb2c288493b2dc7bd23d5e0d0bf275cd5081827a8197b169f53
Python
353
13
"""CNN deep learning classifiers. This subpackage provides CNN based classifiers implemented in TensorFlow and PyTorch backends. """ __all__ = [ "CNNClassifier", "CNNClassifierTorch", ] from sktime.classification.deep_learning.cnn._cnn_tf import CNNClassifier from sktime.classification.deep_learning.cnn._cnn...
f8dc9f805645226c825fe5e5490ca2925cf10c4a010dc98d7134f65afc68c2f0
Python
353
11
from __future__ import print_function from featureExtractor import FeatureExtractor class FeatureExtractorRawData(FeatureExtractor): def __init__(self, params): self.params = params self.extractorType = 'rawData' def getFeatures(self, eegSegment, timeStampSegment, time_step, local_mu, local_s...
179f5f0ed4d431b9dfcf4e47979132e247edd52b07ea9ca86db43dc3638dabe3
Python
355
12
"""Pretrain state logic shared by estimator base classes.""" from sktime.base._pretrain._clone_plugin import _PretrainedCloner from sktime.base._pretrain._mixin import _PretrainMixin from sktime.base._pretrain._state_at import _clone_at, _set_params_at __all__ = [ "_clone_at", "_PretrainedCloner", "_Pretr...
33405686c236a55351a0264b7aa6e682c72571cd5173a97d498a301ba82dc345
Python
355
14
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from scipy.spatial.distance import correlation from sklearn.metrics import mean_squared_error def Pearson(pred, label): coef = 1 - correlation(pred, label) return coef def RMSE(pred, label): rmse = np.sqrt(mean_squared_e...
4ad2d86f422163a58bb2dee88fe4722597f2059721180c0e4fb79cfe0cf71562
Python
355
15
""" Trivariate histogram with two categorical variables =================================================== _thumb: .32, .55 """ import seaborn as sns sns.set_theme(style="dark") diamonds = sns.load_dataset("diamonds") sns.displot( data=diamonds, x="price", y="color", col="clarity", log_scale=(True, False), ...
5c1eb4c4fa691d487b706773b35594bc89b559bb053c5c92d6414ce5d0885e3e
Python
355
12
# SPDX-License-Identifier: LGPL-3.0-or-later from deepmd.dpmodel.fitting.latent_charge import ( LatentChargeFitting as LatentChargeFittingDP, ) from deepmd.pt_expt.common import ( torch_module, ) @torch_module class LatentChargeFitting(LatentChargeFittingDP): """Per-atom latent charges predicted from the ...
7d9c5ae89b5c6ee60225ef0c2ba8a84d173211ffc766c6b5f1a9c4be28aeb4f9
Python
355
15
""" Plotting large distributions ============================ """ import seaborn as sns sns.set_theme(style="whitegrid") diamonds = sns.load_dataset("diamonds") clarity_ranking = ["I1", "SI2", "SI1", "VS2", "VS1", "VVS2", "VVS1", "IF"] sns.boxenplot( diamonds, x="clarity", y="carat", color="b", order=clarity...
a921225ecbbf4db6b2295683679e9b8b1432fb235544d27f0539c0d59bf0e8ba
Python
355
12
# for vcnmodel plotters # from . import displayresult_model_run # from . import displayresult # from . import displayRevCorrResult # from . import displaySACResult # from . import IVPlots # from . import plot_allsecs # from . import plot_ANsims # from . import plot_gbc_ANresults_2 # from . import plot_gbc_ivresults_2 ...
18bd76fbfa40cbf0c7a43a51a18a90f91570c1598a20efb60ebc31c26ae4f59e
Python
356
15
from .toy import get_toy_palette, sample_toy_networks from .wrangle import ( create_node_data, ensure_connected, get_hemisphere_indices, get_paired_inds, get_paired_subgraphs, get_seeds, remove_group, select_lateral_nodes, split_connectome, split_nodes, to_largest_connected_c...
7d142946ca01feda3559433980e16de4bfbb92eba7c2176f4c10111b2f25e49b
Python
356
16
"""Top-level package for fnnls.""" # Do not edit this string manually, always use bumpversion # Details in CONTRIBUTING.md __version__ = "1.0.0" __author__ = "Joshua Vendrow" __email__ = "jvendrow@gmail.com" __license__ = "MIT" __copyright__ = "Copyright (c) 2020, Joshua Vendrow" from .fnnls import fnnls from .fnn...
10e1c3631c72332c6f929f70710e05f332f61735a0c0e1cef6a7f5ba0531f0b8
Python
357
13
"""Multivariate time series transformer deep learning classifiers. This subpackage provides multivariate time series transformer classifiers implemented in PyTorch. """ __all__ = [ "MVTSTransformerClassifier", ] from sktime.classification.deep_learning.mvts_transformer._mvts_transformer_torch import ( # noqa: E...
8739373b5998f9c9fc282ce87db97289cf098affbcf699f34098f7018a5bab2b
Python
357
14
# 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 class ThresholdedRelu(OpRunUnaryNum): def _run(self, x, alpha=None): alpha = alpha or self.alpha return (np.wher...
502321ede2fd0cd0d50be245ded460cf326860aa19b80698bdcd0a33a66c4637
Python
359
14
import timeit class Timer(object): def __init__(self, name=None): self.name = name def __enter__(self): self.tstart = timeit.default_timer() def __exit__(self, type, value, traceback): if self.name: print("[{}]".format(self.name)) print("Elapsed: {:g}".format(...
8d7ab05a5bbe37e790082d8905d4f55e20ce00a48cb077b5b1c243e43eda468d
Python
359
14
# 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 class Elu(OpRunUnaryNum): def _run(self, x, alpha=None): alpha = alpha or self.alpha return (np.where(x > 0, x, ...
8f6999995c0a0ffb86b544360d650695b6bef53c5b2445ee1270cfc2731c2803
Python
359
16
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from warnings import catch_warnings import numpy as np from onnx.reference.op_run import OpRun class Pow(OpRun): def _run(self, a, b): with catch_warnings(action="ignore"): re...
097650fe883e31578b2b9f88c7410a84edb20c4533320899d02fd39416a64d17
Python
362
10
# 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 .CorruptionGenerationLayerTrain import CorruptionGenerationLayerTrain __a...
2b74acc9f376fcc6a4bcc153b381c26521089c57e33dbf8b693b90e2ef2fa2a6
Python
362
14
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import sys from onnx.backend.test.case.base import Snippets from onnx.backend.test.case.utils import import_recursive def collect_snippets() -> dict[str, list[tuple[str, str]]]: import_recursive(s...
5ff75f77e0c613f7f2da0e5f5724ecea23f03d58ffb558dfa265677e811ece13
Python
362
12
import subprocess # Path to your requirements file requirements_file = "requirements.txt" # Open the file and install each package one by one with open(requirements_file, 'r') as file: for line in file: package = line.strip() if package: print(f"Installing {package}...") su...
62c0a021e312c01286a62030ed104ae87f8f2fd012f5599fc884151815e49b17
Python
362
18
import sys fi=open(sys.argv[1]) fo1=open(sys.argv[2]+'.1.bed','w') fo2=open(sys.argv[2]+'.2.bed','w') i=1 for line in fi: seq=line.rstrip().split('\t') out1=[seq[0],seq[1],seq[2],'L'+str(i)+'P1'] out2=[seq[3],seq[4],seq[5],'L'+str(i)+'P2'] fo1.write('\t'.join(out1)+'\n') fo2.write('\t'.join(out2)+...
eae6724825c22240ccb4fd8a18f04aa29c38de00dc2d43938ea815534a73a0d9
Python
362
16
""" Plotting model residuals ======================== """ import numpy as np import seaborn as sns sns.set_theme(style="whitegrid") # Make an example dataset with y ~ x rs = np.random.RandomState(7) x = rs.normal(2, 1, 75) y = 2 + 1.5 * x + rs.normal(0, 2, 75) # Plot the residuals after fitting a linear model sns.re...
b4f74bb10c0305d007123d59d5b194ed9d8c5a5038dd5dfcddea85f680701861
Python
363
18
import time from pprint import pprint import ray print(ray.__file__) ray.init(address="localhost:10000") pprint(ray.cluster_resources()) @ray.remote def f(): time.sleep(0.01) return ray.services.get_node_ip_address() # Get a list of the IP addresses of the nodes that have joined the cluster. pprint(set(ra...
b815dcf003f451a0d906fea8590fb647e72d8cf7f5f66a1ed2d299920041b8dd
Python
363
13
"""FCN time series classifiers. This subpackage provides FCN based time series classifiers implemented in TensorFlow and PyTorch backends. """ __all__ = [ "FCNClassifier", "FCNClassifierTorch", ] from sktime.classification.deep_learning.fcn._fcn_tf import FCNClassifier from sktime.classification.deep_learnin...
be6342f4b1f6d27a710076f32b87ec634ec1b0853d3baf478a2aa17a3f63ae80
Python
363
15
from setuptools import setup, find_packages setup( name="evoaug", version="1.0.6", packages=find_packages(), description = "A Python package that trains models with evolution-inspired data augmentations. ", python_requires=">=3.6", install_requires=[ "lightning>=2.0.0", "torch>...
a685d3e94c42bb67d3f0a94985a6db15ac95e5f8288af6742dc9fc307f536378
Python
364
14
""" Plotting large distributions ============================ """ import seaborn as sns sns.set(style="whitegrid") diamonds = sns.load_dataset("diamonds") clarity_ranking = ["I1", "SI2", "SI1", "VS2", "VS1", "VVS2", "VVS1", "IF"] sns.boxenplot(x="clarity", y="carat", color="b", order=clarity_ranking, ...
65f50c96058d794274ef239e64aa641875a66e5d723c0f26c5e39e9520c38009
Python
365
11
"""Classification foundation models.""" __all__ = [ "MantisClassifier", "MomentFMClassifier", "TSPulseClassifier", ] from sktime.classification.foundation_models.mantis import MantisClassifier from sktime.classification.foundation_models.momentfm import MomentFMClassifier from sktime.classification.founda...
088b93312ff6397d67fce4fff88ed1c77af87cef2d47c46739d2a0b7ff97143b
Python
366
12
try: from setuptools_scm import get_version __version__ = get_version(root="..", relative_to=__file__) del get_version except (LookupError, ImportError): try: from importlib_metadata import version # Python < 3.8 except: from importlib.metadata import version # Python = 3.8 __...
cfffa271a5dfeaa0d8d9579dd6910002bec5365b1f8edf06e5944c5a322234ee
Python
366
15
from .enums import ColumnSettings, Mode, RowSettings, Units, Verbosity from .model_statistics import ModelStatistics from .torchinfo import clear_cached_forward_pass, summary __all__ = ( "ColumnSettings", "Mode", "ModelStatistics", "RowSettings", "Units", "Verbosity", "clear_cached_forward_...
1283cbec798e1b96b281b919444c59261905bad1d6eb6bf39d3af094fcdd3cde
Python
367
15
import cv2 import functools def rolling_frame(func): @functools.wraps(func) def wrapper(frame): frame = frame.to_ndarray(format="rgb24") frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) ret = func(frame, wrapper.last_frame) wrapper.last_frame = frame.copy() return ret ...
cecdcab992833364d8eb45d92bc2a98d8ff3c84a788444acf0eb1753e3197184
Python
367
10
"""IsoPrism: short-read expression to within-gene isoform proportions. The current method is the terminal-aware Competitive-TA implementation. It is not the historical IsoVAE or IsoBudget-v2 model. """ from short2long.competitive_model import IsoPrism from short2long.competitive_predict import infer_h5ad __version__ ...
6e961bc830d61b90bcaecbdde3389055e20ea058daa26a8d3b8e4c8c8f22ae36
Python
368
16
# -*- coding: utf-8 -*- from parameterSetup import ParameterSetup from dumpServer import DumpServer class OnlineApplication: def __init__(self): self.params = ParameterSetup() def start(self): self.server = DumpServer(self.params) self.server.serve() if __name__ == '__main__': ma...
4531be9a81a7bc02e7823cdad59a490f140f34a12dc0bc444bcb1cbc23cd3864
Python
369
15
# Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod from mmcv.runner import BaseModule class BaseHead(BaseModule, metaclass=ABCMeta): """Base head.""" def __init__(self, init_cfg=None): super(BaseHead, self).__init__(init_cfg) @abstractmethod def forward_...
bcf75c07db72df8ed0dd5f787d2a4ea8d792e42ccbcffc57f12fe3182c76a5a1
Python
369
17
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class SequenceErase(OpRun): def _run(self, S, ind=None): if ind is None: ind = -1 else: ind = int(ind) S2 = S...
29f258903d2c987044e4018a51bd5bef7f239a492a1e6620e7882fa91a5d0dfc
Python
370
16
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from warnings import catch_warnings import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class Sqrt(OpRunUnaryNum): def _run(self, x): with catch_warnings(action="ignore"):...
824a4ecc1effaa5e93a015ac8b1b7ba2739fd52eaa910c0c4ce721388f42bc03
Python
372
9
from torchvision.models.detection.faster_rcnn import FasterRCNN from torchvision.models.detection.backbone_utils import resnet_fpn_backbone class FRCNNObjectDetector(FasterRCNN): def __init__(self, num_classes=91, **kwargs): backbone = resnet_fpn_backbone('resnet50', True) super(FRCNNObjectDetecto...
1cd979d03332769e1dda03c62107cb3965055f0330f0dd7f1719651095ab670e
Python
373
13
"""MACNN deep learning classifiers. This subpackage provides MACNN based classifiers implemented in TensorFlow and PyTorch backends. """ __all__ = [ "MACNNClassifier", "MACNNClassifierTorch", ] from sktime.classification.deep_learning.macnn._macnn_tf import MACNNClassifier from sktime.classification.deep_lea...
3e76a613075075fa80500abf5d17de842892a8fdd99d7d2876c9393cd2faed75
Python
373
9
from torchvision.models.detection.mask_rcnn import MaskRCNN from torchvision.models.detection.backbone_utils import resnet_fpn_backbone class MASKRCNNObjectDetector(MaskRCNN): def __init__(self, num_classes=91, **kwargs): backbone = resnet_fpn_backbone('resnet50', False) super(MASKRCNNObjectDetect...
b849cf97a9019e7499000cbb2d926f2dd804221ceb9242556c01a8ccae5427dc
Python
374
16
# 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 Mod(OpRun): def _run(self, a, b, fmod=None): fmod = self.fmod if fmod is None else fmod if fmod == 1: r...
4f0f2c2cdd9a2b3ade9450c495ce272cc200dd4c9a47f3f63369db1991373e38
Python
375
14
from .decoder import DeepNCMDecoder, LabelVerbalizerDecoder, PrototypicalDecoder from .dropout import LockedDropout, WordDropout from .model import Classifier, DefaultClassifier, Model __all__ = [ "Classifier", "DeepNCMDecoder", "DefaultClassifier", "LabelVerbalizerDecoder", "LockedDropout", "M...
f680fbb7ddea4cd92364d7f836fbd27bf9a0a2ddc3246e4df59fdff26699f896
Python
375
14
# 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 class Swish(OpRunUnaryNum): def _run(self, x, alpha=None): alpha = self.alpha if alpha is None else alpha return...
0585cfb198f37b51fe07faf445213dacbd48fe2c7e59d69eb67e7033cc8935f1
Python
376
9
import pyarrow.dataset as ds from tqdm import tqdm def stream(dataset_lis, file_format="parquet", batch_size=20000, columns=["idnumber", "standard_smiles", "achiral_fp"]): dataset = ds.dataset(dataset_lis, format=file_format) num_files = len(dataset.files) return tqdm(dataset.to_batches(columns=["idnumber...
0da93f8529aab110a2d44838343a842ef18178eb2beb7fd147319bb8164b7b53
Python
376
16
import time import functools def collect_run_time(func): @functools.wraps(func) def wrapper(*args, **kwargs): last = time.perf_counter() ret = func(*args, **kwargs) now = time.perf_counter() elapsed_run_time = now - last wrapper.samples.append(elapsed_run_time) ...
319242e965ef142116bf16a114e85905204370dd26d8abeba961f9130ba45c34
Python
377
13
"""CNTC Deep Learning Classifier. This submodule provides the CNTC deep learning classifier implemented in both TensorFlow and PyTorch backends. """ __all__ = [ "CNTCClassifier", "CNTCClassifierTorch", ] from sktime.classification.deep_learning.cntc._cntc_tf import CNTCClassifier from sktime.classification.d...
633f39114da87af1f0009b3b09f973f219d8bcc654e2e0b60666644b1eccb539
Python
377
13
"""RNN deep learning classifiers. This subpackage provides RNN based classifiers implemented in TensorFlow and PyTorch backends. """ __all__ = [ "SimpleRNNClassifier", "SimpleRNNClassifierTorch", ] from sktime.classification.deep_learning.rnn._rnn_tf import SimpleRNNClassifier from sktime.classification.deep...
88a522e94e9e0a8dbe90c6745c20a92fad310480ce458cf701f279048ae9bba4
Python
377
16
# -*- coding: utf-8 -*- from parameterSetup import ParameterSetup from networkServer import NetworkServer class OnlineApplication: def __init__(self): self.params = ParameterSetup() def start(self): self.server = NetworkServer(self.params) self.server.serve() if __name__ == '__main__...
249896d509fc75ab9ef15ab4a7abbfcceb7f0383fad282b81e57802187d75b6f
Python
378
8
"""Basic implementations of some optimization algorithms namely - `purecma.fmin` and `purecma.CMAES`: a basic and readible CMA-ES implementation where the core algorithm is coded in under 40 lines (in the method `CMAES.tell`) - `compact_ga.CompactGA`: compact GA which is the most logical abstraction of an genetic ...
b12fdd3e77aa3fc2be9266f5f6db3bb059c4c022679d2c7d318303e910f5b0ac
Python
378
18
#! /home/miro/miniconda/bin/python import sys filename=sys.argv[1] atom_num=int(sys.argv[2]) f=open(filename,'a+') curr_num=1 padding_count=1 padding_limit=8 for i in range(atom_num): if (padding_count == padding_limit): f.write (' 0\n') padding_count=1 else: f.write (' ...
9eeef5cb099481a79703fde8e113f6662268763aa4dde73141bc05ed610cb955
Python
379
11
# Define the DIR to the data, model, logs, results, and colors # import os ROOT_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) DATA_PATH = os.path.join(ROOT_PATH, "data") RESULT_PATH = os.path.join(ROOT_PATH, "results") MODEL_PATH = os.path.join(ROOT_PATH, "model") LOG_PATH = os.path.join(ROOT_PAT...
531a7034d11bb7efe0005445dab834f48fde88123e464b8c557db0bdb07406fa
Python
380
10
from distutils.core import setup setup( name='SpikeShip', version='1.0', description='Fast, unsupervised discovery of high-dimensional neural spiking patterns based on optimal transport theory', author='Boris Sotomayor-Gomez', author_email='bsotomayor92@gmail.com', py_modules=['spikeship.spikes...
712f48a19fd6ff6d1bf319a2d8641f4537fc0a3cd0c4a9fa8f207f1b567db3b1
Python
381
11
import datetime import re def presentTimeEscaped(): presentTime = str(datetime.datetime.now()) presentTime = presentTime.replace(' ', '_') # presentTime = presentTime.replace('/', '-') # presentTime = '-'.join(presentTime.split('\/')) presentTime = re.sub(r'\:', '-', presentTime) presentTime = ...
93d9b4fb1866f2be605de6f9ee07b2fb8560535548c8cb66c4e0e676aa8b9900
Python
381
17
""" Timeseries plot with error bands ================================ _thumb: .48, .45 """ import seaborn as sns sns.set(style="darkgrid") # Load an example dataset with long-form data fmri = sns.load_dataset("fmri") # Plot the responses for different events and regions sns.lineplot(x="timepoint", y="signal", ...
cf8af6b4ccd1f12765bddf088de2e84455b3573ca4d2dae5de753bbf2d762b30
Python
381
18
""" Joint kernel density estimate ============================= _thumb: .6, .4 """ import seaborn as sns sns.set_theme(style="ticks") # Load the penguins dataset penguins = sns.load_dataset("penguins") # Show the joint distribution using kernel density estimation g = sns.jointplot( data=penguins, x="bill_len...
e5c84cc8ef3b374c14039abcc4bc52ede80fe9d96fa6d8653f80c87d68229f30
Python
381
17
""" Facetted ECDF plots =================== _thumb: .30, .49 """ import seaborn as sns sns.set_theme(style="ticks") mpg = sns.load_dataset("mpg") colors = (250, 70, 50), (350, 70, 50) cmap = sns.blend_palette(colors, input="husl", as_cmap=True) sns.displot( mpg, x="displacement", col="origin", hue="model_year...
3117a5405d75ef398e2137a2ee36234a6cc0643c9a6a74c656cad3697af3f8bb
Python
383
16
""" ASGI config for web project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_...
9d0086d8167fdac406131daefb4654a8ea4288116c37b0d65a23de82229d7e9d
Python
383
15
import pandas as pd import atom3d.datasets as da import atom3d.filters.filters as filters import atom3d.filters.scop as scop dataset = da.load_dataset('tests/test_data/lmdb', 'lmdb') def test_scop_filter(): level = 'class' filter_fn = scop.form_scop_filter(level, allowed=None, excluded=None) for i,d ...
b6809a0c25df2d837270058b2549bdabb80788120a3b17c5521f35c7ca522d0a
Python
383
16
""" WSGI config for web project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_...
4f22c896e22c91cb2791b798fda54c12893a5793b57dfa4e2876c6934bfd1467
Python
384
18
""" Grouped boxplots ================ _thumb: .66, .45 """ import seaborn as sns sns.set(style="ticks", palette="pastel") # Load the example tips dataset tips = sns.load_dataset("tips") # Draw a nested boxplot to show bills by day and time sns.boxplot(x="day", y="total_bill", hue="smoker", palette=["m",...
54763a3f7cbef4b2a6fd3cada4e827f2389c66619665c9fe308afcf3f8a4bc37
Python
385
16
# 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 Trilu(OpRun): def _run(self, x, k=None, upper=None): k = 0 if k is None else k.item() if upper: return ...
949f83d9b337e6b1ed1ce839f7a1ab8fd428244ac37dbf15a3110797a7163692
Python
385
21
from pathlib import Path import pandas as pd HERE = Path(__file__).parent def haber() -> pd.DataFrame: """ Tabularized counts of cell types in the small intestinal epithelium of mice with different conditions. Haber et al. 2017 Returns ------- data matrix as pandas data frame. """ filena...
3d146d8b25453b7672b2284a5dd9e858f35a1351db96339a0a07c39ed0d51154
Python
386
16
""" Scatterplot with categorical variables ====================================== _thumb: .45, .45 """ import seaborn as sns sns.set_theme(style="whitegrid", palette="muted") # Load the penguins dataset df = sns.load_dataset("penguins") # Draw a categorical scatterplot to show each observation ax = sns.swarmplot(da...
e8d32f99db0684408fd5a9e1155bb3dd2305f1e7e267233c3ee4d5fec851c6c0
Python
386
12
from setuptools import find_packages, setup setup( name="gradient_correction", version="0.1", description="Gradient correction method", author="Antonio Majdandzic", author_email="antem@bu.edu", platforms=["any"], # or more specific, e.g. "win32", "cygwin", "osx" url="https://github.com/Ant...