sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
00e49322a58f0560e46701d74f19f176c14c213671fa81a5007d43b568c7b738
Python
15,766
319
import os import torch import hydra from omegaconf import OmegaConf from sklearn.metrics import roc_auc_score from dig.xgraph.method import PGExplainer from dig.xgraph.evaluation import XCollector from dig.xgraph.method.base_explainer import ExplainerBase from dig.xgraph.utils.compatibility import compatible_state_dic...
c8ef0d1d25ddecbcb35c4e703422282098b0c8ba577596c9936510137de45de0
Python
15,770
345
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " from mpi4py import MPI import numpy as np from nest_elephant_tvb.transformation.communic...
0106b6cb4701a0264c005d691e4dd887ec9b78107572977c14f7f939308fcf3e
Python
15,774
484
from torch_cluster import radius_graph from torch_geometric.nn import GraphConv, GraphNorm from torch_geometric.nn import inits from torch_scatter import scatter, scatter_min try: from ocpmodels.common.registry import registry from ocpmodels.common.utils import conditional_grad, get_pbc_distances, radius_grap...
a345b44e8673513de922d939860af46fceac4524c40906eb4a29ec8b2d523f4a
Python
15,788
444
# Copyright (c) 2020 PaddlePaddle 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 # # Un...
195a32e084975fea55a85bd7f5aee31c87d4df693d6744dab37d2313b8d838c5
Python
15,810
467
#cript containing the modular version of the code # so far we have only implemented the non_linear_embedding layer # for simplicity we can just use dense layers for the merge operations import numpy as np # import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn import torch.nn.functional as F...
a4bb447b72e249b12980bb2054a894c3123bb2111c11ef1eea0d4cb5180063cd
Python
15,811
445
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import collectio...
824964960d43f871b008ac15ab0767473dd418c50103e5c6cd07143cb4fa51b4
Python
15,813
482
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Workspace module.""" import logging import os import shutil import subprocess # nosec import sys import tempfile from hashlib import sha256 from pathlib import Path from typing import Union from click import Choice, echo, group, optio...
4c4fb21fde665624ab71259cb2e15f65c91c3a9305f503cfa2fc745d02725263
Python
15,834
386
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Dec 9 10:35:43 2018 @author: ngritti """ import numpy as np from matplotlib import pyplot as plt from skimage.filters import threshold_otsu import sys, os,tqdm from tifffile import imsave from multiprocessing import Pool import matplotlib as mpl impor...
81da5ec5edfd6749eceb4f7a6f7b82204e9f9faaf3ab639bf3b399806f86e2c2
Python
15,857
289
"""Publication retrieval and record-level receptor association. ``score``, ``lift`` and ``lift_family`` query publication postings. ``receptor_lift`` uses the definitive record and chain tables to measure assigned epitope associations. """ from __future__ import annotations from dataclasses import dataclass import p...
6056a963c2cc01737da41e18106996ec2fcd789f186c0eecaccdbc1f50693c11
Python
15,874
291
import numpy as np import cv2 from scipy import sparse from skimage.segmentation import watershed def watershed_CV(img): '''Apply watershed from OpenCV to further segment the mask "img". Adapted from [https://docs.opencv.org/master/d3/db4/tutorial_py_watershed.html] Inputs: img (2D numpy.nd...
d9f362776befe1cd0f41d0bc9ece2f5f3e1f9dc7786b50a64a810f5a0325b25a
Python
15,880
448
import sys import os import torch import numpy as np from torch_geometric.data.dataset import Dataset from torch_geometric.data.data import Data from tqdm import tqdm import h5py import copy from .community_pooling import community_detection, community_pooling def DivideDataSet(dataset, percent=[0.8, 0.2], shuffle=T...
9fa6b1be4b18a5c33173bd46e57a9f898e55fd6e50cb12092d19baacde239a45
Python
15,882
287
"""Reported peptides and allele-conditioned presentation predictions. Predictions annotate observations; they never rewrite them or supply identity keys. The reference panel is an explicit, checksum-verified input. No download or stored calibration is used during assembly. Each supported MHC species/class is scored on...
105cad6dab0f8010ca9941aea88dd9559707f6fc73531c5ae4ea1ce6ff63f728
Python
15,896
348
######################################################################### # SlumberNet: Sleep Stage Classification using Residual Neural Networks # ######################################################################### # This Python script implements SlumberNet, a deep learning model for classifying # sleep stages ...
037fd4344ac5ba3c1ee6db435a7e3946f754a76de0aeb8f496241b4e4c92c60d
Python
15,898
407
import asyncio import concurrent.futures import json import logging import queue from pathlib import Path from collections import defaultdict import numpy as np import scipy.io as sio from ScanImageTiffReader import ScanImageTiffReader from ..alerts import Alert from ..analysis.traces import process_data from ..guis ...
aae93169cf954171c822d6cc8991830f6633be418d2dee26729f522df8a8e6bf
Python
15,904
424
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # OS stuff import os import sys import warnings from pathlib import Path from tqdm import tqdm # Computational stuff import numpy as np import matplotlib as mplb import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpecFromSubplotSpec from matplotlib impor...
30c9cbe4f0e1f3d49fd0941440af894ec9de37ea570347359ffd7cba92281af3
Python
15,905
384
import torch.utils.data as data import torchvision.transforms as transforms from PIL import Image import os import os.path import numpy as np try: import accimage except ImportError: accimage = None import pdb from mapcrop import MapCrop # , MultiscaleMapCrop from torch.nn import functional as F import torch i...
3f8ad29b76c705ccdd8476e3657f391e7ecd7d93f439e561f674aeaf800bb7ff
Python
15,909
323
#!/usr/bin/env python3 # # Sniffles2 # A fast structural variant caller for long-read sequencing data # # Created: 15.08.2021 # Author: Moritz Smolka # Contact: moritz.g.smolka@gmail.com # import pysam import os from sniffles import sv from sniffles import util def format_info(k,v): if isinstance(v,float): ...
39dfea27e72aa5b84b07b5fe65d7a71576322551c378d479b646e4c8b2035050
Python
15,914
399
import math import paddle import numpy as np import paddle.nn as nn import paddle.nn.functional as F from ppdet.core.workspace import register from ppdet.modeling.initializer import normal_ from ppdet.modeling.lane_utils import Lane from ppdet.modeling.losses import line_iou from ppdet.modeling.clrnet_utils import ROI...
c05afd643fd83bb482ff8d72d4fc80296602d94bfc074063738693172e2b9597
Python
15,915
503
import argparse from typing import Optional from data.sampler import arguments_sampler from data.collate_fns import arguments_collate_fn from options.utils import load_config_file from data.datasets import arguments_dataset from cvnets import arguments_model, arguments_nn_layers, arguments_ema from loss_fn import argu...
d5d3b56ba9c18fc6fdcb9787b2749806bf1c2e928de4a7db84ac70b0086f0a1d
Python
15,918
456
from __future__ import absolute_import import numpy as np import scipy import torch from pysurvival.models import BaseModel from pysurvival import utils, HAS_GPU from pysurvival.utils import optimization as opt from pysurvival.utils import neural_networks as nn class BaseParametricModel(BaseModel): """ Base class...
56888ebab5a4662e10728cfc6c54a5f674d534f660e3c245e04f3d1576a24396
Python
15,930
458
import numpy as np # from brian2.units import * from scipy.stats import lognorm, norm from scipy.interpolate import UnivariateSpline from optimization import slsqpopt, blahut_arimoto, jimbokunisawa import pickle import warnings import os from matplotlib.pyplot import get_cmap ELEMENTARY_CHARGE = 1.6e-19 AP_COST = 0.12...
f0f44dfc59116e34741d3e7db3d5ecd4cf22f8a2cc9714d9fa330404c7e24fc6
Python
15,933
465
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cogn...
7ebaa55f03b5f8da467f0809b57fd5475aa99dcacf0283d931bd82dff1f5f28c
Python
15,977
507
from anthropic import Anthropic as AnthropicClient from openai import OpenAI as OpenAIClient from anthropic.types.message_create_params import MessageCreateParamsNonStreaming from anthropic.types.messages.batch_create_params import Request from typing import Dict, List from tqdm import tqdm import pandas as pd import r...
8fc14f58aea93ef3ce2c3681c144ee59dc61c785ebfb26ae8c15e6f8eec1536e
Python
16,001
271
"""What a chunk does to the database, for the pull request that adds it. `vdjdb qc` says whether a chunk is well formed. That is a different question from whether it is the chunk the curator meant to submit, and the second one is answered by comparing it against the corpus it is joining: a mistyped epitope is perfectl...
f5731e896d72ca8b652a94ef07c3a71db1a119627d06d6fc41a6435028d75031
Python
16,005
435
import warnings from numbers import Integral, Real import numpy as np from joblib import effective_n_jobs from sklearn.isotonic import IsotonicRegression from sklearn.metrics import euclidean_distances from sklearn.utils import check_array, check_random_state, check_symmetric from sklearn.utils._param_validation impor...
9136c3d48f7ba6b24222215665f159cd81e24afed8c4c9af17686bd74b6d96df
Python
16,008
474
import datetime import hashlib import hmac import selectors import subprocess import time import urllib.error import urllib.parse import urllib.request import xml.etree.ElementTree as ET import uuid from typing import Dict, List, Optional, Tuple, cast import pytest from chromadb.api import ClientAPI from chromadb.api...
49418b37c937c34136a4be6b537ddcfb5a49259351106e9f5ce99aac18718778
Python
16,045
426
"""Bootstrap resampling for `BrainData` — aggregate statistics and Ridge model statistics. `BrainData.bootstrap` delegates here. """ import numpy as np from .utils import _result_from_array #: Statistics that reduce `bd.data` directly and need no fitted model. SIMPLE_STATS = ("mean", "median", "std", "sum", "min", ...
34ba62a81aa8c0be0e03889e33c28beb42ceb91d8206c5811b0dbc217aed5fc4
Python
16,050
451
from __future__ import absolute_import import numpy as np import pandas as pd import random import scipy import copy from pysurvival import utils from pysurvival.models import BaseModel # %matplotlib inline # List of Survival Distributions DISTRIBUTIONS = ['Exponential', 'Weibull', '...
a0493275d9492b6dbf5ef1e01cdda1583e5c195d7b0982811f57aac7aa76a839
Python
16,072
372
"""The tiny AtomicDipolesMACE anchor reproduces its committed reference. The energy anchors next door pin an energy assembly. This one pins the other half of the model zoo: a graph dipole, which is a scatter-sum of per-atom vectors plus a fixed-charge baseline and shares no arithmetic with an energy. RET-4 deletes the...
83323c8a69e9f20bd7546ab70360a2fa41b5aa90d141a6499831ed5973f70892
Python
16,083
455
"""Tests for the frozen `FitResult` record `BrainData.fit` leaves on `.model`.""" from dataclasses import FrozenInstanceError import nibabel as nib import numpy as np import polars as pl import pytest from nltools.data import BrainData, DesignMatrix, FitResult N_SAMPLES, N_VOXELS = 20, 8 @pytest.fixture def maps...
9f4dadde4eeb3847410eeec409866ecb5751c5f0630f54822de26b9fbf732858
Python
16,090
479
from numba import jit import numpy as np import math from fimpy.utilities import fast_pearson import itertools from fimpy.utilities import to_4d, to_3d from lightparam import Param def correlation_map(video: np.ndarray, window_size=(1, 3, 3)) -> np.ndarray: """Calculate the correlation map of a video :param ...
f13f1eaf334a72e3ca202a0fe56f0eca167d704dbbb0897837205bfe086425ea
Python
16,097
488
# 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 typing import Tuple, List import torch import torch.nn.functional as F from fairseq.models import FairseqEncoder from fairseq.models.spe...
ba0ad2b98b750c9e4d5775a70532c3560c675e505ede425712bd96a35557242d
Python
16,100
434
import inspect import numpy as np import pytest from nltools.data import BrainData from nltools.data.results import BootstrapResult from nltools.mask import create_sphere SUMMARY_FIELDS = ("estimate", "standard_error", "ci_lower", "ci_upper") # Only `bootstrap` emits these two quality advisories, and the bootstrap ...
09c037dcf657f78aa738e41a1808426dc788b3cd3650a22fd6635e4156c68f9f
Python
16,121
292
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
5c1522b1790ea3aca89953fa4b71a1c3fc5a2747e01d4998fd3d787c0a1ba69a
Python
16,125
288
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Moun...
4f14729d94d4b4d09e1a49bbd8fe533f267606e82153296ebffea7f4185f7f36
Python
16,146
460
"""The n-dimensional hyperbolic space. The n-dimensional hyperbolic space embedded with the hyperboloid representation (embedded in minkowsky space). Lead author: Nina Miolane. """ import math import geomstats.algebra_utils as utils import geomstats.backend as gs from geomstats.geometry._hyperbolic import _Hyperbol...
bc56a9fb162b878d274e2cdf787aa441e62370c344b98f1829c9b8117a8dad44
Python
16,147
453
import numpy as np import xarray as xr from unittest.mock import patch, create_autospec from numpy.testing import assert_allclose, assert_array_almost_equal, assert_raises, assert_warns from xarray.testing import assert_equal as assert_xr_equal, assert_allclose as assert_xr_allclose from testtools import assert_array...
b9532e79090b9e3e291f28f947759a9bcf416ca88ee51c02b2b44c543e765330
Python
16,148
476
"""A Python class containing an implementation of MPPCA denoising for magnitude and/or phase images. Inputs are a 4D image with dimensions (X x Y x Z x N) Usage: import mpcomplex as mp imgdn, sigma, nparameters = mp.denoise(img, kernel=[5, 5, 5], shrinkage='frob', algorithm=veraart) ...
e5186eefcb92162d76c89ed2ea0da07a753f6ca9963d241882aa1d7716a24e68
Python
16,156
389
#/usr/bin/python from __future__ import print_function import argparse import torch import pickle import numpy as np import os import math import random import sys import matplotlib.pyplot as plt import data import scipy.io from os.path import normpath, basename from torch import nn, optim from torch.nn import...
8a705bb2e029ce43bc136bafb7ace2aa374b61677a0619b014cc66342ba23c57
Python
16,178
376
import os, torch, json, ast import os.path as osp import ssl from itertools import repeat import numpy as np from rdkit import Chem import pandas as pd import networkx as nx from six.moves import urllib from torch_geometric.data import Data, InMemoryDataset, download_url bond_type_to_int = {Chem.BondType.SINGLE: 0, Ch...
dfdee6c6a6a7f8eb94e3dc753a8fbc15480277fdd8ddc2f4546eb33992f82b1b
Python
16,183
343
import torch import torch.nn.functional as F from torch_scatter import scatter_mean, scatter_softmax, scatter_add, scatter_sum from torch_geometric.nn import MessagePassing, GCNConv, NNConv, GINConv from torch_geometric.utils import degree import numpy as np class MLP(torch.nn.Module): def __init__...
dfc25971f35ac826b26a8dd36eca7baf25abddac6ac4b011696f5f874026dd80
Python
16,186
390
#!/usr/bin/env python3 # # Sniffles2 # A fast structural variant caller for long-read sequencing data # # Created: 29.08.2021 # Author: Moritz Smolka # Maintainer: Hermann Romanek # Contact: sniffles@romanek.at # import logging from collections import defaultdict from dataclasses import dataclass import s...
b16fd7869c1fbe273e25310dfa97ff8c261d314784b86019346ff01c9365feb2
Python
16,199
413
"""Unit tests for mace/tools/finetuning_utils.py. Builds two small ScaleShiftMACE models in-process (no network, no pretrained checkpoints): a "foundation" over elements [1, 6, 8] and a target over the subset [1, 8]. Checks that load_foundations_elements transfers weights (element-subselected embeddings, scale/shift, ...
f80f0a3bb75ea81422a20bb61ba2b1f6e6cbbb88d8a630d75813355aec878ca0
Python
16,214
408
import argparse import glob import importlib import os import numpy as np import shutil import mne import tensorflow as tf import matplotlib.pyplot as plt from data import load_data, get_subject_files from model import TinySleepNet from minibatching import (iterate_minibatches, iterate_batch_...
eb376ae8f5d95c1513e93e5258c30f7fb3443c4dfe3b7664d9c3913c71e0ab06
Python
16,216
474
import os import random import numpy as np import torch from torch.utils.data import DataLoader, TensorDataset from torchvision import datasets, transforms import utils as u logger = u.getLogger(__name__) class AngleDataset(TensorDataset): def __init__( self, num_samples=100, num_targ...
ae5b5b82f0f69f6306ee9bb0ea4839e9fb3055b558e4467a2413807cd988d551
Python
16,219
469
# Script containing the modular version of the code # so far we have only implemented the non_linear_embedding layer # for simplicity we can just use dense layers for the merge operations import numpy as np # import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import data ...
7a8f06f5f6dcfedca545496e3b4156a551927b4a225677d4c0b03125c7268621
Python
16,220
287
"""Fit v3.2a/b offline from declared inputs, keeping assay data private. Set TCRVDB_PATH or pass --tcrvdb-path. The selected-records CSV (or test.csv member of a ZIP) uses anchor-inclusive junctions. No source paths or identities are written into model parameters. Inputs are read anew on each invocation. """ from __fu...
99e7710538f6af7e63c2fb96907e7925d4b6586a9326b92515ad35531e972481
Python
16,240
434
"""A Python class containing an implimentation of MPPCA denoising. Inputs are a 4D image with dimentions (X x Y x Z x N) Usage: import mpdenoise as mp imgdn, sigma, nparameters = mp.denoise(img, kernel=[7,7,7], M=60, shrinkage='frobenius') LICENCE Authors: Benjamin Ades-Aron (...
0adaa9094e38383fa14393bc9615b78657c103297c22f4fa57e1f455940cdfea
Python
16,254
337
# Copyright (c) 2021 PaddlePaddle 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 ...
b9031e4e5d3af1f16fb0048be43b92019d6d21a33100e33ac81981a960615f35
Python
16,254
490
import numpy as np import cv2 import copy def decode_image(im): im = np.array(im) img_info = { "im_shape": np.array( im.shape[:2], dtype=np.float32), "scale_factor": np.array( [1., 1.], dtype=np.float32) } return im, img_info class Resize(object): """resiz...
341883a57e4d06bb2c28ce633182feaf287feebeaf14cd532cec8862bd8a7c1b
Python
16,261
437
"""Mutation and numerical contracts for BrainData result ownership.""" from copy import copy, deepcopy import nibabel as nib import numpy as np import pandas as pd import polars as pl import pytest from nilearn.maskers import NiftiMasker from nltools.data import BrainData, DesignMatrix from nltools.data.braindata.ut...
d2463ef0ed130215ad7c89adbdaa3cc07a4ce0e35ac11eea59710cd04274fa13
Python
16,290
487
# copyright (c) 2023 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
fbfe9e378f7c7278ef0b4ee1bcb95346ba9f9047139ccca5af5429b130f8a6a8
Python
16,305
506
import math import geomstats.backend as gs from geomstats.test.data import TestData from .base import VectorSpaceOpenSetTestData from .matrices import MatricesMetricTestData from .pullback_metric import PullbackDiffeoMetricTestData from .riemannian_metric import RiemannianMetricTestData SQRT_2 = math.sqrt(2.0) LN_2 ...
737586ecf1392665e596291cf5e313ecccbbaac7275734d023996e470271e8f1
Python
16,319
430
import torch import torch.nn as nn from torch.autograd import Variable import numpy as np import six import copy from collections import defaultdict from pdb import set_trace as st from metroem import helpers from metroem.masks import get_mse_and_smoothness_masks from metroem.alignment import align_sample def lap(fi...
0fc5e43a8d43e812db372587114b8299987097a12220bd791b342b8691b496e5
Python
16,322
486
"""Tests for pandas-backed Plot FI summary calculations.""" import warnings from types import SimpleNamespace from typing import Any from unittest.mock import Mock import numpy as np import pandas as pd import pandas.testing as pdt import pytest from qtpy import QtCore, QtWidgets from sanpy.interface.plugins.plotFi ...
6a10f86afe41f138fe9892c95af8da1fffb4765f492b1ec1d4dec72b6de4d10d
Python
16,342
486
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cogn...
60cdd4da07585a2138f4f3d3c51ba4d8fb9818ac2bb670d96401adc0109f35c3
Python
16,343
399
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import math from e3nn import o3 from nequip.data import AtomicDataDict from nequip.nn import ( GraphModel, SequentialGraphNetwork, ScalarMLP, PerTypeScaleShift, ConvNetLayer, F...
0e9ad551f63c0c1cb5a2b1c7d7784475599d8eb40093f429680330d1a31f1463
Python
16,347
267
"""Paired-junction model associations and optional complete variable-domain proof.""" from __future__ import annotations import os import tarfile from pathlib import Path import polars as pl from .master import HASH_FIELDS CONTEXT = ('species', 'antigen.epitope', 'mhc.a', 'mhc.b', 'mhc.class') IDENTITY = ('species'...
1473df957614c641b3910b7ec58a9cbb81e4a840302303965221d3fb1924cc8f
Python
16,382
474
""" Script to sample from a trained diffusion model """ import multiprocessing import os, sys import argparse import logging import json from pathlib import Path from typing import * import numpy as np import pandas as pd import mpl_scatter_density from matplotlib import pyplot as plt from astropy.visualization import...
3fa10f48a496b0a6811c2436430e6f37d89e9d0732effbf8c41905e59bfc8502
Python
16,387
468
# Copyright (c) 2021 PaddlePaddle 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 ap...
4444ee0f8ed0641e1d26647be3e6e581d5495a5c27d5cf60b8a40d5a491d8109
Python
16,391
473
# Copyright (c) 2021 PaddlePaddle 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 # # Un...
661c6fd2cf1027e8cc6c5f84f17bedb7d944b95cda804a14bff0a28866d03571
Python
16,397
381
import torch import torch.nn.functional as F import torch.nn as nn import ISNetFunctions import LRPDenseNet import pytorch_lightning as pl import warnings from collections import OrderedDict import numpy as np from torch.autograd import Variable import torch.autograd as ag import torchvision import sys sys.path.append...
210918866ac1934bec08486efa3d8ff374a555305e23aca844eafc9f2f61ae0a
Python
16,398
463
import pytest import itertools import renderapi from test_data import (render_params, montage_raw_tilespecs_json, montage_parameters) from bigfeta import bigfeta from bigfeta import solve import json from marshmallow.exceptions import ValidationError import copy import os i...
5ec46d4110a4ede4c804ea3d3ddc1e8b861504cbca1f9b202872727eb8fba62f
Python
16,404
379
"""The published foundation models reproduce their committed references. Three artifacts, two tiers. The tracked MACE-MPA-0 medium checkpoint is in this repository, so `mace_mp()` with no model argument short-circuits to it and touches no network: that golden carries no marker and runs on every pull request, on all fo...
14ad9836c11612fe95b6df436b71798a0a0580ab30335571885c3c2cf6cdd053
Python
16,409
442
""" Code to convert from angles between residues to XYZ coordinates. """ import functools import gzip import os import logging import glob from collections import namedtuple, defaultdict from itertools import groupby from typing import * import warnings import numpy as np import pandas as pd import biotite.structure...
78018af68c7bab82887bb868aff27a24162b1cc5c7f68432beac9648d9ef6a17
Python
16,409
356
""" reproduce RF, SVM from https://github.com/nsf-c-cas/yield-rxn/blob/master/scripts/ML_models_testing.py """ import argparse from utils_ds import * import pickle import pandas as pd import numpy as np import warnings from collections import defaultdict import random from sklearn.ensemble import RandomForestRegressor...
cf05bdec00fcaeb180a4849b14d5b9334eda0d31dbb500d42b9b0d28b3ca4da4
Python
16,411
449
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """AggregatorGRPCClient module.""" import logging import time from typing import Optional, Tuple import grpc from openfl.protocols import aggregator_pb2, aggregator_pb2_grpc, utils from openfl.protocols.aggregator_client_interface import...
666a946bc5edff7d06b6525945c6f9592c29a809a91b4c9374a1bd507c1790f2
Python
16,423
346
import tensorflow as tf import variational.layers as variational_layers import variational.activations as variational_activations from common.models.local_pooling import VariationalMaxPool2D class VariationalConvBlock(tf.keras.layers.Layer): def __init__(self, filters, use_bias...
162736d390a8cf9290c9219f093174aebadd1e15a637987faaa6fb97b2b620c7
Python
16,441
470
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
8e1ed150d4c214e6e6fbbbd4f59d742830d9e49b198072c6af7ce780b4f1fcee
Python
16,444
289
"""Instantiate experiment object for imgae data. This file runs the experiment with code designed specifically for image data; i.e., the feature attribution is performed on pixels. """ import enum from typing import Any, Callable, Optional import numpy as np import pandas as pd from sklearn.model_selection import tr...
c42e4bf99b6e7134832870f5ab53eddec96267cf87fb5fe5b02b533f20842402
Python
16,458
385
from evaluation import community_detection, link_prediction from input_data import create_adjacency from louvain import * from model import GCNModelAE, GCNModelVAE,GCNModelVAE3D from optimizer import OptimizerAE, OptimizerVAE from preprocessing import * from sampling import get_distribution, node_sampling import numpy...
61cff94e25c22a79c659eaf95d412e4cbcb3087616355fecf689d2a750ac569b
Python
16,466
397
# 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...
77b4317ca6599d251ece09973ff0b8fdee536b7b453b7fce6bca52d223831bdc
Python
16,467
494
import numpy as np import cv2 import copy def decode_image(img_path): with open(img_path, 'rb') as f: im_read = f.read() data = np.frombuffer(im_read, dtype='uint8') im = cv2.imdecode(data, 1) # BGR mode, but need RGB mode im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB) img_info = { "im_...
10ce875d363388bb14c964cf0e17e13ab5704b1a579f05ca4091c1acaea4d92a
Python
16,469
340
import numpy as np # import tensorflow as tf import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import os ''' follows files: - P1_stdp_v4_cluster_ILAB.py - P1_readout_learning_v0_cluster_ILAB.py completely rewritten version of - stdp - output rate learning combined into one single update func...
b0b01d792cf6f68f6f264958ac8bfc704130d134e30399f006dd07cdbd01552f
Python
16,480
477
""" Wrapper class for o3.Linear that optionally uses cuet.Linear """ import dataclasses import types from typing import Any, List, Optional import torch from e3nn import o3 from mace.modules.symmetric_contraction import SymmetricContraction from mace.tools.cg import O3_e3nn from mace.tools.scatter import scatter_sum...
60f61a4e11d90aec47309d493fa29bc57c325dc99bb0c106abf2394240031393
Python
16,484
500
# in this script to fellow fairly closely Zou et al # but the create a equivariant descriptor for each type # of tree topology from the beggining # We use a an embedding "across sequences" instead to # within sequences. import numpy as np # import matplotlib.pyplot as plt import torch torch.manual_seed(0) import h...
31c9b1da0ea50057077338d56898502404429fb05aea583a6a01e1ee0013374f
Python
16,508
333
import tensorflow as tf from keras import backend as K from tensorflow.python.keras import losses def dice_coeff(y_true, y_pred): '''Dice coefficient between two arrays. Inputs: y_true (tf.TensorArray): GT array y_pred (tf.TensorArray): Predicted array by CNN Outputs: score (tf....
b1411ea6627d3a64149cee9439663241a71954c0a73f311e818c27c6ace663cb
Python
16,509
498
# in this script to fellow fairly closely Zou et al # but the create a equivariant descriptor for each type # of tree topology from the beggining # We use a an embedding "across sequences" instead to # within sequences. # this is an optimized version of the lstm network import numpy as np # import matplotlib.pyplot...
3eebee5df43fe2b7a2b83e8e84e76ccc70cce74f45df038f9e99046aebeb7332
Python
16,524
459
import tempfile from typing import Dict, Optional, Type, Iterable import torch from .monitors import AbstractMonitor from .nodes import Nodes, CSRMNodes from .topology import AbstractConnection from ..learning.reward import AbstractReward def load(file_name: str, map_location: str = "cpu", learning: bool = None) ->...
5bfb59f3bcf782e9a110c7a1bfc0c4f7a5d7694bb3352d2503867237c9b235ec
Python
16,531
474
import numpy as np import torch # we fix the random seed for reproducibility torch.manual_seed(0) import torch.nn as nn from torch.utils import data import itertools import json import sys import time from os import path sys.path.insert(0, '../') import gc gc.collect() device = torch.device("cuda:0" if torch.cuda....
596edb0c40dde18ebd5961dcae19ca458606902109da544238ab0e6b6f4815af
Python
16,532
471
from pdb import set_trace as st import glob import h5py import os import re import torch import torchfields import numpy as np from collections import defaultdict from metroem.alignment import align_sample from metroem import helpers class MyConcatDataset(torch.utils.data.ConcatDataset): def __init__(self, *kar...
ed1b90ca09ed7fd0a336ca5ffd50a9d6ddf1fb5900116b74c02bb422750f1074
Python
16,543
383
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """ Train a YOLOv5 classifier model on a classification dataset. Usage - Single-GPU training: $ python classify/train.py --model yolov5s-cls.pt --data imagenette160 --epochs 5 --img 224 Usage - Multi-GPU DDP training: $ python -m torch.distri...
9f639adc21af9f55b1b70ac2d4e85c80ce6a8f42ae0083637ef5cc444a93525c
Python
16,549
326
import torch import torch.nn as nn import numpy as np from rdkit import Chem from dig.ggraph.utils import check_valency, convert_radical_electrons_to_hydrogens from .disgraphaf import DisGraphAF class GraphFlowModel(nn.Module): def __init__(self, model_conf_dict): super(GraphFlowModel, self).__init__() ...
28e3d44797de2d28db89c17b891cb111ca61fce89510cc3fa3a774146f39a2bd
Python
16,554
444
import logging import numpy as np from qtpy.QtCore import Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtCore import QEvent, Qt from qtpy.QtGui import QColorConstants, QIcon, QKeyEvent from qtpy.QtWidgets import ( QComboBox, QGroupBox, QHBoxLayout, QLabel, QMessageBox, QPushButton...
7f22e1b549011cfed901526dbda3472f4915e2a10a3077dbbbfeb5519a84e78f
Python
16,554
507
import math import random import warnings import cv2 import torch import numpy as np from torchvision import transforms def gray_scale(image: np.ndarray) -> np.ndarray: # language=rst """ Converts RGB image into grayscale. :param image: RGB image. :return: Gray-scaled image. """ return c...
8a504fb670081ac792a2d17afb2e0468eac7b0bc64cc2f99ac78f6ce9df2055a
Python
16,567
448
#!/usr/bin/env python3 import logging import math from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from fairseq import checkpoint_utils, utils from fairseq.data.data_utils import lengths_to_padding_mask from fairseq.models import ( FairseqEncoder, ...
4992ed23dda7c9a02e9e40f8e24206723d1cc655dd2007937edf1bc11c9f0d30
Python
16,568
456
# Copyright (c) 2020 PaddlePaddle 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 app...
fd1dcffcb5ae50ef823a4eff17d01810fd406152dbd2ae2a406103e7950e0876
Python
16,580
192
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
c05df4681dbc78fee5cfdceacc1f2c644fa20fb09f9af3968451752c8bfff21d
Python
16,582
423
import sys import torch from torch import nn from torch_cluster import knn_graph, radius_graph import torch.nn.functional as F from torch_scatter import scatter_add, scatter_max import numpy as np from sklearn.mixture import GaussianMixture class AttentionModule(nn.Module): def __init__(self, input_size): ...
a92ae3150b85869f697c0a101fdcf9c26d0fa8dfd24e1748ecf526e5768804d1
Python
16,601
524
"""Matplotlib helpers for plotting SanPy recordings and analysis results.""" from typing import Any, Optional, TYPE_CHECKING import numpy as np import scipy.signal import sanpy from sanpy.sanpyLogger import get_logger if TYPE_CHECKING: from matplotlib.axes import Axes from matplotlib.figure import Figure ...
4d1c72e046fa03d6ba83f9f0a6b326344963cd5779296c8c9663f999db99cb20
Python
16,609
368
import numpy as np import torch import torch.nn as nn import math from torch.autograd import Variable import torch.nn.functional as F from SNN_layers.spike_neuron import *# ## readout layer class readout_integrator_test(nn.Module): def __init__(self,input_dim,output_dim, tau_minitializer = 'unifo...
4f72cc8eaebc6b11992f2fe787f002aaed737774bb6a5651612e375f21c951d9
Python
16,626
391
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Tensor codec tests module.""" from unittest import mock import numpy as np import pytest from openfl.pipelines import NoCompressionPipeline from openfl.pipelines import SKCPipeline from openfl.pipelines import TensorCodec from open...
f6a0d315f23a8bb2340a1d285ec3d6fe3bb8b4b56009271e61e9433b4941ba15
Python
16,630
436
# Copyright (c) 2021 PaddlePaddle 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 appli...
47b1d46b22e1f61ba199ddc8f1b3d41d418cf33aa7d4ada06e40bbdd71a7b7a7
Python
16,631
416
# Copyright (c) 2020 PaddlePaddle 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 appli...
49e4ce0049f6142c4afbcfd66be0bde575a0d8726b2b6c403d237b86a81c9c63
Python
16,631
422
"""Recipe for the committed end-to-end training regression set. ``datasets/regression_train.xyz`` is the dataset the legacy-versus-rewrite training comparison is run on: small enough to train in seconds on one CPU core, and deliberately *diverse* -- isolated atoms, molecules, slabs and bulk cells, all three anchor ele...
b01060ffebbe26d5182613ba2212e1ea3fb6c9a8bb54c686781e025c6efbe259
Python
16,634
515
from turtle import clearstamps import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler import numpy as np import pickle import time import os import sys file_dir = os.path.dirname(__file__) sys.path.append(file_dir) from model import * try: ...
5ff5c9145ae4de0e86da33070fa86b899a0ad5356e1ce21b13a2e47f0917215b
Python
16,639
309
"""The epitope catalogue: what VDJdb knows about each antigen, and which MHC presents it. Two tidy tables, both derived from ``records`` and both shipped: =============== ================================================= =============================== ``epitopes`` PK ``(antigen.epitope, antigen.species)`` ...
d5845bee5242229a7411f8e361222e91f648b81309ee9c83cf086f0b7433cf52
Python
16,684
494
"""Statistical Manifold of Gamma distributions with the Fisher metric. The natural coordinate system for a Gamma Distribution is: point = [kappa, nu], where kappa is the shape parameter, and nu the rate, or 1/scale. However, information geometry most often works with standard coordinates, given by: point = [kappa, ga...
88f8626d98fd2c2c3259d77420fa6db75a0439b54d840d52a03cdc7ab711f2cb
Python
16,685
499
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # Working with DesignMatrix — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.24.0" app = marimo.App(width=...
06a56de01bc498b46df709233893a708c052c86e7fbb4e4105681b13c921bae1
Python
16,728
541
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import os from p...