sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fe9c3d5596642e106051229635acea3d91468cb0df1e4149b59371b81b8b0ca3
Python
5,650
175
""" File to define the entry point to Model Server """ import os import re import subprocess import sys import tempfile from builtins import str import psutil from ts.version import __version__ from ts.arg_parser import ArgParser def start(): """ This is the entry point for model server :return: """...
6f2f7965f8ed3a8db0e1d0d73ae5095cec6c48058bc5e7e82fafa53a5d5fb09b
Python
5,651
169
"""Time series Agglomerative Clustering.""" __author__ = ["Muhammad-Rebaal"] __all__ = ["TimeSeriesAgglomerativeClustering"] from scipy.cluster.hierarchy import fcluster, linkage from scipy.spatial.distance import squareform from sktime.clustering.base import BaseClusterer from sktime.dists_kernels.base import Base...
aad5498c5bb8454c8a0abeef9f043f7bab65e325362611de0183d6b65d79c671
Python
5,651
169
#!/usr/bin/env python3 ''' Functions for manipulating matploblib and cv2 colormaps, as well as some functions for converting between rescaled to dfof values. On first import, loads defaults set by seas.defaults configuration into REGION_COLORMAP, DEFAULT_COLORMAP, and COMPONENT_COLORMAP. Authors: Sydney C. Weiser Dat...
3db127f2f17a6b371d271e585c75aed5c1c792e8006c117f12a80451f46f2315
Python
5,656
154
# 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...
57b1f218bdcadbdffb406928a6edbcd9193ea4cbe9a74901172a66a3caad687b
Python
5,664
152
# 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...
779438974cd2fd4e6ed2e6166a190513d4652b2c7f5f4bf2bf930b24a4c3eee3
Python
5,664
144
from typing import Tuple import torch import torch.nn as nn from .utils import get_p_polar, get_p_cartesian, get_polar_rel, check_p_dim from scipy import optimize class HungarianMSELoss(nn.Module): """Permutation invariant MSE Loss for jets using scipy.optimiz (Hungarian algorithm).""" def __init__(self): ...
506938143f92610069c33b802d17de159ec88d6e14932f8a89c84c7b8b42aba3
Python
5,665
179
""" Utility methods for datasets. """ from __future__ import annotations from typing import Set, List, Tuple, Union, Any from numpy.typing import ArrayLike import requests import sys import os from os.path import exists import numpy as np import logging def download_progress_bar(file_url: str, file_dest: str): ...
c79a72174cd45225662378b897a065256d19b80d62f61dfcb7ed64f00f52f3a4
Python
5,665
202
"""MP distance.""" import numpy as np def sliding_dot_products(q, t, q_len, t_len): """Compute the sliding dot products between a query and a time series. Parameters ---------- q: numpy.array Query. t: numpy.array Time series. q_len: int Length...
43b54dcda71df954325a0023cf908ba625b4c12385e1536ee45d2eb24996b448
Python
5,669
152
# 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...
1ea6caadad8af1a58909bac11f9d5fb66bbd7584904d94083c008e5845bd9ee5
Python
5,672
187
# 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...
6df4412ed8c18733736ea48daceb54a3a14f0456242559e29bb91cb2b8982335
Python
5,673
129
#!/usr/bin/env python import sys import os import math import re from os.path import isfile, join, isdir import imageio import numpy as np from kn_common import pipetools,pipedef from kn_pipeline_class import CPipeError,CPipeStep class CPipeStepHighResMap(CPipeStep): matlab_tools=pipedef.maltab_tools mat...
c69599b4b617ccbe41b387c28ce20ac1be6482d5eeb1b5406bfb25ef8e51588a
Python
5,673
158
import cv2 import matplotlib.pyplot as plt import numpy as np import argparse import glob import time import os from tools import videoMetadata from constants import * import pdb from scipy.stats import circmean import matplotlib from matplotlib import gridspec import pandas as pd from matplotlib import cm from matplo...
34d531561b7fae29112fb99240d6ed956c4dcf61e00c91c85a7f20924dbee00d
Python
5,674
125
#!/usr/bin/env python3 import subprocess from pathlib import Path from collections import defaultdict import rdflib from ttlser import natsort from pyontutils.core import qname, makeGraph from pyontutils.utils import TermColors as tc from pyontutils.namespaces import NIFRID, ilxtr from pyontutils.combinators import re...
4e5eaf21a2a0a8152dcc37871349ba214a18e9a65f3a6bece122d458e6736fdd
Python
5,675
217
from sns_toolbox.networks import Network from sns_toolbox.connections import NonSpikingSynapse, SpikingSynapse from sns_toolbox.neurons import NonSpikingNeuron, SpikingNeuron import time import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm # SNS Version net_ns = Network() net_s = Network() neuron_...
502ef354fbccc9d0144fa3e0eeb996e9ad77d6fecc93cc060c1aed3d91b5b1bd
Python
5,677
175
# 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 # """Data source identifier. This module provides the main class and the support...
db46c426c6f550b4ab9b8ebcfb7668cd10d60c22646577ed6385b78937a7dee6
Python
5,678
137
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file) """Base class for data types.""" __author__ = ["fkiraly"] from sktime.datatypes._base import BaseDatatype class ScitypeHierarchical(BaseDatatype): r"""Hierarchical data type. Represents a hierarchical collection of time series. The ``Hi...
ee4eea6c19124337aa9c6d61d11ecace408c08f5ef6aba95eefe9960f29eb349
Python
5,679
133
""" Parameters: ---------- ndl: neighbours of each vertex, read from the {h}.pial.neighbor.asc file for each hemisphere nb: max number of neighbor for each vertex Returns: ------- {h}.pial.area.asc: surface area associated with each vertex for each hemisphere {h}.pial.K.asc: Gaussian curvature (K) at ea...
08e6fa4fb1721bf14fc9e1baabf78bbaf275fe55f965a42651ec5212afc930c5
Python
5,680
150
# 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 # # ...
9c28c804d4078c2f929565713ed99580c8d3c2b384935a96a8266f52379a5193
Python
5,680
157
# 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...
4c3c9533291030aca61a2d4c3c85ca643301583c92f49812e4801343c82635cd
Python
5,681
170
import pandas as pd from typing import Tuple, Optional, Dict, Any from .src.validation.config_manager import ConfigManager from .src.validation.input_validation import InputValidator from .src.core.main import VarBayes from .src.core.utils import write_data, pre_launch from .src.viewer.run_flask import flask_app_start ...
3de71645c0075abd665435685507a00b4ba1515c18d57a2f103afd17f12f65fb
Python
5,683
186
import itertools from pathlib import PosixPath from typing import Generator, List import ants import numpy as np import torch import torchio as tio from omegaconf.dictconfig import DictConfig from rich.progress import track from hsf.augmentation import get_augmented_subject from hsf.engines import InferenceEngine d...
d603479f341c3b2dd297304dc4d11e6e73dc3a5739d37d058963aba308e06735
Python
5,684
152
patchseq_config = { "train_batch_size": 16, "finetune_batch_size": 16, "transfer_batch_size": None, "train_epochs": 20, "finetune_epochs": 20, "transfer_epochs": None, "train_task": "cross_model_prediction_clus", # "cross_model_prediction_clus", "finetune_task": "unsupervised_gr...
d416ce15806257307e7635f153f1e36fe5cf7aa71d8182feaacbe3819a23c0fc
Python
5,686
140
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import argparse import json import os import shutil import onnx.backend.test.case.model as model_test from onnx import TensorProto, numpy_helper TOP_DIR = os.path.realpath(os.path.dirname(__file__)) D...
5d577082fc87633f2aa6977d0e72a02b52653aa20d80497c98b08c829b5c2a4b
Python
5,687
162
# 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...
431e5522ec7914f81ac80029bc1031946de89a2540a6d28eebade60fbe0a912b
Python
5,688
153
# 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...
ac33dd758d03220a32100d02525c5a009a29de9a4f192f5f54de60896189dbd8
Python
5,690
158
import argparse import json import numpy as np import os import multiprocessing import pickle import sys from collections import Counter from rdkit import Chem from tqdm import tqdm sys.path.append('./util') from rdchiral.template_extractor import extract_from_reaction parser = argparse.ArgumentParser...
c032e6dff915d150ba76624bf2b80d4ac4f03ab76c0865ca5dd36207c7ace452
Python
5,691
212
# 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...
7c8ec2491ba50213bc46939ce93f3041fdbfe0d0655a6bbdd38fc642b435fd81
Python
5,694
118
# SAFE TEAM # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode) import argparse import os import sys from subprocess import call class Downloader: def __init__(self): parser = argparse.ArgumentParser(description='SAFE downloader') parser.add...
7053c716cc87a44d367de0c6690b2327671c654ab0c5fbec884c4430ae62aa0a
Python
5,697
149
#!/usr/bin/env python # coding: utf-8 # In[1]: import os os.environ["CUDA_VISIBLE_DEVICES"]="1,6" # Choose which GPUs by checking current use with nvidia-smi import tensorflow as tf # import tensorflow_addons as tfa from tensorflow import keras from tensorflow.keras.applications import ResNet152V2 from tensorflow.ker...
1f497aa481e276199d9407548dda38837652501d1bd4d296eda7360d710893ca
Python
5,704
156
import numpy as np from keras.optimizers import * import os import pandas as pd from scripts import models_util from scripts_tl import training_util_tl import scipy as sp import keras # Global dictionaries name_to_optimizer_dict = {'Nadam': Nadam, 'SGD': SGD, 'RMSprop': RMSprop, 'Adagrad': Adagrad, 'Adadel...
7990196023905cfc6541dceeca8383e43dc93396e9eca9021c2023e0e7effb91
Python
5,704
165
#!/usr/bin/env python __doc__ = """ Training Script Put all the ugly things that change with every experiment here Nicholas Turner, 2017-8 """ import os, imp import collections import torch import tensorboardX import utils import train import loss def main(**args): #args should be the info you need to spec...
c8bc892adc1343c8e45f9857536f9391d4f6a2b62c3ece38058c705e62cea4a5
Python
5,707
215
import os import sys import yaml import torch import shutil import argparse import torch.nn as nn from tqdm import tqdm from operator import getitem from functools import reduce from torch.utils.data import DataLoader from utils.const import regression_loss def parse_config(): parser = argparse.ArgumentParser(...
0b004d94ecde88c0ed4ba47cb3bb645bf8d7bb20f9107cfbefecf5f9e0e046ba
Python
5,708
179
"""TSC Bake off 2017 catalogue.""" from sklearn.metrics import accuracy_score from sklearn.model_selection import ShuffleSplit from sktime.catalogues.base import BaseCatalogue class BakeOffCatalogue(BaseCatalogue): """TSC Bake-off 2017 catalogue. Catalogue of datasets, classifiers, metrics, and CV splitter...
aca427cb1e108ea01510f78be3ecef3dbbf605a7f05fb945b693adbd731434a8
Python
5,711
165
# 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...
42a7abbabe414aac83903d83aef6d2db7c863db37f4a0f24aacd05e50465d0be
Python
5,714
119
# simple 2D unet from the previous 2D unet # change the 2d conv into 2D conv # add instance norm inside; deeper the model from keras.models import Model from keras.layers import Input, Conv2D, MaxPooling2D, concatenate, Conv2DTranspose, BatchNormalization, Dropout, Lambda from tensorflow.keras.optimizers import Adam f...
78cfd74d4a9773b62254041a490634f2f8b99d97aaa549aabf051e345356fdf6
Python
5,715
179
import json import os import shutil from typing import Callable, List, Tuple import numpy as np import pandas as pd from rdkit.Chem import MolFromInchi, MolFromSmiles, MolToInchi, MolToSmiles from rdkit.Chem.Descriptors import MolWt from rdkit.Chem.MolStandardize.rdMolStandardize import Cleanup MW_THR = 800 MIN_P_DIF...
e346a76c6cfefead14d899a488a4c95911d725d038d8039686a9e2fb451caa19
Python
5,717
110
dbitseq_config = {'train_batch_size': 16, 'finetune_batch_size': 16, 'transfer_batch_size': None, 'train_epochs': 20, 'finetune_epochs': 10, 'transfer_epochs': None, 'train_task': 'cross_model_prediction_clus', 'finetune_task': 'unsupervised_group_identification', ...
69b55da9587124e9bfe896f194b8cffa6a6a2d68e9cc6e7aa45bdbbb04fd95f7
Python
5,720
168
"""Hidden Markov Model with Poisson emissions. Please see the original library (https://github.com/hmmlearn/hmmlearn/blob/main/lib/hmmlearn/hmm.py) """ from sktime.detection.hmm_learn import BaseHMMLearn __author__ = ["klam-data", "pyyim", "mgorlin"] __all__ = ["PoissonHMM"] class PoissonHMM(BaseHMMLearn): """...
93cd1def17853b4e3440ffc1042a9d9667e25514e82d1fd15c0e498a251c57f5
Python
5,724
129
import numpy as np import datetime from parameterSetup import ParameterSetup def linearFit(y): x = np.array([i for i, _ in enumerate(y)]) X = np.c_[x, np.ones(len(x))] beta = np.matmul(np.matmul(np.linalg.inv(np.matmul(X.transpose(), X)), X.transpose()), y) # z = np.matmul(beta, X.transpose()) retu...
47ebcb490966c8c9bd866fe127f4a6932dc3749e20737e1bbdc68d5e05d4c299
Python
5,726
157
""" Base classes for JetNet datasets. """ import torch from torch import Tensor from typing import List, Optional, Tuple, Any, Callable from .normalisations import NormaliseABC from .utils import checkStrToList, checkListNotEmpty, firstNotNoneElement class JetDataset(torch.utils.data.Dataset): """ Base cla...
ccca3d806462fa1f6b354754ed60ec1b4e2bf75b1aa34479cab4c1c1a4cee64c
Python
5,728
131
import sys import numpy as np import torch import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # Personal stuff to send an email once data collection is finished # sys.path.extend(['/home/will']) # fr...
a8740ca95913bdefb3d1d2dfde96adee26db461efa296d63febc888ab2594c0a
Python
5,729
149
import torch.nn as nn import torch from vp_suite.base import VPModelBlock class ConvLSTMCell(nn.Module): r""" This class implements a single ConvLSTM cell for the ConvLSTM implemented in https://github.com/ndrplz/ConvLSTM_pytorch. """ def __init__(self, input_dim, hidden_dim, kernel_size, bias): ...
4ac6bf9c44d8ad3a5677204a680e2613c8df58c80be60aed58d69bf827d0522b
Python
5,731
124
import numpy as np import tensorflow as tf # structure2vec # DE-MF : discriminative embedding using Mean Field # SAFE TEAM # # # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) # # class Network: def __init__(self, features_size, embedd...
7aaf08617132c7416c57085457ed5c387873444dcf8e115ca232021952f1a7de
Python
5,732
151
# SPDX-License-Identifier: LGPL-3.0-or-later """Register fake tensor implementations for deepmd custom tabulate ops. These registrations enable torch.export and make_fx to trace through the compressed forward path, which uses C++ custom ops (tabulate_fusion_se_*). Without fake implementations, torch.export cannot dete...
62f900002151b8c024b9699d820d5437a47718d315e2fcfb7e0bd86427ca9eaa
Python
5,736
173
# -*- coding: utf-8 -*- import torch import random import inspect from itertools import islice, repeat import os def split_corpus(path, shard_size, default=None): """yield a `list` containing `shard_size` line of `path`, or repeatly generate `default` if `path` is None. """ if path is not None: ...
22fae73370e0c990202b35d99e6bdb421c512b237b2b7a87d630173751c812e0
Python
5,740
166
"""Tests for source/odp_functions.py:check_species_input_legality. This is the biggest single function in odp_functions and validates the three input files for one species: genome FASTA, protein FASTA, and .chrom. Each file has multiple failure modes that produce a multi-line error message; we cover the happy path and...
62315688d9034b592ae4d59a7689cc905093468e2c4582cf8e9c86582b000241
Python
5,746
178
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch from mmcls.models.utils.attention import ShiftWindowMSA, WindowMSA def get_relative_position_index(window_size): """Method from original code of Swin-Transformer.""" coords_h = torch.arange(window_size[0]) coords_w = torch.ar...
3c9197b452e65a6ecb4d9ed6883a8ee903428b8e57e70c3b0c1d1a438d090125
Python
5,747
200
#!/usr/bin/env python from Bio import SeqIO import click from click_option_group import optgroup import json import numpy as np import os import pandas as pd import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.pardir)) sys.path.insert(0, os.path....
8623e42879c8ec31ebd13f564f2a60bc787c5d697f55ec17b25fbc3cf3ebeee0
Python
5,747
156
"""Find extrema for individual cycles.""" import numpy as np from neurodsp.filt import filter_signal from neurodsp.filt.fir import compute_filter_length from bycycle.utils.checks import check_param_range from bycycle.cyclepoints.zerox import find_flank_zerox #########################################################...
4f2e5a410d8d7eb66fd78915333fb034782dafad4799d338b8adbd4b46ef94a7
Python
5,750
206
import json import logging import os import random import sys from itertools import combinations from pathlib import Path from typing import Tuple import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader from transformers import HfArgumentParser # Local imports import training.pipel...
31b42fcadbb8ddd4ddf8bd9352f918747b8039dcbe92e86ec1c02b2df3456730
Python
5,751
130
""" Initialization of scCODA models. :authors: Johannes Ostner """ import numpy as np import patsy as pt from anndata import AnnData from sccoda.model import scCODA_model as dm from typing import Union, Optional class CompositionalAnalysis: """ Initializer class for scCODA models. This class is called when ...
726ea81909bd5f5f64ac9cd1bd05c436b5f7f8ca90183fe4a5bb2ac06fe4a377
Python
5,751
158
#------------------------------------------------------------------------------- # elftools: common/utils.py # # Miscellaneous utilities for elftools # # Eli Bendersky (eliben@gmail.com) # This code is in the public domain #------------------------------------------------------------------------------- from __future__ ...
b4eb7da3265eacf86514394ad697b95ca6dc4570ab38137ba02ae9bb9a281061
Python
5,753
126
from mprl.rl.common.util import set_policies_to_train_in_trainer # def get_ed_fixed_scheduler(best_response_iterations, equilibrium_policy_iterations, # trainable_tmp_policy_key, static_tmp_policy_key): # # def ed_fixed_scheduler(trainer, eval_data): # if 'is_training_best_respo...
f445008e15ce5d20462db6ddb6d95e8714325c8a03364b17aeb211a9965fbbc9
Python
5,753
170
# 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...
edf6b40232a7eb53f0b389d4a6c941f4071286a5b7b61b9e9195b0a90110c651
Python
5,754
131
# 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...
b1755923ac2f6b7f42258bd12f967e33baa9fe9c1b4c867c9ef08a74f8e79a30
Python
5,756
137
import torch import torch.nn as nn import torch.nn.functional as F import sys class EncoderDecoder(nn.Module): def __init__(self, in_seq_len, out_seq_len, in_feat_len, out_feat_len, static_feat_len, hidden_size, num_layers, enc_dropout, dec_dropout, arch, device): super().__init__() ...
33ea07f5999ff1b84407681ddd8e45d43fe91c032cf6a5d886b036fb7f122b43
Python
5,757
196
"""NIfTI orientation utilities: query, reorient, and swap axes.""" import os from pathlib import Path from typing import List, Optional, Tuple, Union import nibabel as nib from tqdm import tqdm from bcblib.imaging._types import NiftiLike from bcblib.imaging.io import load_nifti # ----------------------------------...
edc1849adc4792f30ed242562d884c88531f96c77c8d76b710b2763903d288a0
Python
5,757
148
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
0a20cbbb0a5b54c7da98f7cd8cdcf9b8c5d8ea26356b2622f0a7739f97bf78a6
Python
5,758
110
""" @file: preact_resnet_se.py Created on 01.05.21 @project: CrazyAra @author: queensgambit Descirption of a preactivation resnet with se layers """ import mxnet as mx from DeepCrazyhouse.src.domain.neural_net.architectures.builder_util_symbol import value_head, policy_head, get_se_layer def preact_residual_block(da...
3e4c22f7ab81994c3e431b46680a3f50a38106da489b56bf4a4da5edcca2b1d2
Python
5,758
160
import torch import torch.nn as nn from torch.utils import data import torch.nn.functional as F import pickle import numpy as np class RawDataset(data.Dataset): def __init__(self, dataset, window_size, train=True): self.dataset = dataset self.window_size = window_size self.train = train ...
c7b39d2946dd8e1f21f69e06c7be6a5654f22f94088e5e9f07a5ad38b1d6126f
Python
5,759
161
""" common.py -- Shared model, tilt dynamics, pass@k, sign-variation utilities. Paper 2: "Pass@k Can Cross Twice" (working title). Solvable model of RLVR as exponential tilting of a policy over strategies SHARED across prompts. All randomness goes through a seeded numpy Generator. Every script fixes its own seed so e...
013bb6d3fa366b6f555f74cfd13bbd1461fa298a948386e0a4b0addb90ebbdaa
Python
5,760
87
""" Data structures for model_run XM13 with nabu channels """ # nabu _vshift 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1] ChannelData = u""" This table describes the REFERENCE ion channel densities (and voltage shifts if necessary) for different cell types based on the Xie and ...
d2a50a9c1e845aac85d83b182a2930db0f9a74387beb47e91d4005d2ad467324
Python
5,760
110
""" @file: preact_resnet_se.py Created on 01.05.21 @project: CrazyAra @author: queensgambit Descirption of a preactivation resnet with se layers """ import mxnet as mx from DeepCrazyhouse.src.domain.neural_net.architectures.builder_util_symbol import value_head, policy_head, get_se_layer def preact_residual_block(da...
5042552f54798357fe0248d38f365b1f5355852ac643f362fe4b96c5db44a7d0
Python
5,765
128
import typing import torch import flair.embeddings import flair.nn from flair.data import Corpus, Sentence, TextPair, _iter_dataset class TextPairClassifier(flair.nn.DefaultClassifier[TextPair, TextPair]): """Text Pair Classification Model for tasks such as Recognizing Textual Entailment, build upon TextClassif...
7d10193528641d5942965cbaa60b56bf3c9ef9ad03247166f3ad251d746aa5c1
Python
5,769
199
"""librdf parser for rdflib""" __version__ = '0.0.1' try: import RDF except ImportError as e: print('WARNING: librdf bindings not found. You will have runtime errors.') import rdflib from pathlib import Path def Literal(string, language=None, datatype=None): datatype = datatype if datatype is None else ...
a314ccd11c349b838e42e4ccd95bcf5eb0b8b5751c68e0d644c422a7e80c139a
Python
5,773
111
import unittest import yaml import pandas as pd from hbip.predict import read_seqs def load_data(base_path, data_name): config_path = base_path + data_name + "_config.yml" with open(config_path, "r") as file: config = yaml.safe_load(file) data_path = config["path"] return pd.read_csv(data_p...
a5e8b947137ca3c34e3e689dfe13c9c7a0ce8f61eddde82edb508e7702189af3
Python
5,773
123
import requests import base64 import json import sys import os import pandas as pd from tqdm import tqdm import time SLEEP_DURATION = 5 # in seconds # cloud_function_url = 'https://jivjy5pgt3.execute-api.us-east-2.amazonaws.com/covid/oraquicktestpredict' # cloud_function_url = 'https://jivjy5pgt3.execute-api.us-east...
def4f262810c2760728846ef92aa331eff7be4079abe777273bd2337dc33699d
Python
5,774
179
"""Tests for KNeighborsTimeSeriesClassifier.""" import numpy as np import pandas as pd import pytest from sktime.alignment.dtw_python import AlignerDTW from sktime.classification.distance_based._time_series_neighbors import ( KNeighborsTimeSeriesClassifier, ) from sktime.datasets import load_unit_test from sktime...
8efd8e401777cdd45ca5c03111455c9ae56ca3be27498c89b28e0cfe6f82b5b3
Python
5,775
135
import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn.metrics import classification_report, roc_curve, roc_auc_score from hbip.preprocess import train_test wuhan = { "Accession": "YP_009724390", "Sequence": "MFVFLVLLPLVSSQCVNLTTRTQLPPAYTNSFTRGVYYPDKVFRSSVLHSTQDLFLPFFSNVTWFHA...
8b01289730ddb3565ee243ba46c32d9fb46df2c7f351da5a3a2d37696568e087
Python
5,780
188
from utils import * import pandas as pd import numpy as np import torch.utils.data import torch import pickle import h5py as h5 import os from model import * from torch.autograd import Variable import h5py import time #wandb.init() class Chip2HiCDataset(torch.utils.data.Dataset): def __init__(self, chipseq_path...
ae8e0e75f0a0b8cf7c64c2069fac7d764adb8373f3c9315fb0f9800a0bae6293
Python
5,782
149
"""Methods to extract protein interface labels pair.""" import click import numpy as np import pandas as pd import scipy.spatial as spa import atom3d.util.log as log logger = log.get_logger('neighbors') index_columns = \ ['ensemble', 'subunit', 'structure', 'model', 'chain', 'residue'] def neighbors_from_ense...
31f604e46f6dc87c53752fe894c946cb0408b8e1103bd8e5171b5d65b4758bd6
Python
5,783
159
import numpy as np from keras.optimizers import * import os import pandas as pd from scripts import models_util from scripts import training_util import scipy as sp # Global dictionaries initializer_dict = {'0': 'he_uniform', '1': 'lecun_uniform', '2': 'normal', '3': 'he_normal'} optimizer_dict = {'0': Nad...
dfb952675d1c100cc6a2b03c8f1749bcc700219be4948477568ef960fcfb38d0
Python
5,783
148
# 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...
644c2639a7ba2f214618b6afa984cad41294d0deb61590a461937fc3b2de1a6d
Python
5,784
200
#!/usr/bin/env python # coding: utf-8 #Code to generate the figure from the paper import pytest import numpy as np import matplotlib.pyplot as plt from scipy import optimize from scipy import sparse from time import time from fnnls.fnnls import fnnls class nnls_comparison(): def __init__(self): ret...
41ea25d318d71b2f028d51946c5e5cf49071b9f6a4b4a8f1fac59894160bd33a
Python
5,786
207
# 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...
886155f3b8df50ff1ad374ad4ae3027346314987e7174d5dbfe64821c66dc40c
Python
5,789
129
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 3 08:32:28 2020 @author: sam """ from detectron2.data import MetadataCatalog, DatasetCatalog from detectron2.utils.logger import setup_logger setup_logger() import os import numpy as np import cv2 import random import pandas as pd from tqdm impor...
a2743f4f9a2f78485a30f9cc8775bda7942ecc8eb9e19cb306535071ee3075bf
Python
5,793
173
# 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...
b9a87f8a72bc387622e35d198b09ada701a813fb3d73b4e5e04e770ee865f015
Python
5,793
184
import cv2 import matplotlib import numpy as np from matplotlib import pyplot as plt # * syn where to set this # must use 'Agg' to plot out onto image matplotlib.use('Agg') #### def fig2data(fig, dpi=180): """ Convert a Matplotlib figure to a 4D numpy array with RGBA channels and return it Args: ...
18ce8161e224008c9a2ec7a672794db76004e743c414653de0b2e783f425e28e
Python
5,795
68
r""" This module contains the Settings class, which contains constants; and pre-set program configurations, such as default run config parameters. """ import json from pathlib import Path from vp_suite.utils.utils import get_public_attrs, timed_input class _PackageSettings: r""" This class contains package c...
6c5ddce1c7f95acca58ac696380fa653e11467398d9f3b035355db491d261928
Python
5,802
220
# code in this file is adpated from # https://github.com/ildoonet/pytorch-randaugment/blob/master/RandAugment/augmentations.py # https://github.com/google-research/fixmatch/blob/master/third_party/auto_augment/augmentations.py # https://github.com/google-research/fixmatch/blob/master/libml/ctaugment.py import logging i...
989bd74be1dc93db7c492c0baf1f6a710b62c2c64fce9e06ebf336e6c1b19f6e
Python
5,807
125
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
0706a5a37f30e9380b6a81a15dd92ac6a1eb0900611cef063efac6628dd298fb
Python
5,810
156
''' optimise.py @author: Nicholas Browning ''' import numpy as np import matplotlib.pyplot as plt ''' general, gly, prepro, pro ''' import os import sys def get_script_path(): return os.path.dirname(os.path.realpath(sys.argv[0])) def loadold(): # 0 : GEN # 1 : GLY # 2 : PREPRO # 3 : PRO ...
481d345da3762c6d14e8b73f9125048fc3b03ffff34c574f257b6b6d97877e58
Python
5,814
168
"""UCR UEA Datasets.""" __author__ = ["jgyasu"] __all__ = ["UCRUEADataset"] from inspect import signature from sktime.datasets import load_UCR_UEA_dataset from sktime.datasets.classification._base import BaseClassificationDataset from sktime.datasets.classification.ucr_uea_archive._tags import DATASET_TAGS from skti...
48cae547fede2664212551946af25f7f6b4057fe36a84ba34865bf19c2d5c0ef
Python
5,814
115
""" @file: rl_training.py Created on 20.11.19 @project: CrazyAra @author: queensgambit Functionality for conducting a single NN update within the reinforcement learning loop """ import sys import glob import logging from pathlib import Path import torch sys.path.append("../../../") from DeepCrazyhouse.configs.train_...
015bbe4aa32409d2922833937d5df1823aac756c384ec87a5ccf96be2c4ba705
Python
5,816
157
""" Controller component of the MVC pattern for pciSeq diagnostics. This module implements the Controller layer, responsible for: 1. Coordinating between Model and View components 2. Managing dashboard lifecycle (start/stop) 3. Handling data flow from algorithm to diagnostics 4. System initialization and shutdown The...
81367dda74f4c81f259d048832e2994ea43d62b3e65b1ffb06ca745ed0e18ffb
Python
5,817
124
# -*- coding: utf-8 -*- # # Copyright © 2013 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://www.mozilla.org/MPL/2.0/. # """Interface with the `Bowtie2 <https://github....
714886bb7b7fae38ee5cbc60ca1d6c29af35239b9a31fe0864a653c903a81575
Python
5,818
169
import seaborn as sns import matplotlib.pyplot as plt import numpy as np import pandas as pd import os import argparse parser = argparse.ArgumentParser( 'Visualize the distribution of learned edges between residues.') parser.add_argument('--num-residues', type=int, default=77, help='Number of r...
7202a6d091b22a6d7e815ffbe6553b8afc136a8075b869037048359d0f246288
Python
5,818
150
import argparse import logging import os import time import datetime import matplotlib.pyplot as plt import numpy as np import seaborn as sns import pandas as pd import torch import torch.nn.functional as F from torch_geometric.data import DataLoader from model import GNN_SMP from data import GNNTransformSMP from atom...
ae0da30fdb8345344af30106968b13c8efd086022dbcc56c87ac8761f1610389
Python
5,820
175
# 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...
a520c67d9470e61840609066ffb8d7f02aca45bb1f203423b9a206df623b7723
Python
5,823
144
import sys import pickle import numpy as np import math from parameterSetup import ParameterSetup #-------------- # print in the format of a latex table params = ParameterSetup() pickledDir = params.pickledDir paramDir = params.pickledDir args = sys.argv if args[1] == 'test': datasetType = 'test' groupIDs = ...
39b757f5d9dfd6c62901a496a21b56545e87cf9284bee4ea6392cac09015745d
Python
5,824
191
#!/usr/bin/env python3 -u # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Utility class for plotting functionality.""" import numpy as np from skbase.utils.dependencies import _check_soft_dependencies from sktime.utils.validation.forecasting import check_X __all__ = [ "plot_time_series...
c2b9a61eaf2c5c76dbfea261896f1e40cb968637ab09df184a3ee72be75cd496
Python
5,824
147
import numpy as np import os import pickle # My Scripts from scripts import models_util from scripts import training_util from scripts import testing_util def concantenate_test_data(config, X, X_biofeat, y, DataHandler): if config.enzyme == 'multi_task': a=0 # TODO else: X = np....
899c591a13fdc66fbdb9aa66fb0efa8235edd40667008d33d820494c42bef60f
Python
5,827
110
dbitseq_config = {'train_batch_size': 16, 'finetune_batch_size': 16, 'transfer_batch_size': None, 'train_epochs': 20, 'finetune_epochs': 10, 'transfer_epochs': None, 'train_task': 'cross_model_prediction_clus', 'finetune_task': 'unsupervised_group_identification',...
4f10e5021203a74d03d23d33f5ad7e73f379cca8490d0ab7797339c01d399154
Python
5,832
114
# Copyright 2007 Zachary Pincus # This file is part of CellTool. # # CellTool is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. """Extract contours from images, optionally rescaling and resampling...
b6db213f4b83b5fd7af3c994640635037ca44f03f0db7a4f22ddabf5a9f90948
Python
5,834
194
#!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-3.0-or-later """Evaluate a charge-density model on validation/test datasets. Usage ----- python dptest_density_script.py model.pt /path/to/data --ratio 0.1 --output result.txt """ import argparse import glob import math import os import random import sys import ...
204e852292a70148a29f5c85a5d3d80134684009f130f893c4a62e6f81ed17e0
Python
5,835
137
""" Compare the simulation speed of the different backends William Nourse September 9 2021 The correct term is Babes, sir """ import numpy as np import torch import time import pickle from sns_toolbox.neurons import SpikingNeuron from sns_toolbox.connections import SpikingSynapse from sns_toolbox.networks import Netw...
0cc22caeee3f51930026e3ddc164e3cd6fdd8a19137f0b918e136b8c5fa94927
Python
5,836
142
# 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...
9846bee54a8aae9930e89abfc7f3981396adbee5b262d991044c6504f79af2e0
Python
5,840
200
#!/usr/bin/env python import click from click_option_group import optgroup import json import numpy as np import os import pandas as pd import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.pardir)) sys.path.insert(0, os.path.join(os.path.abspath(o...
ad172fd4f06be0c0d8b18006dee0840a33ee190f3bdd65e5dfc38a6c114eb21d
Python
5,840
155
""" Module for all things voxelwise and volumetric """ import sys import traceback import warnings import hiwenet import networkx as nx import nibabel import numpy as np from graynet import config_graynet as cfg from graynet.parcellate import get_atlas_path from graynet.utils import ( import_features, is_i...
46136daa5eb626a0582436076acac58ac60c16f04418a6b7c6e517810b099994
Python
5,841
128
"""Testing machine type converters for scitypes - convert_to utility.""" __author__ = ["fkiraly"] import pytest from sktime.datatypes._convert import convert_to from sktime.datatypes._examples import get_examples from sktime.tests.test_switch import run_test_module_changed from sktime.utils.deep_equals import deep_e...