sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c490ef0b06f4864208f932ac64f7a18ff48e884e98147c4088dd2c893254cc5e | Python | 6,623 | 200 | from __future__ import annotations
from dataclasses import dataclass
import numpy as np
import matplotlib as mpl
from seaborn._marks.base import (
Mark,
Mappable,
MappableBool,
MappableFloat,
MappableString,
MappableColor,
MappableStyle,
resolve_properties,
resolve_color,
docum... |
9550afb2602f8c3f6e9c9558e0ba35b4cb01b59fd1ef1b18bb47ad02e5447414 | Python | 6,624 | 246 | def nst_to_adj(l):
start = l[0]
if (isinstance(start, list) or isinstance(start, tuple)):
raise ValueError('malformed')
first = [] if start == "blank" else [(start, e[0]) for e in l[1:] if e]
second = [p for r in l[1:] if r for p in nst_to_adj(r)]
return tuple(first + second)
def assoc(k, ... |
17bb402b69774293c44545c174e12fb72421f853ae83b55c0b9403e14ad71408 | Python | 6,625 | 172 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Freezing a SeZM model with the isolated-atom reference.
The ``.pt2`` freeze folds the vacuum reference into the fitting bias, so the
frozen model carries no reference atoms yet reproduces the referenced eager
model: an isolated atom gives exactly its bias and a cluster g... |
54f0736eee29aba0d0a8b43365dac01fe28bda1e333798a91a6ea32a8a96896a | Python | 6,628 | 258 | from __future__ import annotations
from functools import partial
from multiprocessing import Pool, cpu_count
from typing import Tuple
import numba
import pandas as pd
from libpysal.weights import W as libpysal_W
from pysal.explore import esda
def local_moran(
gene_expression_df: pd.DataFrame,
weights: libpy... |
6e6414acf985991c04b3b69415439bbf4dce2d3edd92705801e2f6b9e286d9d9 | Python | 6,630 | 206 | """
Common filtering functions.
These all are applied to individual atom dataframes, and remove entries from that dataframe as necessary.
"""
import Bio.PDB.Polypeptide as Poly
import pandas as pd
import scipy.spatial as ss
import numpy as np
def standard_residue_filter(df):
"""
Filter out non-standard resid... |
f2808de5dbaaa8a3c0bc9cbc22ce13aad5ce136e0dc8dc7174fabf18a6eb3d4b | Python | 6,632 | 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... |
04481cdc611e16fc717a94c02d5bd9c2e32212a3ba0714fa960d8100f5253531 | Python | 6,635 | 220 | #!/usr/bin/env python
import click
from click_option_group import optgroup
import json
import numpy as np
import os
import pandas as pd
from sklearn.metrics import average_precision_score, roc_auc_score
import sys
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
... |
a30f669ddcf3228ebcac7dfdb34e72e9216948461b1783b45c72fa217cd4d3f6 | Python | 6,638 | 143 | import torch
from torch import nn
import transformers
from transformers import activations
from transformers import DistilBertTokenizer, \
DistilBertForSequenceClassification, DistilBertModel, DistilBertPreTrainedModel, Trainer, TrainingArguments,EvalPrediction, AutoTokenizer
from torch.nn import BCEWithLogitsLoss, Cro... |
7b8e9fb89ec856d758c7cc3dceb2016dd9ba9ef8197575e486319985e7b9c649 | Python | 6,640 | 136 | """
@file: generate_random_nn.py
Created on 27.05.21
@project: crazyara
@author: queensgambit
Command-line tool to generate a random initialized neural network and export ONNX weights.
"""
import os
import argparse
import mxnet as mx
import logging
import numpy as np
import sys
sys.path.insert(0, '../../../../')
from ... |
9cc81110c75dc5f7fe9d6e37c272c67da6130da6a9892bb6cf6bf21df6949b43 | Python | 6,640 | 157 | # 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... |
a79958158a53c60c8f2cdba5bee4839f4420578258768e6f1c29bd6de2dec844 | Python | 6,640 | 169 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 2 11:45:25 2020
@author: sam
"""
import os
import cv2
import numpy as np
import detectron2
from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor
from detectron2.utils.visualizer import Visualizer, ColorMode
from det... |
4574d7765feedeba4b8b9fc3baa2dcbf58ad2e4e525813e266b0bfe03bc43fa4 | Python | 6,643 | 172 | import collections as col
import logging
import os
import sys
import click
import pandas as pd
from torch.utils.data import Dataset
import atom3d.datasets.datasets as da
import atom3d.splits.splits as spl
import atom3d.util.file as fi
import atom3d.util.formats as fo
logger = logging.getLogger(__name__)
class LEPDa... |
0b3d2ed8837e43722bf67e1b9f62b988a63c3a21077e036e54b2155b27e1d2f2 | Python | 6,646 | 261 | from dataclasses import dataclass, field
from typing import List
@dataclass
class DataArguments:
"""
Arguments related to data loading and preprocessing.
"""
data_path: str = field(
default="../data/raw/canonical_data/pediatric_studies",
metadata={"help": ("Path to the directory conta... |
63b00dc78bfcfa45845360e9048058fd4458747748c72f2f7c814dc9e90eea88 | Python | 6,647 | 184 | """
3. PAC Cycle Feature Distributions
==================================
Compute bycycle features for simulated phase-amplitude coupled (PAC) data.
"""
####################################################################################################
# Import packages
# ---------------
#
# First let's import the p... |
9e7d516ef634e92f4e910df63f26c396b1393851447251588ebab8e541815913 | Python | 6,652 | 125 | """Perform GNN model training."""
import argparse
from os.path import isdir
import time
import sys
sys.path.insert(0, "../src")
import torch
import toml
import matplotlib.pyplot as plt
from gnn_eads.functions import create_loaders, scale_target, train_loop, test_loop
from gnn_eads.nets import FlexibleNet
from gnn_e... |
8122546beebc9691918e1f32914861e26a27f8a32160128409305b118ff519d2 | Python | 6,653 | 214 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""JSON Schema validation of input files before preset expansion."""
import copy
import json
from typing import (
Any,
)
import pytest
from jsonschema import (
Draft202012Validator,
)
from deepmd.utils.argcheck import (
gen_json_schema,
normalize,
)
from d... |
d3e4e49d3351d10b17e4aa3455490a9e61f84fb6c02362906e4c33c417d2dfa7 | Python | 6,653 | 184 | import argparse
from keras.optimizers import *
def get_parser():
print('Receiving parser values')
parser = argparse.ArgumentParser(description='Process some integers.')
# Data
parser.add_argument('--pre_train_data', type=str, default='DeepHF_old') # [DeepHF_55k, DeepHF_full, DeepHF_old]
... |
8f25bce699422002ec26c298be2290e3130fc2ea52f12c957cd387f36a6811b3 | Python | 6,659 | 188 | """
Utilities for generating and caching spike trains from AN model.
"""
import logging
import os, sys, pickle
import numpy as np
from .wrapper import get_matlab, model_ihc, model_synapse, seed_rng
from ..util.filelock import FileLock
import cochlea
try:
import cochlea
HAVE_COCHLEA = True
except ImportError:
... |
9d8d945a4e075ebeafe5e1632e02f6ea3e1ca917c0fb77b0c5b5338403f11e49 | Python | 6,663 | 199 | # 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... |
1c9e88d5a27f7621779b54ac84aea3522421e42afc33766213bd304138b0004d | Python | 6,664 | 131 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
from io import BytesIO
from elftools.common.excepti... |
b8769237ad23772e811420a102bb68361a7258b8a2744842b4d042871a311dfb | Python | 6,666 | 313 | import operator
import math
__version__ = "2.1.0"
m = [
[3.2406, -1.5372, -0.4986],
[-0.9689, 1.8758, 0.0415],
[0.0557, -0.2040, 1.0570]
]
m_inv = [
[0.4124, 0.3576, 0.1805],
[0.2126, 0.7152, 0.0722],
[0.0193, 0.1192, 0.9505]
]
# Hard-coded D65 illuminant
refX = 0.95047
refY = 1.00000
refZ ... |
e3df4275bdfa63f58dbf763acbeaabe47df00d0c1a649af8a6bf6c945432d5ce | Python | 6,666 | 313 | import operator
import math
__version__ = "2.1.0"
m = [
[3.2406, -1.5372, -0.4986],
[-0.9689, 1.8758, 0.0415],
[0.0557, -0.2040, 1.0570]
]
m_inv = [
[0.4124, 0.3576, 0.1805],
[0.2126, 0.7152, 0.0722],
[0.0193, 0.1192, 0.9505]
]
# Hard-coded D65 illuminant
refX = 0.95047
refY = 1.00000
refZ ... |
2bd1772e309d3dcb85c67d9f358f56dc2d214d8bdf6f2d9b8638baf851a9c67c | Python | 6,669 | 162 | import collections as col
import logging
import os
import sys
import click
import pandas as pd
from torch.utils.data import Dataset, IterableDataset
import atom3d.datasets.datasets as da
import atom3d.splits.splits as spl
import atom3d.util.ensemble as en
import atom3d.util.file as fi
import atom3d.util.formats as f... |
f87a058e3ca6d6964392180f5654a9383db5d42038698c52c0099fad2a0f6fba | Python | 6,673 | 155 | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import build_conv_layer, build_norm_layer
from ..builder import BACKBONES
from .resnet import ResLayer
from .seresnet import SEBottleneck as _SEBottleneck
from .seresnet import SEResNet
class SEBottleneck(_SEBottleneck):
"""SEBottleneck block for SERe... |
20bec3da364b356691473178555e6ffa7e917343515e4d5be2fea386376cf6be | Python | 6,675 | 184 | import os
import pickle
import traceback
from os.path import exists as pexists, join as pjoin
import numpy as np
from matplotlib import pyplot as plt
from graynet import parcellate
from graynet.utils import roi_info
#---------------------------------
# CHANGE THESE FOR YOUR PROCESSING
#------------------------------... |
b981e8af1e46aa575046fe58b0645c29973def8c2463c6e1387fba59bd063770 | Python | 6,675 | 203 | from __future__ import print_function
import re
import os
import sys
import tempfile
import subprocess
import multiprocessing
import multiprocessing.pool
import dxpy
def normalize_timedelta(timedelta):
"""
Given a string like "1w" or "5d", convert it to an integer in seconds.
Integers without a suffix are... |
cc7887b05f59d7663e51d3dbcda0ca5a9d80f127fc5cce29da1bf013f1cadd1d | Python | 6,676 | 204 | # 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... |
fde0bb22bd91ec25c84ba319dbfdbbbfede32194efe1d3f4bfa41698a8f0f7f3 | Python | 6,676 | 149 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
import population_server_pb2 as population__server__pb2
class PopulationServerStub(object):
# missing associated documentation comment in .proto file
pass
... |
329fda7fa4bb429032f824a57a9c2f93198d2588015701de848437a6566f59fb | Python | 6,681 | 202 | import os
import os.path as osp
import time
import dill
import numpy as np
import pandas as pd
import torch
from sklearn.model_selection import train_test_split
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch_geometric.data import DataLoader
from molucn.dataset.pair import get_num_features
from molu... |
7bf4573cee0f8eea43b0fcecbe7de19dbcd85e4cfeae500b7ad5cceff6384769 | Python | 6,683 | 158 | # 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... |
151e6c5ee110dc29a445f49d6d276cd4020ff6aa45e6ddc96ac2fa180a30d7a0 | Python | 6,684 | 183 | """Time series kernel kmeans."""
import numpy as np
from numpy.random import RandomState
from sktime.base.adapters._tslearn import _TslearnAdapter
from sktime.clustering.base import BaseClusterer
class TimeSeriesKernelKMeans(_TslearnAdapter, BaseClusterer):
"""Kernel k-means clustering, from tslearn.
Direc... |
2f0aea0b17a2f54424a94002273851446c72c0a224554ce3a786e7150624e81c | Python | 6,687 | 157 | import os, sys
import pickle
import torch
import numpy as np
import pandas as pd
import scipy as sp
import scipy.stats as stats
class Results3DCNN():
def __init__(self, name, reps=[1,2,3]):
self.name = name
self.reps = reps
def get_prediction(self, prediction_fn):
"""
Reads t... |
3f1f8840607bf803cba204554f19005a476142447a8ffedb7977f71ffb814114 | Python | 6,687 | 171 | """Dummy time series classifier."""
__author__ = ["ZiyaoWei"]
__all__ = ["DummyClassifier"]
import numpy as np
from sklearn.dummy import DummyClassifier as SklearnDummyClassifier
from sktime.classification.base import BaseClassifier
class DummyClassifier(BaseClassifier):
"""DummyClassifier makes predictions th... |
fe90634c96cdb4b9b58abf1bcf8b6cc944fe5b8e7c2221513c677c0045af4526 | Python | 6,687 | 152 | # 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... |
d21b9d50f07239abe4a523b6435d2a0f8574f7bc6bd59105519855d8a0ac4d1a | Python | 6,688 | 188 | import logging
import networkx as nx
import os
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import graphviz_layout
from networkx.algorithms.traversal.depth_first_search import dfs_tree
from dendrogram_tools import dend_json_2_nodes_n_edges
from template_generation_utils import read_dendrogram_tree, i... |
599431444d689906954e804314ae6831ec5f9399ddafdf9375da21aa205bb168 | Python | 6,689 | 249 | import time
import torch
import numpy as np
from scipy.special import lpmv as lpmv_scipy
def semifactorial(x):
"""Compute the semifactorial function x!!.
x!! = x * (x-2) * (x-4) *...
Args:
x: positive int
Returns:
float for x!!
"""
y = 1.
for n in range(x, 1, -2):
... |
2d59ba06e06a1a108d741ca5ab07d163b058da2392b751d966ef0e101ff943eb | Python | 6,700 | 208 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Command-line entry point of ``dp test``.
System discovery and the run-level report live here; evaluating a system is
the business of :mod:`deepmd.infer.model_test`.
"""
import logging
from pathlib import (
Path,
)
from typing import (
Any,
)
from deepmd.common ... |
babead966f1131b7e64671726b11d9bd82a09b4ea8176cdd48325d83b716fa05 | Python | 6,701 | 211 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: johannvk
"""Continuous piecewise linear trend change score."""
__author__ = ["johannvk"]
import numpy as np
from sktime.detection.base._base_interval_scorer import BaseIntervalScorer
def... |
e686e82e2277aad6765290cfa4bb644480d012eb1af6739398343e8f32db435e | Python | 6,701 | 153 | """
Helper functions used for analysis of eeg epochs.
The intention is that these should be used both in offline analysis and Timeflux when running things in real-time.
"""
import numpy as np
import pandas as pd
import pyriemann
from pyriemann.utils.distance import distance_riemann, distance
from pyriemann.estimation ... |
0e898385d9f90dc57daedac94a68be18b5b10672362a595b7d2b0c56b32c2815 | Python | 6,703 | 195 | # SPDX-License-Identifier: LGPL-3.0-or-later
from abc import (
ABC,
abstractmethod,
)
from collections.abc import (
Callable,
)
from typing import (
Any,
)
import numpy as np
from deepmd.utils.path import (
DPPath,
)
from deepmd.utils.plugin import (
PluginVariant,
make_plugin_registry,
)
... |
fd35b0636a6a2227fd7714f7c0b558f42f807b0a7df96198ec9a3680bf275300 | Python | 6,703 | 211 | #!/usr/bin/env python3
# CBDA validation and training set creation.
# This script defines the set of ordinal line numbers to use for the validation
# set of a CBDA project.
#
# Inputs:
# File name of original data file.
# The following assumptions are made about the contents of the file:
# It ... |
43673666aff565849e06ea76d7317b074f1b2e28339163f6fd3520e415091b4d | Python | 6,704 | 202 | import re
from collections import defaultdict
import rdflib
from pyontutils.sheets import Sheet
from pyontutils.namespaces import ilxtr, TEMP, rdfs, skos, owl, interlex_namespace
from neurondm.core import Config, NeuronEBM, Phenotype, NegPhenotype, log, OntId
from neurondm import orders
orders.to_rdf = orders.bind_rdf... |
922af389e8c0b991c510b36cc3cb1e4e7f80871799db5e4dd7ab0a1b831352b3 | Python | 6,704 | 170 | import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# Plotting
import sciplotlib.polish as splpolish
import sciplotlib.style as splstyle
import src.models.predict_model as pmodel
import src.models.jax_decisio... |
deb6786a423052c1d2471c6e3321f71dd3c6257034f98639d0fc38c02a1f2d41 | Python | 6,704 | 172 | import argparse
import logging
import os
import time
import datetime
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
from torch_geometric.data import DataLoader
from model import GNN_LBA
from data import GNNTransformLBA
from atom3d.datasets import LMDBDataset, PTGDataset... |
5421b160d5309a93b1f22bd5347fa43c154e890b6bcb10707969fe0665403214 | Python | 6,705 | 86 | """
Data structures for model_run
XM13 with cooperative nacn channels
Active dendries: dendritic conductances are the SAME as the soma
"""
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the Xie and Manis 2013 m... |
2cce0efc0bd61e39f41fbb6998c03a7720d4aaf536f6c7388a2158e479a58780 | Python | 6,706 | 184 | """
The Baysian Estimation Effect Size is introduced in Kruschke, J. (2012)
doi:10.1037/a0029146
"""
from __future__ import division
import numpy as np
import sciunit
import matplotlib.pyplot as plt
from matplotlib.transforms import blended_transform_factory
import matplotlib.ticker as mticker
import matplotlib.lines ... |
86e49d5f11abc55e0867ab5d585225b2e78e373aab2d668fb4c17303fc75286c | Python | 6,707 | 186 | # 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... |
80b02e0544e8196d01e48fe6aab97d3ba48f73737c59e11e7e316764c08d304d | Python | 6,708 | 216 | from __future__ import annotations
import gzip
from pathlib import Path
import anndata
import h5py
import numpy as np
import pandas as pd
import scipy.io
from .STDataset import STDataset
def load_10X(
read_path,
file_name="filtered_feature_bc_matrix",
make_sparse=True,
) -> STDataset:
"""
Load 1... |
192f12f46f077ccfc33866eb9785bca52e610e490cb859ef2b2d83bf2f77b7e9 | Python | 6,710 | 193 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 14 12:22:39 2018
@author: wanglab
"""
import os, numpy as np, sys, time
import collections
import tifffile
import torch
from torch.nn import functional as F
import dataprovider3 as dp
import forward
import utils
import models
def load_memmap_arr(... |
bde2b91e41aed280ac6670a8a80cf154960f5df8273e9118d8a04ee06192c0e9 | Python | 6,711 | 193 | import os
import math
from shutil import rmtree
from src.cajal.utilities import Err
from src.cajal.swc import (
batch_filter_and_preprocess,
cell_iterator,
default_name_validate,
linearize,
forest_from_linear,
read_swc_node_dict,
read_swc,
node_type_counts_forest,
num_... |
31304462b9c299acab4dd114ec17536a70f0777793c55d6009b7139acf1e351c | Python | 6,717 | 182 | from typing import List, Union
import torch
import torch.nn as nn
import logging
from .graphnet import GraphNet
from utils.const import DEFAULT_DEVICE, DEFAULT_DTYPE
from .const import LOCAL_MIX, GLOBAL_MIX
class Encoder(nn.Module):
def __init__(
self,
num_nodes: int,
input_node_size: in... |
08c9374ad87e4de316bef4c868d9a86918bab7a1415fe3208bf2bc4602f7a5da | Python | 6,718 | 184 | # Copyright 2019 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 applicabl... |
78f23d0f16dda9cdba6ce9f3d17442c640b84fd6ebef1bf82f4aeec6cdca32b3 | Python | 6,718 | 150 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Yaoyao Liu
## Tianjin University
## liuyaoyao@tju.edu.cn
## Copyright (c) 2019
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the root directory of this source tree
##++++++++++++++... |
7d833718ee95f9ea20dee613b7b53d2f9f558f84d95026f377ff414cb2a36b35 | Python | 6,721 | 196 | """
Regression tests for MetricsDAG._count_accuracy.
Issue #188: TPR > 1.0 when B_est contains bidirectional edges due to
double-counting in pred_und construction (both flatnonzero(B_est==-1)
and flatnonzero(B_est.T==-1) are included, yielding two index entries
for a single undirected edge).
"""
import numpy as np
im... |
d2a34889db28a86a824f828140f3af5f3d6334fde58f290bc44707685d0a85d0 | Python | 6,721 | 173 | # Copyright (c) OpenMMLab. All rights reserved.
# migrate from mmdetection with modifications
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weight_reduce_loss
def seesaw_ce_loss(cls_score,
labels,
weight,
... |
2294f8eae75b7bb89d9cec732409257a65803abc18f82ddc1760e1000112e13d | Python | 6,722 | 156 | """
@file: convert_to_onnx.py
Created on 07.02.20
@project: CrazyAra
@author: queensgambit
Utility script for cmd-line usage to convert a given MXNet model into the ONNX format.
The ONNX model can later be used to do inference with TensorRT or to load the model in a different DL-framework.
MXNet 1.5.1 only supports O... |
02437655f1f3a09c93bb22fcc109bfa4e146960597436971e8940a5b4ef5045e | Python | 6,724 | 181 | # 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... |
1cf221c2d2d33cfe63487b1b0a57c70cb01fe25d77d8658b6d595939a9ab00a3 | Python | 6,725 | 86 | """
Data structures for model_run
XM13 with cooperative nacn channels
Passive Dendrites: The dendrites have LEAK channels only, no voltage gated channels.
"""
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the ... |
362734fa41afea2642ac4e93e51ee9485e240906632896921ea19a16225dee6b | Python | 6,726 | 87 | """
Data structures for model_run
XM13 with cooperative nacn channels
Passive Dendrites: The dendrites have LEAK channels only, no voltage gated channels.
"""
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the ... |
61e0471a3d68ef0bcd7a9c4c70525ac28bf590e81407b7c81c439f94cc73152e | Python | 6,726 | 87 | """
Data structures for model_run
XM13 with cooperative nacn channels
Passive Dendrites: The dendrites have LEAK channels only, no voltage gated channels.
"""
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the ... |
faf93d602c1c465893c6256a3b75d0e2deb53061d31f46570eebcda8b32be1ea | Python | 6,728 | 174 | # 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... |
7c4927fd1b4d1cd1f6360b7e653f63e1c3185544471b7e2013555c24efc0e1f5 | Python | 6,731 | 156 | # 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... |
c44acaedce9a6db148a7364d06572734452feb0491554e63f77b3c90c9a6463a | Python | 6,731 | 143 | #=======================================================================================================================
#Copyright
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick ... |
3d926aa0211801d2e17b59e3da4548713be2d7fc7ad02b664a88f37a2aab0a06 | Python | 6,732 | 151 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 19 15:42:12 2018
@author: wanglab
"""
import os, sys, shutil
import argparse
from tools.utils.io import load_kwargs
from tools.conv_net.utils.preprocessing.preprocess import get_dims_from_folder, make_indices, make_memmap_from_tiff_list, generat... |
ba89b19bb51231656f6dd8821d6486858666dff32b3896b7bced4be66026d2fd | Python | 6,733 | 201 | from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import time
import sys
import six
import marshal
import types as python_types
def get_from_module(identifier, module_params, module_name,
instantiate=False, kwargs=None):
if isinstance(identifier, s... |
62014968e3b2cbf4337527185e09ab554dcff8c9cbc41a31a6b3c82e74997a43 | Python | 6,734 | 183 | from typing import List, Optional, Union
import torch
import torch.nn as nn
import logging
from .graphnet import GraphNet
from utils.const import DEFAULT_DEVICE, DEFAULT_DTYPE
from .const import LOCAL_MIX, GLOBAL_MIX
class Encoder(nn.Module):
def __init__(
self,
num_nodes: int,
input_nod... |
089131fce8a2b01a8fa5bf72933d7f3ee77169c7d694bcd2a52a7d839706c607 | Python | 6,736 | 168 | """Interface module to scipy.
Interface module to scipy.spatial's pairwise distance function cdist exposes
parameters as scikit-learn hyper-parameters
"""
__author__ = ["fkiraly"]
import numpy as np
import pandas as pd
from scipy.spatial.distance import cdist
from sktime.dists_kernels.base import BasePairwiseTr... |
9db9f1067909df1f129da9e45299c06dbe17e171c73cd2084004be3b6f60f342 | Python | 6,736 | 267 | import numpy as np
from scipy.integrate import simps, solve_ivp
from Historia.shared import design_utils as desu
from Historia.shared import mesh_utils as mesu
def save_Ca_Ta_lambda_dlambdadt(path_to_sim, path_to_out):
"""
Works with 4 heart beats simulations performed with -exdata_init option on.
Reads ... |
f1c4e7380db0bc1c8ab1d4021652ab3956382132936b366f1ecc1fee6e122f2f | Python | 6,739 | 183 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.utils.parrots_wrapper import _BatchNorm
from ..builder import BACKBONES
from .base_backbone import BaseBackbone
def make_vgg_layer(in_channels,
out_channels,
num_block... |
6d6666ea5ca8743ac581b4becca69ae86e31b71c1851a6654b55b414b68970b7 | Python | 6,745 | 162 | from src.solvers.neuralDistDDE_train_HOTs import create_interpolator, create_validation_set
import src.utilities.findiff.findiff_general as fdgen
### Define a custom loss function
class custom_loss():
def __init__(self, args, x, mse_weight = 0.):
self.args = args
self.base_str = 'cdefghijklmno... |
bda0a0f78c2de829c490e59ad2ba9000911ed5d1385502f57063b2730a4745b3 | Python | 6,745 | 245 |
#=======================================================================================================================
# 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... |
dccbf4b4339221ea187bb0819bac23e0688f77da4f2bae02b57a8ecb24127045 | Python | 6,745 | 180 | # 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... |
39b5e61ecfd290e928306a3d7afed40bf118940afe5c2863e0d2f1c8eb9a7b7e | Python | 6,755 | 181 | import os
import gc
import csv
import shutil
import yaml
import numpy as np
from datetime import datetime
import torch
from torch.optim import AdamW
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
import torch.multiprocessing
torch.multiprocessing.set_sharing_strategy('file_system')
... |
570e1e061b5c4f7c0ff80736c0e252f2abdc9fa3156d248a33e2ab147979e4c7 | Python | 6,758 | 145 | import argparse
import os
from collections import defaultdict
from pathlib import Path
import nibabel as nib
import numpy as np
from bcblib.tools.spreadsheet_io_utils import import_spreadsheet, str_to_column_id
from bcblib.tools.nifti_utils import is_nifti, file_to_list, load_nifti
def anacom2():
"""
Main fu... |
7530f5c4dba370d7303e0d6bd1d317f8811d2f0e4d471cdfdf7cd569afddc5fa | Python | 6,761 | 262 | # 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 topk_sorted_implementation(X, k, axis, largest):
ind_axis = np.indic... |
7809aed0a7a9862ad0eb789e2cb829db00dd040fa62c7497167999b33f4df119 | Python | 6,763 | 234 | # 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 ReduceMin(Base):
@staticmethod
def export_do_not_keepdims() ->... |
c99a9e912c58f5e9fbd588d3215fca5eda130ae8e8428094c130991db922b0ca | Python | 6,782 | 170 | import logging
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.nn.parallel import DataParallel, DistributedDataParallel
import models.networks as networks
import models.lr_scheduler as lr_scheduler
from .base_model import BaseModel
from models.modules.loss import CharbonnierLoss
logg... |
a7a3d6262ada5fbf4ebf32f0aeb26cdb7e3033c6dc6de501f9205f60a3c87554 | Python | 6,786 | 180 | # 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... |
b4edda008258b2757dda43a886719e490f5379d8d860c2c48f8a67d5a3147467 | Python | 6,786 | 167 | """
This scripts plots figure 6c from the paper.
This is the accumualtor model output for the naive mice.
Internal notes:
This is from notebook 21.22
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# ... |
6d5f2f49b40ab59e375c353858028f5ffd983384ef84db1c7bd9cdfa1982e664 | Python | 6,792 | 186 | # 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... |
036362ca1caafcdee8bd0552938bd1e82e00fc77b938293f571062204eae8a03 | Python | 6,793 | 190 | # 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... |
5553e67826653838d28ea2ff9d7c2c11d70d575b68ba92a175d806f44d86fbe6 | Python | 6,793 | 186 | from .triplet_loss import batch_hard_triplet_loss
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
""" model structure of MUSE """
def structured_embedding(x, y, label_x, label_y, dim_z, triplet_margin,
n_hidden, weight_penalty, triplet_lambda):
"""
Construct structure and ... |
c4c3654decefcd1c5a98651c80d1e4df3de01adcfdc348e70b1f309058edd090 | Python | 6,795 | 179 | '''
Interval Tree data structure for indexing a set of
integer intervals of the form [start, end).
http://en.wikipedia.org/wiki/Interval_tree
Copyright 2013, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
class IntervalTree:
'''
Interval Tree data structure for indexing a set of
... |
a25aeb5e4e96a3d3c4937ffa10ecf4c6095bd73c3aadb056fe772a2b9fab19bb | Python | 6,805 | 83 | """
Data structures for model_run
XM13 with cooperative nacn channels
XM13A: reduce channel density to match input resistance with more complex
cells from SBEM data (original densities were based on soma-alone assumption)
"""
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and volta... |
4921ab370d2146df4403dee478db372823a3c199bddd6b54ae0b97e6054846b7 | Python | 6,807 | 207 | # SPDX-License-Identifier: LGPL-3.0-or-later
import random
import unittest
from unittest.mock import (
patch,
)
from deepmd.pd.model.model.model import (
BaseModel,
)
from deepmd.pd.utils.update_sel import (
UpdateSel,
)
from ..seed import (
GLOBAL_SEED,
)
def update_sel(jdata):
type_map = jdata... |
d092aa02f4f4b3afee8146bc39ce09860a0886cbe7d0ca3ea0fc52adb6936bef | Python | 6,807 | 146 | import numpy as np
from scipy.special import factorial
from functools import reduce
from itertools import product
from ..lddmm._lddmm_utilities import _validate_ndarray
from ..lddmm._lddmm_utilities import _validate_scalar_to_multi
from ..lddmm._lddmm_utilities import _compute_coords
from ..lddmm._lddmm_utilities impo... |
cf677a86365a596fa5ae9deb3457e83298a330fada8c49b88a36ef84fd264b75 | Python | 6,809 | 180 | # Copyright (c) OpenMMLab. All rights reserved.
# Adapted from https://github.com/facebookresearch/pycls/blob/f8cd962737e33ce9e19b3083a33551da95c2d9c0/pycls/core/net.py # noqa: E501
# Original licence: Copyright (c) 2019 Facebook, Inc under the Apache License 2.0 # noqa: E501
import itertools
import logging
from typ... |
d06330b767453f2d76aa182585dfa5561490e53f8df0f73a26f04063417eec9e | Python | 6,811 | 197 | # 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
#
# ... |
7a1f72af1dbe4036da3f5c3ed379cf7bd09ec000a2410143e8fb680a153af0af | Python | 6,814 | 188 | from __future__ import print_function
from freqAnalysisTools import band
from os import listdir
from os.path import isfile, join, splitext
import pickle
import math
import numpy as np
from itertools import groupby
#---------------
# set up parameters
# for data handling
metaDataLineNum4eeg = 18
metaDataLineNum4stage ... |
ebf2eb5f7abc2c1b694c17c05d801c119c20cfe2815c28e6b783edecfcb1f0c0 | Python | 6,819 | 188 | # 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... |
37afe724697d0d16abf11e0463ff54695d54f74d4f83ee3b42fc7721b61295f4 | Python | 6,820 | 206 | from __future__ import print_function
import re
import os
import sys
import tempfile
import subprocess
import multiprocessing
import multiprocessing.pool
import dxpy
def normalize_timedelta(timedelta):
"""
Given a string like "1w" or "5d", convert it to an integer in seconds.
Integers without a suffix are... |
34cab04c72cda2e291335a9c5604be1a701537cf33abdaea27469f27ef3cf2f8 | Python | 6,823 | 195 | # 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... |
8d14fb34aedcc96a529e05b4bb50d138e7fe988e1fca8dd7919b01e91641305a | Python | 6,827 | 204 | import numpy as np
import lmfit
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
class FitModel(lmfit.Model):
""" Simple extension of lmfit.Model that allows one-line fitting.
Example uses:
# single exponential fit::
fit = expfitting.Exp1.fit(data,
x=ti... |
c4680a89fff0aa39a1f046c817b7c98465c3a90af7e663756f61feda8fcf8f9c | Python | 6,828 | 233 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 12 15:53:12 2023
@author: Mesfin Diro
"""
import warnings
warnings.filterwarnings("ignore")
import os.path as osp
import torch
import torch.nn.functional as F
from torch.optim import Adam
from molgnn import MolGATConv
from pygdata import RedDB
fr... |
5bec37657b786a18cd8cad38657c48b95c90cffd36a2f897209eec0edf29347f | Python | 6,832 | 156 | """
Helper functions used for analysis of eeg epochs.
The intention is that these should be used both in offline analysis and Timeflux when running things in real-time.
"""
import numpy as np
import pandas as pd
import pyriemann
from pyriemann.utils.distance import distance_riemann, distance
from pyriemann.estimation ... |
d0119f8a098e929416019287593578eee40b34fc9677e8045533e8ff44824390 | Python | 6,832 | 189 | import os, h5py, sys, time
import numpy as np
import tensorflow as tf
from tensorflow import keras
import tfomics
from tfomics.fit import MonitorMetrics, LRDecay, EarlyStopping, progress_bar
@tf.function
def saliency_map(X, model):
with tf.GradientTape() as tape:
tape.watch(X)
outputs = model(X, t... |
b50fb6609c1cc1502f428ce75513b089acd415fe2a3eabee78670c3ea01729a8 | Python | 6,833 | 134 | """
@file: output_representation_tests.py
Changed last on 17.01.19
@project: crazy_ara_cleaning
@author: queensgambit and matuiss2
Testing outputs
This file contains the test cases for testing the outputs
"""
import unittest
import chess
import numpy as np
from DeepCrazyhouse.src.domain.variants.plane_policy_represen... |
2b9d1b90b6922df5dd627dcec905a1a9735df18cce9ce3195848646247b8f4f8 | Python | 6,834 | 186 | import math
import numpy as np
# import matplotlib
# import matplotlib.pyplot as plt
# import matplotlib.ticker as tckr
# import matplotlib.transforms as mtransforms
# import matplotlib.mlab as mlab
# An alpha version of the Talbot, Lin, Hanrahan tick mark generator for matplotlib.
# Described in "An Extension of Wilk... |
36a7a28bcde34d74c8dcf1a2116a179b9ccd61adf905a75a9f8d2919e58a4416 | Python | 6,837 | 193 | import sys
from lxml import etree
from pyontutils.core import Source, LabelsBase, Collector
from pyontutils.utils import Async, deferred
from pyontutils.config import auth
from pyontutils.namespaces import NIFRID, ilx, ilxtr, WHSSD
from pyontutils.namespaces import makePrefixes, NCBITaxon, UBERON, nsExact
from pyontuti... |
e2f4f31b40294762b74f8d851c4e05be5034ce76f39605311b6e9d2673c1b5b4 | Python | 6,838 | 178 | """
3. Cycle-by-cycle analysis of resting state data
================================================
Simulated experiment using the cycle-by-cycle approach.
Say we ran an experiment and want to compare subjects' resting state data for some reason. Maybe we
want to study age, gender, disease state, or something. This... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.