sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0dfb823512ef0d34f45861646c110d9ca22da93075190041587b2876b5b557a8 | Python | 7,300 | 162 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import networkx as nx
from plotgiiSurf import plotgiiSurf
# plotNetwork3(covMat_yesAD, NetworkDataGeneral.Schaefer400x7.GII, currCoM,LabelNames,cRange,MakerVecYes,panelAll,pSelectCol,colorVec,3)
def plotNetwork3(currFig, adjMtx,... |
09454cc1dcf31425f8adddfdc6941706bbcfd372692b92dd61ee30108edd3b50 | Python | 7,301 | 211 | """Time series kernel kmeans."""
import numpy as np
from sktime.base.adapters._tslearn import _TslearnAdapter
from sktime.clustering.base import BaseClusterer
class TimeSeriesKMeansTslearn(_TslearnAdapter, BaseClusterer):
"""K-means clustering for time-series data, from tslearn.
Direct interface to ``tslea... |
9a6b2585dd5b6cbbfcb330dc25a10ae2006227fca571081db456b30b6f7e453c | Python | 7,302 | 123 | # get results from Google Healthcare API: an experiment with Google healthcare API to validate the results of SemEHR.
from test_google_medcat_api_util import *
from sent_bert_emb_viz_util import get_context_window#, get_char_offset
import pandas as pd
from tqdm import tqdm
import sys
import json
... |
421dfa4f1e1774c81a76f9158a8b3140b5cf7152e54c6a256fcc8bf2429b3a37 | Python | 7,307 | 234 | """English Word Segmentation in Python
Word segmentation is the process of dividing a phrase without spaces back
into its constituent parts. For example, consider a phrase like "thisisatest".
For humans, it's relatively easy to parse. This module makes it easy for
machines too. Use `segment` to parse a phrase into its... |
0ce039d763fad82a76ca98d6490a611a8c22f2ad0be6e46697af383a9aa9f866 | Python | 7,319 | 232 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
import json
import r2pipe
import networkx as nx
from dataset_creation.BlockFeaturesExtractor import BlockFeaturesExtractor
class Dict2Obj(object):
"""
Turns a dictionary into a cl... |
7b0861aeb3ba058757572889abc1bcb84dbbec29b4eeb878f6993523b0c08cdc | Python | 7,319 | 129 | """
This script plots figure 4h of the paper.
This is the discrimination time of neurons.
Internal notes:
The code is from the decompiled version of figure_for_paper_discrimination_time.py
"""
import pandas as pd, pickle as pkl, numpy as np, os, glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm i... |
b617fcd05e7d76867179365b6605d54d5ead18a1b626b1f7dd8b6409d61657da | Python | 7,321 | 200 | """ Summary
Because the arXiv dataset does not contain unique author identifiers, the dataset
inherently suffers from the problem "same name, different person". To overcome
this, the following approach is used:
1. For all abstracts of papers associated with the same name (i.e. all papers
listed in the same line of ... |
dd8fa9c4458538e911f080fb6e20712b1687f1220707cde5246a40fb11dfa89c | Python | 7,324 | 236 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import tempfile
from math import ceil
import numpy as np
import pytest
import torch
from mmcv.runner import load_checkpoint, save_checkpoint
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmcls.models.backbones import SwinTransformer
from mmcls.models.... |
672cd15808445dc21b94f90883ef6e56c18a091ad9b0780a33c7fe9fd9b2cf8a | Python | 7,325 | 210 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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 the License, or
# (at your option) any later version.
# This prog... |
e206d9345c077e0b1883b1c82cafa8321a3a180c508550e089237f61698b4e25 | Python | 7,326 | 263 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
ea03c8c92c062f2288770ba8fe2dfa5c345891b2671df77eb47aa49b73637beb | Python | 7,331 | 194 | """Dynamic time warping distance, from tslearn."""
__author__ = ["fkiraly"]
from sktime.dists_kernels.base import BasePairwiseTransformerPanel
from sktime.dists_kernels.base.adapters import _TslearnPwTrafoAdapter
class DtwDistTslearn(_TslearnPwTrafoAdapter, BasePairwiseTransformerPanel):
"""Dynamic time warping... |
08baca971941214a1edbbd2459a71a2ce21aac7378f027326a821f7304605e1b | Python | 7,334 | 180 | """Lab streaming layer nodes
The lab streaming layer provides a set of functions to make instrument data
accessible in real time within a lab network. From there, streams can be
picked up by recording programs, viewing programs or custom experiment
applications that access data streams in real time.
"... |
48a701bcec86f8e2394880b13f62ba0ff081280ff7e211c331232ff25e9d3989 | Python | 7,334 | 255 | """
partial_rotation.py
Perform partial learning rotations and plot adjacency
matrices and conflict outputs. The goal was to determine
if partial rotations were still useful which it seems they are.
"""
import numpy as np
import matplotlib.pyplot as plt
from extended_ring_model import *
from dict_key_definitions impo... |
82444d10d04a695bc200ab0044365496eba63850bfa3fbb84a441657dd53cfd9 | Python | 7,336 | 175 | from __future__ import absolute_import, division, print_function
import math
import os
import pickle as cp
import numpy as np
import rdkit
import torch
from gln.common.reactor import Reactor
from gln.data_process.data_info import DataInfo, load_bin_feats
from gln.graph_logic.logic_net import GraphPath
from gln.mods.m... |
a222e3674d6049ddff05a4d875c17250016b0cdc06272c29fcd29f6a8dcdf9c2 | Python | 7,337 | 202 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: johannvk
"""Linear trend cost function."""
__author__ = ["johannvk"]
import numpy as np
from sktime.detection.costs._base import BaseCost
def _fit_linear_trend(time_steps, values):
"... |
3ead496ff61da3a4463458ca9f1f877feb7e7e073fd1d94a2380abe609a1a557 | Python | 7,338 | 199 | """Utility scripts for pydeface."""
import os
import shutil
import sys
from numpy.core.numeric import _outer_dispatcher
from pkg_resources import resource_filename, Requirement
import tempfile
import nipype.interfaces.fsl as fsl
from pathlib import Path
from nipype import Workflow, Node, MapNode
from nipype.interface... |
74ff9ecd2e3fd6afd52fed4b617d4ef7ee6084375f4053dd84e3c0456342e5c3 | Python | 7,338 | 183 | """
Tester to figure which of two spiking methods is faster
William Nourse
August 23rd, 2021
The word today is 'Squatter's Rights'
"""
import pickle
import numpy as np
import time
"""
########################################################################################################################
SPIKING METHO... |
0f9fb0c5c121923ed555b2a1fe55c16c037eac68e74c19eb78c0fb3628bf05ae | Python | 7,339 | 163 | """
@file: pgn_converter.py
Created on 09.06.18
@project: DeepCrazyhouse
@author: queensgambit
Converts a given board state defined by a python-chess object to the plane representation which can be learned by a CNN
"""
import numpy as np
import logging
import chess.pgn
from DeepCrazyhouse.src.domain.variants.constant... |
cf2a43395499d51ed8fae26e3ab719b084932f24d7405ca08eebb9b9baf08ca3 | Python | 7,339 | 188 | from copy import deepcopy
from torch import nn
import torch
from torch_cluster import radius_graph
from torch_scatter import scatter
from models.torchmdnet import GatedEquivariantBlock
class E_GCL(nn.Module):
"""
E(n) Equivariant Convolutional Layer
"""
def __init__(
self, input_nf, output_nf... |
75188f79f5c1c849b322bc6591ea77820373465ff2e0489fc15a56b0b37e918d | Python | 7,345 | 169 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import moana, utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
... |
b2eeed5b84b2a071e8b399de83e9896d08a08d6a7fbc7c62e972302bf66ff068 | Python | 7,348 | 224 | """
@file: output_presentation
Created on 24.09.18
@project: crazy_ara_refactor
@author: queensgambit
Provides all methods to convert a move to policy representation and back
Loads all needed constants for the Crazyhouse game internally.
"""
import chess.variant
import numpy as np
from DeepCrazyhouse.src.domain.varian... |
8dbb74b1172094d1a6e13120f0dd75debf2fdbcc8912b5867efee9bf95b33462 | Python | 7,349 | 224 | """
@file: output_presentation
Created on 24.09.18
@project: crazy_ara_refactor
@author: queensgambit
Provides all methods to convert a move to policy representation and back
Loads all needed constants for the Crazyhouse game internally.
"""
import chess.variant
import numpy as np
from DeepCrazyhouse.src.domain.varian... |
12684eda76e4cc81846697e57086a4ad3c6e6692c614709fe972c5c68bf7cc7b | Python | 7,354 | 255 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class ReduceMax(Base):
@staticmethod
def export_do_not_keepdims() ->... |
12ca231fdc359976681020685f77cc28791dec2f8c4bcf5b76ef39387eafbae2 | Python | 7,354 | 295 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
d79e30f4c11cd8472e6878861aeba2f99f9e8bd0ee18798b8f44ea3486b82d4a | Python | 7,359 | 256 | import os
import h5py
import pytest
import numpy as np
from os.path import join as pjoin
from dnnbrain.io import fileio as fio
DNNBRAIN_TEST = pjoin(os.environ['DNNBRAIN_DATA'], 'test')
TMP_DIR = pjoin(os.path.expanduser('~'), '.dnnbrain_tmp')
if not os.path.isdir(TMP_DIR):
os.makedirs(TMP_DIR)
class TestStimul... |
1e6f6e3944332d51430784e5140b26acdcc8203876fb236c73c8c2d0312198ef | Python | 7,360 | 228 | # Copyright 2019-2020 The ASReview Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
8f87b56579dfae11bcc951c63d222739d25c4c7597dd07f223a59694d44a2a41 | Python | 7,361 | 214 | import argparse
import re
import os
import pickle
import numpy as np
from tqdm import tqdm
from rdkit import Chem
from collections import Counter
import torch
import random
from typing import Optional
def seed_everything(seed: Optional[int] = 0) -> None:
torch.manual_seed(seed)
random.seed(seed... |
a248bf2c895281b54176ae2db0acd22c071c81a3e1c0f16ddcf7cc0884909045 | Python | 7,362 | 213 | # coding=utf-8
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
1459569259f63cb1b2699ebebf720c1a5fa83d1559865b8658917da79a6e1d34 | Python | 7,367 | 208 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
ccada451df38b455fbbde79f523a44b3262ae5c09bb7c2af1f0e6c89022b0cde | Python | 7,367 | 194 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 18 15:47:10 2018
@author: tpisano
"""
import numpy as np, cv2
import matplotlib.pyplot as plt
from skimage.morphology import ball, cube, star, octagon
from tools.conv_net.functions.dilation import dilate_with_element, cylinder
from scipy import ndim... |
4eca020da9e0b9b5f682076877b9ce5f6da7f5cb61bf202182e4f2043ff3028e | Python | 7,368 | 207 | """Tests for TSCGridSearchCV."""
__author__ = ["yash-sangwan"]
import numpy as np
import pytest
from sklearn.metrics import accuracy_score, log_loss
from sklearn.model_selection import KFold
from sktime.classification.dummy import DummyClassifier
from sktime.classification.model_evaluation import evaluate
from sktim... |
9d9786ccd976f7b0573dce9db864576d59b6042212707e5590832cdc9715a6ab | Python | 7,373 | 207 | import os
from datetime import datetime
import shutil
import sys
from pytz import timezone
# cellline folder, test, K562, A549, HUH7, NB4 or SKNMC
if len(sys.argv) >= 2 and not sys.argv[1].split("/")[-1].startswith("run"):
cellline = sys.argv[1].split("/")[-1]
elif len(sys.argv) >= 2:
cellline = sys.argv[1].sp... |
f02bef67ea263591f320450045343193389aa17060e8c9474e141b77b6907886 | Python | 7,374 | 167 | '''
generate_perturbations_util.py
Util functions for generating perturbations at certain genomic location
'''
##########################
# Loading packages #
##########################
# 1. Load packages
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as tra... |
b5da3e5fa519a77e221f251af3e7d2c36aaeea68b0cebb23ad6053d5ea816da6 | Python | 7,377 | 174 | # Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
from ampligraph.latent_features.layers.encoding import EmbeddingLookupLayer
fr... |
df79deabc31948bf63cb29401a9ed179127b0519609425f87c1d04e2b65a1459 | Python | 7,380 | 222 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
ce19f2b7ea48170cc52889bc474d2b3ebfcb04747cb55653a79de2c306dd8bbe | Python | 7,381 | 249 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import io
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import _image_decoder_data, expect
def generate_checkerboard(width: int, height... |
db0f5838ffacbfa8443d0cb79b342cabba8449b8af3e164a5b041f0c623ea7a3 | Python | 7,384 | 178 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
f27f52dd7a4d94dc1fbf95306c53a46385a3e7e6ba129b49c565673605209f63 | Python | 7,386 | 223 | import os
import copy
import math
import random
import numpy as np
from Bio import SeqIO
from operator import itemgetter
from argparse import ArgumentParser
from sklearn.model_selection import KFold
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.optim as optim
import torch... |
466f723e379564d40b7018db02ed1f5daf9a6942e1577bdf31f1b4d4c0135971 | Python | 7,391 | 216 | from __future__ import print_function
from freqAnalysisTools import band
from os import listdir
from os.path import isfile, join, splitext
import sys
import pickle
import math
import numpy as np
from itertools import groupby
import codecs
#---------------
# set up parameters
# for signal processing
wsizeInSec = 10 ... |
476172728025f1c18cf931460f98ffa609d1cc1f6fd89b1fc1d3e92b655807c3 | Python | 7,392 | 193 | #=======================================================================================================================
#Copyright
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick ... |
75b7a8821766162efca094bed7337a552b5c752bfb8e9ff6a0cfe22e1bce889a | Python | 7,392 | 201 | #-------------------------------------------------------------------------------
# elftools: dwarf/namelut.py
#
# DWARF pubtypes/pubnames section decoding (.debug_pubtypes, .debug_pubnames)
#
# Vijay Ramasami (rvijayc@gmail.com)
# This code is in the public domain
#------------------------------------------------------... |
52250502253d6e4bc658998c7979d8568e9781eb43661be2713bea86df886b85 | Python | 7,394 | 209 | """KNeighbors Time Series Estimator base class."""
__author__ = ["fkiraly", "Z-Fran"]
__all__ = ["_BaseKnnTimeSeriesEstimator"]
import numpy as np
from sktime.dists_kernels._numba_distances import DISTANCES_SUPPORTED
class _BaseKnnTimeSeriesEstimator:
"""Base KNeighbors Time Series Estimator."""
def __ini... |
2a66507bf5d35db579cd892ba6017151ed1596591a3740a4903b9e6099c91fcf | Python | 7,396 | 274 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
7c20268557242ac3e98bf3226558061eb80bf591fdbe77f445600ad9bb8eff6d | Python | 7,396 | 210 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
bcba6b0292a68dda85883f443ccd0b2a1c6b9b3b3ba0476abfbf04157ec076f9 | Python | 7,397 | 182 | """
This script generate figure S7d of the paper.
Internal
--------
This is from figure_for_paper_regression_model.py
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# Plotting
import sciplotlib.polis... |
0b63a5357c97541184d4881e3ca42f27c7eeac10144df862e5995c2cb91378ea | Python | 7,398 | 181 | """
This script generate figure S7c of the paper.
Internal
--------
This is from figure_for_paper_regression_model.py
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# Plotting
import sciplotlib.polis... |
dbe00d3d6183b4379d8b1b3040e65af17c51d9486d26c438812716814adaaed9 | Python | 7,398 | 136 | """
@file: rl_training.py
Created on 20.11.19
@project: CrazyAra
@author: queensgambit
Functionality for conducting a single NN update within the reinforcement learning loop
"""
import sys
import glob
import logging
import mxnet as mx
try:
import mxnet.metric as metric
except ModuleNotFoundError:
import mxnet... |
113cbe772c112fef93bd2b1a2702143feefa94dc9a31e50d1a1e2b4d66a8b56c | Python | 7,401 | 241 | import numpy as np
import pandas as pd
import os.path
import sys
import scanpy as sc
from scipy.io import mmread
import anndata
from typing import Optional, List, Union
def _clean_up(df: pd.DataFrame) -> pd.DataFrame:
"""
Remove rows and columns with all zeros from a DataFrame.
Parameters
-------... |
3838532bc69c13509d0435dea2b4e8e02c8424802c3c751fc0812c1dff1e4fed | Python | 7,403 | 190 | import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.distributions import Bernoulli
import pdb
from .resnet import resnet18ori
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding... |
5a1b3834146e260e596303d77bf08af1ed88f53b164be83e6e5964810fae70ee | Python | 7,404 | 178 | import os, pathlib, h5py
import numpy as np
from sklearn.metrics import roc_auc_score, average_precision_score, mean_squared_error
from scipy import stats
import torch
import pytorch_lightning as pl
from torch.utils.data import TensorDataset, DataLoader
#---------------------------------------------------------------... |
02b1a04d90868b797ac059b9228b99220e7b4c8e4d91a5c4802a5f4da94f6165 | Python | 7,406 | 206 | import os
from datetime import datetime
import shutil
import sys
from pytz import timezone
# cellline folder, test, K562, A549, HUH7, NB4 or SKNMC
if len(sys.argv) >= 2 and not sys.argv[1].split("/")[-1].startswith("run"):
cellline = sys.argv[1].split("/")[-1]
elif len(sys.argv) >= 2:
cellline = sys.argv[1].sp... |
1530cc4fd40a09504415613aa303c31551f273e1c2a27b3071337dc2e5a45f8c | Python | 7,407 | 203 | #!/usr/bin/env python
#-------------------------------------------------------------------------------
# test/run_dwarfdump_tests.py
#
# Automatic test runner for elftools & llvm-dwarfdump-11
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#------------------------------------------------------... |
d061667619da3254f585e963bd62c575040898e603b524b35bf5fd2ff3b98f27 | Python | 7,407 | 183 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
"""Illustrative example of using an Opaque type.
Opaque types allow a model to carry values whose internal representation is
not defined by the ONNX spec, but is instead understood only by the
producer/consumer of a custom domain's ops (mu... |
67d36872a50b42c42ee6412a152352e50f9fddf1f3ca27b4cffe821920d44d58 | Python | 7,410 | 160 | """
@file: game_phase_detector.py
Created on 08.06.2023
@project: CrazyAra
@author: HelpstoneX
Analyses a given board state defined by a python-chess object and outputs the game phase according to a given definition
"""
import chess
import chess.pgn
import numpy as np
import matplotlib.pyplot as plt
import io
from D... |
8938c382b09a13eb1bda2d11974514a6535b42260cdaa7d9e2921ebb6c743143 | Python | 7,410 | 205 | import os
from datetime import datetime
import shutil
import sys
from pytz import timezone
# cellline folder, test, K562, A549, HUH7, NB4 or SKNMC
if len(sys.argv) >= 2 and not sys.argv[1].split("/")[-1].startswith("run"):
cellline = sys.argv[1].split("/")[-1]
elif len(sys.argv) >= 2:
cellline = sys.argv[1].sp... |
a7427a916ca528b50e4219ea188b4f0adbac93233513bc5d502407a91f877ee6 | Python | 7,410 | 206 | #!/x0/arnavmd/python3/bin/python3
import torch
import torch.nn as nn
from torchvision import datasets
from torchvision import transforms
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
import argparse
from utils import *
import time
print(torch.__version__)
def main():
parser = ar... |
1e702a5a679ebd98bd8b358cf45f5e7de75cf33e25dd1a21ec22f1d5f6dc210b | Python | 7,412 | 192 | """Set classifier function."""
__author__ = ["TonyBagnall"]
from sklearn.ensemble import RandomForestClassifier
from sktime.classification.deep_learning import CNNClassifier
from sktime.classification.dictionary_based import (
MUSE,
WEASEL,
BOSSEnsemble,
ContractableBOSS,
TemporalDictionaryEnsemb... |
1fc9639dd2b0bbbd07c927735eb80f9a517833b02295c9b2aca839dd933aec46 | Python | 7,413 | 212 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 29 18:23:23 2018
@author: wanglab
by Tom Pisano (tpisano@princeton.edu, tjp77@gmail.com)
"""
import os, numpy as np, sys, multiprocessing as mp
from skimage.external import tifffile
def generate_patch(**params):
"""
Function to patch up... |
a4102cf45d98da5c2b4fc686799c3029d5e601419a2e88f90aef13be032ca57c | Python | 7,416 | 139 | """
@file: generate_random_nn.py
Created on 27.05.21
@project: crazyara
@author: queensgambit
Command-line tool to generate a random initialized neural network and export ONNX weights.
"""
import os
import argparse
import torch
from pathlib import Path
import logging
import sys
sys.path.insert(0, '../../../../')
from ... |
24e460a1166028ca30d366629d27e0c12a4fec9d3eeecd7cc8076a90251b6f7e | Python | 7,418 | 207 | """Regression tests for bugfixes related to base class related functionality."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
import pytest
from skbase.utils.dependencies import _check_estimator_deps, _check_soft_dependencies
from sktime.forecasting.compose import ForecastByLevel, Transfor... |
54cba8000436875b791fdcd9c4547186f8829a43490d10891e7072b79c6e9b36 | Python | 7,426 | 311 | from Bio import SeqIO
from io import BytesIO
from ftplib import FTP
import gzip
import numpy as np
import os
import pandas as pd
import pickle
import sys
from zipfile import ZipFile
#-------------#
# Classes #
#-------------#
class ENCODE:
def __init__(self, accession, biosample_name, biosample_type, downloa... |
2bd25179ed7dfdc7a0bcc240eeb128c997605ee8932990bf30af42f61f2f4741 | Python | 7,427 | 218 | import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
def get_training_time(log_path):
with open(log_path) as f:
content = f.readlines()
if content[0][:4] != '2019':
... |
daeccabe2ff174432a771020568138bae4f0b0c33cca48498ed417a9d6c9ec62 | Python | 7,429 | 49 |
#from regions_per_sections_adult import regs_per_section, Regions_n_colors_List
from . import regions_per_sections_adult as rpsa
import numpy as np
import cv2
#import regions_per_sections_adult as rpsa
try :
with open("./mb_gui/src/regionscode/regions_adult.txt","r") as file:# open("regionscode/regions_adult.txt",... |
8877b38dacd111c141013cdaea29f00b204d45229f0fe774d8b2ea4d7b33da63 | Python | 7,432 | 188 | import os
import numpy as np
import torch
from torch.utils.data import Dataset
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader as PyGDataLoader
from torch_geometric.nn import radius_graph
from dataset.utils import anidataloader
ATOM_DICT = {('Br', -1): 0, ('Br', 0): 1, ('C', -1): 2... |
a3847bd24babbc709fb95c58265f91cf45512d1e03ed705450e8d13d45fc4567 | Python | 7,435 | 184 | import numpy as np
import torch
from torchvision.utils import make_grid
from tqdm import tqdm
import matplotlib.pyplot as plt
import math
from src.base.base_trainer import BaseTrainer
class Trainer(BaseTrainer):
"""
Trainer class
Note:
Inherited from BaseTrainer.
"""
def __init__(self,... |
e9bf693e0d0d42e476f32f60dbd3368d931b7ab99cb8f0a08469b2c00e6e4ace | Python | 7,437 | 228 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
4ff796f5825486aa2f57d22fd2167522c20e3ad96b766bdad5a96faca9607d49 | Python | 7,438 | 212 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Issue #5906 Task 2 (pt backend): SFPG completion across ranks.
A BRIDGED SeZM model's parallel (comm_dict) path must reproduce the folded
single-domain path. The Source Freeze Propagation Gate multiplies, into the
envelope of an edge, the switching amplitudes of every pa... |
7aa447e56e0c3ff2253ffef97c2f2c53fdc4896ff2df446ad43028f9b1845b1b | Python | 7,439 | 182 | #!/usr/bin/env python
#
# Copyright 2010, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
24517bf96b764c8063b751023d003a00bb40c0eb718be6f5be66869e0c61cc47 | Python | 7,447 | 192 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
693d1fc681c3025fbedd6b9e3a2129c6e93b316af965d78b9904d0123fdd1ed4 | Python | 7,448 | 222 | # -*-coding:utf-8-*-
# from __future__ import absolute_import
import torch.nn as nn
import torch.nn.functional as F
import math
def conv1x1 (in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
def conv3x3 (in_planes, out_planes, stride=1):
re... |
57bf9a3387ce89b07c972d4eace296349f7db1b498081bc5e8c506fcc890f1c2 | Python | 7,450 | 188 | from metrics import sdr, sdr_stratified
from utils import AverageMeter
from tqdm import tqdm
from collections import OrderedDict
import torch
import pandas as pd
import cv2
from matplotlib import pyplot as plt
def train(config, train_loader, model, criterion, optimizer):
avg_meters = {'loss': AverageMeter()}
... |
c4dfc7c6d7d3bbadf21577b3220dd85f0be5dd86856faeb8129c9fbccc3ff88e | Python | 7,452 | 215 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import re
import matplotlib.pyplot as plt
import numpy as np
from mmcls.utils import load_json_log
TEST_METRICS = ('precision', 'recall', 'f1_score', 'support', 'mAP', 'CP',
'CR', 'CF1', 'OP', 'OR', 'OF1', 'accuracy')
def cal... |
64e60a2caccae7ec357515eb6dcfaf27614b1dc2db3f512c20509c389677b26d | Python | 7,456 | 204 | from __future__ import annotations # for ArrayLike type in docs
# for calculating jet features quickly,
# TODO: replace with vector library when summing over axis feature is implemented
import awkward as ak
import numpy as np
from coffea.nanoevents.methods import vector
from energyflow import EFPSet
from numpy.typing... |
4789fe89fe9e33f8a69f74e45a76454c19ce12b9c37450ad64b6f15146e69f26 | Python | 7,458 | 207 | #=======================================================================================================================
#Copyright
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick ... |
55839133e040cf3d07df527f16397d76cb8abd7865cf065778664221efdccec4 | Python | 7,459 | 199 | import os
import sys
import unittest
from pathlib import Path
from importlib import import_module
import pytest
import augpathlib as aug
import pyontutils
from pyontutils.utils import get_working_dir
from pyontutils.config import auth
from pyontutils.integration_test_helper import _TestScriptsBase, Repo, Folders, skipi... |
00a1a0c7458fbd96ddd6fc1eaaab252f03cb42cb7f6dd1ffec505af7a6f4e270 | Python | 7,460 | 201 | import numpy as np
from scipy import ndimage
import random
from bcblib.tools.arrays_utils import coord_in_array
def get_neighbours(coord, shape, n_dim=3):
"""
Get valid neighbors of a given coordinate.
Parameters
----------
coord : tuple
The coordinate to find neighbors for.
shape : ... |
2da9d70c628394dad79bc70560e4bd323f197fd9d4fe9e18fea70be64945143a | Python | 7,460 | 257 | """
Utility functions for the ANLffr package
@author: Hari Bharadwaj
"""
import warnings
import logging
import inspect
import sys
from functools import wraps
from .externals.decorator import decorator as markDecorator
__all__ = ['logger', 'verbose', 'deprecated', 'set_log_level']
logger = logging.getLogger('anlffr'... |
5945dc6a22b4a2be2245cfa6b94ad99abd6c695cc55c9f58a4fa6cc9990fa835 | Python | 7,465 | 144 | #=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller
# Computer Vision Studio
# Friedrich Miescher Laboratory of the Max Planck Society
# Systems Biology of Development, Univers... |
da3a19817665ed1b1c1d79604f76929dbafd17c6ceab51eeae55869b9188413c | Python | 7,467 | 186 | import unittest
import numpy as np
import shutil
import os
from ddt import ddt, data
import warnings
import site
from SPHARM.classes.surface import Surface
from SPHARM.classes.image_stack import ImageStack
import SPHARM.lib.transformation as tr
@ddt
class TestSurfaceClass(unittest.TestCase):
@data(
'0,... |
cae8cd756bac705aa29c5de8bf62336c104bd8da4b904fb47e16c1b9ef3190ba | Python | 7,473 | 224 | from __future__ import absolute_import
from __future__ import print_function
import tarfile
import os
import sys
import shutil
import hashlib
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError, HTTPError
from .generic_utils import Progbar
from .modac_utils import get_file_from_mo... |
bea643633c30d60ed93ed79254d9a14245fed7aa080cbdeb845f16261e6c8c95 | Python | 7,476 | 203 | import tensorflow as tf
import voxelmorph as vxm
import numpy as np
import distutils.dir_util
from scipy.ndimage import zoom
import SimpleITK as sitk
import config as cfg
import loadsave
import image
def img_to_nparray(img):
"""
Converts a SimpleITK image object to a numpy array.
Arg... |
eed4abe87a373d7a40e7791f7071b893a32fd66f9ce9e96606b7e7f90215e334 | Python | 7,482 | 213 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
4ef8fb6c49410a1136adaf4f70b3383c8bc9cd8996cd812526f572339a96c860 | Python | 7,487 | 209 | #!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Generate deeppot_dpa4_zbl_graph.pt2: DPA4 with analytical ZBL bridging.
``bridging_method: ZBL`` builds a COMPOSITION -- ``LinearEnergyModel`` over
``[learned DPA4, InnerPotentialAtomicModel]`` with ``weights="sum"`` -- so
the frozen archive exerci... |
4a6e7119136586968dcc3cadd01eea677457f925c83ffd5b494d6c0f16d41e69 | Python | 7,490 | 167 | """Legend plots"""
import numpy as np
from matplotlib import colormaps
from ..utils import _node_scale_vminvmax, _detect_coloring_type
def _setup_legend(legendproperty, legend, legendname, currentlegend=None):
# If the condition has been specified
# And if the legend for that legendproperty is true
if isi... |
77aa4a5dc4ffc2d217a9ba9406ff9dcf4f8cec39de8ed5a9893bc8673628c1b1 | Python | 7,490 | 241 | import torch
import torch.nn as nn
from lgn.cg_lib import CGProduct
from lgn.nn.generic_levels import get_activation_fn
from lgn.nn import CatMixReps
class LGNNodeLevel(nn.Module):
"""
The message passing step in LGNCG layers.
Attributes
----------
tau_in : `GTau`
The multiplicity of th... |
8b23d969688a656f133c592c0e08fb71cae657ce705c76c7cddb696c3d644165 | Python | 7,493 | 189 | import os
import numpy as np
import torch
from torch.utils.data import Dataset
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader as PyGDataLoader
from rdkit import Chem
ATOM_DICT = {1: 'H', 6: 'C', 7: 'N', 8: 'O'}
PAIR_DICT = {('Br', -1): 0, ('Br', 0): 1, ('C', -1): 2, ('C', 0): 3, ('... |
f5966888637bdfabff78661498f480064f8b508367369edfc6f5cd6138757372 | Python | 7,493 | 241 | #%% [markdown]
# # Connectome data
#%%
import datetime
from secrets import choice
import time
from tkinter import N
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from pkg.data import load_split_connectome
from pkg.io import OUT_PATH
from pkg.io import glue as default_glu... |
63cf096560540e021ac88781038ac1a9ad8809e761082cce12ad863783ec1ce5 | Python | 7,494 | 243 | import torch
import torch.nn as nn
from lgn.cg_lib import CGProduct
from lgn.nn.generic_levels import get_activation_fn
from lgn.nn import CatMixReps
class LGNNodeLevel(nn.Module):
"""
The message passing step in LGNCG layers.
Attributes
----------
tau_in : `GTau`
The multiplicity of th... |
82795922d2df2af0110f702297ec667103c93ade97c62089a5506ba436d17588 | Python | 7,494 | 237 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Degree-wise real Cartesian geometry for DPA4C."""
from __future__ import (
annotations,
)
import math
from typing import (
TYPE_CHECKING,
)
import array_api_compat
if TYPE_CHECKING:
from collections.abc import (
Sequence,
)
from deepmd.dpm... |
2d66f03b0c97b02357de28d9e24d9254f7011fdbb54e3880e9ec4788f9283b99 | Python | 7,497 | 245 | #!/usr/bin/env python
#
# Copyright 2008 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
fd02e34374628ffe33ce51f90138ad7f81714b51cdbf777794bd7c8ee6d794e7 | Python | 7,497 | 114 | #error analysis for ORDO concept identification results
import numpy as np
import pandas as pd
#df = pd.read_excel('for validation - SemEHR ori.xlsx')
df = pd.read_excel('data annotation/raw annotations (with model predictions)/for validation - SemEHR ori (MIMIC-III-DS, free text removed, with predictions).xlsx... |
c3ef49ab64c7a6952c8521db8ff3e223b43a3ad38c099c3f4e08740d8f4ff3f0 | Python | 7,498 | 223 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
b8481470fc280c31aafa499235c08b670d078df12e303e9cb2bbe7566bd1c48f | Python | 7,501 | 230 | import os
import random
from pathlib import Path
from akkadian.parse_json import parse_json
from akkadian.data import reorganize_data, rep_to_ix, invert_dict, add_to_dictionary
from akkadian.__init__ import dictionary_path, train_path, validation_path
def build_signs_and_transcriptions(corpora, add_three_dots=False):... |
c7b0863f607b8989a8efecd0445ec36f94fd73498999e61bcf00319d6e6512d8 | Python | 7,501 | 305 | from akkadian.data import logits_to_trans, load_object_from_file
from akkadian.combine_algorithms import overall_classifier, list_to_tran, sentence_to_allen_format, sentence_to_HMM_format
from akkadian.hmm import hmm_viterbi
from akkadian.memm import memm_greedy
from akkadian.__init__ import hmm_path, memm_path, bilstm... |
d14a029060f79808a434fd1df32b1f8627e575f591b5720ec2152c040c4b8a75 | Python | 7,501 | 216 | from collections import Counter
from typing import Optional, Union
import numpy as np
import pandas as pd
from sklearn.neighbors import NearestNeighbors
from sklearn.mixture import BayesianGaussianMixture
from .STDataset import STDataset
def _find_combinations(
hotspot_df: pd.DataFrame,
coordinate_df: pd.Da... |
36a4334344670389cf0436f51b75ce53e7ca79ca20bcfd7b7622d8864a3a8979 | Python | 7,505 | 207 | """
Responsible with allocating stable PCL IDs for taxonomy nodes. Id ranges for taxonomies are allocated based on
taxonomies order in the 'taxonomy_details.yaml' configuration file. Automatic ID range allocation starts from
#ID_RANGE_BASE and allocates 400 IDs for classes and 600 IDs for individuals
ID range allocati... |
62c0b019feb69949e3e8b974ba3e321a3c155bd0a7bdb03c8c6b66763ff22cf6 | Python | 7,505 | 233 | import os, sys
import pickle
import numpy as np
import scipy as sp
import scipy.stats as stats
import sklearn.metrics
def pearson(targets, predict):
"""
Calculate the Pearson correlation coefficient (R) between targets and prediction.
:param targets: The target values (ground truth).
:type target... |
45fbef03165f3f971a9d6b82e55bb8679c2672dbd6c3336107a50291fd83b21f | Python | 7,514 | 201 | """Internal crash-safe checkpoint store for benchmark runs.
This module provides incremental persistence used during a benchmark run.
It is not part of the public, user-facing storage API and is not a
`BaseStorageHandler` subclass.
Final results are written to a single results file in the user's chosen
format (JSON, ... |
82bde3e1fabc118195aeddc0ea2fd6ab663ee72aaa78a574900522e815ba4f13 | Python | 7,519 | 192 | #
#
import sys
import Bio.PDB.Vector
from numpy import mat, array
from math import sin, cos, sqrt, pi
#
# defines the different atoms needed to calculate the chi angles
# for all the different residue types ... well at least the common
# 20 ones
chi_atoms = {
"ALA": {},
"ARG": {"x1": ["n", "... |
1fcd5a9d1ff1a1df9f9219ee766a462e8bc1be153bc9dc88cc034397075ee1c2 | Python | 7,520 | 212 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.