sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
aad53c1b3f9985da8a5478977f006d7799fb2b474e65d235823150627463b9da
Python
7,520
127
""" Main function for this repo. """ import argparse import torch,json,os import time from misc import pprint,ensure_path,timer from trainer.pre import PreTrainer from trainer.adapt import AdaptTrainer from trainer.self import SelfTrainer import os.path as osp # dataset_pool = ['BTNx','ACON_Ab','ACON_Ag','DeepBlue_Ag'...
7b8b91e5c6c2ffe6382a08015308816d5f0872e70caa69e264a819ea64412800
Python
7,523
210
import argparse import datetime import json import os import time import tqdm import numpy as np import pandas as pd import torch import torch.nn.functional as F from torch.utils.data import DataLoader from atom3d.datasets import LMDBDataset from model import CNN3D_SMP from data import CNN3D_TransformSMP # Constru...
799dc7f1b84615c288f12d456f49322e0541b48008ff0b7f2efc982f6daadcc8
Python
7,524
112
import numpy as np import pickle from writePredictionResults import writePredictionResults from evaluationCriteria import y2sensitivity, y2confusionMat, printConfusionMat, mathewsCorrelationCoefficient, multiClassMCC from tester import printMetadata def getStatistics(params, testFileIDandClassifierIDs_byMethod, y_test...
fa5c9ae33f1de3dcbb243a3673c94304c2ecbbb6988b4c073159b27fb0ca07bd
Python
7,524
163
import os import sys import stat from os.path import join as pjoin, exists as pexists, realpath import numpy as np import pickle import networkx as nx from neuropredict import run_workflow from pyradigm import MLDataset from graynet import parcellate """#---------------------------------#-----------------------------...
3552e974cc8384f98a2ea97c50a4ca1b112553d6ed718dc37140c8a24bd50e3d
Python
7,526
133
"""Global constants for the GNN project""" from sklearn.preprocessing import OneHotEncoder import numpy as np from torch.nn.functional import l1_loss, mse_loss, huber_loss from torch_geometric.nn import SAGEConv, GATv2Conv from torch.nn import ReLU, Tanh CORDERO = {'Ac': 2.15, 'Al': 1.21, 'Am': 1.80, 'Sb': 1.39, 'Ar...
0b84536d6a0a961b148507cc4ce81908ba5004005515fa418a9b0b9d7ae7c4a7
Python
7,529
145
import os import numpy as np import pandas as pd import scipy.io as sio import nibabel as nib from sklearn.linear_model import Ridge from os.path import join as pjoin from nilearn.glm.first_level import make_first_level_design_matrix from had_utils import save2cifti, roi_mask # define path # make sure the dataset_path...
5f3772372a60adaa88e9f6427e640ed54b2ec2753b926e2843e9da41629ef018
Python
7,529
172
import enum import logging import threading import time import grpc from google.protobuf.empty_pb2 import Empty from minio import Minio from mprl.utility_services.cloud_storage import DEFAULT_LOCAL_SAVE_PATH, connect_storage_client, maybe_download_object from mprl.utility_services.payoff_table import PayoffTable, Pol...
4c5675e7460fd51726c608ae8f1a6908a2d9eb8211902040e90a9c74da1446fd
Python
7,531
205
"""Interface module to dtaidist package. Exposes basic interface, excluding multivariate case. """ __author__ = ["fkiraly"] import numpy as np import pandas as pd from sktime.alignment.base import BaseAligner class AlignerDtwDtai(BaseAligner): """Aligner interface for dtaidistance time warping alignment. ...
1817a617e54b5c7f0e8916d31ed66679bd7a525d574d9cde7f76dd195f9b06c8
Python
7,534
223
"""Tests for get intervals in time series forests.""" import numpy as np import pytest from numpy.random import RandomState from sktime.base._panel.forest._tsf import _get_intervals from sktime.tests.test_switch import run_test_module_changed @pytest.mark.skipif( not run_test_module_changed("sktime.base._panel....
cc2e2d6abfd4fcb8f32db226d62cb43efa4a4e27a75f1d23460998ca79ff65ac
Python
7,534
243
import os import copy import time import math import random import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch import torch.nn as nn import torchvision import warnings warnings.filterwarnings('ignore') # hyperparameters train_batch_size = 4 learning_rate_init = 0.0002 num_cycles ...
e965c87bc7e9376cac2d2c52ff73c9de5e0a8c8fba3f5f201f9d6db92fd22058
Python
7,534
179
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # import logging import numpy as np logger = logging.getLogger(__name__) logge...
8f1f07f6dd2098b93ac199fc3bc075f7f131273b8bf61247995d245fb5e36bcb
Python
7,539
250
# Copyright 2019 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
8c9c098efe7a332121b027f93dd7dbfca38fe2605b687902753d77b50ba9e456
Python
7,541
169
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import networkx as nx from plotgiiSurf import plotgiiSurf # plotNetwork3(covMat_yesAD, NetworkDataGeneral.Schaefer400x7.GII, currCoM,LabelNames,cRange,MakerVecYes,panelAll,pSelectCol,colorVec,3) def plotNetwork3Individual(currFi...
61194e69768d16efbad1751997fb26eaad8a83c1fc9244c1c7ba4923780511b3
Python
7,550
274
from __future__ import annotations from dataclasses import dataclass from typing import ClassVar, Callable, Optional, Union, cast import numpy as np from pandas import DataFrame from seaborn._core.groupby import GroupBy from seaborn._core.scales import Scale from seaborn._core.typing import Default default = Default...
9b98351d2a02233a0277eb209b5be6c39fe21098e98527cf412067cdb7488712
Python
7,550
209
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weight_reduce_loss def cross_entropy(pred, label, weight=None, reduction='mean', avg_factor=Non...
efef512ea44b8d466fef4bfad5fe9591f0889b31c6c32ceb6a20feb2287e5b4c
Python
7,554
171
""" @file: dataset_loader.py Created on 22.10.18 @project: crazy_ara_refactor @author: queensgambit Please describe what the content of this file is about """ import glob import logging import numpy as np import zarr from DeepCrazyhouse.configs.main_config import main_config from DeepCrazyhouse.src.domain.util import ...
fe38c17fc1ca6af65d14f4f3be5c9216a0c85df5925ffac31cd6e7ba4acd6551
Python
7,558
227
import numpy as np import pandas as pd import tensorflow as tf from keras.losses import mse from keras.preprocessing.text import Tokenizer import sys import importlib config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else "" config = importlib.import_module(config_path+"config") attention_set...
332ea0702e9cadbaf08035302fa75bf52dcbda4e0f953f1cdf939a9b65b41129
Python
7,562
164
import subprocess import sys import os from pathlib import Path import argparse from nilearn import datasets from nilearn.regions import connected_regions from bcblib.tools.general_utils import open_json from bcblib.tools.nifti_utils import load_nifti def run_command(command): """Run a command in the shell.""" ...
99aedf31d51e0dcd0591a2d6f0a7f17dae445367e944fbdd15adf9490f5df679
Python
7,566
183
import os import sys import random import math import time import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.metrics import auc, precision_score, classification_report, plot_confusion_matrix, f1_score, confusion_matrix from sklearn...
edffa981a11856c1164658264a332a52cf44f1e978634b44130574d33e8ca736
Python
7,568
174
# -*- coding: utf-8 -*- """ Created on Fri Sep 2 12:57:53 2016 @author: wanglab """ from __future__ import division from tools.utils.io import makedir, listdirfull, makedir, removedir, chunkit, writer, load_kwargs from tools.utils.directorydeterminer import directorydeterminer from tools.analysis.network_analysis imp...
691e7b9c54d7b3e33f0140ab02df7b9530e381cf6e3da99f3c3dc27493b5374a
Python
7,573
260
# Mocapy: A parallelized Dynamic Bayesian Network toolkit # # Copyright (C) 2004 Thomas Hamelryck # # This library 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, either version 3 of the # License...
d22eac89f337d21e6c1c637e32cf7da4e4e332166842bf915d1949b05ffa4699
Python
7,573
250
"""Time Series Forest (TSF) classifier base class.""" __author__ = [ "TonyBagnall", "kkoziara", "luiszugasti", "kanand77", "mloning", "Oleksii Kachaiev", ] __all__ = [ "BaseTimeSeriesForest", "_transform", "_get_intervals", "_fit_estimator", ] import math import numpy as np fr...
5d3c88d2feb196fcfc9736d6aa324ec61610cb2d97ce967c6e916557d1b2b3ad
Python
7,574
213
# SPDX-License-Identifier: LGPL-3.0-or-later import logging from collections.abc import ( Iterable, Sized, ) import numpy as np from deepmd.loggers import ( is_node_main_process, ) log = logging.getLogger(__name__) def compute_total_numb_batch( numb_batches: Iterable[int], sampler_weights: np.n...
5dd5cff6bc3276dac1cdb2398ba86337b21e487622cb64fabfc3f81196b7d2b6
Python
7,574
235
#!/usr/bin/env python __doc__ = """ Training. Nicholas Turner <nturner@cs.princeton.edu>, 2017-8 """ import numpy as np import os import time import torch from torch import autograd import utils REQUIRED_PARAMS = ["max_iter","test_intv","test_iter", "avgs_intv","chkpt_intv","expt_dir", ...
d6b11099ec7bda229b4628d9742fb16d89c2e90ef9d7f9460944da8cbf37b57f
Python
7,578
224
# coding=utf-8 # 2021.03 modified (1) notears_linear(def) to Notears(class) # 2021.03 added (1) logging; # (2) BaseLearner # 2021.03 deleted (1) __main__ # Huawei Technologies Co., Ltd. # # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # Copyright (c) Xun Zheng (https...
af3b1b20cb2e8d4a1b0c55d485f149ffbbd3b7224c3f180e21c91c871e2a1657
Python
7,579
190
import os import numpy as np import torch from torch.utils.data import Dataset from torch_geometric.data import Data from torch_geometric.loader import DataLoader as PyGDataLoader from torch_geometric.nn import radius_graph from rdkit import Chem from dataset.utils import ani1x_iter_data_buckets ATOM_DICT = {1: 'H', ...
750cbf61b8f0530758a6e669ee11162e5156e20ee999114b2ee5aa3fd7deaf8f
Python
7,581
196
import gc import os import h5py import numpy as np from rdkit import Chem from openmm.unit import * import torch from torch.utils.data import Dataset from torch_geometric.data import Data from torch_geometric.loader import DataLoader as PyGDataLoader from torch_geometric.nn import radius_graph posScale = 1*bohr/angstr...
d84fe4e824668330dbc4bffc04cb274b5dbb11c975b9122302d89e9ce817b91d
Python
7,581
204
#!/usr/bin/env python """ This script reads in the orthogroups and generates .rbh files for different combinationas of species """ import pandas as pd import numpy as np import os import shutil import sys # Analyze the Orthofinder results OGTSVPATH="./fasta/OrthoFinder/Results_Jul02/Orthogroups/Orthogroups.tsv" sp...
eae576d4936d170b0f70acb1605d890bf1f191cf887eff676e472ff2d0b4a5ae
Python
7,582
172
# -*- coding: utf-8 -*- """ Created on Wed Jun 22 15:50:46 2016 @author: tpisano + bdeverett Two approaches. Typically find_site is the more robust for general CTB injection detection. detect_inj_site has more parameters and might be better tunable for specific approaches """ from __future__ import division import Si...
1cc9636baa45d60be17742987664316c14f4a27de92896396bf8e1b433cdd9f3
Python
7,585
191
""" conflict_dacke.py Simulates the cue conflict paradigm from Dacke et al. (2019). Dacke et al. (2019) test three scenarios, each performs the same cue manipulation but with the sun at high, medium, and low elevations. Dacke et al. (2019) use ranges to determine high, medium, and low, so we take the midpoint of that...
90b067e6265bdd6c66e9ae890dd9f1d538aa1b6985c0fc60f556d9fac84a574f
Python
7,588
219
# Copyright (c) OpenMMLab. All rights reserved. import logging import tempfile import warnings from unittest.mock import MagicMock, patch import mmcv.runner import pytest import torch import torch.nn as nn from mmcv.runner import obj_from_dict from torch.utils.data import DataLoader, Dataset from mmcls.apis import si...
fdc48d0597fb877d9fdc6e21e2db6cd4577514a8405a8b80efcb4ecab3f2a3e6
Python
7,590
190
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
1e5422356ac9471d82b69ce3e0ac7f1da9374a0bc2d7cc174293ec902dd66d33
Python
7,591
225
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Creates across patient plots in Figure 4 from Wang et al. (2023) Temporal stability of intracranial EEG abnormality maps for localizing epileptogenic tissue. Calculates time-varying D_RS from abnormalities before plotting. Gabrielle M. Schroeder CNNP Lab, Newcastle...
ec860e53dcb2e7dc0ae20c2deb7245e3519fa608b61e526de36794b9b598f3fc
Python
7,596
170
import numpy as np class ImageMetaData(): """Container class for metadata about an image. Stores: - nxyz (np.ndarray): image shape - computed from provided image. - dxyz (np.ndarray or scalar): image resolution - if dxyz is a scalar, it is upcast to the length of nxyz. - xyz (np.ndarray): i...
3dffef1472d13efd422490c6e0dcbd009f0214229542337a38e3e5c68c62bd97
Python
7,597
144
"""Registration in the job worker of SlicerWeb: what ElastixLib.web_launcher starts there. This runs in a Python of its own, the worker's, with the same packages as the page and without the application: nothing of slicer or qt is imported here. The elastix of ITK-Wasm, the itkwasm-elastix package, is awaited; the work...
3c628abf2aec53e8cab089a4508681bca500a5ea63a4f8512363b55d2cd99f12
Python
7,599
210
""" make_sound_waveform.py Generate a sound waveform - with different choices of sound. This was taken from model_run2.py, and is a stand-alone version, and the parameters are taken from model_params.py It is used by vcnmodel.plotters.plot_runs and vcnmodel.plotters.plot_sims to show the stimulus waveforms a...
5aa1ae163852f48f5ea0e88604e8208b77d860ca364bdd04812f7907b0bec2df
Python
7,601
229
""" Script to center and crop an MRI based on regions given by the CerebrA atlas. Distributed under MIT License by Clément POIRET. """ import argparse import tempfile from pathlib import Path from shutil import rmtree import ants from rich import print from rich.console import Console from rich.progress import track ...
226a57c7b6cd0dc2f6821d596e69a6154bea1df47a7c655fbe62a2fee5fc9598
Python
7,603
165
from scripts import configurations as cfg from scripts import preprocess from scripts import data_handler as dh from scripts import cross_validation_tl as cv_tl from scripts import ensemble_util from scripts import testing_util from scripts import hyper_parameter_search as hps from scripts import postprocess i...
b7d177c79552889305fe5a286d5c1fafe44c77075b29d161518f661a34d096a2
Python
7,603
210
import csv import logging import math from collections import defaultdict from pathlib import Path from typing import Union import matplotlib.pyplot as plt import numpy as np from matplotlib.axes import Axes # header for 'weights.txt' WEIGHT_NAME = 1 WEIGHT_NUMBER = 2 WEIGHT_VALUE = 3 log = logging.getLogger("flair"...
6efc704cf734c74cd33c4a7d81d4d6f5935a73e0ce69109580da7fa3698f882b
Python
7,608
195
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import ConvModule from torch.nn.modules.batchnorm import _BatchNorm from ..builder import BACKBONES from ..utils import InvertedResidual from .base_backbone import BaseBackbone @BACKBONES.register_module() class MobileNetV3(BaseBackbone): """MobileNet...
74d6e23d39bdf29979cab8ea44958b17bc53744042496ba96982cbc98b0d31da
Python
7,609
208
"""Hidden Markov Model with Gaussian emissions. Please see the original library (https://github.com/hmmlearn/hmmlearn/blob/main/lib/hmmlearn/hmm.py) """ from sktime.detection.hmm_learn import BaseHMMLearn __author__ = ["miraep8"] __all__ = ["GaussianHMM"] class GaussianHMM(BaseHMMLearn): """Hidden Markov Model...
def7bdcde20cab37b27e905d209103d28c561b6b05cb9a23b607f3034cfe642c
Python
7,609
184
""" Test generating a series of EPSPs in a MSO cell in response to tone pip. This test demonstrates how a binaural circuit can be constructed. This script: 1. Creates multiple SGCs (base instance has 3) converging onto two bushy cells. The 2 bushy cells then converge onto one MSO cell 2. Connects the group of sg...
a5360e2fea88334e1c9e47b22eee68ff1067a577415ffa83c3fd7d8c1382d41f
Python
7,610
189
# Copyright 2019 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
8a8c1f6f75a4f6b044bf8816f55d136915441ca73f8d5c5dd37f836c622f641c
Python
7,611
243
from argparse import Namespace import logging import os import os.path as osp from pathlib import Path from typing import List, Optional, Tuple, Union import torch import matplotlib.pyplot as plt import glob import numpy as np def create_model_folder(args: Namespace) -> str: make_dir(args.save_dir) return mak...
8d60b037f00ca48d491b5908cade084ec3bc318f9af338e4bcaaafbfeb866c38
Python
7,619
243
# SPDX-License-Identifier: LGPL-3.0-or-later """Shared infrastructure for the LAMMPS Python tests. Model paths, expected values, and scenario-specific assertions stay in their test modules. This module owns setup that must remain identical across model formats and backends, so changes to the LAMMPS test system have on...
25ee135022dbccfc9642520c505fc675541264d85eda201bee5e96c920174476
Python
7,620
218
from __future__ import annotations import functools import math from typing import TYPE_CHECKING import numpy as np from optuna.pruners import BasePruner from optuna.study._study_direction import StudyDirection from optuna.trial._state import TrialState if TYPE_CHECKING: from collections.abc import KeysView ...
f0ab9a11c3316351c9721a320e84ef53f2c182d14cf12f26c9ea9119126d19bc
Python
7,621
232
#!/usr/bin/env python __doc__ = """ 3D Box class. Box -- two vectors, forming a box Modified the code from https://wiki.python.org/moin/PointsAndRectangles Kisuk Lee <kisuklee@mit.edu>, 2017 """ import math from .vector import Vec3d, minimum, maximum class Box(object): """ A 3D box identified by two vec...
c0b40d6e78d9e2c828f70cb862d956603f9b584c437a741e4f8dd34f6981320b
Python
7,628
182
import logging import os import threading import time from http.server import HTTPServer, SimpleHTTPRequestHandler from pathlib import Path from socket import gethostname import argparse import yaml import pandas as pd import plotly import plotly.express as px from grpc import RpcError from termcolor import colored f...
6a0cc607dfe46cd18b3dcc866bf19ea47721d89985a10b7b43ff42444b89c4fa
Python
7,630
245
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
ecaa8e3e55c4478c94488b26667d9667edbca6f1740be1a84c21eb72c78c56bd
Python
7,631
223
from typing import Dict, Optional, Tuple import numpy as np import pandas as pd import torch from scipy.stats import hmean from sklearn.metrics import classification_report, roc_auc_score from torch.nn.modules.loss import BCELoss from torch.optim.adamw import AdamW from torch.optim.lr_scheduler import OneCycleLR from ...
969aacd8db1a0b599492d10f5a651087f802f5567f7c2a334d7c2a0947c9fd14
Python
7,634
234
#!/usr/bin/env python __doc__ = """ 3D Box class. Box -- two vectors, forming a box Modified the code from https://wiki.python.org/moin/PointsAndRectangles Kisuk Lee <kisuklee@mit.edu>, 2017 """ import math from .vector import * __all__ = ['Box', 'centered_box'] class Box(object): """ A 3D box identif...
d00ec4dbcf02df7d013f370192148bf90f99effca73e791e862dd93588c5c9d0
Python
7,638
181
import torch import torch.nn.functional as F from utils import find_alexnet_layer, find_vgg_layer, find_resnet_layer, find_densenet_layer, find_squeezenet_layer class GradCAM(object): """Calculate GradCAM salinecy map. A simple example: # initialize a model, model_dict and gradcam resnet = ...
f7ca465904a061c9f2393e0d5e805636e21b05b9af1b3bd767846643da886f6a
Python
7,644
220
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
3d160a23d9b8b542d0165776a82ca2e7c2aa7c9027a43942cef9aeab415d4020
Python
7,645
246
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.backbones import ShuffleNetV1 from mmcls.models.backbones.shufflenet_v1 import ShuffleUnit def is_block(modules): """Check if is Re...
b9af5839e9637ac96218f45f239b4985e0be83de65ac9053e143b1743928b7b7
Python
7,646
186
from typing import Any, Optional import pytest import torch from flair.data import Sentence from flair.embeddings import Embeddings from flair.embeddings.base import load_embeddings class BaseEmbeddingsTest: embedding_cls: type[Embeddings[Sentence]] is_token_embedding: bool is_document_embedding: bool ...
cc465ff1c5e09a45db4bf2d76c2b49b6a184f7a5a90e384fe8d03565d6bcbc67
Python
7,651
299
""" OTF Codec """ import json import logging import struct import os from builtins import bytearray from builtins import bytes int_size = 4 END_OF_LIST = -1 LOAD_MSG = b'L' PREDICT_MSG = b'I' RESPONSE = 3 def retrieve_msg(conn): """ Retrieve a message from the socket channel. :param conn: :return...
c11c976c2cfa92bf1ffe9d361c60f0a96064b56afd5bcf669f420711aae3d721
Python
7,655
257
''' Crossover operatons .. codeauthor:: Nicholas Browning ''' from __future__ import division from __future__ import print_function from __future__ import absolute_import from builtins import range from past.utils import old_div import copy import numpy as np from . import Individual def crossover(settings, individu...
a0ae5e5c05a6832e2b11fa60ae96947422fd86be4b3d1256fe0f284ff7fa9d45
Python
7,656
207
# -*- coding: utf-8 -*- """ Created on Thu December 10 11:41:02 2022 @author: Pawan Panwar, Quanpeng Yang, Ashlie Martini PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini This file is part of PyL3dMD. PyL3dMD is free software: you can redistri...
f8ef14fa06e0fad1278d5692968c4689d26ebb109af9ae2791e98ebf23c48768
Python
7,661
212
import face_recognition import cv2 from multiprocessing import Process, Manager, cpu_count, set_start_method import time import numpy import threading import platform # This is a little bit complicated (but fast) example of running face recognition on live video from your webcam. # This example is using multiprocess....
dd7cd8702cceb3e15bf81c712b89305e6e8047fe00cd0e0b645a1f7c9fb12957
Python
7,664
209
from keras.models import load_model import tensorflow as tf from keras.callbacks import EarlyStopping, Callback import warnings import os import numpy as np from keras import backend as K import keras class GetBest(Callback): def __init__(self, filepath=None, monitor='val_loss', save_best=False, verbos...
4d1bebd8fe1a51eb2b20be2d4f872e83b549cd059faa1a96981838dfec827f2e
Python
7,665
226
# Copyright 2019 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
0cd0fdee9632c8dfd66949758059da92c8044c7fb35f540611fea195fc7f452c
Python
7,666
227
# Copyright 2019 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
a66f8a977f8bd651d6f5064d2543c0785bbe3af6b52cab6d1fc72ec389d3be04
Python
7,666
228
from __future__ import print_function import re import os import sys import tempfile import subprocess import multiprocessing import multiprocessing.pool import dxpy def normalize_timedelta(timedelta): """ Given a string like "1w" or "5d", convert it to an integer in seconds. Integers without a suffix are...
52ceff5eb9214a8ac2fb0d8d96b132fa25aa81a9241dd94df09350e63c2284bc
Python
7,671
281
""" Count cluster members contributed by each of two transcriptomes. When Corset is run over reads from two different transcriptome assemblies, a cluster that draws all of its members from a single assembly is a warning sign: the two assemblies' copies of the same gene failed to cross-map and were split into separate ...
e028a414c272da566ef37137c0f83fd3709fd9deb5cdbe46fbda7dd8be92b8e6
Python
7,671
220
import os import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision.transforms import * import math from math import log2 class Mish(torch.nn.Module): def __init__(self): super(Mish, self).__init__() def forward(self, x): retu...
b7402fdbf95d7074090742f87fa453dbb7c028d5fd04dc2980fd7072d47358a6
Python
7,672
277
# Copyright 2026 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
71b573d2bc49904c227e00e3e03df8d288f3ec6264bfdecee9107ffaf7504417
Python
7,674
191
import torch from flair.data import Token, Sentence, DataPair, Span, DataTriple, Image from flair.training_utils import identify_dynamic_embeddings # Helper tensors dynamic_tensor = torch.tensor([1.0, 2.0], requires_grad=True) static_tensor = torch.tensor([3.0, 4.0], requires_grad=False) def test_identify_dynamic_e...
7d8b3d5da58faae13ff2e2969f51f6725288dd0c3e14cda699fe958ffebbaaa1
Python
7,675
197
import math from utilities.solutionFSHT import Solution from utilities.fs_utils import transfer_function from utilities.ht_utils import * import random # all random should be updated by numpy (faster calculation) import copy import numpy as np class SCA: def __init__(self, n, function,tf,nfeatures): ...
345ddddddebfe9c80de82c8f5d8d886e60ba336cb07d2a1d8714f7b9fbf1f240
Python
7,677
184
#======================================================================================================================= # Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller # Computer Vision Studio # Friedrich Miescher Laboratory of the Max Planck Society # Systems Biology of Development, Univer...
0ed6d90332da5b5c32a31544b7e8533e71020a598dda1e82a1ebd8bdafae5e34
Python
7,682
184
""" @file: efficient_scaling.py Created on 30.04.21 @project: CrazyAra @author: queensgambit Grid search for evaluating different depth and channel ratios, as recommended in EfficientNet by Tan et al. - https://arxiv.org/abs/1905.11946v5 """ from __future__ import print_function import os import sys sys.path.insert(0...
bed0053a2c93d6b1156b8613f25a779b0eef5ef805f7bd36fc23f377ebb17571
Python
7,689
182
from tensorflow import keras def cnn_deep(input_shape, output_shape, activation='relu', num_filters=24, first_layer_kernel_size=19, initializer='he_normal'): l2 = keras.regularizers.l2(1e-6) # input layer inputs = keras.layers.Input(shape=input_shape) # layer 1 nn = keras.layers.Conv...
fd53cb10f5a7831946d4e7ae506a25f6141426a2b4d0ef5ec0ecab8581252b02
Python
7,689
200
import unittest from pathlib import Path import rdflib from pyontutils.core import yield_recursive from pyontutils.identity_bnode import bnodes, IdentityBNode from .common import temp_path class TestIBNode(unittest.TestCase): def setUp(self): self.graph1 = rdflib.Graph() file = Path('ttlser/test/n...
de1c31ac10dfd033770b65de22a2f058156200e583f9986d41e9dabfbcf87fc2
Python
7,694
227
import slideio import numpy as np import matplotlib.pyplot as plt import cv2 import xml.etree.ElementTree as ET import Switches_Static as st_switches CNTR_ENH = st_switches.contrast_enhancement def histogram_equalization(img_in): channels= cv2.split(img_in) channels_=[] clahe = cv2.createCLAHE(clipLimit=C...
7746a0b4faeb991e8c322b51ea0ad6eba1a97f5b3b8bb443434f347e2a0fbb82
Python
7,700
203
# -*- coding: utf-8 -*- """ Created on Thu December 10 11:41:02 2022 @author: Pawan Panwar, Quanpeng Yang, Ashlie Martini PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini This file is part of PyL3dMD. PyL3dMD is free software: you ...
d690277725ba35a328fe3e13ec15402771050a2838d1a3ca75457c83906882b3
Python
7,702
265
import numpy as np from .utils import logger, verbose import time ''' Module: anlffr.bootstrap functions to aid random resampling when using anlffr.spectral functions note: these aren't particularly clever or efficient; but if you're going to resample, you might as well do it in parallel. Function Listing ========...
4d997b26238c5b3825afa77ea7c1ea7bac771d1a931735b25b71e3eaafacde8f
Python
7,704
161
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright © 2013 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://www.mozilla.org/MPL/2.0/. # """Generate and convert ...
be1cb0dc8265d78e06e04aca36a47544146dc3b48b23979d8baa99294e76bc02
Python
7,705
227
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
1464483750f2929415a33ce4c150609224933c8852017632118eba9cd4f155b3
Python
7,707
258
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import matplotlib.pyplot as plt import numpy as np import os import random import shutil from sklearn.utils import shuffle # In[2]: #read meta data files that stored in csv files from the previous stage. # random state = 5 will allow you a rea...
834d92490b68612b8b14408a0a26880ee91db4c38c24f10f6393371579e458c1
Python
7,707
182
from typing import Callable, List, Set, Union, Optional, Tuple import numpy as np import logging from .dataset import JetDataset from .utils import ( checkConvertElements, checkDownloadZenodoDataset, getOrderedFeatures, checkStrToList, checkListNotEmpty, ) from .normalisations import NormaliseABC...
a0b32326536f3a4ee9ea7ad78514393d540a6481cc598c17abb37b701dbed00d
Python
7,707
183
import argparse import logging import os import sys import torch from model import TextSentiment from torch.utils.data import DataLoader from torch.utils.data.dataset import random_split from torchtext.datasets import text_classification def generate_batch(batch): r""" Since the text entries have different le...
6b4f3771d2448f2be96b9a5fe4b0b444439718443deef1e9c669fbf871187bde
Python
7,723
205
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 19 22:36:46 2022 Plotting correlations between measures. Figures 7 & 8. @author: nagehan """ import scipy import scipy.stats import matplotlib.pyplot as plt import numpy as np import matplotlib s = np.array([0.59, 1.44, 1.74, 2.40, 2.32, 2.41, 2....
1c3c1890f260e5c783b1a12d24677c446e331300c4e012200bcde3dc9b37f6e4
Python
7,726
168
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Nov 19 15:42:12 2018 @author: wanglab """ import os, sys, shutil import argparse from utils.preprocessing.preprocess import get_dims_from_folder, make_indices, make_memmap_from_tiff_list, generate_patch, reconstruct_memmap_array_from_tif_dir from ut...
62cdb36916eb954f47f55241d30e71d20928a58ea3b828cc53933780cfb6b7ad
Python
7,728
163
# Copyright 2019 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
5f48b9b19c8cd1f70f07edee645fe9465198ed2b56d010b8a6db36377c6401e2
Python
7,729
227
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
4ac001d8039110094a57f7a619aee7b0854a93f3a6271fc103ace9c11a3ae2d0
Python
7,734
258
"""Reading and writing FASTA files. Copyright (c) 2022 by Andrzej Zielezinski (a.zielezinski@gmail.com) Maciej Michalczyk (mccv99@gmail.com) https://github.com/aziele/fasta-parser """ import bz2 # standard python library import gzip # standard python library import io # standard python library import...
9b31df0af3e90a5138ff126a1171f94c0844ad8ab08d7fca84ef246a78ed37a8
Python
7,744
204
""" This is code to generate stimuli of the desired length For ophys type sessions, unexpected sequences or violations are included. These are every 30-90 seconds, and last 2-4 seconds for the visual flow, and 3-6 seconds for the Gabors. For hab type sessions, no unexpected sequences or violations occur. Everything ...
f4058a4599333dde92fe64751e2cff5bc2dd1d553aab694656846bded2331dcb
Python
7,747
258
"""Isolated numba imports for lower_bounding.""" __author__ = ["chrisholder", "TonyBagnall"] import math import numpy as np from sktime.utils.numba.njit import njit @njit(cache=True) def create_shape_on_matrix( bounding_matrix: np.ndarray, y_upper_line: np.ndarray, y_lower_line: np.ndarray | None = No...
d067e3ca8f33afe8e69bfafe21bd3a07e98ea39f0052653572d98482d46dc0f9
Python
7,748
175
""" - For plotting figure 6. Box plot of surface area, sulcal depth, and cortical thickness """ def t_sd_box(input_txt, subjects_name, output_folder, max_t, min_t): import matplotlib.pyplot as plt import numpy as np import seaborn as sns import os import scipy.stats as stats path = os...
a45d50857f57bf467068dac0a9ce4a6503f01c2b2928e72d53a356c0ad26f8a2
Python
7,755
173
from itertools import combinations, product from .combinations import SystemCombination import numpy as np def performance_anhilation(system, substitutions, bonds): accepted = [SystemCombination(system, None, None, None)] for elem_old, elem_new, numb in substitutions: comb_lst = [[] for i in range(num...
12633cee6973f43c892842663cfd3b46445848af6c6431ae2b1f53c5a97784b3
Python
7,756
211
"""Hidden Markov Model with Gaussian mixture emissions. Please see the original library (https://github.com/hmmlearn/hmmlearn/blob/main/lib/hmmlearn/hmm.py) """ from sktime.detection.hmm_learn import BaseHMMLearn __author__ = ["miraep8"] __all__ = ["GMMHMM"] class GMMHMM(BaseHMMLearn): """Hidden Markov Model w...
e23e9bf11d45c22c65aaafa1e9a0cb3f7a5a5e027486fef57a65a47f95081757
Python
7,760
207
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
141cce5b964ec2b6e6133560f72a2d3af0422406b1c86ec8428b7713c8f33f32
Python
7,764
217
import torch import torch.nn as nn from torch import Tensor from torch.nn.parameter import Parameter from spikingjelly.clock_driven import neuron, layer from .blocks import SeparableSEWResBlock ############### ### SCALING ### ############### class MultiplyBy(nn.Module): def __init__(self, scale_value: floa...
4bc6df1642c01d25e03ab5a352b8068e833c216815f2aeb0ba3035fbc364eae6
Python
7,766
173
#------------------------------------------------------------------------------ # elftools tests # # Kyle Zeng (zengyhkyle@asu.edu) # This code is in the public domain #------------------------------------------------------------------------------ import os import unittest from elftools.elf.elffile import ELFFile from...
d521707fb8fe9358b6bc18fab8ea9168ffbd7a4e8b5cfc7f3599ade540aa9728
Python
7,767
187
""" This script will perform a tree walk through the AWS VGP species directory and through projects on DNAnexus and compare contents to ensure symlinks are created for all files. """ import boto3 import dxpy import argparse import os VGP_BUCKET = "genomeark" SHARE_WITH = "org-vgp" def locate_or_create_dx_drive(drive...
707f8c7177f1eb6a9d1a8c18c329799fd7d84a16ae3ed4fabb35da66e45aa46f
Python
7,769
227
"""Test suite for lower bounding techniques.""" import numpy as np import pandas as pd import pytest from sktime.dists_kernels._numba_distances.lower_bounding import LowerBounding from sktime.dists_kernels._numba_distances.tests._utils import ( create_test_distance_numpy, ) from sktime.tests.test_switch import ru...
16e20efc80643df025d19ea0e1edcbaeb1a948332428bd42d788eae2b5b05e89
Python
7,772
261
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 30 21:34:56 2022 @author: sam """ import h5py import numpy as np import matplotlib.pyplot as plt import glob from natsort import natsorted from scipy import stats import os import matplotlib.pyplot import matplotlib.dates import datetime import mat...
04f86881a05b0cd76b7565b806f68c765a3e4e915dc01c0eef026141b698d4a2
Python
7,773
225
# Copyright 2018 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
b68b19a5132053f018895b3494f975c0f502a2bd780d6c32d014fcf5d93b0ea5
Python
7,777
214
""" Model (implemented in Pytorch Lightning) demonstrating how to use augmentations during training. """ import torch import lightning.pytorch as pl import numpy as np class RobustModel(pl.LightningModule): """PyTorch Lightning module to specify how augmentation should be applied to a model. Parameters ...
482cdcbfd6146bdf3591c92fd6e8fc1678f06d1d688afaf0091a1ad3971c8f1d
Python
7,780
186
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
861752552a8d3ede6a397ff3225f75dc5380351599a428171780a23e7bd03c9a
Python
7,781
205
import io import logging import struct import numpy as np import pytest from pyxdf import load_xdf from pyxdf.pyxdf import StreamData, _parse_numeric_samples, _robust_fit SRATE = 100 T0 = 1000.123 def _varlen(n): return b"\x01" + struct.pack("<B", n) if n < 256 else b"\x04" + struct.pack("<I", n) def _chunk(...