sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
1f2cb2307c6f993d53a82627aacd82da09c2cc70746e9a115c6e9ba9374fac5a
Python
8,217
265
""" Wrappers for VTK classes needed for rendering. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from .base import BSVTKObjectWrapper, wrap_vtk from .actor import BSActor, BSActor2D, BSScalarBarActor, BSTextActor ############################################################### # ...
5593e4f0a6cd910ecadd23083419ee6769dc909c1470b03104c128e217f27e25
Python
8,219
230
import os import zarr import numpy as np import tskit import yaml import ray import argparse parser = argparse.ArgumentParser("Plot observed and posterior summary statistics across windows") parser.add_argument("--configfile", type=str, help="Path to config file", default="npe-config/DroMel_CO_FR_rnn.yaml") parser.add...
c632319fcd3615383401b7373972de532fa968f29c2f49b03dd82d824655f9a7
Python
8,219
184
import os import random import logging import time import numpy as np import torch import skimage.io as skio from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm from src.utils.dataset import gen_train_dataloader, random_transform from src.utils.util import parse_arguments from model.SUPPORT import ...
326de16211fb929fa462d6d7507a90df411cb12a520de2ecc85caddf7ee8942d
Python
8,222
268
import math import anndata as ad from anndata import AnnData from scvi.utils import dependencies from ._preprocessing import subsample from ._utils import validate_layer_key, validate_marker, validate_obs_keys @dependencies("seaborn", "matplotlib") def plot_histogram( adata: ad.AnnData, marker: str | list[...
47cdc8e167101e2d133a6cf6dc50338dd720cb11ae1bd4dd70a8f029b248afe0
Python
8,222
168
#20240109 将帧率修改为25,对应的baseline和imgnumber from PyQt5.QtWidgets import * from PyQt5.QtGui import * import time import threading import gc import numpy as np import os import cv2 as cv class Lightstability_Check(QWidget): def __init__(self, MainUI, Serialnumber,Datatype): super(Lightstability_...
513d4db5c86277c31a25010c645779bd33bb3bbf2cc1a042ee698e34e9b085c0
Python
8,222
214
#!/usr/bin/env python3 # Written by Lorena Pantano with subsequent reworking by Jonathan Manning. Released under the MIT license. import glob import logging import os import platform import re from collections import Counter, OrderedDict from collections.abc import Set # Configure logging logging.basicConfig(format=...
6fd2a1c9ff6ffe7d9e1c71186421ad0b42328e690add07225ec1c71dc81129d7
Python
8,225
241
"""Expasy ENZYME: EC numbers for enzyme names, assigned outside BRENDA. enzymeNER marks spans and no identifiers, so this nomenclature is what turns a span into gold. It is a dictionary, which makes the enzyme evaluation weaker than a corpus of hand-assigned identifiers — its own resolution errors are indistinguishabl...
aa32d54c2e4051d18afa6a9032e4bd51e6a60b9e2c7376fe27c26c61262b03d8
Python
8,225
201
""" Created on Fri Apr 1 13:04:14 2016 @author: artur """ from RecognitionModel import * import pickle import time import sys from data_funcs import * from perf_funcs import * class TrainingAlgo(object): """ Class that controls the training process. """ def __init__(self, rec_params, rec_model,...
ab7e3a23f5cc675cf1cffcf3287f9d7df692331e469ae1f861e9b484e47e807b
Python
8,229
165
import sys sys.path.append("..") from modelR.backbones.mobilenetv2 import MobilenetV2 from modelR.necks.conv_csa_drf_fpn_hbb import Conv_CSA_DRF_FPN,FC2_CSA_DRF_FPN,Cat_Conv_CSA_DRF_FPN,M_CSA_DRF_FPN from modelR.head.dsc_head_hbb import Ordinary_Head from modelR.loss.loss_hbb import Loss_s_l,Loss import config....
0ec69fc866f60198b895acd8023a66c5f42c60f61cf6c599d180d754bd20a521
Python
8,231
221
import scanpy as sc import sys sys.path.append('./scctools/scctools') from scctools import * # # Load Data ad = sc.read('./FM27_cell_133454_wk.h5') import matplotlib.patheffects as pe matplotlib.rcParams.update({'font.size': 12}) fig = plt.figure() gs = GridSpec(1,3, figure=fig) ax1 = fig.add_subplot(gs[0, 0]) ax2 ...
20c0d789350a88e3544f9f27c8bd161399e1b86ce0b1acf2c469783de32b0cf8
Python
8,231
226
"""Figure 2 panel D primitive — Hausser β × z_dim hyperparameter sweep. Uses the locked 5-fold sweep over the 42-config grid (6 z_dim × 7 β) that mirrors NEMO's 42-config sweep to keep the two tools at parity. Highlights the production HIPPIE config (z=30, β=1.0) selected by the stability tiebreaker described in the M...
f7828c5ed322f8df5df23473f6ee33148d80bcbf4b9ef5b0046bd2bc9954bf6f
Python
8,231
167
import sys sys.path.append("..") from modelR.backbones.mobilenetv2 import MobilenetV2 from modelR.necks.conv_csa_drf_fpn_hbb import Conv_CSA_DRF_FPN,FC_CSA_DRF_FPN,Cat_Conv_CSA_DRF_FPN,M_CSA_DRF_FPN from modelR.head.dsc_head_hbb import Ordinary_Head from modelR.loss.loss_hbb import Loss_s_l,Loss import config.c...
fa6cbe07c5c5d1c22f6b25473ae57d43df378d777d20294b6f4e4661f97664cb
Python
8,232
204
"""Approximate volume estimators for relaxed carbon clusters. For a 2D-like cluster relaxed in 3D the convex hull may be degenerate (all atoms in a plane). We provide three robust estimators ordered by sophistication, all in ų: V_atomic = N · (4π/3) r_C³ (purely extensive, sanity ref) V_inflate...
1baf80395f6f3dfe19f666e7f94dbf4b9041498e4e2aab648a7554cac4180f6e
Python
8,236
42
import os import gensim def read_corpus(pmids, abstracts): tagged_corpus = [] for pmid, abstract in zip(pmids, abstracts): tokens = gensim.utils.simple_preprocess(abstract[0]) tagged_corpus.append(gensim.models.doc2vec.TaggedDocument(tokens, [pmid])) return tagged_corpus def train_model(...
6ea55420a246c25b95a0ef83a5ca76fa6e399da18ca12e9f9f208811657c786d
Python
8,239
234
# Original work Copyright 2018 The Google AI Language Team Authors. # Modified work Copyright 2019 Rowan Zellers # # 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/...
52b99ebf28f7f4a41012db85baa0a85a993d4beb03fc7ae505dfbe40b3aaa657
Python
8,241
285
#!/usr/bin/env python # ENCODE DCC common functions # Author: Jin Lee (leepc12@gmail.com) import sys import os import re import csv import gzip import logging import subprocess import math import signal import time logging.basicConfig( format='[%(asctime)s %(levelname)s] %(message)s', stream=sys.stdout) log ...
58d11d316dbaf9b38c11b44506293619d6f97ac99babd84b540689eec0092169
Python
8,242
218
from typing import List, Union, Optional import math import torch from nequip.data import AtomicDataDict from nequip.nn import GraphModuleMixin, scatter from nequip.utils.global_dtype import _GLOBAL_DTYPE from nequip.data._key_registry import get_field_type class PerTypeScaleShiftE(GraphModuleMixin, torch.nn.Module)...
768ed74db83be46cbaf93c57157cf6d7ece6141f55adcdcb4de824ad5f0b691f
Python
8,242
152
import numpy as np import logging import collections import pytest from .utils import UnivariateParametrization from .utils import UnivariateParametrization_natural_axis from .utils import UnivariateParametrization_constPI from .utils import UnivariateParametrization_constPI_constSIG2BETA from .utils import Univariate...
7df4dc8df2487e3c1b7ff4c0ebf4efeeb40d60be18688bb61a09a7da56e982ce
Python
8,244
197
#!/usr/bin/env python3 """ Two-way Venn diagram comparison of transcript models from Bambu and IsoSeq. Transcripts are compared by intron chain: two transcripts are considered equivalent if they share the same set of internal splice junctions (defined by the positions of all internal exons, excluding the terminal 5' a...
ccf31fc9ed833565be8deb5ce7fbd5ed4fd6bd9308c73cdf38c56bc6878265ea
Python
8,244
205
"""Tests for the CV-based k selector in hippie.inference.select_k_via_cv. The selector mirrors the procedure in ``hippie_benchmarking_release/scripts/cross_dataset_script.py``: * L2-normalize reference embeddings * cv = min(5, n_classes) * scoring = "balanced_accuracy" * try k = 1..20, return argmax """ from ...
5fa25c4c3bd27fe8ab4e5f326205555fffbc1d7a891e5c335885e8310e59bccb
Python
8,245
176
#!/usr/bin/env python3 """Cell-level Wilcoxon scan over the 25-gene candidate panel (Figure 5B, Methods 4.7 and 4.10). WHY THIS EXISTS. Results reports 793 gene x cohort x cell-type comparisons of which 111 are significant, and Figure 5B is drawn from them, but no script in the release produced the table: Poster_v2/fi...
67c3041677fe99780bce9427757420a4461321545bdcfc53786a50f0c68ec508
Python
8,245
141
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'main_gui.ui' # # Created by: PyQt5 UI code generator 5.10.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWin...
05d7e3a55923eced834ab61a169e87ab8f40c5c8a5a0b49f77b15834f0327224
Python
8,250
264
#!/usr/bin/env python3 """ Unified comparison tool for analyzing posteriors from multiple models. This script provides a complete workflow for simulating data once and comparing posterior distributions from different trained models. """ import argparse import subprocess import os import sys import yaml def run_comm...
32a2f8323c905f8c1e5ff7a44d0278ee20f5ada77369a626012167fbebcf7727
Python
8,250
143
#!/usr/bin/env python3 """Numeros e figuras que faltam no protocolo final da R1 (sem copias + CV interna agrupada). Consome r1_bootstrap_oof.npz (predicoes fora da dobra do protocolo final) e r1_cv_interno_agrupado.json (curva de aprendizado agrupada). Produz: * Tabela S3 (por haleto) e Tabela 8 (residuo por haleto)...
ffb464b65efaee04a3a717504a35e0a6fb17284b10441bc4fc0f39f9482c9b78
Python
8,252
236
import xml.etree.ElementTree as ET import os import pickle import numpy as np from utils.utils_basic import * def parse_rec(filename): """ Parse a PASCAL VOC xml file """ tree = ET.parse(filename) objects = [] for obj in tree.findall('object'): obj_struct = {} obj_struct['name'] = obj.f...
a67e98592510547be53823b9d7ab890910bd75170890434a296cb03d1313257c
Python
8,255
229
from itertools import combinations from typing import Dict, List, Set, Tuple import pandas as pd from BLEval.evaluator import Evaluator from BLEval.data import EvaluationData, DatasetGroup def _top_k_edges(ranked_edges: pd.DataFrame, k: int) -> Set[Tuple[str, str]]: """ Return the set of top-k predicted edg...
a7c9e062e757ee3446942f593cbb7ab3b8c1f207dfaee819735952ec22020f66
Python
8,259
145
import os from copy import deepcopy from typing import Union, List import numpy as np import torch from acvl_utils.cropping_and_padding.bounding_boxes import bounding_box_to_slice from batchgenerators.utilities.file_and_folder_operations import load_json, isfile, save_pickle from nnunetv2.configuration import default...
53c2b8feda71ae0ea56a0ac99195e4d6250ae560d483ee8267ac85141a4213f4
Python
8,265
244
#!/usr/bin/env python3 # 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. from concurrent.futures import ThreadPoolExecutor import logging from omegaconf import MISSING import os import torch ...
bb4dcebe89ea2972b63afeeb57829edbe2212be9dfee444d261569e5435c226d
Python
8,266
175
#!/usr/bin/env python3 import pandas as pd import argparse def classify_protein_splice_fsm(row): if row.pr_splice_cat=='full-splice_match' and row.pr_splice_subcat=='multi-exon': ## if nterm and cterm match if row.pr_nterm_diff==0 and row.pr_cterm_diff==0: return 'pFSM,known_nterm_know...
b9848d3b19e9a4332a4c4007e01826854cfd984ed0ae0a7884786bd2a3a011da
Python
8,272
220
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import scipy.io as sio import numpy as np import time import torch import CBIG_pMFM_basic_functions as fc def get_init(gradient_data, highest_order, init_para): '...
1e4bfbed9f7833e16440c7774da9f0bd886912067da57aa316c6050e9d91f4ba
Python
8,273
244
import os from typing import Dict, List import sacrebleu import pandas as pd from glob import glob from pathlib import Path from utils import retrieve_asr_config, ASRGenerator from tqdm import tqdm from argparse import ArgumentParser def merge_tailo_init_final(text): """ Hokkien ASR hypothesis post-processing...
8349e3337827299e39e7bf72c955a5e6f1b08123b3b220886d4904c412401484
Python
8,278
246
# Copyright (c) Facebook, Inc. All Rights Reserved import torch import os import numpy as np import pickle from . import retri from ..utils import get_local_rank class VectorPool(object): """ Base class of retrieval space. """ def __init__(self, config): from transformers import AutoConfig ...
5151a646aaf2f3a9707c61cb0075369ac87382e9aa2a1c085c378dd4fc11e47e
Python
8,279
211
import os import json import numpy as np from warnings import warn from voluseg._tools.get_volume_name import get_volume_name from voluseg._tools.parameters import save_parameters from voluseg._tools.parameters_models import ParametersModel from voluseg._tools.nwb import open_nwbfile, find_nwbfile_volume_object_name ...
edbf3b18dd5a4db7a22772e6de4c020b0b5f315b5a607d4b5aafb4eae1d37dfa
Python
8,279
219
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import scipy.io as sio import numpy as np import time import torch import CBIG_pMFM_basic_functions as fc def get_init(gradient_data, highest_order, init_para): '...
5c6b091cc2d564f29287fe5111edbaa2949634ab5528d3b75a862ba7bc488427
Python
8,280
234
import os # custom_loadmat.py must be importable (same directory as this script, or on PYTHONPATH). from custom_loadmat import custom_loadmat import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import StratifiedKFold from sklearn.pipeline import Pipeline from sklearn.preprocessing import Sta...
386bf0a301f0b16bd448cecc7c114118bf67b2dfe6f094db962bd8d5f49f7dce
Python
8,285
227
from typing import Sequence, Tuple, List, Union import torch import numpy as np RawMSA = Sequence[Tuple[str, str]] def collate_tokens( values, pad_idx, eos_idx=None, left_pad=False, move_eos_to_beginning=False, pad_to_length=None, pad_to_multiple=1, pad_to_bsz=None, ): """Convert...
ed17d37658b81a2ee73674eb5b76c3d3a3fdeadaa08a319d5f7056bdc78fc2d9
Python
8,286
220
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import scipy.io as sio import numpy as np import time import torch import CBIG_pMFM_basic_functions as fc def get_init(gradient_data, highest_order, init_para): '...
332b261b65bc1e7a5b53dc224e5902072c0c96e9294bdd5cf3dc6aa8be175bf8
Python
8,287
220
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import scipy.io as sio import numpy as np import time import torch import CBIG_pMFM_basic_functions as fc def get_init(gradient_data, highest_order, init_para): '...
ae7954e1a5240f28252a7e2523df426d0450b5ea3b8336e5a85c679854dacc53
Python
8,287
252
"""`NERClassificationModel` — entity class detection without linking.""" import logging from collections.abc import Sequence from typing import cast import torch import torch.nn as nn from d3text import tracking from d3text.constraints import FREQUENCY_CLAMP_EPS, UnitInterval from d3text.progress import batch_progres...
3f0c6b58023f56571dbab4d28b3f5ded5407c11912ffaf177d576b3371965832
Python
8,288
146
from typing import Optional import anndata import lightning as L import torch from torch.utils.data import random_split from aestetik.dataloader import CustomDataset from aestetik.utils.utils_data import prepare_input_for_model class AESTETIKDataModule(L.LightningDataModule): """Internal Lightning DataModule fo...
982d2462986ecfbcfb0e735f15bd488d7683d36eee84f87d06c404c38b96de08
Python
8,294
208
import unittest from torch.optim import Adam, SGD from simulation_encoder.dataclass.config_schemas import ( HyperparameterDiscreteConfig, HyperparameterRangeConfig, ) from simulation_encoder.utils.generate_hyperparams import ( _get_continuous_values, _get_discrete_values, _get_optimizer_values, ...
f28bf3b882ffc2886bced2408b4da00c94a9698b6997765a7c8da2569fa64f80
Python
8,294
250
#!/usr/bin/env python """Example of display interactive flood-filling "inference" results. shift+mousedown0 triggers the simulated flood filling to start with an initial seed at the mouse position. The computed mask values are displayed as an image, while the seed points chosen are displayed as point annotations. k...
1d8b5d33516bbd2e3b9331eff5706be9e03b27f28717ea79446372fa150f2219
Python
8,296
195
"""Writing and reading a checkpoint that carries its own provenance. A bare `state_dict` is not self-describing: its class head is a matrix of the right *width* and nothing more, and nothing in it says which dictionary its token-level targets were matched against, which tokenization produced its inputs, or which entit...
d99833c10b319b0623e8509a97d05c0613ebb20ab679950b01d224c7fdf57029
Python
8,298
243
# 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. import logging import os from dataclasses import dataclass, field from typing import Optional import numpy as np from omegaconf import II, MI...
15b5de7fc63cfb422d3f3c2a116b9dde675f4861f2a1a02a43e49ca99d008401
Python
8,299
262
import numpy as np import pandas as pd import statsmodels.formula.api as smf from .paper_ANOVA import ANOVAModel # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"]) Subtype_colours = np.array( ...
7eaf84d0cbd79d227d70363cc12c4115ce139918abe02536552476e8e8b810fc
Python
8,303
194
import os, gc from pathlib import Path import pandas as pd import torch.utils.data as data import pytorch_lightning as pl from pytorch_lightning import Trainer from modules import NFTDetector from nft_datasets import TileDataset def main(args): pl.seed_everything(42) #set the stride and model names, used to...
80e802524bd98eaff9da6ccc72c8bd66f5a02a688b4658757de4e86ec1a89e35
Python
8,304
221
from typing import Callable, List, Union, Tuple import math import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.nn.parameter import Parameter import kornia.filters as KF from . import base from .base import Conv2d, Linear, ChAttn2d, SpAttn2d _DEBUG_IMAGES_: Uni...
8f680842a790e744476736eb95567da7ba562e72c0357601423944632fd101a1
Python
8,304
209
"""Building a model from a config, and loading a checkpoint back into it. The seam between a `ModelConfig` and a ready-to-train `Model`, plus the run context a tracking run records about the built splits. Lives above `d3text.models` rather than inside it because `dataset_metrics` reads an `EntityRelationDataset`, and ...
573860479758c967e4d1c84d771925e78b2ea362b13e8c174332de2c3cec61a8
Python
8,309
215
from tabpfn import TabPFNClassifier, TabPFNRegressor from tabpfn_extensions import unsupervised import pandas as pd import numpy as np import random import torch import os from huggingface_hub import login from main_ml import frame2arrays from train_svm import impute_missing_values import argparse def parse_config(...
28bf8ca3cc40a3f6b7b3d8f12fe597d66ff3574cce6217dc28871f4238f2bfb1
Python
8,311
197
import os from pathlib import Path import numpy as np import pandas as pd from analysis.metrics import dPrime_monkey, get_dprime classes = {0: 'bear', 1: 'elephant', 2: 'face', 3: 'car' ,4: 'dog', 5: 'apple', 6: 'chair', 7: 'plane'} train_classes = {1: 'bear', 2: 'elephant', 3: 'table', 4:'face', 5: 'car' ,6: 'dog',...
d0b715d4e09da01e749f661da781e8b67073f78bad408087245e203a39fc1a78
Python
8,311
293
import os import nipype.pipeline.engine as pe from fetpype.pipelines.full_pipeline import ( create_full_pipeline, ) import nipype.interfaces.utility as niu from fetpype.utils.utils_bids import ( create_datasource, create_bids_datasink, create_description_file, ) from fetpype.workflows.utils import ( #...
51fee6f62e7285bb3cad4ed7037b884c10c16d9e21eff483d98f8bc8cd856bb7
Python
8,312
175
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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...
f80e1ce047343dcc436489b0405b46d38109308287a99bb8489871f5953015f6
Python
8,312
229
#!/usr/bin/env python3 # classify 5utr status for pb proteins # classification focuses on monoexonic and multiexonic 5utrs #%% from collections import defaultdict import re import argparse import os parser = argparse.ArgumentParser() parser.add_argument('--gencode_exons_bed',action='store',dest='gencode_exons_bed')...
573dc6b88b4a63e817aa19999afaca05600d4df430487e9a072ff536ad8089f6
Python
8,313
176
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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...
35540b26d5911d911f40f03ced78cbb83188176315d045455c161d64d7150399
Python
8,315
226
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import time import torch import CBIG_pMFM_basic_functions as fc import warnings def get_init(myelin_data, highest_order, init_para): ''' Th...
402a1fe4a177cc5425d9ebf143ee99cf880f0787761f01526dfde4058a972d55
Python
8,318
220
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import scipy.io as sio import numpy as np import time import torch import CBIG_pMFM_basic_functions as fc def get_init(gradient_data, highest_order, init_para): '...
cd610dae62e045d0bb0b9940b3df0d98ad4630da89cd39494fa8a7dbd12a3344
Python
8,318
267
from __future__ import annotations import logging from collections import defaultdict from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Iterable from anndata import AnnData from mudata import MuData import numpy as np import sparse import torch from scvi import REGISTRY_KEY...
e8ca2d580cbe3683adc3f0fad73d927b61d464e735effd63f071dcae3e973ff1
Python
8,320
139
from typing import Union, Tuple from batchgenerators.dataloading.data_loader import DataLoader import numpy as np from batchgenerators.utilities.file_and_folder_operations import * from nnunetv2.training.dataloading.nnunet_dataset import nnUNetDataset from nnunetv2.utilities.label_handling.label_handling import LabelM...
d4338a3b03ff4355381f914991673800f8d5f544dd00e4734362acbf00cec917
Python
8,322
242
# Copyright Howto100M authors. # Copyright (c) Facebook, Inc. All Rights Reserved import torch as th import pandas as pd import os import numpy as np import ffmpeg import random from torch.utils.data import Dataset class VideoLoader(Dataset): """modified from how2's video_feature_extractor.""" def __init__(...
2fe9f94213d685a611c83c881f028013ff8c8c33f47bf769e7342d281572ca43
Python
8,326
246
import math import numpy as np import torch from torch.nn import functional as F def sum_except_batch(x: torch.Tensor) -> torch.Tensor: """ Sum the elements of the input tensor along all dimensions except the batch dimension. Parameters: - x (torch.Tensor): Input tensor. Returns: to...
a701eb695f56fa457395635e910f9f2b959f3be92bd4848136d66b53800c733b
Python
8,329
225
from __future__ import annotations from PySide6.QtCore import QCoreApplication, QEvent, QEventLoop, Qt from PySide6.QtWidgets import ( QApplication, QFrame, QHBoxLayout, QLabel, QMainWindow, QPushButton, QSizePolicy, QToolButton, QVBoxLayout, QWidget, ) from src.dashboard.catal...
080dfd0bd9acefce3d72b76b481ebd0b96fa4419429aff9ced1bb0547c9333f6
Python
8,330
193
import unittest import networkx as nx import numpy as np import pandas as pd from pgmpy.independencies import Independencies from pgmpy.models import NaiveBayes class TestBaseModelCreation(unittest.TestCase): def setUp(self): self.G = NaiveBayes() def test_class_init_without_data(self): sel...
4e28fdbe35ced1581b1119fc1d54b0357cd930c806a876ce2f6ad02040cc2692
Python
8,334
266
# 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. """ Signal processing-based evaluation using waveforms """ import numpy as np import os.path as op import torchaudio import tqdm from tabulat...
f1206e8b4e378492d6674e0bbb9fbd727303b810eb5cb08571dd1e36180c01db
Python
8,334
203
from __future__ import annotations import logging import pathlib import attrs import crowsetta import pandas as pd from ...common import annotation, constants from ...common.converters import expanded_user_path, labelset_to_set from ...config.spect_params import SpectParamsConfig from . import audio_helper, spect_he...
5ce9259ce544cca768fdc4c53f2196f614367df788a02a797cb5d5940acb6f9f
Python
8,335
213
import pdb import sys import argparse import numpy as np import os import pickle import scipy.io as si from sklearn.decomposition import PCA import h5py import matplotlib.pyplot as plt rootpath = os.path.join(os.getcwd(), '..') sys.path.append(rootpath) from load_RNN_model import load_RNN_model PATH_TO_FIXED_POINT_FIND...
7c1a0351505f47d70f9250fef5b9e5298cd79a788aaea9af8ea899939fa38732
Python
8,336
164
#!/usr/bin/env python3 """Regularizacao por bloco no gap das perovskitas, com o canal HYB. O que se testa, e contra o que: A. AFERICAO -- com alphas iguais em todos os blocos, o solver dual novo tem de reproduzir o ridge uniforme do projeto. Se nao reproduzir, e bug. B. wave15 SOZINHO, uniforme x por bloco --...
82e239684ff0de5260be804f476a54b32d873672b8562e4112998b0a45bca5af
Python
8,339
234
"""Characterization of image complexity based on https://github.com/tinglyfeng/IC9600.""" import io import json import os from typing import Dict, Optional, Union import click import cv2 # type: ignore import numpy as np import torch import torch.nn.functional as F # noqa from datasets import Dataset, load_from_dis...
c75ca739bb3deb839a68dbea94aeb2f064c584b153e02fd7ab778f571006835a
Python
8,343
233
#!/usr/bin/env python3 """Validate gmx_MMPBSA_test manifest against example READMEs and docs.""" from __future__ import annotations import argparse from collections.abc import Sequence import re import shlex import sys from pathlib import Path REPO = Path(__file__).resolve().parents[1] if str(REPO) not in sys.path: ...
18bf5f09c22036a0032dd046d30bdea5ca8306036b3b8919897a61d669206670
Python
8,347
228
from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union import inspect import math from loguru import logger import os import torch import torch.nn as nn from torch.nn import functional as F from transformers.generation.utils import SampleDecoderOnlyOutput ...
60234d6dd73183cc74f5478c3003deaceec3e6d403596ad98aae985be2d9cb90
Python
8,347
259
"""`d3text.logs`: where the library's console output goes, and who decides. Two guarantees. The library must not decide — importing `d3text` installs no handler and touches no level, so an application that embeds it keeps its own logging — and the handler an entry point *does* install must not smear a live progress ba...
c65da0b1362b8fd4f1b854101f90234a0493384a192d66e33e04487ad095a776
Python
8,351
265
from __future__ import annotations import contextlib import itertools import sys from importlib import metadata from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import Literal from typing import overload from poetry.utils._compat import WINDOWS from poetry.utils.helpers im...
0559355a7766a2804c1d810a7228a4af44fb4c18fda77b406863ce88f5289a92
Python
8,352
241
# 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. import json from functools import lru_cache def convert_sentence_to_json(sentence): if "_" in sentence: prefix, rest = sentence....
15c09a0ca006415cdc12620482bced8cbeff8e9dbb3acfa1413d9b868daf08e6
Python
8,354
190
from yacs.config import CfgNode as CN # ----------------------------------------------------------------------------- # Convention about Training / Test specific parameters # ----------------------------------------------------------------------------- # Whenever an argument can be either used for training or for test...
21f567be3105e152e530c24482a1da7b5113c2f953de74851cd898b238134a56
Python
8,354
216
# This extension template provides instructions to add new metrics to pgmpy. # # Please follow the following steps: # 1. Copy this file to `pgmpy/metrics` and rename the file as `your_metric_name.py` (e.g., `my_metric.py`). # Note: Do NOT start the filename with an underscore `_`, otherwise it won't be discovered. #...
28f6f363f2ffe37ad210d1364788e494d6c8eef0f7c9ad4f17211a5001595a46
Python
8,357
227
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging from dataclasses im...
3c81da703416a24ff14444249e5035b063ced3ea9b86732b865bae62e547e798
Python
8,360
198
#!/usr/bin/env python3 """G0 — Latent-space classification accuracy (sanity gate). Encodes each labeled dataset, fits a leave-one-out cross-validated LogisticRegression on the μ vectors, and reports balanced accuracy and per-cell-type F1. Run this immediately after training as a quality gate before the generative exp...
da018da72f414183afa3cab78076996efd20a4f659f06c4bdcf07289518d3f04
Python
8,368
241
import logging import community import leidenalg import networkx as nx import igraph as ig import numpy as np from scipy.stats import mode from sklearn.cluster import DBSCAN from sklearn.decomposition import PCA from sklearn.neighbors import NearestNeighbors from pynndescent import NNDescent from scipy.sparse.csgraph ...
5048fe08ffc87d092be75a75f40fad905f9a23460ef7ac3340acec7be4f8272b
Python
8,370
220
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import scipy.io as sio import numpy as np import time import torch import CBIG_pMFM_basic_functions as fc def get_init(gradient_data, highest_order, init_para): '...
35a46bc1eca9936b2b2182071be46636c607c293a9a7fd4695939e8f0b1af98b
Python
8,374
231
import torch import torch.nn as nn import torch.nn.functional as F from einops import rearrange from functools import partial from .performer_module import default, Chunk, FeedForward, PreLayerNorm, Gene2VecPositionalEmbedding, RandomPositionalEmbedding class FullAttention(nn.Module): def __init__(self, ...
c4806bea6bb3afaebf394c32dc524dade036f3142738fadd67a0aae83bbc6e87
Python
8,376
165
from typing import Optional, Tuple import torch from torch import Tensor from torch.nn import Module from torch.nn import functional as F from torch.nn.init import constant_, xavier_normal_, xavier_uniform_ from torch.nn.parameter import Parameter class MultiheadAttention(Module): r"""Allows the model to jointly...
78217e88e378d474122ce6ca9e6c9d038046d9633415ffcbfbf97a652e4c0f04
Python
8,377
275
# -*- coding: utf-8 -*- """ Created on Tue Feb 11 22:25:00 2025 @author: hanna """ """ Supplemental Figure 1 session-average changes for ROTATION and SHUFFLE sessions averages are over all neurons (including non-significant) """ import os import pickle import numpy as np import pandas as pd from tq...
22ccc323dc8da9a6395ee4eda05fb98bbe393714e2ee48b3ff08ccbd60c4c316
Python
8,379
230
import os import zarr import torch import numpy as np import matplotlib.pyplot as plt import seaborn as sns from torch import Tensor from torch.utils.data import DataLoader from lightning import LightningModule, Trainer from sbi.inference import DirectPosterior from sbi.utils import BoxUniform import ts_simulators fr...
5d5fcffa2cf28fc42bf50dff556c2d540858b1a8c811ecd980e38dce9c759f8c
Python
8,386
221
# Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
1cdf6ee9e28c29909b8e50bbda74ea8984ffc34a75e26ff5cbd0fb5219324487
Python
8,391
259
import copy import os import lightning as L import numpy as np import pandas as pd import torch import torch.nn as nn class MALDICNN(nn.Module): def __init__(self, num_classes, out_dir=None, skip_connections=False, binary=False): super().__init__() if binary: num_units = 1 els...
646012a2d70644c3618ad4ce84bd807109778c1ddf7a597826e0cac453c76b99
Python
8,393
267
import os from shutil import rmtree import pytest import torch from lightning.pytorch.callbacks import ModelCheckpoint import scvi from scvi.data import synthetic_iid from scvi.model import MULTIVI, SCANVI, SCVI, TOTALVI from scvi.train._callbacks import SaveCheckpoint, ScibCallback @pytest.mark.optional @pytest.ma...
a849a58d99f86207331ca609b54b3a0097995e8aa633889549dfc652a7d56a6d
Python
8,399
257
#!/usr/bin/env python3 """ Cancer signaling network analysis with RAG-GNN. This example demonstrates the full workflow used in the paper: 1. Load protein interaction network 2. Create functional knowledge base 3. Train RAG-GNN and baseline methods 4. Benchmark comparison 5. Case study: DDR1 analysis """ import numpy ...
68cba2378b13361dbdb3ec3b254ae21f66499f6c6e181f5df05331f2ae60bb9f
Python
8,401
232
from typing import Optional, Tuple import jax import jax.numpy as jnp from jax.experimental import pallas as pl try: from jax.experimental.pallas import triton as plgpu except ImportError: from jax.experimental.pallas import gpu as plgpu from packaging.version import Version def sum_columns(x: jax.Array) ...
68217a5fefad8f8fd968c30d93af37b2ad7539d4b3813cdb4056694e34347a7c
Python
8,403
217
import networkx as nx from pgmpy.base import UndirectedGraph from pgmpy.causal_discovery import ExpertKnowledge, HillClimbSearch from pgmpy.ci_tests import ChiSquare from pgmpy.estimators import StructureEstimator from pgmpy.structure_score import BDeu from pgmpy.utils.mathext import powerset class MmhcEstimator(Str...
25bb1ca5763dfbd4bd798efabcd84e3305cb2c33bd8fe9e1e15034d90e948ffe
Python
8,406
214
from typing import Literal from pgmpy.base import ADMG, DAG from pgmpy.identification.probability_expression import ProbabilityExpressionTree class BaseGraphicalIdentification: """Base class for identification methods that return annotated graphs. Graph-returning identification methods inherit `BaseGraphica...
2ce022e5a3e01f027b53e8e1f97375021eac744ff9624f80c4f83447b01c0a8d
Python
8,411
217
import streamlit as st import glob import os import json import sys import numpy as np import random import cv2 import time import joblib from collections import defaultdict from pathlib import Path from argparse import Namespace from PIL import Image from st_pages import show_pages_from_config, add_page_...
be968f7105a80d51c3c621cd72b7ecd5d4cd64b227f9e26ba33ffaa08c9e8ff6
Python
8,411
128
from msi_visual.saliency_opt import SaliencyOptimization from msi_visual.nmf_3d import NMF3D from msi_visual.nonparametric_umap import MSINonParametricUMAP from msi_visual.percentile_ratio import TOP3, PercentileRatio from msi_visual.metrics import MSIVisualizationMetrics from msi_visual.normalization import t...
3860870b95aea8acd8c0944fe975d85a3346b43dd6537bddff77bab0eea281cc
Python
8,412
207
import argparse import contextlib import dataclasses import gzip import io import os import tempfile import unittest import medaka.medaka import medaka.options class ParseDictArgTest(unittest.TestCase): def test_001_basic_counting(self): parser = argparse.ArgumentParser() parser.add_argument('--...
2cd11b5164d409eaf25fdf629dc7732b50f92872527e8d57b0fdb5a28dc612bd
Python
8,413
253
# 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. import os import torch import pickle import random from tqdm import tqdm from torch.utils.data import DataLoader from torch.utils.data.distrib...
213c912c1ff625d1898dba63f01c5a6612173a75fa8ab2c5d06984f0386982fe
Python
8,416
226
""" ======================================= Receiver Operating Characteristic (ROC) ======================================= Example of Receiver Operating Characteristic (ROC) metric to evaluate seqwise_predictor output quality. ROC curves typically feature true positive rate on the Y axis, and false positive rate on ...
470be36f9362c49d2bf42cd301853f6fdaa97e3705703426d281f7707ca84e9e
Python
8,416
196
import RPi.GPIO as GPIO import time from VariableList import var_list class Steppercontrol: def __init__(self,enablepin,steppin,directionpin,limitpin,Axis,Plusdir,Minusdir,Stepcon_sendtoUI): self.enable = enablepin self.step = steppin self.direction = directionpin self.limit = lim...
a45a6c3891f025befc92ce657d9fc223a6963a6a2d26fc4b4d33cb299edd0657
Python
8,417
226
"""Tests for vak.train.frame_classification module""" import pathlib import pytest import vak.config import vak.common.constants import vak.common.paths import vak.train def assert_train_output_matches_expected(cfg: vak.config.config.Config, model_name: str, results_path: pa...
7c26667ee6ea4e8da9451c1346cf2aaf6e5c249f67a549378811176580c9aba6
Python
8,418
261
# source: https://github.com/eccv2020-4574/DCANet/blob/master/models/resnet/resnet_se_dca.py # arxiv: https://arxiv.org/abs/2007.05099 import torch.nn as nn import torch.utils.model_zoo as model_zoo from torch.nn.parameter import Parameter import torch import torch.nn.functional as F from torch.nn import init from tor...
c6b7f892b5059be15df126c68cbac37aea21226ff3db047e8d66a0b01ee454d5
Python
8,418
249
""" Base Fitter class for fitting linear readout layer (highly inspired by/credit to: https://github.com/neuroailab/VisualCheese) """ import os import pickle import sys from collections import defaultdict from sklearn.decomposition import PCA from spacestream.core.feature_extractor import get_features_from_layer fr...
77a6d927b7d9c2ce74b803a05cd8e30fa078678bd2f430694229a71bfe4e081f
Python
8,427
196
import RPi.GPIO as GPIO import time from VariableList import var_list class Steppercontrol: def __init__(self,enablepin,steppin,directionpin,limitpin,Axis,Plusdir,Minusdir,Stepcon_sendtoUI): self.enable = enablepin self.step = steppin self.direction = directionpin self.limit = lim...
911852785b9a2d21f611ce88b6bc27b7b556957f6f875f7dbbc5e21e9e5807fe
Python
8,429
227
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.helpers import option from poetry.console.commands.installer_command import InstallerCommand from poetry.plugins.plugin_manager import PluginManager if TYPE_CHECKING: from cleo.io.inputs.option import Opti...