sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ab5e9c6728d810407257ac2493d0dcd85ef29ed9a082651f20992e512fbb149f | Python | 14,985 | 438 | from __future__ import annotations
import math
from typing import Any
from typing import NamedTuple
from typing import TYPE_CHECKING
import numpy as np
from optuna._warnings import optuna_warn
from optuna.logging import get_logger
from optuna.study import Study
from optuna.study import StudyDirection
from optuna.tri... |
beeb2edc40a0506bda6e1aa8d6b336a47dde0177bc5f695d5ce1de6797cea225 | Python | 14,985 | 537 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 14 18:54:43 2022
@author: sudhanshu
CAPSIF:G PDB utility files
"""
# -*- coding: utf-8 -*-
import os
import time
import numpy as np
from Bio.PDB.Polypeptide import index_to_one
import pandas as pd
from sklearn.linear_model import LinearRegression
... |
c5a95b4ad15dc4544b06196ec3e0e3b86c08d249e8bb8bfb4597456f78cc6ffa | Python | 14,993 | 421 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx import (
AttributeProto,
FunctionProto,
GraphProto,
ModelProto,
NodeProto,
SparseTensorProto,
TensorProto,
)
from onnx.helper import (
make_a... |
5191886eaf3d8c41c98ec321812af4fb951ad6c4a88a6cc544e8a02cef8b6b66 | Python | 15,014 | 365 | """InceptionTime Classifier in PyTorch."""
__authors__ = ["Faakhir30"]
__all__ = ["InceptionTimeClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.inceptiontime import InceptionTimeNetworkTorch... |
c04fc27256e519e7f3e25d54eb90e63e378ec117d0d0398da9822d9d33685ad8 | Python | 15,028 | 410 | import logging
import os
import qt
import slicer
from typing import Callable
from ElastixLib.utils import getContentSuffixes
from ElastixLib.database import BuiltinElastixDatabase, UserElastixDataBase, InSceneElastixDatabase
from ElastixLib.preset import *
class BlockSignals:
def __init__(self, elements):
self.... |
eb76b93fbe810d7b02fdb2d921f128811f979b85d8d8e304451181515d358b24 | Python | 15,037 | 372 | # 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... |
73f5d9fc7aa6e05e40f9074f36ee4732563f1a055fc0c4c4ecf4a95b981847f0 | Python | 15,039 | 440 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 14 18:52:20 2022
@author: sudhanshu
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 29 14:05:48 2022
@author: sudhanshu
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
from Bio.SeqUtils import s... |
c31b625a6f826b0b4a17a2240143722eecb2dcb6f6365c3c13bf4c500c954b07 | Python | 15,039 | 353 | from __future__ import print_function
from neuron import h
from ..util import nstomho
from ..util import Params
import numpy as np
from .cell import Cell
from .. import synapses
from .. import an_model
from .. import data
__all__ = ['SGC', 'SGC_TypeI', 'DummySGC']
class SGC(Cell):
scaled = False
@classm... |
614d92c48bcb0b343af2b253ea9e41b5a78134d8a4cded28431ec6aa10dc1ab4 | Python | 15,042 | 446 | import subprocess
import math
import sys
import argparse #https://docs.python.org/2/library/argparse.html
import json
import time
import datetime
import os
import re
import nibabel as nib
import numpy as np
from pathlib import Path
#import resource
_HONE_=str(Path.home())
sys.path.append(_HONE_+"/pipeline_passwd/")
fr... |
19ca4119b4a6d224bae31ad59ab2dc0fed9a1965c522066888dd98982351fb6e | Python | 15,052 | 384 | # 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... |
93bbb1a932b38b417a8d492d19eefb22e50801fd37e3e3f63a18a589a0ca20ae | Python | 15,062 | 428 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Registry of mtypes and scitypes.
Note for extenders: new mtypes for an existing scitype
should be entered in the _registry in the module with name _[scitype].
When adding a new scitype, add a new Scitype class in datatypes/_[scitype]/_base.... |
c479c336dd0e5f73bbfb8c6df7bccff4161e1743c10d58b15b8414272172f006 | Python | 15,063 | 368 | # SPDX-License-Identifier: LGPL-3.0-or-later
import os
import unittest
from contextlib import (
ExitStack,
nullcontext,
)
from unittest import (
mock,
)
import numpy as np
import torch
from deepmd.pt.utils.auto_batch_size import (
AutoBatchSize,
)
from deepmd.utils.batch_size import (
RetrySignal,... |
21dd277ccec80bca54af6db94812c0895390ff3ad3f282099c6f0edd87240829 | Python | 15,079 | 383 | """A shapelet transform classifier (STC).
Shapelet transform classifier pipeline that simply performs a (configurable) shapelet
transform then builds (by default) a rotation forest classifier on the output.
"""
__author__ = ["TonyBagnall", "MatthewMiddlehurst"]
__all__ = ["ShapeletTransformClassifier"]
import numpy ... |
5c502507a27167a899bda71cff818e57d3fe77a07514422ce63eda1ca20f590b | Python | 15,080 | 425 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""GluonTS-compatible predictor for Tabby-Pretrain.
Usage:
from tabby.predictor import PatchTSTFMPredictor
predictor = PatchTSTFMPredictor(
checkpoint="/path/to/step_0165000",
prediction_length=96,
device="cuda:0",
)
forecasts = p... |
348d458c1ab4c7b709101f94e7e58b0c272dcb902fc0bb9f460cb56aab9877d0 | Python | 15,083 | 520 | '''
The generator populates the first generation with a set of rotamers based on the selection in the input file
.. codeauthor:: Nicholas Browning
.. codeauthor:: Simon Duerr dev@simonduerr.eu
'''
from __future__ import print_function
from __future__ import absolute_import
# Import modules
from builtins import range
... |
9bbe1388c891a3f0074aae6124a9ad254748e557f60e6160559cb6595ce6e13a | Python | 15,090 | 405 | import numpy as np
import argparse
import os
import re
import random
import multiprocessing
from rdkit import Chem
from tqdm import tqdm
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
# Get the mapping numbers in a SMARTS.
def get_idx(smarts_item):
item = re.findall('(?<=:)\d+', smarts_item)
ite... |
ffccc78986785d6dcd32b95748002f6b7eaa8c1ccdff4271f7ac9cae2821d9bb | Python | 15,098 | 401 | # !/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements adapter for pmdarima forecasters to be used in sktime framework."""
__author__ = ["mloning", "hyang1996", "kejsitake", "fkiraly"]
__all__ = ["_PmdArimaAdapter"]
import pandas as pd
from sktime.datatypes._... |
9dfdc4e9d80aa7a0b8468d5a713634a8ff3552eb3c40daad1f2e0b015877a403 | Python | 15,106 | 434 | # SPDX-License-Identifier: LGPL-3.0-or-later
import copy
import json
import os
import tempfile
import unittest
import warnings
from unittest import (
mock,
)
import torch
from packaging.version import parse as parse_version
from deepmd.pt.loss import (
EnergySpinLoss,
)
from deepmd.pt.model.model import (
... |
bf492e2da0ccb213135e9954f4b1e0bcf3b56414dabd6a93e13b3f0ccfa53d28 | Python | 15,110 | 325 | import importlib.util
import warnings
import pytest
import torch
from PIL import Image
from transformers.utils import is_detectron2_available
from flair.data import BoundingBox, Dictionary, Sentence
from flair.embeddings import TransformerJitWordEmbeddings, TransformerWordEmbeddings
from flair.models import SequenceT... |
de2995823c3c422eb5496c51abbe646a0d10bb78ddee4b056824822a202329de | Python | 15,118 | 248 |
import numpy as np
import random
from stratego_env import StrategoMultiAgentEnv, ObservationComponents
from stratego_env.game.stratego_procedural_impl import SP, StateLayers
from mprl.barrage_agent_api.create_initial_state import STRATEGO_ENV_BARRAGE_INTERFACE_CONFIG, P2SRO_AGENT_PLAYER_ID, \
OUTSIDE_AGENT_PLAYER... |
7c659aede32225ff9cdccfc1b77f19b3fcf7161ab7460f1442fffbed0a03855f | Python | 15,121 | 419 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 req... |
896bb3c1b678df8858a8d2ae353cd3349020d53bcba56864dc994bf3809f9496 | Python | 15,122 | 426 | # 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
#
# ... |
695e7138c54acf207963e9acacea156b99bce88d3398021e6e903d17ae08a1a5 | Python | 15,123 | 420 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import locale
import platform
import pytest
import onnx
from onnx import GraphProto, OperatorSetIdProto, TensorProto, checker
class TestBasicFunctions:
def check_graph(self, graph: GraphProto) ->... |
a8755f87e1b31309de9cfd3a0824627ab02112ee15e9b2d3ce02d8a30c0dde2a | Python | 15,124 | 403 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Mixin with pretrain state logic shared by estimator base classes."""
__author__ = ["SimonBlanke", "srupat"]
from collections import defaultdict
from skbase.base import BaseObject
from skbase.base._clone_base import _check_clone, _clone
from ... |
f2b87a48523b805739c6c5ac33e3f83cb51f8b495128622c85016e467c9042ef | Python | 15,128 | 395 | # 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... |
feaa8214d88066424ec19aeab3bdd8e4146d7f4d5bcc5f1ca28f28608eed9de1 | Python | 15,129 | 389 | import argparse
from tqdm import tqdm
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import MultiStepLR
from data import *
from model.gat import *
from util.misc import CSVLogger
import random
import torch
import numpy as np
import os
from typing import Optional
parser = argparse.ArgumentParse... |
5af7a490768b0f2299a975e73aec4f5ef128dbffc615685857ac85263e1fce1e | Python | 15,140 | 354 | # Copyright (c) OpenMMLab. All rights reserved.
from numbers import Number
import numpy as np
import torch
from math import sqrt
from scipy.special import ndtri
from sklearn.metrics import confusion_matrix as cfm
from sklearn.metrics import ConfusionMatrixDisplay
import matplotlib.pyplot as plt
import seaborn as sns
... |
e8d3ad77492daf4604308d9ffe7857c63d2b16180f4810b0922c1ced7a3a2704 | Python | 15,141 | 366 | #!/usr/bin/env python
#-------------------------------------------------------------------------------
# test/run_readelf_tests.py
#
# Automatic test runner for elftools & readelf
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#------------------------------------------------------------------... |
f680840bf0f55cb453f8f7896a9f055b1b4569b56398fccd8835a751d59919eb | Python | 15,147 | 332 | from __future__ import print_function
from neuron import h
from ..util import nstomho
from ..util import Params
import numpy as np
from .cell import Cell
from .. import data
from .. import synapses
__all__ = ['Cartwheel', 'CartwheelDefault']
class Cartwheel(Cell):
celltype = 'cartwheel'
scaled = False
... |
c231bd716d938dade10f5cd5296d1716d4f2ca32c48c269eba770006760968a1 | Python | 15,158 | 434 | # 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... |
020d22c3049654e836c1655984701431446faca497c2bbe4c7b7a1b4ed1aa13e | Python | 15,172 | 483 | # 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... |
80761024642fbbd027e3ea4aca173b90d0c386adca5689ab6c4b0d90187590ef | Python | 15,173 | 497 | import argparse
from email.policy import default
import numpy as np
import torch
def get_bool(arg: argparse.Namespace) -> bool:
"""Parse boolean from input string.
Adapted from https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse
"""
if isinstance(arg, bool):
retur... |
35610f659b2f5eaadf3c6f56343bef48f418b95e4eea7acde4c04553a51dd244 | Python | 15,175 | 425 | # 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... |
7a2785830e186e94ab6cfa7fda9eaef78204372e8c6e550b38b2ff03a2dda56e | Python | 15,177 | 417 | # 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... |
2b6d97a72c93d84c31b559d66525f72a3577ad2d3fbeb2fa4fa57cec1b6178e3 | Python | 15,180 | 424 | """Contextual Time-series Neural Classifier for TSC."""
__all__ = ["CNTCClassifier"]
from copy import deepcopy
from sklearn.utils import check_random_state
from sktime.classification.deep_learning.base import BaseDeepClassifier
from sktime.networks.cntc import CNTCNetwork
class CNTCClassifier(BaseDeepClassifier):
... |
78c3fc90af8d368709c0fa02d8c4b860b1e361ae1f53d93d8a8ba7746de91fcd | Python | 15,201 | 423 | """Utility functions for clusterings and embeddings
"""
from __init__ import *
# from sklearn.decomposition import PCA
import igraph as ig
from scipy import sparse
from annoy import AnnoyIndex
from umap import UMAP
import leidenalg
from basic_utils import create_logger
# major change in annoy functions 5/7/2019
def... |
702afdcc6c525abbb1371d062507686e2fa4315fd8cd4c06d541c04499ec0d1f | Python | 15,212 | 482 | import numpy as np
from matplotlib import pyplot as plt
from scipy import linalg
from numba import jit, njit, float32, float64, uint, vectorize
np.seterr(all='warn')
import warnings
def calculate_ss(x_bar, s_bar, b, m, p):
"""Calculates the required second order expectations
Parameters
----------
x_... |
391b7f08f1ce356d8c7f675d474b8c44aa8e1e636cc4032ed414615d18765c39 | Python | 15,215 | 344 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_face_recognition
----------------------------------
Tests for `face_recognition` module.
"""
import unittest
import os
import numpy as np
from click.testing import CliRunner
from face_recognition import api
from face_recognition import face_recognition_cli
fro... |
3eed8085ca197aebe0c2356f9b0020f6c530ac93079c93ab2e4b1ac434d7f00d | Python | 15,217 | 405 | import multiprocessing as mp
import os
from itertools import product
from typing import Any, Callable, Optional, Union
import numpy as np
from scipy.spatial import Voronoi
from sklearn.preprocessing import OneHotEncoder
from torch import from_numpy, long, tensor, where
from torch_geometric.data import Data, InMemoryD... |
7bb4021c4d90a08be7e36af4c86601448d9aaa6277d27b1fbaa03814d34b0b16 | Python | 15,221 | 358 | """Save data as Numoy array"""
import os
from datetime import datetime, timedelta
import pickle
import numpy as np
import pandas as pd
from timeflux.core.node import Node
from timeflux.helpers.port import get_meta, match_events
from timeflux.nodes_dev.helpers import get_dict_keys_by_start
# Statuses
IDLE = 0
ACCUMU... |
c3d4caeba73c2c50039d998c4798bf8973633f070c4a9a1408737a7824af8f27 | Python | 15,236 | 358 | import os
import logging
import csv
import requests
from pathlib import Path
import pandas as pd
from template_generation_utils import read_csv, read_csv_to_dict, read_taxonomy_details_yaml, index_dendrogram
from dendrogram_tools import dend_json_2_nodes_n_edges
GENE_DB_PATH = os.path.join(os.path.dirname(os.path.rea... |
b70e75cc01ddd467f9cae1f50cb1661aef70f3557ad5c279ffdfc3eaca2854e7 | Python | 15,244 | 365 | """MLP (Multi-Layer Perceptron) Classifier for Time Series Classification in PyTorch."""
__authors__ = ["RecreationalMath"]
__all__ = ["MLPClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.mlp... |
93505970e8a25ccd2fa16b6572937797489bdae5343cb43d19be042ad6f2a5d8 | Python | 15,260 | 389 | from __future__ import division
import os
import numpy as np
import pandas as pd
import pylab as plt
import seaborn as sns
from scipy.fftpack import fft
from helper_lib import filelib
class TimeSpectrum(object):
"""
Class for storing and handling the dynamics of SPHARM spectrum of a cell.
"""
def _... |
c756947dd151a7b2124097b7ef9a7790b5e9286ea5dffb7faac38bdfd0298e41 | Python | 15,265 | 382 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""
Environment-variable gates for the SeZM/DPA4 hardware-accelerated kernels.
This module centralizes the opt-in selectors that route inference and training
through the custom Triton, CuTe, CUDA and CPU kernel packages. The gates are read
once at model construction time so... |
a00645e14f8847f653e4e0a7d6dfa3edc169231cf88aee341c331a8c402ee934 | Python | 15,266 | 437 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 14 18:52:20 2022
@author: sudhanshu
Usage: python preprocess.py
Returns:
Changes files from ../dataset/[test,test_af,val,train]/pdbs/*.pdb to
../dataset/[test,test_af,val,train]/g_npz/*.pdb.npz
for all train/test protocols
"""
import numpy as np
... |
d10533064e0a78f746a44de7584a69d1a9c3b76ed5e15d920148d2bf016c0875 | Python | 15,277 | 532 | from os import stat
from typing import Tuple, Union
import torch
import numpy as np
from scipy import stats
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
NUM_BINS = 81 # Number of bins for all histograms
PLOT_FONT_SIZE = 14
def get_magnitude(p, gpu=True):
"""Get the momentum magnitude |p... |
a310376397ac9a9d4858baf8637abaf20ee6740ee63f329a6043cff53dc638f6 | Python | 15,279 | 390 | # Copyright 2020 by Gongfan Fang, Zhejiang University.
# All rights reserved.
import torch
import torch.nn.functional as F
def _fspecial_gauss_1d(size, sigma):
"""Create 1-D gauss kernel
Args:
size (int): the size of gauss kernel
sigma (float): sigma of normal distribution
R... |
cd997d9094331ef0161dcf2ff56284abccd772f32e350e9d9efe5af72f164acb | Python | 15,279 | 371 | """Time Recurrent Neural Network (RNN) for classification in PyTorch."""
__authors__ = ["RecreationalMath"]
__all__ = ["SimpleRNNClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.rnn import RN... |
ad08c9bbf20903a00e3a0b97f026913a188226d6c45860a3b5be750b7610e673 | Python | 15,286 | 418 | # 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... |
ef40c49208ff72fdf57aca4f1abe9192024c6d81a0869cfdaabf4eaca6c90645 | Python | 15,303 | 377 | """
Plot the impedances as seen from the soma for VCN cells
for different dendritic configurations
Assumes that the analysis has already been done, and that the
location of that data is given in the 'wheres_my_data.toml' file
Generates: Figure3_Supplemental3_Zin.pdf
This module is part of *vcnmodel*.
Support::
N... |
912b104cff09b0f5a84d91bfbe307d2f423645c3a22c7bd00608ae5cc769ee19 | Python | 15,316 | 439 | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
# Lots of different places that widgets could come from...
try:
from ipywidgets import interact, FloatSlider, IntSlider
except ImportError:
import warnings
# ignore ShimW... |
ef5051a9d98a9ebefe1c808d3c45a50afb5c466252629a443e3cfefed3f6f3e0 | Python | 15,318 | 381 | """
This includes: LossComputeBase and the standard NMTLossCompute, and
sharded loss compute stuff.
"""
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
import onmt
from onmt.modules.sparse_losses import SparsemaxLoss
from onmt.modules.sparse_activations... |
dc24dea7a0128d92c79adab2254df9e3e6bcee61c5cf9ce9691b07cf2efc0928 | Python | 15,324 | 320 | from rdkit import Chem
import os
import argparse
from tqdm import tqdm
import multiprocessing
import pandas as pd
from rdkit import RDLogger
import re
lg = RDLogger.logger()
lg.setLevel(RDLogger.CRITICAL)
def smi_tokenizer(smi):
pattern = "(\[[^\]]+]|Br?|Cl?|N|O|S|P|F|I|b|c|n|o|s|p|\(|\)|\.|=|#|-|\+|\\\\|\/|:|~|... |
747f6cd354c67ac43a921462a6ba27266d0bd3e0f0b7f7993c140d55474c8c26 | Python | 15,325 | 384 | """Dynamic time warping distance, from dtaidistance."""
__author__ = ["fkiraly"]
import numpy as np
from sktime.dists_kernels.base import BasePairwiseTransformerPanel
class DtwDtaidistUniv(BasePairwiseTransformerPanel):
"""Univariate dynamic time warping distance, from dtaidistance.
Direct interface to ``... |
6a90e3a2db173a28ed311494257b8ce0ebed4498ccc0840a20d10769210bc7d2 | Python | 15,330 | 428 | """CLI entry points for bcblib.imaging (``bcb-info``, ``bcb-stats``, etc.)."""
import argparse
import json
import os
import sys
from pathlib import Path
# -----------------------------------------------------------------------
# Terminal styling helpers
# -------------------------------------------------------------... |
8d21c5c598ef6cb964c5c71706f25def0a71d19c8c27b36a4e86ee94bb22b6ea | Python | 15,334 | 302 | """
@file: train_cli_util.py
Created on 10.11.23
@project: CrazyAra
@author: queensgambit
Provides utility functions for train_cli.py.
"""
import logging
import os
import sys
import shutil
import numpy as np
from pathlib import Path
import glob
# Pytorch imports
import torch
from fvcore.nn import flop_count_table
fro... |
ab0913136f3c3d2ce676ad198cd7f9ebf38d5e27d55a07ffe37b5aefb5a71350 | Python | 15,339 | 414 | import torch
import math
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
class LTE(torch.nn.Module):
def __init__(self, requires_grad=True, rgb_range=1):
super(LTE, self).__init__()
vgg_firstlayer = models.vgg19(pretrained=True).features[0]
... |
cf74a688146d235f8160344156006a9d02ac24fc5f34f292be69c8b598fd32cc | Python | 15,356 | 443 | #!/usr/bin/env python
import click
from functools import partial
from fastcluster import linkage
import json
from multiprocessing import Pool
import numpy as np
import os
import pandas as pd
from scipy.cluster.hierarchy import fcluster
import sys
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), os.pardir)... |
5ee76a848d16f3ab185e2c846a7aee20703ba2623a716f501f98b129bf8ba7e5 | Python | 15,361 | 396 | # 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... |
7899c7efdec54d1de81bc171457b24d765b851b3e3151ebe29bff25c59f0c87f | Python | 15,371 | 488 | #!/usr/bin/env python
__doc__ = """
3D Vector class.
Modified from the vec3d class on the pygame wiki site.
http://pygame.org/wiki/3DVectorClass
Kisuk Lee <kisuklee@mit.edu>, 2017
"""
import math
import operator
class Vec3d(object):
"""
3d vector class, supports vector and scalar operators,
and also p... |
306f22267cb80b57842fcfde3e31753d0ee24b920759135f2a19f667490b7a8c | Python | 15,373 | 379 | import pytest
from test.common import _TestNeuronsBase, pyel, tel
from neurondm.core import UnionOf, IntersectionOf, IntersectionOfPartOf
'''
class TestNeurons(_TestNeuronsBase):
# TODO make sure this runs after cli test? it should ...
# but then we need to keep the output of ndl around
def test_load_exist... |
46a428be0f5910c7bea4d412c938ee47bb5660ad3e52442e5638fc63fd4ffbbd | Python | 15,381 | 598 | """
Command line interface for corset-tools.
Exposes the four helper tools as subcommands of a single ``corset-tools``
entry point. Each subcommand is a thin wrapper that validates arguments and
delegates to a ``run_*`` function, so the underlying logic stays importable and
testable without click.
"""
import logging
... |
0dc738492c6c3da3726ffc5e79b54373838c336d4197322f4321f54d3f78081e | Python | 15,383 | 427 | """Hierarchical Vote Collective of Transformation-based Ensembles (HIVE-COTE) V2.
Upgraded hybrid ensemble of classifiers from 4 separate time series classification
representations, using the weighted probabilistic CAWPE as an ensemble controller.
"""
__author__ = ["MatthewMiddlehurst"]
__all__ = ["HIVECOTEV2"]
from... |
7a08d3e9dfed935d6a29c62c2083d9764f72647acb581df4b9ef02bb662176e0 | Python | 15,383 | 411 | # -*- 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 ... |
9bbfbfdfa0dba88a966eef64dd5b6c0cd31142c635d004aa215f90eaa229c21c | Python | 15,400 | 421 | from typing import Optional, Tuple
import numpy as np
import torch
from torch import Tensor, nn
from torch_geometric.nn import MessagePassing
from torch_scatter import scatter
from models.torchmdnet_utils import (
NeighborEmbedding,
CosineCutoff,
Distance,
GatedEquivariantBlock,
rbf_class_mapping,
... |
c626f73c606c9c16f9fa93d6ddf5ddfcf19606ee173909ab7e53584c95fb068f | Python | 15,409 | 489 | #!/usr/bin/env python
__doc__ = """
3D Vector class.
Modified from the vec3d class on the pygame wiki site.
http://pygame.org/wiki/3DVectorClass
Kisuk Lee <kisuklee@mit.edu>, 2017
"""
import math
import operator
__all__ = ['Vec3d', 'minimum', 'maximum']
class Vec3d(object):
"""
3d vector class, supports ... |
8250e1a1e0cd637331a329d2f29cb0a07c3e4ebce6394f323335e3ce9e9ef8a4 | Python | 15,416 | 499 | # 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... |
20dbc87af06e6c9aee62ccc122970da31aa339078c5b8cc782a5676529d54cb6 | Python | 15,418 | 302 | import os
import pickle
from build_cell_grid import build_cell_grid
os.environ["OPENCV_IO_MAX_IMAGE_PIXELS"] = str(pow(2, 140))
import PIL.Image as Image
import cv2
import ipywidgets as widgets
import numpy as np
from IPython.display import display, Markdown, Javascript, HTML
import pandas as pd
from allensdk.core.m... |
9b6ee8e915e9943a6351d5dc4efceb664133dc7eaa883b1cbdde51efc52236f6 | Python | 15,419 | 444 | """E-Agglo: agglomerative clustering algorithm that preserves observation order."""
import warnings
from collections.abc import Callable
import numpy as np
import pandas as pd
from scipy.spatial.distance import cdist
from sktime.transformations.base import BaseTransformer
__author__ = ["KatieBuc"]
__all__ = ["EAggl... |
bc629ae3520cb85919ea4dbffca55662b4fe2a042c072ca4bfc4159a96006e84 | Python | 15,429 | 470 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = [
# Constants
"ONNX_ML",
"IR_VERSION",
"IR_VERSION_2017_10_10",
"IR_VERSION_2017_10_30",
"IR_VERSION_2017_11_3",
"IR_VERSION_2019_1_22",
"IR_VERSION_2019_3_18"... |
e34d28472c08621bfa3b2a84ae1ae45a5daa7c6132902f9624a53e35c106013e | Python | 15,441 | 416 | # 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... |
73b81f9a33e41c82c602858fcbb236435228c0e367c03891de0b7e5fd1fd7f5b | Python | 15,449 | 305 | #!/usr/bin/env python
"""
This code handles the coloring of the orthlogs in a rbh file.
There are a few ways to do this. The first way is to just color the
proteins based on their protein IDs. If the protein ID matches the
protein ID of the model, then just give the the color specified in
the model. This requires det... |
cbc8c447d59d4a7557559cba061d47c8cb13e628cb9dcbc5b62ccba0e416f2d6 | Python | 15,461 | 473 | """Relation computation for ParaDime.
The :mod:`paradime.relations` module defines various classes used to compute
relations between data points.
"""
from typing import Union, Callable, Optional
import warnings
import torch
import torch.nn.functional as F
import pynndescent
from scipy.spatial import distance
from p... |
5354730586da47eca825db617419a8a65fb20370ba08dd3b93300298d1264914 | Python | 15,466 | 284 | """Fixed-protocol source-selected improvement; external labels only enter evaluation."""
from __future__ import annotations
import argparse
import copy
import json
import time
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from scipy import sparse
from .conservative_model import (Conser... |
cd7551dacf50a9356e3b6488e91a21e92303c02d71604e5c9ecff9e7707d334b | Python | 15,473 | 382 | """ConvTimeNet (PyTorch) classifier for time series classification."""
__authors__ = ["Tanuj-Taneja1"]
__all__ = ["ConvTimeNetClassifier"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.convtimenet import Co... |
7b4547aa5aa19fc5eea91e664aec4878e86fca895a0bbbf14ab5a943a2436ad4 | Python | 15,485 | 463 | import h5py
import numpy as np
from collections import OrderedDict
class StimulusFile:
"""
A class to read and write stimulus file
"""
def __init__(self, fname):
"""
Parameters
----------
fname : str
pre-designed .stim.csv file.
Format... |
83ccf461249317ee3b31fae5da6618cdd418c291a879a2b3cdf149e26a0d4401 | Python | 15,493 | 310 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
"""Demultiplex sequencin... |
dddbfcf9c168cb502db637124f2767a019af92456c36a9be88036e84368dbf0e | Python | 15,497 | 447 | """Utilities for downloading datasets."""
__author__ = ["jgyasu"]
__all__ = ["DatasetDownloader"]
import os
import shutil
import tempfile
import warnings
import zipfile
from pathlib import Path
from urllib.error import HTTPError, URLError
from urllib.request import urlretrieve
from skbase.base import BaseObject
fro... |
4f0a3c85d4a198ce7c49ca00b0dc8d81d7e2d4b9aad4f701474196d30d8fa507 | Python | 15,514 | 440 | """
Input preprocessing for PatchTST-FM pretraining.
Available utilities include:
- make_cpm_prediction_mask: create prediction masks for the CPM-style pretraining objective.
- mask_aware_normalize: compute mean/std from visible real values and apply asinh normalization
while zeroing out all masked positions.
"""
... |
7eed82a430a33046661f1af717f785b958a0d1446248d2a92e11732474810837 | Python | 15,515 | 380 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
import numpy
def distance(a, b):
"""Return the euclidian distanc... |
301d4839deea93291155663bc51762269020cf920759b2e046299f7f5730461b | Python | 15,530 | 404 | # 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 glob
import logging
import os
import pickle
import shutil
from time impo... |
2f1632c69c64886e812d14b6e74bfb59a5e1c03a1b17b4288663bf18b2f53b5f | Python | 15,543 | 444 | import pytest
import pandas as pd
import numpy as np
import warnings
import scanpy as sc
from anndata import AnnData
from pandas.testing import assert_frame_equal, assert_series_equal
from palantir.validation import (
_validate_obsm_key,
_validate_varm_key,
_validate_gene_trend_input,
normalize_cell_id... |
e2c74e621f38a74a7154a50e991e2dda1de9bd66f75ee0960fc67c6f9a1f178d | Python | 15,544 | 408 | # 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... |
3b007cc0e17cc7c43d3f603a795a3cfeaf4ed3eb080afdc6aae675863570c5a0 | Python | 15,555 | 371 | import os
import copy
import logging
import numpy as np
import scipy as sp
import scipy.spatial
import pandas as pd
import torch
from torch.utils.data import Dataset, DataLoader
from atom3d.datasets import LMDBDataset, extract_coordinates_as_numpy_arrays
from utils import batch_stack, drop_zeros
class CormorantDatase... |
5ef3c3a131534e3416fd5bb750d5ff69237e361cda8543aa05c3899141a6dcb0 | Python | 15,555 | 456 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements Aurora for forecasting."""
__all__ = ["AuroraForecaster"]
import contextlib
import io
import numpy as np
import pandas as pd
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.forecasting.base import BaseFo... |
a984f0e971d39ed7a5b5803e0d33e6f2b18a604004e20093fd6070470973e458 | Python | 15,584 | 456 | # 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... |
5b923b559ecafb9dadd0df339876cd19c436e7b95ebd56c08fe5569a0c223d09 | Python | 15,590 | 559 | # 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... |
8fc09f6443bc2755a05477fc3924bd05105e4c64256f4965b9e13e9f78005cb9 | Python | 15,603 | 517 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 12 16:04:19 2021
Load up and plot spatial results
@author: robert.mok
"""
import os
import sys
import numpy as np
import torch
import itertools as it
from scipy.stats import binned_statistic_dd
import matplotlib.pyplot as plt
import pandas as pd
... |
94fa230b085d4f94f8681093f2b92a4d9b7862a145cea6641c65976ccd3fb573 | Python | 15,609 | 245 | # this program calculates the binary filtering of UMLS concept extraction from the 'for validation - SemEHR ori.xlsx' sheet.
from sklearn.metrics import precision_score, recall_score, f1_score, confusion_matrix
import numpy as np
import pandas as pd
import sys
# input gold labels and pred labels
# display pre... |
e50d024cf7384a5c9a8b770d34deb241ff7f96ec3674fcc8c712d5e98675aac2 | Python | 15,612 | 410 | #!/usr/bin/env python
# coding: utf-8
""" Python module for plotting results from the Partial Least Square Correlation analyses (from the myPLS MATLAB toolbox)
Run as:
python Visualize/plot_PLSC.py
"""
import numpy as np
import pandas as pd
import os.path as op
import matplotlib.pyplot as plt
from matplotlib imp... |
9c1cd69ca26dc33dc8c62febcb31464bce4fba3fa9d82d24d3a175bb8e30db29 | Python | 15,619 | 392 | # -*- coding: utf-8 -*-
# from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import argparse
import JH_utile
# import JH_DataAug
import JH_net_par... |
bf2a1b00e3bf10ae2098a3a60afed8f129e06d6142d6e64e0c0a56bf57825fb1 | Python | 15,626 | 548 | from typing import Tuple, Union
import torch
import numpy as np
from scipy import stats
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
NUM_BINS = 81 # Number of bins for all histograms
PLOT_FONT_SIZE = 12
def get_magnitude(p, gpu=True):
"""Get the momentum magnitude |p| of the 4-vector.
... |
9d23edc02b44da9b578edea5a1188ccc55d78c824bf08e2919fcee2392d8a6a7 | Python | 15,633 | 439 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Test LAMMPS with a .pt2 DPA4C model that carries a long-range module.
The latent-charge module sums over every pair of atoms of a complete
non-periodic system, and over the images of the cell of a periodic one when
it serves periodic systems, so ``pair_style deepmd`` run... |
27a8781063a26ba919305ae1b60a3c4693caf16dad87cb0da0153018f30d7998 | Python | 15,634 | 508 | import rdflib
from ontquery import OntCuries
from pyontutils import combinators as cmb
from pyontutils.core import OntId, OntTerm as OntTermBase, OntGraph
from pyontutils.namespaces import ilxtr
from pyontutils.closed_namespaces import rdf, rdfs, owl
neurdf = rdflib.Namespace(str(ilxtr) + 'neurdf/')
_current_collect... |
b40c728c5feb9ffd4bd616e518dbe954830c716e782829cbe29f5b3483818151 | Python | 15,647 | 288 | from __future__ import print_function
__author__ = 'pbmanis'
"""
Decorator:
A class to insert biophysical mechanisms into a model.
This function attempts to automatically decorate a hoc-imported model set of sections
with appropriate conductances.
The class takes as input the object hf, which is an instance of morpho... |
d876e66537d5f51f634bf7f625c11420e8b37e69d532790c0a1f41b42457003e | Python | 15,652 | 528 | # 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... |
e6ba546ab502d8c82e446d975970067dbe65841fc946ba7781d8d8800d676f84 | Python | 15,655 | 452 | # Copyright 2019-2021 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 tensorflow as tf
import tensorflow.compat.v1 as tf
import abc
import lo... |
7752c7fcfd932329583ad1d88bd94ac05673a627cbc43016fddad645bf048692 | Python | 15,657 | 513 | """
SWC File format from CNIC:
n T x y z R P n is an integer label that identifies the current point and
increments by one from one line to the next.
T is an integer representing the type of neuronal segment, such as soma, axon,
apical dendrite, etc. The standard accepted integer values are given below.
0 = undefine... |
39e39c30a8784433314a38104ab615be57ce28f4f333c7b3171ce0ecd3e5a716 | Python | 15,668 | 466 | from typing import Optional, Tuple, Union
from utils.utils import make_dir
import os.path as osp
import numpy as np
import torch
import matplotlib.pyplot as plt
import awkward as ak
from coffea.nanoevents.methods import vector
ak.behavior.update(vector.behavior)
IMG_VMAX = 0.05
def plot_jet_image(
p_target: np.... |
20e4d508cbaaf23f637c50654eb2cf1996c85c5942c764c5f0aa66ca43a61629 | Python | 15,671 | 433 | from sklearn.neighbors import KernelDensity
from scipy import signal
from scipy.signal import argrelextrema
import numpy as np
import math
from itertools import compress
from typing import Tuple, List
def sort_noise(timecourses: np.ndarray = None,
lag1: np.ndarray = None,
return_logpdf: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.