sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0097903f449f2d3f339ea286e314a12b0ba2e4a26fc4f9367ce001a402c759ff
Python
1,707
56
""" Example for creating a synthetic dataset with compositional labels. Requirements ------------ seaborn mpl_toolkits """ from smote_cd import dataset_generation import numpy as np import matplotlib.pyplot as plt import seaborn as sns from mpl_toolkits.axes_grid1 import make_axes_locatable def display_data(): ...
4e23af7f1f2f3313497e43f751c1cbb81dcaf5f169bc6dd0fb71089e2a03a3fb
Python
1,707
54
from flair.data import Dictionary, Sentence from flair.embeddings import ( DocumentLMEmbeddings, DocumentRNNEmbeddings, FlairEmbeddings, ) from flair.models import LanguageModel from tests.embedding_test_utils import BaseEmbeddingsTest class TestFlairEmbeddings(BaseEmbeddingsTest): embedding_cls = Fla...
155ea6abbdd77381ad7fe5507d4989958debaf440ac6c78a334d988f90b9f577
Python
1,708
46
from typing import Any from flair.trainers.plugins.base import TrainerPlugin from flair.trainers.plugins.metric_records import MetricRecord class ClearmlLoggerPlugin(TrainerPlugin): def __init__(self, task_id_or_task: Any): if isinstance(task_id_or_task, str): self.task_id = task_id_or_task ...
5f70fa486841f0415c1179b1e28da6ea33ae21dbbb4cf332be85a2a75bc71ed8
Python
1,709
53
import numpy as np #import matplotlib # Force matplotlib to not use any Xwindows backend. #matplotlib.use('Agg') import matplotlib.pyplot as plt class covar_pdf: """ Plots the probability density distributions of prediction and observation for cross-covariances. """ def __init__(self, testObj): ...
b7b2dda03d7a6ac21c9480c2783be7242d424e258d16f02695f07c2d0ca0e1dd
Python
1,710
44
# 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...
aff2eb1f09c60e8b3e6dff28cb78ae592eded3eed23654a476b890f96d37bebc
Python
1,711
71
#!/usr/bin/env python2 __doc__ = """ Loss functions. Nicholas Turner <nturner.cs@princeton.edu>, 2017 """ import torch from torch import nn import numpy as np from balance import gunpowder_balance class BinomialCrossEntropyWithLogits(nn.Module): """ A version of BCE w/ logits with the ability to mask ...
3648af90908df10545ea34ad828d0bbc9f8b231ddfab461bf2cca8841eb2457b
Python
1,712
51
# 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...
de6639c77361f96b5fdcd23814309f14c83eebd46352f59bc3a0c790e37e7cdc
Python
1,713
48
"""Script for the direct comparison of the GNN performance compared to DFT. It works wirth systems containing the following elements: Adsorbate: C, H, O, N, S Catalyst slab: Ag, Au, Cd, Co, Cu, Fe, Ir, Ni, Os, Pd, Pt, Rh, Ru, Zn """ import argparse import sys sys.path.insert(0, "../src") import matplotlib.pyplot as ...
57ddead3535c5f740d405ef3e2951cb947fbd2ec8c7427d95f70be045e8d1b40
Python
1,715
53
# coding = utf-8 # Copyright (C) 2022. 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 # ...
5219058878243ef36515d0d2abe3f54232d1b337bf8b12c21d15c8d25e810df7
Python
1,718
73
"""Loads NetworkUnit score classes""" import math def to_precision(x,p): """ returns a string representation of x formatted with a precision of p Based on the webkit javascript implementation taken from here: https://code.google.com/p/webkit-mirror/source/browse/JavaScriptCore/kjs/number_object.cpp ...
61bd2330cdf0bd19525afd2f33db1a5c8b5e4cd966d798f3b5e71fa47b48f25b
Python
1,718
61
import pytest import pandas as pd import scanpy as sc import numpy as np from palantir.utils import run_pca @pytest.fixture def mock_data(): n_cells = 50 n_genes = 500 rng = np.random.default_rng() return pd.DataFrame( rng.random((n_cells, n_genes)), columns=[f"gene_{i}" for i in rang...
d2af72fda6241f07605f428e62aae92c048366f979c66a441ec1603e303d0209
Python
1,718
29
"""This file contains the radius for every element. Constants: CORDERO (dict): Covalent radius. Beatriz Cordero; Verónica Gómez; Ana E. Platero-Prats; Marc Revés; Jorge Echeverría; Eduard Cremades; Flavia Barragán; Santiago Alvarez (2008). "Covalent radii revisited". Dalton Trans. (21): 283...
bf1c82b00dba39c30c158d8f4e76cf9c7c777098ac341bcc8b1a23d25ea94df7
Python
1,720
57
# roifile_demo.py """Demonstrate the roifile module. Use the roifile and tifffile modules to read and write the results of image segmentation from/to ImageJ TIFF files. """ import numpy from matplotlib import pyplot from skimage.measure import find_contours, label, regionprops from tifffile import TiffFile, imwrite...
4775599e695af0ada96389bacc09f288db602ea1cdae11da0a755d018c8fe2bd
Python
1,721
52
from __future__ import print_function import sys import numpy as np from scipy import signal import matplotlib.pyplot as plt from parameterSetup import ParameterSetup from statistics import recompMean, recompVariance args = sys.argv if len(args) > 1: option = args[1] else: option = '' # get params shared by p...
597782389951a3a09a0635a2661e70659a36b537ffe2cd62163ffda808788e40
Python
1,722
49
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class MeanVarianceNormalization(Base): @staticmethod def export() ->...
7aabefb2a4cbeae126f4cb646599ca636fd19d251039ad4d6a448054da0d20d4
Python
1,722
52
"""Unit tests for sklearn classifiers.""" __author__ = ["MatthewMiddlehurst"] import platform import pytest from sklearn.linear_model import LogisticRegression from sklearn.utils.estimator_checks import parametrize_with_checks from sktime.classification.sklearn import ContinuousIntervalTree, RotationForest from skt...
91235d1dfacc55ae1672e386e2c67445bba92bd95cb0f4492f672ad3500e515d
Python
1,723
56
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class IsInf(Base): @staticmethod def export_infinity() -> None: ...
f47fab7b7d1646f5d2cbad8ead6056b2415c0dbb78b16bc68d2e24520e17c50d
Python
1,723
50
# 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 # # ...
41e07877af48b243ed55f69c2f91c91b6adac4daf775a8d05a22528be38432a2
Python
1,724
47
# 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...
44b2124d7d0756fcf49a2a681a3cd61162df19365f4c8548c0ea8498abcca580
Python
1,726
61
from __future__ import print_function """ """ import sys import subprocess if len(sys.argv) < 2: # if no argument, print helpful message print("Plot selected figures from paper, Manis and Campagnola, Hearing Research. 2018") print("Usage: figures.py [2a | 2b | 2c | 3 | 4 | 5 | 6a | 6d | 7]") exit(1) ...
61efdbf82a097f6503a02ec874b98ea8c9a9a768fde23eeb519da750eaf13330
Python
1,728
46
from expert.src.model import Model import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf, pandas as pd, numpy as np from expert.CLI.CLI_utils import find_pkg_resource def search(cfg, args): # Basic configurations for GPU and CPU os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.envi...
bb402fa753f509705b01b3f1677cdc60d9d14c2db12fb9e8e2fd0320cb43b2e1
Python
1,730
42
# Copyright 2019 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...
302da229f7cd76849bfea55ef30b4dbbf72525b34f7567274aa67655b7fc0c94
Python
1,731
47
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl class DictVectorizer(OpRunAiOnnxMl): def _run(self, x, int64_vocabulary=None, string_vocabulary=None): ...
3e10931f7f96ef35456cf89e05b47c73fd62d69a5b6a0435911276132b1c9680
Python
1,731
52
# Copyright 2023 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...
d03afd6705c8d0d7328de00fc6c6fe3a18e8619faaebd59eaa0f2168f5746d3e
Python
1,731
51
# SPDX-License-Identifier: LGPL-3.0-or-later """PyTorch extras keep Vesin bindings within their supported versions.""" from pathlib import ( Path, ) import pytest from packaging.requirements import ( Requirement, ) @pytest.mark.parametrize("version", ["2.1.0", "2.2.0", "2.3.0", ""]) def test_vesin_requireme...
e7cd77d847ff536424e2c40ac2eb5e9f1015daf2b7f4fc03b34eeab6e1295f61
Python
1,731
49
from setuptools import setup, find_packages import setuptools import os, shutil import os path = os.path.join(os.path.dirname(__file__), 'cnmodel') version = None for line in open(os.path.join(path, '__init__.py'), 'r').readlines(): if line.startswith('__version__'): version = line.partition('=')[2].stri...
0aa8e1547f4d444ea38f193e9f361698566c1e22d91c397f4909359e790d626f
Python
1,732
52
import numpy as np import os from matplotlib import pyplot as plt from .helper import run_shell_command from ..io import save_nifti def show_brain_side_by_side(im1, im2, num=10, savename=None): # merge two images along x axis merged = np.concatenate((im1, im2), axis=2) start = int(im1.shape[0]*0.05) e...
0aaf95832460628ce85ef4953c6dc47dbf9c3f2e82c6082ef42fcb40952046c6
Python
1,732
41
import torch import os class Config(object): """args in model and trainer""" def __init__(self): self.device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') self.num_fold = 10 self.num_classes = 5 self.num_epochs = 200 # Because early stopping is ...
13bc435b880b9a33f4c3cdb517af76ee31731844e23ad7e1d5106ae335ac4d67
Python
1,732
45
# 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...
746b507b8cee2c63781642341dafd161eed6883fb87f1bdf3097de93dddffe20
Python
1,732
63
#!/usr/bin/env python import click import pandas as pd import sys CONTEXT_SETTINGS = { "help_option_names": ["-h", "--help"], } @click.command(no_args_is_help=True, context_settings=CONTEXT_SETTINGS) @click.argument( "bed_file", type=click.Path(exists=True, resolve_path=True), ) @click.argument( "chr...
1f1962a9662214d073e98a2a5fd1fc053ef2e3adcb8f12905ef3cf9a012066a2
Python
1,735
63
"""Euclidean distances implemented in pytorch. This module was copied from the repository the following repository: https://github.com/asappresearch/dynamic-classification It contains the code from the paper "Metric Learning for Dynamic Text Classification". https://arxiv.org/abs/1911.01026 In case this file is mod...
2f7319197283535fbc38156a6899e5a099aab0fadda06adda8ad510d5c65138d
Python
1,735
46
import scipy.stats import numpy as np from .population import Population from .. import cells class TStellate(Population): type = 'tstellate' def __init__(self, species='mouse', **kwds): # Note that `cf` is the mean value used when selecting SGCs to connect; # it is NOT the measured CF o...
1cb5fc9c646c0441b50f795cab4680c07098d93acbfb198eda6fc251c50afa67
Python
1,736
52
from setuptools import setup from setuptools import find_packages # change this. NAME = "expert-mst" AUTHOR = "Hui Chong" EMAIL = "huichong.me@gmail.com" URL = "https://github.com/HUST-NingKang-Lab/EXPERT" LICENSE = "MIT" DESCRIPTION = "Exact and pervasive expert model for source tracking based on transfer le...
8415bd8504e669b2f41bada83244e74cf2cdcbe54a3a39493599573e11ee6191
Python
1,736
51
"""JapaneseVowels dataset.""" from sktime.datasets._single_problem_loaders import load_japanese_vowels from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class JapaneseVowels(_ClassificationDatasetFromLoader): """JapaneseVowels time series classification problem. Example of a ...
c459c8a91569d5f927b950cb874600eacfed06703ef64445aa0fbdca7de3a8b8
Python
1,736
52
import re from setuptools import setup def find_version(filename): _version_re = re.compile(r"__version__ = '(.*)'") for line in open(filename): version_match = _version_re.match(line) if version_match: return version_match.group(1) __version__ = find_version('htmlfn/__init__.py'...
10db143e7068bddbf0bf7612fa277b52192368d2ebcf37cd929b0ec57f86484a
Python
1,738
52
from setuptools import setup from setuptools import find_packages # change this. NAME = "expert-mst" AUTHOR = "Hui Chong" EMAIL = "huichong.me@gmail.com" URL = "https://github.com/HUST-NingKang-Lab/EXPERT" LICENSE = "MIT" DESCRIPTION = "Exact and pervasive expert model for source tracking based on transfer le...
13f2c192ace5d1e5d6afa8c89002d671ca27c1e65fbeaccb475903e8dc1f5e0f
Python
1,738
48
"""GunPoint dataset.""" from sktime.datasets._single_problem_loaders import load_gunpoint from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class GunPoint(_ClassificationDatasetFromLoader): """GunPoint time series classification problem. Example of a univariate problem with e...
916e2cf18541cb07d252dc9d69fa68254841efb6ae72ac6c01b0a11b1164a470
Python
1,738
51
# 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...
a2edc1b7fbf69f973acdbdef69f5565656accbf7a0805b0115a92626fd4e4bdd
Python
1,738
57
# 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...
19681173ba2f7969b1453b3164987b690d8365c6ebcc9aea94d6c42eba312e01
Python
1,739
54
# -*- 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/. # import json import os import re all_exts = ['....
cd7c1e90a8fa81768f8dc049dcea43604452eefda07ec19e1b655ee3b8dfafd0
Python
1,739
39
# Copyright (c) OpenMMLab. All rights reserved. from .alexnet import AlexNet from .lenet import LeNet5 from .mobilenet_v2 import MobileNetV2 from .mobilenet_v3 import MobileNetV3 from .regnet import RegNet from .resnest import ResNeSt from .resnet import ResNet, ResNetV1d from .resnet_cifar import ResNet_CIFAR from .re...
f03a9bddee07acd3655fba44eeaa944454c6ff38cca7fa6fe5779db922d39f65
Python
1,739
58
""" Rename import paths for pickle load after restructuring data Approach taken From stack overflow: https://stackoferflow.com/questions/2121874/python-pickling-after-changing-a-modules-directory This module is part of *vcnmodel*. Support:: NIH grants: DC R01 DC015901 (Spirou, Manis, Ellisman), DC R01 ...
7f887874cce085ca88f0399afe51e4ae2618af38446754ec004df385f0db69b1
Python
1,741
52
import face_recognition import cv2 # This is a demo of blurring faces in video. # PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam. # OpenCV is *not* required to use the face_recognition library. It's only required if you want to run this # specific demo. If ...
9224819aadcf24417ede83f501173929bc155a46c6831ef184668b521b27152f
Python
1,741
56
params = {'font.size': 14, 'font.weight': 'bold', 'axes.labelsize':14, 'axes.titlesize':14, 'axes.labelweight':'bold', 'axes.titleweight':'bold', 'legend.fontsize': 12, # 'legend.fontweight': 'bold', } # Global parameters ext='.mp4' # '.avi'...
eae7ac29cb4c18eeb176a007bbe8796da7c562f59374cf9aa70a370d10b0cb9e
Python
1,741
66
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect # Reference implementation of shape op def shape_reference_impl( x: np.n...
406edb2d96fd2b3d42d1d714bad73c83b31d3425228c79e013a0231612fbdacb
Python
1,743
62
import pytest import pandas as pd import scanpy as sc from anndata import AnnData import numpy as np from palantir.utils import run_pca @pytest.fixture def mock_data(): n_cells = 50 n_genes = 500 rng = np.random.default_rng() return pd.DataFrame( rng.random((n_cells, n_genes)), column...
82258bc7cfa8832606b216b7b41eb451d69e49caa1ca3f4f4b62384193b1c76d
Python
1,743
49
# Copyright 2022 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...
98bf959ff79c35305f66581ce38b053bf3575fd3dbb0bf3c0bc3dc129183accf
Python
1,743
50
from ctypes import byref import numpy as np import socket import datetime import threading import tqdm import time import math import pickle from parameterSetup import ParameterSetup params = ParameterSetup() pickledDir = params.pickledDir classifierType = params.classifierType classifierParams = params.classifierPar...
359209197b9465c90127a2b70f17cc17cab100a3eeac3d189d10defae0d5fd8c
Python
1,745
51
from setuptools import find_packages, setup with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name="genomic_benchmarks", version="1.0.0", description="Genomic Benchmarks", long_description=long_description, long_description_content_type="text/markdown", ...
4f67e1112f01ef0eabe52c83ffa2e113f6f7eea68200dba060a99fac156426af
Python
1,745
44
# 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...
301ab2c9098820960eaa538745e60c162d7020bb3d307871986e50829cbc0d05
Python
1,746
55
# Copyright (c) OpenMMLab. All rights reserved. import argparse import datetime import subprocess from pathlib import Path import torch from mmcv import digit_version def parse_args(): parser = argparse.ArgumentParser( description='Process a checkpoint to be published') parser.add_argument('in_file',...
926ba4523f75b010b59c4906607616905f0577042c2467b77221d6475f85b30b
Python
1,746
53
''' Inference of inception-v3 model with pretrained parameters on ImageNet ''' import tensorflow.compat.v1 as tf # To make tf 2.0 compatible with tf1.0 code, we disable the tf2.0 functionalities tf.disable_eager_execution() import tensorflow_hub as hub import numpy as np import cv2 import pandas as pd # Load saved ...
b95dfa7b1fc3c0b89c0d395870e46bd2dd0d84d396729b7fcb99bf659b6ea627
Python
1,746
58
import pytest from itertools import repeat from time import time import os import numpy as np import siibra from siibra.features.image.image import Image from siibra.volumes.volume import Volume TEST_ALL_PRECONF_BBOXES = os.getenv("TEST_ALL_PRECONF_BBOXES", "False").strip().lower() in ("1", "true", "yes", "on") RANDO...
5894d0ccf2a3b72d43ab5b96e3b1849832b604d9833727af1b9feaf2f3acf9b3
Python
1,747
54
import torch from torch import nn from scipy.spatial import distance import numpy as np class DiceCoefficient: """ Standard DICE coefficient """ def __init__(self, smooth=1.0, epsilon=1e-06, **kwargs): self.smooth = 1.0 self.epsilon = epsilon def __call__(self, y_pred, y_true, ma...
e87246f44e8f0b1624db717ed0da62b196ba164f14682549418f8cc1e0782bda
Python
1,747
56
import torch class LockedDropout(torch.nn.Module): """Implementation of locked (or variational) dropout. Randomly drops out entire parameters in embedding space. """ def __init__(self, dropout_rate=0.5, batch_first=True, inplace=False) -> None: super().__init__() self.dropout_rate = ...
ee4094c787e6241d60a202848fbdb59a3af667eee06d8aa58d2aa6c236f7cf20
Python
1,749
60
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class EyeLike(Base): @staticmethod def export_without_dtype() -> Non...
c625ae29ab665d09349d620a3fe7926c1c9bbb40c07cadf8305704011d4d0d85
Python
1,750
65
from anlffr.helper import biosemi2mne as bs import mne import numpy as np from anlffr import spectral import pylab as pl # Adding Files and locations fpath = '/home/hari/Documents/MNEforBiosemi/' # List of files stems, each will be appended by run number # Use list [] and enumerate over if filenames are weird names...
870377e260044d9cf86cdabb281e9b11610f3c019973efdceb7e7fcb6e2490cc
Python
1,751
57
#!/usr/bin/env python import argparse import torch def average_models(model_files, fp32=False): vocab = None opt = None avg_model = None avg_generator = None for i, model_file in enumerate(model_files): m = torch.load(model_file, map_location='cpu') model_weights = m['model'] ...
b858d1cf3b2a9e08b5938aea12e0fc6218a63d90bb50be816a8ace61241f9b39
Python
1,751
68
""" Module to collect system metrics for front-end """ import logging import types from builtins import str import psutil from ts.metrics.dimension import Dimension from ts.metrics.metric import Metric system_metrics = [] dimension = [Dimension('Level', 'Host')] def cpu_utilization(): data = psutil.cpu_percent...
19506a8b80e35147efe27d300aacf931a6f4d8863c85f82f3b87cc340ef7732d
Python
1,752
56
# 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...
36983fb4f85ea8fc8ae51362b060546eb40299e8c264d43dd15eb37ad833a428
Python
1,752
64
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ 'face_recognition_models>=0.3.0', 'Click>=6.0', 'dlib>=19.7', ...
9193553502906ccc487f21af826722f555bf556545d30f3e24d28906b724e13b
Python
1,752
63
# Author: Behrad Soleimani <behrad@umd.edu> "Statistical tests" import numpy as np from scipy.stats import chi2, ncx2 def fdr_control(d, k, alpha): """CFDR control based on BY procedure Parameters ---------- d: ndarray of shape (n_sources, n_sources) devianc...
54f735aef6005917826ee9163f322799619e6825b8efdcf6838f05ad55d963a3
Python
1,756
41
import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.layers import Input, Dropout, Activation, Convolution2D, Convolution3D from tensorflow.keras.layers import BatchNormalization """ adapted from https://github.com/okason97/DenseNet-Tensorflow2 """ def conv_block(x, stage, bra...
342cf1153d0f3d57ce24c88bee740e8aa210327bc4b5ea779dfa8ff6e331ce46
Python
1,758
38
import numpy as np import nibabel as nib from nilearn import image, signal, plotting, masking from scipy import stats import seaborn as sns import nilearn ## Taking HCP resting-state fMRI data as an example ## Volume pipeline gradients_vol = image.load_img('$PATH_SOURCE/principal_gradient_MNI.nii.gz') nii_img_demo = i...
557ef27f5fbf1dbedf88006ed7a1695bfa2d52c5f71d2b13ff2330e7e68c68f5
Python
1,761
46
# 这是一个在树莓派上运行人脸识别的案例 # 本案例会在命令行控制面板上输出识别出的人脸数量和身份结果。 # 你需要一个2代以上的树莓派,并在树莓派上安装face_recognition,并连接上picamera摄像头 # 并确保picamera这个模块已经安装(树莓派一般会内置安装) # 你可以参考这个教程配制你的树莓派: # https://gist.github.com/ageitgey/1ac8dbe8572f3f533df6269dab35df65 import face_recognition import picamera import numpy as np # 你需要在sudo raspi-config中把c...
c15dbc0199bf154fc3f284421afaa53ecb0ad1d53ac4ca83e26cbf251f67322c
Python
1,763
59
# 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...
db04aeb1b9e85c900880baf7780b97ca7344b3522bd0ef3c2cedb8403dfa43f1
Python
1,763
53
# 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...
edc25951e6c604b23354c071a5d7b9ac0851d67d8eb5537e12d9c211d89208ad
Python
1,763
57
"""Dummy segment detector which detects no segments.""" from sktime.detection.base import BaseDetector class ZeroSegments(BaseDetector): """Dummy segments detector which detects no segments. Naive method that can serve as benchmarking pipeline or API test. Detects no segments. Examples -------...
fe395cd9be1f6b23e5dd4bbf370ead31a7725786b598b26235afb9593e288828
Python
1,763
58
"""Intended purpose it to convert every ontology in NIF-Ontology and picklize it in a new folder Usage: picklize.py [-h | --help] picklize.py [-v | --version] picklize.py [-f=<paths>...] [-o=<path>] Options: -h --help Display this help message -v --version Current version ...
82f9d63354154e9a856925775380b9e1b3b5b37ebbd56a14e85f999ad4c333be
Python
1,764
47
# 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 # # ...
84de9f0f79f57eccc9eb65ae3b068b06a8e0a2eae33be99802654030805132dc
Python
1,764
51
# 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...
eba67e51a73279da6ec8bb86bbd9ef8c02b87ff163c8bcee20fb6ced1c222693
Python
1,767
53
# Copyright 2019-2020 The ASReview 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 appl...
f9e8e55970a23baaf9ab78b7b3cf0d090939a6d96d7352e39bc9219930a577c8
Python
1,767
58
import pytest import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.linalg import eigs from pytest import approx from palantir.utils import diffusion_maps_from_kernel, determine_multiscale_space @pytest.fixture def mock_kernel(): size = 50 rng = np.random.default_rng() A = rng.random((...
435c1378044586af1ca3fe6c33f9f0c767f480c40978a3a05d181b372cacb55d
Python
1,768
52
import unittest import os import numpy as np import shutil from ddt import ddt, data from SPHARM.classes.ellipsoid import Ellipsoid @ddt class TestEllipsoidClass(unittest.TestCase): @data( ([10, 10], [1, 3, 2], (0, 0)), ([10, 30], [3, 3, 2], (np.pi/4, 0)), ([100, 100], [1, 3, 2], (np.pi...
91b0d98c12d2003a445c788db7038e6cd5a4ca94a60f2b9ae5f5b6770ff21cd5
Python
1,768
43
# Code adapted from tensorflow to pytorch from https://github.com/google-research/graph-attribution/tree/main/graph_attribution import torch from torch_geometric.data import Data from molucn.feat_attribution.explainer_base import Explainer class CAM(Explainer): """CAM: Decompose output as a linear sum of nodes ...
d2655b604a8640216df1d692ae88adec89e7a663a78bc446a6adc1ea5d1f01ea
Python
1,768
50
# Copyright 2023 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...
47b0457f2c697c82a46cc17bfccc8b30aaf6f63a4cacb53ed472e168a52376d5
Python
1,769
49
# 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...
c4d79576ecc4059bba34fb44a27b448f52d67d913cc9758d2d9cf0672a3f4cb3
Python
1,770
72
''' what does this do? printMoleculeInfo @author: Nicholas Browning ''' from __future__ import print_function # Use this to print residue information from builtins import range import argparse from src import MoleculeInfo as mi import openbabel import numpy as np def printResidueInfo(mol): print("Num Atoms:",...
406aab9f68dc949c21ac0d454239e11394211a3f87aced5c5e4542186402918f
Python
1,771
60
import rdflib from IPython import embed from ilxutils.ilx_graph_comparator import IlxGraphComparator tdata = """ @prefix skos: <http://www.w3.org/2004/02/skos/core#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xsd: <http://www.w3.org/2001/XMLSche...
b6887b93a964b74ff8bdea2e101e220d83ab34ef87b027b0b19183d444e79e09
Python
1,771
55
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.helper import tensor_dtype_to_np_dtype from onnx.reference.op_run import OpRun class _CommonRandom(OpRun): def __init__(self, onnx_node, run_params): OpRun.__i...
3176b28b867334642cfc331f4f200cdea718ffa729d15c33172cdbacc7323be2
Python
1,772
46
"""Unit tests for all time series regressors.""" __author__ = ["felipeangelimvieira"] import numpy as np import pandas as pd from sktime.tests.test_all_estimators import BaseFixtureGenerator, QuickTester class ClassificationDatasetFixtureGenerator(BaseFixtureGenerator): """Fixture generator for classifier tests...
4ac18dd23e405fb02d4c70cad0bbc1d65469cd217075efc499d7e4965e421af7
Python
1,772
57
#!/usr/bin/env python # arima_mapping 0.0.1 test suite # Generated by dx-app-wizard. import json, os, time, unittest import dxpy import dxpy.app_builder from dxpy.exceptions import DXAPIError src_dir = os.path.join(os.path.dirname(__file__), "..") test_resources_dir = os.path.join(src_dir, "test", "resources") def...
021011c24046b7bf1a982b1c812c0261240bffd39fd6dd3c9ad98a94fe602810
Python
1,773
68
"""Utilities to handle checks and conversions between output formats of detectors.""" import pandas as pd def _get_example_segments_0(): """Generate example 0 for segmentation output. - non-overlapping - non-exhaustive - no labels """ segs = pd.IntervalIndex.from_tuples([(1, 2), (3, 6), (7, ...
c9a0737e3c0152649d98806b8f3c7dc239023139d99e3d42fbcc55d16928e3cf
Python
1,773
56
from __future__ import division import numpy as np import sciunit import matplotlib.pyplot as plt class effect_size(sciunit.Score): """ Calculates the effect size between samples. """ score = np.nan @classmethod def compute(self, observation, prediction, **kwargs): def s_pooled(sampl...
31a8ef241068abac871a32e95de4da6abbc3f2b712ea6f81abd7bbb29f404c7a
Python
1,774
61
# 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...
5db4d8fcf0e3084b6a3cacb90cba3a9447d1644eb60f71ffdea6cd764f4ff248
Python
1,774
65
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Created by: Yaoyao Liu ## Modified from: https://github.com/Sha-Lab/FEAT ## Tianjin University ## liuyaoyao@tju.edu.cn ## Copyright (c) 2019 ## ## This source code is licensed under the MIT-style license found in the ## LICENSE file in the r...
786192717ac88832502e73a0a14a96a3db062f2de5f21f7be88e9083aa391b39
Python
1,774
57
#!/usr/bin/env python # bcftools_merge 0.0.1 test suite # Generated by dx-app-wizard. import json, os, time, unittest import dxpy import dxpy.app_builder from dxpy.exceptions import DXAPIError src_dir = os.path.join(os.path.dirname(__file__), "..") test_resources_dir = os.path.join(src_dir, "test", "resources") de...
870ee2673cebfc8060079384f897bfb075f798dd5a55d03c5175a2cc0558c74e
Python
1,774
57
#!/usr/bin/env python # rename_contigs 0.0.1 test suite # Generated by dx-app-wizard. import json, os, time, unittest import dxpy import dxpy.app_builder from dxpy.exceptions import DXAPIError src_dir = os.path.join(os.path.dirname(__file__), "..") test_resources_dir = os.path.join(src_dir, "test", "resources") de...
24186ccc0d623f51c46c0f6363509122f961041e43cf966b59a86f277f6acde1
Python
1,775
60
''' Functions for computing abnormalities and abnormality-based measures from continuous iEEG data. Gabrielle M. Schroeder CNNP Lab, Newcastle University May 2023 ''' import numpy as np import sklearn.metrics as sk_metrics def compute_d_rs(roi_data,roi_is_resect): ''' Compute D_RS (AUC) of resected vs. spar...
6f23230edf4bca00aae1170f1afd6a5b17a3d6ad78fd1453a2a13d0955bdc818
Python
1,775
73
"""Turn the examples section of a function docstring into a notebook.""" import re import sys import pydoc import seaborn from seaborn.external.docscrape import NumpyDocString import nbformat def line_type(line): if line.startswith(" "): return "code" else: return "markdown" def add_cell...
fe37d44ac3f2d1e151c92c819248803ecf7ec4c0c22b1293696a2e5184b542b3
Python
1,775
51
import pytest import os from time import time import numpy as np import siibra from siibra.volumes import Map from siibra.exceptions import NoneCoordinateSuppliedError TEST_ALL_MAPS = os.getenv("TEST_ALL_MAPS", "False").strip().lower() in ("1", "true", "yes", "on") preconfiugres_maps = list(siibra.maps) BLACKLIST =...
a2946b9113322bbb7d3e707d818b7b88cee4ce1f06f9ce66bade3d8dcf157af6
Python
1,776
57
#!/usr/bin/env python # workstation1404 0.0.1 test suite # Generated by dx-app-wizard. import json, os, time, unittest import dxpy import dxpy.app_builder from dxpy.exceptions import DXAPIError src_dir = os.path.join(os.path.dirname(__file__), "..") test_resources_dir = os.path.join(src_dir, "test", "resources") d...
89465ecbfa2f357898a232d9c922816c7e661a5c60d39c9573ed468cd6c6592e
Python
1,778
48
import numpy as np from scipy.stats import ttest_ind import sciunit from networkunit.scores import to_precision class students_t(sciunit.Score): """ Student's T-test """ score = np.nan # TODO: should be named ttest only because if equal_var=False -> Welch's t-test # The computation is perform...
f0efd945e4b5eb6ba5c97b4486d92405aaeb0b763d15f7d553ba378434916e68
Python
1,778
74
# 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...
46ac075435b46941041233eed4647fc95b3895bb0a3bc9e5ad03b85a4a8d6af3
Python
1,779
66
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from numpy.random import RandomState from onnx.reference.op_run import OpRun def _dropout( X: np.ndarray, drop_probability: float = 0.5, seed: int | None = None, tra...
f03235e77e48a39b5ded4ce6b2d05347d5a8b26ee199e89e62ba666c4bc4780f
Python
1,779
48
# 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...
8464b9617cecaa66006e7bf628a4e61edfeda2470ee41299b1254efb42dc0da4
Python
1,781
45
def _add_subplot_title(ax, azim=None, elev=None, subtitle_frame='auto', hemisphere='both', viewtype='b', **kwargs): subtitlefont = kwargs.get('font') subtitlecolor = kwargs.get('fontcolor') subtitle_fontsize = kwargs.get('subtitle_fontsize') subtitle_loc = kwargs.get('subtitle_loc') subtitle_weigh...
3229ebdcc57ec5060be42ead3ad47cf16330402d01f6db78ba876ea0e6aa30cf
Python
1,782
55
import logging import os import sys import pytest from ts.context import Context from ts.service import Service from ts.service import emit_metrics logging.basicConfig(stream=sys.stdout, format="%(message)s", level=logging.INFO) # noinspection PyClassHasNoInit class TestService: model_name = 'testmodel' m...
768aabe46d17523da48e746e4bd2a01080ff51899709cb066830d06fcdaf4caa
Python
1,784
63
"""Functions and utilities for downloading example data for bycycle.""" import os from urllib.request import urlretrieve import numpy as np from neurodsp.utils.download import check_data_folder, check_data_file ################################################################################################### #####...
1a69688e57e108f02579a5da43722c2acd2f5dee50251a0719942cc9e5c1cb5c
Python
1,786
55
import re from setuptools import setup def find_version(filename): _version_re = re.compile(r"__version__ = '(.*)'") for line in open(filename): version_match = _version_re.match(line) if version_match: return version_match.group(1) __version__ = find_version('clifn/__init__.py')...