sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
304fde18c356a4afa5cf89347b46ccd199b1d787576d67eb526b3349addd79a9
Python
2,991
88
"""Custom scoring functions""" import numpy as np from skorch.dataset import unpack_data def loss_scoring(net, X, y=None, sample_weight=None): """Calculate score using the criterion of the net Use the exact same logic as during model training to calculate the score. This function can be used to implem...
3747171c03694dd1376951d54ad762d5f08daa3a09450db4bc137364f1238778
Python
2,993
77
#! /usr/bin/env python3 # ReScience yaml to README converter # Released under the BSD two-clauses licence def generate_README(article): content = ( "**{_.title}**, {_.authors_abbrv}, " "ReScience {_.journal_volume}(#{_.article_number}), {_.date_published.year}.\n" "\n" "**Abstract....
9652d81ef18fab48f515eb3c9432872e7d2fe0930058366375d0a9d3a756afee
Python
2,993
79
import os from typing import List, Union import torch import ray from ray.air._internal.device_manager.torch_device_manager import TorchDeviceManager class CUDATorchDeviceManager(TorchDeviceManager): """CUDA device manager""" def is_available(self) -> bool(): return torch.cuda.is_available() d...
67cf00527b4d7a2cbbb5315ce499a861174c95207124ad3cd361a89323a2c39a
Python
2,994
93
#data utils import argparse import rasterio as rio import json import os import numpy as np from torchvision import transforms from sklearn import preprocessing import torch import yaml import warnings import pandas as pd from torch.utils.data.dataloader import default_collate def read_config(config_path): """Read...
8fc22b0e87288e9d8efc4a2c6be8f599578100bd1d43df99f59a2473644d2b48
Python
2,994
101
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os import warnings warnings.filterwarnings("ignore") # load in directories from language.constants import DATA_DIR from language.preprocess import Participants def load_dataframe( bad_subjs=['p06', 'p08', 'p11', ...
5b0bf094eba7e5698943534fbdb8349f9888effe8e6711a0dfe54c38641064f0
Python
2,995
90
""" ICA and related signal decomposition methods for tedana """ import logging import warnings import numpy as np from scipy import stats from sklearn.decomposition import FastICA LGR = logging.getLogger("GENERAL") RepLGR = logging.getLogger("REPORT") def tedica(data, n_components, fixed_seed, maxit=500, maxrestart...
5a0a441267624d1d7c319eb714f818dc615920c52390dac11b3b25ce18454e61
Python
2,996
81
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) from model import utils from matplotlib import pyplot as plt import seaborn as sns import numpy as np import pickle t =...
71c950d90880ff3b69bcef14d2d45ff25ae0b2df6f8f7fffa9a385cb606bdf1b
Python
2,997
87
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
d2fce6d4ce69b53d6cef1daf60051bee03e533b4a66c840034738d84b6657bc2
Python
2,997
89
import os from typing import List, Optional from ci.ray_ci.configs import DEFAULT_ARCHITECTURE, PYTHON_VERSIONS from ci.ray_ci.container import _DOCKER_ECR_REPO from ci.ray_ci.docker_container import RAY_REPO_MAP, DockerContainer, RayType from ci.ray_ci.utils import RAY_VERSION, docker_pull from ray_release.configs.g...
c3ae10eddbd0f2e3d396a6816825631cf9107dac0d2176d83b17e6407d09f01b
Python
2,998
82
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Runner that executes Experiments locally.""" from typing import Dict, Optional from torch import device as torch_device from torchvision.datasets import Fas...
f7e6528e1a11b3b0262aef1f34fce096c6e54f345771e3bce1d8b38aefd170f7
Python
2,998
104
import cv2 from albumentations import Compose, PadIfNeeded from transforms.albu import IsotropicResize import numpy as np import os import cv2 import torch from statistics import mean approaches = {1: "FaceShifter", 2: "FS-GAN", 3: "DeepFakes", 4: "BlendFace", 5: "MMReplacement", 6: "DeepFakes-StarGAN-Stack", 7: "Talk...
a17b8a161117d32a1adc7e5c9f540033780204c4e4e9e3046e82e7ccf3b0668b
Python
2,999
87
# -*- coding: utf-8 -*- import socket import struct import time import numpy as np import pdb from power_readout import * def dB2inten(dB): inten = 1000 * (10 ** (dB / 10)) return inten class VoltageOperator(object): def __init__(self): self._addr = ("XXX", 7) self._sock =...
1bbd95a93eeb185a90007703c4bb604a15d9117cbb53924d22d7f5814754e5e5
Python
3,000
78
import tensorflow as tf # from tensorflow.keras import backend as K import os, sys import h5py import matplotlib.pyplot as plt from utils import * import gc sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib.pyplot as plt; plt.rcdefaults() from tqdm import tqdm import warni...
f4ca0025fab13ac5a1ca14aa08dc991acdc2311fcd23773fb235193df3406cb7
Python
3,000
93
# Copyright 2023 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
7b4e5007926936cc3ed65c03cae49568604b34c3ea1d05cb67fb52f18a3dfe26
Python
3,001
80
import seaborn as sns import matplotlib.pyplot as plt from Bio import SeqIO import sys, os import pandas as pd import numpy as np type = sys.argv[1] target = "pos_MANE" project_root = "../../train/src/INPUTS/800bp/" output_dir = f"../../results/mutation/{target}/scores/" def plot_violin(df, target): plt.figure(fi...
b9715d258509b1db75426acbb10655213519752ae4120cd873a79b6283b5edbd
Python
3,001
93
import torch from torch import nn from torchvision import models class ResNetFeatures(nn.Module): def __init__(self, resnet=50): super().__init__() if resnet == 18: self.r = models.resnet18(pretrained=False) elif resnet == 34: self.r = models.resnet34(pretrained=Fal...
40ffc4539eaea88dd453465c259ddd59e251a063fc213640154856f31eeb4abf
Python
3,002
115
"""Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html """ import os import sys import mock # -- Path setup --------------------------------------...
58f98aedd0fb912fd1b20b348e173f9ba6069aa9a89a55cdb8f8887e75c9c748
Python
3,004
100
import importlib import ray import yaml import pdb import numpy as np from matplotlib import pyplot as plt from data_assimilation.utils import create_directory TEST_CASE = 'multi_phase_pipeflow_with_leak' TRUE_SOLUTION_PATH = f'data/{TEST_CASE}/test' DISTRIBUTED = True NUM_WORKERS = 25 BATCH_SIZE = 25 PDEForwardMod...
9793784185c5badfa2f5c976eb8c90aa3dc382d03754b15ae5e410e7720df849
Python
3,006
94
"""Script to train an ensemble of models.""" import argparse import logging from importlib import resources from typing import List from flyvis.utils.compute_cloud_utils import launch_range from flyvis.utils.config_utils import HybridArgumentParser logging.basicConfig( format="[%(asctime)s] [%(filename)s:%(linen...
7a4dacf85f5b1ea37c12a5a73db3c55932de23da344d3a8c18bd2c2726d85ffa
Python
3,007
91
import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import math import numpy as np import tensorflow as tf from tensorflow.keras import layers import logging tf.get_logger().setLevel(logging.ERROR) class Envelope(layers.Layer): """ Envelope function that ensures a smooth cutoff """ def __init__(self...
65c03214b3ec32aeb0e597efd2cda5bec94ab4bfaf48480d24a0a55361fb730c
Python
3,008
91
''' Calculate the datasets on the selected combinations ''' import time import moabbpatch import moabbpatch.datasets import moabbpatch.baseparadigm moabbpatch.baseparadigm.physionet_rm_rest = True import moabbpatch.mne_estim_output SEED = moabbpatch.set_random_seed(1023) import config import numpy as np import pandas...
a051d0074298efc82d900f461b26ea11c65e329d904a76cde28be94489f9a614
Python
3,008
78
""" Contains the code for the Perstruc-Denoiser algorithm """ # Imports import numpy as np import copy from tqdm import tqdm from scipy.fftpack import fft, ifft from scipy.ndimage import gaussian_filter1d def perstruc_denoiser(img_stack, FREQ_POS=72, use_gaussian=False): # Output image stack modified_img_...
f13dfe164ad2f14bf8af709dd96fb64a0b64cad47871cf5b0aa41647d3e2ca2f
Python
3,008
100
# stdlib dependencies from typing import List, Union, Any # 3rd party dependencies from numpy.typing import NDArray # project dependencies from deepface.models.facial_recognition.tf import VGGFace from deepface.commons import package_utils, weight_utils from deepface.models.Demography import Demography from deepface...
59749d13c05e985d5957b2a011b34e85b553365746fc1c4e113af42662a0b7cc
Python
3,009
87
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
71e130c48dda800a635b324c727c9846dca40fc3352b672001abcb87a2a7e2b8
Python
3,009
107
_base_ = [ '../_base_/datasets/rtts_coco.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='PAA', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], ...
fe78c4c6bd2a18d9d09629a0ec05bd154b262804ed739d6b006e321136ce72e5
Python
3,011
97
import json from collections import defaultdict import tables as tb def rapppid_to_pipr( dataset_path, c_type, seq_path, train_path, test_path, val_path, metadata_path ): rapppid_dataset = tb.open_file(dataset_path) metadata = rapppid_dataset.root.metadata cols = metadata.colnames rows = [row[:]...
031ea44c271e1630a018ee0e5f16de0eaae97a3a4ecab30000a29670d63ae2cc
Python
3,013
96
import os import pdb import numpy as np from tqdm import tqdm import torch import matplotlib.pyplot as plt import yaml from latent_time_stepping.AE_models.VAE_encoder import VAEEncoder from latent_time_stepping.AE_models.autoencoder import Autoencoder from latent_time_stepping.AE_models.encoder_decoder import Decoder,...
a75833543c6fd098d40ce71baecdb0f1a8c0ba06e696e93714e7352bc4e5e29e
Python
3,013
82
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import pytest from fairchem.applications.cattsunami.core import Reaction from fairchem.applications.cat...
89a3a5084efe4568fb5ce8a01c145efd1744025f4d2375b19a6758b44d25e1e2
Python
3,015
97
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 ag...
cacbe43928bba1efc5c710cf7096d8eb46d15f51c40e173190863b56359ea2ac
Python
3,015
86
#!/usr/bin/env python3 """Utility scripts for pruning graphs and adjacency matrices.""" import logging import numpy as np from scipy import sparse def prune_graph_degree(graph, degree=0): """Prune igraph graph nodes by degree.""" logging.info("Removing igraph nodes with degree <= " + str(degree)) import i...
3499aad16f1255fd6653014f9e67ef45a729f4de1762fa251f03a98890c885cf
Python
3,016
74
"""Register each run to one reference run.""" import os import subprocess DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/derivatives' SUBS = ['sub-06'] BBOX = {'sub-05': {'RH': {'xlower': 435, 'xrange': 162, 'ylower': 55, 'yrange': 162, 'zlower': 95, 'zrange': 158}, 'LH': ...
55d326af60771f46784d8a9f9a61c3de8d978cadce1d8a4f52e9592752fa3e64
Python
3,016
114
import os import tempfile from ray.dag import DAGNode from ray.dag.utils import _DAGNodeNameGenerator from ray.util.annotations import DeveloperAPI @DeveloperAPI def plot(dag: DAGNode, to_file=None): if to_file is None: tmp_file = tempfile.NamedTemporaryFile(suffix=".png") to_file = tmp_file.name...
a3d4f2feaf2d5de1171e68d62e3b6e9e581a0dcb5b89514eaeae2a771bfe94af
Python
3,016
99
import argparse import hashlib import importlib import os from typing import Optional import requests import torch from ldctbench.hub import load_model torch.serialization.add_safe_globals([argparse.Namespace]) import torch.nn as nn import tqdm from ldctbench.utils import load_json from platformdirs import user_cache...
afd25836ab2b77a363043e54e8ec07cdfee7e583508f8f55c0d9fcca8d9b50db
Python
3,016
107
_base_ = [ '../_base_/datasets/duo_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='PAA', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375...
510f100bc59fa544fdf08b09fdfd6bc053ecd4e951ed3174b52382a2621d2181
Python
3,017
87
from __future__ import annotations from typing import Any, Optional def _normalize_session_id(value: Any) -> str: if value is None: return "" session_id = str(value).strip() return session_id def resolve_bridge_session_id(session: Any, *, create: bool = True) -> str: """Return the active ag...
74a46509bee7ef56527c37865f90a79db78a26a1d3a5ed833c91b850e5fcb150
Python
3,017
92
#!/usr/bin/env python """ Collect medcov metrics. Writes stats to stdout. Metrics: medcov_mean : mean median coverage medcov_mean_err : mean absolute deviation from baseline profile (if --baseline specified) medcov_max_err : max absolute deviation from baseline profile (if --baseline specified) """ impor...
99128c2c424a0e25d4641a402d53ac3773a7bce9802c77e721de3d0391ba9e1f
Python
3,018
123
import numpy as np from spinnaker2 import snn, hardware from spinnaker2.mla import conv2d, mla_helpers import matplotlib.pyplot as plt #create input signal for rf neurons dt = 0.01 timesteps = 512 t = np.linspace(0,(timesteps-1)*dt, timesteps) w = np.array([0.2, 3, 4]) n_targets = len(w) signal = np.exp(1j*2*np.pi...
3060c2f8db4d46c98a81d2c47423e10e04248ea60d44e893652b13dfb28c6995
Python
3,019
96
import os class Parameters(): def __init__( self, dim_hidden = 16, dim_context = 128, ctx_wt = .5, stickiness = 1, concentration = 1, gen_grad = 5, lik_softmax_beta=.33, try_reset_h=False, use_shortcut=False, pe_tracker_size =...
d201b696c58f46119d32e08a3a225e4af4f8c7e6c28a2045aeb38da9c8a7b6e2
Python
3,020
107
_base_ = [ '../_base_/datasets/ruod_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='PAA', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.37...
57e73b3b46ecb0f21c87687277ec9bf7ef508d7dd34e860f9fce0e2f0737ccfb
Python
3,021
120
import tempfile import pytest from pfrl.collections.persistent_collections import PersistentRandomAccessQueue def check_basic(tmpd): rb = PersistentRandomAccessQueue(tmpd, 16) assert 16 == rb.maxlen data = {0x42: "pocketburger"} rb.append(data) x = rb.sample(1) assert [data] == x assert...
67396dd5577ad3dba6f0809f864f333085c0f59389b59991ba709afa6807c77a
Python
3,021
96
import numpy as np from matplotlib.pyplot import imread import h5py import os import argparse import multiprocessing as mp from typing import List import functools from lib.data_utils.sta_metadata import RGB_CONVERSION CROP_HEIGHT = 160 CROP_WIDTH = 256 MAX_IM_PER_CLASS = 500 HALF_CROP_HEIGHT = CROP_HEIGHT // 2 H...
7214d31ebc1a1e802184c028e796857c2dc49b40cecc910aa2bcc7e43071170b
Python
3,021
118
from typing import Union, Sequence, List, Dict, Callable, Tuple, Iterable import collections import numpy as np from shapely.geometry.polygon import Polygon, LinearRing from shapely.geometry import LineString NicePathType = Sequence[Sequence[float]] # [[x, y], [x, y]] PathType = Union[ str, # "x,y,x,y" Nice...
4a3c9efa81dffbbf65eb77d5de6ad87f1b104e6550e5cad5ab6ee98d6eefb870
Python
3,022
93
#!/usr/bin/env python # coding: utf-8 import sys import numpy as np import pandas as pd import tensorflow as tf import logging tf.get_logger().setLevel(logging.ERROR) sys.path.append('../DROID') from data_descriptions.echo import LmdbEchoStudyVideoDataDescription from model_descriptions.echo import create_movinet_cl...
78804357ec34fa79e517097b4ba184af81a1eea620f686e92e0072362cfd63c6
Python
3,022
93
"""Script to run a notebook for each model of an ensemble.""" import argparse import logging from importlib import resources from typing import List from flyvis.utils.compute_cloud_utils import launch_range from flyvis.utils.config_utils import HybridArgumentParser logging.basicConfig( format="[%(asctime)s] [%(f...
c476483c86ad644325559a861bd084a7356a03a47d6f83ac2ff7419852d4e2b5
Python
3,022
67
import numpy as np import pandas as pd from sklearn.datasets import make_classification from siapy.entities import Pixels, Signatures, SpectralImage from siapy.features import AutoSpectralIndicesClassification from siapy.features.helpers import FeatureSelectorConfig from siapy.features.spectral_indices import compute_...
4a22a78bb619fa9999aeeac7537fa585b0c628e182095c522b71896eb011aa05
Python
3,023
92
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class OnnxStableDiffusionImg2ImgPipeline(metaclass=DummyObject): _backends = ["torch", "transformers", "onnx"] def __init__(self, *args, **kwargs): requires_backends(self, ["...
77b6a1156782ddcc325f536c12481c05b3544400c05631a9d8e0a1395b520cc3
Python
3,024
83
import numpy as np from spinnaker2.neuron_models.application import BaseApplication from spinnaker2 import mapper from spinnaker2.mapper import SynapseWordSpec, SynapseWordSize from spinnaker2.configuration import PEConfig, MemoryRegion from spinnaker2.neuron_models.common import (add_log_memory_region, N_WORD...
aab61c497f3cab5a1fc30539f2aeef8286ec1b4354d053ba816941ccb51451e5
Python
3,024
55
import tensorflow as tf from mol_graph import max_nb from utils.nn import * def gated_convnet(graph_inputs, batch_size=64, hidden_size=300, depth=3, res_block=2): input_atom, input_bond, atom_graph, bond_graph, num_nbs, node_mask = graph_inputs layers = [input_atom] atom_features = input_atom for i in ...
8bcbfb43a0dd949a506aa1c90883a76816bf1b64280ce36775a99c37c69ed73c
Python
3,026
112
from typing import Optional import matplotlib.pyplot as plt import numpy as np from numbers import Number class DataTracer: def __init__(self): self._data_list = [] self._data_array = np.array([]) self._time_list = [] self._time_array = np.array([]) self._ax = None @pr...
b9c7e770526af52878beb8316c15eb1b31584abf574cf080b590e5482ca69392
Python
3,026
98
from spinnaker2 import snn, hardware import json from spinnaker2.helpers import read_log import matplotlib.pyplot as plt from numpy.polynomial import Polynomial # enable profiling for LIFApplication class import spinnaker2.neuron_models.lif_neuron spinnaker2.neuron_models.lif_neuron.LIFApplication.profiling = True d...
d1250f16605933ef41eba49115590ac9100ace2764515b9a237c207d90d2b692
Python
3,026
75
# 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 agreed to in writing, software # distributed under th...
eefed0fe24f7096a41d587b6b6f3ec3742b4860e6201039a44ec0240cc347cd5
Python
3,026
77
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import numpy as np from lifelines import CoxPHFitter from lifelines.utils import concordance_index import pandas as pd i...
3d9ceeadaeb438002c166009e2d92847e349c6be51f3cd8325f7572ebbfa4a6f
Python
3,027
87
import numpy as np import mne from audio_utils import WaveProcessor from tqdm import tqdm def create(wav_dir: str, out_dir: str, config: dict) -> None: """ Create feature from audio snips. This function creates a feature from audio snips. The feature is an acoustic array of the shape (samples, segments, ...
1e7bd83c50f82f18fd9cca5e936c8117ad31d54565b4a03c5e562520c113359b
Python
3,028
61
from argparse import ArgumentParser from sys import stdin as std_in from sys import stdout as std_out import logging import pysam from deltasplice.pred_utils import get_delta_prediction, Annotator from tqdm import tqdm def get_options(): parser=ArgumentParser(description="Version: 1.0.0") parser.add_argument('-...
224d826ff7bf8ecdb524d593f45080b16f87246458bc5ddc95afb0f3d7cb0945
Python
3,029
83
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
4f00de320e11ee401bc362b625dce73b01a56b430312de64786bb0c0b5a8289c
Python
3,029
84
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) from model import utils from matplotlib import pyplot as plt import seaborn as sns import numpy as np import pickle t =...
84146cbdbe47b1e9a8187687f0879019c0ad6399539ff2d87df1817a099ace45
Python
3,029
103
""" Structured event reporting for OmicVerse Agent (P1-1). Replaces hard-coded ``print()`` calls with a pluggable Reporter interface. Three built-in implementations: * **PrintReporter** – reproduces current emoji-rich terminal output (default). * **SilentReporter** – logs to ``logging`` only (tests / batch pipelines)...
ad669c304a1071683d4fa5700bb39b77acf0a4d216d9bf9d7fa4ba6434a43ea3
Python
3,029
105
_base_ = [ '../_base_/datasets/rtts_coco.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='RetinaNet', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], ...
42f9b587a94aa44586f526c4ec2f690be7b9a7c083bee988db9c716f3d7b0bfd
Python
3,030
87
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 ag...
6146cf7d1566c7f3cc044a8cc1c05ba90e5a64ac74469f902cc117e3d82f5a43
Python
3,030
92
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion): # --------------------------------------------------------------------------------...
762c2c4c99a8f9a0f1d588ff969222c394e3aad742c9ee3aaea7e2197dfeba3c
Python
3,031
67
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
b0b26e3b18f3ecad70a091622e996f751c43ca16a5ece9ed9303cad0877f9dfa
Python
3,031
80
from typing import Optional, Sequence from mmeval.metrics import MeanSquaredError as MMEVAL_MSE from lqit.registry import METRICS @METRICS.register_module() class MeanSquaredError(MMEVAL_MSE): """Mean Squared Error metric for image. mean((a - b) ^ 2) Args: gt_key (str): Key of ground-truth. De...
3e827af6df218c2056a8c4f30bafa78767341add4919ae9245978081a19b026d
Python
3,035
81
from typing import Optional, Sequence from mmeval.metrics import MeanAbsoluteError as MMEVAL_MAE from lqit.registry import METRICS @METRICS.register_module() class MeanAbsoluteError(MMEVAL_MAE): """Mean Absolute Error metric for image. mean(abs(a - b)) Args: gt_key (str): Key of ground-truth. ...
a92c0d410bb93cedced8bba23be0671a69a5c324e0087ac7cabe4812013c5676
Python
3,036
105
_base_ = [ '../_base_/datasets/duo_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='RetinaNet', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, ...
b3641b6114eb197d7e21d6d0c7dc7c17a2f9415ab4c317624ebe282424ca543e
Python
3,036
85
import math import torch import torch.nn.functional as F from ..distances import CosineSimilarity from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from ..losses.base_metric_loss_function import BaseMetricLossFunction from ..losses.mixins import WeightRegularizerMixin #####...
eb5ba364899d9bce25e491487bce9bd6e2828111b05699336ab0875c25b34bf0
Python
3,036
75
import sys import scipy.io as sio import os import numpy as np from scipy import special import h5py if __name__ == "__main__": list_Exp_ID = [ 'Mouse_1K', 'Mouse_2K', 'Mouse_3K', 'Mouse_4K', \ 'Mouse_1M', 'Mouse_2M', 'Mouse_3M', 'Mouse_4M'] num_Exp = len(list_Exp_ID) r_bg_ratio = 3 ...
0d8f6574c5600edf55cf21fa3c5bd5354b6b991457b1c92a87616f55ecc87698
Python
3,038
106
import sys from unittest.mock import Mock import pandas as pd import pytest from data_profiling import ProfileReport @pytest.fixture def df(): return pd.DataFrame({"num": [1, 2, 3, 4, 5]}) @pytest.fixture(scope="function") def mod(): mod = Mock() sys.modules["great_expectations"] = mo...
2b37fffb436ca4412c1cdedc2895a003b4b5f8627f36ac25879cc590123bef96
Python
3,038
105
_base_ = [ '../../_base_/datasets/rtts_coco.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model settings model = dict( type='RetinaNet', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, ...
ba434a31adfe982fa797fb5924082596c086529a902c0c1fbb094301305a973d
Python
3,038
80
import torch from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from ..losses.generic_pair_loss import GenericPairLoss class LiftedStructureLoss(GenericPairLoss): def __init__(self, neg_margin=1, pos_margin=0, **kwargs): super().__init__(mat_based_loss=False, **kw...
bc6f1e215269bdf473ec443f57c934e232d0d3f3c7a9b557d44da6063d7f0d11
Python
3,038
77
# Copyright 2023 The HuggingFace Team, the AllenNLP library 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 # ...
26a5529e21295d2921714213c0c06ab30c4722346de9e2d626e7036cd0fb65dd
Python
3,040
94
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Tests for optimizers.""" from torch import Tensor, manual_seed from torch.nn import Linear from torch.optim import SGD, AdamW from torch.nn.functional import...
71cc536333053b0bcfd20d732d44020ea1ed84265d27792e9752179655e3dbfd
Python
3,040
105
_base_ = [ '../_base_/datasets/ruod_coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='RetinaNet', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12,...
dca498edadb17048401c0b54606d78ef65179ecf7f179e4d7f2b6f1c9c075e8a
Python
3,040
78
from .swin_transformer import SwinTransformer, PatchMerging from torch import nn class Build_Merging(nn.Module): def __init__(self, body_psg, body_hyp, head) -> None: super().__init__() self.body_eeg = body_psg self.body_hyp = body_hyp self.head = head def forward(sel...
54477151ca705a0a1be0dcc8d6299eb7a92ee8229bcd7f61db401164292aa26f
Python
3,041
83
# Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # and Applied Computer Vision Lab, Helmholtz Imaging Platform # # 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 L...
5a121d2a770778fce5ebda3826d542f5efa6e9936ffd00a8aeaa9a5a049e42c9
Python
3,041
84
import gym import numpy as np import pytest import pfrl @pytest.mark.parametrize("num_envs", [1, 2, 3]) @pytest.mark.parametrize("env_id", ["CartPole-v0", "Pendulum-v0"]) @pytest.mark.parametrize("random_seed_offset", [0, 100]) @pytest.mark.parametrize( "vector_env_to_test", ["SerialVectorEnv", "MultiprocessVect...
5e8d0a2b05523bc8bcb1dd56c707e35cc80902348bc0c2f0c0a429afe632b8c2
Python
3,041
121
from argschema.schemas import ArgSchema, DefaultSchema from argschema.fields import ( InputFile, OutputFile, String, Nested, Dict, List, Int, Field, Float, Boolean) from marshmallow import ValidationError class PathResolution(DefaultSchema): path = String( description="Fixed value boundary condition",...
0a3905479a2c73e0a1c95e8c0a5740c9bbace196e277b62e8a189dfc5f53060c
Python
3,044
92
import os import pickle import numpy as np import pandas as pd from utils import to_pth, list_fnames, pickle_load from utils.PCATransformer import PCATransformer from sklearn.preprocessing import StandardScaler DATA_ROOT = '../data/input_scene_vecs/' scene_vec_fpattern = '*_kinect_sep_09.pkl' FPS = 25 pcat = PCATransf...
8cef85c73536f053c5310c70d8b2b40afbba9f474663da3b8bcac7cca763a8f1
Python
3,044
88
import functools import torch.nn as nn # Isolated baseline implementation provided by @warvito and should be used as minimum performance # for any further improvement. This implementation is 3D only. It was extracted from his codebase # at commit https://github.com/Warvito/Dan_Data/blob/97ccba41d8ee1e811b66e79254fcce...
a4fe830717996fea95e3cc9bc40d5a23553021a62a02bd096b9d176878b121d8
Python
3,044
78
import numpy as np import pandas as pd def in_silico_fold_change(concentration, fold_change_limit=9): ''' Take a series of known concentration, and a fold change limit, and relabel the concentrations such that new labels are within the fold change limit. Returns the given concentrations, the replaced conc...
f0c7e4f98434a5f23453dc21fdc0d261f720749fcd1e10496e61928dc4edd94d
Python
3,045
99
import numpy as np import pandas as pd import pytest from matplotlib.legend import Legend from matplotlib.pyplot import Axes, close, rcParams from data_profiling.visualisation.plot import ( _create_timeseries_heatmap, _plot_pie_chart, _plot_stacked_barh, _prepare_heatmap_data, ) # Generating dummy dat...
4c9ea6c8662df3079f0d387b440f8df6e715f4c76a66b3b6874f2135be1d12d4
Python
3,048
89
"""Reduce bounding box to decrease filesize.""" import os import subprocess import glob # ============================================================================= # Define data dir DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti' # Set subs to work on SUBS = ['sub-07'] # ===============...
fb77e7bad95440d57228d07783ef7151e58d349d2a5355ab92bdf04510128326
Python
3,048
88
import functools import torch.nn as nn # Isolated baseline implementation provided by @warvito and should be used as minimum performance # for any further improvement. This implementation is 2D only. It was extracted from his codebase # at commit https://github.com/Warvito/Dan_Data/blob/97ccba41d8ee1e811b66e79254fcce...
1dd1fbe115d43112188879e7f4d7c4102b3c19ef38a1c7790fc3b01a1248aba1
Python
3,049
94
import torch import torch.nn as nn from torch.nn.functional import binary_cross_entropy_with_logits from torchvision.transforms.functional import to_pil_image import matplotlib.pyplot as plt def convert_cell_to_img(t, padding=16): """Converts pytorch tensor into a Pillow Image. The padding will be removed fro...
1b888cef4ee821cf1abcd141f228d5f47ea990cfd70cdb87b73f1aad28782eef
Python
3,051
83
# # Copyright (c) 2021, NVIDIA CORPORATION. # # 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 agreed ...
726bcd834eac43c4dd0da2350537b53eabfb78bc57141ef20ae365adcef33609
Python
3,051
77
import unittest import numpy as np from reval.relative_validation import RelativeValidation from reval.utils import kuhn_munkres_algorithm from sklearn.neighbors import KNeighborsClassifier from sklearn.cluster import AgglomerativeClustering from hdbscan import HDBSCAN from sklearn.datasets import make_blobs # Modify...
2a5b74e118bbda929b22c51a9b34db89710723a5d4699b77fd3dcbb9098285b4
Python
3,052
80
import unittest from pathlib import Path from tempfile import TemporaryDirectory import numpy as np import pandas as pd from metabolite_learner.agilent import EXPECTED_SHAPE, TIME_GRID, convert_agilent_to_csv from metabolite_learner.cli import build_parser from metabolite_learner.pls import MetaboLiteLearner class ...
3f203177060b2f2dd6c019d20d09ae5a0b25954940825405b04fe3b22cb803e3
Python
3,053
96
import numpy as np from scipy.stats import sem # from scipy.special import kl_div from sklearn.metrics import accuracy_score from sklearn import metrics def compute_stats(arr, axis=0, n_se=2, use_se=True): """compute mean and errorbar w.r.t to SE Parameters ---------- arr : nd array data ax...
6092e4e65770a39e464a05380f1f9b7edbfa484d352eebe179afdf65d76bffec
Python
3,053
82
# built-in dependencies import os # 3rd party dependencies import pytest # project dependencies from deepface.models.face_detection import OpenCv from deepface.commons.logger import Logger logger = Logger() BUNDLED_PATH = os.path.join(os.path.dirname(OpenCv.cv2.__file__), "data") def test_haarcascade_files_are_do...
5b22a546a2e300c1f59e63854b9d99ffb37e245622d96394d63a421488b7b808
Python
3,057
137
# flake8: noqa # __tasks_start__ import ray import time # A regular Python function. def normal_function(): return 1 # By adding the `@ray.remote` decorator, a regular Python function # becomes a Ray remote function. @ray.remote def my_function(): return 1 # To invoke this remote function, use the `remot...
cf59489dbe4f9c5c8fbc599127281cb87d79cd1580b4e5bc15f05ba4677ad333
Python
3,057
83
import os import pandas as pd from src.commons.process_dataframe import keep_valid_columns, change_col_value_type, insert_new_col_from_two_cols, \ get_sub_df_according2col_value, get_mean, get_std from src.commons.process_number import get_deviation, get_percent_change from src.constants.ms2_triplets_4_constants i...
5225940063cf3fd67fa57387d75bbe3f53a272b6446614d5c220a8bfae4ae954
Python
3,058
79
import io import unittest from unittest import mock from container_resource_utils import ( get_container_cpu_limit, get_container_mem_limit_mb, get_system_ram_mb, main, ) class TestResourceUtils(unittest.TestCase): def test_get_system_ram_mb_calculates_correctly(self): with mock.patch("os...
90c55df508fec9f658bc34ef2e81a4cc5f207c6eb5b9057a0e4fc7bf4e7fac56
Python
3,059
136
import os import pickle import numpy as np import matplotlib.pyplot as plt from utils.grid_funcs import ( meanfr_repsupp ) import settings from joblib import Parallel, delayed from tqdm import tqdm ############################################################################### # Parameters ...
57d5271e84ce1100d0e8205dae6800ae7285bc9d20490b7c03c25b4c0bb6458e
Python
3,061
82
#!/usr/bin/env python3 import argparse import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages def calculate_median_mad(group): median = np.median(group) mad = np.median(np.abs(group - median)) return median, mad def main(): parser...
f3bf9d252e763e7676e71a216dbd3911d932d09700beaba3f19cd49ac957f1e7
Python
3,062
81
import optuna import sys import os import datetime import os.path as osp from math import isfinite sys.path.insert(0, "/srv/home/zgaleday/torch_pgn") from torch_pgn.args import HyperoptArgs from torch_pgn.train.run_training import run_training DEVICE = 'cuda:' + sys.argv[1] ENCODER = 'dimenet++' DATA_PATH = sys.arg...
3480fbbebe9870f090b8617b74a97a907b6b5bea5454d00a2fdf830a25a6f238
Python
3,063
74
#!/usr/bin/env python import numpy.testing as npt import numpy as np from scipy.ndimage.filters import gaussian_filter import caiman.source_extraction.cnmf.params from caiman.source_extraction import cnmf as cnmf #%% def gen_data(D=3, noise=.5, T=300, framerate=30, firerate=2.): N = 4 ...
c228e5a26c90fb4f6078a3dc1d01edc85585a5e0ab09ae7b02fe4c0aa617fabe
Python
3,063
81
import torch import soft_rank_numpy def wrap_class(cls, **kwargs): """Wraps the given NumpyOp in a torch Function.""" class NumpyOpWrapper(torch.autograd.Function): """A torch Function wrapping a NumpyOp.""" @staticmethod def forward(ctx, values): obj = cls(values.detach()...
680b13badbe43cc0f33cd4e4d953ee9e616e60830f3149ea1a5c7d90894cc52e
Python
3,064
46
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool f...
ef7fa57de01e6b7881c2e44a5dba705f430614e49e076e1db04c2a5582bd52b3
Python
3,064
83
import torch # mypy somehow complains about `torch.optim.RMSprop` as of torch==1.5.0. class RMSpropEpsInsideSqrt(torch.optim.RMSprop): # type: ignore """torch.optim.RMSprop with eps inside sqrt.""" def step(self, closure=None): """Performs a single optimization step. Arguments: c...
ea2090be6d29566c0a0cf83b2b22ddfe03cbb46237481afe8d7f862328bde49f
Python
3,067
94
from typing import Annotated, Literal from mlxtend.feature_selection import SequentialFeatureSelector from pydantic import BaseModel, ConfigDict from sklearn.linear_model import Ridge, RidgeClassifier from sklearn.pipeline import Pipeline, make_pipeline from sklearn.preprocessing import RobustScaler from siapy.core.e...
0bb0b4671b7bcd80ebdb828bd967ca47b46c42c44370f3f1cdb0fe712940908d
Python
3,068
87
from pathos.pools import ParallelPool as Pool from itertools import product import numpy as np from lgca import get_lgca from tqdm import tqdm INPUT = '.\\data\\gog\\nonlocaldensity_10reps\\' OUTPUT = '.\\data\\gog\\nonlocaldensity_recurrence\\' def iteration(args): from pickle import dump, load index, kwargs...