sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
23718a8a1a58f2cdca72a1fe2a5e071d9c3ff7fa712ecdc7ce7dbc32184261ca | Python | 13,648 | 434 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 7 2023
@author: scanner1
Utility file for running both CAPSIF:V and CAPSIF:G in the notebooks and "predict_directory.py"
"""
#For prediction specific
import torch
import numpy as np
import os
import sys
import math
import py3Dmol
sys.path.append('... |
e6cade1cf793ecf89da8151d33a04ba9d33cbf76e4c4f67a4ea5595e2184bd97 | Python | 13,651 | 355 | """Delegator mixin that delegates all methods to wrapped forecaster.
Useful for building estimators where all but one or a few methods are delegated. For
that purpose, inherit from this estimator and then override only the methods that
are not delegated.
"""
# copyright: sktime developers, BSD-3-Clause License (see L... |
d83a6deaa60d1016a3e3cac5dac7d87652d1b3560184be501b6bd3f4d9242806 | Python | 13,656 | 370 | # SPDX-License-Identifier: LGPL-3.0-or-later
import logging
from typing import (
Any,
)
import torch
from deepmd.pt.model.atomic_model.base_atomic_model import (
BaseAtomicModel,
)
from deepmd.pt.model.model.make_model import (
make_model,
)
from deepmd.pt.model.model.model import (
BaseModel,
)
from ... |
bf299bed467dc28b0f6c71ad70d7b9dd6b1e7b2263b43036e6bfefe2744ec776 | Python | 13,668 | 279 | """
Main script for running inference on trained classification models.
Sample Calls:
python main.py --kit_id=BTNx --membranes_dir=../../data/btnx_field_membranes/ --output_name=btnx_mayo_eval
python main.py --kit_id=ACON_Ab --membranes_dir=../../data/aconab_membranes/ --output_name=aconab_eval
python main.py --kit_i... |
ef9185bc6886a903c7f3e49f588085b3d428b96463b7f01b546ae651225f4c40 | Python | 13,670 | 415 | # 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... |
1347718699c1261955cb76decdc412427a36c92d2739913dee437283b506b4ee | Python | 13,675 | 393 | import os
from openbabel import pybel
from multiprocessing import Pool
from tqdm import tqdm
import tempfile
class rewritePDB(object):
"""
Modify pdb file by changing atom indexing, resname, res sequence number and chain id
Parameters
----------
Attributes
----------
"""
def __init__... |
7d8069848ce6c12b4af86256d0fcb3d1ef9eb52bcd88cef7c7ddc4e204f41149 | Python | 13,676 | 315 | #!/usr/bin/env python
import sys
import os
import math
import re
import subprocess
#import pandas as pd
from os.path import isfile, join, isdir
from os import listdir
from kn_common import pipetools, pipedef
from kn_pipeline_class import CPipeError, CPipeStep
import json
import nibabel as nib
import numpy as np
import... |
cc3f5cb4ca08bc0eae9caf881c86d6ccd1287af33bac9d25e7d4b32cb7412c41 | Python | 13,679 | 359 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import copy
import math
import pkg_resources
import re
from pathlib import Path
import mmcv
import numpy as np
from mmcv import Config, DictAction
from mmcv.utils import to_2tuple
from torch.nn import BatchNorm1d, BatchNorm2d, GroupNorm, LayerNorm
from m... |
42b0ab11672794bca3949ecae72f44c21b5723ac04b6f7a99756c83c07609729 | Python | 13,702 | 312 | # ----------------------------------------------------------------------------
# Copyright (c) 2017-2026, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
8c54737dd5a5e3213f2bacde341ed9e899bbb56c4e6439f5057f6fa70b407576 | Python | 13,703 | 324 | import numpy as np
import argparse
import re
import random
import textdistance
from rdkit import Chem
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
def smi_tokenizer(smi):
pattern = "(\[[^\]]+]|Br?|Cl?|N|O|S|P|F|I|b|c|n|o|s|p|\(|\)|\.|=|#|-|\+|\\\\|\/|:|~|@|\?|>|\*|\$|\%[0-9]{2}|[0-9])"
regex =... |
4b59e021d6364a364263cbfbf6aa210c280c2ef3b8afbdb5b113cc03add74069 | Python | 13,708 | 305 | import bz2
import os
import pickle
import sys
from collections import defaultdict
from multiprocessing import Pool
import cv2
import numpy as np
import pandas as pd
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache
from tqdm import tqdm
from process_cell_data import get_center_x
mcc = MouseC... |
a8d1a6e741aee8af935311f851380e2720604184c99b74be0583acb081953a28 | Python | 13,717 | 350 | import tomopy
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage.interpolation import rotate
from scipy.ndimage import median_filter
import math
SAVE_AS_PNG = FALSE
def plot_two(img1, img2, figsize=(10, 6), titles=['', ''],
cmap=plt.cm.gray):
ax1 = plt.figure(figsize=fig... |
3917b6c627d69d8bcef1a0abb197b6c23b6f8989f8a94276597fee2813942c5c | Python | 13,722 | 342 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Device-resident O(N) neighbor-list strategy backed by ``vesin.torch``.
This provides a :class:`~deepmd.dpmodel.utils.neighbor_list.NeighborList`
strategy that replaces the historical all-pairs ghost expansion (~27*N images +
a dense ``[N, 27N]`` distance matrix) with a c... |
310c772e864372883802c1fc3d541ba82565aa97aebd80d0224aed0f4d9bd32b | Python | 13,724 | 352 | from __future__ import print_function
import numpy as np
from neuron import h
from .psd import PSD
class GlyPSD(PSD):
"""Glycinergic PSD
This creates postsynaptoc glycinergic receptors. Receptors are connected to the XMTR range
variable of the terminal release mechanisms.
Parameters
---... |
b23e1f8af9220c3d34ddcd17859d771b063c0630e6ab6d75384e8e0ad705c460 | Python | 13,724 | 310 | from __future__ import print_function
from freqAnalysisTools import band
from os import listdir
from os.path import isfile, join, splitext
import sys
import pickle
import math
import numpy as np
from itertools import groupby
from datetime import datetime, timedelta
import codecs
# import pyedflib
import importlib.util
... |
0c8bc1b51b021366ed9cc7b011d3c535cb8f56ad773aed96c08d80dd8369c414 | Python | 13,726 | 380 | """
This module was copied from the scipy project.
In the process of copying, some methods were removed because they depended on
other parts of scipy (especially on compiled components), allowing seaborn to
have a simple and pure Python implementation. These include:
- integrate_gaussian
- integrate_box
- integrate_b... |
20cf1f740c567e39da0e6f9ddbcabed3eb6d724cb0f9043daaa8806c0cfe4345 | Python | 13,739 | 446 | import torch
import numpy as np
from math import sqrt
from lgn.cg_lib import CGModule
from lgn.cg_lib import cg_product
from lgn.g_lib import GVec, GTensor
class ZonalFunctions(CGModule):
def __init__(
self,
maxdim,
normalize=False,
basis="cartesian",
cg_dict=None,
... |
fa98c74509d3afaa45f4fd5b807164a68a178c72ec8848ed11ceaff8713c20fa | Python | 13,739 | 310 | 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 CormorantDatasetLEP(Dataset... |
0064567d7fe21441206fbe900c6ede56dcac076c55df1be27776a971e1bc3977 | Python | 13,740 | 447 | import torch
import numpy as np
from math import sqrt
from lgn.cg_lib import CGModule
from lgn.cg_lib import cg_product
from lgn.g_lib import GVec, GTensor
class ZonalFunctions(CGModule):
def __init__(
self,
maxdim,
normalize=False,
basis="cartesian",
cg_dict=None,
... |
89c33d77c460c39f16f706a0e182fcada5efd29d6b478907fb8cdd9237f181e8 | Python | 13,752 | 499 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx import TensorProto
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.helper import make_tensor
class Quant... |
82e5a1c76fc42848bc4fe227e1c8f4b80c42e7cf816c7fc735fdc2ec61edc993 | Python | 13,756 | 407 |
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
from model import *
from utils import *
from torch_geometric.loader import DataLoader
from torch_geometri... |
e18357ddb8fdded8eb40248523bffe5949bd0c82c5c24d654024b8a703f58999 | Python | 13,758 | 304 | """
C6 -- theory-derived correction to GRPO that removes the pass@k crossing.
Goal (from C2): make the RL success distribution first-order stochastically
dominate the base, F_tau <= F_0, i.e. S-(G)=0 => Delta_k >= 0 for all k.
Sufficient microscopic condition: no prompt loses, p_tau(x) >= p_0(x) for all x.
We test ca... |
617a914cc0ec10f10b99fce7f6adc781745b16dee583f720198be2cca2bc49d3 | Python | 13,764 | 477 | # -*- coding: utf-8 -*-
"""This module contains second order section filtering routines
implemented in c, cffi and numpy.
A bilinear transform converting sos analog weights to
sos digital weights is provided by :func:`bilinear_sos`.
There are different implementations of sos filtering routines:
- A scipy.lfilter(... |
b51a345e7879714ad0bad045134aadb580182d9355c6878a7380b86f5a9088fe | Python | 13,767 | 376 | import os
import torch
from torch import nn
from torch.nn.parameter import Parameter
from typing import Dict, Optional, Type
from numbers import Number
from sns_toolbox.neurons import NonSpikingNeuron
from sns_toolbox.networks import Network
from sns_toolbox.connections import NonSpikingSynapse
import matplotlib.pyplot... |
e3dc2567523b231bd6a6177831a7d9e6efbca829b17fce80ef14881fbe6d2cbb | Python | 13,771 | 329 | # 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... |
805307169004528c9ccbf486196241b571dbc52997871d3c7cfbf091ed10bf02 | Python | 13,772 | 375 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""The Uni-Mol v1 pretraining head set, as a deepmd fitting.
Ported from Uni-Mol (https://github.com/deepmodeling/Uni-Mol) at commit 90f52c4,
MIT licensed:
Copyright (c) DP Technology
This source code is licensed under the MIT license found in the LICENSE
file ... |
7f54455f316f8e0542f126b51a0a63d9eeab7db33031df3901842d6e74e604e5 | Python | 13,773 | 467 | # 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... |
53e15461b90afbebf90dbdf422eb87c639aadfa7997c09a38233cf4175898272 | Python | 13,777 | 355 | import os
import torch
import torchvision
import torch.nn as nn
from tqdm import tqdm
from torch.utils.data import DataLoader
from torch.distributed import all_reduce, all_gather, ReduceOp
from utils.func import *
from modules.loss import *
from modules.scheduler import *
def train(cfg, model, train_d... |
1505f9515ea7b84cec21038c89776262bc515a9a579633ff9a37af127e6237fb | Python | 13,780 | 323 | """LSTM-FCN classifier for time series classification in PyTorch."""
__authors__ = ["Faakhir30"]
__all__ = ["LSTMFCNClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.lstmfcn import LSTMFCNNetw... |
13c6d209ce7b8d7e2fac15a3b1e904d1d84d27950254301285df6c39e74ac1ba | Python | 13,790 | 382 | from argparse import Namespace
from typing import Iterable, Optional, Tuple, Union
from .utils import get_jet_name
from utils.utils import make_dir
import os.path as osp
import numpy as np
import matplotlib.pyplot as plt
import torch
from .utils import NUM_BINS, PLOT_FONT_SIZE
FIGSIZE = (12, 4)
LABELS_CARTESIAN_ABS_CO... |
2f6d07a56a70e52af31b97cb013c3864098f0fbd506b29a341e15a1b7d4f3df1 | Python | 13,798 | 363 | """Tests for bcblib.scripts.imaging_cli entry points."""
import json
import os
import subprocess
import sys
import numpy as np
import nibabel as nib
import pytest
def _make_nii(tmp_path, name="test.nii.gz", shape=(4, 5, 6), val=1.0):
p = tmp_path / name
data = np.full(shape, val, dtype=np.float32)
nib.s... |
e440e419058f4f0fd6a2d51cd6e01bb93f421f9fca5b3c08b83baed92d79b3c3 | Python | 13,802 | 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... |
176e7229da8cb4cf2b2ca63937c313c34da40129dcf8d8251597cc62ac3aa362 | Python | 13,812 | 427 | # 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... |
1a1c89347d1723c71f61e4589d1f5e95220cff6fc1890e609411b4796b579bdd | Python | 13,812 | 386 | """Utility functions for clusterings and embeddings
"""
from .__init__ import *
import igraph as ig
from scipy import sparse
from annoy import AnnoyIndex
from .basic_utils import create_logger
# major change in annoy functions 5/7/2019
def build_knn_map(X, metric='euclidean', n_trees=10, verbose=True):
"""X is ... |
dd155b390b13e8f3771dc7337fdf6371d9fd0262551d3e2b13ca4d4f92664c55 | Python | 13,814 | 386 | # 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 BitShift(Base):
@staticmethod
def export_right_unit8() -> None... |
eb55ee2589a372133195e6fe06eb5a5dad3b60dc963e53dc87efa9b30034a08f | Python | 13,822 | 373 | # 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... |
8e242fab5eab3eec8e10e66eac1f2bef1f08f4083755bb6f225df2ad895e1c63 | Python | 13,826 | 517 | import itertools
import pandas as pd
def seq_features(sequence, columns=False, single=False, promoter=None):
'''
Calculates selected features from input sequence.
:parameter sequence: 30-nt sequence(s) to calculate features.
:parameter columns: option to get the name of the features.
:parameter s... |
ae3a231271092855ba20c08d06ef84ea8dc0f43c278dda2b3d29141605a5bbe5 | Python | 13,826 | 434 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""pt realization of the canonical bridging composition (issue #5948).
The canonical config spelling is ``type: "linear_ener"`` with an
``inner_potential`` sub-model. The pt backend implements bridging inside
``SeZMModel``, so its linear builder maps the canonical form onto... |
a146d7e740489c1a4516a1b0e8fda21949cf4c0c1adb4fa46ee134802938e0ac | Python | 13,828 | 402 | from __future__ import print_function
import re
import os
import sys
import tempfile
import subprocess
import contextlib
import multiprocessing.pool
import dxpy
@contextlib.contextmanager
def set_env(**environ):
"""
Temporarily set the process environment variables.
>>> with set_env(PLUGINS_DIR=u'test/p... |
5e70450726590f82601ef126ea192bc489607fe24b14bc4dcab08c954c65f4d4 | Python | 13,839 | 347 | # SPDX-License-Identifier: LGPL-3.0-or-later
import copy
from collections.abc import (
Iterator,
)
from typing import (
Any,
)
import numpy as np
from deepmd.env import (
GLOBAL_NP_FLOAT_PRECISION,
)
def env_protection_descriptors(
descriptor: dict[str, Any], inherited_protection: float | None = Non... |
754af7df8896a4cd21024c22b5585055298e5926451a1ef192866bbf225475b7 | Python | 13,846 | 316 | import json
import pickle
from pathlib import Path
from typing import Dict
import numpy as np
import scipy.io as sio
import toml
from cplAE_TE.utils.tree_helpers import HTree, get_merged_ordered_classes, simplify_tree
def get_paths(warn=True, write_toml=False):
"""Get paths for all data used in the analysis.
... |
4bbfc7674919b7a37e55f87823fbac24752dee740305ddf8e9d36926d4602688 | Python | 13,848 | 435 | """
h_reader.py - Read hoc files
This module is part of *vcnmodel*.
Support:
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
Copyright 2019 Paul B. Manis
Distributed under MIT/X11 ... |
2abf1ed78bc5f8e79357a315152ceadba4ea4443e901d792b50ae42259c738fa | Python | 13,867 | 483 | # 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
#
# ... |
a571a27c37920e04c8ef1f4d7fbd19bb8c431732021792587704a3e928989354 | Python | 13,867 | 302 | """Task adapters for published networks, not claims of unmodified reproduction.
Upstream implementations live in pinned, unmodified ``third_party`` checkouts.
Only the prediction contract and modality-specific likelihoods are adapted.
"""
from __future__ import annotations
import ast
import importlib.util
import logg... |
42bc67c900eae1175c7e10f4c14bc46b8c1ad4cfeb24dcb37e9ae29ccbf8e5ea | Python | 13,884 | 268 | import numpy as np
from scipy.signal import find_peaks as find_peaks
### HELPER FUNCTIONS
def loss_biological(j1, j2, alpha1=1E-5, alpha2=1E-2):
"""Computes scalarized loss including genetic constraint and product production"""
loss = alpha1*j1 + alpha2*j2
return j1, j2, loss
def activation(x,... |
55ff99743a25a045b42e218f81a5a867c06dbf5dda2c07680641121cf9461468 | Python | 13,890 | 420 | # 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... |
d43a29259ac4c64f676f4a77713e87d933e8a3fed6959a43be239410617c2fb9 | Python | 13,892 | 288 | """
@file: rise_symbol.py
Created on 18.05.19
@project: CrazyAra
@author: queensgambit
RISEv2 - mobile
Updated model architecture of RISE optimized for CPU usage proposed by Johannes Czech 2019.
Additionally, it combines techniques presented in the following papers:
MobileNetV2: Inverted Residuals and Linear Bottlene... |
d84e8356473fb0b484c668a3fa35c2254a3fc46af2d5718227ada752464b00ab | Python | 13,893 | 288 | """
@file: rise_symbol.py
Created on 18.05.19
@project: CrazyAra
@author: queensgambit
RISEv2 - mobile
Updated model architecture of RISE optimized for CPU usage proposed by Johannes Czech 2019.
Additionally, it combines techniques presented in the following papers:
MobileNetV2: Inverted Residuals and Linear Bottlene... |
10e6a93c709684c4e775f9a2b49d87352bcb35bc67b9fbcd1438094d202d8bc7 | Python | 13,894 | 308 | import argparse
import csv
import logging
import multiprocessing
import os
import sys
from collections import Counter
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional, Union
import pandas as pd
import rdkit.Chem as Chem
from joblib import Parallel, delayed
from rdkit impor... |
63dff9e65256885596da32e819831ef6c2f535405ddcdff3d6958581c53c7d86 | Python | 13,896 | 355 | import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# import shap
from keras.models import load_model
# import PyNonpar
# from PyNonpar import *
import scipy as sp
# import seaborn as sns
import time
import numpy as np
# from scripts_tl import data_handler_tl as dh_tl... |
31c0e0c34e8343b16e83bc1e97208db23b9e6768c16b9de9013d4c1a673f0f2b | Python | 13,898 | 358 | 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_stats, NUM_BINS, PLOT_FONT_SIZE, DEVICE
from scipy import optimize
from scipy import stats
import logging
import jso... |
22d3c14c082e448be6b6c058e513d4bc6d476f2b9675b1f44dc045e5a9a705a1 | Python | 13,907 | 309 | import csv
import json
import logging
import nmslib
import os
import pickle
import scipy
import time
import torch
import numpy as np
import pandas as pd
from concurrent.futures import ProcessPoolExecutor as Pool
from pathlib import Path
from scipy import sparse
from typing import List, Optional, Tuple, Union
from torc... |
315bfb2541724192117e389f7165e82b34ffc86e87c68c53dd491da6d59d227c | Python | 13,913 | 329 | from __future__ import annotations
import math
from typing import TYPE_CHECKING
import numpy as np
from optuna._gp.thread_limiting import limit_threads_in_optimization
from optuna.logging import get_logger
if TYPE_CHECKING:
import scipy.optimize as so
import torch
from optuna._gp import batched_lbfgsb... |
6a2c61cc2c54375b351b42a66982200ff327b1ff9d148d0d43e44d631ebc5d51 | Python | 13,924 | 471 | """
Neuron electrotonic structure determination based on charging time
constants in response to a small current injection.
Model of the cell is the "somatic shunt" model (sse Ref 1).
References:
The implementation here is based on these works, but there is a much
larger literature (cited in these works).
1: White JA... |
6fb3cc52f014ab38c7c77de9412d92156239797e16f10a30603d8b079ff4b6dd | Python | 13,924 | 314 | #!/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/.
#
"""Create report with pr... |
ee2ce2ffa4f2b585cfc1275a25a1d586c694b3c12761ca0bb97b30092c427e70 | Python | 13,926 | 312 | """ Trainer for pretrain phase. """
import os.path as osp
import os
import tqdm
import json
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import transforms
from models.NetworkPre import FeatureNet
from utils.misc import Averager, count_acc, ensure_path, count_mem_... |
adb4043ea6bed05b9e0581071adac9ad3fc3e4981c5d1d702e1e355e8c7d94b3 | Python | 13,929 | 370 | # 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... |
078a2139114a31fb353e58b43595cd7083b9f6e056cced3da2b743344e036c08 | Python | 13,932 | 386 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
dfd0d4b5dec827878ed2661dd9a24bd02956acd1edfed4ee24094e9a4d1c2e8b | Python | 13,934 | 480 | # Copyright 2019-2021 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... |
0f2e37ccd569dd982ad5083a4ce2abc07106ea5e8e0ea474d600b8f405c08f3d | Python | 13,942 | 387 | import itertools
import os
import pickle
import re
from abc import ABCMeta, abstractmethod
from argparse import ArgumentParser
from collections import OrderedDict
class NotAToken(Exception):
""" We expected a single token, not multiple tokens """
class TransliterationNotUnderstood(Exception):
""" The websi... |
e43e3f7239b25630bd66bb191564ca56fa106acd07366ff964a84695820b59c0 | Python | 13,954 | 278 | 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,
... |
14d24009e385550535793f8e42bb4f85270a4f7f5ae97112afd8f98f1c6a9fdf | Python | 13,955 | 433 | # 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... |
1c382986a64f96655a3bcd20840f20492c7a69bd79ba918b2a333633f220c428 | Python | 13,966 | 294 | """
Script to build main file of data from reticulospinal backfills - note that this file has much less information
than what is stored for the main rwave experiments
Intended file information:
I RS Fit Neurons - only for neurons which were fit by the ann
<Neuron ID> <Barcode> <is RSpinal> <labelBrightness>
II RS Ne... |
944143b785858becad44b4f969eac1fb33eb8e95c1aa4c0d51ae65d5536c6b27 | Python | 13,974 | 308 | from __future__ import annotations
from collections import defaultdict
from itertools import combinations_with_replacement
from typing import TYPE_CHECKING
import numpy as np
from optuna.samplers.nsgaii._constraints_evaluation import _validate_constraints
from optuna.samplers.nsgaii._elite_population_selection_strat... |
4a7900e358b9e9500da776f08279b2a714625341b234efb1cba6675b5eb1c5ab | Python | 13,988 | 380 | """
Library of data augmentations for genomic sequence data.
To contribute a custom augmentation, use the following syntax:
.. code-block:: python
class CustomAugmentation(AugmentBase):
def __init__(self, param1, param2):
self.param1 = param1
self.param2 = param2
def __ca... |
5ce3882b069265088e0a42fe4fce6aca33e89e56223db73a07df90cae81cc4db | Python | 13,990 | 369 | # Copyright 2018-2026
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICE... |
1d215aa4fc6f884d2bd0395d7405ac050d9d80e30fb5a88e088c99b9eafd7daf | Python | 13,998 | 310 | """ Trainer for pretrain phase. """
import os.path as osp
import os
import tqdm
import json
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import transforms
from models.NetworkPre import FeatureNet
from misc import Averager, count_acc, ensure_path, count_mem_acc
fr... |
5def3de6d7ce699e3825e2e9e2b5de2727fa1182af685d65a18154c328ce9c66 | Python | 14,000 | 342 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import os
import sys
from collections import OrderedDict
class MaxPool3dSamePadding(nn.MaxPool3d):
def compute_pad(self, dim, s):
if s % self.stride[dim] == 0:
retur... |
784a3c2fc3e6f0ffa0ef4f1087a8b37fa2e0559894869d3b2cfefab1d22a6294 | Python | 14,035 | 562 | # 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... |
d424a54ac17d6b135091dc049ab35420dee6c0db3344cf9aefd1634e8d354496 | Python | 14,043 | 419 | #!/usr/bin/env python
__doc__ = """
3D U-Net.
(Optional)
Residual skip connections.
Kisuk Lee <kisuklee@mit.edu>, 2017-2018
Nicholas Turner <nturner@cs.princeton.edu>, 2017-2018
"""
import collections
from collections import OrderedDict
import itertools
import math
import torch
from torch import nn
from torch.nn i... |
f9e5d4dba2aad427f8a07e706ea71d391b2bde99c39990b03f8d5fa1214bc957 | Python | 14,043 | 380 | # -*-coding:utf-8-*-
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
from torch.autograd import Variable
import math
import sys
import numpy as np
import os
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=... |
5bc285513432b44db479db8a9fc44cab159eacbaaa006301adcbc69b2676afdc | Python | 14,051 | 307 | """Extension template for clusterers.
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.
How to use this implementation templat... |
ecf424dddc5ab074ca3eae4016c5b93a6b29e02269c64378deaaaf5c4d4e5f3c | Python | 14,055 | 311 | from pathlib import Path
import rdflib
from collections import defaultdict
from pyontutils.core import Collector, resSource, ParcOnt
from pyontutils.core import makePrefixes, makeGraph
from pyontutils.core import OntGraph, map_term
from pyontutils.utils import Async, deferred, rowParse
from pyontutils.config import aut... |
368992c0bbe6f8a46851f25bef5e5169351cef02fd953564efca1ac3709f1416 | Python | 14,070 | 397 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numbers
from typing import ClassVar
import numpy as np
from onnx.reference.op_run import OpRun
from onnx.reference.ops.op_resize import _get_all_coords
class _CommonGridSample(OpRun):
"""S... |
96b69ef568a6e30a5e150155facba566d562e1d4318d555b17df3961e183799b | Python | 14,081 | 314 | import logging
from pathlib import Path
from typing import Any, Union
import torch
from deprecated.sphinx import deprecated
import flair.nn
from flair.data import Dictionary, Sentence, Span, Token
from flair.embeddings import TokenEmbeddings
log = logging.getLogger("flair")
class TokenClassifier(flair.nn.DefaultCl... |
a88a034f24827b506106b1cc20f5016d52c5eeec95452953b1329733b3e695c3 | Python | 14,085 | 415 | '''
MoleculeCreator.py
Contains a few key functions for performing mutations specifically on proteins. Extensions to more general molecules should be straightforward to implement based on the code here.
.. codeauthor:: Nicholas Browning
'''
from __future__ import division
from __future__ import print_function
from __... |
ef81d1b1df4f77c0fa810d6fb6948ec046c9df3814a8e9682e36409647d97418 | Python | 14,087 | 416 | # 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... |
031b51e37c46e22d615173666a5e05fe0e56290a3f03566d5b89788ec7f7a7aa | Python | 14,108 | 389 | # 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... |
8b9f4a18b7606930441a1bc4f0ef47f63d42ad07c04311a2c4857de91cbb9f10 | Python | 14,111 | 470 | """Orchestration for the transcriptome distance calculation."""
from dataclasses import dataclass
import logging
from multiprocessing import Pool
from typing import Optional, Sequence
import numpy as np
from ..fileio import PathLike, read_fasta
from .align import (
AlignedPair,
align_pair,
count_gaps,
... |
c1932a8af4c6b0bd64a1821a6a5796276a2805d1f42bbd576714d71d3975ab5c | Python | 14,124 | 346 | # 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
import pytest
from sklearn.cluster import DBSCAN
from amplig... |
ae88127d8c8a5f6a9de6d592c3ab66664f9c10c8f4233289412cbf34fbd4a8ec | Python | 14,142 | 416 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Abstract base class for unsupervised sequence aligners.
This covers both pairwise and multiple sequence aligners.
class name: BaseAligner
Scitype defining methods:
fitting - fit(self, X, Z=None)
get alignment (iloc) -... |
f41cff8bd7f2643be0c74fc79dd85b7503a0592bb6ad557383ed6d97d1f4dcac | Python | 14,147 | 539 | # 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... |
880b7efd1a15b1dad0cd0ccde4f74840d4c05f89683d2b97c9500c1094b67332 | Python | 14,157 | 390 | # Copyright 2018-2026
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICE... |
038b0f2d56fec11adcf96bf8a53b8156dfacb253ac8099d1d9302a191750d455 | Python | 14,161 | 386 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 21 18:44:37 2021
Lesion simulations and plotting
@author: robert.mok
"""
import os
import sys
import numpy as np
import torch
import matplotlib.pyplot as plt
import itertools as it
sys.path.append('/Users/robert.mok/Documents/GitHub/multiunit-clu... |
238177a9a90ace4374d25d269b680d3a767704e1241ea1272099034ab509d15f | Python | 14,167 | 388 | """Compute burst features for individual cycles."""
import numpy as np
import pandas as pd
from bycycle.utils.checks import check_param_range, check_param_options
from bycycle.burst import detect_bursts_dual_threshold
###################################################################################################... |
b8e3f1342cb7b3756a947eb8658a2d3d8f6321a61e4cef374b8a761cf06ccc35 | Python | 14,167 | 227 | # this program calculates
# (i) the mention-level rare disease phenotype extraction (precision and pseudo-recall)
# (ii) the final patient-level ORDO concept extraction results by aggregating the mention-level predictions
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusi... |
79cc35a4788022a4055b305aa3031908a98159efb1766a6190032ce1ca9e648c | Python | 14,170 | 314 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python codes for 'Causal Discovery with Reinforcement Learning', ICLR 2020 (oral)
Authors: Shengyu Zhu, Huawei Noah's Ark Lab,
Ignavier Ng, University of Toronto (work was done during an internship at Huawei Noah's Ark Lab)
Zhitang Chen, Huawei Noah's... |
7418b30959af22bbee0a9c1457f0a9476adfb41e02cc7b388790c483a805d68e | Python | 14,178 | 281 | # -*- coding: utf-8 -*-
"""
Same thing as Clutter_runSFA but for when there is clutter in both the training and testing set
"cocktail party problem"
@author: ronwd
"""
import numpy as np
import soundfile as sf
import pyfilterbank.gammatone as g
from sklearn.linear_model import SGDClassifier
from tqdm import tqdm
f... |
524d18558e3a98ea37bb77ecc0df972acabf8dbf6f5b7e2cc96f6411f65efc6d | Python | 14,181 | 358 | # 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... |
006a58e42f2945e828d929ab155b11714539fd1f8ed560bd31293a6c036d1b12 | Python | 14,185 | 375 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Sequence
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
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.runner.base_... |
06aeec9ef9f36c03aa2fbe47dc17a964fb25442e7492f9e92ae7e0198ed81f21 | Python | 14,209 | 435 | import functools
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_array_equal
from pandas.testing import assert_series_equal
from seaborn._core.data import PlotData
assert_vector_equal = functools.partial(assert_series_equal, check_names=False)
class TestPlotData:
@pytest... |
9a3628d1376015ca892d19aa0cfb0a8428eb527cc42a9263e4d1bbbc17a73032 | Python | 14,209 | 480 | """
Utility functions for computing the BAM metric for a given object
"""
import numpy as np
import cv2
from skimage import draw
from skimage.measure import regionprops
import matplotlib.pyplot as plt
import scipy
from scipy.interpolate import InterpolatedUnivariateSpline
def get_enclosing_ellipse(cnt):
"""Gen... |
6bec2f3faf17cd9847512255fd1b487a12e70814c7bd677adea52d253548e778 | Python | 14,229 | 403 | """Hierarchical Vote Collective of Transformation-based Ensembles (HIVE-COTE) V1.
Hybrid ensemble of classifiers from 4 separate time series classification
representations, using the weighted probabilistic CAWPE as an ensemble controller.
"""
__author__ = ["MatthewMiddlehurst"]
__all__ = ["HIVECOTEV1"]
from datetime... |
1cd48dfe931e7e2a16ed8b8e4f70cc08b359e32dcd0775357aeb5062489f332b | Python | 14,239 | 449 | import torch
import torch.nn.functional as F
from src.constants import *
import random
import numpy as np
def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
setup_seed(seed)
class Ba... |
a480f5868a0eecff1ffe8c00ab72385d388260142bf95bfe67342f7b4c111eef | Python | 14,265 | 361 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ray
from collections import namedtuple
import numpy as np
import random
from ray.rllib.agents.trainer import Trainer
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.policy.policy impor... |
b52ae4ab1f7700e8547b28d7364fdebe668c0be134f8224bf72ef3171a90864c | Python | 14,269 | 291 | import glob
import logging
import os
import re
from typing import Union
import numpy as np
from minio import Minio
from minio.error import NoSuchKey
from mprl.utils import ensure_dir
import mprl
from shutil import copyfile, move, copy2
from filelock import FileLock
# Default save path is the "data" folder in this packa... |
5fa451e78c4ba7d970c28357bc6148b9c0f02d7af95d845a8ef96018231a1511 | Python | 14,272 | 376 | # 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... |
150324d943d62ba33f8cb58951417ca38b634efc7299bf59d2e0b83c6fbd12cd | Python | 14,277 | 349 | """TapNet Neural Network for classification in PyTorch."""
__authors__ = ["srupat"]
__all__ = ["TapNetClassifierTorch"]
from collections.abc import Callable
import numpy as np
from sktime.classification.deep_learning.base import BaseDeepClassifierPytorch
from sktime.networks.tapnet import TapNetNetworkTorch
class... |
202d163fe3b50291f00b4d048096f0b0b10e07da1a595a32899312571e411d58 | Python | 14,278 | 369 | # 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... |
a2c7b1ac94397e8e2e91cdac5708067bd8ec2ca28d42b08e310da13e60375c62 | Python | 14,285 | 433 | """
Spike statistics
----------------
In all functions below, spikes is a sorted list of spike times
These functions are from Brian 1.4, and are not included in Brian 2.
From 2017.
See the public archive on github at::
https://github.com/brian-team/brian
at brian/brian/tools/statistics.py (renamed here to be ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.