sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
127b4aadc4cbe3a47b3121a04a01b6475e41f7c404b8177b74737084333f4b87 | Python | 10,878 | 291 | """ Converts owl or ttl or raw rdflib graph into a pandas DataFrame. Saved in .pickle format.
Usage:
Graph2Pandas.py [-h | --help]
Graph2Pandas.py [-v | --version]
Graph2Pandas.py [-f=<path>] [-a | -t=<str>] [-o=<path>]
Options:
-h --help Display this help message
... |
93395bfcd120154fe6bb1c9cc09e44a71c6850297661bb52ab3b92656a5f88d4 | Python | 10,883 | 348 | # SPDX-License-Identifier: LGPL-3.0-or-later
import unittest
from unittest.mock import (
patch,
)
import numpy as np
from deepmd.dpmodel.atomic_model import (
DPAtomicModel,
)
from deepmd.dpmodel.atomic_model.linear_atomic_model import (
DPZBLLinearEnergyAtomicModel,
LinearEnergyAtomicModel,
)
from de... |
9be5b8c84ddc8ee24fae517176eb965e2a6121432cea2325ab3009118d376bcf | Python | 10,883 | 280 | from .utils import str_sum
import sqlite3
import pandas as pd
from collections import OrderedDict
from tqdm import tqdm
import os
import gc
import numpy as np
# making biom, otus, tsvs into npz file. sparse matrix storage needed.
# keep all important information from raw data (paths, leaves of ontology and... |
38e22f003633ad7b37fac7a4c05b2f9b30e6e287dbbac05732213c46f06da542 | Python | 10,889 | 283 | 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 *
class MLP(nn.Module):
def __init__(self, config):
super().__init__()
in_sizes = [config[str_input]] + config[str_hiddens]
out_siz... |
acbaa027bd8cb7531cf26961f9b1983b2abae6b57b55cf2f0991acf9a989a75c | Python | 10,891 | 310 | # 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... |
654454a631145f12d7da93f67c36c553e20c701935eebaa23ccae0af5de51998 | Python | 10,895 | 216 | import random
from tqdm import tqdm
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from vp_suite.base import VPModel
from vp_suite.model_blocks import Autoencoder
from vp_suite.model_blocks.predrnn import SpatioTemporalLSTMCell, ActionConditionalSpatioTemporalLSTMCell
from vp_s... |
9f3f6512c4688f4e252de1024673706a46085aaf5db04ccd4ba3c851d8e2b7d9 | Python | 10,895 | 268 | # SPDX-License-Identifier: LGPL-3.0-or-later
import sys
import unittest
from importlib.util import (
find_spec,
)
import numpy as np
from deepmd.common import (
VALID_ACTIVATION,
)
from deepmd.dpmodel.common import (
to_numpy_array,
)
from deepmd.dpmodel.utils.network import get_activation_fn as get_activ... |
2cfde1438c2e96251f620dc9e5a06ca44cd0370bfea2171ae78544ac4d54dd0b | Python | 10,897 | 394 | # Copyright [2020] Luis Alberto Pineda Cortés, Gibrán Fuentes Pineda,
# Rafael Morales Gamboa.
#
# 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.... |
33cf72b7523c535f209c1e81c1c40fc3e88caf989de2f9ecddedafa60530d3dd | Python | 10,898 | 277 | import logging
import torch
from torch.optim import Optimizer
from torch.optim.lr_scheduler import LambdaLR, ReduceLROnPlateau, _LRScheduler
from torch.optim.optimizer import required
log = logging.getLogger("flair")
class SGDW(Optimizer):
r"""Implements stochastic gradient descent (optionally with momentum) wi... |
c7175f4a27c78157dc559853aab26d14ec86e1aa3c57904c4ea8277aed5a8382 | Python | 10,901 | 211 | from tkinter import *
from mothe.pipe import mothe
from tkinter.ttk import *
from tkinter import scrolledtext
from tkinter import messagebox
from tkinter.ttk import Progressbar
from tkinter import filedialog
import yaml
from tkinter import ttk
import numpy as np
from matplotlib import pyplot as plt
import cv2
class mo... |
7b1c2e3b3eb49d0df50423c03d4ef7e083d1c60fc4c5336da0b9410dde049f12 | Python | 10,911 | 242 | # 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... |
2df42acda00874bff341820c1cdf6c17c59b0d3ec8cc437cdefa12fb4cf4ecf2 | Python | 10,912 | 330 | import argparse
import os
import os.path as osp
import pickle
import re
from collections import OrderedDict
from datetime import datetime
from pathlib import Path
from modelindex.load_model_index import load
from rich.console import Console
from rich.syntax import Syntax
from rich.table import Table
console = Console... |
ab1d86665695303e12740711ef62dd9cc3c8d9b9076f691e53c7a73fe3f2d407 | Python | 10,916 | 239 | 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
#---------------
# set up parameters
... |
ee385d559f16f0574c1021cc94596210b3324211d4561134a0c95b687d42bbb0 | Python | 10,918 | 300 | # -*- 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 can redistri... |
ad779cd97c7153ae97a5ed476f10fe8f1ac3c9757d21ce8e49616709c78acf12 | Python | 10,920 | 268 | from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple
import anndata as ad
import numpy as np
import pandas as pd
import scipy.sparse as sp
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import Stan... |
b731957c3275381655a454722ba92a6de18c0e0c6d481e64095d1a217014bbdf | Python | 10,922 | 275 | """Plot burst detection parameters."""
from itertools import cycle
import numpy as np
from scipy.stats import zscore
import matplotlib.pyplot as plt
from neurodsp.plts import plot_time_series, plot_bursts
from neurodsp.plts.utils import savefig
from bycycle.plts.cyclepoints import plot_cyclepoints_df
from bycycle.u... |
189cdfc805afbb1524ae1bb652cdff0376a3da903575fdc5a26f0cd6c474c063 | Python | 10,933 | 312 | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import torch
from mmcls.datasets import (DATASETS, BaseDataset, ImageNet21k,
MultiLabelDataset)
@pytest.mark.parametrize('dataset_name', [
'MNIS... |
ca31dec9bee370e9c64b9620d6e92b201b70a0b7e8b8bf942587a36b57e22dba | Python | 10,933 | 266 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import csv
import datetime
import os
from collections import OrderedDict, defaultdict
from typing import IO, Any
from tabulate import tabulate
import onnx
from onnx import GraphProto, defs, helper
_al... |
4ef4f1b361e732fe20036e92f113bae095be55d4b41e97aad95f968f703259ca | Python | 10,936 | 311 | # 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... |
744fc39e032a1d31368c2e84cf129e08ffc7dd3411e6c63a98f5bb23fa1a860b | Python | 10,936 | 346 | import os
import re
import sys
import difflib
import inspect
import unittest
import subprocess
from io import BytesIO
from random import shuffle
from pathlib import Path
from collections import defaultdict
import rdflib
from rdflib.plugins.serializers.turtle import TurtleSerializer
from ttlser import CustomTurtleSeria... |
1495c2e9dbb0376015974b4fde4e4297427cea9c906b0b9dc01ab4e211c45d30 | Python | 10,948 | 286 | """RandOm Convolutional KErnel Transform (Rocket).
Pipeline classifier using the ROCKET transformer and RidgeClassifierCV estimator.
"""
__author__ = ["MatthewMiddlehurst", "victordremov", "fkiraly"]
__all__ = ["RocketClassifier"]
import numpy as np
from sklearn.linear_model import RidgeClassifierCV
from sklearn.pre... |
fb155f6e2186e05d3839d862445c3e32ebe1323b33b99627c0a1cf78ba3bd6d2 | Python | 10,950 | 285 | import pandas as pd
import os
import numpy as np
import pickle
from scripts import feature_util
import math
# def create_dataframes(config):
# if config.transfer_learning:
# a=0
# else:
# if config.data_source == 'new':
# full_df = pd.read_csv('data/main_dataframes/final... |
f8b4382ec002faeb5c93bd02c1bbf90d6c0ab6795cc210a65b17dda00777e37a | Python | 10,952 | 304 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class SequenceMap(Base):
@staticmethod
def export_sequence_map_ident... |
a39f7df81cd0583d1a582a0e6626ee989b51c0efd0a6cc7d790b7fb845f419ed | Python | 10,955 | 396 | """
Sphinx plugin to run example scripts and create a gallery page.
Lightly modified from the mpld3 project.
"""
import os
import os.path as op
import re
import glob
import token
import tokenize
import shutil
import warnings
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # noqa: E402
# Py... |
5d4e57c6dfadcc10c4054eb7e422501925edc6671c1cb954d857f6d3df40920f | Python | 10,956 | 314 | # ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.13.8
# ---
# + [markdown]
"""
# Tutorial 1: Input data
To plot figures in Netplotbrain we... |
ac2c095311ec7b57fea14b1a69db59ebb2aaf09fb41f9e3038c49fa0c457e898 | Python | 10,964 | 314 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import itertools
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops._op_common_indices import _get_index, _get_indices
_NUM_2D_PADS = 4
def _get_pad_shape(
auto_p... |
53bbd7a9c5a96721d7c4ade761b1c7c44e13eb5762c2d807edbfa538238e0f21 | Python | 10,970 | 343 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Runtime selection and dispatch for pt_expt carry-all graph builders."""
import logging
from typing import (
TYPE_CHECKING,
)
import torch
from deepmd.dpmodel.utils.lmdb_data import (
PHANTOM_ATOM_TYPE,
)
if TYPE_CHECKING:
from deepmd.dpmodel.utils.exclude_... |
8d637ecc702802a792977945e976c69b27475d92de52ee6af0fc43e0f01e3be0 | Python | 10,970 | 301 | from sklearn.preprocessing import RobustScaler
from tqdm import tqdm
import pandas as pd
import numpy as np
def filter_invalid_columns(df):
"""
Filter invalid columns from the dataframe:
1. Remove constant columns.
2. Convert boolean columns to integers.
3. Remove object columns that cannot be con... |
51d3881602a5cc7e2fba43d32e3fe4b5ff97d9e3f1ad5784dd1fcb5ef6c38f64 | Python | 10,975 | 267 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 4 11:38:51 2021
@author: Mesfin Diro
"""
from typing import Callable, Optional
import os.path as osp
import torch
from torch_geometric.data import InMemoryDataset, Data
import re
from tqdm import tqdm
from rdkit.Chem import AllChem
from rdkit impor... |
3ebe5c2153f9903b7555f8b207c2464a3e43915ff36746a792a9521232488410 | Python | 10,976 | 250 | import logging
import re
from functools import lru_cache
from pathlib import Path
from typing import Any, Callable, Optional, Union, cast
from unicodedata import category
import torch
from deprecated.sphinx import deprecated
import flair.embeddings
import flair.nn
from flair.data import Dictionary, Sentence, Span
fro... |
60db5e46737080a4e96ef5cfbf4e725176d203bfdc01bcf83340036dfb62478e | Python | 10,977 | 272 | # SPDX-License-Identifier: LGPL-3.0-or-later
import logging
from collections.abc import (
Generator,
)
from contextlib import (
contextmanager,
)
from typing import (
Any,
)
import torch
if torch.__version__.startswith("2"):
import torch._dynamo
log = logging.getLogger(__name__)
class ModelWrapper... |
828100c5febe1c1396f13f2218b4f1f0d70ebfcc31fa4aa266b1538b2976624f | Python | 10,977 | 240 | 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, ):
color = []
... |
1aedbc5851e5429f0aaf8986ef80710799a20206a09ca43d6ffcf29f0fca7595 | Python | 10,979 | 288 | """Operations to fill a surface randomly with different molecules. A template
with a simple configuration to use this module can be found in templates
"""
import json
import random
from collections import namedtuple
import numpy as np
from .. import vaspio
from .. import molecule
SEED = None
def parse_molecules(file... |
2b68a62d896bc265e998c7c6c91ccdbc30529cc521a9a61edb752a0313d36f61 | Python | 10,983 | 347 | # 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... |
62a82e47d303a27c205eb00ab67696aeec0610d31044e83c6f77409d0d858c59 | Python | 10,986 | 283 | import os
import pickle
import torch.nn.functional as F
import torch
import torch.nn as nn
def get_data_folder():
return "sp_data/"
class BinarySPClassifier(nn.Module):
def __init__(self, input_size, output_size, classarray=False, filters=[120, 100, 80, 60], lengths=[5, 9, 15, 21],
dos=[0.1... |
109721f8aaf6fac3e0331a663f4ed1983fb24f9105284ba3ccdcb28cdd7ca839 | Python | 10,992 | 493 | #%% [markdown]
# # Explain GM vs. BGM
#%%
import datetime
import logging
import time
import matplotlib.pyplot as plt
import navis
import numpy as np
import pymaid
import seaborn as sns
from graspologic.plot import heatmap
from graspologic.simulations import er_corr
from matplotlib.patches import Rectangle
from matplot... |
a8f26141be8a034a454e6a8fc5b48a3b87a101caf2b5aefec6cde8b1c14227b6 | Python | 10,994 | 390 | # Copyright 2018-2026
# 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... |
4be6eaf958cf2212d7533895b12e52b0cadfba0e34d3ff76d68f5f45511106eb | Python | 10,999 | 287 | # 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... |
a39bece724d34974351bb58f29e0df30ad20d690dd3302e7eab151ff63985ef1 | Python | 11,002 | 330 | """Balanced dataset splitting via Monte Carlo permutation search.
Generalises the round-robin splitting strategy from
``bcblib.tools.misc.create_balanced_split`` (which groups subjects by lesion
territory) to any categorical grouping variable.
References
----------
Morgan & Rubin (2012). Rerandomization to improve co... |
bdaaf6fe2f10ec3d676c90efecb860769e74f3262a26b19f21ced371615f2414 | Python | 11,021 | 251 | """Benchmarking for forecasting estimators."""
from collections.abc import Callable
from sktime.benchmarking._benchmarking_dataclasses import (
FoldResults,
TaskObject,
)
from sktime.benchmarking.benchmarks import (
BaseBenchmark,
)
from sktime.forecasting.base import BaseForecaster
from sktime.forecastin... |
a08e24e4f7fb1c10aa5f10cb757d47f84c1d303befb4f6f17857fd4208844ef9 | Python | 11,022 | 297 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Pre-process Data / features files and build vocabulary
"""
import codecs
import glob
import gc
import torch
from collections import Counter, defaultdict
from onmt.utils.logging import init_logger, logger
from onmt.utils.misc import split_corpus
import onmt.inputter... |
829ed6737895a5d92f527f137c3cb224a9cf2933b20d30356763f874584184b8 | Python | 11,026 | 318 | # 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... |
b2c03b818d9e958c29541bfed16c1745c654e8bd2e6ce2aed0a2cbd4932ba8e2 | Python | 11,034 | 307 | # This code is an implementation of the model presented in Sætra et al. 2023.
import dolfin as df
default_init_parameters = {"alpha_i": "0.4",
"alpha_e": "0.2",
"Na_i": "15.474585472970270",
"K_i": "99.892102216365814",
... |
942fd67ff6821bd8e871e68f8f6063bf5c802b82d383f595c32081db3c5add22 | Python | 11,043 | 244 | """
These are all the runs for the SAM tone data
Run with the 0.7686 ASA density
24-Nov-2020 to 29 Nov 2020
"""
samdata = {
2: [
'runANPSTH-all-2020-11-25.09-00-38',
'runANPSTH-largestonly-2020-11-25.09-19-53',
'runANPSTH-removelargest-2020-11-25.09-39-28',
'runANPSTH-all-2020-11-... |
411bc64e8f52c4645424d36587d326fc5c88e3b963e110f3d301afe65c43af09 | Python | 11,045 | 235 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
import os
import shutil
import time
from socket import gethostname
from termcolor import colored
import dill
import numpy as np
import ray
from mprl.utility_services.payoff_table imp... |
16ef1deaab255cafc9d70a9e32f49fcd5381e5315730834d64f78e436cf225fe | Python | 11,050 | 250 | import numpy as np
import nibabel as nib
import os
import json
import templateflow.api as tf
from scipy.ndimage import rotate, sobel, spline_filter1d
from nibabel.processing import resample_to_output
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from skimage import measure, segmentation
from .. import __path_... |
08d630de39b77290408349c19f9c403043f39deeab3a822a788e9dc08a0f10a5 | Python | 11,068 | 305 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Issue #5906 Task 4: export-time questions are atomic-model capabilities.
Compositions must answer by aggregation, never by wrapper type or by
reaching into a single ``.descriptor``.
"""
import copy
import pytest
from deepmd.dpmodel.atomic_model import (
DPAtomicMo... |
d7a4b2486f167a315865d4a4be2e8a3cc9467e4a05a0f55dfe4331c9fc719d7d | Python | 11,069 | 349 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Col2Im(Base):
"""Col2Im operator with N-dimension support
The... |
3725d270f87a87584b33005e866f3cf1e9371ee56336ab00c21813ac53ad9d6b | Python | 11,070 | 351 | """
conflict_comparison.py
Generate the conflict comparison figure which compares the
ring model to the vector sum given by Murray and Morgenstern
(2010).
References:
Murray and Morgenstern(2010) - Cue combination on the circle and the sphere
"""
import argparse
import numpy as np
import matplotlib.pyplot as plt
fro... |
edf436b372c7f172aaf12691c5091ccbdd51c199c79ced0b9f403686f1847091 | Python | 11,070 | 336 | # 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... |
f61cd1af101926cb04c8aad298fe54c043b63c1fc116b010c056bc580b194753 | Python | 11,076 | 237 | import os
import random
import torch
import torch.nn as nn
import torch.utils.data as Data
import numpy as np
import pandas as pd
import argparse
from data_utils import data_generator, data_preprocess
import math
from model import ClaLSTM, SASA
class sasa_lstm_model(object):
def __init__(self,... |
4f0da4451e4ec51eb1949863ebd7350684e52f959bf8c1b71f018c8e1cbcb0c0 | Python | 11,077 | 285 | """BaseAligner interface to sktime edit distance aligners in distances module."""
__author__ = ["fkiraly"]
import numpy as np
import pandas as pd
from sktime.alignment.base import BaseAligner
class AlignerEditNumba(BaseAligner):
r"""Interface to sktime native edit distance aligners.
Interface to the follo... |
8f09a0ad10253e2832e1a742d2c0eb04a7971ef1516b124e721fa4097669a9d4 | Python | 11,078 | 308 | import functools
from collections import OrderedDict
from copy import deepcopy
from typing import Iterable
import torch
import torch.nn as nn
from mmcv.runner import build_optimizer
from mmcv.runner.optimizer.builder import OPTIMIZERS
from mmcv.utils.registry import build_from_cfg
from torch.autograd import Variable
f... |
23fd616c15921840fd04819556c8364f5023ba498282f58cb7c10c0e031c647f | Python | 11,092 | 243 | import torch.nn as nn
from torch import cat, transpose
import torch
import torch.nn.functional as F
from Layers import EncoderLayer, DecoderLayer
from Sublayers import Norm, OutputFeedForward
import copy
import attention_setting
import numpy as np
import crispr_attn
import math
import OT_crispr_attn
import sys
import i... |
66330cff77ee1d1544dcd393e22c6c5acba116dc59af4fe6df43783fb8c19536 | Python | 11,100 | 280 | from typing import Callable, List, Set, Union, Optional, Tuple
import numpy as np
import logging
from .dataset import JetDataset
from .utils import (
checkConvertElements,
checkDownloadZenodoDataset,
getOrderedFeatures,
checkStrToList,
checkListNotEmpty,
getSplitting,
)
from .normalisations i... |
4e025935fa1293abc5354a4f28612cbe55ef8b351ced06f4d32837fea8aa0172 | Python | 11,104 | 304 | #!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Generate the compressed DPA4C .pt2 test models of the compact canonical lower.
A compressed DPA4C frozen with the compact canonical lower is served by two
entry points: the host ones, which build the compact canonical graph from
coordinates, and th... |
2609d2738d53334a06340567f334232fce0730bf9f78e055cb96cbc711eb12df | Python | 11,110 | 395 | # 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... |
79014a170a4b2527d7440f09ce55950611c25de53424f1ccd40f8501273e1175 | Python | 11,112 | 320 | """
continuous_learning.py
This script provides a simulation routine which tests how the ring
model behaves where plasticity is enabled during behaviour. This was
written and tested before the insight provided by Dan et al. (2022)
and Fisher et al. (2022); namely, that angular velocity appears to
regulate plasticity ... |
b250c022c51dec0f5dc60e946381d3080848a9cd80958057c13006827bde1936 | Python | 11,113 | 228 | import pandas as pd
import numpy as np
import statsmodels.formula.api as smf
from scipy.io import loadmat
import matplotlib.pyplot as plt
from nilearn import plotting
prwfile = 'rmsRaw.csv'
prwfile = 'stdRaw.csv'
sourcefolder='/Users/yyu/Documents/Psychology/Derek/Data/'
labeldict={'None':'Unassigned','Default':'DMN... |
1231d2b487dff00ca2e76baaa1a55ca6598dbcdac93d3caa48a589446b711f3f | Python | 11,115 | 261 | import sciunit
import networkx as nx
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from copy import copy
import re
from networkunit.utils import use_cache
class graph_centrality_helperclass(sciunit.Test):
"""
Abstract test class to compare graph centrality measures of a set of
s... |
d3f0bacf09e19ba6adc28ba0140b84db158fcb0cd13285cc96d9cebfad720dc9 | Python | 11,115 | 218 | # -*- coding: utf-8 -*-
"""
Runs alternate baseline where 5 random channels of cochlear model are selected.
@author: ronwd
"""
import numpy as np
import soundfile as sf
import pyfilterbank.gammatone as g
from sklearn.linear_model import SGDClassifier
from tqdm import tqdm
from SFA_Tools.SFA_Func import *
from path... |
df4e734e14a088e23def954d8b4c9f5a23a38be5fbcca5aa193dbc530cd55fbd | Python | 11,116 | 244 | import sciunit
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains
from sciunit.models import RunnableModel
import numpy as np
from elephant.spike_train_generation import single_interaction_process as SIP
from elephant.spike_train_generation import compound_poisson_process as CPP
from elephant.... |
84279432dab4a81422743d9faf4b013be4696c08d32ad460b06141d37becf6e3 | Python | 11,117 | 244 | '''
Pure-python implementation of UCSC "liftover" genome coordinate conversion.
Class for dealing with "xx.over.chain" files.
Copyright 2013, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
import os.path
import gzip
import urllib
import shutil
import sys
from .intervaltree import IntervalTr... |
3ae429a596ab5fffd8ef381aa251255e8bb2dbe619cda5f8b64274967bd167a6 | Python | 11,125 | 259 | from pathlib import Path
import math
import os
import re
import numpy as np
import torch
from tqdm import tqdm
from PIL import Image
from vp_suite.utils.utils import timed_input
from vp_suite.base import VPDataset, VPData
from vp_suite.defaults import SETTINGS
class MovingMNISTDataset(VPDataset):
r"""
Datase... |
108c2ae374292417325e0f700305c22df3291be7d5f89f00cab79b677e4280d6 | Python | 11,126 | 209 | """Run Hyperparameter optimization with Ray Tune"""
import argparse
import os
os.environ["TUNE_RESULT_DELIM"] = "/"
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src')))
from gnn_eads.paths import create_paths
from gnn_eads.create_graph_datasets import create_graph_datasets
... |
00d494e11166b0f705c2e7bf5dd84cad835337d2909efdbeaa8db279d69120af | Python | 11,130 | 322 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcls.models import build_loss
def test_asymmetric_loss():
# test asymmetric_loss
cls_score = torch.Tensor([[5, -5, 0], [5, -5, 0]])
label = torch.Tensor([[1, 0, 1], [0, 1, 0]])
weight = torch.tensor([0.5, 0.5])
loss... |
0dd47261b6a6656782009f051f806027972f107626b0394fb41266a260c50ca4 | Python | 11,132 | 251 | """
T* -- the no-free-lunch theorem, CORRECTED.
A free lunch at an interior policy w is a tangent dw (1^T dw = 0) with Q dw >= 0
and Q dw != 0 (a Pareto improvement of per-prompt success; since
f^T dw = (1/N) 1^T Q dw, "mean up" is equivalent to "some prompt up"). This does
NOT depend on w.
CORRECT characterization (... |
6913f6c7223dc696d0d02f3f5dedc95a7330ed81883a88dcd366a4addc2d5d6d | Python | 11,132 | 285 | from collections import namedtuple
import numpy as np
import warnings
def lambda_calc(dist, pdist, constraint, mass1, mass2, t_step):
num = pdist**2 - constraint**2
den = 4*(mass1**-1 + mass2**-1) * t_step**2 * np.dot(pdist, dist)
return num/den
class Shake:
"""Perform a constrained molecular dynamic ... |
51dbf4ab2a4fafaeee77e153e95a9b8ebe83d8ffcfc79ded3e9c8f3693f0d664 | Python | 11,133 | 325 | # -*- 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 ... |
7ba8bd2dbd596f1ac79b1cd4e346069ecac3b1505d7c193a6454c437cf7820db | Python | 11,137 | 340 | # Copyright 2026 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... |
565d4b7ac37fb4495a526cffb1708f46ddffe5b34311d44ffd9851e947208ab8 | Python | 11,144 | 295 | # 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... |
7d50bbe4a1492ecca6d7a3b75a5399d68608b57eb991912bd1f51174f99db28b | Python | 11,145 | 331 | # =============================================================================
# IMPORTS
# =============================================================================
import torch
import numpy as np
import h5py
from tqdm import tqdm
import torch.nn as nn
import matplotlib.pyplot as plt
# ===========================... |
7104cf5c22a77afffe4522609ca5abe2ce30a9dcee2788613f042524d04d5814 | Python | 11,153 | 242 | import argparse
import torch.optim as optim
from torch.optim import lr_scheduler
from albumentations.augmentations import transforms
import cv2
import numpy as np
import seaborn as sns; sns.set()
from matplotlib import pyplot as plt
import pandas as pd
def scheduler_maker(optimizer, config):
if config['scheduler... |
88c60d6be8d5f8d863ae18cadf3fce973e1a24d567dc5e82ae34c88a14a1b589 | Python | 11,156 | 243 | import unittest
import networkx as nx
import os
from template_generation_utils import read_dendrogram_tree
from marker_tools import read_marker_file, extend_expressions
PATH_DEND_JSON = os.path.join(os.path.dirname(os.path.realpath(__file__)), "./test_data/CCN202002013.json")
PATH_MARKERS = os.path.join(os.path.dirna... |
d067898382fcf7c4c3cd559dd094341c346388471f69e586e34bf7d37f1de10f | Python | 11,159 | 353 | # Mocapy: A parallelized Dynamic Bayesian Network toolkit
#
# Copyright (C) 2004 Thomas Hamelryck
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License... |
8c8ee1fcd1caee0127fea60ef7ef8934e300d7af4a66e03506e28e6e879d8590 | Python | 11,160 | 282 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements adapter for StatsForecast forecasters to be used in sktime framework."""
__author__ = ["AzulGarza"]
__all__ = ["_StatsForecastAdapter"]
import pandas as pd
from sktime.forecasting.base import BaseForecaster
from sktime.forecasting... |
7b86d98214db9f7f4f719c31f8456c32b05dcbbb2967c5f237a9d4972759b2d9 | Python | 11,163 | 273 |
from functools import lru_cache
from typing import Dict, List
from collections import namedtuple
from itertools import product
import e3nn.o3 as o3
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.cuda.nvtx import range as nvtx_range
FiberEl = namedtuple('FiberEl', ['degree', 'channel... |
99db5efcf0cd3a27439b974f0bd8260519e04c3b4a752f24773f9fe52adee9f0 | Python | 11,163 | 464 | """Example generation for testing.
Exports examples of in-memory data containers, useful for testing as fixtures.
Examples come in clusters, tagged by scitype: str, index: int, and metadata: dict.
All examples with the same index are considered "content-wise the same", i.e.,
representing the same abstract data objec... |
a3cc764193f42c7ae20605371ab469fd3a6c67d2a56ef1829dbac6770d4ec12d | Python | 11,171 | 295 | """Bagging time series classifiers."""
__author__ = ["fkiraly"]
__all__ = ["BaggingClassifier"]
from math import ceil
import numpy as np
import pandas as pd
from sklearn.utils import check_random_state
from sktime.classification.base import BaseClassifier
class BaggingClassifier(BaseClassifier):
"""Bagging en... |
c1b8f8a8a8db00b8441409fad204515d6e57d21ac3ee0858b3a7a3d0eae8806a | Python | 11,172 | 339 | import os.path as osp
import argparse
import logging
from pathlib import Path
import torch
import numpy as np
from utils.argparse_utils import get_bool, get_device, get_dtype
from utils.argparse_utils import parse_model_settings, parse_eval_settings
from utils.jet_analysis import plot_p, get_ROC_AUC, anomaly_scores_sig... |
66787951091ebb1972188d00e4df539fc89394182e6480c2b1be9b2b2fd5c751 | Python | 11,175 | 373 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
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_tensor
class Dequa... |
e6fdfa570f7329fefb7f0eaafb70dfaa20fff798ea91c8a40cede51f1a75ca10 | Python | 11,176 | 171 | #!/usr/bin/python
# coding=utf-8
# only test the phenotype confirmation model trained from MIMIC-III discharge summaries for new documents.
from sent_bert_emb_viz_util import load_data, encode_data_tuple, test_model_from_encoding_output
import pickle
import os, sys
from step4_further_results_from_annotations import g... |
505bb2e6cd4609184de8a063976446890db4b79d37bc0914557d672c5a54497f | Python | 11,184 | 380 | """
===========
Basic Units
===========
"""
import math
import numpy as np
from packaging.version import parse as parse_version
import matplotlib.units as units
import matplotlib.ticker as ticker
class ProxyDelegate:
def __init__(self, fn_name, proxy_type):
self.proxy_type = proxy_type
self.fn... |
2c0e2014051c623fea5eef520bfcfd6d05ffeded40429965d390eae1e6578081 | Python | 11,190 | 316 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 19 17:20:25 2018
@author: wanglab
"""
import os, numpy as np, sys, time
import collections
import torch
import tensorboardX
import dataprovider3 as dp
import utils
import train
import loss
import tifffile
from torch.nn import functional as F
i... |
9d37392ca1de1b340481ef64ecdabe0f2fb2a011c1a04cb5b06478f996457762 | Python | 11,190 | 294 | # SPDX-License-Identifier: LGPL-3.0-or-later
import json
import os
import shutil
import tempfile
import unittest
from copy import (
deepcopy,
)
from pathlib import (
Path,
)
import numpy as np
import torch
from deepmd.pt.entrypoints.main import (
get_trainer,
)
from deepmd.pt.train.training import (
g... |
fb5b1b0d15131021fb3e810730f097ce107da5566e4b3d0ca36c935ed5ecfacd | Python | 11,190 | 293 | #!/usr/bin/env python3
"""SingleCellFusion main rontine"""
from .__init__ import *
import collections
import argparse
import anndata
from . import basic_utils
from . import SCF_utils
def add_args(parser):
"""
"""
# parser.add_argument("-c", "--config_py", help="Configuration file", required=True)
r... |
7f4dab11cc7f9b0cd67006fac3021f542991bd547a894a88835046ba2563dcfc | Python | 11,191 | 322 | # 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... |
4e15ab6eed95c8a8c9680e8d630a442e59a2e320ee47a021d395e4ce4f0889d6 | Python | 11,194 | 298 | # -*- 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 can redistri... |
81ca2efc5dd8001db6aa81958d53879970700000b996103407fdd4725444c569 | Python | 11,194 | 330 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Tests for the training log messages."""
import datetime
import logging
import os
import pickle
import sys
from collections.abc import (
Iterator,
)
from pathlib import (
Path,
)
from types import (
SimpleNamespace,
)
import pytest
from deepmd.loggers import... |
ae4f82b57910b41f2bf1ae56763a75c835861e49b52b23ffc9d6b2f738e7f84a | Python | 11,201 | 304 | # 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... |
2a9b93f3bd7939e7037ec403fcfafbb9e009f4f4a1c236e9d17c1223e4bd6c6f | Python | 11,208 | 269 | # 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... |
2cb1d42686be306f6bc763e86671fe2718c977670bec25942e751cac27415784 | Python | 11,216 | 259 | # Copyright (c) OpenMMLab. All rights reserved.
from numbers import Number
import numpy as np
import torch
from torch.nn.functional import one_hot
def calculate_confusion_matrix(pred, target):
"""Calculate confusion matrix according to the prediction and target.
Args:
pred (torch.Tensor | np.array):... |
b56b0ac5592144928e401201fe2588c5abf0fe304db1d953ae3f40fc2cab4ffb | Python | 11,219 | 269 | from __future__ import division
import re
import os
import numpy as np
import pandas as pd
from scipy import ndimage
from SPHARM.lib import spharm
import SPHARM.lib.parallel as prl
import SPHARM.lib.segmentation as sgm
from SPHARM.lib.vrml_parse import combine_with_track_data
from SPHARM.classes.image_stack import Ima... |
e57f0ab3d6fc67155bc6e1df75bd7b5c5841bae9ee0257d83fc31151dcbdf39c | Python | 11,220 | 299 | """Learning Shapelets classifier, from pyts."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
__all__ = ["ShapeletLearningClassifierPyts"]
from sktime.base.adapters._pyts import _PytsAdapter
from sktime.classification.base import BaseClassifier
class ShapeletLearningClassifierPyts(_PytsAd... |
4f08bfec10d45089a1a8f9fde67d4bc67e82a1290eb41e918ab39d9a04382885 | Python | 11,237 | 295 | #!/usr/bin/env python3
"""Harmonize FLAMES/ONT and CRC/PacBio by exact multi-exon splice chains."""
from __future__ import annotations
import argparse
import gzip
import json
import re
import sys
from collections import Counter, defaultdict
from pathlib import Path
from typing import TextIO
import numpy as np
import... |
a35705a7ffcdedfe83eb94cb4e6cb88dbf90c71b4f9de86fbbd0e8e57b007948 | Python | 11,237 | 289 | import requests
import nifstd_tools.parcellation as parc
from pyontutils.core import Source, LabelsBase, Collector, build
from pyontutils.utils import Async, deferred
from pyontutils.namespaces import makePrefixes
from pyontutils.namespaces import NCBITaxon, UBERON, NIFRID, ilx, ilxtr, TEMP
from pyontutils.namespaces i... |
29c148369c3c0aa0354944e9d8fba85f62fa8a2d1fe4f1163d06e6e8c54c634a | Python | 11,239 | 335 | """
Implements fitting functions for latent variable model in Urban et
al. (2023).
Main method provided is the fit() method which takes in a dataset and
returns fitted parameters according to latent variable model.
"""
import numpy as np
import scipy.linalg
import cvxpy as cp
def r_map(r_counts, r):
"""
Ret... |
71a2af328c22c82f8395d860865639ae2fa469ac56848b726c18c0bd9379bed6 | Python | 11,239 | 286 | # 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... |
ad2c786c62587dcf4beeeba679f05baeeff55643a6e0d558d149ffcd11de0c3a | Python | 11,239 | 28 | from regionscode.regions_per_sections_rat import regs_per_section, Regions_n_colors_List
def create_regs_n_colors_per_sec_list(atlasnum):
regs_per_sec_List = regs_per_section[int(atlasnum)] #list
regs_n_colors_per_sec_List = [('root', 'not detected', '000000', (0, 0, 0))]
for elem in Regions_n_colors_List... |
785a04ed6c4a79f15208b5962d3a3232d18c02c52a5f2933a2ee308431b6487b | Python | 11,242 | 304 | import os
import numpy as np
import pandas as pd
from skbio.stats.composition import (closure, alr, alr_inv,
multiplicative_replacement)
from sklearn.preprocessing import LabelEncoder
from cmdstanpy import CmdStanModel, CmdStanMCMC
import tempfile
import json
import xarray as xr
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.