sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0e8e97bc372e9609f5350ccb101daae9eeb3f8271c0bebe60df79e00fb067c62 | Python | 9,790 | 200 | import os
import sys
# supress warnings about having no GPU
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import logging
# suppress warnings about tf retracing
tf.get_logger().setLevel('ERROR')
logging.getLogger('tensorflow').setLevel(logging.ERROR)
import numpy as np
import pandas as pd
import argpa... |
eb2185cd512702824219bcc2377982ebd985d5ab8557e2f55129114be314c719 | Python | 9,796 | 297 | """Tests for _cluster_report_data + _ClusterReport."""
import nibabel as nb
import numpy as np
import polars as pl
import pytest
from nltools.data import BrainData
from nltools.data.atlases.reporting import (
_ClusterReport,
_cluster_report_data,
)
# ---------------------------------------------------------... |
cee256fbce641eaabe8ed5d956c48491b10bc61ccb59b0cfd052609bcbe8895a | Python | 9,803 | 277 | import os
import torch
from typing import Optional, Union
import math
import glob
from cvnets import EMA
from optim import BaseOptim
from utils import logger
from utils.ddp_utils import is_master
from utils.download_utils import get_local_path
CHECKPOINT_EXTN = "pt"
def get_model_state_dict(model):
if isinstanc... |
e821478cfe6b7116107f908db6b57f13f3f62ea4193f3a77247af03e165a600d | Python | 9,810 | 288 |
from sleepy.processing.engine import Engine
from sleepy.processing.dataset import Dataset
import unittest
from unittest.mock import MagicMock
import numpy as np
import pdb
class MockAlgorithmSimple:
def extract(self, data):
pass
def compute(self, signal):
# Returns samples whos... |
e8d5ed9a568fcef2694add32d99a90aa2ff55d3c4489ec4a5b22d1913cf9030c | Python | 9,817 | 261 | # Copyright (c) 2022 PaddlePaddle 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 appli... |
1e8fe946f8aec79d349637ab2a68bb484f21bf50610deb5ed71b1dfe88696d5e | Python | 9,822 | 289 | from tqdm.auto import tqdm, trange
import numpy as np
import pandas as pd
import torch
from sample_for_integral import integrate_of_exponential_over_simplex, project2simplex
from util import NesterovGD, Minibatcher
@torch.no_grad()
def project_M(M, M_constraint):
if M_constraint == 'simplex':
project2simplex(M, ... |
059f34a31a24b6187d4279a14b1a82b5c7ef9656f74d5cdf610c6fc5aa764b0a | Python | 9,823 | 302 | # Copyright (c) 2022 PaddlePaddle 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 appli... |
147c362049ecf7de9b84373b06333876869feb4f97605d12dfcbf063a5478977 | Python | 9,828 | 288 | from numbers import Integral, Real
import numpy as np
import scipy.sparse as sp
from scipy import linalg, optimize, sparse
from scipy.sparse.linalg import lsqr
from sklearn.base import (
MultiOutputMixin,
RegressorMixin,
_fit_context,
)
from sklearn.linear_model._base import LinearModel, _preprocess_data
f... |
d9ccadaccdec685cb62f740abc362c3a01d5a71366f826ba12606060d199525d | Python | 9,836 | 286 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
ec553bb313d3889756c859d5909e2ba79c1e8838190525cc1da7a38c200e03aa | Python | 9,851 | 191 | """Publication retrieval contracts and chain-specific receptor-association acceptance tests.
Release tests read the definitive tables from VDJDB_TABLES. Motif association joins
chains to their own epitope records; retrieval tests retain publication-level semantics.
"""
from __future__ import annotations
import os
fro... |
6948d9404f6f75ccd452d2c073e1a8a04a201e1f7b13a4d6d2ffef04ccaed04b | Python | 9,853 | 312 | # ==============================================================================
# Copyright 2023 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
import os
import... |
c2947b9f98f6b664f9eac5c8bf7cfa1a4de9864a3344d167ae2071cb46c1f5c0 | Python | 9,855 | 169 | from DeepPurpose import utils, dataset
from DeepPurpose import DTI as models
import warnings
import itertools
import numpy as np
import pandas as pd
import wandb
from tqdm import tqdm
import sys
warnings.filterwarnings("ignore")
import random
import argparse
def main(num_samples, val_setting, cuda_id, num_workers, d... |
5716aedb941a0fec667f16300f7ae3b3ce9bec2a96fc881f12e66e08ea97aacc | Python | 9,858 | 290 | """Tests for revealing a file-table recording in the platform file manager."""
import importlib
import shutil
import subprocess
from pathlib import Path
import pytest
import sanpy
# The package exports bTableView as the view class, which hides this module.
file_table_module = importlib.import_module("sanpy.interfac... |
33ac1ee2b80400ecef0d6eab74f6f704b6700623a0adfbe484c5054f60a8e1e7 | Python | 9,861 | 312 | import click
from cloudfiles import CloudFiles
from cloudvolume import PrecomputedSkeleton
from collections import defaultdict
from copy import deepcopy
import kimimaro
import numpy as np
import pickle
from corgie import scheduling, argparsers, helpers, stack
from corgie.log import logger as corgie_logger
from corgie.... |
6380a75dc6dd02a8a0e8cfb92346fd7ee08abeb77d5d1e46f4d35706b6c18dda | Python | 9,881 | 302 | import click
import torch
import procspec
import cachetools
from corgie import scheduling, argparsers, helpers
from corgie.log import logger as corgie_logger
from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type
from corgie.boundingcube import get_bcube_from_coords
from corgie.argparsers im... |
f982c48fb1fdaecc5f72435371e7976e6188366c009ff200f74507c1fcfe1f85 | Python | 9,885 | 247 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network model_templates and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cogn... |
de137c9b71da2889515ecb5facb4373663c28d160cc93a2aac2989a4cc7db4d1 | Python | 9,894 | 301 | # 20210610
import os
import sys
import glob
import importlib
import inspect
from typing import Union, Dict, List, Tuple, Optional
import sanpy
import sanpy.interface.plugins
# from sanpy.config import DO_KYMOGRAPH_ANALYSIS
from sanpy.sanpy_paths import SanPyPaths
from sanpy.sanpyLogger import get_logger
logger =... |
4593089a7fb488e9cbf4ca47a4fcc2106fa0d1b6836e3f891332eca19a45cddb | Python | 9,895 | 297 | import numpy as np
np.random.seed(1234567)
import tensorflow as tf
tf.random.set_seed(1234567)
import random
random.seed(1234567)
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, LeakyReLU
from tensorflow.keras.layers import Dropout, AlphaDropout, GaussianDropout
from tensorflo... |
2ae578b490ebbe86881d48f3f44b6fdec4633bcde10a2fb722f0fff249a16aa6 | Python | 9,906 | 304 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Memory Stimulation and Phase-Amplitude Coupling
# Copyright 2021 Nikolaos Vardlakis & Nicolas P. Rougier
# Released under the BSD 3-clauses license
# -----------------------------------------... |
35f86406719456a6b6ce190d05cf8d131a21ae25c2a3989537c22b6e7712c9e7 | Python | 9,909 | 254 | """Generates preprocessed subject data from NSRR datasets.
It reads the raw files from each NSRR dataset, extracts the EEG signal and hypnogram,
resamples the signal to 200 Hz, applies a bandpass filter, and saves the preprocessed
data in a .npz file, one per subject.
"""
import os
import sys
import time
import nump... |
77520122b06e668da05558ac6059055c590cde787a94fc6437d1a3de5813599c | Python | 9,911 | 246 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 13 17:50:34 2023
@author: Em
"""
from torch import (zeros_like,
abs as t_abs,
no_grad)
from torch.optim import Adam
from torch.nn import (LogSoftmax,
NLLLoss)
from torch.autograd import Function
cl... |
5a7e2d650201931bff43428a781aa1780c7e8d558c66a820d1feb5a1b1951e54 | Python | 9,913 | 279 | import math
import numpy as np
from scipy.interpolate import interp1d
from scipy.signal import resample_poly, butter, filtfilt, find_peaks
def split_mass(subject_ids, split_id, train_fraction=0.75, verbose=False):
"""Subject ids is the sorted list of non-testing ids."""
n_subjects = len(subject_ids)
n_tr... |
ba369b6d6c76e4766192c1b8a83626fcc2a21cca8d3e717fd54967ec491599c3 | Python | 9,919 | 269 | from math import pi as PI
import torch
import torch.nn.functional as F
from torch.nn import Embedding, Sequential, Linear, ModuleList
from torch_scatter import scatter
from torch_geometric.nn import radius_graph, MessagePassing
from ogb.graphproppred.mol_encoder import AtomEncoder
try:
import ase
except ImportErro... |
aab93d1f28efeb65500840f4a017f5474f85e7592f18fd13b74eb432bf7e058d | Python | 9,925 | 263 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import RidgeClassifier
from sklearn.preprocessing import StandardScaler,LabelEncoder
from imblearn.over_sampling import SMOTENC
from sklearn.metrics import ConfusionMatri... |
3cbab2d58c52b58c8602580bcd8a5e0f13383520d5d32829d3708fd5a14a58a2 | Python | 9,930 | 291 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import copy
import torch
from torch import Tensor
from torch.utils import data
import cv2
from PIL import Image
from typing import Optional, Union, Dict
import argparse
import psutil
import time
import numpy as np
... |
72929ab0fe64d0fe5cee52fda059c59351cbf7bac1b34a35185632a88606e23b | Python | 9,930 | 284 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 1 12:07:40 2023
@author: nicol
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 22 14:30:31 2021
@author: nicol
"""
import os, glob, tqdm
from skimage.io import imread, imsave
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as p... |
54781e9eba64b135e5077a37f748bdc2ba3082dda0ad12c34ed05f05dd5d4b8e | Python | 9,932 | 232 |
import os
import pickle
import random
import numpy as np
from sklearn.preprocessing import StandardScaler
from tdc.multi_pred import DTI
import torch
from torch.utils.data import Dataset
from hyper_dti.settings import constants
from hyper_dti.utils.bio_encoding import precompute_target_embeddings, precompute_drug_em... |
cdae5003fadd67eea1b91ef10f7d6a7f071aeb89b09983c7b34ee4fc514801b0 | Python | 9,936 | 266 | import os
from torchvision.datasets.vision import VisionDataset
from torchvision.datasets.folder import default_loader
from typing import Optional, Tuple, Dict, List, Union, Callable, Any
import torch
import argparse
from utils import logger
from .. import register_dataset
from ..dataset_base import BaseI... |
1e7608af6d86da425a23ceb8e066fc9f29075b51b55769d872fa30e724374e14 | Python | 9,950 | 263 | """Proj2Proj: self-supervised reconstruction using masked projection loss."""
from pathlib import Path
import numpy as np
import torch
from skimage.metrics import (
mean_squared_error,
peak_signal_noise_ratio,
structural_similarity,
)
from tqdm import tqdm
from sparse_ct.model.dncnn import DnCNN
from spa... |
68c34c5e23480c41148cab53858772328e6827718776a648c120e5ac98bedae8 | Python | 9,952 | 310 | import warnings
import numpy as np
import pandas as pd
from scipy import stats as st
from scipy.stats._continuous_distns import _distn_names
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from tqdm import tqdm
from .utils import dim
def sample_indel_params(kde_obj, pca, scale... |
587d767c5d0825bc95fa1165d23fceff198ac901cbe491ebe16d25d453d9b078 | Python | 9,953 | 306 | """
Functions that operate on CSR matrices
Nigel 3 dec 2020
"""
import copy
import numpy as np
from scipy.sparse import csr_matrix
from typing import Union
from utils.time_utils import timer
@timer
def remove_greater_than(graph: csr_matrix,
threshold: float,
... |
0088227348059b1af664af4e4e3f643ab1b701e0818893b8a570e66c4dde8af2 | Python | 9,959 | 329 | # -*- coding: utf-8 -*-
"""
Analytical functions for the comparison framework.
Created on Jun 29 2023
@author: Mohammad Torabi
"""
from copy import deepcopy
import numpy as np
import pandas as pd
import statsmodels.api as sm
from scipy import stats
from statsmodels.formula.api import ols
from ..dfc_utils import dFC... |
033b00eb585e249245d587083f6b3a51da9637706b4d7f44ca344945047b0a97 | Python | 9,959 | 278 | # Copyright (c) 2023 PaddlePaddle 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
#
# Un... |
1ad7e8cc48d88e1cd385712a6b3a6d2b309be4841529c0c5d98ba3364f2ac019 | Python | 9,964 | 267 | import random
from qtpy.QtCore import Qt, Signal # pyright: ignore[reportPrivateImportUsage]
from qtpy.QtGui import QColor
from qtpy.QtWidgets import (
QApplication,
QColorDialog,
QGridLayout,
QLabel,
QLineEdit,
QMenu,
QPushButton,
QScrollArea,
QWidget,
)
from .other_utils import ... |
5c2ff9b243a313104a84d4900ecfd37161d210f58cdcc2a5e6e53df1ea53bda4 | Python | 9,965 | 287 | #!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 26.09.2021
# Author: Moritz Smolka
# Maintainer: Hermann Romanek
# Contact: sniffles@romanek.at
#
import logging
import os
import pickle
import json
import gzip
import math
from functools imp... |
087f92fdeff9dfd2af8ee912ea4ff7e373588b070a5b02d18d8e8f90b53cd665 | Python | 9,970 | 263 | import os
import pandas
import psycopg
import json
from psycopg.rows import dict_row
from configs import config_db
# (OK) TODO: Create sequence_id - This is unnecessary
# (OK) TODO: get CAS ... do we need it?? - yes, but only as user input and we will not search for it.
# TODO: get CID
class MergerSQL:
"""
... |
2d38d4405a3daa36d42cd907becd46b2398b17e47cd2eda0e6b378a79c33deeb | Python | 9,973 | 307 | import argparse
import logging
import os
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
from e3nn import o3
from mace.tools import deprecation
from mace.tools.cg import O3_e3nn
from mace.tools.cg_cueq_tools import symmetric_contraction_proj
from mace.tools.scripts_utils import extract_con... |
8bef640f645cdc2750fbf3a6b3fdf9860043c5cd2094be172088bbbe658f5aea | Python | 9,976 | 267 | # Copyright (c) 2022 PaddlePaddle 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 appli... |
0fd4f4302d646f4bb22d6e4268e44708b88228f8cd2222340ca0f86ea87b759a | Python | 9,981 | 238 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from typing import Dict, Any, Sequence, Union, Optional, Final
from collections import OrderedDict
import torch
from e3nn.o3._irreps import Irreps
from nequip.data import AtomicDataDict
class Graph... |
9d082063d15b7d6a07b41fb42ee71de6320462e7ab1e2366e3967739b417eb97 | Python | 9,981 | 214 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
01e7253c75e1f5cd719ffba00949e885a88d3d378dec99a1829b9ad97dda9f49 | Python | 9,984 | 285 | # -*- coding: utf-8 -*-
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 18})
import numpy as np
import logging
import argparse
import os
import torch
import h5py
import sys
sys.path.insert(0, os.path.join(os.getcwd(), 'src/models'))
from layers import Ne... |
21203f6a9d8d544fb80fedacd8a0f5931ddf594f8b58c1c078fda54b37fc62c8 | Python | 9,990 | 263 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... |
35e11d0b3764e4749c7de73ea1438db41a7918c131583d210d6e9a82b73d6656 | Python | 9,991 | 314 | """Statistical Manifold of multinomial distributions with the Fisher metric.
Lead author: Alice Le Brigant.
"""
from scipy.stats import dirichlet, multinomial
import geomstats.backend as gs
from geomstats.geometry.base import LevelSet
from geomstats.geometry.diffeo import Diffeo
from geomstats.geometry.euclidean imp... |
3f14f9a28d92ae4afc791406871350f0d4c52125eb15df576012673d04a4896a | Python | 9,998 | 245 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
49b6bf7f69118d837a160f70dbdd3f4866870321eb2cb2c063bd2dc894ed4706 | Python | 10,009 | 335 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""CA module."""
import base64
import json
import os
import shutil
import signal
import subprocess # nosec
import sys
import time
from logging import getLogger
from pathlib import Path
from subprocess import check_call # nosec
from click... |
f7efb7c67cb695d862524c7513eccd67e50554543859be0e0d2ba3ac2e762be2 | Python | 10,012 | 316 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
A standalone module for aggregating metrics.
Metrics can be logged from anywhere using the `log_*` functions defined
in this module. The l... |
6540a2ce168fb6cda195eedd370587100afdb5cedfb62e699f1c999e7d3cffb9 | Python | 10,014 | 293 | import os
import numpy as np
import torch
import tables
from torch.utils.data import DataLoader, TensorDataset
from scipy.sparse import coo_matrix
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import torchvision.datasets as dsets
import torch.nn.functional as F
imp... |
00f1f95ebbfc1751994498cc6790495f5a8268e53805f12d309ace520b1ba5b1 | Python | 10,017 | 285 | from torch.utils.data import Dataset
import torch
import random
import numpy as np
from rdkit import Chem
ALPHABET = "0" + "Cc1(O)=N23S4nF.l[-]sa+oKH#BrgP56ZIb78iLAteGd9" + "\\/@%PuYmpfMhW*VUETDy~R" + "<>?"
class TargetSet(Dataset):
def __init__(self, smile_list, label_list, use_aug=False, use_cls_token=False, se... |
671658b83b1ee3c5142439bc76e05b9f5f234f0d6e9ffbaa0f5ad5100201290b | Python | 10,020 | 289 | # pylint: disable=C0103, R0914, R0201
"""Main module for rbo."""
from typing import List, Optional, Union
import numpy as np
from tqdm import tqdm
class RankingSimilarity:
"""
This class will include some similarity measures between two different
ranked lists.
"""
def __init__(
self,
... |
c03cfd9c7799ad64d6e6b28c75e9e057ff8e0a8ba5068b7a53cd54f4b0c0cbbd | Python | 10,027 | 285 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import torch
import os
from .. import AtomicDataDict
from .base_datasets import AtomicDataset
import lmdb
import pickle
import copy
import numpy as np
from dataclasses import dataclass
from functools ... |
22c22123f9105fd9e0adec1c4c68440d784b88ed7657218830f6c89ee0d7b89b | Python | 10,036 | 308 | """
Vispy Canvas for Neurodecode's StreamViewer.
Code adapted from Vispy official example:
https://github.com/vispy/vispy/blob/main/examples/demo/gloo/realtime_signals.py
"""
import math
import vispy
import numpy as np
from vispy import app
from vispy import gloo
vispy.use("pyqt5")
VERT_SHADER = """
#version 120
// ... |
b818932ff2fb1890c9321ac6bcd7825d447d5e4d9c975a585981438f0df63fa5 | Python | 10,045 | 258 | import numpy as np
import NALSM_GEN_SUPPORT as sup
import multiprocessing as mp
import os
class bf_comp:
def __init__(self,ver,num_processes=10,buffer_IN=25):
self.main_Path = os.getcwd()
self.data_path = self.main_Path + '/train_data/ver_'+str(ver)
self.net_path = self.main_Path... |
c31b0733e283ecea028754b31d0bb8c31f27f82462c26a6961feac559edf679e | Python | 10,047 | 281 | import sys
import os
import torch
import numpy as np
from sklearn import metrics
from sklearn.metrics import confusion_matrix
from sklearn.metrics import roc_auc_score
def get_binary(values, threshold, target):
"""
Transforms continuous or multiclass values into binary values (0/1)
Args:
values ... |
eb9123f577eefad55273195bf06c57f917c57fb73ef3f14c0cda904db2a101b4 | Python | 10,047 | 274 | """Tests for experimental-metadata edits shared by the plugin and file table."""
from pathlib import Path
from typing import Any
import pytest
from qtpy import QtCore, QtWidgets
import sanpy
from sanpy.interface.plugins.setMetaData import SetMetaData
from sanpy.interface.sanpy_window import _SelectedFileProgressDial... |
9b65e52586e9324322e0e2378c1e47d65e2b104c5ac53a110e501d81274b1b55 | Python | 10,049 | 232 | #!/usr/bin/env python
import tensorflow as tf
import numpy as np
import h5py
#Data import
enumeratorr = 0
buffer_size = 300
batch_size = 40
train_length = 350
epochs = 4001
steps_per_epoch = train_length // batch_size
save_pred_out, save_mask_out, save_rec_out = np.empty([16,240,240,1]), np.empty([16,240,240,1]), np.e... |
8703743d64f52abb0dba487131056e917eb5d7a0315fd99aa3de2e0884b2b987 | Python | 10,055 | 18 | import matplotlib.pyplot as plt
plt.scatter([100*(i+1) for i in range(100)], [0.17603826522827148, 0.17499947547912598, 0.18692231178283691, 0.18900084495544434, 0.18800020217895508, 0.20300030708312988, 0.2160658836364746, 0.21796655654907227, 0.23700237274169922, 0.278001070022583, 0.3640012741088867, 0.391029596328... |
5325410956801b7a81106c70649b2ed067ee798951c72b20f50021c3fac03326 | Python | 10,063 | 197 | # 2026-09-26 Every candidate partition, scored through one harness.
#
# uv run python docs/tuning/sweeps.py dbscan|hdbscan|lumbermark|hybrid|hybrid-len|all
#
# Writes one CSV per sweep into out/reports/tuning/; `report.py` merges them into the committed
# scorecard. Each sweep produces a label vector in the tcremp c... |
a8ca6d04e68cc5fb3ad1fbea576769b764d4ccbd94ed85d1431327235330a832 | Python | 10,067 | 395 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.1
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# %% [ma... |
99857106a2ee6e365456b285b3c8387ec3bb06fc8ef7bad4eea5ef3fc0d9aad6 | Python | 10,071 | 309 | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import logging
import argparse
import os
import torch
import h5py
import sys
sys.path.insert(0, os.path.join(os.getcwd(), 'src/models'))
from layers_1d import GATRelateCNetV2, ... |
6d2e8b69f1253b14336bd8fa5595b5b17ee2c2321b9316c5dd9cd5e237b5f725 | Python | 10,075 | 193 | import os
import torch
import hydra
from tqdm import tqdm
from omegaconf import OmegaConf
from sklearn.metrics import roc_auc_score
from benchmarks.xgraph.gnnNets import get_gnnNets
from benchmarks.xgraph.dataset import get_dataset, get_dataloader, SynGraphDataset
from benchmarks.xgraph.utils import check_dir, fix_ran... |
b28c8d36062f6a980d04719d5a761c6b6d677432a7ab597df8308f967efef1e2 | Python | 10,087 | 488 | import analysis_utils as au
import torch
import seaborn as sns
import matplotlib
import torch.nn as nn
acf2gain = {
'nn.Sigmoid()': 1,
'nn.Tanh()': 1.6666666666666667,
'nn.ReLU()': 1.4142135623730951,
'nn.LeakyReLU()': 0.9999000099990001,
'nn.Identity()': 1.0,
'pc.NoneModule()': 1.0,
}
class ... |
0f076478f93f504cd088b0ecdcb4ec8402f64e92ad45efd0bb85f8ebfbea9c4d | Python | 10,101 | 249 | import os.path as osp
import h5py
import numpy as np
import warnings
from tqdm import tqdm
import torch
import torch.nn.functional as F
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
class ECdataset(InMemoryDataset):
def __init__(self,
root,
... |
9473fffa380c7992ebb6d22d57971411a3566e735268ac00f8c1d835930bf8ec | Python | 10,103 | 256 | import os
import numpy as np
import nibabel as nib
from glob import glob
from model_trans import transxai_model
from tensorflow.keras.models import load_model
from config_trans import cfg
from scipy import ndimage
from skimage import morphology
def read_brain(brain_dir, mode='train', x0=29, x1=221, y0=29, y1=221, z0=... |
991a6943d66bfe96371c43b4e4ad657221f4496c0cdf5cd80c2fa8410fb1e845 | Python | 10,105 | 354 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Plan module."""
import sys
from logging import getLogger
from os import makedirs
from os.path import isfile, splitext
from pathlib import Path
from shutil import copyfile, rmtree
from click import Path as ClickPath
from click import ec... |
00a4e20e9bbc289822f5369d47eb63a4b2ce3ee8ee7ea378e87606e93b1105a0 | Python | 10,107 | 340 | """
Trigger can send events to the parallel port (DESKTOP, USB2LPT, ARDUINO), to an
event file (SOFTWARE) or to nothing (FAKE).
"""
import io
import sys
import time
import ctypes
import threading
import multiprocessing as mp
from pathlib import Path
import pylsl
import serial
from serial.tools import list_ports
from... |
788db8e5e401c2c4d1329c3428ddccf768b969cff6e0c7645b1d1dffe29c688c | Python | 10,111 | 230 | """`vdjdb qc`: what fails a submission, what is only reported, and what the report contains.
`qc/runner.py` was 28 % covered while being the gate every chunk pull request hits. The split
between advisory and fatal findings is the part that matters: 99 of 230 chunks are CRLF, so a hard
gate on that would block every un... |
46eec7ac49c721df3da0fda62f3fe94b25eca08ba8bf366088075eb3d8bebe15 | Python | 10,113 | 296 | from __future__ import print_function
from pysam import AlignmentFile
from argparse import ArgumentParser, FileType
from collections import defaultdict, Counter
from multiprocessing import Pool, cpu_count
from sys import stdout
from os import path
from math import log2, sqrt
import pickle
import subprocess
import re
t... |
89f0fcaa3810f8c8df024bdd490f608ea7b1d19c6a68db153ac8d3f3d9137df5 | Python | 10,114 | 292 | # Script containing the modular version of the code
# so far we have only implemented the non_linear_embedding layer
# for simplicity we can just use dense layers for the merge operations
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
... |
b75139ea19db9dd9a2df150c30f9d22b10a18b1f2ae3602bfa44868f9190899f | Python | 10,122 | 225 | import pandas as pd
import numpy as np
import scipy.io as sio
import mat73
import os
import multiprocessing
import time
import random
from tqdm import tqdm
from scipy import stats
from sklearn.linear_model import Ridge
from sklearn.svm import SVC
from sklearn.metrics import make_scorer
from sklearn.model_s... |
6fe1cf82b8fc1df5ed1219eb1e2a70e76cd6a0cffd96f1391e3c85d961534c40 | Python | 10,124 | 292 | # Script containing the modular version of the code
# so far we have only implemented the non_linear_embedding layer
# for simplicity we can just use dense layers for the merge operations
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
... |
a883b31f76b590febd48801825a845ff62ceea489b599fb6182c40257b1fe0d0 | Python | 10,125 | 309 | import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.modeling.initializer import constant_
from paddle.nn.initializer import KaimingNormal
class ConvModule(nn.Layer):
def __init__(self,
in_channels,
out_channels,
kernel_size=1,
... |
f1d12646e16fb3365e7c6837e27d681e5492448170d49c4ee3030be3410952a9 | Python | 10,125 | 302 | # This file loads an xyz dataset and prepares
# new hdf5 file that is ready for training with on-the-fly dataloading
import argparse
import ast
import json
import logging
import multiprocessing as mp
import os
import random
from functools import partial
from glob import glob
from typing import List, Tuple
import h5py... |
920787605671413216a41f70223db66b0605fbff83a3045fca2621e420a99352 | Python | 10,126 | 325 | # Copyright (c) 2021 PaddlePaddle 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 app... |
68e63ca20062f52d12cc0b953009d6f6a674b547b1e9f5662b39307203951406 | Python | 10,130 | 352 | import math
import torch
import copy
import click
import itertools
from click_option_group import optgroup
from corgie import scheduling
from corgie import helpers
from corgie.log import logger as corgie_logger
from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type
from corgie.boundingcube i... |
65dc36f058eb0588698bc9720d8c2927b43f82962a1cdaa89bc1de283a51e8a5 | Python | 10,132 | 232 | #### parcel_naming.py
# Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com)
#
# This script is a part of the pyClusterROI python toolbox for the spatially
# constrained clustering of fMRI data. It provies functionality for assigning
# labels to regions identified through spatially constrained functional... |
c69312c4d71ca00c87b2d33ffa84c1d7f9aa049b70e5121ac9109834f4bc88bb | Python | 10,138 | 283 | from chromadb.api.types import (
Embeddings,
EmbeddingFunction,
Space,
Embeddable,
is_image,
is_document,
)
from chromadb.utils.embedding_functions.schemas import validate_config_schema
from typing import List, Dict, Any, Union, Optional, TypedDict
import os
import numpy as np
import warnings
im... |
fb0d81ceca743cfa91a5f94db0b3f2e5b43c7dcae7d84c493000315a36134c2a | Python | 10,140 | 314 | """Statistical Manifold of Binomial distributions with the Fisher metric.
Lead authors: Jules Deschamps, Tra My Nguyen.
"""
from scipy.stats import expon
import geomstats.backend as gs
from geomstats.geometry.base import VectorSpaceOpenSet
from geomstats.geometry.euclidean import Euclidean
from geomstats.geometry.ri... |
1173a24190510edbebaafabce1e3146b4d97952e3ea313339019dc884c587548 | Python | 10,152 | 352 | import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
# number of available gpu
ngpu = 1
batch_size = 16
###################################################
## Loading the data
dataRoot = "../../data"
# labelFiles = "label... |
e0f27db6fd2707eaf041ce1416a481065d3add1285a9ee2a04759a5e4be68b46 | Python | 10,155 | 229 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
import numpy as np
from nest_elephant_tvb.transformation.communication.mpi_io_external i... |
1e94aae8ebd5308d5a39d2bfcd5bd2c6513e3422b9f281346dadac705e9fab27 | Python | 10,157 | 327 | """
Convert known file format to FIF.
"""
import pickle
from pathlib import Path
import mne
import numpy as np
from mne.io._read_raw import supported
from .io_file_dir import get_file_list, make_dirs
from ..preprocess.events import find_event_channel
from ... import logger
mne.set_log_level('ERROR')
# ------------... |
f821ae39e5cf1573d63ef5cb2f31a30942df3bd816dcf9a8ce8716be849f7c05 | Python | 10,157 | 227 | # Copyright (c) 2022 PaddlePaddle 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 appli... |
a84bfc6e20888c64997a04e58a3c5724a369a96eb1e23ae0ab2b343fcd93930a | Python | 10,161 | 306 | # nolapse_test.py - Testing JAGS fits of HDDM models without lapse process in JAGS using pyjags in Python 3
#
# Copyright (C) 2021 Michael D. Nunez, <m.d.nunez@uva.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... |
cd4d351521dc4f0da39ea84009f31f13091a68e080f46bfaf9d3753d8c041766 | Python | 10,163 | 266 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... |
3b831f4613cfe895e037406d950fb9395ac352cd1fa4f8bf6248cdab1f661e62 | Python | 10,173 | 294 | # Script containing the modular version of the code
# so far we have only implemented the non_linear_embedding layer
# for simplicity we can just use dense layers for the merge operations
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
... |
0d209410f915202e2429d61a0e2ff102399f22275f93fd01fe3a368781c1555f | Python | 10,186 | 243 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""TensorCodec module."""
import numpy as np
from openfl.pipelines import NoCompressionPipeline
from openfl.utilities import TensorKey, change_tags
class TensorCodec:
"""TensorCodec is responsible for the following.
1. Tracking... |
29530df2e469363d3f2e5a16d9e59322406a073f3c170afd15639fd17b7a91ee | Python | 10,187 | 342 | from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Optional, Union, Sequence, Dict, Mapping, Generic
from typing_extensions import Self
from overrides import override
from typing_extensions import TypedDict, TypeVar
from uuid import UUID
from enum import Enum
from pydantic i... |
041a7c96c5b5b5ad9fc4b01cbbbb9fb47138aecd6926b82a8081b171127f84ae | Python | 10,188 | 244 | import os
import hydra
import torch
import shutil
import warnings
from torch.optim import Adam
from omegaconf import OmegaConf
from benchmarks.xgraph.utils import check_dir
from benchmarks.xgraph.gnnNets import get_gnnNets
from benchmarks.xgraph.dataset import get_dataset, get_dataloader
import torch.nn.functional as F... |
262afcf1c0c6e3006ed85b73994567edd9f5691a97c63de15b270c4c4bb2052a | Python | 10,200 | 208 | """The legacy proofreading, transcribed. This is the oracle the new rules are measured against.
Two tiers ran in the retired pandas build, and both are here:
* **Per chunk** - ``py_src/ChunkQC.py``: ``check_exist``, ``check_header``, the 13-entry
``validators`` dict, the three emptiness checks and the within-chunk ... |
5487800c0202aaf65c83a679fc900d4ccdc43f91255a95ad7f3c2690a50840cf | Python | 10,201 | 282 | # Copyright (c) 2022 PaddlePaddle 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 appli... |
dfdc9829f1c92021cd60fb4ad54c990323760f07379464cf3432cf903f0cea4d | Python | 10,201 | 295 | import os
import sys
sys.path.append("..")
import time
import numpy as np
import scipy.io.wavfile as wav
import torch
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from torch.utils.data import DataLoader
import torchvision
from torch.optim.lr_scheduler import StepLR,MultiStepLR,LambdaLR,Expon... |
f071bbbc226babc56161b02b7232910d363e207ea745ef82bb319055d7524041 | Python | 10,202 | 189 | import tensorflow as tf
from common.models.variational_conv_blocks import VariationalResBlock,\
VariationalConvBlock
from common.models.local_pooling import VariationalMaxPool2D
class VariationalResNet28():
def __init__(self,
spectrogram_length,
spectrogram_width,
... |
751445e8498019e5ad4abe8dded191d146491643d268b697d553f8d69033c289 | Python | 10,213 | 271 | import pytest
import geomstats.backend as gs
from geomstats.test.random import RandomDataGenerator, get_random_times
from geomstats.test.test_case import TestCase
from geomstats.test.vectorization import generate_vectorization_data
class _SolverTestCase(TestCase):
def setup_method(self):
if not hasattr(s... |
a14daae2684d682381ca1fc7547fc4d32699285a56b1c6bdbdec1fa78d2d0acf | Python | 10,228 | 238 | import pandas as pd
import numpy as np
import scipy.io as sio
import os
import time
import random
from scipy import stats
from sklearn.linear_model import Ridge
from sklearn.model_selection import GridSearchCV, cross_val_score, KFold
from sklearn.feature_selection import SelectPercentile, f_regression, r_regression
fro... |
29b15e34fc426a2481f5f2fd42090facf8b89b12e10adde04d4d7f9ada307530 | Python | 10,238 | 405 | from rdkit import Chem
import numpy as np
import networkx as nx
import collections
from collections import defaultdict
import itertools
import copy
from scipy.spatial import distance_matrix
global atomic_valence
global atomic_valence_electrons
atomic_valence = defaultdict(list)
atomic_valence[1] = [1]
atomic_valence[... |
5f3b791109ed805e7e3a63d20b8720bece5170599dc5006e327f30ff94a5ab61 | Python | 10,243 | 341 | from __future__ import annotations
import functools as ft
import json
import operator as op
import os
import re
import textwrap
from os import PathLike
from pathlib import Path
from typing import Any, Callable, Iterable, Mapping, Protocol, Sequence, TypeVar, cast
import attrs
import importlib_resources as impr
import... |
b1f7af1f00099ade67ebdcf20aca30fc7fef1de6a400db27953000430f1ac189 | Python | 10,245 | 295 | # Copyright (c) 2020 PaddlePaddle 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 appli... |
d2ce3c393aa74cdaebf82fe4b98370b0faf52b147176de7b0bd866b258b27382 | Python | 10,247 | 280 | import os
import urllib.request
import gzip
import shutil
import hashlib
import h5py
from six.moves.urllib.error import HTTPError, URLError
from six.moves.urllib.request import urlretrieve
from torch.utils import data
import numpy as onp
class DatasetNumpy(data.Dataset):
""" Numpy based dataset generat... |
140bffeaf8a8e112b4089d6723797b14f8a09ab08f58c8973773fa95bee8f74c | Python | 10,248 | 266 | #!/usr/bin/env python3
"""Enforce the canonical-kwarg vocabulary manifest against public signatures.
`docs/_data/api-vocabulary.yml` is the single source of truth for the v0.6.0
canonical-kwarg vocabulary. Its `enforcement:` section is machine-checkable:
this script walks every public (non-underscore) ``def`` in ``nlt... |
275ebcfa633287a01ec37cc5d8b251b13ad12ec5da28ccea66110c388f5447a9 | Python | 10,249 | 311 |
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QHBoxLayout, QLabel, QCheckBox, QMenu, QAction
import PyQt5.Qt as Qt
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import QMainWindow, QFileDialog, QMessageBox, QStackedWidget, QShortcut
from PyQt5.QtGui import QKeySequence
from functools impo... |
20d0c46b23436dc54636cb90c191f8f18bb504ca2ba6008ae179ee8ab33b1be1 | Python | 10,256 | 293 | import numpy as np
import geomstats.backend as gs
from geomstats.geometry.matrices import Matrices
from geomstats.geometry.spd_matrices import SPDMatrices
from geomstats.geometry.symmetric_matrices import SymmetricMatrices
from geomstats.test.data import TestData
rand = gs.random.rand
class DtypeTestData(TestData):... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.