sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3434772401e31969e3712803b2c8b0fe5d6e30568e9c8ba8f1fc7d899f300077
Python
11,194
218
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
b0998dc57b3de203b993d51816e435d01a732ee6929226830f7b35b218c0a62f
Python
11,197
259
"""Contract tests for `nltools.models._Glm` (development/specs/glm.md). `_Glm` is a numerical estimator over a precomputed `DesignMatrix` and a one- or two-dimensional response. It delegates fitting to nilearn's `run_glm` and contrast inference to nilearn's `Contrast`, so the numerical references here are direct nilea...
c9c789bf48a84f744d93991b9e4cf3290ae188def4ca33477176340025a11e0e
Python
11,197
218
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
53cff4fbcf12e407f4717b93ecc420f080a77da5be27ad7d413802dd3b2a9f8f
Python
11,198
218
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
a0f004cec4e780c693cd7eb8dfaef2a27a812c4151f1c92cd97c0906fe472e4c
Python
11,198
303
"""Provides a child class ConvNet of torch.nn.module to allow the construction of a convolutional neural network as well as a function to load a network and to initialize values of a tensor """ import os import torch import torch.nn as nn from matplotlib import pylab as plt from sklearn.metrics import balanced...
32bcdb1a58495cdac36a6eb90af5371996d76c2808c44bea426feba7f8fd1708
Python
11,206
218
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
b15a1aa3008b589c3a690793a72ffd260d78cbea579b9bd7e81cc0d3ad40807c
Python
11,206
219
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
b980753c23db7bb6509ef31616c615936eaef47f9ad90de0924eddf1c3d56ad3
Python
11,207
344
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # Multivariate classification — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.24.0" app = marimo.App(widt...
62951637e29c320112d9470f17e57e750b42f475f92c13c59425fb1719e874a6
Python
11,213
392
import numpy as np import matplotlib.pyplot as plt from scipy import signal as sig import scipy.spatial.distance as dst import csv # Data processing functions def my_FR(spikes: np.ndarray, duration: float, window_size: float, overlap: float) -> (np.ndarray, np.ndarray): """ ...
7377389cb60216d77c07f2693f89e29e3a0bfedbe9a9b307155e43d0dd7cb4d9
Python
11,213
219
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
558332e6bf4cb79381bda324bf76c2b8d4c412cda8f122780743871f2761d787
Python
11,225
264
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.model_selection import StratifiedKFold import torch from torch.utils.data import DataLoader,TensorDataset from modelClasses import * from utilityFunctions import * from sklearn.metrics import confusion_matrix,classification_report,pre...
f1e89a4d952a0658f9bc9b6fc41be5ce694460ccf04b2680de81cbe31a127eef
Python
11,234
361
from __future__ import print_function import copy import pprint import torch import numpy as np import matplotlib.pyplot as plt import utils import analysis_utils from dataset_learning_trainable import DatasetLearningTrainable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from to...
e5596b0ece6fd8f1f1b2e23ac0a2fb818549b377e141765ea74426e5dca226d2
Python
11,235
292
"""One-sample permutation test (sign flipping). Tests whether a mean differs from zero by randomly flipping the sign of each observation — the permutation analogue of a one-sample t-test. Permutations run on joblib workers; `n_jobs` sets how many, and a given `random_state` gives the same result at any worker count. "...
c892c0915d85c96efa35a909dbeeae36c0b2dd34cf2a1b038f4259aac2e51213
Python
11,240
278
# Copyright (c) 2021 PaddlePaddle 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 appli...
5157bd6a0e1ba51ec35bf89be59f1efed40f2a7c9bf81ba01d5a03904928c669
Python
11,241
382
''' Create CNN based on ResNet-50 to generate flatten representation of the 2D feature matrix ''' import numpy as np import pandas as pd from pyparsing import And import os from tensorflow.keras import activations, Input from tensorflow.keras.optimizers import Adam from tensorflow.keras.models import Model, load_model...
afce264453df54b85514a0f309dc4ea8a72a5c17decf868e0785006f48ced83b
Python
11,241
316
# system # sci import numpy as np # ephys # plotting # own import sssort.functions as sf from sssort import sssio def calc_update_final_frates(SpikeInfo, unit_column, kernel_fast): """calculate all firing rates for all units, based on unit_column. This is for after units have been identified as 'A' or '...
ed520513e391ef5818ad22ba2ec52d1390faacdfb43f4c81413e956712d54223
Python
11,245
332
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # Multivariate Pattern Analysis — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.23.9" app = marimo.App(wid...
8031b864f9cf38cb3dff5bf1b8350c765d0c8231810b7d039ff576cbb550e9b5
Python
11,253
317
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. """AtomicDataDict A "static class" (set of functions) operating on `Dict[str, torch.Tensor]`, aliased here as `AtomicDataDict.Type`. By avoiding a custom object wrapping this simple type we avoid unne...
05c91bc24fa7b82c1899578b39af6108a1f3f47b949cf314c71787cfbe38ecc2
Python
11,256
300
import torch from torch import nn from torch.nn import Linear, Embedding from torch_geometric.nn.inits import glorot_orthogonal from torch_geometric.nn import radius_graph from torch_scatter import scatter import torch.nn.functional as F from math import sqrt from .geometric_computing import xyztodat from .features im...
97af5b1178acf2be02fd65cd405c31f06f40dd4055c2e5d5ab9ef7b2d843f7a8
Python
11,258
288
import pytest import geomstats.backend as gs from geomstats.test.vectorization import generate_vectorization_data from geomstats.test_cases.geometry.manifold import ManifoldTestCase from geomstats.test_cases.geometry.mixins import GroupExpTestCaseMixins from geomstats.vectorization import repeat_point class _LieGrou...
9b68fd47243088700025777201a533833bf220c92a4c7ec11677518621bace0a
Python
11,260
352
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair from copy import deepcopy from typing import Union, Sequence, Optional, Tuple, Dict, Iterable import bindsnet.network.nodes as nodes import bindsnet.network.topology as topology from bindsn...
afb462debb8e7ceca2601d56fdd6852b4e93f5e47463f6442642b82d64015a1b
Python
11,263
247
"""Trains a model on a dataset and generates predictions at the end of the training. This script supports running on a list of datasets and models. For each dataset and model: 1. The dataset is loaded and split into train, validation, and test sets according to the desired configuration in the dataset_configs list. S...
12bed89bb13f065185a77c83f2827660c53f98e499be78959a4242c3de742f6b
Python
11,264
218
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
20d3f6ce5d3e135a528ec24279d0718b9c761111d27044fa88ba77bfe27ea59c
Python
11,267
218
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
3a6eb5d9f6da8e7cc0b8ec501fdf94a3104a4bc49acf5181c48ab5ca7f8819a9
Python
11,276
218
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
8e41950fc714edb8adfd5ced490092bfac89f33476e34a7373fea9b270cde40f
Python
11,280
321
import matplotlib.pyplot as plt import numpy as np import csv def load2(filename): sim = [] col = [] num = [] mes = [] with open(filename, newline='') as csvfile: reader = csv.reader(csvfile, delimiter=',') for i, row in enumerate(reader): if i>0: sim.app...
69aa903e78011a059a41d224c3483d2e16526b128d82d600685f53baa62e70af
Python
11,287
293
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # GLM Analysis — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.23.9" app = marimo.App(width="medium") @a...
58144efdde42b031477682ecb0830667afbfcabec811831370b37a56c1422684
Python
11,292
165
import numpy as np from .SharedTrees import cstr, get_fmt, Description, get_data_kind, get_recording_mode, AmplifierState_v9, UserParamDescrType, LockInParams_v9 class TraceRecord(Description): def __init__(self, n=1): super(TraceRecord, self).__init__(n) self.description = [ ("TrMar...
a7bc8424206ca2f9b903ac4e3c6af4bf61a8dc6fbb2147ebff4f9ac6ef82098d
Python
11,301
252
######################################################################### # SlumberNet: Sleep Stage Classification using Residual Neural Networks # ######################################################################### # This Python script implements SlumberNet, a deep learning model for classifying # sleep stages ...
8e87dce01fa07118e91e99fc86af6ead97756812c43e8a6686ddd2c7300c314c
Python
11,312
205
"""Which alleles can present each epitope VDJdb records. Issue #372. **This does not second-guess the allele a publication reported.** The restriction on a record is the author's finding and the authority for it is the paper. What a presentation predictor adds is the *other* alleles: given a donor's HLA type, which of...
f885a6a38fc7bf7be0e60f7171af25af039f03d76f5c49a8d00f37e453b9bc7a
Python
11,324
351
# -*- coding: utf-8 -*- # # nltools documentation build configuration file, created by # sphinx-quickstart on Thu Jun 4 07:22:28 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
148989cc397ccf4caa1ee86ad1d5bdb4fb155209c03417425058b0a85107d2cc
Python
11,330
280
import contextlib import numpy as np import torch import torch.nn as nn from einops.layers.torch import Rearrange from model_angelo.gnn.backbone_frame_net import BackboneFrameNet from model_angelo.gnn.cryo_attention import CryoAttention from model_angelo.gnn.gnn_output import GNNOutput from model_angelo.gnn.sequence_...
c05a1cfce998d8b141bd95e78c16c12bfa666cc6080cae27b923f3b5e68c0cff
Python
11,332
357
"""Statistical Manifold of geometric distributions with the Fisher metric. Lead author: Tra My Nguyen. """ from scipy.stats import geom import geomstats.backend as gs from geomstats.geometry.base import VectorSpaceOpenSet from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.riemannian_metric im...
59da62e4521d9a9338aa5255952fa2c15df484767e1393f572f83563714f7bdc
Python
11,340
216
import os import torch import hydra from tqdm import tqdm from omegaconf import OmegaConf from sklearn.metrics import roc_auc_score from benchmarks.xgraph.gnnNets import get_gnnNets from benchmarks.xgraph.dataset import get_dataset, get_dataloader, SynGraphDataset from benchmarks.xgraph.utils import check_dir, fix_ran...
5422fbeca75e3786883a4aa84d05a91c15dc2faa7b638a966ecdae0de6a32217
Python
11,347
219
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
1632edad5c0128e9f6c575358272311e2cd9b53039b638314409ea5549d2d958
Python
11,350
314
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import copy import logging import os from typing import Any, Dict, Iterator, List import torch from...
a4d3b60fe7a1961ebe32ee5a76c3e5bb42a07272dab570157548440f4475f381
Python
11,356
348
""" For Fig 2B go to: Z:\people\gritti\IRIR\supFig2_3 """ import os, glob import matplotlib.pyplot as plt from matplotlib import rc import pandas as pd import seaborn as sns import numpy as np from scipy.stats import binomtest plt.rcParams.update({'font.size': 15}) rc('font', size=8) rc('font', family='Arial') # pl...
00069873c4e1749c205b8d46d6706e9edb4d45aa5117dd9b7ae1c59dcecca669
Python
11,359
293
# Copyright (c) 2021 PaddlePaddle 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 appli...
2ff7181c2ff0845b275cd80041aa97cf97791887a27ad7581d84afd8f4e0c59f
Python
11,359
297
from PymoNNto.Exploration.Evolution.Devices.Evolution_Device_Single_Thread import * from PymoNNto.Exploration.Evolution.Devices.Evolution_Device_SSH import * from PymoNNto.Exploration.Evolution.Breed_And_Selection_Module import * from PymoNNto.Exploration.Evolution.Single_Evolution_UI import * from PymoNNto.Exploration...
8d93763c5891f2a30b1271b8f9e005be75582c16bd8f607e28ba2c04ceb21568
Python
11,360
318
import os aff = os.sched_getaffinity(0) print( "**********************before import torch******************************" + str(aff) ) import torch print( "**********************after import torch******************************" + str(os.sched_getaffinity(0)) ) os.sched_setaffinity(0, aff) from DeepPurpose...
9ab0bb3ccb4ed15fc94578593adefa5de71e22a653843ffd5b85e1669b09f4e5
Python
11,363
310
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from scipy.signal import firwin import tensorflow as tf def apply_fir_filter_tf(signal, kernel): """For single signal, not batch""" signal = tf.reshape(signal, shape=[1, 1, -1, 1]) ...
efba79028aa180fed1b87df9b60617039a5345112c0bbd8b71027b832bf3ca2d
Python
11,373
370
''' @Description: @Author: voicebeer @Date: 2020-07-03 00:53:27 LastEditors: Please set LastEditors LastEditTime: 2020-09-08 08:42:42 ''' # for SEED data loading import copy import os import scipy.io as scio # standard package import numpy as np import random random.seed(0) # temporary # normalization function de...
f8193bcb83106dc97cef7aeb6c2b31bbe7427c022a8fe81324c9f6fd17576fa4
Python
11,373
345
# Copyright (c) 2020 PaddlePaddle 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 appli...
9e2791e7f67be8b1f285759459845dea89d333488aa31438816cb82ba780e9c4
Python
11,384
289
import logging import os import sys import time from contextlib import contextmanager from typing import Dict, Tuple import numpy as np import torch from ase.data import chemical_symbols from e3nn.util.jit import compile_mode try: from lammps.mliap.mliap_unified_abc import MLIAPUnified except ImportError: cl...
1c5783bb15597b1176bae298c6b910bd3ce8fc350e8879becca4bc6f80549b08
Python
11,386
283
import pytest import tempfile import subprocess import hydra import math import torch from omegaconf import OmegaConf, open_dict from nequip.utils.unittests.utils import _training_session, _check_and_print try: import schedulefree # noqa: F401 _SCHEDULEFREE_INSTALLED = True except ImportError: _SCHEDUL...
dfa7624731951f223fe5a11f362f0960cbc7860f69d036f684f5754045cd0e2e
Python
11,387
358
import ast from argparse import ArgumentParser, ArgumentTypeError, _ArgumentGroup from collections.abc import Callable from pathlib import Path from idtrackerai import Session, __version__, conf from idtrackerai.utils import resolve_path def Bool(value: str) -> bool: """Argument type for booleans, accepts true/t...
f470bd850a936aee05799d6a43adeb57142bd09db67b894cd22a52ab87c0b0e0
Python
11,391
352
""" ModelAngelo evaluate model residue per residue Compare a predicted model with a ground truth model. You need: 1) A predicted mmCIF file, passed to --predicted-structure/--p/-p 2) A target mmCIF file, passed to --target-structure/--t/-t 3) Output file, passed to --output-file/--o/-o or 1) An input data file """ imp...
d0c51936a7f9e8504f1973f054b68ad50751173f114fdb5cb3dc54d68979a180
Python
11,396
301
""" Test suite for BrainData.plot() method. Tests follow TDD approach: write tests first, then implement functionality. Focuses on plotting functionality, brain-space integration, and user-friendly defaults. """ import pytest import numpy as np from nltools.data import BrainData class TestBrainDataPlotting: """...
2b186ad924f8d95605a1c345229ca9f6b244992083bd4def8b263677acc65e12
Python
11,403
323
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """AggregatorGRPCClient module.""" import time from logging import getLogger from typing import Optional, Tuple import grpc from openfl.experimental.workflow.protocols import aggregator_pb2, aggregator_pb2_grpc from openfl.experimental.w...
766655e1016162a459e55c714c251f48d4a5b58f826d8e8d4a944ef8d993e422
Python
11,403
224
import tensorflow as tf import numpy as np from variational.layers import DenseReparameterisation from variational.activations import sigmoid_moments class VariationalAttentionGlobalPooling(tf.keras.layers.Layer): def __init__(self, number_of_heads, number_of_features, ...
ddf07c6125033085a8ebaaf03484c898559390325504da4c440e174497486283
Python
11,411
216
# %% import sys import os import random import time import glob import numpy as np import math import h5py from scipy.io import savemat, loadmat import multiprocessing as mp sys.path.insert(1, '../..') # the path containing "suns" folder os.environ['KERAS_BACKEND'] = 'tensorflow' # os.environ['CUDA_VISIBLE_DEVICES'] =...
b24b715bc5931ab1bbc76638718aba1e22cdf5d3dbb5564459621e1c7620e30f
Python
11,415
292
""" Dispatch management for different machines (clusters, local, ...) """ import copy import logging import os import re import shutil import subprocess from pathlib import Path from ruamel import yaml from deeperwin.configuration import Configuration, to_prettified_yaml from deeperwin.run_tools.available_gpus import ...
18c4fc5617791166f1d2436872341ddbdfcec5c718c4212fca05a22d30030423
Python
11,421
294
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" import os import nibabel as nib import numpy as np import numpy.ma as ma def parse_segments(seg, msk_modes): """Parse the label segments. Each channel cor...
557f90a4ad281b1e1f282342b01055d79f2ad6ed9b7fd21169b4d8867fc04d86
Python
11,426
206
"""Motif inference: which CDR3s recur against an epitope more than the repertoire explains. Two methods, run side by side and shipped as two pairs of files. **TCRNET** asks whether a clonotype has more one-substitution neighbours than a matched background repertoire accounts for, then clusters what survives on the Ha...
2b4d4a3b67de0bd60341e84860b7c43d414a815135bdbe7cf3d0a2c79c9a7acd
Python
11,428
265
# Copyright (c) 2021 PaddlePaddle 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 appli...
6fe1346b012f785fc03ecf6636de0e5716c62a7fc77e526fbda54dc4fccab30c
Python
11,430
297
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """UnbalancedFederatedDataset module.""" from abc import abstractmethod from typing import List import numpy as np from tqdm import trange from openfl.utilities.data_splitters.data_splitter import DataSplitter def get_label_count(label...
5cc244f94da1940d364d2e76878f2b7490955829d4175a4a2fef09d7c21e5f76
Python
11,433
294
"""Tests for nltools.algorithms.alignment.procrustes — data alignment and Procrustes.""" import nibabel as nib import numpy as np import pytest from nltools.algorithms.alignment.procrustes import ( align, procrustes, procrustes_distance, align_states, ) from nltools.data import BrainData from nltools....
f68dba57b2e4422125d483ca2bfdd8fe7eac50b2944fef4584d83b640c4cdb95
Python
11,435
300
"""Advance notice for the surfaces MACE v1.0 removes or replaces. MACE v1.0 is a rewrite. Its feature inventory carries a KEEP / MERGE / DROP disposition for every enumerable surface of this package, and the non-KEEP rows of it are reproduced in :mod:`mace.tools.deprecation_table`. This module turns those rows into wa...
3a4e68b67e50fc30703acf3844d1a2504ae1619ecbfbfb55be62554031d34fdf
Python
11,441
281
#!/usr/bin/env python3 # # Copyright 2017 Martin Heusel # # 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 la...
1dad081fb7895ef0e47afa697be239b9e409e26edd8fe41838ef60dffdbc3983
Python
11,442
269
''' Module focused on the implementation of VGG. ''' import torch import torch.nn as nn import torchvision from smithers.ml.utils_imagerec import decimate if torch.cuda.is_available(): device = torch.device('cuda') else: device = torch.device('cpu') class VGG(nn.Module): ''' VGG base convolutions to...
4e9cb50330205735a15a452b18b78d820cd2ead8e4b60c3c2d5cfe8e797f9930
Python
11,449
319
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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...
bd2f9510932a83d446fcc042407a1dab9c8eae203c038434f40a006729fb1194
Python
11,459
263
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Model validation metrics.""" import warnings from pathlib import Path import matplotlib.pyplot as plt import numpy as np import torch from ultralytics.utils import LOGGER from ultralytics.utils.metrics import box_iou, mask_iou, plot_mc_curve, plot...
434a41ec26f0c9a867a04f30b4648ff6a782d3c37b02963d3917eec2f0fc5f97
Python
11,474
186
import scipy.io import numpy as np import matplotlib.pyplot as plt def get_running_time(dataset,nRep): # Provide a rough estimation of running time if dataset=='nhp': exp_time=np.ceil(22*4.3*nRep*np.array([10, 16])/60/60) elif dataset=='rat': exp_time=np.ceil(40*0.9*nRep*np.array([10, 16])/...
d6ccfa663a4a0eea9b952af268cd302831c408ecda0cc4d484b66f596e3ac0f6
Python
11,482
394
import unittest import torch import torch.utils.data as tud from reinvent.models.transformer.core.dataset.paired_dataset import PairedDataset from reinvent.models.transformer.core.vocabulary import SMILESTokenizer from tests.models.unit_tests.linkinvent.transformer.fixtures import mocked_vocabulary from tests.test_da...
ca25641c5ade6fc29f27355edea8c617bc0ed1af05ce6e2c51c6b223b403fdcf
Python
11,485
301
# Copyright (c) 2021 PaddlePaddle 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 appli...
ae1832725e4922a7f672c6e3374b073d88f604ae826c5b626dffafceb7eadf0c
Python
11,488
287
#!/usr/bin/env python3 import math from pathlib import Path import numpy as np import matplotlib.pyplot as plt from mlspm.graph import MoleculeGraph from mlspm.datasets import download_dataset from ppafm.ocl.AFMulator import AFMulator from ppafm.ocl.field import HartreePotential from ppafm.ocl.oclUtils import init_e...
044c340221e439be37120ae9213f0636a3f8cbbe8ed657a4a692facfbc862633
Python
11,495
314
import os import sys import time import zipfile import warnings from glob import glob from urllib.request import urlretrieve from typing import Optional, Tuple, List, Iterable import cv2 import torch import numpy as np from PIL import Image from torch.utils.data import Dataset from bindsnet.datasets.preprocess import...
666bc3f900f7e5f2feaa666bfcb081ca85c9d64e05179f1ddac6c8f7b8ed6a4b
Python
11,496
263
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch import tempfile import os from pathlib import Path from nequip.data import AtomicDataDict from nequip.data.transforms.neighborlist import NeighborListPruneTransform from nequip.nn import ...
d8fa4c580ac614cebfc75d25f4442b5e5829743d7cbafa55941f184106e2d94a
Python
11,501
332
# -*- coding: utf-8 -*- # Copyright 2014-2018 The ODL contributors, # 2019 Johannes Leuschner # # This file was taken from ODL and modified by Johannes Leuschner to add # random state support instead of seeds. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a...
f955e2b9db00ffa4321c51eb114a869c1b231647aaeebda95507913d09141dfa
Python
11,504
345
import asyncio from typing import Any, Awaitable, Callable, Generator, cast, Dict, Tuple from unittest.mock import MagicMock, patch import chromadb from chromadb.config import Settings, System from chromadb.api import ClientAPI import chromadb.server.fastapi from chromadb.api.fastapi import FastAPI import pytest import...
98794e7683b79a1fc02ddd649c417a57942e6c2b36e4a99080d7a6c4ae664500
Python
11,505
343
# Copyright (c) 2019 PaddlePaddle 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 # # Unle...
0a9c8b23dcb7f6559d28df26d800b96690c8cf524e0682bbbee47a2425729d35
Python
11,520
357
import os import torch import argparse import numpy as np import matplotlib.pyplot as plt from torchvision import transforms from tqdm import tqdm from time import time as t from bindsnet.datasets import MNIST from bindsnet.encoding import PoissonEncoder from bindsnet.models import DiehlAndCook2015 from bindsnet.net...
de5529659d09a155ccca86f98f3c8d37fa3fc4fbdb87285e994624166b891860
Python
11,526
300
import os from rdkit import Chem from rdkit.Chem import AllChem import time import pickle from rdkit import RDLogger RDLogger.DisableLog('rdApp.*') def get_pos_dict(idd=None, cl_file=os.path.join("..", "data", "pretraining_data", "merge_cl.pt"), yield_file=os.path.join("..", "data",...
7f5287d377f77e979f29d23b109cb9cfba3613fc7a084d6e853b36a74b52970f
Python
11,531
283
import os import random import numpy as np import torch def setup(args): """ setup - name: the name of dataset - device: CPU / GPU - seed: random seed - n_clusters: num of cluster - n_inputs: dimension of feature - alpha_value: alpha value for graph diffusion - lambd...
f8079e8074b134baeb2c67e6fe74255c64ffc897c0af25ed27a1cc9747e99b12
Python
11,535
330
# Copyright (c) 2022 PaddlePaddle 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 appli...
d45e7d9023f382425136e38cf50332e2900c371737d0056382c2d817f3dbf2ab
Python
11,540
326
import copy import io import os import random import re import time from itertools import islice from pathlib import Path from typing import Any, Generator, Iterable, Optional, Tuple import numpy as np import torch import webdataset as wds from torch.utils.data import get_worker_info from .graph._data_loading import ...
2bb7bfc74ba00bcea2886d502f190e57f85a3b97f97d670ee0b5e9c17ba78ac1
Python
11,547
261
import tensorflow as tf import numpy as np from crf_rnn_layer import crf_rnn_layer def get_spatial_rank(x): """ :param x: an input tensor with shape [batch_size, ..., num_channels] :return: the spatial rank of the tensor i.e. the number of spatial dimensions between batch_size and num_channels """ ...
752cf2f50193ef7f86f9f15fcf2b92719fc44fa782cd38391f03f6d6733fb498
Python
11,547
305
# ============================================================================== # Copyright 2023 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import numpy as ...
2d9b2d7c5fb7edcbdbd8d72148dcb39f5098f7ffc5e635ed69ee6015c1654f79
Python
11,558
330
from collections.abc import Sequence from pathlib import Path import cv2 import numpy as np from qtpy.QtCore import Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtCore import Qt, QThread, QTimer from qtpy.QtGui import QIcon, QImage, QPainter, QPixmap from qtpy.QtWidgets import ( QCheckBox, QCombo...
6f211fb28ee9ac403ae722e9319ed9e0664f8592e142fbaba59dafabb2f9a894
Python
11,558
293
from keras.layers import Activation, Convolution2D, Dropout, Conv2D from keras.layers import AveragePooling2D, BatchNormalization from keras.layers import GlobalAveragePooling2D from keras.models import Sequential from keras.layers import Flatten from keras.models import Model from keras.layers import Input from...
fd51ea29842ab5536487e9145d67e824331a5b8ac84333a9b580a72699fc75c3
Python
11,565
361
import uuid from django.contrib.auth.models import User from django.db import models from django.utils import timezone from celsusdjango import settings # Create your models here. class ExtraProperties(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True) curtain_link...
8043062614cc9e5e54a1eceafa39def6ee175ea45dff3ea8a80533a04c2c226d
Python
11,569
230
# -*- coding: utf-8 -*- import os, sys import numpy as np import argparse import logging from data_functions import writeTbsFile import copy import subprocess MSMOD_PATH = 'msmodified/ms' import time # this function creates an array for writing to text that has the ms parameters # from a CSV file produced via boots...
b55bf1ec3ccf87fe2fcd58e5b9b72cb81bdbd6e72c5a3d5502cb2f6dfea5abf5
Python
11,571
287
# Copyright (c) 2021 PaddlePaddle 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 # # Un...
63a51f305c047c13454740ef720513d3482de437d47bf8ddf24b75203563a8da
Python
11,574
351
# saved as /n/groups/marks/users/david/res/model_save//RES_1638990570.3313198_32.pt import gvp from atom3d.datasets import LMDBDataset import torch_geometric from functools import partial import gvp.atom3d import torch.nn as nn import tqdm, torch, time, os import numpy as np from atom3d.util import metrics import skle...
9b7d1c7946cac85829cd2b88b5f3ca18ebd2fdb0882d8798f3c00c094a1b49ef
Python
11,587
278
import json from copy import deepcopy from typing import List import pandas as pd import requests import seaborn as sns from matplotlib import pyplot as plt from curtainutils.common import curtain_base_payload class CurtainClient: def __init__(self, base_url: str): self.base_url = base_url def post...
277208f7cc26a71706af2313b86c2808fd6cf996d4ee7e2502038948dfb26bd9
Python
11,590
272
# Copyright (c) 2022 PaddlePaddle 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 appli...
7170d126885267deb607c11b96fba2b084f549e33c825f726b38107c687e97ee
Python
11,593
308
import torch.nn as nn import numpy as np from collections import defaultdict from torch.nn import Sequential as Seq, Linear as Lin, ReLU, BatchNorm1d as BN, Dropout from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F import copy from torch import autograd from typing ...
0ad86e7041e07c09f47cd7f09d03753bb2cdfcec0e37e43ba18d2a43f071664b
Python
11,596
387
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 """ Evaluate a trained pytorch-lightning model on the three tasks on CASF2016: - Scoring => Spearman rho, R2 - Docking => top1, 2, 3 success rates - Screening => Average EF, success rates """ from train import ( ...
6c5b22f27f8e6a121f7c898bbe66288c990145234dccabdb7e40894f795f9584
Python
11,601
324
import itertools from typing import Callable, Optional, Tuple, Dict import torch from tqdm import tqdm from .base_pipeline import BasePipeline from ..analysis.pipeline_analysis import MatplotlibAnalyzer from ..environment import Environment from ..network import Network from ..network.nodes import AbstractInput from...
6478c3fc69d7cc8a12671f7471ad88ce9f054ab31d329820d480aea48f6a6e37
Python
11,611
214
from DeepPurpose import utils, dataset from DeepPurpose import DTI as models import warnings import itertools import numpy as np import pandas as pd import wandb from tqdm import tqdm import sys warnings.filterwarnings("ignore") import random import argparse def main(num_samples, val_setting, cuda_id, num_workers, da...
ef6eb21c7abf6815057ce8ad2b27e6b0c17bbacd33e29c0f65916084c123f8b1
Python
11,612
279
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cognitiv...
1e1a79af9bf9c612b8c205be9f9e39633716609e3c7c28a835b614e8f6ba45b8
Python
11,614
282
''' Description: Author: voicebeer Date: 2020-12-10 08:47:27 LastEditTime: 2021-02-27 08:52:04 ''' # standard import models import utils import argparse import torch import torch.nn.functional as F import torch.nn as nn import numpy as np import copy import random import time import math from torch.utils.tensorboard ...
b027edbce9fc7a02715365e5630f5963e196db582b5360e04d0a2d6baa43b5e9
Python
11,614
345
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Collaborator tests module.""" import numpy as np import pytest from pandas.testing import assert_frame_equal from openfl.interface.aggregation_functions import AggregationFunction from openfl.interface.aggregation_functions import We...
fdf894cf231ee87fc007a7fed4b7470631857adf36ddf50aa8ed2c61b6d00623
Python
11,616
327
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # OS stuff import os import sys import warnings from pathlib import Path # Computational stuff import numpy as np import matplotlib as mplb import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec from matplotlib import font_manag...
3d96f296291a3f6a6765aec565839416638fc6d962562cb48d609ddfe44f19f4
Python
11,620
319
from typing import Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F def _get_padding(kernel_size: int | Tuple[int, ...], nd: int) -> Tuple[int, ...]: if isinstance(kernel_size, int): kernel_size = (kernel_size,) * nd padding = [] for i in range(nd): paddi...
872e5640f300725c2cc3b085ae303bba3d85741db58863387831410f66b70b59
Python
11,622
274
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
827e6b6c3747ff51608598ed3d8b4bae24dfe8203e8c679e093eb1a439d3e9b0
Python
11,626
245
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch from torch.optim.swa_utils import _group_tensors_by_device_and_dtype import lightning from .lightning import NequIPLightningModule from nequip.utils import RankedLogger import warnings fr...
ca43c3f8cb7b282383eb9b5d6718f89ffe05bda117bd20c1077937827d33c97a
Python
11,633
354
''' Alex Crits-Christoph License: GPL3 Identifies closest GenBank prokaryote genomes by euclidean distance between tetranucleotide frequencies of query sequences. ''' import json from scipy.spatial import distance import sys from Bio import SeqIO from marker_genes import meta_marker import operator import argparse im...
f88b643b8fcb6540559b209962edf66eb7c8fa94c1ec94808293c4b53aed7b0b
Python
11,634
291
""" Calculate the optical flow (vector field) signal using the Horn Schunck algorithm. """ import argparse from scipy.ndimage import gaussian_filter from scipy.signal import hilbert import neo import numpy as np from copy import copy import matplotlib.pyplot as plt from utils.io_utils import load_neo, write_neo, save...
fa6c6da2b908c95f78bd1fa33433e9b14c15390a1c3d2c405789026c104f0cb3
Python
11,642
305
import numpy as np import xarray as xr from sklearn.base import BaseEstimator from sklearn.model_selection import KFold from numpy.testing import assert_allclose, assert_raises from xarray.testing import assert_allclose as assert_xr_allclose from unittest.mock import patch, create_autospec from scipy.stats import pe...