sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6778996753ba83fd28a62975857ba826446b1d040fc3c400bbc2190d59be8e1c
Python
7,759
224
import functools import torch.nn as nn from utils.pyt_utils import load_model __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3,...
65a2f27b0cd3386c097d4345f93f8d1163a8da66f10cddc859398242f9f02f7f
Python
7,760
237
"""Functions for matching the speaker turns in Kaldi CTMs and segments files.""" import csv from typing import List from typing import Optional from typing import Tuple import pandas as pd class KaldiFile: """Kaldi file template for loading different Kaldi files.""" def __init__(self, filename: str) -> None...
f04d5551c957069156e91c7042d1017d8936fc97053ee9adac7593e7ff356e30
Python
7,760
197
""" This file contains specific functions for computing losses on the FCOS file """ import torch from torch.nn import functional as F from torch import nn from maskrcnn_benchmark.layers import IOULoss from maskrcnn_benchmark.layers import SigmoidFocalLoss from maskrcnn_benchmark.modeling.matcher import Matcher from m...
9524514ec5aeba9b34592b7fef58020c7dcd7f9ab52d9ce507fe5da48d8367bb
Python
7,761
253
# -*- coding: utf-8 -*- """ Created on Wed Jul 14 15:56:15 2021 @author: zhang.9325 """ import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from keras.preprocessing.image import ImageDataGenerator from keras.callbacks import LearningRateScheduler from keras.optimizers import Adagrad from keras.ut...
852c568c8d332bfa76c3049b8f6643045b54c9a9cb23fead1e6a8d064e592ed6
Python
7,763
177
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" import numpy as np from math import cos, sin from scipy.interpolate import interpn import numpy.matlib from numpy.linalg import solve def rigid_p2matrix(translation, rotation): ''' :param translation: shape (3,) :param rotation: shape (3,) ...
1fc4e8dde5b8e93c2c6e5a1c94d01d45147d6727a50ac07374c2b0e6c3a556ee
Python
7,764
222
from __future__ import print_function, division import csv import functools import json from logging import root import os import random import warnings import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torch.utils.data.dataloader import default_collate from torch.utils.data.sample...
4d85d5e5566f7a248cd6f4b7ce8f2dae807aa62e90442a464feacd115c01847c
Python
7,765
184
from scipy.signal import correlate as cc from scipy.spatial.distance import euclidean from skimage.metrics import mean_squared_error as mse from skimage.metrics import structural_similarity as ssim from medpy.metric.binary import dc, hd95 import numpy as np import pandas as pd import os from ddmr.utils.constants import...
e75382e61b2d3f951343fa70bfed174e97c17fe0a76a54f3708d05e2f682093c
Python
7,766
167
""" Data reader for AllenNLP """ from typing import Dict, List import json import logging import torch from allennlp.data import Field from overrides import overrides from allennlp.common import Params from allennlp.common.file_utils import cached_path from allennlp.data.dataset_readers.dataset_reader import Dataset...
76ef39e706ad8469cb63ac0d6ccaaa4dcab59e110dfaa3f3accce9d1d55f82d9
Python
7,768
225
"""Brain viewer""" from __future__ import print_function # Import libraries import math import os import os.path from pathlib import Path import nibabel as nib import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib.patches as patches matplotlib.use('Qt5...
f4911522e16a4bbf45a8a5eaf73c9b16ac83fbc9b2efbdc7a170f37894090050
Python
7,769
193
import tqdm import ipdb import argparse, sys; sys.path.append('../..') import random as rand import torch from metrics import * from graphxai.explainers import * from graphxai.datasets import load_ShapeGGen from graphxai.datasets.shape_graph import ShapeGGen from graphxai.gnn_models.node_classification.testing import ...
38b785f047dd365d5cc68192fd1c6009c254b620d719245cff919318e62a1d89
Python
7,772
225
"""Brain viewer""" from __future__ import print_function # Import libraries import math import os import os.path from pathlib import Path import nibabel as nib import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib.patches as patches matplotlib.use('Qt5...
c1e3d1af1ce1078a5b230228798ef37f5489a6d3a36b2b435053f6d824be280f
Python
7,773
220
# redminehelper: Redmine helper extension for Mercurial # # Copyright 2010 Alessio Franceschelli (alefranz.net) # Copyright 2010-2011 Yuya Nishihara <yuya@tcha.org> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. """helper commands...
a96f00ebbbb1ed81e75c60742948f372c08fd387aeba2a438a9c6c69869dab04
Python
7,779
216
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=True): ...
70390898c37696a74a124537163b79c76709a9cd25f5294c03587946825646ed
Python
7,780
208
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from maskrcnn_benchmark.modeling.box_coder import BoxCoder from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.boxlist_ops import cat_boxlist from maskrcnn_benchmark.structures.boxlist_ops...
3da6039b975d35d22308c75dc93fc175b31f40535d5ecc26a1a4b358b9747b1f
Python
7,781
192
import os import time import logging ## Plot import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.colors as colors from matplotlib.backends.backend_pdf import PdfPages import seaborn as sns import numpy as np import pandas as pd def calculate_vmax_vmin(X, cut...
6d76f298d27d9cbbbd58ce1393ff46730962548ed518ee813af51880480845e4
Python
7,788
205
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
89bcbeb1ff1956bf942c16468097603d9de26f3e81ff86ffb4c07771cbae6bdc
Python
7,792
209
"""Bearer-token authentication. * Tokens look like ``cc_<id>_<secret>``; only ``sha256(secret)`` is stored in ``<state>/tokens.json`` together with the public ``id`` and a label. * Verification is a dictionary lookup on ``id`` plus a constant-time compare of the digest, so timing does not leak which ids exist. * T...
b03635f584268ea17ff9d46981182c6ba5609bbec6bad6de743908bc6e0130d7
Python
7,793
249
import argparse import os import itertools import torch import torch.nn as nn import random import numpy as np import clip from tqdm import tqdm from dataset.celebahq import CelebAHQ from dataset.cub import CUBZeroShotText from torchvision import transforms class Trainer: def __init__(self, args): self....
e00713f874d2bdde218ce70295193b6cb471d0c0388e96add963f31dae498387
Python
7,793
169
# Code modified from https://github.com/FabianFuchsML/se3-transformer-public # @inproceedings{fuchs2020se3transformers, # title={SE(3)-Transformers: 3D Roto-Translation Equivariant Attention Networks}, # author={Fabian B. Fuchs and Daniel E. Worrall and Volker Fischer and Max Welling}, # year={2020}, # book...
e065bcd5ca18790a74d8d279e049d2aaf86becbd1019ad9b960835fd1668fa8c
Python
7,794
223
import csv import json import random from collections import defaultdict import numpy as np from pycocotools.coco import COCO from sklearn.decomposition import PCA from sklearn.metrics.pairwise import cosine_similarity data_type = "val2014" annotation_path = "data/preprocess/annotations/instances_{}.json".format(data...
88c14d26c4d25bcbf2850d3bfdcd2508fe2040beb693e47c0f5345524bd23b25
Python
7,795
190
import warnings import torch.nn as nn from ..utils import constant_init, kaiming_init from .activation import build_activation_layer from .conv import build_conv_layer from .norm import build_norm_layer from .padding import build_padding_layer from .registry import PLUGIN_LAYERS @PLUGIN_LAYERS.register_module() cla...
69e3a6d5dfb17f9520b063181b6c265a3fd7c0cb6357b61dbefaa3de24999527
Python
7,797
210
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
c02eb1b0f02ac69b20b64af4ec4186d7d810986751af2f73379da1a4649806cb
Python
7,798
184
import torch import torch.nn.functional as F from torch.utils.data import DataLoader import pytorch_lightning as pl import numpy as np from omegaconf import OmegaConf from cotatron import Cotatron from modules import VCDecoder, SpeakerEncoder, F0_Encoder from datasets import TextMelDataset, text_mel_collate class Sy...
e0e31c7081629182d8a29a6770ff452c848890c3ad86b065d90c271ce84d0687
Python
7,800
191
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse from functools import partial import json import traceback import imlib as im import numpy as np import pylib import tensorflow as tf import tflib as tl import data import models import os ...
316f967ae227f1281392d1406edf107d0d67771846931d63383201456dc85831
Python
7,802
184
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
235ddd0f57fa93a338ab93679eef6f65815caf7d2afb4aff5c85314f24c1da9c
Python
7,803
247
"""Input stimulus object for GIF-like models. @author : Emerson Harkin """ import warnings import numpy as np class ModelStimulus(object): """Container for input to GIF and related models.""" def __init__(self, dt): self.dt = dt self._currentArray = InputArray([], dt) self._condu...
4970fe5534fe15ff6a3e0aab7b477c7327635c1bc91d9b845be80468d1ea6166
Python
7,811
244
# -*- coding: utf-8 -*- # # maggot_models documentation build configuration file, created by # sphinx-quickstart. # # 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. # # All configuration values ...
bb92c9ad566fc6598b8ed3f2ac1686e68c00debdf8059918b0bbd5033bf988a4
Python
7,811
146
import numpy as np from nipype import Workflow, Node, MapNode, IdentityInterface from nipype.interfaces.fsl import FLIRT, Merge, ApplyXFM, ImageMaths import nipype.interfaces.utility as util from qipype.fitting import MPMR2s, MTSat from qipype.commands import B1Minus from qipype.fsl import ApplyXfm4D from qipype.utils ...
b6a703a28ab31cff30df36e535c64c291148638d3c1e7880215564d20ab77424
Python
7,812
220
# Header variables and parameters. import sys import pymesh import os import numpy as np from IPython.core.debugger import set_trace import importlib from scipy.spatial import cKDTree from default_config.masif_opts import masif_opts """ masif_ppi_search_cache_training_data.py: Function to cache all the training data...
d72695a2e325b08494185fdc132308a366ec20f9aeb62ee678998a5a764c1f83
Python
7,816
187
"""Targeted kNN attack.""" import os from tqdm import tqdm import argparse import numpy as np import torch import torch.backends.cudnn as cudnn import torch.distributed as dist from torch.utils.data import DataLoader from torch.utils.data.distributed import DistributedSampler from torch.nn.parallel import Distributed...
327f0fe7b28cb3c1ff82150f4686cba923030494d3dd495a1939318c1e46ec5d
Python
7,818
218
""" properties Created by: Martin Sicho On: 06.06.22, 20:17 """ import re import tqdm import numpy as np from typing import List from rdkit import Chem, DataStructs from rdkit.Chem.QED import qed from rdkit.Chem.GraphDescriptors import BertzCT from rdkit.Chem import Descriptors as desc, Crippen, AllChem, Lipinski f...
2ac4053f526a2b51ec04d61e868348e74c131b9ca916e0452a3470c01cd7d78b
Python
7,819
232
# -*- coding: utf-8 -*- from tensorflow.python.util.deprecation import deprecated from .core import * from .. import _logging as logging import tensorflow as tf __all__ = [ 'LambdaLayer', 'SlimNetsLayer', 'KerasLayer', 'EstimatorLayer', ] class LambdaLayer(Layer): """A layer that takes a user-de...
33ecfa5b9dc79d64bb57a8a4929c2bace7d9e3e662c080b2384ea18faaf35112
Python
7,820
270
#%% import datetime import time from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from giskard.utils import get_paired_inds from graspologic.models import DCSBMEstimator, SBMEstimator from graspologic.utils import binarize, remove_loops from scipy.sta...
e2193823d2563ee59cb377c4b619817dff6052a7a85f6c1fea6f9e76ac9d263a
Python
7,821
200
# Code is copied and adapted from here # https://github.com/ahendriksen/msd_pytorch/blob/master/msd_pytorch/image_dataset.py import numpy as np from pathlib import Path import imageio import random import logging import re import torch from torch.utils.data import Dataset def _natural_sort(l): def key(x): ...
17e522eaa71f8ce11c8e586559404378497c149491c50e450c56481fa605f9ba
Python
7,822
251
import community import markov_clustering as mc import networkx as nx import torch from torch_scatter import scatter_max, scatter_mean from torch_geometric.nn.pool.pool import pool_edge, pool_batch, pool_pos from torch_geometric.nn.pool.consecutive import consecutive_cluster from torch_geometric.data import Batch, Dat...
8a981afe4535682f8a86dda7baa13121b8c28c5acfbc9bd356f9929fa39b97b8
Python
7,822
207
#!/usr/bin/env python3 """ @ Lina Teichmann INPUTS: call from command line with following inputs: -bids_dir OUTPUTS: Calculates and plots noise ceilings based on the 200 repeat images for all sensors and each sensor group NOTES: If it doesn't exist, the script makes a figures folde...
0cfdf6516099b649cc435f453531a9c0696f62cd13fcf53d79fbea40a9e81243
Python
7,823
192
import os from os.path import join import collections import numpy as np import pandas as pd from itertools import chain from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer, MissingIndicator from sklearn.pipeline import make_union, Pipeline from sklearn.ensemble import RandomF...
5ea091d4c541eb6d7f5ad6ec719c7b1b87a54c2d8646c3d03a1d442dfeec9d17
Python
7,831
147
# Copyright (c) 2016, Konstantinos Kamnitsas # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the BSD license. See the accompanying LICENSE file # or read the terms at https://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_im...
1037e311de16a0a09e665f49b31582b1709ff23b488d48e7570342c622eb4159
Python
7,833
195
import os from tqdm import tqdm from rdkit import Chem from rdkit import Chem import torch from torch_geometric.data import Data import networkx as nx from scipy.spatial import distance from scipy.sparse import coo_matrix import numpy as np from .atom_features import get_available_features_generators,...
e2e40c17e61ced56e05859ac48fd96a3d8b9a4c0664d152a513132a25be1136a
Python
7,836
309
# %% [markdown] # ## import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from graspy.simulations import sbm from src.data import load_metagraph from src.graph import preprocess from src.hierarchy import signal_flow from src.io import savefig from src.traverse import ...
56fd1db9cf4c564afdfb48d7b5ba1c548b162551a3ae57348f3f340e299825b4
Python
7,839
175
""" The Trainer class prepares and launches training of a model. Most importantly, it compiles the tf.keras Model object with according to the specified optimizer, loss and metrics and implements the .fit method for training the model given a set of parameters and (non-initialized) callbacks. """ import logging import...
d489fbe14fc3f7e816e8268feb7a4c611bf5f4d34589db151d20737389dc2599
Python
7,840
193
import os from os.path import join import collections import numpy as np import pandas as pd from itertools import chain from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer, MissingIndicator from sklearn.pipeline import make_union, Pipeline from sklearn.ensemble import RandomF...
15fdee87ec4403cc4e1318998ac429d5d1c25e8a8b199baaf8725fcff76011f9
Python
7,841
228
import argparse from datetime import datetime, timedelta import re import sys from bruker2nifti.converter import Bruker2Nifti import bruker2nifti._utils as utils from bruker2nifti._metadata import BrukerMetadata def main(): """ Parser from terminal with: $ python2 bruker2nifti -h $ python2 bruker2nif...
51ee93d47fea63421a387f0cd568d7cf559a5f1b9c11e70366af44619dbc15a9
Python
7,844
200
import logging from collections import defaultdict from dataclasses import dataclass from io import TextIOWrapper from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Type from sssom_schema import Mapping from oaklib.datamodels.obograph import Node from oaklib.datamodels.search import Se...
d10ed62f412a572d73f35a36c44523f14528ec1ded290ebaa73aea783799354e
Python
7,844
194
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
15f301726bfdba7e2f2235de538e6316adaa9861a78c5cd04ad4e6217f76d94d
Python
7,845
247
################################## # # # Last modified 2017/11/08 # # # # Georgi Marinov # # # ################################## import sys import os # try: # import psyco # psyco.full() # except: #...
3086dbbdf094ee99b4edccf9695e86aebce1d8ddbe53dec4eb57508321aa0717
Python
7,845
252
from __future__ import absolute_import, division, print_function, unicode_literals import copy import json import logging from collections import OrderedDict from . import ( fbnet_builder as mbuilder, fbnet_modeldef as modeldef, ) import torch.nn as nn from maskrcnn_benchmark.modeling import registry from mas...
fcdbb9ba17e2b4b6ef4d840df9c33771049c0df5831bcde94cf344018e2c3e3f
Python
7,845
194
from itertools import combinations import numpy as np import torch def pdist(vectors): distance_matrix = -2 * vectors.mm(torch.t(vectors)) + vectors.pow(2).sum(dim=1).view(1, -1) + vectors.pow(2).sum( dim=1).view(-1, 1) return distance_matrix class PairSelector: """ Implementation should re...
1532c2e93cb132d670214c23a2a922c45f855eb4a002726cef761e4101d58f2f
Python
7,849
215
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import torch import torch.nn as nn class InstanceNorm(nn.Module): def __init__(self, epsilon=1e-8): """ @notice: avoid...
00359f024235b70be31ea8cb13454eb8be0670bb0efdda482b3907473759f1aa
Python
7,850
208
import torch import torch.nn as nn import torchvision.models as models import torch.nn.functional as F from torchvision import transforms from torch.nn.utils.rnn import pack_padded_sequence from torch.nn.utils.rnn import pad_packed_sequence import operator from queue import PriorityQueue import itertools counter = i...
1b5628818005be2fc9db6f15f143962b4c8687bc150f2a36fb9e05cce18a6d68
Python
7,850
203
#!/usr/bin/env python3 """ @ Lina Teichmann INPUTS: call from command line with following inputs: -bids_dir OUTPUTS: Using the MEG data to predict univariate fMRI activation in two ROIs NOTES: The plot was made in matlab so it looks the same as the decoding plots (see Step3bb) ...
439b2930376e9d641b8df3f218acb72706f7975b959ed67857e04da339629e71
Python
7,851
197
import numpy as np import torch import torch_geometric.transforms as T import torch.nn.functional as F from torch.autograd import Variable from torch_geometric.nn import GCNConv, GAE, VGAE from torch_geometric.nn import GATConv, GATv2Conv from torch_geometric.nn import ResGatedGraphConv, TransformerConv class GCN_poo...
b2e350cd87d66294986084a0f797bb89876a8219955bbfb66731e3ab405ff482
Python
7,852
220
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module containing useful metric functions. Created on Mon Nov 12 09:37:00 2018 @author: nicolas """ import numpy as np from skimage import measure #%% Metrics for ROI binary detection def loss_mae(predictions, targets, reduction='mean'): """ Compute the (M...
5df542a9377b0211d52da4565fb2ec5ee1eb5f75736cfd9e8253737c4784b003
Python
7,853
225
#%% import datetime import os import time import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from graspologic.match import graph_match from src.data import join_node_meta, load_maggot_graph from src.io import savefig from src.visualization import adjplot, set_theme from tqdm i...
17ce115e1877ea5a6c0d36a32c247afdadf1082dca4e10021cca98ca6a32a30d
Python
7,854
203
# Copyright 2020 Google Research. 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 applicable law...
0b336b609448a3f8489d715ad335d092ce50ff333a485e77dd2a74adb7ca1fdc
Python
7,855
231
#!/usr/bin/env python3 """ File: compare_inter_matrices.py Created: 2020/04/06 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Softwar...
35d4af320c4baf64ba73733c25388b59f04412691a9dcff32077a5a7a2997295
Python
7,855
251
import logging import os from pathlib import Path from typing import Union, List import torch from torch.utils.data import DataLoader from .pt_dataset import PTDataset from .web_utils import download_from_zenodo_record from neuralop.utils import get_project_root logger = logging.Logger(logging.root.level) class D...
cfa5c614ec328dd1d37dfa1e7f3cd623e7f18e7f20b7fade2af6658e05a84bb3
Python
7,856
224
from pathlib import Path from typing import Literal, List import yaml import torch from the_well.data import WellDataset from the_well.utils.download import well_download from ..transforms.normalizers import UnitGaussianNormalizer from ..transforms.the_well_data_processors import TheWellDataProcessor class TheWel...
4ca634253e527c476ae5b4b2bf4316843d7d22482bdb0c7cf3fe7b48980d06b5
Python
7,857
159
from drugex.training.scorers.predictors import Predictor from rdkit import Chem from sklearn.preprocessing import MinMaxScaler as Scaler from sklearn.model_selection import StratifiedKFold, KFold from drugex.logs import logger class QSARDataset: """ This class is used to prepare the dataset for QSAR model ...
124483917e06b9940c9913794d2930fd77141af4d83ae1949c922cce3c4a6c54
Python
7,859
149
# Copyright 2021-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
7045746bbae06ae36ac6939c966a228a3318802263ff68d267b3f513724431b6
Python
7,860
195
import os from os.path import join import collections import numpy as np import pandas as pd from itertools import chain from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer, MissingIndicator from sklearn.pipeline import make_union, Pipeline from sklearn.ensemble import RandomF...
23ccb216ab5b0c0993da789b012cac3b76845284f98f91417e2cfc2696517def
Python
7,862
225
import os import random import multiprocessing import pickle import collections import numpy as np import torch from openeye import oechem from openeye import oegrid from openeye import oezap from openeye import oespicoli try: from base import VISCOSITY_KEY, ENTITY_KEY except Exception as e: from .base impor...
9c0830ca856a1a2dbe4ea5ef8f0b8110746317f9bfcad47ae5724b0af1ff664b
Python
7,865
210
import numpy as np from scipy.optimize import minimize from functools import partial from scipy.special import erf, erfcx, erfinv def erf_times_gauss(X): return erfcx(X / np.sqrt(2)) * np.sqrt(np.pi / 2) def log_erf_times_gauss(X): m = np.zeros(X.shape) tmp = X < 6 m[tmp] = (0.5 * X[tmp]**2 + np.log...
e3e2ab0bcce1c4ea6c311114fbb6c369ea0537f187077d72e24c33bdf45302d3
Python
7,865
186
""" HMM: Training ============= This tutorial covers how to train an HMM. We will use MEG data in this tutorial, however, this can easily be substituted with fMRI data. """ #%% # Getting the Data # ^^^^^^^^^^^^^^^^ # We will use resting-state MEG data that has already been source reconstructed and prepared. This data...
4affb4466747aa0ae7c078643de3f54fbcc471f5c2ccbd18fb3fddfa9fb98e03
Python
7,870
182
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
a331baa9031d798415659dc4791edcb89a6376f67668aaed74aa8e374d629646
Python
7,871
222
import torch import numpy as np import networkx as nx import torch_geometric.utils as pyg_utils def to_networkx_conv(data, node_attrs=None, edge_attrs=None, to_undirected=False, remove_self_loops=False, get_map = False): r"""Converts a :class:`torch_geometric.data.Data` instance to a :obj:`net...
2fbb04afda356e31137f749cdcd31df0ce35b5d414776d44be6fc0e0afcc9829
Python
7,873
191
import roboscientist.equation.operators as rs_operators from collections import deque import numpy as np import sympy as sp class ConstantsCountError(Exception): pass class InvalidEquationError(Exception): pass class Equation: def __init__(self, prefix_list): self._prefix_list = prefix_list ...
3693f14ece0a02e2f68d2ef452099d72b6bd8750956df7910b591d9de89a7bca
Python
7,874
199
# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
bbf73e3c4cfd4eb16fccd7c20d7137c951cb28a7e269628912cd923e16c4620b
Python
7,875
194
import os from os.path import join import collections import numpy as np import pandas as pd from itertools import chain from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer, MissingIndicator from sklearn.pipeline import make_union, Pipeline from sklearn.ensemble import RandomF...
c97a9b7ab837f85f9adac3d5b30d7a1392bccbf053522bf868e8483933e866b9
Python
7,875
218
import os import re import torch import random import librosa import numpy as np from pysptk import sptk from torch.utils.data import Dataset from collections import Counter from .text import Language from .text.cmudict import CMUDict from modules.mel import mel_spectrogram class TextMelDataset(Dataset): def __i...
1e1786df5ba754106766bc6a78fd3528de10fc7d5bf1d14211d1b354d39ffc3f
Python
7,879
248
import os import shutil import numpy as np import pandas as pd import matplotlib.pyplot as plt from constants.constants import * from constants.enumerates import DataTypes def create_tree_dir(tree_levels: dict = None, clean: bool = False, plots: bool = False, output_dir: str = DIR_OUTPUT_NAME): ...
5c615956e5cab47bbf66c03232b6ec5895ad427556ffff2ee3f3d6f1e7c37796
Python
7,879
185
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" from math import cos, sin import numpy as np import numpy.matlib from numpy.linalg import solve from scipy.interpolate import interpn def rigid_p2matrix(translation, rotation): ''' :param translation: shape (3,) :param rotation: shape (3,)...
7078a0e2f82db9896392117b85aef811048e903eda2133b742531bcdd880de37
Python
7,879
211
# Built-in import os import shutil from typing import Any # Third-party import brian2 as b2 import numpy as np from brian2.units import ms, second from scipy import io # Local from cxsystem2.core.tools import load_from_file, write_to_file __author__ = "Andalibi, V., Hokkanen H., Vanni, S." """ The preliminary versi...
c2f5e831e901d06d9796c453afb108ae800a719b688dcccc0ebe1f743edbbf94
Python
7,880
159
import random as rng from pathlib import Path import cv2 import numpy as np from .saveFilesC import saveFilesC class positiveRandomC: def __init__(self): super().__init__() def positiveRandom(self): acceptance_boolean, overlapping_percentage = ( self.check_if_lesions_and_gland_m...
8bb4682d2430884e1462239463d2dd49eeb0f48951cf2664e80f26298bb2d899
Python
7,882
194
import os from os.path import join import collections import numpy as np import pandas as pd from itertools import chain from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer, MissingIndicator from sklearn.pipeline import make_union, Pipeline from sklearn.ensemble import RandomF...
8cce607e1c5a3420022864411e285a095f1b040b12504975b4510ad41fbebb10
Python
7,882
242
# -*- coding: utf-8 -*- # # SIMA documentation build configuration file, created by # sphinx-quickstart on Tue Jan 28 03:36:31 2014. # # 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. # # All co...
746630fe8286da753f2bf52530d99d7b19d2aab84e226987e69e7cb4b05fb66b
Python
7,883
171
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
bb831c28310edb0d1b8d82cf15b085b62d72818c125975cc25fdf244af2549de
Python
7,884
267
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
3218d116c4dec58820ee2e23351d6a2d4f6f1b1cfcd1720af5dd84d670ee5961
Python
7,886
203
""" File: inter_zscores_bars.py Created: 2020/03/16 Last Changed: 2020/06/03 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, eith...
8fc01bfbf2322532975bc32b062576879d5519d18516a810b9de44a45db08392
Python
7,887
186
"""Targeted point perturbation attack.""" import os from tqdm import tqdm import argparse import numpy as np import torch import torch.backends.cudnn as cudnn import torch.distributed as dist from torch.utils.data import DataLoader from torch.utils.data.distributed import DistributedSampler from torch.nn.parallel imp...
9bc44391c169cdb61429ac381f35f2e41d390a5229f824d26f0e2cb68c2bcd92
Python
7,889
264
#!/usr/bin/env python # coding: utf-8 # In[1]: ##################### IMPORTS ####################### import os import sys from keras.models import model_from_json from matplotlib import pyplot as plt import numpy as np from keras.callbacks import ModelCheckpoint from rdkit.Chem.Draw import IPythonConsole import os,...
e146aa39e059f65e6d002559d8d37d777d4a1485f1fb145e4ad417270cffd0e5
Python
7,890
199
#!/usr/bin/env python3 """Persistent Alpamayo 2 Super inference service for alpamayo_control.py.""" from __future__ import annotations import argparse import json import os import socket import time import traceback from typing import Any import numpy as np from alpamayo_protocol import WireMessage, recv_message, s...
2825ccb6f1bc456ca82c2dd0def6ce1b02b76a54fa7e73865b7aa404eb91ca4d
Python
7,892
203
# Copyright 2020 Google Research. 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 applicable law...
580871f1595b2501551abfe4ce2f79f851335ed84b969edb1593e216eb3aa201
Python
7,892
271
""" The Python implementation of the fast-oopsi algorithm port from the matlab code by jovo: https://github.com/jovo/oopsi @author: liubenyuan <liubenyuan AT gmail DOT com> @date: 2014-04-16 """ import numpy as np import numpy.linalg as lp from scipy.signal import lfilter, detrend from scipy.sparse import spdiags, eye ...
ce10d6064bce1539a6bfe4b925886a929263b0a36e57a08c9a669e6692806a63
Python
7,894
251
"""Deep Q learning (DQN) for optimizing Nanobeam photonic crystals (using OpenAI Gym) #Renjie Li, December 2021, NOEL CUHKSZ. """ import sys import gym import math import random import numpy as np import matplotlib import matplotlib.pyplot as plt from collections import namedtuple, deque from itertools impor...
f4b727ed710c56ede49806c0ccf7e3aa2dae071df5f8a9c3f4a5f8460ff80ea3
Python
7,894
187
"""Discover mushroom-body compartments from connectome wiring alone. The larval MB has ~10 anatomically-defined compartments (Eichler et al. 2017, Saumweber et al. 2018) — each a triplet of (DAN, MBON, shared KC pool) that performs semi-independent associative learning. If the wiring is biologically meaningful, we sh...
0e13b79c8578940a378c36f0b95ba82cb0e23afa67253ed02e9870ced8d961aa
Python
7,901
221
""" Comprehensive tests for starting_conformations module """ import time import numpy as np import pytest from polychrom import starting_conformations class TestGrowCubic: """Tests for grow_cubic function""" def test_grow_cubic_correct_length(self): """Test that grow_cubic produces conformations ...
250e28bc16f120f27f040b12c5352fe9b3121e0735d542045709eaf8f3675150
Python
7,908
223
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
267c8c3ccd5b5ba7cfbbcf9e7428bb5c0481dba084c93c52272d04a0b9bac6c3
Python
7,915
184
# Ranger deep learning optimizer - RAdam + Lookahead + Gradient Centralization, combined into one optimizer. # https://github.com/lessw2020/Ranger-Deep-Learning-Optimizer # and/or # https://github.com/lessw2020/Best-Deep-Learning-Optimizers # Ranger has now been used to capture 12 records on the FastAI leaderboard. ...
b54bab669d22307eaed914d01036360a2d19d240134bed85f0f081efc7f4f1bf
Python
7,920
178
"""Public API and CLI regressions for #813 / #757. Native failures run in bounded subprocesses using the parent's installation. """ from pathlib import Path import subprocess import sys import pytest from conftest import macs3_env, no_core_dumps from test_callvar_cmd import (REF1, GENOME, REFS, DEL, ...
e7ca331b7006df6b6d8897c5dfde08ff64cacf7c631c5afbc30c34da5bd5df7b
Python
7,923
152
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
7d03cf48dc300931ed4973a83bf29b390cf541f3aeb0f3b98552aa24b54063b1
Python
7,924
162
# coding=utf-8 # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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/lice...
4b65181ab179b9ce8054710be71272fb74b507385d68273c6a3dba9be359bfa6
Python
7,927
255
''' Connectivity @YX 1210 Edit ''' import numpy as np import matplotlib.pylab as plt import matplotlib from numpy import linalg as la from scipy import linalg as scpla import scipy # import seaborn as sb from cmath import * from scipy.optimize import fsolve,leastsq,minimize import scipy.integrate from math import tanh,...
923afc4d238b0b5729ca6b869438e656c8429aa48289dd7adea04d691ff00f02
Python
7,928
137
#!/usr/bin/env python3 """Unit test of exposure_calib.py without a server: synthetic CARLA-layer / neural pairs with a known EV offset. A textured road plane (tag Roads, 4..80 m) is rendered on both sides through the sRGB 8-bit encode; the neural side gets cast shadows (-2 EV patches) and real markings (+1.6 EV patche...
82336ba4348b16ce67685f08df83071e5640af9a8fc85018428a592b5ef0dffe
Python
7,930
180
#!/usr/bin/env python3 """ File: create_psychencode_idlinks2.py Created: 2021/10/08 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free So...
638a43bb3448a871eaa58346e484e2e1b59fece6472901997d3b7c38684716a3
Python
7,931
196
#!/usr/bin/env python3 """Read an actor's live telemetry: transform, velocity, acceleration, control. Select the actor (resolve ambiguity with the world-data skill first): --id N | --role hero | --filter '*prius*' | --color 255,0,0 | --nearest --near-id N | --nearest --near X,Y,Z Commands: show ...
44485c98ae47abc5a2c7544d01ab72c80fe33410396b1b269ef0a878c7664d1c
Python
7,932
196
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module containing useful functions/classes for model manipulation with PyTorch. Created on Mon Oct 22 13:54:19 2018 @author: nicolas """ import os, sys, shutil import torch def weights_initialization(model): """Initialize the weights of the given PyTorch model...
cd13d4f3a9980a19052352936b1f929e1c29032f5701f9078ec7c89a48697a7d
Python
7,933
267
# Copyright (c) Open-MMLab. All rights reserved. import functools import itertools import subprocess import warnings from collections import abc from importlib import import_module from inspect import getfullargspec def is_str(x): """Whether the input is an string instance. Note: This method is deprecated si...
d0d8fe00584685d27c370de31344fdcb96204254aa79bab36672084dc3568cf5
Python
7,933
211
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
c2fea9184f036516bfdde47d986297d1af21363d7e2f8cfd4b10809e92478843
Python
7,937
200
from typing import List, Optional import numpy as np import pandas as pd from pydantic import BaseModel from oaklib import BasicOntologyInterface, get_adapter from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.interfaces import OboGraphInterface from oaklib.interfaces.semsim_interface import SemanticS...