sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
76b7fda2033a74f78e9df05d907a46de32836580c81e2e7735c583e0ce14f400 | Python | 16,690 | 568 | # 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... |
f70fd2a71da65a3b21ff8e1e48ccb5200dacac00a39c3b4e20b67b9a5480e4fa | Python | 16,690 | 419 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Model factory for the pt_expt backend.
Mirrors ``deepmd.dpmodel.model.model`` but uses the pt_expt
``BaseDescriptor`` / ``BaseFitting`` registries so that the
constructed objects are ``torch.nn.Module`` subclasses.
"""
import copy
import logging
from deepmd.dpmodel.ato... |
c527a093e7dde71ae0f1c11e9c7d97e13da3e5fd0018d1fc095de8acde3bd87a | Python | 16,694 | 374 | import torch
from onmt.translate import penalties
from onmt.translate.decode_strategy import DecodeStrategy
from onmt.utils.misc import tile
import warnings
class BeamSearch(DecodeStrategy):
"""Generation beam search.
Note that the attributes list is not exhaustive. Rather, it highlights
tensors to docu... |
f09ec07a3ee0b3d7e30a314d74ec96e284e5c93e8acc9c8833aeb784b786d5b8 | Python | 16,721 | 623 | # 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... |
92060c4bcee38e21a467a64f311af195a72b9267471dd3f1f545598720eec66c | Python | 16,728 | 453 | """Bycycle class objects."""
import warnings
import numpy as np
from neurodsp.plts.utils import savefig
import pandas as pd
from bycycle.features import compute_features
from bycycle.group import compute_features_2d, compute_features_3d
from bycycle.plts import plot_burst_detect_summary
from bycycle.burst.utils impo... |
984fc685b22e881462fb55f5cd4472f2a98e231b31937f29b93ba49210f45ef9 | Python | 16,743 | 463 | """Abstract base class for the Keras neural network classifiers.
The reason for this class between BaseClassifier and deep_learning classifiers is
because we can generalise tags, _predict and _predict_proba
"""
__all__ = ["BaseDeepClassifier"]
import os
from abc import abstractmethod
import numpy as np
from skbase.... |
aaa420e527756b9e28aacbe80fdd12eff123c5f147aa47c07ba3dc5cfa0f347f | Python | 16,743 | 342 | from typing import List, Tuple, Dict, Iterable
from pathlib import Path
import math
import os
import numpy as np
import torch
import matplotlib.pyplot as plt
try:
import cv2 as cv
except ImportError:
raise ImportError("importing cv2 failed -> please install opencv-python (cv2) "
"or use... |
b31e6bf1bfd5bf4fea3bebbb1b011a04b47eeae17a204944824a9fc5d9f60dda | Python | 16,762 | 365 | """Extension template for forecasting metrics (hierarchical).
Purpose of this implementation template:
Quick implementation of new estimators following the template.
This is not a concrete class or Base class to import!
Use this as a starting template to build on.
How to use:
- Copy the template t... |
c216dabcefd19f58999746019f43115873b28a26adfcf8d4af3b01bbe55ca766 | Python | 16,767 | 346 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Extension template for transformers, SIMPLE version.
Contains only bare minimum of implementation requirements for a functional transformer.
Also assumes *no composition*, i.e., no transformer or other estimator components.
For advanced cases (... |
61fd3ff73c44eda3528fb9881d1b9c9f1d36ce723dd8a901aea76995596ba99f | Python | 16,781 | 551 | # 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... |
5942c87a210d6e13bd34f47e40b2bb800e68152091b03cc69ed1e2f37bfef8ca | Python | 16,792 | 405 | from __future__ import annotations
import argparse
import json
import random
import re
import time
from pathlib import Path
import numpy as np
import torch
from scipy import sparse
from torch.utils.data import DataLoader, TensorDataset
from .data import choose_input_genes, load_dataset, normalize_log_cpm
from .metri... |
86608f1afc287a7aaa6beef2f63d62b9a6f8f6e00fb6f68dbab899caedb5ebc6 | Python | 16,820 | 331 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 11 14:14:48 2017
@author: tpisano
"""
import os, numpy as np
import tifffile
import matplotlib as mpl
from tools.imageprocessing.orientation import fix_orientation
from tools.registration.transform import count_structure_lister, transformed_pnts_t... |
3cfd3edfe4de80041415120392e27540d70de19bad1dbc74714be3b3cab39259 | Python | 16,833 | 424 | # 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... |
2b77f404209ea3c4437758a7e64a7b01534250293b6855838aa7b5509842b08a | Python | 16,843 | 412 | """Epoching nodes"""
import numpy as np
import pandas as pd
import json
import xarray as xr
from timeflux.core.node import Node
from timeflux.core.exceptions import WorkerInterrupt
from timeflux.helpers.port import match_events
class Samples(Node):
"""Fixed-size epoching.
This node produces equal-length epo... |
3be21bb0bb87920d92126491d8a626f15f6bd879fb8c6087de039fb694adcbc9 | Python | 16,848 | 447 | # 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... |
41367ee525c76aa270dc1476c5f8b89b3dbec56f4290a960fa11acf6609dc6d1 | Python | 16,855 | 501 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Base class for data types."""
__author__ = ["fkiraly"]
from sktime.base import BaseObject
from sktime.datatypes._base._common import _ret
from sktime.utils.deep_equals import deep_equals
from sktime.utils.dependencies import _isinstance_by_nam... |
e311f3b6431a98e3fc1f8982d4409f394c3fbc0528b7457bd1ca3d3ac3deb0b9 | Python | 16,862 | 427 | """Machine type checkers for Series scitype.
Exports checkers for Series scitype:
check_dict: dict indexed by pairs of str
1st element = mtype - str
2nd element = scitype - str
elements are checker/validation functions for mtype
Function signature of all elements
check_dict[(mtype, scitype)]
Parameters
--------... |
e18be9e1d4d412080636a3a2219308a7e1f48a78dd3fcd53fd04882d2b497e82 | Python | 16,871 | 458 | import shutil
from pathlib import Path
import json
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from sklearn.metrics import roc_curve, auc, precision_recall_curve, log_loss
class ResultManager:
"""Utility object for computation and saving of results.
Saves raw predictions, cal... |
a35644c2e3f7f612ee1021e5129ec8871bc31bb35f5ec0b6b819043acdd27ca6 | Python | 16,876 | 579 | """Example generation for testing.
Exports examples of in-memory data containers, useful for testing as fixtures.
Examples come in clusters, tagged by scitype: str, index: int, and metadata: dict.
All examples with the same index are considered "content-wise the same", i.e.,
representing the same abstract data objec... |
0176c965da9b76d7427b5ada71007907d956f30bf80f30bc4d6da47f8be6efe4 | Python | 16,879 | 422 | """Multivariate time series transformer (PyTorch) classifier."""
__authors__ = ["gzerveas", "geetu040"]
__all__ = ["MVTSTransformerClassifier"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.mvts_transformer... |
c6481a6e4e77ad18ccb23e1bbea80be763298c2d7f1bbfd80fc77c68b9abba59 | Python | 16,891 | 419 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import sys
from copy import deepcopy
from typing import TYPE_CHECKING, Any
import onnx
from onnx.backend.test.case.test_case import TestCase
from onnx.backend.test.case.utils import import_recursive
fr... |
bc0fbcbf8592fc64b1ddebd929a92d083f89dc09850952ebc76a6389921db25b | Python | 16,894 | 370 | from __future__ import print_function
from neuron import h
from .terminal import Terminal
from ..util import random_seed
# utility class to create parameter lists...
# create like: p = Params(abc=2.0, defg = 3.0, lunch='sandwich')
# reference like p.abc, p.defg, etc.
class Params(object):
def __init__(self, **kw... |
9b75dd36eb5bead3934dce6ed60343b8e441df6fcb3538d69147263d20d712fd | Python | 16,899 | 281 | """Retrain unchanged IsoBudget v2 on the separately versioned coverage repair.
Old checkpoints/results/code are untouched. Fixed old evaluation clusters are
used only by metrics, not by the model. Large prediction arrays are disk-backed.
"""
from __future__ import annotations
import argparse
import copy
import gc
imp... |
f7c7d2bb5c6c095fc4266b6be0804753e3b6d776878fdfbb1f9c15f878a7c283 | Python | 16,904 | 441 | #!/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file).
"""Implements forecaster for applying different univariates by column."""
__author__ = ["GuzalBulatova", "mloning", "fkiraly"]
__all__ = ["ColumnEnsembleForecaster"]
from sktime.base._meta import _ColumnEstimator
from s... |
41dbec0ad3b20310c8b244870faab50e931428ffe8542218c85a911901a38d7d | Python | 16,915 | 456 | """ColumnEnsembleClassifier: For Multivariate Time Series Classification.
Builds classifiers on each dimension (column) independently.
"""
__author__ = ["abostrom"]
__all__ = ["ColumnEnsembleClassifier"]
from itertools import chain
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncode... |
a00ce1ec64493732f0d3a8427d0ec123a91d4c8fd24a349c58d399078290016a | Python | 16,955 | 471 | import math
from pathlib import Path
from typing import Optional, Union
import torch
from torch import logsumexp, nn
from torch.optim import Optimizer
import flair
from flair.data import Dictionary
from flair.nn.recurrent import create_recurrent_layer
class LanguageModel(nn.Module):
"""Container module with an ... |
0f72a03e39c34b9bc3ecb84ade578a08eeb60f2e3168b04565036ff82c3ecae9 | Python | 16,973 | 554 | # 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... |
8f089403f9f09b4d743866b957dbfb8b464aa1111bdbb4210a6cf633be46ecf9 | Python | 16,980 | 433 | """Very few interface defining base class definitions"""
from __future__ import absolute_import, division, print_function #, unicode_literals
import warnings
try: from .optimization_tools import EvalParallel2
except: EvalParallel2 = None
del absolute_import, division, print_function #, unicode_literals
class EvalPar... |
19a0e1feb5e559b15ca3daea75619a46eb18fad0ab4b492285796357a7f1b714 | Python | 16,996 | 395 | # 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
#
# ... |
c84c8db6edd9324b4da9f1d2d95bad4ee6109563553e7d72176101810a0a9bb0 | Python | 17,003 | 482 | import yaml
import os
import csv
import networkx as nx
import json
import sys
import pcl_id_factory
from dendrogram_tools import tree_recurse
TAXONOMY_DETAILS_YAML = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'../dendrograms/taxonomy_details.yaml')
EXPRESSIONS = "... |
79107d39c893a17a349f04735f5ba4091e25a6871bed62b8af3c64165174ccb8 | Python | 17,005 | 525 | import itertools
import numpy as np
import pytest
from seaborn._core.subplots import Subplots
class TestSpecificationChecks:
def test_both_facets_and_wrap(self):
err = "Cannot wrap facets when specifying both `col` and `row`."
facet_spec = {"wrap": 3, "variables": {"col": "a", "row": "b"}}
... |
f3a91023ea9dfa99ee47b87ad6de90f28eb4b1548471c0856f9ef46fe8d6dda8 | Python | 17,006 | 558 | import argparse
import numpy as np
import torch
def parse_data_settings(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
parser.add_argument(
"-j",
"--jet-type",
type=str,
default="qcd",
help="Jet type to train. Options: ('qcd', 'g', 'q', 't', 'w', 'z').",
)... |
375ee918ba8d10bb1abdac25797699ab56eaee13267ce13e182f2b3ea9734c0d | Python | 17,017 | 441 | from typing import Optional, Tuple, Union
import torch
import numpy as np
import matplotlib.pyplot as plt
import os.path as osp
from utils.utils import make_dir
from .utils import (
get_p_polar_tensor,
get_p_polarrel_tensor,
get_stats,
NUM_BINS,
PLOT_FONT_SIZE,
DEVICE,
)
import scipy.optimize as... |
b3c580a44b50927ee7203373cf21e9e5d664d0d9f20ce090b0ed159baa5e6b19 | Python | 17,023 | 423 | import csv
import sys
import logging
import time
import argparse
import os
import pickle
import numpy as np
import rdkit
import random
import multiprocessing
import torch
import torch.nn as nn
import pandas as pd
from rdchiral.main import rdchiralReaction, rdchiralReactants, rdchiralRun
from torch.utils.data import Da... |
e8af6ea5fa4a7ed5f6bbfb791422998322715a6a99fabf40ae47e596802cde14 | Python | 17,032 | 409 | import logging
import scipy.stats
import numpy as np
from .. import data
class Population(object):
"""
A Population represents a group of cell all having the same type.
Populations provide methods for:
* Adding cells to the population with characteristic distributions.
* Connecting the cel... |
c462fa8d3dba8e32acd94b773ca49aa91736fa00d7e0707392c1d876b383e1ab | Python | 17,051 | 577 | #Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#This program is free software;
#you can redistribute it and/or modify
#it under the terms of the MIT License.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHA... |
7a82eabdd8f490a0cb2fd25ae7d6f2d1fd48418b81516c2208546b4871963775 | Python | 17,056 | 495 | """WEASEL+MUSE classifier.
multivariate dictionary based classifier based on SFA transform, dictionaries and
logistic regression.
"""
__author__ = ["patrickzib", "BINAYKUMAR943"]
__all__ = ["MUSE"]
import math
import numpy as np
from joblib import Parallel, delayed
from scipy.sparse import hstack
from sklearn.linea... |
a0ba1825e2af5e3cc8889c95e6225f5c6233bf003fb4b1eeae03353016ad48f1 | Python | 17,067 | 448 | import os
import pprint
import unittest
import pytest
import orthauth as oa
from pyontutils import sheets
from pyontutils.config import auth
# TODO move some of this to orthauth directly
# no SCOPES
# bad path
# no path/path is null
auth_config = {'auth-variables': {'google-api-store-file': None,
... |
09fb25499a42dacc9234f3710dae7bc85173795d7a7f49d7c1f8aa7b024645e2 | Python | 17,078 | 440 | #!/usr/bin/env python
# Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
from collections import defaultdict
from typing import TYPE_CHECKING, Any, NamedTuple
import numpy as np
from onnx import defs, helper
from onnx.backend.sample.ops impo... |
d3ff353ff3185288545347c550c69aeb07e6aedb77905b93839fab138bac7b20 | Python | 17,088 | 456 | # 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
#
# ... |
30aa9bd804ffe6a8f5bbbd5183303ac966838f93d031a0673d36002e36d7c6e3 | Python | 17,093 | 286 | # process Tayside brain imaging reports with SemEHR outputs and link to ORDO, ICD9 for coding comparison, also generate samples for validation
# input: some settings, original full Tayside data, SemEHR processed Tayside brain imaging reports
# output: (i) dataframe (.pik) and (ii) excel sheet containing UMLS, ORDO, I... |
a388cb9ed0fd8d145aa39763a89a45a01f052591ac1da76ccdfce9ff6d02ca5a | Python | 17,097 | 424 | # 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... |
add4196440f89d3d5cd55b76d2b4db3f8955f66da6f61994805f7a89e97d89dc | Python | 17,099 | 459 | import datetime
import logging
import math
import random
import time
from collections.abc import Iterable
from pathlib import Path
from typing import Any, Optional, Union
import torch
from torch import cuda
from torch.optim import AdamW, Optimizer
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.optim... |
adf1633e4200df0deb1e5c92e2b1adfaf4d0d1bdf9091aa52d5f87542516593c | Python | 17,111 | 585 | # 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... |
4f53596af4b86a5d4150e1bcf694afea219a0054b90091914454b36f0c662baa | Python | 17,113 | 443 | from typing import Optional, Tuple, Union
import torch
import numpy as np
import matplotlib.pyplot as plt
import os.path as osp
from utils.utils import make_dir
from .utils import (
get_p_polar_tensor,
get_p_polarrel_tensor,
get_stats,
NUM_BINS,
PLOT_FONT_SIZE,
DEVICE,
)
import scipy.optimize as... |
8f7d86eeab47b545efab9c57602c13d2e07085452d774ff08226359b7ce0e256 | Python | 17,165 | 322 | import numpy as np
from .muse_architecture import structured_embedding
from scipy.spatial.distance import pdist
import phenograph
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
""" Model fitting and feature prediction of MUSE """
def muse_fit_predict(data_x,
data_y,
... |
62fd3b2c896de728a0c3eb9b585abcf611e7b22bd3eddca6602b024deed6bbd2 | Python | 17,167 | 461 | # 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... |
dc241442eb4b7b2b8c4b9e6b00a8955f33861007fa1b024fe0644be43eb36fe4 | Python | 17,175 | 295 |
"""
Script for performing decomposition to compute predictor contributions and nonlinearity metrics
"""
import os
from os import path
import utilities
from taylorDecomp import taylor_decompose, d2ca_dr2, complexity_scores
import h5py
import numpy as np
from multiprocessing import Pool
import multiprocessing as mp
fr... |
566ab8fcafb4decbafc5c957ef87c92bf657e571ded4bb447ed06f179b16a6c5 | Python | 17,198 | 608 | """Standalone module to compute and plot critical difference diagrams."""
__author__ = ["SveaMeyer13"]
import math
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
def _check_friedman(n_strategies, n_datasets, ranked_data, alpha):
"""Check whether Friedman test is significant.
... |
2760e27e1e53bd7160ec4e0ab36945146fcaa9f2fc5be28f287241282862a303 | Python | 17,202 | 439 | # 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
#
import tensorflow as tf
# Precision for floating point comparison
COMPARISION_... |
ffb3a924f10420fc5025591ae272790b4d122a4d517a4a07e7ebf365b958b9f6 | Python | 17,203 | 452 | '''
Copyright (C) 1995-2004, Christopher Torrence and Gilbert P.Compo
Python version of the code is written by Evgeniya Predybaylo in 2014
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is withou... |
3d75d8640aa688aa76b681f401ac397ed3bf377e4e1bbeb751ee5b10c90dad8a | Python | 17,226 | 447 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
import torch
import torch.nn as nn
from mmcv.cnn import (Conv2d, build_activation_layer, build_norm_layer,
constant_init, normal_init, trunc_normal_init)
from mmcv.cnn.bricks.drop import build_dropout
from mmcv.cnn.bricks... |
15b170eb1c0f87317990332257bef3f99c07a927e70c11fbbfd349c794e0d6a7 | Python | 17,246 | 430 | import math
import torch
import torch.nn as nn
import torch.nn.init as init
from torch import Tensor
from torch.nn.parameter import Parameter
from spikingjelly.clock_driven import functional, surrogate, neuron, layer, rnn
##############
# ANN BLOCKS #
##############
class BilinConvUpsampling(nn.Module):
"""
... |
84f1e313b7bc7b7fd59d4f999c07d4b299cee1439072ff268fab7b8dfb47ccbd | Python | 17,248 | 423 | """
Helper functions.
"""
from dataclasses import dataclass
import csv
from scipy.spatial.distance import squareform
from scipy.sparse import coo_array
import itertools as it
import math
from typing import Iterator, Iterable, Optional, TypeVar, Generic
from sklearn.neighbors import NearestNeighbors
import le... |
8650f03e6d4258963cb8d55e767e7d8aab572e32fcc3a1dde37f491041f9f80b | Python | 17,252 | 579 | # 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... |
470fe6e2fea528b2343130b2d1394a8a3ab4414956a050ffeaae37f16fe23406 | Python | 17,263 | 427 | """
Functions for sampling points from a triangular mesh
"""
from __future__ import annotations
import os
import sys
import csv
import numpy as np
import numpy.typing as npt
import potpourri3d as pp3d
import networkx as nx
import networkx.algorithms.shortest_paths as nxsp
from scipy.spatial.distance import squareform,... |
6858d12fa709579b23cd2ce4ed946d7c84d8bae41c24ec73b86b19168cd27845 | Python | 17,276 | 463 | # Copyright (c) OpenMMLab. All rights reserved.
from copy import deepcopy
from typing import Sequence
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import build_norm_layer
from mmcv.cnn.bricks.transformer import FFN
from mmcv.cnn.utils.weight_init import trunc_normal_
from mmcv.r... |
d07baefcc7368049c72c6ef444d2f373b5376a329f0db8364ded106897180ede | Python | 17,290 | 437 | # 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... |
ff671927ff7f4fb9a536519f27d3caeafec07dc6ac8ed31ed487c613e5cb13df | Python | 17,290 | 420 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
import torch
import torch.nn as nn
from mmcv.cnn import (build_norm_layer, constant_init, kaiming_init,
normal_init, trunc_normal_init)
from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention
from mmcv.runner impo... |
52f598c3d9510f8b3bbb1358ee5afef03d665a575b2ab3410c950ee86851cd4b | Python | 17,297 | 492 | # 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... |
111b1c5145935fcac65d68d2fbade15431f3d45ecbc24691518ad348dc9fc1b7 | Python | 17,311 | 521 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten, johannvk
"""Pruned Exact Linear Time (PELT) changepoint detection algorithm."""
__author__ = ["Tveten", "johannvk"]
__all__ = ["PELT"]
from dataclasses import dataclass
import nump... |
a44f2ae1dbb9d844ed23bc160372b18943b2443d2a45babffcb1b6f02d285ab4 | Python | 17,321 | 362 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
"""Run project"""
impor... |
a1ff642ed6169cf097d6d9d4c53cbb8c5f25123ec11259bc824df6bcc9c15c54 | Python | 17,329 | 421 | """
Functions for sampling points from a triangular mesh
"""
from __future__ import annotations
import os
import csv
import numpy as np
import numpy.typing as npt
import potpourri3d as pp3d
import networkx as nx
import networkx.algorithms.shortest_paths as nxsp
from scipy.spatial.distance import squareform, cdist, eucl... |
2ee9cfedafc04e0253f4cc4527027225b5ba3f4eb3377c60f04976368767a317 | Python | 17,337 | 386 | """Extension template for series detection - outliers, changepoints, segments.
Purpose of this implementation template:
quick implementation of new estimators following the template
NOT a concrete class to import! This is NOT a base class or concrete class!
This is to be used as a "fill-in" coding template... |
9235a1ffa094875b0198e68a8e99fd0a9262651389cd828e4f7ead5f264f8d4b | Python | 17,341 | 548 | import torch
import torch.nn.functional as F
from statistics import mode, mean
class SaveValues():
def __init__(self, m):
# register a hook to save values of activations and gradients
self.activations = None
self.gradients = None
self.forward_hook = m.register_forward_hook(self.ho... |
81dc1de74380161bcc0d4a9170ef3d66ac616f3b684e779d49b4779b877053c2 | Python | 17,356 | 436 | import time
import argparse
import pickle
import os
import datetime
import torch
import torch.optim as optim
from torch.optim import lr_scheduler
from utils import *
from modules import *
parser = argparse.ArgumentParser(
'Neral relational inference for molecular dynamics simulations')
parser.add_argument('--num-r... |
6c7a64629e143c931277e783f0ef5622ff7ae85c6895039ce365a267463ec75a | Python | 17,360 | 499 | # 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... |
9d49ed0d4e43ac8214cea344623b9cfe9bb27c1106d866680f8364752f7ec8d3 | Python | 17,375 | 449 | # Copyright 2019-2021 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
#
import numpy as np
from ..datasets import NumpyDatasetAdapter
import logging
lo... |
210be27e0608b6c4348cf9ceebedf91c2b0e19927b3c2d344c26a864bc68bf01 | Python | 17,402 | 537 | # SPDX-License-Identifier: LGPL-3.0-or-later
import logging
import os
import queue
import time
from collections.abc import (
Iterable,
Iterator,
)
from functools import (
cached_property,
)
from multiprocessing.dummy import (
Pool,
)
from threading import (
Event,
Thread,
)
from typing import (
... |
444fe64ee286e7af2c7923e2c58261b38a77640dcd61d971e58821ceebec3fd7 | Python | 17,431 | 503 | # 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... |
5ed524ce7eab4c7e149540b7aabb25a261426e2501f5aa7c499069133f8ef962 | Python | 17,445 | 444 | """
simulation_utilities.py
This module provides the core behaviorual simulation described in the paper
(perform_runs()). There are subroutines for noisy dances and computing statistics
for each agent.
"""
import numpy as np
import test_utilities as testutils
from extended_ring_model import *
from dict_key_definition... |
9e6c647738a5f5949e1a3c5ae2c93865efbabb119899b8f02319f7fa5d0d8625 | Python | 17,452 | 458 | # SPDX-License-Identifier: LGPL-3.0-or-later
from abc import (
ABC,
abstractmethod,
)
from collections.abc import (
Callable,
)
from typing import (
Any,
NoReturn,
)
from deepmd.common import (
j_get_type,
)
from deepmd.dpmodel.array_api import (
Array,
)
from deepmd.utils.data_system impor... |
55d559bb999913c081e4c6c4edad058ecd20698185682d63a2a4ccf60dfffea6 | Python | 17,453 | 443 | # 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... |
53aa91bf51fe8f1fb2a15a74d538251b1a703e504a18bde0ffb35217c2993119 | Python | 17,456 | 384 | import os
from torch import cuda, device
from torch import save
import torch
import sys
import importlib
import logging
import pandas as pd
import process_features
import utils
import attention_setting
import pickle
from skorch import NeuralNetClassifier, NeuralNetRegressor
import attention_model
from sklearn.model_sel... |
4193e1a0c1d96db0a890a185c2c9b6dc27950154611adbce3b778d19c193980b | Python | 17,486 | 468 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner.base_module import BaseModule
from .helpers import to_2tuple
class PatchEmbed(BaseModule):
"""Image to Patch Embedding.
We use a conv layer to implement P... |
9f1305af6b8d762aa15ffcbcf5c1881f3ba2f8f827f15e4617cf9306a2b7db90 | Python | 17,491 | 294 | from IPython.core.debugger import set_trace
import numpy as np
import scipy.interpolate
import tensorflow as tf
import matplotlib.pyplot as plt
from matplotlib import cm
import os
### Define a custom plotting function
class custom_plot:
def __init__(self, true_y, y_no_nn, z, t, figsave_dir, args, restart = 0... |
1226440d1e5cef825c4a76a8a6d4f1a777014f1086457e47845fa45c0dc92a70 | Python | 17,493 | 446 | # 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... |
c4fa13599b1ab92fdb8fa640bfb339dc0af593ff0ccbb63676808c4f3193b513 | Python | 17,495 | 485 | import matplotlib.pyplot as plt
import numpy as np
from typing import List, Dict, Set, Tuple, Iterable
import networkx as nx
import ast
from scipy.ndimage import binary_erosion
from CGAL.CGAL_Kernel import Point_3, Vector_3, Point_2
from CGAL.CGAL_Point_set_3 import Point_set_3
from CGAL.CGAL_Polyhedron_3 import Polyhe... |
d0230300b4726345831e5c372d915acdde4725693250cd1908e1f11b36faa74a | Python | 17,497 | 498 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 17 17:35:46 2022
@author: sudhanshu
"""
#For prediction specific
import torch
import numpy as np
from utils import (
load_checkpoint,
dice,
)
import sys
sys.path.append("..")
from data_util import load_npz_data_mask_, load_npz_data_protein_... |
c7aa8cc0f2c6ded73c80d8c6f988ca11ecbb23eb916bbca623bb41c63915ce96 | Python | 17,505 | 384 | #!/usr/bin/env python3
from pyontutils.config import auth
__doc__ = f"""Sync the scicrunch registry to a ttl file for loading into scigraph for autocomplete.
Usage:
registry-sync [options]
Options:
-u --user=USER [default: rin_reader]
-h --host=HOST [default: localhost]
... |
e2cf3fb962be02f4862c48275eaf5de7524e382e526be55af593d8951d602cab | Python | 17,507 | 464 | # 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... |
0d77334c7de2b560245eef6d29bc6610cae68cd80c723aadaee15323c700bffc | Python | 17,538 | 289 | import os
import pandas as pd
import numpy as np
import sys
sys.path.insert(1, "/Users/hyung/Research23_Network_Analysis/mBIN/Python/InvivoAnalysis/")
from LoadNetworkDataByID import LoadNetworkDataByID
from findPathCoM import findPathCoM
def pathLoadData(dataDir, NetworkDataGeneral):
"""This method will load Pat... |
ed4de686e69eb55a50ff5b3dfbc5237c1488bc7c12229149e4f92600e3866102 | Python | 17,552 | 396 | """
This file contains functionality related to applying Fused Gromov-Wasserstein
to SWC morphology reconstructions of neurons, the functions are specialized
for this purpose. For other applications such as images with multiple color channels,
see sample_seg.py.
"""
import numpy as np
import numpy.typing as npt
import... |
375f6045bc13cc14ced584cdf58279be498402158d15d863d5ee61ba692b0516 | Python | 17,554 | 544 | # 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... |
1f29f20e5d272bfb0fec65cd315139ea062c63ca9230f04ada972231beac6f78 | Python | 17,563 | 466 | # SPDX-License-Identifier: LGPL-3.0-or-later
import math
from typing import (
Any,
Optional,
)
import numpy as np
import torch
from deepmd.pt.model.descriptor.base_descriptor import (
BaseDescriptor,
)
from deepmd.pt.utils.nlist import (
nlist_distinguish_types,
)
from deepmd.pt.utils.utils import (
... |
6efde82c9fbafab1de14cb0433037441f821a7cde1d86cddbd969b328da1b0a0 | Python | 17,563 | 480 | # 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... |
0ee8313b267d3eaa5bda95692d74ec3cf62182c6dd7d89917ab15d3ca827b7eb | Python | 17,564 | 554 | # 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... |
07abb8635089df29463457d713782f2cad31b44bb43eeb3561d0eca9a6b8ecc2 | Python | 17,569 | 533 | #!/usr/bin/env python3
'''
Tools for standardized saving/loading a class or dictionary to a .hdf5 file.
Strings are saved as attributes of the file; lists of strings are saved as tab
delimited strings; arrays are saved as datasets. Dicts are saved as a new folder,
with data saved as numpy datasets. Other objects ar... |
3d2f7568e59edc98e11e8e57440290d70a80bc6a8bd5988b0bbc228dea5e258b | Python | 17,569 | 429 | # SPDX-License-Identifier: LGPL-3.0-or-later
r"""Reciprocal-space energy of latent charges in periodic cells.
For the charges :math:`q_i^c` of a periodic cell of volume :math:`V` and a
pair kernel :math:`K` with Fourier transform :math:`\hat K`, the energy of the
lattice of images,
.. math::
E = k_e \Big[ \frac{1... |
5ec73e78c09e647529a5b497e6e5eabee74000926e3fd9c749659faebc5918aa | Python | 17,619 | 500 | """Arsenal classifier.
kernel based ensemble of ROCKET classifiers.
"""
__author__ = ["MatthewMiddlehurst", "kachayev"]
__all__ = ["Arsenal"]
import time
import numpy as np
from sklearn.linear_model import RidgeClassifierCV
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
... |
5f1105dd76fb4d076f8313aff9cf4ea8c7c388a0accbc1b7770f386d95638d4b | Python | 17,622 | 521 | # 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 NonMaxSuppression(Base):
@staticmethod
def export_nonmaxsuppre... |
138d62a84dcb36098ea94dc45ef04a43aae6de5ce9681437e7cd1faf09662fb4 | Python | 17,643 | 509 | # 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... |
b2ca7191f10f90703ba9fc4a1a3c5723e841e0f3a390d6c5c5ab79eeb5f91e2d | Python | 17,647 | 559 | """Final-format storage handlers for benchmark results.
Each `BaseStorageHandler` subclass implements the strategy for a
specific output file format (JSON, CSV, Parquet). The appropriate handler is
selected by file extension via `get_storage_backend`.
Crash-safe incremental checkpoints during a run are not handled he... |
3949d48531ff63eecd8cdd3da58162270a9ad1cb72c4a5ac0b45d6d60f04ecd8 | Python | 17,668 | 256 | import pickle
import os
import datetime
from sp_data.data_utils import SPbinaryData
from train_scripts.cv_train_cs_predictors import train_cs_predictors, test_seqs_w_pretrained_mdl, train_sp_type_predictor,\
test_w_precomputed_sptypes
import argparse
import logging
def create_param_set_cs_predictors():
from s... |
632485a2f92e6948e88edc8d8a14a288ce191cdab1d153e66d1dccc0ce89e7c3 | Python | 17,684 | 486 | # 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... |
0fe44e2c1e7a85a1c99ea229fe412f5153ea725f7d14077c769e41a81488d07a | Python | 17,701 | 531 | '''
Individual sets up the Invidiuals for EVOLVE computation
Depending on context the individual is deepcopied or initalised.
.. codeauthor:: Nicholas Browning
.. codeauthor:: Simon Duerr dev@simonduerr.eu
'''
from __future__ import print_function
from builtins import str
from builtins import range
from builtins impo... |
00986bcea30659cbdba1b86e656039c7c362d642bd2bd97a4fe49529cb4dcba0 | Python | 17,708 | 537 | # 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... |
e51750ed494e7c4b673ffc161e4e48bb6b0c8ccdb80dc45c0bf59c1163ce054a | Python | 17,719 | 352 | import logging
from queue import Queue, Empty
import dill
import numpy as np
from bidict import bidict
from copy import deepcopy
logger = logging.getLogger(__name__)
class PolicySpec(object):
def __init__(self, policy_key, policy_class_name, policy_config_key, tags=None, payoff_matrix_index=None):
self.... |
49ae84ffc36ceadad4d3a8e1a348ef591605956736aa167f9ce501f33d8f2d8b | Python | 17,731 | 618 | #!/usr/bin/env python3
import rdflib
from rdflib import RDF as rdf, RDFS as rdfs
__all__ = [
'dc',
'dcterms',
'oboInOwl',
'owl',
'prov',
'rdf',
'rdfs',
'skos',
'npoph',
]
###
dc = rdflib.namespace.ClosedNamespace(
uri=rdflib.URIRef('http://purl.org/dc/elements/1.1/'),
ter... |
8c01883f8c45ed9b69bb70461bec41dca5e0858cdbd8c7e3b8c884cc96d06519 | Python | 17,734 | 523 | import time
import warnings
from functools import wraps
from typing import Literal, Optional, Union
import numpy as np
from beartype import beartype
from numba import njit
from ot import sinkhorn
from scipy.optimize import linear_sum_assignment
from scipy.sparse import csr_matrix
from sklearn.base import BaseEstimator... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.