sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d1eea7b3be9db5e434fafd18a059422837d518c2eb1900be4449ee8b584b787a | Python | 24,978 | 537 | """Memory lifecycle of the CUDA-graph cache (``aimnet.calculators.cuda_graph.cache``).
The cached graphs of a calculator share one memory pool owned by the cache. The pool is created by the first
capture, accounted when a graph is captured or rebuilt, and released by ``clear``, a model change, an over-budget
capture o... |
8ae6685017d3ccdb24be25dcb7bb5f14e30e20c696d57c295017f5c8b19cdfd1 | Python | 25,007 | 660 | # coding: utf-8
from typing import Any, Dict, Optional
from zoneinfo import ZoneInfo
import numpy as np
import pytest
import lightgbm as lgb
from .utils import assert_datasets_equal, np_assert_array_equal
pd = pytest.importorskip("pandas")
# ------------------------------------------------------------------------... |
a239651c55cabfc5bf8ce6d013018f8ee526a21df735b00eaad585de7d778136 | Python | 25,040 | 669 | """Tests for ASE calculator interface."""
import warnings
import numpy as np
import pytest
from conftest import CAFFEINE_FILE, CIF_SPIRO
# All tests in this module require ASE
pytestmark = [pytest.mark.ase, pytest.mark.weights]
MODELS = ("aimnet2", "aimnet2_b973c")
NSE_MODEL = "aimnet2nse"
class TestBasicCalculat... |
8e70df6f27f69e9837c1cc93b81fa7ebcd614a569fb78326b2a82128d0e19cc3 | Python | 25,050 | 584 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, force_fp32
from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
from mmdet.models.builder import HEAD... |
a5a31cfac47c3a84749947a4edf643bcee92fb4ef3aff59aae65e95746e60ba2 | Python | 25,075 | 719 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import numpy.random as npr
import copy
from lib.model_zoo.common.get_model import get_model, register
from lib.model_zoo.common import utils
from .optimus_models.tokenization_gpt2 import GPT2Tokenizer
version = '0'
symbol = 'optim... |
55946e056936e8d6e475d6a78c94d662bc3fd53f8aa9bcf9e1d138bc213c5968 | Python | 25,076 | 597 | import pandas as pd
import re
import os
import numpy as np
import nibabel as nib
import abc
import colorcet as cc
import matplotlib.pyplot as plt
import seaborn as sns
import copy
import subprocess
from nilearn import plotting
from typing import Dict, Tuple
from statistics.utilities \
import CONFIG
from statistics.... |
df6d9be90e2665cd8dac147da8e4646915d4bf71a3a9150c1aa686186698cef0 | Python | 25,168 | 718 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
import inspect
import warnings
from functools import partial
from typing import Any, Callable, Dict, Optional, Sequence, Union
import numpy as np
import ... |
2a90a65ad55025556289d71452c26cb979d717fb7f004c860af824cd8d796cdd | Python | 25,189 | 587 | import sys
from collections import Counter
import numpy as np
from genomad import utils
from genomad._paths import GenomadData, GenomadOutputs
def get_empirical_sample_composition(score_array):
counts = Counter(score_array.argmax(1))
counts = [counts[i] for i in range(score_array.shape[1])]
return np.arr... |
4ab4424bfd925249e27a0c8789be1035afb9d883bc7fbe67863897ff6c65bb3d | Python | 25,266 | 568 | from __future__ import print_function
import numpy as np
import torch
import torch.utils
import torch.utils.checkpoint
import torch.nn as nn
import torch.nn.functional as F
import random
from transformers import XLNetTokenizer, XLNetLMHeadModel
AMINO_ACID_ORDER = 'ACDEFGHIKLMNPQRSTVWYX'
def featurize(batch, device):... |
c9bdc847d807a84e9def83eb5ba9b946451ecfc55b817e4b93f60e23788d58f4 | Python | 25,329 | 741 | # Imports #
import configparser
import numpy as np
import pathlib
import random
import statistics
import traceback
import time
from Classes.Protocol import ImageButton, ProtocolBase, PreloadedVideo
from kivy.clock import Clock
from kivy.config import Config
from kivy.uix.button import Button
from kivy.uix.image impo... |
b6b60079fee852efcf8a6de600904b2061d86da9b0d109f55983ec711f450777 | Python | 25,335 | 683 | from datetime import datetime
import functools
from importlib.metadata import version, metadata
import pkg_resources
import re
import textwrap
from typing import List, Literal
from q2cli.core.state import get_action_state
from q2cli.core.usage import CLIUsage, CLIUsageVariable
import q2cli.util
from qiime2.core.type i... |
2dfd2ee3d34f8e37421f60794f51b742a3600e0eb528873111b88be8583e9dbd | Python | 25,383 | 605 | from elasticsearch import Elasticsearch, RequestsHttpConnection, serializer, compat, exceptions
import hashlib
import utils
import json
from os.path import join, isfile
from os import listdir
from cohortanalysis import load_all_docs
from datetime import datetime
import sys
import requests
from requests.packages.urllib3... |
7e058585d06b85cd4c4762692b37e12673a169d13727c495b2d24b8a038723db | Python | 25,386 | 596 | # -*- coding: utf-8 -*-
"""
@author: yaron
Created on Sat Dec 23 10:41:45 2017
Functions to create a B-spline basis with constraints. The book that was most
useful to figuring this out was:
Trevor Hastie, Robert Tibshirani, Jerome Friedman
The Elements of Statistical Learning: Data Mining, Inference, and Prediction
... |
09ca593f065d5e94b5063718faefe1db9113e86b9fed49c733cc34e4e750e3a0 | Python | 25,502 | 629 | """Interactive Regression Model (IRM) based on the new DoubleMLScalar hierarchy."""
from __future__ import annotations
import warnings
from typing import Any, ClassVar
import numpy as np
import pandas as pd
from sklearn.base import clone
from sklearn.utils.multiclass import type_of_target
from typing_extensions impo... |
6388c41e286634161ead19a270796de89daee0c709a9851947645732a4c895c8 | Python | 25,603 | 593 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import BaseModule, auto_fp16, force_fp32
from torch.nn.modules.utils import _pair
from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
from mmdet.models.builder import HEA... |
0dd37c6e2a8aa8f98835954bc82b09dcc5ec7ffb64a62f94882166f5196afbf4 | Python | 25,683 | 605 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn.functional as F
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes,
merge_aug_masks, multiclass_nms)
from ..builder import HEADS, build_head, build_roi_extractor
from ..uti... |
b2fcef1230bba8a985dd4102c1d0949dc80de8ec776ec79e43cbb43233c7a98f | Python | 25,718 | 693 | """ Standard Linear regression models. """
import warnings
from math import sqrt
from pathlib import Path
from pprint import pformat
from typing import Optional, Sequence, Tuple, Union
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from scipy.stats import skew, kurt... |
5504c40a69bf4b7bad42b04e4a89408207bcbfe893f51fb55e1a01ec248b353a | Python | 25,747 | 640 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from dataclasses import replace
from enum import Enum
from typing import Any, Callable, Literal, Optional, Union
from torch import nn
from sbi.neural_ne... |
c68ae1dbe02468cdfdade978a695233a428893cedd8e88577133de43731d69a5 | Python | 25,792 | 511 | import sys
import pandas as pd
import numpy as np
from scipy import stats
import pymannkendall as mk
import os
from pathlib import Path
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
def LoadPredictors_Save_Csv(config, runType):
''' Import ASAP data in the csv format,
check agreement w... |
22028cab2cfb358412d83686ba6c649b57635cfd96a3f4c3369db608d6cf421a | Python | 25,975 | 583 | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... |
36f4d76ead317c0cb5c999c08e7385f990aa5dcb77fbdd9d042f92f15fda37f3 | Python | 25,996 | 721 | # -*- coding: utf-8 -*-
import re
import os
import sys
import shutil
import platform
import subprocess
import time
import inspect
import ast
import copy
from pathlib import Path
from collections import namedtuple
from shutil import copyfile
from filecmp import cmp as compare_file
from PyQt5.QtWidgets import QMessageB... |
6342e8b068629978af2056340c1308cdb637a9e3a701d9c11491fba5cbce3eca | Python | 26,224 | 563 | import pandas as pd
import numpy as np
from os.path import join
import os
from glob import glob
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.ndimage.interpolation import zoom
import nibabel as nib
import h5py
from tqdm.notebook import tqdm
from sklearn.model_selection import train_test_split
from ... |
b6248a7fe124bac155ca466f01cf42fef00d107dfccf850fbdabe5dee9ac3e93 | Python | 26,267 | 779 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from __future__ import annotations
from dataclasses import dataclass
import pytest
import torch
from scipy.stats import binomtest
from sklearn.neural_ne... |
9c608fd10c7b360b0f4a486a031fabe5e80eb4e3a8a64eaff876089eaee5b18b | Python | 26,329 | 619 | # Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) 2019 Western Digital Corporation or its affiliates.
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import (ConvModule, bias_init_with_prob, constant_init, is_norm,
normal_init)
from ... |
45642a571f0eb3a4c693e99c05e99a31990bd0f952746850569bcd18343e009c | Python | 26,363 | 601 | #!/usr/bin/env python
from os import path, symlink
import sys
from picrust2.default import (default_ref_dir_bac, default_ref_dir_arc, default_tables_bac,
default_tables_arc, default_pathway_map)
from picrust2.place_seqs import identify_ref_files
from picrust2.util import (make_output_dir,... |
a2c8f69e19d46bde7be1148c65b26b739481062532ca65117650f04fd38c73e6 | Python | 26,504 | 546 | from jax.config import config
import os
config.update('jax_enable_x64', True)
os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false'
import sys
sys.path.append('../')
import jax
import jax.numpy as jnp
import numpy as np
from functools import partial
import plot
from einshape import jax_einshape as einshape
import math
... |
08752ed98bb6f850853eb4b4673ace87eb2da3f597831949a36f55b22f8addf0 | Python | 26,547 | 671 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 7 16:51:34 2021
@author: fhu14
Backend for the models derived from the models defined in spline_backend.py.
These are the models that will be exposed at the top level of the package
for use by the rest of the code.
"""
#%% Imports, definitions
import numpy as np
Array =... |
a97b7ad705bbfa9ea9da2cec8b71b1388c69ec33da5e4c048fd8f9c068d25f9c | Python | 26,578 | 575 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 24 22:12:39 2020
@author: tungbioinfo
"""
import pandas as pd
import numpy as np
pd.options.mode.chained_assignment = None
pd.set_option("display.max_columns", 60)
import matplotlib.pyplot as plt
import seaborn as sns
import itertools
from scipy... |
c777fa240c703683e16c72a97199a8d422c2318e86ecbc3c05fdbb243a43b631 | Python | 26,650 | 575 | """layer2c.py
This file is part of keras2c
Copyright 2020 Rory Conlin
Licensed under MIT License
https://github.com/f0uriest/keras2c
Writes individual layers to C code
"""
# imports
from keras2c.io_parsing import layer_type, get_model_io_names, get_all_io_names, get_layer_io_names, flatten
import tensorflow as tf
tf.... |
f7f57090b2cc9998ad925082614d617d8f52355d50e7e0616318e9f373da11e6 | Python | 26,652 | 469 | import torch as th
from torch.nn import functional as F
import torch.nn as nn
import numpy as np
import anndata as ad
import scipy as scp
from torchdiffeq import odeint
from latentvelo.models.velocity_field import ATACRegVelocityField
from latentvelo.models.modules import MLP, GCN, GCNCombined, ATACGCN
from latentve... |
e8ad4711146d46986726158fc193e7821337a351aa9bdd0dbec8735e9069b2ed | Python | 26,706 | 729 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import cv2
import numpy as np
from mmpose.core.post_processing import transform_preds
def _calc_distances(preds, targets, mask, normalize):
"""Calculate the normalized distances between preds and target.
Note:
batch_size: N
num... |
53cda43be1842043ddb0cd080e249539b9e81c5a30395d24344a7c09d4edb906 | Python | 26,752 | 546 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 24 14:36:54 2021
@author: baris
"""
import seaborn as sns, numpy as np
import matplotlib.pyplot as plt
import glob
import pandas as pd
from scipy.stats import pearsonr, spearmanr
import os
from mpl_toolkits.axes_grid1 import make_axes_locatable
f... |
0a2f4e72d0d2dbf3a0b08497d8cc81a1a888db37e8e06b8fef979c0c81eb301c | Python | 26,794 | 592 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
import warnings
from typing import Optional, Union
import torch
from torch import Tensor, log
from torch.distributions import Distribution
from sbi.infe... |
1090e550e02cee6bf282acf01174c252d80c73e0b195492742db03fdf937175f | Python | 26,900 | 781 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from __future__ import annotations
from typing import Callable, Dict, Tuple
import pytest
import torch
from torch import Tensor, eye, zeros
from torch.d... |
8e7fcf041c2addca18ffafc7e1f26096552969c34ab938ee92a2174744c384c9 | Python | 26,950 | 607 | # Imports #
import kivy
import zipimport
import sys
import os
import configparser
import time
import numpy as np
import csv
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.floatlayout import Fl... |
b686a6fca7d5af27387109b643747908611ea9aaa06b1e4873879dd5189dd14d | Python | 26,978 | 782 | """Abstract base class for multi-treatment DoubleML models (parameter vector estimation)."""
from __future__ import annotations
import copy
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any
from typing_extensions import Self
if TYPE_CHECKING:
from .utils._tune_optuna import DMLOptunaResu... |
9d1d2c7b1062ad9f0b8143bbd1b5c4f65ab7904d40e357e8e2ea89700c30494e | Python | 26,999 | 693 | # coding: utf-8
from datetime import date, datetime
from typing import Any, Dict, Optional
import numpy as np
import pytest
import lightgbm as lgb
from .utils import assert_datasets_equal, np_assert_array_equal
pl = pytest.importorskip("polars")
# ------------------------------------------------------------------... |
e41c40902f2b4203bf1d27788f29883733cac912ffbbe8d6c4ef97ca2f5c297c | Python | 27,031 | 875 | import numpy as np
import cv2
import scipy.ndimage.filters as filters
from scipy.ndimage.filters import convolve
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt
#import caiman as cm
import trefide.extras.tools as tools_
import trefide.extras.tool_grid as tgrid
import trefide.e... |
254215eb25df0fe6cfe9ffaac39cca8e925baef8784137d8b532bf7b61f9f672 | Python | 27,036 | 784 | """Shared pytest fixtures for AIMNet2 tests."""
import contextlib
import functools
import os
import shutil
import sys
import tempfile
import warnings
from collections.abc import Generator
from contextlib import contextmanager
from pathlib import Path
import pytest
import torch
from torch import Tensor
# ============... |
698fde9b36d29b3217c320ee9c4605b4d62929acd1aeb8dabdbadb0d4a2fb382 | Python | 27,042 | 696 | import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import rfft, irfft, fftfreq, fft, ifft
from scipy.fftpack import fftshift
from tqdm import tqdm
import pyroomacoustics as pra
import matplotlib
from .Patch_3D import Patch
import time
import math
import torch
import os
import pickle
from .MUSIC_bloc... |
0e22c7cb73ba42e3f6f160d9f708816f90a4a034dd1a975819af69c792db6561 | Python | 27,079 | 552 | # -*- coding: utf-8 -*-
"""
Created on Sun May 29 13:20:53 2022
@author: fhu14
"""
"""
Code to create datasets based off the full_master_dset.p file which should
exist.
It is generally assumed that the 'cc' version of a dataset is first, and the
'wt' version comes second or is copied.
For generating larger datas... |
62d7ead7212654c43b955d4232ce10ba29bba7445c6881dcb65f7a8eb0ef8c07 | Python | 27,113 | 616 | # Imports #
import kivy
import zipimport
import sys
import os
import configparser
import time
import numpy as np
import csv
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.floatlayout import Fl... |
7665788cbda9c7d083e8becaf9296e70241848abb0744268043bb1e04c18fd6b | Python | 27,237 | 594 | from copy import deepcopy
import numpy as np
import torch
import os, sys
import json
import pandas as pd
from torch.utils.data import DataLoader
import torch.optim as optim
import matplotlib.pyplot as plt
from sksurv.metrics import concordance_index_censored, brier_score, integrated_brier_score, cumulative_dynamic_auc
... |
c380d48ce4fb3bdca028a4ad5cd3321ac5677aecec40a2b1a598defe731d6665 | Python | 27,355 | 563 | #!/usr/bin/python
"""
Defining tensorflow.keras training the models
"""
import os
import numpy as np
import time
import os.path
import tensorflow as tf
from tensorflow.keras import optimizers
from tensorflow.keras.callbacks import Callback, ModelCheckpoint, History, ReduceLROnPlateau, TensorBoard, LambdaCallback
from... |
37ab22d82dae7291ea8699c1f30da66d096f6b3a1c7171e315a0875683c36b02 | Python | 27,410 | 630 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import force_fp32
from mmdet.core import (build_assigner, build_bbox_coder,
build_prior_generator, build_sampler, images_to_lev... |
097c5c136357db647b1ae8813edda25a0f46f330d7e09e2046ffda6db402c6a8 | Python | 27,461 | 689 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmdet.core import BitmapMasks, PolygonMasks
def dummy_raw_bitmap_masks(size):
"""
Args:
size (tuple): expected shape of dummy masks, (H, W) or (N, H, W)
Return:
ndarray: dummy mask
"""
... |
66211f1a33092ac8756f454f6ff21281ae92e3f35614b19db14a5f75337befb3 | Python | 27,630 | 628 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn.functional as F
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes,
merge_aug_masks, multiclass_nms)
from ..builder import HEADS, build_head, build_roi_extractor
from ..uti... |
3143c5cd00f74e9a99633efe423506e7964342e4a344e8fd285216de254f7b22 | Python | 27,668 | 631 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.runner import ModuleList
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner,
build_sampler, merge_aug_bboxes, merge_aug_masks,
multicl... |
58f18498e3ac92cb78a8efa3d56658ef17bf74b5904c885caf40e6a9316782de | Python | 27,727 | 729 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 9 17:54:58 2021
@author: baris
"""
from neural_coding import load_spikes, rate_n_phase
from perceptron import run_perceptron
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from sklearn import decompos... |
e4845ad9685f5bf552c81dcd73faa184d64e187fd51a34b4406a24263dce0499 | Python | 27,852 | 635 | # -*- coding: utf-8 -*-
"""
Output
=======
This module contains classes used for representing the output of extraction procedures.
author: Damian Wilary
email: dmw51@cam.ac.uk
"""
import copy
from abc import ABC, abstractmethod
from collections import Counter, namedtuple
from collections.abc import Iterable
import n... |
26df0e94b3c2b57d01b6e1508a17391b6d265edf17c2c30d669e8c184e23175a | Python | 27,913 | 648 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, Scale
from mmcv.runner import force_fp32
from mmdet.core import (anchor_inside_flags, bbox_overlaps, build_assigner,
build_sampler, images_to_level... |
7fed7e50a8ff5d06fbcbc8c6824c0d548908844a06dc2762334e1b40ce2ef9e1 | Python | 27,951 | 632 | import inspect
import warnings
import numpy as np
from sklearn.base import is_classifier, is_regressor
from sklearn.utils.multiclass import type_of_target
from sklearn.utils.validation import has_fit_parameter
def _check_in_zero_one(value, name, include_zero=True, include_one=True):
if not isinstance(value, floa... |
727bf3ea65028f3dfde39620de181c9c0089576f48529e4b91f2dba74c2a3338 | Python | 27,953 | 767 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 23 10:33:01 2021
@author: baris
"""
import seaborn as sns, numpy as np
import matplotlib.pyplot as plt
import os, glob
import torch
from torch.autograd import Variable
import torch.nn as nn
from torch import optim
path1 = '/home/baris/resul... |
4465da8e4350035597656847eae6bba1c31d24a7c2a2ef895ec324e6123adbc8 | Python | 27,965 | 757 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Dataset modules."""
import logging
import os
from multiprocessing import Manager
import numpy as np
from torch.utils.data import Dataset
from parallel_wavegan.utils import find_files, read_hdf5
class A... |
eaf3a09f01b271d5a8fd8303664f6e9cac099c9ee0ca60494c20ae0922e82178 | Python | 28,008 | 538 | import argparse
import glob
import logging
import math
import os
import random
import shutil
import time
from pathlib import Path
import numpy as np
import torch.distributed as dist
import torch.nn.functional as F
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
import torch.utils.data
impor... |
612ffba7c54518ba0d3c8b4dc85972f8e0cebecfe95306b0a863bcaaba3c8aff | Python | 28,048 | 763 | #!/bin/env python
#
# Copyright 2013-2014 Graham McVicker and Bryce van de Geijn
#
# 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 ... |
e524e85f81a2121e85e0e50b8f409d445b4a84b9b0036f4ee22ab3c5723a5d43 | Python | 28,177 | 747 | import os
from collections import OrderedDict
from functools import partial
from typing import Any, Dict, List, Tuple, Union
import numpy as np
import torch
import xgboost as xgb
from torch import nn
from torch.utils.data import DataLoader
from torchmetrics.functional import (
mean_squared_error,
pearson_corrc... |
3b66abb46667adc46df8b1f0028e180f1bbe7249cd268a74eb80092a3ed6a5e3 | Python | 28,214 | 688 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
from glob import glob
import os
import re
import tempfile
from typing import Optional, List, Tuple, Dict
import torch
fr... |
9d3895756c7284f675f91dc3e10ba9ba4b44105b233f993d49680ca9541ed74d | Python | 28,359 | 733 | # Copyright (c) OpenMMLab. All rights reserved.
from collections import OrderedDict
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from mmcv.cnn import build_norm_layer, constant_init, trunc_normal_init
from mmcv.cnn.bricks.transformer i... |
e1a0158d8f7df60f5d6062c8803f0866eb31740da9f5958da6f4de22ead8906d | Python | 28,384 | 615 | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
###############################################################################
# Helper Functions
###############################################################################
class Identity(nn.Modu... |
9c3324ea08c5a615623e881a2cc788cf8edea26b4ff3192c3e495199f9d92c43 | Python | 28,417 | 636 | ############################################
# imports
############################################
import os
import subprocess
from abc import abstractmethod
import pandas as pd
from oligo_designer_toolsuite._exceptions import ConfigurationError, DatabaseError
from oligo_designer_toolsuite.database import OligoData... |
26061ab329acc27a658252ffc9f68f4d4c6468898c3f7e4d8e27100e9c7e2a53 | Python | 28,498 | 742 | import sys
import re
import string
import os
import io
import p4.func
import copy
from p4.var import var
from p4.p4exceptions import P4Error
from subprocess import Popen, PIPE
from builtins import object # For Py2/3 compatibility, needed for redefinition of __bool__() below in Py2
from p4.sequence import Sequence... |
6faacd00d21af6718a3a9088e67385668c83fcac0bd3d7150f70423052f344d4 | Python | 28,513 | 705 | # -*- coding: utf-8 -*-
"""
@author: yaron
Created on Sat Dec 23 10:41:45 2017
Functions to create a B-spline basis with constraints. The book that was most
useful to figuring this out was:
Trevor Hastie, Robert Tibshirani, Jerome Friedman
The Elements of Statistical Learning: Data Mining, Inference, and Prediction
... |
34a9c188afc2303edb8691901f8287824f79115da04be17f37eb55e8bb3c16bb | Python | 28,593 | 626 | import functools
import torch
import torch.nn as nn
from torch.nn import init
from torch.optim import lr_scheduler
class Identity(nn.Module):
def forward(self, x):
return x
def get_norm_layer(norm_type='instance'):
"""Return a normalization layer
Parameters:
norm_type (str) -- the nam... |
726ac04030baac105ce26a9930dfee08ee8a7d682d2d6f48edc5cc56fdbf4e5c | Python | 28,611 | 660 | """
author: mathildelpx
creationTime: 22/02/2022
goal: load calcium imaging data output from suite2p, behavior pre-processed data and compute map of recruitment and
regressor analysis.
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats.mstats import zsco... |
93892bae28c96d56e5028d464f7b44c08d52a0a8559557a71624cfa4e218445e | Python | 28,613 | 656 | import numpy as np
from neuron import h
import pdb
# generate variable lists for DeepDendrite
def gen_files(network, out_g, out_in2hd_syn, out_h2out_syn, out_w, out_dw, out_stim):
for i in range(10):
for syn in network.synlist_in2hd:
seg = syn.get_segment()
mech_id = network.seg2s... |
4c4d40911d93994c25c93f044c83110fba0504eca50d0a37fd2271420058b6d2 | Python | 28,672 | 450 | # -*- coding: utf-8 -*-
#File Name : StimulationsCodes.py
#Created By : Aurelien Van Langhenhove
## Stimulation codes
## Originally from openvibe-toolkit/ovtk_defines.h
OpenViBE_stimulation = {
'OVTK_StimulationId_ExperimentStart' : 0x00008001,
'OVTK_StimulationId_ExperimentStop' ... |
efc82e91b999ed62220dbdbe7ae68c0a845a145663786af8c00ad03efeccc8ef | Python | 28,692 | 734 | import joblib as jl
import text_generaliser as tg
import json
import spacy
import utils
_STOP_POS_TAGS = ['SPACE', 'VERB', 'PUNCT', 'CCONJ', 'ADP']
_en_model = None
_acc_high_threshold = .75
_acc_low_threshold = .25
class SentencePatternInst(object):
def __init__(self):
pass
@property
def senten... |
c6452e217d12ee8d9e593a9f487851da57665beb83bc4961ad3874aaf9db4eaf | Python | 28,693 | 531 | #!/usr/bin/env python3
"""
Feature extraction for ASR models supported by Hugging Face.
"""
import argparse
import collections
import copy # for freezing specific parts of networks during randomization
import itertools
import json
import os
import operator
from pathlib import Path
import re
from typing import Dict, I... |
82144287ecbce0a5234d3d4d5b7b59a02e321708974fe6c01143899b437d09ba | Python | 28,754 | 459 | import argparse
import os.path
def main(args):
import json, time, os, sys, glob
import shutil
import warnings
import numpy as np
import torch
from torch import optim
from torch.utils.data import DataLoader
from torch.utils.data.dataset import random_split, Subset
import copy
im... |
fe297c1ecbe1ab8f97dd54bc23ef0eace3e6dd0c93306f422080dcd8318cdeeb | Python | 28,799 | 771 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
import os
import pytest
import torch
import torch.jit
import numpy as np
from torchmdnet.models.utils import OptimizedD... |
1ebb422a9e02f648b09e6186c7d0cbba7d1b5516aa576124d7d5ceaca4317b5a | Python | 28,801 | 761 | # ----------------------------------------------------------------------- #
# Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
# #
# Software Name: Fast Autonomous Scanning Toolkit (FAST) #
# By: Argonne Na... |
4bfa7aca8a90bcd6b7aa15f2c88a9f79b864c3279ddd7286d57789724398eb41 | Python | 28,827 | 646 | import sys
import os
import numpy
from p4.p4exceptions import P4Error
# A Ala Alanine
# R Arg Arginine
# N Asn Asparagine
# D Asp Aspartic acid
# C Cys Cysteine
# Q Gln Glutamine
# E ... |
0efc3343c816d9c3b26145e8509d99677f1ec8c7f67100f367c58da42038871e | Python | 28,870 | 814 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
import torch
from typing import Optional, Tuple
from torch import Tensor, nn
from torchmdnet.models.utils import (
... |
1687777abd12d0f74c0c2c42b3e7bc7f6b4ec2f30e735bd8b6932cffa3877e3c | Python | 28,880 | 890 | # Imports #
import configparser
import numpy as np
import pathlib
import random
import time
import traceback
from Classes.Protocol import ImageButton, ProtocolBase, PreloadedVideo
from kivy.clock import Clock
from kivy.config import Config
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.... |
fff6fb425f7527ded062cf3cdedfd871efd0a0ea324fe79f57b9b70467d47afb | Python | 28,892 | 744 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Callable, Dict, List, Optional, Tuple, Type, Union
import nump... |
1c0b6b0bad8e9455a6c54475ead56ac28b25efedbfa201b967aa3b31d473c3bd | Python | 28,952 | 811 | # -*- coding: utf-8 -*-
"""
Segments
=======
Models created to identify different regions of a chemical schematic diagram.
Module expanded by :-
author: Damian Wilary
email: dmw51@cam.ac.uk
Previous adaptation:-
author: Ed Beard
email: ejb207@cam.ac.uk
and
author: Matthew Swain
email: m.swain@me.com
"""
from __future... |
91760c52206b25a5e5f358e8c7c6327cc92dd07438c084bd304294e61b1bfdda | Python | 29,199 | 698 | from decimal import Decimal
import numpy as np
import pandas as pd
import pytest
from sklearn.linear_model import Lasso, LogisticRegression
from doubleml import DoubleMLData, DoubleMLDIDCS, DoubleMLDIDData, DoubleMLPLR, DoubleMLSSM, DoubleMLSSMData
from doubleml.data.base_data import DoubleMLBaseData
from doubleml.di... |
36126dab382149f5640971fa7fa8e9a988dceb81cf8c3782800743d811071211 | Python | 29,247 | 980 | import os
import pickle
import copy
import json
from collections import defaultdict
import numpy as np
import random
import torch
from rdkit import Chem
import networkx as nx
import imp
import h5py
from tqdm import tqdm
import hashlib
import torch as pt
from glob import glob
import pandas as pd
import ase.units as unit... |
b6d6bcdfdd819f485cbec52925794707b5c594061af0fbc1c586ae02e7252236 | Python | 29,269 | 729 | # dataloader.py: Prepare the dataloader needed for the neural networks
# Created: 5/21/2021
# Status: OK
import numpy as np
from sklearn.model_selection import StratifiedKFold
import glob
import torch
from torch.utils.data import Dataset, DataLoader
from utils import read_csv_cox2, read_csv_cox, read_csv_pre, rescale,... |
4f716032a3d2608670bf74b988de50afe193444dc593a90eef9e357e7858c31c | Python | 29,287 | 634 | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
###############################################################################
# Helper Functions
###############################################################################
def gray2color(img):
... |
95d0b33672ae6f92fe316cf0e6c1ea002fa502a96b023d212a3c71151de75fa8 | Python | 29,298 | 693 |
######################
#What follows are functional programming forms of the above code, which are more
#clunky and have somewhat less functionality. However, they are here if your
#really want them.
class Distribution_Fit(object):
def __init__(self, data, name, xmin, discrete=False, xmax=None, method='Likelihood... |
0078c0897b0b81b68bfa7780fd1ee70d6a8780a5f02f4d31a22521c8fc04251a | Python | 29,319 | 724 | """layer2c.py
This file is part of keras2c
Copyright 2020 Rory Conlin
Licensed under LGPLv3
https://github.com/f0uriest/keras2c
Writes individual layers to C code
"""
# Imports
from keras2c.io_parsing import (
layer_type, get_model_io_names, get_all_io_names, get_layer_io_names, flatten
)
from keras2c.types impor... |
c71f4481207e92245107f2da4cb0852989c21b89ed99f9877549e3aa94ec8e8f | Python | 29,334 | 691 | #!/usr/bin/env python3
"""
compare_plm_methods.py
──────────────────────
Fair comparison of MVLM against two recently published PLM-based
drug-target interaction methods on the strict KIBA benchmark:
- PMMR (Ouyang et al., Bioinformatics 2025, doi:10.1093/bioinformatics/btaf002)
- MGF-DTA (Ni et al., Int J Mo... |
cce37b2159a727a4abfc93298d6538051b6a0cf67af5b9475ea4a5dc7c95183d | Python | 29,467 | 708 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from abc import ABC, abstractmethod
from copy import deepcopy
from dataclasses import asdict, replace
from typing import Any, Callable, ClassVar, Dict, Op... |
316c710cdcddc3edfcac9b02b40e2bce275a75c96c16625176d629c87ea25397 | Python | 29,505 | 797 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
import math
from typing import Optional, Tuple
import torch
from torch import nn, Tensor
import torch.nn.functional as ... |
f0dc812de2099ffe59f67981262568121c7cc3202c4215217c7dba254bab1436 | Python | 29,531 | 504 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 28 14:34:30 2021
@author: nehas
"""
import numpy as np
import sys
import pandas as pd
pd.set_option('display.width', 1000)
pd.set_option('display.max_colwidth', 100)
import warnings
warnings.simplefilter("ignore")#, category=FutureWarning)
import glob
import os
print ... |
60fd362deeb3549d0a9ef5c49e23276d2d8ab99125ad32efcca55a24dbb880e8 | Python | 29,600 | 844 | import os
import re
from string import *
import sys
import subprocess
import datetime
from collections import defaultdict
#SET OF UTILITY FUNCTIONS FOR mapEnhancerFromFactor.py
#==================================================================
#==========================I/O FUNCTIONS===========================
#=... |
7bb7fd906afd084de670ea2c1d993c1fce3bdb99485052c6c382701069c82f03 | Python | 29,609 | 701 | # Imports #
import kivy
import zipimport
import sys
import os
import configparser
import time
import numpy as np
import random
import csv
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.floatla... |
b5d841d103506d5177a09208d3fdc02d99a5ac31fa5913ff73035ea00ea5370d | Python | 29,656 | 501 | import sys
import pandas as pd
import numpy as np
import os
import copy
import re
from B_preprocess import b101_load_cleaned
from E_viz import e110_ope_figs
from F_post_processsing import F100_analyze_hindcast_output
from B_preprocess import b50_yield_data_analysis
import datetime
import glob
from pathlib import Path
... |
22cefa948b222701347fbcbe43e6c7debc4957f593971d4366da83bbc713f078 | Python | 29,678 | 746 | import warnings
from typing import Optional
import numpy as np
from scipy.stats import norm
from sklearn.utils import check_X_y
from sklearn.utils.multiclass import type_of_target
from doubleml.data.base_data import DoubleMLData
from doubleml.double_ml import DoubleML
from doubleml.double_ml_score_mixins import Linea... |
576c79e80f22674981d7038904d690baa546c75d1de831d87fd4f4c7070edb3c | Python | 29,698 | 775 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import cv2
import numpy as np
from mmpose.core.bbox import bbox_xywh2cs
from mmpose.core.post_processing import (affine_transform, fliplr_joints,
get_affine_transform, get_warp_matrix,
... |
5e7b3693e2991400c52153a5f5aa2ee05f8f6508a61f113d43b360ecc09ca337 | Python | 29,757 | 665 | """
Assorted utility functions used throughout
"""
import scanpy as sc
import scvelo as scv
import numpy as np
import scipy as scp
import torch as th
import anndata as ad
import gc
from .velocity_genes import compute_velocity_genes
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
def unique_index(x):
... |
9822a38275c9cad151e0a23bee262ce0c6a36326dc78b8729b245e70a19a2195 | Python | 29,857 | 618 | #! /usr/bin/env libtbx.python
# -*- coding: utf-8 -*-
# =============================================================================
# Created at:
#
# Author:
# Grzegorz Chojnowski - gchojnowski@gmail.com
# =============================================================================
## @file doubleHelix
#
# A prog... |
3c2bee0496753d70b6355ed6b0bded697cef32f16fb9a2d85869e4ea2d5c1e62 | Python | 29,872 | 746 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
# from timm.models.layers import to_2tuple, trunc_normal_
from mmcv.cnn import (build_activation_layer, build_conv_layer,
build_norm_layer, trunc_normal_init)
from mmcv.cnn.bricks.transformer import bu... |
a17f3114064c5c3f37e1dbf9d391cc6f466bcf198e03ca702de8d0b2010a33b4 | Python | 29,888 | 791 | # Copyright 2013 Graham McVicker and Bryce van de Geijn
#
# 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 la... |
6dd776465ad6431b7d070d6a9770405696020a30ae8c9a0319575093d32ffadc | Python | 30,019 | 733 | """Base models/modules in PyTorch."""
import numpy as np
from scipy.special import softmax as scipy_softmax
from scipy.stats import entropy
import torch
from sklearn.metrics import accuracy_score, r2_score
from torch import nn, save
from daart import losses
# to ignore imports for sphix-autoapidoc
__all__ = [
'r... |
53a0b0170701aa2faa13639d29054ca8e1275ab42a2922a532cd39b186cc4451 | Python | 30,050 | 734 | """Base models/modules in PyTorch."""
import math
import numpy as np
import os
import pickle
from scipy.special import softmax as scipy_softmax
from scipy.stats import entropy
import torch
from sklearn.metrics import accuracy_score, r2_score
from torch import nn, save
from daart import losses
# to ignore imports for... |
21b2a45d80e818bb1277b9e61e08ea05cfc248e587eccc9bfabdb92b0154d6c3 | Python | 30,086 | 750 | from collections import namedtuple
import warnings
import torch
from torch import nn, Tensor
import torch.nn.functional as F
# from .._internally_replaced_utils import load_state_dict_from_url
from typing import Callable, Any, Optional, Tuple, List
__all__ = ['Inception3', 'inception_v3', 'InceptionOutputs', '_Incept... |
90ba7727ac0a1817a144a76a933679b135fdf4a66aaea4a6db94253b4a8fb1d3 | Python | 30,123 | 860 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
Routines for loading and preparing Krupic lab datasets
Resolution for the camera used to record R1 is 350px/m;
resolution for other rats (R11 and R18) was 338px/m
Fs = 50.0 # Sample rate of data (samples/second)
"""
import os
import warnings
import numpy ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.