sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3c493c7e210d8cede4cf3f51b2d0a7701a9422d3677922fe7881acea73b72dfd | Python | 12,358 | 290 | # -------------------------------------------------------------------------------
# elftools: ehabi/decoder.py
#
# Decode ARM exception handler bytecode.
#
# LeadroyaL (leadroyal@qq.com)
# This code is in the public domain
# -------------------------------------------------------------------------------
from __future__... |
bef02cdbfbf64a7309650154845ed227bbcde607503d6d8723b9952534696c24 | Python | 12,358 | 295 | """
@file: fileio.py
Created on 01.04.2021
@project: CrazyAra
@author: queensgambit, maxalexger
Contains the main class to handle files and directories during Reinforcement Learning.
Additionally a function to compress zarr datasets is provided.
"""
import os
import glob
import zarr
import time
import logging
import d... |
8dccf2fc674d5f594c7942f03a46fbd8e8ec78de8d9205d6858d2c6762e3d9d5 | Python | 12,382 | 312 | # 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 numpy as np
import pytest
from sklearn.cluster import DBSCAN
from ampli... |
6db0ea7575c220107b9c6422612f493ac5f38a84078f9bb16e66793daa3ef934 | Python | 12,384 | 340 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Compact canonical deployment of compressed DPA4C with a long-range module."""
from __future__ import (
annotations,
)
from typing import (
TYPE_CHECKING,
Any,
)
import torch
if TYPE_CHECKING:
from deepmd.pt_expt.utils.canonical_graph import (
C... |
08ef54e68937621bc4e3a260a84813adc53d39f8f531178ff91d4731114910e4 | Python | 12,385 | 359 | """Utility functions for working with ByCycle DataFrames."""
from itertools import product
import numpy as np
import pandas as pd
from bycycle.utils.checks import check_param_range
###################################################################################################
###################################... |
2bab80b61eee93edb1d2c3961f0196787001391851ec2873e10ddc2cb8161de3 | Python | 12,397 | 348 | # 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... |
7978358967bf3ea9333518221fee08bb373f91debb471dc56659c7fe98216bfd | Python | 12,399 | 327 | import math
from typing import Callable, Iterable, List, Optional, Union
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
from utils.const import DEFAULT_DEVICE, DEFAULT_DTYPE, EPS
class GraphNet(nn.Module):
def __init__(
self,
num_nodes: int,
... |
cb013cf2f9418379033f571d750d87f6943ab6fece0241b58fab22c78d694aad | Python | 12,399 | 381 | # 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... |
62718558b845306cf4a9c7a8c6ac74428894a502ac84d57bacdd075598d62148 | Python | 12,400 | 342 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Spin-free checkpoint transfer for the PyTorch and pt_expt native-spin models."""
from collections.abc import (
Callable,
)
from functools import (
singledispatch,
)
import torch
from deepmd.dpmodel.descriptor.dpa4 import (
DescrptDPA4,
)
from deepmd.dpmodel... |
4e8f7b468db9f38646d50aecdcefc7608edcb7433ef8a2838a926f4392b6705c | Python | 12,401 | 199 | import numpy as np
import pickle
from parameterSetup import ParameterSetup
from evaluationCriteria import y2sensitivity, y2confusionMat, printConfusionMat, mathewsCorrelationCoefficient, multiClassMCC
from sequentialPrediction import classifySequentially
from writePredictionResults import writePredictionResults
from fi... |
63716dc5b3ed0e81d95cee74b3d612679436d1f9f4f0d191c99dce2ba356eb13 | Python | 12,407 | 261 | import copy
import logging
from ray.rllib import SampleBatch
from ray.rllib.agents import Trainer
from ray.rllib.evaluation import collect_metrics
from ray.rllib.utils.memory import ray_get_and_free
from ray.tune.util import merge_dicts
from mprl.rl.common.shared_pol_rollout_worker_set import SharedPolicyRolloutWorke... |
439f6194be783293756df8a7856cb3b477a9beb4c543c9ac1a2fec7098a64fbb | Python | 12,430 | 413 | from pathlib import Path
from utils.argparse_utils import get_bool, get_device, get_dtype
from utils.argparse_utils import (
parse_model_settings,
parse_plot_settings,
parse_covariance_test_settings,
parse_data_settings,
)
from utils.utils import create_model_folder, get_compression_rate
from utils.util... |
3f1406d3755025cc2d8a8a5fec2babc8857e14735e42ea3627405968a036b3d1 | Python | 12,440 | 316 | """
AQDnet Smoke Tests
Minimal test suite for AQDnet functionality:
- Feature extraction from sample structures
- Model parameter loading and prediction pipeline
- CLI interface availability
"""
import os
import sys
import tempfile
import glob
import json
import shutil
import subprocess
import unittest
from types imp... |
2d987e5d1e53d4b835075094900b257ce35e6bb4f743eba8aa7aaa7d39743128 | Python | 12,445 | 280 | # coding = utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from .sparsemax import Sparsemax
def init_weights(m):
classname = m.__class__.__name__
if classname.find('Conv2d') != -1 or classname.find('ConvTranspose2d') != -1:
nn.init.kaiming_u... |
938e819736b6b71bd41b642fc6a4609616e4f27a8417b17c40c9d0c7a353e14a | Python | 12,445 | 415 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class LSTMHelper:
def __init__(self, **params: A... |
facaee567e559c194a3aa0708a88f82129c4958c5358668ac4cfe9ac9fde4d4a | Python | 12,448 | 308 | # 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... |
3a6557b8e5311f8b15740219ec34848c2f00ebdf81c9c2a19198a7ce2e3f2e83 | Python | 12,456 | 472 | import torch
from abc import ABC, abstractmethod
from lgn.g_lib import g_torch, g_tau
GTau = g_tau.GTau
class GTensor(ABC):
"""
Core class for creating and tracking G Vectors (aka G representations).
Parameters
----------
data : iterable of of `torch.Tensor` with appropriate shape
Input... |
d7eea252774d7628b4df66427ec589420e208a0c4b38669f703a7807c11a8f47 | Python | 12,462 | 342 | """
@file: input_representation.py
Created on 05.06.21
@project: CrazyAra
@author: queensgambit
Input representation 3.0 - No legal move information, but with history again and 50 move rule information.
"""
import chess
from DeepCrazyhouse.src.domain.variants.constants import BOARD_WIDTH, BOARD_HEIGHT, NB_CHANNELS_TOT... |
0de83319a21ced0cc62a3689a150c971391d09ba6038c1fc7936dfb9dde3f016 | Python | 12,471 | 419 | """Tests for plotting utilities."""
import tempfile
import shutil
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import nose
import nose.tools as nt
from nose.tools import assert_equal, raises
import numpy.testing as npt
try:
import pandas.testing as pdt
except Impo... |
c01e3578e566a2246e4a1c3fa4397a63aa0560fc480bc7e94512b6a4a9970f88 | Python | 12,483 | 308 | import numpy as np
import cv2
from numba import jit
# constant
NUM_SECTOR = 9
FLT_EPSILON = 1e-07
@jit
def func1(dx, dy, boundary_x, boundary_y, height, width, numChannels):
r = np.zeros((height, width), np.float32)
alfa = np.zeros((height, width, 2), np.int)
for j in xrange(1, height-1):
for i... |
5c2850c0a4de0dc62fea07d4b084cb9f35a72049eb96a78328ce11312702dc08 | Python | 12,487 | 432 | # 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... |
3a8070e7f368a96d1d65659b1c4363e820dddaa17535ec4552c83a0c70dea452 | Python | 12,488 | 321 | """Elastic Ensemble classifier from file."""
__author__ = ["jasonlines"]
import os
import numpy as np
from sklearn.metrics import accuracy_score
from sktime.datasets import write_results_to_uea_format
class ElasticEnsemblePostProcess:
"""Elastic Ensemble post processor.
Parameters
----------
resu... |
97218985c3568bb98796d8d69d670b62eef529026e102f1b51c34ad6cb56d029 | Python | 12,489 | 346 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Implements function make_large_model to easily create and save models
bigger than 2 Gb.
"""
from __future__ import annotations
import os
import sys
from typing import TYPE_CHECKING, Any
import numpy as np
import onnx
import onnx.ex... |
4d14ef6f9c6c02baf3d1896adfb975a3affcfb9cb9e21f735bc69f0e3437f5b1 | Python | 12,495 | 364 | """RestructuredText changelog generator."""
import os
from collections import defaultdict
HEADERS = {
"Accept": "application/vnd.github.v3+json",
}
if os.getenv("GITHUB_TOKEN") is not None:
HEADERS["Authorization"] = f"token {os.getenv('GITHUB_TOKEN')}"
OWNER = "sktime"
REPO = "sktime"
GITHUB_REPOS = "https... |
69d41d3827be697c51439dce00c298ff34a80e4d12d3ec0de80eafdc07d85851 | Python | 12,496 | 241 | import numpy as np
import matplotlib.pyplot as plt
import nibabel as nib
import nilearn.plotting as niplot
def _scale_data(data, limit_mode=None, stdevs=4, quantile=0.01, limits=None):
"""Returns a copy of data scaled such that the bulk of the values are mapped to the range [0, 1].
Upper and lower limits ... |
df4287059a70df608b4cdee943331cc40499501122ff032b23240c909191aafc | Python | 12,499 | 275 | import numpy as np
np.random.seed(1234567)
import tensorflow as tf
tf.random.set_seed(1234567)
import random
random.seed(1234567)
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, LeakyReLU
from tensorflow.keras.layers import Dropout, AlphaDropout, GaussianDropout
from tensorflo... |
de4bb61509311e150e9f3d790c126d07da90a19fd083bb1a70102a99fb2beef8 | Python | 12,503 | 257 | """ Module containing the class for the generation of the PyG dataset from the ASE database."""
import os
from typing import Union
from torch_geometric.data import InMemoryDataset, Data
from torch import zeros, where, cat, load, save, tensor
import torch
from ase.db import connect
from sklearn.preprocessing import On... |
5621273421826d6dfefd067897357dee74270431465e204cb5464931000d7557 | Python | 12,507 | 424 | """
Display the hoc files with pyqtgraph, This is a command-line tool. See the
--help message for details on the commands.
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, ... |
d231b5a6509c826a4155e0626475a54924a468935629fe4216775c35d45ca1e4 | Python | 12,510 | 330 |
#=======================================================================================================================
# 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... |
b2e59f49e647860d7077bf216087b30caccd3768bd95e9a4230ad6ec7e4d213c | Python | 12,511 | 346 | """InceptionTime for classification."""
__all__ = ["InceptionTimeClassifier"]
import warnings
from copy import deepcopy
from sklearn.utils import check_random_state
from sktime.classification.deep_learning.base import BaseDeepClassifier
from sktime.networks.inceptiontime import InceptionTimeNetwork
class Inceptio... |
59ebc2b44307e08ac368c165b48f3629624efc88c40693dd92c5a1784055a762 | Python | 12,514 | 453 | # 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 triu_reference_implementation(x, k=0):
return np.triu(x, k)
def tr... |
d088a68801d5ad23327f69f1afed048da6c988c9b741b4291cab554c188d65ca | Python | 12,514 | 293 | import pytest
from flair.data import Relation, Sentence
from flair.datasets import ColumnCorpus, DataLoader
from flair.embeddings import TransformerDocumentEmbeddings
from flair.models import RelationClassifier
from flair.models.relation_classifier_model import (
EncodedSentence,
EncodingStrategy,
EntityMa... |
804619f88ee32bf69a28ef60d5fa96068e78b73c8e8ec2fc06149f79475b57ac | Python | 12,516 | 374 | """Command line interface is defined here.
"""
DESCRIPTION_preproc="""
SingleCellFusion is a computational tool to integrate single-cell transcriptome and epigenome datasets.
This is the CLI for its preprocessing module
(from count matrices to normalized HVG feature matrices).
"""
DESCRIPTION="""
SingleCellFusion is... |
0df8c58f3f7c159624d9e7100fe79f5f603fbd92f58fe5f20ffaecffbd0244b5 | Python | 12,518 | 280 | #-------------------------------------------------------------------------------
# elftools: dwarf/lineprogram.py
#
# DWARF line number program
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ import... |
663f3a8668d0d09b8be7ce54356010fdeeeb6680a05fedb59f586867ec58d68e | Python | 12,524 | 350 | from typing import List, Tuple
import torch
import logging
from lgn.cg_lib import CGModule, ZonalFunctionsRel, ZonalFunctions
from lgn.cg_lib.cg_dict import CGDict
from lgn.cg_lib.zonal_functions import p_cplx_to_rep, rep_to_p
from lgn.g_lib import GTau, GVec
from lgn.models.lgn_cg import LGNCG
from lgn.nn import Rad... |
78bb3ae1386fe22597437d365d16dd7dd34503123c23d891106a78b71f5b0456 | Python | 12,527 | 380 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import collections
from enum import IntEnum
import numpy as np
from onnx.reference.op_run import OpRun
class IntMap(collections.UserDict):
def __init__(self):
super().__init__()
s... |
380fbc1bef274620901703171805337b0c55d4f8e6b86f4e72c226c726537c34 | Python | 12,528 | 299 | """
@file: trt_vit.py
Created on 07.07.22
@project: CrazyAra
@author: queensgambit
TRT-ViT network architecture definition
Based on: TRT-ViT: TensorRT-oriented Vision Transformer, Xia et al.
https://arxiv.org/pdf/2205.09579.pdf
https://github.com/whai362/PVT/blob/v2/classification/pvt.py
"""
import torch
import torch... |
d6fd56cc4e62bbfa8e48ee625394701b619681c79da0bd27c1e93072d408c15e | Python | 12,530 | 318 | """
Implementation of "Attention is All You Need"
"""
import torch
import torch.nn as nn
from onmt.decoders.decoder import DecoderBase
from onmt.modules import MultiHeadedAttention, AverageAttention
from onmt.modules.position_ffn import PositionwiseFeedForward
from onmt.utils.misc import sequence_mask
class Transfo... |
c744ea661f05cdc571d771303ed6edf240587c5d5d444596b9ff418695b38fba | Python | 12,542 | 322 | # 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... |
ce4c0e4ac8e3755bef0be782e153c5d101ad7adeb4c93295886b996ab6f71395 | Python | 12,548 | 299 | """ConvTran Neural Network for classification in PyTorch."""
__authors__ = ["srupat"]
__all__ = ["ConvTranClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.convtran import ConvTranNetworkTorch... |
eaaa2da731ddf397a8d7b1b61c4706e49655472ab23917ee61ba9f9961d933fc | Python | 12,554 | 298 | import tensorflow as tf
import tensorflow.keras.layers as KL
import math
import NetworkBasis.layers as layers
"""
Adapted from https://github.com/cwmok/C2FViT
Mok, T.C.W., Chung, A.C.S., 2022. Affine Medical Image Registration with Coarse-to-Fine Vision Transformer.
2022 IEEE/CVF Conference on Com... |
950ad3ca60734340a83384c77f77839b674d213c8042d94774a9dbe70779198f | Python | 12,563 | 350 | # 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... |
f8941158ae64a8f761ecac48ff3e973cd151926350f497dcc9b479ff6b08368d | Python | 12,576 | 335 | # -*-coding:utf-8-*-
import torch.nn as nn
import math
import torch.nn.functional as F
def conv1x1 (in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
def conv3x3 (in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kern... |
449a3d67846ab36bef32618229a55214c38e960cbdedd2ce397df0362afd0363 | Python | 12,581 | 485 | # 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... |
c8f71868b0998595d36e3d18f8f201f38f55b62be44a8954fefec118df34b9ac | Python | 12,587 | 311 | """Epoching nodes"""
import json
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
import pandas as pd
import xarray as xr
from timeflux.core.node import Node
from timeflux.core.exceptions import WorkerInterrupt
from timeflux.helpers.port import match_events
class Ep... |
eff17a5d2d7d10ebf119c548d22c233e3880826a74787ab89e17d7f852700f5f | Python | 12,594 | 346 | # Copyright 2022 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... |
4097981f220d00f1086ac4f3189e7416c8f0ac6de6ebc93226bbbdccf6f53beb | Python | 12,620 | 263 | """
Script to organize and process data from Musall et al., 2019
"""
import os
from os import path
import h5py
import numpy as np
from scipy.io import loadmat
from typing import List, Tuple, Any, Optional
import argparse
import multiprocessing as mp
from multiprocessing import Pool
from mine import Mine, MineData
cla... |
3480f5fd4d5e139d504080d95a883551d09d79f6fdb3733df1d6ffdb6c6b71a8 | Python | 12,627 | 346 | #!/usr/bin/env python
#
# Copyright 2008, 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... |
7b73a635ff2238d2dab5b77469455a02d1fc2c5cbf00a3890f40a824c750d4b3 | Python | 12,634 | 420 | """Base class template for catalogues."""
__author__ = ["jgyasu"]
__all__ = ["BaseCatalogue"]
from abc import abstractmethod
from skbase.utils.dependencies import _check_estimator_deps
from sktime.base import BaseObject
from sktime.registry import craft
class BaseCatalogue(BaseObject):
"""Base class for cata... |
0486d8222a14a3cd13fea3d07d2e8d94175b646c1b25b0c435ead36bac3f16e7 | Python | 12,644 | 323 | """Probability Threshold Early Classifier.
An early classifier using a prediction probability threshold with a time series
classifier.
"""
__author__ = ["MatthewMiddlehurst"]
__all__ = ["ProbabilityThresholdEarlyClassifier"]
import copy
import numpy as np
from joblib import Parallel, delayed
from sklearn.ensemble i... |
caf775e2b8bf0720f8730f6f01cbb7e61deb612badf0e076fd1dcd6c8829eaff | Python | 12,649 | 305 | """
This script plots figure 6d of the paper.
This is the mouse reaction time + trained model reaction time + naive model reaction time
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# Plotting
import... |
f0d6afa25f09a9cca13ab1d8badef7a6d4a62025826dc7734fc0e6521e032556 | Python | 12,650 | 323 | import dolfin as df
import sys
class Solver():
""" Class for solving the model presented in Sætra et al. (2023)
with unknowns w = (alpha_i, k_r, phi_r, p_e) where:
- alpha_i: intracellular volume fraction
- k_i: concentration of ion species k in compartment r
- phi_r: potential in... |
8383ebb4108e781656bd04a4e198d017b587dcca1bb98004299a2033c3de57e4 | Python | 12,655 | 308 | """
Plot two panels showing how threshold changes with either AIS length
or dendrite surface area.
This replaces two plots previously made in Prism (Hillock-AIS-Threshold.pfzx)
aisdata and aisthrdata are taken from the data tables in that file
The threshold data as printed out by model_run2.py into thrrun.txt has been... |
c348fae1eef6880fe32bbb39bd85f38d485bf28a90293b3ba709138c918503e3 | Python | 12,664 | 398 | # 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... |
8ae583c97c355e09c622961769cd520c8399cf37b006e32aa3391ca2de964285 | Python | 12,669 | 376 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def default_conv(in_channels, out_channels, kernel_size, bias=True):
return nn.Conv2d(
in_channels, out_channels, kernel_size,
padding=(kernel_size//2), bias=bias)
class Upsampler(nn.Sequential):
def __init__(self, ... |
f6324f9d9c2742f05c718cc9d38ff5c88d0bd157eecb46dc5b8037e39ab5c27c | Python | 12,669 | 302 | """Multi Channel Deep Convolutional Neural Classifier (MCDCNN)."""
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.mcdcnn import MCDCNNNetworkTorch
class MCDCNNClassifierTorch(BaseDeepClassifierPytorch):
... |
d78dab29dc95486fa5a61576a4e9af9b938a888d56ab2963f6dcdf301a32ea28 | Python | 12,673 | 302 | """Weighted ensemble of classifiers."""
__author__ = ["fkiraly"]
__all__ = ["WeightedEnsembleClassifier"]
import numpy as np
from sklearn.metrics import accuracy_score
from sktime.base import _HeterogenousMetaEstimator
from sktime.classification.base import BaseClassifier
class WeightedEnsembleClassifier(_Heteroge... |
70bda1a9b7a379cdb86685e96c14105ed1d9f87eca732c676c84f34818e45d3b | Python | 12,675 | 339 | # 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... |
1b22c4f9b3cdb7c941f4047c133d79eaef667df1d8b5990a3c6ddbdfbdbeb2df | Python | 12,677 | 253 | import pickle
import numpy as np
from os.path import dirname, abspath
from stagePredictor import StagePredictor
from statistics_processing import standardizer
from algorithmFactory import AlgorithmFactory
from deepClassifier import DeepClassifier
def classifySequentially(params, paramID, paramDir, fileIDpair):
# ... |
8409599f233a91cfbaae39a6fda7cfb2110b06333b96f65a6ed37cfdc0aa08fa | Python | 12,677 | 389 | # 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... |
94626b05a9e6eb8db78d71f8689c3bed0d66942f45676d2a031b49312b007b6c | Python | 12,686 | 356 | # 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... |
8764e2dba5ebff9b4b07b27a739e8c01bda24e7d127c05d8245f561d15859af2 | Python | 12,688 | 379 | import numpy as np
import torch
from typing import Union, Iterable
def p4_polar_from_p4_cartesian_massless(
p4: Union[np.ndarray, torch.Tensor]
) -> Union[np.ndarray, torch.Tensor]:
"""
Transform 4-momenta from Cartesian coordinates to polar coordinates for massless particle features.
Args:
p... |
a1f300df476d0c4e8b1032e2d1e36b6990a2102359372054f82ad74f96a4054a | Python | 12,689 | 335 | """
@file: next_vit_official_modules.py
Created on 12.08.22
@project: CrazyAra
@author: queensgambit
# Based on official NextViT code (Copyright (c) ByteDance Inc. All rights reserved.)
https://github.com/bytedance/Next-ViT/blob/main/classification/nextvit.py
"""
import torch
from torch import nn
from einops import re... |
326b2c4c7f3c8c686c1029d096b9d4917014c348c09162ca3bc6980667560b66 | Python | 12,693 | 325 | import numpy as np
from tqdm import tqdm
import ot
import matplotlib.pyplot as plt
from glob import glob
import os
def find_nearest(array, value):
array = np.asarray(array)
idx = (np.abs(array - value)).argmin()
return idx, array[idx]
def find_files(path, filename = 'lfp.npy'):
all_paths = glob(... |
bc3ecd05e7fd01e53de480383e0573e9f9f700a0622710b0bc7162fe5e227580 | Python | 12,706 | 315 | from __future__ import annotations
import itertools
from typing import TYPE_CHECKING
import numpy as np
if TYPE_CHECKING:
import sklearn.tree
class _FanovaTree:
def __init__(self, tree: "sklearn.tree._tree.Tree", search_spaces: np.ndarray) -> None:
assert search_spaces.shape[0] == tree.n_features
... |
06320a6de62901f36cabe7f2036f8a24753e848147d1a758e7261f58988aad3d | Python | 12,709 | 610 | # Expose base classses
from .base import (
DataLoader,
FlairDatapointDataset,
MongoDataset,
SentenceDataset,
StringDataset,
)
# Expose all biomedical data sets used for the evaluation of BioBERT
# -
# -
# -
# -
# Expose all biomedical data sets using the HUNER splits
# Expose all biomedical data se... |
b0d0a0794781c1ee56989019fbc955d610c94d0814ed6faae96a3119eb125a00 | Python | 12,714 | 368 | from abc import ABC, ABCMeta, abstractmethod
import logging
from pathlib import Path
from typing import Any, Callable, Dict, Optional, List
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from skopt import gp_minimize, dump, load
from skopt.space import Dimension, Real
from s... |
887a0231f7ac6d420e82b30f5119f6b9487700c265317e746a3dc60a5ddddc3d | Python | 12,716 | 316 | """Gated Recurrent Unit (GRU) classifier in PyTorch."""
__authors__ = ["fnhirwa"]
__all__ = ["GRUClassifier"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.gru import GRUNetworkTorch
class GRUClassifier(B... |
9e496d64658cd3994513cca689a2d47c0a9b5bfc19ef6f31768d14fa7bb70f85 | Python | 12,720 | 393 | # 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... |
b6ce8cfa04561187210bcaaf282af5422e44e118896edf14a07037fcf8c56819 | Python | 12,722 | 457 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""CUDA bindings for compact canonical compressed DPA1 deployment."""
from __future__ import (
annotations,
)
from typing import (
TYPE_CHECKING,
Any,
)
import torch
if TYPE_CHECKING:
from deepmd.pt_expt.utils.canonical_graph import (
CanonicalGra... |
56d1d533a1aae07568d0df4b44c234be86db6faa1a667a2a1b4b55bb3d6cf9af | Python | 12,730 | 349 | import torch
from math import inf
# import itertools
from lgn.cg_lib import CGModule, cg_product_tau
from lgn.g_lib import GTau, GVec
class CGProduct(CGModule):
r"""
Create new CGproduct object. Inherits from CGModule, and has access
to the CGDict related features.
Takes two lists of type
.. m... |
b7b9e5ee8487762050764b2c1500ac1f6b8800365fe512a6cd89d3c367e1a219 | Python | 12,731 | 350 | import torch
from math import inf
# import itertools
from lgn.cg_lib import CGModule, cg_product_tau
from lgn.g_lib import GTau, GVec
class CGProduct(CGModule):
r"""
Create new CGproduct object. Inherits from CGModule, and has access
to the CGDict related features.
Takes two lists of type
.. m... |
5740c71c0fe62bb13e2295dc9d65169d6629a64ae4474dde74ae24f7a5286ecd | Python | 12,742 | 385 | from argparse import Namespace
from pathlib import Path
from typing import Optional, Tuple, Union
import torch.nn as nn
import torch
import numpy as np
import math
import os.path as osp
import time
from models import Decoder, Encoder
from utils.utils import make_dir, save_data, plot_eval_results
from utils.const import... |
10428b9f58c0444f1caed8f5e8bd28aaa8f2aea6c5551734c39b76e1e2494a29 | Python | 12,744 | 387 | from argparse import Namespace
from pathlib import Path
from typing import Optional, Tuple, Union
import torch.nn as nn
import torch
import numpy as np
import math
import os.path as osp
import time
from models import Decoder, Encoder
from utils.utils import make_dir, save_data, plot_eval_results
from utils.const import... |
e4aae731bf3ff9a7ea28dcbb45781ded6bed22568ee7b7ddf34ef7d074c981c4 | Python | 12,756 | 342 | # 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... |
e88f18d9d86aba9a7bdfd02241411730a95c3820dd45c6b411cb3ebf7c8dfe0f | Python | 12,765 | 362 | # 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... |
f10d195e130f80dc5f7c9022a07651473a6578ec73c8c51124efbca9e854684a | Python | 12,770 | 303 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Native-spin model factory (``make_native_spin_model``) and its concrete
energy-model instantiation (``NativeSpinEnergyModel``).
"""
from copy import (
deepcopy,
)
from typing import (
Any,
)
import array_api_compat
import numpy as np
from deepmd.dpmodel.model.b... |
741fbd0f52073397728c2f580ee5ea1e4443aee0c28dcbe4ca9af514c43149a8 | Python | 12,777 | 260 | from __future__ import print_function
from freqAnalysisTools import band
from os import listdir
from os.path import isfile, join, splitext
import sys
import pickle
import math
import numpy as np
from itertools import groupby
import codecs
from parameterSetup import ParameterSetup
from outlierMouseFilter import OutlierM... |
53782851ee0af76cb5cb03a0acbcdd2b7775556968a028e7731a087122c1410a | Python | 12,783 | 366 | from __future__ import print_function
from freqAnalysisTools import band
import pickle
import math
import matplotlib
matplotlib.use('TkAgg')
from os import listdir
from os.path import isfile, join, splitext
import numpy as np
import random
from itertools import groupby
import matplotlib.pyplot as plt
import matplotlib.... |
2a766c1a1fe8219ca53d7c1ae446a452022c0129db3d116a23bc6a8fa161688b | Python | 12,799 | 338 | #!/usr/bin/env python
# blasr 3.1.0
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See https://wiki.dnanexus.com/Developer-Portal for documentation and
# tutorials on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) documentation... |
c3b6bdca741d07b21937548ca9c719add917600be9d5fe795e142419e3caea20 | Python | 12,800 | 319 | import augpathlib as aug
from pyontutils.core import OntGraph, OntResPath
from pyontutils.config import auth
from pyontutils.namespaces import makePrefixes, ilxtr, owl, rdf, rdfs
#import json
def path_json(p):
with open(p, 'rt') as f:
return json.load(f)
def asObj(r, name=None):
# SIGH functions and... |
a5b9059eba5b74813a97c701c8c774777639c65a8854a990512a4c11724c7878 | Python | 12,802 | 392 | """
Summarise and annotate differentially expressed clusters reported by edgeR.
Takes an edgeR ``topTags`` table of differentially expressed Corset clusters,
filters it by FDR / log fold-change / rank, annotates each surviving cluster
with the number of members contributed by each input transcriptome, and
harvests mat... |
9e400dc27d90763b94dbc2ddfa93d8ea50b783c7bde6a4216b8ce71e116afea1 | Python | 12,805 | 277 | # 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... |
3f39fb13faeaee23e86b7459dbbc9b80e8cd47757e47e2219cfc4b6970992ad0 | Python | 12,806 | 362 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""ASE calculator interface module."""
import logging
import math
import weakref
from contextlib import (
ExitStack,
)
from functools import (
partial,
)
from pathlib import (
Path,
)
from shutil import (
copyfile,
)
from tempfile import (
TemporaryDirec... |
8043c6d3ac0e5a28aef28286351f22873a95b7a224edd0865ff150982d73e754 | Python | 12,811 | 283 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Evaluate PatchTST-FM (zero-shot or prompt-tuned) on the TIME benchmark.
This is the out-of-pool counterpart of evaluate.py: TIME's tasks are disjoint from
the GIFT-Eval training pool, so it measures whether a prompt generalises beyond
the data it was tuned on rather t... |
5be2c2c8b1b85954e6f1e3de72d1656037f2c2759f7d8625440225d2e4ec7e8e | Python | 12,817 | 351 | # 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... |
ae5ba8a289a6ba59b964e7d5fcc17a84fc37ec503111f11170fbdd2e1e5f349a | Python | 12,821 | 363 | from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import numpy
import matplotlib.pyplot as plt
import pickle
from scipy import stats
import copy
from scipy.stats import entropy
from sklearn im... |
f603022af4faeed0c88cee3d75cb000c2cbd522ac619876ef1683b399cb9d68d | Python | 12,822 | 311 | import torch
import torch.nn as nn
import torchvision
import functools
import torch.nn.functional as F
class Discriminator_VGG_256(nn.Module):
def __init__(self, in_nc, nf):
super(Discriminator_VGG_256, self).__init__()
# [64, 128, 128]
'''torch.nn.Conv2d(in_channels, out_channels, kernel... |
97067e8095294ef911d47fa01c1ca2956b19450ca3920fc3eed476297e2ab801 | Python | 12,824 | 348 | #------------------------------------------------------------------------------
# elftools: elf/gnuversions.py
#
# ELF sections
#
# Yann Rouillard (yann@pleiades.fr.eu.org)
# This code is in the public domain
#------------------------------------------------------------------------------
from __future__ import annotati... |
f5465237b0babd655d888b162586b26fa90b4a78790addc10ba8e742d95d7080 | Python | 12,825 | 348 | # 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 os
import pickle
import importlib
from time import gmtime, strftime
impo... |
03bfc81e8a71d6853da1b74bafe407541d002078281e4012f780d3b38e29be2d | Python | 12,833 | 423 | import torch
import numpy as np
import time
import numpy.matlib
from math import sqrt, cosh
import logging
from tqdm import tqdm
from lgn.g_lib import rotations as rot
from lgn.models.autotest.utils import (
get_output,
get_dev,
get_avg_output_dev,
get_avg_internal_dev,
get_node_dev,
display_e... |
268523cb4a04967c292600797d004743d31005c69d3f95ce0127a691c737c480 | Python | 12,833 | 305 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 4 18:47:47 2018
@author: tpisano
Set of functions to take a list of points and transform them into new space
# NEED ELASTIX TO RUN THIS (so run on a LINUX machine)
"""
import os, sys, numpy as np, shutil
from scipy.io import loadmat
import pick... |
33806ea08eccc0381405be6a73589caaf64db33785516dadad168191bb3c8ad5 | Python | 12,835 | 425 | import torch
import numpy as np
import time
import numpy.matlib
from math import sqrt, cosh
import logging
from tqdm import tqdm
from lgn.g_lib import rotations as rot
from lgn.models.autotest.utils import (
get_output,
get_dev,
get_avg_output_dev,
get_avg_internal_dev,
get_node_dev,
display_e... |
18f48e7798a81573416356ce3351d06f51e304c2174db35c4a1a4565f4d8cda1 | Python | 12,840 | 390 | """afp — Another Fastx Parser.
Tiny, dependency-free single-file reader/writer for FASTA and FASTQ files
with transparent gzip / bzip2 / zip / zstandard decompression.
This module is intentionally a single file. To vendor it into another project,
drop ``afp.py`` somewhere on the python path and ``import afp``.
Quick... |
c703918e2866315c4b6476a72a060a80f45944d4c24a2a1a4aeeff877d398c70 | Python | 12,843 | 396 | from __future__ import print_function
"""
Simple system for interfacing with a MATLAB process using stdin/stdout pipes.
"""
from .process import Process
from io import StringIO
import scipy.io
import numpy as np
import tempfile
import os, sys, glob, signal
import weakref
import atexit
class MatlabProcess(object):
... |
8126a0bf1b6d6af3d1613894a11fe07f0c275e59a69c08d7f5599489a5bfcc54 | Python | 12,846 | 320 | import os
import gc
import csv
import time
import shutil
import yaml
import numpy as np
from datetime import datetime
from sklearn.metrics import mean_absolute_error, mean_squared_error
import torch
from torch.optim import AdamW
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
import t... |
ea702bc107812fea2a897fa9290a030d1050b95a0451e20be7ed85e72d456204 | Python | 12,850 | 314 | # 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... |
4d347d02979c431f9a752bb4d3cf2b2d98824057c3f6f9a995eeb2baadb868b8 | Python | 12,858 | 349 | # 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... |
a73c0ab4f2a99252288086c6463b34829fdbf381e9825dc16b97b360e60d6b61 | Python | 12,863 | 342 | # 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
#
# ... |
075cc94fca4bd89be153ee4e9b8ed572a10bc9d37f8de2028ca9876564740c55 | Python | 12,875 | 349 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.