sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b2857f0ee903dae1b9ec8865a5ecf02f1c4f69c193a180e827ee0d854f3e51db
Python
9,171
239
import logging import warnings import numpy as np import pandas as pd from keras.callbacks import Callback # http://alexadam.ca/ml/2018/08/03/early-stopping.html class FixedEarlyStopping(Callback): """Stop training when a monitored quantity has stopped improving. # Arguments monitors: quantities to be...
c86a40504a1b3d4f994b039fb8e3f18bedb9ee00d4711510421cadef0429b59d
Python
9,177
247
import os import h5py import time import numpy as np import dask.array as da from types import SimpleNamespace from voluseg._steps.step4a import define_blocks from voluseg._steps.step4b import process_block_data from voluseg._steps.step4c import initialize_block_cells from voluseg._steps.step4d import nnmf_sparse from...
06577b82279918d19310fa5f549a833e689a3dea402b2bffe30bbd8308267e61
Python
9,182
236
from collections.abc import Hashable import numpy as np import pandas as pd from scipy.stats import multivariate_normal from pgmpy.structure_score._base import BaseStructureScore class LogLikelihoodCondGauss(BaseStructureScore): r""" Log-likelihood score for Bayesian networks with mixed discrete and continu...
b1ae7b256be306a24098bf1280e99ec0c912f3b3e5f6cf5d1ae7a2a28a79d6cd
Python
9,182
238
"""Supplemental to Figure 2 — PhysMAP hyperparameter sweep on Hausser. Grid (per preview_sweep.physmap_grid): 4 dimV × 3 metric × 3 nfeatures = 36 configs. Each config's physmap_CV_results.csv contains 5 caret-CV folds (Fold1..Fold5). Locked config (locked_configs.json): config_13, selection classifier KNN. confi...
42496814f276444dfcb534d7ebdf2b0c6098543a70bdfcee898b28cfc4678c90
Python
9,184
239
# 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 collections.abc import Collection from dataclasses import dataclass, field from typing import Any, List impor...
88102215f6d04a616a83e69bb75b391f09d796b287105096416d3d7f88eb4ee8
Python
9,186
286
from typing import Dict, Optional, Tuple import haiku as hk import jax import jax.numpy as jnp from haiku import initializers from nucleotide_transformer.types import SequenceMask from nucleotide_transformer.utils import get_activation_fn class DownSample1D(hk.Module): """ 1D-UNET downsampling block. ""...
9314bb2267b38c89b12c6e7bc24b57f8000476a20f8ad5d2319b5a84f8236e5e
Python
9,187
222
#!/usr/bin/env python3 """ @file train_neural.py @author Simon Yu @date 02/15/2023 @brief Script for training neural models. """ import argparse import dataset import header import logger import math import model import test_neural import torch import tqdm import utility import wandb def computeLoss(output, lab...
fa60c2ac36b5e5079d02ab48e4c4669d1e5fdd345240784aba104bfc9945dd45
Python
9,191
216
""" Compute the percentage of novel isoforms (structural_category != 'full-splice_match') whose splice junctions are all supported by short-read RNA-seq (STAR SJ.out.tab files), and whose 5' ends are within 100 bp of a CAGE-seq peak (refTSS). """ import sys from pathlib import Path import numpy as np import polars as...
698ee58a201979efac015b3d30ae40bbf3a78e5a85b972cf18add138d27012da
Python
9,198
237
""" scoring.py — cross-session CV scorers and score-mode dispatch. Neutral home for the candidate-scoring strategies (kfold / loso / pairwise) used by MAP, DWP and the BDP degrade path. These functions previously lived in map_pipeline.py and were cross-imported by dwp_pipeline.py and bdp_pipeline.py; centralizing them...
8169db361fc3ba361b3c33658b8ea01486153811fe6790504e181bee53afdc3a
Python
9,198
262
# 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 copy import logging from fairseq.models import ( FairseqEncoderModel, FairseqLanguageModel, register_model, register_m...
ef876e90b66c19d47e50d92b27ff237dfe38e2076721bbe20417a601a42cba8e
Python
9,203
167
import os import numpy import numpy.testing import pandas from sqlalchemy import create_engine import unittest from metax import PredictionModel from . import SampleData def get_model_weights(path): engine = create_engine('sqlite:///'+path) return pandas.read_sql_table('weights', engine) def get_weights_i...
85077cdfcaad65199fe4ccbc46b44372d9fd6e9826d197899b8eb7c4ac29deaa
Python
9,204
258
"""Analytic forces for OCE. For each figure class F, we compute the partial derivatives ∂Π_F/∂r_a of the correlation feature with respect to atomic positions r_a. The total force on atom `a` is F_a = -Σ_F J_F · ∂Π_F/∂r_a with J_F obtained from a fitted ``oce.fit.OCEModel``. Topology assumption ----------------...
bbf31376720c83b3e940a5419ef16dd842489e9517e5f2ef4a0d443f6006655c
Python
9,205
226
import json import os import subprocess import sys from pathlib import Path import pytest from rnalysis.utils import param_typing from rnalysis.utils.param_typing import DEFAULT_ORGANISMS REPO_ROOT = Path(__file__).resolve().parent.parent # param_typing getter -> the vocabulary key it reads out of the packaged snap...
5425a2d516b294e6dde39af7cb982cda4e29248e33020b9fee5f20144fb4603c
Python
9,209
222
""" Usage: This script is used to extract the embedding / logit for speech classification task. 1. Set fdir into your model checkpoint directory 2. Run the following command (preferrably on GPU machine to speed up the inference process) CUDA_VISIBLE_DEVICES=0 python3 examples/wav2vec/gen_audio_embeddin...
047241ceb99d0e6e65c967304f29ba3cd60bd533ea3efbd6f15efc21f7a3fea9
Python
9,213
338
import os import subprocess import pytest import torch from mudata import MuData import scvi from scvi.model import MULTIVI, PEAKVI, TOTALVI, CondSCVI, LinearSCVI @pytest.mark.multigpu @pytest.mark.parametrize("unlabeled_cat", ["label_0", "unknown"]) def test_scanvi_from_scvi_multigpu(unlabeled_cat: str): impor...
1b23206fcf63c7dd10210a9561990d182968902aff9c01e0967fc3ca70bc1016
Python
9,215
225
"""Build the Nature Communications Source Data workbook. Writes one sheet per manuscript panel containing the values plotted in that panel. Nothing is recomputed from raw recordings: every sheet is a view of the cached per-fold predictions and metrics that produced the figures. Sheets sourced from ``figures/**/*_metr...
c085227b9fa7d7ebf305a54c460b7412a96da2a291b3632a516a7465808db6d2
Python
9,225
218
import configparser import datetime import sys import os import numpy as np import pandas as pd from scipy.stats import norm from multiprocessing import Pool def process_template_chr(c, template_dir, bfile_prefix, out_dir): print(f"processing template chr {c}") bim_file = os.path.join(template_dir, f"{bfile_p...
7d0ed39f2b23f4f90d01377fa8dad304a1eb5c77caf52cd8c6ebd3b02bb25bef
Python
9,228
319
from docutils import nodes from docutils.parsers.rst import Directive, directives from sphinx.util.docutils import SphinxDirective from docutils.statemachine import StringList import os import json # Here we define the order of the model groups # as they should appear in the list GROUP_ORDER = [ "Quick start", ...
d6a11d5e0e3729e23756ae7bfb5d89dc3f0af0b67b1650a1b667d2dfb8473303
Python
9,228
190
"""Sorts GO IDs or user-provided sections containing GO IDs.""" __copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" import sys import collections as cx from goatools.wr_tbl import prt_txt from goatools.grouper.sorter_nts import SorterNts from goatool...
3ed6d86e68d6a5659511a221fa6debfec8477b70d271e336dc6047e163e2e3ce
Python
9,232
212
from typing import Union, Tuple, List import numpy as np import torch from batchgeneratorsv2.helpers.scalar_type import RandomScalar from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform from batchgeneratorsv2.transforms.intensity.brightness import MultiplicativeBrightnessTransform from batchgen...
065182857e3e60ca0f274c86b8bf9d4b09c79dc3f3029f7bca32dd3e20c944a1
Python
9,234
261
import numpy as np from scipy.optimize import newton import pandas as pd from numba import jit import os import ast import matplotlib.pyplot as plt Lr = 0.013 gr = 1. eps = 0.01 # perturbation rate for local sensitivity analysis (e.g., eps=0.01 means 1% perturbation) rank = 1 # specify the rank of the parameters to u...
57cb8aad5a9a7d4b7de00a27d8e6a548c356d7c618c81852b36e447ed04228ce
Python
9,234
194
"""Functions to read text or tsv files containing GO IDs and sections of GO IDs.""" from __future__ import print_function import os import sys import re import pkgutil import importlib from goatools.gosubdag.go_tasks import chk_goids from goatools.grouper.hdrgos import HdrgosSections from goatools.grouper.grprobj imp...
aa693f793a56e2d41bbe54c2c1ffc9b96d2f681a1ddb0f6d00eab6d6cf9a5725
Python
9,236
295
#!/usr/bin/env python # -*- coding: utf-8 -*- # # ecephys_spike_sorting documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present...
fff7999b0ac93da58d1d122b8ed888231c17286c835fe986e08175ed728ec043
Python
9,239
239
"""Wave-1.5 OCE on perovskite SIESTA pool — full ablation. Compares baseline (1F+2F), CT2F (Wave-1), and Wave-1.5 (CT2F_A + MADCT2F + CT3F) variants on the n=243 SIESTA-PBE labelled pool, with per-kind and per-family breakdown. Strain regime is the key target. """ from __future__ import annotations import json import...
9b8091d4062983ee7636f7ece07143093e42bc91237124a129d872ca6f7f4f9f
Python
9,240
259
import pytest from pgmpy.independencies import IndependenceAssertion, Independencies @pytest.fixture def assertion(): return IndependenceAssertion() @pytest.fixture def eq_assertions(): return { "i1": IndependenceAssertion("a", "b", "c"), "i2": IndependenceAssertion("a", "b"), "i3":...
3287c5daf9bba5d974466354db314aeb3e86512fe052159b1a72e13832b478df
Python
9,243
216
from functools import partial from typing import Callable import jax import jax.numpy as jnp from jax import random, vmap from ..geom import masked_pairwise_distance from ..types import ( ElectronConfiguration, ModelDimensions, MolecularConfiguration, ParallelElectrons, RandomKey, ) from ..utils i...
dc73cb28beeebfd66c1a1a64f98904b3cbae6fc06002f13250a5c97da3143d57
Python
9,248
280
"""Manage optional GO-DAG attributes.""" __copyright__ = ( "Copyright (C) 2015-present, DV Klopfenstein, H Tang, All rights reserved." ) __author__ = "DV Klopfenstein" import re import collections as cx from ..base import logger class OboOptionalAttrs: """Manage optional GO-DAG attributes.""" optional...
4bbf7bb02ee3d8b4555fea852a6867d26c9d825dbe26e90ce12bcdf3388a6fca
Python
9,256
190
# 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...
53f1f9feb7be7657d40d7dc47bfeeda90187efd147f32630721ae88adcb3f692
Python
9,259
208
# Ranger deep learning optimizer - RAdam + Lookahead + Gradient Centralization, combined into one optimizer. # https://github.com/lessw2020/Ranger-Deep-Learning-Optimizer # and/or # https://github.com/lessw2020/Best-Deep-Learning-Optimizers # Ranger has been used to capture 12 records on the FastAI leaderboard....
dd0a5847dfef9627f1638509058c22d892625656e571d6a337d69c63f2f3757b
Python
9,259
211
#!/usr/bin/env python3 """ @file train_blackbox.py @author Simon Yu @date 01/26/2023 @brief Script for training blackbox models. """ import argparse import dataset import header import logger import model import test_blackbox import torch import tqdm import utility import wandb def processArguments(): parse...
d3ac536d7c1e2c7276c4128b3d9941d3b87957e14c3e03bb818fc5a2b700755f
Python
9,260
251
from __future__ import annotations import numpy as np from skbase.base import BaseEstimator from pgmpy.base import DAG from pgmpy.models import DiscreteBayesianNetwork, LinearGaussianBayesianNetwork from pgmpy.utils import build_state_names, preprocess_data class BaseParameterEstimator(BaseEstimator): """ T...
fa1d12377606eceeac65a08d1a3743613052709460d04659c333224d632b2430
Python
9,261
186
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Fit one of the models to the given data. This function can use two kinds of noise standard deviation, a global or a local (voxel wise). If the argument -n / --noise-std is not set, MDT uses a default automatic noise estimation which may be either global or local. To use...
3b687fe4abb4f1c960eef6190225356ee686f6ea62e2c6ff2d16da1cb8e3b3ae
Python
9,262
312
import os import time import sys import traceback from PyQt5 import QtCore from contextlib import contextmanager from functools import wraps from PyQt5.QtCore import QObject, pyqtSignal from PyQt5.QtCore import QTimer from PyQt5.QtWidgets import QApplication from mdt.__version__ import __version__ from mdt.lib.log_...
aaa20dc927f6f23d0b2aa9e10e72ad13b19f3cb87faa5ceb8f5227a6363be926
Python
9,262
254
import numpy as np from scipy.stats import ttest_ind, pearsonr from sklearn.model_selection import StratifiedKFold class CounterbalancedStratifiedSplit(object): def __init__(self, X, y, c, n_splits=5, c_type='categorical', metric='corr', use_pval=False, threshold=0.05, verbose=F...
50d2c003d53ffd72dbe68cfa8663185a189d61cddece0fe98089d3c3e2e60f36
Python
9,264
173
import numpy as np import logging from scipy.sparse import csr_matrix from .utils import AnnotUnivariateParams from .utils import AnnotUnivariateParametrization def get_null_params(libbgmg): return AnnotUnivariateParams(libbgmg=libbgmg, s=0, l=0, sig2_zeroL=0) def get_params(libbgmg): return get_null_params(...
52add9ae12174cf84e06a84cd81479cc2d9ca154cd41f819e5f85a401c30e5a0
Python
9,267
242
"""Classifier and relation heads used by the models in this package. Also holds `PermutationBatchNorm1d`, the hidden-block normalisation layer `base.py` builds into its hidden layers and runs through `base._run_hidden_layer` — not a head, but placed here rather than moved next to its only caller. """ import math from...
6ad2a9c95e09d843dfdf553a4350c1d15d238fb3f390f58cae1619fc4ca7e061
Python
9,272
258
from functools import partial from typing import Callable, Literal, Optional, Protocol, Tuple, Type, Union import jax import jax.numpy as jnp import jax.numpy.linalg as jnp_linalg import numpy as np import scipy from pyscf.dft import numint from oneqmc.density_models.analysis import DensityModel, get_dft_grid from ....
dd6cb72fff9dfbba9137c56b8128e80fbe18bf8423bc2bbcd27f374f775c10f0
Python
9,275
251
import numpy as np from ClusterWrap.decorator import cluster as cluster_constructor from bigstream.align import alignment_pipeline from bigstream.transform import apply_transform from bigstream.piecewise_align import distributed_piecewise_alignment_pipeline from bigstream.piecewise_transform import distributed_apply_tr...
758fb064594fc945fa79c9874f0a1d5c7401f932a6fdebd8e2c2058aec0f5301
Python
9,280
181
import sys sys.path.append("../utils") import torch import torch.nn as nn from utils import utils_basic import config.cfg_lodet as cfg #处理类别不平衡问题,使得模型更关注难分类的样本,从而提高性能 class FocalLoss(nn.Module): def __init__(self, gamma=2.0, alpha=1.0, reduction="mean"): super(FocalLoss, self).__init__() s...
a7ae26d7af4bc8ddda058bb948dda51789e40e6823c5c8a713d558ce6a4998ab
Python
9,281
292
# 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...
6667ee47cede72f80e62200ac683d032b84d13c459ca7e915a2c7bb6164e83d7
Python
9,283
191
#!/usr/bin/env python3 """Análise da DOS das 1.784 perovskitas: o que ela responde para o artigo. Consome `dos_perovskitas.npz` (curvas em grade relativa a E_F + escalares), produzido por `dos_remoto.py`. AS PERGUNTAS, em ordem de importância para o manuscrito do gap: 1. VALIDAÇÃO nas 1.784 (não em amostra): o gap...
d472833446987c6ca4eb659b168401c78ea28f69e06629be0c8226da8d964256
Python
9,285
201
#%% import os import numpy as np import pandas as pd from tqdm import tqdm import itertools from scipy.stats import mannwhitneyu from statsmodels.stats.multitest import multipletests from utils import compute_ccc, combat_correction, bca_bootstrap_ci BIAS_CORRECTION = ["none", "default", "brain", "gwm"] ZNORM_ROI = [...
c32aca77e589f5c37f629f23d28b778bb9fda6f43afb6a75260a9f2e40771728
Python
9,289
254
# 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 import torch import torch.nn.functional as F from fairseq.models.nat import ( _apply_del_words, _apply_ins_masks, _ap...
04821328d01da8ed76a999b8678d5b2549ebc5953c5f8d578d74e67d5d59fe8c
Python
9,292
247
# 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 logging import unittest from io import StringIO from unittest.mock import MagicMock, patch import torch from fairseq...
fa8f2fa776ec87656f40dbaf96c5dfac863453926c86278400e3a7703cbe506d
Python
9,292
321
import os import csv import math import re from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parent INDEX_2016_PATH = PROJECT_ROOT / "dataset" / "index" / "v2016" / "INDEX_general_PL_data.2016" INDEX_2020_PATH = PROJECT_ROOT / "dataset" / "index" / "v2020.R1" / "INDEX_general_PL.2020R1.lst" CASF_2013_...
771ce812372a88753fd58401ff1aabb67f3505a7d96ad185d54634570851ac10
Python
9,296
273
import plotly.graph_objects as go import networkx as nx import matplotlib.pyplot as plt import json import os def get_traces(G, adj_mode="color"): edge_x = [] edge_y = [] for edge in G.edges(): x0, y0 = G.nodes[edge[0]]['pos'] x1, y1 = G.nodes[edge[1]]['pos'] edge_x.append(x0) ...
afb693b51676dbe3f09305d70a9d0b7d85873e50f79379860d1982ab7f18a07d
Python
9,305
251
"""Module providing queries into the document database.""" import logging from collections.abc import Callable, Iterable, Mapping, MutableMapping from pathlib import Path from types import TracebackType from typing import Any, Literal, Self from apiadapters.ncbi.parser import is_scanned from lpsn_interface import lps...
87b6cdbb8dc03898018f4381b5db783ba67011e36161798efeeb2412e3f52616
Python
9,307
244
from math import e import time from matplotlib.pylab import f import scipy import pandas as pd import numpy as np import pingouin as pg import matplotlib.pyplot as plt from scipy.stats import pearsonr import seaborn as sns from sklearn import metrics # durations egestive_priming_data = scipy.io.loadmat("data_folder/Eg...
916c08f988843e744d3e76a62324ba3f0c9f54975296dabe4af86a50941b5ed0
Python
9,308
236
"""Unit tests for vak.prep.frame_classification.make_splits""" import json import pathlib import shutil import crowsetta import numpy as np import pandas as pd import pytest import vak.prep.frame_classification.make_splits @pytest.mark.parametrize( 'annots, expected_sort_inds', [ ( [ ...
5d20b91b872da434b59ae85efbf0d9c232f5ceebc02f4db5675a7fa6b90dbbb6
Python
9,311
270
import os import warnings from pathlib import Path import anndata as ad import numpy as np from anndata import AnnData from scvi import settings from scvi.utils import dependencies @dependencies("readfcs") def read_fcs( path: str, return_raw_layer: bool = True, include_hidden: bool = False, remove_m...
06763765eab7786586fec9625ab69a8f05018e0567aee0a3df057bb0de362467
Python
9,312
268
# 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 fro...
305cef45c6dc034bdf72fd91aba1e89e1c6b5d222c3d6baffff5acdfd9b3873e
Python
9,312
220
#!/usr/bin/env python # # Copyright 2010 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
f728aba8677e22bd4f467206504c9063e2a6699255a5988dfc49e71269d7f73c
Python
9,315
281
#!/usr/bin/env python3 """Train a fully connected BM, writing results directly to disk.""" import argparse from itertools import product from pathlib import Path import matplotlib.pyplot as plt import numpy as np import yaml from neuralsampling import utils from neuralsampling.network import GradDescent, NeuralSamp...
62313378bf5b1ea7a87affca1ff857cf38b0382677ef92867b178589bc22b16b
Python
9,321
283
"""Utilities used in Gene Ontology Enrichment Analyses.""" import bz2 import gzip import io import logging import os import os.path as op import sys import tempfile import traceback import zlib from os.path import isfile from subprocess import PIPE, Popen from urllib.request import urlopen import requests from ftpr...
028cc15ddeccab9f1f671a176ed1d9eda7294c42311bb05ede0dc39296b214f2
Python
9,324
317
# -*- coding: utf-8 -*- """ Created on Thu Mar 6 14:00:52 2025 @author: hanna """ """ [Figure 4A, 4B] changes in preferred of individual BCI neurons from example sessions """ import os import pickle import numpy as np import pandas as pd from tqdm import tqdm import seaborn as sb import matplotlib as mpl im...
144b299a115edb3e3fb6ea18d226d86e6841f79ce4254ee861dac53c5a337d72
Python
9,324
265
"""Sequence encoders for Bayesian Optimization. Supports one-hot encoding, physicochemical property encoding, and Boltz2 remote API embeddings. """ import hashlib import os import numpy as np import requests import time from concurrent.futures import ThreadPoolExecutor, as_completed AAS = "ILVAGMFYWEDQNHCRKSTP" # P...
4b4ef729c34322b7edbecebae0fbf0a35c41f534837dd70aaa05ca6673532fcb
Python
9,325
252
"""Module providing queries into the document database.""" import logging from collections.abc import Callable, Iterable, Mapping, MutableMapping from pathlib import Path from types import TracebackType from typing import Any, Literal, Self from apiadapters.ncbi.parser import is_scanned from d3types import Document, ...
5f7d26a7eb6970ce9b3615dd16fbac9adf1711ab83400b0f0e95aa9ac53060a7
Python
9,327
289
from typing import Tuple, List, Dict, Optional, Sequence from collections import defaultdict import string from pathlib import Path from Bio import SeqIO import subprocess from .typed import PathLike from .constants import IUPAC_CODES from .dataset import ThreadsafeFile import numpy as np from scipy.spatial.distance im...
24f2ee742e965c91e1b49b4f9e257cebd79239719ef71300d3855b0c9f667120
Python
9,328
300
# Copyright 2026 Hongyu Sun # Licensed under the Apache License, Version 2.0 import numpy as np import torch from torch import nn import torch.nn.functional as F import pytorch_lightning as pl from torch_geometric.nn import MessagePassing class Feedforward(nn.Module): def __init__(self, channel_size: int, hidden...
6bc69cb0eff0c490b27afb8f0a73c4769f52c8999b3c906b013fc6b1a1524a0f
Python
9,329
300
# Copyright 2026 Hongyu Sun # Licensed under the Apache License, Version 2.0 import numpy as np import torch from torch import nn import torch.nn.functional as F import pytorch_lightning as pl from torch_geometric.nn import MessagePassing class Feedforward(nn.Module): def __init__(self, channel_size: int, hidden...
75e4b15d26782edda38d5bb171bc264c2035b68f26bf9ba8dadeb19d898b5b99
Python
9,332
256
import cProfile import pstats import time import os from simulation_encoder.runner import Runner from simulation_encoder.writer import Writer from simulation_encoder.plotter import Plotter from simulation_encoder.logger import Logger from simulation_encoder.dataclass.param_sets import DatasetParams, ModelParams from ...
a488215e53c5c0338b7d1a5c85d76fd4f5af81013a23e1b98bc34c199fe95ea3
Python
9,338
289
import os import re import sys import logging import time from nipype import config from nipype import logging as nlogging from nipype.interfaces.base import CommandLine import subprocess # Use Nipype's concurrent rotating handler if available (multi-proc safe) try: from nipype.external.cloghandler import ( ...
e956605d5b8aced0e8a1f056002ef14914e0496d19b478e9ffc2019ad10e760a
Python
9,340
232
from ryp import r, to_r, to_py import polars as pl import polars.selectors as cs def read_gtf(file, attributes=["transcript_id"], keep_attributes=True): if keep_attributes: return pl.read_csv(file, separator="\t", comment_prefix="#", schema_overrides = {"seqname": pl.String}, has_header = False, new_column...
eeca74593efbf62b04eb17728122f43a888be5fe3594b93cd1b57088db6fcb2b
Python
9,341
238
""" Xception is adapted from https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/xception.py Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) @author: tstandley Adapted by cadene Creates an Xception Model as defined in: Francois Chollet Xceptio...
7dacb79f88dda492ccfdc219883db75fde24a249c11c44a7a2060bf504673ef9
Python
9,347
369
import re import pytest from skbase.lookup import all_objects from pgmpy.base import DAG from pgmpy.example_models import list_models, load_model from pgmpy.example_models._base import BaseExampleModel from pgmpy.models import ( DiscreteBayesianNetwork, FunctionalBayesianNetwork, LinearGaussianBayesianNet...
f5dbce99372cb323a1462962bfa216a7da26d792e4c4447495eeb8824522838f
Python
9,350
229
#!/usr/bin/env python3 """Build the per-sample bulk-RNA sex table that the sex-adjusted sensitivity analysis consumes. WHY THIS EXISTS. sex_adjusted_sensitivity_rna.R reads Methylation_Data/rna_sex_persample.csv, and that file was never deposited - it was written to a session temp directory and lost, so the sensitivit...
6dd4b4dca7c7b55e4ed3cabfc75acf8d1bf08a4b9b0a68b7f7e55e3c38b8f921
Python
9,358
274
# Copyright (c) Facebook, Inc. All Rights Reserved import numpy as np import os import torch class Processor(object): """ A generic processor for video (codec, feature etc.) and text. """ def __call__(self, **kwargs): raise NotImplementedError class MetaProcessor(Processor): """ A ...
d1ffdeab48419d8f4c2bc2e1799f680bb5faee91f169863afd8c87a13dc061b9
Python
9,358
359
#!/usr/bin/env python # ENCODE DCC common functions # Author: Jin Lee (leepc12@gmail.com) import sys import os import re import csv import logging import subprocess import math import signal import time import argparse logging.basicConfig( format='[%(asctime)s %(levelname)s] %(message)s', stream=sys.stdout) ...
33aa7d61681c15023a5e9953ab3bb16566987f79d43519259437d51db103a490
Python
9,365
153
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'optimization_extra_data_dialog.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_OptimizationExtraDataDialog(object): def set...
d9e8f1a6b21f81c9a4c12b4e3adfd5f1faa603dde2d11600afc80e6797077e9d
Python
9,367
278
# Simulate uniform rotations and translation of the whole sensor array #%% Imports import numpy as np import matplotlib.pyplot as plt from bfieldtools import sphtools as sph import functions font = { 'size' : 20} plt.rc('font', **font) #%% Plot parameters legendfontsize = 15 linewidth = 2.5 #%% Define paramete...
9c17ea0eb4a96c8cc2d2e92279caba3febd7718fc05d0ac83d10ff799fa71eb4
Python
9,368
356
# 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...
a8175682b19964f0123852de27d4f31460f023c0cb0c376f291b405e55058868
Python
9,368
273
import json import os import pathlib import shutil import tarfile import urllib.request import nox DIR = pathlib.Path(__file__).parent.resolve() VENV_DIR = pathlib.Path('./.venv').resolve() with pathlib.Path('./tests/vak.tests.config.json').open('rb') as fp: VAK_TESTS_CONFIG = json.load(fp) nox.options.sessi...
4409ed7d62268011d94ffd0a2df1d9674fb59d13bd1d2ace001c6384b734f65a
Python
9,372
185
""" VGG 16 model without Predify """ import torch import torch.nn as nn from torchvision.models import vgg16_bn class VGG16Baselin...
f7aba24d8529fe755e63ad44b26f6365f7da99334c0f63301c304a9f6935b4a5
Python
9,373
351
# 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 bisect import time from collections import OrderedDict from typing import Dict, Optional try: import torch def type_as(a, b):...
6502f38ed6b9e8f831bab978d13a9bf176ecd6110263bab79eba808f8c2a8378
Python
9,375
205
"""tests for vak.config.learncurve module""" import pytest import vak.config.learncurve class TestLearncurveConfig: @pytest.mark.parametrize( 'config_dict', [ { 'standardize_frames': True, 'batch_size': 11, 'num_...
e5c050ca5bbf40c6bccde806a8ef0ab332f19a141d925d0a7a098306760a9f45
Python
9,379
218
import numpy as np from scvi import settings from scvi.data import AnnDataManager from scvi.dataloaders import DataSplitter from scvi.dataloaders._data_splitting import ( validate_data_split, validate_data_split_with_external_indexing, ) from ._contrastive_dataloader import ContrastiveDataLoader class Contr...
18a6685c37474e2371481e70e35cc22dbd51e88b59660831e9670bbd67cbde5d
Python
9,382
253
import numpy as np import pandas as pd import os, six, sys, subprocess, time def prob_output(pred_data, pred_path): """ INPUT: a tuple of (predict, label) output prob_file """ pred_label = pred_data for id, seq, y_pred in pred_label: y_pred = y_pred.cpu().numpy() # GPU data to CPU ...
ae24e6199228e5da17d84dd1fcfcd448b79f7783985655cdee00866be94bbfb0
Python
9,383
253
import numpy as np import pandas as pd import os, six, sys, subprocess, time def prob_output(pred_data, pred_path): """ INPUT: a tuple of (predict, label) output prob_file """ pred_label = pred_data for id, seq, y_pred in pred_label: y_pred = y_pred.cpu().numpy() # GPU data to CPU ...
bbb2f4aa6db2e822f6abc89a54e21755674d2612e44be0df23ae95feaf44fd5a
Python
9,384
274
import os import glob import re from pathlib import Path import pickle import numpy as np import pdb from celltype_ibl.params.config import DATASETS_DIRECTORY from torch.utils.data import Dataset import torch SAVE_DIR = DATASETS_DIRECTORY def find_files(directory: str, filename: str): """ Find files with a s...
4a8b4f464d4bb0f21cb3f69d20ef99e5fa84accf401d68222c176d2b57ceb05f
Python
9,389
228
#Line 1-190 is from https://github.com/phbradley/alphafold_finetune/blob/main/predict_utils.py from alphafold.common import residue_constants from alphafold.data import templates import numpy as np #this is from alphafold/data.templates.py from typing import Any, Dict, Mapping, Optional, Sequence, Tuple, Union, List i...
aecc2079edf9249fb33d458832a0e9a9954f78319f9f3095dff0735edceb38ac
Python
9,392
219
"""Phase 2: KAN interpretability on tahini. Produces (into results_phase1/paper/): the symbolic equation (txt + LaTeX), an accuracy-vs-complexity table, KAN response curves overlaid on the linear PLS effect (where they differ = KAN's added value), and PLS-component-to-chemistry loadings. Run: python -m kanfood.interpre...
22268ce7f1c86961d987699c12f9c5f25b1c8e30ff4b916065384da21a482fae
Python
9,394
231
from typing import Callable, List, Optional, Tuple, Union import numpy as np import torch import ttach as tta from pytorch_grad_cam.activations_and_gradients import ActivationsAndGradients from pytorch_grad_cam.utils.image import scale_cam_image from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget ...
d2da92e0f66a06b756740f64acec15e9f9f2413e8bdd5c12732c1a49317c5281
Python
9,399
313
""" 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. """ # Copyright (c) Facebook, Inc. and its affiliates. # Borrowed from https://github.com/facebookresearch/pythia/blob/master/pythia/common/regis...
78b94f58b3d729395c3a0ee9769309138afb2989f73880b1e254ea03ef33207a
Python
9,402
210
import os import fcntl # For Unix-like systems (including Ubuntu) ''' By properly implementing file locking mechanisms like using fcntl for Unix-like systems, one can ensure that the Optuna optimization process runs smoothly without encountering race conditions or file locking issues, even when using multiple proces...
0331e58fb87d2060f70a72fc6eebc881ff6a08f7bbe9cee4491afe2726533598
Python
9,403
267
# Copyright (c) 2021-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 import math from ty...
a8fa1bcc2615475120de1b3205e12473ad85b9df1313dd36e8100f823c1cce57
Python
9,404
264
import os import sys from pathlib import Path from sklearn import metrics import numpy as np import pandas as pd import torch import torch.nn as nn from torch.utils.data import DataLoader, TensorDataset, Dataset from tqdm import tqdm from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score, m...
ae10ea9585e3080e4455ba3d10758b48602b796933bc6c9c4ac1b0bb2045a14f
Python
9,410
245
import os import json from typing import Optional, Callable, Any from abc import ABC, abstractmethod import numpy as np import torch from torch.utils.data import DataLoader, Subset, TensorDataset from simulation_encoder.logger import Logger from simulation_encoder.loaders.dataset_utils.augmentation import Augmentatio...
b8f3fe9dde0e8184076aed64d2e2df60786e963942758d7f9febef31f2380ba2
Python
9,412
289
import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout, QFileDialog import PyQt5.QtWidgets as QtWidgets from PyQt5.QtGui import QIcon, QKeyEvent from PyQt5.QtCore import pyqtSlot, Qt from matplotlib.figure import Figure from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as...
f3214ad483667e5647ea903d371be054cbb2b873ab8f36fb509cd2cc2c503a3d
Python
9,414
274
import os import glob import re from pathlib import Path import pickle import numpy as np import pdb from celltype_ibl.params.config import DATASETS_DIRECTORY from torch.utils.data import Dataset import torch SAVE_DIR = DATASETS_DIRECTORY def find_files(directory: str, filename: str): """ Find files with a s...
8929f4b6cfa19d37ac8f524fb74f428a1f6af4dbe90b5bbc91f4382c7d3a376f
Python
9,420
247
"""Build a perovskite structure library for OCE feature evaluation. Inorganic ABX3 perovskites with A in {Cs,K}, B in {Pb,Sn,Ge}, X in {I,Br,Cl,F}. Three families: (a) endmembers — 5-atom cubic Pm-3m primitive cells, 24 ABX3 combinations (b) mixed-X — 2x2x2 supercells (40 atoms) with 1-12 halide substitutions ...
b4300553a02342eb8050cb6a9bca1a38c7f3247c964938a4f02825d2c7309c6a
Python
9,423
270
from typing import Tuple from dataclasses import dataclass import math import torch as th from torch import nn from config_base import BaseConfig from .blocks import Upsample, AttentionBlock from .nn import conv_nd from einops import rearrange from utils import M2H def exists(x): return x is not None class Si...
ded9971904a3d98143de16f78bde7851253f1beb1388e5544dab9b0a0ce90153
Python
9,426
255
import numpy as np import torch import torch.nn as nn from sklearn.cross_decomposition import PLSRegression from sklearn.ensemble import RandomForestRegressor from sklearn.multioutput import MultiOutputRegressor from sklearn.preprocessing import StandardScaler, MinMaxScaler from sklearn.svm import SVR from kan import K...
0b04edc261c9ef030093e70a03d35a20b848c06b66cf67742dd3eb39dd491fd5
Python
9,429
259
#!/usr/bin/env python """Provide a command line tool to validate and transform tabular samplesheets.""" import argparse import csv import logging import sys from collections import Counter from pathlib import Path logger = logging.getLogger() class RowChecker: """ Define a service that can validate and t...
3da02344ae52ae1a51d9f3fd174304af38e3a249abd3210c351cc961ede301da
Python
9,429
241
from __future__ import annotations from typing import List, Literal import torch from .functional import precision_recall_fscore_rval, BOUNDARY_DETECTION_IR_METRICS, BoundaryDetectionIRMetric class PrecisionRecallFScoreRVal: r"""Compute information retrieval metrics for boundary detection: precision, recal...
e028a52f396b87c4fc5a31034305ae352032a3b289869c8f3351d5c83fb89840
Python
9,433
283
"""PyTorch module for methylVI for single cell methylation data.""" from collections.abc import Iterable from typing import Literal import torch import torch.nn as nn from torch.distributions import Binomial, Normal from torch.distributions import kl_divergence as kl from scvi import REGISTRY_KEYS from scvi.distribu...
4da53217a98c6d5917cabeb29033b9a10715a8d203480b8fc8a7edba16199567
Python
9,435
227
"""Phase 7 — focused coordination study. Re-samples small subsets of percolation clusters (L = 32, 64) for both materials × 3 lattices, runs LAMMPS optimisation, and stores BOTH the relaxed positions AND the post-relaxation coordination distribution. Goal: directly correlate post-relaxation ⟨z⟩ and the fraction of 4-...
9c4526ad093033e9664dcba6e1da94f47c4e9de5c8d7181fa76cfc96dab9faf1
Python
9,440
256
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # # 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://ww...
a8df99540fc4ce8a092980cff9f7f3f2d259c96d706159d72c3f0f4eb39be418
Python
9,441
257
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # # 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://ww...
9a5b691e5ba51ba40d358c92148cedd9a4361812d2e0017d0da05eecf3408386
Python
9,443
291
import argparse import os import random from concurrent.futures import ProcessPoolExecutor from copy import deepcopy import h5py import numpy as np import torch import torch.nn as nn import torch.optim as optim from sklearn.model_selection import KFold from torch.utils.data import DataLoader, Dataset from torchdiffeq ...
fbc31d872242a88215290f9dad0ce1354f5d91597ce6c5071700a65dfb2bf119
Python
9,449
220
import logging import unittest from pathlib import Path from tempfile import TemporaryDirectory from GMXMMPBSA.commandlineparser import ( AMBER_TRAJECTORY_FORMATS, amber_parser, amber_trajectory, parser, trajectory, testparser, validate_output_paths, ) from GMXMMPBSA.exceptions import MMPBS...