sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
83dedc677597b75be523e6d498d8d207d39d9f908336dec167ee304878cd4fd3 | Python | 6,305 | 208 | import numpy as np
import os
import torch
import SimpleITK as sitk
def compute_landmark_accuracy(landmarks_pred, landmarks_gt, voxel_size):
landmarks_pred = np.round(landmarks_pred)
landmarks_gt = np.round(landmarks_gt)
difference = landmarks_pred - landmarks_gt
difference = np.abs(difference)
di... |
b7bb3d8c34b30f1a1d8521bd2a0225a0f603333229b506fb4341032acb6cdec8 | Python | 6,306 | 224 | import sys
from importlib import metadata, util
from pathlib import Path
from types import SimpleNamespace
import pytest
import gpn.cli as cli
def _help(capsys: pytest.CaptureFixture[str], *arguments: str) -> str:
assert cli.main((*arguments, "--help")) == 0
return capsys.readouterr().out
def test_console... |
be5903dd03f00305b2fe086b1526a72bf2e3ab84dafab6800f0cc0edfcb9fb63 | Python | 6,307 | 188 | # 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 random
from pathlib import Path
from typing import Dict, Optional, Tuple
import torch
import torch.nn as nn
logger = l... |
1c39fa9eb2f878a7507c4b7d57ec59f2fcaea601fd11c022aecb2a8355d36da6 | Python | 6,310 | 148 | # coding=utf-8
# arxiv: https://arxiv.org/abs/2006.12030
# source:https://github.com/yangyanli/DO-Conv/blob/master/do_conv_pytorch.py
import math
import torch
import numpy as np
from torch.nn import init
from itertools import repeat
from torch.nn import functional as F
from torch._six import container_abcs
from torch.... |
3a6ab9afb9d34b9eeb6c83fe053bec45f2a115102b3551667396109b4a0bb85f | Python | 6,310 | 154 | """Wang's termwise semantic similarity for GO terms"""
# http://127.0.0.1:31762/library/GOSemSim/doc/GOSemSim.html
# https://cran.r-project.org/doc/manuals/r-release/R-intro.html#An-introductory-session
# TOP 20179076 R. HA..c 98 4 2010 332 1 13 au[06](Guangchuang Yu)
# GOSemSim: an R package for measuring sem... |
ae46e2fa84775aed92394a92b6d49899b087cd0871920a86a5e1f51c6ce72a53 | Python | 6,310 | 210 | #!/usr/bin/env python3
from pathlib import Path
import torch
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
_REPO_ROOT = Path(__file__).parents[3]
_DEFAULT_DATA_DIR = str(_REPO_ROOT / "datasets")
def cifar10(
batch_size: int, path: str = _DEFAULT_DATA_DIR
) -> tuple[DataLo... |
51cf97f72f6329137080a17ee7557fe0f789fbe017614e365d2c027ce786e1b9 | Python | 6,311 | 191 | #!/usr/bin/env python3
"""Build SIVmac239m2-based synthetic test fixtures for umi-pipeline-nf-HIV."""
from __future__ import annotations
import argparse
import os
import random
import shutil
import subprocess
import sys
import pysam
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SIVMAC_DIR ... |
08da67ad0c0c02d206131f9161769f72953148ecea12fb099714f16892a529f8 | Python | 6,315 | 267 | CompScalerMeans = [
21.194441759304013,
58.20212663122281,
37.0076848719188,
36.52738520455582,
13.350626389725019,
29.468922184630255,
28.71735137747704,
78.8868535524408,
50.16950217496375,
59.56764743604155,
19.020429484306277,
61.335572740454325,
47.14515893344343... |
c7d672ba05c23745ef3aaf454641fd2bf82ad472ec729aed078c06271fa4b103 | Python | 6,315 | 210 | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import gc
import os
import os.path as osp
import random
import numpy as np
import tqdm
import torch
... |
73c017c34c6a503179e545c4712e4f1608e5877e130a8f60a15293187e2c651b | Python | 6,316 | 173 | import io
import logging
import sys
import types
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch
from GMXMMPBSA.exceptions import GMXMMPBSA_ERROR, InputError, MMPBSA_Error
from GMXMMPBSA.infofile import _determine_type
from GMXMMPBSA.input_parser import ... |
12580004b1c3d7c8366310269bb69bdf1b3bd8a4edcded5dad1463b5fdcafdf4 | Python | 6,317 | 150 | import json
import io
from pathlib import Path
import sys
import tempfile
import unittest
import zipfile
import numpy as np
from PIL import Image
MODULE_DIR = Path(__file__).resolve().parents[1]
if str(MODULE_DIR) not in sys.path:
sys.path.insert(0, str(MODULE_DIR))
from segmentation_job import ( # noqa: E402
... |
e644fb29ea65edee42a4669a01ea425c19044450b1e1fb3e7545294af5d68f98 | Python | 6,321 | 165 | """Controller for behaviour table setup, sorting, and row lifecycle."""
from __future__ import annotations
from typing import ClassVar
import pandas as pd
from PySide6.QtWidgets import QFrame, QMessageBox, QVBoxLayout
from src.gui.framework.qt_view_styles import panel_stylesheet
from src.gui.framework.tk_style_tabl... |
03f80c528f7fe8aa98b6d95a2e4207879ef48cec2b481838cc1db36786b45364 | Python | 6,323 | 162 | """Test-only stitched cache for visualize payload generation."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Dict, Iterable, Tuple
import cv2
import numpy as np
import torch
import torch.nn.functional as F
from tasks.cell_morphology import calculate_cell_metri... |
2be97487cf93ddf070007bd10c5d535d5fd92821f3c95d829651c8b2ccab78af | Python | 6,327 | 160 | import json
import os
from pathlib import Path
import sys
import tempfile
import unittest
from xml.etree import ElementTree as ET
import cv2
import nibabel as nib
import numpy as np
from PIL import Image
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
os.environ.setdefault("SEGREF3D_DISABLE_SAM2", "1")
MODULE_... |
9c35a3ff94ad313285307d247a1b6f72572fa88f3630cea2db63cec653d52eac | Python | 6,337 | 128 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/main.py
# This file includes the modifications to the source codes according to this project!
import os
import time
import yaml
import argparse
import logging
import utilities
import precision
import calculate_g... |
a8891e323214cc343224253f60f3716ab58c7802a63e15f4dd1a95324d7c4eec | Python | 6,338 | 159 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
from .iadc import IADC
from simulator.backend import ComputeBackend
xp = ComputeBackend... |
6ef04a3a2a884cac7ae0ae9bb121cb7192f5057a9582effd09445d48b8ebbd6d | Python | 6,342 | 123 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI/ContCorrUI.ui'
#
# Created by: PyQt5 UI code generator 5.8.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.setObjectN... |
4539d3a27eb07ed99968b57218e94ef7fd245aa756406251c03f94279d0bede4 | Python | 6,343 | 176 | # 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... |
247774916df0a358e8f0e2c465c0553579db3f6b86fefed65e4e7d75f9be48bc | Python | 6,344 | 129 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/main.py
# This file includes the modifications to the source codes according to this project!
import os
import time
import yaml
import argparse
import logging
import utilities
import precision
import calculate_g... |
8c9c2ef93e3ce23dd510c394090e0f5534dc8359cf7914a4825a226930d8a918 | Python | 6,344 | 166 | # 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... |
a8cd0dbfc5c2ac9348ee9f2a2871aa4264d95c839dbc2883dc34dbaf27d7e54f | Python | 6,347 | 196 | # Given a config file, check if the docker model is available
from collections import defaultdict
import subprocess
import sys
def flatten_cfg(cfg, base=""):
"""
Flatten a nested configuration dictionary into a flat dictionary
with keys as paths and values as the corresponding values.
Args:
cf... |
838199c832617adae11cd69135dbad43de4ec92afa61036e215cc7cc51458daf | Python | 6,348 | 186 | # @license
# Copyright 2021 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... |
022d6b1e553ab848cc32712399d2f6e48a1bad18e5021e7b45c8eba880abc9c4 | Python | 6,350 | 192 | import torch
import matplotlib.pyplot as plt
import seaborn as sns
import argparse
import os
import numpy as np
from Bio import SeqIO
from tqdm import tqdm
np.set_printoptions(threshold=np.inf)
import math
from src.transformers import BertModel, RNATokenizer
def get_kmer_sentence(original_string, kmer=3):
if k... |
a4dbc988008d9f0a4614f540d5c4909cc72ed7163801fdff666bba7708344f23 | Python | 6,350 | 184 | import logging
from os import makedirs
from os.path import join, exists
import pandas as pd
abs_ = True
from matplotlib import pyplot as plt
from utils.plots import plot_roc
import numpy as np
def save_coef(fs_model_list, columns, directory, relevant_features):
coef_df = pd.DataFrame(index=columns)
dir_nam... |
f0d2ad4da037f39a554f37fd0455df382158119222f61fa99a534c7d1014e6a0 | Python | 6,354 | 178 | """Implementation of the ProteinBERT model.
This code has been modified from the original implementation
by Facebook Research, describing its ESM-1b paper."""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .modules import (
TransformerLayer,
LearnedPositionalEmbedding,
... |
a7fc514517b88ff0c217490a1cc275076b2d4b68fb9ad02415c8ea3fbdd482d1 | Python | 6,357 | 189 | #!/usr/bin/env python
#
# Raspberry Pi Rotary Encoder Class
# $Id: rotary_class.py,v 1.3 2021/04/20 12:23:04 bob Exp $
#
# Author : Bob Rathbone
# Site : http://www.bobrathbone.com
#
# This class uses standard rotary encoder with push switch
#
#
import RPi.GPIO as GPIO
import time
from testvariables im... |
dd22b65f0b3ce9dbc0dbea07115773cd40b96700ae98b8e229545ad61919dba9 | Python | 6,360 | 160 | """
This notebook loads in videos of natural scenes collected via the video collection protocol,
and computes the response of a set of Gabor filters.
Author: Jonathan Gant
Date: 04.08.2023
"""
# import statements
import numpy as np
from tqdm import tqdm
import cv2
import glob
import os
import h5py
from decord import... |
297a4db96e3f78cea6a44171825ae4cac1ec42cd58ced1f7f06dec987eeda741 | Python | 6,363 | 206 | #!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_... |
b4acb5be5a0ba27043d3d9353d8c21fd059338118c12c40d6bb487c8d923d2a3 | Python | 6,363 | 152 | #! /usr/bin/env python
__author__ = 'heroico'
import metax
__version__ = metax.__version__
import logging
import os
import sqlite3
import pandas as pd
import numpy as np
from scipy.stats import chi2
from scipy.stats import norm
from timeit import default_timer as timer
from metax import Logging
from metax import Util... |
8c9181cae1147acd1515fa3f409cb83020f223ed9f984ea0bc7b14335a4ebdb2 | Python | 6,365 | 135 | #!/usr/bin/env python2
# written by Jin Lee, 2019
import os
import argparse
import json
from collections import OrderedDict
default_output_def_json_files = ['default.json']
def parse_arguments():
parser = argparse.ArgumentParser(prog='Resumer for ENCODE ATAC/Chip-Seq pipelines',
... |
b23fe36f1359530d62352ba6f449c8eddf7b3cc7e8d1ef9d45072f6ba4dc1e13 | Python | 6,365 | 142 | from argparse import ArgumentParser, Namespace
from logging import getLogger
from transformers.commands import BaseTransformersCLICommand
def convert_command_factory(args: Namespace):
"""
Factory function used to convert a model TF 1.0 checkpoint in a PyTorch checkpoint.
:return: ServeCommand
"""
... |
b49c40f8f153239014b9b1e2dc47072977e8a1d25ff4c079d607af046bdda50c | Python | 6,365 | 166 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
import h5py
from sklearn.decomposition import PCA
import pdb
def get_period_pca(xx_trials,period,nComponents):
# Which times the trajectory points will be drawn from
if period == 'instruction':
times = np.arange(29,79) # Instruc... |
5fa953ca53bca670deec638295613b101a03df3f14a87175bc85cdcd793b48b1 | Python | 6,366 | 177 | import numpy as np
import pandas as pd
import random
from sklearn.neighbors import KDTree
from metrics import *
#' @param num.cc Number of canonical vectors to calculate
#' @param seed.use Random seed to set.
#' @importFrom SVD
def embed(data1, data2, num_cc=20):
random.seed(123)
object1 = Scale(data1)
ob... |
dbe49bad0ffcd49029b4b549e9bb5dc7dd152dcc5e3fa49344c64d22cec17496 | Python | 6,367 | 202 | from typing import List
import numpy as np
class BinnedOmicTokenizer:
"""
Tokenizer that bins gene expressions or methylation to convert them to tokens.
"""
def __init__(
self,
n_expressions_bins: int,
min_omic_value: float = 0.0,
max_omic_value: float = 1.0,
... |
fb980104c1d5cb757162fab290905d524527a06d2a2f57654d631739fe2695fb | Python | 6,370 | 160 | """
VGG 16 model without Predify
"""
import torch
import torch.nn as nn
from torchvision.models import vgg16_bn
class VGG16Baseline(nn.Module):
def __init__(self, pretrain=False, freeze_pretain=False):
super(VGG16Baseline, self).__init__()
# configs
self.pretrain = pretrain
self.f... |
8a659a2df070bf97f4d32ddcd4222a023a7e02524959a558c16d957eb789e9a8 | Python | 6,374 | 172 | """Default transforms for frame classification models.
These are "item" transforms because they apply transforms to input parameters
and then return them in an "item" (dictionary)
that is turn returned by the __getitem__ method of a vak.InferDatapipe.
Having the transform return a dictionary makes it possible to avoid... |
f57ce00691eef9d35819d15a32679248d0920627fa96bd12256e1ffd93d2b7e8 | Python | 6,379 | 190 | import os
import logging
import numpy as np
import torch
from torch.utils.data import DataLoader
from lightning.pytorch.loggers import TensorBoardLogger, CSVLogger
from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping
from lightning import LightningModule, Trainer, LightningDataModule
import embeddin... |
4e281e210fe614c31a13d7f819fdc1483475826471677660d0d2a4e227192c92 | Python | 6,381 | 160 | # 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 collections import OrderedDict
from typing import Dict, Sequence
import numpy as np
from . import FairseqDataset, Langua... |
cef5c6ce2d2b4ffa79f0cc0989e59d34d46e770efe6a05828d1f44ed509f1ce4 | Python | 6,381 | 198 | from mdt import LibraryFunctionTemplate
class RotateOrthogonalVector(LibraryFunctionTemplate):
"""Uses Rodrigues' rotation formula to rotate the given vector v by psi around k.
This assumes that the vectors we are rotating are orthogonal to each other.
Args:
basis: the unit vector defining the r... |
43bde6ceb6852fc349ce21dd9cda13223bcfb3ae5f4eca87415b22e17f882ee9 | Python | 6,382 | 181 | # 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 import utils
from fairseq.logging import metrics
from fairseq.criterion... |
f8e10940138d40fee5c7738e84f6e63d5ba09b62ebf17003653223a4a20eac0a | Python | 6,383 | 132 | from torch_geometric.explain import Explainer, CaptumExplainer
import numpy as np
import sys
import torch
import torch_geometric
from colour import Color
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
from models.STAG.encode_structure import get_graph, add_edge_data
from models.STAG.model import STAG
from model... |
4602efe12e1c894b137891207c9e7d836e8360b6a5368103bac81cb7aa0a60c1 | Python | 6,388 | 148 | #!/usr/bin/env python
from rdflib import Graph, RDF
from rdflib.namespace import SKOS, RDFS, OWL
from rdflib import Namespace
import yaml
class Parameters:
"""
Class for input parameters to parse the MESH TTL file.
Attributes
----------
vocab_name : str
Name of vocabulary.
namespace : ... |
2b65395e2f630beb3af524256f3b8ea560d35c4afcd2e1fbf13e5ac095cc1f80 | Python | 6,390 | 179 | import numpy as np
import pandas as pd
import pytest
from sklearn.linear_model import LinearRegression
from pgmpy.ci_tests import PillaiTrace
from pgmpy.tests.test_ci_tests import _multivariate_fixtures
pillai_data = _multivariate_fixtures.pillai_data
skip_gh_actions = _multivariate_fixtures.skip_gh_actions
@skip_g... |
fcf8d39e22efd5c405534ecf88ea5071fc6f4f77f0387dde0270e693bba5bfee | Python | 6,390 | 219 | # _ _
# | | | |
# ___ __ _ __ _ ___| |_ ___ ___ | |___
# / __/ _` |/ _` / __| __/ _ \ / _ \| / __|
# | (_| (_| | (_| \__ \ || (_) | (_) | \__ \
# \___\__,_|\__,_|___/\__\___/ \___/|_|___/
'''
A Convergent Amino Acid Substitution identif... |
530d1f29fbe19ba5a95e8c320a319c551a34f81a77f50b3c54639502dc66db17 | Python | 6,392 | 192 | #!/usr/bin/env python
# ENCODE DCC bowtie2 wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import re
import argparse
from encode_lib_common import (
log, ls_l, mkdir_p, rm_f, run_shell_cmd, strip_ext_fastq, strip_ext_tar,
untar)
def parse_arguments():
parser = argparse.ArgumentParser(... |
7a2f5fe70701526cdbdc5cc48944626050c59ffe7e108fd7eb3a37ce0fd1dbc3 | Python | 6,392 | 165 | import logging
import numpy as np
import pandas as pd
from anndata import AnnData
from mudata import MuData
from ._arraylike_field import ObsmField
from ._layer_field import LayerField
from ._mudata import BaseMuDataWrapperClass, MuDataWrapper
logger = logging.getLogger(__name__)
class ProteinFieldMixin:
"""A ... |
4aaa3ee7159043cb4ae15aae6657e49e0c1cd585139bdd788fd71877621db331 | Python | 6,393 | 188 | import json
import pickle
from pathlib import Path
from collections import Counter, OrderedDict
from typing import Dict, Iterable, List, Optional, Tuple, Union
from typing_extensions import Self
import torchtext.vocab as torch_vocab
from torchtext.vocab import Vocab
class GeneVocab(Vocab):
"""
Vocabulary for... |
a16e2efa4a8b0e814b2a9f8bd9452f0d312bb68ac0a1ae6a8a2f2e45de3b0278 | Python | 6,393 | 166 | #!/usr/bin/env python3
"""
Author: Ken Chen
Email: chenkenbio@gmail.com
Date: 2023-01-10
"""
import argparse
import warnings
from tqdm import tqdm
import os
import sys
import pickle
import numpy as np
import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data impo... |
dbeedb05eb6d759de0db2dd0c3398cb810efb43dadb5e3f8ef3d7b479d898478 | Python | 6,393 | 178 | """NLP4Pheno: microbiology sentences with hand-marked `STRAIN` spans.
A Label Studio export, one sentence per task, whose offsets are **already
half-open** — the opposite of S800, so the `+ 1` that corpus needs is a
one-character error here — and which repeats each span's surface, so the loader
checks its own conventi... |
251512d152b02c323e69211bd3f517402ff509d17119dde216ecc65f37c820dc | Python | 6,397 | 163 | import sys
import unittest
from pathlib import Path
import numpy as np
MODULE_DIR = Path(__file__).resolve().parents[1]
if str(MODULE_DIR) not in sys.path:
sys.path.insert(0, str(MODULE_DIR))
from mask_postprocessing import ( # noqa: E402
apply_mask_volume_changes,
build_mask_volume_changes,
cleanu... |
9ef20e6b5442e736604146ef42097d5a1f3972d915257800136b473a45fc21e8 | Python | 6,401 | 158 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import copy
import torch
import torch_geometric.data as pyg_data
from torch import IntTensor, LongTensor, Tensor
from torch_geometric import utils
from torch_geometric.typing import OptTensor
class ChemGraph(pyg_data.Data):
r"""A ChemGraph... |
2ad021aed0f527f48d6fa52420bba46f8e7394ce5d16decbb273fd96f16956d6 | Python | 6,402 | 113 | # -*- coding: utf-8 -*-
"""
Concatenate parcellated PET images into a region x receptor matrix of densities.
Author: Yuan Zhang
Date: 2025-07-25
Steps:
1. Load parcellated PET receptor data (already reduced to BN246 regions).
2. Combine these data into a matrix of shape (n_regions x n_receptors).
3. Average datasets f... |
8cdc1af2dfc14b877c0e9f499dbb03c6819cbb2a1db2a370aa03a968a9df9170 | Python | 6,403 | 181 | import xml.etree.ElementTree as ET
import os
import json
import config.cfg_npmmrdet_dior as cfg
coco = dict()
coco['images'] = []
coco['type'] = 'instances'
coco['annotations'] = []
coco['categories'] = []
category_set = dict()
image_set = set()
category_item_id = 0
image_id = 11725 ##### bug (first_id-1)
annotation... |
1c15ce5f80b563ce1609be4b9432a749a49e7926a592e0ad15767f8757d8e977 | Python | 6,406 | 156 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import numpy as np
import torch
from tqdm import tqdm
import scvi
from scvi import REGISTRY_KEYS
from scvi.data._utils import _validate_adata_dataloader_input
from scvi.module._constants import MODULE_KEYS
if TYPE_CHECKING:
from ... |
356ca508e660b62c7779d3d65cb712bbaa38b7dd4d55a05d16799db5ef7f0456 | Python | 6,406 | 162 | # %%
"""Aggregate training acceptance logs and select models for downstream analysis.
This implements the model-selection flow requested by Reviewer 1 (point 2):
for each training condition it reports how many models were trained, how many
passed the R^2 > threshold criterion, the R^2 distribution before and after
sel... |
7a477a424fbb8d02198ecc8f7ac1aaf1dbf5a80b159ebab6dc33821fc4f4b86e | Python | 6,406 | 144 | from argparse import ArgumentParser, Namespace
from logging import getLogger
from transformers.commands import BaseTransformersCLICommand
def convert_command_factory(args: Namespace):
"""
Factory function used to convert a model TF 1.0 checkpoint in a PyTorch checkpoint.
:return: ServeCommand
"""
... |
499fe1791a79094b79e42e75c97bc59a372c3696d6ab304a929584a5798f0627 | Python | 6,409 | 205 | import unittest
from pyecharts.commons.utils import remove_key_with_none_value
from pyecharts.options.series_options import (
AnimationOpts,
LabelOpts,
ItemStyleOpts,
MarkPointItem,
MarkLineItem,
MarkLineOpts,
MarkAreaItem,
MarkAreaOpts,
MarkPointOpts,
MinorTickOpts,
MinorSp... |
a57960382e63aee00b3ef9525828569a02c9c7a23197786a5974f058519161e9 | Python | 6,411 | 196 | import os
import anndata
import pytest
import scvi
pytest.importorskip("huggingface_hub")
from scvi.hub import HubMetadata, HubModelCardHelper
def prep_model():
adata = scvi.data.synthetic_iid()
scvi.model.SCVI.setup_anndata(adata)
model = scvi.model.SCVI(adata)
model.train(1)
return model
de... |
dbba228f182eb79d19ba2a6add5183dc95af55bc10731d637387eb4d89a8d97a | Python | 6,411 | 177 | """Figure 2 panel B primitive — Hausser mouse cerebellar cortex dataset profile.
Reads the locally cached unified Hippie dataset (hausser_cell_type), the dataset
all tools (HIPPIE, PhysMAP, NEMO) locked their hyperparameters against. This
is a **different** dataset from Hull (hull_cell_type) — Hull is reserved for
the... |
bf5e7613d80de0da47c868aaab10dbc86a246a453a37dfb3aaf71b5c3f3ae702 | Python | 6,413 | 205 | import numpy as np
import ctypes
import datoviz as dvz
from datoviz import (
S_, # Python string to ctypes char*
V_, # booleans
vec2,
vec3,
vec4,
)
# -------------------------------------------------------------------------------------------------
# 1. Creating the app > batch > scene > figure > ... |
e995acdc0bc9fcbb37cacf12dcfd2e6faa0afa805beecda8a98ff4009e44179d | Python | 6,420 | 188 | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
from itertools import chain
import torch
from hydra.core.hydra_config import Hy... |
069aa1742da103442ecd5b8ee0b220b23e579b0dff3d4fbdb169cf09bb3fde0a | Python | 6,421 | 174 | import logging
import os
import tempfile
import unittest
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
from GMXMMPBSA.exceptions import MMPBSA_Error
from GMXMMPBSA.make_trajs import make_trajectories, warn_concatenated_complex_trajectories
def _input():
return {
... |
867b8e6894af2125b579e8934b26489aab50cc81c8715746bda8444555cf5d3d | Python | 6,423 | 183 | from collections.abc import Iterable, Sequence
import numpy as np
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
import torch
import torch.nn as nn
import torch.utils.data
from torch.distributions import constraints
from torch.nn.functional import softmax, softplus
from scvi._constants i... |
a33d45c911f0eaa1ee1db736df15e46441986f6850ec5f6f4eacf8d590dcc963 | Python | 6,423 | 150 | #!/usr/bin/env python3
# Florian Bénitière 16/03/2025
# This script generates a, unfiltered annotated .parquet file by integrating variant effect predictor (VEP) annotations,
# including all specified VEP plugins, and linking them to individual identifiers (SampleID).
import os
import sys
import pandas as pd
import ... |
a496693d4879c81c425739b77873218331837e4a9b97fbd19f1b69cff33b6c93 | Python | 6,423 | 142 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq import utils
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,
)
from f... |
b65c827a0ff15df4f3b05e8686401c0a1ed86fa8f543ea1ac732f35db1231eca | Python | 6,424 | 212 | import os
import json
import nipype.pipeline.engine as pe
from fetpype.pipelines.full_pipeline import (
create_seg_pipeline,
)
from fetpype.utils.utils_bids import (
create_datasource,
create_bids_datasink,
create_description_file,
)
from fetpype import VALID_RECONSTRUCTION
from fetpype.workflows.utils ... |
69632487e687641873aa857182d9b0008e2eb23f006f891fc93de47380db5e32 | Python | 6,425 | 169 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import h5py
import numpy as np
import pandas as pd
from anndata.abc import CSCDataset, CSRDataset
from scipy.sparse import issparse
from torch.utils.data import Dataset
from scvi._constants import REGISTRY_KEYS
from scvi.utils import ... |
97a664765389ae0691f0e9a89d28a721571cf285b74f14a7365668c56f7b2ceb | Python | 6,425 | 176 | """Resolving a token that has more than one candidate answer."""
import numpy
from conftest import _BACTERIUM, _ENZYME, _encode, _labels_over
from d3text import surface_forms, token_labels
def test_a_form_naming_several_entities_of_one_type_keeps_that_type() -> None:
"""`AS-A` names four separate enzymes; the to... |
933d96de81ad74e5158a13fec293dadd09fd0bbdcedb74568c5a70127d4c76ec | Python | 6,428 | 149 | #!/usr/bin/env python
# Florian Bénitière 16/03/2025
# Script to generate a .pdf that describe the content by column of a .parquet
import sys
import duckdb
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import os
from math import floor # For rounding down nu... |
94dca6e61e4452354ca3612b67767c4111e7d504a7ef067ce4505e21582d4867 | Python | 6,429 | 192 | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from poetry.core.constraints.version.version import Version
from poetry.console.exceptions import PoetryRuntimeError
from poetry.utils.env.python.installer import PythonDownloadNotFoundError
from poetry.utils.env.python.installer impo... |
53d1ceac53c153d47bd82968db1a9479f2b5d923a460ba75e51ab2f653b7b806 | Python | 6,430 | 166 | import warnings
warnings.filterwarnings('ignore')
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import sys
import scanpy as sc
import numpy as np
import cell2location
#------------------------------ Get the arguments: dataset name and slide name ------------------------------
dataset = sys.argv[1]
slide = sys.arg... |
6a2a6f7b3d1588085c394efe8f421ddd7ad9ab2067d15c9bcc626804ca4656b5 | Python | 6,430 | 174 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
from abc import ABC, abstractmethod
from simulator.backend import ComputeBackend
xp =... |
06ffa9cc2afb154eafa0f834fa71b888ad096b4b4803e6f0694a3c6ebe94c11d | Python | 6,434 | 191 | import pickle
import numpy as np
import os
import json
import scipy.io
import scipy.spatial.distance as ssd
import scipy.cluster.hierarchy as sch
from scipy.stats import pearsonr
from helper_functions_pre_test import get_plot_group_order, plot_clustering_heatmap, plot_temporal_factors, plot_trial_factors
from helper_fu... |
b391b7949101db3a13b40f836111cc1c7eeddb7689aa28537ec51065606f2eed | Python | 6,434 | 191 | import pytest
import vak.config.model
class TestModelConfig:
@pytest.mark.parametrize(
'config_dict',
[
{
'NonExistentModel': {
'network': {},
'optimizer': {},
'loss': {},
... |
827f22404ff08fcfd69a8895244fed67e758b4d6d24bf8d5f154612deba7a349 | Python | 6,436 | 102 | #https://github.com/ZHANGDONG-NJUST/FPT/blob/ffdbf3de67ba9e811f05c800c64e4ea855cc0dae/lib/modeling/FPT.py
import torch
import math
import torch.nn as nn
import torch.nn.functional as F
# from torch.nn import DataParallel # or your customized DataParallel module
# from sync_batchnorm import SynchronizedBatchNorm1d, pa... |
af35bc9cd0d714d6eaf5bf8b0ce363ac22b234ac03aa6fbc52b906f795014f02 | Python | 6,437 | 191 | import pickle
import numpy as np
import os
import json
import scipy.io
import scipy.spatial.distance as ssd
import scipy.cluster.hierarchy as sch
from scipy.stats import pearsonr
from helper_functions_post_test import get_plot_group_order, plot_clustering_heatmap, plot_temporal_factors, plot_trial_factors
from helper_f... |
0a112894af3b2267ee5b0a697cec01eeb663d43bb056792e375be85e97cd12e6 | Python | 6,438 | 138 | '''
This script optimizes logistic nonlinearities for a variety of Gaussian distributions and plots the optimal parameters.
Author: Jonathan Gant
Date: 29.08.2024
'''
import numpy as np
import matplotlib.pyplot as plt
from utilities import logistic_func, calc_MI, calc_entropy
from tqdm import tqdm
import h5py
import b... |
f74197b7988e03d04b0ae63d8f849298c337b08028af2dfdcd46cf80b11f0b53 | Python | 6,438 | 141 | #!/usr/bin/env python
# this was implemented by heylf
import argparse
import os
import sys
import tempfile
import requests
import shutil
import gzip
import pandas as pd
import json
import scipy as sp
from zipfile import ZipFile
# pip install openpyxl
def download_data(url, destination_folder, boolzip):
print(f'... |
13fe1225310e15dca1227ddc134e73a7d5951034f1837913c5df18e969f58ea3 | Python | 6,440 | 139 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
import numpy as np
'''
Print a (non-exhaustive) list of simulation settings prior to th... |
5832c3e505aa177a2a4a558b5ab1fadec14a071d3d321143a506e974e4d51a70 | Python | 6,441 | 190 | # This is the class for Physics informed neural network for phase field modeling in 1D
import tensorflow as tf
import numpy as np
import time
import math as m
class CalculateUPhi:
# Initialize the class
def __init__(self, l, layers, lb, ub):
self.l = l
self.lb = lb
self.ub = u... |
cbb2338b19a75d7134bfddfadf19462cfa7c16d87e70a6e96bc9001af9f22918 | Python | 6,447 | 171 | """Controller for app-level data preparation and z-score state management."""
from __future__ import annotations
from PySide6.QtWidgets import QMessageBox
from src.processing.behaviour_metrics import (
PRIMARY_ZSCORE_COLUMN,
compute_z_score,
zscore_column_key,
)
from src.processing.behaviour_parser impor... |
953d45c4026c656efbb12bd2c70877d8b4bce97e87f9ecea690030a0ec2192ff | Python | 6,450 | 174 | """The class-head column order and membership a checkpoint records.
The class head is positional and nothing in a `state_dict` records which class
owns which column, so a same-width repermutation scores every class against
another class's logits and reads as a mediocre model rather than a broken one.
`Vocabulary` is t... |
345ce465a4017f1440846d2120c26d1d5503eb784a892eec1e8f85911f554452 | Python | 6,453 | 179 | """The label space: which integer means which entity type."""
import numpy
import pytest
from conftest import _BACTERIUM, _ENZYME, _encode, _labels_over, _rows
from d3text import surface_forms, token_labels
from d3text.schema import BRENDA_SCHEMA
def test_every_declared_entity_type_has_its_own_code() -> None:
""... |
b54e044ec108a71f4667e69e9d6faacfd446734d21e58ecb6584de5c703108a8 | Python | 6,453 | 162 | # 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.
"""
This file implements:
Ghazvininejad, Marjan, et al.
"Constant-time machine translation with conditional masked language models."
arXiv pre... |
fef3d47ffe37748bf09e0bbf8351fe27ab7a643b64b8735befac558bbcc9461b | Python | 6,454 | 191 | # 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 itertools
import logging
import os
from collections import OrderedDict
import numpy as np
from fairseq import tokenizer, utils
from fa... |
5e6592a58655b2d0ba628d286939b639653c5acd745d819cb7274ccd071e4629 | Python | 6,456 | 197 | """ This python file contains code for the DataModules that will preprocess the
data and returns it in the form of torch dataloaders.
author: Vishnu Vardhan Dadi
credits: [Leyla Jael Castro, Dietrich Rebholz-Schuhmann]
copyright: GENERAL PUBLIC LICENSE Version 3, 29 June 2007
maintainer: Vishnu Vardhan Dadi, Lukas Ge... |
bc4b2b5335c8db6124a17afbfa86f9b858543d039796805d66b46c56c853c4b3 | Python | 6,461 | 227 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Training PCA and linear models.
@author: Matthew Magoon
"""
from pathlib import Path
from typing import List, Optional
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import linalg
# data info
DATA_PATH = (...) # FIXME: Provide pat... |
6812433a06c1debb6169907ca4d25c4ab7075b33ac8e8d22415bde62fb3b1489 | Python | 6,463 | 200 | from utils.preprocess import *
import torch
import numpy as np
from model.model_factory import *
import networkx as nx
from params.ML_params import require_ML_params
def obtain_placeholders(args, dataset):
if args.method == "sglcn":
adj, features, y_train, y_val, y_test, train_mask, val_mask, test_mask =... |
083075c47388416a42f8f43d093ec4872188d514b778c59e94c24afbacb73259 | Python | 6,475 | 172 | # 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 pathlib import Path
import torch
from fairseq import checkpoint_utils
from fairseq.models import register_model, registe... |
e1abf88189e2941ddf09b3c3b1e230680f12a6f79d619eb8dd1e76f364dcc2e4 | Python | 6,478 | 187 | # -*- coding: utf-8 -*-
"""
Computational cost of the architectures.
Reports, for each model and using the input dimensions and constructor
arguments of the classification experiments: trainable and total parameters,
multiply-accumulate operations for one trial, peak inference memory, and
single-trial latency o... |
111d1301a28a02cee2829e70c99dde551e12741cd8642a6f50f1063fcc576ed6 | Python | 6,479 | 218 | import os
import json
import nipype.pipeline.engine as pe
from fetpype.pipelines.full_pipeline import (
create_surf_pipeline,
)
from fetpype.utils.utils_bids import (
create_datasource,
create_bids_datasink,
create_description_file,
)
from fetpype import VALID_SEGMENTATION
from fetpype.workflows.utils i... |
748003cab2fbcc3d9bc3cd535421cda1fa4d7ca4c4acba67a907518d48979bce | Python | 6,479 | 158 | from __future__ import annotations
from math import ceil, floor
import numpy as np
import pytest
import scvi
@pytest.mark.parametrize("shuffle_set_split", [False, True])
def test_contrastive_datasplitter(
shuffle_set_split: bool,
mock_contrastive_adata_manager,
mock_background_indices,
mock_target_... |
595071eec2c5393004e007d7f878f2a66872e74c48669c630b6b4e93ccb12994 | Python | 6,480 | 140 | import torch
import torch.nn as nn
import torch.nn.functional as F
'''
https://www.cnblogs.com/YongQiVisionIMAX/p/12630769.html
https://github.com/Andrew-Qibin/SPNet/blob/master/models/spnet.py
'''
class StripPooling(nn.Module):
def __init__(self, in_channels, pool_size, norm_layer, up_kwargs):
super(St... |
06089593586ad9d66dc99862e9b88db2404e8bc0a4c00921d427186b7aec3ccd | Python | 6,481 | 168 | from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import time
from PyQt5.QtGui import *
import cv2 as cv
import os
import numpy as np
from PIL import Image
import pyqtgraph as pg
import sys
class Realtime_Process(QWidget):
def __init__(self,Serial_path,Realtimestatus):
# self.ma... |
7518c05704f8a0e98a8073f7e30c1a26e648d739b0a34ad2f38588679b631cbd | Python | 6,481 | 161 | import os
import argparse
def none_or_float(value):
if value.lower() == "none":
return None
try:
return float(value)
except ValueError:
raise argparse.ArgumentTypeError(f"Invalid float value: {value}")
def parse_base_args():
"""
Parse command line arguments
"""
p... |
25c081ae23e8a53d8b824ac03081674bb5bc74c335bb9efeca1d885c27a71474 | Python | 6,485 | 182 | from PyQt6.QtWidgets import (
QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QGridLayout,
QPushButton, QLabel, QGraphicsView,
QCheckBox, QScrollArea, QFrame, QComboBox, # ← ここに QComboBox を追加
QDoubleSpinBox, QSpinBox # ✅ ← これを追加
)
from PyQt6.QtGui import QColor, QPixmap
from PyQt6.QtCore import... |
4700945ccd99690d121300fd868e1c96feb0d7f15fb991cf8c7753994bdcf4db | Python | 6,485 | 102 | if __name__ == '__main__':
from nnunetv2.paths import nnUNet_results, nnUNet_raw
import torch
from batchgenerators.utilities.file_and_folder_operations import join
from nnunetv2.inference.predict_from_raw_data import nnUNetPredictor
from nnunetv2.imageio.simpleitk_reader_writer import SimpleITKIO
... |
f51adf3903e04ca031cb1222527cf16542a94286ad6b0880ba1f35219d8ce71a | Python | 6,487 | 167 | import os
import pickle
import numpy as np
import pytest
import torch
import scvi.module._autozivae as autozivae_module
from scvi.data import synthetic_iid
from scvi.model import AUTOZI
from scvi.module import AutoZIVAE
from scvi.utils import attrdict
def test_saving_and_loading(save_path):
def legacy_save(
... |
bf0c7f9405430e1f1af52d1725019447356ef529066abd7f28558b732c1a95fc | Python | 6,489 | 166 | """Active learning iteration 1 — select 50 high-variance perovskites.
Strategy: bootstrap aggregation of Ridge regressions on the 93 SIESTA-labelled
cohesive energies (1F+2F basis, α=10). For each candidate (1532 GFN-FF-OK
records minus the 93 already-SIESTA), predict with K=50 bootstrap models and
take the predictio... |
8c2fb58fcb0b5a3f322e2056a298baf080714fc6082f748b58fbdd8c70971434 | Python | 6,491 | 102 | if __name__ == '__main__':
from nnunetv2.paths import nnUNet_results, nnUNet_raw
import torch
from batchgenerators.utilities.file_and_folder_operations import join
from nnunetv2.inference.predict_from_raw_data import nnUNetPredictor
from nnunetv2.imageio.simpleitk_reader_writer import SimpleITKIO
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.