sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a8a17f348863f3b766e932b65d95218d613c59c173f12c0f1db1fdf44e62e405 | Python | 3,790 | 120 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e6e71f04899d2f038d4a35d7dab630f4bbef95fbbd5d149daf729989f4f0d500 | Python | 3,800 | 87 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(torch.nn.Module):
def __init__(self, encoder_dim: int, decoder_dim: int):
super().__init__()
self.encoder_dim = encoder_dim
self.decoder_dim = decoder_dim
def forward(self,
query: torch.Tensor, ... |
4bca7838e1bb7ed577b1dfa4659961bc29d30bdffe4e5e23f2ec5a5ffa696833 | Python | 3,802 | 73 | import os
from argparse import Namespace
from probabilistic_forecast.nn_mc import NN_MC
from probabilistic_forecast.ensemble import Deep_Ensemble
from probabilistic_forecast.swag import SWAG
from probabilistic_forecast.lstm_mc import LSTM_MC
from probabilistic_forecast.bnn import BNN
from probabilistic_forecast.gnn_mc... |
45b2999e57c1a53545db6779dd1ed426b30f3432aedee6ac1bac445132f03cc3 | Python | 3,803 | 108 | import torch
import torch.nn.functional as F
from torch.nn import ModuleList
from torch.nn import Sequential, ReLU, Linear
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch_geometric.utils import degree
from ogb.graphproppred import PygGraphPropPredDataset, Evaluator
from ogb.graphproppred.mol_encoder i... |
02c6f448beaed97082d31b2df4b7ad70e5286ec1150643d4d297842723a1cbf2 | Python | 3,805 | 99 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 16 16:08:22 2014
@author: crousse
"""
from datetime import datetime
from datetime import time
from datetime import date
from collections import OrderedDict
from traceSet import TracesSet
from protocol import Protocol
from note import Note
class Recording(... |
930f677a5502829784dd02126f323f9e2bad758ee75327980c4a924e97bdfb6c | Python | 3,805 | 121 | import glob
from functools import lru_cache
from os import path
import pandas as pd
from .config import DATA_DIR
from .nmr import NMRDataset
FOLDER_PHOTO_REAGENTS = path.join(DATA_DIR, "002_photo_space/reagents")
FOLDER_SIMPLE_REAGENTS = path.join(DATA_DIR, "001_simple_space/reagents")
FOLDER_PHOTO = path.join(DATA_... |
2b838fa1dc4dee67c06415b8e1b470b19f2199a912b6a51342eaec6b48294023 | Python | 3,809 | 75 | import tensorflow as tf
from helper_functions import *
class DataGenerator(tf.keras.utils.Sequence):
'Generates data for Keras'
def __init__(self, data_directory, list_IDs, labels, X_random=np.zeros((100,9000)), batch_size=64, dimx=(9000), dimy=(3),
shuffle=True,augmentation=False, shift_off... |
fdca2bfe10983f12b2b5579d5a4867d92a4f7414cf0f6f9a0a25308d7fa2a3f1 | Python | 3,813 | 127 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
84f3e1c32ae0205ac07216b602ca948a26262ef9b235f5f61b12f2c38e4b7f22 | Python | 3,819 | 132 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
4a847e5b6deada1db64a9d2a6a3289bedb3f0984c7728bc812d162977726b4a5 | Python | 3,828 | 116 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
8149d56befc591c845acffb1c9f524a1e2595ae12752048b33cbfd457fe287e1 | Python | 3,830 | 106 | import operator
import warnings
from bisect import bisect_left
from rotation_analysis.analysis.event_detection.events_collection import EventsCollection
import numpy as np
import pandas as pd
from rotation_analysis.analysis.probe.config import FS_probe
class ProbeEventsCollection(EventsCollection):
de... |
eae244761636c1389d092e551ecb041606314ecfb994536b84fe3983a5646ae8 | Python | 3,834 | 138 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
6bc5b67414b25fe1e36d80c91ef2e729f6ed960e87d377ea414283c2249ece63 | Python | 3,837 | 128 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
499147fbaef5fc0dafaa16a0021f076de3bafad2337337d6ca651a63d8526cca | Python | 3,838 | 137 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
72ef0ec6d24eb9cbdefafec88f31d6c271faa4d1446e65e6aad7c08c296b6cc6 | Python | 3,843 | 99 | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Robotiq, 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 copyr... |
916d4f5f1842406a9c8eb0144974cbb55cd5dd0b6f10c16575d129278fd738d0 | Python | 3,855 | 120 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1593b6f2602304d985a6a3b3b50a056bf35406c3ad223bc4fb58eeace531148f | Python | 3,856 | 86 | import sys
#Download python filesin repository and insert their path here to import them
sys.path.append("")
from SurvivalClustering.SurvivalClusteringPipeline import SurvivalClusteringPipeline
import pandas
import numpy as np
from sklearn.cluster import KMeans
from sklearn import metrics
#rootFolder should contain p... |
2b150e2f09a87d0ff435b1d608a6f294a3c5b374b81b6b9df75f50d55392d105 | Python | 3,856 | 120 | import sys
from optparse import OptionParser
import rdkit
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from jtnn import *
from torch.utils.data import DataLoader
lg = rdkit.RDLogger.logger()
lg.setLevel(rdkit.RDLogger.CRITICAL)
parser = OptionParser()... |
2358c4a020e45456d7fb17fdbce317136a6f303dcd01237e946dd5a2d58f20c4 | Python | 3,857 | 163 | import torch
import numpy as np
from gluonts.dataset.repository import get_dataset
from gluonts.evaluation import Evaluator
from gluonts.torch.model.deepar import DeepAREstimator
from gluonts.torch.distributions import (
SplicedBinnedPareto,
SplicedBinnedParetoOutput,
)
from matplotlib import pyplot as plt... |
e79d4a703beb2719c125990f40dfba452652f0486323594b63469cb1613942fa | Python | 3,858 | 167 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
5147b64fef216b80836d4519f1cd146a8b729f2d3798ac695cada651e9151eae | Python | 3,867 | 85 | #!/usr/bin/env python3
"""
Write the grobid.yaml used by an end-to-end evaluation run.
configure_grobid.py --profile crf
configure_grobid.py --profile delft --delft-install ~/delft
configure_grobid.py --profile crf --consolidation glutton --glutton-url http://glutton:8080
The `delft` profile starts from... |
ef0ec3145edd3033c2aedbd50c4b7fae1945b1f26fc841882fc38e40bc59af29 | Python | 3,869 | 97 | import os
import sys
import argparse
def init_argparser():
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description='''
''')
# config file
parser.add_argument('-c', '--config', metavar='Path', type=str, default=None,
help='''Config file with j... |
b97c7774c94d4f70ff3f2fefa380afeeb667c08bc143f651d5b4eda279a8c796 | Python | 3,874 | 110 | import torch
import torch.nn as nn
INPUT_DIM = 547
CROP_SIZE = 64
DIST_BINS = 10
AUX_BINS = 94
SS_BINS = 9
ANGLE_BINS = 37
ASA_BINS = 11
DROPOUT_RATE = 0.15
CUDA = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
def load_model(model, fname):
"""load pytoch state_dict into predefined model"""
... |
ea00393916f495349d30d3a39b331e632c88ed2b668fe65a6dcd525e61fb73d9 | Python | 3,878 | 128 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
b43fa6b7a91af18ff42e39db8dbca02ba684aff20ccb389258ffb9bb316e8948 | Python | 3,879 | 129 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from .MessageFunction import MessageFunction
from .UpdateFunction import UpdateFunction
from .ReadoutFunction import ReadoutFunction
import torch
import torch.nn as nn
from torch.autograd import Variable
class MPNN(nn.Module):
"""
MPNN as proposed by Gilmer et a... |
0b0ccd9617815267aeddd7afa61e72d762d956631fb0a5be626d8069f971e578 | Python | 3,881 | 92 | import re
import numpy as np
import pandas as pd
from deep_phospho.proteomics_utils import rapid_kit as rk
def substract_snlib(snlib_1, snlib_2, col='Prec'):
"""
将第一个 lib 按给定的 col 删除第二个 lib 中的内容
这里两个 lib 的大小不一定哪边一定大,只是删除 overlap 的部分
"""
pass
def add_pep_pos_in_prot(x, seq_dict: dict):
"""
... |
d2941ca00a44633694a6c065eb8b717d609d97adf54847c8df3e4af215223109 | Python | 3,882 | 144 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
db4176c5346adc21dc1d59f62de49231722b6256d6a4c0f7d58837ab58a3f4db | Python | 3,882 | 106 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
af7d347a3b924e18d44f8e61574b2cd471451c6d51811e768a516123389d4c3c | Python | 3,885 | 100 | import argparse
from argparse import RawTextHelpFormatter
from matplotlib import pyplot as plt
import numpy as np
import os
from prospr.prediction import predict
from prospr.sequence import Sequence
def make_plots(pred, label, base_save_path):
"""Create plots comparing distogram, secondary structure, phi/psi, and... |
2feaa2fb5270d30110a8de986ccb0879f8fc02da8496695b75e9492203b76fde | Python | 3,887 | 116 | # 26th September 2018
# Python script for executing msprime simulations of Holstein demography,
# Calculate mean tip lengths to determine age range of mutations
# Execute with python3 MSP_Holstein.py 1000 > MSP_Results.dat
# (Results piped to STDOUT)
# Update 21st Jan 2019
# Using actual data files provided by Simon B... |
d3edcd0ceab8904977af2811e28fb9bc43feccb40a062d3eb525144c43802647 | Python | 3,887 | 112 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
ed83b6979d9a9829c874c856f17db73f053b4807d8811a138695dde15b6d9aff | Python | 3,889 | 130 | import os
import time
import pickle
import pandas as pd
def file_prefix_time(with_dash=False):
curr_time = time.strftime('%Y%m%d', time.localtime())
prefix = curr_time + '-' if with_dash else curr_time
return prefix
def pd_read_csv_skip_row(file, comment=None, **kwargs):
if os.stat(file).st_size == ... |
dab41c1c34315796ad998e1fcb4f8403719d059a970441ba358742a6bdd25136 | Python | 3,891 | 107 | from __future__ import division
from __future__ import print_function
import time
import tensorflow as tf
from gcn.utils import *
from gcn.models import GCN, MLP
# Set random seed
seed = 123
np.random.seed(seed)
tf.set_random_seed(seed)
# Settings
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_string('datase... |
6083f91876ff72b8eabdad1d3c80cc660ccfce527fb1d51efeb91ea506276486 | Python | 3,902 | 105 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
364a43125a6125aac57eaa77400a20ce5e8bb95aec8b07d06030bb01668c4d98 | Python | 3,907 | 107 | """Define RNN-based encoders."""
from __future__ import division
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence as pack
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from onmt.encoders.encoder import EncoderBase
from onmt.utils.rnn_factory imp... |
5917079ba874250765f5a371f4d4613672568e4460abe081c5f67cf9ad693815 | Python | 3,908 | 95 | # Steps to get the deleted forecast files
# Step 0: open terminal at the root directory of the project
# Step 1: git log --diff-filter=D --summary -- "data-processed" > code/misc/file_delete.txt
# Step 2: python code/misc/extract_deletion_information.py
import pandas as pd
from itertools import groupby, chain
from dat... |
715e06796d603955ddb27637f0f35a0c4b4e1e185add4585386c808f5760d06b | Python | 3,908 | 86 | import tensorflow as tf
def segmentation_loss(final_logits, contour, labels, edge_weights, mode = 'BCE', nb_classes = 2):
"""
if use_dice:
# based on the watershed lines, tune the unet featmaps have 1 at the background predictions
contour = tf.reshape(contour, labels.shape)
# con... |
addcc186b9dbb38a7ded27908650905326d9ea5b3dd3ad9e9bc3356465c2f75d | Python | 3,910 | 107 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
796295d6034fd71b69670fb700c0774f572214b00f45e53e1d624702e847dfc5 | Python | 3,916 | 109 | import jax.numpy as jnp
from jax.tree_util import register_pytree_node_class
@register_pytree_node_class
class MonotonicInterpolate:
"""
Piecewise cubic, monotonic interpolation via Steffens method [1].
The interpolation curve is monotonic within each interval such that extrema
can only occur at grid ... |
11c989ddbd9448213a093d7c2fefeed83b5a3dd17bd4b9969db22e114dd1a835 | Python | 3,917 | 128 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
3533f9c611f4d6c0765055c2ba9b43a9589f8885666cfe427ebca02703350a1d | Python | 3,920 | 98 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
96556584a77c24f5c8f8c53d91d22806d8d0235e7a89c8c8f57b470a1ab0e62e | Python | 3,923 | 116 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import os
import sys
from functools import partial
import xml.etree.ElementTree as ET
import lxml.etree as lxmlET
from gui import input_parameters_dlg_ui
from gui.advanced_settings_dlg import ... |
70475e31bc49ebb9a90ab97320a2293190dbf8f4ff3747b445dad13bd2b5499b | Python | 3,925 | 113 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
a9e53e2bce2ef793fd327a10f6faeeb206fcebb79368a5285f1da98d1b8d9439 | Python | 3,925 | 106 | # -*- coding: utf-8 -*-
""" Average Attention module """
import torch
import torch.nn as nn
from onmt.modules.position_ffn import PositionwiseFeedForward
class AverageAttention(nn.Module):
"""
Average Attention module from
"Accelerating Neural Transformer via an Average Attention Network"
:cite:`htt... |
fe882d97867402c9207588e29e94f507ff715c97048033543ab3c484ef92bcc3 | Python | 3,925 | 108 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from .MessageFunction import MessageFunction
from .UpdateFunction import UpdateFunction
from .ReadoutFunction import ReadoutFunction
import torch
import torch.nn as nn
from torch.autograd import Variable
class MPNNv3(nn.Module):
"""
MPNN as proposed by Duvenaud... |
6e5ffbde1c78e32ea8b09641ddf71ee0a848918d74d0fe345da3533d1c173d0e | Python | 3,940 | 106 | # Created by woochanghwang at 11/08/2021
import pandas as pd
import gseapy as gp
def get_drugtargets(virus, cluster):
if virus == "SARS-CoV":
pathway_cluster_addr = "../result/SARS-CoV/Drug/SARS-CoV_candidate_drug_info_target.SIP.CT.v2.xlsx"
elif virus == "SARS-CoV-2":
pathway_cluster_addr = ".... |
301a760831b45b5b6abfbada5805f99b9a158ccd54396bddc3520f85e6bae5c2 | Python | 3,941 | 103 | import numpy as np
import tensorflow as tf
from scipy import ndimage as ndi
from skimage import morphology
from skimage.measure import regionprops
def _watershed(scores, proposals, pred_mask, min_score=0.99):
im_height = pred_mask.shape[0]
im_width = pred_mask.shape[1]
markers = np.zeros([im_height, im_w... |
b25a5f68aad54ff9a99691d5985e8607ee24b034294dbbe9a9bb09ebf962dfd1 | Python | 3,941 | 127 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
db59d14874a8d24750f3de78fe48a3f27dd5bf154094ab3fa9f47c1d084525ee | Python | 3,952 | 106 | # @license
# Copyright 2020 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
827867c681ee1413ef5e36e78c295732008fe6e0e864a467a5db81d15238722b | Python | 3,953 | 129 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e9edafa4222875969ab8d3d23db3bc1cfe42247ac150a03f7ca36ff1252b2c26 | Python | 3,958 | 83 | import pandas
import numpy as np
#Class Description: Class to compile and write result outputs
class OutputFormatting:
def __init__(self, rootPath, outputFolderPath):
self.outputFolderPath = outputFolderPath
#Description: Write file detailing cluster metrics
#Parameters: df = DataFrame ... |
aeac4fc4f64b30df02111aaa330f335e0f1a4535795962a543eb7fa8528f0fdb | Python | 3,963 | 131 | #!/usr/bin/env python
import os
import argparse
import logging
SCRIPT_PATH = os.path.abspath(__file__)
FORMAT = '[%(asctime)s] %(levelname)s %(message)s'
l = logging.getLogger()
lh = logging.StreamHandler()
lh.setFormatter(logging.Formatter(FORMAT))
l.addHandler(lh)
l.setLevel(logging.INFO)
debug = l.debug
info = l.i... |
bf83af50c7355d3e02f01da250202e3b3682313786eb9061a062871ebc2ea536 | Python | 3,965 | 134 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2017-11-19
from __future__ import absolute_import, print_function
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
try:
from encoding.nn ... |
230cff25989001ed12300da14b1c31f58c414ea1af3a3715e4de5676cceca854 | Python | 3,977 | 99 | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Robotiq, 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 copyr... |
f273b030abe7c54821ea6c56d67c42554c47b9835ab169c73409d5149905dd55 | Python | 3,989 | 110 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
14826a0fe9887c806cf2f9f02c2fb1d3a3c78e623a19d78d1c8f6edf0e2af509 | Python | 3,995 | 131 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
c330031a410fc2c5a1772a4cf4e313507bbaeedcf25c9e69b8fc88a182698714 | Python | 3,998 | 131 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
58e43fd037b353c52ac985bec84487924dc6dc000e90ab33b444791d96c9af5c | Python | 4,008 | 111 | from matplotlib import pyplot as plt
from scipy.stats import pearsonr
from deep_phospho.proteomics_utils.colors.precolors_single import S
from deep_phospho.proteomics_utils.stats import delta_tx, r_square
# TODO Reg class
"""
将绘制函数放在 class 中还是独立的函数中?
class XXX:
def __init__(xxxxx)
self.figure = None
... |
a57b84a032147aa803b44b1083553b38cde27b4ffdac29b100e66024ec14fa64 | Python | 4,009 | 138 | from typing import List, Optional, Tuple
import napari
import napari.layers
import numpy as np
from brainglobe_utils.cells.cells import Cell
from brainglobe_utils.qtpy.logo import header_widget
def html_label_widget(label: str, *, tag: str = "b") -> dict:
"""
Create a HMTL label for use with magicgui.
""... |
641a37554f77f238598ba0609cffde012534a2fc57cc2f3ebd5b58c716017c1b | Python | 4,010 | 90 | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Robotiq, 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... |
0f6f596ec16826dd38167f31b5ef88d24b7a3b8bdcadb8fd2ef04df4d41ca0a4 | Python | 4,022 | 97 | import keras
from keras.layers import Dense, Conv1D, BatchNormalization, Activation
from keras.layers import AveragePooling1D, Input, Flatten
from keras import backend as K
from keras.models import Model
from models.attention_module import attach_attention_module
def ResidualBind(input_shape=(150, 14), num_class=27, c... |
8172c48ebb7998ed7d3568f9d2b24a0c35df210e013ce24c3e4076f4316b22a6 | Python | 4,024 | 124 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
64dc122b21d3314a4cc3466f3779f129dddd61eac0c3a18ba5989f60e5521749 | Python | 4,029 | 86 | import os
from analysis.probe.probe_io.probe_io import TriggerTraceIo, BonsaiIo, IgorIo
from analysis.probe.probe_field_of_view import ProbeFieldOfView
from spike_handling import spike_io
SRC_DIR = os.path.expanduser('/home/skeshav/swc_glusterfs/Sepi/Probe/')
def main(experiment_id, raw_traces_extension='g... |
e344b8096b30697932c7c27adae28febad6801d4a22b7802e24a7adc51500720 | Python | 4,030 | 102 | import re
import os
import logging
import numpy
from .Genotype import GF
from .. import Utilities
from ..misc import Genomics
class DTF:
"""Format of dosage"""
CHR = 0
ID = 1
POSITION = 2
ALLELE_0 = 3
ALLELE_1 = 4
FREQ= 5
FIRST_DATA_COLUMN = 6
def dosage_file_geno_lines(file, variant... |
4b17f96e6b63cb80abd7780dd57c6a5951f96e48fffd6cfc6bdb640d9edc4ab5 | Python | 4,034 | 104 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
6cc183aa2846961a3205c172b15c9249a194e7229c5f32a9212d57a92c63a196 | Python | 4,036 | 121 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
41bfb3cd1c7224420028fc15ed97011f92bc59d62f62c403258c6e82c9164148 | Python | 4,039 | 121 | """Shared pytest configuration and fixtures.
The sample data is downloaded from Zenodo (and cached) by :py:func:`yasa.fetch_sample`. It is
loaded in session-scoped fixtures, so that test collection works offline and each file is only
read once per session. The arrays are read-only so that a test cannot silently modify... |
7e832209c1746fb1a04d2364f299d60aa3c54626a5cffcc5aa17e7b9baff0bc1 | Python | 4,039 | 110 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
2ef183bc5acb9c3bd5e29cba2af9db7fe56ce3ea8c36dfd3907ea3e1f4b96f77 | Python | 4,047 | 109 | """ Image Encoder """
import torch.nn as nn
import torch.nn.functional as F
import torch
class ImageEncoder(nn.Module):
"""
A simple encoder convolutional -> recurrent neural network for
image src.
Args:
num_layers (int): number of encoder layers.
bidirectional (bool): bidirectional e... |
533427cb9e585d6e2571702f9f3f09766646f08bc59377256da8b796cc9f518f | Python | 4,047 | 129 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
daabd023e847995cb443ccd784667ec5c6ff74874d50d0db45fdca58ad7d7a96 | Python | 4,054 | 124 | import math
import numpy as np
from scipy.signal import butter, filtfilt
def detrend_all_channels_gaussian(array):
from scipy.ndimage.filters import gaussian_filter1d
detrended_data = array - gaussian_filter1d(array, sigma=100, axis=0)
return detrended_data
def denoise_detrend(array, n_chan, ... |
59d9b78c967feb1dff0cd0d66d219b1f27720c3db52bca5168039ae582cae7b0 | Python | 4,062 | 120 | # 26th September 2018
# Python script for executing msprime simulations of Holstein demography,
# Calculate mean tip lengths to determine age range of mutations
# Execute with python3 MSP_Holstein.py 1000 > MSP_Results.dat
# (Results piped to STDOUT)
# Updated 18th Jan 2019
# Changed recent No to 49
# Update 21st Jan... |
aee55095be6a32a5dc1209672400a15992fc2368a02e76d896473b44b4201999 | Python | 4,068 | 132 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
5287bb5b4311e4de7c85d145a53ed97b3e7940ea0b1333b690c67dd872d5cfa4 | Python | 4,075 | 131 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9186197f9f0c60a7708cd78ceb8d915b4a7419c62e234e33f1bafbe8a9ef80b1 | Python | 4,075 | 88 | """
implementation of StemGNN (Spectral Temporal Graph Neural Network) block
adopted from https://github.com/microsoft/StemGNN
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class GLU(nn.Module):
def __init__(self, input_channel, output_channel):
super... |
02953220f1e9f99139398989969713ddad0587d12a585aa039d5d3ee2daf96b8 | Python | 4,077 | 93 | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Robotiq, 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... |
922cd16cb29a66cf37666ce43fffdb3e17428dadbb1fc353dd97516636ac79f5 | Python | 4,077 | 91 | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Robotiq, 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... |
5dd8b001868eaa6316aebd46147edd2856a4b7106eeda71b44377a29ba7b06d3 | Python | 4,082 | 94 | from ..utils.losses import smooth_l1_loss
import tensorflow as tf
def RPNLoss(prediction_dict):
"""
Returns cost for Region Proposal Network based on:
Args:
rpn_cls_score: Score for being an object or not for each anchor
in the image. Shape: (num_anchors, 2)
rpn_cls_target: Gro... |
015d5e063daa7a3611f65fae78dd749f8dc7d8fe17aa002250d8d03b54639524 | Python | 4,083 | 105 | import torch
class Batch(object):
"""Defines a batch of examples along with its Fields.
Attributes:
batch_size: Number of examples in the batch.
dataset: A reference to the dataset object the examples come from
(which itself contains the dataset's Field objects).
train: De... |
d210b1911d3b65d88e098c33a910f73115468cba802f3a00f8b9e2600c68f9c6 | Python | 4,090 | 139 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
2ec533063e648d862f7dbd3d2d311a9f666d5f805bbd3f793b0911e57931e37b | Python | 4,091 | 105 | import pandas as pd
import glob
import os
from utils import _utils
from pathlib import Path
import shutil
def reformat_forecasts(file_path, target, root, data):
# read forecast
fips_codes = pd.read_csv(root / 'data-locations/locations.csv')
df = pd.read_csv(file_path)
# lowercase all column headers
... |
172a7f0c391d4fb0570d95f12a526beed735a6508708873e1bd6ef4ea5c994b1 | Python | 4,094 | 150 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
327d20df96e559c205fe83918a18be6dbfefe2bd9a91d77c17eae30080b50686 | Python | 4,107 | 128 | # coding: utf-8
"""
Base dataset class and constants
"""
from itertools import chain
import torchtext
import onmt
PAD_WORD = '<blank>'
UNK_WORD = '<unk>'
UNK = 0
BOS_WORD = '<s>'
EOS_WORD = '</s>'
class DatasetBase(torchtext.data.Dataset):
"""
A dataset basically supports iteration over all the examples... |
18719030bb69913cbe56dafff6638915abfe46590efc8d3756f7bb1e2aa14274 | Python | 4,108 | 106 | import json
from truth_utils._utils import get_epi_data, get_epi_data_TZ, get_available_timezeros, pre_process_truth, pre_process_epiweek, get_raw_truth_df, extract_raw_us_and_state_truth
import pandas as pd
import datetime
import warnings
warnings.simplefilter(action='ignore')
def configure_JHU_data(df, target):
... |
ce47b086d37b3517d76d69646a50af65d0db1888fd4f68366c08b5b98db9764a | Python | 4,111 | 132 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
73a4bf4c1c9c2da98452c661356eacd6393f0d9699b1da047e91735972c6beee | Python | 4,119 | 114 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
014bf2869e8e764ecf37e7ea34449bcc88032abf2343e1091fb0342de32595ec | Python | 4,121 | 121 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1d91be922d65b03548b89fbb5fc24e1e32c5c885d1ccfc60b6c8fc7cbe92f269 | Python | 4,124 | 83 | import argparse
import os
from deep_phospho import proteomics_utils as prot_utils
from deep_phospho.model_utils.logger import setup_logger
HelpMSG = '''
This script have two usages and both of them will build a Spectronaut-compatible spectral library
Usage 1: python build_spec_lib.py build -i pathA -r pathB -o pathC... |
e4ec7218524ba757f69fc39fac66c4be5012988d88010f9a5ea0532fcb266b02 | Python | 4,128 | 134 | import os
import numpy as np
import pandas as pd
def sum_set_in_list(list_with_sets, return_type='set'):
union_set = list_with_sets[0]
if len(list_with_sets) >= 2:
for s in list_with_sets[1:]:
union_set = union_set | s
if return_type == 'set':
return union_set
elif return_... |
268b65e1b148468f10d2af3a320920816cdfa41c963992eae7a9e65a66bee3f8 | Python | 4,137 | 126 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
91f4816ad3135387af5dd120fe545e77597dad5c21824258a834380836a975bc | Python | 4,138 | 133 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
ed24bd31d95e27d9ddf734b66df401ad855e2eb7988b8a81d05ac12735f8587b | Python | 4,146 | 127 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
d2ea674a587ffa41e4297aaa11f8da9d3c1bc3170449109f96df0787436e8899 | Python | 4,149 | 110 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9c6d55a6b84f91d47bf2bc9631cc0d7d3a1774214a574389e4f1948c842c245a | Python | 4,160 | 136 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
516700250d25eb3e5475432dca01a40cdd6e43f5605b2a14488c87b2aa7983de | Python | 4,167 | 123 | # import os
#
#
# import numpy as np
#
# res = np.array([80.56, 80.39, 79.91, 80.28, 80.33])
#
# print(res.mean())
# print(res.std())
import os
import numpy as np
import h5py
from Bio import SeqIO
from tqdm import tqdm
from utils.preprocess import reduce_embeddings, remove_duplicates_full
os.chdir('..')
base_path = ... |
55cbc5c765ca45e78170db53fce2d7c892b0f88df18bec3666c101cb1358c507 | Python | 4,168 | 97 | import torch.nn as nn
import dgl
from nets.gru import GRU
from models.dgl.pna_layer import PNALayer
from nets.mlp_readout_layer import MLPReadout
"""
PNA: Principal Neighbourhood Aggregation
Gabriele Corso, Luca Cavalleri, Dominique Beaini, Pietro Lio, Petar Velickovic
https://arxiv.org/abs/2004.05718
... |
9e0f6d666ccd9a9f03d54594f63c4206fc2be05ed0356ab9c1f88005a76150f2 | Python | 4,172 | 132 | """ Statistics calculation utility """
from __future__ import division
import time
import math
import sys
from torch.distributed import get_rank
from onmt.utils.distributed import all_gather_list
from onmt.utils.logging import logger
class Statistics(object):
"""
Accumulator for loss statistics.
Currentl... |
9fc4ce86ebb8c7cde945407412b24494e65fd2dc25f0bad8294af5d9eca7f630 | Python | 4,180 | 85 | import pandas as pd
import os
def reformat_county_data(df):
df.drop(columns = ['StateFIPS', 'County Name', 'State'], inplace = True)
df.rename(columns = {'countyFIPS': 'location'}, inplace = True)
# Drop row that is not county data
df = df[df['location']>1000]
# Format county fips code
df = d... |
bca5afd0157c5ba5300114dbb91327aff5f9585de502e00e6a6247f1f558b369 | Python | 4,184 | 91 | import numpy as np
import pandas as pd
def data_loader(data_dir, task, historical_sequence_length=24, forecast_horizon=24, start_train='2019-01-01', end_train='2019-12-31', start_test='2020-01-01', end_test='2020-02-01'):
df_aq = pd.read_csv(data_dir+'/air_quality_measurements.csv',index_col='time', parse_dates... |
de81dc30aba7c3c6b4301001cbdfeea5940f12bdd1f720e3dc050ae3bdfa7555 | Python | 4,184 | 149 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.