sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7730e5b906a0ad043fd7f081ef7feabbc77ee99c036c1036dd68fd7d0c3d1bc2 | Python | 2,555 | 64 | import torch.nn as nn
import dgl
from models.dgl.pna_layer import PNASimpleLayer
from nets.mlp_readout_layer import MLPReadout
import torch
from ogb.graphproppred.mol_encoder import AtomEncoder
class PNANet(nn.Module):
def __init__(self, net_params):
super().__init__()
hidden_dim = net_params['hid... |
dd8a150f55c5e82731398da93b51fef4a2181e8e1d2b5546d553a7ea0d944e57 | Python | 2,558 | 80 | # 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... |
c453398a1125d26a49a0871fe35d58a8defb89540862e1dd699437a340cf58f0 | Python | 2,563 | 76 | # 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... |
f42208790e836c82fcf1193ac87826118c6308dcb4c2f646a97999fd3db5564d | Python | 2,566 | 75 | # 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... |
3c351716d4092a865e167b0c57ee3e8386242bd97d8c71bc4999a59920137ca7 | Python | 2,569 | 83 | import os
import glob
import pandas as pd
from pathlib import Path
import yaml
'''
Get the path of the root dorectory of the repo.
'''
def get_root():
try:
root_path = Path(os.path.dirname(__file__)) / '..' / '..'/'..'
except:
root_path = Path(os.getcwd()) / '..' / '..'
return root_path... |
39cc08e0f3796803fa3648847b10b680d0baed8ab21ebc32fe9f7a1bbb405a15 | Python | 2,585 | 75 | import matplotlib.pyplot as plt
import numpy as np
import os.path
#------------------------------------------------------------------------------
def calcTemplateMatch(X,Y):
tm = 0
normX = np.linalg.norm(X)
normY = np.linalg.norm(Y)
if (normX != 0 and normY !=0):
tm = (np.dot(X,Y) / (normX*normY... |
5c22776853c29e5e8b7409b17e0837d1064b238808a8b74fc30b22c9d231185b | Python | 2,587 | 87 | # 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... |
6bea83e23f2d756e8d958eed4364c205a4214e464d501cbf40a8f724ca7fbd99 | Python | 2,597 | 72 | # 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... |
4c7779ed48190feac4607de1b4d20cfb8d090465d65e3aa17a8354b8cb5eebe5 | Python | 2,604 | 91 | import os
import requests
from tqdm import tqdm
from warnings import warn
from shutil import copy
from .. import network
if os.name == 'nt':
IS_WINDOWS = True
HOME = 'USERPROFILE'
else:
IS_WINDOWS = False
HOME = 'HOME'
# if config dir is specific in environment var
if 'NUSET_CONFIG' in os.environ:
... |
02b421cac55b8be971fe154782be747dcb95ad761cc41c6a0754706b2e0df056 | Python | 2,611 | 69 | """
Fit torus graph to neuropixels phase data using pyTG.
"""
# 'results/neuropixel_csd_V1_phases.mat' (or LM)
# each has beta and theta for two different time points
# so fit model for each frequency/time, also bootstrap.
# Should be similar in structure to the 1D script.
# %% Imports
import numpy as np
from tqdm ... |
f61f1ef9d0b082d70e6c4b7c06582e27c69689dac20e400fed8f7cfaad60d251 | Python | 2,624 | 84 | # 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... |
fb243bc01e31663f77aec06139053d7b30032ecea49027de67f4c0ff40630e2b | Python | 2,625 | 66 | import numpy as np
import matplotlib.pyplot as plt
# Modefied version of the Gabor-Function to create a 2D- Sinus grating
# R. Larisch, Technische Universitaet Chemnitz
# 2020-04-27
def makeGaborMatrix(xPos,yPos,amplitude,theta,sigmaX,sigmaY,k,phi,x_c,y_c,offset,patchsize):
#xPos = index/12
#yPos = index - 1... |
98ded183def8ceb9bd255033cdb56266178963f5e71f926e1663cdc962492662 | Python | 2,626 | 85 | import os
import glob
import pandas as pd
from pathlib import Path
import yaml
'''
Get the path of the root dorectory of the repo.
'''
def get_root():
cur = Path(os.path.dirname(__file__))
while(cur.resolve().parts[-1] != 'covid19-forecast-hub') :
try:
cur = cur / '..'
except:
... |
3f80ab5ebde36731951604ebb54c38076930bce6e6fecf311006a12ff0ddb29a | Python | 2,631 | 75 | import numpy as np
import pandas as pd
"""because I can't be bothered to look up how to make data frames all the time"""
def create_data_frame(keys, data):
df_keys = np.array([keys])
df = pd.DataFrame(data=df_keys[1:, 1:], # convert to empty dataframe
index=df_keys[1:, 0],... |
42816c59310aca7b451c17349103dab761439da2cb5e252779403d9686342954 | Python | 2,632 | 65 | # 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... |
cabddff2c830d94ac557a8c4bd6dc3804b708020802e51f501c7ee498cfeb83d | Python | 2,637 | 83 | import numpy as np
import csv
import os
import os.path
import pandas as pd
def main():
IDList = []
MIlist = []
for number in range (1,33):
with open(str(number)+'.csv', newline='') as csvfile:
csvReader = csv.reader(csvfile, delimiter=',')
lineCount = ... |
3052ec7f5e26e9b5f19ff0c370b27c80fa92c2c4630d67296ad27b5aed10e748 | Python | 2,638 | 47 | import pandas as pd
import os
# Global Constants
US_URL = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us.csv"
STATES_URL = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv"
COUNTIES_URL = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
R... |
d8968516a0f2e368ab8f7d23f1cc09b49f897f547340173d430e4c39464decc6 | Python | 2,638 | 81 | # 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... |
31160f1ecc76cb488f137d7c3c18b9d579a67401cc0872ab02fa8e8a7d96e107 | Python | 2,639 | 85 | # 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... |
90afde19db9af3142d9d125c54b68da0d6c3ed750aa73ee7c27cd8e0371336b6 | Python | 2,651 | 73 | from margrie_libs.signal_processing.list_utils import flatten as flatten_list
from spike_handling import spike_io
from analysis.probe import probe_cell
from analysis import field_of_view
from analysis.probe.trigger_handling.triggers_old_data import Triggers
from analysis.probe.ctxt_manager_decorator import temp_... |
ef7e9720711980db22867e98cfde2e132bcfa03cdb063deec86ac1890beacf58 | Python | 2,655 | 79 | # 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... |
f0dc42c20a618b318282ae717b3b3a0de01fbfadb21a48abefda1e55046fa52e | Python | 2,656 | 88 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2018-03-26
from __future__ import absolute_import, print_function
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
from .deeplabv3 import _AS... |
3a37e4e39ffed2fbdb5c2a91698ea833150464dac14cbc965d9d59e5872f0214 | Python | 2,657 | 78 | # 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... |
f85b8f22ff76abac68c31b7dc16f178154b7d5ec4c9f0c3dd08c299f5528619a | Python | 2,664 | 70 | import numpy as np
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.externals import joblib
from sklearn.metrics import matthews_corrcoef
from sklearn.metrics import roc_auc_score
def fit_model(data, model_clf, test_size, random_state):
x = data.x
y = da... |
c10c4fbce0351f4c04fd9aeae6a10b3e82ad5edcafc6e9a5da3e7d5fbd69a5f2 | Python | 2,665 | 81 | # 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... |
e49f7f49d25ddf9f81e4bb0aa9b12fa354523ab86113281f04f8f2af05ac68b7 | Python | 2,679 | 82 | # 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... |
aed6cf799d13275a9e1e34a9112f59c22f9a1cebf789c60dc1d5efa262728a58 | Python | 2,682 | 34 | UNIVARIATE_DATASET_NAMES = ['50words', 'Adiac', 'ArrowHead', 'Beef', 'BeetleFly', 'BirdChicken', 'Car', 'CBF',
'ChlorineConcentration', 'CinC_ECG_torso', 'Coffee',
'Computers', 'Cricket_X', 'Cricket_Y', 'Cricket_Z', 'DiatomSizeReduction',
... |
7d6e6186a5de32aeceeba164da1fdb88310a6a1b3591213984d3603fc1629f8f | Python | 2,683 | 58 | import torch
import torch.nn as nn
class LightAttentionPSSM(nn.Module):
def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=9, conv_dropout: float = 0.25):
super(LightAttentionPSSM, self).__init__()
self.feature_convolution = nn.Conv1d(embeddings_dim, 1024, kernel_siz... |
63f7af5ae1dca1b1bef92883c7cc9ee53fcc8f00d1e5f06524c03506d7ffea41 | Python | 2,684 | 77 | # 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... |
fa18449d1cfc14645e6ea5d72896d6c7900b207367199f487b812690159a7e42 | Python | 2,686 | 58 | import torch
import torch.nn as nn
class BahdanauAttention(nn.Module):
def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=9, conv_dropout: float = 0.25):
super(BahdanauAttention, self).__init__()
self.feature_convolution = nn.Conv1d(embeddings_dim, embeddings_dim, ke... |
c92debbc804e6f393266a7cbcde1eaa2c57e56c07b61170cd0f57929989c2970 | Python | 2,691 | 77 | import time
import dgl
import torch
from torch.utils.data import Dataset
from ogb.graphproppred import DglGraphPropPredDataset
from ogb.graphproppred import Evaluator
import torch.utils.data
class HIVDGL(torch.utils.data.Dataset):
def __init__(self, data, split):
self.split = split
self.data = [g ... |
99c394b9a8a6521d3e419ff551d05230a1f936be2b6b207137f0c922ab301169 | Python | 2,693 | 89 | # 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... |
0646ec27f79ab8742129a2d2e6d6208f3a023cbfe99e096e56b6839791a3c0bb | Python | 2,695 | 77 | import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
from sklearn.metrics import cohen_kappa_score
from sklearn.metrics import auc, roc_curve
def print_stats(ytest, ypred):
print("Accu... |
fb5dec11e614523ae6c268a4276cd9b9e8aea80f7f6294e33be4eda5186642a2 | Python | 2,703 | 60 | import torch
import torch.nn as nn
import torch.nn.functional as F
class FirstAttentionCat(nn.Module):
def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=7, conv_dropout: float = 0.25):
super(FirstAttentionCat, self).__init__()
self.conv1 = nn.Conv1d(embeddings_dim /... |
3246c5b0505f60a6a8979509bffcd37ff9c5a67a1c539c8891b7b36b9b8c1476 | Python | 2,705 | 104 | # 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... |
b455e074d3ee5acbe3e73b053e5718fc2fe833592ff1756bc89045a4734b3208 | Python | 2,707 | 90 | import numpy as np
# TODO: replace with margrielibs implementation
def flatten_list(lst):
"""
this is the fastest
"""
out = []
for sublist in lst:
out.extend(sublist)
return out
def make_mask(size, idx_true=None):
"""
creates a boolean mask from a list of in... |
dbeefa922e2d3290b371596fc4c0dc09e2ead6ace205de53c2925b2b8b391efc | Python | 2,720 | 68 | import numpy as np
from margrie_libs.margrie_libs.signal_processing.thresholding import find_level_decrease
from cached_property import cached_property
class Event(object):
ATTRIBUTES = ('start_p', 'peak_p', 'half_rise_p', 'amplitude') # TODO: add end
def __init__(self, start_p, peak_p, half_rise_p,... |
5158afd8f25aebfea0237ab96af3083ef75779160f4f5374838943eb0134f520 | Python | 2,721 | 72 | import os
# main function - startAnalysis():
# main function to analyse the results of the newtwork simulation
# e.g: - start fitting with Gabor-Functions
# - start calculation of STA and STC
# - start the image reconstrunction functions
# - create all necessary folders
# - test if all necessary inpu... |
59f2fec4e8f266136987d995436ae5e42790c89cf17f7de4798284e6d1d74589 | Python | 2,722 | 85 | # 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... |
80a58ac3af7ec4684dc09e15dfc0a4c63a4030e28ccc814ec487818489b29037 | Python | 2,722 | 77 | # 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... |
9402c37aea3f64d2d3626a9962eb47aa97988a6050f3bc018b3088160956dd36 | Python | 2,725 | 84 | # 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... |
a6fd72f93d6f629d04733aa9a4bff827c215b297b7227be8d7744296c5974867 | Python | 2,731 | 69 |
# Script for extracting data from .nwb files and formatting it to .mat files, for use
# with the Sabes lab raw broadband (Supplemental) neural dataset from
# https://zenodo.org/record/3854034#.YFyjfa_7Q2w.
##################################################################################
# MIT License
#
# Co... |
7248da6120556e6581688456a172bfef3590eb3a318f2758cecb0af31c76cd64 | Python | 2,736 | 106 | from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
def file_parse(parser):
file_parser = parser.add_argument_group("Files")
file_parser.add_argument(
"--spiketimes",
dest="spike_time_file",
type=str,
required=True,
help="Spike timing file (.npy)",
)
... |
c4776a09aa447bb484094f36b41ab795526831a29d0d9b7f6f030aff5253f4bb | Python | 2,736 | 83 | # 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... |
dacda717702e0c0e540133bdd4aea7d6e5dc856b0635af9b69f1835b0821d88c | Python | 2,738 | 66 | """ Onmt NMT Model base class definition """
import torch
import torch.nn as nn
from onmt.modules.util_class import make_condtion
class NMTModel(nn.Module):
"""
Core trainable object in OpenNMT. Implements a trainable interface
for a simple, generic encoder + decoder model.
Args:
encoder (:obj... |
ab9f61aff9678d108d997a2991dd847f2ba88c4d2cf983d7f54647ab477bbd1d | Python | 2,747 | 90 | # 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... |
5b25566de0b4362cc6d7f1870c2d22ddd3b88e93788eb5588294898c22c9768f | Python | 2,749 | 65 | # Created by woochanghwang at 12/07/2021
import toolbox.drugbank_handler_postgres as drug_pg
import pandas as pd
def get_DDI_of_a_drug(drug):
# drug_a = row['DrugA_ID']
# drug_b = row['DrugB_ID']
sql = "SELECT * from structured_drug_interactions where subject_drug_drugbank_id = \'{}\' " \
"or ... |
aacd5c456eb49275d5c69df7636938c866c9c3d8192a0ad3abd9a73ae44a50af | Python | 2,755 | 79 | # 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... |
c15c4b0a9119e37f9288e84ccb840de181ab04b2eaf87c1f056eb296ff9dacf5 | Python | 2,757 | 97 | # 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... |
88e6a374ad67b368d51de5bd656099e59eeca3034a75c58cdd66216923ec0231 | Python | 2,759 | 67 | #!/usr/bin/env python
#******************************************************************************
# $Id$
#
# Name: gdalcopyproj.py
# Project: GDAL Python Interface
# Purpose: Duplicate the geotransform and projection metadata from
# one raster dataset to another, which can be useful after
# ... |
cbe3e7fcb6148391340e2fa61daeedde08580bd2b2269ed3d312d1f0acaf5e05 | Python | 2,763 | 86 | # 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... |
57dd4caeff0bdf357a44011eee62608b1cbfddafc318122a6ecbc3069a08bafc | Python | 2,770 | 117 | # 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... |
5c1bce0c4045d431f021983fd80627a1911e8407a4df8aaacca9c692361d5853 | Python | 2,786 | 61 | import os
from analysis.probe import analyse_functions
from analysis.probe.trigger_handling.trigger_handler import TriggerIo
from spike_handling import spike_io
SRC_DIR = os.path.expanduser('~/probe_data/')
def main(experiment_id, raw_traces_extension='g0_t0.imec.ap.bin', trigger_extension='trigger.npy', n... |
44b700069bbd424e9ec46b2ef67220f8438cedafc541013296da4a4361175f31 | Python | 2,792 | 90 | # 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... |
c6a809a444519d571f2d5907c3035ba1be4f71114ad6e62061058079072b1ec1 | Python | 2,796 | 87 | # 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... |
02aa9172dea1d7544ab4fb59523fdf90ddccfa3ff5671994bb19982cdf6545be | Python | 2,799 | 83 | # 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... |
85c6ffcdc812dfc47df1eca09278d0fa116742a3cb428f7e83043ba046207a9c | Python | 2,804 | 104 | # 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... |
bdf51a4d942d4fd506a6d77e5c83618a2763a270783f1e1a170b67a14d6c3671 | Python | 2,807 | 87 | # Standard library imports
import math
# First-party imports
from gluonts.mx.kernels import RBFKernel
from gluonts.mx.model.gp_forecaster.gaussian_process import GaussianProcess
# Third-party imports
import mxnet.ndarray as nd
import numpy as np
# In this file, we generate a synthetic dataset where the time series ... |
a7238cd695b3d9e307646c954f320b67f97a5631fc32135fe51c8a09aa4cca89 | Python | 2,819 | 40 |
REPO = 'https://github.com/weizhenFrank/DeepPhospho'
REPO_PretrainParamPart = 'https://github.com/weizhenFrank/DeepPhospho#down_pretain'
MainDesc = ('DeepPhospho desktop provides the full supports for DeepPhospho runner with graphical user interface, '
'to make the running of DeepPhospho pipeline easily.... |
b9fa341f5fe720382a962d86c93e1ba47a0daed57338106f9d7e073167373f92 | Python | 2,821 | 85 | # 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... |
10d2dcf37df909b4e0658a0e0a30b54e2eeee18a3efb123b13b6c6445e626bcd | Python | 2,822 | 106 | # 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... |
99f7c7507be5044cf58b768bd7436945efe6e19091bf840add2c71d51bfec5c9 | Python | 2,824 | 67 | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvsStrangeAttendConcat(nn.Module):
def __init__(self, embeddings_dim: int = 1024, output_dim: int = 12 , dropout=0.25):
super(ConvsStrangeAttendConcat, self).__init__()
self.conv1 = nn.Conv1d(embeddings_dim, 512, 21, strid... |
e6bdcc27be86b51b610c85da1a626ce585a1e1936204507e12852161a3997772 | Python | 2,828 | 87 | #!/usr/bin/env python
# Script to simulate partial sweep trajectory using simuPOP and HOL demography
# Based on script from http://bopeng.github.io/simuPOP/userGuide_ch7_sec2.html#backward-time-trajectory-simulations-function-simulatebackwardtrajectory
import sys
import simuPOP as sim
from simuPOP.utils import Trajec... |
44542a7b74f0a26ca0c276e3cac5f047062290c62f393650e153ed807acb2f59 | Python | 2,834 | 87 | """
In class Enzyme
Enzymes:
The dict contains all usable enzymes
Key: The name of enzyme, which starts with uppercase letter except some conventions
Values:
CleavageSite: a tuple with three elements, ('cleavage aa', 'direction', 'exclusion')
'cleavage aa': The AA for cleavage, one AA w... |
d1b2d9704f4a252804f78a3b68791901a364c63ca552521d1aaecdd8fa437ebc | Python | 2,838 | 100 | # 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... |
43de1f6adc0b4ad0755035cc08f18cf07f840afd5a588e562e4e74bea4db872f | Python | 2,843 | 106 | # 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... |
06b81d327e4a2428b2aab80d21118c087b06d1e9e730417830f767dde485f845 | Python | 2,847 | 77 | import torch
import torch.nn as nn
from torch.autograd import Function
from onmt.modules.sparse_activations import threshold_and_support
from onmt.utils.misc import aeq
class SparsemaxLossFunction(Function):
@staticmethod
def forward(ctx, input, target):
"""
input (FloatTensor): n x num_class... |
e73241dbfd46ad839e163f1053b85b33045f64edfc9240361b8516d4f1fec79a | Python | 2,860 | 97 | # 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... |
da0b6004b7cf73e5de8cd67af9ee25a0dec8b0d4784b53987a9245a1a751b4b8 | Python | 2,866 | 70 | import numpy as np
from spike_handling import spike_io
from spike_handling.cluster import Cluster
from util.generic_functions import sort_by
import matplotlib.pyplot as plt
import os
def main():
src_dir = '/home/slenzi/Desktop/CA242_B/'
traces_path = '/home/slenzi/Desktop/sepi_subset_probe_data/CA24... |
3e8f2c95ae601a03ce4c7e6a8c21b7fe295d61ef6e279e74df493cd827fbb62a | Python | 2,875 | 99 | import os
from math import isclose
from pathlib import Path
import pytest
from brainglobe_utils.general.exceptions import CommandLineInputError
from brainglobe_utils.general.system import ensure_directory_exists
import cellfinder.core.tools.system as system
data_dir = Path("tests", "data")
background_im_dir = os.pat... |
7fb36097b28f5afdda36a67eb82b4dec7aa23f5557ce4f55e10d28b2988843be | Python | 2,877 | 96 | # 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... |
4a2f1804673ac612c51f901e3c85ad1163aad5fc3b588523efc264f620297585 | Python | 2,880 | 61 | import torch
import torch.nn as nn
class LightAttentionMetaData(nn.Module):
def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=9, conv_dropout: float = 0.25):
super(LightAttentionMetaData, self).__init__()
self.feature_convolution = nn.Conv1d(embeddings_dim, embeddin... |
b583b3941094aecb89097e636ad7b935293232f2ebce78f3a2a6e72f1ac60365 | Python | 2,882 | 79 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 16 16:08:42 2014
@author: crousse
"""
from collections import OrderedDict
from board import BoardConf
from traceSet import TracesSet
class Protocol(object):
"""
An ephys protocol (I/V, ramp, gratings ....)
"""
def __init__(self, data, reco... |
d829bd081df8ec9fab04e5ea4ec28e0ca7db84fda1f316bb82ec6dd2d1e7a3b7 | Python | 2,882 | 103 | # 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... |
56a6ae6cccf4ed674bd9749d4370a0be959af79271d3a01fc7d8b15500164ec0 | Python | 2,890 | 75 | import cv2
import numpy as np
import time
import multiprocessing
import hamamatsu_camera as hc
class Preview(multiprocessing.Process):
def __init__(self, currFoc, first_expos):
multiprocessing.Process.__init__(self)
print " ----------- Starting Acquisition thread ------------- "
print "--... |
ad17a5ec358118d7b897ecb90b98251d865c515ee27f91e9176a4a3b9cfc7c47 | Python | 2,894 | 98 | # 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... |
8c7c9e761c90b9e50ff3eb74fd8fe3bf5ced5b61241dd0b14374684b24b3e6f8 | Python | 2,899 | 88 | #!/usr/bin/env python
# coding: utf-8
# This scripts updates the population for each state and county
# NOTE: does not add county if not already present!
# In[1]:
import pandas as pd
from pathlib import Path
import numpy as np
# get root of repository
root = (Path(__file__)/'..').resolve()
# read latest CSV file (i... |
fcb4b8697c209ec3b03a33f0eec12cd827ba20bd28f271898dc6708012434e21 | Python | 2,903 | 80 | import torch
import torch.nn as nn
import torch.nn.functional as F
class GATHead(nn.Module):
def __init__(self, in_features, out_features, alpha, activation=True, device='cpu'):
super(GATHead, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.ac... |
4e0ec42dd0a55bf924ba0754863600b02ecbc9dc1a6ee58b64a9cc2850c9e796 | Python | 2,905 | 95 | # encoding=utf-8
import matplotlib
#matplotlib.rcParams['backend'] = 'SVG'
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import numpy as np
from pylab import *
#mpl.rcParams['font.sans-serif'] = ['SimHei']
#simsun = FontProperties(fname=r'C:\Windows\Font... |
8dff596a6f3d6bcd320b0041db631ad990ebbe6d5728666c6489f764f4c6da89 | Python | 2,914 | 79 | # 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... |
6e72f1a5ad275c894047e6d8b0e557fa3e6d145e4e56073003b5abef0bc2d418 | Python | 2,920 | 104 | import numpy as np
def rgb_to_hsl(x, h_type='degree'):
norm_rgb = np.array(x) / 255
min_value = norm_rgb.min()
max_value = norm_rgb.max()
delta_value = max_value - min_value
l = (min_value + max_value) / 2
if delta_value == 0:
h = 0
s = 0
else:
if l < 0.5:
... |
f027d02010793b6c8b72e2d4d86853ec80ca4a73b96d84e5212c38433ed292d1 | Python | 2,922 | 97 | # 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... |
498f1546b94f3197288c8d29a96c37d732c1887bfae4e28b49a5864918012b65 | Python | 2,938 | 96 | # 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... |
cf4926e6c0037e00848959228a70a96672bcf1288c009f5d04c5b69780573a6e | Python | 2,938 | 92 | import numpy as np
import tensorflow as tf
# originally from https://github.com/tryolabs/luminoth/blob/master/luminoth/models/fasterrcnn/
def bbox_overlap_tf(bboxes1, bboxes2):
"""Calculate Intersection over Union (IoU) between two sets of bounding
boxes.
Args:
bboxes1: shape (total_bboxes1, 4)
... |
2072985441ded0d4756d84f4cf177a9624b2820a4cca400915b68dd2358a925e | Python | 2,942 | 88 | from abc import abstractmethod
from dataclasses import dataclass, fields
from typing import Optional
def asdict_no_copy(obj: dataclass) -> dict:
"""
Similar to `asdict`, except it makes no copies of the field values.
asdict will do a deep copy of field values that are non-basic objects.
It still crea... |
8fe25376d6961d3c13dab5dd691435cf20bfc9209005b9b89931e7103cafa241 | Python | 2,943 | 93 | # 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... |
0d5d0f2bde5dfd8ed15eb894338da7f53f1ac92d8f94bc941656a9d944ed8b58 | Python | 2,949 | 83 | """ Multi Step Attention for CNN """
import torch
import torch.nn as nn
import torch.nn.functional as F
from onmt.utils.misc import aeq
SCALE_WEIGHT = 0.5 ** 0.5
def seq_linear(linear, x):
""" linear transform for 3-d tensor """
batch, hidden_size, length, _ = x.size()
h = linear(torch.transpose(x, 1, 2... |
0504f9b45fea9744aefcc53c1728c95cba48a9cae1c5c19462bfe4186d5de0dc | Python | 2,951 | 101 | # 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... |
2b63e9b901050b99c208314d4967d3d5e7b06864ebd4dc7e8ef30a44991076a1 | Python | 2,951 | 94 | # 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... |
799a46a8d1b09b149dcaf5c8c9aacfe5d135c4dc1d4c8e1fc7ff7e54c449ec12 | Python | 2,956 | 77 | import numpy as np
import pandas as pd
from deep_phospho.proteomics_utils.rapid_kit import substring_finder
from .sn_utils import sn_modpep_to_intseq
def init_phos_analysis(df,
protein_col='PG.ProteinGroups',
modpep_col='EG.ModifiedPeptide',
prec_c... |
ec299d8a653a9b1a5da9b484b8ea4a792295452ed63bb62866136110c6c69bda | Python | 2,956 | 94 | # 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... |
74fdc9a2ecc08730d64160889e7aad266720fe7801004f5ad2a3c0e0dd671cc2 | Python | 2,957 | 80 |
from cyvcf2 import VCF
import logging
import pandas
import numpy
from metax.misc import Genomics
def vcf_file_geno_lines(path, mode="genotyped", variant_mapping=None, whitelist=None, skip_palindromic=False, liftover_conversion=None):
logging.log(9, "Processing vcf %s", path)
vcf_reader = VCF(path)
is_di... |
fd6cccc1be2d3b1ac34725330a3e4fdcf98f32b270135d893046b9567a7e1913 | Python | 2,961 | 96 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2018-03-26
from __future__ import absolute_import, print_function
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
from .resnet import _ConvB... |
c368320a1314ba59d4de1740e5289e41105052f1fe8c6c3d011a6569a8971047 | Python | 2,962 | 79 | import numpy as np
mapping = {"Endoplasmic.reticulum": "Endoplasmic reticulum",
"Cell.membrane": 'Cell membrane',
'Golgi.apparatus': 'Golgi apparatus',
'Cytoplasm': 'Cytoplasm',
'Lysosome/Vacuole': 'Lysosome/Vacuole',
'Mitochondrion': 'Mitochondrion',
'... |
d5845b5b9eff9e6d99f2a04ab7caf41c366aa1bc66714e34daa0697298310e38 | Python | 2,963 | 90 | # 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... |
69993294184fa12529646ccd12042c559475e24fe2826bd65a5396c58abf191d | Python | 2,966 | 97 | 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()... |
821aeae49477d8ab00585d094d30bc7a08e4e369a5c680aec40adfa69e5f40e0 | Python | 2,967 | 75 | # --*-- coding: utf-8 --*--
import torch
import torch.nn.functional as F
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import add_self_loops
class GraphConv(MessagePassing):
def __init__(self, coors, out_channels_1, out_features, label_dim=1, dropout=0):
"""
label_dim - ... |
f76a19962b4506c80466df047e93ca56172bde1f2415fa26bc115cf27b5e1700 | Python | 2,969 | 74 | import math
import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
def __init__(self, embeddings_dim: int = 1024, dropout: float = 0.25, n_heads: int = 8, skip_last_linear=False):
"""
CAREFUL: this does not do the multihead attention from the paper. The last linear layer is missi... |
2b0841086bfddfed0dcb57828a3e2bc1013a927b4315e49ec4a3d5681d74753d | Python | 2,970 | 95 | # 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... |
7abb48e90b7b38eedd80a0132aac027b7cf45ba93e6798684d3730d27b28b7ec | Python | 2,970 | 96 | # 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.