sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
48f855ca9655f937c9e04bf57c424833b06122ceb8cc3901bec681c405997690
Python
10,736
263
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # pyre-unsafe import logging import os from collections import OrderedDict from typing import List, Optional, Union import torch from torch import nn from detectron2.checkpoint import DetectionCheckpointer from detectron2.config import CfgNode fr...
3f0e82b479e6000ecff8ebddeaed9cfa3e680cbfc09908df832caa5ef6a7dd46
Python
10,739
272
"""Scoped glue between the ColabFold JAX runner and the shared RGI engine.""" from __future__ import annotations import copy import functools import inspect import json from contextlib import contextmanager from pathlib import Path from colabfold.citations import write_rgi_citation from colabfold.rgi import ALPHAFOL...
172bd3ab0b3dc186c7096236eb1d4fec3bab5f4c483460b8594bf52ca950b203
Python
10,744
244
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import prl_preprocess_func __all__ = ['prl_fictitious_rp_woa'] class PrlFictitiousRpWoa(TaskModel): def __init__(self, **...
7301f24c54eaf8f59eed97b69cf4e2619c38504b20d6ef25da3636c3fcf81f6e
Python
10,745
281
import warnings from typing import Any from typing import Callable import torch from torch import nn import ptrnets from ..utils.mlayer import clip_model from ..utils.mlayer import hook_model_module class Core(nn.Module): def initialize(self) -> None: raise NotImplementedError("Not initializing") d...
bb80584eef496565b32089dba50b7c11bd59c55cb92c347f689fc55ce5c245e1
Python
10,746
248
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import banditNarm_preprocess_func __all__ = ['banditNarm_lapse_decay'] class BanditnarmLapseDecay(TaskModel): def __init_...
71d065bbbcf46ec634d044da351c2eb37bf80a4586d7831260f15cfc327aaa69
Python
10,758
299
import keras from keras.models import Sequential, Model, load_model from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda from keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D from keras.layers import GRU, BatchNormalization, LocallyConnected2D, Permute from keras.l...
d4ce8bb5558fe7f740f9cec57eed54f4159aafcd1d6db82f2db07f7690354c33
Python
10,758
299
import keras from keras.models import Sequential, Model, load_model from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda from keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D from keras.layers import GRU, BatchNormalization, LocallyConnected2D, Permute from keras.l...
4e77742885521d26e7870b45514722d0418ce11dd7e1a0f2ca38abc2bbbe949f
Python
10,759
245
# -*- coding: utf-8 -*- """ Created on Thu Apr 23 11:36:41 2020 @author: gritti """ import sys, time, tqdm, copy, os, glob # sys.path.append(os.path.join('..')) import pandas as pd import numpy as np from scipy.ndimage import map_coordinates from skimage.io import imread, imsave from skimage.filters import gaussian f...
e6a085e37279bb05f1d10f7e51db9f613d6c45227a05722a756da05a87f9e285
Python
10,764
246
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import prl_preprocess_func __all__ = ['prl_fictitious_rp'] class PrlFictitiousRp(TaskModel): def __init__(self, **kwargs)...
bfb6f4725f7a40e6f73ef1883d929e7793556515bef4e06f8848f3b439d79e51
Python
10,768
271
from collections import Counter from argparse import ArgumentParser from argparse import RawTextHelpFormatter import sys, os import re from mantis_ml.modules.pre_processing.data_compilation.process_features_filtered_by_disease import ProcessFeaturesFilteredByDisease from mantis_ml.config_class import Config ...
4c2e8c806b576f9632d9351e4cd85d16c938fe8b67b82418951359996ace6f34
Python
10,773
254
import pandas as pd import numpy as np import sys import matplotlib.pyplot as plt from sklearn.ensemble import (ExtraTreesClassifier, RandomForestClassifier, GradientBoostingClassifier) from sklearn.svm import SVC from sklearn.metrics import confusion_matrix, roc_curve, roc_auc_score import xgboost as xgb # fro...
c57d762185dfaa914bb0022a8bc1bdb8d54ab928ed14c584d507dc49c8d3b3cd
Python
10,775
254
import pandas as pd import numpy as np import sys import matplotlib.pyplot as plt from sklearn.ensemble import (ExtraTreesClassifier, RandomForestClassifier, GradientBoostingClassifier) from sklearn.svm import SVC from sklearn.metrics import confusion_matrix, roc_curve, roc_auc_score import xgboost as xgb # fro...
371d5140cee0a53d732a4df6d34ab480da22c532896dc3a89f6f941485837ab6
Python
10,781
304
#!/usr/bin/env python3 # pylint: disable=line-too-long """ Various functions for generating machine learning models for genomes. """ # Imports import pickle import os import logging import numpy as np from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier from sklearn.model_selection import train_te...
90cdc9bce7fa3b4b1fd22d8de64d85babb5661c172f773786831b73adaee3ffd
Python
10,785
317
import re from collections.abc import Sequence from typing import Any from langchain_core._api import deprecated from langchain_core.agents import AgentAction from langchain_core.callbacks import BaseCallbackManager from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePro...
f325d95e45f99624c26e4a5ea30df42f84663ed8296c95319fb45b0a12196176
Python
10,788
249
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import banditNarm_preprocess_func __all__ = ['banditNarm_kalman_filter'] class BanditnarmKalmanFilter(TaskModel): def __i...
9b26c74432fe7a9f81bae8452c7abdae6e91f0f39035b27db33a82a7afb051de
Python
10,790
241
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Publication figures for the arXiv preprint (English labels). All values are read from the persisted result registries produced by the campaign; none is hard-coded except the staircase amplitudes, which are read back from the R2 registry for consistency. """ from __futu...
c9e37e6787850f28efb3edea2b7d6b86a6af049a4f66ac348b5be7e07f0b6c1e
Python
10,790
271
import numpy as np import nltk import csv, os, re import h5py, json, pickle import pkg_resources from symspellpy import SymSpell, Verbosity import inflect np.random.seed() # randomly initialize the seed sym_spell = SymSpell(max_dictionary_edit_distance=2, prefix_length=7) # for correction of spelling mistakes dictio...
87bcdafdb421f42e1c1a6f4b50969d0e7c55ad8006cb72ca72682e9022d7a717
Python
10,801
239
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pdb import torch from torch import nn from functools import partial from .activations import ACTIVATION_REGISTRY import numpy as np import math def fourier_embedding(timesteps: torch.Tensor, dim, max_period=10000): r"""Create sinusoi...
9f04479cc75383592c49909ff87acb4958006013c8d282e568e9e4dbd6822059
Python
10,802
315
from __future__ import annotations from typing import Annotated, Any, TypeVar from langchain_core.exceptions import OutputParserException from langchain_core.language_models import BaseLanguageModel from langchain_core.output_parsers import BaseOutputParser, StrOutputParser from langchain_core.prompt_values import Pr...
7b4fbd4442cc6c0cc4b41228430cb741b7a1dc202177f861edadc16e911281a7
Python
10,805
225
from collections.abc import Hashable import numpy as np import pandas as pd from numpy.typing import ArrayLike from pgmpy.parameterization._base import BaseParameter, _checked_evidence, _parent_order from pgmpy.parameterization.distributions import NominalDistribution from pgmpy.utils import build_state_names, encode...
ef0a2d10c6c5f673cceb514739910ef1444cf7809b2c3290617837f200e2612d
Python
10,808
284
import warnings import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from pensa.preprocessing import merge_and_sort_coordinates from .visualization import project_on_eigenvector_pca, sort_traj_along_projection # --- METHODS FOR PRINCIPAL COMPONENT ANALYSIS --- def calculate_pca(d...
e5abb8ffb2a8d0060b4faedd267ac48a90fb6d5f5453fe686ba27c1a0f808d96
Python
10,809
279
import numpy as np from tqdm import tqdm from rdkit import Chem, DataStructs from rdkit.Chem import Descriptors, Crippen, Lipinski, QED from analysis.SA_Score.sascorer import calculateScore from analysis.molecule_builder import build_molecule from copy import deepcopy class CategoricalDistribution: EPS = 1e-10 ...
ff11ec9d390cbf7cda6e6e0855ea53c871d8e8f0351a2f9b8886dfb354248406
Python
10,815
271
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
577b1ddbe117422be5b4e226407824113873295a141c05018295428731b415f7
Python
10,818
232
""" OmicScope Module OmicScope allows user to import data and perform statistical analysis for differential gene/protein expression. This is the key module of all OmicScope workflow, being the input for all other modules. """ import warnings from .Input import Input warnings.filterwarnings("ignore") class Omicsc...
64267e3ea677b16ecb5bae302f9271e702c8f086ac43b5427a3221654dc5cf35
Python
10,821
255
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/9/28 10:48 # @Author : zhangchao # @File : transfer.py # @Software: PyCharm # @Email : zhangchao5@genomics.cn import os import os.path as osp from typing import Union import torch import scanpy as sc import numpy as np import scipy.sparse as sp impo...
6d5dae03ec86e78f877ac95188815169c4ac6f86b5c73e7a8b8b709091ae4591
Python
10,824
325
import pytest import torch import copy from nequip.utils.unittests.model_tests_ase_integration import ASEIntegrationMixin from nequip.utils.unittests.model_tests_train_time_compile import TrainTimeCompileMixin from nequip.utils.unittests.model_tests_lammps import LAMMPSMLIAPIntegrationMixin from nequip.utils.unittests....
52914160f062e13a224ad647552e6b4242e58e2446e9ae9bbeaccca8d772c2b3
Python
10,825
278
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
57eb678d1bae39971d457078d5c1320e8d3045932ac6131a7c2e63ced843fdea
Python
10,827
320
from datetime import datetime as dt from datetime import timezone from typing import Any, TypeVar import pytest from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers import BaseOutputParser from langchain_core.prompt_values import PromptValue, StringPromptValue from langchain_c...
8ffc137e96c9d946c1c0a015963afa8f61a07741ef05f410dc319cf34abd1459
Python
10,834
254
from __future__ import print_function import numpy as np from dipy.reconst import dti from dipy.core.gradients import gradient_table_from_bvals_bvecs from .utils import erode_mask from .free_water_fit import grad_data_fit_tensor, clip_tensor_evals from tqdm.notebook import tqdm d = 3.0e-3 def estimate_tensor(dwi_da...
37d59cb1c395aef13307e1a3a1227505e9178aa28cd93948ec334dc0b7318c79
Python
10,835
373
"""LLM Chains for evaluating question answering.""" from __future__ import annotations import re import string from collections.abc import Sequence from typing import Any from langchain_core.callbacks import Callbacks from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import Pro...
b3558a9b061216cdcfb31bed52f1c129cf29c311b32e1d88bf1e22ae3dfd0892
Python
10,836
279
"""Functions for clustering sequences before input. This includes computing a distance matrix using MinHash, and clustering that matrix. """ from collections import defaultdict from collections import OrderedDict import logging import operator import numpy as np from scipy.cluster import hierarchy from easyDesign.u...
dc6a60494cae0467698144b0f0c34d4a9b8da12a184d6337ab9ec8e5942b9b65
Python
10,840
279
# -*- coding: utf-8 -*- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~IMPORTS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Standard library imports from collections import OrderedDict, namedtuple, Counter import gzip # Third party imports from tqdm import tqdm import numpy as np from pyfaidx import Fasta # Local imports from pycoMe...
00c26824aad5a45b1dedb78acddacd54d83bceb6939153800bd757dac8406133
Python
10,843
267
import sys sys.path.append('../') import os import numpy as np import matplotlib.pyplot as plt import torch from torch import nn from torch.utils.data import DataLoader import torch.nn.functional as F from matplotlib.colors import LinearSegmentedColormap import alg from alg import alg from utils.util import set_rando...
f9dd90c6397932939b50fc80e5dd36ef5eaa39e4742a1c20863f1bb6a6cad3a8
Python
10,843
306
''' Author: Alexandra Fischbach Github repo: https://github.com/AlexFischbach/local_csf_pipeline/tree/main Date: 04-18-2025 Contact: fischbach.a@northeastern.edu ''' def initialize_roi_dict( roi_dir, subj ): ''' Creates a dictionary of ROI NifTI mask file paths. Key value corresponds to ROIs name...
f55f85c8f6d4405ddbc5a83a163cee287676b9281a09522e8f00f886cb6b10ed
Python
10,845
281
import numpy as np from pensa.comparison import \ relative_entropy_analysis, \ kolmogorov_smirnov_analysis, \ ssi_ensemble_analysis from pensa.dimensionality import \ calculate_pca, get_components_pca """ Calculates the average and maximum Jensen-Shannon distance and the Kullback-Leibler divergenc...
8375e8508759c034f28fa09b162a52af8c1689b072d0fb79ca2d9b1d9376058e
Python
10,848
276
""" Training ZephOD feature detection network Usage: train_zephod -h | --help train_zephod -v | --version train_zephod --index=<index> [options] Options: -h --help show this message and exit. -v --version show version information and exit. --ind...
d8b10d29b6eb3c6e7f0460e14d7630db6dd42243612b17738aefe0f44da39a24
Python
10,851
375
''' Created on Oct 13, 2011 two normalization methods are supported. sequence depth bin correlation @author: Ying Jin ''' #from rpy2.robjects.packages import importr #from rpy2.robjects import FloatVector #import rpy2.robjects as robjects #import rpy2.robjects.lib.ggplot2 as ggplot2 import subprocess from array imp...
07e30c5f6d974295c36bf0b1872f27daf051a5c975ae34776215ed1e48c72fe6
Python
10,855
300
""" ############################################################################## # # Filter ATtRACT database and save motifs in a MotEvo-compatible format # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREAT...
e78782d7baa618e2fb45bfb5b10e8a48ce11d2d82134a6210b28413512280db7
Python
10,855
333
# Adapted from OpenFold # Copyright 2021 AlQuraishi Laboratory # 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/l...
ed6aa36aaee6d9d01d979bcc12000ac89e0655b3527b5b3ae745fa7217d59bb5
Python
10,857
179
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
757f45b2d09bfcf636c8da17621f9dba18f8bdac456263ce86747c47e1e908f5
Python
10,858
252
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import igt_preprocess_func __all__ = ['igt_vpp'] class IgtVpp(TaskModel): def __init__(self, **kwargs): super()._...
be270d5887e00ce939a702859b1953c8530b400adef151c5ffaddd37d1bea40f
Python
10,867
273
import enum ## # Residue identities non_standard_residue_substitutions = { '2AS':'ASP', '3AH':'HIS', '5HP':'GLU', 'ACL':'ARG', 'AGM':'ARG', 'AIB':'ALA', 'ALM':'ALA', 'ALO':'THR', 'ALY':'LYS', 'ARM':'ARG', 'ASA':'ASP', 'ASB':'ASP', 'ASK':'ASP', 'ASL':'ASP', 'ASQ':'ASP', 'AYA':'ALA', 'BCS':'CYS', 'BHD':'ASP', '...
90e175dc99ee03f130482afe28a8093b6a74eec4fe92a25748ef4da2d83d6db4
Python
10,868
297
import copy import logging import os import socket import sys import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from configs.configs import get_config_dict from helpers.hcp import get_human_connectome_project_subjects, rename_variables_for_plots from helpers.figures import g...
94e0ff1bac522084c87e03028699888201c1d29813cae8af51fa006f785d2e28
Python
10,868
267
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
3beffaaf9eab5da5a199644b991c645c5b3112a10215b4adb61ddabcfeb605ab
Python
10,880
324
"""Script for preprocessing mmcif files for faster consumption. - Parses all mmcif protein files in a directory. - Filters out low resolution files. - Performs any additional processing. - Writes all processed examples out to specified path. """ import argparse import dataclasses import functools as fn import multipr...
e3c1b2699291f79aef69d88c892ffd896e5511f3d3c05ce8bef1fedce258aa4f
Python
10,884
234
# coding=utf-8 import os import numpy as np import torch from torch import nn import torch.nn.functional as F from torch.cuda.amp import autocast import torch.autograd as autograd from torch.autograd import Variable from torchmetrics import PeakSignalNoiseRatio as PSNR from skimage.transform import resize from alg.a...
181981f057bd9505c7fdcebb5fea616d2fcc7ff6826d0d2a0db43a3889feadce
Python
10,893
186
# coding=utf-8 """ Defines test cases for tabular dataset """ import pytest from vulcanai.datasets import tabular_data_utils import os import pandas as pd import torch import numpy as np # noinspection PyMissingOrEmptyDocstring class TestTabularDataset: @pytest.fixture def split_data(self): pass @...
0b1f110389b704f9c20df8a8c83b37bfb4568fbdcba5aefaa059452b4d251276
Python
10,898
272
import numpy as np import random import torch import torch.nn as nn from models.common import Conv, DWConv from utils.google_utils import attempt_download class CrossConv(nn.Module): # Cross Convolution Downsample def __init__(self, c1, c2, k=3, s=1, g=1, e=1.0, shortcut=False): # ch_in, ch_out, kern...
d26c91b5a72c1f6ddfe38fe1d50e67e4afaf90e74753dbb60f47741266c01aa6
Python
10,899
326
import numpy import cloudvolume from cloudvolume.datasource.precomputed.mesh.unsharded import * from pycilium.utils.skeleton_utils import * def bb_included(bb1, bb2): return (bb1.contains_bbox(bb2) or bb2.contains_bbox(bb1) or bb1.intersects(bb1, bb2)) def bbox_from_filename(fn, scale=...
786117a9a699cf52d0613fc9719cc08348215a1dba84644b8aaafe95cb3bf9a4
Python
10,901
245
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import ts_preprocess_func __all__ = ['ts_par4'] class TsPar4(TaskModel): def __init__(self, **kwargs): super().__...
b0be730b6c6b39c7d63dc4d32b2dbd7ce56e20e22f885c504bd6cb346cf53f0c
Python
10,905
208
import matplotlib.pyplot as plt import numpy as np import yaml import argparse from collections import defaultdict from src.utils import triu_inverse from config.paths import GRADIENTS_PER_JOBS_PATH_TEMPLATE, CLASSIFICATION_PER_JOBS_PATH_TEMPLATE, FEATURE_IMPORTANCE_PATH_TEMPLATE, FEATURE_IMPORTANCE_FULL_MATRIX_PATH_TE...
62a91ad11f319bcd30ecd437fe79f55e2a34ab03127d88fe6a1b74c7753094a4
Python
10,909
245
from ._base import register_transform import torch import math from rde.utils.protein.dihedral_chi import AA_TO_INDEX, ALL_ATOMS, ALL_ATOM_POSNS,ONE_TO_THREE, CHI_PI_PERIODIC_LIST from rde.utils.protein.constants import restype_to_heavyatom_names as restype_name_to_atom15_names from rde.utils.protein.constants import ...
f1ef61563160bf21134d0053a268f3bb5ae8d718ff61dbc5eae066a644d49e8b
Python
10,914
191
"""CPU regression checks for label export and batched surface overlays.""" from pathlib import Path import tempfile import unittest from unittest.mock import patch import nibabel as nib import numpy as np from postprocessing.labels import read_regions, write_labels from postprocessing.overlays import FIELDS, copy_fra...
7d7679856527dbf4733c3043bcd11e8994fd9a2c401959dad9a80181ad3d3b37
Python
10,919
325
''' PipelineTranscriptDiffExpression.py - Utility functions for pipeline_transcriptdiffexpression.py ============================================================== :Author: Toms Smith :Release: $Id$ :Date: |today| :Tags: Python Code ---- ''' import cgatpipelines.tasks.expression as Expression import cgatpipelines....
130697e2fd7ace4aef789a18f4314a1b4e6d3c0529be83e4e2ec3532a99af183
Python
10,922
357
''' https://github.com/flatironinstitute/mountainsort/blob/master/packages/pyms/mlpy/mdaio.py Modified by jiaaoZ 01/20/2022 ''' import numpy as np import struct class MdaHeader: def __init__(self, dt0, dims0): uses64bitdims=(max(dims0)>2e9) self.uses64bitdims=uses64bitdims self....
02b8fed955933441e94f63dc071a32cb436b633bec2bdd713ca765b8c80aad06
Python
10,932
300
import numpy as numx import pydeep.base.numpyextension as npExt from pydeep.base.activationfunction import Sigmoid import pydeep.rbm.model as MODEL import pydeep.rbm.estimator as ESTIMATOR import pydeep.misc.measuring as MEASURE #import pydeep.misc.visualization as VIS import pydeep.misc.io as IO import pydeep.misc.toy...
60b74b4e24a34d25e995d9455c9d6722cae4fa8ce08ef2c69c50c147ac29ffe2
Python
10,934
320
""" Created by @author Shengze Cai Modified by @author Mitchell Daneker Contact Mitchell Daneker with any questions via mdaneker@seas.upenn.edu """ import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" import tensorflow as tf if tf.__version__ >= "2.0.0": import tensorflow.compat.v1 as tf tf.disable_v2_beha...
ea2bdcc93dffa29c143fa71bbc2d6754a2c0d11e90b75d07d8a8e653c1e8d61f
Python
10,944
267
from pathlib import Path from typing import List, Union import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd from omegaconf import DictConfig, ListConfig from scipy import linalg from libs.function.function import Log, Standardize from libs.function.utils import pca from libs.u...
e0f7debf2902b7fdd8e47d0848a49fb533c07024c7f9c6fc5d4f7fa695c8df41
Python
10,947
312
"""Prompt schema definition.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, Any from pydantic import BaseModel, model_validator from typing_extensions import override from langchain_core.prompts.string import ( DEFAULT_FORMATTER_MAPPING, PromptTemplateFormat...
99a5a37e85bc0760275a8250d86ec27b836ef095e637a2a611281900a0c02389
Python
10,948
249
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import ts_preprocess_func __all__ = ['ts_par6'] class TsPar6(TaskModel): def __init__(self, **kwargs): super().__...
a3802a81a1b2749396fdd6b989a4f349bb3fdea8dd0cba88578177229d7dffdb
Python
10,948
239
import random import re import torch import nibabel as nib from data import create_dataset from .helpers import * import pandas as pd import numpy as np from .util import mkdir from .metrics import SSIM3D from monai.metrics import RMSEMetric, PSNRMetric class PhaseNotDefinedError(Exception): pass class NIIVisua...
22071b33f2d0889357fd84adc510b54f82b897f38d11028fa444d3f8a891df90
Python
10,950
281
import math from e3nn import o3 from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from torch import Tensor from torch_sparse import SparseTensor import torch.nn as nn from torch_geometric.nn.conv import MessagePassing from torch_geometric.typing import Adj, OptTensor, PairTensor f...
2d34da2afeaa295fcdd2dc7235f340e164d7a6232c6304783e092512d3ce5d7c
Python
10,953
301
# Copyright 2023 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
46a8caa8b8c0ee6a4438699744c06e2f1331c9b5d7fd648bc4379cce659863c2
Python
10,956
320
import argparse from pathlib import Path from datetime import datetime import logging import quantities as pq import neo from neo.utils import get_events, cut_segment_by_epoch, add_epoch from elephant.signal_processing import butter from elephant.spectral import welch_psd import numpy as np import matplotlib.pyplot...
c00834bc9fd546354abde75bead22c653551b8658326fe83243837ca6ce31ade
Python
10,959
277
import json from logging import Logger import os from typing import Dict, List import numpy as np import pandas as pd from tensorboardX import SummaryWriter import torch from tqdm import trange from .evaluate import evaluate, evaluate_predictions from .predict import predict from .train import train from HMSA.args impo...
f2be4e596350e1db79477a4268370fa19e615f359dcb368defc8883b1d78c25c
Python
10,962
312
from ChipseqReport import * import Motifs ########################################################################## ########################################################################## ########################################################################## # Base class for mast analysis #####################...
76f4b3d55024361f4e87d6f42d2033927b6fd7f762b5401047bed3f466cb5636
Python
10,964
357
"""Asynchronous iterator utilities. Adapted from https://github.com/maxfischer2781/asyncstdlib/blob/master/asyncstdlib/itertools.py MIT License. """ from collections import deque from collections.abc import ( AsyncGenerator, AsyncIterable, AsyncIterator, Awaitable, Callable, Iterator, ) from c...
9e6cdc90aa81091efe3594469dd2aaeb2c95aea2ac26817471b17ebf1e9ae4a6
Python
10,966
297
from sklearn.svm import SVC from sklearn.metrics import accuracy_score from sklearn.model_selection import StratifiedKFold import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader, TensorDataset import os from sklearn.metrics import confusion_mat...
33076fb443f64b05ec3b0e84894e6aedceb0cdfeb9a6e7a6655938ab3f580ec6
Python
10,969
294
r"""A project configuration module that reads config argument from a file; set automatic generated arguments; and overwrite configuration arguments by command arguments. """ import copy import sys import typing import warnings from os.path import join as opj from pathlib import Path import os import torch from munch ...
5e752b1e7afa38a65ccbf1479342251c2147f17a9ce5ea9e38c31b60b7d13fca
Python
10,973
250
import logging import os import random import time import numpy as np import torch import h5py from lightning.pytorch.callbacks import Callback from lightning.pytorch import seed_everything from lightning.pytorch.utilities import rank_zero_only # don't log twice while training on multiple GPUs from predmoter.utilitie...
025689be34b02025bb0d438a0c42c15426d3c26baa12019c9de143f85d828d85
Python
10,979
259
import torch from torch import nn class NNRELoss(nn.Module): """wrapper of loss function for PU learning""" def __init__(self, prior=None, loss=(lambda x, y: torch.sigmoid(-x*y)), gamma=1, beta=0, transform=True): super(PULoss,self).__init__() self.prior = prior self.gamma = gamma ...
7449d9c0045205be9265174862352596670c16d66c92a4480796493098257f9f
Python
10,981
182
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
a033505d9d0c4b0b6a6435fc3e1597cb4db173b4828e9bf995ab29242058a82b
Python
10,981
244
"""non-rigid ICP (Amberg et al. 2007), scipy-only. deforms a template (source) mesh onto a target mesh while preserving the template's own topology, so every registered patient ends up with the exact same vertex count/connectivity as the template - useful for a cohort where you want point-to-point correspondence acros...
ebb4df53da3b436b18f2ff9c087d6ee870949b5427e976bb5c3fe4e56e055fcd
Python
10,983
229
import torch.nn.functional as F import torch import torch.nn as nn import math import escnn import timeit # ---------------------------------------------------------------------------------------------------------------------- # GFNO2d # ---------------------------------------------------------------------------------...
c3a32755256fb7925c012520df311a0d641af72a9190e91cc151cca157271ef2
Python
10,989
318
import hashlib import logging import json import os from typing import Any, Dict, List, Optional from pathlib import Path import hydra import lightning.pytorch as pl import omegaconf import torch import wandb from lightning.pytorch import Callback from omegaconf import DictConfig, ListConfig from lightning.pytorch im...
fc92d60b5a42a5532c0133b98a38f0ceaa5c2609612e02153e39d2b746a268a1
Python
10,994
306
# This file uses sklearn library to setup ML model comparison experiment with cross validation # It will write out files to an 'out' directory that it will try to create import time import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import PolynomialFeatures, F...
8d95ec0ae02d3a36f8269232e0c4fa7b74e5632e00c52118599d7d30ae6fbc22
Python
11,000
323
import os, glob, sys from collections import defaultdict import openfold.np.protein as protein import openfold.np.residue_constants as rc import torch import openfold.data.data_transforms as dt import openfold.data.data_pipeline as dp import openfold.data.input_pipeline as ip import openfold.data.feature_pipeline as Fp...
1d23f719ffd4fc55a69a0bbee1c9d113e4c088db689f73633573f63bdf1a50a8
Python
11,003
287
import torch import numpy as np import torch.nn as nn from timm.models.layers import trunc_normal_ from pdearena.models.transolver.model.Embedding import timestep_embedding from pdearena.models.transolver.model.Physics_Attention import Physics_Attention_Structured_Mesh_2D from pdearena.configs.config import CFDConfig f...
38b69aba290240d45dd91541fff6fa42e2899a1193045ddaebcae7a1eae58c8f
Python
11,003
394
""" pipeline_expression.py - analysis of expression data ==================================================== Purpose ------- This pipeline predicts gene that are differentially expressed. This pipeline uses the bioconductor package. Usage ----- Type:: python <script_name>.py --help for command line help. C...
4d7cf66f5566815775df97c52066d4430ed54c51c564bb7663504d2f3b971a39
Python
11,006
324
# import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module from functools import partial def sce_loss(x, y, alpha=3): x = F.normalize(x, p=2, dim=-1) y = F.normalize(y, p=2, dim=-1) # loss = - (x *...
94091a84a546f4cbc63afa412055d32719106b93b17e0c2e72f2c2f9300a4aa6
Python
11,007
328
#!/usr/bin/env python3 from collections.abc import Hashable, Iterable from pgmpy.utils.types import Self __all__ = ["_GraphRolesMixin"] class _GraphRolesMixin: """Mixin class for handling roles in a causal graph.""" def get_role(self, role: str): """Return list of nodes in graph G with a specific r...
a1a0fdd0aae58bf26ed54832c0f8f7f573e6ef55f7b400bc2d820afe4a12676c
Python
11,007
229
import pandas as pd import argparse from utils import set_seed import numpy as np import wandb import os import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.nn import functional as F from torch.cuda.amp import GradScaler from model import GPT, GPTConfig from trainer import Trainer, Tra...
ea74b7edb308f6957c4df26e512eef315e02a97b2430e9d4be2641dea6e5892e
Python
11,011
258
# MIT License # # Copyright (c) 2022 Matthieu Kirchmeyer & Yuan Yin import torch from torch import nn from .utils import * from functools import partial import torch.nn.functional as F from torch.quasirandom import SobolEngine import copy import numpy as np nls = {'relu': partial(nn.ReLU), 'sigmoid': partial(...
8b28a745ba19821d0a0894b5482926fb280e5305d0bb832e0e5d44faa50464b5
Python
11,013
252
# Copyright 2019 DeepMind Technologies Limited. 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
3404e21f170a7a27b15adfc8163b7443f0e8dd3fb096a744429a3264512c600d
Python
11,016
294
"""The script to test all layers and SELU activation properties hold.""" import pytest import numpy as np import math import copy from functools import reduce import torch import torch.nn as nn from torch.nn import modules from vulcanai.models.layers import BaseUnit, ConvUnit, DenseUnit from vulcanai.models.utils impor...
9a1c110cdd1aca88650d8512356ad00fb15e369343988ea59f75caf6a3286f7e
Python
11,025
249
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import pstRT_preprocess_func __all__ = ['pstRT_ddm'] class PstrtDdm(TaskModel): def __init__(self, **kwargs): sup...
96509c4b99500559eaa8d8d46e645fab4516fda9114a1994c553ab5870ab098d
Python
11,026
217
import os from copy import deepcopy from collections import OrderedDict from itertools import groupby import warnings import numpy as np import matplotlib.pyplot as plt import matplotlib import matplotlib.font_manager from matplotlib.colors import ListedColormap from matplotlib.cm import get_cmap import scipy.stats as...
bbd65c9fb63b1d960b4b64f3510daf0fd54cebe619ab72649fbe4bc45dbbe0c7
Python
11,032
343
########################### # Latent ODEs for Irregularly-Sampled Time Series # Author: Yulia Rubanova ########################### import numpy as np import torch import torch.nn as nn from torch.nn.functional import relu import lib.utils as utils from lib.encoder_decoder import * from lib.likelihood_eval import * f...
0dd148f935c0434a67cc29e5a0ff9f37a7fec33768244536e37f9997b74345da
Python
11,035
291
""" Analyze the information gain afforded by a single outcome in different studies previously conducted. Information gain is measured by the KL divergence between the prior and the posterior (having observed a single outcome), using the prior as reference distirbution. Note that this is a standard way of measuring in...
93c20c0036f0c393d1d0e7d36d21e4a345622547aab99e784182749dd1ce7b83
Python
11,036
305
"""Compute conn (PID | II) + stats across condition in the time domain. This script can : - Compute connectivity metrics like conn_pid and conn_ii - Perform RFX-contacts on ii (two-tailed), redu | syn | redu - syn | syn - redu (one-tailed) - Computations are performed within conditions (i.e. rew | pun) - Significanc...
d8d20f5e0fdfd65a706840e68a48ca86ec724bcebea57f0cc146f7de6611ff83
Python
11,041
293
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import scipy.stats import numpy.ma import Stats import Histogram from cgatReport.Tracker import * from cpgReport import * ########################################################################## class UniqueIn...
056bf4406a77ac38d514ecf920ad8bda7e48a80806e840c467cee5cf2364a9a5
Python
11,047
290
import os import time import pickle import numpy as np import torch from torch.optim import lr_scheduler from torch.nn.init import xavier_normal,xavier_normal_ from torch import nn import torch.utils.data.sampler as sampler from config_PPI import DefaultConfig from model_PPI import DGCNN import data_generator_PPI fr...
07b31581f9b2c40aad76af0d69656bb16eee42ecebcff928327ee9154d69b1db
Python
11,054
336
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from opt_einsum import contract as einsum import copy import dgl from rfdiffusion.util import base_indices, RTs_by_torsion, xyzs_in_base_frame, rigid_from_3_points def find_breaks(ix, thresh=35): # finds positions in ix where th...
466009cac9a281fb50e1a1c554a132f73307f94476675dc11bed3221c68f82a3
Python
11,055
328
'''tasks for running a trained model on new data. ''' import logging import os import luigi from luigi.util import requires import pandas import numpy as np from retchat.models import load_model from keras.backend import clear_session from .ioutils import imread_raw from .predutils import Preprocessor from .preduti...
d58d1a07244e427d712ac002ab95fd7b9da368706016d17667add5564eb3129c
Python
11,056
328
'''tasks for running a trained model on new data. ''' import logging import os import luigi from luigi.util import requires import pandas import numpy as np from retchat.models import load_model from keras.backend import clear_session from .ioutils import imread_raw from .predutils import Preprocessor from .preduti...
8bac1ae5a03da74be32beb3fbb98d83f8e139ee286c54a8349fe39b5c70e8851
Python
11,057
328
'''tasks for running a trained model on new data. ''' import logging import os import luigi from luigi.util import requires import pandas import numpy as np from retchat.models import load_model from keras.backend import clear_session from .ioutils import imread_raw from .predutils import Preprocessor from .preduti...
a0aa77bcc8a8ecf0f957102fbacebdf6d0b7c3613c013075d09d806b769fb668
Python
11,061
137
from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Cut, BRepAlgoAPI_Fuse from single_feature import (BaseSheet, FlangHole, Swelling, BendGroove, Rib, Rip, CommonHole, CommonGroove, Vent, Array, ProfiledGroove, ProfiledArray, Bend, Roll, EarPlate) class Compound(object): def __init__(self, fl...
dcd6dc964f4066f293a39e81ef8f32f85f9d576c01c294875f9b456bcc1a42f0
Python
11,061
382
from pdearena import utils from pdearena.modules.twod_resnet import DilatedBasicBlock from pdearena.modules.conditioned.twod_resnet import ( FourierBasicBlock as CondFourierBasicBlock, DilatedBasicBlock as CondDilatedBasicBlock ) MODEL_REGISTRY = { ## sinenet: zeros "sinenet1-dual-128": { "cla...
3befe7a47e1d5f9a26382f19373dd4f8151af969a1188d6e56319b58f527cef7
Python
11,066
256
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
23602d73a8df4f799d874fff05b4e4e1a5deb137d60cf53deb28225d50c8c948
Python
11,067
216
# -*- coding: utf-8 -*- # @title Hodgkin & Huxley parameters # @file Hhparam.py # @author Romain Beaubois # @date 05 Dec 2022 # @copyright # SPDX-FileCopyrightText: © 2022 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief Class to generates HH n...