sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
01a4e755f09cc9d1af81cc0c2782697b17893f94c46b6c1eb3c8b398a2ac4b52 | Python | 2,798 | 119 | '''
plotHeatmap.py
@author: Nicholas Browning
'''
from numpy.random import uniform, seed
from matplotlib.mlab import griddata
import matplotlib.pyplot as plt
import numpy as np
# make up data.
# npts = int(raw_input('enter # of random points to plot:'))
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyp... |
1b83c1a41920b8d0474b6ecc12c7b73f4e1b7522600cfeb2eb3bdc8d1d449fb7 | Python | 2,799 | 73 | # Copyright (c) OpenMMLab. All rights reserved.
import random
import numpy as np
from .builder import build_augment
class Augments(object):
"""Data augments.
We implement some data augmentation methods, such as mixup, cutmix.
Args:
augments_cfg (list[`mmcv.ConfigDict`] | obj:`mmcv.ConfigDict`)... |
269bea1cce1365d3246950785c142837c38ef31b847cc1e29db6a2efad7480c7 | Python | 2,802 | 68 | # 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... |
12109bcde7f9465af0f7c1d6a891285300dfb3de5f48ba1ee8102a6ebd583885 | Python | 2,803 | 96 | #!/usr/bin/env python
import click
from functools import partial
from multiprocessing import Pool
import os
import re
import subprocess as sp
from tqdm import tqdm
bar_format = "{percentage:3.0f}%|{bar:20}{r_bar}"
from fastq2explainn import _to_ExplaiNN
CONTEXT_SETTINGS = {
"help_option_names": ["-h", "--help"],... |
810d897f9092979ef91e337f995f3bcfbec1302afd27058940f4c53e7b29f105 | Python | 2,803 | 63 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# # Gene differential expression with DESeq2 from Python
#
# Author: Charles E. Vejnar (charles.vejnar@gmail.com)
#
# **Requirements**
#
# * Python with [Matplotlib](https://matplotlib.org)
# * Download gene expression data [dev_timecourse_zebrafish_vejnar_giraldez_count... |
55becfc4952fc6c1d36a55920be6b5b0c42ee7644f03559c15d50be94632ab25 | Python | 2,804 | 97 | # 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... |
ad30efdc9a1018612fd45656a4bf0102d6de46492686d32702f172c5c7f2185d | Python | 2,804 | 76 | import torch
import torch.nn as nn
from torch.autograd import Function
from onmt.modules.sparse_activations import _threshold_and_support
from onmt.utils.misc import aeq
class SparsemaxLossFunction(Function):
@staticmethod
def forward(ctx, input, target):
"""
input (FloatTensor): ``(n, num_cl... |
bde8521d94386984061e0e53263c6f2a11d5516d72fc37f8b5c3d5f740f880bd | Python | 2,805 | 64 | # 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 GradCAM(Explainer):
"""GradCAM: intermediate activations and gradie... |
0185734e69a25984a07f2fa35002b6a476118056bb8bdfeccff6e4a2dca668d1 | Python | 2,806 | 79 | """
Example network for the living machines paper
William Nourse
January 27th 2022
"""
import numpy as np
import matplotlib.pyplot as plt
from sns_toolbox.neurons import NonSpikingNeuron
from sns_toolbox.connections import NonSpikingSynapse
from sns_toolbox.networks import Network
from sns_toolbox.renderer import rend... |
011fe2af89ec24b844d2b3f858615b120e1dcc5de69158fa3f5ce49e90281688 | Python | 2,807 | 64 | import pandas as pd
import os
from dendrogram_tools import dend_json_2_nodes_n_edges
from template_generation_utils import read_taxonomy_config, get_subtrees, read_dendrogram_tree, read_gene_data, \
read_markers, get_gross_cell_type
MARKER_PATH = '../markers/CS{}_markers.tsv'
MARKERS_DENORMALIZED_PATH = "../marke... |
f686f3453c55783d56d1018c3c7f017f711d433f0d5672bb7a8e3f463ebbb78f | Python | 2,807 | 74 | # 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... |
257b77fb25ab3a710752e2c6a2ee5d978d2663461dad2ea0090e7de52e5cf5af | Python | 2,808 | 85 | # 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... |
a35d8cd38dd32d82287d978e5e0d4daf3e3f9e05bffcffccd9e0446014ccb141 | Python | 2,809 | 97 | import unittest
import rdflib
from pyontutils.namespaces import TEMP, ilxtr, rdf, rdfs, owl
from pyontutils.core import OntGraph
from pathlib import Path
from uuid import uuid4
PAGE_BREAK = "" # C-q C-l
utt = rdflib.Namespace('https://uilx.org/tgbugs/u/r/test/')
path_graphs = Path(__file__).parent / 'examples' / '... |
507b97c469b5c8cd56975224fa06500d5fb7ffaef2fa289a6b5d986a5756ffd9 | Python | 2,811 | 65 | from __future__ import print_function
import numpy as np
from itertools import groupby
from featureExtractor import FeatureExtractor
from globalTimeManagement import getTimeDiffInSeconds
class FeatureExtractorRawDataWithFreqHistoWithTime(FeatureExtractor):
def __init__(self, params):
self.params = params
... |
7034e7af361141f1e46e2bc6df9540d26d268056a70a3b1fad8b537abb4a3351 | Python | 2,811 | 91 | # 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... |
ed11391aa21b5a52fe6c718b608e665d6d2538d60284376c113a0dcbb4af4c98 | Python | 2,811 | 61 | # 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
#
from ampligraph.latent_features.layers.calibration import CalibrationLayer
im... |
98e9c7dcaf48dc57c94ec6fe2c641ed35a486732baea50383a362d6a01b36c36 | Python | 2,812 | 85 | # 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... |
05abdad258f0d1be941dcac141f716602aac95427ed7ac09d5ec41a8c8a2cb7f | Python | 2,813 | 91 | # 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... |
cbc8540f21ef0ac2980ce962f41cc86d1e59b3009387e043aefe6b7a08dcc0c0 | Python | 2,814 | 83 | """Configuration file for pytest for bycycle."""
import os
import shutil
import pytest
import numpy as np
from neurodsp.sim import sim_oscillation, sim_combined
from neurodsp.utils.sim import set_random_seed
from bycycle.features import compute_shape_features, compute_burst_features, compute_features
from bycycle.... |
8a579ec57553492690d115b461bef562fcc4fff0a48089be0b76031bb1420b76 | Python | 2,815 | 82 | # 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... |
62d25552a7b7989f67383a33de003a18fbc404197b3f5408231db0a52183f852 | Python | 2,819 | 80 | # 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... |
418e5748368fdb43a06b7f3b57227208ccdfab0890151b7aa64a03a20697e656 | Python | 2,820 | 82 | """
Copyright (c) 2018 Takato Kimura
The source code for U-Net is released under the MIT License
https://github.com/4uiiurz1/pytorch-nested-unet/blob/master/LICENSE
"""
import torch
from torch import nn
__all__ = ['UNet']
class nVGGBlock(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels... |
28dcc07922a0ee7d0e6bbc30defe1175f1b909a55dc14884eca85473416d86a7 | Python | 2,821 | 61 |
#=======================================================================================================================
# 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... |
2f2bfea71ac44f038fccac9f91709e113544059a375716f00f5ec7a0b6d20e7e | Python | 2,821 | 107 | # SPDX-License-Identifier: LGPL-3.0-or-later
import logging
from typing import (
Any,
)
import torch
from deepmd.dpmodel import (
FittingOutputDef,
OutputVariableDef,
)
from deepmd.pt.model.task.fitting import (
Fitting,
GeneralFitting,
)
from deepmd.pt.model.task.invar_fitting import (
InvarF... |
96df353e4dda5519ab723c6025094c775f7a56296d99f5476b5153efcca632bf | Python | 2,825 | 91 | #!/usr/bin/env python
#-------------------------------------------------------------------------------
# test/run_examples_test.py
#
# Run the examples and compare their output to a reference
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#------------------------------------------------------... |
5a98c817a6c662c2fd82c37d666c8546d3813c754ab8c07c63a0d2bd8c683363 | Python | 2,826 | 24 | import pytest
import siibra
selected_ids = [
"cf0::BigBrainIntensityProfile::p:minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579-290::r:Area hOc1 (V1, 17, CalcS) left::acc39db40e08a9ce23d05bf75a4ce172::0d023118e0b9923a11628642e6170d00", # 1574 BigBrain Intensity Profile features
"lq0::B... |
57d6f68bff7801119beb388029e58ce92c4e7675d325ab0bbefdb521e3af548e | Python | 2,827 | 73 | """
@file: le_vit.py
Created on 06.07.22
@project: CrazyAra
@author: queensgambit
LeViT network architecture definition based on:
https://github.com/lucidrains/vit-pytorch
"""
import torch
from torch import nn
from vit_pytorch.levit import LeViT
from vit_pytorch.levit import Transformer, cast_tuple, Rearrange, exists... |
091ce7bd3a6ebb909f2a8876b6e116e7247151a2eb25dbd53074e67eb53d069b | Python | 2,828 | 102 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Range(Base):
@staticmethod
def export_range_f... |
b153711112fe66a2c5725cc02109340c33bde006886b254b840f32137efa18d3 | Python | 2,828 | 79 |
"""
Command line interface to export model files to be used for inference by MXNet Model Server
"""
import logging
import sys
from .arg_parser import ArgParser
from .model_packaging_utils import ModelExportUtils
from .model_archiver_error import ModelArchiverError
def package_model(args, manifest):
"""
Inte... |
6cadf4b11f4f32bf492a0cbaa62474e4d33815acc493cadaecdb0799b4f68036 | Python | 2,830 | 79 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import io
import os
import shutil
import tarfile
import tempfile
import pytest
import onnx
from onnx import TensorProto, helper
class TestUtilityFunctions:
def test_extract_model(self) -> None:
... |
924ca847b5f2c717cf993bb077842fbd6ff7fed5f189712ad3ef124612642d4f | Python | 2,830 | 69 | import torch
from sklearn import metrics
def my_metric(output, target):
with torch.no_grad():
pred = torch.argmax(output, dim=1)
assert pred.shape[0] == len(target)
correct = 0
correct += torch.sum(pred == target).item()
return correct / len(target)
def my_metric2(output, tar... |
c37a8b4427af8db46a8d48bc94d33e1a121bcbf12652e5b684746bf367f39b28 | Python | 2,830 | 82 | #!/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements composite forecasters."""
__all__ = [
"HierarchyEnsembleForecaster",
"ColumnEnsembleForecaster",
"EnsembleForecaster",
"TransformSelectForecaster",
"FallbackForecaster",
"AutoEnsemble... |
dcf4204e9d4376428f35dd501a45aa8e2daced6b8ab8fbc6fcfb62ecd2f458f8 | Python | 2,830 | 111 | '''
Function for handling paths, data, and figures.
Gabrielle M. Schroeder
CNNP Lab, Newcastle University
May 2023
'''
import scipy.io as sio
import os
import matplotlib.pyplot as plt
def mat_load_as_dict(filename,*args):
'''
Loads mat file as python dictionary (each variable is a dictionary entry).
... |
2afd99c4a0c3c972de22acd56b4fd578624a890d4507b285978a4d1142f6c29c | Python | 2,831 | 96 | #!/usr/bin/env python
import click
from functools import partial
from multiprocessing import Pool
import os
import pandas as pd
import subprocess as sp
from tqdm import tqdm
bar_format = "{percentage:3.0f}%|{bar:20}{r_bar}"
# Globals
scripts_dir = os.path.dirname(os.path.realpath(__file__))
CONTEXT_SETTINGS = {
... |
4db9a41c3d162ad1bba1e2410ee07fcdc9e6916c7d6d71f8b2424ac8ace40cc0 | Python | 2,831 | 51 | {'config-search-paths': ['{:user-config-path}/pyontutils/config.yaml',],
'auth-variables':
{'curies': ['../nifstd/scigraph/curie_map.yaml', # git
'{:cwd}/share/pyontutils/curie_map.yaml', # ebuild testing
'{:user-config-path}/pyontutils/curie_map.yaml', # config
'{:user-data-... |
6dc0a394c2b266aca1784742fc6096cdfb563dbb6406fd5c8771f63d3d582b65 | Python | 2,831 | 77 | # 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... |
ffd6ad068272f45ba51e1aba9e530f1c881152cfe23151330d572bf6d0786183 | Python | 2,831 | 76 | # 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... |
9d4efac25af3709161c61c4716acd8bc73ff6dad20fa22cd926fb369a6f2c51b | Python | 2,834 | 82 | # 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... |
052d8d59cce3b213cec086d7aa26f0b9cc16ff6f775bf8ee88199cf18d2560a9 | Python | 2,836 | 93 | """
@file: input_representation.py
Created on 13.02.20
@project: CrazyAra
@author: queensgambit
Input representation for the chess board state which is passed to the neural network
(folder is name "classical_chess" to avoid name clash with python chess library)
"""
import DeepCrazyhouse.src.domain.variants.input_repr... |
c8a1778ead0ee6babd4daae2d09b7bc415fb47ed5f5ffd016e49c86cfcf5ed53 | Python | 2,836 | 88 | #Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#This program is free software;
#you can redistribute it and/or modify
#it under the terms of the MIT License.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHA... |
2df13ac507232ca750994f7961b869f6b95361d323bb8536b266074bc0112ac4 | Python | 2,838 | 88 | from __future__ import annotations
from typing import TYPE_CHECKING
from optuna._experimental import experimental_func
from optuna.logging import get_logger
from optuna.visualization._edf import _get_edf_info
from optuna.visualization.matplotlib._matplotlib_imports import _imports
if TYPE_CHECKING:
from collect... |
b0e3b1c1b6d952510b2c36abbdae40eb3ef13ebe28d58bcae831f756ad0fc3c6 | Python | 2,840 | 68 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 20 15:38:18 2018
@author: wanglab
"""
import pickle, sys
sys.path.append("/jukebox/wang/zahra/python/BrainPipe")
from tools.conv_net.utils.io import pairwise_distance_metrics
if __name__ == "__main__":
#load points dict
pth = "/jukebo... |
97fb9a0294e0581adf91b3f6ab9f9a39660e7425fe140c9172b92b1cc087a4ab | Python | 2,841 | 98 | # 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 tracemalloc
from functools import wraps
from time import time
def get_... |
cd8acb56dd966a55d78f9fb389de6b1b66085d6273d1e85b4ab68d7aacf489a2 | Python | 2,841 | 88 | # 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... |
276c2a91c444646a23a4a963a0dceee87f7ac4980cce818e34d3106caa10d263 | Python | 2,843 | 85 | # 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... |
9aaadc9a11c22460b277030411c34681f5d615537df9749babc99eaf0c00afcb | Python | 2,843 | 98 | # SPDX-License-Identifier: LGPL-3.0-or-later
import unittest
from collections.abc import (
Callable,
)
from typing import (
Any,
)
import numpy as np
from deepmd.dpmodel.train import (
change_model_out_bias,
change_model_out_bias_by_task,
)
class FakeFittingNet:
def __init__(self) -> None:
... |
5d2463ee753b60f1f619e6555a078fbca96f6330b0e98c88bb3287243a18d38e | Python | 2,844 | 73 | # 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... |
a4b05585463e481b63502f0c01e43d07c3a1512021a7919ebe6d033a21c78ac1 | Python | 2,847 | 97 | import unittest
import rdflib
from pyontutils.namespaces import TEMP, ilxtr, rdf, rdfs, owl
from pyontutils.core import OntGraph
from pathlib import Path
from uuid import uuid4
PAGE_BREAK = "" # C-q C-l
utt = rdflib.Namespace('https://uilx.org/tgbugs/u/r/test/')
path_graphs = Path(__file__).parent / 'examples' / '... |
b020ed87a8d68abdc2dc0be13b96d4a19b6f6b9b8f89188ce82fdfcef75f920d | Python | 2,847 | 90 | # 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... |
b54c3fcb8412ad50c63dd446b41ba96f905ba30fca99181f6eb073ffb0ffc083 | Python | 2,847 | 78 | # 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 Div(Base):
@staticmethod
def export() -> None:
node = ... |
c1e59c771f2716171759c016dd64f2c3e2566877b4de87de9f95640bd8bfed7f | Python | 2,850 | 122 | #%% [markdown]
# # Maggot connectome subset
#%%
import datetime
import logging
import time
import networkx as nx
import numpy as np
import pandas as pd
import pymaid
from pkg.data import DATA_PATH
from pkg.io import glue as default_glue
from pkg.io import savefig
from pkg.plot import (
dashes,
matched_stripplo... |
0ca4f72f163ec57445fbb2538d42c7dc13d07e4964dbe0810ad21fd9067e4e24 | Python | 2,851 | 70 | # 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... |
2e4acc2f13e1e11e44fa126f6b97facfbfae8ec6f04b83970706d947600a93d6 | Python | 2,851 | 75 | # 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... |
23ba2aeb74e5ec11d14edf769eddfbcf649a6a6be67c9d6691c4f9134469bf2c | Python | 2,852 | 86 | import collections as col
import logging
import os
import random
import re
import sys
import click
import torch
import atom3d.datasets.datasets as da
import atom3d.util.file as fi
import atom3d.util.formats as fo
import atom3d.util.rosetta as ar
logger = logging.getLogger(__name__)
# Canonical splits.
TRAIN = \
... |
35ec29b8036baad606b9111ede5d2f2850c7e5bfb9ff5a167ecf9c762b4b3684 | Python | 2,852 | 74 | # Copyright 2019-2021 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... |
c6d036005f76c2bca0ae8773a4968898835615e8c585805935c38822b203d4bb | Python | 2,853 | 117 | import sys
import nibabel as nib
import numpy as np
from skimage.morphology import ball
import scipy.ndimage as nd
def binary_erode_label(img, radius=1):
img = img.astype(np.uint8)
max_radius = 11
indiv_radius = radius // max_radius
iter = radius // indiv_radius
remain = radius % max_radius
... |
ef4017dd2f64e6f87a246f032b6eb76a8b3899fdd62f586fd7a880b35c12dc2f | Python | 2,855 | 83 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcls.models.backbones import VGG
from mmcls.models.utils import HybridEmbed, PatchEmbed, PatchMerging
def cal_unfold_dim(dim, kernel_size, stride, padding=0, dilation=1):
return (dim + 2 * padding - dilation * (kernel_size - 1) - 1)... |
e2870aee1c44973237098e0ed219ffc425b504682a0a4bb42290bd9762a48277 | Python | 2,857 | 82 | # 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... |
ea99fb9cc62b144e8c22016408069ee30b94a3d2b9fa55422835ab6ad3769405 | Python | 2,859 | 83 | __author__ = ["chrisholder"]
import numpy as np
from sktime.clustering.metrics.medoids import medoids
from sktime.dists_kernels._numba_distances import distance_alignment_path_factory
def dba(
X: np.ndarray,
max_iters: int = 30,
tol=1e-5,
averaging_distance_metric: str = "dtw",
medoids_distance_... |
0c668c33b14d2be3fd6d538e45278617270ac6e86497916e29b746efd806c6e1 | Python | 2,861 | 82 | # 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... |
20ef30806286bb611a9b9a801bccc869588c564041243b813fc1257f50222d7c | Python | 2,863 | 105 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining
def _apply_adam(
r, t, x, g, v, h, norm_coefficient, norm_coefficient_post, alpha, beta, ep... |
0dba686ddeb00140d3ea32a369301279292acce1c23555e7429468844097fe0d | Python | 2,864 | 88 | # 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
#
# ... |
e8b64a95f7c399d68567af71445886b6579f6de8f90983671e25925a6dc44506 | Python | 2,864 | 89 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = [
"load_op",
"Adagrad",
"Adam",
"Momentum",
]
import textwrap
from typing import Any
from onnx.reference.op_run import OpFunction, OpRun
from onnx.reference.ops._helpers impor... |
7f5756899feb180b17dacf4d222a52c53410ff31c56959befeaa35a0aa8ce4aa | Python | 2,865 | 73 | import face_recognition
from PIL import Image, ImageDraw
import numpy as np
# This is an example of running face recognition on a single image
# and drawing a box around each person that was identified.
# Load a sample picture and learn how to recognize it.
obama_image = face_recognition.load_image_file("obama.jpg")
... |
af58db15b4ca1ab431e220578343967cc6392dcd86634f8c12198853052064b4 | Python | 2,866 | 82 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""Generic tests for all segment anomaly detectors."""
import numpy as np
import pandas as pd
import pytest
from sktime.detection.capa import CAPA
from sktime.detection.circular_bins... |
7f946c3314b4df51ebfd8696830a1b2dbf5ed0ae689321fc9143b11617e37189 | Python | 2,867 | 77 | # 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... |
b4cc868b2f32d5f4c257f0fa73407b4db99955ef80a6e35e0beafd794fd7cd5d | Python | 2,867 | 84 | from utils import *
import pandas as pd
import numpy as np
import torch.utils.data
import torch
import pickle
import h5py as h5
import os
from torch.autograd import Variable
import h5py
import time
#wandb.init()
class Chip2HiCDataset(torch.utils.data.Dataset):
def __init__(self, seq_length=200, window_size=1400... |
6f9a37212d0a895dc387a22cda77cb295ee522ccf002d079fe50a28595d3d80d | Python | 2,869 | 103 | import numpy as np
from ANNarchy import *
# import matplotlib.pyplot as plt
import time
import pickle
# Personal stuff to send an email once data collection is finished
import sys
sys.path.extend(['/home/will'])
from email_utils import send_email
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
cf636ca1fcf677097cab853ced48a0af1f34fa7977fd383a8f1012afb7fe4118 | Python | 2,870 | 82 | # 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... |
e834c454833fe74135d4c80969b0ea8051de14eae8e407a23703b385ba960402 | Python | 2,871 | 70 | import numpy as np
import pytest
import torch
from short2long.published_models import (METHODS, TabularAdapter, allocation_nll,
build_published_model, chromosome_layout)
GROUPS = np.array([0, 0, 1, 1, 1, 2, 2])
STRUCTURES = ["g0|chr2|+|1-3", "g0|chr2|+|2-3", "g1|chr1|+|1-3", "... |
0c0729326e13b94fae41a3edc08258ce63fb8a6e1b3cd54407e9ec79e0e17252 | Python | 2,872 | 87 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
245b0335cfd7751911dfb2acb815dd32829b7fb900ad5dc25d6c0aba9308caca | Python | 2,875 | 82 | import json
import tensorflow as tf
import numpy as np
import scipy.io as sio
from sklearn.model_selection import StratifiedKFold
class Datagen():
"""Iterator class to sample the dataset. Tensors T_dat and E_dat are provided at runtime.
Args:
maxsteps: length of generator
batchsize: samples p... |
7f50cf466ae20e91759bb26789f0e06b73b143fb89eb6a0c21aa4e497e3c8203 | Python | 2,875 | 107 | #!/usr/bin/env python
import functools as func
import glob
import os
import re
from pathlib import Path
import numpy as np
MMCLS_ROOT = Path(__file__).absolute().parents[1]
url_prefix = 'https://github.com/open-mmlab/mmclassification/blob/master/'
papers_root = Path('papers')
papers_root.mkdir(exist_ok=True)
files =... |
a012b9e81881e2f79b49a55df70ab7e37edd9a4b55322ced3b8f49aed6905d34 | Python | 2,876 | 84 | # -*- 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/.
#
"""Helper functions for parallel processing of ... |
a02fe900843520a110eadd9e5e1542b313c39a2a880c175a22d877bb33052c00 | Python | 2,876 | 107 | #!/usr/bin/env python
import functools as func
import glob
import os
import re
from pathlib import Path
import numpy as np
MMCLS_ROOT = Path(__file__).absolute().parents[1]
url_prefix = 'https://github.com/open-mmlab/mmclassification/blob/master/'
papers_root = Path('papers')
papers_root.mkdir(exist_ok=True)
files =... |
a72a768aa830521b3f61c32946cafb1a5ca70163dcc9a46144b3268db013d67a | Python | 2,877 | 77 | # 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... |
c07f62f835f5685a40aeb2f132c9845e6d4a4a05d9de273f33f42d93cc751c53 | Python | 2,878 | 68 |
#=======================================================================================================================
# 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... |
14fdd5a7864bf19e5aea86320ced10b65d56ab2f030c076c632ef6be2841c69a | Python | 2,881 | 108 | #%% [markdown]
# # Reproducibility
#%%
import datetime
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from giskard.match import GraphMatchSolver
from giskard.plot import matched_stripplot
from pkg.data import load_split_connectome
from... |
3e55dcdccd415994730f947138c67a2638cf186ca4c83eea5561f5f4e19d1312 | Python | 2,884 | 93 | # 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... |
f9474593e1c93de8af7f8e7e74d566011d014193c52681c9f2ec00849dcae863 | Python | 2,887 | 93 | import os
import json
import urllib.request
import urllib.error
import requests
def set_proxy(proxy_dict):
proxy = urllib.request.ProxyHandler(proxy_dict)
opener = urllib.request.build_opener(proxy)
urllib.request.install_opener(opener)
class BaseDB(object):
def __init__(self):
pass
def ret... |
4f26693907f8d4e74a97f7406a334171f4966bccf830f92815273e5b6c5caabe | Python | 2,889 | 82 | # 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
def reshape_reference_implementation(
data: np.ndarray, shape: np.ndarra... |
2ae6fce7a6034ed18312ce18d2296a4fb15372a8dbd3fe5034043bed524b047f | Python | 2,890 | 103 | import numpy as np
from ANNarchy import *
# import matplotlib.pyplot as plt
import time
import pickle
# Personal stuff to send an email once data collection is finished
import sys
sys.path.extend(['/home/will'])
from email_utils import send_email
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
ddc40bbef74625017d9ef46cff3c6d74a1a7c3dac1c7d8dea0d191c7b95b5224 | Python | 2,890 | 73 | import numpy as np
import logging
from mprl.utility_services.worker.base_interface import BaseClientManagerInterface
from mprl.utility_services.lock_server.lock_client_interface import LockServerInterface
logger = logging.getLogger(__name__)
def _get_br_to_strat(strat, payoffs):
row_weighted_payouts = strat @ pay... |
de16b19ce862038affcf0b73e8587b55205c37e80c55b01c8320774c8ed39ddd | Python | 2,890 | 99 | import io
import logging
import numpy as np
import os
import torch
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms
logger = logging.getLogger(__name__)
class MNISTDigitClassifier(object):
"""
MNISTDigitClassifier handler class. This handler takes a greyscale image... |
f55b4c7209be0e8f46586063778dfdaa0a73879a2d5a9003846c16a7e75261cc | Python | 2,891 | 83 | def convert_from_multiindex_to_listdataset(trainDF, class_val_list=None):
"""Output a dataset in ListDataset format compatible with gluonts.
Parameters
----------
trainDF: Multiindex dataframe
Input DF should be multi-index DataFrame.
Time index must be absolute.
class_val_list: st... |
aac844f1d1c4ec2f11c310d12ae4bd1e5a67948c66e02845189f22d2b1aa6af3 | Python | 2,893 | 90 | # 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... |
98c491ba4846a5fe49106aea37f727d226a10d4c701edad843c241ccd57056e2 | Python | 2,894 | 69 | # 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... |
af566f6b6d881e35c78488c43edb07b478de7bf0aad3b6e7706a2f6901c0f1d6 | Python | 2,895 | 95 | import io
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms
from .vision_handler import VisionHandler
class ImageClassifier(VisionHandler):
"""
ImageClassifier handler class. This handler takes an imag... |
0085e16a7cb080126b5d55d989fc5cc922ac1ff2f4a7e200d1f683e28275fc30 | Python | 2,897 | 105 | # 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
#
# ... |
26adf200e1dfa504f2f1ad18700544415567e3e94efef8bf215f9e04ecf23e49 | Python | 2,900 | 69 | from __future__ import print_function
import numpy as np
from itertools import groupby
from featureExtractor import FeatureExtractor
from globalTimeManagement import getTimeDiffInSeconds
class FeatureExtractorFreqHistoWithTime(FeatureExtractor):
def __init__(self, params):
self.params = params
sel... |
cd2482604a6d7a140c71b606178eff18343394b85dc604a0d951e3b00d15180e | Python | 2,900 | 83 | from typing import List, Tuple
import numpy as np
from sklearn.metrics import f1_score
from torch_geometric.data import HeteroData
f_score = lambda x, y: f1_score(x, y, zero_division=1)
EPS_ZERO = 1e-8
def aggregated_color_direction(
color_pred_i: List[float],
color_pred_j: List[float],
color_true_i: L... |
19b325745ebae4689cb6338f8f8b21898c33465d85d5791bf2e08e1ded842517 | Python | 2,901 | 84 | """Isolated numba imports for _msm."""
__author__ = ["chrisholder", "jlines", "TonyBagnall"]
import warnings
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.utils.numba.njit import njit
if _check_soft_dependencies("numba", severity="none"):
from numba.core.errors i... |
6176b3a07cf9132e0dc260b6d614f27ea3e05838ff3895ad86b2a37b38764a7e | Python | 2,902 | 99 | # Code adapted from tensorflow to pytorch from https://github.com/google-research/graph-attribution/tree/main/graph_attribution
from copy import deepcopy
import networkx as nx
import torch
from torch_geometric.data import Data
from molucn.feat_attribution.explainer_base import Explainer
def gen_steps(graph, n_steps:... |
b15613974a5d7669fbdafd1a1f61e95ed73fdeae393cf27932fb96f263cbb018 | Python | 2,904 | 78 | # + [markdown]
"""
# Netplotbrain with spring layout subplot
While networks on brains are useful as they show the geographical locations of nodes, there are other useful ways to visualize networks.
One such example is a spring layout visualizaiton that plots based on the weight of edges.
Netplotbrain integrates with n... |
f9e963c37f6ae0cf02c38ecb1cbe28c184eab829fc5d60f9fe3b7d1feb31e3b3 | Python | 2,906 | 55 | """The Insight transform file format (.tfm), the text form of an ITK transform::
#Insight Transform File V1.0
#Transform 0
Transform: Euler3DTransform_double_3_3
Parameters: 0.01 -0.02 0 6 -4 3
FixedParameters: 1.5 -20 30
A transform is a dict here: {"type": "Euler3D", "dimension": 3, "parameters"... |
b7c041df594ff90abeb88d63b2989122d1c2bef0689d05a5a3b375c213fdf54e | Python | 2,907 | 73 | """Tests for hmmlearn wrapper annotation estimator."""
__author__ = ["miraep8", "klam-data", "pyyim", "mgorlin"]
import pytest
from numpy import array_equal
from sktime.detection.datagen import piecewise_normal, piecewise_poisson
from sktime.detection.hmm_learn import GMMHMM, GaussianHMM, PoissonHMM
from sktime.test... |
0a2552c85c948473a52b671b40fedbb3e3e31d872ce8d0ebd64573d24dfef894 | Python | 2,908 | 87 | import pytest
import pandas as pd
import scanpy as sc
import numpy as np
from palantir.presults import PResults
from palantir.core import run_palantir
@pytest.fixture
def mock_data():
n_cells = 50
n_genes = 10
rng = np.random.default_rng()
return pd.DataFrame(
rng.random((n_cells, n_genes)),
... |
58a0ad742f9d4a7ecd3b7e26f6524c7c3495c83a892d84a960fbb74bfaf2464e | Python | 2,908 | 84 | # 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 _compute_negative_log_likelihood_loss(
x, target, weight=None, reduction="mean", ignore_index=None
):
input_shape = x.shape
i... |
8f02da0ef1dc9f781a057ab35afa70318c069fc3d4cafe586259916ed56adb91 | Python | 2,909 | 77 | # 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
#
# ... |
6b2deedb01b66ba50f8fcfde459e2e8650f157957bbe4a811465803ffb43cd61 | Python | 2,912 | 76 | # Copyright 2023 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.