sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
af1ebc0b5dddd460404c38bd1e1bc1dc2258d0e2212c14e30125e3da3180f627 | Python | 853 | 30 | # 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 Sigmoid(Base):
@staticmethod
def export() -> None:
nod... |
ee0c31a2e15eecb112eb1a1d45a94763de13c033cfa8b8535ebcfac412660ee7 | Python | 855 | 26 | # 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... |
5091795c3d06f7a2d55044bfcaa96d1ef5d84edf2139a6d6b8b14c039734611c | Python | 856 | 20 | # 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... |
7fef0f42e49da206a31773244eccc4240aca579a07d156b624a027abcecfb24b | Python | 856 | 29 | import logging
from pathlib import Path
from typing import Any
from flair.trainers.plugins.base import TrainerPlugin
from flair.training_utils import add_file_handler
log = logging.getLogger("flair")
class LogFilePlugin(TrainerPlugin):
"""Plugin for the training.log file."""
def __init__(self, base_path) -... |
330c65e53b349ee71037dcad3611f72d0edf9141eee83e49e5cd6576ec6940ef | Python | 857 | 31 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunBinaryNum
def numpy_matmul(a, b):
"""Implements a matmul product. See :func:`np.matmul`.
Handles sparse matrices.
"""
try:
... |
e5f899ae5668d160cd0ea53174f56b45abe24f9d47d9b7ede8ed7023041f3b0d | Python | 857 | 30 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn.functional as F
from .builder import AUGMENT
@AUGMENT.register_module(name='Identity')
class Identity(object):
"""Change gt_label to one_hot encoding and keep img as the same.
Args:
num_classes (int): The number of classes.
prob... |
1749c2b9939846173843f9e67988af9ed059e4a3b45c858e5ffc0e09e5aa86ce | Python | 858 | 22 | # 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... |
38af31217940a61a2a7c1c7d8188edee65eaf3fb1ff452404edc8fb1ab317a42 | Python | 859 | 25 | """
Companion tools for working with transcript clusters produced by Corset.
The package exposes a single console entry point, ``corset-tools``, which
groups four subcommands:
``fetch-seqs``
Extract and cluster-tag transcript sequences from a multi-FASTA.
``cross-count``
Count cluster members originating from... |
bcb1829afacf07b052cdc258522a0f2ce2fad4a7703f6bdca6468c8222d032db | Python | 860 | 23 | from torchvision.models.segmentation.fcn import FCN
from torchvision.models import resnet
from intermediate_layer_getter import IntermediateLayerGetter
from fcn import FCNHead
class FCNImageSegmenter(FCN):
"""
NN definition for fcn_resnet101 i.e. FCN with restnet 101 as backend
"""
def __init__(self,... |
698560e8c72a7eb8c353ab5a3ce4812ab9744b4a6e9eb64ab9c9e3fa976a20ac | Python | 861 | 28 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def gather_numpy(self: np.ndarray, dim: int, index: np.ndarray) -> np.ndarray:
dim %= self.ndim
data_slices = tuple(
slice(No... |
d0015a6792534616fb354eeb8d2c1fec6ad6e0d21bdafafe2a8662ea1a0bdf10 | Python | 861 | 28 | """Tests for medoids."""
import numpy as np
import pytest
from sktime.clustering.metrics.medoids import medoids
from sktime.dists_kernels._numba_distances.tests._utils import (
create_test_distance_numpy,
)
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.skipif(
not run_test_for_class(m... |
25544d18cb13d5fb0cce937f31a2684a525091378291a498c8a692bbfa2b8fc0 | Python | 862 | 30 | """
Horizontal bar plots
====================
"""
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="whitegrid")
# Initialize the matplotlib figure
f, ax = plt.subplots(figsize=(6, 15))
# Load the example car crash dataset
crashes = sns.load_dataset("car_crashes").sort_values("total", ascending=Fal... |
4bd18ad68b213957bd33ab174e6c6767b0139fac727cc6181925df504a70c7f4 | Python | 862 | 30 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import importlib
import inspect
import pkgutil
import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from types import ModuleType
def collect_sample_implementations() -> dict[str, str]:
... |
2b697e75bb9ad66f6adfeb0d501e13b318bd6754433374f8e78e6141cb79e69f | Python | 863 | 36 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 3 22:52:14 2023
@author: daniel
"""
import json
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
sns.set(font_scale = 1.5)
sns.set_style("ticks")
vs_widths = []
vs_amps = []
vs = []
filename = './results/alpha/noise_s... |
314e9bd18cc0d3444656c6902c4d631419621f67e399bd16f35a99894deb226d | Python | 863 | 36 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import JH_utile
# DS = np.array([89.22, 88.04, 89.11, 88.64, 88.94])
#
# kernel_3 = np.array([90.13, 90.59, 91.51, 90.43, 90.26])
#
# # kernel_5 = np.array([91.05, 91.97, 91.57, 92.43, 91.84])
#
# mean, std = JH_utile.meanstd2(kernel_5)
# print()
... |
3752604a476c67121a249464555c6c38ac98392716f9ff62bdfba2e635202845 | Python | 863 | 26 | # 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 LinearRegressor(OpRunAiOnnxMl):
def _run(
self, x, coefficients=None, intercepts=None, targe... |
3ec1d5315257f7aff53648ae0d6ac347ff14158fa3b84bc499bc6be410af9567 | Python | 863 | 26 | # 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... |
c0be20ad1f24826c2fe0851b736c66284fe942b0fa3f6873a69e82eb34af0423 | Python | 864 | 47 | """
plot_intermediate_values
========================
.. autofunction:: optuna.visualization.matplotlib.plot_intermediate_values
:no-index:
The following code snippet shows how to plot intermediate values.
.. _visualization-plot-intermediate-values-matplotlib-content:
"""
import optuna
def f(x):
return ... |
3c49c0ac0a93da9872b8e5897f99d2b1d19b98e17c1ca70764aea53ef89e8359 | Python | 865 | 21 | # Copyright (c) 2019. Martin Haesemeyer. All rights reserved.
#
# Licensced under the MIT license. See LICENSE
"""
Module with simple parser of swc tracing files
"""
import numpy as np
class SWC:
# TODO: init should take swc file name and optionally cmtk transformation file as parameters. swc information wil... |
619bed451f4fcc89ce5b7aa327226dc3188290810a2b73337352240524aece2e | Python | 866 | 30 | from pptree import print_tree
from flair.data import Sentence, Token
class NodeToken:
def __init__(self, token: Token, tag_type: str) -> None:
self.token: Token = token
self.tag_type: str = tag_type
self.children: list[NodeToken] = []
def set_haed(self, parent):
parent.childr... |
98696d5a50830888fb7dd69cd69f3650787d4302256e933526a40cc8e0400290 | Python | 867 | 30 | """DrCIF test code."""
import pytest
from sktime.classification.interval_based import DrCIF
from sktime.datasets import load_unit_test
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.skipif(
not run_test_for_class(DrCIF),
reason="run test only if softdeps are present and incrementally (... |
1a2b8600cdff84099859d61257c43f7d0caa7d9a238b389ad363495f9f89b49c | Python | 868 | 18 | from __future__ import print_function
import pickle
from parameterSetup import ParameterSetup
def writePredictionResults(testFileIDandClassifierIDs, params, y_test, y_pred, resultFileDescription):
outpath = params.pickledDir
fileFullPathPrefix = outpath + '/' + 'predictions'
if resultFileDescription != '':... |
b392fbf9fd551bffb00b70fbc2953d331371001807d823161ce790b5bd4b153b | Python | 868 | 30 | """
Horizontal bar plots
====================
"""
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="whitegrid")
# Initialize the matplotlib figure
f, ax = plt.subplots(figsize=(6, 15))
# Load the example car crash dataset
crashes = sns.load_dataset("car_crashes").sort_values("total", ascendi... |
3d8f33ec4854afaaedbb9f8f7ae70681424c4ee054aab28518bbb8ba44da41b3 | Python | 871 | 25 | #-------------------------------------------------------------------------------
# elftools tests
#
# Efimov Vasiliy (real@ispras.ru)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from elftools.elf.elffile import ELFFile
... |
32e6fdbeb864581def80f8fb59ad40f22ad1cb89954c16dd5c16ec2890aede9b | Python | 872 | 33 | import os
import argparse
import sys
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)
from seas.gui import run_gui
ap = argparse.ArgumentParser()
ap.add_argument('-i',
'--input',
type=argparse.FileType('r'),
nargs=1,... |
cd07ea0ee688cefe8664abbc7d21d583b800b6f50d7a884ba655478e9f4c6b6b | Python | 874 | 27 | import numpy as np
import torch
import atom3d.util.results as res
import atom3d.util.metrics as met
# Define the training run
maxnumat='400'
name = 'lep_cutoff-08_maxnum-'+maxnumat+'-noh'
print(name)
# Load training results
rloader = res.ResultsENN(name, reps=[1,2,3])
results = rloader.get_all_predictions()
# Apply... |
853a14366c85ab5516e42c52707c8107e99267b9142bfc350afae4d4e91941fd | Python | 875 | 19 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
b0ebb33c7876c6ad69e794f4cc072b496d81d707f0c1811704e588b828c678f1 | Python | 875 | 27 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
dd736dfc013fe2b86ef995bfc504573a4e2daee0b450e0b22854afa7607eee07 | Python | 875 | 31 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx import defs
def main() -> None:
# domain -> support level -> name -> [schema]
with_inference = []
without_inference = []
for schema in defs.get_all_schemas():
domain,... |
8f1f0536e172eabf4868ed5ab3b0f13d1043982cef4f0c510c6f02f1207e00e3 | Python | 877 | 28 | """Module exports for dist_kernels module."""
from sktime.dists_kernels.base import (
BasePairwiseTransformer,
BasePairwiseTransformerPanel,
)
from sktime.dists_kernels.compose import PwTrafoPanelPipeline
from sktime.dists_kernels.compose_tab_to_panel import AggrDist, FlatDist
from sktime.dists_kernels.dtw imp... |
19e1257fbce7f87dfb78f0c89d08a3d5d83b08373bd971599f892e02e5725e60 | Python | 880 | 25 | """Tests for datagen functions."""
__author__ = ["klam-data", "mgorlin", "pyyim"]
import pytest
from numpy import array_equal
from sktime.detection.datagen import piecewise_poisson
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.skipif(
not run_test_for_class(piecewise_poisson),
reason... |
16820dbd69383ce2e92666b358b0706e9ff76a4a0bf9e56f567145b221a0a9b2 | Python | 881 | 24 | import sys
from os.path import splitext
import pickle
import numpy as np
from parameterSetup import ParameterSetup
from writePredictionResults import writePredictionResults
from fileManagement import getAllEEGFiles, fileIDsFromEEGFiles
params = ParameterSetup()
eegFiles = getAllEEGFiles(params)
fileIDs = fileIDsFromEE... |
dd221a3149392b49115d5b896f9f07934f84ea94f9029aaa0a376aa006374013 | Python | 882 | 28 | import numpy as np
from STIFMaps.misc import norm_pic
def test_norm_pic_basic_behavior():
# Make an image with known spread
im = np.linspace(0, 100, 10000).reshape(100, 100)
norm = norm_pic(im)
assert norm.shape == im.shape
assert norm.min() >= 0.0
assert norm.max() <= 1.0
# Check approxi... |
e3b4ecf01ece557a53f3c34af6d7725a52b875e24b7c474d1f8bfceee33ee8b0 | Python | 882 | 20 | """Tests to run without pytest, to check pytest isolation."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# test: check that all_estimators can crawl all modules without throwing an exception
# this is a test for soft dependency isolation, in particular of pytest itself
# (note that isolat... |
2d9ff6644e38ad928e3b2ac947308834b0babc5b9c9411a4ce3a1f1cfc110952 | Python | 883 | 22 |
#=======================================================================================================================
# 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... |
a6872fd5b4ceeb41d1273f634ba30a645fe544a04a1c21641c98da00ac465f7a | Python | 883 | 32 | # 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 Not(Base):
@staticmethod
def export() -> None:
node = ... |
b488542b594179afac42f9fc6173ffc4e3762f46bd3a88ac0743a63bc8ac1f69 | Python | 884 | 31 | """
Multiple bivariate KDE plots
============================
_thumb: .6, .45
"""
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="darkgrid")
iris = sns.load_dataset("iris")
# Subset the iris dataset by species
setosa = iris.query("species == 'setosa'")
virginica = iris.query("species == 'virgini... |
1bd4a7d4e7b43215497675ed852936fe4f27e7ea3068afe0b0e1f7cfb6c48570 | Python | 885 | 30 | from collections import OrderedDict
import torch
def normalize_activation(x, eps=1e-10):
norm_factor = torch.sqrt(torch.sum(x ** 2, dim=1, keepdim=True))
return x / (norm_factor + eps)
def get_state_dict(net_type: str = 'alex', version: str = '0.1'):
# build url
url = 'https://raw.githubusercontent... |
d3ba8b2dc11f13a384096b3e1ab176f50244c4b5d45d67a31cc8b2ebd90110bf | Python | 885 | 37 | import matplotlib.pyplot as plt
import os
from src.utils import get_project_root
root = get_project_root()
# plt.style.use(os.path.join(root, 'src/visualization/ts.mplstyle'))
FIG_DPI = 300
# from src.visualization.useSansMaths import use_sans_maths
# use_sans_maths()
def plot_toeplitz(fig, ax, toeplitz_matrix, glo... |
1157d63d627d8125cad242af3b208eed08eba5910412b575bedb7dba1db89401 | Python | 887 | 33 | """
Distribution plot options
=========================
"""
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="white", palette="muted", color_codes=True)
rs = np.random.RandomState(10)
# Set up the matplotlib figure
f, axes = plt.subplots(2, 2, figsize=(7, 7), sharex=True)
sns.de... |
adfa67bcc48b8a455c434837224ba80b43ba34ac62931327a96c572bf0b9f1a7 | Python | 887 | 31 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
from onnx.reference.op_run import OpRun
def _concat_from_sequence(seq: list[Any], axis: int, new_axis: int = 0) -> np.ndarray:
if new_axis == 1:
... |
f3aba62f83fe1dc0c4ded87f1fb5671029ffd4dc9e4f36293d795943f1fdf639 | Python | 887 | 30 | from setuptools import setup, find_packages
setup(
name="molbeam_fp",
version="0.1.2",
packages=find_packages(),
install_requires=[
"pyarrow",
"duckdb",
"datamol",
"rdkit",
"pandas"
],
entry_points={
'console_scripts': [
'molbeam_searc... |
0478086bc7ed455a54a2d5eaccfae894c09d4619eda4b33b45cc35460928cf64 | Python | 888 | 56 | # SPDX-License-Identifier: LGPL-3.0-or-later
from .dpa1 import (
DescrptDPA1,
)
from .dpa2 import (
DescrptDPA2,
)
from .dpa3 import (
DescrptDPA3,
)
from .dpa4 import (
DescrptDPA4,
)
from .dpa4c import (
DescrptDPA4C,
)
from .hybrid import (
DescrptHybrid,
)
from .make_base_descriptor import (... |
75febf64b238e38f25228ef2dfd9cd3810d6d6b5099b365886bd8707e7c2db32 | Python | 888 | 29 | """Tests for bycycle.cyclepoints.zerox."""
from bycycle.cyclepoints import find_extrema
from bycycle.cyclepoints.zerox import *
###################################################################################################
#########################################################################################... |
40895900fb36a91e16cb853fa229a0b964a8196c4059f8230957eaf07ac91580 | Python | 890 | 22 | # 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
#
# ... |
f7bedf72e8a3760b9e55fbd0883fa4dd60e8af58b8adedd99b3ac9303e50a6e5 | Python | 890 | 21 | import numpy as np
import torch
import atom3d.util.results as res
import atom3d.util.metrics as met
for name in ['msp_cutoff-06_bs-4_LMDB', 'msp_cutoff-08_bs-4_LMDB-noH']:
print(name)
rloader = res.ResultsENN(name, reps=[1,2,3])
results = rloader.get_all_predictions()
# Apply Softmax to outputs and use... |
4e9f5bb5f1309b6732e4d97cf3ee2a0353df87e4f1ae1d415619f908a90b8596 | Python | 891 | 26 | import numpy as np
import constants
domain_sizes = [32, 64, 128, 256, 512]
def accuracy(labels, predictions):
n = 0
for l, p in zip(labels, predictions):
n += (l == p)
return n/len(labels)
if __name__ == "__main__":
dir_prefix = 'runs-'
es = constants.ExperimentSettings()
for domain i... |
a76f6c9ea1cba11a71299c4e4fe6e732279b8c51169901bc5838df2d6be4871c | Python | 891 | 35 | """
Different cubehelix palettes
============================
_thumb: .4, .65
"""
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="white")
rs = np.random.RandomState(50)
# Set up the matplotlib figure
f, axes = plt.subplots(3, 3, figsize=(9, 9), sharex=True, sharey=True)
... |
07ca6e6161969a73b3829a51c56cc39133b675e0443f8a3eec1ef4828df6b773 | Python | 894 | 30 | # 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... |
763fd9306ec36a7ffec5d9804fdebecd5fad7f2df391301bce86f393afd69437 | Python | 894 | 25 | """Feature based time series classifiers."""
__all__ = [
"Catch22Classifier",
"MatrixProfileClassifier",
"RandomIntervalClassifier",
"SignatureClassifier",
"SummaryClassifier",
"TSFreshClassifier",
"FreshPRINCE",
]
from sktime.classification.feature_based._catch22_classifier import Catch22... |
ada9206a8a72911d898761e578fafd9ed9192620df9b632b6b7c77e6a99533db | Python | 894 | 30 | """Average-rank evaluator for benchmark results."""
__all__ = ["AverageRank"]
from sktime.benchmarking.analysis._base import BaseBenchmarkAnalyzer
class AverageRank(BaseBenchmarkAnalyzer):
"""Average ranks of estimators across datasets.
Ranks the estimators on every dataset (task) and averages the ranks ac... |
3c314f7ab691b73b29474a0a32ad83ff37930101fb1ca2aa8a3c28edc5fc505e | Python | 895 | 34 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import pytest
import onnx
from onnx import TensorProto, helper
from onnx.defs import ONNX_DOMAIN
@pytest.mark.parametrize("version", [2, 11, 13])
def test_split_requires_output(version: int) -> None... |
f7479ffb0ebfd99bfbb5d4fff8b1ea5daf7a26e9b4718af68e584bdea9ae8479 | Python | 895 | 30 | from __future__ import print_function
import sys
from os import listdir
from os.path import splitext
import numpy as np
from parameterSetup import ParameterSetup
from classifierTrainer import trainClassifier
args = sys.argv
if len(args) > 1:
option = int(args[1])
else:
option = -1
fileMax = option
params = Pa... |
5eb5a419b7650ac1d20402ad52fc9f3c22cdf5ab7409915351b26014e42843e5 | Python | 896 | 25 | from expert.src.utils import load_otlg, meta_from_dir, map_to_ontology
import pandas as pd
from tqdm import tqdm
def map(cfg, args):
if args.from_dir:
print('Generating table for metadata..')
meta = meta_from_dir(args.input)
print('Done')
meta.to_csv(args.output)
elif args.to_otlg:
mapper = pd... |
4925e187c4252a170267ff4866b66bee9e54cb4897f1c06bfc0b55b2faae8ec8 | Python | 898 | 26 | # 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... |
28fa37e56b331c2375ef7d17871f2f1ee5fa2c9083bd9f04737996c47e1fb4cd | Python | 900 | 34 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Long-range modules of the atomic energy of a descriptor-fitting model.
A long-range module is a component of the atomic energy model beside its
energy fitting: it reads the descriptor features shared with that fitting and
the topologies it declares, and contributes an en... |
9dc8ddef34cf3b91ba429dbe9ab5619850a48e3869ce6863999de27ed4a75f1a | Python | 900 | 37 |
import subprocess
import multiprocessing
import os
SCRIPT='/home/disk/database/data/ICS_scHIC/f03_atlas/eQTL/src/step02_pair2bed.py'
def Work(input_path,a):
print input_path
subprocess.Popen('mkdir '+input_path+'.format',shell=True).wait()
subprocess.Popen('python '+SCRIPT+' '+input_path+' '+input_path+... |
a6b6aad59bc919d76ba489ac0d575451770bdc7072f7fecab61a728c1bce1e71 | Python | 900 | 28 | import scanpy as sc
import numpy as np
import pandas as pd
import doubletdetection
import pickle
sc.settings.n_jobs=8
adata = sc.read("../combined_all_organoids_v2.h5ad")
'''
scrub = scr.Scrublet(adata.raw.X)
doublet_scores, predicted_doublets = scrub.scrub_doublets()
combined = {"doublet_scores": doublet_scores,
... |
8e9ae11e84de703ec9be0c46f3a3fd33fabf2c0946c6acc6a1ee844f22cbe456 | Python | 901 | 13 | # aggregating the published mention-level data to document-level data
# input: any published data generated by step9.5_data_rd_linking_publishing
# output: document-level data
import pandas as pd
#mention_level_data_fn = 'test_set_RD_ann_MIMIC_III_disch_sample-rad.csv'
mention_level_data_fn = 'full_set_RD_ann_MIMIC_II... |
815523927e3e23fe67812809c6b5bc6d0bf495da3880831637fd3ac26dbf448f | Python | 902 | 29 | # 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... |
b4976ced1f5a8998e75f67e31a269c4553447616ce45a191c94a33a7ab4e0535 | Python | 902 | 20 | # 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... |
d7fe1c489c368da5d1b66e2f858e7977d966cbff0d33351c2acbebfcace98c8a | Python | 902 | 38 | """
Loosely based on gist.github.com/MantasVaitkunas/7c16de233812adcb7028
"""
import os
import warnings
__licence__ = "BSD (3 clause)"
def get_github_repo(app):
return app.config.github_repo, "/docs/"
def html_page_context(app, pagename, templatename, context, doctree):
if templatename != "page.html":
... |
665ff069783a1a7714953980e90a7fb788c0a037a381e52d8831704c0ef46656 | Python | 903 | 36 | import pickle
import numpy as np
def get_data(config, set):
print('Reading data')
dir_path = f'data/tl_train/{config.tl_data_category}/{config.tl_data}/set{set}/'
with open(dir_path + 'test_seq.pkl', "rb") as fp:
test_seq = pickle.load(fp)
with open(dir_path + 'valid_seq.pkl', "... |
dc3fd7b21faa351827597e0e209a4cef355412a1e7f9aa6cff82e4b96831e10d | Python | 905 | 27 | # 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... |
16bc975f6bcbdb2d3549b5d8ebf8bfe8ea8e5fe92ce3b2b8b9387846d9807f8b | Python | 906 | 29 | import torch
from data.file_generator import generate_files
flow_sequences = ['zurich_city_09_a',
'zurich_city_07_a',
'zurich_city_02_c',
'zurich_city_11_b',
'thun_00_a',
'zurich_city_02_d',
'zurich_city_11_c',... |
9ef5bea36be1eb51d4a7d588fbcc771a61e5c7a334061398386e964ad46a7378 | Python | 906 | 30 | import numpy as np
from sklearn.metrics import roc_curve
def get_sens_spec_metrics(targets, probs):
"""Get the specificity at different sensitivity cut-offs.
Args:
targets (list): list of true labels
probs (list): list of predicted scores
Returns:
"""
b... |
ac9f449ee492449d9ea0abdeaa943d1230c08f96029f664d056c838ca5bebf88 | Python | 907 | 23 | from PIL import Image
import face_recognition
# Load the jpg file into a numpy array
image = face_recognition.load_image_file("biden.jpg")
# Find all the faces in the image using the default HOG-based model.
# This method is fairly accurate, but not as accurate as the CNN model and not GPU accelerated.
# See also: fi... |
6b5e78ab551e03cd92b0873dc8722d83717a32556ce84321dfb895a2dc09a7bc | Python | 908 | 33 | import pickle
import numpy as np
def read_pickle(filepath: str):
"""Read contents of output pickle files.
Usage:
from pickle_reader import read_pickle
y, t = read_pickle(filename)
Args:
filepath: str -- path to pickle file
Returns:
y: ndarray -- output predi... |
88294e6f0b513ea99e8b4c2ff10b77a0a1314ec058e3968ea6a3daf0a18e10e0 | Python | 908 | 25 | # -*- 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 ... |
c4ddf9dccbb91a17913d0417268df19e7332059a97f47f92eddea027e8795ee8 | Python | 908 | 34 | """
Plotting a diagonal correlation matrix
======================================
_thumb: .3, .6
"""
from string import ascii_letters
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="white")
# Generate a large random dataset
rs = np.random.RandomState(... |
ea4b47fee2b67911d2612ff9f788118f5599f4be0fc365290eacd4ed3579e4cf | Python | 910 | 24 | import os
import Switches_Static as st_switches
def return_root_path():
return os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
def return_atlas_path():
if st_switches.atlas_type == "Adult":
atlas_prepath= os.path.join(return_root_path(), "Gui_Atlases", "Adult_full_atlases"... |
fa1169b4a9bd9f0cc7e25078cffe5d2a255facdfaa5538d80eecdc066fde707c | Python | 910 | 32 | from skimage import measure
import nibabel as nib
import mcubes
def marching_cubes(res, name='vessel', level=0.9, spacing=1, method=None, smooth=False, show=False):
if smooth:
res = mcubes.smooth(res)
if method == 'skimage':
verts, faces, normals, values = measure.marching_cubes(volume=res,... |
b52e5714e326a7a4d0d855ac211be0c978e8a512ab1d3e324bccbbea4adb5fbe | Python | 911 | 37 | from setuptools import find_packages, setup
packages = find_packages()
setup(
name="camstim",
version="0.2.4",
description="camstim python package",
author="derricw",
author_email="derricw@alleninstitute.org",
url="http://stash.corp.alleninstitute.org/projects/ENG/repos/camstim/browse",
pa... |
09a830b650565fceb33658260dfd24a0a5e05e22b3972d40c057fe7cddcca078 | Python | 912 | 28 | """
ExplaiNN: interpretable and transparent neural networks for genomics
"""
import setuptools
with open("README.md", "r") as f:
long_description = f.read()
setuptools.setup(
name="explainn",
version="23.5.1",
author="Gherman Novakovsky, Oriol Fornes",
author_email="g.e.novakovsky@gmail.com, orio... |
683bca2f3fe0fd83c04582f1c84245190c13ce09655ff5a0705d3ab160776982 | Python | 913 | 29 | #-------------------------------------------------------------------------------
# elftools tests
#
# Audrey Dutcher (audrey@rhelmot.io)
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
fro... |
1c0335772ecf530423d339d1b05ef9c1cb33703e2226604f433bf27d3b1fe900 | Python | 914 | 35 | from setuptools import setup, find_packages
setup(
name='ilxutils',
version='0.0.2',
description='Uploads terms to SciCrunch',
long_description='',
url='https://github.com/tmsincomb/ilxutils',
author='Troy Sincomb',
author_email='troysincomb@gmail.com',
license='MIT',
keywords='inte... |
ba3c6ad14d2f999ad84d028596fc305de42e54832735a811926c5a81489a2847 | Python | 914 | 30 | #!/usr/bin/env python
#-------------------------------------------------------------------------------
# test/all_tests.py
#
# Run all pyelftools tests.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import subpro... |
d78d65f3a19b0ae9f1a59aa6ea36a60cf4d3bb0a90c988768d117402ef4bc5b0 | Python | 914 | 34 | import matplotlib.pyplot as plt
from seaborn import miscplot as misc
from seaborn.palettes import color_palette
from .test_utils import _network
class TestPalPlot:
"""Test the function that visualizes a color palette."""
def test_palplot_size(self):
pal4 = color_palette("husl", 4)
misc.palpl... |
25eb5cd18802369bcbb6226824ca244a41f6a3802927eb6f5d909488fede2d1b | Python | 917 | 33 | import pytest
import numpy as np
import pandas as pd
import atom3d.datasets as da
import atom3d.protein.sequence as seq
def test_find_similar():
# TODO: write test for seq.find_similar()
pass
@pytest.mark.network
def test_get_pdb_clusters_and_find_cluster_members():
id_level = 0.3
clusterings = seq.... |
599e316c1bc5aa96517ba4db4f59e7cd839e0ca29c93b9eeca003ead57eb0ce0 | Python | 917 | 32 | #!/usr/bin/env python
# rename_contigs 0.0.1
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See https://wiki.dnanexus.com/Developer-Portal for documentation and
# tutorials on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) docu... |
d7389882a78306025eb33b63f809528974a3dc137103ab9e6fb6e9ec796241f5 | Python | 917 | 29 | from sktime.catalogues.forecasting.M4._base import _BaseM4CompetitionCatalogue
class M4CompetitionCatalogueDaily(_BaseM4CompetitionCatalogue):
"""M4 forecasting competition catalogue for daily time series.
The M4 competition is a large-scale forecasting benchmark that evaluates
forecast accuracy across m... |
4086689e2821ffe632a6100af4becbd6be0bd97576f36f4ab4c9bbd9d279bf46 | Python | 918 | 25 | # Copyright (C) 2022-2025 Shijiazhuang Xianyu Digital Biotechnology Co., Ltd
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... |
55c787409448ec90137a96528794de40fbf09220c838420d1bafa82588eeef9b | Python | 921 | 29 | from sktime.catalogues.forecasting.M4._base import _BaseM4CompetitionCatalogue
class M4CompetitionCatalogueYearly(_BaseM4CompetitionCatalogue):
"""M4 forecasting competition catalogue for yearly time series.
The M4 competition is a large-scale forecasting benchmark that evaluates
forecast accuracy across... |
ac7b09a5ee03c3783624d3bbe1c5b8f685f41af70d151a8c9f9e660f262af9a3 | Python | 921 | 41 | import csv
import numpy as np
tsJava = None
tsPython = None
with open('tsJava1619316546.4062428.csv', newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=' ', quotechar='|')
for row in reader:
tsJava = row
with open('tsPython1619316546.4062428.csv', newline='') as csvfile:
reader = cs... |
e87d004cd6d0d2c916241d54c7aa13f86354bc08ac904f528e6d6fbedfcdfd3f | Python | 921 | 39 | """IsoVAE public API.
IsoVAE predicts gene-wise isoform usage from short-read single-cell gene
expression and denoises sparse long-read isoform-usage measurements.
"""
from .data import (
IsoVAEPreprocessor,
align_paired_cells,
counts_to_gene_usage,
prepare_paired_data,
)
from .inference import (
... |
59dfa653a820083b953fac18c0a8f88a45299c98873493037cb9e4a70eb89ecc | Python | 923 | 29 | from flair.data import Dictionary
from flair.embeddings import CharacterEmbeddings, HashEmbeddings, OneHotEmbeddings
from tests.embedding_test_utils import BaseEmbeddingsTest
vocab_dictionary = Dictionary(add_unk=True)
vocab_dictionary.add_item("I")
vocab_dictionary.add_item("love")
vocab_dictionary.add_item("berlin")... |
c799d03cfb840a4f7a246b1a130a8229d4d45e964d4afbd0266b200a2388f4e9 | Python | 923 | 28 | r"""
This modules contains all usable video prediction models.
"""
from vp_suite.models.copy_last_frame import CopyLastFrame
from vp_suite.models.phydnet import PhyDNet
from vp_suite.models.st_phy import STPhy
from vp_suite.models.unet3d import UNet3D
from vp_suite.models.lstm import LSTM
from vp_suite.models.predrnn_... |
38dbaf874a624a7733478c087535668a3f4bcf67c704fa9e3b1a362d580714fe | Python | 924 | 29 | from sktime.catalogues.forecasting.M4._base import _BaseM4CompetitionCatalogue
class M4CompetitionCatalogueHourly(_BaseM4CompetitionCatalogue):
"""M4 forecasting competition catalogue for hourly time series.
The M4 competition is a large-scale forecasting benchmark that evaluates
forecast accuracy across... |
a7efd1d840390cf9cdb5271ff022e448fc8569372dfea29f47785c58e5a6a9e1 | Python | 924 | 29 | from sktime.catalogues.forecasting.M4._base import _BaseM4CompetitionCatalogue
class M4CompetitionCatalogueWeekly(_BaseM4CompetitionCatalogue):
"""M4 forecasting competition catalogue for weekly time series.
The M4 competition is a large-scale forecasting benchmark that evaluates
forecast accuracy across... |
382c30491337af02ee0a89013321f8dfa90c29a776524c9e0a3068ac40929bfb | Python | 925 | 25 | # 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... |
5863963e1432404b26c7010b237a1662625c5b3cedd5ae9ba864f2ff37cbd9df | Python | 927 | 38 |
# pylint: disable=missing-docstring
import json
from enum import Enum
class EngineType(Enum):
MXNET = "MXNet"
# TODO Add more engines here as and when MMS supports more DL Frameworks
class Engine(object):
"""
Engine is a part of the final manifest.json. It defines which framework to run the infer... |
07aff74afd45a49c71b0d4c8ef86f37bf477e6a494895f56658988c3bc2c84a5 | Python | 928 | 29 | from sktime.catalogues.forecasting.M4._base import _BaseM4CompetitionCatalogue
class M4CompetitionCatalogueMonthly(_BaseM4CompetitionCatalogue):
"""M4 forecasting competition catalogue for monthly time series.
The M4 competition is a large-scale forecasting benchmark that evaluates
forecast accuracy acro... |
6d6e1eb9ca85685d05eb528017b55802cc74e8b61b4e9228852b3b409c857c13 | Python | 929 | 21 | # 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... |
c51fc72cf36e7fa12a57c9a55dbf1fdea398fe6769995bd4053eee3b3d159775 | Python | 929 | 33 | #! /usr/bin/env python
"""
Convert empty IPython notebook to a sphinx doc page.
"""
import sys
from subprocess import check_call as sh
def convert_nb(nbname):
# Execute the notebook
sh(["jupyter", "nbconvert", "--to", "notebook",
"--execute", "--inplace", nbname])
# Convert to .rst for Sphinx
... |
1ffc9ec04da1d4580c6bba9a24b47318ee8014de061f2d2301547011a0d36a12 | Python | 931 | 24 | # 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... |
a7d7830aeede8c31614a7ccd84b60f9b33c949f950f2214679b3b6a386b18e7c | Python | 931 | 31 | class Terminal(object):
"""
Base class for axon terminals. A terminal has a single postsynaptic
neuron, but may have multiple release zones. It defines a release mechanism
with a NetCon input (triggering from presynaptic voltage or calcium level)
and either NetCon or pointer output for driving a PS... |
e72d7f8c9ddcbd9693c0b9d507b039538ba87f7384c62bdc3189fc412a0f9449 | Python | 933 | 29 | from sktime.catalogues.forecasting.M4._base import _BaseM4CompetitionCatalogue
class M4CompetitionCatalogueQuarterly(_BaseM4CompetitionCatalogue):
"""M4 forecasting competition catalogue for quarterly time series.
The M4 competition is a large-scale forecasting benchmark that evaluates
forecast accuracy ... |
0076428eeb42a8ee269c7c72ca4563ab1973f398c3a8559c4a3b1ae1c8b07350 | Python | 934 | 20 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
b8fcaa6f33d04d521db4b523d48cb26f6e1de40fe401a9912eb7dd3b98a3efbc | Python | 934 | 23 | """Loads NetworkUnit test classes"""
# Abstract Base Tests
from .two_sample_test import two_sample_test
from .correlation_test import correlation_test
# Helper Test Classes
from sciunit.tests import TestM2M
from .graph_centrality_helperclass import graph_centrality_helperclass
from .joint_test import joint_test
# Te... |
eb6d4b7c79d0dd715e7c9f5be868137b1ba46db0290d504496c4076b5440d424 | Python | 934 | 24 | import numpy as np
import torch
import atom3d.util.results as res
import atom3d.util.metrics as met
for name in ['res_maxnum-400_samples-100']:
print(name)
rloader = res.ResultsENN(name, reps=[1,2,3])
results = rloader.get_all_predictions()
# Apply Softmax to outputs and use second [1] component to pre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.