sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
87c8514ae146f8fa729ae3f6bba78a1f27227dca5e6d348e9c6f033b8a1e8864
Python
11,812
299
#!/usr/bin/env python # Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import os from typing import IO, TYPE_CHECKING, Any from onnx import AttributeProto, defs, load from onnx.backend.test.case import collect_snippets from onnx.backend.test.loader ...
aa3e905fc8ada3b30d35beb5e3ae21d78aa5e6498b80a5b50928057218f9f810
Python
11,812
305
"""Support vector classifier using time series kernels.. Direct wrap of sklearn SVC with added functionality that allows time series kernel to be passed, and uses the sktime time series classifier interface. """ __author__ = ["fkiraly"] __all__ = ["TimeSeriesSVC"] from inspect import signature from sklearn.svm impo...
bbfeaa4b36ab3abcdeb1126bf8ecda18d05b8444aba4119901bbe303437348c3
Python
11,827
278
"""Residual Network (ResNet) for classification in PyTorch.""" __authors__ = ["srupat"] __all__ = ["ResNetClassifierTorch"] from collections.abc import Callable import numpy as np from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch from sktime.networks.resnet import ResNetNetworkTorch c...
44b2f9c6549280523e6f63046358080a7dd0e54be91a969185caaf16d51b891c
Python
11,828
338
# 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...
26ce68dc2d45970d06d6e2b9ced5c2350d7bd0896a88f94bb70078eede46c2f5
Python
11,832
375
from __future__ import annotations import warnings from collections import Counter from copy import deepcopy from typing import Optional, Tuple, Union from pathlib import Path import numpy as np import pandas as pd from libpysal.weights import KNN from libpysal.weights import W as libpysal_W from . import cluster, d...
66ebed5b4ae06b579646c298f8b6dc6dd54eaceeff35129e80f348a807d048e9
Python
11,836
353
# SPDX-License-Identifier: LGPL-3.0-or-later from typing import ( Any, overload, ) import ml_dtypes import numpy as np import torch import torch.nn.functional as F from deepmd.dpmodel.common import PRECISION_DICT as NP_PRECISION_DICT from deepmd.pt.utils import ( env, ) from .env import ( DEVICE, ...
60184281f6f41ad86b978b08a454f32ee025340b2a669c025873535667ed593d
Python
11,840
332
# 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...
205c2ec13a052cfaed26111a54566721d2c6363276e61642da20c74bab141cea
Python
11,845
290
# 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...
41f6f8583fdf374460ce986b3d91e9f3d3d453e9c6f4e1368bb04b48eb148615
Python
11,845
378
# 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 Split(Base): @staticmethod def export_1d_opset13() -> None: ...
55ad7529a91f0872f4a89e4702908895a768506d6f740a35179e10a6c11a88ff
Python
11,846
335
# 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 from onnx.reference.ops.op_causal_conv_with_state import ( CausalConvWithS...
d04b41112dbcca7059999c2e7a6e5e96884955a5f0653d41cbf6a06ce38fa553
Python
11,847
282
import os.path as osp import torch from torch import Tensor import torch.nn.functional as F from torch.nn import Parameter from torch_geometric.nn import MessagePassing from torch_geometric.utils import remove_self_loops, add_self_loops #, softmax from torch_scatter import scatter from torch_geometric.nn.inits import...
c12fc8fd0a58a7e857854c642da8821a007515e20387afa1b98abe3da283cf56
Python
11,854
279
# Copyright [2020] Luis Alberto Pineda Cortés, 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.0 # # Unless required by ...
84d02dc0ac1c6b666a8d8ea7f5c3909cb51ff72f5f58a9f0223d449ce6f476b4
Python
11,860
282
# 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...
efb02bb3da14d4146bbe0e4cbfb3f9d7b34be88fb359dc245ba519fdc94d11e2
Python
11,860
351
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
52ce5a87934779c1b9c79b669b122127c7ed3d5a01d27d1c038335a3f539644e
Python
11,876
364
import numpy as np import rdkit import rdkit.Chem as Chem import networkx as nx from build_vocab import WordVocab import pandas as pd import os import torch.nn as nn from dataset import DTADataset,Pre_DTADataset from model import * from utils import * from torch_geometric.loader import DataLoader fr...
77015fa448d752135837ecde96da361608360890c130517d9a29b32049774e8d
Python
11,877
210
""" @file: rise_mobile_v3.py Created on 21.11.19 @project: CrazyAra @author: queensgambit Upgrade of RISE architecture using mixed depthwise convolutions, preactivation residuals and dropout proposed by Johannes Czech Influenced by the following papers: * MixConv: Mixed Depthwise Convolutional Kernels, Mingxing ...
bb4abbafdf0afc7e9f0ccebd955e3cb13b71ca5b92fbe7cfc0d486b9fd8b0ca8
Python
11,889
312
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch.nn as nn from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from .resnet import ResNet from .resnext import Bottleneck @BACKBONES.register_module() class RegNet(ResNet): """RegNet backbone. M...
ee0b744a5f4bb4807cc124f81862fc1803548c88161d8f4a74ffb8955b14f141
Python
11,889
315
#------------------------------------------------------------------------------- # elftools: dwarf/compileunit.py # # DWARF compile unit # # Eli Bendersky (eliben@gmail.com) # This code is in the public domain #------------------------------------------------------------------------------- from __future__ import annota...
d5baeaa0bf5dec826949b88f11bdc44a423f2e75d235bc07116767aaa6aa1fad
Python
11,906
320
import logging import numpy as np from ray.rllib.models.modelv2 import ModelV2 from ray.rllib.models.tf.tf_modelv2 import TFModelV2 from ray.rllib.models.tf.misc import normc_initializer, get_activation_fn from ray.rllib.models.catalog import ModelCatalog from ray.rllib.policy.rnn_sequencing import add_time_dimension ...
990507c209773ecdb90e6cac972e40267328842adb0010e59a2c613d88d7291a
Python
11,910
314
# SPDX-License-Identifier: LGPL-3.0-or-later """Compact canonical graph contract for compressed CUDA deployment.""" from __future__ import ( annotations, ) from dataclasses import ( dataclass, ) from typing import ( TYPE_CHECKING, ) import torch if TYPE_CHECKING: from deepmd.dpmodel.utils.neighbor_g...
2579cf95e121fbcdc1d110681ab5505deb8e3cb7e7d6790ccba82b181a11ffb6
Python
11,915
254
from mprl.utility_services.real_time_payoff_tracker.protobuf.real_time_payoff_tracker_pb2 import PayoffTableKey, PolicyInfo, LivePolicyInfo, Confirmation, EvalMatchupResult from mprl.utility_services.real_time_payoff_tracker.protobuf.real_time_payoff_tracker_pb2_grpc import RealTimePayoffTrackerServicer, \ add_Real...
a68faafe5bcb2f5c97748a9f286214588fe4a2570f2063bd1ada7545a868c162
Python
11,918
309
# 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...
c0666c6e11a07809cd92e091aa7bdd9f5d9e2856d407fb947ca96ff9b9f3d1ba
Python
11,924
273
#!/usr/bin/env python3 #!/usr/bin/env pypy3 import os import sys import gzip from io import BytesIO from pathlib import Path from lxml import etree import rdflib import requests from pyontutils.core import makeGraph, yield_recursive, qname, build from pyontutils.core import Ont, Source, OntGraph, OntResIri from pyontut...
759e3e8352efe67b2a97c400f86c732597957f9cded945d660357a83e8b59164
Python
11,929
310
# 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...
f9777b2b52640915d2d3990b630b7f44b90c826c2c649ee821dc5af8b98f135a
Python
11,929
368
# 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...
346dcd2924e35be40fe6f121c91e71640bc1ef7df43259d7f0bba5d1cd588a96
Python
11,932
352
"""Time Convolutional Neural Network (CNN) for classification.""" __all__ = [ "TapNetClassifier", ] from copy import deepcopy from sklearn.utils import check_random_state from sktime.classification.deep_learning.base import BaseDeepClassifier from sktime.networks.tapnet import TapNetNetwork class TapNetClassi...
8efcef36a24fd57651702c92d6cda5020d74c7763c4f3bce71278a2d88bdb75e
Python
11,932
339
"""Tests that exercise heavy functions using real pipeline outputs. The fixtures used here live in `tests/test_odp_basic/odp/` and `tests/testdb/`, products of prior smoke-test runs. The .D.FET.rbh files carry the full column set (FET, D, ix, breakchrom, break_ix) that the plotting + statistics functions expect; the ....
6e2bed84b4607daa3604365b6ff1e9b621be968c0c7396a220c32207bf1fee15
Python
11,938
423
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 21 15:25:48 2021 Plotting examples showing double-update (Fig 1D, 2A) @author: robert.mok """ import os import sys import numpy as np import torch from scipy.stats import multivariate_normal import matplotlib.pyplot as plt import imageio sys.path...
a19ba20f553f7d424c712acf744e086d85506af0a0bcc6f573fec53ab7ec6d90
Python
11,948
335
import xml.etree.ElementTree as ET from akkadian.data import from_key_to_line_number, from_key_to_text_and_line_numbers def parse_word(sentence, word): """ Add all parts of word to sentence (include punctuation marks as well for example) :param sentence: sentence of words being built as we proceed :pa...
8581e09546b462ada16356b2c0bb07a6604c9a1b0e4ee02bdc8c96e771939357
Python
11,950
385
"""ClaSP (Classification Score Profile) Segmentation. Notes ----- As described in @inproceedings{clasp2021, title={ClaSP - Time Series Segmentation}, author={Sch"afer, Patrick and Ermshaus, Arik and Leser, Ulf}, booktitle={CIKM}, year={2021} } """ from sktime.detection.base import BaseDetector __author__ = [...
023f51871d92eb4bdda7b98f0e5f07cf00fca7f44652632c132be92cb798f424
Python
11,954
203
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 13 17:05:41 2019 @author: wanglab """ path_to_lighsheet_folder = '/home/kellyms/wang/seagravesk/toms_lightsheet_software_20190104/lightsheet' import os, sys, shutil, numpy as np, pandas as pd import datetime from collections import Counter sys.pa...
a45a7b42b05b233655a98f5fceff10543801db2fb045078248bdf827517b6663
Python
11,957
319
from akkadian.data import increment_count, compute_vocab_count, compute_accuracy from akkadian.build_data import preprocess TEST_DATA_SIZE_FOR_LAMBDAS = 3 def hmm_preprocess(train_sents): """ train the HMM model :param train_sents: train sentences for the model :return: counts of unigrams, bigrams and...
e830a6f79c159a0a2c195ed094db83f9ed293476af3edb98f4545ee089205aac
Python
11,966
466
""" Light weight functions for generating html and working with the rest of the unholy trinity. """ __version__ = '0.0.4' # chars nbsp = '\xA0' # html def tag(_tag, n=False): nl = '\n' if n else '' s = f'<{_tag}{{extra}}>{nl}' e = f'{nl}</{_tag}>' def tagwrap(*value, **kwargs): if 'class_' ...
5b10c4cc9fe15694d4d6f71ae1c72cba66f87de0a6c75b3e6564dcee7c9e2619
Python
11,967
317
# Copyright 2020 by Gongfan Fang, Zhejiang University. # All rights reserved. import torch import torch.nn.functional as F def _fspecial_gauss_1d(size, sigma): r"""Create 1-D gauss kernel Args: size (int): the size of gauss kernel sigma (float): sigma of normal distribution ...
8fa274831e9b7bf6446b442159679b0e4542e7cf339e580961f9fcb659ca434a
Python
11,967
336
# 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...
12860e9c7351c0e2f1c4aa616f802514175d6925c0df81bfff775f787dacda55
Python
11,972
300
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # """ Train KGE model on benchmark datasets: Usage: predictive_performance.py ...
97cf821abf74c61c29d056a7b27ca38d26162a5cd6f34bc7d4b4ef4751d59d96
Python
11,973
323
#!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-3.0-or-later """Generate the DPA4C long-range .pt2 test models and reference values. A latent-charge long-range module sums over every pair of atoms of a complete non-periodic system, and over the images of the cell of a periodic one when it serves periodic system...
0a8eb40e3ee9e90d3d0c80a1d48d2a419ea0a96e5fc1df8ec78aea0166141ac9
Python
11,982
290
# 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...
4886620b4f145bfc510e000bc112a6cbfc9530c8bc796a2efc5562cb622f3ec3
Python
11,988
378
# 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....
bac2094405edf5f9887280ba0780d03ca8ab6feb5da5cefcdad2b1994919d58d
Python
11,990
316
"""Time Series Forest (TSF) Classifier. Interval based TSF classifier, extracts basic summary features from random intervals. """ __author__ = ["kkoziara", "luiszugasti", "kanand77"] __all__ = ["TimeSeriesForestClassifier"] import numpy as np import pandas as pd from sklearn.tree import DecisionTreeClassifier from...
7755994272c7e54d73bd4d01eccacb7afd4cd79de7520abeeb6c0e1f9fce1fe5
Python
11,992
335
import xml.etree.ElementTree as ET from akkadian.data import from_key_to_line_number, from_key_to_text_and_line_numbers def parse_word(sentence, word): """ Add all parts of word to sentence (include punctuation marks as well for example) :param sentence: sentence of words being built as we proceed :pa...
9b3a13641f2b4f8593e2b1f8bee66c6bf4152bba9e579388674272dc8eff6ea6
Python
11,996
373
import unittest from unittest.mock import patch, MagicMock from siibra.volumes.parcellationmap import ( Map, space, parcellation, MapType, MapIndex ) from siibra.exceptions import ( ExcessiveArgumentException, ConflictingArgumentException, NonUniqueIndexError, NoVolumeFound ) from siibra.commons import Spec...
869a07d48748ad4aab86d12d5988480953cc76a404c55a3b438f9c4354280c63
Python
12,000
349
import json import tempfile import numpy as np import copy import time import torch import torch._six from pycocotools.cocoeval import COCOeval from pycocotools.coco import COCO import pycocotools.mask as mask_util from collections import defaultdict import utils class CocoEvaluator(object): def __init__(self...
eb550018ecbf51ebe81bfa94dac276c62dba81ceb019922acc79cabe49ffbd21
Python
12,006
345
# Helper functions for plotting ASR results, # adapted from the Topiary library # See https://topiary-asr.readthedocs.io/en/latest/topiary.draw.html import topiary import pandas as pd import matplotlib.pyplot as plt import numpy as np import numpy as np from matplotlib import pyplot as plt import matplotlib.patches a...
6239f230b7dcba742122769877cc34301cfd83cceaedc5b6f01a410101e56968
Python
12,012
244
# -*- coding: utf-8 -*- """ Code used for binary discrimination and discrimination in clutter results. As with all other ***_runSFA code meant to be used with a batch wrapper module that feeds in the vocalizations to compare. @author: ronwd """ import numpy as np import soundfile as sf import pyfilterbank.gammatone...
e70d25d66244284df1d7e88776370de6d2f2db45aa92b1dcbcd01a6d481e1e9e
Python
12,016
317
# 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...
ff9c814246948544466069268f435f144866b865ff0589ec039905eabc98609f
Python
12,036
354
# -*- coding: utf-8 -*- """! @file calibrate.py @brief Script to do calibration of visual stimulus monitors. @author Perry Hargrave, Jay Borseth, Derric Williams @copyright Allen Institute for Brain Science This works to adjust gamma and luminance so the response of the monitor is roughly a straight line ...
43b0643763a01542b50532caa089dd8191af0d13f5cdc03dc92e2c50a596d982
Python
12,046
328
"""AxialTAD — Wilcoxon rank-sum post-hoc filter for trained models. The filter (window_size=8, p<0.05) operates on: - dense Hi-C matrix (KR-balanced .txt) - per-bin model predictions (binary 0/1) It (a) standardises the matrix per anti-diagonal, (b) finds "gap regions" via zero-row windows, (c) on each non-gap pr...
569de872ea0a9785ab258372ad421f9451a0694b2d54a72000d95e82669d9ef2
Python
12,058
450
DATASET_TAGS = { "m1_yearly_dataset": { "n_instances": 181, "n_panels": 1, "n_hierarchy_levels": 0, "is_univariate": True, "is_one_series": False, "n_splits": 0, }, "m1_quarterly_dataset": { "n_instances": 203, "n_panels": 1, "n_hierarc...
eda9ef5836413b6fc18516a5980284a96e63fc7c62422793709c894a023fdafc
Python
12,066
328
import torch import math import numpy as np from models.se3transformer_layers.from_se3cnn.SO3 import irr_repr, torch_default_dtype from models.se3transformer_layers.from_se3cnn.cache_file import cached_dirpklgz from models.se3transformer_layers.from_se3cnn.representations import SphericalHarmonics ####################...
152f65d817f27d05ea514f0257c0b93b1e0778f179e0d0b21b7a171bfd13ffa4
Python
12,069
342
import matplotlib.pyplot as plt import mmcv import numpy as np from matplotlib.backend_bases import CloseEvent # A small value EPS = 1e-2 def color_val_matplotlib(color): """Convert various input in BGR order to normalized RGB matplotlib color tuples, Args: color (:obj:`mmcv.Color`/str/tuple/int...
2dcb843eb921f61868e93dcb617ff2870ccc5e420361d189d990f046e00d5021
Python
12,072
306
from __future__ import annotations import math from typing import Any from typing import TYPE_CHECKING import numpy as np from optuna.distributions import CategoricalDistribution from optuna.distributions import FloatDistribution from optuna.distributions import IntDistribution if TYPE_CHECKING: from optuna.di...
c026fea090e98f33f670d20f63e34f1b6349f68ab3f37db78192bb3199ad0e13
Python
12,072
315
""" CTULIP: Canine TUmor CLassIfication Predictor This tool predicts the primary tumor type (17 or 32 types) based on RNA-seq Canine data. This tool takes expression data of 14,761 genes, that is common to Canine-to-Human 1 to 1 mapped and Human protein coding genes Authors: Satish RG, Sara Jones """ from __future__...
da9c17fcabdef32b496aa4677a12fe87967cc385a8a9d2914617f74940e5f4c0
Python
12,076
302
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Dec 23 14:11:22 2016 @author: tpisano """ import numpy as np, SimpleITK as sitk, sys import tifffile import itertools import matplotlib.pyplot as plt #################################################################################################### ...
89086adf42de32053806917e0027850b0457fad26184371f76236c941ae90d5c
Python
12,080
299
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split import gensim from gensim.models import Word2Vec import os import pickle def save_model_here(model_name, model_object, object_name): directory = './models/' + model_name if not os.path.isdir(directory): os.make...
8b9dbe8badd668d3867bb3c85b41b5ace71794a3f5bac2846497c55f069af18a
Python
12,081
295
import logging import pickle import re import shutil import sqlite3 from pathlib import Path from typing import Union import numpy as np import torch from tqdm import tqdm import flair from flair.embeddings import WordEmbeddings # this is the default init size of a lmdb database for embeddings DEFAULT_MAP_SIZE = 100...
66454a551a9a36a77a9109cf3b8976f94da278d567fe8c628321977e199508a0
Python
12,085
341
#!/usr/bin/env python3 # CBDA validation and training set creation. # This script defines multiple trainig sets for a CBDA project. # # Inputs: # File name of original data file. # The following assumptions are made about the contents of the file: # It is a text file with standard Unix style e...
fb90c9f930ff5f89a0d1624403073325c7c5de05383f454c509c1ea01684226c
Python
12,094
371
# 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...
108ea38fb71ba0b1b834816fe23272a7a5333cd9ddd2d9d7e98fb0c465d4d7e7
Python
12,095
309
from flair.data import Label, Relation, Sentence, Span def test_token_tags(): # example sentence sentence = Sentence("I love Berlin") # set 4 labels for 2 tokens ('love' is tagged twice) sentence[1].add_label("pos", "verb") sentence[1].add_label("sentiment", "positive") sentence[2].add_label(...
dac36ea5ceed6d18f1d581f1103a6bd392b8453ba689862bec8798144ae8a9aa
Python
12,096
350
# Copyright 2022 Diagnostic Image Analysis Group, Radboudumc, Nijmegen, The Netherlands # # 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...
2c888b070cd0338f9cfb79f11082054db211cbf1b8c84e0782d1983b2b746bdc
Python
12,100
277
import os import logging import numpy as np import scipy as sp import scipy.spatial import pandas as pd import torch from torch.utils.data import Dataset, DataLoader from atom3d.datasets import LMDBDataset, extract_coordinates_as_numpy_arrays from utils import batch_stack, drop_zeros class CormorantDatasetMSP(Dataset...
3128700c0d8f639d346350b2758a759b2ef14ca11918c1df9f88ffd16db0e8d7
Python
12,101
321
""" Analysis tools for VarBayes algorithm results. This module provides diagnostic and analysis capabilities for examining the results of the VarBayes spatial transcriptomics algorithm. The CellAnalyzer class provides methods for: - Analyzing gene expression patterns within cells - Examining spatial relations...
5f97114070ea6bfd7eb3fdb9e5b1f33ad09aab8c5dfcdc1d791cde88b3f99a3e
Python
12,102
306
import os from pathlib import Path import statistics from .bilstm import prepare1, prepare2, LstmTagger, PosDatasetReader from akkadian.build_data import preprocess, break_into_sentences from akkadian.hmm import hmm_train, hmm_viterbi, hmm_compute_accuracy from akkadian.data import load_object_from_file, logits_to_tran...
f2326ec4ba4f761658bae6dfa09d20ebd99718e8cf65535728d2d618180f55b7
Python
12,112
213
""" @file: rise_mobile_v3.py Created on 21.11.19 @project: CrazyAra @author: queensgambit Upgrade of RISE architecture using mixed depthwise convolutions, preactivation residuals and dropout proposed by Johannes Czech Influenced by the following papers: * MixConv: Mixed Depthwise Convolutional Kernels, Mingxing ...
ccda2bff44c36557ea72cad45bff2623df2f04112121021c991f0e45ad6b813e
Python
12,113
346
# 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...
65667a8e27e5621da6b3be38377a0d09547c8b306dd41e9f8d64259249996be0
Python
12,115
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...
f9cd4cb1741d272bbf881a65db58b9b286774bc3ddab4025a3418812a78b86d0
Python
12,122
318
# 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...
7e24ae46ad2cd66d45a6d0797aec0aa3db3a84e0c7f41a98f5dd7c251302f4f4
Python
12,140
302
"""Multi-scale Attention Convolutional Neural Network (MACNN) Classifier in PyTorch.""" __authors__ = ["Faakhir30"] __all__ = ["MACNNClassifierTorch"] from collections.abc import Callable import numpy as np from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch from sktime.networks.macnn imp...
4260a1e2d3aafbc4ac62cbd70dfadd38b35a24e226cf5fd4f9dc27cfcc10446b
Python
12,141
307
"""Operations to perform comparisons between two different molecule systems.""" import numpy as np from scipy.spatial.distance import cdist from scipy.optimize import linear_sum_assignment from scipy.linalg import svd def molecule_compare(mol1, mol2, options='vacuum', excluded=False, threshold=0....
60671a486e14956e225699d9723c125e5e5355b8dae362064b96c927eb5fb147
Python
12,148
360
""" @file: input_representation.py Created on 26.05.21 @project: CrazyAra @author: queensgambit Input representation for chess v2.8. This presentation avoids potential overfitting and bias, e.g. no color information, no move counter, no progress counter and adds features which are hard for the CNN to extract, e.g. mat...
1efe743816affa49321acc6e268fb7148092f7db2557cba745a175cf22c6f22b
Python
12,152
360
""" @file: input_representation.py Created on 26.05.21 @project: CrazyAra @author: queensgambit Input representation for chess v2.8. This presentation avoids potential overfitting and bias, e.g. no color information, no move counter, no progress counter and adds features which are hard for the CNN to extract, e.g. mat...
31fbd413ad37a2071e3c79a5fc948f0b3687679c79e7280adeb4bb85ea7cde2f
Python
12,155
304
# 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 # # ...
6ac8520195c7db4652c9ff63ee26ece22f8b35ec2ba0c0d7f91aed0017ba523a
Python
12,155
238
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Jan 26 10:35:25 2017 @author: tpisano see: tools.conv_net.mem_map for example usage """ from tools.utils.io import chunkit import multiprocessing as mp import pandas as pd import numpy as np from math import sqrt import sys, os, cv2, gc, time clas...
67b226023c584dc5a8535d8f8d35d95b32010dffeec13ab71fa36ad2db33a161
Python
12,160
364
import numpy as np import torch from typing import Union, Iterable def p4_polar_from_p4_cartesian_massless( p4: Union[np.ndarray, torch.Tensor] ) -> Union[np.ndarray, torch.Tensor]: """ Transform 4-momenta from Cartesian coordinates to polar coordinates for massless particle features. Args: p...
359dcb608a7a05703d88e2686abca6f532c35a006aa7e0f48fb8edc14b654d75
Python
12,163
412
"""Utilities for loading datasets.""" __author__ = [ "ericjb", ] __all__ = [ "load_fpp3", "_load_fpp3", ] import os import shutil import tarfile import tempfile import warnings import pandas as pd # import zipfile # from urllib.error import HTTPError, URLError # from warnings import warn # from sktim...
a3f57a335fc7df61889f31b1f1f6065e0ed098f13c640236cbdb95cf11e5947d
Python
12,164
289
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from sparemax import Sparsemax def init_weights_lstm(m): """权重初始化""" classname = m.__class__.__name__ if classname.find('Conv2d') != -1 or classname.find('ConvTranspose2d') != -1: ...
4b5cca63c0ed40eb5d81270dd24091cd9f53c942475412f6c6712f396ff0aedb
Python
12,170
427
"""This module implements gammatone filters and a filtering routine. A filterbank is coming soon [Hohmann2002]_. .. plot:: import gammatone gammatone.example() TODO: - Tests, - nice introduction with example, - implementing the filterbank class References ---------- .. [Hohmann2002] Hohman...
e54fc0ad00c9e4a459a692bc41d97c724f9a7fc1fd8d5b831d39dbeab5edd3b3
Python
12,185
357
"""Tests for the grid search engine shared by the classification and regression tuners. The engine is tested directly here, the tuner classes in their own test modules. """ __author__ = ["yash-sangwan"] import numpy as np import pytest from sklearn.metrics import accuracy_score, log_loss, mean_squared_error, r2_scor...
dea37225a1ed20e752703af73798aac820862b39306c12f745c31344cddc6e5c
Python
12,190
315
# 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...
9e12cc6083a533025b0d1259b1b481727e2a5812186106418d1bfc127048a266
Python
12,195
384
#!/usr/bin/env python3 ''' Functions used for loading and finding files for brain analysis. Authors: Sydney C. Weiser Date: 2017-07-28 ''' import os import re import sys import time from subprocess import call import yaml from typing import List def find_files(folder_path: str, match_string: str, ...
5d4be6404e60db8b1722df4b532b6175932e76a9897dc8efc4c283b48d8f365d
Python
12,201
326
"""Compute shape features for individual cycles.""" import numpy as np import pandas as pd from neurodsp.timefrequency import amp_by_time from bycycle.utils import rename_extrema_df, check_param_range from bycycle.features.cyclepoints import compute_cyclepoints ######################################################...
5f3314bbce4166e9326b61bdf7798991e0afa783cabd6fdca66cc5a208349b00
Python
12,203
333
import cv2 import numpy as np import os import pandas as pd import matplotlib.pyplot as plt # Replace with the path to your video file video_path_directory = '/Volumes/BET lab/BET Lab/Science/BET lab in Sheffield/Projects/Active Decison-making/pythonProject/Videos/' output_dir = '/Volumes/BET lab/BET Lab/Science/BET ...
e62539c395c9f6209b094e2169bda453b08ebf5e765f26b475c897acce6ccabe
Python
12,203
308
from typing import Union, List, Dict, Tuple import numpy as np import pandas as pd import scanpy as sc from anndata import AnnData import warnings from . import config def _validate_obsm_key(ad, key, as_df=True): """ Validates and retrieves the data associated with a specified key from the provided AnnData o...
db9f41212fd63c091a1e2df22ac20a437da9109a68471d3eda021e3efda1f2ac
Python
12,211
333
# code copied from https://github.com/torchmd/torchmd-net/blob/main/torchmdnet/models/utils.py import math from typing import Optional import torch from torch import nn import torch.nn.functional as F from torch_geometric.nn import MessagePassing from torch_cluster import radius_graph import warnings def visualize_b...
98a1a93f732b0276e147c5199a036ab7a35ed4c2c17ce348bf60930a1349054b
Python
12,221
309
from __future__ import annotations from copy import copy from typing import Callable import numpy as np from .dataset import JetDataset from .normalisations import NormaliseABC from .utils import ( checkConvertElements, checkDownloadZenodoDataset, checkListNotEmpty, checkStrToList, getOrderedFeat...
005d80d4ceba6654a232da5477d64b470c6cfb00858ccbba4338eb241e416d1e
Python
12,226
380
# Copyright 2023 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
904270c68770fe61cb37e4487659ff1771302e7f40788f85498711fa2b3336cd
Python
12,231
339
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from .resnet import Bottleneck as _Bottleneck from .resnet import ResLayer, ResN...
d5106c929e67251ee9e3362ab2ca49d8809424bd1958e3c976f5e1391b3740e3
Python
12,237
332
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: real_time_payoff_tracker.proto from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_data...
ad6bc96bc2102c935a982a4a1cbfda0da41f7afd1361cce0c387ecc0fae0a1c6
Python
12,239
363
""" @file: util.py Created on 09.06.18 @project: DeepCrazyhouse @author: queensgambit Utility functions which are use by the converter scripts """ import copy import numpy as np from DeepCrazyhouse.src.domain.variants.constants import ( LABELS_XIANGQI, CHANNEL_MAPPING_CONST, CHANNEL_MAPPING_POS, MAX_N...
a5ed3741c741ad65bfed0d3189ca4fda46b7116bb12ce04287f1a5e0dd12941f
Python
12,242
334
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import pytest from shape_inference_test_utils import TestShapeInferenceHelper import onnx.parser from onnx import TensorProto from onnx.helper import make_node, make_tensor, make_tensor_value_info cl...
e93c468e9b7c374262e7bdf605e66055171670d505555ee452cfd591d09eadc1
Python
12,248
346
# 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...
fe8a93bd82f3dd9423e3c7ab37bc66f5b4a8f6e94876e6bea15308c3035ccdf3
Python
12,253
340
import numpy as np import pandas as pd import argparse import os import re import pickle from rdkit import Chem from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument('--dataset', type=str, default='USPTO50K', help='dataset: USPTO50K or...
cda65a1b36d90c11682f83b132dbe07c20ece0b3145d50d45d9970e6eeb2db9d
Python
12,277
250
""" @file: rl_loop.py Created on 12.10.19 @project: crazy_ara @author: queensgambit Main reinforcement learning for generating games and train the neural network. """ import os import sys import logging import argparse from rtpt import RTPT import dataclasses from multiprocessing import Process, Queue assert os.getc...
732bfed9a3b8d454bd6eeba570f5e72322baad97c870d9300c4c9f9768071d6c
Python
12,282
296
from __future__ import annotations import itertools from numbers import Real from typing import Any from typing import TYPE_CHECKING from typing import Union import numpy as np from optuna._warnings import optuna_warn from optuna.logging import get_logger from optuna.samplers import BaseSampler from optuna.samplers....
60dd9cd90fc121f516718ebb0f1f008ef448c0e774e2891abe45a0a0754a00f1
Python
12,298
302
import logging import random import typing from pathlib import Path from typing import Any, Optional, Union import torch import flair.nn from flair.data import DT, Corpus, Sentence from flair.file_utils import cached_path from flair.nn import Classifier from flair.training_utils import Result log = logging.getLogger...
f5c0edead6b8d1c56d1876cb1d0eadb743022fbf3ab7e69abffe64710aedfd7b
Python
12,306
277
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## 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 ##++++++++++++++...
f45b8091fa450fded5a45942169f03a74b105fbbfa438be7cfbaf632e2d25672
Python
12,325
326
from typing import Callable, Iterable, List, Union import warnings import torch import torch.nn as nn import torch.nn.functional as F import logging from utils.const import DEFAULT_DEVICE, DEFAULT_DTYPE, EPS class GraphNet(nn.Module): def __init__( self, num_nodes: int, input_node_size: i...
688b38d41cd80bb0e5573e32af094a23e9cf0c9e6e7d902721ae0d8582ea0fd0
Python
12,337
324
# Copyright 2026 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
5aebff3402fd85e23bfe2a2cb6cbb1562cc4295ca53688d3510b505a2c4c7731
Python
12,349
238
import pandas as pd import os import glob def load_choice_decoding_results(files_folder_path='/Users/timothysit/Dropbox/msi-key-data/active-m2-choice-init-decoding/decodeChoiceThreshDir/'): """ Load choice decoding results used in the main figure for Coen 2022 INPUT -------- files_folder_path : (s...
7cf91d3e087d7b0fa76dffcfeb2e90ad2cb181c8821fc277ff04d3b9d3b97fa6
Python
12,349
346
# 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...