sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
76a085c6c9a7adf73f035efbb79d64f1e72f72915d14c198e915f21aeb23f3af | Python | 11,246 | 340 | import argparse
import json
import os
import os.path as osp
import re
from datetime import datetime
from pathlib import Path
from zipfile import ZipFile
from modelindex.load_model_index import load
from rich.console import Console
from rich.syntax import Syntax
from rich.table import Table
console = Console()
METRICS... |
3e629cf7b59e14171d969a725423ff376cebe078da3f108fb762f40ac0cd21fb | Python | 11,266 | 248 | """
These are all the runs for the SAM tone data
Run with the 0.7686 ASA density
Cells 2 and 5 with "standardized axon"
30 dB SPL
11Aug2021 to 16Aug2021
Manual copy from DataTableVCN using selection of runs and "print" function
"""
samdata = {
2: [
"runANPSTH-largestonly-2021-08-15.16-02-05",
"... |
c8ae75c8ffc1da3ba6796a494b71903f0c86446d04f884a94aa651e7fb9cae8e | Python | 11,269 | 355 | """
This file contains only classes that act as containers for groups of variable names.
Use to access groups of related variables at once as well as the group's name.
"""
# Features
class VariableSet:
"""Contains set of variables"""
name = None
features = None
class MetaVariableSet:
"""Contains ... |
0c97bc4144c7635b6480de7794335c783cc113bb60840b32f7821a1e4fb836df | Python | 11,276 | 290 | # SPDX-License-Identifier: LGPL-3.0-or-later
import unittest
import numpy as np
from deepmd.dpmodel.common import (
to_numpy_array,
)
from deepmd.dpmodel.utils.neighbor_graph import (
GraphLayout,
NeighborGraph,
build_edge_csr,
canonicalize_neighbor_graph,
)
def assert_csr_consistent(graph: Neig... |
9e58bb1b3f444ecaeb52f98df418546f50b96c4fd9dca31757c0906c52cc5691 | Python | 11,284 | 325 | """Tests for incremental benchmark result persistence."""
import hashlib
import json
import pandas as pd
import pytest
from sktime.benchmarking._benchmarking_dataclasses import FoldResults, ResultObject
from sktime.benchmarking._incremental_store import (
IncrementalResultStore,
result_key,
)
from sktime.ben... |
b9b2665ba89be98b492febf86864cea7b1e5e023c483b2143edd10217de86de3 | Python | 11,300 | 337 | import os
import sys
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)
import seas
from seas.filemanager import experiment_sorter
from seas.experiment import Experiment
from seas.hdf5manager import hdf5manager
import seas.ica
import seas.video
# testing section:
if... |
cfdc8dfb609e0008396d8dabb0e8f6c6846407c05b782a9dbe50725c4ebda6fc | Python | 11,300 | 366 | # Copyright 2024 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... |
6502f66bfe52869cf4272062d5f22f4d0d02624f661d47bc2643092ce1e9c36e | Python | 11,321 | 307 | from typing import Optional, Type
import torch
import torch.nn as nn
import torch.nn.functional as F
def make_attn_mask(query_pad: torch.Tensor, key_pad: torch.Tensor) -> torch.Tensor:
"""
Build an additive attention mask of shape (B, Q, K) from
query/key padding masks.
Args:
query_pad: (B, ... |
03c57d2c0bb1fb23828907f1ab3c50414e2c66c37d91cc62523e54f2e3097c4c | Python | 11,340 | 234 | import math
import torch
from torch.optim import Optimizer
class AdaBound(Optimizer):
"""Implements AdaBound algorithm.
It has been proposed in `Adaptive Gradient Methods with Dynamic Bound of Learning Rate`_.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
... |
8c3a9d2d94d66805957c81298da416725bcf6ccc1f2f00b198f03fabc55b2c49 | Python | 11,341 | 288 | import logging
from typing import Any, Optional
import torch
import torch.nn.functional as F
from torch.nn import (
AdaptiveAvgPool2d,
AdaptiveMaxPool2d,
Conv2d,
Dropout2d,
Linear,
MaxPool2d,
Parameter,
ReLU,
Sequential,
TransformerEncoder,
TransformerEncoderLayer,
)
import... |
a3917c64a2565941c6505f7b49313c52d2a9d09a418622f294bc869ccf9943b9 | Python | 11,347 | 248 | #!/usr/bin/env python
import sys
import os
import math
import re
from os.path import isfile, join, isdir
from kn_common import pipetools,pipedef
from kn_pipeline_class import CPipeError,CPipeStep
class CPipeStepNNTracerStitch3D(CPipeStep):
def progress_update(self,txt):
if re.match(r'#PROGRESS#\d*#', tx... |
b4c94dbc511f2174f2ba5aab86db4b413778409fed0d98d20235d9c29c3d8718 | Python | 11,375 | 406 | import json
from functools import partial
from pathlib import Path
import numpy as np
import pyarrow.parquet as pyarrow_parquet
import pytest
from scipy.stats import trim_mean
from graynet import export_to_nx, extract, extract_multiedge, get_edge_values, load_run, roiwise_stats_indiv
from graynet.cli import main as c... |
0352e78ca60982e15aaffb506e7cecf04131417b518fe35759f1693fee81f6dd | Python | 11,381 | 295 | # 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... |
89dc6d288ab21edbc4495263c936ee27d0c9526f511455cd78df69d52f61494f | Python | 11,381 | 253 | import argparse
import csv
import os
import pdb
import numpy as np
import scipy.io as sio
import tensorflow as tf
from model import Model_TE_aug_decoders
from utils.dataset import load_bioarxiv_dataset,partitions, Datagen
parser = argparse.ArgumentParser()
parser.add_argument("--batchsize", default=200, ... |
293258cb7a39511c5c01feed9adfca7435dd4024c141d3258bd19c60c10e3930 | Python | 11,382 | 333 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._common_classifier import (
compute_logistic,
compute_probit,
compute_softmax_zero,
logistic,
softmax,
softmax_zero,
)
from on... |
b31f432a5dbdb972242f25d71110b329c5dee68eba7849c4176e31cdf7b423a1 | Python | 11,390 | 280 | """Tools for fancy-formatting terminal output.
This module includes classes for displaying and updating progress bars in
terminal windows that support such fancy operations.
These tools are based on Edward Loper's Python Cookbook recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475116
"""
import sys, ... |
dedd2dc731828016f062ee3320e3ef33b62b0809ab2e1c8522ec9636cc2d5e04 | Python | 11,391 | 367 |
from itertools import product
import numpy as np
import pandas as pd
from pandas.testing import assert_series_equal
from numpy.testing import assert_array_equal, assert_array_almost_equal
from seaborn._core.moves import Dodge, Jitter, Shift, Stack, Norm
from seaborn._core.rules import categorical_order
from seaborn.... |
6aa3159c3151f6f6de1b96d3f2b6cbbfc32391afb2d2490c0b119198511dd423 | Python | 11,394 | 324 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import itertools
import numpy as np
import onnx
from onnx import TensorProto
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.helper import make_te... |
fe154689e708d9b9a0e60ce0f9af28cdbbe83526f903ff56e0348387800524b3 | Python | 11,398 | 231 | __author__ = 'pbmanis'
import pprint
import os, sys
from collections import OrderedDict
import numpy as np
import pickle
import matplotlib
matplotlib.use('Qt5Agg')
rcParams = matplotlib.rcParams
rcParams['svg.fonttype'] = 'none' # No text as paths. Assume font installed.
rcParams['pdf.fonttype'] = 42
rcParams['ps.font... |
7bf077c8dd76247614f675c0c82178b78d7144f1dc8b2d8c519e271b0cbd2d2d | Python | 11,401 | 260 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 28 18:13:16 2018
@author: wanglab
by Tom Pisano (tpisano@princeton.edu, tjp7rr@gmail.com) & Zahra D (zmd@princeton.edu, zahra.dhanerawala@gmail.com)
"""
import numpy as np, cv2, sys, os, shutil
import time
from skimage.external import tifffile
f... |
1ea30d66996d4c4dae73d14de7ae198bf3ab0f0b13fc5c70cd28d4cdf7cc3d0b | Python | 11,408 | 335 | # SPDX-License-Identifier: Apache-2.0
# Copyright (c) ONNX Project Contributors
from __future__ import annotations
import numpy as np
import pytest
import onnx
from onnx import TensorProto, TypeProto
from onnx.checker import ValidationError
from onnx.defs import OpSchema, get_all_schemas_with_history, get_schema
fro... |
8692ddd96cc8094415cfa59fad4b8580e15e1e1a84b62ee76fc1f87189b08902 | Python | 11,423 | 245 | from __future__ import print_function
from neuron import h
from .cell import Cell
# from .. import synapses
from ..util import nstomho
from ..util import Params
import numpy as np
from .. import data
__all__ = ['MSO']
class MSO(Cell):
celltype = 'mso'
scaled = False
@classmethod
def create... |
9869f08903fb91ed396ddc825094f43e7b37be85e6f9a538abee134b5801ca64 | Python | 11,423 | 342 | import json
from pathlib import Path
def get_delim(c):
"""
Gets the right delimiter from the c node
:param c: the c node json object
:return: delimiter of the transcription
"""
if "delim" in c:
return c["delim"]
else:
return None
def parse_tran(c, chars, key, add_three_do... |
9229a484bac16202e8fa50d91867fbb74c968391c5c7620c61d6769d61f61255 | Python | 11,425 | 383 | """Machine type converters for Series scitype.
Exports conversion and mtype dictionary for Series scitype:
convert_dict: dict indexed by triples of str
1st element = convert from - str
2nd element = convert to - str
3rd element = considered as this scitype - str
elements are conversion functions of machine type... |
cdf612e4586858d4ad2aeb4d4c1fc03ca6559d0eb4dbf6d9c7f9eaf9c8611321 | Python | 11,428 | 286 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import io
import os
import pathlib
import tempfile
import google.protobuf.message
import google.protobuf.text_format
import pytest
import onnx
from onnx import serialization
def _simple_model() -> on... |
c7fbc5cc5e61586ca7666b6b03d0e7a6e7faad42121abed68fc6ee7c52e0e0c0 | Python | 11,430 | 263 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Extension template for forecasters, SIMPLE version.
Contains only bare minimum of implementation requirements for a functional forecaster.
Also assumes *no composition*, i.e., no forecaster or other estimator components.
Assumes pd.DataFrame us... |
137bbdbb144a3976cb2a4059056e27665262b35baa9e10135edabe3daff93e58 | Python | 11,433 | 290 | import argparse
import pathlib
from collections import Counter
import glob
import json
import os
import pandas as pd
from scipy.spatial import distance
import string
class DrugScreenJsonReader:
"""
A class for summarizing predictions generated by EmbryoNet.
Usage:
DrugScreenJsonReader(
number of ... |
f596fef018560203ffd0da8dd7bf398b90b7840ee057e0ea16bbe436f2ee8ad0 | Python | 11,435 | 344 | import matplotlib.pyplot as plt
import scipy
import numpy as np
import os
from scipy import stats
import seaborn as sns
from PIL import Image
def drawCovMatrix(covMat, x_labels, y_labels, title, outputDir, outputName, annot_fontsize = 8, tick_fontsize = 6, annot_bool = True):
# Dimension(one side) of the covarianc... |
febecd58e51a38942de6860a5c83cceeb5e3d1713d34926c90f829210b3458cd | Python | 11,437 | 301 | """Time series DBSCAN, wrapping sklearn DBSCAN."""
__author__ = ["fkiraly"]
from sklearn.cluster import DBSCAN
from sktime.clustering.base import BaseClusterer
from sktime.datatypes import update_data
from sktime.dists_kernels.base import BasePairwiseTransformerPanel
from sktime.utils.warnings import warn
class Ti... |
1e4b72b2c067f8d6d4c6c63d345a8cbfca248fe716c937b1af587271a6af90c4 | Python | 11,438 | 383 | # 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 GRUHelper:
def __init__(self, **params: An... |
97bc2b6396caba131c318721e852cc5dca43ad45d2fb22245fa9a997eac8ae50 | Python | 11,438 | 333 | import argparse
import os.path as osp
import re
import time
from pathlib import Path
from pprint import pformat
import matplotlib.pyplot as plt
import mmcv
import torch.nn as nn
from mmcv import Config, DictAction, ProgressBar
from mmcv.runner import (EpochBasedRunner, IterBasedRunner, IterLoader,
... |
69e499f802547ed0a8d7bdadcf2bd73307a5dfc8561f5807239e83d105d9f315 | Python | 11,439 | 33 | from .regions_per_sections_rat import regs_per_section, Regions_n_colors_List
try :
with open("./mb_gui/src/regionscode/regions_rat.txt") as file:
Region_names=file.read().split("\n")
except :
with open("regionscode/regions_rat.txt") as file:
Region_names=file.read().split("\n")
def create_reg... |
3205158e6886eb3ba13f110adba2733fb02c0d6044108c9538fb6964611d161c | Python | 11,441 | 214 | import torch
import numpy as np
from numpy import newaxis as na
def gru_cell(input, hidden, w_ih, w_hh, b_ih, b_hh):
"""
GRU cell
Returns:
- hy: output hidden state
- resetgate,#,newgate: cell gates
- pre_gate: cell gates before applyi... |
894bd22d0138d30e86397a2994f896efc2a13cc98a32cabbc08d099609ef63e3 | Python | 11,441 | 332 | # 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... |
7700546f9c0c1210289dfc8b212eb205dcc31b96533a000507ed04b6983331e9 | Python | 11,446 | 272 | import numpy as np
import os
import csv
import pandas as pd
import matplotlib.pyplot as plt
import SimpleITK as sitk
import config as cfg
import util
import loadsave
import metric
from processing import nparray_to_img, seg_binary
def make_csv_header():
"""
Creates a list representing the head... |
9f32adcd67e6f55670f0474e61408cd6fd3e963e66131c9b10aaccfa6db7ff02 | Python | 11,448 | 300 | """ Summary
This script reads the abstracts, content, and references for all papers.
It opens all the textfiles from the PDF-to-text converstion process. Then,
the individual sections are found using some regular expressions.
If no main section or a reference section is found, the corresponding
entry is left blank and... |
b3e017cc10d3e6561e5bde503d577669f5b5e162425ee2dbc4ead80456d60863 | Python | 11,462 | 268 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Multi-rank LAMMPS driver for DPA3 .pt2 (Phase 5 of GNN MPI).
Run via ``mpirun -n N python run_mpi_pair_deepmd_dpa3_pt2.py DATAFILE PB_FILE OUTPUT``.
Mirrors ``run_mpi_pair_deepmd.py`` but targets a GNN model whose .pt2 archive
carries the with-comm artifact (Phase 3 dual... |
a76a192f6b43b410db7214b2fd2ba27ef08d8dd78ea9e71022fa4d91912554ce | Python | 11,471 | 253 | # 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
#
# ... |
d6ec84bb67729fdc41aa5bc9b2eb500dcb6d3fdf2f59920f1c1c17f473c1ce3b | Python | 11,471 | 300 | """
Suite of common ways to normalise data.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
import numpy as np
import torch
from numpy.typing import ArrayLike
class NormaliseABC(ABC):
"""
ABC for generalised normalisation class.
"""
def features_need_deriving(self) -> bo... |
4e260faa66cbe3a10d16b03fee92772026e51860c39083287a984dd6d767a360 | Python | 11,473 | 271 | """
Module containing a set of filter functions for graphs in the Geometric PyTorch format.
These filters are applied before the inclusion of the graphs in the HetGraphDataset objects.
"""
import torch
from torch_geometric.utils import to_networkx
import numpy as np
import networkx as nx
from torch_geometric.data impo... |
4bca1ae5b53ef82e7e7825c9f581cac30c2696d9bf0313aedf69273eaf56ecfe | Python | 11,477 | 263 | """KNN time series classification.
This class is a KNN classifier which supports time series distance measures. The class
has hardcoded string references to numba based distances in
sktime.dists_kernels._numba_distances. It can
also be used with callables, or sktime (pairwise transformer) estimators.
This is a direct... |
b4529d3d0412f01ab42393e741dc3e61555755d834c525aa12ddab1e89c198e3 | Python | 11,478 | 305 | # 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... |
7eefbf4bb71617b68c609e8ec74082709eb4502bb67b3586b4c63b58cb6f7965 | Python | 11,487 | 369 | from pathlib import Path
import warnings
from jinja2 import Environment
import yaml
import numpy as np
import matplotlib as mpl
import seaborn as sns
import seaborn.objects as so
TEMPLATE = """
:notoc:
.. _tutorial:
User guide and tutorial
=======================
{% for section in sections %}
{{ section.header }}... |
822ed0ad32fda39aa057039401110475e3e6aca16ef479ba662df3fc6010168f | Python | 11,487 | 324 | # 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... |
6c297e4f906ee2847b254bc1d567a948425fb159cf326f66a428e7b76e7ed5cd | Python | 11,489 | 299 | import pandas as pd
import os
import numpy as np
import pickle
from scripts import feature_util
from new_version import redistribute_split
import math
# def create_dataframes(config):
# if config.transfer_learning:
# a=0
# else:
# if config.data_source == 'new':
# full_... |
80ae56c3c295ae89c394e5f488ec0aa55c1ad61363d57af5730df44af5a91196 | Python | 11,490 | 249 | """Extension for template of detection metrics.
Purpose of this implementation template:
Quick implementation of new estimators following the template
This is not a concrete class or Base class to import!
Use this as a starting template to build on.
How to use:
- Copy the template in the suitable ... |
0dd90fd0c05b348e52851592b8a0d52ef3c75cb138b7fd90d4ec42982d905ac4 | Python | 11,505 | 308 | # Copyright 2022 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
cf25d7f932fa7a7590861babd1888dadee1aba541fdfa19e398107ed3543a84b | Python | 11,505 | 310 | # 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... |
8bf6c886c5ee72c1c2d199ee278eb64997f5794d6c266dc5e467037c258889da | Python | 11,509 | 346 | import colorsys
import numpy as np
import matplotlib as mpl
import pytest
import nose.tools as nt
import numpy.testing as npt
import matplotlib.pyplot as plt
from .. import palettes, utils, rcmod
from ..external import husl
from ..colors import xkcd_rgb, crayons
from distutils.version import LooseVersion
mpl_ge_150 ... |
5ba241a56f63ba9329321b77ac7c8865a102ddae471c9fb4171a5fef240548c2 | Python | 11,519 | 347 | # 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 specify_int64(indices, inverse_indices, counts):
re... |
0de862a550f22160aca3f165b99a5b1fa34f36962d65b109341edd6e8f22f7cd | Python | 11,523 | 306 | from typing import Optional
import torch
from lgn.cg_lib.zonal_functions import p_cplx_to_rep, repdot
from utils.utils import get_p_polar
def convert_to_complex(real_ps: torch.Tensor, eps: float = 0) -> torch.Tensor:
"""Extend real jet 4-momenta from the dataset
to complex field (with imaginary dimension begi... |
203572cd0ba848394efaefbd0a33271bde2302b109b3ede1891e716949551ab0 | Python | 11,532 | 342 | # 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... |
7a8855a456145f1b9bbb25306b510f4eb3cfa7c31503b3691132580780f4c1aa | Python | 11,540 | 294 | from sklearn import preprocessing
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import random
from src.constants import *
def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
... |
4d256bd9da2d91fe90c6ce309a472402506623520b89ef8e5758bda0ae91c7b4 | Python | 11,544 | 408 | #!/usr/bin/env python
"""
Experimenting with QCoreApplication for experiment container
and component signaling.
"""
import os
import sys
import time
import signal
import pprint
import datetime
import platform
from collections import OrderedDict
from qtpy import QtCore
from misc import getPlatformInfo, printHeade... |
6176565d0a5193f1737b1eefeefa04978ff02a9c658a2217d93f4d8bbd2fbe7a | Python | 11,545 | 262 | import itertools
import operator
import os
import urllib.request
from collections import defaultdict
import matplotlib.pyplot as plt
import pandas as pd
import requests
import streamlit as st
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache
from scipy import stats
from streamlit_tree_select im... |
97570c8dbbfd6a6bea74729636958a6a000bf86ba873fd1f9845a72091d74677 | Python | 11,548 | 339 | """Tests for add API in benchmarking."""
__author__ = ["jgyasu"]
import pytest
from sklearn.metrics import accuracy_score
from sklearn.model_selection import KFold
from sktime.benchmarking.classification import ClassificationBenchmark
from sktime.classification.dummy import DummyClassifier
from sktime.datasets impor... |
cf291b4e21654d4c4837e0a949f1c0b8fa045693e8a87c987ad2445b6aef33e5 | Python | 11,556 | 283 | """BaseAligner interface to sktime dtw aligners in distances module."""
__author__ = ["fkiraly"]
import numpy as np
import pandas as pd
from sktime.alignment.base import BaseAligner
class AlignerDtwNumba(BaseAligner):
r"""Interface to sktime native dtw aligners, with derivative or weighting.
Interface to ... |
31e312d08025fe2b76f20fa1742bb6e848c7dac942793014d4e0d93457fe4bcf | Python | 11,557 | 324 | import copy
import unittest
import math
import torch
import onmt
import onmt.inputters
import onmt.opts
from onmt.model_builder import build_embeddings, \
build_encoder, build_decoder
from onmt.encoders.image_encoder import ImageEncoder
from onmt.encoders.audio_encoder import AudioEncoder
from onmt.utils.parse im... |
78710bb8159a6bab439f2180edf0f5933b123b0907e3299ee4b696f6b063fe79 | Python | 11,570 | 321 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (ConvModule, build_activation_layer, constant_init,
normal_init)
from mmcv.runner import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from mm... |
aaf0423d106778b190f7c8720da34afccf4a721e8d3414f0e357edf49d2d6ff2 | Python | 11,577 | 275 | """
Module containing the GAME-Net architecture and GNN-related classes.
Note: The Graph Multiset Transformer (GMT) originally employed in GAME-Net has
been reimplemented here as the new implementation in pyg>2.0.3 is not compatible.
"""
import math
import os.path as osp
from os import listdir
from typing import Op... |
b318a63206dbfdd73c10289bfd67a1e6614cef8c4e8f0a804794d819822a4927 | Python | 11,589 | 303 | """
Suite of common ways to normalise data.
"""
from __future__ import annotations
from numpy.typing import ArrayLike
from typing import List, Union, Optional, Tuple
from abc import ABC, abstractmethod
import numpy as np
import torch
class NormaliseABC(ABC):
"""
ABC for generalised normalisation class.
... |
bab16d5b84974cff71c8ca621e67f04afd9ca4053733b85c05e4aea28763440c | Python | 11,600 | 342 | import pytest
from torch.optim import Adam
import shutil # Import shutil for cleanup
from pathlib import Path # Import Path for type hinting
import flair
from flair.data import Sentence
from flair.datasets import ClassificationCorpus
from flair.embeddings import DocumentPoolEmbeddings, FlairEmbeddings, WordEmbedding... |
fc78cf6d4c02a12f9d978f830ac8ca879df77033cddb769ffd5315d56aa41819 | Python | 11,602 | 257 | import numpy as np
import torch
import torch.nn
from torch.nn.functional import softmax
from torch.nn.utils.rnn import pack_padded_sequence
import flair
from flair.data import Dictionary, Label, Sentence
START_TAG: str = "<START>"
STOP_TAG: str = "<STOP>"
class ViterbiLoss(torch.nn.Module):
"""Calculates the lo... |
d189bdae1e6042b7aa9d3fb9ecaba8ffee7fb1561ac8f6de2d8258c1e6d89eab | Python | 11,624 | 277 | # Copyright (c) Rahil Gholamipoor
# 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 agree... |
254999c31798b4551c6965e7590507ea1aad7197c7ca3b6d7d46ffa0d791703e | Python | 11,633 | 265 | import logging
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
import models.networks as networks
from .base_model import BaseModel
from models.modules.loss import GANLoss, GradientPenaltyLoss
logger = logging.getLogger('base')
class SFTGAN_ACD_Model(Base... |
5b9f719a2c6e9a74e4441aa5d71efa2db2df40049b8925c3c33b4f7176ca2055 | Python | 11,635 | 302 | # SPDX-License-Identifier: Apache-2.0
# Copyright (c) ONNX Project Contributors
from __future__ import annotations
import numpy as np
import pytest
import onnx
from onnx import checker, inliner, utils
from onnx.reference import ReferenceEvaluator
class TestFunction:
def _verify_function_set(self, extracted_mod... |
924b6291c1075a6f313beaefa104922f7f4d28fe0790edcdc4ff29c18d4a84cf | Python | 11,635 | 306 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Convert Uni-Mol pretraining data into a deepmd LMDB dataset.
Uni-Mol ships its molecular pretraining set as a single LMDB file whose values
are pickled dicts, ``{"atoms": [element symbols], "coordinates": [n x 3 arrays],
"smi": str}``, with roughly ten RDKit conformers p... |
9dffbfbf19bc27e0de41c7d5858d472237d7b64d0eddfce4a7532363bd921523 | Python | 11,636 | 302 | """Private utils functions for reading files."""
__author__ = ["TonyBagnall"]
__all__ = [
"_alias_mtype_check",
"_read_header",
"_write_header",
"write_results_to_uea_format",
]
import os
import pathlib
import textwrap
def _alias_mtype_check(return_type):
"""Return appropriate return_type in ca... |
22e127c3dedffdc756600cf4a9d97add15db01fed14e6ed40ce46b0a31162a66 | Python | 11,645 | 325 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import random
def abeta_input(x):
if x == '>1700':
return random.randrange(1700, 2000)
else:
return x
def load_data_ADNI(input_filename):
# # Get samples names
# samples_file = open('data/... |
3784bafdbc104a0a4fd679e2c1b435dea45d43b4396289e937f51208eee54fd3 | Python | 11,645 | 285 | from __future__ import division
import pandas as pd
import numpy as np
from sklearn import svm
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import cross_val_predict
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.model_selection import StratifiedKFold
from skl... |
d1e8c2325f6be2c786ac525646840b2c77871948abcace5e448340801ce4e0cd | Python | 11,646 | 332 | #!/usr/bin/env python
import click
from click_option_group import optgroup, RequiredMutuallyExclusiveOptionGroup
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... |
c1c9326c4862bd5574de2b88f61eeb7be6b4c9b240a12b17fc781615c77843b9 | Python | 11,651 | 375 | # 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... |
cc9cb2d74a6f1d8319707d1767f64e839ef7f4ee9f6be3e2df85413547b68848 | Python | 11,656 | 248 | # 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.
"""Plot a the distribution of one or more data sets in one or two di... |
4ca6e9a9f8fc61c046de758f547575685adcbd5ce8c65c781ebdf22c525e4918 | Python | 11,657 | 253 | """ Dataloader for all datasets. """
import os.path as osp
import os
from PIL import Image
from torch.utils.data import Dataset
from torchvision import transforms
import numpy as np
import json
import pdb
import os,json,pdb,argparse
import os.path as osp
import numpy as np
import pandas as pd
from PIL import Image
i... |
8dcf7e9a5357352538bf6de49a25ade4275a421d2e51ff0a141675f3e9e07aa2 | Python | 11,662 | 380 | # 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... |
ec068d97288b75aa9a24a405e90e9b7882fc3280f4c2477b6b235579c9376c1e | Python | 11,663 | 223 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
# Questa classe estra da un blocco di codice assembler le features utilizzate nell'articolo ccs17
class BlockFeaturesExtractor:
x86_ARIT = 0
x86_MOV = 0
string = []
dyn_s... |
fe09ce5e093f66ddea6bfd7578e2d5bf9fbedd242747c43e58ee6e128511c2ec | Python | 11,668 | 316 | import numpy as np
import cv2
import fhog
# ffttools
def fftd(img, backwards=False):
# shape of img can be (m,n), (m,n,1) or (m,n,2)
# in my test, fft provided by numpy and scipy are slower than cv2.dft
return cv2.dft(np.float32(img), flags = ((cv2.DFT_INVERSE | cv2.DFT_SCALE) if backwards else cv2.DFT_COMPLEX_... |
dcdf4a6aae5ca5d526cdbcbc5438c1365e6ea011d2d0b261317041ecd1bed2db | Python | 11,671 | 328 | # 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... |
6724834e57ee372bcb3b13dc0995191073e135ecb9851a3a6c139de6598c2237 | Python | 11,680 | 293 | #-------------------------------------------------------------------------------
# elftools: dwarf/dwarf_expr.py
#
# Decoding DWARF expressions
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ import... |
64806a9771f37cc3d51064409adc4a71cd27c6b49d89e086da2c889a70485ce3 | Python | 11,685 | 343 | # -*- 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 ... |
74a461b887cc8cdc64ffdfa9df7d9e8915b696be61e888ac36e9c8e9bde8d820 | Python | 11,688 | 317 | # SPDX-License-Identifier: LGPL-3.0-or-later
import math
from typing import (
Any,
ClassVar,
)
import numpy as np
import torch
from deepmd.dpmodel.common import (
NativeOP,
)
from deepmd.dpmodel.utils.network import EmbeddingNet as EmbeddingNetDP
from deepmd.dpmodel.utils.network import FittingNet as Fitt... |
2935130eeffdd0b08f0447e77cf8fb9978c44ae16cd027e97252307107a3d89b | Python | 11,709 | 292 | import json
import subprocess
import collections
from pathlib import Path
from bs4 import BeautifulSoup
from lxml import etree
import rdflib
from pyontutils.core import resSource, LabelsBase, Collector
from pyontutils.config import auth
from nifstd_tools.parcellation import parcCore, Atlas, LabelRoot, Label
from pyontu... |
e295a6284dc1742420741e46ebe483617d718ae8e603e8632f5a2c674282c9e4 | Python | 11,716 | 262 | from ray.rllib.offline.input_reader import InputReader
from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch
from stratego_env.game.config import STANDARD_STRATEGO_CONFIG
from stratego_env.game.stratego_procedural_env import StrategoProceduralEnv
from stratego_env.game.util import create_game_from_da... |
c8b79b0c889519c87e14f92466bf2858fb6aa56e43b4bddde6fd07afd4ae6376 | Python | 11,724 | 319 | # Copyright (c) OpenMMLab. All rights reserved.
from unittest.mock import patch
import pytest
import torch
from mmcls.models.heads import (ClsHead, ConformerHead, DeiTClsHead,
LinearClsHead, MultiLabelClsHead,
MultiLabelLinearClsHead, StackedLinearClsHea... |
e9aa87c685d29ec111375b97d450f23e8a17eab908a0f6458069e91d71ca7357 | Python | 11,725 | 275 | """Unit tests for classifier/regressor input output."""
__author__ = ["mloning", "TonyBagnall", "fkiraly"]
import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_estimator_deps, _check_soft_dependencies
from sktime.base import BaseObject
from sktime.classification.tests._e... |
b8fffc92bb72462ba5fe422ba750b5bc49d2855f052105ea8ebb5db75da8c87e | Python | 11,727 | 354 | """
@file: util.py
Created on 09.06.18
@project: DeepCrazyhouse
@author: queensgambit
Utility functions which are use by the converter scripts
"""
import copy
import numpy as np
from DeepCrazyhouse.src.domain.variants.constants import (
LABELS_XIANGQI,
CHANNEL_MAPPING_CONST,
CHANNEL_MAPPING_POS,
MAX_N... |
c0840817ad518533d1c2eba72a948d84f6f9464828c247ab35ac0002d58ec415 | Python | 11,728 | 261 | # 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... |
2c853fad40b2115632ddc37d239835293fdf67001b5dacb250d67cfc31fbe1e9 | Python | 11,729 | 307 | # 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
#
# ... |
6e9c8ede36fc7387589c7ac1c2936b7d2a033c365a5b0103d16ede13df2b1da7 | Python | 11,732 | 302 | """
This script generates figure S6g from the paper :
They are the cumulative histogram plots comparing selectivity index for visual (left panel), auditory (middle panel) and
choice decoding (right panel) across brain regions.
In these plots the brain regions are labelled and coloured differently.
In the publication ve... |
0ab5b86b06065d1741fb8f374a062ce3a651520c73bff2b8168623bf4be33167 | Python | 11,738 | 488 | """Dictionaries of expected outputs of classifier predict runs."""
import numpy as np
# predict_proba results on unit test data
unit_test_proba = dict()
# predict_proba results on basic motions data
basic_motions_proba = dict()
unit_test_proba["BOSSEnsemble"] = np.array(
[
[0.5, 0.5],
[0.75, 0.... |
2568ed39b3cf76f1c7d29fa3866dca4ff451205cbfedb8d8dbb069fc83f489ba | Python | 11,755 | 330 | #!/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 os
from Bio.SeqUtils import seq3,seq1
from data_preparation.data_utils import aa_1_letter_code, aa_parameters_all, done_data_recorder
from pyrosetta... |
36ec5be4c150413586cc2c8776015c93a1b72c5d307bb7de0a7ccab3894d5931 | Python | 11,755 | 343 | """Implements Chronos-2 forecaster."""
__all__ = ["Chronos2Forecaster"]
import numpy as np
import pandas as pd
from sktime.forecasting.base import BaseForecaster, ForecastingHorizon
from sktime.utils.singleton import _multiton
class Chronos2Forecaster(BaseForecaster):
"""Interface to the Chronos-2 Zero-Shot Fo... |
e9bea7b4c12c0bd8de72a7aad2346b4beb6fdf1b0cb83b0eb7ad289c8c7243fc | Python | 11,763 | 292 | import json
import subprocess
import collections
from pathlib import Path
from bs4 import BeautifulSoup
from lxml import etree
import rdflib
from pyontutils.core import resSource, LabelsBase, Collector
from pyontutils.config import auth
from nifstd_tools.parcellation import parcCore, Atlas, LabelRoot, Label
from pyontu... |
59c085355eb48fda97b1d584532d7d57cb90d86f91703c8c5db1083446c90d0e | Python | 11,779 | 319 | """Time Convolutional Neural Network (CNN) for classification."""
__all__ = ["CNNClassifier"]
from copy import deepcopy
from sklearn.utils import check_random_state
from sktime.classification.deep_learning.base import BaseDeepClassifier
from sktime.networks.cnn import CNNNetwork
from sktime.utils.warnings import wa... |
77d168d3e77eedcb97df3b0dea57fd194a85a624e90a82fd1cf69b2de7b3cc41 | Python | 11,787 | 301 | # 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
#
# ... |
671faf57222b42cae7a36137d2cd20c77fc82c8a58f6970abfc5ec50ecccb01c | Python | 11,789 | 328 | # 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... |
601bd97f49afc707834c29c69721f726a38e7a93dfdf15fefe92fc573768af78 | Python | 11,790 | 348 | # !/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements adapter for using tbats forecasters in sktime framework."""
__author__ = ["mloning", "aiwalter", "k1m190r", "fkiraly"]
__all__ = ["_TbatsAdapter"]
import numpy as np
import pandas as pd
from sktime.foreca... |
064d5f99a4b7ecda0cae665e29acd4d4dbcbcbfd7532c4a22c25d721d1c5e085 | Python | 11,803 | 247 | import numpy as np
import matplotlib
import pylab
from sklearn.preprocessing import MinMaxScaler
import copy
from scipy.stats import rankdata
import scanpy as sc
import pandas as pd
from mne_connectivity.viz import plot_connectivity_circle
scaler = MinMaxScaler()
def color_cm(cmap, NUM_COLORS, ):
c... |
f4c0ddb60285647cddb3e833ee40b96353f1d18cab87bb2546c9b41d447ff209 | Python | 11,804 | 371 | """
Utility functions for plotting in Palantir
"""
from typing import Optional, Union, Dict, List, Tuple, Any, Callable
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from matplotlib.axes import Axes
from mpl_toolkits.axes_grid1 import m... |
8918377027d020fd77dc07f8143eb047627b53fba28d9f07e692a6444c98deb6 | Python | 11,809 | 289 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.