sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
36e2a6dff2e855bee9612ddfdf5613981097c5c2990754c7071b789f025e79f3 | Python | 8,897 | 259 | # Plots errors, unified model criteria, smoothed population rates, and spike rasters
# used in Fig 4
from os.path import join
from get_paths import *
import pickle
import matplotlib.pyplot as plt
import numpy as np
from os.path import join
import objective
from colors_paultol import *
save_flag = 0
#... |
a3ae155d714b3114773a48b7f2284a6765ac3ae130d0f598c769be1593a9fea0 | Python | 8,899 | 127 | """KEYSTONES.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02k-KEYSTONES.md
Are the two cells a property of the lobe's distance from its line? M: the census repeated along paths towards the line (random
unlabelled local neurons made excitatory, v2LN30 kept inhibitory) and away from it (laboratory-cholinergic... |
91c4e28fca31b95c2e9619aca6160513ecfb9cc5809a57792f58b8dacc328c97 | Python | 8,900 | 270 | # -*- coding: utf-8 -*-
"""
Created on Fri May 24 14:42:38 2024
@author: mpolonen
NOTE: used to pick waves I, III, V for both regressors
does not give the peak and trough amplitudes, only the difference
ie the peak-trough amplitude
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.b... |
ea80dc539534f5f7370a796c3b2d91fbc73b5e0e4c94a78355616e4db7e62659 | Python | 8,901 | 237 | #modified from: github.com/scikit-learn/scikit-learn/blob/main/sklearn/linear_model/_ridge.py
import numpy as np
from scipy import sparse
from sklearn.linear_model import Ridge, RidgeClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.base import RegressorMixin, MultiOutputMixin, is_classifier
f... |
0c62789a877e486f15bdfb36ea937219093f3bcb61b337bb190395bba5873cea | Python | 8,904 | 319 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by : Alpha Renner (alpren@ini.uzh.ch)
Abbreviations:
inp: input
sfc: main (graded) synfirechain network
g: gating SFC
"""
import numpy as np
import re
# source, target, type
# step number is "first appearance"
connected_pairs = [
# x mem
('x', 'm_x6',... |
d532daa95c5370a20a7dbd128851c278cf5da8728a01909db54e565d7c3731d3 | Python | 8,905 | 239 | # ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# custom_cell_magics: kql
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: transformer
# language: python
# name: p... |
cf603d9d6120d89d754299685d0fe28ed33117fe6895d5856d7d6a421f8d93cb | Python | 8,912 | 248 | #!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... |
2a5d60f8bc44e7551d0922045d4b1d834c90a8bbf82673ad859cfbb8e4eeb761 | Python | 8,915 | 241 | import torch
from torch_geometric.nn import MessagePassing
import torch.nn.functional as F
from torch_geometric.nn import global_mean_pool, global_add_pool
from myogb.graphproppred.mol_encoder import AtomEncoder,BondEncoder
from torch_geometric.utils import degree
import math
### GIN convolution along the graph struc... |
12b051a18a2267b42b9d5bc0d1bb46954cb21e26dbe6418eefd8e85843eaf5cb | Python | 8,918 | 232 | #!/usr/bin/env python
# Written by Minh Nguyen and CBIG under MIT license:
# https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
from __future__ import print_function, division
import argparse
import itertools
import numpy as np
import cbig.Nguyen2020.misc as misc
def a_value(probabilities, zero_label=0, one... |
09540154a4c2fad64f09409e6b7236d7f8ab4f10b9622eead9845a7ead7a9ef4 | Python | 8,921 | 203 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: emma
code for generating dataset with simulated disease, bias, and subject variability effects.
- generates datasets defined by disease and subject effect distributions from
define_stratified_distributions.py
- running this script will create a subdirectory... |
125f22c9bdb35934627de320b1bc0dc43e1033716bf7962428a21dcc63b8877d | Python | 8,922 | 230 | import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from utils.complex_utils import complex_utils as Z
from utils.loss_utils import choose_loss
from utils.optics_utils import super_gaussian, gaussian
from utils.layer_utils import layer_sel
from utils.dataset_utils import get_dataset_mask, get_in... |
7ecf2cb57d11134d2c8eb3d75462c62f1556e52d395efce123a296a1c23e05ab | Python | 8,923 | 246 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
1121ab0c456605cf23613b5d65101688b93bda53b300a59e7b3160a09fccb817 | Python | 8,926 | 240 | import collections
import contextlib
import functools
import os
import re
import sys
import warnings
from typing import Dict, Generator, Iterator, NamedTuple, Optional, Tuple
from ._elffile import EIClass, EIData, ELFFile, EMachine
EF_ARM_ABIMASK = 0xFF000000
EF_ARM_ABI_VER5 = 0x05000000
EF_ARM_ABI_FLOAT_HARD = 0x000... |
854731e10aed7ead3af61123832da552846933eb348c296399d055ee046219cf | Python | 8,926 | 257 | # coding: utf-8
__author__ = 'ZFTurbo: https://kaggle.com/zfturbo'
if __name__ == '__main__':
import sys
import os
# For this test, make sure that only the tested framework is available
sys.modules['tensorflow'] = None
sys.modules['torch'] = None
gpu_use = 0
print(f"GPU use: {gpu_use}")
... |
91fda5f60bd2c137068990c0e875e88bd62c9764e83c698ac3d21a25c5e3c1ae | Python | 8,926 | 257 | # coding: utf-8
__author__ = 'ZFTurbo: https://kaggle.com/zfturbo'
if __name__ == '__main__':
import sys
import os
# For this test, make sure that only the tested framework is available
sys.modules['tensorflow'] = None
sys.modules['jax'] = None
gpu_use = 0
print(f"GPU use: {gpu_use}")
... |
9d00ecc4f669a6ed98e6b53c13ea600f2094d3e3b8ee08704465fa18aa8d8446 | Python | 8,926 | 278 | from datetime import timedelta
from operator import itemgetter
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QAbstractItemView,
QComboBox,
QDateTimeEdit,
QDialog,
QDialogButtonBox,
... |
8c79765e0e42c28cde3dc02941e6b6fa2c5ec564463af884df27caa3f95fec12 | Python | 8,930 | 158 | # 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
#
# ht... |
3188b662f60db8e5c0c8d67bd2eb330d3fbf71ab7e33b1becbeeee741a032186 | Python | 8,932 | 257 | # coding: utf-8
__author__ = 'ZFTurbo: https://kaggle.com/zfturbo'
if __name__ == '__main__':
import sys
import os
# For this test, make sure that only the tested framework is available
sys.modules['jax'] = None
sys.modules['torch'] = None
gpu_use = 0
print(f"GPU use: {gpu_use}")
os.... |
4ba89e4f300b80b62f30019a76589fcce7d05243a62315c0641fd3c2fd9f5bf9 | Python | 8,932 | 189 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .scVI_distribution import *
from .utils import *
from .loss import *
import os
import copy
import random
import numpy as np
import pandas as pd
import scipy
import torch
from torch import nn, optim
import ... |
423294b374eb949575d32339e1eb5cb65b80109cf192afdf459c23821a054d94 | Python | 8,933 | 218 | import argparse
import json
import math
from argparse import RawTextHelpFormatter
from leaderboard.utils.checkpoint_tools import fetch_dict
import carla
import os
SCENARIO_COLOR = {
"Scenario1": [carla.Color(255, 0, 0), "Red"], # Red
"Scenario2": [carla.Color(0, 255, 0), "Green"], # Green
"Sc... |
1dbb918c92253782c7ed5f8c66afa4df56c4b3a899cd1e82eecc38325f097826 | Python | 8,934 | 195 | """
Low-level transform utilities.
Provides functions for applying affine transforms and deformation fields
to images and point clouds.
"""
import numpy as np
from scipy.ndimage import affine_transform, map_coordinates
from .io_utils import loadNiiImages
def applyAffineTransform(image, A, output_shape... |
6d06d7b9fd96acb8e218ed10e421131808b9eb865aed301dbd5d64f6294e6550 | Python | 8,935 | 248 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
c4cd3020c56ee5ded1e78d78855107f960de972a35d30f5a847acf6e69b317f1 | Python | 8,935 | 195 | from typing import Tuple
import torch
import torch.nn as nn
class BCGenerator(nn.Module):
r'''
GAN-based methods formulate a zero-sum game between the generator and the discriminator. The generator is optimized to generate simulation samples that are indistinguishable by the discriminator, and the discrimina... |
cdbab0c4bf100e8c5e9f224be8cf56aa8a541f3ac4db93837fdd104fcb19fec7 | Python | 8,935 | 310 | import torch
import numpy as np
import scipy.io
import h5py
import torch.nn as nn
import operator
from functools import reduce
from functools import partial
#################################################
#
# Utilities
#
#################################################
device = torch.device('cuda' if torch.cuda.is... |
eb148dd59ecf174c7dba86060697e3db311be3f27d481a6e5bcdb87a2eba1b64 | Python | 8,939 | 194 | import os
import numpy as np
import skimage
import skimage.transform
import skimage.morphology
import skimage.io
import pandas as pd
import mrcfile
from tqdm import tqdm
from . import unetmic as umic
from . import segment as segment
from tensorflow.keras.models import load_model
from scipy.special import expit, logit... |
2af876f0a51dea29f26f8904c43d784d30a9cc3b28fd69c97d2fa9db2063fa63 | Python | 8,940 | 85 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, geometric_mean
from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run
BENCHMAR... |
f18ef0ef1a0e1ee8b2e97f853616aa643fcd34e34bbdc80bf8ee1e4c13af68f3 | Python | 8,940 | 228 | import torch
from torch_geometric.data import Data, Batch
class BatchMasking(Data):
r"""A plain old python object modeling a batch of graphs as one big
(dicconnected) graph. With :class:`torch_geometric.data.Data` being the
base class, all its methods can also be used here.
In addition, single graphs c... |
f7c34fc553983a4ecfffd7e8f13cb3d730a423c6f92b5b175a7e6e729ae2a5a3 | Python | 8,940 | 174 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 23 18:43:14 2023
@author: daltonm
"""
import dill
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import itertools
import os
from scipy.stats import binomtest, ttest_rel
from pathlib import Path
from imp... |
6fcfc43af885d113b50e1ba30df39d2ad619a22238d0d66c7429524bfe361616 | Python | 8,941 | 254 | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import stats
import math
import re
from matplotlib_venn import venn2
import gseapy as gp
import glob
import os
impo... |
33b415d2d442d0837dfcaabd5aac8266769825bca9ee3d2d0485903c13d6fb51 | Python | 8,944 | 182 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
9a18d158bc8af96e601a50ea5151114f369297553fda1b6c53f4c54f63552f65 | Python | 8,944 | 266 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..initializer import create_initializer
class BasicBlock(nn.Module):
expansion = 1
def __init__(self,
in_channels,
out_channels,
stride,
remove_first_relu,
... |
54984e91f83c804eb486b47a97a00ac8bfcb35adea15c3e514406d3e6f9b0568 | Python | 8,945 | 236 | import concurrent.futures
import json
import os
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import scipy.sparse
from anndata import AnnData
from cirrocumulus.abstract_dataset import AbstractDataset
from cirrocumulus.anndata_util import ADATA_LAYERS_UNS_KEY
max_workers = m... |
ec18165053136f7d9e0f6bcc8ac6150f3c4124305ea70d7d290993bfd859a83c | Python | 8,945 | 310 | import torch
import numpy as np
import scipy.io
import h5py
import torch.nn as nn
import operator
from functools import reduce
from functools import partial
#################################################
#
# Utilities
#
#################################################
device = torch.device('cuda' if torch.cuda.is... |
776a026a58913606b5b4ffe9c1d750bcf71b39feaca8b835278e666d67e4aac2 | Python | 8,946 | 241 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.integer.MPQ.linear.design import Linear as LinearDesign
from elasti... |
73ab0fc53371cc9ba3bf04eabca587f58e7f3649c402a26aac9a4e0fd5181e21 | Python | 8,953 | 264 | """Constraint handling."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import numpy as np
from scipy.stats import norm
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Matern
from bayes_opt.parameter import wrap_kernel
if TYPE_C... |
d1fe89b5385f058274e22f8240bcbccf34958edcc05be639330b709bae50cdb3 | Python | 8,954 | 206 | import os
import re
from copy import copy
from typing import List, Tuple, Union, Dict
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
class KFoldPerSubjectGroupbyTrial:
r'''
A tool class for k-fold cross-validations, to divide the training... |
0d7d5df11384cb70351b1d74aa1ee9164834a29c71f07beebc22010ef023496b | Python | 8,957 | 161 | #!/usr/bin/python
# -*- coding:utf-8 -*-
import argparse
import os
from datetime import datetime
from utils.logger import setlogger
import logging
from utils.train_utils_combines_ts import train_utils
import torch
import warnings
print(torch.__version__)
warnings.filterwarnings('ignore')
import numpy as np
import rand... |
b3683b1af19157ad9dcb5e9eeb2a9444a07d3754a348e9b66b41236dca359daf | Python | 8,957 | 202 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 18:25:59 2018
@author: ***
Training script for spiking LeNet with quantization level k=2 on MNIST.
"""
#! /usr/bin/python
# -*- coding: utf-8 -*-
import time
import tensorflow as tf
import tensorlayer as tl
import os
import ast
print(os.getcwd())
tf.reset_default_g... |
c1a30d07b641fd0d9a4aeae437534be9cc8b39c7657bd885e4307dbb8411b7f3 | Python | 8,962 | 293 | """Contains classes and functions for logging."""
from __future__ import annotations
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any
from colorama import Fore, just_fix_windows_console
if TYPE_CHECKING:
from bayes_opt.parameter import ParamsType
just_fix_windows_console()
class Scre... |
8e60eed058c942dad34b40738bc324ad306ed52eb36b426ec9108ffabb5592a4 | Python | 8,964 | 244 | #!/bin/env python3
"""
Variable files (fields)
-----------------------
Functions to read, write and convert var files generated by Ithildin.
For this submodule the distinction between IJK and KJI order is important.
Many applications, like NumPy, ParaView or this Python module use KJI order,
which means that the oute... |
f2cb23ce67e7ab0e4869052f5467e3f22770c3d7bda7a1bf2acf3971b770b6f8 | Python | 8,965 | 257 | import logging
from typing import Any, Dict, List, Tuple, Union
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torchmetrics
from torch.utils.data import DataLoader
from torchmetrics import MetricCollection
_EVALUATE_OUTPUT = List[Dict[str, float]]
_log = logging.getLogger('torcheeg')
clas... |
299351c2fe56443af0ca498941a2fb7c32c80a6895706b0e55de2afc74f3dee8 | Python | 8,966 | 135 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : __init__.py
# Author : Yufeng Liu
# Date : 2022-11-10
# Description :
#
#======================... |
ee40b92c25227f789de18ec0aafc9f346f2df01ba77227e04d37891329f8f9c5 | Python | 8,968 | 212 | from typing import List
from typing import Union
import numpy as np
from skimage import transform
from skimage import feature
from skimage import registration
import cv2
from merlin.core import analysistask
from merlin.util import aberration
class Warp(analysistask.ParallelAnalysisTask):
"""
An abstract cla... |
237eac7e6f5994e6e533af4c80d0c560aff5b4d966be2693a2fd04700421d10d | Python | 8,971 | 238 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
8764e78e3b9e18b652b130ed919d99874aa997e496c79272487469217fe97b13 | Python | 8,977 | 220 | from lxml import etree as ET
import json
import sys
import os
import re
import zarr
from skimage.io import imread
from skimage.io.collection import alphanumeric_key
from dask import delayed
import dask.array as da
from glob import glob
from ome_zarr.writer import write_image
from ome_zarr.io import parse_url
lazy_im... |
b49228740fd0c71b24e5d692cfff0af514dbbf7267eebf427f1b86bcf1c0eb73 | Python | 8,977 | 237 | import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import numpy as np
import nibabel as nib
import pytest
pytest.importorskip("pyqtgraph")
@pytest.fixture(scope="module")
def qapp():
from PySide6.QtWidgets import QApplication
return QApplication.instance() or QApplication([])
... |
a5c75beffb8c86ae813163cce5acfb5f87fc024e59b18253694b4e0d1f1d4d8f | Python | 8,978 | 265 | from __future__ import annotations
import os
from importlib.util import find_spec
from pathlib import Path
import pytest
from ase import units
from ase.io import read
from pymatgen.io.qchem.inputs import QCInput
from quacc.calculators.qchem import QChem
has_obabel = bool(find_spec("openbabel"))
FILE_DIR = Path(__f... |
6c2a847030955066e002bf0fc8b24f8b7b18f3f4155236f76b7a2fa94ba89272 | Python | 8,979 | 223 | #########################################
# Script for importing major parameters #
#########################################
from numpy import array
from os.path import join
dir_data = join("..", "data")
from time import strftime
import sys
import settings_model_connectivity
import settings_model_neurons
import sett... |
7f998300b6c2e111aac4bad37e5be5cab157605732cec5ddd741665607918b79 | Python | 8,980 | 156 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ... |
5dbfc318820044190cea357ac181263d24333c139f7b8c6055fabc69e176f6e0 | Python | 8,984 | 204 | import io
import os
import shutil
import unittest
from hed import schema
from hed.errors import ErrorHandler, ErrorSeverity, HedExceptions, HedFileError, ValidationErrors
from hed.models import ColumnMetadata, DefinitionDict, HedString, Sidecar
from hed.models.definition_entry import DefinitionEntry
class Test(unitt... |
ffb7a5caa378f1c3791b7ec52788f1b7304e85311c8d86c2a0bd146664fdd508 | Python | 8,985 | 326 | import pytest
import torch
import torch.nn as nn
from elasticai.creator.experimental.ir.shape_inference.shapes_calculation_functions import (
adaptiveavgpool2d_output_shape,
add_output_shape,
batchnorm1d_output_shape,
batchnorm2d_output_shape,
conv1d_output_shape,
conv2d_output_shape,
flatt... |
a6069aa1bb33a8225515d36941946c26056eb760dbf4d020186c21a4328687aa | Python | 8,994 | 157 | #!/usr/bin/env python
from __future__ import division, print_function
import argparse
import sys
import topaz.cuda
from topaz.training import load_data,make_model,train_model
from topaz.utils.printing import report
name = 'train'
help = 'train 2D region classifier from images with labeled coordinates'
def add_argu... |
77c098e0d01db4265e765880204dddbe8c1320eed90f73e99f887dae42781639 | Python | 8,996 | 188 | #!/usr/bin/env python3
__author__ = "Zoe Wefers"
__credits__ = ["Ryan Huang"]
__version__ = "1.0.0"
__maintainer__ = "Zoe Wefers"
__email__ = "zoe.wefers@mail.mcgill.ca"
"""Purpose: Executable file to collect localization statistics froms users result files and skeletons/prints."""
import localization_anal... |
c457c1a8d460e3887dc61f8b9986f85ca54e023086bc2b250e980528be733a20 | Python | 8,998 | 164 | # 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
#
# ht... |
2f4a05c7a2d8c673012c55bc31c18a7b0aaa1815d31a7a144a13a6f72cfb0c6b | Python | 9,000 | 214 | # coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
978bd5916202e5cf530486b847a0571e7da06249e7055b4fd5108a1fb03a3054 | Python | 9,000 | 197 | import abc
from argparse import ArgumentParser
from typing import Any, Optional
import cv2
import pytorch_lightning as pl
import torch
from pytorch_toolbelt.losses import FocalLoss
from torch_optimizer import AdaBelief
__all__ = ['UNetsuper']
from metric.iou import iou_score
from utils import label2rgb, unnormalize
... |
e47482c62b05be02b9d9b9c8e90a358304bbc1c7602ba743e8087d388d78ef49 | Python | 9,001 | 333 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import dgl.function as fn
from dgl.backend import pytorch as F_dgl
from dgl.nn.functional import edge_softmax
class MLP(nn.Module):
def __init__(
self,
input_dim,
hidden_dim,
output_dim,
... |
4653fb0b2d8b369f3e1ad029ed030d2e6bdafa2a45b718a9cdb28640a41d59a1 | Python | 9,003 | 168 | """Launch the local anatomical neural observatory or run a real diagnostic."""
from __future__ import annotations
import argparse
import faulthandler
import json
import logging
import os
from dataclasses import fields
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def load_configuration(path: P... |
d41d9b06a11f0f3bc591defd9cdd118c3db44d7c381a933b35e40f86e5d0b7e6 | Python | 9,004 | 224 | """Helper functions to run inference on trained models"""
import argparse
import os
import numpy as np
import tensorflow as tf
import multiprocessing as mp
import json
import os
from cddd.input_pipeline import InputPipelineInferEncode, InputPipelineInferDecode
from cddd.hyperparameters import add_arguments, cr... |
ab54ffcb9c0dc5325514032296838fe7b372a69d3b00824b9d59abaf2b2468a8 | Python | 9,005 | 179 | import scanpy as sc
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from pca import pca
import warnings
warnings.filterwarnings('ignore')
from sklearn.preprocessing import LabelEncoder
from utlis import softmax, reduce_dimensions, cal_ratio
import pandas as pd
imp... |
c6301a28b91fc6122491cf580f3ccb3ffb5153b5f0491f28e25cfb2690856cf8 | Python | 9,007 | 244 | """
Contains class Contingency for compaing a clustering (classification) with a
reference classification.
# Author: Vladan Lucic
# $Id: cluster.py 1520 2019-03-11 17:00:20Z vladan $
"""
__version__ = "$Revision: 1520 $"
import collections
import numpy as np
import scipy as sp
try:
import pandas as pd
except ... |
8738591ec94d2705ff093996bd11777ed3305a307bb9c6e555f7978ca6a399c5 | Python | 9,008 | 205 | RESOLUTION_FIG = 'resolution'
ROBUSTNESS_FIG = 'robustness'
HUMAN_COMP_FIG = 'human-comparison'
DATA_PROGR_FIG = 'data-progression'
ABLATIONST_FIG = 'ablation-study'
BIN_ERRORS_FIG = 'bin-errors'
ITEM_ERRS_FIG = 'item-errors'
BIN_STDEV_FIG = 'bin-stdev'
ERR_HIST_CLINICIANS = 'err-hist-clinicians'
# MAIN_SAVE_AS = './r... |
7d75238cd4314cbd69e3fff9a74e3b511455c03f3c39de5497f0d97335860ecb | Python | 9,009 | 257 | import numpy as np
from pydrake.trajectories import PiecewisePolynomial
from pydrake.math import RollPitchYaw
from pydrake.util.eigen_geometry import Isometry3
PlanTypes = [
"JointSpacePlan",
"TaskSpacePlan",
"PlanarTaskSpacePlan",
"PlanarHybridPositionForcePlan",
"OpenLeftDoorPositionPlan",
"... |
c27bcd07d0cd7807cabf95601ecd2e6b2fd11fa10bc2e9b7aee64efe6a76133d | Python | 9,009 | 244 | #!/bin/env python3
"""
Variable files (fields)
-----------------------
Functions to read, write and convert var files generated by Ithildin.
For this submodule the distinction between IJK and KJI order is important.
Many applications, like NumPy, ParaView or this Python module use KJI order,
which means that the oute... |
5751b7cba9c0bc9bcabb1456273c512d11eaaeeb2f113757539b622d2eaaa732 | Python | 9,011 | 191 | #!/usr/bin/env python3.9
import argparse
import numpy as np
import gzip
# parse commandline arguments
def ParseArgs():
parser = argparse.ArgumentParser(description='Train AI model for CNV bait prediction.')
parser.add_argument('--epoch', action="store", dest="epoch", type=int, required=False, default=100, help... |
5cf643ee4b1301c0006afd9e83b034f19610cedab1bde613ff881b59d97a14d7 | Python | 9,012 | 225 | #########################################
# Script for importing major parameters #
#########################################
from numpy import array
from os.path import join
dir_data = join("..", "data")
from time import strftime
import sys
import settings_model_connectivity
import settings_model_neurons
import sett... |
28b3ba64817ba5d22efa9a178d6c5c3e66ab0bc02b9a7a551a371b26fdc336a1 | Python | 9,014 | 228 | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from typing import Any, Dict, Optional
from models.model import Model
from models.kan_layers import KAN, FastKANConv1DLayer, FastKANConv3DLayer
class ParallelConvBlock(nn.Module):
def __init__(self,
inp,
... |
099332379e8a19e9ca16f4ed85f04c4b1bc3944627d02cd6075c5250cfb61f09 | Python | 9,015 | 239 | import logging
from itertools import chain
from typing import List, Tuple
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torchmetrics
from torch.utils.data import DataLoader
from ..classifier import ClassifierTrainer, classification_metrics
_log = logging.getLogger('torch... |
0e28c8bbc409d8f8f08e29fb5fcca0aece2f120fb727424a1c66aa972dc9cc8f | Python | 9,016 | 194 | """
AMBIGUITY_REPRODUCIBILITY_ROBUSTNESS.py - written 2026-09-17.
AMBIGUITY_REPRODUCIBILITY.py found within-cell-type concordance of the classifier's
runner-up at 0.5502 against a stratified null of 0.4204, z = 244. Before that number is
allowed anywhere near a report, four things have to be ruled out. In order ... |
d183e5cb0344e8293a34fea9b57351b270dde1afcea5faa5b2a96a78d86c3fe6 | Python | 9,016 | 199 | from typing import Tuple
import torch
import torch.nn as nn
class BCGenerator(nn.Module):
r'''
GAN-based methods formulate a zero-sum game between the generator and the discriminator. The generator is optimized to generate simulation samples that are indistinguishable by the discriminator, and the discrimina... |
6b572805dcab87a0e5689bdb4d27e6a0ab9405419f104ba10b315f98d94f9d75 | Python | 9,018 | 338 | # ----------------------------------------------------------------------
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/... |
65d7eff8482290938e9608f53a353eef347e379e470af290d6d24a6614efdee4 | Python | 9,022 | 194 | # -*- coding: utf-8 -*-
from functools import partial
import tensorflow as tf
import tfsnippet as spt
from tensorflow.python.ops.linalg.linear_operator_identity import LinearOperatorIdentity
from tensorflow_probability.python.distributions import LinearGaussianStateSpaceModel, MultivariateNormalDiag
from tfsnippet.dis... |
fef35e39e9ab5ab1aa39582b794633d9781a76134f00194908a784df143709f7 | Python | 9,023 | 288 | """Transition state recipes for the NewtonNet code."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import change_settings, get_settings, job, strip_decorator
from quacc.recipes.newtonnet.core import _add_stdev_and... |
1df773965651cfee40fe0f30ad4a4ed15707888f3b3fbfb95b4f7f08907f5033 | Python | 9,024 | 187 | from collections import namedtuple
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import os
import cv2
from REACTRL import mol_property
import numpy as np
import shutil
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
fro... |
501305c00ef0cd0ccdb94e16d35edaccd205dd18af00b11fac48a0ff85b53770 | Python | 9,025 | 338 | # ----------------------------------------------------------------------
# Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/... |
6132c7853b2c368fdc4ebb6105ef0fda3a72bb9509f956b6846855e9fdfe88cb | Python | 9,026 | 205 | supervised_learning = False
options = dict(requires_training_frame=False)
def class_extensions():
@staticmethod
def from_external(external=H2OFrame):
"""
Creates new H2OWord2vecEstimator based on an external model.
:param external: H2OFrame with an external model
:retu... |
5962fd08325a08166efb20abcbfd724ce0583fb460e07c8f73273dd1b6e91ace | Python | 9,027 | 231 | # -*- coding: utf-8 -*-
import os.path
from lab.environments import MaiaEnvironment
from lab.steps import Step
from downward.checkouts import Translator, Preprocessor, Planner
from downward.experiments import DownwardExperiment
from downward.reports.compare import CompareRevisionsReport
from downward.reports.scatter... |
c1d737fd5dca0264d10b7139a60bc2e62e690f0bc5aaa0f19807bac122a3d2ca | Python | 9,027 | 234 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
383a176b5c27c7768f6f65c28f2310fdd94bd131b97f6074395d0598526a0196 | Python | 9,028 | 254 | import nibabel as nib
from nibabel import processing
import matplotlib.pyplot as plt
import numpy as np
import os
import argparse
import pandas as pd
from sklearn.preprocessing import QuantileTransformer
import logging
from tqdm import tqdm
def create_logger(log):
"""
Creates a logger that logs to both a file ... |
6c2de02f84c06ca7e095796df0236e707fd5552f54f1b8f8edc61c8618a921ef | Python | 9,030 | 167 | import pandas as pd
from pathlib import Path
from argparse import ArgumentParser
from typing import Union, List, Mapping, Tuple, Optional
import pickle
from pymol import cmd, stored
def read_foldx_pssm(fpath):
series = pd.read_csv(fpath, sep='\t', index_col=0).stack()
series.index = series.index.map(lambda x:... |
53a5a825962bec7f724a8e0628c452bcc9a2b6f4c7fca0f08590d4b33b7b2c99 | Python | 9,033 | 233 | import matplotlib
matplotlib.rcParams['figure.facecolor'] = '1.'
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import nibabel as nib
import pandas as pd
import re
import os
import ants
import argparse
import csv
import statistics
from scipy.ndimage import distance_transform_edt
from scipy.nd... |
652b0b6f5f3d4467297eced6f16b1467be4ded536c2075cfcb0f309916d9ee2f | Python | 9,035 | 224 | import torch
import torch.nn as nn
import torch.nn.functional as F
class SelfAttention(nn.Module):
def __init__(self, in_channels, grid_size):
super(SelfAttention, self).__init__()
self.in_channels = in_channels
self.grid_size = grid_size
self.multiatt = nn.MultiheadAttention(in_ch... |
cc40c7a2c66dedabdceeef4804b8220731fe8e88bcd26f60c6f8b4a7bc91b6cc | Python | 9,036 | 279 | #!/usr/bin/env python3
# coding: utf-8
import torch
import torch.nn as nn
import torch.utils.data as data
import torchvision.transforms as transforms
import torch.backends.cudnn as cudnn
import time
import numpy as np
from benchmark_aflw2000 import calc_nme as calc_nme_alfw2000
from benchmark_aflw2000 import ana_msg ... |
059b1c1526653306417ce8fd0d4ea816d4b49259d19e035cd9596490aad81699 | Python | 9,037 | 293 | import random
from Bio import Entrez, Medline
from collections import defaultdict
import pandas as pd
import io
import base64
import bs4 as bs
import dash_html_components as html
import requests
import networkx as nx
from networkx.readwrite import json_graph
from urllib import error
Entrez.email = 'alberto.santos@cpr.... |
c66bdaa35bdf1322c061140db39be17ece888929f31ca9a583daca1b6febe908 | Python | 9,038 | 273 | """Main script to train, evaluate and predict with cell prediction models."""
import argparse
import logging
import os
import pathlib
import pickle
import warnings
import tqdm
from sklearn import metrics
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from layer... |
af95c95cfaa6b09a8b6fe88c6d122c7e07288e6fbd1acb4db1121b3d0c225c72 | Python | 9,039 | 239 | import glob
import os
from itertools import compress
from pathlib import Path
import napari
import numpy as np
import pandas as pd
from napari_video.napari_video import VideoReaderNP
# Goes through all the layers of the video, extracting the coordinates,
# frames, and the visible data and creates a DataFrame with th... |
c375dd2b15a7bb64e1b4aaabb26a212d93534956b123071be7ae196034dd74be | Python | 9,040 | 283 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
21e1da83c37330fdc80292606683d09e6a508b7c07ed64026a4ee65eab3c539c | Python | 9,042 | 303 | import pandas as pd
import logging
import numpy as np
import matplotlib.pyplot as plt
from omegaconf import DictConfig
from . import Tester
logger = logging.getLogger(__name__)
def plot_hypothesis_distribution(cluster: int, cluster_method: str, freq_threshold: int, df: pd.DataFrame, hypotheses: list = None):
'''... |
d5ac890a275749d529df1c96caf648cf5aae1fe0e99c7e9f9450127c8b168d19 | Python | 9,042 | 232 | #!/usr/bin/env python3
"""Run Micro-PVM supertype models and produce manuscript-ready summary figures."""
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.stats.mult... |
24c7b8f25d7a122d453a12b55842768bb3046b5862f5eb669fec9eee6c09fd38 | Python | 9,043 | 192 | """
Correct PU splitting with real damages (3 classes: Healthy / Outer ring / Inner ring)
"""
import os
import pandas as pd
from scipy.io import loadmat
from sklearn.model_selection import train_test_split
from datasets.SequenceDatasets import dataset
from datasets.sequence_aug import *
from tqdm import tqdm
... |
f4ecc2803f9a965adc6ca05c672a3b6353cfdcd8e2d2d85625222e10838460e7 | Python | 9,045 | 262 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.addition import Addition
from elasticai.creator.nn.integer.batchnorm1d import BatchNorm1d
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.encoderlayer.design import (
EncoderLay... |
089f621093b6b37c1bdab3d9c20f0270382bf668e477cd618cfb2f143e6123b6 | Python | 9,048 | 376 | # 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 writing, software
# distributed under th... |
79f436b73fd2e8474fd24a08c0f3bad9e7a857868da65ae63e0f6b731ed14c55 | Python | 9,048 | 226 | import numpy as np
import nibabel
import json
import os
import time
from glob import glob
from subprocess import call
from joblib import Parallel, delayed
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
# inspired by the NVIDIA nnU-Net GitHub repository available at:
# https://github.co... |
2bc438d9a4b224c8b5ca68f47ce3f6e409fc58717d1e769add006eceac47338f | Python | 9,049 | 214 | ##
# \file case_study_fetal_brain_test.py
# \brief Unit tests based on fetal brain case study
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date November 2017
import os
import unittest
import numpy as np
import re
import SimpleITK as sitk
import pysitk.python_helper as ph
import pysitk.simple_itk_hel... |
bfbe0a794de420943ecb7a81af9ca76e1b6d32257410b499407caa4b901db831 | Python | 9,051 | 342 | import numba
import numpy as np
def timeIntegration(params):
"""Sets up the parameters for time integration
:param params: Parameter dictionary of the model
:type params: dict
:return: Integrated activity variables of the model
:rtype: (numpy.ndarray,)
"""
dt = params["dt"] # Time step ... |
19bac3caa9f3b0d5f204df22cbc66fcc9ce71e07eef14ad968105dbd136ad316 | Python | 9,052 | 276 | # TODO: Time does not include outputs_to_preds and subtracting mean from data
import sys
sys.path.append("/data/MEAprojects/DLSpikeSorter")
sys.path.append("/data/MEAprojects/DLSpikeSorter/src")
# Imports
import torch
from torch import nn
from torch.profiler import profile, record_function, ProfilerActivity
from src... |
f80a86dad9a69d8e8517d289232582cdf6b0087cb26c04e787b33a6201c32558 | Python | 9,052 | 243 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.conv1dbn.design import Conv1dBN as Conv1dBNDesign
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import (
get_padded_q_input... |
4b56de267b27a36c8f0502fb5798321107139fb92dde5f1d8f803142f555cff5 | Python | 9,054 | 275 | # 2020.06.09-Changed for building GhostNet
# Huawei Technologies Co., Ltd. <foss@huawei.com>
"""
Creates a GhostNet Model as defined in:
GhostNet: More Features from Cheap Operations By Kai Han, Yunhe Wang, Qi Tian, Jianyuan Guo, Chunjing Xu, Chang Xu.
https://arxiv.org/abs/1911.11907
Modified from https://g... |
71a832d42c85c4223fafcfe654218090732678c8498aacd905358cc8f8087d99 | Python | 9,055 | 237 | """
Author: David Kappel
Copyright (C) 2024, by the author.
See the LICENSE.txt file for more information.
Code snoopies:
run the closed loop experiment
"""
import numpy as np
import pylab as pl
import time
from scipy.ndimage import gaussian_filter1d
from mpl_toolkits.mplot3d import Axes3D
fro... |
974861632f077add80c3bfab9ed2bb8d18c02beba394d4a4a91ee78be37c413f | Python | 9,055 | 200 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GATv2Conv
class FeatureAugmentation(nn.Module):
"""
特征增强模块,用于生成增强的节点特征,同时尽量保持协方差的一致性。
参数:
num_features (int): 输入特征的维数。
epsilon (float): 控制噪声强度的超参数,用于确定噪声的方差。
"""
def __init__(self, num_feature... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.