sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4c95ba0ba8877d6861ee8cea9c985366b93ae59d3860480d98881aecb5545f53
Python
1,274
44
# 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 GlobalAveragePool(Base): @staticmethod def export() -> None: ...
fce1e82dc26516cd6e4f8ad9729ab1711c6d5f501cc6de8b3abd909447d1587f
Python
1,274
33
def train_model(config, DataHandler, model, callback_list, verbose=2, final_models=False, return_model=False): 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'], Da...
52bbfcaa1875d3c838055abb493ba69124045f3918d972db2f85abe607e69232
Python
1,275
48
#! /usr/bin/env python3 import os import csv import json from pathlib import Path from pyontutils.utils import async_getter from pyontutils.scigraph import Cypher, Vocabulary current_file = Path(__file__).absolute() gitf = current_file.parent.parent.parent c = Cypher() v = Vocabulary(cache=True) def main(): cur...
389bc8467b270484cfa1eb43bcf503d9eeb59088d0a4cab1d0f48d003dade193
Python
1,276
39
# 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 LeakyRelu(Base): @staticmethod def export() -> None: n...
0309efa8c554614a0db7a3ecc08ae8311a3cbef480795ddfa0819efc62efcbc9
Python
1,278
42
"""Plotting examples for DBA.""" from sktime.clustering.metrics.averaging import dba from sktime.datasets import load_arrow_head from sktime.datatypes import convert_to def plot_dba_example(): """Plot dba.""" import matplotlib.pyplot as plt X_train, y_train = load_arrow_head(split="train") X_train =...
3771e2fb5f834e74c19074e3ad084cbf37117377fb4c30ddf847bc89497499d4
Python
1,279
32
"""Unit tests for all time series regressors.""" __author__ = ["felipeangelimvieira"] from sktime.tests.test_all_estimators import BaseFixtureGenerator, QuickTester class RegressionDatasetFixtureGenerator(BaseFixtureGenerator): """Fixture generator for classifier tests. Fixtures parameterized ---------...
06fe2b3ac3fd8f6ed91eecf21cecf28da5133441de3c5a75bd03a27d271ff619
Python
1,280
40
from torchvision import datasets from torch.utils.data import Dataset from .loader import pil_loader class CustomizedImageFolder(datasets.ImageFolder): def __init__(self, root, transform=None, target_transform=None, loader=pil_loader): super(CustomizedImageFolder, self).__init__(root, transform, target_t...
9f5c0cb3a2f64b2ba234072b163937a8ecb70dd2a0a99efd39c80f280af7cb97
Python
1,280
44
from scipy.spatial.distance import pdist, squareform from scipy.optimize import linear_sum_assignment import pandas as pd def _standardize(x): return (x - x.min()) / (x.max() - x.min()) def _matchmaker(metadata, status, match_columns, types): """ Computes matching ids. Parameters ---------- met...
0856dac1a6a121e7e856b286247800676b8b5742005dd5b13fb551df411f01ef
Python
1,282
41
#!/usr/bin/env python """ AQDnet setup script """ from setuptools import setup, find_packages with open('README.md', 'r', encoding='utf-8') as f: long_description = f.read() setup( name='aqdnet', version='0.1.0', author='AQDnet Authors', description='Deep Neural Network for Protein-Ligand Docking...
dbd70043d149b308f3e09c4f467c18f4574284a0e69dd4a76a7385b8e0286175
Python
1,282
43
# --- # jupyter: # jupytext: # cell_metadata_filter: -all # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.13.8 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # ...
5a7396346ae7f124b7d97bc3d28a3c7112fa441015918f03968274b5e7dec8bb
Python
1,283
50
from __future__ import annotations from dataclasses import dataclass import numpy as np import pandas as pd from seaborn._stats.base import Stat @dataclass class PolyFit(Stat): """ Fit a polynomial of the given order and resample data onto predicted curve. """ # This is a provisional class that is u...
f9aa25f2b49935dc79eb5e8202aa54ae4fbd7796093f587b973992c94ca3f28b
Python
1,283
38
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import matplotlib.pyplot as plt def load_data_HCSC(spss_file): data = pd.read_spss(spss_file) #Change numeric identifiers to objects data['NHC'] = data['NHC'].astype('object') data['NHC_LCR'] = data['NHC_LCR'...
a27d3a279b2d9d980caab171cdb98361c5e77dac6b79cc633abde9b74f552230
Python
1,284
42
from pathlib import Path as p from ilxutils.interlex_sql import IlxSql from ilxutils.tools import create_pickle import os sql = IlxSql(db_url=os.environ.get('SCICRUNCH_DB_URL_PRODUCTION')) terms = sql.get_terms() create_pickle(terms, p.home() / 'Dropbox/interlex_backups/ilx_db_terms_backup.pickle') print('=== terms...
e4db7858043e15f77182e44847a6860b9adc6b15e260339196d24d86decea310
Python
1,284
44
""" Creates a stimulus with an auto-generated sweep order then replaces it with a custom one. """ from camstim import SweepStim, Stimulus, Window from psychopy import visual window = Window(fullscr=True, monitor="GammaCorrect20") stim = Stimulus(visual.GratingStim(window, pos=(0, 0), ...
76284260bd671f82c8e8b77b9dd0cfb4e2b3cf8d858932d3a5ecfd89458656c4
Python
1,285
50
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.backbones import TNT def check_norm_state(modules, train_state): """Check if norm layer is in correct train state.""" for mod in modules: if isinstance(mod, _...
784631f29d47dc18c8e61a8966750dc7d0b1021969cb8b67505960c5f30152ff
Python
1,286
45
# coding: utf-8 # several data readers need optional dependencies. There's no # appropriate builtin exception class MissingDependencyException(Exception): pass class DataReaderBase(object): """Read data from file system and yield as dicts. Raises: onmt.inputters.datareader_base.MissingDependenc...
bc8433f39dc6e2b6f17a88a6a128657b714cda573203ee436673e8d324b8271d
Python
1,286
44
from anlffr.helper import biosemi2mne as bs import mne import numpy as np from anlffr import spectral import pylab as pl # Adding Files and locations # This below is just an example # You have to edit this to supply your own data fpath = '/home/hari/Documents/MNEforBiosemi/' edfname = 'I13_depth_01.bdf' # Load data a...
6965ec0959adcf466d5f927e7ff5dec9e192023f576ee4108ca273febbcf56d6
Python
1,287
44
# 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...
cbff06fe3cba3d331081fc343932e3673e2c5373bbc5f33bc33e3d8e9f37ae75
Python
1,287
44
""" Read and prepare paths for the data and other input files. All """ from pathlib import Path import toml def get_data_paths(): """get the full path for a the data files Reads the "wheres_my_data.toml" file, prepends the disk, and returns the configuration. (A call to this functions should replac...
0565975263d4f9a3d02036ac61da600f3d485a95b1c35234673607d17cc64db1
Python
1,288
25
"""The package :mod:`pyfilterbank` provides tools for acousticians and audiologists/engineers working with python. A fractional octave filter bank is provided in the module :mod:`octbank`. You can use it to split your signals into many bands of constant relative fractional octave band width. The output signals stay in...
1e0183da65ef08644bf5717cce0d50bd45d8347759ed8cf384d024b3cee45347
Python
1,288
48
# 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 HammingWindow(Base): @staticmethod def export() -> None: ...
654e8bfeb35538dcb6adedfe6659bdbb034ddb477e5205c9c7cd392ff4e9a365
Python
1,288
43
# # # Highlight Parcels # # One possble use of netplotbrain is to highlight a seed region used. Here we will highlight two regions of interest. # + # Load imports import netplotbrain import pandas as pd import numpy as np # Get 100 node atlas from templateflow node_dict = {'atlas': 'Schaefer2018', ...
6c1e1e2fcf24c09fb955b2346a787a2e254351f4a0318a3138b567fbb01e9f86
Python
1,288
45
# 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...
7db3493b438c6ffc86c2586be8a335057eb06617f6118dc187aa646e5c9fb0de
Python
1,290
42
import pytest from typing import Tuple import siibra @pytest.mark.parametrize("space", siibra.spaces) def test_space(space: siibra.core.space.Space): for vol in space.volumes: print(vol.providers) should_have_desc = [siibra.spaces["big brain"]] @pytest.mark.parametrize("space", should_have_desc) def t...
2f8e2887f466506b9aff54c4a0f93573331f3b906dde0c5331d7276c1ab19644
Python
1,291
49
""" Merge PDF files This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (Spirou, Manis, Ellisman), DC R01 DC004551 (Manis, 2013-2019, Early development) DC R01 DC019053 (Manis, 2020-2025, Later development) Copyright 2020 Paul B. Manis Distributed under MIT/X11 license. See lice...
cf2cd67c44796ac101fd04ad3b6acc4229a08ffa0f27bed225f3a8ac6ab5482c
Python
1,291
42
# Mocapy: A parallelized Dynamic Bayesian Network toolkit # # Copyright (C) 2004 Thomas Hamelryck # # This library is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License...
1a52738bf27aff4f189e02c78dd249190bfbd811e6ea85519d6037a5382b9e9a
Python
1,292
36
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import re import numpy as np from onnx.reference.op_run import OpRun _acceptable_str_dtypes = ("U", "O") class RegexFullMatch(OpRun): def _run(self, x, pattern=None): # Note: The ONNX sp...
513d171d71284639f39baf2b087e1585fc9062b6f775d06200e03ea2cbdbd71e
Python
1,292
40
# 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...
54bf361363c6e2e063ad49a069a0582e0c262bb4608857c61e54046ed8aaec5e
Python
1,292
42
"""Isolated numba imports for _ddtw.""" __author__ = ["chrisholder", "TonyBagnall"] import numpy as np from sktime.utils.numba.njit import njit @njit(cache=True, fastmath=True) def average_of_slope(q: np.ndarray) -> np.ndarray: r"""Compute the average of a slope between points. Computes the average of the...
be3ce424d9bb0d85cb79de8869d2400a40a49afaba088dedce7f38d56799f49d
Python
1,293
45
import io import setuptools try: import numpy as np except ImportError: print("Please install Numpy first. e.g. pip install numpy") exit(1) from glob import glob module_utils = setuptools.extension.Extension('ssam.utils', sources=["c/utils.cpp"], extra_compile_args=["-fopenmp"], extra_link_args=["-fopenmp"...
f350ca4234be9fc4eeb79f561e85535cbf9748b93df449ee098467e15dbdf71e
Python
1,293
55
"""Isolated numba imports for _euclidean.""" __author__ = ["chrisholder", "TonyBagnall"] import numpy as np from sktime.utils.numba.njit import njit @njit(cache=True, fastmath=True) def _local_euclidean_distance(x, y): """Compute the local euclidean distance. Parameters ---------- x: np.ndarray (1...
470823a89c289db0d56ab5f88c0335227569d1154bdc66e657ad496a5c22c39d
Python
1,294
42
"""#---------------------------------#---------------------------------#------------- This script helps estimate the full range of values for a given feature type """ # # ---------------------------------#---------------------------------#------------- from os.path import join as pjoin import numpy as np from gra...
034f2894958dd183e8b3e31b4b4a9251f2b12a022e461c15bdba9dfea0db3420
Python
1,296
41
import random import numpy as np def binary_tournament(trial_runner, trial, states): """Selects a candidate to replace the current trial. Parameters ---------- trial_runner : ray.tune.trial_runner.TrialRunner The trial runner for the PBT run. trial : ray.tune.trial.Trial The tria...
491b5ce5c33f06b297d239eb89183c5a8e892513bc0385a292db8426f8d426f1
Python
1,296
39
""" Filtering functions for protein sequences. """ import pandas as pd import atom3d.protein.sequence as seq def form_seq_filter_against(dataset, cutoff): """ Create filter that removes remove structures with too much sequence identity to a chain in supplied dataset. We consider each chain in each stru...
eb33f60453137faaf87e25f619b7943f2197574e407f54b586a70a2daf76166d
Python
1,296
59
import sentencepiece from translation_tokenize import TOKEN_DIR def source(line): if len(line) < 1: return False if line[0] == 'S': return True return False def translation(line): if len(line) < 1: return False if line[0] == 'D': return True return False ...
5ce6a1e96ff77cb6e2c19db13033df5e96989c1982f8ced45a4ac9e7101b63e0
Python
1,298
41
# 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 ThresholdedRelu(Base): @staticmethod def export() -> None: ...
6a1cd6aa25f154f81ad496b586329eabe2938991c4b1f559e8445ab12d33d901
Python
1,298
46
# 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 DepthToSpace(OpRun): def _run(self, data, blocksize=None, mode=None): if len(data.shape) != 4: raise RuntimeErr...
7393dd928af18b8ef754c7fa8f4826b0bd7343986a1f0a02103332ccbaa2a848
Python
1,298
51
fa=open('/home/disk/database/data/ICS_scHIC/f03_atlas/eQTL/ALL_EQTL_1k_merged.bed.detail.bed') snp2tag={} for line in fa: seq=line.rstrip().split('\t') this_tag=seq[0]+'\t'+seq[1]+'\t'+seq[2] this_snp=seq[3]+'\t'+seq[4]+'\t'+seq[5] snp2tag[this_snp]=this_tag import numpy as np from scipy.stats impor...
27643efed9c74892228026be8f5194f3021b3f68047703d5d94d6ff4596f5db8
Python
1,301
57
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import sys import atheris with atheris.instrument_imports(): import onnx from onnx import version_converter def _default_opset_version(model): for opset in model.opset_import: if o...
b76ec1ed55603b70f4702acad1a19ab6ef5151c2d19727d3c4decebbd4a81d28
Python
1,301
45
import numpy as np import pandas as pd from keras.models import load_model from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from keras.utils import to_categorical from sklearn.metrics import confusion_matrix, classification_report import seaborn as sns import matplotli...
3307f424130838e510ba1e527252a3b0b811ebb911f944a53404b3dd2bd6f670
Python
1,303
44
#!/usr/bin/env python # -*- coding: utf-8 -*- """ read datasets from existing files""" import numpy as np from sklearn.preprocessing import StandardScaler class DataGenerator(object): def __init__(self, file_path, solution_path=None, normalize_flag=False, transpose_flag=False): self.inputdata = np.lo...
2efa27c7976aecb9612348a0038c4c7b8f05de7b5533e41e06429f4f90483675
Python
1,304
37
import matplotlib.pyplot as plt import seaborn as sns import numpy as np def sample_histogram(sample1, sample2=None, ax=None, bins=100, palette=None, sample_names=['observation', 'prediction'], density=True, var_name='Measured Parameter', **kwargs): if ax is None: ...
6f49292cfe350d9b269e27d3c030fe166c77f8ecd3ea01ba063e56844ae335e5
Python
1,304
36
# 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 # # ...
38a079cb25e5a28b9bb50c3c0fa652e1ba55eb4935853aea28e427022b5528fc
Python
1,305
43
# 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...
4da58e0deef311384bce8b97d7a5265338648dd04143cad3351f81699b39a195
Python
1,307
43
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.backbones import DistilledVisionTransformer def check_norm_state(modules, train_state): """Check if norm layer is in correct train state.""" for mod in modules: if isinsta...
9622db895f46adb4035e6ed4bb46fb1afd099af235f136ee4e097220c7ef34db
Python
1,308
67
# SPDX-License-Identifier: LGPL-3.0-or-later # Import to register converters. ``dpa4_nn`` registers the dpmodel -> pt_expt # converters for the DPA4 interaction block, initial embedding, grid nets, # SO(2) modules and radial MLP (activation checkpointing, accelerated inference # kernels and trainable-weight promotion),...
17dcc419e397fc62273dcc388994ba8b0be3dd18e07279f565488cc339aba7ba
Python
1,310
60
from pyontutils import sheets from pyontutils.sheets import Sheet from pyontutils.namespaces import ilxtr from neurondm.sheets import CutsV1, Row as RowBase from neurondm.core import Config, NeuronEBM from neurondm.phenotype_namespaces import Species class NeuronNerves(NeuronEBM): owlClass = ilxtr.NeuronNerves ...
4066f33584833f517a7ecd52c3f22b135f45074e6db96cecbea38c6ca0913ed7
Python
1,311
37
# 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...
7574374f7f7bf3305cf63df47a75e30c66a2edc533c8a19ffd7d68c968c26677
Python
1,312
45
import unittest import htmlfn as hfn doc_expect ='''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>test page</title> <meta charset="UTF-8"> <meta test="meta"> <style> body { font-family: Dejavu Sans Mono; font-size: 11pt } </style> <script> console.log("l...
3472a3883e13306a747cc601e4e2caef706689e92f9fb694fc597820af5ba52c
Python
1,317
33
# Code adapted from tensorflow to pytorch from https://github.com/google-research/graph-attribution/tree/main/graph_attribution import torch from torch.autograd import Variable from torch_geometric.data import Data from molucn.feat_attribution.explainer_base import Explainer class GradInput(Explainer): def __init...
7549e1781f00ef027df81d9fc368fb00b7fe483e00ca675a164f800fdd02dbae
Python
1,317
43
# An extension to: Mocapy # # Copyright (C) 2007 Jes Frellsen, Ida Moltke and Martin Thiim # # This library is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at...
2eb3444af8d3bce9c235d8bd3c6e4f5997103d2ae4a649a31cf87c6b3c3156fb
Python
1,319
42
#!/usr/bin/env python from setuptools import setup, find_packages from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='OpenNMT-py', description='A python implementation o...
62d9f32b5959954837e4692d0deeb7d9d3b02c8f878af1c60423c185881ab1db
Python
1,320
31
import time _this_year = time.strftime("%Y") __name__ = "vp-suite" _version = 0, 0, 9 __version__ = ".".join(map(str, _version)) __author__ = "Andreas Boltres" __author_email__ = "andreas.boltres@posteo.de" __license__ = "MIT" __copyright_short__ = f"2021-{_this_year}, {__author__}" __copyright__ = f"Copyright (c) {__...
7106da2c0fad568517eb7b9d982a010760e303d30b0edc7f2805e187e724e3b4
Python
1,321
50
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING, Any import pytest from onnx.backend.test.report.coverage import Coverage if TYPE_CHECKING: from collections.abc import Sequence import _pytest _coverage = C...
3a50cfef92c655b580916913a5822e046ca7d1724039de990a9090feaa65bbb2
Python
1,322
62
# 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 Round(Base): @staticmethod def export() -> None: node ...
a99ef68cbfb437345dd02681439f882c5ce221141ae98dc33bfa9d2047d641b9
Python
1,322
39
from ..preprocessing import preprocess def basic_preprocessing(data): """ Call each of the listed preprocessing functions on <data> and return the result. Preprocessing functions: - cast_to_typed_array - normalize_by_MAD - center_to_mean Args: data (np.ndarray, list): ...
3567877b222f7e18003ae3d3e8864f1f0fdad0cbd9622810df19b1390fbfc9e2
Python
1,325
48
import unittest import os import shutil import numpy as np from ddt import ddt from SPHARM.classes.surface import Surface from SPHARM.classes.moving_surface import MovingSurface @ddt class TestMovingSurfaceCass(unittest.TestCase): def test_add_spectrum_and_plotting(self): ms = MovingSurface() ...
35000014586203bf960a10ab33b93e42916b68b08c4870ef2e3a0bb6bf017845
Python
1,326
36
# qtlib.py # # Utiliti functions for training CNN in DeepDTI. # # (c) Qiyuan Tian, Harvard, 2021 import numpy as np import keras.backend as K def extract_block(data, inds): xsz_block = inds[0, 1] - inds[0, 0] + 1 ysz_block = inds[0, 3] - inds[0, 2] + 1 zsz_block = inds[0, 5] - inds[0, 4] + 1 ch_block ...
4180d427cdb9a976df4b2add02d8e2528e8f5736ce34787c9630284d40c863c6
Python
1,326
41
import numpy as np from tensorflow import keras import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten from tensorflow.keras.layers import Convolution2D, MaxPooling2D from tensorflow.keras import layers from tensorflow.keras.preproc...
72537a0c63086075277c57737e3b00a0251d3138cd9b127ee91b33541252612a
Python
1,326
42
# ---------------------------------------------------------------------------- # 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. # ------------------------------------------------...
b6124249bc2cc01e62385dfda3bf4ee1ca9f999b393bb378b8cfd42c80f85508
Python
1,326
42
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from ..builder import BACKBONES from .base_backbone import BaseBackbone @BACKBONES.register_module() class LeNet5(BaseBackbone): """`LeNet5 <https://en.wikipedia.org/wiki/LeNet>`_ backbone. The input for LeNet-5 is a 32×32 grayscale image...
ed2b643cb170f75b1b17c6b070c2dbed8d520e85a2ed250100d09ac93cfbbf6e
Python
1,326
43
"""Code to generate pair ensembles.""" import click import pandas as pd import parallel as par import neighbors as nb import atom3d.util.log as log logger = log.get_logger('shard_pairs') def _gen_pairs_per_ensemble(x, cutoff, cutoff_type): pairs = [] if len(x['subunit'].unique()) > 1: raise RuntimeE...
582b5c05d20787ab64791d8e6f3afa2f2c1e7f22bf856470a035d8306028fdbc
Python
1,327
42
"""HIVE-COTE v2 test code.""" import pytest from sktime.classification.hybrid import HIVECOTEV2 from sktime.classification.sklearn import RotationForest from sktime.datasets import load_unit_test from sktime.tests.test_switch import run_test_for_class @pytest.mark.skipif( not run_test_for_class(HIVECOTEV2), ...
80c6ebdbcf7ea9a37c7c2b820303ab6b557a28d10055d86168bf5cfd5aeca360
Python
1,327
42
# # # Template from TemplateFlow: WHS # # [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/whs.ipynb) # # To plot different templtes from templateflow, you just need to change the template specification: # # `template='WHS',` # # The example nodes are sca...
a6aef0438c15b209c508600cadfa32cf8eb4aa44372a227f1f3228a99e0116e1
Python
1,327
36
# 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...
61089e6d354d120f69dbc9e12fb5e73d2d6616b6494ce6c7d35e294694d7464e
Python
1,328
47
"""train_precipitation""" """ Author: Yimin Yang Last revision date: Jan 18, 2022 Function: Run this to train the model on cloud cover dataset """ import torch from Models.AA_TransUNet import AA_TransUnet import pytorch_lightning as pl if __name__ == "__main__": args = { 'vit_blocks': 1, 'vit_he...
699be6a0e90a912e6428041b7bcdf8c7ce8d43bca61a9280402a1d73b9196e98
Python
1,330
43
import numpy as np from scipy import io import os, subprocess def define_initial_transformation(aff, transl, outname): """ generates a .mat file defining the initial transformation INPUTS: aff: 3x3 numpy matrix transl: 3x1 vector outname: .mat file name """ aff = aff.reshape((9,1)) transl = transl.reshape((3...
a1f353609ac53a7aba7d10426f3741e1dc08956b47f411319c42dcad7005e202
Python
1,330
42
# 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 Where(Base): @staticmethod def export() -> None: node ...
53de065abf1b5c09878c95a1dc5d82f5569226efc17295a86eccd4dd5aa88537
Python
1,331
40
import logging import os from abc import ABC, abstractmethod from typing import Dict, List class Processor(ABC): """Base class for processor""" @abstractmethod def __init__(self, model_name: str, model_args, # let's enforce everythi...
734566f927d3ed4199cc015c48804a65d8c77809dbc0e664a28a5ec48218df73
Python
1,331
60
# 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 MatMulInteger(Base): @staticmethod def export() -> None: ...
76d3249ba12539cb1a1cd0630e033845694bf7a5d618edceb19b4b0f253421ea
Python
1,334
33
#------------------------------------------------------------------------------ # elftools tests # # Anders Dellien (anders@andersdellien.se) # This code is in the public domain #------------------------------------------------------------------------------ import os import unittest from elftools.elf.elffile import EL...
790c43699c54f398f1c3d35776bcfe7cd4e69c479ed1732959520610359c77d7
Python
1,334
45
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.ticker as ticker __all__ = ["palplot", "dogplot"] def palplot(pal, size=1): """Plot the values in a color palette as a horizontal array. Parameters ---------- pal : sequence of matplotlib colors col...
6aa936728e06d1cadb5417ac3b37b6e3081a976c578f3fe839fc217c5f99e664
Python
1,335
33
"""Fetch official comparator repositories at the experiment's pinned revisions.""" import argparse from pathlib import Path import subprocess from short2long.published_models import ROOT, UPSTREAM URLS = { "rtdl": "https://github.com/yandex-research/rtdl-revisiting-models.git", "babel": "https://github.com/wu...
b42078e17ba742b070d2a339a7a4a1ee74ae5bc610ad3900a980358629e2e86b
Python
1,337
43
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys sys.path.insert(0, os.path.abspath('../..')) # -- Project information --------------------...
f528303ca75f18c7a708936c61ac99701a0dc8251353e9600da6bacd3187ed25
Python
1,337
45
# 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 # # ...
75c6844f4080748a9b673068778e826004a5221fe3690f8cc4a3f01df4272c8c
Python
1,338
53
import sys import torch from tqdm import tqdm from PIL import Image from torchvision import transforms sys.path.insert(0, '..') from utils.func import load_config from modules.builder import generate_model def define_preprocess(cfg): input_size = cfg.data.input_size mean = cfg.data.mean std = cfg.data.st...
dbd3c877716e4ab2c7c1fc83bcf808c8045c1cfc5d22d9f4adfeac513d2ed53a
Python
1,338
45
"""Utilities for detection tasks.""" import numpy as np import pandas as pd def seg_middlepoint(seg_df): """Convert segmentation data frame to midpoint detections. Parameters ---------- seg_df : pd.DataFrame data frame in segmentation format, with columns: * ``ilocs`` - IntervalInde...
7d0b85c780c15f05f50ed6a34f684ec7173faf396d4613495afc5b11d5c8551f
Python
1,339
48
import numpy as np from tensorflow.keras.initializers import Constant, RandomNormal, VarianceScaling def ones_zeros(hidden_dim): """Creates a custom initializer for GRU cell bias. GRU bias initializer sets gate bias (upper 2/3 of matrix) to 1 and candidate bias (bottom 1/3 of matrix) to 0 Parameters...
e29d4202d36d36b0d42bef95d91468ddbcd27f77c935bdf7645a771acd59748e
Python
1,339
43
# Copyright (c) OpenMMLab. All rights reserved. from collections.abc import Sequence from mmcv.utils import build_from_cfg from ..builder import PIPELINES @PIPELINES.register_module() class Compose(object): """Compose a data pipeline with a sequence of transforms. Args: transforms (list[dict | call...
8d5f2f24eca56235bef5edb6d17c5d13f1e52cdb1e2f724beedc203c0ad04fa9
Python
1,340
41
import numpy as np from tensorflow import keras import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten from tensorflow.keras.layers import Convolution2D, MaxPooling2D from tensorflow.keras import layers from tensorflow.keras.preproc...
79f7593a3df9be8baa8ba19be22f5290002a458125a62528500d17fade2964e1
Python
1,341
36
# ---------------------------------------------------------------------------- # 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. # ------------------------------------------------...
cb41b4231ae221e8b811268df890934a9b2c9cae2bc09549dc39d2e06a2f7c4a
Python
1,342
46
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 sns.set_context("poster") sns.set_palette("colorblind") sc.settings.figdir = "./figures/" seed = 1029 # set randomness for dim. reduction and clustering data_d...
ec32f1f6dec9c8fa0656449a067c034a44476f97fd76ce481f7d4f52af4a901d
Python
1,342
48
""" utility to copy the ORIGINAL VCN hoc files to a new name only if the new name does not already exist (prevent overwrite) This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (Spirou, Manis, Ellisman), DC R01 DC004551 (Manis, 2013-2019, Early development) DC R01 DC019053 (Manis...
98ae326bd84044ec27d3defd89fb40c630b04a797c6e0e59113787303ccc9b46
Python
1,343
44
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 """onnx version converter This enables users to convert their models between different opsets within the default domain ("" or "ai.onnx"). """ from __future__ import annotations import onnx import onnx.onnx_cpp2py_export.version_convert...
a21c4be60b12e47f5ffb45aff276859d10dbd9157046bed4686063baeb80697b
Python
1,343
40
from typing import Dict, List from rxnebm.proposer.proposer_base import Proposer from rxnebm.proposer.retrosim_model import Retrosim class RetrosimProposer(Proposer): """ Retrosim proposer """ def __init__(self, retrosim_config: Dict) -> None: super().__init__() self.model = self.build_mode...
c74ae56869f84d30cc1e22bb2c3b2372488c644532c730a310f22308a8170633
Python
1,343
43
# 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...
ecaa8ed8d29019694d4c2a8ba515c856bd0be38f47e7ef96fbd18d11d9978f20
Python
1,344
41
from collections.abc import Iterable import torch from flair.models import MultitaskModel from flair.nn import DeepNCMDecoder from flair.trainers.plugins.base import TrainerPlugin class DeepNCMPlugin(TrainerPlugin): """Plugin for training DeepNCMClassifier. Handles both multitask and single-task scenarios....
509f3f706cb9df9df28f4343095c6a371909a8e91ff6e2480764c2312efb7990
Python
1,345
47
# 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 Sum(Base): @staticmethod def export() -> None: data_0 ...
213aa3442ca93c3f7e7c604f00777253892d55044bbe5b20c9721b875ab472e9
Python
1,346
47
# 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...
63f4fd496c7684a35a910a4a67d06432d71d540d2fc11b661f029f6df0682d03
Python
1,346
45
#%% import pandas as pd import numpy as np import netplotbrain import templateflow.api as tf import itertools import pytest import matplotlib.pyplot as plt #%% @pytest.mark.mpl_image_compare def test_labels(): #%% atlas = {'template': 'MNI152NLin2009cAsym', 'atlas': 'Schaefer2018', ...
c7db32babb1457ad57a647df92fd9d84d65adebf9cead7babe1511df06774325
Python
1,346
72
"""Shared pytest fixtures for the corset-tools test suite.""" from pathlib import Path import pytest @pytest.fixture(scope='session') def data_dir() -> Path: """ Directory holding the checked-in test fixtures. Returns ------- pathlib.Path Path to ``tests/data``. """ return Path(...
da70748b956192ae86d14d784eecdeea8c54b790bcb3a13d0d03c6bb227d4717
Python
1,346
38
#------------------------------------------------------------------------------ # elftools tests # # Seva Alekseyev (sevaa@sprynet.com) # This code is in the public domain #------------------------------------------------------------------------------ import os import sys import unittest sys.path.insert(1, os.getcwd(...
1615982bde76f164a1546e570969012c1dd1d73748dbdbf20a90fc64c26d0a17
Python
1,347
48
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun def _rms_normalization( X: np.ndarray, W: np.ndarray, axis: int = -1, epsilon: float = 1e-5, ) -> np.ndarray: shape = X.s...
23ced2a63b5fcf116e944d1938c391352f47e3ad5be3aaee4cbbab2af1d69064
Python
1,348
47
from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Self # Map an integer in the inclusive range 0-255 to its string byte representation _printable = {i: chr(i) if 32 <= i < 128 else "." for i in range(256)} def hexdump(data: bytes, linesize: int) -> list[s...
6ce28edd95b7d0a1619ec3079d03391982297abdf808ddbdcc400cb2a8d0098c
Python
1,349
62
""" plot_pareto_front ================= .. autofunction:: optuna.visualization.plot_pareto_front :no-index: The following code snippet shows how to plot the Pareto front of a study. .. _visualization-plot-pareto-front-plotly-content: """ import optuna def objective(trial): x = trial.suggest_float("x", 0...
994c19e034f9ad2e8e1f4dacbf03be593c55faea63fef48feb0697691ae8a2fd
Python
1,349
43
"""Compute medoids from time series.""" __author__ = ["chrisholder", "TonyBagnall"] import numpy as np from sktime.dists_kernels._numba_distances import pairwise_distance def medoids( X: np.ndarray, precomputed_pairwise_distance: np.ndarray = None, distance_metric: str = "dtw", ): """Compute the me...
f179b246901e64663c4012a474d6cd0f683b9ba76e8b9bb74a67a3b05fbeeda5
Python
1,349
30
import numpy as np class ResultWriter(): def __init__(): pass def write(): #----- # show the summary (average) of the result print('classifier type = ' + str(classifierType)) print('classifier parameter = ' + str(classifierParams[paramID])) print('pastStageLo...
956375bc6c7039bf3431966621d00ab906bd63a1286f565e1b6c3db5d02a30d6
Python
1,350
40
# 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...
13d4fcddec7951273bdee881507a24182c5a33b0c23301b99e3a01afafb62eef
Python
1,352
32
# 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 SwiGLU(OpRun): def _run(self, a, b, alpha=None): # SwiGLU requires identical shapes and dtypes for A and B: broadcasting is...
af1c78ad2e6ecf0aee503cf0d4e5451a56f4287a8eb19342fa3de330e069f93a
Python
1,352
42
# # # Template from TemplateFlow: MNIInfant # # [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/infant.ipynb) # # To plot different templtes from templateflow, you just need to change the template specification: # # `template='MNIInfant',` # # The exampl...