sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
0e9a3a007dbbf2426dd1beaad2d1c5d3cbc2a433a5c6f4774eb30c39f0e98590
Python
6,731
173
"""3-state learning-curve comparison: n=93 → n=143 → n=193. For each pool we report 5-fold CV metrics on: (i) the full pool (with strain if present) (ii) the non-strain subset (the fair, basis-suitable comparison) This is the canonical AL learning curve for the perovskite OCE workflow. """ from __future__ import...
2225a46398607167b004af54723428427092bc4e9b8f72ba929728fb15ea338f
Python
6,732
199
from pathlib import Path from typing import List import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from sklearn.metrics import auc, roc_curve from BLPlot.plotter import ( Plotter, get_algo_ids, iter_datasets_with_runs, load_dataset_metric, make_box_figure, ) def _make_roc...
1f0d09d1ade99d8528a8bd0a857c8a7a3728ad46f7a309b75396181d142d6d92
Python
6,736
168
# 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...
7b6bbe92066d804fa5d58a468f033225da0aacfebe59f279f02cc92b16489110
Python
6,736
150
from typing import Callable, List, Optional import numpy as np import torch import tqdm from pytorch_grad_cam.ablation_layer import AblationLayer from pytorch_grad_cam.base_cam import BaseCAM from pytorch_grad_cam.utils.find_layers import replace_layer_recursive """ Implementation of AblationCAM https://openaccess.t...
58cc327382e6d9e92ef543df7ceee20478b52855a9f75cba8c512d6206db161e
Python
6,738
178
from __future__ import print_function from keras import activations, initializers, constraints from keras import regularizers from keras.engine import Layer import keras.backend as K import keras class GraphLayer(keras.layers.Layer): def __init__(self, step_num=1, activation=...
847eb3210239890f34c8e36446a9bfc371ba48ce67eda87e36a8936c6da07a94
Python
6,738
189
"""Atomic orbital eigenenergy table built from xtb single-atom calculations. Each element gets a list of (shell_label, eigenenergy_eV, occupation) tuples, grouped by shell (s, p, d) — orbitals with identical eigenenergies are collapsed into a single shell entry. """ from __future__ import annotations import json impo...
519d6a3dc219b46009b9dff0f98fc4fc53a2add5c14f3eec201fb6e7f21a973a
Python
6,741
261
import numpy as np import pandas as pd import pytest from joblib.externals.loky import get_reusable_executor from pgmpy.causal_discovery import TAN from pgmpy.example_models import load_model from pgmpy.factors.discrete import TabularCPD from pgmpy.models import DiscreteBayesianNetwork from pgmpy.sampling import Bayes...
9b87403a2c85a9ada2b343bff8d9933005c509361e169204548baad250bff88c
Python
6,741
215
#!/usr/bin/env python3 """ Used for EMA tracking a given pytorch module. The user is responsible for calling step() and setting the appropriate decay """ import copy from dataclasses import dataclass, field import logging import torch from omegaconf import II from fairseq.dataclass import FairseqDataclass try: ...
95905e2e5eaecfa5ebe796afa5aa67b366f187b2dbc293fbcf6be477a032e40e
Python
6,743
192
from typing import Callable import torch from nnunetv2.utilities.ddp_allgather import AllGatherGrad from torch import nn class SoftDiceLoss(nn.Module): def __init__(self, apply_nonlin: Callable = None, batch_dice: bool = False, do_bg: bool = True, smooth: float = 1., ddp: bool = True, clip_tp: f...
eaea71bf194c63464c8e9dc5507fbfd4a2da8782a52a452ec455b49b7bb05195
Python
6,747
146
''' Compute the heatmap based on layer cell bins and their ABreelin occupancy over time This code generates Figure 4 in the main manuscript ''' import os import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from matplotlib import gridspec #Experimentally observed Lateromedial reeli...
67061bfe13fd7bca549bc38498bcfccb8941ac5cfb67785cbdfb1f268a5746e9
Python
6,753
235
#!/usr/bin/env python3 """Base class for undirected graphical models in pgmpy.""" import itertools import networkx as nx class UndirectedGraph(nx.Graph): """Base class for all the Undirected Graphical models. Each node in the graph can represent either a random variable, `Factor`, or a cluster of rando...
dc728c850afdcf7741ecf50638300bd7fce972528521e5ca632752f540b5b227
Python
6,756
224
# build large-scale data in scBank format from a group of AnnData objects # %% import gc import json from pathlib import Path import argparse import shutil import traceback from typing import Dict, List, Optional import warnings import numpy as np import os import scanpy as sc import sys sys.path.insert(0, "../../")...
5db5b6f33dbc3a90294a6bca1a89e66f379eab7283f15aff2d832df7e3fda1e5
Python
6,757
182
from torch.utils.data import DataLoader, TensorDataset from sklearn import preprocessing from sklearn.model_selection import train_test_split import pandas as pd import numpy as np import torch class BINNDataLoader: """ A utility class for aligning data to the BINN network, preparing train/validation splits, ...
67113df1ec5314a8dedefd4abd73cfeceb4d704311930e30fe3a86193ab63d75
Python
6,757
193
import os import pathlib import omegaconf import wandb from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ( EarlyStopping, LearningRateMonitor, ModelCheckpoint, ) from datasets.data_module import DataModule, Infos from diffusion_model import FullDenoisingDiffusion from utils.dat...
50f06b13e8894f624eacbb1d9a052f03365ee6cfc7a6422115d76f7ce66d7a94
Python
6,758
155
import os, sys import matplotlib.pyplot as plt from itertools import chain, product import numpy as np import torch import torchvision from LibKIME.LibGeneral import (MakeFolder, StartTimer, StopTimer, Save_dict2j...
57d9912a842fafd9d3db9b6c07f131b625a12dbafca15978b6b59e68d69b1533
Python
6,759
215
""" Multi-GPU Training Example for Garfield Model This script demonstrates how to train the Garfield model using multiple GPUs with PyTorch DistributedDataParallel (DDP) following PyTorch Geometric patterns. Usage: python train_multi_gpu.py Requirements: - Multiple CUDA-capable GPUs - PyTorch with CUDA s...
112071a4b6f4b87c6e4e34061496c583d6fa5c2c887592e9ca4aeab8cf4afeed
Python
6,760
217
# @license # Copyright 2017 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
688193d0713979c70d328529e40a52d1b8042e169c1d5dd8b97064eea58aaf1c
Python
6,760
165
import glob import os import time import numpy as np import argparse from datetime import date from os.path import join import pandas as pd from joblib import Parallel, delayed import nibabel as nib from nilearn import image, masking from nilearn.glm.first_level import FirstLevelModel def prepare_data(subj, configs):...
252e8c333bcc3f5e944bce4fb41e98b27546861c5f7580cc0397cb9fb2c9cdc1
Python
6,761
156
""" Set up the VCF prediction pipeline """ import zarr import tskit import os import yaml import numpy as np from pysam import FastaFile from numcodecs import Blosc from math import ceil import ts_simulators vcz = zarr.open(snakemake.input.vcz) n_variants = vcz.variant_position.size n_samples = vcz.sample_id.size n...
e245d5a553caeddce495db04b3ccc8c6c5c374737bc4d19b85af5b08667ac4ba
Python
6,763
176
#!/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. import argparse import collections import os import re import torch from fairseq.file_io import PathManager def ave...
5513e4a6ec5630cb148d0d64078997676816bbfae75b6395dbeb157c010b982a
Python
6,764
218
# -*- coding: utf-8 -*- # This file is part of Eigen, a lightweight C++ template library # for linear algebra. # # Copyright (C) 2009 Benjamin Schindler <bschindler@inf.ethz.ch> # # Eigen is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published...
8ab206ea9b80f7edb52ad581b81b0b664922680fb1304a0da6c22fe97a63bf77
Python
6,765
172
# @license # Copyright 2026 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
aae838e08303f0bbe67797840b66e031ed05c09a40ce1097c94d28dcc6c30994
Python
6,770
151
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn from utils import * from self_calibration import * from torch.fft import fftshift, ifftshift, ifft2, fft2 from fft_conv_pytorch import fft_conv, FFTConv2d dtype = torch.float32 class forward_model_wf(nn.Module): def __init__(sel...
269ac4996857a573a27a76b1b6a06d7b388b8a60f5145ad91e5bac09417c361d
Python
6,773
208
import random import unittest import numpy as np import pandas as pd from tqdm.auto import tqdm from pgmpy.models import LinearGaussianBayesianNetwork from pgmpy.utils import ( discretize, get_example_model, preprocess_data, ) from pgmpy.utils.mathext import sample_discrete class TestDiscretization(unit...
32389a47d296e035febe40a200832b999d74784bebf3df4a4be43fa971657ce9
Python
6,774
95
MOUSE_EXL = { # 0:HK06, 3:HK03, 6:194, 21:146, 29:114, 30:111, 35:095, 39:083, 54:038, 57:029 '609882': [59, [0, 3, 6, 21, 29, 30, 35, 39, 54, 57]], # 12:463, 20:493, 21:496, 33:538, 34:541, 39:557, 41:563, 57:HK07, 58:HK08 '609889': [58, [12, 20, 21, 33, 34, 39, 41, 57, 58]], # 6:956, 7:959, 8:962...
3c4cd7dc850cd1badcc7bcc8fb10b6adaf31f6795d785b8914ceecf31073bbdf
Python
6,774
179
from __future__ import annotations import warnings from time import sleep from typing import Optional import numpy as np import torch import torch.distributed as dist from batchgenerators.utilities.file_and_folder_operations import join, maybe_mkdir_p from nnunetv2.configuration import default_num_processes from nn...
9283a76caf1a99721f81cc1942d63e8f3fa5b055f244ed9d23d81aa9559e2955
Python
6,774
139
#!/usr/bin/env python3 """A variância do seletor exige DUAS condições. Este script mede a segunda. CONTEXTO. A dispersão do RMSE sob permutação das linhas de treino foi medida em dez casos (perovskitas e QMOF) e não escala com a largura da base nem com o regime p > n -- as duas hipóteses caíram. O que os logs mostram ...
bfb55648ac422a8a4a3dd5fa45f90b85834a60e77724297d80f158da6935e20a
Python
6,774
201
from __future__ import annotations import warnings import torch import torch.nn.functional as F from torch.distributions import Gamma, constraints from torch.distributions.utils import ( broadcast_all, lazy_property, logits_to_probs, probs_to_logits, ) from scvi import settings from ._constraints im...
128e8cce9801f52cf62fe77f5bb03f4d9b00167696887acbba8a46e5cc7b49ed
Python
6,780
184
# 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 from .. import tasks from .. import models from .. import losses from ..datasets import MMDataset from .. import processors cla...
6f4a365cad3c234655ab8d55630ae05c1d885528e5f893b95a6d99a455737299
Python
6,781
175
#!/usr/bin/env python3 # Florian Bénitière 16/03/2025 # This script processes VEP outputs per chromosome, extracts necessary columns # and merges them into a PySpark DataFrame before saving the output as a Parquet file. import os import sys import pandas as pd import subprocess import psutil # System and process ut...
89e862f71a4fa80792b73d8792d27c563f9ae4de587aca7f8d9a1c1061ece84a
Python
6,786
173
""" Usage: This scripts it to evaluate the classification accuracy/error rate from the embedding extracted by gen_audio_embedding.py Example (LID classification) PYTHONPATH='.' python examples/wav2vec/eval_speaker_clf_task.py \ --data /fsx/androstj/exps/lid_voxlingua/infer/atj_xlsr2_100pct...
9e1c4eb8ac873613b58793978e719fcfa465a8343225401892bb9de7fd4221bf
Python
6,786
199
# pgmpy/tests/test_base/test_mixin_roles.py import pytest from pgmpy.base import DAG @pytest.fixture def basic_dag(): G = DAG(ebunch=[("X", "Y"), ("Z", "Y")]) G.add_node("U") return G def test_with_role_single_variable(basic_dag): basic_dag.with_role(role="exposures", variables="X", inplace=True) ...
19a0b12a0a8d64425d2cd072f8076a513f4b3bee8ad88e17cc761601efba51eb
Python
6,789
151
import pandas as pd import numpy as np from preprocessor.utils.preprocess_axial import get_segment_iax, update_root_node class AxialCurrentPreprocessor: """ Initializes the AxialCurrentPreprocessor class. Initializes two primary DataFrames: - axial_current: Stores calculated axial currents with a Mu...
612e867dad4685449ff86268dcdffc97f932cf6304073fdbdfb6b14fa4c78ed4
Python
6,789
200
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from abc import ABC, abstractmethod from math import pi from typing import Optional, Tuple import pytest import torch from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.diffusion.corruption import ( LatticeVPSDE, ...
2cf949e6067f88384b46c836c8a5f028f22149bfcdae625b04fde38344ed26d6
Python
6,790
174
import torch import torch.nn as nn import torch.nn.functional as F import matplotlib.pyplot as plt import numpy as np import random from dataclasses import dataclass def noising( data, xnoiselevel, ynoiselevel, threshold=0, noise_region='above', plot=True ): x, y = data x = x.numpy() y = y.nump...
4a5b698167679f1fde01e6f0c1e1cea149d7c909918d8c9b53d547cfb9b40297
Python
6,792
154
#!/usr/bin/env python3 # MIT License # # Copyright 2020 Broad Institute # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use...
2e87fc5ae6df986e92a390476be6cd52a1f89ff95ddd3d26c0ae6fea8f2568df
Python
6,795
216
from __future__ import annotations import logging from typing import TYPE_CHECKING import numpy as np from scvi import REGISTRY_KEYS from scvi.data import AnnDataManager from scvi.data.fields import ( CategoricalJointObsField, CategoricalObsField, LayerField, NumericalJointObsField, ) from scvi.modul...
e531d0c18bd09f83cb57f0ea588bc1b4dc076186b082ac6ace4d9478bc0788aa
Python
6,795
210
# 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 importlib from collections.abc import Collection from dataclasses import dataclass, field from typing import List import torch from fa...
c515abded3f8d7e8fe3849b6f3f141996bec7632180d98070919ed48fbbe3432
Python
6,796
184
#!/usr/bin/env python3 """Run the Evo 2 Gene Completion benchmark (% amino-acid recovery). For each gene in a panel the model is prompted with the start of the gene and asked to complete it; the generated protein is recovered and compared to the reference over the non-prompt region. See README.md for the methodology. ...
c2596d515bb1b39b2e181d147a068dd5ee3e2904e4d5c010b94d200d1f1d8100
Python
6,800
181
# coding=utf-8 # Copyright 2018 T5 Authors and 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
fa0a6464ec38823323ae8a5ba538e36fa55f11b469d311400317878f83f39c09
Python
6,800
231
"""Matplotlib figure builders for raw-photometry analysis results.""" from __future__ import annotations import numpy as np import pandas as pd from matplotlib.figure import Figure from src.dfer.df_common import read_analysis_output def _graph_time_values(axis) -> np.ndarray | None: values: list[float] = [] ...
7f27dfb36966084044bdf70566886a1c6109cd87f154d2dd29c99de32650c982
Python
6,801
182
# coding=utf-8 # Copyright 2018 T5 Authors and 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
50f6febb2db918bb0279b34ac009571e41026bcb101c826182582f562e56032a
Python
6,802
183
import torch from torch import nn import torch.nn.functional as F class ResizeConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, scale_factor, mode="nearest"): super().__init__() self.scale_factor = scale_factor self.mode = mode self.conv = nn.Conv1d(in_c...
3753ea5826a004490f898a4192eb240f6a984bb3db6cf2c3807328da79b47ba1
Python
6,811
161
import datetime import logging from copy import deepcopy from os import makedirs from os.path import join, exists from posixpath import abspath import numpy as np import pandas as pd import yaml from sklearn.model_selection import StratifiedKFold from data.data_access import Data from model.model_factory import get_m...
a78975f3221bc355295ee0098d2ccd752d4e10b44691514420297a6e6c3c393c
Python
6,813
168
"""Compare 1F+2F (baseline) vs +CT2F on perovskite SIESTA pool (n=193). Specifically targets the strain regime where 1F+2F got ρ=0.29 due to topology-only blindness. CT2F is geometric-distance-binned and should break this degeneracy. """ from __future__ import annotations import json, re, sys from collections import...
f539e4dbc11880452ad6bb143267e69481ca3ba60143c14d696427fc024daa78
Python
6,816
207
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import time import torch import yaml from datastructures.Graphs import Graph from utilities.Utilities import ( scalar_product, ff_module, build_Rx2, cdist, pdist_sq_unsafe, ) def load_parameters(filename: str): fi...
6f45c019df1a1b2ef6818f6f3d4c16672886dd2d5bfd7e79bd0d6a20631df645
Python
6,818
182
#!/usr/bin/env python """Run `train` and keep the per-epoch timings it logs, as JSON. `training/epoch_seconds` and `training/batches_per_second` are computed once an epoch and handed to `tracking.log_metrics`, which is a no-op unless `MLFLOW_TRACKING_URI` names a server — so a machine with no tracking server runs the ...
62268e1999a22e68f96324c470f3f87ebcd87d007a6811dc0e77c16796548586
Python
6,819
177
import pytest from pgmpy.base import ADMG, DAG, PDAG from pgmpy.identification import BaseFormulaIdentification, BaseGraphicalIdentification from pgmpy.identification.probability_expression import ProbabilityExpressionTree, ProbabilityNode @pytest.fixture def cg(): edges = [("U", "X"), ("X", "M"), ("M", "Y"), ("...
2e378a9e52c15e2172dde57a3dd9967447309245045b66a3e7a1250e53891eda
Python
6,822
255
import pynwb from contextlib import contextmanager from datetime import datetime from dateutil.tz import tzlocal from uuid import uuid4 import numpy as np @contextmanager def open_nwbfile_local(file_path: str): """ Context manager to open and close a local NWB file. Parameters ---------- file_pat...
6b435c5babe90c1da7b62fce0eb0b1488ac4c624bceea3613128bd9bb06a4e82
Python
6,825
215
# 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 unittest from copy import deepcopy from dataclasses import dataclass from typing import Optional import torch from fairseq.models.ema...
2739beeba4db5cfadc17ff326e7b1981745264a959c8cb09b6be8fb44c020f92
Python
6,826
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 numpy as np import os.path as op import re from tabulate import tabulate from collections import Counter def comp_purity(p_xy, axis):...
84ad51c6475a173c646e8ff7ddc9f43da8a104f87784afee1889db25feaf1ad0
Python
6,827
176
# -*- coding: utf-8 -*- """ Statistical comparison of the architectures. The statistical unit is the participant: the cross-validation accuracies of a participant are averaged into a single value before any test, so correlated folds are never treated as independent observations. Each condition is analysed separately; ...
fd01df1121e3500da93fdb3b97adf7a5efb0535ba21540fff160537e6bd8e44d
Python
6,831
170
# 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 typing import Dict, List, Optional from pathlib import Path import torch.nn as nn from torch import Tensor from fairseq im...
7bf54d67b42370537a8c11263764728afd61ea06e46d2e02e347b44d0edb29d3
Python
6,832
215
"""End-to-end integration tests modelled after the getting-started notebooks, using the small simulated dataset ``test_data/A.h5ad`` (1000 spots, ``X_pca`` + ``image`` obsm pre-computed, ``ground_truth`` labels available). These tests exercise the sklearn-style public API exactly the way the notebooks do. Marked ``slo...
501622e5edfd9b1cd19ac2b7cfbc0bc0a2e62deb41078ea69c43e671a9b234b1
Python
6,834
194
from utility import * import pandas as pd from scipy.stats import zscore import numpy as np import os """ Author: Yuan Zhang Date: 2026-04-13 This script performs receptor-based regression analysis using the Mode 2 GMV weight map extracted from the joint CCA model (math + reading combined model). Specifically: - l...
56bfebb8c4e533df28ffaf369610b690becdb0448ddbde9913d164a39ee9c679
Python
6,838
224
""" Compute linear CKA between MB18 task representations on NSD stimuli. Uses the MB18 selected units (chosen_indices) and streams through images to avoid storing full feature matrices. """ import argparse from pathlib import Path import numpy as np import torch from spacestream.core.feature_extractor import get_feat...
5ea48f5857e3af9d2bc1b819d1668f2ec5f71a5afab172f03ca3bc9ef82e18fe
Python
6,845
203
"""Tests fix_taxonomy reclassifying other_organisms into bacteria/strains.""" import copy import logging import pytest import functools from scripts import fix_taxonomy from brenda_references.docdb import BrendaDocDB from typing import Any import pathlib TESTDB_DIR = pathlib.Path(__file__).parent / "test_files" TEST...
fb28057e7e50f4cc75520bd02606b60d677b71aa9303c6768baf0ed5007f046b
Python
6,851
143
import os import pandas as pd from BLRun.runner import Runner class SINGERunner(Runner): """Concrete runner for the SINGE GRN inference algorithm.""" def generateInputs(self): ''' Function to generate desired inputs for SINGE. If the folder/files under self.input_dir exist, t...
b86bcad9e6b6fb6fe6524eaf98ce5ef2f85c9325cfff30a176e3e24bb8d4f42a
Python
6,856
159
#!/usr/bin/env python3 """ Author: Ken Chen Email: chenkenbio@gmail.com Date: 2022-11-24 """ import json import sys import gzip import numpy as np from tqdm import tqdm import torch from torch import Tensor from torch.utils.data import DataLoader, Dataset, Subset import h5py from transformers import AutoTokenizer from...
cef58813c9b3308733fd0b079a1f3a8366b2e996dec25457eb1233209228e4aa
Python
6,860
137
import os import unittest from collections import namedtuple from medaka.common import Region from medaka.labels import TruthAlignment __truth_bam__ = os.path.join(os.path.dirname(__file__), 'data', 'truth_to_ref.bam') __ref_fasta__ = os.path.join(os.path.dirname(__file__), 'data', 'draft_ref.fasta') __ref_name__ = '...
9c3590aed993f8b1893ab93023b3cad156a7178652aab2920515b658c3f1cde2
Python
6,861
175
from md.Simulator import Simulator import openmm as mm from openmm import unit as u from openff.toolkit import Molecule import argparse import os import numpy as np def current_cv(simulator, pullingForce): cv1_value, cv2_value = pullingForce.getCollectiveVariableValues(simulator.simulation.context) current_cv_...
8ef35a106c54100523b6b2d1d8fc3dea48fe702fde450591e23202ae66fe1ea4
Python
6,865
173
import unittest import numpy as np from pgmpy.factors.discrete import DiscreteFactor from pgmpy.models import JunctionTree from pgmpy.tests import help_functions as hf class TestJunctionTreeCreation(unittest.TestCase): def setUp(self): self.graph = JunctionTree() def test_add_single_no...
3ead5d8a6bc424fe94c71e78d22201c692fc09141a0c87d88c9140552ca66146
Python
6,866
223
# 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. def gen_forward(): kernels = [3, 5, 7, 15, 31, 63, 127, 255] blocks = [32, 64, 128, 256] head = """ /** * Copyright (c) Facebo...
19eb1f6eaaebb32625459710cd996dfd12ffe14004d580d4508e1a15f8d77592
Python
6,868
126
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/SchedGenUI.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from pyqtgraph import PlotWidget from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setu...
3b9940fb9f419dc31ad725e97d910fa05996506398de86b6855857e67a9bce5d
Python
6,869
217
"""Parametric UMAP model, as described in [1]_. Code adapted from implementation by @elyxlz https://github.com/elyxlz/umap_pytorch with changes made by Tim Sainburg: https://github.com/lmcinnes/umap/issues/580#issuecomment-1368649550. """ from __future__ import annotations import pathlib from typing import Callable,...
b79a57f52ab3739b2750461708fa662594f283d788f18237e23d916791559a69
Python
6,870
201
from pathlib import Path from typing import List import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from sklearn.metrics import auc, precision_recall_curve from BLPlot.plotter import ( Plotter, get_algo_ids, iter_datasets_with_runs, load_dataset_metric, make_box_figure, ...
129cee2cc0d343559ca1579057b32788ac32582d40afc1f104db176b0a36206a
Python
6,872
176
# source: https://github.com/IndigoAI/SemanticSegmentation/blob/master/HRNet/OCR.py import torch import torch.nn as nn import torch._utils import torch.nn.functional as F from OCRForClothes.HRNet.batchnorm import SynchronizedBatchNorm2d BatchNorm2d = SynchronizedBatchNorm2d import warnings warnings.filterwarnings("ign...
809f0e701fe6c6a42e481102032d7e15ee36a0485df47d27f66bdeda1e1aca14
Python
6,872
219
""" Graph Neural Network encoder module. Implements GCN-style message passing for network topology encoding. """ import numpy as np from typing import Optional, List, Literal from .utils import normalize_adjacency class GNNEncoder: """ Graph Neural Network encoder using spectral convolutions. Implement...
2dc9eb5b591d88a84e748a76457d64d1f83f37e3e19ff310625b45d322533250
Python
6,873
203
""" Regression utils adapted (credit to Yamins lab: https://github.com/neuroailab/) """ import numpy as np import scipy.stats as stats from sklearn.model_selection import GridSearchCV from spacestream.utils.general_utils import featurewise_norm, rsquared # very trimmed down get_splits function def get_splits( d...
54ce6415c7af073b01094a26c1900121816319b2321a340612cf862c5503ffe1
Python
6,874
169
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ This is an integeratation test of reverse sampling. For a known data distribution that is Gaussian, we substitute the known ground truth score for an approximate model prediction and reverse sample to check we retrieve correct moments of the ...
50b753e5e399fcfcbb9a8295688c639113e5ab50e703bc9fb076dc3476305ae9
Python
6,878
141
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Fits a batch profile to a set of data. This script can be used to fit multiple models to multiple datasets. It needs a batch profile with information about the subjects. If no batch profile is given, this routine will try to auto-detect a good batch profile. The most g...
087ca0900d4ef281e9af8a97709d8a4d8c8e46352594883a6014eaaef36fb1bf
Python
6,882
206
# Copyright 2020 The Lucent Authors. 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 ...
9834ef3b3c1453de6f0121ca98c3cac9e44b9a56986fac919a54a498f749ac33
Python
6,882
137
"""Execute the upload cell with Colab mocked; no network or training dependencies.""" import ast import contextlib import io import json from pathlib import Path import sys import tempfile import types import unittest from unittest.mock import Mock, patch import zipfile ROOT = Path(__file__).resolve().parents[1] def...
5cd7e3763ac4aba405d59ac7e8c635776d2342b1ca1c43958bc47abb5aed6da6
Python
6,884
219
import logging import warnings from collections.abc import Iterable as IterableClass import anndata import numpy as np import pandas as pd from scvi import settings from scvi.data._constants import _ADATA_MINIFY_TYPE_UNS_KEY, ADATA_MINIFY_TYPE from scvi.utils import track from ._differential import DifferentialCompu...
131463a1ff12f0c53b14ae976ccf57d2b12988e3c8c1f32de52499c237768d64
Python
6,890
131
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/CorrUI.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(...
cee0e899ac59c37bd8d529916f77ed8b6e34f86eb47a1e09b89a34a1bd072006
Python
6,890
186
import os import readline import numpy as np import pandas as pd from scipy.stats import chi2 def set_confounds_type(confounds): if pd.isna(confounds): return 'None' else: return 'all' def set_confounds_type_detail(confounds): if pd.isna(confounds): return 'None' else: ...
04a84ae159c40d6ef1e373ad548f9a02c058c6aa43ee4215e958a124bf23bdaf
Python
6,893
191
#!/usr/bin/env python # -*- coding: utf-8 -*- """Transforms data, for subsequent classification""" from pathlib import Path from typing import List, Optional import numpy as np import pandas as pd from utils.models import Cell def get_features_one_cell(cell: Cell, features: List[str]) -> np.ndarray: """Gets f...
38ff1e65b9883fa7c5bd4dc3f320c8dfe35296c08a9bd4f48a671189b922d617
Python
6,893
222
from typing import Optional, Any import torch from torch import nn from torch.utils.data import DataLoader from simulation_encoder.logger import ExperimentLogger DEBUG = False class BaseCNN(nn.Module): """ Base convolutional neural network class. Parameters ---------- logger : Logger, optional...
7649ccc66070d73344ffdb6884f4d7d4e6cf7c1c5330c57c41bbd9de1112578d
Python
6,893
221
from __future__ import annotations import warnings from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Callable from typing import Literal import numpy as np import torch from torch.nn import ( Linear, Module, Parameter, ) from scvi import settings from scvi.distributi...
7cd6b1356c01d926f11b97a0bb0a4a2efbc716e0ed844efcbab79a44cdeb0979
Python
6,894
226
from __future__ import annotations from copy import deepcopy from dataclasses import dataclass from importlib import resources from itertools import count from typing import Any, ClassVar import jax import jax.numpy as jnp import numpy as np import qcelemental as qcel import yaml from .types import Embeddings, Molec...
d48c2f013a4792262604960434cb9a5b2cd773127ace9b9b87782b6e2b4955a6
Python
6,896
217
# 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...
63983782d22e38217c610c1e6c47d0a1db7f5ba752cdb8dd46d95a4a0bdfb179
Python
6,898
122
import logging import re import os import pandas import numpy from . import GWAS from .. import Exceptions from .. import Constants from .. import Utilities as BUtilities def add_gwas_arguments_to_parser(parser): parser.add_argument("--snp_column", help="Name of -snp column- in GWAS input file", default="SNP") ...
6d2a70a69c9d7974e272ee39696fa909b4cc15aa1dba3938a22202b8bb1ee096
Python
6,899
193
import random import unittest from pyecharts import options as opts from pyecharts.charts import Bar, Bar3D, Timeline from pyecharts.commons.utils import JsCode from pyecharts.faker import Faker def get_bar_3d_chart(i: int): data = [(i, j, random.randint(0, 12)) for i in range(6) for j in range(24)] c = ( ...
239a97b701c568672991145cee4953265dbc98b60ffd4dd104b818dc67fbdfe4
Python
6,910
205
import logging import os from functools import partial from typing import Dict, NamedTuple, Optional, Sequence import jax import jax.numpy as jnp from tqdm import trange from oneqmc.density_models.analysis import ScoreMatchingDensityModel from oneqmc.density_models.base import ( DensityFittingBatchFactory, De...
599048a8b00f5b0d68a6adf9709df12ebda84dda4fee37f2cfe71c5d4e3c8e60
Python
6,913
201
from pathlib import Path import numpy as np from math import ceil from fairseq.data.audio import rand_uniform from fairseq.data.audio.waveform_transforms import ( AudioWaveformTransform, register_audio_waveform_transform, ) SNR_MIN = 5.0 SNR_MAX = 15.0 RATE = 0.25 NOISE_RATE = 1.0 NOISE_LEN_MEAN = 0.2 NOISE_...
09926fc47c977383963d68f0082f6e62dc3f58c1d70e4c9abd744b1567a53911
Python
6,916
189
import pytest import torch import numpy as np import pandas as pd import torch.nn as nn from binn.analysis.explainer import BINNExplainer from binn import BINNTrainer class DummyModel(nn.Module): """ A dummy model to mimic a trained BINN. It needs the following attributes: - device (a string, e.g., ...
ca33b919b80d375b59ecd4c7ef723450ed2e5de538bcb8f36bdaf787b97cbde6
Python
6,916
181
from __future__ import annotations import json import logging from pathlib import Path import lightning as L import numpy as np import pandas as pd import torch import torch.nn.functional as F from anndata import AnnData from fast_array_utils.conv import to_dense from sklearn.decomposition import PCA from sklearn.nei...
18a101532d1a8d0dc22777c04f8c19ff1d0bbe9ec91b8ed70440e3d177b43823
Python
6,917
204
import numpy as np from itertools import product import matplotlib.pyplot as plt from collections import Counter from scipy.stats import permutation_test, ks_2samp class ConfusionVarianceMatrix: def __init__(self, cm_array, display_labels=None): self.cm_array = cm_array self.display_labels = displ...
610b4f4221c49d126a58ff968ac5e5302cda7a13c165a6a97ea67705c72d5270
Python
6,917
203
""" Copyright (c) Facebook, Inc. and its affiliates. Copyright (c) Microsoft Corporation. Licensed under the MIT License. Adapted from https://github.com/FAIR-Chem/fairchem/blob/main/src/fairchem/core/models/gemnet/layers/atom_update_block.py. """ from typing import Tuple import torch from torch_scatter import scatte...
04dce5f9a02633be0c3343fef1697d22516d95fb2d7960c8f083fe70d925f93a
Python
6,920
194
#!/usr/bin/env python # -*- coding: utf-8 -*- """Reads nd2 images and extracts layers of interest""" from pathlib import Path from typing import Optional, Any from xarray import DataArray, Coordinates import imagej import numpy as np import scyjava from scyjava import config, jimport, JavaMap, JavaList config.ena...
31b83e9645c08c4d287daa1d4d1a3d18ba4e5848b09fe718473589748a7fa575
Python
6,921
209
"""Compute and analyse the phase plane diagram (PPD).""" # /usr/bin/env python3 import copy import warnings from typing import Optional import numpy as np import numpy.typing as npt from scipy.integrate import trapezoid from scipy.interpolate import CubicSpline, RegularGridInterpolator from tqdm.contrib.itertools im...
5365b564b0f1d164a3595a208cd5aba5a6e2e8db3eca81b00c38456c41ea656e
Python
6,921
165
"""Gaussian Process surrogate model for Bayesian Optimization.""" import math import numpy as np import torch class GPRegressor: """Gaussian Process regressor with ARD RBF/Matern kernels. Optimizes log length scales, signal variance and noise by maximizing the log marginal likelihood for the current BO ...
231c80f6f675dd15996df1085bfa1d5e5c6117f61d57465446ee80393baf26ad
Python
6,923
205
# 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.abs import csv import logging impor...
90e2cec385b746c7820242bb61db6d7a60a3b7c9c996643b25559da134eba38b
Python
6,923
146
import os import pandas as pd import torch import numpy as np import transformers from sklearn.model_selection import train_test_split from torch.utils.data import Dataset from transformers import AutoTokenizer,BertTokenizer, DistilBertTokenizer, ElectraTokenizer, \ BertForSequenceClassification, DistilBertForSeque...
ba8de348af25b87ed2570bfcc3b511898afbd179e7a19588409c72c301e3adc3
Python
6,923
221
# # Modified by Peize Sun # Contact: sunpeize@foxmail.com # # Copyright (c) https://github.com/FateScript/CenterNet-better # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # import math import torch import torch.nn as nn import fvcore.nn.weight_init as weight_init from detectron2.layers import Co...
ba419d462e4a8ea6fc97790e3da52f69171e4e67bba1a363c313a9c76d91ea81
Python
6,925
190
import torch import torch.nn as nn import math from mamba_ssm import Mamba class PositionalEmbedding(nn.Module): def __init__(self, d_model, max_len=5000): super(PositionalEmbedding, self).__init__() # Compute the positional encodings once in log space. pe = torch.zeros(max_len, d_model).fl...
149c54ab0323ac5623c5dcc4e0c94d6b4ad8b5feb5b18fdb7c74ff9d4ac9b59a
Python
6,928
180
import os import time import requests import numpy as np from tractseg.libs.system_config import SystemConfig as C def invert_x_and_y(affineMatrix): """ Change sign of x and y transformation (rotation, scaling and transformation) IMPORTANT note: only done for diagonal elements (if we need rotation (no...
8171959194239f841bdd5ed952b73d4d65913e7d40a0d8214fc18f57320bef32
Python
6,933
143
#!/usr/bin/env python3 """A variância do seletor exige DUAS condições. Este script mede a segunda. CONTEXTO. A dispersão do RMSE sob permutação das linhas de treino foi medida em dez casos (perovskitas e QMOF) e não escala com a largura da base nem com o regime p > n -- as duas hipóteses caíram. O que os logs mostram ...
54f2dabb3421ea6e6e506c138c75a07643bcbbefcd63169093f81e9a1bdc2547
Python
6,934
180
# Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py # This file includes the modifications to the source code according to this project import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.a...
7f7980d600c06e537a3d0195e65f438c15c04270ba26790a4b431b4c032e78a4
Python
6,934
157
from md.Simulator import Simulator import openmm as mm from openmm import unit as u from openff.toolkit import Molecule import argparse import os def submit_protein(name, checkpoint_folder, output_folder, idx, steps, force_constant, xi_0, start, number, seed): base_folder = os.path.abspath(os.path.dirname(__file_...