sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4ee55af918cbf7ccbfecd4394229c9b1f3a5de21a5ba094393ed55a01a11243d | Python | 9,596 | 265 | import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNetV1b', 'resnet18_v1b', 'resnet34_v1b', 'resnet50_v1b',
'resnet101_v1b', 'resnet152_v1b', 'resnet152_v1s', 'resnet101_v1s', 'resnet50_v1s']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet... |
469a066604e2a589ad4dc20da7efe39ff64b4b6430bd30f6be52d0b499218391 | Python | 9,607 | 239 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from collections import OrderedDict
def batchnorm(in_planes):
return nn.BatchNorm2d(in_planes, affine=True, eps=1e-5, momentum=0.1)
def conv3x3(in_planes, out_planes, stride=1, bias=False):
return nn.Conv2d(in_planes, out_planes, ... |
bc78388f9733e564bf1c716b944c6d1b04e7b8412f5a84675d48eb2a636b11d2 | Python | 9,609 | 305 | ## System
import os,gc
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # no debugging from TF
os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3'
import time
import copy
## sklearn
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
## Maths
import math
import numpy as np
import pandas as pd
import logging
log... |
16d364b607b940695a79f9db355000b199a9aeea7217c2432fb4b5421c6f8177 | Python | 9,611 | 306 | ## System
import os,gc
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # no debugging from TF
os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3'
import time
import copy
## sklearn
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
## Maths
import math
import numpy as np
import pandas as pd
import logging
log... |
daaa6c85ac4615f04f5d5a04d2e338a2b0bbd65d5da0744a5759189e7ad5583b | Python | 9,613 | 251 | import json
import logging
import unittest
from copy import deepcopy
from curies import Converter
from oaklib.datamodels.vocabulary import IS_A, PART_OF
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.interfaces.obograph_interface import OboGraphInterface
from oaklib.r... |
8ad092949fc3fe1e66bebbc3ddbad29c16676435e1969f76b7976aaf6bee15e2 | Python | 9,621 | 209 | import warnings
import torch
from torch.nn import GroupNorm, LayerNorm
from mmcv.utils import _BatchNorm, _InstanceNorm, build_from_cfg, is_list_of
from .builder import OPTIMIZER_BUILDERS, OPTIMIZERS
@OPTIMIZER_BUILDERS.register_module()
class DefaultOptimizerConstructor:
"""Default constructor for optimizers.
... |
08ca62482070771e6c4743c28c3bf54d1fcb81274946e2b6876d9737554d7bbf | Python | 9,625 | 362 | # %% [markdown]
# #
import os
from itertools import chain
import colorcet as cc
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from graspy.cluster import AutoGMMCluster
from graspy.utils import pass_to_ranks
from src.data import load_metagraph
from s... |
50508daa4ead24d893e75673752fed7b28a44d1fed224e55487d8bcfa76505e7 | Python | 9,625 | 252 | import os
import unittest
import numpy as np
from selene_sdk.targets import GenomicFeatures
from selene_sdk.targets.genomic_features import _any_positive_rows, \
_is_positive_row, _get_feature_data
class TestGenomicFeatures(unittest.TestCase):
def setUp(self):
self.features = [
"CTCF", ... |
6719817de5f3559e2c53b2b769202b66ffaaf5830ace04da735708e179687c7f | Python | 9,625 | 211 | # %%
from pymaid_creds import url, name, password, token
from data_settings import pairs_path, data_date
import pymaid
rm = pymaid.CatmaidInstance(url, token, name, password)
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import cmasher as cmr
# allows text to be editabl... |
c5f7db86a8fffc51b695e244e31e20f5736d17a5d0a3bdca3a66aea0ef294650 | Python | 9,628 | 233 | """TFRecord reading/writing utilities for both Tensorflow and PyTorch."""
import os
import copy
import struct
import slideflow as sf
from tqdm import tqdm
from multiprocessing.dummy import Pool as DPool
from random import shuffle
from slideflow.util import log
from os.path import join, exists, isdir, isfile
# Backen... |
5a4303a9b5ef5bf0f57c3b0006a188f3ff5e29e6e7cf05fe725fcd424d5fbd1a | Python | 9,634 | 306 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import tempfile
import subprocess
import tensorflow as tf
import numpy as np
import tfimage as im
import threading
import time
import multiprocessing
edge_pool = None
parser = argp... |
605b3bc92b6d8a7d2b879749ac640877ea91bbd2495ec3460b6f9b419d99fc5a | Python | 9,635 | 244 | """
This file runs 1 sided significance tests with various optional conditions. By default, this file runs food vs non-food significance test.
Example run:
python get_fdr_ols_weights.py -s 1 -v voxel_path.npy -t stim_id_path.npy -o output.npy
-s : subject
-v : path to preprocessed voxels in the format of images x co... |
7bb32ff2526a4c5bc72d93d31d7662e621ac9c96950816982efa20f18bb5a518 | Python | 9,638 | 291 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module containing useful functions for loading/saving/displaying stacks and images.
Created on Mon Oct 1 17:48:29 2018
@author: nicolas
"""
import numpy as np
from matplotlib import cm
from skimage import io, color, measure
def imread_to_float(filename, scaling=No... |
1933fbacc5a367de252c16df99440770767c721bd5a507d3b5ce467a95d7faff | Python | 9,639 | 237 | # Fixes for defective mne functions
from collections import defaultdict
from distutils.version import LooseVersion
import os.path as op
import warnings
import numpy as np
from mne.surface import read_surface
from mne.utils import get_subjects_dir, logger, verbose
from mne.label import _get_annot_fname, _n_colors, _wr... |
10533b8b9b8fe6aefaf7f8483088adcd43655af978c3654d7acee04d94bee7e9 | Python | 9,641 | 297 | """
Written by Nathan Neeteson
A utility module for post-processing the output predictions from a model that
is estimating the masks for the cortical and trabeculaer compartments of an
HR-pQCT image.
"""
import vtk
import numpy as np
from skimage.morphology import binary_dilation, binary_erosion
from skimage.measure im... |
05b0b9664b08c6ba0e1987b314b0a75c1e946a1b2e424f17b7ebc9c196f37483 | Python | 9,645 | 266 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
# transpose
FLIP_LEFT_RIGHT = 0
FLIP_TOP_BOTTOM = 1
class BoxList(object):
"""
This class represents a set of bounding boxes.
The bounding boxes are represented as a Nx4 Tensor.
In order to uniquely determine the bou... |
c4b2de2e8146de077ca6bd45e58a63952308b86aba6a1d1599add0b8ee90b8b7 | Python | 9,647 | 275 | import torch
import torch.nn as nn
import torch.nn.functional as F
from slideflow.clam.utils import initialize_weights
import numpy as np
"""
Attention Network without Gating (2 fc layers)
args:
L: input feature dimension
D: hidden layer dimension
dropout: whether to use dropout (p = 0.25)
n_classes: number of cla... |
264e33d43cc197ee5be358d9524636e612a03713cb7050938ddbbd1f19d6e126 | Python | 9,657 | 233 | import os
from os.path import join
import numpy as np
import pandas as pd
from collections import OrderedDict
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selectio... |
11508b0af649589a96b4c73178cfdc519fdb640f429d5111325f6e0127f482a4 | Python | 9,659 | 268 | import pickle
import gzip
import bz2
import pandas as pd
import numpy as np
from .degree_centrality import calculate_degree_centrality
from . import analysis
class output_handler():
"""
Stores output of siVAE/VAE results
Inputs:
result_dict:
"""
def __init__(self, result... |
4f79c8a87d18464d4a97239b6f86b0ffe143a290a07984749bd3b48f24d8dd8a | Python | 9,659 | 296 | import numpy as np
import pandas as pd
import numpy.typing as npt
# try except to accomodate older versions of Python
try:
from typing import Optional, Sequence, Union, Protocol, Iterable, Tuple
except ImportError:
from typing import Optional, Sequence, Union, Iterable, Tuple
from typing_extensions import P... |
09d8caf1b03958091c6b4d7d4e17ab261b3b52dc853e4a93ce65946d9fd3436f | Python | 9,660 | 285 | """
.. _exa-intro:
.. currentmodule:: eelbrain
Introduction
============
Data are represented with there primary data-objects:
* :class:`Factor` for categorial variables
* :class:`Var` for scalar variables
* :class:`NDVar` for multidimensional data (e.g. a variable measured at
different time points)
Multiple vari... |
1d9b3e829dc14facc57eb8634a120939c207c2e022c060140aa221b4ae83f12c | Python | 9,665 | 260 | import sys
import os
import torch
import numpy as np
from sklearn import metrics
from sklearn.metrics import confusion_matrix
from sklearn.metrics import roc_auc_score
def get_binary(values, threshold, target):
"""
Transforms continuous or multiclass values into binary values (0/1)
Args:
values (... |
4ef72d33ec73fa580a4185c4bbb4e7b09f647389e4e1c6e484d79c16b757ff86 | Python | 9,667 | 297 | import inspect
import warnings
from abc import ABCMeta, abstractmethod
class BaseStorageBackend(metaclass=ABCMeta):
"""Abstract class of storage backends.
All backends need to implement two apis: ``get()`` and ``get_text()``.
``get()`` reads the file as a byte stream and ``get_text()`` reads the file
... |
d3be963a3778d52639f878810509d7a7c126ecf7db39964f9c5efb51efd96f22 | Python | 9,668 | 247 | from functools import partialmethod
from pathlib import Path
from typing import List, Union, Optional
import torch
from .tensor_dataset import TensorDataset
from ..transforms.data_processors import DefaultDataProcessor
from ..transforms.normalizers import UnitGaussianNormalizer
class PTDataset:
"""PTDataset is ... |
d3e4eed6b73cec352a4e431815291a220f3c6ef20ced47ae079c102473162a59 | Python | 9,670 | 271 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
5cbac0c0798b66d9931846006842669731324d56e8e1157f4938919c409a84b6 | Python | 9,671 | 304 | import os
import sys
import time
import glob
import numpy as np
import pickle
import torch
import logging
import argparse
import functools
from maskrcnn_benchmark.modeling.detector.generalized_rcnn import GeneralizedRCNN
from maskrcnn_benchmark.utils.complexity import Complexity
from maskrcnn_benchmark.config import ... |
a7d9522cd8afed53940d8a941193e3bcc325d256dc2b118aecbbdfee110d72b7 | Python | 9,671 | 274 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
d4dfd13271d0fabe0e23d4b254537041ef72e0c6c417a09e623e78c366dc766d | Python | 9,674 | 214 | """In-editor half of import-carla-ue58-walker. Runs inside UnrealEditor via
`-ExecutePythonScript`; never invoke directly.
Reads a job JSON (`CARLA_WALKER_JOB`), performs one of two actions, and writes a
result JSON. Progress is flushed after every step, because two of the operations
here can hard-crash the process an... |
394599491527a57c2387b3ae93a9c0f235d7093c90d561e32f436b4a4cdaea00 | Python | 9,675 | 379 | # %% [markdown]
# ##
import os
import warnings
from itertools import chain
import matplotlib as mpl
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import numpy as np
import pandas as pd
import seaborn as sns
from joblib import Parallel, delayed
from sc... |
0c53a04964f753cd0534ccc3aa2fcd3f62b59b25d4e16986bdf8967b33a4c9ad | Python | 9,676 | 253 | #Experimental Class for Smiles Enumeration, Iterator and SmilesIterator adapted from Keras 1.2.2
from rdkit import Chem
import numpy as np
import threading
class Iterator(object):
"""Abstract base class for data iterators.
# Arguments
n: Integer, total number of samples in the dataset to loop over.
... |
f2418b94094604077f8ed6f5c4278d5e1b29d5f0fed5422f2c3211abedd0267e | Python | 9,677 | 331 | import logging
# %%
import copy
import json
import pathlib
import pickle
import pprint
import warnings
from collections import defaultdict
import box
# import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.io
from scipy import signal, stats
# from scipy.optimize import dual_annealing, ... |
a292cfcb13d79421676d687621bfb9c44f63f90273adcd836c9a6d5bd898177a | Python | 9,679 | 242 | """
File: eqtl.py
Created: 2020/06/09
Last Changed: 2020/06/11
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 ... |
ab6d2b60b6258fec7a3ea591132eb3a9025edd3800b4ac791fdfeb6df3e063f9 | Python | 9,682 | 224 | #!/usr/bin/env python3
"""
File: mathys2019_comparison.py
Created: 2020/09/16
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software... |
1d5bd01f3dc6ad4ad71e28126bbf0708aefbef0e7ae95617f421ab393c868704 | Python | 9,685 | 266 | #!/usr/bin/env python3
"""
File: visualise_gene_vs_sex.py
Created: 2020/10/30
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software ... |
391784d11b3481c959d942213b70bd27496ad6f70a3272b0e406463ae94930ba | Python | 9,685 | 223 | import tqdm
import ipdb
import argparse, sys; sys.path.append('../..')
import random as rand
import torch
from metrics import *
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.utils.performance.load_exp import exp_exists
f... |
f3bc65e20c5fe52150c24d6adf374d5379135ba0e7f0a1de6e4e931a3881cb63 | Python | 9,687 | 259 | """Strategy registry for per-modality intensity normalization.
Each normalization recipe is encapsulated in a :class:`Normalizer` strategy
class and registered under a short name (``percentile``, ``autoref``,
``gaussian``, ``zscore_clip``). The file-writing code resolves the strategy for
a modality with :func:`get_nor... |
a0bcd1d70e9f407c884a6660d5b57e81d68e274941491ecc717a9c4c7cc32844 | Python | 9,694 | 237 | #!/usr/bin/env python3
"""Replay a recorded CARLA .log, control its speed, follow an actor, and stop.
Commands:
play --file run.log replay the whole log
play --file run.log --start 5 --duration 10 --follow 87
play --file run.log --time-factor 2.0 replay at 2x
play --file run.... |
3a67f280647689b7b60bd68cbcc1e59a1900416c5295fb3fc4843a6ff2352cde | Python | 9,695 | 284 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
from torch.nn.modules.module import Module
from ..cnn import UPSAMPLE_LAYERS, normal_init, xavier_init
from ..utils import ext_loader
ext_module = ext_loader.load_ext('_ext', [
'carafe_naive_forward', 'carafe_na... |
8c2da10243ba7a84568d544230b3a22a26c8e5c4fdb60000a3ab8dbc400cdd59 | Python | 9,695 | 224 | #!/usr/bin/env python3
"""
File: mathys2019_comparison.py
Created: 2020/09/16
Last Changed: 2022/02/10
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Fr... |
01a317110ae36c68a396ac208a1c60faf338ed0bbbc37a47c185180a66b13faf | Python | 9,702 | 255 | import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
import gym
import pandas as pd
import matplotlib.pyplot as plt
# import matplotlib.path as mpath
# import matplotlib.lines as mlines
# import matplotlib.patches as mpatches
# from matplotlib.collections import PatchColle... |
5241a767fcd305da78523a56d4435607d51d1d81eea0efe393a82b77b1a5624f | Python | 9,706 | 264 | from typing import Dict
from ...utils import count_tensor_params
from .base_transforms import Transform, DictTransform
import torch
class Normalizer(Transform):
def __init__(self, mean, std, eps=1e-6):
self.mean = mean
self.std = std
self.eps = eps
def transform(self, data):
... |
c5cc81a82366f50ee7ca058e0fb71c256af195992d14daae385d872b6f86d0da | Python | 9,707 | 251 | # Copyright (c) 2021, NVIDIA CORPORATION. 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 software and rel... |
324283e0a1e51ea3c7af70d556441cc81505005158a204a0b3865a0f5093e46f | Python | 9,713 | 301 | import numpy as np
import pytest
import torch
import torch.nn as nn
from mmdet.core import auto_fp16, force_fp32
from mmdet.core.fp16.utils import cast_tensor_type
def test_cast_tensor_type():
inputs = torch.FloatTensor([5.])
src_type = torch.float32
dst_type = torch.int32
outputs = cast_tensor_type(... |
d1eae64e643ad3e277eed75715a48f808cc55a8e7de39dfd8b367cfe7dc178e9 | Python | 9,716 | 319 | import math
import torch
import torch.fft
import torch.nn as nn
import torch.nn.functional as F
from M2TR.utils.registries import MODEL_REGISTRY
from .base import BaseNetwork
from .xception import Xception
from .efficientnet import EfficientNet
from .modules.head import Classifier2D, Localizer
from .modules.transfor... |
0574ce9000d5a767ee963f36602f9240f8ababffd103069f9c501274cd4d886f | Python | 9,727 | 264 | """
This module provides the EvaluateModel class.
"""
import logging
import os
import warnings
import numpy as np
import torch
import torch.nn as nn
from sklearn.metrics import average_precision_score, roc_auc_score
from torch.autograd import Variable
from tqdm import tqdm
from .sequences import Genome
from .utils i... |
c9f12239da7ffc73ca5947baf7efc2a8e6e8e86523733f9bcb8feeb0fe9f43fd | Python | 9,728 | 242 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
from torch.autograd import Variable
from .base_model import BaseModel
from . import networks
class SpecificNorm(nn.Module):
def __init__(self, epsilon=1e-8):
"""
@notice: avoid in-place ops.
... |
ede07db6807c3a8120d789419d0e7da8f90447d98f2a8b0500dc24673318d29c | Python | 9,731 | 283 | # This file is execfile()d with the current directory set to its containing dir.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
#
# All configuration values have a default; values that are comme... |
9f977687029416a9ae6115339b1e49aa105324926104e26e15b32a0b2cecc2f8 | Python | 9,732 | 225 | """Tests for: Obographs to FHIR converter"""
import os
import unittest
from typing import List
import curies
import requests
from linkml_runtime.loaders import json_loader
from oaklib.constants import TIMEOUT_SECONDS
from oaklib.converters.obo_graph_to_fhir_converter import OboGraphToFHIRConverter
from oaklib.datamo... |
28c3378a8b1d128fc130d0b4684d18706bf07983e8ae9295a9fd96deac7df8c6 | Python | 9,733 | 413 | # %% [markdown]
# # THE MIND OF A MAGGOT
# %% [markdown]
# ## Imports
import os
import warnings
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy.linalg import orthogonal_procrustes
from sklearn.exceptions import Conv... |
1ea6275538facba8f421005798c668287b7eff1d0a473c243ac60658232c1241 | Python | 9,735 | 278 | import math
import copy
import numpy as np
import torch
import torch.nn.functional as F
from torch_geometric.datasets import TUDataset
from torch_geometric.nn import MessagePassing, global_mean_pool
from torch_sparse import SparseTensor, matmul
from typing import Union, Tuple
from torch import Tensor
from torch_geom... |
226898163db65efbb0c51565ae61e77cf0d315a9732a4d499496f03f367628e9 | Python | 9,735 | 237 | import inspect
import torch
import warnings
from pathlib import Path
# Author: Jean Kossaifi
class BaseModel(torch.nn.Module):
"""Based class for all Models
This class has two main functionalities:
* It monitors the creation of subclass, that are automatically registered
for users to use by name u... |
1d84028e0a57a729d560a23692137155680ff39adee557323f0289e5aab0c876 | Python | 9,739 | 235 | #!/usr/bin/env python3
"""
File: create_jobs.py
Created: 2020/06/05
Last Changed: 2020/06/08
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwar... |
80efd5e06d2cf0634fb7eebabf56980dbaafbfd8a2288d94d5860be1d6a69de1 | Python | 9,745 | 329 | import torch
from mmdet.core.bbox.assigners import MaxIoUAssigner
from mmdet.core.bbox.samplers import (OHEMSampler, RandomSampler,
ScoreHLRSampler)
def test_random_sampler():
assigner = MaxIoUAssigner(
pos_iou_thr=0.5,
neg_iou_thr=0.5,
ignore_iof_thr... |
e602c722a041f838ed121cc13dc98403aff69f88814968ee7ce3082f423ea2cb | Python | 9,746 | 189 | r"""
Simulation parameters and the Rouse model
-----------------------------------------
This module provides some intuition for the units that are used in polychrom as
well as some guidance on how to interpret polychrom parameters through the lens
of the Rouse model. Of course, chromatin is not necessarily a Rouse po... |
12365a3bb5d106890d32766b8f6b734697c2c8dcdc6c9719c1f867dc00615a4b | Python | 9,749 | 237 | #!/home/nimath/anaconda3/envs/pegdesign/bin/ python
import os, sys
from os.path import exists
from os import system
import tensorflow.compat.v1 as tf
import numpy as np
import scipy.misc
import scipy.stats
from scipy.stats import rankdata
# Model
length = 30
class DeepCas9(object):
def __init__(... |
08b60ed8b96594504a74246cdd6ec0fd6f77398e3f7fe0a6b4c20535fde5d6fa | Python | 9,750 | 240 | import os
from os.path import join
import numpy as np
import pandas as pd
from collections import OrderedDict
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selectio... |
7c5f6bc3985acc32d348684b6de31d6200834ed9cef4dbc7ed8b535394709b32 | Python | 9,750 | 212 | import torch
from ..builder import BBOX_ASSIGNERS
from ..iou_calculators import build_iou_calculator
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
@BBOX_ASSIGNERS.register_module()
class MaxIoUAssigner(BaseAssigner):
"""Assign a corresponding gt bbox or background to each bbox.
... |
a5f95686ab469d235f79a5c53a6ee017f2d80486e8985793fecdfe8f85759528 | Python | 9,750 | 385 | #%% [markdown]
# # Removing the Kenyon cells
#%%
import datetime
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from pkg.data import load_network_palette, load_unmatched
from pkg.io import FIG_PATH, get_environment_variables
from pkg.io import glue as default_g... |
086947f1b24d897b0dd559cc9a18655e11b66a4844c0e4bf0754d01f84ebec21 | Python | 9,751 | 383 | #//=============================================================
#//Copyright (c) 2011 G. Gogoshin
#//Distributed under MIT-style license.
#//(see LICENSE.txt or visit http://opensource.org/licenses/MIT)
#//=============================================================
import numpy as np
from itertools import product
... |
9df7cd5ff88c1421193c72c22c112bf28ca7958aa0124abc6f2c8be38859af87 | Python | 9,755 | 298 | """Wrappers for scikit-learn."""
import logging
from typing import Optional, Tuple, Union
import numpy as np
from scipy import special, stats
from sklearn.linear_model import LinearRegression
from sklearn.mixture import GaussianMixture
_logger = logging.getLogger("osl-dynamics")
def linear_regression(
X: np.n... |
aedeefe795114cd96ec085d67ff487c0c8abacdeecc7463ec478679c69807f15 | Python | 9,771 | 206 | # Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
# de Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""Pixel-content regression test for the encoding cameras.
Validates that the depth, semantic-segme... |
2650758f3a34a754aa71862f386fb737df86030b9915d59422a9593d62df1dc1 | Python | 9,778 | 261 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 27 06:01:17 2021
@author: H.yokoyama
"""
from IPython import get_ipython
from copy import deepcopy
from scipy import signal as sig
import matplotlib.pylab as plt
import numpy as np
from PyEMD import EMD
import matplotlib.pylab as plt
#%%
EMD.splineKind = 'cubic'
EMD... |
293c675978e238580ecf1f56942a8a15faf627da135f5ef0d1744824024104c0 | Python | 9,783 | 214 | import os
import argparse
import re
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from scipy.spatial.distance import cdist
from network.resEGNN import resEGNN_with_ne
from data.loader import expand_sh
if __name__ == '__main__':
parser = argparse.ArgumentParser(descri... |
a049c0782c4c58cbf081e45bcb858a6bc53f77c7f8d9a677a09070874e33a5a6 | Python | 9,786 | 275 | """Functions to be called in the main controller
for the behavioral classifier"""
import abc
import optuna
import keras
import pandas as pd
import os
from datetime import datetime
import sys
import logging
from params import load_params
import pymongo
import numpy as np
import json
class Model(abc.ABC... |
d1ad41034b05f7d16511995b4c0aeec5f1c78301e45c900eca981ce03a9da804 | Python | 9,789 | 307 | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
from .cell_class import subtract_baseline, subtract_leak
from .Tools import raiseExpectedGot, timeToIndex
def exponential_curve(p, t):
"""Three parameter exponential.
I = (A + C) * exp (-t/tau) + C... |
3380b2c4515fc5f040db7ab8da6423588204b3101033d2239a3b915c03317476 | Python | 9,791 | 227 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
f85c90d2a410aa53596906dd8db3e3d2daaacd51647b0d29052bf1f68cdf5d04 | Python | 9,792 | 233 | """
File: simple_eqtl_effect.py
Created: 2020/03/16
Last Changed: 2020/06/19
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eith... |
99f6f19a52db8d7f22767c4acb94f999af1e55d60c39eff7e7b84b6d8ac20133 | Python | 9,794 | 294 |
# This file is part of the exercise code repository accompanying
# the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch)
# located at http://github.com/EPFL-LCN/neuronaldynamics-exercises.
# This free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License 2.... |
95e57bafb021755bd5f23c3bb921cce8f9ee151c514121dee94319fa1f2aff4f | Python | 9,795 | 237 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 3.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... |
cc09a75e9ee03f1de95c0a793f8de9593ec95d64883b7b74f65c245c43eeb454 | Python | 9,795 | 195 | #!/usr/bin/env python3
"""
File: decon_eqtl_zscore_jobs.py
Created: 2022/01/24
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software... |
ed31d9657931bf9c6f9e39ddc6af685998bde0295c5466bb73a847d014bddf12 | Python | 9,796 | 313 | import warnings
from math import cos, sin, sqrt
from typing import Callable, Tuple
import numpy as np
def create_spiral(r1, r2, N):
"""
Creates a "propagating spiral", often used as an easy mitotic-like
starting conformation.
Run it with r1=10, r2 = 13, N=5000, and see what it does.
"""
pi =... |
3ade40f2d02d3da558f27f0f2d097c09959e4b13c6630f82cc436d23a0f57046 | Python | 9,800 | 250 | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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 agre... |
a9e2dfa6b3a5cacb03ff5a3a93f67cb2ea875e0e75b1aa29cb366fdb6fd29b65 | Python | 9,801 | 203 | import torch
import torch.nn.functional as F
import argparse, time, datetime, shutil
import sys, os, glob, json, random
import warnings
warnings.filterwarnings("ignore")
sys.path.append("..")
# from torchsummary import summary
from scipy.sparse import csr_matrix, lil_matrix, save_npz, load_npz
from sklearn.metrics imp... |
556eee46b7c8a443a61f73a833e8fb74af086060b4b638a016f7fa8391350175 | Python | 9,803 | 302 | """Hidden Markov Model (HMM) with a Possion observation model."""
import logging
from dataclasses import dataclass
from typing import Union
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
from osl_dynamics import data
from osl_dynamics.inference.layers import (
VectorsLayer,
Se... |
d13765ac7d8883bc1e8504bcbde0e35576662a7afdc8c8ba0628b9811ee651ca | Python | 9,804 | 211 | """Bayesian-observer mushroom-body agent (perception-only AIF reduction).
Same substrate as the Bennett RPE baseline (KC sparse code from real PN->KC wiring,
connectome KC->MBON edge mask), but the learning + DAN signal come from variational
Bayes rather than reward prediction error.
The agent maintains a Bayesian ge... |
2ca7d0b1ca03202454a9657ac953edb3d367d6e4b51b8bdeab4b64c970b8783d | Python | 9,805 | 272 | #!/usr/bin/env python3
"""DVS test suite: F4 sync mode, F5 attribute effects, F7 resolution/FOV, F8 lifecycle.
Run against a live CARLA UE5 server. Each test prints PASS/FAIL; exit code is
the number of failures.
"""
import argparse
import time
import numpy as np
import carla
DVS_DTYPE = np.dtype([
("x", np.uint... |
a69c528cb7220b73a7876de84fe4b7e40ed8502445855a6a9d20beaf2bd71c85 | Python | 9,805 | 328 | '''
- Generate rectangular lattice
- In rectangular domain, assuming periodic boundary conditions.
MAYBE: rewrite get_neighbour_list - there's much easier way for the rectangular lattice
'''
import math
import numpy as np
from scipy.linalg import norm
from carpet.various import get_basis_dual, mod2pi
def get_basis(... |
e52fa12beabb1ac172fbf9aebe32b34310aa452582cf513022c3492856b6bdf4 | Python | 9,806 | 274 | import os
from os.path import join as pjoin
import nibabel as nib
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from nilearn.glm.first_level import FirstLevelModel, make_first_level_design_matrix
from nilearn.image import load_img, concat_imgs
from nilearn.masking import apply_mask, inters... |
688f5a8aa8f46dd14099bac360476b324f93c05cf97e053ea7a41b37449cd2b0 | Python | 9,809 | 291 | model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet101',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch'... |
701a74409c2d6b50da6f803db3ae6d2738defd374e67b00e5e61ce437b2d1932 | Python | 9,820 | 273 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
57c7e9fdbc495a5aa528a4ec4671de77766404b04aff34b043ee1b3e25699aaa | Python | 9,823 | 392 | # %% [markdown]
# ##
import os
import time
import colorcet as cc
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy.linalg import orthogonal_procrustes
from tqdm import tqdm
from graspy.cluster import GaussianCluster
from graspy.embed import AdjacencySpectralEmbed
... |
dfb556d8102f3eb2585fb0413afecebedfc059322de5d0fef6cffe7826ba3a16 | Python | 9,824 | 242 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
6be18934d2bd6784cffa10aee06e2ca663e677a822114a57d2a1573b64127bf9 | Python | 9,826 | 206 | #!/usr/bin/env python3.9
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 09:52:30 2021
@author: paulmueller
Contains the ECOGReader which can read EPILEPSIAE data files and apply downsampling and notch filter
"""
import pandas as pd
import numpy as np
from datetime import datetime
import scipy.signal as scs
class... |
494d9423c5bf7252a553f9872c08cd507af3c9acf882eb04552112a8d1f0e818 | Python | 9,834 | 261 | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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 agre... |
28c43c385940cf724e3963d457d34eb8cd419d533bb46a29d7b079d224dd9f7b | Python | 9,837 | 305 | """
Offset principal component analysis functions.
"""
from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
import numpy as np
try:
from bottleneck import nanmean
except ImportError:
from numpy import nanmean
from scipy.linalg import eig... |
74e0d5a770e1389619e39f2a32e137777b3aad4eb24fd60f860f5b83de43a5d9 | Python | 9,838 | 289 | # libraries
import pandas as pd
import numpy as np
from sklearn import preprocessing
import biovec
import math
import pickle
import tensorflow as tf
from tensorflow.keras.models import Model, load_model
from tensorflow.keras import optimizers, regularizers
from tensorflow.keras.layers import Dense, Dropout, BatchNorm... |
f24bf4df0cfecb61ebf00f9230237f88ac428312b40ea41147232c5d8d4b3fa9 | Python | 9,838 | 290 | # This file is execfile()d with the current directory set to its containing dir.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
#
# All configuration values have a default; values that are comme... |
f885c4b24275ab8fccf75c9037423caded8c4dc754b0c386a02c953ff877c2db | Python | 9,839 | 236 | """
File: main.py
Created: 2020/03/13
Last Changed: 2020/06/08
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 ... |
17b753d121e71e0671d9e1bfb005491c3c072caf6e26c55e28cd0462a9ee821d | Python | 9,841 | 230 | import numpy as np
import imageio
from pathlib import Path
from scipy import ndimage
from tqdm import tqdm
from scipy.stats import loguniform
import random
import shutil
import copy
import flexsim
def write_avocado_volume_stats(obj, out_folder):
mat_counts = obj.get_stats()
thr = 10**-2
air_ratio = ma... |
e54582370708c66419d03df87c42c92b7aea5ded7d66193fffb30a9133e34dd4 | Python | 9,843 | 252 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
f61c8e35b025dccc9ee3d157577a8be707178d7d0d200c211c6bdaeaf1f0c2a5 | Python | 9,846 | 230 | """
This is a re-implementation of the HOG feature extractor from https://github.com/joaofaro/KCFcpp written in python and
found in https://github.com/uoip/KCFpy/blob/master/fhog.py (MIT license)
"""
import numpy as np
import cv2
from numba import jit
# constant
NUM_SECTOR = 9
FLT_EPSILON = 1e-07
@jit
def func1(dx,... |
f9d91bcb1d713ae8cfe9d91c5779b8a042779d097a4323aa0c9a2b966221ba02 | Python | 9,852 | 352 | #%% Imports
from operator import itemgetter
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspy.cluster import GaussianCluster, KMeansCluster
from graspy.embed import AdjacencySpectralEmbed, LaplacianSpectralEmbed, OmnibusEmbed
from graspy.models import DCSBMEstimat... |
bb59a37e02742b9ae26e7b4f148ddb7e3b4d482c5997661b125848d1c2785133 | Python | 9,858 | 278 | #! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from six.moves import xrange
__all__ = [
'minibatches',
'seq_minibatches',
'seq_minibatches2',
'ptb_iterator',
]
def minibatches(inputs=None, targets=None, batch_size=None, shuffle=False):
"""Generate a generator that input a group of... |
ce0a1787104da909f6a1d17d548fd04d2e9af2e90cf01459f7955ded86cd8751 | Python | 9,858 | 306 | """
Code to generate new simulations.
"""
import logging
import numpy as np
import pandas as pd
from tctx.analysis import simbatch as sb
import datetime
#########################################################################################
# Generate new simulation protocols
class ProtocolSweep:
"""
Re... |
8a1d49cb9a161623844712c9bc39cea300333f03833d9a8212baa8d289dbda7a | Python | 9,860 | 202 | import torch
from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
def _flatten_helper(T, N, _tensor):
return _tensor.view(T * N, *_tensor.size()[2:])
class RolloutStorage(object):
def __init__(self, num_steps, num_processes, obs_shape, action_space,
recurrent_hidden_state_... |
d274d8dc740760826483a61d2cd1e64d10b34403046bc18bce228a70a3b1e0df | Python | 9,864 | 321 | import sys
import torch
import random
import numpy as np
import networkx as nx
from typing import Optional
from networkx.algorithms.traversal.breadth_first_search import bfs_edges
from torch_geometric.data import Data
from torch_geometric.utils import k_hop_subgraph
from sklearn.model_selection import train_test_spli... |
6deacfa79646b9fbb472300fff9cff1dec78dad144bee79401836b8d7425f71e | Python | 9,865 | 308 | import numpy as np
from collections import defaultdict
import os.path
from recurrent_rsa.rsa_utils.config import *
from keras.preprocessing import image
###IMAGE UTILS
def overlap(target_box, candidate_box):
saved_x1 = target_box[0]
saved_y1 = target_box[1]
saved_x2 = target_box[2]
saved_y2 = targ... |
04d64b55cdaa785aae5f91da80444d828f4d776ab890f8faeba243335a286720 | Python | 9,868 | 265 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
35075b9aa06ecdd1ecbf1572d1bcdace96486d21856ad3d44ced252e8e9899bd | Python | 9,869 | 220 | # -*- coding: utf-8 -*-
"""Preview
Code for 'Inf-Net: Automatic COVID-19 Lung Infection Segmentation from CT Scans'
submit to Transactions on Medical Imaging, 2020.
First Version: Created on 2020-05-05 (@author: Ge-Peng Ji)
Second Version: Fix some bugs and edit some parameters on 2020-05-15. (@author: Ge-Peng Ji)
""... |
b9c8a7e241181a8cfc871367e129dfd0c55708e9317ce07ea39834a0ea957a48 | Python | 9,871 | 305 | # This script is part of navis (http://www.github.com/schlegelp/navis).
# Copyright (C) 2017 Philipp Schlegel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.