sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2abf9787637e563d2b3f8070e8693d3a257684d3783a5b158826c0d09a7b873d
Python
4,200
114
import math from collections import defaultdict, deque from bidict import bidict def szudzik_pair(*numbers): if len(numbers) < 2: raise ValueError("Szudzik pairing function needs at least 2 numbers as input") elif any((n < 0) or (not isinstance(n, int)) for n in numbers): raise ValueError("Szu...
827cada04a126ec3e273d6a3bdd8d52ad692bc28bf40ed920e62e1f1de66945f
Python
4,200
114
import math from collections import defaultdict, deque from bidict import bidict def szudzik_pair(*numbers): if len(numbers) < 2: raise ValueError("Szudzik pairing function needs at least 2 numbers as input") elif any((n < 0) or (not isinstance(n, int)) for n in numbers): raise ValueError("Szu...
c684d3b9a301f9f9656412110a6f50d4a3549eb0c66f1ea46413446e93f6081e
Python
4,200
137
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/panoptic_hand2d.py' ] evaluation = dict(interval=10, metric=['PCKh', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( ...
4643718de0b74f796adacbbdf204428deb36f706616ae57ab135e1b68db9d55a
Python
4,202
122
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 23 12:29:15 2022 @author: baris """ import pickle import numpy as np import seaborn as sns import pandas as pd from phase_to_rate import grid_model from phase_to_rate.figure_functions import (_make_cmap, _precession_spikes, ...
8d25e51204645ef36d5f0c4455eabd6b0cf3ed170c7d94806a6ae4f78954577a
Python
4,206
111
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmdet.core import bbox2result from mmdet.models.builder import DETECTORS from ...core.utils import flip_tensor from .single_stage import SingleStageDetector @DETECTORS.register_module() class CenterNet(SingleStageDetector): """Implementation of Ce...
05627317bb7cd6c08e69bb1432fe462b4d0330f05cfb3562350692294995e7e0
Python
4,213
129
"""Maximum likelihood and Bayesian phylogenetic analysis. P4 is a phylogenetic toolkit that does Bayesian and maximum likelihood phylogenetic analyses of molecular sequences. It's specialty is that you can use heterogeneous models, where the model parameters can differ in different parts of the tree, or over differen...
c9ba9bc8af52fad2bd4a6ad939838e5359afcec0b5e615132f70d8a1ad6ad56f
Python
4,213
143
""" =============================================================================== :mod:`foolbox.criteria` =============================================================================== Criteria are used to define which inputs are adversarial. We provide common criteria for untargeted and targeted adversarial attack...
e298d63e5a0ed2971e3c47401e3d4a4e9f2b3fc2dd86fd0b7a708d1b943466aa
Python
4,216
122
import json import os import numpy as np import torch def read_data(train_data_dir, test_data_dir): '''parses data in given train and test data directories assumes: - the data in the input directories are .json files with keys 'users' and 'user_data' - the set of train set users is the same...
26b0fec38d5606658a123506feeeec87101f366ba23c553210404cf756fc7c35
Python
4,218
144
#!/usr/bin/env python # Copyright [1999-2017] EMBL-European Bioinformatics Institute # # 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 # # Unl...
496004d9d517bc3cd9cdcf8de3cea75a18018edd16217be594d268e110c48470
Python
4,220
126
# Copyright (c) OpenMMLab. All rights reserved. from queue import Full, Queue from threading import Thread from typing import List, Union import cv2 from ..node import Node from ..registry import NODES @NODES.register_module() class RecorderNode(Node): """Record the video frames into a local file. :class:`...
c09841420a25ccf24842fb6e824c44f2ec717e32cb6eb1667052e08130367aef
Python
4,220
137
# Copyright (C) 2024-2025 ETH Zurich, Niels Maeder and other DASH contributors. from pathlib import Path from typing import Any, Union import pytest from serenityff.charge.data import ( additional_data_dir, default_dash_tree_path, ) from serenityff.charge.tree.retrieve_data import ( DataPath, data_is...
84f35156436b3f1051c409db3e9d3c8284ba7e1d9ff09fdbadf25c63aa6bb174
Python
4,221
105
import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib import os import pyabf import seaborn as sns import shelve import sys from scipy.stats import zscore df_summary = pd.read_csv('/network/lustre/iss01/wyart/analyses/2pehaviour/MLR_analyses/data_summary_BH.csv') fishlabel, plane = ...
9196d22fef4bda889021aadb6d9b5c82d03bc78ad6c55d0af4e5743ac495c4c5
Python
4,221
140
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
cc57c508739ea43fdcfce2d38a15ed4b79ac449e75e6c8cd01d860ccc801a553
Python
4,221
111
# Copyright (c) OpenMMLab. All rights reserved. import torch from ..builder import BBOX_SAMPLERS from ..transforms import bbox2roi from .base_sampler import BaseSampler @BBOX_SAMPLERS.register_module() class OHEMSampler(BaseSampler): r"""Online Hard Example Mining Sampler described in `Training Region-based ...
597ca0740000f4136859bc70c05c5717017e599582fc8e7b79094a1994f448d7
Python
4,223
116
from django.db import models from django.contrib.postgres.fields import ArrayField import pathlib def get_figures_path(): current_dir = pathlib.Path(__file__).resolve(strict=True).parent figures = current_dir.parent.parent return str(figures) class Article(models.Model): doi = models.CharField(pri...
17eef0d8664afbf35229c01c4aefddebcf0b4b9417664cf2f4e37ab07fed9408
Python
4,225
89
####################################################################### # Software License Agreement (AGPL-3 License) # # OpenViBE SDK Test Software # Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015 # Copyright (C) Inria, 2015-2017,V1.0 # # This program is free software: you can redistribute it and/or modify #...
7ce69ee8be3ceac3b2f31cbf002362c13d3feccc9ddf2fd9d54c053d7ecf7b0d
Python
4,226
108
from collections import defaultdict import taxopy from genomad import utils def get_conservative_taxon(taxon, taxdb): for rank, taxid in taxon.ranked_taxid_lineage: if rank not in {"subfamily", "genus", "subgenus", "species"}: return taxopy.Taxon(taxid, taxdb) return taxon def write_ta...
561fe9e741fa291bb982f705f83b2d866d4150357b4a24a9035c6d95e3e18872
Python
4,229
144
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
7045959d4899d0699a16adbd5c8b8288924a2743fc9aaafb79f7ffddb7cea4a7
Python
4,229
137
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/panoptic_hand2d.py' ] evaluation = dict(interval=10, metric=['PCKh', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( ...
d717ad13486dc573463d142696db1ca5d1bb12cafc5a012c2dee472d97f36691
Python
4,229
144
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
0c43a4160fa038293ac5841f22f37c5f9e67c9f9c49651580ae33726fbc01d02
Python
4,230
114
import jax import jax.numpy as jnp from collections import namedtuple from functools import partial import data_utils from einshape import jax_einshape as einshape ''' the semantics of jax.lax.scan() are given roughly by: def scan(f, init, xs, length=None): if xs is None: xs = [None] * length carry = init ...
6c8b603b5f680ee03e4478367aac788a69d3f3147027d580e8e181b5122fb0c0
Python
4,239
138
import numpy as np import tensorflow as tf import random as python_random import os import tensorflow_datasets as tfds from tensorflow.keras.models import load_model from gradient_accumulator import GradientAccumulateOptimizer tf_version = int(tf.version.VERSION.split(".")[1]) def normalize_img(image, label): "...
ca734d1653111131e493028b0a03f75a9f9af963afd13e71ce100c259e6e0fd0
Python
4,239
113
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT from config_path import LOG_PAT...
29ee14c5d4c987c12ce1b8ebecfa3d8024209cd1ce5a1165ca3c9683236c4737
Python
4,240
103
import os import sys import logging import time import warnings import shap import pickle import numpy as np from metstab_shap.data import load_data from metstab_shap.config import parse_shap_config, utils_section from metstab_shap.utils import get_configs_and_model, find_and_load from metstab_shap.savingutils import...
2d4992e3b35e6c865cacac6c2332f783a141876caea3d354e3df4b035958b0c4
Python
4,241
140
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP', rle_score=True) optimizer = dict( type='Adam', lr=1e-3, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step...
a85e539c115d920cde135bfa15cdf7d3bb82062dde3f01c9a0604e411507413d
Python
4,241
90
""" Plot reconstruction errors after network training. Example (from terminal): $ python train.py --data mnist_extended_fast.npy --labels labels_mnist_extended.npy --trafos 0 0 0 --resultfolder fig7b_translation --epochs 20 --n_runs 4 $ python train.py --data mnist_extended_fast.npy --labels labels_mnist_exte...
011848467f136348646fc613c2ce1009bafd5032e324efce7cf151a8289cf9be
Python
4,243
140
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP', rle_score=True) optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step...
27f69ed09c15108bcae8e7271ad7d797375ac36bcced3481caf7bf58cbe9e1e4
Python
4,243
140
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP', rle_score=True) optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step...
eaf9397ffa8034756fd8bdd5ac6659734b561ded578be42434140ea246189efb
Python
4,243
140
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP', rle_score=True) optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step...
c06cdce5fdd843df2a23c8e5c038fb50c36f4f11e7e7ce685c55cab570fa9d39
Python
4,248
133
import numpy as np import random import os from matplotlib import pyplot as plt import prettytable as pt from sklearn.metrics import roc_curve, auc, f1_score def load_amp(dir): """ Load peptide sequences and labels from AMPXXX.txt :param dir: directory of AMPXXX.txt :return: ...
e8e973702dcfbda91e26f50bbef97b96b89d41b7ce444e7a413f85ff6aedf2df
Python
4,249
118
''' * Copyright (c) 2022, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause * By Junnan Li ''' import argparse import os import ruamel_yaml as yaml import numpy as np imp...
0b2580b5ada3d7be7c7369f3eee8168ca65e8e7ce01d8a21c6ba516c59cd6c40
Python
4,250
149
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 10 09:32:34 2020 @author: ravinderjit Reject trials with large p2p deflections Calculate system functions from EEG data for Dynamic Binaural Msequence project Also compute noise floors """ import matplotlib.pyplot as plt import matplotlib.colors a...
c9c9e0256657c98aa1e7719888c15c7b3d127e0e78d347a49e8fc060dd11205b
Python
4,251
138
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aic.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='li...
ea5102cacdcb0734107ec1f3cbb7256cf1d3e8fb101284d34fc7a8c1c74ff0dc
Python
4,252
124
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np import torch import torch.nn as nn from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def balanced_l1_loss(pred, target, beta=1.0,...
038c85a89fc214e2291a273b4e889550fed0e219debc795c7a14754639c9b19d
Python
4,253
138
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aic.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='li...
75b13389410f93afbfcf7dfc6d9e94c994b0c8eb7825c5160236b8677ef9691a
Python
4,253
138
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aic.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='li...
8990c081671017cfe21358b4e302f10e7f878d5cf0ebfffcb4e193def70ebab8
Python
4,253
142
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/posetrack18.py' ] load_from = 'https://download.openmmlab.com/mmpose/top_down/resnet/res50_coco_256x192-ec54d7f3_20200709.pth' # noqa: E501 checkpoint_config = dict(interval=1) evaluation = dict(interval=1, metric='mAP', save_best...
97854f0f642ede38f6c6869e9767c387014ba9e26dbc0caa86fa9d71a7010e0a
Python
4,253
138
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aic.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='li...
a2510bc6710fb6fd466c2ba8d58dfc6f76defc63322ba22cdd19681421b42e07
Python
4,253
138
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aic.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='li...
63d92d5958f03e7ca54d387cbea27c6a09dbb7d8d6ec48f5e921b819e3b92e66
Python
4,256
144
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/jhmdb.py' ] load_from = 'https://download.openmmlab.com/mmpose/top_down/cpm/cpm_mpii_368x368-116e62b8_20200822.pth' # noqa: E501 checkpoint_config = dict(interval=1) evaluation = dict(interval=1, metric=['PCK', 'tPCK'], save_best=...
aed42ab3415ecec0901b204d06f0f43c7f7bfc97938ba58dc5f33009626453f8
Python
4,256
144
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/jhmdb.py' ] load_from = 'https://download.openmmlab.com/mmpose/top_down/cpm/cpm_mpii_368x368-116e62b8_20200822.pth' # noqa: E501 checkpoint_config = dict(interval=1) evaluation = dict(interval=1, metric=['PCK', 'tPCK'], save_best=...
e6d20fc153c83793cdb85fd2cd134796b1747930a02976dd76bd16d5db0a20c2
Python
4,256
144
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/jhmdb.py' ] load_from = 'https://download.openmmlab.com/mmpose/top_down/cpm/cpm_mpii_368x368-116e62b8_20200822.pth' # noqa: E501 checkpoint_config = dict(interval=1) evaluation = dict(interval=1, metric=['PCK', 'tPCK'], save_best=...
a718eb45fb1447499304914afbf67a6d6895fcc44128164ed7744cffda015eef
Python
4,261
138
# Copyright (c) OpenMMLab. All rights reserved. import os import warnings from argparse import ArgumentParser import cv2 import mmcv import numpy as np from mmpose.apis import (inference_top_down_pose_model, init_pose_model, vis_pose_result) from mmpose.datasets import DatasetInfo def main(...
bb853548a11bde5eb4375df68898276120f84377895837cc3636a2c275bca5bf
Python
4,263
143
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
6cb5bcc14b517c9c177b099b5d1f25098110d65f1d6e87c10d0a45a0dc226c2c
Python
4,268
109
# -*- coding: utf-8 -*- """ Created on Wed Jul 7 16:23:37 2021 @author: fhu14 Testing file for playing around with the new repulsive model predicted_train_elec_only.p and predicted_validation_elec_only.p are pickle files that contain the Electronic energy targets predicted from trained models, 150 epochs with lj d...
5053faf3fcbeae850b1b02d347e2008b7cf7a2f20530e6bb7b71ce3fba988e87
Python
4,273
138
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/panoptic_hand2d.py' ] evaluation = dict(interval=10, metric=['PCKh', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( ...
b15591972f2c122d9f0d7a2d9e085984425a535fec04575b5456ea1a135dc615
Python
4,273
118
import os from os.path import join, basename import pandas as pd from config_path import TEST_RESULTS_PATH from os import listdir import numpy as np from utils.evaluate import evalualte def read_predictions(dirs_df,max_f1, _class= 0): model_dict={} for i, row in dirs_df.iterrows(): dir_ = row.file ...
bb6ccee45b4163188291d784e8d7c42ca09f06c3c62d0ae2b223fc334b213476
Python
4,275
156
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/mpi_inf_3dhp.py' ] evaluation = dict( interval=10, metric=['mpjpe', 'p-mpjpe', '3dpck', '3dauc'], save_best='MPJPE') # optimizer settings optimizer = dict( type='Adam', lr=1e-4, ) optimizer_config = dict(grad_c...
8cd4ed73c46173aee4afc75dada7eced64d72f2a74faeb1fa49e3d95e810a88a
Python
4,277
84
# ----------------------------------------------------------------------- # # Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. # # # # Software Name: Fast Autonomous Scanning Toolkit (FAST) # # By: Argonne Na...
8984597e43e51fee8b57b2e3d7cd35d876cbcccc65baf611c4fb3811c31bcd1c
Python
4,279
124
import numpy as np import scipy.io as sio from tensorflow.keras.utils import to_categorical from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from preprocess import preprocess_data def load_all_data(data_path): X_train, y_train = [], [] for s...
c59582e88046f19f6dc4af18b62b3e704c79645657251efe7429418ac1e32426
Python
4,280
131
import gzip import argparse import math import sys from argparse import ArgumentParser import tables import util def parse_options(): parser = ArgumentParser(description="""This script adjusts heterozygote probabilities in CHT files to account for possible genotyping errors. Total ...
47df16e259d3ed59918e650417a20c0752d8a6bb095e5247716254fc64d8f873
Python
4,281
118
# This file contains modules common to various models import math import torch import torch.nn as nn def autopad(k, p=None): # kernel, padding # Pad to 'same' if p is None: p = k // 2 if isinstance(k, int) else [x // 2 for x in k] # auto-pad return p def DWConv(c1, c2, k=1, s=1, act=True): ...
ab0e68c422e55321e240d5560dfafd7549960de929382c30acff10f1ae1fd2a5
Python
4,281
125
import numpy as np import scipy.io as sio from tensorflow.keras.utils import to_categorical from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from preprocess import preprocess_data def load_all_data(data_path): X_train, y_train = [], [] for s...
d410370c0b24a8a0829e04c6e29d6311335e098a2b3a3f4a8dc9f3ca6dbb5742
Python
4,283
124
from chromosome import Chromosome class CoordError(Exception): """An exception indicating that something is wrong with a coordinate""" def __init__(self, value): self.value = value def __str__(self): return str(self.value) class Coord(object): def __init__(self, chrom, start, end, s...
d3433dcff44866596fbbda8ee41f04a8d974137c3e9b4ae07a27f0682668e5bf
Python
4,287
115
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN...
d75919ebbd50c8d8ff43191b5c418eab7af9fbec5452dbbd242ff3fdc2d224b3
Python
4,288
137
import sys import subprocess import os DNA_COMP = None def comp(seq_str): """complements the provided DNA sequence and returns it""" global DNA_COMP if DNA_COMP is None: DNA_COMP = str.maketrans("ATCGMRWSYKNatcgmrwsykn", "TAGCKYWSRMNtagckywsrmn") return seq_s...
5b892b7bbb5a063769fb2e7c08255b6982bde6d416a36e2b0c24b2c677aa6d65
Python
4,292
108
# Copyright (c) OpenMMLab. All rights reserved. executor_cfg = dict( name='Gesture Recognition', camera_id=0, camera_max_fps=15, synchronous=False, buffer_sizes=dict(_input_=20, det_result=10), # Define nodes. # The configuration of a node usually includes: # 1. 'type': Node class name...
eae061a09b480436684dc473845d706853a36c59b54f34f766e313f8470cd745
Python
4,292
143
import torch import torch.nn as nn def compute_scale_and_shift(prediction, target, mask): # system matrix: A = [[a_00, a_01], [a_10, a_11]] a_00 = torch.sum(mask * prediction * prediction, (1, 2)) a_01 = torch.sum(mask * prediction, (1, 2)) a_11 = torch.sum(mask, (1, 2)) # right hand side: b = [b_...
cb7566eaf25f3ea6a706d47ec0ad5c1a8072aa6c610c5f63f410d68a34214e02
Python
4,295
105
from pydantic import BaseModel, ConfigDict, Field, PositiveInt, model_validator from typing_extensions import Self from oligo_designer_toolsuite.config._types import ( GCContentMaxT, GCContentMinT, GCContentOptT, TmMaxT, TmMinT, TmOptT, ) class IndependentSetSelection(BaseModel): model_co...
2845bea837d0434d1d5a4f6bba9efacd8de2611a3d06b27040955d39b83f2171
Python
4,297
105
# Copyright (c) OpenMMLab. All rights reserved. from collections import OrderedDict from mmcv.utils import print_log from mmdet.core import eval_map, eval_recalls from .builder import DATASETS from .xml_style import XMLDataset @DATASETS.register_module() class VOCDataset(XMLDataset): CLASSES = ('aeroplane', 'b...
60b853ab062d65e2ed2c55faba6a31f222910eaf4914c05dc81028ebaf436115
Python
4,298
115
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN...
9bfa8f7cbecb0875e90a9212a9e80d0b34901941bcb32fe1252c89f71063213d
Python
4,298
101
# -*- coding: utf-8 -*- """ Created on Wed Jun 16 15:32:47 2021 @author: fhu14 """ #%% Imports, definitions import numpy as np import matplotlib.pyplot as plt import os from MasterConstants import Model from InputLayer import Input_layer_pairwise_linear_joined, Input_layer_pairwise_linear import pickle #%% Code behin...
33ce64bf614b110cdd1f874b9f828dcb281335983ffb7a81716a58cfd21ad8b4
Python
4,301
147
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/mpii.py' ] evaluation = dict(interval=10, metric='PCKh', save_best='PCKh') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup...
977cc398162387dbfe2bc9569ff64929ead90799cc0c0829cc6e9923e88f30bd
Python
4,301
113
import os, sys, math, pickle import pandas as pd root = os.path.dirname(os.getcwd()) db_file = root + "/data/chembl/chembl_v31.csv" cpds = root + "/data/chembl/chembl_tautomers.csv" kinases = root + "/data/kinases.csv" db_header = ["kinase_name","hgnc_mgi","accession","kinase_group","chembl_id","standard_inchi_key","...
f7f09b15a24eae3eaaaf9ef3ee22c8ab44160a83c64336a57f6a501f2504d2e8
Python
4,301
147
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/mpii.py' ] evaluation = dict(interval=10, metric='PCKh', save_best='PCKh') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup...
c4c257bafe1a08f7011fb0539550da3116681df99ab24f98fca5aac0cee04910
Python
4,302
133
import numpy as np import h5py import importlib import stringcase from skimage.transform import resize from fedml_api.data_preprocessing.my_transforms.compose import Compose def init_transform(transforms, transforms_args): transform_instances = [] for module_name in transforms: transform = importlib.i...
e8577885177480e1072637b7ed476da856097e67dd41f68b704cdd41bc1113db
Python
4,302
101
# -*- coding: utf-8 -*- """ Created on Wed Jun 9 17:18:18 2021 @author: fhu14 TODO: Add more functionalities that you might want for manipulating datasets """ #%% Imports, definitions import os, re, pickle, random, math from functools import reduce #%% Code behind def randomize_existing_set(src_dir: str, dest_dir:...
55c1d9156695a91f10706cb86fbd5d5cd134cb58c971757a6bed7f8085cb5312
Python
4,303
96
import os import cv2 import numpy as np import scipy.io as scio from csutil import util from csutil.imgfeature import ImageFeature from csutil.coarsealign import AlignViaPro if __name__ == '__main__': # scale_factorreg = 12 root_dir = 'E:/Zhu/ETreg/newdata/HUA3/' TEMs_coarse_b_dir = root_dir + '/TEM...
9ef9fced3df5aa6003b62d0f34270291169fb75af7f4d99fe80fb37c5b88d128
Python
4,305
120
"""test_checks.py This file is part of the test suite for keras2c Implements tests for the checks run on the model before conversion """ #!/usr/bin/env python3 import unittest from tensorflow import keras from keras2c import keras2c_main import numpy as np __author__ = "Rory Conlin" __copyright__ = "Copyright 2020, ...
356ad4765ac1128d8f7a56b3eba3593adcefb3a98f03b2c6881e5c78b8f6dcc8
Python
4,306
120
"""test_layer_wrappers.py This file is part of the test suite for keras2c Implements tests for layer wrappers """ #!/usr/bin/env python3 import unittest import time from tensorflow.keras.models import Sequential, Model from tensorflow.keras.layers import ( Input, Dense, LSTM, Bidirectional, TimeDistributed, Conv1...
99877f4d8d835e051be0b11451f1ba7f7270b4e8b8a3762979f5d138a4759fa6
Python
4,314
131
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import mmcv import torch from mmcv.parallel import collate from mmcv.utils import build_from_cfg from mmdet.datasets.builder import PIPELINES from mmdet.models import build_detector def model_aug_test_template(cfg_file): # get config cfg ...
748f1f85249747f94cfa28d9a375e8f8759b2cb747e2d42a073970509811ebe1
Python
4,315
104
# -*- coding: utf-8 -*- """ Created on Sun May 29 12:58:27 2022 @author: fhu14 A master dataset is generated as a list of molecule dictionaries containing the energy targets for both coupled-cluster (cc) and DFT (wt). The max_config parameter is set to int(10E6) to ensure that we get all possible configurations from...
8185d3b6e34b2d2c7d5342999b6fdd1c7425d7fdfa7e6ef392aac56d3e55f7a8
Python
4,320
119
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> import warnings import pytest import torch from torch import eye, zeros from torch.distributions import MultivariateNormal from sbi.inference import BNR...
9787b65b368e5ce33c79c232d983632669024cb0b3cf661f886357e298dbb5ad
Python
4,324
73
""" Functions to load data and labels as well as to add noise to them. """ import torch import numpy as np def load_data(dataset, n_instances_per_class_train, trafos, labels_filename, device): """Get (visual) input data and labels, split into training and validation. Only mnist_extended and mnist_extended_fa...
77dfda696092c20bc13779ea5cf54c6a4693ee362c2fbd6c8019a429c0043067
Python
4,325
73
import argparse from itertools import chain, repeat # import itertools import multiprocessing as mp import os import torch from typing import Any, List from selbstaufsicht import datasets from selbstaufsicht.models.self_supervised.msa.transforms import MSATokenize from selbstaufsicht.models.self_supervised.msa.diversi...
e574284223c437f7210900eb6237113397f2ea83d6348648d6f415ebca50ec16
Python
4,326
129
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
f40c522dbe6dbf4796deb8ec7121acf0185b8c0f3ce8a0356eac12868fecdabe
Python
4,332
155
from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass from enum import IntEnum from typing import Dict import numpy as np import numpy.typing as npt from pydapsys.toc.display import DisplayProperties from pydapsys.toc.exceptions import ToCNoSuchChildError, ToCPathEr...
0bf8584f9da6ca484a427dc47ba137a0471851bb16d89ad52a772a26e8f2c774
Python
4,334
133
# coding=utf-8 from typing import Callable, Union from torch_geometric.typing import OptPairTensor, Adj, OptTensor, Size import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from torch_sparse import SparseTensor, matmul from torch_geometric.nn.conv import MessagePassing from .co...
24bd067ffebf2eb637f0fac01a191ca4ef95b46a633454223f10dddcfb7fcec4
Python
4,339
120
#!/usr/bin/env python3 from flystim.stim_server import launch_stim_server from flystim.screen import Screen, SubScreen from flystim.trajectory import Trajectory import numpy as np from flystim.draw import draw_screens import flyrpc.multicall from time import sleep """ Demonstrates: 1) subscreens with different screen...
f0e17e479cfe7e3c79f9ed203d4643080b2d2ab9179d4763cc5183cb91537263
Python
4,339
116
#!usr/bin/env python #coding:utf-8 """ @author: Haidong Zhang @contact: haidong_zhang14@yahoo.com @time: 2020/12/10 22:12 @project: MalariaDetection @description: """ import tensorflow as tf import os from tensorflow.python.keras.layers import Layer from tensorflow.python.keras import backend as K cla...
f74fe53ebbd4544ee56f80bb31a572d9dc2b688f65d87c20b527ceac2aaa7995
Python
4,340
123
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from ..builder import LOSSES from .utils import weight_reduce_loss def dice_loss(pred, target, weight=None, eps=1e-3, reduction='mean', avg_factor=None): """Cal...
c2da238b857cb899b0345a2d70d44dce9bf1155c13706a697a09c146e233efa1
Python
4,342
147
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) from pytest import mark from glob import glob from os.path import dirname, join import lightning as pl from torchmdnet ...
b50cb2df6db32e6d449ca9c8ec419318cea3927fb8030b2dc62c48b1f158cee6
Python
4,350
111
""" Functions for RDM computation. Example: compute_rdm(y2_reps_train, train_data_original_format.cpu().numpy().shape, results_path) """ import torch import matplotlib.pyplot as plt import numpy as np def distance(vec_a, vec_b): """Computes the cosine distance between two vectors. Args: vec_a (...
14d2b9493a8569e6ced5fb8855811c8b731fe927cd9d569c8eeb8bef5775557b
Python
4,352
146
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
44d0f6804819165dc289139687c788421e18333ae3029aa9d0e9e87d82b614e3
Python
4,352
146
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
f18e9e82844ed8c4dc26e00c3c2f0b7c278ac8ea8427c4fab7331939bf69829d
Python
4,352
96
import torch import torch.nn as nn from layers.Embed import DataEmbedding_wo_pos from layers.AutoCorrelation import AutoCorrelation, AutoCorrelationLayer from layers.Autoformer_EncDec import Encoder, Decoder, EncoderLayer, DecoderLayer, my_Layernorm, series_decomp class Model(nn.Module): """ Autoformer is the...
3b54b72113cf34c985a3ae0fea2546b4620224a3315a8f870b68c8cdb57bbc81
Python
4,354
108
import unittest import warnings import yaml from .._yaml_constructors import MetadataInfo class YamlConstructorTests(unittest.TestCase): """ YAML Constructors are used to handle the custom YAML tags defined by the framework. """ def test_unknown_tag(self): """ Makes explicit the ...
ba82f7cb7338957f68afd811d927c1df7327e9f678df4fb41cc7ce673df247a4
Python
4,359
109
import utils as imutil import pyodbc import MySQLdb import logging #SQL db setting dsn = 'sqlserverdatasource' user = '' password = '' database = '' def get_db_connection(): con_string = 'DSN=%s;UID=%s;PWD=%s;DATABASE=%s;' % (dsn, user, password, database) cnxn = pyodbc.connect(con_string) cursor = cnxn...
2a8ce5a976561dc96b5f9fb208d114675325be55658ce25cb67e2aa2d9ed9eac
Python
4,360
120
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_...
eb526a08c7e314e5e0ddc2c4c2292a04eb5049743111dcad4ee155058797ccd6
Python
4,362
146
import os import sys import numpy as np import h5py import scipy.io as spio import nibabel as nib import torch import torchvision import torchvision.models as tvmodels import torchvision.transforms as transforms from torch.utils.data import DataLoader, Dataset import torchvision.transforms as T from PIL import Image i...
2dada2c30d7ee264a3757627ae8c10463e4d8f88c0f3d9c9962a09dd42eeba21
Python
4,365
179
# -*- coding: utf-8 -*- #File Name : openvibe.py #Created By : Aurelien Van Langhenhove from StimulationsCodes import * import sys, traceback, collections from io import StringIO class NewStd(StringIO): def __init__(self): StringIO.__init__(self) def flush(self): self.truncate(0) self.seek(0) def isempty(sel...
fdcf8dd52f872d0929929c00805b28dd50e65b08456dc068b315cab36b6ffd24
Python
4,365
124
import glob import os import pathlib import random import re import subprocess as sp from copy import deepcopy import numpy as np import torch from Bio import AlignIO, SeqIO from Bio.PDB.Atom import Atom from Bio.PDB.PDBParser import PDBParser from Bio.PDB.Residue import Residue from torch.utils.data import Dataset f...
0b83eafb0bfec04357b7850137c8b08b047ba41c7c01932c26147b3855481810
Python
4,368
116
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN...
6cfe145821f326249e1dee7602b81a9858d6427d545a0cc776b6933be2790928
Python
4,368
161
"""io_parsing.py This file is part of keras2c Copyright 2020 Rory Conlin Licensed under MIT License https://github.com/f0uriest/keras2c Helper functions to get input and output names for each layer etc. """ __author__ = "Rory Conlin" __copyright__ = "Copyright 2020, Rory Conlin" __license__ = "MIT" __maintainer__ = "...
2089b645cae19ddb6dd2c1875073fb8487f2769af1fe5233ead26b66ab8a54cb
Python
4,369
116
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN...
4a2df593d9bf0394547e6aaa99f0f127ea8efd179c83cd2c10af2949a19976d5
Python
4,369
116
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN...
a8200265660640d79113dd7aac06c7b98da3407b688d138499622a6ac8acfd2c
Python
4,369
116
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN...
fb734d4e0d27307f965e6eb8724324fa3719cbbbb621516c583a47b344dd2808
Python
4,369
137
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 4 10:15:39 2021 @author: baris """ from neural_coding import load_spikes, rate_n_phase import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns trajectories = [75, 74.5, 74, 73.5, 73, 72.5, 72, ...
bb64e86d6e0c8716c095294bd09bfa1145029b5a0d3947fbe2b0cbf5eed894db
Python
4,371
96
#For generate labkit subregions #first open a python.exe, call imaris with a self-defined ID #import subprocess #subprocess.call(['C:\\Program Files\\Bitplane\\Imaris 9.9.0\\Imaris.exe', 'id101']) import ImarisLib import numpy as np import math as m import random import nrrd filename = r"R:\22.gaj.49\200826-...
d2c879cbb28002429eae036431b93adac701c90676468f61ec9f43a192e2a429
Python
4,375
69
"""Rebuild the release tree from interface2 and fireflies at the commits in pins.tsv. python3 provenance/build_tree.py <interface2 clone> <fireflies clone> Each stage folder is self-contained: files come from that stage's pinned commit, found by following .m names from its entry points (closure.py) plus the stage's...