sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3810d10173c70e7e2b6b6e72b50a3f10c3a4d49d87b2b0a2c853d215fae76bc6
Python
8,541
352
# flake8: noqa # __reproducible_start__ import numpy as np from ray import tune def train_func(config): # Set seed for trainable random result. # If you remove this line, you will get different results # each time you run the trial, even if the configuration # is the same. np.random.seed(config["...
9965f36142af26853a9fe27d10fc71bd0be1268a829afce13010a8a7e1dd9e0e
Python
8,541
214
import time from collections import defaultdict from dataclasses import dataclass from typing import Dict, List, Optional, Set import ray from ray.air.execution.resources.request import ( AcquiredResources, RemoteRayEntity, ResourceRequest, ) from ray.air.execution.resources.resource_manager import Resourc...
b19a880974610bad73fc5560af9bede4fb0c023d05ada1b1c834608ce18e7354
Python
8,541
265
import torch from torch import nn, optim from torch.utils.data import DataLoader, Dataset import numpy as np from skimage.segmentation import clear_border from skimage.morphology import closing from skimage.measure import label import os import RS from clean_pdb import clean_pdb import pybel import openbabel import tf...
793534b445f4b4a607349dc9096353b6aa87241cdffd85a054634ec4b217cf4c
Python
8,543
238
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import functools import sys from contextlib import ExitStack from dataclasses import dataclass from io ...
ddaf5c413ff22d1b85eefd021d0a7200e4c34ced6c24fdfcf6658e3261699259
Python
8,543
281
import os import numpy as np import tensorflow as tf import keras_tuner as kt import matplotlib.pyplot as plt from utils.constants import * from utils.experiments_tools import * from utils.regressor_tools import * from utils.plot_tools import * class TransformerTuner: def __init__( self, output_dir...
20881163f80a2b00f26ba980d40110370f8a88c2c04c040e2c98edcea875db09
Python
8,546
265
import torch.nn as nn import torch import numpy as np def flops_to_string(flops): if flops // 10**9 > 0: return str(round(flops / 10.**9, 2)) + 'GMac' elif flops // 10**6 > 0: return str(round(flops / 10.**6, 2)) + 'MMac' elif flops // 10**3 > 0: return str(round(flops / 10.**3, 2))...
e816e4a43718de69e76ca85e31782cbe2f8fac277855043b621e4c8e15fd6b86
Python
8,547
208
# built-in dependencies from typing import Any, Dict, List, Union, Optional, Sequence, IO, cast from collections import defaultdict # 3rd party dependencies import numpy as np from numpy.typing import NDArray # project dependencies from deepface.commons import image_utils from deepface.modules import modeling, detect...
c312acf31d25b99636e105517b863054eeda10e188facc9c1fbdefb8ce089c2d
Python
8,548
261
from inspect import isfunction import math import torch import torch.nn.functional as F from torch import nn, einsum from einops import rearrange, repeat from stable_diffusion.ldm.modules.diffusionmodules.util import checkpoint def exists(val): return val is not None def uniq(arr): return{el: True for el i...
58658fd0966cde68bc8b79eb0a17ae3f0fa4af1e76f170b9bc0bb4449b19a1fa
Python
8,550
209
import requests from .__config import base_url from .__aux_funcs import process_response def get_samples_by_keyword(keyword=None, direction="ASC", pageNumber=0, pageSize=10000000, projection="SUMMARY", sortBy=None): """ Get all samples matching a keyword. \n :param keyword: Search keyword that applies to t...
643021677db809690b8554f45d79a5463e83dd58ea40124146ebd92eaa358225
Python
8,552
233
import hashlib import sys import pytest from ray._common.runtime_env_uri import Protocol, parse_uri def _sha1_hex(s: str) -> str: return hashlib.sha1(s.encode("utf-8")).hexdigest() class TestParseUri: @pytest.mark.parametrize( "uri,protocol,package_name", [ # GCS stays in the n...
bee0b791642960fa4352734b90b9a44a7e839a12b419f5d5f7725a56ebc573c5
Python
8,553
290
import random import json link_list = [ [0,0,0,0], [0,0,0,1], [0,0,1,1], [0,0,1,2], [0,0,1,3], [0,1,1,1], [0,1,1,2], [0,1,2,2], [0,1,2,3] ] gnn_list = [ "gat", # GAT with 2 heads "gcn", # GCN "gin", # GIN "cheb", # chebnet "sage", # sage "arma", "graph", # k-GNN "fc", # fully-co...
a18a73fc94f51dcf47227e8f98e5db1cfb627c33d84573cc322c111f7bbbc934
Python
8,554
270
import os import pickle import sys from typing import List from typing import Tuple import pystow import tensorflow as tf import Transformer_decoder if int(tf.__version__.split(".")[1]) <= 10: import Efficient_Net_encoder else: raise ImportError("Please use tensorflow 2.10 when working with the checkpoints.")...
ec1343a10c6b8efa5f40bfdd3ec42cb3e5af8f51a3ea38095664a98ff37983f0
Python
8,555
231
# -*- coding: utf-8 -*- """ Alignment on simulated 2D data. =============================== As we mentionned several times, we search for a transformation, let's call it `R`, between the source subject data `X` and the target data `Y`. `X` and `Y` are arrays of dimensions `(n_voxels, n_samples)` where each image is a...
ecc409dd6a5d8b5bb4c8b73524352c17a1e93c0e0d6f774d1d0c7278aa70875b
Python
8,555
241
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import logging import math import re import readline import sys from itertools import islice from pathl...
5d9909b7e95bc6e06ca955a9a3b3a18185b59402ddebe401e215967dec69a07b
Python
8,571
261
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
bffa94fdbfc7939ff8b7f54986cc2ccc2814162e7ceb4846848ca8c6ed0490df
Python
8,571
211
# -*- coding: utf-8 -*- """ Created on Fri Oct 29 18:09:15 2021 @author: Nikhil """ #Crossover analysis #1. takes detrended timeseries as xov_df #2. calculates 24 h rolling woindow average as xov_roll_avg #3. takes difference of xov_df and xov_roll_avg #4. looks for change in sign which indicates crossover ...
128291e142dc6fd4c83df04ed8dee6323fad3f04a6aa43d2bd4cecd0c00bd813
Python
8,572
228
import torch from torch.nn import Module, BatchNorm1d, LeakyReLU, Conv1d, ModuleList, Softmax, Sigmoid, Flatten, Dropout2d, Linear from torch.optim.lr_scheduler import LambdaLR from torch.optim import Optimizer from torch.utils.data import Dataset, DataLoader import argparse import math import random import numpy as n...
bd8d9cea370032648ba80b1954aaaaa29d67dd0aab66a0e0ccf3a12e974492c4
Python
8,574
265
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import os import random import sys from itertools import product NAME = "webhooks" def read_rules(name): rules = [] with open(os.path.join(sys.argv[1], f"{name}.csv")) as f: reader = csv.DictReader(f) ...
6b4cc1278aefad1d108fafe1bf0ac0f1788d9990a58319c9500ce61200518c25
Python
8,575
224
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. FastCSP Centralized Logging System """ from __future__ import annotations import json import logging import sys from datetime import datetime...
89ce7dee4c81b297a922da25ad9952cbcdbf9e07de7fadda2ac777265fe21d59
Python
8,575
244
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import re from unittest.mock import MagicMock, patch from allauth.account.models import EmailAddress from django.core import mail from django.test import override_settings from django.urls import re_path, reverse from rest_framework import serialize...
da3c59179fccda49d9408064b7b465f4ac081b2e1c61d24d33d41c15ae460b9a
Python
8,577
255
import random from tkinter import W import brainrender as b import numpy as np from brainrender.actors import Point from brainrender import _utils #Find cell coordinates import csv as c file = open("CN_neuron_coordinates_allcells.csv") csvreader = c.reader(file) # Skip first line to get to get to data next(csvreade...
2fbcc5ab54967da49b068a9cea954884d834bfad9afafef4cf8095cf598c42b6
Python
8,579
243
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # =========================================...
efceb68d0d88f89a95e8d31e6e6d0c618adc12ac2649d0727536a16b10e1b2f7
Python
8,580
244
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modif...
cba290848a900b8d9532c09f6fd3452947932b141394e1edd4d25cc531bd5f1a
Python
8,587
221
#!/usr/bin/env python from scipy import stats import numpy as np from sklearn import mixture # calculate the Del statistic given a FME combo in het files def Deltest(F, M, E, length, crit=0.01, thres1=0.0005): # if True: thres1 = min(50 / length, thres1) if F / length < thres1 and M / length < thres1 \ ...
6af6d28a8aa0459f4b40e3659d4abcd00b739397ed72d1d1d575da27c283a549
Python
8,589
211
from typing import Callable, List, NamedTuple, Optional, Tuple import pyarrow as pa import pyarrow.compute as pc def is_boolean_arrow_type(t: "pa.DataType") -> bool: """Whether ``t`` is boolean, including dictionary/run-end encoded booleans.""" if pa.types.is_dictionary(t) or pa.types.is_run_end_encoded(t): ...
8ce33621d35379f18b10a287a6f026629640fb7c7bf38bafb82e69e3d35e3f88
Python
8,592
270
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING import numpy as np from fairchem.c...
6064187abecdb76433ec86b1f06915e13ad2b739c11ab4b604a74c84ea371610
Python
8,598
240
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # =========================================...
b9e191b97a98198efb223d0fb248735aadc1cf918b355261bd5a8a6aaa10a454
Python
8,600
241
import argparse import numpy as np from tqdm import tqdm import torch.multiprocessing import torch from torch import nn from torch import optim from data import build_retina_dataset from models import SpatialDecoder, FlattenLayer, ResNetFeatures WANDB = False if WANDB: import wandb PROJECT_NAME = 'Multi-ta...
df9fb1fa58475b4cde4be7c58ac7b2f590dcebd70391687a0c79daed3f9e4734
Python
8,600
296
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Thu Oct 20 13:49:57 2016 @author: agiovann """ from builtins import range from past.utils import old_div import logging import numpy as np import scipy try: import numba except: pass #%% def mode_robust_fast(inputData, axis=None): """ R...
832c6328626e94539c565af1f9049d0213058bea9f6156d7d954577bdba68106
Python
8,601
298
import numpy as np import pandas as pd import scanpy as sc from scipy import stats from sklearn.linear_model import Lasso, LassoCV from sklearn.metrics import mean_squared_error, r2_score from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from tqdm.auto import tqdm #...
8ade3fb0c366505b7571c9263032579f4876f0f69048711c0b1cf686b0c7d2c9
Python
8,601
184
import torch import torch.nn as nn from .transformer import AbstractTrasnformerLayer from ..utils import create_norm ## Core code for Flow-Attention, Please refer to each folder for corresponding experiments class Flow_Attention(nn.Module): # flow attention in normal version def __init__(self, d_model, n_head...
9da1a18b33c5dceb4415bbdbb7ea1b574bb51bd542fcf3359c0067d7b1c7275f
Python
8,603
232
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 27 10:15:17 2021 @author: sam """ #Parse inputs import argparse parser = argparse.ArgumentParser() parser.add_argument("file", help="path to video file") parser.add_argument("-intenseSample",type=float, default=40, help="minutes...
42b055b2a7d8067a58c7a499056b3f85250677374e9499c968c8bec946ec71fc
Python
8,605
256
import pandas as pd import pathlib import subprocess from collections import Counter TARGET_NAME = 'target' # these are words that yaml doesn't like you to use protected_feature_names = ['y','Y','yes','Yes','YES','n','N','no','No','NO', 'true','True','TRUE','false','False','FALSE', ...
3174283f9e93165a87cdfdbbe369d71f1c19d9f12a590da3e9033393f3941b18
Python
8,611
314
"""HTML rendering for the AnnData report. Single-file output: all plots are inlined as base64 PNGs and the CSS is inlined too, so the report can be emailed or hosted from any static file server with no asset directory. Style: warm cream background, dark warm-grey text, single accent in muted terracotta — keeps the re...
7207a3f317162f2176193f2a2ef88d555983dab049c299cb10bb81c99da3d244
Python
8,611
244
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 ag...
4935670160fced9136cadd08e43d51c976fce0b90d2cbf9b1fda5556e74e4749
Python
8,612
262
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import torch def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv1d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def conv5x5(in...
d68c93ed62715ddaa8e1d4a0c8e2773adecc8e74d84705db3742b8610a98eddc
Python
8,612
270
#!/usr/bin/env python import os, sys sys.path = [os.path.dirname(os.path.abspath(__file__))] + sys.path from liblinear import * from liblinear import __all__ as liblinear_all from ctypes import c_double __all__ = ['svm_read_problem', 'load_model', 'save_model', 'evaluations', 'train', 'predict'] + libline...
8c09bfb8bc0263f6ca147314fd996b10fb53020a98a7709b14a84a96d86aba5e
Python
8,617
255
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import json import logging import os import shutil import time from abc import ABC, ABCMeta, abstractme...
fb47c6c0c234b059c8748cc042681aa166df27abffb4bd768f2aaa3378e50326
Python
8,617
197
import argparse import multiprocessing import os from time import sleep from typing import Union import numpy as np import torch from batchgenerators.dataloading.multi_threaded_augmenter import MultiThreadedAugmenter from batchgenerators.utilities.file_and_folder_operations import load_json, save_pickle, join, maybe_m...
e56901239b7454730feebe8b3d9f904286bd829d2d6566171ff56cf74427de3e
Python
8,620
261
""" Performs size simulations for all hypotheses. """ from utils.grid_funcs import ( gridpop_clustering, gridpop_conj, gridpop_repsupp, gen_offsets, traj ) from utils.utils import ( convert_to_rhombus, get_hexsym, get_pathsym ) import numpy as np import pickle import os import settings i...
172a1c3439b460f94dcbe3a9cf49a57a69f139c90cc728193d9e504b9351e944
Python
8,621
174
import os import numpy as np import matplotlib.pyplot as plt import ivim root = '/path/to/root' input_root = os.path.join(root,'data') results_root = os.path.join(root,'results') subs = [sub for sub in os.listdir(results_root) if sub.startswith('sub')] runs = ['run-{}'.format(r+1) for r in range(2)] scans = ['sIVIM'...
338d7916a8dda880ebbef2b2c5c760d77216774454eabbd3bed0e0b0eded8072
Python
8,621
219
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import gzip import io import json import os from glob import glob from typing import TYPE_CHECKING, Any...
0af70b59d65d798f076ef25d7f7f0c519d7cf6ff67424ed048ce2c0531637278
Python
8,622
230
import json import re from typing import ( Any, Dict, List, Optional, ) import yaml import ray._private.ray_constants as ray_constants # Regex patterns used to validate that labels conform to Kubernetes label syntax rules. # https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#sy...
4530c9781d25fe0315929a702ebbb2312c090be5f0c86c1a41dc9622dfdab315
Python
8,622
285
import os import numpy as np import tensorflow as tf import keras_tuner as kt import matplotlib.pyplot as plt from utils.constants import * from utils.experiments_tools import * from utils.regressor_tools import * from utils.plot_tools import * class InformerTuner: def __init__( self, output_direct...
5670398129a16603ca610ac8f56432c944e1e45db57a06636c464bbae5e0ff4a
Python
8,622
174
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
acb576adae1479f91e3fcd7b523bde7f25057fa12f83cec5e3b9b52e45e793c8
Python
8,622
263
import os import torch import time import argparse import numpy as np import pandas as pd import torch.nn as nn from tqdm import tqdm from sklearn.metrics import mean_absolute_error from torch.utils.data import DataLoader, Dataset, random_split import torch.nn.functional as F parser = argparse.ArgumentParser() masks...
b529ebe354a1a27c8035e84d453e5fc327b289f7071293e1cb637b5117e3c5a4
Python
8,622
259
import abc import json from copy import deepcopy from dataclasses import dataclass from inspect import signature from typing import Dict, List, Union import ray from ray.util import placement_group from ray.util.annotations import DeveloperAPI RemoteRayEntity = Union[ray.remote_function.RemoteFunction, ray.actor.Acto...
a5dca14da775177c6295e65a1efa1b7db33b176c5d8b27fd1381387c55d85c90
Python
8,625
197
r"""Biomolecular complex structure & binding affinity — Boltz-2. `Boltz-2 <https://github.com/jwohlwend/boltz>`_ (Passaro *et al.* 2025) is an open, AlphaFold3-class model that co-folds proteins, nucleic acids and small molecules **and** predicts binding affinity — the first open model to approach FEP-level affinity a...
e91d31cedcdd6c0c6b3da83d3d511699c3b107f12cc2a6167af6df30d9def5ed
Python
8,627
197
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
aa0e30a352ebbdc860aecdd9f3713d4e31f9bde895796d31af30de48d3dc093c
Python
8,632
193
import optuna import Training_Utility_Functions as Training_Utils import os import Dataset_Generator import torch import numpy as np import logging import ML_Models logging_file_name = "optuna_logs.txt" # file name for where the hyperparameter optimisation output logs will be saved base_path = "/app" # t...
1cb1b5b64c8a4513339da05d781f19a00665cb63294ce405fcd6cc942b52f923
Python
8,635
255
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Quantizer(nn.Module): def __init__(self, entry_num, entry_dim): super().__init__() self.entry_num = entry_num self.entry_dim = entry_dim self.decay = 0.9 self.entry = nn.Embedding(s...
fea44c09d705cb529dcf94caf5439d8f71f4960e2eadbdc217f6583536644822
Python
8,641
193
import numpy import json import os from matplotlib import pyplot from scipy.spatial import distance from .user import select from .prefnet import PrefNet from .pareto import find_dominating OBJ_NAMES = { "FWHM (nm)" : "Resolution", "Signal Ratio" : "SNR", "Bleach" : "Bleach", "Squirrel" : "Squirrel"...
8c0276919a0d93f853b5e562ebeb145f25be3e2278aa84e8bfd3350de5b20aa1
Python
8,644
239
# built-in dependencies import io import cv2 import pytest import numpy as np import pytest # project dependencies from deepface import DeepFace from deepface.commons.logger import Logger logger = Logger() def test_standard_represent(): img_path = "dataset/img1.jpg" embedding_objs = DeepFace.represent(img_p...
9581a7c2aa314855f760f31ea5b3cefa48c91fcc53d996f3789737fe9930bd55
Python
8,646
227
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint import torch class CANN(): """ Generic CANN modules for rapid testing """ def __init__(self, data, num = 128, tau = 0.02, Inh_inp = -.1, I_dur = 0.5, dt = 0.05, A = 20, k = 1): self.num = num self.tau...
6fd3abc9a3afe57e593b118e11985a6c765fde3668ca40ee076f796b699ede9c
Python
8,647
281
from typing import Optional, Tuple import torch.nn as nn from sinabs.layers import SumPool2d from sinabs.utils import expand_to_pair from .crop2d import Crop2d from .flipdims import FlipDims class DVSLayer(nn.Module): """DVSLayer representing the DVS pixel array on chip and/or the pre-processing. The order of ...
8fd58159f55216b6f1768fdb4d2495ab5c89683c009d3ef7e1bc352126020c76
Python
8,647
224
"""Parquet helpers shared by the V2 Parquet datasource, scanner, reader and footer indexer. These used to live in the legacy ``ray.data._internal.datasource.parquet_datasource`` module. They moved here so that ``datasource_v2`` does not depend on the legacy package; the legacy module imports them from here instead. It...
c3f407a936d6662c4d7beabbdf4e45bb6fc0a6a6d2a8b079c7dae4a08e7a428c
Python
8,648
194
from dataclasses import dataclass from typing import Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .embeddings import TimestepEmbedding...
eaaec798642c19534b2ba04462dc0c2f8bc411555084c03f5728f325d65bc5be
Python
8,649
189
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fr...
2949e7d4c50c8b9f0e7177730310d3f00fa4d652bd183a7118c19df3eb035bd2
Python
8,650
219
from __future__ import print_function import argparse import glob import sys import os def parse_args(): parser = argparse.ArgumentParser("Consolidates output logs for chunked marginPhase run") parser.add_argument('--log_dir', '-l', dest='log_dir', default='.', type=str, help='Location w...
d77f53cd0c6d8631f6cf2b36145f8c2077db8230872baf0f1c509bf449289293
Python
8,650
265
import imageio import os import glob from skimage import io, transform import matplotlib.pyplot as plt from scipy import ndimage from skimage import color import numpy as np starts = {'bold': [3330, 3753, 4175, 4602, 5026], 'vaso': [996, 1420, 1842, 2269, 2693]} SF = 2400/1000 template = f'/Users/sebas...
e285d63ab97ae669f780ef7f4893d9af464855fc6dac3900a9334fbb4c95f095
Python
8,650
246
"""STRING API client.""" import logging from typing import Any, Dict, List, Optional from urllib.parse import urlencode from .base import BaseAPIClient from ..config import settings logger = logging.getLogger(__name__) class STRINGClient(BaseAPIClient): """Client for STRING database API. STRING (Sear...
1801e8bdd316321986812d3690539a4bbfcbabd009993c6b0590b4544947c014
Python
8,657
210
# Copyright 2022 The Music Spectrogram Diffusion Authors. # Copyright 2023 The HuggingFace Team. 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...
8223a64dfc81d68ba4ccd2fe1f9018284cde5b0e38752cde002d69f02703c08f
Python
8,657
113
# Tensor maps for the CelebA Dataset # https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html import os import sys import gzip import pickle import logging from typing import Dict import h5py import numpy as np from skimage.transform import resize from ml4h.normalizer import ZeroMeanStd1 from ml4h.TensorMap import Tensor...
472886e3752037172bb2838aa9c7af75e9e9401d15d52005edfae1564d196575
Python
8,661
247
import numpy as np import pytest import torch import torch.nn as nn from sinabs.layers import ALIF, ALIFRecurrent def test_alif_basic(): batch_size, time_steps = 10, 100 tau_mem = torch.as_tensor(30.0) alpha = torch.exp(-1 / tau_mem) input_current = torch.rand(batch_size, time_steps, 2, 7, 7) / (1 - ...
b90eebb061da195dcd57ccc24761b6aa49439ac0fd59950f27ae5d6056e58085
Python
8,664
202
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch import torch.nn.functional as F import pandas as pd import numpy as np from unicore import metrics from unicore.losses import UnicoreLoss, ...
ac71f66099d83d873ac7575d831f019e986b19b3588baf753110c1b5252261b7
Python
8,665
132
import os import argparse import easygrid import pdb # DFR add 8-31-21 # Stages MAKE_TEMPLATE_FILES = 'make_template_files' TRAIN_MODELS = 'train_models' SCORE_SUMSTATS = 'score_sumstats' GATHER_SUMSTATS = 'gather_sumstats' if __name__ == '__main__': parser = argparse.ArgumentParser('Script to generate LD score r...
f29ccb5af16fe2b2dce09c2f1033b670f73de28043f094c92f27953a22692064
Python
8,666
211
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion): # --------------------------------------------------------------------------------...
42b38676413f218254da1a0493295ef6fa041f83c29652c64a66d05c71ebaee1
Python
8,668
267
'''test our simple memory mechanism on meta scene vectors using a encoding-recall temporal generalization test assume: - the model encode at time t, where t can be some early time points or at the end of each event - the model recall LC (context classification) at time t - for both retrieval and encoding, the model use...
465aa11c4e73b50a7e217a966bcb863bfdeb62ea84addf2973bc8800ec5a459b
Python
8,669
204
import os,time,pickle import numpy as np import torch from timm import scheduler as schedulers # do not delete! from os.path import join from tqdm import tqdm from tensorboardX import SummaryWriter from torch.nn import DataParallel as DP from tools import * from sleep_models import build_model import w...
dfc0a39bf3b29135024dc72cec83c24e7afaafb03308cdebd68304dacea56094
Python
8,670
227
from sklearn.model_selection import train_test_split import torch,os, pickle, threading from torch import nn import numpy as np import matplotlib.pyplot as plt class MedianAge(nn.Module): def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) def forward(self, x): ...
b08d062a1d8593272260526eb822c2722b4ece51237c41046d21bf3a2257202c
Python
8,683
231
from collections import deque from copy import deepcopy from dataclasses import dataclass from typing import Dict, List, Optional, Tuple, Union import sinabs from .dvs_layer import DVSLayer from .dynapcnn_layer import DynapcnnLayer from .exceptions import InvalidModel @dataclass class LayerConstraints: kernel_m...
9c70c54789d390550f6211d6c7a6b5e758a6f1968f98b308dfe7ea4007cfde0d
Python
8,684
255
"""Tests for dashboard token authentication.""" import sys import pytest import requests import ray from ray._common.test_utils import wait_for_condition from ray._private.test_utils import reset_autoscaler_v2_enabled_cache from ray.autoscaler.v2.utils import is_autoscaler_v2 from ray.experimental.internal_kv import...
0659dd71455d6dbfd0047369ec627664bf5f6808c55e2476a021c79787bbd2fd
Python
8,687
257
"""Compositional preprocessing for microbiome AnnData. All functions operate on a ``samples × features`` AnnData with int counts in ``X``. Most write the result back into ``X`` (returning a new AnnData is not default; pass ``copy=True`` to avoid in-place modification). """ from __future__ import annotations from typi...
a193a3f6a2516b401b07e3054e15ffb441ca3bdf8378661d14da503d5b055d15
Python
8,691
309
import gzip import logging import re import tempfile from pathlib import Path import numpy as np from Bio.PDB import (PDBIO, NeighborSearch, PDBParser, Polypeptide, Select, Selection) from pokeformer.consts import PDB_SET_DIR logger = logging.getLogger(__name__) _hydrogen = re.compile("[123 ]*[...
eb0add0c74250b9f73b17425e0285b5a39d9bd9ac811601f9788b1ad5afcd303
Python
8,692
219
from torch import nn from abc import ABC, abstractmethod from torch import Tensor from torch.nn import functional as F from torch.nn.modules import Module from torch.nn.modules.activation import MultiheadAttention from torch.nn.modules.container import ModuleList from torch.nn.init import xavier_uniform_ from torch.nn....
07d9390bf426feb6bc9b25bdcf60897fa9963e07cf28a07748e7e1f65d720cca
Python
8,695
206
import matplotlib.pyplot as plt import pickle import numpy as np import os import pandas as pd from util import * from sklearn.metrics import auc, accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay from sklearn import svm POS_NUM = 250 NEG_NUM = 25000 def plot_pr...
16ab790f8d5041226170a10650be9c6065e013e79bf9f653fe812ce9f41fafe4
Python
8,701
182
# -*- coding: utf-8 -*- #Written in Python 3.7 #Python 2 compliant as of 6/16/17 #Most recently updated/tested in openpyxl 2.6 """ Python functions for the Factorial Mass ERP Univariate Toolbox AUTHOR: Eric Fields VERSION DATE: 18 April 2019 """ import sys import re import openpyxl from openpyxl.styl...
a4d4afa40dc319dc726f27dc35f9f469d1e8516f5bc1b0c3f8ffd77477ef475a
Python
8,701
228
import os import time import datetime from subprocess import call import numpy as np import pandas as pd import seaborn as sns from scipy import stats import seaborn as sns import matplotlib.pyplot as plt import scipy as sc from matplotlib.colors import ListedColormap import scipy.sparse as sparse from scipy.stats imp...
ea3bbc88b26273aa71940207683ba1059e137c1bef45e65ee15229512bbd49ad
Python
8,704
253
import sys import random import networkx as nx # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom utility functions def kcorepercolationPlateau(G, rm_nodes, kcore, dp, p, zeta, simu,...
ed2a9b03162d24bf3549012638c3b2904e0100f4550a268306bc882fb6206f2c
Python
8,707
230
import os import re import shutil import logging import datetime import argparse import xmltodict from timeit import default_timer as timer def _format_date(input_date, day_flag, sep_char='-'): '''Format input date from `mm-dd-yyyy` into `yyyy-mm`, or `yyyy-mm-dd` This is the ISO 8601 standard for date''' ...
47ba675fcf7995a34a39acb10df71d9bdf6fc68f667e3cd38ae0ff1614eea5a0
Python
8,709
287
# -*- coding: utf-8 -*- """ Created on Wed Nov 17 11:53:51 2021 @author: mmall """ CODE_DIR = 'C:/Users/mmall/Documents/github/' SAVE_DIR = 'C:/Users/mmall/Documents/uni/columbia/assignment_errors/fits/' import socket import os import sys import pickle as pkl import numpy as np import scipy as sp import matplotlib...
e425aadef79bcfe7b6866a67b05a7b21ddf5948d8bf9ff1a61f4baf187aee685
Python
8,710
253
import sys import random import networkx as nx # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom utility functions def kcorepercolationPlateau(G, rm_nodes, kcore, dp, p, zeta, simu,...
1dbffbc941b707a565987daf6de79f10fa27687afe500d2da87e0bab0e40947b
Python
8,711
258
import matplotlib.pyplot as plt import nir_reference_impl import norse import numpy as np import snntorch as snn import torch # NOTE: this requires snntorch Pull-Request #246 and nirtorch/feature-state from snntorch import export_nirtorch from torch import nn def compare_spike_counts(results): n_spikes_st = np.c...
789116a9c4425a4044e0df5932936fa899d253235a17d7c94591866cf12c1d02
Python
8,713
387
import numpy as np import nir from .test_readwrite import factory_test_graph from tests import mock_affine def test_sequential(): a = mock_affine(2, 2) b = nir.Delay(np.array([0.5, 0.1, 0.2])) c = nir.LIF( tau=np.array([10, 20, 30]), r=np.array([1, 1, 1]), v_leak=np.array([0, 0, 0...
98686747f2785560586bc2b9ef356e57d2ad37a3fc809871b7f8c9b63b7ba3b7
Python
8,714
285
"""Databricks credential providers for Ray Data. This module provides credential abstraction for Databricks authentication, supporting static tokens with extensibility for future credential sources. """ import logging import os from abc import ABC, abstractmethod from dataclasses import dataclass from typing import C...
86b0ad01dc7aee77355bd398fe5b5cc8f426386f5ec56006cd13c69a92a1a91c
Python
8,716
217
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import logging import math import time from typing import TYPE_CHECKING, Iterator import numba as nb i...
90d5da3c3f069bd79ffdf261ecede5afabd890b49805dbbb51f636b2388d8ea7
Python
8,716
259
import argparse import os import numpy as np import pytorch_lightning as pl import torch import torch.nn.functional as F import torchaudio import hydra from omegaconf import OmegaConf from torch.distributions import Categorical from tqdm.auto import tqdm from src import utils from src.dataloaders.audio import mu_law...
63b5ad5882832ba1665c56eeb5e421a04ae531e950fdce164883eb7ad9a5552e
Python
8,717
233
# built-in dependencies import base64 # 3rd party dependencies import cv2 import numpy as np import pytest # project dependencies from deepface import DeepFace from deepface.commons import image_utils from deepface.commons.logger import Logger logger = Logger() detectors = ["opencv", "retinaface"] # opencv 5 droppe...
d60ac834b14d110fc03ed548838c1374e1c583c22c2bab3c7bf597b728d89b66
Python
8,717
266
# Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
52f4349520658dd4c9a531305bb6517de7251b0d3254ba7454884a1401e52043
Python
8,719
198
from lisa.core.lisa_core import LISA_Core from lisa.lisa_public_data.genes_test import FromGenes from lisa.core.data_interface import PACKAGE_PATH, REQURED_DATASET_VERSION, INSTALL_PATH from lisa.core.lisa_core import CONFIG_PATH as base_config_path import numpy as np from scipy import sparse from lisa.core import geno...
b10492d32eeab60ffe96ae0227bbca63bba36ec40e07ceb80ed293d7bc514106
Python
8,719
221
#################################################################################################### # Copyright (c) 2022, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is free softw...
9d29470edfcc3ccd8c90b95c5098a64b56399447403958efb659493aedb7fa85
Python
8,720
113
""" DATA COLLECTION FOR BENCHMARKING @date: 02/09/2023 @author: dimiboeckaerts """ import pandas as pd from Bio import SeqIO, Entrez absolute_path = '/Users/dimi/Documents/GitHub/PhageDEPOdetection/data/Benchmarking/' # 1 - NCBI DATA COLLECTION, FASTAS, DATAFRAME # ------------------------------------------ # collec...
73e40a60db2247bb75d9768cc9573937f60c671d04f689d6517ca2b654fcf193
Python
8,723
197
# Copyright (c) 2017-present, Facebook, Inc. # # 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 agreed...
aa3e240dc99ae83a3caa4bcc320493fdecc4cb31bf45c7e61df821ce6bd0297f
Python
8,723
243
#!/usr/bin/env python from __future__ import print_function import argparse import glob import sys import numpy as np import pysam import time import tempfile import os from subprocess import run from contextlib import closing from multithread import * import subprocess FORWARD="FORWARD" BACKWARD="BACKWARD" FILE_LOCAT...
0542787812d1354e7907006ebf382482e2fd3a053df147f7d9faf1daca438910
Python
8,724
187
import torch import utility import loss from trainer import Trainer torch.backends.cudnn.enabled = False import argparse from div2k import DIV2K from torch.utils.data import dataloader import model def options(): parser = argparse.ArgumentParser(description='EDSR and MDSR') parser.add_argument('--model', defa...
f5635d73e6605aca824a59c24348c48497651bf3f9c802fc60147c5d95c3f61b
Python
8,724
174
import torch.nn as nn import torch from pytorch3dunet.unet3d.buildingblocks import DoubleConv, ExtResNetBlock, create_encoders, \ create_decoders from pytorch3dunet.unet3d.utils import number_of_features_per_level, get_class class Abstract3DUNet(nn.Module): """ Base class for standard and residual UNet. ...
210a373d125255d093557966be18652d8ef698f8891793511d025c63e8730d6d
Python
8,725
218
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
8d90ef773fb5de1d6c8729885bd2288b1a820eb1d0a6c5288a26a7bb0cd606e1
Python
8,725
158
# Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # and Applied Computer Vision Lab, Helmholtz Imaging Platform # # 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 L...
d85e089bc8d575c0ce226dd0a8f0a3268bcc88cbd42f6b55618f9ad7c10b42d0
Python
8,725
187
from lisa.core.utils import LoadingBar from lisa.core.assays import LISA_RP_Assay, delta_RP_wrapper, transform_RP from multiprocessing import Pool import numpy as np from scipy import stats, sparse import os from collections import defaultdict class PeakRP_Assay(LISA_RP_Assay): def __init__(self, **kwargs): ...
130d0ef77ace0cb688dbb553996e7bfcd2a40f23839336884e532c4ee78d949f
Python
8,726
139
#!/usr/bin/env python # coding: utf-8 # author: Maruthi Mutnuri (maruthi2008@gmail.com) # loading libraries import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.experimental import enable_iterative_imputer from sklearn.impute import IterativeImputer from sklearn.lin...