sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5c99a4bb902a438623d7402666ff7392961964b039f972a40bdc81bc337963e8
Python
3,588
64
# Case 1: courtship vs defense — recursive A·D·C·Φ likelihood, parameter & model recovery import numpy as np, json, sys from scipy.optimize import minimize from scipy.special import logsumexp rng=np.random.default_rng(11) NC=9; TAU_U=200. def design(n_wt=275,n_lc=60,n_ph=0,n_p1=0): n=n_wt+n_lc+n_ph+n_p1 g=np.r_...
79f52c837633a9f08bc93438ff54c4d9da35b573dae392621e42a2e657ae2a79
Python
3,588
99
from catboost import CatBoostRegressor from lightgbm import LGBMRegressor from pathlib import Path from sklearn.ensemble import RandomForestRegressor from sklearn.impute import SimpleImputer from sklearn.metrics import roc_auc_score from sklearn.model_selection import train_test_split import numpy as np import sys de...
3b086b74246d0896e3f5cbea5efff79973c06baebc2fcb99858bcdc17e70f1c6
Python
3,589
141
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ For every gene in the provided GTF, subtract UTR sequence from the exonic features. Requires the input GTF be sorted by gene_id (`sort -k10,10`). """ import argparse import sys import re import pybedtools as pbt def parse_attribute(attribute): """ Convert ...
120d711bfc65f13120926ba941441fac0be9df66dbd1aa962e3b74f511088d0a
Python
3,591
99
import os def main(): SEQ_LEN = "800" HALF_SEQ_LEN = int(SEQ_LEN) // 2 QUATER_SEQ_LEN = int(SEQ_LEN) // 4 print("QUATER_SEQ_LEN: ", QUATER_SEQ_LEN) # output_files = ["./dataset/pos/", "./dataset/outlier_test/", "./dataset/neg_5/"] output_dir = "./dataset/" output_files = [output_dir+"pos...
9105a6cb34d0b701a932cbe17017cf5702682e72418c4752a37704924979e53b
Python
3,591
124
from scipy.io import loadmat from scipy.special import erfcinv import numpy as np import pandas as pd from scipy.stats import kstest, kruskal from itertools import combinations from matplotlib import pyplot as plt def star(p_val): assert 0 <= p_val <= 1 if p_val >= 0.05: return 'ns' if p_val >=...
c1eec5b5b85159a9fc2d85cb9a7083052b17c625f56efe11e8ab876ac7226635
Python
3,591
141
import os import subprocess seed_list = [1111, 2222, 3333, 4444, 5555] #snn_ratio = [0.05, 0.25, 0.5, 0.75, 0.95] snn_ratio = [0.05, 0.15, 0.25, 0.35, 0.45, 0.5, 0.55, 0.65, 0.75, 0.85, 0.95] log_folder_path = "./log/" dataset = "mnist" rnn_type = "rnn" def extract_one_performance(model, seed, ratio=None): if...
2d0b3185b7b093119330567ec0556fbf798ac08128ffc3bc3e7133034b32c778
Python
3,592
105
import torch from loss import spearman_loss from metrics import spearman_corr class ProcessingData(torch.utils.data.Dataset): def __init__(self, train_csv, train_pt, dataset_type): self.train_csv = train_csv self.train_pt = train_pt self.dataset_type = dataset_type def __len__(self)...
aae6ed4caa3cf3e38b38386eff285f7ef4623fbd0efb7d20d7b4c08a18fccbb9
Python
3,592
99
from abc import ABCMeta, abstractmethod # Delay importing optuna since it is an optional dependency. try: import optuna _optuna_available = True except ImportError: _optuna_available = False class EvaluationHook(object, metaclass=ABCMeta): """Hook function that will be called after evaluation. ...
37084e17ee2cbaeb72997560e6f6f60a86679a280da32eee09ef45ee9a93963c
Python
3,593
116
#Download deepforest before tests start import comet_ml from deepforest.main import deepforest import geopandas as gpd import os import glob import rasterio as rio from src import data from src.models import year from src.models import dead, multi_stage from src import utils import tempfile import torch from pytorch_li...
c4c64b72e50ed6a85af53e29a53ac2662b3a7fa0c484ae314eb287c79022e812
Python
3,593
110
import unittest from unittest.mock import Mock, call import torch from rising.transforms import AbstractTransform, BaseTransform, PerChannelTransform, PerSampleTransform class AddTransform(AbstractTransform): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.grad_tensor...
956ffd7a5eeec3d07ac8a186ceb10ff134f0b5c3a1a22d1dced5a729563420bd
Python
3,594
99
# -*- 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. #...
b7f4eed3afb42180208d26414beb0ed7639808bd62c6a38c738275cf8e5c1db2
Python
3,594
105
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
e1ecb2bb1b9e03873c601803040878057c8d68ba6c135b98fa5dead534c4aac1
Python
3,595
124
import sys import getopt import math import numpy import random import logging import numpy as np from skimage.color import rgb2yuv, yuv2rgb from PIL import Image import os from shutil import copyfile class YUV_Read(): def __init__(self, filepath, h, w, format='yuv420', toRGB=True): self.h = h sel...
0ae01550dbfbac0773f204e7e43b88745c49f77267d97843a0232d20f00f7a04
Python
3,597
89
# Copyright 2023 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...
324914702df29714362069a3f114878591e16e325d9cf5ad9736ddd5f9b6ac3e
Python
3,598
96
# import the main libraries required for the preprocessing import mne from pathlib import Path import numpy as np import matplotlib.pyplot as plt import os import pickle from scipy.stats import zscore # import homemade function from technical_validation_utils import (parula_map, interp, subjects) mne.set_log_level(v...
ef982a90b04303795187abe4e908742d0a294baca0af598175e81b11caea2e06
Python
3,598
98
import pytest @pytest.mark.parametrize( "in_channels,out_channels,kernel_size,padding,stride,input_shape", [ (2, 2, (3, 3), (1, 1), (1, 1), (2, 8, 8)), (2, 4, (7, 7), (3, 3), (1, 1), (4, 8, 8)), ], ) def test_specksim_conv_layer_setup( in_channels, out_channels, kernel_size, padding, s...
8ee88ffacb964f21151752226b8b215319fd6224d0c8aedd36b7986df6e5d6a5
Python
3,599
90
""" This Script checks the provided WDL files with miniwdl for syntax, validation, and import errors. See the following page on the checks. Note that this script does not check for "warning" or "suggestions"; you may use `$ miniwdl check WDL_FILENAME` to get warnings and suggestions. https://miniwdl.readthedocs.io/en/...
370e9096b5357ca567fb9b53684397ab2f692478e081349444a7caf1bcd43c3b
Python
3,600
95
import keras from typing import List, Dict from common import DataRecord, SEED from innvestigate import create_analyzer from innvestigate.utils import model_wo_softmax # from scipy.ndimage import sobel, laplace import numpy as np from keras.layers import Conv2D np.random.seed(SEED) import os os.environ['PYTHONHAS...
d07246936e910aeef88af0ec1ff7a890404f16b0b377bed6c3788c5c155fad50
Python
3,600
98
import json import logging import os from typing import List from ray._private.runtime_env.constants import ( RAY_RUNTIME_ENV_PLUGIN_SCHEMA_SUFFIX, RAY_RUNTIME_ENV_PLUGIN_SCHEMAS_ENV_VAR, ) logger = logging.getLogger(__name__) class RuntimeEnvPluginSchemaManager: """This manager is used to load plugin j...
fbe4accb46c7fe7f7d6d2bd39fc6fb88bb5949b3827027ca3032af4300cbe652
Python
3,600
76
import numpy as np from sklearn.metrics import pairwise_distances import matplotlib.pyplot as plt # Linearly scale isodepth range inside each domain s.t. isodepth approximately measures microns # isodepth: N x 1 numpy array of isodepth values per spot # num_domains: number of domains # q_vals: num_domains x 1 array...
50ba3f2784c85fe345b05739c3214fbdddf3e6ecf62e738c23a16edda390f583
Python
3,602
115
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar, Generic, Protocol, Self, TypeVar import cvat_sdk.auto_annotation as cvataa import cvat_sdk.datasets as cvatds from cvat_sdk imp...
9358b59eac00c9473e3eb7eeb11cb9bd942e09183d1b2a7e63a559ab13026bf4
Python
3,602
113
import stereoEstimation import readGPS import os import shutil import argparse if __name__=="__main__": print "check" parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('img0_folder', type=str, default="/home/leo/Nvidia_SS/semantic-segmentation2/logs/eval_DM/dext...
444fdceb43b27dd4e3cec45febacad7511910abf5d74129f147815b757c96960
Python
3,605
112
import numpy as np import pytest from PIL import Image from siapy.core.exceptions import InvalidInputError from siapy.core.types import XarrayType from siapy.entities.images.mock import MockImage def test_initialization(): # Valid 3D array valid_array = np.random.rand(100, 100, 3).astype(np.float32) mock...
9ab07b6e2318085d4928c6e7ee2db00e325e7056acf9585819637ed69cb5e7e2
Python
3,605
85
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # mypy: disable-error-code=attr-defined """Tile with quantized periphery and outputs.""" from typing import TYPE_CHECKING, Optional, Tuple from torch import T...
d3319c1c75e7f9e3f7fdbf43d98e9009b4741e6b5e47a96666a475c696c0f3d1
Python
3,606
89
# Copyright 2023 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...
2f6dff997d91efc9f1d6ea422145df4d0ca373dac9fde34fb6777985952f7082
Python
3,607
116
'''train a regular nn on two bandits -- see if ... 1. is there a development of certainty representation, which can be used to trigger CRP 2. is h_t different across bandits, which is needed for CRP to do the right splitting ''' import numpy as np import torch import torch.nn as nn import seaborn as sns import matplotl...
596b5d95ea95268ce1b74115c1eb6a01348988ad7f8881c9c4cbe2049df9f94f
Python
3,608
109
'''define prediction error in the case of 2 gaussians''' import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt from scipy.stats import sem import seaborn as sns sns.set(style='white', palette='colorblind', context='talk') cp = sns.color_palette(n_colors=2) alpha = .7 np.random.seed(0) '''help...
84ccd6e2d1ca4b2724f245117f282fba2530d1b213729f624fd01ff72ee90264
Python
3,610
99
import numpy as np import scipy.sparse as sp import torch import torch.nn as nn import torch.nn.functional as F from ..nn.gcn import sparse_or_dense_dropout from ..utils import to_sparse_tensor __all__ = [ 'ImprovedGCN', 'ImpGraphConvolution', ] class ImpGraphConvolution(nn.Module): """Graph convolution...
2634faa39df312e1edb0566e00720bd5c80eaa8cd6dc9669f1c0ec5e9d041fb9
Python
3,611
112
import tensorflow as tf from tensorflow.keras import backend as K import os, sys import matplotlib.pyplot as plt from utils import * import gc sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib.pyplot as plt; plt.rcdefaults() from keras.models import load_model from pkg_re...
86dc49b1e57c7d055a39f865ec7d4d2af3c3265cb1042b2fcdeb53a1dbf7ba15
Python
3,612
71
""" This file will help to demonstrate pipeline for testing microscopy data using the DeepCAD-RT algorithm. The demo shows how to construct the params and call the relevant functions for testing DeepCAD-RT network. The demo will automatically download tif file and corresponding model file for demo testing. See insi...
567934773eb5951add329b19c5924d208ae82e4cd714e7872fb75a1b9575a4c7
Python
3,615
109
#!/usr/bin/env python # -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Compare the metric values captured by two runs of ``run_examples.py``. By default the two most recent runs under ``run_results/`` are c...
e1fdb16b37960a5aca1bc45d27a3202be1acca6b01add44e26b7c1ab315760a1
Python
3,615
112
import tensorflow as tf from tensorflow.keras import backend as K import os, sys import matplotlib.pyplot as plt from utils import * import gc sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib.pyplot as plt; plt.rcdefaults() from keras.models import load_model from pkg_re...
2db10dbe9fc6ae08778ae92209b2c5b4f0c540bffe7fe7a2eafdd87ba4b69739
Python
3,616
87
import requests from .__config import base_url from .__aux_funcs import process_response def fetch_status_display_patient_trts(study_ids, tier="Agent"): """ Check if patient level treatments should be displayed. \n :param study_ids: List of Study IDs. \n :type study_ids: list of str \n :param tier:...
12e463e41c5778275dc4a6fad39c7effe238accafb8d71e6a920d8c698254c38
Python
3,617
95
import math import torch import torch.nn as nn import torch.nn.functional as F from models.DeepLab.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d class _ASPPModule(nn.Module): def __init__(self, inplanes, planes, kernel_size, padding, dilation, BatchNorm): super(_ASPPModule, self).__init_...
261740eb12f60942f0dbf4e3b8f7d810c7259488ecb92bddfb83632f83161b6e
Python
3,617
82
#Imports relevant modules import os import csv #Defines the path of the directory containing compiled data for all pipelines. compiled_dir = '\\<directory root>\\Sustainability_Output\\Compiled' #Defines the path of the directory that output data should be written into. JASP_dir = '\\<directory root>\\JASP\\O...
c276650e27d775f50be9d4cdfa03edc29cb3345c97ca05f915e7d093a3dfe202
Python
3,617
102
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Python version: 3.10.9 pandas version: 1.5.0 seaborn version: 0.11.0 matplotlib version: 3.6.3 pingouin version: 0.5.3 ptitprince version: 0.2.6 scipy version: 1.11.4 """ #%% Import Modules import pandas as pd import glob import seaborn as sns import matplotlib.pylab...
35f48b72776afa9b52a39c018815173e3d852d118448d3d54982d9f7ffd17b2e
Python
3,618
99
''' MBEANN settings for solving XOR. ''' class SettingsEA: # --- Evolutionary algorithm settings. --- # popSize = 100 maxGeneration = 100 # 0 to (max_generation - 1) isMaximizingFit = False eliteSize = 0 tournamentSize = 20 tournamentBestN = 1 # Select best N individuals from each tourn...
49486d8566febbfa1e66eed97aa993634c335205547e1b6e2859b5c62c174792
Python
3,618
99
import torch import os from banditopt import algorithms, models # import sys # sys.path.insert(0, "..") from .defaults import regressors_dict class AlgorithmsConfigurator: """ Implements the configuration of the algorithms based on the given configuration file. """ def __init__(self, config, **kwarg...
9de54a2ae611f2c47e4e08a169eae13a2190604888432837617e5d1e01fac822
Python
3,618
91
"""Qwen3 with the LM head replaced by a scalar reward head, as a vLLM plugin.""" import os from collections.abc import Iterable import torch from vllm.config import VllmConfig from vllm.logger import init_logger from vllm.model_executor.layers.linear import ReplicatedLinear from vllm.model_executor.layers.pooler imp...
dd688023fee177f93d42c8c67ab4bddfa6b483aeb1fa8642ace4d0e0efd3b5ef
Python
3,619
98
#################################################################################################### # 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...
c73cdcc13d5a9f13fdcdf9b97f332fc575c4a77d97ae0172b8fd7e3c6afdf9e8
Python
3,620
119
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 21 23:29:28 2021 @author: Saad Idrees, Joel Zylberberg's Lab, York University idrees.sa@gmail.com """ import numpy as np import tensorflow as tf import models import prfr_params from tensorflow.keras.layers import Input # %%GENERATE RANDOM DATA ...
306a799882b34f4043c18e1d95f28518db42e12f661cb1d854888f1257c88074
Python
3,621
132
import os import sys import time import errno import time import timeit import numpy as np from numba import jit import warnings warnings.simplefilter("ignore") @jit(nopython=False) def VEP2Dmodel_sensor(params, constants, init_conditions, SC, Gain, dt, ts): nt=ts.shape[0] nn=SC.shape[0] ns=Gain.sha...
3592dbce81518d0c48f7a0fe1921259289f6df75760720c0ffb9ffadde5d6fe3
Python
3,621
145
"""Benchmark to test time and memory performance of History. Before #312, the timing would be roughly 5 sec and memory usage would triple. After #312, the timing would be roughly 2 sec and memory usage roughly constant. For the reasons, see #306. """ from pprint import pprint import time import numpy as np from sk...
7126902acc162f97cc22abad696d8382a94cf8df07753b5046b3c7a837b674bb
Python
3,624
98
import logging import threading from typing import Optional import ray import ray._private.ray_constants as ray_constants from ray.air._internal.device_manager.cpu import CPUTorchDeviceManager from ray.air._internal.device_manager.hpu import HPUTorchDeviceManager from ray.air._internal.device_manager.npu import NPUTor...
cad11aca5ab770617a50d8c832f6908b1a50e7eb653631180f5174eae841b213
Python
3,626
41
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: i_onnx_common.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor...
dc0995a5182b48beafb3f38ffceb520ecb75230e399e94cfe40e1594be8736fd
Python
3,627
94
r"""Version shims for anndata and zarr. omicverse supports a range of anndata versions rather than tracking the newest, so the differences between them are collected here instead of being scattered through the codebase. What actually differs --------------------- Measured on real installs (anndata 0.11.4 + zarr 2.18....
773baa42211d37cc804da55e6836da33d19c0ac2cc6f812522c37171ae5fde13
Python
3,628
132
# -*- coding: utf-8 -*- import numpy as np from vtkplotlib._get_vtk import vtk from vtkplotlib.plots.BasePlot import SourcedPlot, _iter_colors, _iter_points, _iter_scalar class Sphere(SourcedPlot): """Plot an individual sphere.""" def __init__(self, point, color=None, opacity=None, radius=1., fig="gcf", ...
26b8492244a6b97297e93d10b8b84f48389f4da6f4e14339fd1723d5caeae543
Python
3,629
105
""" Calculate surprisal and frequency for each word in a sentence using the pre-trained German BERT model and DeReKo 1grams. """ import os import json import logging import torch import numpy as np import pandas as pd import tqdm from pathlib import Path from transformers import BertTokenizer, BertForMaskedLM from ge...
8a3d7bccf64b2179c2a4d107eed5b2db4b58407192d8c386bb78794e801cab31
Python
3,629
111
import math import torch import torch.nn as nn def batched_index_select(values, indices): last_dim = values.shape[-1] return values.gather(1, indices[:, :, None].expand(-1, -1, last_dim)) def default_conv(in_channels, out_channels, kernel_size, stride=(1, 1), bias=True): return nn.Conv2d( in_cha...
c502da3736c2a704c14dd2a6caf5f3b7d19aca6275dfc48568c78133c34611e5
Python
3,629
120
# __program_start__ import ray from ray import DynamicObjectRefGenerator # fmt: off # __dynamic_generator_start__ import numpy as np @ray.remote(num_returns="dynamic") def split(array, chunk_size): while len(array) > 0: yield array[:chunk_size] array = array[chunk_size:] array_ref = ray.put(np....
c6e362d48993529f938815f844aca3abe013fe6b79be423257a3c398016b2d5b
Python
3,629
110
"""Utils to detect runtime environment.""" import logging import os import sys from typing import List from ray._private.runtime_env.utils import check_output_cmd _WIN32 = os.name == "nt" def is_in_virtualenv() -> bool: # virtualenv <= 16.7.9 sets the real_prefix, # virtualenv > 16.7.9 & venv set the base_...
de02875b66f129f30e31e92fa00dcf92242c87b2da1693df5f77652ab9aef9a5
Python
3,629
115
from pathlib import Path from typing import Literal import math import pickle import json import matplotlib.pyplot as plt import argparse import logging import pandas as pd import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from timm.utils import ModelEma from timm.loss import Label...
1bfb8dbe7dbe878906706b9d7f66dbbfe07a1cc54ede64f6a154663c709a048f
Python
3,630
98
from typing import Any, Dict, List, Optional, Tuple from ray.util.annotations import DeveloperAPI @DeveloperAPI class CommandRunnerInterface: """Interface to run commands on a remote cluster node. **Important**: This is an INTERNAL API that is only exposed for the purpose of implementing custom node pro...
8bf9e7c0f8d82fbf6b983db86f9041469e37cdf4f530b6276e86e1f276cf0f49
Python
3,630
58
#Plot abundance distribution from glob import glob import os import pandas as pd import geopandas as gpd from src import start_cluster client = start_cluster.start(cpus=100,mem_size="5GB") #Same data #species_model_paths = #"/blue/ewhite/b.weinstein/DeepTreeAttention/snapshots/06ee8e987b014a4d9b6b824ad6d28d83.pt", ...
73127aa4780a279724e1f56f9c937a78d7ea3c5ddacd7371057c58ecc5a04475
Python
3,634
99
''' MBEANN settings for the double pole balancing problem. ''' class SettingsEA: # --- Evolutionary algorithm settings. --- # popSize = 1000 maxGeneration = 500 # 0 to (maxGeneration - 1) isMaximizingFit = True eliteSize = 0 tournamentSize = 20 tournamentBestN = 1 # Select best N indivi...
af2bf69292d7cfc2ddde322756275d78f9fc0d8c2eeb182d4e3e1479ac9577f3
Python
3,634
102
from pathlib import Path import torch from einops import rearrange from structured_kernels import cauchy_mult_sym_fwd, cauchy_mult_sym_bwd # try: # from cauchy_mult import cauchy_mult_sym_fwd, cauchy_mult_sym_bwd # except ImportError: # from torch.utils.cpp_extension import load # current_dir = Path(__fil...
b8cfd44ac83f80b3c9f5a21407839f7a7dd3f6b6a931ae8c88bc27d76da569ff
Python
3,636
109
"""Plotting helpers for ambient-RNA decontamination diagnostics. A single light helper, :func:`plot_contamination`, draws the per-cell contamination-fraction distribution. For embedding overlays or grouped violins, prefer the general omicverse plotting surface (``ov.pl.embedding(adata, color='ambient_contamination')`...
22c650225a1e8f9cc083787a385ef7315b4815bdfeaec03921cff9d8ed55f855
Python
3,637
89
import tensorflow as tf from models.deep_learning.deep_learning_models import DLRegressor from utils.constants import is_spline class GRURegressor(DLRegressor): """ This is a class implementing the GRU model for time series regression. ! Remember to use regularization techniques such as dropout, weight d...
be6ddd381340c344b62ca9f130539ebed4aa1d60b34d884aa5319ca061aa91e9
Python
3,637
88
import copy from typing import List, Tuple, Union from mmdet.models.detectors import BaseDetector from mmdet.structures import SampleList from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig from mmengine.utils import is_list_of from torch import Tensor from lqit.registry import MODELS @MODELS.register...
cb88076e579991acaa27db4c8148f9632aa29121f9e693b2ed92783fea7af32e
Python
3,637
94
import torch import torch.nn as nn # derived from https://github.com/leoxiaobin/deep-high-resolution-net.pytorch def ohkm(loss, topk): ohkm_loss = 0. for i in range(loss.shape[0]): sub_loss = loss[i] topk_val, topk_idx = torch.topk( sub_loss, k=topk, dim=0, sorted=False ) ...
eb61b62aaf86fd6262772cf61d7a2a89f5c6ae4e6ba02ad7cb5947b88bd07bce
Python
3,637
89
import torch import torch.nn as nn import math import torch.utils.model_zoo as model_zoo from torch.nn import functional as F import torch import torch.nn as nn import torch.nn.functional as F #from resnet50 import Resnet50 as backbone from . import resnet_custom as resnet from torchvision.models.segmentation.deepla...
698854adc051bcbcaf6d1815b991c35705aad816f2a6e756ca80e3d005d9a727
Python
3,638
103
""" 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 typing import TYPE_CHECKING from ase.calculators.calculator import PropertyNotPresent from pymatg...
81d20b6271508ca94b713bfcfa533691034ca61abf34dcddaae283bafdb19533
Python
3,638
126
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Annotate a VCF of structural variants with a list of genomic elements. """ import pandas as pd def split_gencode_fields(field_str): fields = field_str.strip(';').split('; ') fields = [x.split(' ') for x in fields] fields = dict(map(lambda s: s.strip('"...
0810c29a12124a0fcc8933eac4e09970f0224f3abf27bc407460302f88c940fa
Python
3,639
106
"""Used to check bazel output for team's test owner tags The bazel output looks like <?xml version="1.1" encoding="UTF-8" standalone="no"?> <query version="2"> <rule class="cc_test" location="/Users/simonmo/Desktop/ray/ray/streaming/BUILD.bazel:312:8" name="//streaming:streaming_util_tests" ...
72c67c96aaaf03a8586c0ebdbf3617dec6fb5f55f311f5ec61fe82774dbacb51
Python
3,639
104
import logging import os from typing import Dict, List, Optional from ray._common.utils import try_to_create_directory from ray._private.runtime_env.context import RuntimeEnvContext from ray._private.runtime_env.packaging import ( delete_package, download_and_unpack_package, get_local_dir_from_uri, is_...
eda1902f6babaf8fd9e976e4bc8477a96c92fe167256605a256dd3a29bca1426
Python
3,639
91
import gzip import re from csv import DictReader from pathlib import Path from . import utils def download(path: Path, version: str = "current"): url = f"http://cbdm-01.zdv.uni-mainz.de/~mschaefer/hippie/HIPPIE-{current}.mitab.txt" utils.download_file(url, path / "HIPPIE-current.mitab.txt", "Downloading HIPP...
eec13d03d44ebe763e136cedba506b7981275b36afcd3433c5b304978e58d927
Python
3,639
99
# -------------------------------------------------------- # SimMIM # Copyright (c) 2021 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Zhenda Xie # -------------------------------------------------------- import math import random import numpy as np import torch import torch.distri...
10c0dc8ab1c3c4d6325f5040ac2d0915b39915205a0be56df96c8d91779dcad6
Python
3,641
89
import pandas as pd import os import sys project_root = '/ccb/cybertron/khchao/splam-analysis-results/' output_dir = f'{project_root}train/results/ALL_RefSeq/BAM_REF_Intersection/' def get_hg38_chrom_size(): f_chrs = open("../hg38_chrom_size.tsv", "r") lines = f_chrs.read().splitlines() chrs = {} for...
d7a6cdf39f6030299a347db7c6002aee8718bacd2e37377eb18e6ce0fda761ed
Python
3,641
133
"""Get image metas on a specific dataset. Examples: python tools/misc/get_image_metas.py \ ${ANNOTATIONS FILE} \ ${PATH TO IMAGES} \ --out-dir ${OUTPUT FILE PATH} \ --img-suffix ${IMAGE SUFFIX} """ import argparse import os.path as osp from multiprocessing import Pool from mmcv import imread from ...
2cee149e72b5ca7323aec52212694e94c83ed6c97801caed2c1e7271b1c998c5
Python
3,643
81
#################################################################################################### # 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...
ab371cc3baff1d2ad47f8a10b3a7c02986e285caa6e338f9505a868bbfdb04b8
Python
3,643
96
import os import pandas as pd import matplotlib.pyplot as plt from adjustText import adjust_text annotations = ["chess", "gencode", "refseq_ucsc"] colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple'] os.makedirs("exon_intron", exist_ok=True) for level in ["exons", "intr...
b9b5dd0253b5460b79a0837ef7b29c4ef26fd0e5c8b7ee75e6499fb041658752
Python
3,643
121
""" 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 argparse import logging from pathlib import Path from fairchem.experimental.legacy.utils import...
223f52a5df47d9b5adf2bc554c7d13d36acf1de01ffb12ceef848132d9cf086c
Python
3,644
121
import numpy as np class ContextRep(): def __init__(self, context_dim, threshold=.3, n_contexts=100): self.context_dim = context_dim self.n_contexts = n_contexts self.threshold = threshold self.contexts = [ np.random.normal(size=(self.context_dim, )) for _ i...
87abe579d548519dede8ae985b379a005502a1460945356b98f15b2469b8a912
Python
3,644
98
import argparse, os, sys, glob from omegaconf import OmegaConf from PIL import Image from tqdm import tqdm import numpy as np import torch from main import instantiate_from_config from ldm.models.diffusion.ddim import DDIMSampler def make_batch(image, mask, device): image = np.array(Image.open(image).convert("RGB...
9d64b10940f0402dc78da88370233050302e7bdcf669282cdc1f332639b0fd01
Python
3,645
123
""" 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 random from functools import partial import numpy as np import pytest import torch from ase imp...
1d86975d2c653a6bcbb879b1c3f78ebe20020fc124f56313b3af204ddbb359b9
Python
3,646
71
import logging from os.path import exists from sklearn.metrics import precision_score, recall_score, f1_score, accuracy_score from sklearn.metrics import classification_report from agent.data.entities.config import RESULTS_FILE_TSV, RESULTS_FILE_TXT from agent.data.entities.config import CW_CLASS_VALUES, FC_CLASS_VAL...
771bd22e254ca873d0b618f56e2fe4cf7ca5c13f7efd42335d9532029f21d797
Python
3,646
97
# --------------------------------------------- # # This script generates samples at the reference and/or target level of theory # --------------------------------------------- # # define equilibirum sampling control parameters smiles = "Cn1cc(Cl)c(/C=N/O)n1" # SMILES of the molecule run_id = 1 n_samples = 1_000 # how ...
d1195ce45e691f64abcb436168f9f2f6d8e01e5cd966657989e5c7685ba68706
Python
3,646
86
import pandas as pd import os def get_hg38_chrom_size(): f_chrs = open("./hg38_chrom_size.tsv", "r") lines = f_chrs.read().splitlines() chrs = {} for line in lines: eles = line.split("\t") chrs[eles[0]] = int(eles[1]) return chrs SEQ_LEN="800" QUATER_SEQ_LEN = int(SEQ_LEN) // 4 p...
28d640e8c6cd126b6d931762a242cc6886be15834053e33dfa10ee9c4db6b486
Python
3,647
119
""" This file serves as a documentation example and CI test for data parallel + prefill-decode disaggregation. Structure: 1. Monkeypatch setup: Ensures serve.run is non-blocking and removes accelerator requirements for CI testing. 2. Docs example (between __dp_pd_example_start/end__): Embedded in Sphinx docs via liter...
c328a7b09e825b6e88abe962f248f3c375082d909e94bc4f20e5ede05f244b9c
Python
3,648
122
# -*- 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. #...
c31373f1e20083dee0ee2f4a5a650ae5a6a68bd74e7ed8e977838087cb0debdb
Python
3,651
104
import torch from sinabs.layers import ExpLeak, ExpLeakSqueeze def test_leaky_basic(): time_steps = 100 tau_mem = torch.tensor(30.0) input_current = torch.rand(time_steps, 2, 7, 7) layer = ExpLeak(tau_mem=tau_mem) membrane_output = layer(input_current) assert not layer.does_spike assert ...
d456950ca4c825074106cd3c1df144f6475d21f155ac254e7095e6014fb178f6
Python
3,651
77
""" This file will demonstrate pipeline for training microscopy data using the DeepCAD-RT algorithm. The demo shows how to construct the params and call the relevant functions for training DeepCAD-RT network. The demo will automatically download tif file for demo training. See inside for details. * This demo is ...
a21ad8cf679a081f67e9216b30f39b34f18db225c1a423100dc44e8697e264d9
Python
3,652
116
""" 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. ONLY for use in the NeurIPS 2021 Open Catalyst Challenge. For all other submissions please use make_submission_file.py. """ from __future__ im...
9caefb49c156993261264e89ac50b536086b2275c606a2e98e33cf85d2ccace7
Python
3,653
91
# Imports import sys,subprocess try: import scipy.io as sio except ModuleNotFoundError: subprocess.run([sys.executable, '-m', 'pip', 'install', 'scipy']) import scipy.io as sio try: import numpy as np except ModuleNotFoundError: subprocess.run([sys.executable, '-m', 'pip', 'install', 'numpy']) ...
adf72065febe722d9636c1a99f2a98ed582d6d762d8d047f25f8e8be926e87e1
Python
3,653
86
import numpy as np import pandas as pd from autogluon.text import TextPredictor from Bio import SeqIO import argparse import json def Csv_to_json(input_path,result_path): ''' This function takes two arguments input_path and result_path. It loads the csv file from input_path, it converts t...
61c49d5eb7362b159b63adb13799eca4f08522fb0d8415ca4972a0608bb17da4
Python
3,654
87
# Copyright 2026 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, ...
b17a8cda8b759c2ffb3d0883f2f72e7d804c1f813c254e523ca549009f51511b
Python
3,656
108
# 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.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
0dfcb3fc1616bfbf59c8781d6d36febae25f5e5cd3dedb8dca47fb656bad511b
Python
3,657
113
""" 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 typing import TYPE_CHECKING, Iterable if TYPE_CHECKING: from fairchem.demo.ocpapi.client impor...
d65dd6bc1abae1b069d6179b6f8d35179232bc21589caa76d56faa811a06ef51
Python
3,657
106
# ruff: noqa: F401 import warnings from pathlib import Path warnings.filterwarnings("ignore", message=".*The 'nopython' keyword.*") # noqa # isort:skip # Note: Geneformer dictionary files are not included in the package to reduce size. # Users must provide their own paths to these files when initializing the tokeniz...
e41590848fc8bb6e4161b05ee4ebd7aa6cd77c863f3200373fe82045cec4d9e6
Python
3,658
89
import tensorflow as tf from models.deep_learning.deep_learning_models import DLRegressor from utils.constants import is_spline class LSTMRegressor(DLRegressor): """ This is a class implementing the LSTM model for time series regression. ! Remember to use regularization techniques such as dropout, weight ...
818e1ec8e485bd8ae9ee753ea0e80e27f1316b7ee69cce9309350b6fe2ae45ad
Python
3,659
128
import logging import psycopg2 import yaml from psycopg2 import OperationalError from psycopg2.extras import RealDictCursor from agent.data.entities.config import CONFIG_FILE_PATH logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) logger.setLevel(loggin...
ab241ff8923f494673678033033b984ead1e30ba684cd85a853b2fb177c2e2aa
Python
3,659
105
from typing import Dict, Callable import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from src.handlers.general import TBSummaryTypes from src.losses.adversarial.utils import AdversarialLosses class AdversarialLoss(_Loss): def __init__( self, criterion: str = Adv...
b9cdf1531863ef5f9a8a7f9d00214e620928b656655b9cc0909d1a2a153815b0
Python
3,659
125
# -*- coding: utf-8 -*- ### ---------------- IMPORTS ------------------ ### import os import tables from pick import pick import numpy as np # User Defined from helper.array_helper import find_szr_idx ### ------------------------------------------- ### class UserVerify: """ Class for user verificat...
7bbc191607affa13fb3d70fd991892e470babaacf60a69c2ac344befb73e2ead
Python
3,660
126
""" OmicVerse main CLI dispatcher. Entry point: ``omicverse`` (registered via pyproject.toml scripts). Sub-commands ------------ claw Start the Jarvis bot and/or generate code with -q. jarvis Alias for ``claw`` (legacy name). web Launch the OmicVerse web interface. skill-seeker OmicVerse Sk...
93572edd2ee38fae3fc1d538dbcd253570a5260f8cd3c419f743455d2ec4f3b6
Python
3,660
96
import os project_root = '/ccb/cybertron/khchao/splam-analysis-results/' output_dir = f'{project_root}/train/results/tool_benchmark/splam/' def main(): SEQ_LEN = "800" HALF_SEQ_LEN = int(SEQ_LEN) // 2 QUATER_SEQ_LEN = int(SEQ_LEN) // 4 print("QUATER_SEQ_LEN: ", QUATER_SEQ_LEN) output_files = [out...
170d50ec08482ca99818046934c4568d34338d837b7c95361cd7805b2b507d3d
Python
3,661
94
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 23 21:00:57 2021 @author: saad """ import os import h5py import tensorflow as tf import tensorflow.keras.callbacks as cb from tensorflow.keras.optimizers import Adam, SGD import model_acnn.metrics as metrics from model_acnn import customCallbacks i...
4eada1973613138fa7321615861da88748529d541735d4563dc3f908b5f9d4c7
Python
3,662
77
#################################################################################################### # Copyright (c) 2025, Open Brain Institute # Author(s): Marwan Abdellah <marwan.abdellah@openbraininstitute.org> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is ...
65a6e8874077cc35f8dde840d103ff232c526fdeb6f9505aebdc4921dd373730
Python
3,662
111
from __future__ import division import numpy as np from ..utils import dotd from .. import gpu_utils # Import manually defined functions from .variational_nodes import Constant_Variational_Node class Y_Node(Constant_Variational_Node): def __init__(self, dim, value, groups): Constant_Variational_Node.__in...
a73e76d4c3cf91ee321933791e7cb5076803047cb77548746e46270426e52a9c
Python
3,662
86
#################################################################################################### # 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...
a84b623b6f174d5bd594e228305bfb0a0a2c446edb0ea3281b5b27a08e3edeec
Python
3,662
107
#Metrics import torch import numpy as np import pandas as pd from torch.nn import functional as F from src import data def site_confusion(y_true, y_pred, site_lists): """What proportion of misidentified species come from the same site? Args: y_true: string values of true labels y_pred: string ...