sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
95fa57fc60123fcb8180b595a7a24a42b0c0240a8accf55bc4ed789a09bff84a | Python | 9,964 | 263 | from __future__ import annotations
from collections.abc import Generator
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from typing import TYPE_CHECKING
if TYPE_CHECKING: # TODO move to seaborn._core.typing?
from s... |
227984243180ffd7cdb5a3ae0054a41e5f95d7146efeafad7dc2922cd0c2bc76 | Python | 9,965 | 297 | # type: ignore
import torch
import torch.nn.functional as F
from torch import nn
class DoubleConvBlock(nn.Module):
"""(2D conv => BN => LeakyReLU) * 2"""
def __init__(self, in_ch, out_ch, k_size, pad, dil):
super().__init__()
self.block = nn.Sequential(
nn.Conv2d(in_ch, out_ch, ke... |
ecf53930e1aabaa5990fb9d5caae9ecb97601b09d938ae22060a951b07858da6 | Python | 9,972 | 274 |
"""
Helper utils for Model Export tool
"""
import json
import logging
import os
import re
import zipfile
import shutil
from .model_archiver_error import ModelArchiverError
from .manifest_components.engine import Engine
from .manifest_components.manifest import Manifest
from .manifest_components.model import Model
f... |
d45bc27add80af7b3e1993c63b854bb7578111527ecae19d6b130b3fa5bed594 | Python | 9,991 | 316 | import os
import pytest
import flair
from flair.data import Corpus, Dictionary, Label, Sentence
from flair.datasets import ColumnCorpus, FlairDatapointDataset, SentenceDataset
def test_dictionary_get_items_with_unk():
dictionary: Dictionary = Dictionary(add_unk=True)
dictionary.add_item("class_1")
dict... |
2c7e80c042bc6f800985b2771f3529c3b70feec780e30fb098fb87043ab93733 | Python | 9,997 | 328 | import numpy as np
from pathlib import Path
import Switches_Static as st_switches
from skimage import measure
import cv2 as cv
def check_switch(parameter):
global tf
if parameter.section_classifier_on or parameter.segmentation_1_20_on or parameter.section_QL_on:
import tensorflow
tf=tensorflow
... |
47161c9fd03af785a647579a7f67da642c79f88c0e75cba55a9e4099d1aecf2a | Python | 10,004 | 270 | """Composers that create panel pairwise transformers from table pairwise transformers.
Currently implemented composers in this module:
AggrDist - panel distance from aggregation of tabular distance matrix entries
FlatDist - panel distance from applying tabular distance to flattened panel matrix
"""
__author_... |
2313bc4eba2c1819e02902d250fc23318cd2f053bff750e017bf3ebd8f273301 | Python | 10,007 | 270 | from __future__ import annotations
from collections.abc import Mapping
from collections.abc import Sequence
from collections.abc import ValuesView
import itertools
import numpy as np
import pytest
import optuna
from optuna import samplers
from optuna.samplers._grid import GridValueType
from optuna.storages import Re... |
2f494dbf7adbfdbdce6dbcca16e7931e810093f57cdac48c6bf2bb5a4847f6a8 | Python | 10,015 | 243 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import palettable
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from scipy.stats import pearsonr
def lmplot_label2prediction(extonionnet_object, label='pKa', prediction='pK... |
c2e9e8e2823523e772c51afcfad2c58f8da2683e9d61988f8a00aa54c86b1b9d | Python | 10,027 | 294 | # 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... |
78209cfcec3268fb941ce5ef99930e66fe23102d2db9edc97f88644e944a7aa0 | Python | 10,030 | 314 | import cv2
import random
import numpy as np
from scipy.stats import pearsonr, spearmanr, kendalltau, zscore
from sklearn.cluster import KMeans, AgglomerativeClustering, DBSCAN
from dnnbrain.dnn.core import Mask
def get_frame_time_info(vid_file, original_onset, interval=1, before_vid=0, after_vid=0):
"""
Extr... |
81f84384c3a1014574abe72dc61c0fecf3528bc19fe0943510b2fdf4274eac04 | Python | 10,031 | 283 | #!/usr/bin/env python3 -u
"""Time Recurrent Neural Network (RNN) for classification."""
__all__ = ["SimpleRNNClassifier"]
from copy import deepcopy
from sklearn.utils import check_random_state
from sktime.classification.deep_learning.base import BaseDeepClassifier
from sktime.networks.rnn import RNNNetwork
class ... |
31d519c5ec0d77f20ea9b9687f97265970ab751d94f3f636ace5a2ceb4130219 | Python | 10,051 | 230 | from collections import defaultdict
from pathlib import Path as p
import rdflib
from rdflib import *
from ilxutils.tools import open_pickle, create_pickle
from ilxutils.interlex_sql import IlxSql
import pickle
import os
from typing import *
class rdfGraph(Graph):
''' Adds needed functions to rdflib.Graph '''
... |
41bd5aab697a4694bf23b51a2b4a66912cdeaca959d83d9f716ed32819a86b63 | Python | 10,054 | 284 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""Moving window (MOSUM) changepoint detection algorithm."""
__author__ = ["Tveten"]
__all__ = ["MovingWindow"]
import numpy as np
import pandas as pd
from sktime.detection._change_... |
b2be9cd43b887b4104c8846a763c77cda9bb06fee56fb32a29cd006e596f096d | Python | 10,067 | 222 | import torch
import torch.nn as nn
import logging
from cormorant.cg_lib import CGModule, SphericalHarmonicsRel
from cormorant.nn import RadialFilters
from cormorant.nn import InputLinear, InputMPNN
from cormorant.nn import OutputLinear, OutputPMLP, OutputSoftmax, GetScalarsAtom
from cormorant.nn import NoLayer
from... |
52d3fbab502b8065e55964bab7006e3f4c89f07fc7efda04fe16c1d4239a7280 | Python | 10,069 | 274 | # from rdkit.Chem.Draw.cairoCanvas import Canvas
import os
import re
from collections import defaultdict
import numpy as np
import rdkit.Chem as Chem
import rdkit.Chem.AllChem as AllChem
import rdkit.Chem.Draw as Draw
from PIL import Image, ImageOps
'''
Many of these functions are taken from RDKit.
'''
def mols_fr... |
33ca8584c095c8d74f4d2366e43472f566bcf779e62d43f3f0ebe1ab69b82652 | Python | 10,070 | 242 |
#=======================================================================================================================
# 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... |
aa07f80067db0be5c04c029790345aa96255a162aec8ae05a44ebc4dae95b613 | Python | 10,073 | 272 | # 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... |
e4a46aaf3c71cd1fe3bd47f5fc758515566c5f52672a1a774c144f59636cb019 | Python | 10,093 | 268 | # -*-coding:utf-8-*-
# from __future__ import absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
from networks.ShakeDrop import ShakeDrop
def conv1x1 (in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kerne... |
598829243c1527b47ec8962a83edbbac062ce8653de2237e5e6bdd71a4d43011 | Python | 10,098 | 227 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 3 11:39:37 2018
@author: wanglab
"""
import os, numpy as np, sys, multiprocessing as mp, time, matplotlib.pyplot as plt, pandas as pd, pickle, matplotlib as mpl
from scipy import ndimage
from skimage.external import tifffile
from scipy.ndimage.mor... |
e1575da2ef82286b4bda5e067d76d07a619fff880b40527be542dd52a4fb5f8e | Python | 10,102 | 291 | import copy
from functools import lru_cache
from os import path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ray import tune
from scipy import stats
from tune_tf2.defaults import EXPLOIT_CSV, HPS_CSV, PBT_CSV
@lru_cache(maxsize=10)
def load_tune_df(experiment_dir):
"""Cache the cre... |
ea41ec12138567ec61f73ed10083eb03c6c791ef8e69b2b4dabaab31201503d0 | Python | 10,103 | 295 | # 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... |
c936c273cbcbdabf4a07d0953b7712294b71b646fe4edb76a8822ca30ce3a9c4 | Python | 10,111 | 245 | import json
from pathlib import Path
from typing import Optional, Union
import gdown.download_folder
import PIL
from torch.utils.data import Dataset
import flair
from flair.data import BoundingBox, Corpus, FlairDataset, Sentence, get_spans_from_bio
from flair.datasets.base import find_train_dev_test_files
class Ocr... |
37ea99f6ab6bf36b0821c92fd094e2bb89fbaba6aeb1790726a85fc04df4d965 | Python | 10,116 | 245 | import csv
import networkx as nx
import pandas as pd
import logging
import os
from template_generation_utils import get_root_nodes, read_taxonomy_config, generate_dendrogram_tree, index_dendrogram, read_csv_to_dict
from dendrogram_tools import dend_json_2_nodes_n_edges
from nomenclature_tools import nomenclature_2_nod... |
c2b2f8e1f0edad726fe973008b40fd113b590fb9c3329e7e21ebba313d9eb52e | Python | 10,117 | 257 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import namedtuple
import numpy as np
import logging
import collections
from ray.rllib.utils.annotations import override
from ray.rllib.policy.policy import Policy
from ray.rllib.models.catalog... |
36b83f87772711a4ad2f94a3b50292d08a67c0583e60af34c17df669a5837531 | Python | 10,118 | 277 | # 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
#
# ... |
0796c71d43453eb21872828cb0fac8f7c1cdef473ab4399b5d258adc7871c6fb | Python | 10,119 | 277 | """Tests for the v2 post-hoc benchmark evaluators."""
__author__ = ["viktorkaz", "mloning"]
import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.benchmarking.analysis import (
AverageRank,
CriticalDifferenceDiagram,
FriedmanTest,
... |
2d6cb5f30fd02d2f5bdacafd0960595bd0e955dc1bc55b2b2ea86ab69f299e4e | Python | 10,121 | 212 | import argparse
from copy import deepcopy
import torch
import torch.nn as nn
import numpy as np
from vp_suite.models.predrnn_v2 import PredRNN_V2
from vp_suite.utils.models import state_dicts_equal
REFERENCE_GIT_URL = "https://github.com/thuml/predrnn-pytorch.git"
REPO_DIR = "predrnn-pytorch"
def test_impl():
... |
42ff712aa6e9970bb1c98a2e7cbda5a0e4dd74a9c912053e9bf5c4eb1685c446 | Python | 10,121 | 238 |
#=======================================================================================================================
# 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... |
2488cbc2c0193d74415357c805385ac6e223c1dae924db4915c4bae8a7869612 | Python | 10,124 | 285 | import matplotlib.pyplot as plt
import mpltern # noqa : F401
from math import sqrt
import numpy as np
import numpy.typing as npt
from typing import Literal, Optional
from scipy.spatial.distance import squareform
from scipy.stats import gaussian_kde
from .run_gw import DistanceMatrix, Matrix
def normaliz... |
f99345343d75276ed502423f506cb3e5a74d1e0abf82083b356828928c0190dd | Python | 10,126 | 293 | # 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... |
5ca51797abf15553dbf0c723e5723c92f84ce65a13f4025ed787ecbf83f46f30 | Python | 10,128 | 298 | """Abstract base class for the Pytorch neural network classifiers."""
__author__ = ["geetu040"]
__all__ = ["BaseDeepClassifierPytorch"]
import abc
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sktime.classification.base import BaseClassifier
from sktime.utils.dependencies import _safe_imp... |
3228bd6e8bf558b84c0b663a4c44b0b2e3f8dc19c377410dd13eaf7625b86591 | Python | 10,134 | 311 | # 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 agreed to in writing, software
# distributed under t... |
680ce499e0d9697459f9d9007846f6712cb0367f56cc8cf4cfbc85b4dea23695 | Python | 10,135 | 266 | # 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... |
e7aaccb48ed064cc16503ba8a8c651da7a6d5bf8f8338689cf389367ee981211 | Python | 10,136 | 326 | #######################################################
# plotting from the command line - limited...
#######################################################
import argparse
import argparse
from dataclasses import dataclass, field
from pathlib import Path
from typing import List, Tuple, Union
from vcnmodel.util.get_d... |
c1f74d5420df0be5d68126352302c9d08ee8a02af0a3a348f1041f94bcbc3a51 | Python | 10,139 | 283 | # 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... |
be55ba126a4a8bda5c24c9e71f09395751093dcee26b2569ee2e739a20c3e230 | Python | 10,148 | 235 | from __future__ import annotations
from typing import Any
from typing import TYPE_CHECKING
from optuna import _deprecated
from optuna._experimental import experimental_class
from optuna._warnings import optuna_warn
from optuna.samplers._ga import BaseGASampler
from optuna.samplers._lazy_random_state import LazyRandom... |
e8e15ccaa8f1236e30a6d2dcf6813b9db543fdf7d52c3341977cfaa9285b2600 | Python | 10,151 | 350 | # 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... |
47c1a8d948c3a43a016fea71c33f0ad1d5cb40ef4e748d9bc4476526be8a9201 | Python | 10,152 | 297 | """Tests for STRAY (Search TRace AnomalY) outlier estimator."""
import warnings
import numpy as np
import numpy.typing as npt
from sklearn.neighbors import NearestNeighbors
from sktime.transformations.base import BaseTransformer
__author__ = ["KatieBuc"]
__all__ = ["STRAY"]
class STRAY(BaseTransformer):
"""ST... |
31886405f123b07be8875bf16f8426e2d66e342d73dff879530cc478218ac50d | Python | 10,158 | 267 | import os
import csv
import copy
import json
import logging
import torch
from torch.utils.data import TensorDataset
from utils import get_label
logger = logging.getLogger(__name__)
class InputExample(object):
"""
A single training/test example for simple sequence classification.
Args:
guid: Un... |
cd2a588f75ea576c60ffc8fdf24977fc195f7faeed5dda3d4f859dbff47edd15 | Python | 10,158 | 233 | # Coupled autoencoder training with v1 patch-seq data
# Data is provided as a .mat file on codeocean, and also in the repository
import argparse
import csv
import numpy as np
import scipy.io as sio
import tensorflow as tf
from pathlib import Path
from cplAE_TE.models import Model_TE
from cplAE_TE.utils.load_helpers im... |
d823e622cb885ec68f8c3bed190625cf7954e0bfa7d7815c0e4c1814a9042b5f | Python | 10,160 | 245 | import os
import tensorflow as tf
from tensorflow.keras.layers import Dense, Flatten, Dropout, BatchNormalization, Concatenate, \
Conv2D, Activation, Lambda, Layer, Input, GaussianNoise, AlphaDropout
from collections import OrderedDict
import numpy as np
import pandas as pd
from tensorflow.keras import backend ... |
23669817b7f53a60971fe05f2c80e98910173208f341a87c1b273ebe1dda1d27 | Python | 10,164 | 236 | import tensorflow as tf
from tensorflow.contrib.rnn import LSTMCell, GRUCell, MultiRNNCell, DropoutWrapper
from tensorflow.contrib import distributions as distr
from ..encoder import TransformerEncoder
# from config_graph import get_config, print_config
# from dataset_graph import DataGenerator
def multihead_attenti... |
abf805cb3b3d28e39560035b5be7defcfd5c4f3fe811ff6949301d88aba3a947 | Python | 10,165 | 242 | from mprl.rl.envs.opnspl.poker_multiagent_env import POKER_ENV, KUHN_POKER, LEDUC_POKER, PARTIALLY_OBSERVABLE, PokerMultiAgentEnv
from mprl.rl.common.sac_stratego_model import SAC_STRATEGO_MODEL
from progress.bar import Bar
import numpy as np
import dill
from multiprocessing.pool import Pool
from multiprocessing impor... |
adc7b82e11de9a7b3eab7532309dab12abbdb0807a42e642f9c43ff8ce039873 | Python | 10,166 | 285 | import autokeras as ak
import tensorflow as tf
from autokeras.blocks import reduction
from autokeras.utils import utils
from keras_tuner.engine import hyperparameters
from tensorflow.keras import layers
from tensorflow.python.util import nest
class DownsamplingMultBlock(ak.Block):
class DownsamplingMultLayerBase(... |
eeaff1ad535d0443e547dd1b0990045d1eb0eabb57b847276fd598ae730fd225 | Python | 10,176 | 319 | # 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... |
e3f4676498ffb35b168a59a6f15696564a2a776d246ca0d0cbe1721a3709bdfc | Python | 10,181 | 221 | import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
def plot_improvement(attribution, attribution_corrected, x_min, x_max, y_min, y_max, x_label, file_save, labelsize=15, fontsize=15, alpha=0.9, s=30):
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.add_p... |
04a0e504b44344fbb356fdd2abc395ab9af80f50da63c72a3c43bdd888144b3b | Python | 10,184 | 256 | """Fully Convolutional Network (FCN) for classification in PyTorch."""
__authors__ = ["kajal-jotwani"]
__all__ = ["FCNClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.fcn import FCNNetworkTor... |
ae6990e8e1a388c1bf87216b25d0d4172fdd806fd394a729164c60a6fb4c829b | Python | 10,186 | 195 | import numpy as np
from functools import partial
import random
loinc_lookup_table = {
"pH": "2744-1", "PCO2": "2019-8", "PaO2": "2703-7", "IonCalcium": "17863-2",
"Sodium": "2951-2", "Potassium": "2823-3", "BUN": "3094-0",
"Creatinine": "2160-0", "Glucose": "2345-7", "CO2": "1963-8", "TotalCal... |
a20f447101bdb6d6985c5b2de9e5f1bd82ddc9e7131e9875e5cf0f5f61106cc8 | Python | 10,191 | 255 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Tests for the frame-major grid/density branches in DeepmdData.
These keys are loaded verbatim (no reshaping to natoms) and must carry a
leading frame dimension matching the set's frame count, so that shuffling
never pairs a structure with another frame's grid or density ... |
d20212211045b6d9b2da709236bfc26388ceaf33387cb81da6e9edf1267e76ff | Python | 10,192 | 253 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Actual CUDA /kk convention and MPI regression, separate from host FD tests.
Run source/install/test_lammps_kokkos.sh after test_cc_local.sh on a CUDA host.
That job supplies a compressed canonical fixture and a matching Kokkos LAMMPS
library/plugin, and sets DPA4SPIN_KOK... |
1ce70d16e6a1c62b85d942c4c479ff057da0208b091cbc6e571cca3a7cb34b1b | Python | 10,206 | 317 | from __future__ import annotations
from dataclasses import dataclass, fields, field
import textwrap
from typing import Any, Callable, Union
from collections.abc import Generator
import numpy as np
import pandas as pd
import matplotlib as mpl
from numpy import ndarray
from pandas import DataFrame
from matplotlib.artis... |
40bf8f1dc1a9b565d0aa27b2319b5ee576f2a9cc594f55cf7174a54909129f47 | Python | 10,210 | 321 | import json
import pickle
import re
import pandas as pd
from pathlib import Path as p
import pprint
from subprocess import call
from sys import exit
import csv
from typing import Union, Dict, List
import networkx as nx
def sort_list_of_tuples_by_string(list_of_tuples:List[tuple], string_index:int) -> List[tuple]:
... |
5f983be62effa6cd44816e32a06f22b6b053136e1bc7f73a5d752662862a5875 | Python | 10,213 | 267 | # 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... |
889247227301a111d3ea9791796b604fa1991132e22ebc216c0025f6871feef0 | Python | 10,214 | 338 | # 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... |
6fab1d325adeb8c91e1a3f12f8843e3e82142158d6ec93460828bce124345a1b | Python | 10,217 | 233 | """
Copyright (c) 2021 txWang
the original source code of def prepare_trval_data, gen_trval_adj_mat is released under the MIT License
https://github.com/txWang/MOGONET/blob/main/LICENSE
"""
import os
import re
import datetime
import numpy as np
import pandas as pd
import seaborn as sns
import models
import matplotlib.... |
e5f0bd7ff7693f0f94438d6eb40ab906de27a4dfa925a73fdb6d0b0c20bbb261 | Python | 10,218 | 271 | # 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... |
44538187e5a94279b1868f4fa4f1758005d86f6d6f24391b3514a63a38122612 | Python | 10,242 | 320 | import time
import cv2
import numpy as np
from numpy.lib import recfunctions as rfn
from accumulator import collect_run_time
from fig import Config as C
from .decorators import rolling_frame
@collect_run_time
def apply_queue_of_mvs(mvs_buffer, bboxes, method):
for _ in range(mvs_buffer.qsize()):
mvs = mv... |
056be0a4103c98937fc2ca44cacb21bf757a7bb302a7bf6f4704d8b98e170cb6 | Python | 10,246 | 386 | # 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... |
4c11cdab8aab28e3ad21139f2fc60b56e255323192b151865b18a5f05faf9b0d | Python | 10,248 | 287 | # 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... |
03472fc6fa2b87cb0f579ed7b25580043ccc77a287a9f08823a2a46f71da746a | Python | 10,254 | 218 | import argparse
import os
import torch
import utils.evaluator as eu
from quicknat import QuickNat
from settings import Settings
from solver import Solver
from utils.data_utils import get_imdb_dataset
from utils.log_utils import LogWriter
import logging
import shutil
torch.set_default_tensor_type('torch.FloatTensor')
... |
e88a3b8c6e158174f1c88dc6f9d34653079f1385b6f13a87986d008cdaebd8e8 | Python | 10,257 | 240 | import os
import math
import argparse
import random
import logging
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from data.data_sampler import DistIterSampler
import options.options as option
from utils import util
from data import create_dataloader, create_dataset
from models impor... |
2884baf1e363c7ecb0237751e77c719d96b99382697a145a5defbb1d757278a1 | Python | 10,258 | 281 | # 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... |
9e66f078e0a92f87f31323df4af9943cbb2ec9fe42e844566d091f3cc0599b88 | Python | 10,258 | 298 | # 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... |
5bd24e7c8041e3725f8f53b39ac9f72441714e90ee1ba41858110ea3ba0e074a | Python | 10,262 | 219 | from __future__ import print_function
from freqAnalysisTools import band
from os import listdir
from os.path import isfile, isdir, 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... |
51fb2ba8bf9fcf2e335dde5f6c652cb331318e213c2d94e08ed8dea845d5998b | Python | 10,278 | 293 | from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
import seaborn as sns
import sys
import os
import yaml
from copy import deepcopy
from hbip.predict import predict
from hbip.utils.data_prep import aggr... |
6d49a3c98201ab7363d944921556edf0087a9fb5f1bae932dbfd1bb56890c9d1 | Python | 10,278 | 230 | # -*- coding: utf-8 -*-
"""
This script provides a method to cluster non-zero voxels in a 3D image (Nifti format) into groups of specified sizes. The clusters can be made contiguous, ensuring that the voxels in each cluster are spatially connected, or non-contiguous, where clusters consist of the nearest neighbors in t... |
f2026e52b2f5de823248e3e08b2e63e3a6b951d69efdc275fd07eb50703bd822 | Python | 10,309 | 275 | # 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... |
07454adcfbd9a1686e0cd0a21c09531ec3e209a88b8761fc99d9351c1540faf1 | Python | 10,327 | 317 | #!/usr/bin/python
"""
Basic test of initialization of multiple cells in the model, and running multiple cells at one time.
Plots the resposnes to a series of current injections for most implemented baseic cell types in
in cnmodel.
Usage:
python examples/toy_model.py (no arguments)
"""
import sys
import numpy a... |
7e252adc9992d3480a6158f357ece32caa71344bbc02624a4894a480f916ccca | Python | 10,334 | 298 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Parity tests for the DPA4 ``SO2Convolution`` cross-mode grid products.
These tests cover the ``node_wise_s2``/``node_wise_so3`` (edge-local) and
``message_node_s2``/``message_node_so3`` (post-aggregation) grid-product
branches wired into the dpmodel ``SO2Convolution``. E... |
39d30c1c4a277c648694d4ed2c62c1f762c4c4fc2895ff3bc53aef3eb1aa3e48 | Python | 10,339 | 245 | # -*- coding: utf-8 -*-
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
#
# Description:
# Training code of DIAM-CNN
#
# Copyright @ Yanqiu Feng
# Laboratory for Medical Imaging and Diagnostic Technology
# Southern Medical University
# email: foree@163.c... |
263a148db8d392568ddbafeebb2fcfeb79d3e3bbfec6f49ee0aa63faa5fe8246 | Python | 10,360 | 301 | """
@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... |
1fe364b90c07867f10ee17dd75b9d32ea50cf0d2edb3c97474c274c5a2c31414 | Python | 10,372 | 366 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 15 20:49:01 2021
@author: TF
"""
'''import os
import cv2
#import keras
from keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array
import tensorflow
import tensorflow.keras as keras
from tensorflow.keras.models import load_model
... |
47fdb52ab7a5034e4c383449c2cf27dca6489e14dd497bb8ff1c33aa6821810a | Python | 10,378 | 246 | # 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... |
81b5a2098f4d12198f0ff0f1af9df0b39a7e6b9ea2f7957d29a4f01a28d5bfc0 | Python | 10,378 | 267 | # 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... |
117c6c46179d5ba22ab5fde02da7d2a27d0682b01dd2f8c3d9a577d66910d0b3 | Python | 10,381 | 251 | import math
import numpy as np
import pickle
# sigmoid activation function / fast implementation for arrays https://stackoverflow.com/a/43024779
from scipy.special import expit
import time
import sys
from smt.sampling_methods import LHS
def turn(o_steer, st_incr):
coef_steer = o_steer - 0.5
dsteering = coef_s... |
83881564dac97f1824022faeea2e1dbd2f8429e9a642e6616ad78944171a5d00 | Python | 10,385 | 293 | """TSFresh Classifier.
Pipeline classifier using the TSFresh transformer and an estimator.
"""
__author__ = ["MatthewMiddlehurst"]
__all__ = ["TSFreshClassifier"]
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sktime.base._base import _clone_estimator
from sktime.classification.base imp... |
b36c55b03bee90fb32ab2a51fbee7b422d90deda2635026507bf54cc8830782d | Python | 10,385 | 385 | """
Sphinx plugin to run example scripts and create a gallery page.
Lightly modified from the mpld3 project.
"""
from __future__ import division
import os
import os.path as op
import re
import glob
import token
import tokenize
import shutil
from seaborn.external import six
import matplotlib
matplotlib.use('Agg')
im... |
7147a7631f8408b01672ea1fcc5725ea52e3df31da1b5c680a00c1a47920f380 | Python | 10,386 | 285 | """
Components for parsing variable assignments and internally representing plot data.
"""
from __future__ import annotations
from collections.abc import Mapping, Sized
from typing import cast
import pandas as pd
from pandas import DataFrame
from seaborn._core.typing import DataSource, VariableSpec, ColumnName
cla... |
3b505eff7d8ad0c73fc2404f37d95125616d8201c0fe3876b28ee8cf4963231f | Python | 10,392 | 226 | """Extension template for pairwise distance or kernel between time series.
How to use this:
- this is meant as a "fill in" template for easy extension
- do NOT import this file directly - it will break
- work through all the "todo" comments below
- fill in code for mandatory methods, and optionally for optional method... |
7ff88bcbbd00bf95656325cc82481e9996d442705266cbab628d0756e99ec2df | Python | 10,394 | 226 | """Extension template for pairwise distance or kernel on tabular data.
How to use this:
- this is meant as a "fill in" template for easy extension
- do NOT import this file directly - it will break
- work through all the "todo" comments below
- fill in code for mandatory methods, and optionally for optional methods
- ... |
fe7f344dc8d47183b1872e69c2db5834a047f50714e41d2f82aed639b1622173 | Python | 10,400 | 262 | from test.common import _TestNeuronsBase, pyel, tel
'''
class TestNeurons(_TestNeuronsBase):
# TODO make sure this runs after cli test? it should ...
# but then we need to keep the output of ndl around
def test_load_existing(self):
from neurondm.lang import Neuron, Config
config = Config('n... |
0b3ca3f2c7bc6a817a7a2cc363084125f713ec7ee2cd3c4db8a15b5492a30d75 | Python | 10,407 | 190 | import os
import glob
import re
import pandas as pd
import tensorflow as tf
from structure import ElementwiseDNN
from model import ModelByTensorflow
# coreset_path = '/home/koji-shiota/project/AQDNet/1.Input/5.Dataset/CASF2016/CoreSet/Ver1/tfrecords/feature_coreset.tfrecords'
# docking_path = '/home/koji-shiota/projec... |
0a16be1c03cbb7e7f2b0db652192e105ad309149b5c45c34e24d3b13eafa9efa | Python | 10,408 | 297 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import ConvModule, constant_init, normal_init
from mmcv.runner import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from mmcls.models.utils import channel_shuffle
from ..b... |
1b113f8aefc45cd5a07bb68704e5bcf9042eb060de6b25d786a125018df6f151 | Python | 10,412 | 310 | """
This module handles various aspects of cell initialization.
This includes:
* Initializing the model (get_initial_condition_state).
* Saving the initialized model.
* Restoring the initialized model from disk.
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Ma... |
595f6d459b01cec700bae6a9a9250e12332282a334ffcec71dc699d099141109 | Python | 10,414 | 328 | """
Scoring, read-penalty estimation and Bowtie2 ``--score-min`` advice.
Bowtie2 rejects an alignment whose score falls below
``intercept + slope * readLength``. This module converts the divergence
observed between two aligned transcripts into the alignment penalty a read of
a given length would be expected to accrue,... |
ee564bab697e88fd359ae272f6022615826d564e55d9d06feec597def89e3208 | Python | 10,417 | 202 | import os
import unittest
from io import BytesIO
from unittest.mock import Mock
from elftools.common.exceptions import ELFRelocationError
from elftools.construct import Container
from elftools.dwarf.dwarf_expr import DWARFExprParser
from elftools.elf.dynamic import DynamicSection, DynamicSegment
from elftools.elf.elff... |
329a2aba73b0bd6a6dcc77b43149b0f8cc585173c14cd284511fb52101e62e44 | Python | 10,422 | 298 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""``nlist_backend`` dispatch + O(N) strategy equivalence for the pt backend.
The pt model is reconstructed eagerly in ``DeepEval`` and evaluated via
``forward_common_lower`` when an O(N) neighbor-list strategy is selected. Each
strategy (``vesin``, ``nv``) must give resul... |
46aaa25cf61f57538d21a85cca8f536a4e1decc4f5d36c4d05371b961daf45e7 | Python | 10,425 | 322 | import zipfile
import re
import numpy as np
from io import BytesIO
import cv2
from typing import Tuple, List
def get_masked_region(array: np.ndarray,
mask: np.ndarray,
maskval: float = None):
'''
Extract a spatially masked array where the mask == 1 or
mask == m... |
3094eacc3e2038b119cb7a020ae771ee4ad89580a5ff0098c4461446231371bd | Python | 10,432 | 179 | import unittest
import os
from template_generation_tools import generate_base_class_template, \
generate_ind_template, generate_homologous_to_template
from template_generation_utils import read_tsv, migrate_manual_curations
from pcl_id_factory import get_class_id, get_taxonomy_id, get_individual_id
current_dir = ... |
e53abc9d18ee2983d7bf06a21f5dadae1b39197c17c8ab04770fc41499b29c46 | Python | 10,438 | 307 | import sys
sys.path.append('..')
from seas.hdf5manager import hdf5manager
import argparse
def main():
'''
If called directly from command line, take argument passed, and try to read
contents if it's an .hdf5 file.
'''
print('\nHDF5 Manager\n-----------------------')
ap = argparse.Argument... |
8303c5b538e2fe354ce1bcd7d4bd1e9a1d25cc087fe46f9b72822f395ad18986 | Python | 10,443 | 304 | # 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... |
b77bd485ac472eeebc73ed8c45033d26b2c0a653cd9b74e4a210b18c7cf54e3f | Python | 10,449 | 301 | import scipy.signal as ss
from glob import glob
import numpy as np
import os
import sys
from scipy.ndimage import gaussian_filter
import icsd
import quantities as pq
from tqdm import tqdm
import matplotlib.pyplot as plt
def get_mua(ecp, filter_order = 5, fs = 20000, fc = 500, q = 20):
'''
This function giv... |
7607427b55445846f55687e0d473a37e3cc2b2ab129fafd4fa126862baa983b4 | Python | 10,451 | 226 | # -*- coding: utf-8 -*-
import PIL.Image
import dlib
import numpy as np
from PIL import ImageFile
try:
import face_recognition_models
except Exception:
print("Please install `face_recognition_models` with this command before using `face_recognition`:\n")
print("pip install git+https://github.com/ageitgey/... |
43ea7c338ad524e671f074bfb7bf478111c6881bfcd481828dd4f11008f88ad5 | Python | 10,457 | 232 | """
Generate matched synthetic lesions dataset
Authors: Chris Foulon & Michel Thiebaut de Scotten
DEPRECATION WARNING:
This script is deprecated and maintained only for reproducibility purposes as referenced in the scientific article.
Please use the updated tool 'parcitron' for generating synthetic lesions.
"""
impor... |
30d90ccefa5246726c47fb9a3f605b22cc9e73347184e30b8448a00c4b137757 | Python | 10,458 | 271 | # 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 scatter_nd_impl(
data: np.ndarray, indices: np.ndarray, updates: np.... |
97bace8e107f8950e224aa08e7ce8e3a56fb940b2938fc691228a48a3b94f88e | Python | 10,467 | 277 | import logging
import networkx as nx
import numpy as np
import re
import torch
from rdkit import Chem
from rxnebm.data.chem_utils import ATOM_FDIM, BOND_FDIM, get_atom_features_sparse, get_bond_features
from rxnebm.data.rxn_graphs import RxnGraph
from typing import Dict, List, Tuple
def get_graph_from_smiles(smi: str... |
57894c3b7b8895a44cd03d385f555c80e1b223f92162de469bca095f2fd617c3 | Python | 10,468 | 214 | import yaml
from pathlib import Path
from pyontutils.config import auth
from pyontutils.utils_fast import log
def interlex_namespace(user):
return 'http://uri.interlex.org/' + user
def getCuries(curies_location):
# FIXME this will 'fail' silently ...
# probably need to warn?
try:
if curies_l... |
18d2667b57e6c3cc57ec313225c0040e80dc1343ed5dad198dcbe0ca6526658f | Python | 10,475 | 299 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import time
import sns_toolbox.backends
from sklearn.decomposition import PCA
import scipy
from sns_toolbox.networks import Network
from sns_toolbox.neurons import SpikingNeuron
from sns_toolbox.connections import SpikingMatrixConnection
from sns_too... |
241a015a77f3a5b0b6f607c75b47a271dc2bd9aa3b5bf7973a888ba2498194e5 | Python | 10,482 | 293 | import os
import tempfile
import pytest
import torch
from mmcv.runner import load_checkpoint, save_checkpoint
from torch import nn
from torch.nn.modules import GroupNorm
from torch.nn.modules.batchnorm import _BatchNorm
from mmcls.models.backbones import RepVGG
from mmcls.models.backbones.repvgg import RepVGGBlock
fr... |
354dfaf3870df09cfea209e23f772e3d74308c63cd037b7b72f2daa6ac033eed | Python | 10,490 | 235 |
from ray.rllib.policy import Policy
from mprl.rl.common.stratego_model import StrategoModel
from mprl.rl.envs.opnspl.poker_multiagent_env import PARTIAL_OBSERVATION, VALID_ACTIONS_MASK, VALID_ACTIONS_SHAPES, KUHN_POKER, LEDUC_POKER
from open_spiel.python.policy import Policy as OSPolicy, PolicyFromCallable, TabularPol... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.