sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8f2149f20665fc8f788576a1d3e43f81d7bcb21ce246f8d69a2277fd29bd09fd | Python | 5,492 | 158 | # -*- 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/.
#
import logging
import os
from ..interfaces imp... |
9cfd7ad4d339ada683d38e7d779a1c121f563f407abb538c95791ebc55db6f82 | Python | 5,499 | 125 | import os.path as osp
import os
import tqdm
import json
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from models.Network import FeatureNet
import torchvision.models as models
import pdb
import random
import cv2
src = './'
class ZoneClassifier(object):
def __init__(self, ar... |
bfe629a452745a82f059c49271fe7c5c366cb37108396656a3eb66577fe0bba7 | Python | 5,500 | 126 | """Tests for pairwise transformer."""
import numpy as np
__author__ = ["fkiraly"]
from sktime.tests.test_all_estimators import BaseFixtureGenerator, QuickTester
class TransformerPairwiseFixtureGenerator(BaseFixtureGenerator):
"""Fixture generator for pairwise transformer tests.
Fixtures parameterized
... |
419b2d49b47312c70199c4ad746cc7e1833093c6c1e174433ac6d474e7e87ba4 | Python | 5,501 | 174 | """Tests for Classification Benchmark."""
__author__ = ["jgyasu"]
import pandas as pd
import pytest
from sklearn.metrics import accuracy_score, brier_score_loss
from sklearn.model_selection import KFold
from sktime.benchmarking.classification import ClassificationBenchmark
from sktime.classification.distance_based i... |
56bf2bd7f0d55c5e769eca6024d6cf90ce874e9486029dc329dc5d0b242757fb | Python | 5,503 | 156 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
2086757797a699783f879f578878ea5726d7a5eec4d3ba040a9bee50e83182cd | Python | 5,504 | 121 | # Copyright 2019 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... |
9cd897c60dfaf0d93ea0c38b8608e7616a052b997feef5c3a97056fb90ce94d1 | Python | 5,507 | 158 | """
@file: input_representation.py
Created on 03.07.23
@project: CrazyAra
@author: queensgambit
Input representation 2.0 for crazyhouse based on the input representation 1.0 of chess.
"""
import chess
from chess.variant import CrazyhouseBoard
from DeepCrazyhouse.src.domain.variants.classical_chess.v3.input_represent... |
f98337eb28b6255ac13e3d0696ab3fc5abfd69cf204d86b16cae78c1cf9fca71 | Python | 5,507 | 113 | """Mean-anchored state corrections using the existing program attention encoder."""
from __future__ import annotations
import numpy as np
import torch
from torch import nn
from .model import IsoBudgetAttentionNet, grouped_softmax
class ConservativeIsoBudget(IsoBudgetAttentionNet):
def __init__(self, n_genes, gr... |
b33cdd4ef75b299f83b1b442b561221f227a5eec1588c4776368648b3fe0ad6c | Python | 5,509 | 120 | #!/usr/bin/env python3
"""End-to-end smoke test: no data, no GIFT-Eval, one GPU (or CPU), ~30 seconds.
It checks the things that actually break when this code is moved to a new
machine, in the order they would break:
1. every installed Tabby module imports
2. the backbone checkpoint loads
3. the prompt module b... |
54a454df83a44ae72b2d2c1f1777ae87aae1bff65036d6ff034e65bfbf0b352c | Python | 5,510 | 83 | """
Data structures for model_run
XM13 with nacn channels
"""
# nacn _vshift 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1]
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the Xie and ... |
9939d867cf0ad1d0336e0c51a7da4790e288a81b2f4f1b38aae20903f7f7c599 | Python | 5,510 | 83 | """
Data structures for model_run
XM13 with nacn channels
"""
# nacn _vshift 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1]
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the Xie and ... |
418b731c9d41080bc5b7f185b82613178e377d980637ce292bceb07fd19f01d7 | Python | 5,512 | 132 | import numpy as np
from scipy.stats import ks_2samp
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import seaborn as sns
import sciunit
from networkunit.scores import to_precision
class ks_distance(sciunit.Score):
"""
Kolmogorov-Smirnov-Distance :math:`D_{KS}`
.. math::
D_\mat... |
92de0e7f81c340f785b1d6ba9e8636ba9eeeb311639cd0a262bead26d952757f | Python | 5,512 | 145 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
import json
import random
import sqlite3
from tqdm import tqdm
class DataSplitter:
def __init__(self, db_name):
self.db_name = db_name
def create_pair_table(self, table_... |
f99709cae86556f3fdb44b21ca26fcf369925420e1952e638df798072afdc585 | Python | 5,514 | 140 | # This is a pytoch implementation of DISTS metric.
# Requirements: python >= 3.6, pytorch >= 1.0
import numpy as np
import os,sys
import torch
from torchvision import models,transforms
import torch.nn as nn
import torch.nn.functional as F
class L2pooling(nn.Module):
def __init__(self, filter_size=5, stride=2, cha... |
afb6db4d84ecbfda1a77020edda48e48768ca0b14d2e45a2a9eb4766cc1e3c7e | Python | 5,516 | 95 | '''
Pure-python implementation of UCSC "liftover" genome coordinate conversion.
Main class, which is actually a convenience wrapper around chainfile.py's LiftOverChainFile
Copyright 2013, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
import os.path
import gzip
from .chainfile import open_li... |
291e1218e33b9e82cb4844379557fa2af59fd6c3d6aaf0a491de2ce3b7aabe7b | Python | 5,517 | 182 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SSAM documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 22 11:41:04 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... |
6fab022c02ea0add6ee6ac56be0babdc87f29632fb31aa962fd825308b02f68b | Python | 5,518 | 136 | import unittest
from onmt.modules.copy_generator import CopyGenerator, CopyGeneratorLoss
import itertools
from copy import deepcopy
import torch
from torch.nn.functional import softmax
from onmt.tests.utils_for_tests import product_dict
class TestCopyGenerator(unittest.TestCase):
INIT_CASES = list(product_dict... |
185e7e53d0cee0d1872ba5447fbc5026bb698b6abb6e92a9bc697b7ae1764a94 | Python | 5,522 | 113 | import random
from pathlib import Path
import cv2
import numpy as np
import torch
from vp_suite.base import VPDataset, VPData
from vp_suite.defaults import SETTINGS
from vp_suite.utils.utils import set_from_kwarg
class KITTIRawDataset(VPDataset):
r"""
Dataset class for the "raw data" regime of the "KITTI Vi... |
5208dd5f4c184e48b7fde53c6731dfae94003a2d5304f20aa532b473ceeb0aa4 | Python | 5,522 | 111 | #=======================================================================================================================
#Copyright
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick ... |
7f490a0226d55060dd3d74d5df81933b7dca800c83cc6e06b044811faf778f57 | Python | 5,527 | 128 | #!/usr/bin/env python
"""
The point of this script is to redefine the rbh significant group detection testing by using a combination of chromosomes
rather than testing the group size against a whole genome.
Previously the assumption was that by using the whole genome shuffling, that the size of rbh groups wasn't depe... |
4ff2657a057ac040979878da1ab4aa809b4b3760b16b84894ab522a6d8abffee | Python | 5,528 | 142 | #!/usr/bin/env python3
"""Prepare the two FLAMES scmixology datasets for cross-dataset evaluation."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from scipy import sparse
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "s... |
4a50b9db2ab085fdf9416c3cbe74272647b4465a145445e56c7da36d152f5f8e | Python | 5,530 | 169 | # 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... |
a9f16778e22c9efc047547ba234a83c8a8565d8472e79d0e936855ec1c2dfee0 | Python | 5,531 | 125 |
import importlib
import inspect
import os
import sys
import types
from collections import namedtuple
import mock
import pytest
from ts.model_loader import LegacyModelLoader
from ts.model_loader import TsModelLoader
from ts.model_loader import ModelLoaderFactory
from ts.model_service.model_service import SingleNodeS... |
080e4fff0b694bb319cafc9b8e10b23f30e9bb6aebdd2e7ac04e1df72beba796 | Python | 5,532 | 166 | from siibra.retrieval.requests import EbrainsRequest, HttpRequest, CACHE, SiibraHttpRequestError, _get_suffix
import json
import os
from concurrent.futures import ThreadPoolExecutor
from threading import Barrier
from time import sleep
from unittest.mock import patch
import pytest
import requests_mock
def test_devi... |
a41ca14214e6bfde803551573b6628b8d37150c1be49aada475a4ae472aebc7d | Python | 5,533 | 152 | patchseq_config = {
"train_batch_size": 16,
"finetune_batch_size": 16,
"transfer_batch_size": None,
"train_epochs": 20,
"finetune_epochs": 20,
"transfer_epochs": None,
"train_task": "cross_model_prediction_clus", # "cross_model_prediction_clus",
"finetune_task": "unsupervised_group_iden... |
370382d747540236001a96de7eddd649af05ebe39e14837352895d268ed55ee1 | Python | 5,535 | 176 | import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import roc_auc_score
import sys
sys.path.append("..")
from metrics.stats_utils import get_sens_spec_metrics
from misc.utils import ranking_loss
def train_step(batch_data, run_info, device="cuda"):
run_info, state_info = run_info... |
7d542a5bb0d196e89de437f2102ddb589f927cbc2112775d5f26bb78555fd435 | Python | 5,535 | 152 | from __future__ import print_function
import numpy as np
import random
from copy import deepcopy
# for the replication of the same simulation data, uncomment next line
# np.random.seed(2020)
""" Function to generate simulation data with two modalities """
def multi_modal_simulator(n_clusters,
... |
e0282f1dabc6c4f853f232dd1c65eff3c9ccf65837d32d29234270fea1973141 | Python | 5,536 | 145 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2" # Choose which GPUs by checking current use with nvidia-smi
import tensorflow as tf
# import tensorflow_addons as tfa
from tensorflow import keras
## Keras library also provides ResNet101V2 and ResNet50V2. Import them... |
3f0f8f73f1f85ee784114c19f1b26f5711449e012616588e86814dddbddc4569 | Python | 5,537 | 200 | #!/usr/bin/python
"""
Runs AN input simulations for cells. This has been superceeded by
the shell scripts in scripts, and may no longer work.
"""
from __future__ import print_function
from subprocess import call
import os
import sys
import datetime
from pathlib import Path
import matplotlib
import matplotlib.pyplot ... |
abcc2756f1ba214b8a2c7f800b3ac6f473432ecd64532eea9106407248732ff4 | Python | 5,538 | 203 | import numpy as np
import subprocess
from math import sqrt
from sklearn.metrics import average_precision_score
from scipy import stats
import random
import torch
import os
from tqdm import tqdm
device = torch.device('cuda:0')
def train(model, train_loader, optimizer, epoch):
print('Training on {} s... |
a518e7f17cceafa3b004a370794174212899448ef996727b7bed4ff64067e779 | Python | 5,540 | 166 | # 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... |
6a4bd542e35bd17a42c22fc1f3ca5f2b4ac7788ebea70b8958342d2227df7b21 | Python | 5,541 | 142 | import numpy as np
import pandas as pd
import logging
import os
import sys
import click
import torch
import atom3d.datasets.datasets as da
import atom3d.util.file as fi
import atom3d.util.formats as fo
logger = logging.getLogger(__name__)
class MSPTransform(object):
"""
Transform for MSP data.
"""
d... |
54d192271e6f2528f6c212ef480605653469950afa185b74d6a782c481345f5f | Python | 5,542 | 153 | """utils.py"""
"""
Ref: https://huggingface.co/transformers/_modules/transformers/modeling_utils.html
Author: Yimin Yang
Last revision date: Jan 18, 2022
Function: Some static functions for model building.
"""
import os
import random
from typing import List, Tuple
import numpy as np
import torch
from einops import re... |
68344d68307b39e3fbb65184ce5d0d598dcd8bedcda90abf9e9e5aa2c27b0b57 | Python | 5,542 | 177 | # -*- coding: utf-8 -*-
#
# CNModel documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 2 15:20:59 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
154393b18324bcda0f2e87ac0f8f98e34274f4760eb2334592e9f68e7a61250e | Python | 5,545 | 183 | # 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... |
5be0bda58fbf2d3a4753d7163f1cd0a807643115c5c6c360bc157e9d677ebe6e | Python | 5,545 | 147 | # 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... |
ca1090c01926e667b3cdf9f16a443016de7f307b6f38267adee2ecf8cbef84a3 | Python | 5,546 | 154 | #!/usr/bin/env python3
# -*-coding:Utf-8 -*
import nibabel as nib
import numpy as np
from dipy.io.streamline import load_tractogram, save_tractogram
from dipy.io.utils import is_header_compatible
from dipy.tracking.vox2track import _streamlines_in_mask
from dipy.io.stateful_tractogram import StatefulTractogram
from di... |
a951a7820f610bab0983a3ba9d88d0ecb10fa47e945039d1e941704e2ff4c139 | Python | 5,547 | 151 | """
This scripts generate figure S6i : visual ccSP and auditory ccSP
Internal notes:
This is from the notebook: figure-4-paper-with-pip
"""
import pandas as pd
import os
import matplotlib.pyplot as plt
import sciplotlib.style as splstyle
import glob
def main():
custom_ylim = [0, 4.5]
# LEFT PANEL: VISUAL C... |
edbc868f0a0158fb6dd315b7cb45986cf4e054330a9253571ee54a79bfbc4c23 | Python | 5,547 | 195 | # !/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Adapter for using HCrystalBall forecastsers in sktime."""
__author__ = ["MichalChromcak"]
import pandas as pd
from sklearn.base import clone
from sktime.forecasting.base import BaseForecaster
def _check_fh(fh, cut... |
9332838a650365b9d4634db60a70912af9c9820c41e5da3af86ff6e21e217699 | Python | 5,548 | 163 | from models.se3transformer_layers.utils_profiling import * # load before other local modules
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
from typing import Dict, List, Tuple
class Fiber(object):
"""A Handy Data Structure for Fibers"""
def __i... |
302520bd1c877ac055ecfd125d0f8a96d88804fa7d25b5c9cd382ec2fd9c53bf | Python | 5,549 | 136 | import os
from ase.db import connect
import numpy as np
import torch
from torch.utils.data import Dataset
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader as PyGDataLoader
from rdkit import Chem
ATOM_DICT = {1: 'H', 6: 'C', 7: 'N', 8: 'O'}
PAIR_DICT = {('Br', -1): 0, ('Br', 0): 1, (... |
033510b5e4f08ea09da2560f7844767e93fdd77fda29dea3241ca703738294ee | Python | 5,551 | 240 | """
Tutorial demonstrating the use of neurons with voltage-gated ion channels.
"""
from sns_toolbox.neurons import NonSpikingNeuronWithGatedChannels, NonSpikingNeuronWithPersistentSodiumChannel
from sns_toolbox.connections import NonSpikingSynapse
from sns_toolbox.networks import Network
import numpy as np
import mat... |
403a339930b8ab2fc98c953180050886cc5f863441fab34e57070198ea529879 | Python | 5,552 | 144 | # Copyright 2022 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
c14349dc46dd5162b348bb0fda4b5c105e57e7c860a6f586bd478178d2b0130a | Python | 5,552 | 174 | # 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... |
27e65f5da918fbc688fccc4312cb7dd625441d88e75e8a9d39b5cbd74ed00e0d | Python | 5,553 | 169 | """Test data loaders that download from external sources."""
from urllib.request import Request, urlopen
import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.datasets import (
_load_fpp3,
load_forecastingdata,
load_fpp3,
load_... |
565c279db19cd3e51b0a7cf2be021700a5b90d6d2c83a4eee767f1444c8a067f | Python | 5,553 | 190 | """
r_num_invariance.py
Here we tested whether using more or less R neurons significantly
affected the vector sum function of the network. We tested the
minimum of 3 R neurons up to 24.
"""
import numpy as np
import matplotlib.pyplot as plt
from extended_ring_model import *
from dict_key_definitions import rmkeys, de... |
9349a5d0dfef4ab8e1cfb17f1f91b6b79c7fb96d6defd7548330eb1fa8edd830 | Python | 5,554 | 157 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Converters between polars and pandas, with multiindex convention."""
from copy import deepcopy
import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.datatypes._adapter.... |
b2f4b1b4c576c28402348ebc7e3f8557d1c3475b70c646dd642b2528f99787b8 | Python | 5,554 | 171 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Graph utilities for checking whether an ONNX proto message is legal."""
from __future__ import annotations
__all__ = [
"check_attribute",
"check_function",
"check_graph",
"check_model",
"check_node",
"check_sp... |
7d9226d7481681229c8b0f3e55b502b2db4e82c395a069a5abbf9d1effa607df | Python | 5,558 | 194 | # 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 ReduceSumSquare(Base):
@staticmethod
def export_do_not_keepdim... |
6abc717e6edf268eaf1a0ca3514b0bb3538149c46c1b874a6f2d6b4b472db49f | Python | 5,559 | 142 | #-------------------------------------------------------------------------------
# elftools: dwarf/aranges.py
#
# DWARF aranges section decoding (.debug_aranges)
#
# Dorothy Chen (dorothchen@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
f... |
1f2c41700e12c2133f9ba7d2068afdb29c714673fcb5ee6c27e5cdfd1b184a85 | Python | 5,563 | 166 | from pathlib import Path
from typing import Dict, Optional, Tuple, Union
import torch
from torch.utils.data import DataLoader
from models import Encoder, Decoder
from utils.const import DEFAULT_DEVICE
EPS = 1e-12
class PermutationTest:
def __init__(
self,
encoder: Encoder,
decoder: Decode... |
1c9fcee46065e2383d63f216153020f6aee4d71a6425454cd4c7e83134012753 | Python | 5,564 | 167 | from pathlib import Path
from typing import Dict, Optional, Tuple, Union
import torch
from torch.utils.data import DataLoader
from models import Encoder, Decoder
from utils.const import DEFAULT_DEVICE
EPS = 1e-12
class PermutationTest:
def __init__(
self,
encoder: Encoder,
decoder: Decode... |
95d4e7ccf1459962c7da89c6959c55114d19f58d972a58956ae01c421025ade9 | Python | 5,567 | 147 | import logging
import random
from typing import List
import click
import pandas as pd
from tqdm import tqdm
from torch.utils.tensorboard import SummaryWriter
from src.definitions import REPO_ROOT, PROCESSED_DATA_DIR
from src.data.data_loader import RepeatedStratifiedKFoldDataloader
from src.models.base import ModelIt... |
07e85a083f128a7a493f2894509a0bf31aa65d4fe909712b683309cb589e32ce | Python | 5,568 | 111 |
import os
from mprl.utility_services.cloud_storage import connect_storage_client, BUCKET_NAME
from mprl.utility_services.worker import ConsoleManagerInterface
from mprl.utility_services.lock_server.lock_client_interface import LockServerInterface
from mprl.utility_services.payoff_table import PayoffTable, PolicySpec
i... |
d9b899d1538bec49b2d65621c44d424d9dead1023aeaaf88735248d90859cfa6 | Python | 5,568 | 82 | """
Data structures for model_run
XM13: pretty pure
"""
ChannelData = u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the Xie and Manis 2013 models for mouse.
The REFERENCE values are applied to "point" models, and to the s... |
29e1fffe28fdf63031c7a5c54cc4b93312bae3acb3ea2239bc3bc63fb241067e | Python | 5,571 | 141 | # 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... |
a1e7c6a2916d2b7088a71e9e5fb322b9d74ee4dbc35e6e332090bf45285a9c7d | Python | 5,571 | 159 | # 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 ... |
93aa0c876356fcc45b8451f87d55e5a2fcb711a786cb7f2a5fa41bfb465fe6ad | Python | 5,572 | 147 | import os
import random
import numpy as np
import torch
import vtk
import json
from vtk.util import numpy_support
from torch.utils.data import Dataset
class BCDataset(Dataset):
"""Dataset for prediction of Attachment Points"""
in_channels = 4
out_channels = 1
def __init__(
self,
inpu... |
c4750476bbf1e2df3ac5ae6ee686c2c2e73376aad18041058bdc018f68d9ac6d | Python | 5,572 | 148 | from typing import List, Union
import torch
import torch.nn as nn
import logging
from .graphnet import GraphNet
from .const import LOCAL_MIX
from utils.const import DEFAULT_DEVICE, DEFAULT_DTYPE
class Decoder(nn.Module):
def __init__(
self,
num_nodes: int,
latent_node_size: int,
o... |
27b40a10c8b81cd09d5ae238dabc0462bc5831ad09759365ccb20d92b1a1c5cf | Python | 5,573 | 191 | import string
import random
import os
import urllib.request
from asreview.models.feature_extraction.embedding_lstm import load_embedding
from asreview.models.feature_extraction.embedding_lstm import sample_embedding
def random_words(n_words=1000, other_word_dict={}):
""" Generator of random (ascii) words.
P... |
7b6663f4d559e611236a52c2afa9bfd4c6db584659d493c2ff9b00249b2b180c | Python | 5,574 | 142 | # =============================================================================
# IMPORTS
# =============================================================================
import copy
import os
import torch
from torch.nn import CosineSimilarity
# ==========================================================================... |
2fc796f3f38e3d8e2079dbd79782532b1d5bf4d3d3179f094e793bce07fbad12 | Python | 5,575 | 167 | # 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... |
420a48e49c67dd421691cea98c2bc3fd1e42c326c7ff45db954183f95a34c0e3 | Python | 5,575 | 240 | """
#### ####
## #### ## ## #### ###### ##### ## ## #### ###### ## ##
## ## ## ### ## ## ## ## ## ## ## ## ## #### ##
## ## ## ###### ### ## ##### ## ## ## ## ##
## ##... |
7c45e85c81a99fb59965646e8f44ef3c505010d931fc3645930fb29cac6a2d4d | Python | 5,576 | 139 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
from elftools.dwarf.descriptions import (
ExprD... |
3881ea5898a09fabc353d6fc30c1a2aa240abfd837807b6e55445725e3f684e8 | Python | 5,579 | 188 | #%%
import datetime
import time
import networkx as nx
import numpy as np
import pandas as pd
from graspologic.plot import adjplot
from pkg.data import DATA_PATH
from pkg.utils import create_node_data, ensure_connected, select_lateral_nodes
OUT_PATH = DATA_PATH / "processed_split"
t0 = time.time()
#%%
def load_a... |
d644b052b71fc95a249c26c78897eb2d8bcb70cb49f144351d65bea61026ec19 | Python | 5,580 | 154 | """Interface for MrSQM classifier."""
__authors__ = ["lnthach", "heerme"] # fkiraly for the wrapper
from sktime.classification._delegate import _DelegatedClassifier
class MrSQM(_DelegatedClassifier):
"""MrSQM = Multiple Representations Sequence Miner.
Direct Interface to MrSQMClassifier from mrsqm.
No... |
b9ca732a715bef4b494b0852cd06f6ca81233768b0f82498289a52944f2bab68 | Python | 5,583 | 165 | """Top-level damage_profile function."""
import os
from pathlib import Path
from typing import Dict, List, Optional, Union
import numpy as np
import nibabel as nib
import pandas as pd
from bcblib.imaging._types import NiftiLike
from bcblib.imaging.io import load_nifti, is_nifti
from bcblib.tools.damage_profile._atla... |
381b79f0e5403163da257781a5ceb8b5d87aa6e50e6a5e96fe7fbf776de79c9f | Python | 5,593 | 167 | #!/usr/bin/env python
import os
import sys
import stat
from os.path import join as pjoin, exists as pexists, realpath
import numpy as np
#---------------------------------
# CHANGE THESE FOR YOUR PROCESSING
#---------------------------------
base_dir = '/u1/work/hpc3194'
dataset_name = 'ADNI' # '4RTNI' # 'PPMI' #
#... |
5dd9b8f4e2b05ad9fe488f7db1a9a29f39e9a102677c217bc6b65a96e0322730 | Python | 5,593 | 180 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
53b1f62bcd0885a57757d6ee63c88bef822bdc0d31a388cd5812d34f8d186122 | Python | 5,594 | 160 | """
plot_behaviour.py
Plot the behavioural data contained in the behaivoural_data sub-directory.
This script generates a companion plot for plot_precision.py
"""
import json
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.stats import wilcoxon # Statistical comparison between groups
... |
a0bd844ce044a4801aea256f544e9bdf32d62a69f5153db961ebcc27e3580403 | Python | 5,594 | 160 | """Plot cycle features."""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from neurodsp.plts.utils import savefig
###################################################################################################
###############################################################################... |
08fdce8b62199c8812da0bb1067f8b14b316180dbf0a3c5a7e038d7503bdf834 | Python | 5,596 | 121 | from __future__ import print_function
import pickle
import numpy as np
from emgProcessing import emg2feature
class FeatureExtractor():
def __init__(self, params):
self.extractorType = ''
self.params = params
def getFeatures(self, eegSegment, timeStampSegment, time_step):
print('passin... |
ea99dfc376a597093e93f208bc2cc8f810bcc5d62d3979f5a0340d6e7c83a725 | Python | 5,597 | 164 | from neuron import h
from neuron.units import ms, mV
import numpy as np
import functions
import time
import os
def initialize(filename):
"""
initialize NEURON simulation environment and Hallermann et al. 2012 model
:param filename: name of .hoc file for the simulation
"""
h.load_file('stdgui.hoc'... |
eb32224337ac2db6049651de32bcd666ad8c67160c2de6b6c775c4f40902baa7 | Python | 5,600 | 156 | """Tests for read-penalty scoring and score-min recommendations."""
import numpy as np
import pytest
from corset_tools.dist_calc.scoring import (
format_advice,
read_penalty,
recommended_score_min,
score_min,
)
def test_score_min_is_linear() -> None:
"""score_min evaluates bowtie2's L,intercept,... |
d6722b4de3a4d4fcfbcb293714c7d0d4d7ecbef253612692b3f69c1d49382eab | Python | 5,604 | 189 | # 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 ReduceL1(Base):
@staticmethod
def export_do_not_keepdims() -> ... |
01006d771f355f53c22909c494b26f11f6370383b9bc53d9e8c545b0f090c0a0 | Python | 5,607 | 142 | # 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... |
79c1f7fa4e6d7b509fca4272673ac797a8cdbe708f8c6377eed72f8a0ac155be | Python | 5,611 | 182 | __author__ = ["chrisholder", "TonyBagnall"]
import numpy as np
from sktime.utils.numba.njit import njit
@njit(cache=True)
def compute_min_return_path(
cost_matrix: np.ndarray, bounding_matrix: np.ndarray
) -> list[tuple]:
"""Compute the minimum cost path through the cost matrix.
The return path is comp... |
db7d725f2fbad228dbadd2199458bc025d48cb519de5843dafb9df101473c82d | Python | 5,612 | 142 | import math
from collections import Counter
from collections import defaultdict
import torch
from torch.optim.lr_scheduler import _LRScheduler
class MultiStepLR_Restart(_LRScheduler):
def __init__(self, optimizer, milestones, restarts=None, weights=None, gamma=0.1,
clear_state=False, last_epoch=-... |
3de44dd2c28adc5f7dc576338c9411759fe440d4ab2be53875ff431c8a5f46a6 | Python | 5,614 | 158 | from ast import ExtSlice
from email.policy import default
import numpy as np
import os
import random
import torch
from sklearn.utils import class_weight
from src.data import create_dataloader, create_joint_dataloader, set_seed
from src.scripts import *
from src.configs import *
from src.constants import *
from src.mod... |
be3168b2bde8b9ec9e66309e84dd1ecf0c1dbd1accffb06f49322a7d117be448 | Python | 5,614 | 177 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ----------------------------------------------------... |
ce74b9d08eebe9649a2875fcd87cd93f04ab118154d30e376f4d0110f4839eb5 | Python | 5,614 | 183 | """Class definition of DtypeKind and related utility functions.
Enum values of DtypeKind are in accordance with the dataframe interchange protocol.
Utility functions to help convert dtypes to corresponding DtypeKind values.
"""
__author__ = ["Abhay-Lejith", "pranavvp16"]
from enum import IntEnum
from pandas.api.typ... |
d08f149571e621d949a2d16ac9bed65bbb56a48044e8d4c4f2a4946ed213f0a0 | Python | 5,614 | 139 | # 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... |
46eb5ff106dcadfc403bdf1a3d8fd3ed8995e3cc0bc3de22c741d27207f93a2b | Python | 5,615 | 166 | import pytest
import pandas as pd
import numpy as np
import scanpy as sc
from anndata import AnnData
from palantir.presults import cluster_gene_trends
def test_cluster_gene_trends_basic():
"""Test basic functionality of cluster_gene_trends"""
# Create a simple DataFrame of gene trends
n_genes = 30
n_... |
da2381c4bac7569d9480e7d13a210d6ccf230c074a5e35388751edb7e1def52b | Python | 5,615 | 148 | from typing import List, Optional, Union
import torch
import torch.nn as nn
import logging
from .graphnet import GraphNet
from .const import LOCAL_MIX
from utils.const import DEFAULT_DEVICE, DEFAULT_DTYPE
class Decoder(nn.Module):
def __init__(
self,
num_nodes: int,
latent_node_size: int,... |
a91c0d6c3287f551300f4e0bde5192137966af1543f2cfa9a92e4b0eeacf01cf | Python | 5,617 | 165 | """Test functions for data input and output."""
__author__ = ["SebasKoel", "Emiliathewolf", "TonyBagnall", "jasonlines", "achieveordie"]
__all__ = []
import numpy as np
import pandas as pd
import pytest
from sktime.datasets import load_basic_motions, load_UCR_UEA_dataset, load_uschange
from sktime.datasets._data_i... |
ef04cd86ba70cd166199fb26b892d7be80a6742f26deaa0dcee71cd62c002ac0 | Python | 5,617 | 173 | from __future__ import annotations
import warnings
from collections import UserString
from numbers import Number
from datetime import datetime
import numpy as np
import pandas as pd
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Literal
from pandas import Series
class VarType(UserStr... |
735423dfc98f1df3cc29c8fb7e93584088d87a89413a83a63431018354fb6962 | Python | 5,619 | 129 | # Copyright (c) 2009, Evan Fosmark
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and... |
036c2bb29c41a7afe4c591e08bdcac9a6a6e4542ade10cac28daab946385aff8 | Python | 5,620 | 154 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import warnings
from typing import List
import numpy as np
from mmcv.utils import scandir
from .base_dataset import BaseDataset
from .builder import DATASETS
from .imagenet import find_folders
class ImageInfo():
"""class to store image info, using slots... |
a20b57f3b0760121b27619ca0654de87f85b5c9c6af4ac44eeaf8ea426dd747b | Python | 5,620 | 157 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Batch-aware selection of persistent torch neighbor-list strategies."""
import warnings
from typing import (
Any,
Literal,
)
import torch
from deepmd.dpmodel.utils.default_neighbor_list import (
DefaultNeighborList,
)
from deepmd.dpmodel.utils.exclude_mask i... |
35695aa9d9e51c509b9839d1845bd7af97ce4587e47b4db12671c355932600ff | Python | 5,621 | 182 | from numpy import sqrt, pi, cos, sin, sinh, log
def rbj_sos(filtertype, sample_rate, f0, gain_db=None,
q_factor=None, band_width=None, shelf_slope=None):
if 'shelf' in filtertype and not shelf_slope:
raise(ValueError('shelf_slope mus be specified.'))
w0 = 2*pi * f0/sample_rate
amplit... |
d549f55fe1e9a1f5869672c560928e7cb9e003f49f949b038696b72ba4ea0e09 | Python | 5,622 | 160 | # 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... |
47bffbc0471cedb6fc7e586c21307d8659f41221bbee271e873300799125d38b | Python | 5,629 | 143 | #-------------------------------------------------------------------------------
# elftools: elf/segments.py
#
# ELF segments
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ import annotations
from... |
7a343f39d33fd08231db7c76e8915527368f9752ba92a0e02139db19bf1fc099 | Python | 5,629 | 239 | """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... |
a7a02ce7f7c8430525eb91e1dac83c2bb8956490b94b89b0c0b9f3f6a779835f | Python | 5,638 | 148 | import dxpy
import boto3
import argparse
import os
import subprocess
import sys
import hashlib
from functools import partial
VGP_BUCKET = "genomeark"
def parse_args():
'''Parse the input arguments.'''
ap = argparse.ArgumentParser(description='Symlink VGP data to dnanexus')
ap.add_argument('object',
... |
6e4120666065adb65e2a0a4d5cdbf44cf1cb9bf6555397fe2ca950335a05945e | Python | 5,639 | 135 | import os
import numpy as np
import pickle
import keras
from scripts import models_util
from scripts import training_util
from scripts import testing_util
#gl_init_lr = 0.00001
gl_init_lr = 0.0008
def create_data(config, DataHandler):
# Create main dir
data_dir = f'data/tl_train/{config.tl_da... |
88ea6ec467ae810ba8c166fbe8a3b8075cbedd521bed472e49b0893e4b7db08a | Python | 5,640 | 157 | """
Base classes for JetNet datasets.
"""
from __future__ import annotations
from typing import Any, Callable
import torch
from torch import Tensor
from .normalisations import NormaliseABC
from .utils import checkListNotEmpty, checkStrToList, firstNotNoneElement
class JetDataset(torch.utils.data.Dataset):
"""... |
8197fb3d507bc7fe0580c544a56476c25194c2835b1a36ddf2fdee58ed898ec8 | Python | 5,641 | 151 | from DeepCrazyhouse.src.domain.variants.constants import LABELS_XIANGQI
ROW_NUMBERS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
COL_LETTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
def xiangqi_board_move_to_ucci(old_pos, new_pos):
"""
Converts a position (index) on a Xiangqi board represente... |
3b86fc63aef71f02fdf545a326b2a8aafe7d5d03940909679a49f6559b37c825 | Python | 5,645 | 161 | # SPDX-License-Identifier: LGPL-3.0-or-later
import json
import os
import unittest
from collections.abc import (
Iterator,
)
from pathlib import (
Path,
)
from threading import (
Event,
)
import numpy as np
import paddle
from paddle.io import (
BatchSampler,
DataLoader,
)
from deepmd.common import... |
bb58bcc6c68df6ec4fa64acee0d774faa9357928d566af3a5072c1b1d2f1aaf8 | Python | 5,647 | 108 | """Short-read-only inference for IsoPrism (formerly Competitive-TA) checkpoints."""
from __future__ import annotations
import argparse
from pathlib import Path
import re
import anndata as ad
import numpy as np
import pandas as pd
from scipy import sparse
import torch
from .competitive_model import CompetitiveAllocat... |
50d84b33d4f7943528d6738507ad5b80b2b547f5729eed54bd86777e74bd2132 | Python | 5,650 | 213 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.