sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ac4e4e5d703a2701f1e6529f48bc2478535751356578f8c8f1372b0befa11f48
Python
5,750
112
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " from mpi4py import MPI import os import json from nest_elephant_tvb.utils import create_...
fd60649bc2fa1cc5fa8cfc3a10023d931502e1d5b5c4f87c78f3858858df773b
Python
5,754
113
# from vis.visualization import visualize_cam # import matplotlib.cm as cm from lime import lime_image from tensorflow.keras import Model import tensorflow as tf, numpy as np, cv2.cv2 as cv2 # deprecated GradCAM function # def generate_heatmap(model, input_image): # grads = visualize_cam(model, layer_idx=-1, filte...
b955e0908e82f2e59d355c9c7f22c7e8feb19ab7a3c90135d82985df0ca1814c
Python
5,756
144
"""The kernel density estimation classifier on manifolds. Lead author: Yann Cabanes. """ import math from sklearn.neighbors import RadiusNeighborsClassifier import geomstats.backend as gs def wrap(function): """Wrap a function to first convert args to arrays.""" def wrapped_function(*args, **kwargs): ...
46b9b00f075b69a0b99398eca501515f26393618c9c8b7416b9124f144d44895
Python
5,760
130
import sys from miscFuncs import * vcfSnpFileName1, vcfSnpFileName2, vcfAllSitesFileName1, vcfAllSitesFileName2, maskedFaFileName, qualThreshold, outVcfPrefix = sys.argv[1:] qualThreshold = int(qualThreshold) def addSnpLocsInVcfFile(vcfFileName, snpLocs, outGenos, quals): with open(vcfFileName) as vcfFile: ...
894099880bc992d3488c9cf09589d2d28215549fd4aa38d0db976166a2d3f7b4
Python
5,761
141
from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.Exploration.Visualization.Module_visualizer import * class module_visualizer_tab(TabBase): def add_recorder_variables(self, neuron_group, Network_UI): return def initialize(self, Network_UI): self.di_modules=[] group...
b310e94f5bf67210eaf2dc65a91ee8c4bb69f2fa29555a888a6e888f8d2644e0
Python
5,763
162
from typing import Sequence, Union import torch import torch.nn as nn from monai.networks.blocks.convolutions import Convolution, ResidualUnit from monai.networks.layers.factories import Act, Norm from monai.networks.layers.simplelayers import SkipConnection from monai.utils import alias, export class UNet_double(nn...
1373e41360b198530fb3b3d0ca1395e57991c244cfa461c7bfb52282981e070d
Python
5,765
180
from typing import Any, Optional, Sequence, Tuple, Type from types import TracebackType from typing_extensions import Protocol, Self, Literal from abc import ABC, abstractmethod from threading import local from overrides import override, EnforceOverrides import pypika import pypika.queries from chromadb.config import S...
2c51fcd1efe6e852dc5ed0bf91b393c4c2273f0f934a1e7388067fe22cec0027
Python
5,769
151
# Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class DigitRecognizerCNN(nn.Module): """ A Convolutional Neural Network (CNN) model for digit recognition. This model consists of two convolut...
5856f95fbe050ab274a76656e3e8b650947afaad02ad4a44e93c87b19332d9d6
Python
5,772
180
"""General purpose (numerical) utilities for spike detection and plotting. """ import numpy as np from sanpy.bAnalysisResults import HALF_HEIGHTS from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) def throwOutAboveBelow( vm, spikeTimes, spikeErrors, peakWindow_pnts, onlyPea...
61b489e2a1a2150f0a064efc580786a7b7dad6e36b8de0a2b4f24f410e3108b2
Python
5,776
163
# 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...
68562c0a90d4640df69eb5ec1748d0fd9ed10611c4437219930f625ba3f1e2a8
Python
5,776
211
import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as dsets import torch.nn.functional as F import numpy as np from torch.autograd import Variable from torch.optim.lr_scheduler import StepLR,MultiStepLR import matplotlib.pyplot as plt import math from sklearn.util...
35e502903105cad3722f374b4ee3bd5e5f2cdc37462a51b53ef1c7d031092259
Python
5,779
156
# 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...
8c42d8a84c08f1a6bd5a7713027981efbea046dc802dbbf28426c4f9a2b47d79
Python
5,779
185
import os import random import numpy as np from tqdm import tqdm import torch from torchvision import transforms from skimage.metrics import ( mean_squared_error, structural_similarity, peak_signal_noise_ratio ) from pytorch_radon import Radon, IRadon from pytorch_radon.filters import LearnableFilter f...
1e13ae4a19a7e6faf32ffb1e8ec20e4b4b802e70c5b01999b1649961f28e52fa
Python
5,781
174
import numpy as np import nibabel as nib import glob import os from scipy.ndimage import binary_dilation from src.ni_functions import get_atlas_coords, image_overlaps import sys def select_rois_from_lobe_partitions(lp_path, area): image_names = glob.glob(os.path.join(lp_path, area, "*.nii.gz")) image_roi_lab...
07c5a99a331bb4a684077b07f6b7181d72eee9c28a1361ff6cdc3f7022e46783
Python
5,782
153
# -*- coding: utf-8 -*- import os import argparse import logging import os import numpy as np import logging, argparse from data_functions import load_data, get_windows import h5py import matplotlib.pyplot as plt from format_unet_data_h5 import Formatter from collections import deque from calc_stats_ms import * fr...
17ec749242ad0a358a9fd82c02f88448c3b2d1846b1a0f16ab08c6b483581193
Python
5,783
170
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Pipeline module.""" import numpy as np class Transformer: """Base class for data transformation. This class defines the basic structure of a data transformer. It should be subclassed when implementing new types of data tr...
b68ea2fddfb466a8f56c301c8b5ffe1b94086138ef3d82cc4d84760fc1dfdbbe
Python
5,783
160
""" Code for perform generalization evaluation. First executes the training of the model, and saves in Results folder returns pkl with results and heatmaps function to Sh in func_test_models """ import argparse import logging import subprocess as sp import pandas as pd import seaborn as sns import matplotlib.pyplot...
3dea970c5403c6c8a34cc6ac9fb50d790371eee33e65cdd9a578bb009b6b46ba
Python
5,784
210
## IMPORT BASIC LIBS FOR SCRIPT import scipy as sc from scipy import io import pickle import numpy as np import h5py import pandas as pd import os from sys import argv ## TREATING ARGV VARS nPats = int(argv[1]) # NUMBER OF SUBJECTS pipe = argv[2] # PIPELINE ## COMMAND TO ALLOW THE USE OF HDF5 IN NETWORK (HPC) STOR...
ee698e7a39ba373318f929699f0669b7c433645a93d319d16fa157168413dfe6
Python
5,785
160
""" Code for perform generalization evaluation. First executes the training of the model, and saves in Results folder returns pkl with results and heatmaps function to Sh in func_test_models """ import argparse import logging import subprocess as sp import pandas as pd import seaborn as sns import matplotlib.pyplot...
c9b625c12571462653d7ab0ef736d4847137a2476f5da896b9325b71dd02c132
Python
5,786
117
"""How much of a motif is chance, and how much of a lift is publicity. Two quantities `docs/denoising.md` uses, computed rather than asserted. The chance-recruitment rate says what fraction of a motif's members a non-convergent record would supply for free. TCRNET already estimates the background neighbour probabilit...
0409e9ab6e5cd16f928f0fe945dee3b845ee3089045cb001cf5ea0fc8eb8ef7f
Python
5,788
135
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
ba844c478a64de1578cdd2e23343c8d2771fe2b16e6f17f31920ef72f828fd71
Python
5,788
139
#### group_binfile_parcellation.py # Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com) # # This script is a part of the pyClusterROI python toolbox for the spatially # constrained clustering of fMRI data. It performs group level normalized # clustering of connectivity matrices. This is one of two meth...
527b2ddd2bb894401a2bd813d9e5d515a89663fb7c31a0cadea004165cd9056b
Python
5,789
167
import unittest import pytest import torch import torch.utils.data as tud from reinvent.models import TransformerAdapter, Mol2MolModel from reinvent.models.transformer.core.dataset.paired_dataset import PairedDataset from reinvent.models.transformer.core.vocabulary import SMILESTokenizer from reinvent.runmodes.create...
cf8a995eb98bcd223c7ac1a1f635118e00b89d5968ab44afdc87fb7b4c4c33f0
Python
5,794
167
import logging import time from pathlib import Path from multiprocessing import Process, Queue import json from ScanImageTiffReader import ScanImageTiffReader from .utils import get_nchannels, get_nvols, get_tslice, slice_movie from .workers import RealTimeQueue logger = logging.getLogger('live2p') def append_to_qu...
29caf98d0039be09e97b2c87701593127fe86b954b89b75c50fc34cf9d466968
Python
5,797
159
import torch import numpy as np import copy import sys import time import torch.distributed as dist from metroem import loss from pdb import set_trace as st def align_sample(model, bundle, train=False): tgt = bundle['tgt'].unsqueeze(1) src = bundle['src'].unsqueeze(1) src_field = None if 'src_field...
7be682433785f146d24389faefdc8656b89593d687c33bf66f76710dc3e5d145
Python
5,798
164
import numpy as np import numba from numba import jit, prange, f4, u1, c8 import math @jit("void(f4[:,:,:])",nopython=True,parallel=True,cache=True,fastmath=True) def fastlog(f): '''Step 1 of FFT-based spatial filtering: computing the log of the input video. Inputs: f(numpy.ndarray of float32, shape...
a24d4ab00a0ed1b0d4c0f64fd89e7ea1ebd0e9ed222669d7bc6eabbd5c30f3f7
Python
5,800
191
import click from corgie import scheduling from corgie.log import logger as corgie_logger from corgie.data_backends import pass_data_backend from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type from corgie.boundingcube import get_bcube_from_coords from corgie import argparsers from corgie.a...
a5b7be1eed6995c9f9164913a74de1eea349b3e8a771e91e807a55fc945580e3
Python
5,801
211
""" NN METRICS ==================== Support for metrics based in neural networks. To the date of release, support for Keras models is included. This module has been entirely created by Carlos Outeiral. """ import numpy as np import rdkit.Chem.AllChem as Chem import tensorflow as tf from keras.layers import Dense, D...
b51367e83647c2bb1f31a4ae30e862636e2e0039f61295299c8b609dcaeb8609
Python
5,804
177
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates 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 Cogn...
d7ee72830524b02b07a5fadbc2548a51c10e69dd621326c370435d582dd82353
Python
5,810
128
import os import sys import pandas import json import itertools import logging from utils import enumerate_isomers from pubchem_utils import get_map_inchikey_to_canonicalSMILES, get_map_isomericSMILES_to_inchikey class IsoRetriever: def __init__(self): self.auxillary_dir = 'Data' self.log_dir = ...
3ad7dc214b2f6873c91054eaadd156112aeafd1cbad1711fc45e85d063fb7e81
Python
5,811
158
# 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 # # Unless required by appli...
b0d725dd31712096caf701550085f396b912c6ac798d0cde74cfd5b748e34c8d
Python
5,811
150
# 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 # # Un...
77cf7a2d58943f968d2ea7f9910b002ec91d20d7ba4d669ffe3729b765ee3f6b
Python
5,812
156
from typing import List # Union, Dict, List, Tuple, Optional import numpy as np import logging logger = logging.getLogger(__name__) from load_heka_python.load_heka import LoadHeka def hekaLoad(path : str, group_idx : int = 0, series_idx : int = 2) -> dict: """Load a heka file and return a dictionary with the l...
004a23f3e498631d9fa6787da1d56ba95a422c731ec48ae6a6e98d20f7a6a313
Python
5,813
146
# 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...
ae63d994a55122c07cabdece2f2c66a380b5af504ebe9cd1c2c237e85586a11d
Python
5,819
173
import jax import jax.numpy as np import jax.random as random from jax.nn import log_softmax from functools import partial def sparser(W_in, W_mask): """ Calculate sparsity-inducing loss. This loss function encourages sparsity in the weights of a model by penalizing the squared weig...
3eb7138458621a13517d96e48fae7ed4e1595d6ac364ecef46a85889d640ce1d
Python
5,820
158
import itertools import numpy as np import torch import torch.nn.functional as F import torch.nn as nn def JSE_loss(zs, zs_n=None, batch=None, sigma=None, neg_by_crpt=False, **kwargs): '''The Jensen-Shannon Estimator of Mutual Information used in contrastive learning. The implementation follows the paper `Lea...
c00c7a2b5847f613ee3823d0eb90d84be4c0add1c2f21ce343c6bfbb0455668e
Python
5,822
179
"""Statistical Manifold of beta distributions with the Fisher metric. Lead author: Alice Le Brigant. """ from scipy.stats import beta import geomstats.backend as gs from geomstats.information_geometry.base import ScipyUnivariateRandomVariable from geomstats.information_geometry.dirichlet import ( DirichletDistri...
c41fd908e1c1f3c6244279f080b8f1ad6bd62b58a65e71a0983d942457a474f1
Python
5,825
156
from warnings import warn from copy import deepcopy import torch import numpy as np import torch.nn as nn from odl.tomo import fbp_op from dival.reconstructors.standard_learned_reconstructor import ( StandardLearnedReconstructor) from dival.reconstructors.networks.unet import UNet from dival.datasets.fbp_dataset ...
0b067a894cfcc05a0989d0a47791c09f8dc7c5ba898f9b797be0430b568d6995
Python
5,827
159
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import os import...
a4ad43bd873db386ffeb869ece69aa6103b3d3b7ab23b33b1c8bd88df5077399
Python
5,830
156
""" Numerical Simulations ===================== In this tutorial, you will learn the different options that PyRates provides for performing numerical simulations. Given a dynamical system with state vector :math:`\\mathbf{y}`, the evolution of which is given by .. math:: \\dot{\\mathbf{y}} = \\mathbf{f}(\\mathbf{...
10cb934cc668c90276a4f0c3c6185e31eb65b5fa39de36cc9ec83e395da21e73
Python
5,835
151
''' Example showing hardware-timed continuous analog output without using a callback function pynidaqmx.ao.hardwareContinuousVoltageNoCallback Purpose Demonstrates how to do hardware-timed continuous analog output without a callback function. To achieve this we use sample regeneration. The buffer contents is pl...
23a4dd3020bfb27a16f59d2c948f14515047d646b4da63c68944f509b8e5c537
Python
5,835
156
"""Test suite for the auto-07p Fortran emission path. Covers the YAML-order preservation (issue: param-order scrambling resulted in `parnames = {1: 'p4', 2: 'p2', 3: 'p1', 4: 'p3'}` instead of the declared `{1: 'p1', 2: 'p2', 3: 'p3', 4: 'p4'}`) and the sub-routine signature / auto wrapper consistency. """ import os ...
cb824440b25f521349497fc254bde9818ee3a53017d6c68f13deaef8136f7107
Python
5,838
209
"""The vector space of lower triangular matrices. Lead author: Saiteja Utpala. """ import geomstats.backend as gs from geomstats.geometry.base import LevelSet, MatrixVectorSpace from geomstats.geometry.matrices import Matrices, MatricesMetric class LowerTriangularMatrices(MatrixVectorSpace): """Class for the ve...
565d1966d10dc3a31e939fedda60d4a1772a04ff450d5e591d99c8b383b27db6
Python
5,839
165
'''SqueezeNet in PyTorch. See the paper "SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" for more details. ''' import math import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.autograd import Variable from functools import parti...
0ca7187146ca9646b49aa63678d6bd8526e4772572ed8ced171e861d23e5bf57
Python
5,841
119
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " from mpi4py import MPI import os import json import time import numpy as np from nest_el...
93cca0be8536740ffdc4ddaf3f1221c0f12517c08344af1a78fa7fd543fdda23
Python
5,841
184
"""Class to implement simply the Fisher-Rao metric on information manifolds.""" from scipy.integrate import quad_vec import geomstats.backend as gs from geomstats.geometry.riemannian_metric import RiemannianMetric class FisherRaoMetric(RiemannianMetric): r"""Class to derive the information metric from the pdf i...
9b1625051b9eafc918c11c662ef2cdcecda654b1690e6c0742aef92007e94a0c
Python
5,842
128
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from ._base_datamodule import NequIPDataModule from nequip.data import AtomicDataDict from nequip.utils import download_url, extract_zip from nequip.utils.logger import RankedLogger import os from typi...
586271d4ea460cd08c645e8f35d43a96efea5890f3dfbe8c8e9fecbe55a75c3c
Python
5,845
150
from PymoNNto.Exploration.Network_UI.TabBase import * class multi_group_plot_tab(TabBase): def __init__(self, variables, title='Multi Group', timesteps=500): super().__init__(title) self.timesteps = timesteps self.original_variables=variables self.variables = [] self.curve...
5052f615a40f3b76327cdbc6a3bfbc544beb598998d849debc13a61d163bb945
Python
5,849
165
from torch import nn import argparse from typing import Dict, Tuple from . import register_cls_models from .base_cls import BaseEncoder from .config.ehfr_net import get_configuration from ...layers import ConvLayer, LinearLayer, GlobalPool, Identity from ...modules import HBlock as Block @register_cls_models("ehfr_...
f2f1c7e74f7359fdf0f53c35e97d4e0253322b9b7dc2e9a009982e6f642d01e9
Python
5,856
139
# Copyright (c) 2023 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...
4ad5fd831ad9bb7d4c9bd49a328975ee346f27f4241289346cf9880b851cd217
Python
5,857
181
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """KCPipeline module.""" import copy as co import gzip as gz import numpy as np from sklearn import cluster from openfl.pipelines.pipeline import TransformationPipeline, Transformer class KmeansTransformer(Transformer): """K-means ...
78eb4ed055df6d0210501fe1dcf00cd47f5460151a8e63a025673c7874d4af9c
Python
5,858
214
"""Complex manifold module. In other words, a topological space that locally resembles Hermitian space near each point. Lead author: Yann Cabanes. """ import abc import inspect import geomstats.backend as gs class ComplexManifold(abc.ABC): r"""Class for complex manifolds. Parameters ---------- di...
59fef45966aa7ac8038d9d4a2500df1c6b7621e7aa22fc982af07c471cd67193
Python
5,861
151
# 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...
c28777ad0d32b384049e51ccf04f888430714259ac61ee77cd1b48c51a163ce2
Python
5,861
178
import contextlib import pytest import torch from nequip.model.utils import ( _EAGER_MODEL_KEY, _TRAIN_TIME_COMPILE_KEY, _COMPILE_MODE_OPTIONS, fresh_model_builder_context, get_current_compile_mode, model_builder, override_model_compile_mode, ) class _ToyModel(torch.nn.Module): """Mi...
4741d91125814761584a8fdcc300555e1bed904dcb52b8c415e3504319185bfa
Python
5,870
181
import sys from chromadb.proto.utils import RetryOnRpcErrorClientInterceptor import grpc import time from chromadb.ingest import ( Producer, Consumer, ConsumerCallbackFn, ) from chromadb.proto.convert import to_proto_submit from chromadb.proto.logservice_pb2 import PushLogsRequest, PullLogsRequest, LogReco...
36482c63de732dcdd82bd852a71a6d158c95abf9acf907a8909b4cf60a7c3814
Python
5,873
181
"""A collection of RDKit wrappers for various types of SMILES conversions""" import sys import random from typing import List, Tuple, Optional from rdkit.Chem import ( AllChem, MolFromSmiles, MolToSmiles, MolStandardize, ) from rdkit.Chem.rdchem import Mol from rdkit.Chem.rdmolops import RenumberAtoms...
55d6c62bf2db68a06603d540e414aa12c95d2f0a0c9aba06ee1f22faf30c734d
Python
5,880
178
# # calculation of synthetic accessibility score as described in: # # Estimation of Synthetic Accessibility Score of Drug-like Molecules based on Molecular Complexity and Fragment Contributions # Peter Ertl and Ansgar Schuffenhauer # Journal of Cheminformatics 1:8 (2009) # http://www.jcheminf.com/content/1/1/8 # # seve...
69d29e8b14baffafad52b4e6fd609c9e52ca63ec84fd9212d131ca8aed615914
Python
5,882
210
"""Reference implementations for correlation matrices.""" import numpy as np from ivac.utils import get_nfeatures # equilibrium IVAC def c0_all(trajs): nfeatures = get_nfeatures(trajs) numer = np.zeros((nfeatures, nfeatures)) denom = 0.0 for traj in trajs: numer += traj.T @ traj den...
8eb6f95cc365814cb74fee0a9ad49b67afd823ef397d774f809ccdd317033faa
Python
5,884
156
import os.path as osp import pickle from sklearn.utils import shuffle import numpy as np import random import rdkit.Chem as Chem from rdkit.Chem.Scaffolds import MurckoScaffold import csv import codecs import torch from torch_geometric.data import Data class JunctionTreeData(Data): def __inc__(self, key, item):...
edebc3434001b0696bc2490ddcf84dc0db875fc473ac601ba78442286a9b852f
Python
5,891
171
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ import time, os, glob from tqdm import tqdm import numpy as np from skimage.io import imread import seaborn as sns import pandas as pd import matplotlib.pyplot as plt from skimage.metrics import structural_simil...
cf72a97bfdfe7f7a0f9621553fe250ce1329b2cc97b23b0133b0c99a5cc9560a
Python
5,892
164
"""Tests for persistent SanPy interface preferences.""" import json from pathlib import Path from types import SimpleNamespace from unittest.mock import Mock from sanpy.interface import preferences from sanpy.interface.bTableView import DEFAULT_HIDDEN_FILE_COLUMNS from sanpy.sanpy_paths import SanPyPaths def test_e...
a23cd80121724bc0bb322e4d5ebee7e31067550d9b2de5e1b9de25dfe66ddab7
Python
5,893
109
"""Audit aligned score forecasts with paired per-epitope and macro differences. Input TSV columns: endpoint, epitope, case, label, predictor, score. Every predictor must cover identical cases/labels. Keep private case tables and outputs outside Git. No fitting occurs here. """ import argparse from pathlib import Path ...
c9d108fe89c9a2eec483678146a856fdc2601a9a0f7c0b6812131ff2e5091b5a
Python
5,893
176
import torch from nequip.train import HuberLoss, StratifiedHuberForceLoss from nequip.train.metrics import MaximumAbsoluteError import pytest LARGE_FORCE_MAGNITUDE_SCALING = 200 EXTREMELY_LARGE_FORCE_MAGNITUDE_MASK = 15000 @pytest.mark.parametrize("reduction", ["mean", "sum"]) @pytest.mark.parametrize("delta", [0....
7f551ff833e8a56061447700bf42249ccade5643998bba7b17c50302b62f0807
Python
5,894
143
""" This script serves as a guideline for the reproduction of the data shown in 4.2.2. The data there presented was obtained with a pre-release version of SHIP, which has then been updated since. This script converts the work done before to a version that uses the new release of SHIP. However, the hyperparameter ...
c98699daeb369a2770e90205fa37cbdbc7eac2eea68c51292228efe0ecfc9aae
Python
5,895
196
"""Group actions.""" import math from abc import ABC, abstractmethod import geomstats.backend as gs from geomstats.geometry.matrices import Matrices from geomstats.geometry.special_orthogonal import SpecialOrthogonal from geomstats.vectorization import get_batch_shape class GroupAction(ABC): """Base class for g...
ff4d756799fb71797f0c1c29a03fe8dd95bee50c3c6d18f442b96f1168535054
Python
5,896
193
# network without using the permutation. import numpy as np import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import data # number of available gpu ngpu = 1 batch_size = 32 dataRoot = "../../data" labelFiles = "labels-1.h5" matFiles = "matrices-1.h5" labelsh5 = h5py...
316ab2650d901527ca506ee66c7ac8c4c4ad53caf3fd2b785a915f030037d306
Python
5,904
128
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from ._base_datamodule import NequIPDataModule from nequip.utils import download_url, extract_zip, extract_tar from nequip.utils.logger import RankedLogger from nequip.data import AtomicDataDict import...
374ed8209b92f82b47300ac0b50750d5ca343e06278302f60bd697614496a40a
Python
5,905
127
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 import threading import os def main(cuda_id, num_workers, so...
502f80dbf200ca75bf47af22ba92087146c34f5a42b365293db7d289b17ad95f
Python
5,912
190
import geomstats.backend as gs from geomstats.test.data import TestData from .base import LevelSetTestData from .invariant_metric import InvariantMetricMatrixTestData from .lie_group import LieGroupTestData, MatrixLieGroupTestData from .mixins import ProjectionMixinsTestData point_1 = gs.array([0.1, 0.2, 0.3]) point_...
4c7eadac99775c4d13e4bafbb91d51858217405edcc5ada024d5962b0fd5b21f
Python
5,913
151
# Copyright (c) 2024 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...
8dca8cb48681ffb3538d1c964f971e3d2832681cdfa535536f629401fa023b49
Python
5,915
131
# 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 nequip.nn.model_modifier_utils import ( is_model_modifier, is_persistent_model_modifier, ) import inspect import contextvars import contextlib from hydra.utils import get_met...
cb75183b0b6319f4cebd1d33a05b814a8e9ad710b6c1ce26044a120edb13c7c6
Python
5,917
157
# 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...
3292158e8ae6620ccf5ee65dfd5be7b688497844e22936f0e3e652c8df3b595f
Python
5,919
152
# 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 # # Un...
39a439fa803e8993cf62ba5af8a9180b2406d4411242cc40de1abe51298e3d40
Python
5,926
180
import pytest from unittest.mock import MagicMock from chromadb.api.shared_system_client import SharedSystemClient from chromadb.api.base_http_client import BaseHTTPClient from chromadb.config import System from typing import Optional, Dict, Generator @pytest.fixture(autouse=True) def clear_cache() -> Generator[None,...
c1f704ac26c03dd98f1b7746d4295c1aa1ce5948a8e17ebc2d061f67fd393668
Python
5,933
173
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. """ Model ASE integration test mixin for ``nequip-compile`` workflows. This mixin provides tests for compiled-model ASE integration workflows including: - ``nequip-compile`` in TorchScript mode (where ...
7001b65044949c72b50dd00fb9b63e2b757b8cf1966e1c63be156b83b454c023
Python
5,934
147
from copy import deepcopy import config import numpy as np from data.dataset import Brats184, Brats313, GanBrats, GanBratsFromFolder, label_mapping from matplotlib import pyplot as plt modalities = ('T1', 'T1CE', 'T2', 'FLAIR') label_colors = {'background': 'k', 'necrotic_non_enhancing_tumor_core': 'b', ...
840f906e3d3efa2a121270d12b9d16ca34a68dd80ed56d7c368fe5f5b4968b1f
Python
5,937
171
import torch import numpy as np from . import EnvironmentPipeline def select_multinomial(pipeline: EnvironmentPipeline, **kwargs) -> int: # language=rst """ Selects an action probabilistically based on spiking activity from a network layer. :param pipeline: EnvironmentPipeline with environment that ...
e6300a223e66cab80cc88cddf021fd049cf394856ec52a93377e8cd322cc9860
Python
5,938
119
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " from mpi4py import MPI import os import json import time import numpy as np from nest_el...
e8d82287513a78d7efe00eed0967e1df12cad74be07e6c61ce09d15eb34887e6
Python
5,939
147
from typing import Optional import config import numpy as np import torch from matplotlib import pyplot as plt from tqdm import tqdm from data.dataset import Brats2021Test, MrSliceDataset, label_mapping from data.transforms import get_transforms from data.utils import plot_img_and_target from learning.metrics import ...
906bb876b5a08b9608c2bdf04fbc0541b6c803c898536e56f24c515392199e02
Python
5,942
169
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import torch import torch.nn.functional as F from torch.nn import Linear, Sequential, ReLU, BatchNorm1d as BN from torch_geometric.nn import GINConv, GCNConv, global_mean_pool, JumpingKnowledge, global_max_pool, global_add_pool from dig....
25c23f584c79d23becc68354fe38b50cbc9bd0538c04f93414ac63ad46542ac0
Python
5,943
160
import os import torch import numpy as np import pandas as pd import pickle as cPickle import random from sklearn.utils import shuffle def load_DEAP(data_dir, n_subjects = 26, single_subject = False, load_all = False, only_phys = False, only_EEG = True, label_type = [0, 2]): ## label_type [arousal: 0, valence: 1, ...
571de5e2677133666a4da76acc3e48333f9dd5313bbcd10ec7946ac0b153fc6b
Python
5,946
173
# pylint: disable=protected-access, redefined-outer-name from __future__ import absolute_import import copy import json from pathlib import Path import hypothesis.strategies as st import pytest import snakemake from hypothesis import HealthCheck, assume, example, given, settings from pytest_mock.plugin import MockerF...
ec87deeec0709535def4dc18f93847812b2882d8fbe0c1d4994021b7a4b4a739
Python
5,946
184
import numpy as np from typing import List, Dict, Any, cast, Union from chromadb.utils.results import ( _transform_embeddings, _add_query_fields, _add_get_fields, query_result_to_dfs, get_result_to_df, ) from chromadb.api.types import ( QueryResult, GetResult, ) from numpy.typing import NDAr...
6c27e5404e13c9f2b236e7e7946c2f52afbd577a21f8e86270473ec82178bfb9
Python
5,947
109
import argparse import torch import torch.nn.functional as F from texttable import Texttable import sys from datasets import * from train_eval import run_classification, run_regression from torch_scatter import scatter_mean from model import * parser = argparse.ArgumentParser() parser.add_argument('--dataset', typ...
cb8aed2a9253861ed8cc9170a0ef5c810bb198758a8f530d783cc7e45979fcdd
Python
5,947
163
"""The Mol2Mol sampling module""" __all__ = ["Mol2MolSampler"] from typing import List, Tuple import logging from rdkit import Chem import torch.utils.data as tud from .sampler import Sampler, validate_smiles from . import params from reinvent.models.transformer.core.dataset.dataset import Dataset from reinvent.mode...
574b493d22e9778be9b98cf99d114b5217946d9165911e01cb971b1e47d87356
Python
5,948
162
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
9659c41cc3c7240b845064e2c2109584e9303798ab3e669512c5622268a4a03a
Python
5,948
138
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import torch import torch.nn as nn import torch.nn.functional as F from torch_scatter import scatter from .genet import Readout from dig.auggraph.method.GraphAug.constants import * class GMNConv(nn.Module): def __init__(self, node_...
9c23fca808f478db04bfa122bbd47ec46c3481fbc4677ce8e6030857dfe7ad8f
Python
5,953
167
"""LogNormal Distribution.""" import geomstats.backend as gs from geomstats.geometry.euclidean import CanonicalEuclideanMetric, Euclidean from geomstats.geometry.hermitian_matrices import expmh, powermh from geomstats.geometry.matrices import Matrices, MatricesMetric from geomstats.geometry.spd_matrices import ( S...
b3518224dc1cf0f94fd352b311f4b38ae3dd4effb9cedd6545a30ded36a1719b
Python
5,954
194
# -*- coding: utf-8 -*- import os import argparse import logging import h5py import numpy as np from scipy.special import expit from evaluate_unet_windowed import cm_analysis from sklearn.metrics import roc_curve, roc_auc_score, precision_recall_curve, average_precision_score, confusion_matrix, accuracy_score import...
cd67ac7e6f5a4f8fbea1e3d415fffb3d03ad01eb84912c814fd4b06495f51a4e
Python
5,954
170
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import logging import os import time import concurrent.futures import tests.end_to_end.utils.federation_helper as fh import tests.end_to_end.utils.helper as helper import tests.end_to_end.utils.wf_helper as wf_helper log = lo...
34ce71f565ac0359097be627982987b7417cb51f0e921b32922be824691fe725
Python
5,957
100
"""Independent structure-file audit rejects changed and missing raw inputs.""" import gzip import hashlib import io import tarfile import polars as pl import pytest from vdjdb.validate.structure_files import check_archives, check_links, check_supplemental, verify_inputs def test_streamed_archive_members_and_pinned_...
5ff766c301579f538cd833a4a2c005d19dbe2b0018f7b623e58fa32b87fadde7
Python
5,964
205
"""Module exposing estimator base class.""" from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin from sklearn.metrics import euclidean_distances from sklearn.utils.multiclass import unique_labels from sklearn.utils.validation import check_array, check_is_fitted, check_X_y import geomstats.backend...
a768130bd4fd24eb1698a8073008cc1ee882c6056b1c0fb3409311599494e7c3
Python
5,966
213
import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as dsets import torch.nn.functional as F import numpy as np from torch.autograd import Variable from torch.optim.lr_scheduler import StepLR,MultiStepLR import matplotlib.pyplot as plt import math from sklearn.util...
8bde38645daf040ee491c22a9dd6ad8edaad63265c038b8f1ba462c5758196c1
Python
5,969
166
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Assigner module.""" import logging from functools import wraps logger = logging.getLogger(__name__) class Assigner: r""" The task assigner maintains a list of tasks. Also it decides the policy for which collaborator shou...
bb207a10096ffc9f952a72669c04c3e7ee9e04fb4bf98c51b02764fc1d722c63
Python
5,969
211
import click import procspec from corgie.log import logger as corgie_logger from corgie.boundingcube import get_bcube_from_coords from corgie import scheduling, helpers, stack from corgie.argparsers import ( LAYER_HELP_STR, corgie_optgroup, corgie_option, create_stack_from_spec, ) class MultiSectionCo...
ae7f3ed3310fdba2e92f125d8d646d9b53eb72135c9d66d6104198195d051137
Python
5,976
205
from unittest.mock import MagicMock import unittest from sleepy.test.core import TestBase import numpy as np class NavigatorTest(unittest.TestCase): def standardScenario(points): """Set up a standard scenario for mocking. """ settings = TestBase.getSettings() dataS...
685b94cfce89e5172e7bf0de386d693c1aa4a901c94ad6ab95b53d6c00a9bb0e
Python
5,977
150
""" Makes a data set in klepto files with MEL frequencies from the TIMIT speech corpus""" #"""https://github.com/philipperemy/timit core test set"""# ''' the preprocessing code refers to the work(Yin, B., Corradi, F. & Bohté, S. M. Accurate and efficient time-domain classification with adaptive spiking recurrent neural...
3e7d5dbb76396fb68ffd602a98536b256aa76066e05f46ede26bc6918bd6b964
Python
5,978
205
import torch as T import torch.nn as nn from Networks.network import Network from monai.networks.nets.unet import UNet class UNet_student(Network): def __init__(self): super(UNet_student, self).__init__() #self._build() self.model = T.nn.Sequential(UNet(3, 1, 1, (32, 64, 128, 256), (2, 2, 2...
52ff1362485ce28c6f83a9346dd1fd30c0eb0c97983a6ec4b52feb12e818dcbc
Python
5,987
168
""" Unit tests to test data loaders. These primarily check that the data loaders return values with expected shapes and ranges. """ import unittest import numpy as np import torch from foldingdiff import datasets, utils class TestCathCanonical(unittest.TestCase): """ Tests for the cath canonical angles dat...
92dab9a68be59c594d85e661db2154324c28571ee46c160dbd8d17ccd1ccd57c
Python
5,987
247
import pickle as pk import os import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import numpy as np import sys def check_create_save_dir(save_dir): if not os.path.exists(save_dir): os.makedirs(save_dir) else: print( 'SAVE DIRECTORY ALREADY EXISTS, TERMINATE P...