sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
51a97c7d93732c2adb9ac125cffc35f28f7adf1c5aac92981b47993884e10cd1 | Python | 5,841 | 174 | # Copyright (c) OpenMMLab. All rights reserved.
from numbers import Number
import numpy as np
import torch
import torch.nn as nn
from math import sqrt
from scipy.special import ndtri
def accuracy_numpy(pred, target, topk=(1, ), thrs=0.):
if isinstance(thrs, Number):
thrs = (thrs, )
res_single = T... |
5a96caaaca1d1bf7f56d394effd05535f141e7c11b653af72f6cc0ed39aed19e | Python | 5,842 | 142 | import os
from pathlib import Path
import numpy as np
import torch
from tqdm import tqdm
from tfrecord.tools.tfrecord2idx import create_index
from tfrecord.torch.dataset import TFRecordDataset
from vp_suite.base import VPDataset, VPData
from vp_suite.defaults import SETTINGS
class BAIRPushingDataset(VPDataset):
... |
0e5f651eec3d1db4cea49dffa0704a98e9ac585a9b0b512a0a60165d0aaac47f | Python | 5,847 | 188 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""Penalised interval scorer — stateless wrapper."""
__author__ = ["Tveten"]
import numpy as np
from sktime.detection._penalties import make_bic_penalty
from sktime.detection._utils... |
e09ca13fcb575331e9a26e2ff1d450c0f944c5c8c7a69ce801d9dd1bb5b298d4 | Python | 5,847 | 167 | """
Generate GUI for SegCNN and TrackCNN
"""
import PySimpleGUI as sg
from sys import exit
import tkinter
from tkinter import filedialog
import glob, os
""" check if on windows or linux """
if os.name == 'posix': platform = 'linux'
elif os.name == 'nt': platform = 'windows'
else:
platform = 0
""" GUI for l... |
d7d36890e7da21b9c438038c03125e79278d7c65eb03ca1d15f5b14e21dc81f0 | Python | 5,848 | 180 | # 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... |
6f2000a9cbb62f7273a6c98044f2a23e91bfa6146842861cf0d218d37961428e | Python | 5,849 | 156 | """Time series k-neighbors, from tslearn."""
from sktime.base.adapters._tslearn import _TslearnAdapter
from sktime.classification.base import BaseClassifier
class KNeighborsTimeSeriesClassifierTslearn(_TslearnAdapter, BaseClassifier):
"""K-nearest neighbors Time Series Classifier, from tslearn.
Direct inter... |
d9a19d830159dd9e1fdda482b24b7cb6c221d8b3a71c7d74db3bf9d143c55bb6 | Python | 5,852 | 157 | import tensorflow as tf
import os
import numpy as np
import matplotlib.pyplot as plt
import glob
import random
from natsort import natsorted
from utils import *
import tensorflow.keras as K
import segmentation_models as sm
from keras.models import load_model
from tensorflow_addons.layers import InstanceNormalization
f... |
1e8da2d02666a2f3b3acd803665c8e4c53a6082d15f9171419f828b2e611ab10 | Python | 5,853 | 171 | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
9eb200ab008f0697f3503ef3c0da8c6519e412262147a06c333df25d7d079664 | Python | 5,854 | 167 | """
==============
phantom_import
==============
Sphinx extension to make directives from ``sphinx.ext.autodoc`` and similar
extensions to use docstrings loaded from an XML file.
This extension loads an XML file in the Pydocweb format [1] and
creates a dummy module that contains the specified docstrings. This
can be ... |
0caa9dcb168eb12d3d4efa562dd9f805603506db09f05fe6f2d9b2a2e34d965f | Python | 5,859 | 200 | #!/usr/bin/env python
import click
from click_option_group import optgroup
import json
import numpy as np
import os
import pandas as pd
import sys
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
os.pardir))
import time
import torch
from tqdm import tqdm
ba... |
362bcbea95b24531ad8b99d279278cb0159c5cbfa3f32225c77c28adca725710 | Python | 5,859 | 149 | from __future__ import annotations
import math
from typing import TYPE_CHECKING, Any
from .enums import ColumnSettings, RowSettings, Units, Verbosity
if TYPE_CHECKING:
from .layer_info import LayerInfo
HEADER_TITLES = {
ColumnSettings.KERNEL_SIZE: "Kernel Shape",
ColumnSettings.GROUPS: "Groups",
Col... |
7ea716ac722cc2a5038db20efffe7f9a59093200654e7bc1b7077fdfc65c8e41 | Python | 5,861 | 107 | from sent_bert_emb_viz_util import load_data, encode_data_tuple_ave_word_emb, get_model_from_encoding_output, test_model_from_encoding_output
import random
import pickle
from step4_further_results_from_annotations import get_and_display_results
from sklearn.metrics import precision_score, recall_score, f1_score
im... |
686eb166e006de5b428461b66ca4aaf7d988c97b5be39b51613bfafcbe7af71f | Python | 5,862 | 197 | #%% md
"""
## The basics.
# This notebook goes through a showcase of netplotbrain examples.
"""
#%%
# Import everything needed
import netplotbrain
import pandas as pd
import matplotlib.pyplot as plt
#%% md
"""
Load example data included in package.
"""
# Example node and edges dataframes included with package
nodes =... |
f15a7c70e92d7bf517d18efe1147ead214299122738fa4541145bb837d12fdba | Python | 5,862 | 205 | #!/usr/bin/env python3
'''
Default colormaps and parameters to be used throughout the seas module. The file is saved to config.txt within the seas library. On first import, the config file is loaded and can be accessed through seas.defaults.config.
Default parameters include colormaps, region assignment values, and ... |
a04b24674a4240d71c2202d987d7c49bdb51250c8f5792121d1e162fd800cc5c | Python | 5,865 | 149 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import unittest
import ml_dtypes
import numpy as np
import onnx
from onnx import helper
from onnx.numpy_helper import to_array
from onnx.reference import ReferenceEvaluator
class TestFP6(... |
fff157a521f88b03205f6aedcc174aa0602a1a8edc0dfa19d90db0a50ac0f8e4 | Python | 5,865 | 166 | """
Extract cluster member transcripts from a multi-FASTA.
Given a Corset transcript-to-cluster map and an optional list of target
clusters, write out the transcript sequences belonging to those clusters,
renamed as ``<clusterID>_<transcriptID>`` so that cluster membership survives
into downstream annotation.
"""
fro... |
8f61bb2d3e99ef3b928458bef0b90ff2c35efa2c775e2c5bd3e43a8e2c4fdb1f | Python | 5,868 | 108 | from collections import OrderedDict
from vp_suite.model_blocks import ConvLSTM
from vp_suite.models.precipitation_nowcasting.ef_blocks import Encoder_Forecaster
class EF_ConvLSTM(Encoder_Forecaster):
r"""
This is a reimplementation of the Encoder-Forecaster model based on ConvLSTMs, as introduced in
"Con... |
4a1f07482cdfc943c1a0beab23e443815c6555f7b9f1995219bb5cc967dbfa91 | Python | 5,870 | 161 | from __future__ import print_function
import os
import sys
import numpy as np
import torch
import random
from functools import partial
from torch.autograd import Variable
from torch.nn.parameter import Parameter
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
fro... |
26721b5b37d30a1e7bf22232216f902f798a24c2e36efaf5815d312f60bd6411 | Python | 5,873 | 212 | import jetnet
from jetnet.datasets.normalisations import FeaturewiseLinear, FeaturewiseLinearBounded
import numpy as np
import pytest
from pytest import approx
np.random.seed(42)
test_data_1d = np.random.rand(3) * 100
test_data_2d = np.random.rand(4, 3) * 100
test_data_3d = np.random.rand(5, 4, 3) * 100
test_data_1... |
e8a67bb9c2e1e1dcac85468883c602ba8de4351d7ec74c96851513415781757a | Python | 5,879 | 155 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
import onnx.parser
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Scan(Base):
@staticmethod
def export_scan_8... |
011900bbecc5595a1e441509c437c94f18d14fda0cefba41d48bf0e7dfd05184 | Python | 5,880 | 200 | from typing import List
import numpy as np
import torch
from rdkit import Chem
from rdkit.Chem.rdchem import Atom, Bond
from rdkit.Chem.rdmolops import GetAdjacencyMatrix
from torch_geometric.data import Data
PERMITTED_LIST_OF_ATOMS = [
"C",
"N",
"O",
"S",
"F",
"P",
"Cl",
"Br",
"Na"... |
8b54a8162c06b85b0191a82a9dceb66c822020af2a419d911fc3fd108455bae8 | Python | 5,881 | 131 | import pandas as pd
import argparse
# referenced from https://tdc.readthedocs.io/en/main/index.html
def create_fold(df, fold_seed, frac):
"""create random split
Args:
df (pd.DataFrame): dataset dataframe
fold_seed (int): the random seed
frac (list): a list of train/valid/test fractions... |
bdc40bf4f2b3bdb94c0dd717f283491d0633cf75c206f0311e1aa2cc0a48254c | Python | 5,881 | 175 | # SPDX-License-Identifier: LGPL-3.0-or-later
import copy
import unittest
import numpy as np
import paddle
from deepmd.pd.model.model import (
get_model,
)
from deepmd.pd.utils import (
env,
)
from ...seed import (
GLOBAL_SEED,
)
from ..common import (
eval_model,
)
from .test_permutation import ( # ... |
80ffcf410bdd0b20abab2ceb085fc3355c674f539b7f36d60a94143f7f35e49c | Python | 5,884 | 145 | import imp
import os
import h5py
import numpy as np
from rdkit import Chem
from openmm.unit import *
import torch
from torch.utils.data import Dataset
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader as PyGDataLoader
posScale = 1*bohr/angstrom
energyScale = 1*hartree/item/(kilojoules... |
911c922888d314958d3ee7d140dc0c603c0f514d61f8ec69b2d4cd93fecd2696 | Python | 5,885 | 167 | # SPDX-License-Identifier: LGPL-3.0-or-later
from typing import (
Any,
)
import numpy as np
from deepmd.dpmodel.output_def import (
FittingOutputDef,
ModelOutputDef,
OutputVariableDef,
)
from .deep_eval import (
DeepEval,
)
class DeepDensity(DeepEval):
"""Charge density evaluated on grid po... |
24520f2b6cb43b56cd7f71a02076b211eae5a24099293bb3e91dac47beb302cb | Python | 5,886 | 124 | import json
import random
import os
import cv2
import torch
from tqdm import tqdm
from vp_suite.base import VPDataset, VPData
from vp_suite.defaults import SETTINGS
from vp_suite.utils.utils import set_from_kwarg, read_video
class CaltechPedestrianDataset(VPDataset):
r"""
Dataset class for the dataset "Calt... |
e9136bcc85567cf0ca241b8d43f1f0d63ddc492560224bb4919a79c033f7f639 | Python | 5,886 | 151 | import argparse
import csv
import os
import pickle
import sys
from pathlib import Path
from typing import List, Optional, Tuple, Union
import rdkit
from rdkit import Chem
from rdkit.Chem import rdChemReactions
from tqdm import tqdm
def canonicalize_products(rxn_smi: str) -> str:
'''
Adapted from RetroXpert's ... |
f2cfdae169f95acc1e48b87b5f60045e569d97b96e23bbb1f7f68d855fccc7c3 | Python | 5,887 | 136 | import os
import re
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
from Bio.Alphabet.IUPAC import ambiguous_dna
import sys
def main():
fasta_file = sys.argv[1]
output_file = sys.argv[2]
minleftover = 100 # after trimming start/end, ... |
762f0556df14ec23e5fb84557bc9864f57d18e021177b127d6d632e753270fba | Python | 5,890 | 211 | from __future__ import annotations
import numpy as np
import pytest
from jetnet.datasets.normalisations import FeaturewiseLinear, FeaturewiseLinearBounded
from pytest import approx
rng = np.random.default_rng(42)
test_data_1d = rng.random(3) * 100
test_data_2d = rng.random((4, 3)) * 100
test_data_3d = rng.random((5, ... |
cfb571035b2c18f360b02e2cdeb6994c39c6b50d41136cae63e2931e8c4268ae | Python | 5,894 | 164 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import os
import ray
from ray.rllib.utils import try_import_tf
from ray.tune.experiment import DEFAULT_RESULTS_DIR
from po.rllib.common.cloud_storage import connect_storage_client, upload_file,... |
94570e181a9b6e7282ba80bbf8ba6c99c99e4f1fee3c1e43d0835f41134e8afe | Python | 5,896 | 193 | from molucn.evaluation.explain import get_colors
from molucn.evaluation.explain_direction_global import aggregated_color_direction
from molucn.gnn.train import train_gnn
import dill
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from molucn.utils.utils import (
get_common_nodes,
get_s... |
f2396fb1b25a734ada0499f0e059864501c96c33b1989bb59fe2c35ae53fb51d | Python | 5,902 | 168 | import pytest
import numpy as np
import pandas as pd
import scanpy as sc
from anndata import AnnData
from unittest.mock import patch, MagicMock
from palantir.utils import run_low_density_variability, run_density_evaluation
@pytest.fixture
def mock_anndata_with_density(mock_anndata):
"""Create anndata with densit... |
cf07957bea042397841d3272b77cbcb2568c01fe3917287c3d8bbb1774672102 | Python | 5,904 | 158 | import sys
import warnings
from pathlib import Path
from typing import Iterator, Tuple
import pytest
from torchinfo import ModelStatistics
from torchinfo.enums import ColumnSettings
from torchinfo.formatting import HEADER_TITLES
from torchinfo.torchinfo import clear_cached_forward_pass
def pytest_addoption(parser: ... |
3791223d9ee20d527cf3224a4208923e746e0db4e08c2f5fd73751f5559b8879 | Python | 5,906 | 157 | """
- Sulcal depth (sd) (distance between alpha surface and pial surface) distribution profiles for convex, concave, and saddle shaped points
for all subjects. Convex and concave shaped points are identified by negative and positive principal curvatures respectively
and saddle shaped points are identified by negative G... |
4fd6009ba4d1c8efb6d27df2e412b57874b8e34a00f7275ee862c820e5460f34 | Python | 5,906 | 181 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""onnx shape inference. Shape inference is not guaranteed to be
complete.
"""
from __future__ import annotations
import os
from typing import TYPE_CHECKING
import onnx
import onnx.onnx_cpp2py_export.shape_inference as C # noqa: N81... |
f252cd9169f077e9f38e418ead7fdf73b20b3ff59963c435ff51910a892db76e | Python | 5,908 | 167 |
"""
ModelServiceWorker is the worker that is started by the TorchServe front-end.
"""
import socket
from collections import namedtuple
import mock
import pytest
from mock import Mock
from ts.model_service_worker import TorchModelServiceWorker
from ts.service import Service
@pytest.fixture()
def socket_patches(mo... |
fd0ab38032010d081e3f4f61726e7c0f9a3acbe7d3b31d8876a0f6b02d8e480f | Python | 5,908 | 167 | import argparse
import os, sys
import numpy as np
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
import time
sys.path.append('net/')
from dataset import BCDataset as Dataset
from banet import BANet
from loss import BCELogits_Dice_Loss
from metrics import DiceCoefficient, TPR
sys.path.app... |
4fd9f902a3310c5b1254b5c410631cd14159b10542502efebb6f7e35226a0537 | Python | 5,910 | 170 | # 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... |
54c9eec703d6c3f6c3e2ca3cd2d7ab41bfd47c7cfcb158011c8d110f47137d75 | Python | 5,913 | 158 | """
Author: Junhong Shen (jhshen@g.ucla.edu) and Peidi Xu (peidi@di.ku.dk)
Description: Simulated Annealing for the specific case of vascular network optimization.
This one is not used in our paper
"""
import numpy as np
class SA_Optimizer:
"""
Given a set of nodes, find the optimal location of the branc... |
76426101f63346711864a221adc1dd68b5191c58e3dabe1c8f429713a5723ef5 | Python | 5,913 | 152 | # 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 DFT(Base):
@staticmethod
def export_opset19() -> None:
... |
80d310aa554f6ba8577b81973b69c038ee4ef4ecfde23c089424f0f245fb589d | Python | 5,914 | 166 | # This file provides functions to generate a synthetic dataset with compositional labels.
# Author : Teo Nguyen
import numpy as np
import pandas as pd
import random
##############################################################################################################
def softmax(k,x):
r"""
Return th... |
8458d920e1509fcf8ab62e4f86e7c92baeac36014fde853673703833c138d27c | Python | 5,921 | 133 | """
@file: rl_training.py
Created on 23.06.22
@project: CrazyAra
@author: queensgambit
Utility methods for training with one of the training agents.
"""
import numpy as np
from DeepCrazyhouse.src.domain.variants.plane_policy_representation import FLAT_PLANE_IDX
from DeepCrazyhouse.src.domain.variants.constants import... |
6e2d94d07b7c58693c8d464f957decf3ff40c200b5cddfebea604ae604999b99 | Python | 5,924 | 147 | from __future__ import annotations
from dataclasses import dataclass
from typing import Dict, Optional, Union, List
from typing import get_origin, get_args, get_type_hints
from .config_manager import ConfigManager
import pandas as pd
import numpy as np
from pandas import DataFrame
from scipy.sparse import coo_matrix
i... |
44e5475b6393af6998bfddaaa2d9476ac676d4e9592cf26f1c0e285767b3bb47 | Python | 5,925 | 164 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import os
import ray
from ray.rllib.utils import try_import_tf
from ray.tune.experiment import DEFAULT_RESULTS_DIR
from po.rllib.common.cloud_storage import connect_storage_client, upload_file,... |
5db9b722224fda40846629187b5f3e8eb08e156a87b8efb0e8a12b1b150b5ca9 | Python | 5,927 | 159 | """Code relating to biomolecular sequence."""
import os
import subprocess
import Bio.PDB.Polypeptide as Poly
import dotenv as de
import numpy as np
from Bio.Blast.Applications import NcbiblastpCommandline
import atom3d.util.log as log
project_root = os.path.abspath(os.path.join(__file__, '../../..'))
de.load_dotenv(... |
46723042d5d4be5b61e998776ea04db0d96b1de17db4460f2f0e8879089862a6 | Python | 5,932 | 171 | # 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... |
3bda94113a23aa3dee1a588e076815bdea13de1f28d4dc9fdac8d79fc7f2fa35 | Python | 5,934 | 172 |
"""
ModelServiceWorker is the worker that is started by the MMS front-end.
Communication message format: binary encoding
"""
# pylint: disable=redefined-builtin
import logging
import os
import platform
import socket
import sys
from ts.arg_parser import ArgParser
from ts.model_loader import ModelLoaderFactory
from ... |
dd441268fc62468590c555167fa7a0f822d0322f44989b6a3d24626b4fb3ac2c | Python | 5,937 | 148 | import torch
class DecodeStrategy(object):
"""Base class for generation strategies.
Args:
pad (int): Magic integer in output vocab.
bos (int): Magic integer in output vocab.
eos (int): Magic integer in output vocab.
batch_size (int): Current batch size.
parallel_paths ... |
feab32089b294c9e31db93aab46a0e65e3f95476baac4ce287451ffab04cbba4 | Python | 5,937 | 164 | # 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... |
eeb731ba512fe0fa8f86149c93b55c7ceb6466fe8af6972ab85488ed83b58069 | Python | 5,938 | 157 | # 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 gemm_reference_implementation(
A: np.ndarray,
B: np.ndarray,
... |
05dd72015a0fd3211f2a753fe8d36bfb84140cc5202adda69b3ffaa376aa580a | Python | 5,940 | 178 | import os
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats as stats
import seaborn as sns
def reject_outliers(data):
if len(data) > 2:
clean_data = data[data < np.percentile(data, 99)]
if len(clean_data > 2):
... |
3c0443d9c8721c99b4855a32d46a92b477ef6772beb5d0bc3cf689b0f7d4f3dd | Python | 5,940 | 156 | """Using an detection estimator as transformation."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
from sktime.datatypes import MTYPE_LIST_SERIES
from sktime.transformations.base import BaseTransformer
__author__ = ["fkiraly"]
__all__ = ["DetectorAsTransformer"]
MTYPE_LIST_FOR_DETECTORS =... |
814bce62a4cef838cb945fc5456ebdcbf8a4d7a91f6954b9be6bb70030378ef1 | Python | 5,943 | 150 | from collections import OrderedDict
import torch.nn as nn
import torch.nn.functional as F
from src.base.base_model import BaseModel
class RnnModel(BaseModel):
def __init__(self, config):
super().__init__()
self.config = config
# Assign parameters
self.filter_base = config.network... |
85614c1ece8ee9a05e77069eae9f853a5c429e51bb139cea9ecba62343e89d98 | Python | 5,943 | 186 | # 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
def one_hot(indices, depth, axis=-1, dtype=np.float32):
... |
5d54ce9ab42da8691a791229b5515b8278308f120ab29823249b0c03e125b5e3 | Python | 5,946 | 171 | """
@author:derricw
DW: THIS IS OLD AND IN THE PROCESS OF BEING REMOVED.
#------------------------------------------------------------------------------
Stim.py
#------------------------------------------------------------------------------
Base stim class. Contains common stimulus functions and classes.
All othe... |
b85857da9b8bad686c9e1b17ee4b7d7c83c3708a2f169b0d1f01c384ed131c05 | Python | 5,946 | 164 | # -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
from pyqtgraph.pgcollections import OrderedDict
from .DataTreeWidget import DataTreeWidget
import pyqtgraph.functions as fn
import types, traceback
import numpy as np
__all__ = ['DiffTreeWidget']
class DiffTreeWidget(QtGui.QWidget):
"""
Widget fo... |
ba8a286f9f4fa0b7a38d4f9d7894c8fff87c3e1b9298e4fdf6ba159110a5ed70 | Python | 5,946 | 186 | # SPDX-License-Identifier: LGPL-3.0-or-later
import json
import os
import shutil
import subprocess
from pathlib import (
Path,
)
import numpy as np
import pytest
ROOT = Path(__file__).resolve().parents[3]
LAMMPS_SKILL = ROOT / "skills" / "lammps-deepmd" / "SKILL.md"
LAMMPS_ASSET = ROOT / "skills" / "lammps-deepmd... |
36b9c6396294df599c17d5f5a2015a66917941b8267c2ab183bc613db9b5cd6b | Python | 5,951 | 168 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Sparse ``(i, j, S)`` edge-list converter to :class:`NeighborGraph`.
``neighbor_graph_from_ijs`` is the canonical sparse converter: it takes an
already-built sparse edge list -- per-edge center ``i``, neighbor ``j`` (both
indices within their own frame) and integer period... |
c9cd0e3c9decd5074bc6750848daaee57817239f54edc1681a4a2242404f70bb | Python | 5,951 | 196 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 24 15:35:24 2022
@author: sudhanshu
"""
import os
# from PIL import Image
import torch
from torch.utils.data import Dataset
import numpy as np
import sys
# sys.path.insert(1, '/home/sudhanshu/HDD2/projects2/voxel_type_pc_interaction')
def load_np... |
181c299bd7ffad58d9805f92c866793c63262fd7bd399cd7847b3bf2e08d858b | Python | 5,952 | 148 | # 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... |
86fb228d82f1f5348d52756120467012523215ae5ecff6f019b46e201b9e2441 | Python | 5,952 | 132 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 16 12:04:08 2020
@author: nagehan
"""
"""
Converting ?h.pial to stl file alters the mesh connectivity and vertex coordinates. Therefore vtk file extension will be used.
Converting to stl file alters the connectivity (both by Freesurfer and Meshlab)... |
a03b6b93de2442ac74e1f3f774dd1c7da8dc1bb241bf6432372608a08fdeb9fa | Python | 5,952 | 198 | # 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... |
ae2f96cd51f50c23a7cecc16183faae7320d6652798a9898240e2930bbee8c0c | Python | 5,956 | 154 | """Ensemble decoding.
Decodes using multiple models simultaneously,
combining their prediction distributions by averaging.
All models in the ensemble must share a target vocabulary.
"""
import torch
import torch.nn as nn
from onmt.encoders.encoder import EncoderBase
from onmt.decoders.decoder import DecoderBase
from... |
f6cc2e9facd910679f49ee5fbf5a693a020e8c4a0f4d3a9e913ca80431bb2b86 | Python | 5,958 | 139 | #-------------------------------------------------------------------------------
# elftools tests
#
# Gabriele Digregorio - Io_no
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ import annotations
import os
import tempfile
import unit... |
dd3acec39c1d640e47081364913d67610a7200f63afc6939b5e72896b8f80856 | Python | 5,962 | 161 | # 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... |
f9f01e6d9060c298e6e0f2eeae6bad74015e01a49fccbee34edf84d86f1b6d4a | Python | 5,962 | 164 | import streamlit as st
import os
import urllib
import fastai.vision.all as fai_vision
import numpy as np
from pathlib import Path
import pathlib
from PIL import Image
import platform
import altair as alt
import pandas as pd
def main():
st.title('Fish Masker and Classifier')
for filename in EXTERNAL_DEPENDENCI... |
03c7e1da3e51f43765f7689386849c8fdbe138603b5ea9549155e6e19b747f2f | Python | 5,967 | 190 | from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import BatchNorm1d
from torch_geometric.nn import (
PNAConv,
GATConv,
global_mean_pool,
)
from torch_geometric.utils import softmax
from torch_geometric.nn.inits import reset
from torch_scatter i... |
746fbef951a59863d84f08de18a67be17d54969b5526214133dd73f31742b0d0 | Python | 5,969 | 120 | import matplotlib.pyplot as plt
import numpy as np
import pickle
def plot_graph(data, data_brian, data_nengo, index, title, threshold, lower=5, upper=95):
numNeurons = data['shape']
npRawTimes = data['numpy']
npAvgTimes = np.mean(npRawTimes[:, 1:], axis=1) * 1000
npVar = np.std(npRawTimes[:, 1:], axis... |
a8df219f6db017f8e8621e15966f9ffc7e34833e39ad2bf461384e9607aca632 | Python | 5,971 | 168 | from __future__ import print_function
import os
import numpy as np
import scipy.io
import tempfile
# from ..util import matlab_proc
try:
import matlab.engine
MATLAB_FOUND = True
except:
MATLAB_FOUND = False
# import matplotlib.pyplot as mpl
_proc = None
"""
Wrapper for matlab computations
Uses matlab.eng... |
de707f71e970ebb68a5104c4d899f12d2b65175c038f4896f2e5181bf02b76f6 | Python | 5,972 | 185 | from __future__ import annotations
from pathlib import Path
import numpy as np
import pytest
from jetnet.datasets import JetNet, normalisations
from pytest import approx
from torch.utils.data import DataLoader
# TODO: use checksum for downloaded files
data_dir = Path("./datasets/jetnet")
DataClass = JetNet
jet_typ... |
e4c329c0dacacb181aa7c1b012c936d4b1cf363ce4c98efeffde1215d1f196bf | Python | 5,976 | 183 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Lucky sequence alignment."""
import numpy as np
import pandas as pd
from sktime.alignment.base import BaseAligner
class AlignerLuckyDtw(BaseAligner):
"""Alignment path based on lucky dynamic time warping distance.
This aligner retur... |
c2bc33692fa1d6611238131ccf9435913fe8726f891abc6a70b3b3148d1cde44 | Python | 5,978 | 186 | # 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... |
df7eb20e826d70807b1a439d0da6204edd4d8319d818762db48ad0dd04c5f089 | Python | 5,981 | 130 | #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... |
e7e025a2690cb028e8def6714e85f2477ebc1e5104c222e8d6380015afac9f37 | Python | 5,985 | 204 | #!/usr/bin/env python
from Bio import SeqIO
import click
from click_option_group import optgroup
import json
import numpy as np
import os
import pandas as pd
import sys
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
os.pardir))
import time
import torch
fr... |
c754c35694beff8b73ea9c1c19ab5eb7d52bb89ebcfbfae422df045d19b0a22a | Python | 5,986 | 136 | """
Functions related to Fisher's Exact Test (FET).
Does not appear to need additional dependencies.
"""
def calculate_FET(genesdf, scafdict):
"""
Takes in a rbh file and calculates the false discovery rate using
Fisher's Exact Test.
Scaffolds that are not included in scafdict are removed from the ... |
4959b041a09cd2fec433a54a894728ad76cb16fe32e6ffd1397bf50d602c418b | Python | 5,989 | 202 | # 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... |
69d43c77f763f06b53b847250839537a0ea234a9ad5ee4f20d5a924ee1e826e3 | Python | 5,989 | 174 | # 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... |
49fe8a74c6604f06e31abff00cd101cb9e60e45bd0aeac86f328bb34f98cb0c3 | Python | 5,994 | 133 | import typing
import torch
import flair.embeddings
import flair.nn
from flair.data import Corpus, Sentence, TextTriple, _iter_dataset
class TextTripleClassifier(flair.nn.DefaultClassifier[TextTriple, TextTriple]):
"""Text Triple Classification Model for tasks such as Query-Ad Matching, build upon TextPairClassi... |
066b5630731c906b16ca659f7714b3d6bc061df1db730bd8bf8338f48fe9b799 | Python | 5,996 | 201 | # 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... |
4686da9048c85b7d567b5eb9ece9e22778f153b44eea1ba74e73a12880b6eae5 | Python | 5,996 | 183 |
from GCODi import *
class GCOForest(GCO):
"""
Given a set of fixed nodes (root nodes) and leaf nodes, generates an optimized vascular network that
connects all leaf nodes with the root nodes using Global Constructive Optimization (GCO).
"""
def __init__(self, *args, **kwargs
):
... |
1558c4c8809b85f0c250aa1567bfe9216a884286852a89e5963ce1050cdb8d2b | Python | 6,002 | 170 | # 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... |
67a9a492ce67917dc7f80053add43fffacdb06e66374fd95acd89a0d3027c62e | Python | 6,004 | 139 | import logging
import numpy as np
import os
import pickle as cp
import random
import torch
import torch.optim as optim
from base.trainer_base import Trainer
from gln.data_process.data_info import load_bin_feats, DataInfo
from gln.graph_logic.logic_net import GraphPath
from gln.training.data_gen import data_gen, worker_... |
4ca75d662c0d62f0c2bb571c38b3d74adc18444433fd520910eb11a1b07d69ad | Python | 6,008 | 205 | from contextlib import nullcontext
import numpy as np
import pytest
from mock_data_stream import MockStreamData
@pytest.mark.parametrize(
"srate, tdiff, expected_srate, expected_tdiff, context",
[
(None, None, None, None, nullcontext()),
(1, 1, 1, 1, nullcontext()),
(2, 1 / 2, 2, 1 / ... |
53ec7139d250d0c54fc28e28134bf323c4b3b460e6cc3d75e7b0cd112ff76e01 | Python | 6,012 | 195 | # 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... |
8761dbb86df37af8381d6f420485c5af3a6211a5cb28c28241653cc0b1c97027 | Python | 6,012 | 207 | # 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 ReduceL2(Base):
@staticmethod
def export_do_not_keepdims() -> ... |
1abb61dace408087dbadf342986341556f84226a5598fa3fddfd6ffbece9fecb | Python | 6,015 | 197 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ampligraph documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 17 14:10:15 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... |
c11fbb943c28e0d5752110db79842f280765495874e2ad0f2b09a5f50510243e | Python | 6,015 | 165 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import os
import ray
from ray.rllib.utils import try_import_tf
from ray.tune.experiment import DEFAULT_RESULTS_DIR
from po.rllib.common.cloud_storage import connect_storage_client, upload_file,... |
ca61761ed36e346b06f5c19963fab10c1a7416baf721a4cbf688d665e15536e1 | Python | 6,017 | 195 | # 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... |
2163cdc45f7fa2e0ceee14e1081535b2622517896cb2131f8979c44e154d897f | Python | 6,020 | 150 | import numpy as np
import os
import pickle
# My Scripts
from scripts import models_util
from scripts import training_util
from scripts import testing_util
def concantenate_test_data(config, X, X_biofeat, y, DataHandler):
if config.enzyme == 'multi_task':
a=0 # TODO
else:
X = np.... |
41428769e7bdf8b0d46c9202804ec8bad2919bfc40a97ca945a1ec75d5d7a267 | Python | 6,020 | 137 | # -*- coding: utf-8 -*-
# Written (W) 2008-2012 Christian Widmer
# Written (W) 2008-2010 Cheng Soon Ong
# Written (W) 2012-2014 Daniel Blanchard, dblanchard@ets.org
# Copyright (C) 2008-2012 Max-Planck-Society, 2012-2014 ETS
# This file is part of GridMap.
# GridMap is free software: you can redistribute it and/or m... |
b735b1ba4e11dbaa33f41d04d4669edb94ac973e0c340a08da3f0197fe11609d | Python | 6,022 | 164 | # 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... |
496045ec270bbb78e133ccf1e42532c64e40ae7cce2d716775694a2600964adc | Python | 6,023 | 179 | #!/usr/bin/env python
from Bio import SeqIO
import click
import copy
import numpy as np
import os
import pandas as pd
import random
import re
from sklearn.preprocessing import OneHotEncoder
import sys
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
os.pard... |
34d208c8bcf96076e3c8aaf02337b1b138413b52082ee213e3d5819889162ba9 | Python | 6,027 | 152 | from keras.models import load_model, Model
from keras.layers import Input, Dense
from keras.layers.merge import concatenate
import os
import numpy as np
import scipy as sp
from scripts import models_util
def load_all_models(config):
models_dir = 'models/transfer_learning/' if config.transfer_learning ... |
62f2a8b845348c3a6095e45708442f786f7932cd3d65cddb099f1c027c78a137 | Python | 6,027 | 250 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt
import cv2 as cv
import numpy as np
from dataclasses import dataclass
import os
import random
# from numba import njit, jit
import shutil
from sklearn.utils import shuffle
# In[2]:
### This racial dataset preparati... |
6d0d845db0493e98b2814eeda53ce7e598205bf790cbb84b04a1a3e6bb517d01 | Python | 6,028 | 203 | # 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... |
8071d71ba08a8dbd146508093225f3a46130d20ac340269077a880de2b0184fa | Python | 6,030 | 159 | import random
import cv2
import numpy as np
import torch
import imgaug.augmenters as iaa
from torchvision.transforms import functional as F
import torchvision.transforms as T
def compute_bounding_box_coordinates(mask):
all_coordinates = np.where(mask == 1)
try:
xmin = np.min(all_coordinates[1])
... |
b97fe6c3dcf1ddfd5d26a912bf5351a26d6eb02daffa21455e6a1f44b3469e3b | Python | 6,030 | 212 | '''
nltk.download(['wordnet', 'stopwords', 'punkt']) if not already downloaded.
Should add to wordnet if you want more words to compare as reference to.
'''
from nltk import word_tokenize, pos_tag
from nltk.corpus import wordnet as wn
from nltk.corpus import stopwords
from fuzzywuzzy import fuzz, process
stop_words = s... |
4cce3e89975d79f8075f6cc45977ebe53131d55b069a15826519598f9c1156ac | Python | 6,033 | 177 | from keras.models import load_model
import tensorflow as tf
from keras.callbacks import EarlyStopping, Callback
import warnings
import os
import numpy as np
from keras import backend as K
import keras
class GetBest(Callback):
def __init__(self, filepath=None, monitor='val_loss', save_best=False, verbose=0,
... |
54716694ad850c50d77008e0e5aec4f5d86899955103bf07385256929a5a33ef | Python | 6,035 | 124 | import numpy as np
from scipy.io import savemat
# Have a general dataloader with data types (9 types)
def LoadNetworkDataByID(ID, allThickVals, outMatSaveFile, atlasName, numLab):
"""A general dataloader to load Thickness (Mean, Median) / Volume (Total, ICV, Normalized) values for [IDs x numLab]
Args:
... |
af591fd220d9e153344e470f65a1e5b75d8f2e00a0135a1e4cbdcba960e85fac | Python | 6,036 | 169 | import os
import shutil
import unittest
import pytest
from pyontutils import obo_io as oio
from .common import temp_path, skipif_no_net
obo_test_string = """format-version: 1.2
ontology: uberon/core
subsetdef: cumbo "CUMBO"
treat-xrefs-as-has-subclass: EV
import: http://purl.obolibrary.org/obo/uberon/chebi_import.owl
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.