sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
6039fad83ddc3e5b4f0be9687378302a30b58cd39f0dfe127ebee3e41ca74e20
Python
19,888
481
# Source code: # https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/utilities.py # This file includes the modifications to the source codes according to this project! import tqdm import numpy as np import pandas as pd import gensim import logging from scipy.spatial.distance impo...
9cd5a93f9a86273e7657011fb9e09f01c8e5b4d77cac29b24c1fc2adfd56855f
Python
19,896
528
#!/usr/bin/env python3 from collections import defaultdict from collections.abc import Hashable import numpy as np from pandas import DataFrame from scipy.linalg import eig from pgmpy.factors.discrete import State from pgmpy.utils import sample_discrete from pgmpy.utils._warnings import _warn_external class MarkovC...
b70f28441bcb23080f1d529b993feff2c77a052c030d4eeab0071ccdf2b62aa3
Python
19,923
522
from itertools import combinations import numpy as np try: from pyparsing import Combine, Literal, Optional, Regex, Word, alphas, nums except ImportError as e: raise ImportError( f"{e}. pyparsing is required for using read/write methods. Please install using: pip install pyparsing." ) from None f...
cf3299d93143b30cea0b0e0dcbb75af486f474c2a90c253947f2dba5781776c9
Python
19,925
555
# -*- coding: utf-8 -*- """ Created on Sun Feb 9 23:49:03 2025 @author: hanna """ """ FACTOR ANALYSIS || Trial-to-Trial (TTT) Models || single model per session (baseline (BL) block data only) Spike counts summed over a fixed window of 200ms to 600ms for each neuron on each trial. [1] data formatting ...
8d99bb3f8586ee9c427a2237a7f546f4c0ad7aad62a1d8030fa8d25e8b7b38d8
Python
19,938
412
#!/usr/bin/env python3 """ ═══════════════════════════════════════════════════════════════════════════════ EIF2S1 R3 REVISION — PIPELINE 2: DISEASE DATASET REPLICATION (PD BA9 RNA-seq) ═══════════════════════════════════════════════════════════════════════════════ Author: Drake H. Harbert (D.H.H.) | ORCID: 0009-0007-7...
844b66e519d270a256d8e06570a2424deb660b127986c3d30c31cf35ac69b5b9
Python
19,941
486
#!/usr/bin/env python # %% from einops.layers.torch import Rearrange from einops import rearrange import os import sys from pathlib import Path from logging import getLogger, basicConfig from typing import Literal, Optional from argparse import ArgumentParser import torch from torch.utils.data import DataLoader impor...
b77385d9c7660e5254fb80eee5b8008c849bbc1f8a6114841c9d3ba09b5d1fa8
Python
19,959
453
import numpy as np import tensorflow as tf from tensorflow.keras.layers import Dense, Dropout, Conv2D, LayerNormalization, GlobalAveragePooling1D CFGS = { 'swin_tiny_224': dict(input_size=(224, 224), window_size=7, embed_dim=96, depths=[2, 2, 6, 2], num_heads=[3, 6, 12, 24]), 'swin_small_224': dict(input_size=...
427029db3c146d963ddbdff294d8c62653f8f7218c06cf0d97a714bcab317f44
Python
19,964
566
""" BAG Index Calculator (Bias-Adjusted Generalization) Calculates the BAG (Bias-Adjusted Generalization) index and BAD (Bias-Aware Degradation) values for evaluating model generalizability across datasets with different bias characteristics. The BAG index quantifies how well a model generalizes to datasets with dif...
49749447889c3dde38e9004595bb00bb483850c4f245d556d8539e591b6eb69d
Python
19,970
476
# app_state.py import logging import os import threading import json import re class Var: """Drop-in replacement for tk.StringVar with .get()/.set() interface.""" def __init__(self, value=""): self._value = str(value) def get(self): return self._value def set(self, va...
5362e1f9b904651de86099c0153fbf1df504ae0eead25678ee8c2626673f09a3
Python
19,980
568
#!/usr/bin/env python # ENCODE DCC common functions # Author: Jin Lee (leepc12@gmail.com) import os import gzip import re import subprocess from encode_lib_common import ( get_num_lines, get_peak_type, human_readable_number, rm_f, run_shell_cmd, strip_ext, strip_ext_bam, strip_ext_peak, strip_ext_ta) d...
6d35cb02f84f07a28b0a9482489b610140eb9c7baae6e00cd84cacea99c170d2
Python
19,987
500
# 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 math from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from torch import Tensor, nn from torch.nn ...
8935f83cb9c1a76c6e62b6f4ea7d8be4c2bf3c5177a219660335d80059a08d66
Python
20,055
602
from __future__ import annotations import os import re import subprocess import sys from importlib import metadata from pathlib import Path from threading import Thread from typing import TYPE_CHECKING import packaging.tags import pytest from installer.utils import SCHEME_NAMES from poetry.factory import Factory f...
1e4ddf7d0d2a5abee1c47704b131418cc224ed7ed387e6410e97147e3c8f8c39
Python
20,081
117
from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join from tractseg.libs.system_config import SystemConfig as C # HCP_105 # (bad subjects removed: 994273, 937160, 885975, 788876, 713239) # (no CA: 885975, 788876, 713239) all_subjects_F...
7879997f12ea7a2ca0973426987d8f5fed066d8b9c14b170001fab4ea05ef376
Python
20,092
410
from typing import List, Union, Tuple import numpy as np import torch from batchgenerators.dataloading.single_threaded_augmenter import SingleThreadedAugmenter from batchgenerators.transforms.abstract_transforms import AbstractTransform, Compose from batchgenerators.transforms.color_transforms import BrightnessTransfo...
a633066a61470d3c07adf514c1eb33ef4695d2add7f5629bbcc666924225b216
Python
20,098
465
#!/usr/bin/env python # ENCODE DCC ATAQC wrapper # Author: Daniel Kim, Jin Lee (leepc12@gmail.com) import sys import os import re import argparse import multiprocessing from encode_common_genomic import * from run_ataqc import * from encode_common_log_parser import parse_dup_qc, parse_flagstat_qc import warnings warn...
713bc83a452ba849f9aa093e718481ba0faa141fd2f739bc31c516fe01a7f18e
Python
20,113
520
# Copyright 2022 InstaDeep Ltd # # Licensed under the Creative Commons BY-NC-SA 4.0 License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://creativecommons.org/licenses/by-nc-sa/4.0/ # # Unless required by applicable law or a...
863c47c568bcaf1a9bfdcf01e4eb185c62934c4610f0e1c9988262aaf411d033
Python
20,116
581
from __future__ import annotations import os from importlib import metadata from typing import TYPE_CHECKING import keyring import pytest import requests from poetry.core.packages.package import Package from poetry.core.packages.utils.link import Link from poetry.repositories.exceptions import PackageNotFoundError...
15bdca7289f34b5a0815243de579c643a1e832ed485ba11b7487788dda53f562
Python
20,131
510
# 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 torch import torch.nn as nn import torch.nn.functional as F from fairseq.iterative_refinement_generator import DecoderOut from fairseq....
dff0aade64866cf9776d970148d4b054d62320ffef5fdad6198c329f8737d4e3
Python
20,137
509
from collections.abc import Hashable, Iterable from itertools import combinations from typing import Any import networkx as nx import numpy as np import pandas as pd from pgmpy.base import PDAG from pgmpy.causal_discovery._base import BaseCausalDiscovery, _ScoreMixin from pgmpy.structure_score import BaseStructureSco...
4b60ed8c68864cab153b0867d56dfc0a17f690bf0adba8c6bf61adb733d5e75f
Python
20,142
468
## run ROI-based mTE # # written by S-C. Baek # update: 16.12.2024 # ''' The following code is to run multivariate transfer entropy (mTE) analysis a subset of ROIs. Only the ROIs that shows significant representations for phonemes or prosody were considered in the mTE analysis to investigate the transfer of the corres...
7ca9f91383ae4c7f13c42be9ddcd1abfacf1475b0ae3b585d13be4a785345e19
Python
20,161
555
# -*- coding: utf-8 -*- """Physiological feature extraction utilities.""" import mne import numpy as np import scipy.signal as sg import matplotlib.pyplot as plt import random import pickle as pkl from pathlib import Path from .preprocessing import auto_identify_bads #%% ################## TIME-FREQUENCY ANALYSIS ##...
5a0b712499ef939dea7ec65efa7239341d17f56875b524b75a05f2e26cfb3aab
Python
20,169
552
import numpy as np import pandas as pd from st_risk.eval.layer_eval import ( calibrate_proxy_threshold, evaluate_proxy_threshold, bootstrap_metric_summary, paired_sample_metric_summary, boundary_enrichment_summary, boundary_spot_mask, celltype_risk_association_summary, cross_sample_laye...
01960097a171d53a9d861b9092cc372a14fcc97f08e17f92db5948db272b5efe
Python
20,190
439
""" run_analysis.py =============== Full parameter-sweep analysis pipeline. For every simulation result file found under RESPATH, this script: 1. Loads excitatory spike times and the corresponding input signal. 2. Computes analytic input characterisation (H, τ_input). 3. Computes dynamical metrics (σ, χ, τ_net, ...
d66c0d6e37a5559c3be039566199c3d5f4f0610b898356b99e352389577095f3
Python
20,191
576
# 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 from dataclasses import dataclass, field from typing import Dict, List, Optional, Tuple import numpy as np import torch import...
829f8d999e7cd342fe8317bc0f9cc1558f83a69292a6d9b14a2b9e0755bc1836
Python
20,203
483
#!/usr/bin/env python3 r"""Calculates useful metrics of model performance. This little helper program reads in two bigwig files and a bed of regions. For each of the regions, it calculates several metrics, and then displays the quintiles of the values of those metrics over the regions. For each region, four metrics ar...
55565dc790111092217e80c382d5f6b38522e2b8e39c80813c1da0da208bfaa8
Python
20,226
469
#!/usr/bin/env python # ENCODE DCC ATAQC wrapper # Author: Daniel Kim, Jin Lee (leepc12@gmail.com) import sys import os import re import argparse import multiprocessing from encode_common_genomic import * from run_ataqc import * from encode_common_log_parser import parse_dup_qc, parse_flagstat_qc import warnings warn...
e24ae77793d7bfc660a294f010165e37ff000e3c931b8b91dd0c523f51a1d19d
Python
20,243
514
# 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 math from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from torch import Tensor, nn from torch.nn ...
228f9db815d620f80781cc4c9c9e544fd68879c70146c4ae6006ed510e798abe
Python
20,245
551
import multiprocessing.process import sys k_fold = sys.argv PROJ_NAME = "DualDataset" def process_gan_training(k_fold: int, EPOCH_RESUME_FROM = 0, MAX_RAM_GB = 4, max_epochs: int = 300): global PROJ_NAME import TSA import tools # import analysis as A import importlib import numpy as np imp...
bda8ae994dc87d8b341e2ecda23a915526a74c9a0b53fd65e02d1cb76a8bc77e
Python
20,260
546
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import pytest import scvi from scvi.data import synthetic_iid from scvi.data._constants import _ADATA_MINIFY_TYPE_UNS_KEY, ADATA_MINIFY_TYPE from scvi.data._utils import _is_minified from scvi.model import SCANVI, SCVI from scvi.m...
bab0800fd20037ce48bc22b5b7843412e1d1a8075d08151374970d1f743e02f8
Python
20,269
567
#!/usr/bin/env python3 import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # ========== USER CONFIGURATION ========== main_csv = "Data/input.csv" output_csv = "Data/input_with_splits.csv" summary_dir = "summaries_joint" outdir = "plots_iso_deam_splits" window_min = 1...
5e995cd38a1c2718547aec65082cb542820af03d4a129d38e3699270b486025f
Python
20,271
410
#! /mnt/projects/ETLAS2/data/code/diffusion_prepared_pcasl/.venv/bin/python """Diffusion-prepared pCASL processing utilities for ETLAS2. This module provides: - motion correction of diffusion-prepared pCASL series to M0 space - robust delta-M estimation from label/control dynamics - parameter estimation of CBF, arter...
c9c1ebf2b0dd2a9c901395cdb8f1fac038b54a4dd18453869b15141436c99f85
Python
20,280
511
"""Implementation of MultiheadAttention. This code has been modified from the original implementation by Facebook Research, describing its ESM-1b paper.""" import math from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from torch import Tensor, nn from torch.nn import Parameter fro...
e90ea0448f59f1f9dad9c79ce4927ff02f2839d120d79eb68434d805fa58e48b
Python
20,289
568
import os import pandas as pd import numpy as np import argparse def kmer2seq(kmers): """ Convert kmers to original sequence Arguments: kmers -- str, kmers separated by space. Returns: seq -- str, original sequence. """ kmers_list = kmers.split(" ") print(kmers_list) ...
d048cb02dd1cb3dbd4b3c0cef3f1cc62428bd4d1043a8eed0227efbb325d746e
Python
20,317
491
""" BDP Pipeline — Bridge-Domain Pipeline (Multi-Source) Step 1: CI-based partition into Bridge set B and Far set F Step 2: Proxy tuning: train on F_proxy, validate on B_proxy (DA as part of phi) Step 3: Final training: B_final -> target T with best phi Partition modes: normal — F_raw non-empt...
cea4fe2a678a80f6866f4144263ef3f85e0716acff965c17c2e947b1f3ec7177
Python
20,318
620
import numpy as np import os, tempfile import SimpleITK as sitk from bigstream.configure_irm import configure_irm import bigstream.utility as ut from itertools import product from ClusterWrap.decorator import cluster from scipy.spatial import cKDTree from scipy.spatial.distance import cdist from scipy.optimize import m...
a07394fce5d03ded9b4ec699073d964b1c522f317b03f4d1087c60110f9c7d3b
Python
20,347
525
import scipy import numpy as np import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm import pandas as pd from tqdm import tqdm from nistats.hemodynamic_models import spm_hrf from scipy.ndimage import gaussian_filter from sklearn.preprocessing import StandardScaler from sklearn.model_selec...
97d01fdab6c40f85aeb7ab480292fe1e992da18c987fd2b64bd8e610044fe289
Python
20,356
574
from __future__ import annotations import re from collections.abc import Mapping from contextlib import suppress from pathlib import Path from typing import TYPE_CHECKING from typing import Any from typing import ClassVar from cleo.helpers import option from packaging.utils import canonicalize_name from tomlkit impo...
db55498f8b81178a666cf07ac98ee9789cc6fa12b28b6233110faac64c83c820
Python
20,378
491
import os import copy import torch import random import numpy as np import pytorch_lightning as pl import torch.nn.functional as F from torch import amp from pathlib import Path from einops import rearrange from torch.utils.data import DataLoader from torch.optim.optimizer import Optimizer from torch.optim.lr_schedule...
e1ec242b61687bb4cbc156102a6b948ee27bc378bb96f33f75d4b7ebb46900fa
Python
20,396
610
""" Module for reading and processing PLINK genotype data and calculating LD scores. Note: This code is adapted and modified from: https://github.com/bulik/ldsc/blob/master/ldsc/ldscore.py """ import logging import bitarray as ba import numba import numpy as np import pandas as pd import pyranges as pr import torch ...
813ef52444c18e2f10080ba7d9a9a1c2669af7b832f870f580ea8c0e143f9599
Python
20,398
526
#!/usr/bin/env python # %% from einops.layers.torch import Rearrange from einops import rearrange import os import sys from pathlib import Path from logging import getLogger, basicConfig from typing import Literal, Optional from argparse import ArgumentParser import torch from torch.utils.data import Dat...
cb99b872b69fe4779f705a835213f38a46acff55ec8ef6023b5fcf4617e5c323
Python
20,415
485
# 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 collections import OrderedDict from fairseq import utils from fairseq.data import ( BacktranslationDataset,...
30db75452d8ddbe676fa4f89b5233aaa05bb5cc22ec993b57b65bb8505059c9d
Python
20,422
548
import torch import torch.nn as nn import numpy as np import pandas as pd from utils.get_grad import get_grad from utils.EarlyStopping import EarlyStopping from utils.Integral import montecarlo,trapz2D,simps2D from utils.NodesGenerater import genMeshNodes2D,genHeteroTip2D from utils.NN import weight_init import matplot...
bba4816dabd40ecd75c0f88fa90d842caa63a0c726affedc71544b7de93cfe2a
Python
20,427
429
import qt, vtk, slicer from qt import QToolBar import os import json from slicer.util import VTKObservationMixin import glob import re import WarpDrive import ImportAtlas from ..Helpers import LeadDBSCall from ..Widgets import ToolWidget class reducedToolbar(QToolBar, VTKObservationMixin): def __init__(self): ...
752a052ccca782a705a1de47fac4cbc7fe86535904100bc07e0b253e653034e7
Python
20,445
519
## ts_simulators outputs tree sequence. This cannot be used as a simulator for simulate_for_sbi! import tskit import msprime import demes import torch import numpy as np import stdpopsim from sbi.utils import BoxUniform class BaseSimulator: def __init__(self, config: dict, default: dict): for key in conf...
b975390a0e28f887d9061c5cd1056bcb823e3f5b9804a42d1f798704bf854f27
Python
20,453
470
import torch import torch.nn as nn import numpy as np from math import sqrt import torch.nn.functional as F from utils.masking import TriangularCausalMask, ProbMask from reformer_pytorch import LSHSelfAttention from einops import rearrange import os import random from utils.tools import create_sub_diagonal_matrix, plo...
da08f891e59433f5162e4ee677f65b3e3e0f558e298e8d621c25bfeb39093d37
Python
20,473
526
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import itertools from collections import Counter from copy import deepcopy from dataclasses import dataclass from functools import cached_property from typing import Literal, Sequence import cachetools import numpy as np import numpy.typing impo...
354169d8e6aafe88eb48753b0ceeb0591c57dc00db895e94ca039c664cec70c4
Python
20,503
595
"""The residency benchmark's arms, equivalence check and source regime record. Written out rather than borrowed from the live method, an arm can drift from it, and a release the shipped method makes and an arm skips can be worth a whole `[chunks, WINDOW_LENGTH, embedding]` block of the peak the script reports. The reg...
993805f67d8d8d7c109d1168201a85c5677e230942e0d9f6fb63d81e02efcd64
Python
20,506
590
# 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 contextlib import json import logging import os import tempfile import unittest from io import StringIO import torch from fairseq imp...
050ccf6edeca78c2b4d8bd8a8daa022a9971775bd7b2a1f84a8acbc0ceecc68f
Python
20,507
588
# Copyright 2022 InstaDeep Ltd # # Licensed under the Creative Commons BY-NC-SA 4.0 License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://creativecommons.org/licenses/by-nc-sa/4.0/ # # Unless required by applicable law or a...
f25e9d4150395e2c0b1fefde67e9dff8d136aaa9d5fbd1ae3d9075dd8d87c219
Python
20,533
556
import logging import os import pickle import sys from collections import namedtuple from datetime import datetime from pathlib import Path from typing import Sequence import h5py import jax import jax.numpy as jnp import numpy as np import tensorboard.summary from jax.tree_util import tree_map from uncertainties impo...
96893111082e78a5d400eb10996bd8c694d22142599ca79bfca098f8e237444e
Python
20,540
564
import os import clip import zarr import torch import sparse import pickle import shutil import random import urllib import argparse import itertools import contextlib import numpy as np import pandas as pd import torchvision.transforms.functional as F from torch import nn from tqdm import tqdm from pathlib import Pa...
1f6785f1f5988f4e20fd03f3ac644dff21da163044877916497920fb498d37de
Python
20,549
548
import os import random import anndata import numpy as np import pandas as pd import pytest import torch from scipy.sparse import csr_matrix import scvi from scvi import REGISTRY_KEYS from scvi.data import AnnTorchDataset, _constants, synthetic_iid from scvi.data.fields import ObsmField, ProteinObsmField from scvi.ut...
1f0b79ee2f2c6f4aede2e71b3a750381e9e6cf40185ef6a2a84acf845ce0fc31
Python
20,567
617
#!/usr/bin/env python3 """ Compare posterior distributions from multiple trained models. This script runs the same tree sequence through different trained models and creates comparison plots showing how different architectures perform on the same data. """ import argparse import numpy as np import tskit import sys im...
882f1bcd8360d273b5bdfc5272b3f3cb87605cc09c036c5b179e377bf74dddc2
Python
20,582
539
""" MMP Pipeline — Minimum-distance Multi-source Pipeline 1) Distance-to-target with bootstrap CI; CI-aware source gating 2) Optional CORAL harmonization to medoid 3) Two combiners: merge_then_adapt / moe (weighted voting) 4) Near/nearest proxy tuning within the target-defined near set - if |N(t)| >= 2: u...
5519cc724e02dede9398766c554b4a0b1b9257cb096c8afa52fe067cb13b75d5
Python
20,585
566
import csv import pathlib import string import pytest import torch import transformers from d3text import utils from d3text.utils import ( Token, load_fast_tokenizer, merge_off_tokens, merge_predictions, repr_sequence, token_merge, ) from d3text.models.base import load_base_model from d3text.ru...
3d482631610b5be35474d43b778099e8b515437a0fcde0e3f69d1eef90e05160
Python
20,592
642
import functools import json import logging import os from pathlib import Path import random import re import subprocess from typing import Dict, List, Mapping, Optional, Tuple, Union import numpy as np import torch import pandas as pd from anndata import AnnData from matplotlib import pyplot as plt from matplotlib im...
0a2b303024fd92490c185e1f27570f6d78c3d1771d536044ecbdf9f664c01510
Python
20,629
361
import argparse import multiprocessing import shutil from typing import Union, Tuple, List, Callable import numpy as np from acvl_utils.morphology.morphology_helper import remove_all_but_largest_component from batchgenerators.utilities.file_and_folder_operations import load_json, subfiles, maybe_mkdir_p, join, isfile,...
20476d73d2835f4cd6b984d03f407ef1d45afdedbc78bc0c6aba4afd606561fb
Python
20,648
552
# 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 math from pathlib import Path from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn from to...
07472ae26b43d8279f90feff59d51e67c23a88876b25738c680d0826d47d360e
Python
20,657
505
import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import sys, os, math, random import numpy as np import torch import torch.nn as nn import matplotlib.pyplot as plt # ====== 工程依赖(与你给的工程保持一致)====== sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.a...
45880ce302dbc15c020e49c9e6768369965bde3c78e5282f24f4c8488906c95e
Python
20,662
579
# 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. """ Base classes for various fairseq models. """ import logging from argparse import Namespace from typing import Dict, List, Optional, Tuple ...
7b7be39bb0593fd0d8542cbef0b808a43abc712573a799d6e8f0950706608e5d
Python
20,672
585
# 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 torch import torch.nn as nn import torch.nn.functional as F from fairseq import options, utils from fairseq.models import ( Fairs...
b85f1181970505d9cd8a9f5d538561e496db41a8dbf3a1686b1952eb65e879cd
Python
20,687
608
"""Reading the corpus: what text actually reaches the tokenizer. Both precompute commands turn a row into one string and each used to do it its own way, neither disagreement visible from the output. A missing abstract is `nan` or `None`, never `""`, and `str(nan)` is the *truthy* `"nan"`, so `str( row.abstract) or ""`...
0bc666bbaabbedafd547bf2b389bbd647efecc771dbeea0cd852fc81eb39a4e4
Python
20,695
362
import argparse import multiprocessing import shutil from multiprocessing import Pool from typing import Union, Tuple, List, Callable import numpy as np from acvl_utils.morphology.morphology_helper import remove_all_but_largest_component from batchgenerators.utilities.file_and_folder_operations import load_json, subfi...
de3a85e3493e2cd410a7dd65b4b064aaa155fb304bb6efc53caebf0a545c092a
Python
20,723
581
#!/usr/bin/env python3 -u # 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. """ Train a new model on one or across multiple GPUs. """ import argparse import logging import math import os impor...
1a602c97047fc74050c0aa5e2ca39f1c58abde5ec8d4855e39944e9e52b1dfdb
Python
20,729
632
''' Reference: https://github.com/bio-ontology-research-group/deepgo2/blob/main/deepgo/metrics.py https://github.com/bio-ontology-research-group/deepgo2/blob/main/deepgo/utils.py ''' import numpy as np import pandas as pd from sklearn.metrics import classification_report from sklearn.metrics.pairwise import cosine_si...
29e9ad72164bc849fe78724c199b954e28b24863790dc09ea58ec537e7186cde
Python
20,741
514
from collections import deque from collections.abc import Hashable, Iterable from itertools import pairwise import networkx as nx from pgmpy.utils.types import Self class _GraphAlgorithms: """Graph-algorithm methods for ``_CoreGraph``-based classes (inherited, not instantiated alone).""" def get_ancestral_...
07a988cc8d0d9000c41254a9ceb61e838a1c7b05e6b0a5c3e6d39b499efc7ed2
Python
20,747
514
import cv2 import copy import torch import random import pyvips import argparse import warnings warnings.simplefilter(action='ignore') import numpy as np import pandas as pd import multiprocessing as mp from pathlib import Path from einops import reduce from PIL import Image, ImageEnhance from utils import MOUSE, MAL...
55d68cad6c601c5d6b815a388f18875a90712010a1062483ec2339d801794111
Python
20,773
600
import os import statistics import networkx as nx import numpy as np import pandas as pd import tensorboardX import torch from matplotlib import pyplot as plt from utils import gengraph, featgen # dataset: stad, coad, ucec, syn1, syn2, syn3, syn4, syn5, citeseer, cora def obtain_dataset(args): if args.dataset ==...
3f94ac1cc9e9547cf6665de4659a42e33b31133753bc77d531ccd101246bbdf6
Python
20,774
636
# -*- coding: utf-8 -*- """ Created on Fri Feb 21 03:02:24 2025 @author: hanna """ # -*- coding: utf-8 -*- """ Created on Sun Feb 9 23:49:03 2025 @author: hanna """ """ FACTOR ANALYSIS || Trial-to-Trial (TTT) Models || single model per block (baseline (BL), perturbation (PE)) One model is fit per block (2 m...
2271abcdb512d4624808832add8ffbeb0870702c9b3f72036b489c04309218b9
Python
20,784
576
from collections.abc import Callable, Iterable from typing import Literal import numpy as np import torch import torch.nn.functional as F from torch import logsumexp, nn from torch.distributions import Beta, Categorical, Independent, MixtureSameFamily, Normal from torch.distributions import kl_divergence as kl from s...
6d31307a6fc4baaea2d6698a1ea1dff0431ac20783505abc73f5fe8d2b0f9054
Python
20,798
642
#!/usr/bin/env python3 import json import os import shutil from datetime import datetime from typing import Any import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np # noqa import torch import torch.nn as nn import torch.optim as optim from torch import Tensor from torch.utils.d...
bbcb3997bf5bbd4ac890e34eeefff78896aa4e5c128f3c2bd617e0fb1870953f
Python
20,825
498
"""Some utilities for dealing with bed files.""" from typing import Literal, Any import multiprocessing from collections import deque import os import pybedtools import pysam import numpy as np import pyBigWig from bpreveal import logUtils from bpreveal.logUtils import wrapTqdm from bpreveal.internal import constants f...
fd69c6a093930321d63e36190f5fe295570360e6100ebb297f9533d663a5d125
Python
20,825
482
"""Generate the four main-text figures for the JCTC submission from the results CSV/JSON cache and from the existing PNG outputs of the perovskite active-learning pipeline. Outputs (all under figures/): fig1_method.png — CT2F construction diagram (3 panels) fig2_perov.png — AL curve + parity plot (c...
453abbc7d4df5d20ff01cd530205e4176251ca465d73583017435be750b80343
Python
20,870
482
from copy import deepcopy import unittest import numpy as np import os from medaka.common import Region, Relationship, Sample, OverlapException import medaka.labels root_dir = os.path.abspath(os.path.dirname(__file__)) test_file = os.path.join(root_dir, 'data/test_probs.hdf') def get_test_samples(num_train=1000, num...
322027a8b4aad27b54eac2fcb1a58dc9bd9f1d9ee44563c80e1cfb32d8c26768
Python
20,891
486
# code adapted from # https://nipype.readthedocs.io/en/latest/users/examples/fmri_fsl.html # # This is supposed to simulate a FEAT run, but it doesn't actually use # FEAT, it uses direct calls to all the constituent functions FEAT otherwise # calls. Constructing this requires careful comparison with feat output # logs ...
1f11050b131eb896c27c7e8dd38fea4538480a5c67c144ebd471955f4ee2d7fa
Python
20,896
571
import sys import numpy as np from keras import backend as K from keras.engine import InputLayer from keras.layers import Dropout, BatchNormalization from keras.models import Sequential from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score from model.model_utils import get_lay...
93964e88c70406cde4b6420fbce3be2dd6f634ee8ebab92bfedf4fa270436903
Python
20,902
538
"""Shared machinery for isolated calculation validation. The runners in this package deliberately execute copied examples under an external results directory. They do not modify the checkout or reuse output files from a previous run. """ from __future__ import annotations import csv import hashlib import json impor...
cb8700c8b750990ea4fa14441e742515529d697c0a93a818c5c0b7e79d3255e8
Python
20,909
581
#!/usr/bin/env python import xml.etree.ElementTree as etree from io import BytesIO from itertools import chain import numpy as np from pgmpy.factors.discrete import TabularCPD from pgmpy.models import DiscreteBayesianNetwork from pgmpy.utils import compat_fns from pgmpy.utils._warnings import _warn_external try: ...
c8e6659410e4a7d0fc40468386731a189134eaeb9546c150cee8376d9b37f32c
Python
20,913
373
#04 3 "olddetion" import logging import argparse import torch.optim as optim from torch.utils.data import DataLoader from tensorboardX import SummaryWriter import dataload.fs_datasets as data import utils.gpu as gpu from utils import cosine_lr_scheduler from utils.log import Logger from modelR.fs_2_lodet_hbb...
dcf8ef1a82634b424f4b989184dda8ed2af3283cea463642612e6cc126ba0a3c
Python
20,916
517
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 26 16:21:46 2025 @author: vbp K-fold cross-validation of the R/S regression model Approach: for each session, split trials into k folds (stratified by region, so each fold has enough trials per region for the downstream per-region fit). For each f...
d8f8b654ced06cfe871469b27cc722e71a0be4a2b727f6f466ecf9ff823406f4
Python
20,928
630
# 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 dataclasses import dataclass, field import logging import math from typing import Optional, Tuple from omegaconf import II import sys im...
bf725994be4a573511bb9663049557cfd091c04f292c441026be2b3ff98e457f
Python
20,931
627
from __future__ import annotations import shutil import sys from pathlib import Path from typing import TYPE_CHECKING from typing import ClassVar from typing import Protocol import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.outputs.output import Verbosity from poetry.core.constraints.version imp...
c5cdd84205a1084f95495505baaea47d401c5335f36bbc0a71c1cd51647b6448
Python
20,936
486
"""Function that generates new inferences from trained models in the frame classification family.""" from __future__ import annotations import json import logging import os import pathlib import crowsetta import joblib import lightning import numpy as np import pandas as pd import torch.utils.data from attrs import ...
efd8fdb7f6d2a0b3af6bba9ef3f261442e633ab846924851aa359aed44725987
Python
20,939
416
from __future__ import annotations from dataclasses import dataclass from pathlib import Path import numpy as np import pandas as pd from st_risk.reporting.anchored_validation import PROXY_SHORT_NAMES from st_risk.reporting.gallery import dominant_celltype_table, repo_relative_link ABSTAIN_REVIEW = "review needed"...
f049e7e38f0da3580ccc6e98cea97a9107f1da165b68a450da932ddd9fb5bb36
Python
20,940
530
#!/usr/bin/env python3 """Implements a small interpreter. Syntax: This interpreter interprets a subset of the Python programming language, with an extension to the behavior of default arguments in lambdas. Since it uses the Python parser, it obeys Python's operator precedence. If it encounters a name in the expressio...
0e1c640d0ac464ca0110b54653ef13d4c35a875174dc5d09d90fc1dde74d742b
Python
20,941
433
""" Code to load data and to create batches of 2D slices from 3D images. Info: Dimensions order for DeepLearningBatchGenerator: (batch_size, channels, x, y, [z]) """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join import random im...
5406f874ace84c4fbd8babef704a145911174579837a1cbfe811fbaec47bdf21
Python
20,977
551
import gradio as gr import torch import pandas as pd import matplotlib.pyplot as plt import numpy as np import os import re import yaml import requests import json import time # from spellchecker import SpellChecker from easydict import EasyDict from scipy.stats import norm # from .init_model import model, all_index, ...
c5a1f8c807e521e18e48d742c5a33b0279b702ad9be36738f99608bb1ae53a92
Python
20,977
612
# 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.multiprocessing as mp import numpy as np import json import torch from torch.distributions.categorical import Categori...
5e1503945b89173c30dc7f43dad307d7de389ceb9099c71cd38b0fa120e7c780
Python
20,987
672
""" kmeans_effect_clustering ======================== This module provides utilities for performing K-means clustering on gene expression effect matrices and generating visual outputs for analysis. It integrates with AnnData and Scanpy for preprocessing, clustering, and visualization, and supports end-to-end workflows...
ce6bb45fc31a6a868a1742c71706242a5b54cc7eede0b296e708bd6f0a652812
Python
20,990
501
''' By K. Butenko Runs OSS-DBS to compute stimulating fields for sEEG ''' import pandas as pd import numpy as np import sys import os import json import subprocess import re from ossdbs.electrodes.defaults import default_electrode_parameters def check_electrode_availability(reco_electrode): """ ...
c0aea4c0c5f19fbabf2242ae5764ec1ffcd066b45afb5203d40b392ccf993c60
Python
20,997
559
# Copyright 2015 Google Inc. 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 applicable law or a...
e416b6190b05674563146a3d215cf62fe6b1811f30636f41d7e47fc0143f739a
Python
21,006
505
import copy import numbers import os import signal from textwrap import dedent import matplotlib matplotlib.use('Qt5Agg') import yaml from PyQt5.QtCore import QTimer from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog from PyQt5.QtWidgets import QDialogButtonBox from PyQt5.QtWidgets import QFileDial...
f0c775580f89dcabd3233f0de70798e3e39dc3f88bd8b71cd2d6d7b7b4cad919
Python
21,037
523
"""What every tracked metric's y-axis actually is. MLflow charts a metric under its key and offers no field for a unit, a direction, or the denominator an average was taken over, so the keys are written to say what they are and this module renders the glossary `tracking.run` posts as the run's description. A leaf: no ...
c6dfa524a9a1ab0916d4aeae45b25e7976d1699069db64a2566a7b0d696d6d40
Python
21,039
471
#!/usr/bin/env python3 """A little program that displays progress information as a model trains.""" import curses import sys import argparse import re from typing import Any from bpreveal import logUtils # These will be initialized after we have a window. _COLOR_GREENBG = _COLOR_REDBG = _COLOR_ALARM = _COLOR_HIGHLIGHT ...
484a4710a1780444a6f205d9e5b28bf2cec3101df66dc5fb036b8742a1ed3d74
Python
21,041
534
"""Metrics for segmentation adapted from information retrieval.""" from __future__ import annotations from collections import defaultdict from typing import List, Literal, Mapping, Tuple import attr import torch from vak.common import validators def find_hits( preds: torch.FloatTensor, target: torch.FloatT...
9a766c6b4f578a3ce8658d0fddc31172eec91b649ad0e81c8302827dab425a8b
Python
21,082
507
# utils/label_utils.py import os import shutil import pandas as pd import pickle import threading import torch import torch.nn.functional as F import evfuncs import re from scipy.signal import spectrogram from PyQt6.QtWidgets import QApplication from moove.qt_helpers import invoke_in_main_thread, show_info from moove...
e8134f7e4245505cdd3718c2f095f2fe0663a8c9ed92f880d247f045504d5f62
Python
21,084
554
import itertools from os.path import join import matplotlib import numpy as np import pandas as pd import seaborn as sns from lifelines import KaplanMeierFitter from lifelines.statistics import logrank_test from matplotlib import pyplot as plt, gridspec from matplotlib.ticker import NullFormatter, FormatStrFormatter f...
10652aa75c5401346cf4d6eab2e85fc5359afe1825973504ca1e1e062a6c4fd1
Python
21,103
470
#!/usr/bin/env python3 """ B0 variant generation using either 2D polynomial or 3D spherical harmonics fitting. Supports two fitting methods: 1. poly2d: 2D polynomial fitting per slice (like the original B0 fitting process) 2. sh3d: 3D spherical harmonics fitting across the entire volume Both methods: - Use only mask ...
99f310693f1603b8e8905c8312a808fe4e5b1394e0c55f181f19863d0ccecb0d
Python
21,113
455
#!/usr/bin/env python """ # Author: XU Kui # Created Time : 09 Nov 2020 11:14:31 PM CST # Description: decription: x """ import os,sys import numpy as np import xgboost as xgb import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt import argparse from sklearn.metrics import r2_score # feature_list=...
ba02ce4706a5da903a3b1060080e901a74de626e19f5e2fb9ccd883322973782
Python
21,126
631
# -*- coding: utf-8 -*- """ Created on Tue Apr 22 10:20:43 2025 @author: mayc06 """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import pynumdiff import utils from utils import unwrap_angle,wrapToPi import warnings from scipy import special def get_trajlist_from_behd...