code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
'''Utility functions for plots.'''
import glob
import natsort
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import gridspec
from scipy.signal import medfilt
from nilearn import plotting as ni_plt
from pynwb import NWBHDF5IO
from dandi.dandiapi import Dand... | [
"numpy.log10",
"seaborn.set_style",
"numpy.array",
"numpy.nanmean",
"nwbwidgets.utils.timeseries.timeseries_time_to_ind",
"matplotlib.pyplot.subplot2grid",
"numpy.arange",
"numpy.mean",
"seaborn.despine",
"seaborn.color_palette",
"numpy.asarray",
"matplotlib.gridspec.GridSpec",
"numpy.linspa... | [((2259, 2294), 'numpy.unique', 'np.unique', (["clabels['labels'].values"], {}), "(clabels['labels'].values)\n", (2268, 2294), True, 'import numpy as np\n'), ((3589, 3627), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(20, 2)', 'dpi': '(150)'}), '(figsize=(20, 2), dpi=150)\n', (3601, 3627), True, 'im... |
import numpy
import scipy
import scipy.special
from typing import NoReturn
from cryspy.B_parent_classes.cl_1_item import ItemN
from cryspy.B_parent_classes.cl_2_loop import LoopN
# FIXME: estimate d by time for epithermal neutrons
class TOFParameters(ItemN):
"""Parameters of the reflexion positions in time-of-f... | [
"numpy.max",
"scipy.special.erfc",
"numpy.sqrt",
"numpy.min"
] | [((4284, 4299), 'numpy.min', 'numpy.min', (['time'], {}), '(time)\n', (4293, 4299), False, 'import numpy\n'), ((4319, 4334), 'numpy.max', 'numpy.max', (['time'], {}), '(time)\n', (4328, 4334), False, 'import numpy\n'), ((5631, 5696), 'numpy.sqrt', 'numpy.sqrt', (['(self.dtt1 ** 2 - 4.0 * (self.zero - time) * self.dtt2)... |
import numpy as np
import os.path
import cv2
from openface.align import AlignDlib
from openface.openface_model import create_model
class IdentityMetadata():
def __init__(self, base, name, file):
# dataset base directory
self.base = base
# identity name
self.name = name
# im... | [
"openface.align.AlignDlib",
"numpy.array",
"numpy.expand_dims",
"openface.openface_model.create_model",
"cv2.imread"
] | [((921, 939), 'numpy.array', 'np.array', (['metadata'], {}), '(metadata)\n', (929, 939), True, 'import numpy as np\n'), ((974, 993), 'cv2.imread', 'cv2.imread', (['path', '(1)'], {}), '(path, 1)\n', (984, 993), False, 'import cv2\n'), ((1201, 1215), 'openface.openface_model.create_model', 'create_model', ([], {}), '()\... |
from nose import tools
import numpy as np
from scipy import stats
from . import models
from .. import basis_functions
from .. import solvers
def analytic_solution(t, k0, alpha, delta, g, n, s, **params):
"""Analytic solution for model with Cobb-Douglas production."""
lmbda = (g + n + delta) * (1 - alpha)
... | [
"numpy.mean",
"scipy.stats.beta.rvs",
"scipy.stats.lognorm.rvs",
"scipy.stats.norm.rvs",
"numpy.exp",
"numpy.random.randint",
"numpy.linspace",
"numpy.random.seed",
"scipy.stats.uniform.rvs"
] | [((1697, 1726), 'numpy.random.randint', 'np.random.randint', (['(2147483647)'], {}), '(2147483647)\n', (1714, 1726), True, 'import numpy as np\n'), ((824, 844), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (838, 844), True, 'import numpy as np\n'), ((924, 959), 'scipy.stats.norm.rvs', 'stats.norm.... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import numpy as np
import blosum as bl
from random import randint
def load_pssm(namefile, aa) :
"""
Lecture d'un fichier .aamtx et renvoie matrice PSSM
"""
with open (namefile, 'r') as f :
for line in f :
if line[0] == '>'... | [
"blosum.load_blosum",
"numpy.array",
"numpy.zeros",
"sys.exit",
"random.randint",
"numpy.arange"
] | [((1037, 1060), 'numpy.arange', 'np.arange', (['(0.1)', '(10)', '(0.1)'], {}), '(0.1, 10, 0.1)\n', (1046, 1060), True, 'import numpy as np\n'), ((3235, 3284), 'blosum.load_blosum', 'bl.load_blosum', (['"""bin/salut_1.0/data/BLOSUM62.txt"""'], {}), "('bin/salut_1.0/data/BLOSUM62.txt')\n", (3249, 3284), True, 'import blo... |
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkendpointsections.py,v $
## Language: Python
## Date: $Date: 2021/01/05 $
## Version: $Revision: 1.5 $
## Copyright (c) <NAME>, <NAME>. All rights reserved.
## See LICENCE file for details.
## This software is distributed WITHOUT AN... | [
"vmtk.pypes.pypeMain",
"vtk.vtkMath.Normalize",
"vtk.vtkIntArray",
"vtk.vtkPolyData",
"vtk.vtkCellArray",
"vtk.vtkDoubleArray",
"vtk.vtkPoints",
"numpy.subtract",
"vtk.vtkMath.Distance2BetweenPoints",
"vmtk.pypes.pypeScript.__init__"
] | [((6173, 6189), 'vmtk.pypes.pypeMain', 'pypes.pypeMain', ([], {}), '()\n', (6187, 6189), False, 'from vmtk import pypes\n'), ((941, 972), 'vmtk.pypes.pypeScript.__init__', 'pypes.pypeScript.__init__', (['self'], {}), '(self)\n', (966, 972), False, 'from vmtk import pypes\n'), ((2213, 2230), 'vtk.vtkPolyData', 'vtk.vtkP... |
"""
Base class for tensor-product style meshes
"""
import numpy as np
import scipy.sparse as sp
import properties
from discretize.base.base_mesh import BaseMesh
from discretize.utils import (
is_scalar,
as_array_n_by_dim,
unpack_widths,
mkvc,
ndgrid,
spzeros,
sdiag,
sdinv,
TensorTy... | [
"discretize.utils.sdiag",
"discretize.utils.sdinv",
"numpy.array",
"properties.Array",
"discretize.utils.TensorType",
"discretize.utils.is_scalar",
"scipy.sparse.eye",
"discretize.utils.code_utils.deprecate_method",
"numpy.diff",
"warnings.warn",
"scipy.sparse.csr_matrix",
"discretize.utils.nd... | [((25004, 25070), 'discretize.utils.code_utils.deprecate_property', 'deprecate_property', (['"""nodes_x"""', '"""vectorNx"""'], {'removal_version': '"""1.0.0"""'}), "('nodes_x', 'vectorNx', removal_version='1.0.0')\n", (25022, 25070), False, 'from discretize.utils.code_utils import deprecate_method, deprecate_property\... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ProDy: A Python Package for Protein Dynamics Analysis
#
# Copyright (C) 2010-2012 <NAME>
#
# 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 vers... | [
"prody.writeDCD",
"numpy.testing.assert_equal",
"prody.tests.test_ensemble.ENSEMBLE.getCoordsets",
"prody.tests.test_ensemble.DCD._getCoordsets",
"os.path.join",
"prody.DCDFile",
"prody.tests.test_ensemble.ENSEMBLE._getCoordsets",
"prody.parseDCD"
] | [((1249, 1274), 'os.path.join', 'join', (['TEMPDIR', '"""temp.dcd"""'], {}), "(TEMPDIR, 'temp.dcd')\n", (1253, 1274), False, 'from os.path import join\n'), ((1318, 1346), 'prody.writeDCD', 'writeDCD', (['self.dcd', 'ALLATOMS'], {}), '(self.dcd, ALLATOMS)\n', (1326, 1346), False, 'from prody import DCDFile, writeDCD, pa... |
# MIT License
#
# Copyright (c) 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | [
"matplotlib.pyplot.imshow",
"numpy.ceil",
"os.listdir",
"os.path.join",
"h5py.File",
"numpy.argsort",
"datasets.imagenet.create_readable_names_for_imagenet_labels",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.show"
] | [((807, 859), 'datasets.imagenet.create_readable_names_for_imagenet_labels', 'imagenet.create_readable_names_for_imagenet_labels', ([], {}), '()\n', (857, 859), False, 'from datasets import imagenet\n'), ((2400, 2440), 'numpy.argsort', 'np.argsort', (["feature_dataset['filenames']"], {}), "(feature_dataset['filenames']... |
#!/usr/bin/python
# x_{t+1} = a x_t + v_t
# y_t = x_t + e_t
import numpy as np
class lgss_bs():
r""" Example of the bootstrap formalism for sequential inference in a
simple linear Gaussian Model.
"""
def __init__(self, a, varV, varE, y):
self.dim = 1
self.a = a
self.varV = varV... | [
"numpy.random.standard_normal",
"numpy.zeros",
"numpy.sqrt"
] | [((681, 705), 'numpy.zeros', 'np.zeros', (['xPrev.shape[0]'], {}), '(xPrev.shape[0])\n', (689, 705), True, 'import numpy as np\n'), ((557, 575), 'numpy.sqrt', 'np.sqrt', (['self.varV'], {}), '(self.varV)\n', (564, 575), True, 'import numpy as np\n'), ((576, 619), 'numpy.random.standard_normal', 'np.random.standard_norm... |
import os
import time
from typing import Tuple, List
import numpy as np
from cnocr import CnOcr
from cv2 import cv2
import simplerpa.aircv as ac
# 话说网易游戏家也有个aircv,功能类似, 还提供了find_sift方法,使用sift算法查找,以后可以试试
# https://github.com/NetEaseGame/aircv
from simplerpa.core.data.ScreenRect import ScreenRect, Vector
from simplerpa.... | [
"numpy.fromfile",
"numpy.array",
"cv2.cv2.bitwise_not",
"simplerpa.core.data.ScreenRect.ScreenRect",
"cnocr.CnOcr",
"numpy.arange",
"simplerpa.core.data.ScreenRect.Vector",
"os.path.exists",
"cv2.cv2.connectedComponentsWithStats",
"numpy.where",
"cv2.cv2.merge",
"cv2.cv2.Canny",
"simplerpa.a... | [((420, 427), 'cnocr.CnOcr', 'CnOcr', ([], {}), '()\n', (425, 427), False, 'from cnocr import CnOcr\n'), ((813, 830), 'numpy.array', 'np.array', (['img_tmp'], {}), '(img_tmp)\n', (821, 830), True, 'import numpy as np\n'), ((846, 885), 'cv2.cv2.cvtColor', 'cv2.cvtColor', (['cv_rgb', 'cv2.COLOR_RGB2BGR'], {}), '(cv_rgb, ... |
from .utils import VectorAndNumbers
from .algorithm import Algorithm
from .individual import Individual
from .job import Job
from .problem import Problem
from SALib.sample.saltelli import sample as sobol_sample
from SALib.sample.morris import sample as morris_sample
from SALib.sample.fast_sampler import sample as fast... | [
"SALib.analyze.ff.analyze",
"SALib.sample.ff.sample",
"SALib.analyze.delta.analyze",
"SALib.sample.fast_sampler.sample",
"SALib.analyze.fast.analyze",
"SALib.analyze.sobol.analyze",
"SALib.sample.latin.sample",
"numpy.array",
"SALib.analyze.rbd_fast.analyze",
"SALib.sample.morris.sample",
"SALib... | [((1411, 1422), 'time.time', 'time.time', ([], {}), '()\n', (1420, 1422), False, 'import time\n'), ((3067, 3091), 'numpy.array', 'np.array', (['self.samples_y'], {}), '(self.samples_y)\n', (3075, 3091), True, 'import numpy as np\n'), ((3972, 4092), 'SALib.analyze.rbd_fast.analyze', 'rbd_fast.analyze', (['self.sa_proble... |
import SimpleITK as sitk
import numpy as np
import os
import paths
import csv
import math
from scipy.io import loadmat
from skimage.measure import regionprops, marching_cubes_classic, mesh_surface_area
def divide_hcp(connectivity_matrix, hcp_connectivity):
''' divide the connectivity matrix by the hcp matrix'''
... | [
"numpy.copy",
"numpy.multiply",
"numpy.amax",
"numpy.ones",
"numpy.absolute",
"scipy.io.loadmat",
"os.path.join",
"os.path.isfile",
"numpy.count_nonzero",
"numpy.zeros",
"numpy.sum",
"skimage.measure.marching_cubes_classic",
"skimage.measure.mesh_surface_area",
"numpy.concatenate",
"Simp... | [((403, 438), 'numpy.zeros', 'np.zeros', (['connectivity_matrix.shape'], {}), '(connectivity_matrix.shape)\n', (411, 438), True, 'import numpy as np\n'), ((909, 1010), 'os.path.join', 'os.path.join', (['hcp_connectivity_matrices_path', '"""HCP1021.1mm.fib.gz.aal.count.end.connectivity.mat"""'], {}), "(hcp_connectivity_... |
# -*- coding: utf-8 -*-
from glob import glob
import csv
import os
import random
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from numpy import genfromtxt
matplotlib.use('Agg')
def make_batches(size, batch_size):
"""Returns a list of batch indices (tuples of indices).
Copied from ht... | [
"os.path.exists",
"os.makedirs",
"matplotlib.use",
"csv.writer",
"os.path.join",
"random.seed",
"os.path.split",
"matplotlib.pyplot.close",
"numpy.stack",
"numpy.dot",
"os.path.isfile",
"numpy.squeeze",
"matplotlib.pyplot.tight_layout",
"numpy.savetxt",
"numpy.genfromtxt",
"matplotlib.... | [((182, 203), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (196, 203), False, 'import matplotlib\n'), ((1492, 1533), 'os.path.join', 'os.path.join', (['folder', "(prefix + '_emb.csv')"], {}), "(folder, prefix + '_emb.csv')\n", (1504, 1533), False, 'import os\n'), ((1538, 1628), 'numpy.savetxt',... |
"""
分析签名算法的碰撞程度
1. 每个桶的模板数目:最多、最少、平均、方差
"""
import numpy as np
from logparser.utils.dataset import *
import collections
from logparser.ADC import log_signature, log_split
from logparser.ADC.ADC_New import log_signature, log_split
class BinEntry:
def __init__(self):
self.sig = None
self.templates ... | [
"numpy.mean",
"collections.defaultdict",
"logparser.ADC.ADC_New.log_signature",
"numpy.std",
"logparser.ADC.ADC_New.log_split"
] | [((372, 401), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (395, 401), False, 'import collections\n'), ((766, 799), 'collections.defaultdict', 'collections.defaultdict', (['BinEntry'], {}), '(BinEntry)\n', (789, 799), False, 'import collections\n'), ((909, 931), 'logparser.ADC.ADC_N... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Calculate permutation p-values for enrichment.
:Author: <NAME> <<EMAIL>>
:Date: 2018-09-13
:Copyright: 2018, <NAME>
:License: CC BY-SA
"""
import copy
import glob
import re
import gc
from datetime import datetime
import csv
import pandas as pd
import numpy as np
fr... | [
"copy.deepcopy",
"csv.writer",
"datetime.datetime.now",
"gc.collect",
"pandas.read_table",
"re.sub",
"numpy.random.permutation"
] | [((968, 1012), 're.sub', 're.sub', (['""".txt$"""', '"""_gene.txt"""', 'obs_enrich_loc'], {}), "('.txt$', '_gene.txt', obs_enrich_loc)\n", (974, 1012), False, 'import re\n'), ((2501, 2549), 're.sub', 're.sub', (['""".txt$"""', '"""_rv_outs.txt"""', 'self.enrich_loc'], {}), "('.txt$', '_rv_outs.txt', self.enrich_loc)\n"... |
# -*- coding: utf-8 -*-
import numpy as np
from tensorflow.keras.models import load_model
from konlpy.tag import Okt
model = load_model('./result_model.mod')
okt = Okt()
selected_words = []
with open('selected_words.list', 'r') as file:
selected_words = file.readlines()
for index in range(0, len(selected_words)):... | [
"konlpy.tag.Okt",
"numpy.asarray",
"tensorflow.keras.models.load_model"
] | [((126, 158), 'tensorflow.keras.models.load_model', 'load_model', (['"""./result_model.mod"""'], {}), "('./result_model.mod')\n", (136, 158), False, 'from tensorflow.keras.models import load_model\n'), ((165, 170), 'konlpy.tag.Okt', 'Okt', ([], {}), '()\n', (168, 170), False, 'from konlpy.tag import Okt\n'), ((669, 683... |
"""
We provide an implementation and pretrained weights for Pooling-based Vision
Transformers (PiT).
Paper: Rethinking Spatial Dimensions of Vision Transformers.
`[arXiv:2103.16302] <https://arxiv.org/abs/2103.16302>`_.
Original pytorch code and weights from
`NAVER AI <https://github.com/naver-ai/pit>`_.
This code h... | [
"collections.OrderedDict",
"tfimm.architectures.vit.ViTBlock",
"tensorflow.shape",
"tensorflow.keras.layers.Conv2D",
"tfimm.layers.norm_layer_factory",
"tensorflow.transpose",
"tfimm.layers.interpolate_pos_embeddings_grid",
"tensorflow.keras.layers.Dropout",
"tensorflow.stack",
"tensorflow.concat"... | [((5715, 5765), 'tensorflow.keras.layers.ZeroPadding2D', 'tf.keras.layers.ZeroPadding2D', ([], {'padding': '(stride // 2)'}), '(padding=stride // 2)\n', (5744, 5765), True, 'import tensorflow as tf\n'), ((5786, 5907), 'tensorflow.keras.layers.Conv2D', 'tf.keras.layers.Conv2D', ([], {'filters': 'out_channels', 'kernel_s... |
"""
Various methods to manipulate images
"""
from __future__ import print_function
from builtins import object
import numpy as np
class IntensityNormalizeImage(object):
def __init__(self):
"""
Constructor
"""
self.default_normalization_mode = 'percentile_normalization'
"""D... | [
"numpy.clip",
"numpy.percentile",
"numpy.max"
] | [((470, 496), 'numpy.clip', 'np.clip', (['I', '(0)', 'None'], {'out': 'I'}), '(I, 0, None, out=I)\n', (477, 496), True, 'import numpy as np\n'), ((908, 934), 'numpy.clip', 'np.clip', (['I', '(0)', 'None'], {'out': 'I'}), '(I, 0, None, out=I)\n', (915, 934), True, 'import numpy as np\n'), ((996, 1018), 'numpy.percentile... |
# -*- coding: utf-8 -*-
import numpy
import time
import os
import magdynlab.instruments
import magdynlab.controllers
import magdynlab.data_types
import threading_decorators as ThD
import matplotlib.pyplot as plt
def Plot_IxV(Data):
f = plt.figure('IxV Semi', (5, 4))
if not(f.axes):
plt... | [
"numpy.polyfit",
"numpy.max",
"matplotlib.pyplot.figure",
"numpy.nanmax",
"numpy.min",
"numpy.nanmin",
"matplotlib.pyplot.subplot",
"os.path.expanduser"
] | [((254, 284), 'matplotlib.pyplot.figure', 'plt.figure', (['"""IxV Semi"""', '(5, 4)'], {}), "('IxV Semi', (5, 4))\n", (264, 284), True, 'import matplotlib.pyplot as plt\n'), ((385, 408), 'numpy.nanmax', 'numpy.nanmax', (["Data['V']"], {}), "(Data['V'])\n", (397, 408), False, 'import numpy\n'), ((421, 444), 'numpy.nanmi... |
# -*- coding: utf-8 -*-
from functools import reduce
from itertools import zip_longest
from math import ceil
from math import floor
from math import log
from scipy import ndimage
import numpy as np
def morton_array(shape):
"""
Return array with Morton numbers.
Inspired by:
https://graphics.stanford... | [
"scipy.ndimage.minimum",
"numpy.unique",
"functools.reduce",
"numpy.sort",
"itertools.zip_longest",
"numpy.asarray",
"math.log",
"numpy.uint64",
"numpy.empty",
"numpy.isinf",
"numpy.zeros_like",
"numpy.arange"
] | [((1902, 1932), 'functools.reduce', 'reduce', (['np.bitwise_or', 'indices'], {}), '(np.bitwise_or, indices)\n', (1908, 1932), False, 'from functools import reduce\n'), ((2580, 2608), 'numpy.arange', 'np.arange', (['(no_data_value + 1)'], {}), '(no_data_value + 1)\n', (2589, 2608), True, 'import numpy as np\n'), ((2620,... |
import tensorflow as tf
from PIL import Image, ImageFilter
import matplotlib.pyplot as plt
import os
import numpy as np
import cv2
class numberGuesser:
checkpointpath = "training.ckpt"
def buildModel(self):
(train_x,train_y), (test_x, test_y) = tf.keras.datasets.mnist.load_data()
... | [
"PIL.Image.open",
"tensorflow.keras.datasets.mnist.load_data",
"tensorflow.keras.layers.Dropout",
"numpy.asarray",
"numpy.argmax",
"os.path.dirname",
"tensorflow.keras.layers.Dense",
"cv2.cvtColor",
"tensorflow.keras.callbacks.ModelCheckpoint",
"tensorflow.keras.layers.Flatten",
"cv2.imread"
] | [((273, 308), 'tensorflow.keras.datasets.mnist.load_data', 'tf.keras.datasets.mnist.load_data', ([], {}), '()\n', (306, 308), True, 'import tensorflow as tf\n'), ((1449, 1473), 'PIL.Image.open', 'Image.open', (['"""number.png"""'], {}), "('number.png')\n", (1459, 1473), False, 'from PIL import Image, ImageFilter\n'), (... |
from typing import List
import gluonnlp as nlp
import numpy as np
from gluonnlp.data import BERTSentenceTransform
__all__ = ['TextDataTransform', 'BERTDataTransform']
class TextDataTransform(object):
"""
Python class for performing data pre-processing on the text dataset.
This class is constructed using... | [
"gluonnlp.data.BERTSentenceTransform",
"numpy.array",
"gluonnlp.data.SpacyTokenizer"
] | [((370, 399), 'gluonnlp.data.SpacyTokenizer', 'nlp.data.SpacyTokenizer', (['"""en"""'], {}), "('en')\n", (393, 399), True, 'import gluonnlp as nlp\n'), ((4459, 4527), 'gluonnlp.data.BERTSentenceTransform', 'BERTSentenceTransform', (['tokenizer', 'max_seq_length'], {'pad': 'pad', 'pair': 'pair'}), '(tokenizer, max_seq_l... |
# -*- coding:utf-8 -*-
"""
词向量测试 6M
词向量:
- 规模: 6115353 x 64D
- 来源: [自然语言处理中句子相似度计算的几种方法](https://cuiqingcai.com/6101.html)提供的[news_12g_baidubaike_20g_novel_90g_embedding_64.bin](https://pan.baidu.com/s/1TZ8GII0CEX32ydjsfMc0zw)
使用(下面代码可能有错误, 请自行修改):
```
# 编辑Dockerfile
echo 'FROM frkhit/benchmark-word2vec:latest
COPY ... | [
"os.path.exists",
"pickle.dump",
"pyxtools.faiss_tools.faiss.index_factory",
"numpy.linalg.norm",
"gensim.models.KeyedVectors.load_word2vec_format",
"numpy.zeros",
"pyxtools.faiss_tools.faiss.write_index",
"pyxtools.global_init_logger",
"time.time"
] | [((4099, 4119), 'pyxtools.global_init_logger', 'global_init_logger', ([], {}), '()\n', (4117, 4119), False, 'from pyxtools import global_init_logger\n'), ((1293, 1383), 'gensim.models.KeyedVectors.load_word2vec_format', 'gensim.models.KeyedVectors.load_word2vec_format', (['self.word_vec_model_file'], {'binary': '(True)... |
from openvino.inference_engine import IENetwork, IEPlugin
from argparse import ArgumentParser
from PIL import Image, ImageDraw
import logging as log
import numpy as np
import time
import cv2
import sys
import os
def build_argparser():
parser = ArgumentParser()
parser.add_argument("-m", "--model", help="Path to an .x... | [
"cv2.rectangle",
"numpy.array",
"PIL.ImageDraw.Draw",
"logging.info",
"os.walk",
"argparse.ArgumentParser",
"numpy.asarray",
"openvino.inference_engine.IENetwork.from_ir",
"openvino.inference_engine.IEPlugin",
"os.path.splitext",
"numpy.squeeze",
"cv2.cvtColor",
"cv2.resize",
"time.time",
... | [((246, 262), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (260, 262), False, 'from argparse import ArgumentParser\n'), ((1612, 1633), 'cv2.imread', 'cv2.imread', (['imagePath'], {}), '(imagePath)\n', (1622, 1633), False, 'import cv2\n'), ((1650, 1675), 'cv2.resize', 'cv2.resize', (['image', '(w, h)']... |
import numpy as np
gauss_len = 100
gaussian_amp = 0.2
def gauss(amplitude, mu, sigma, delf, length):
t = np.linspace(-length / 2, length / 2, length)
gauss_wave = amplitude * np.exp(-((t - mu) ** 2) / (2 * sigma ** 2))
# Detuning correction Eqn. (4) in Chen et al. PRL, 116, 020501 (2016)
ga... | [
"numpy.sin",
"numpy.linspace",
"numpy.exp",
"numpy.cos"
] | [((119, 163), 'numpy.linspace', 'np.linspace', (['(-length / 2)', '(length / 2)', 'length'], {}), '(-length / 2, length / 2, length)\n', (130, 163), True, 'import numpy as np\n'), ((481, 525), 'numpy.linspace', 'np.linspace', (['(-length / 2)', '(length / 2)', 'length'], {}), '(-length / 2, length / 2, length)\n', (492... |
import numpy
import pandas
import scipy
import sklearn.metrics as metrics
from sklearn.model_selection import train_test_split
import statsmodels.api as stats
# The SWEEP Operator
def SWEEPOperator (pDim, inputM, tol):
# pDim: dimension of matrix inputM, positive integer
# inputM: a square and sy... | [
"numpy.diagonal",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"statsmodels.api.MNLogit",
"sklearn.metrics.roc_auc_score",
"pandas.get_dummies",
"numpy.array",
"scipy.stats.chi2.sf",
"statsmodels.api.add_constant",
"pandas.DataFrame",
"numpy.transpose"
] | [((2177, 2407), 'pandas.read_csv', 'pandas.read_csv', (['"""C:\\\\Users\\\\minlam\\\\Documents\\\\IIT\\\\Machine Learning\\\\Data\\\\policy_2001.csv"""'], {'delimiter': '""","""', 'usecols': "['CLAIM_FLAG', 'CREDIT_SCORE_BAND', 'BLUEBOOK_1000', 'CUST_LOYALTY',\n 'MVR_PTS', 'TIF', 'TRAVTIME']"}), "(\n 'C:\\\\Users... |
#
# @Author: kuroitu (2020)
# @email: <EMAIL>
#
import numpy as np
from ..dual import *
##########
# 指数関数 exponential functions
#######
def power(obj, n):
obj = to_dual(obj)
return obj ** n
def square(obj):
obj = to_dual(obj)
return obj ** 2
def sqrt(obj):
obj = to_dual(obj)
return obj... | [
"numpy.exp",
"numpy.log",
"numpy.expm1",
"numpy.exp2"
] | [((449, 463), 'numpy.exp', 'np.exp', (['obj.re'], {}), '(obj.re)\n', (455, 463), True, 'import numpy as np\n'), ((546, 561), 'numpy.exp2', 'np.exp2', (['obj.re'], {}), '(obj.re)\n', (553, 561), True, 'import numpy as np\n'), ((654, 670), 'numpy.expm1', 'np.expm1', (['obj.re'], {}), '(obj.re)\n', (662, 670), True, 'impo... |
import cv2
from PIL import Image
from matplotlib import pyplot as plt
#******************************************#
from sklearn.metrics import precision_score,recall_score,f1_score
from sklearn.metrics import accuracy_score,jaccard_score
#******************************************************************#
import os
imp... | [
"torch.hub.load",
"sklearn.metrics.f1_score",
"torch.nn.CrossEntropyLoss",
"torch.load",
"matplotlib.pyplot.plot",
"MyDataset.MyDataset",
"sklearn.metrics.precision_score",
"os.path.isfile",
"matplotlib.pyplot.close",
"numpy.array",
"sklearn.metrics.recall_score",
"sklearn.metrics.jaccard_scor... | [((1738, 1841), 'torch.hub.load', 'torch.hub.load', (['"""pytorch/vision:v0.6.0"""', '"""fcn_resnet101"""'], {'pretrained': '(False)', 'num_classes': 'num_classes'}), "('pytorch/vision:v0.6.0', 'fcn_resnet101', pretrained=False,\n num_classes=num_classes)\n", (1752, 1841), False, 'import torch\n'), ((2136, 2157), 't... |
import cv2
import torch
from model.model import MobileHairNet
from config.config import get_config
import os
import numpy as np
from glob import glob
def get_mask(image, net, size = 224):
image_h, image_w = image.shape[0], image.shape[1]
down_size_image = cv2.resize(image, (size, size))
b, g, r = cv2.spl... | [
"model.model.MobileHairNet",
"cv2.imshow",
"torch.from_numpy",
"torch.cuda.is_available",
"cv2.destroyAllWindows",
"torch.squeeze",
"numpy.where",
"cv2.waitKey",
"cv2.add",
"cv2.merge",
"cv2.split",
"cv2.resize",
"numpy.transpose",
"config.config.get_config",
"torch.load",
"cv2.bitwise... | [((267, 298), 'cv2.resize', 'cv2.resize', (['image', '(size, size)'], {}), '(image, (size, size))\n', (277, 298), False, 'import cv2\n'), ((313, 339), 'cv2.split', 'cv2.split', (['down_size_image'], {}), '(down_size_image)\n', (322, 339), False, 'import cv2\n'), ((362, 382), 'cv2.merge', 'cv2.merge', (['[r, g, b]'], {}... |
import os
import gc
import utils
import pandas as pd
import numpy as np
import pickle as pkl
from datetime import date
from keras.layers.normalization import BatchNormalization
from keras.models import Sequential, Model
from keras.layers import Input, Embedding, Dense, Flatten, Concatenate, Dot, Reshape, Add, Subtrac... | [
"utils.start",
"keras.layers.Subtract",
"keras.layers.Dot",
"numpy.random.seed",
"keras.callbacks.EarlyStopping",
"keras.models.Model",
"keras.layers.Add",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"keras.layers.normalization.BatchNormalization",
"keras.layers.Concatenate",
"pandas.merg... | [((464, 485), 'utils.start', 'utils.start', (['__file__'], {}), '(__file__)\n', (475, 485), False, 'import utils\n'), ((608, 628), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (622, 628), True, 'import numpy as np\n'), ((4248, 4292), 'pandas.concat', 'pd.concat', (['[train, test]'], {'axis': '(0)'... |
"""This where implementations of individual operations live"""
from ..coreOperation import *
from ..coreNode import broadcast_shape, reduce_shape
import numpy as np
class FlattenFeaturesOperation(SingleInputOperation):
"""Flatten the axis greater than 0 to turn
dim > 2 tensors into 2d arrays
Attributes
... | [
"numpy.zeros",
"numpy.ones"
] | [((5385, 5412), 'numpy.zeros', 'np.zeros', (['self.inputA.shape'], {}), '(self.inputA.shape)\n', (5393, 5412), True, 'import numpy as np\n'), ((1890, 1916), 'numpy.ones', 'np.ones', (['self.inputA.shape'], {}), '(self.inputA.shape)\n', (1897, 1916), True, 'import numpy as np\n'), ((1950, 1977), 'numpy.zeros', 'np.zeros... |
#functions to help with running fiberassign, using SV3 parameters/targets
import fitsio
import numpy as np
from astropy.table import Table,join
# system
import os
import subprocess
import sys
import tempfile
import shutil
import re
# time
from time import time
from datetime import datetime, timedelta
#import some f... | [
"astropy.table.Table",
"numpy.isin",
"desitarget.mtl.inflate_ledger",
"numpy.arctan2",
"numpy.isfinite",
"sys.exit",
"numpy.sin",
"os.path.exists",
"shutil.move",
"fitsio.read",
"desitarget.io.read_targets_in_tiles",
"numpy.flatnonzero",
"fitsio.FITS",
"fitsio.read_header",
"numpy.rad2de... | [((1821, 1940), 'fitsio.read', 'fitsio.read', (["('/global/cfs/cdirs/desi/target/fiberassign/tiles/trunk/' + ts[:3] +\n '/fiberassign-' + ts + '.fits.gz')"], {}), "('/global/cfs/cdirs/desi/target/fiberassign/tiles/trunk/' + ts[:\n 3] + '/fiberassign-' + ts + '.fits.gz')\n", (1832, 1940), False, 'import fitsio\n')... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torchvision.models.resnet import Bottleneck
import numpy as np
class ResNet(torchvision.models.resnet.ResNet):
def __init__(self, block, layers, num_classes=1000):
super(ResNet, self).__init__(block, layers, num_cla... | [
"torch.nn.functional.adaptive_avg_pool2d",
"torch.load",
"torch.nn.MaxPool2d",
"numpy.concatenate",
"torchvision.transforms.Normalize"
] | [((349, 413), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', ([], {'kernel_size': '(3)', 'stride': '(2)', 'padding': '(0)', 'ceil_mode': '(True)'}), '(kernel_size=3, stride=2, padding=0, ceil_mode=True)\n', (361, 413), True, 'import torch.nn as nn\n'), ((753, 808), 'torch.load', 'torch.load', (['resnet101_file'], {'map_location... |
from astropy.io import fits
import pandas as pd
import numpy as np
from lightkurve import KeplerLightCurve
def find_flares(flux, error, N1=4, N2=4, N3=3):
'''
The algorithm for local changes due to flares defined by
<NAME> et al. (2015), Eqn. 3a-d
http://arxiv.org/abs/1510.01005
Note: these equati... | [
"numpy.abs",
"numpy.ones_like",
"numpy.nanstd",
"numpy.nanmedian",
"numpy.where",
"numpy.diff",
"numpy.append",
"numpy.array",
"numpy.zeros_like"
] | [((1288, 1306), 'numpy.nanmedian', 'np.nanmedian', (['flux'], {}), '(flux)\n', (1300, 1306), True, 'import numpy as np\n'), ((1319, 1334), 'numpy.nanstd', 'np.nanstd', (['flux'], {}), '(flux)\n', (1328, 1334), True, 'import numpy as np\n'), ((1541, 1583), 'numpy.where', 'np.where', (['((T0 > 0) & (T1 > N1) & (T2 > N2))... |
import numpy as np
import matplotlib.pyplot as plt
h = np.arange(0, 32.0, 1.0)
to11 = 288.15 - 6.5 * h
to20 = 216.65
to32 = 216.65 + 1.0 * (h - 20.0)
temp = (h < 11) * to11 + (h >= 11) * to20 + (h >= 20) * (to32 - to20)
plt.plot(h, temp)
plt.show() | [
"matplotlib.pyplot.plot",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((56, 79), 'numpy.arange', 'np.arange', (['(0)', '(32.0)', '(1.0)'], {}), '(0, 32.0, 1.0)\n', (65, 79), True, 'import numpy as np\n'), ((224, 241), 'matplotlib.pyplot.plot', 'plt.plot', (['h', 'temp'], {}), '(h, temp)\n', (232, 241), True, 'import matplotlib.pyplot as plt\n'), ((242, 252), 'matplotlib.pyplot.show', 'p... |
'''
Function:
复现论文"Combining Sketch and Tone for Pencil Drawing Production"
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import os
import cv2
import math
import numpy as np
from PIL import Image
from scipy import signal
from ..base import BaseBeautifier
from scipy.ndimage import interpolation
from scipy.sparse.li... | [
"math.sqrt",
"numpy.column_stack",
"numpy.row_stack",
"numpy.rot90",
"scipy.ndimage.interpolation.zoom",
"math.exp",
"os.path.exists",
"cv2.calcHist",
"numpy.reshape",
"math.tan",
"numpy.dot",
"scipy.sparse.csr_matrix",
"scipy.sparse.linalg.spsolve",
"scipy.signal.convolve2d",
"numpy.abs... | [((5062, 5101), 'numpy.zeros', 'np.zeros', (['(kernel_size, kernel_size, 8)'], {}), '((kernel_size, kernel_size, 8))\n', (5070, 5101), True, 'import numpy as np\n'), ((5655, 5674), 'numpy.zeros', 'np.zeros', (['(h, w, 8)'], {}), '((h, w, 8))\n', (5663, 5674), True, 'import numpy as np\n'), ((5926, 5954), 'numpy.zeros_l... |
from typing import Callable, Sequence, Optional, Tuple
import math
import attr
import cv2 as cv
import numpy as np
import numpy.typing as npt
from vkit.label.type import VPoint, VPointList
from .grid_rendering.type import VImageGrid
from .grid_rendering.grid_creator import create_src_image_grid
from .grid_rendering.i... | [
"numpy.clip",
"numpy.sqrt",
"vkit.label.type.VPoint",
"numpy.ones",
"math.cos",
"numpy.asarray",
"attr.evolve",
"numpy.array",
"cv2.Rodrigues",
"numpy.zeros",
"numpy.matmul",
"numpy.polyval",
"vkit.label.type.VPointList.from_np_array",
"numpy.cos",
"numpy.sin",
"vkit.label.type.VPointL... | [((15135, 15160), 'vkit.opt.get_data_folder', 'get_data_folder', (['__file__'], {}), '(__file__)\n', (15150, 15160), False, 'from vkit.opt import get_data_folder\n'), ((16429, 16454), 'vkit.opt.get_data_folder', 'get_data_folder', (['__file__'], {}), '(__file__)\n', (16444, 16454), False, 'from vkit.opt import get_data... |
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
# Find zero standard deviation
def find_zerostd(pos, num_minority):
for i in tqdm(range(100), desc="Searching zero std", leave=False):
std = pos.std()
mean = pos.mean()
zero_list = []
zero_mean = []
for... | [
"numpy.random.normal",
"os.makedirs",
"numpy.random.multivariate_normal",
"numpy.random.seed",
"pandas.DataFrame",
"pandas.concat"
] | [((3809, 3852), 'pandas.concat', 'pd.concat', (['[pos, zero_std, no_corr]'], {'axis': '(1)'}), '([pos, zero_std, no_corr], axis=1)\n', (3818, 3852), True, 'import pandas as pd\n'), ((3879, 3919), 'os.makedirs', 'os.makedirs', (['"""./pos_data"""'], {'exist_ok': '(True)'}), "('./pos_data', exist_ok=True)\n", (3890, 3919... |
import os
import numpy as np
import dataprovider3.emio as emio
# Focused annotation
data_dir = 'flyem/ground_truth/focused_annotation'
data_info = {
'vol001':{
'img': 'img.h5',
'msk': 'msk.h5',
'seg': 'seg.h5',
'glia': 'glia.h5',
'seg_d3_b0': 'seg_d3_b0.h5',
'dir':... | [
"os.path.join",
"numpy.isin",
"dataprovider3.emio.imread",
"numpy.zeros_like",
"os.path.expanduser"
] | [((2934, 2962), 'os.path.expanduser', 'os.path.expanduser', (['base_dir'], {}), '(base_dir)\n', (2952, 2962), False, 'import os\n'), ((2975, 3003), 'os.path.join', 'os.path.join', (['base', 'data_dir'], {}), '(base, data_dir)\n', (2987, 3003), False, 'import os\n'), ((3330, 3375), 'os.path.join', 'os.path.join', (['dpa... |
#
# KTH Royal Institute of Technology
# DD2424: Deep Learning in Data Science
# Assignment 3
#
# <NAME> (<EMAIL>)
#
import numpy as np
import pickle
from timeit import default_timer as timer
class Net:
# ==================== Initialization ====================
def __init__(self, network_sizes, descent_param... | [
"numpy.mean",
"pickle.dump",
"timeit.default_timer",
"numpy.log",
"pickle.load",
"numpy.argmax",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"numpy.isfinite",
"numpy.maximum",
"numpy.random.randn",
"numpy.var"
] | [((5369, 5378), 'numpy.exp', 'np.exp', (['s'], {}), '(s)\n', (5375, 5378), True, 'import numpy as np\n'), ((5397, 5421), 'numpy.sum', 'np.sum', (['exp_s'], {'axis': 'axis'}), '(exp_s, axis=axis)\n', (5403, 5421), True, 'import numpy as np\n'), ((6097, 6117), 'numpy.argmax', 'np.argmax', (['P'], {'axis': '(0)'}), '(P, a... |
import numpy as np
import pytest
import pygeos
from pygeos import Geometry, GEOSException
from pygeos.testing import assert_geometries_equal
from .common import (
all_types,
empty,
empty_line_string,
empty_point,
empty_polygon,
line_string,
multi_point,
point,
point_z,
)
CONSTRUCT... | [
"pygeos.equals",
"pygeos.reverse",
"pygeos.polygonize_full",
"pygeos.offset_curve",
"numpy.array",
"pygeos.testing.assert_geometries_equal",
"pygeos.Geometry",
"pygeos.build_area",
"pytest.mark.skipif",
"pygeos.clip_by_rect",
"pygeos.is_empty",
"pygeos.segmentize",
"pygeos.normalize",
"pyt... | [((668, 714), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""geometry"""', 'all_types'], {}), "('geometry', all_types)\n", (691, 714), False, 'import pytest\n'), ((716, 769), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func"""', 'CONSTRUCTIVE_NO_ARGS'], {}), "('func', CONSTRUCTIVE_NO_ARGS)\... |
import numpy as np
import copy
def calcbadness(xvals, validcolumns, stimix, results, sessionindicator):
"""
badness = calcbadness(xvals,validcolumns,stimix,results,sessionindicator)
Arguments:
__________
<xvals>:
is a list vector of vectors of run indices
<validcolumns>:
is a list... | [
"numpy.mean",
"copy.deepcopy",
"numpy.flatnonzero",
"numpy.asarray",
"numpy.max",
"numpy.array",
"numpy.errstate",
"numpy.sum",
"numpy.setdiff1d",
"numpy.std"
] | [((1706, 1730), 'numpy.max', 'np.max', (['sessionindicator'], {}), '(sessionindicator)\n', (1712, 1730), True, 'import numpy as np\n'), ((2033, 2070), 'numpy.mean', 'np.mean', (['results[0][:, whcol]'], {'axis': '(1)'}), '(results[0][:, whcol], axis=1)\n', (2040, 2070), True, 'import numpy as np\n'), ((2125, 2161), 'nu... |
import numpy as np
import cv2
from matplotlib import pyplot as plt
from PIL import Image
net = cv2.dnn.readNet("yolov3.weights", "cfg/yolov3.cfg")
classes = []
with open("data/coco.names", "r") as f:
classes = [line.strip() for line in f.readlines()]
layer_names = net.getLayerNames()
output_layers = [lay... | [
"cv2.rectangle",
"cv2.dnn.blobFromImage",
"numpy.argmax",
"cv2.imshow",
"cv2.putText",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"cv2.dnn.NMSBoxes",
"cv2.imread",
"cv2.dnn.readNet"
] | [((101, 152), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""yolov3.weights"""', '"""cfg/yolov3.cfg"""'], {}), "('yolov3.weights', 'cfg/yolov3.cfg')\n", (116, 152), False, 'import cv2\n'), ((459, 519), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_default.xml"""'], {}), "('haarcascade_fro... |
from pathlib import Path
import argparse
import json
import glob
import sys
from matplotlib import pyplot as plt
import numpy as np
def roc_graphs(fprs, tprs, names, aucs, savename, minx=0.85):
colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
plt.figure() # figsize=(10, 10)
ax = plt.axes(xscale='log', xli... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"numpy.array",
"sys.exit",
"argparse.ArgumentParser",
"pathlib.Path",
"matplotlib.pyplot.xlabel",
"numpy.max",
"numpy.min",
"numpy.argmin",
"matplotlib.pyplot.savefig",
"numpy.flipud",
"numpy.argmax",
"matplotlib.pyplot.axes",
"matplo... | [((251, 263), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (261, 263), True, 'from matplotlib import pyplot as plt\n'), ((294, 359), 'matplotlib.pyplot.axes', 'plt.axes', ([], {'xscale': '"""log"""', 'xlim': '[0.0001, 1.0]', 'ylim': '[minx - 0.05, 1]'}), "(xscale='log', xlim=[0.0001, 1.0], ylim=[minx - 0... |
import types
import math
import numpy as np
import cvxpy as cp
import scipy.sparse as sp
from gurobipy import GRB, Model, LinExpr, abs_, max_
from copy import copy
from evanqp import Polytope
from evanqp.problems import CvxpyProblem, MPCProblem
from evanqp.layers import BoundArithmetic, InputLayer, QPLayer, SeqLayer
... | [
"scipy.sparse.find",
"gurobipy.max_",
"gurobipy.abs_",
"math.floor",
"evanqp.layers.QPLayer",
"evanqp.layers.SeqLayer.from_pytorch",
"evanqp.layers.InputLayer",
"numpy.random.randint",
"gurobipy.LinExpr",
"gurobipy.Model",
"copy.copy",
"types.MethodType"
] | [((415, 440), 'evanqp.layers.InputLayer', 'InputLayer', (['parameter_set'], {}), '(parameter_set)\n', (425, 440), False, 'from evanqp.layers import BoundArithmetic, InputLayer, QPLayer, SeqLayer\n'), ((2560, 2567), 'gurobipy.Model', 'Model', ([], {}), '()\n', (2565, 2567), False, 'from gurobipy import GRB, Model, LinEx... |
import argparse
import base64
import json
import os
import os.path as osp
import imgviz
import PIL.Image
from labelme.logger import logger
from labelme import utils
import cv2
import numpy as np
def json2mask( json_file, jsonDir, imgDir,maskDir ):
'''Convert the json files to mask images
Paramete... | [
"labelme.utils.img_b64_to_arr",
"os.listdir",
"labelme.utils.shapes_to_label",
"imgviz.asgray",
"base64.b64encode",
"os.path.join",
"os.path.dirname",
"numpy.zeros",
"cv2.imread"
] | [((973, 1004), 'labelme.utils.img_b64_to_arr', 'utils.img_b64_to_arr', (['imageData'], {}), '(imageData)\n', (993, 1004), False, 'from labelme import utils\n'), ((1405, 1474), 'labelme.utils.shapes_to_label', 'utils.shapes_to_label', (['img.shape', "data['shapes']", 'label_name_to_value'], {}), "(img.shape, data['shape... |
#!/usr/bin/env python
"""
:Abstract: Given an abundance table, calculate pairwise Spearman's Rho of the columns.
:Date: 02/15/2017
:Author: <NAME>
"""
import sys
import argparse
from traceback import format_exc
from time import localtime, strftime
from itertools import combinations
from phylotoast.util import parse_ma... | [
"phylotoast.util.gather_categories.keys",
"biom.load_table",
"traceback.format_exc",
"argparse.ArgumentParser",
"scipy.stats.rankdata",
"phylotoast.biom_calc.arcsine_sqrt_transform",
"statsmodels.sandbox.stats.multicomp.fdrcorrection0",
"numpy.array",
"phylotoast.biom_calc.relative_abundance",
"ph... | [((1115, 1125), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1123, 1125), False, 'import sys\n'), ((3501, 3647), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Given an abundance table, calculate and return FDR corrected significant pairwise Spearman\'s Rho."""'}), '(description=\n "Giv... |
import pickle
import os
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
import multiprocessing
# from sklearn.utils.random import sample_without_replacement
# from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegressor
# from sklearn.ensemble import GradientBoostingClassifi... | [
"pyESN.ESN",
"numpy.log10",
"pandas.read_csv",
"time.sleep",
"numpy.array",
"datetime.datetime.today",
"sklearn.linear_model.SGDClassifier",
"os.listdir",
"sklearn.ensemble.HistGradientBoostingClassifier",
"sklearn.decomposition.PCA",
"matplotlib.pyplot.plot",
"os.path.isdir",
"numpy.vstack"... | [((1552, 1601), 'numpy.random.choice', 'np.random.choice', (['all_tickers', '(500)'], {'replace': '(False)'}), '(all_tickers, 500, replace=False)\n', (1568, 1601), True, 'import numpy as np\n'), ((2561, 2575), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2573, 2575), True, 'import pandas as pd\n'), ((2636, 26... |
from utils.misc import isnotebook
if isnotebook():
from tqdm import tqdm_notebook as tqdm
else:
from tqdm import tqdm
import numpy as np
import torch
from torch_geometric.data import Data
from torch_geometric.utils import remove_self_loops
from utils.load_dataset import load_data, load_zinc_data, load_ogb_data,... | [
"utils.load_dataset.load_ogb_data",
"torch.unique",
"utils.load_dataset.load_data",
"os.path.join",
"utils.utils_subgraphs.compute_degrees",
"utils.misc.isnotebook",
"os.path.split",
"numpy.array",
"torch_geometric.utils.remove_self_loops",
"utils.load_dataset.load_zinc_data",
"utils.load_datase... | [((37, 49), 'utils.misc.isnotebook', 'isnotebook', ([], {}), '()\n', (47, 49), False, 'from utils.misc import isnotebook\n'), ((3833, 3839), 'torch_geometric.data.Data', 'Data', ([], {}), '()\n', (3837, 3839), False, 'from torch_geometric.data import Data\n'), ((6063, 6111), 'utils.utils_subgraphs.compute_degrees', 'co... |
"""This module contains unit tests for :mod:`~prody.select`."""
import os
import os.path
import inspect
import numpy as np
from numpy.testing import *
from prody import *
from prody import LOGGER
from prody.tests import unittest
from prody.tests.datafiles import *
from prody.atomic.atommap import DUMMY
try:
rang... | [
"numpy.all",
"inspect.currentframe",
"numpy.array",
"numpy.zeros"
] | [((531, 553), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (551, 553), False, 'import inspect\n'), ((6862, 6890), 'numpy.array', 'np.array', (['[21.2, 35.9, 80.0]'], {}), '([21.2, 35.9, 80.0])\n', (6870, 6890), True, 'import numpy as np\n'), ((9038, 9049), 'numpy.zeros', 'np.zeros', (['(3)'], {}), ... |
import pytest
import numpy as np
from lumicks.pylake.detail.image import reconstruct_image, reconstruct_num_frames, save_tiff, ImageMetadata, line_timestamps_image
def test_metadata_from_json():
json = { 'cereal_class_version': 1,
'fluorescence': True,
'force': False,
'scan ... | [
"lumicks.pylake.detail.image.reconstruct_image",
"tifffile.TiffFile",
"numpy.allclose",
"numpy.isclose",
"numpy.ones",
"lumicks.pylake.detail.image.line_timestamps_image",
"numpy.iinfo",
"lumicks.pylake.detail.image.reconstruct_num_frames",
"ast.literal_eval",
"numpy.array",
"lumicks.pylake.deta... | [((1084, 1116), 'lumicks.pylake.detail.image.ImageMetadata.from_dataset', 'ImageMetadata.from_dataset', (['json'], {}), '(json)\n', (1110, 1116), False, 'from lumicks.pylake.detail.image import reconstruct_image, reconstruct_num_frames, save_tiff, ImageMetadata, line_timestamps_image\n'), ((1165, 1201), 'numpy.isclose'... |
"""
Dynamics-aware Adversarial Attack of 3D Sparse Convolution Network
@Author:
<NAME>,
<NAME>
@Contact:
<EMAIL>,
<EMAIL>
@Time:
2022/1/23 9:32 PM
"""
import os
from datetime import datetime
import numpy as np
np.seterr(divide='ignore',invalid='ignore')
import torch
from torch import n... | [
"utils.IOStream",
"utils.get_point_output",
"models.scannet_model.NewRes16UNet34C_d8_4",
"models.scannet_model.NewRes16UNet34C_d2_1",
"numpy.hstack",
"torch.LongTensor",
"torch.cuda.device_count",
"models.scannet_model.NewRes16UNet34C_d2_2",
"numpy.array",
"numpy.nanmean",
"models.scannet_model.... | [((244, 288), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (253, 288), True, 'import numpy as np\n'), ((617, 636), 'config.scannet.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (634, 636), False, 'from config.scannet impo... |
#!/usr/bin/env python3
import numpy, sys
def ror_str(byte, count):
binb = numpy.base_repr(byte, 2).zfill(32)
while count > 0:
binb = binb[-1] + binb[0:-1]
count -= 1
return (int(binb, 2))
if __name__ == '__main__':
try:
esi = sys.argv[1]
except IndexError:
print(... | [
"sys.exit",
"numpy.base_repr"
] | [((81, 105), 'numpy.base_repr', 'numpy.base_repr', (['byte', '(2)'], {}), '(byte, 2)\n', (96, 105), False, 'import numpy, sys\n'), ((367, 377), 'sys.exit', 'sys.exit', ([], {}), '()\n', (375, 377), False, 'import numpy, sys\n')] |
"""
A script to trial phase correlation for aligning 2D slices, runs through the first 5 patients and saves images for
each body part on each of them. This is not expected to generate results as impressive as the local 3D phase
correlation method, but demonstrates the method can work in 2D
"""
from pathlib import Path... | [
"matplotlib.pyplot.savefig",
"ai_ct_scans.data_loading.data_root_directory",
"pathlib.Path",
"matplotlib.pyplot.close",
"numpy.array",
"ai_ct_scans.phase_correlation.shift_via_phase_correlation_nd",
"ai_ct_scans.phase_correlation_image_processing.generate_overlay_2d",
"ai_ct_scans.data_loading.Patient... | [((512, 521), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (519, 521), True, 'import matplotlib.pyplot as plt\n'), ((990, 1029), 'ai_ct_scans.data_loading.PatientLoader', 'data_loading.PatientLoader', (['patient_dir'], {}), '(patient_dir)\n', (1016, 1029), False, 'from ai_ct_scans import data_loading\n'), ((12... |
import cv2
import numpy as np
from typing import List
from statistics import mean
from .DatabaseHandler import DatabaseHandler
from .algorithms.DepthEstimation import DepthEstimation
from .algorithms.ObjectDetection import ObjectDetection
from .algorithms.PositionReconstruction import PositionReconstruction
CONFIDE... | [
"cv2.rectangle",
"statistics.mean",
"cv2.imshow",
"cv2.putText",
"cv2.circle",
"numpy.zeros",
"cv2.resize",
"cv2.waitKey"
] | [((5487, 5525), 'numpy.zeros', 'np.zeros', (['(height, width, 3)', 'np.uint8'], {}), '((height, width, 3), np.uint8)\n', (5495, 5525), True, 'import numpy as np\n'), ((3873, 3939), 'cv2.resize', 'cv2.resize', (['frame', 'CV2_IMSHOW_RESIZE'], {'interpolation': 'cv2.INTER_AREA'}), '(frame, CV2_IMSHOW_RESIZE, interpolatio... |
from abc import ABC, abstractmethod
from collections import defaultdict
from datetime import datetime
from functools import cached_property
from typing import List, Dict, Union, Optional, Iterable
import numpy as np
import pandas as pd
from gym import Space, spaces
from pandas import Interval
from torch.utils.data imp... | [
"pandas.Series",
"yacht.utils.len_period_range",
"yacht.utils.adjust_period_with_window",
"numpy.stack",
"collections.defaultdict",
"pandas.concat"
] | [((1193, 1364), 'yacht.utils.adjust_period_with_window', 'utils.adjust_period_with_window', ([], {'datetime_point': 'start', 'window_size': 'self.period_adjustment_size', 'action': '"""-"""', 'include_weekends': 'include_weekends', 'frequency': 'frequency'}), "(datetime_point=start, window_size=self.\n period_adjust... |
from datetime import timedelta
from operator import methodcaller
import itertools
import math
import pytest
sa = pytest.importorskip('sqlalchemy')
pytest.importorskip('psycopg2')
import os
import numpy as np
import pandas as pd
import pandas.util.testing as tm
from datashape import dshape
from odo import odo, drop... | [
"odo.discover",
"odo.odo",
"blaze.sin",
"blaze.join",
"pytest.fixture",
"datetime.timedelta",
"numpy.arange",
"pandas.util.testing.assert_frame_equal",
"pandas.date_range",
"pytest.mark.xfail",
"blaze.merge",
"datashape.dshape",
"pandas.DataFrame",
"math.modf",
"odo.drop",
"numpy.rando... | [((115, 148), 'pytest.importorskip', 'pytest.importorskip', (['"""sqlalchemy"""'], {}), "('sqlalchemy')\n", (134, 148), False, 'import pytest\n'), ((149, 180), 'pytest.importorskip', 'pytest.importorskip', (['"""psycopg2"""'], {}), "('psycopg2')\n", (168, 180), False, 'import pytest\n'), ((663, 693), 'pytest.fixture', ... |
#!/usr/bin/env python
import numpy as np
def bezier(t, p0, p1, p2, p3):
return p0 * (1 - t) ** 3 \
+ 3 * p1 * t * (1 - t) ** 2 \
+ 3 * p2 * t ** 2 * (1 - t) \
+ p3 * t ** 3
def angle_deg(a1, a2):
return np.mod(a1 + a2 + 3*180.0, 360) - 180
def angle_rad(a1, a2):
retur... | [
"numpy.array",
"numpy.dot",
"numpy.cos",
"numpy.sin",
"numpy.mod"
] | [((576, 590), 'numpy.dot', 'np.dot', (['R', 'vec'], {}), '(R, vec)\n', (582, 590), True, 'import numpy as np\n'), ((733, 747), 'numpy.dot', 'np.dot', (['R', 'vec'], {}), '(R, vec)\n', (739, 747), True, 'import numpy as np\n'), ((805, 939), 'numpy.array', 'np.array', (['[[-1.4, 1.0, 1.4, 1.4, 1.0, -1.4, -1.4, -1.4], [-0... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.fftpack import fft, fftshift
from scipy import signal
M = 32
N = 128
hN = N//2
hM = M//2
fftbuffer = np.zeros(N)
w = signal.blackman(M)
plt.figure(1, figsize=(9.5, 6))
plt.subplot(3,2,1)
plt.plot(np.arange(-hM, hM), w, 'b', lw=1.5)
plt.axis([-hM, hM-... | [
"scipy.signal.blackman",
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"scipy.fftpack.fftshift",
"numpy.zeros",
"matplotlib.pyplot.figure",
"scipy.fftpack.fft",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplotlib.pyplot... | [((169, 180), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (177, 180), True, 'import numpy as np\n'), ((185, 203), 'scipy.signal.blackman', 'signal.blackman', (['M'], {}), '(M)\n', (200, 203), False, 'from scipy import signal\n'), ((205, 236), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(9.5, 6... |
import argparse
import random
import time
import numpy as np
from keras.models import load_model
CHUNK_SIZE = 256
def generate(model, start_index, amount):
if start_index is None:
start_index = random.randint(0, len(all_txt)-CHUNK_SIZE-1)
fragment = all_txt[start_index : start_index+CHUNK_SIZE]
... | [
"keras.models.load_model",
"argparse.ArgumentParser",
"numpy.argmax",
"numpy.zeros",
"time.time"
] | [((775, 800), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (798, 800), False, 'import argparse\n'), ((1409, 1434), 'keras.models.load_model', 'load_model', (["args['model']"], {}), "(args['model'])\n", (1419, 1434), False, 'from keras.models import load_model\n'), ((1463, 1474), 'time.time', ... |
import itertools
from math import sqrt
from typing import List, Sequence
import torch
import torch.nn.functional as F
# import torch should be first. Unclear issue, mentionned here: https://github.com/pytorch/pytorch/issues/2083
import numpy as np
import os
import csv
import time
import heapq
import fiona # keep this... | [
"torch.mul",
"fiona.crs.to_string",
"utils.utils.get_device_ids",
"utils.verifications.add_background_to_num_class",
"torch.max",
"math.sqrt",
"utils.geoutils.clip_raster_with_gpkg",
"mlflow.set_experiment",
"utils.verifications.assert_crs_match",
"numpy.count_nonzero",
"shapely.geometry.Polygon... | [((1459, 1485), 'utils.utils.get_logger', 'utils.get_logger', (['__name__'], {}), '(__name__)\n', (1475, 1485), False, 'from utils import utils\n'), ((5093, 5108), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5106, 5108), False, 'import torch\n'), ((2740, 2794), 'rasterio.features.shapes', 'features.shapes', ([... |
from config import Config as AnnotatorConfig
import imantics as im
import math
import numpy as np
import torch
import torchvision.transforms as transforms
from agrobot_mrcnn.models import MaskrcnnSweetPepperProtected
import logging
logger = logging.getLogger('gunicorn.error')
CUDA_DEVICE_NUM = AnnotatorConfig.CUDA_... | [
"logging.getLogger",
"imantics.Category",
"torchvision.transforms.ToTensor",
"torch.load",
"torch.cuda.device_count",
"torch.cuda.synchronize",
"torch.no_grad",
"numpy.zeros",
"imantics.Image",
"torch.cuda.is_available",
"torch.squeeze",
"config.Config.TORCH_MASK_RCNN_CLASSES.split",
"numpy.... | [((243, 278), 'logging.getLogger', 'logging.getLogger', (['"""gunicorn.error"""'], {}), "('gunicorn.error')\n", (260, 278), False, 'import logging\n'), ((428, 478), 'config.Config.TORCH_MASK_RCNN_CLASSES.split', 'AnnotatorConfig.TORCH_MASK_RCNN_CLASSES.split', (['""","""'], {}), "(',')\n", (473, 478), True, 'from confi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: benchmark-opencv-resize.py
import cv2
import time
import numpy as np
"""
Some prebuilt opencv is much slower than others.
You should check with this script and make sure it prints < 1s.
On E5-2680v3, archlinux, this script prints:
0.61s for system opencv 3.... | [
"cv2.resize",
"time.time",
"numpy.random.rand"
] | [((693, 704), 'time.time', 'time.time', ([], {}), '()\n', (702, 704), False, 'import time\n'), ((737, 764), 'cv2.resize', 'cv2.resize', (['img', '(384, 384)'], {}), '(img, (384, 384))\n', (747, 764), False, 'import cv2\n'), ((771, 782), 'time.time', 'time.time', ([], {}), '()\n', (780, 782), False, 'import time\n'), ((... |
import numpy as np
from FCS2Corr import correlations
def twoFocusFCS(tau, rhox, rhoy, rhoz, c, D, w0, w1, z0, z1):
"""
Calculate the FCS cross correlation between two PSFs
========== ===============================================================
Input Meaning
tau Lag time [s]
r... | [
"numpy.sqrt",
"FCS2Corr.correlations",
"numpy.size",
"numpy.floor",
"numpy.max",
"numpy.exp",
"numpy.resize",
"numpy.zeros",
"numpy.min",
"numpy.mod",
"numpy.arange"
] | [((1681, 1696), 'numpy.exp', 'np.exp', (['expTerm'], {}), '(expTerm)\n', (1687, 1696), True, 'import numpy as np\n'), ((1905, 1919), 'FCS2Corr.correlations', 'correlations', ([], {}), '()\n', (1917, 1919), False, 'from FCS2Corr import correlations\n'), ((2042, 2056), 'FCS2Corr.correlations', 'correlations', ([], {}), '... |
#stats.py
#catalog creation for heliocats
#https://github.com/cmoestl/heliocats
import numpy as np
import pandas as pd
import scipy
from sunpy.time import parse_time
import copy
import matplotlib.dates as mdates
import matplotlib
import seaborn as sns
import datetime
import urllib
import json
import os
import pdb
impo... | [
"numpy.radians",
"numpy.nanargmax",
"numpy.array",
"numpy.nanmean",
"sunpy.time.parse_time",
"pandas.read_excel",
"numpy.nanmin",
"numpy.arange",
"datetime.datetime",
"numpy.mean",
"numpy.where",
"heliocats.data.cart2sphere",
"numpy.rint",
"numpy.nanmax",
"pandas.DataFrame",
"numpy.deg... | [((670, 690), 'importlib.reload', 'importlib.reload', (['hd'], {}), '(hd)\n', (686, 690), False, 'import importlib\n'), ((1979, 2022), 'astropy.io.votable.parse_single_table', 'parse_single_table', (['"""data/HCME_WP3_V06.vot"""'], {}), "('data/HCME_WP3_V06.vot')\n", (1997, 2022), False, 'from astropy.io.votable import... |
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | [
"torch.cuda.LongTensor",
"megatron.data.indexed_dataset.make_dataset",
"megatron.data.dataset_utils.compile_helper",
"megatron.mpu.get_data_parallel_group",
"megatron.data.dataset_utils.build_training_sample",
"numpy.iinfo",
"megatron.print_rank_0",
"os.path.isfile",
"numpy.save",
"torch.distribut... | [((1803, 1836), 'megatron.print_rank_0', 'print_rank_0', (['""" > dataset split:"""'], {}), "(' > dataset split:')\n", (1815, 1836), False, 'from megatron import print_rank_0\n'), ((6484, 6529), 'megatron.print_rank_0', 'print_rank_0', (['""" > building dataset index ..."""'], {}), "(' > building dataset index ...')\n"... |
# IMPORTING MODULES
#----------------------------------------------------------------------------
# coding: utf-8
from __future__ import print_function, division
import warnings
warnings.filterwarnings("ignore")
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import ... | [
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"torchvision.models.densenet161",
"torch.max",
"torch.from_numpy",
"torch.nn.BatchNorm1d",
"torch.cuda.is_available",
"torch.sum",
"torch.bmm",
"torch.nn.functional.softmax",
"numpy.savez",
"os.listdir",
"torch.nn.init.kaiming_normal_",
"tor... | [((178, 211), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (201, 211), False, 'import warnings\n'), ((5868, 5946), 'torch.utils.data.DataLoader', 'DataLoader', (['train_dataset'], {'shuffle': '(False)', 'batch_size': 'batch_size', 'num_workers': '(0)'}), '(train_dataset,... |
"""Compiled Theano functions, as well as NumPy equivalents of other symbolic functions."""
import sys
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
import theano
import theano.tensor as T
from ucs.constants import EPS, hues, M_SRGB_to_XYZ
from ucs import Conditions, symbolic
_srgb_to_ucs = None
_ucs_t... | [
"numpy.sqrt",
"ucs.Conditions",
"numpy.arctan2",
"theano.tensor.scalars",
"ucs.symbolic.delta_e",
"numpy.atleast_2d",
"theano.function",
"numpy.float64",
"numpy.stack",
"numpy.dot",
"numpy.maximum",
"numpy.squeeze",
"ucs.symbolic.srgb_to_ucs",
"numpy.square",
"numpy.deg2rad",
"numpy.ve... | [((725, 746), 'numpy.vectorize', 'np.vectorize', (['_h_to_H'], {}), '(_h_to_H)\n', (737, 746), True, 'import numpy as np\n'), ((983, 1004), 'numpy.vectorize', 'np.vectorize', (['_H_to_h'], {}), '(_H_to_h)\n', (995, 1004), True, 'import numpy as np\n'), ((1134, 1167), 'numpy.dot', 'np.dot', (['RGB_linear', 'M_SRGB_to_XY... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
class ... | [
"numpy.random.rand",
"hypothesis.strategies.integers",
"numpy.random.randint",
"hypothesis.strategies.booleans",
"caffe2.python.core.CreateOperator",
"unittest.main",
"numpy.arange",
"numpy.random.shuffle"
] | [((3722, 3737), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3735, 3737), False, 'import unittest\n'), ((648, 676), 'numpy.random.randint', 'np.random.randint', (['(5)'], {'size': 'N'}), '(5, size=N)\n', (665, 676), True, 'import numpy as np\n'), ((804, 816), 'numpy.arange', 'np.arange', (['(3)'], {}), '(3)\n',... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
mean = [69, 0]
cov = [[15, 8], [8, 15]]
np.random.seed(5)
x, y = np.random.multivariate_normal(mean, cov, 2000).T
y += 180
plt.scatter(x, y, color='m')
plt.title("Men's Height vs Weight")
plt.xlabel("Height (in)")
plt.ylabel("Weight (lbs)")
plt... | [
"matplotlib.pyplot.ylabel",
"numpy.random.multivariate_normal",
"matplotlib.pyplot.xlabel",
"numpy.random.seed",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((115, 132), 'numpy.random.seed', 'np.random.seed', (['(5)'], {}), '(5)\n', (129, 132), True, 'import numpy as np\n'), ((199, 227), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x', 'y'], {'color': '"""m"""'}), "(x, y, color='m')\n", (210, 227), True, 'import matplotlib.pyplot as plt\n'), ((228, 263), 'matplotlib.pyp... |
import os
import cv2
from tqdm import tqdm
import numpy as np
from semantic_segmentation.data_structure.folder import Folder
from semantic_segmentation.options.config import load_config
from semantic_segmentation.convolutional_neural_network.semantic_segmentation_model import SemanticSegmentationModel
class MaskHan... | [
"os.listdir",
"tqdm.tqdm",
"os.path.join",
"semantic_segmentation.convolutional_neural_network.semantic_segmentation_model.SemanticSegmentationModel",
"numpy.zeros",
"semantic_segmentation.options.config.load_config"
] | [((394, 419), 'semantic_segmentation.options.config.load_config', 'load_config', (['model_folder'], {}), '(model_folder)\n', (405, 419), False, 'from semantic_segmentation.options.config import load_config\n'), ((443, 487), 'semantic_segmentation.convolutional_neural_network.semantic_segmentation_model.SemanticSegmenta... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pandas as pd
from scipy.integrate import odeint,quad
from scipy.stats import kde,beta
import seaborn as sns
from importlib import reload
pi=np.pi
import ucovid
####### Calcul de l'indicateur P de Heesterbek et Roberts
#... | [
"numpy.identity",
"ucovid.genex2per",
"scipy.integrate.odeint",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.log",
"ucovid.lamsaetapp",
"ucovid.genafricanhorseper",
"ucovid.vecetspectralrad",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy... | [((613, 651), 'numpy.arange', 'np.arange', (['(0)', '(T + 1 / nbpts)', '(T / nbpts)'], {}), '(0, T + 1 / nbpts, T / nbpts)\n', (622, 651), True, 'import numpy as np\n'), ((674, 711), 'numpy.zeros', 'np.zeros', ([], {'shape': '(nbpts + 1, dim, dim)'}), '(shape=(nbpts + 1, dim, dim))\n', (682, 711), True, 'import numpy a... |
from __future__ import print_function, division
import gym
import numpy as np
from gym import error, spaces, utils
from gym.utils import seeding
from numpy import array, linspace, deg2rad, zeros
from sympy import symbols
from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame, Point, inertia, RigidBody, Ka... | [
"sympy.physics.mechanics.Point",
"sympy.physics.mechanics.RigidBody",
"numpy.sin",
"gym.utils.seeding.np_random",
"matplotlib.pyplot.plot",
"sympy.physics.mechanics.KanesMethod",
"numpy.linspace",
"sympy.physics.mechanics.inertia",
"pydy.codegen.ode_function_generators.generate_ode_function",
"sci... | [((1309, 1371), 'numpy.linspace', 'np.linspace', (['(0.0)', '(self.dt * self.sim_steps)'], {'num': 'self.sim_steps'}), '(0.0, self.dt * self.sim_steps, num=self.sim_steps)\n', (1320, 1371), True, 'import numpy as np\n'), ((1856, 1890), 'numpy.full', 'np.full', (['self.num_links', 'min_angle'], {}), '(self.num_links, mi... |
#!/usr/bin/env python3
"""
Identify change points throughout the entire TU of each individual sample.
The premise of this approach is to identify significant change points in the
cumulative read sum (CRS) distribution as a function of position. It identifies
the following change point types: DistalTSS, TandemTSS, Dista... | [
"matplotlib.pyplot.ylabel",
"pysam.faidx",
"math.sqrt",
"math.log",
"pybedtools.BedTool",
"scipy.stats.ttest_ind",
"sys.exit",
"numpy.arange",
"os.remove",
"os.path.exists",
"numpy.mean",
"os.listdir",
"collections.deque",
"argparse.ArgumentParser",
"numpy.delete",
"numpy.sort",
"mat... | [((933, 954), 'matplotlib.use', 'matplotlib.use', (['"""pdf"""'], {}), "('pdf')\n", (947, 954), False, 'import matplotlib\n'), ((1852, 1882), 'src.functions.sort_bedfile', 'sort_bedfile', (['bg_plus', 'bg_plus'], {}), '(bg_plus, bg_plus)\n', (1864, 1882), False, 'from src.functions import sort_bedfile, run_command\n'),... |
#!/bin/python3
import numpy as np
import psycopg2
from logger import *
def get_vectors(filename, logger, max_count=10**9, normalization=True):
f = open(filename)
line_splits = f.readline().split()
logger.log(Logger.INFO, str(line_splits))
size = int(line_splits[0])
d = int(line_splits[1])
wor... | [
"numpy.zeros",
"numpy.linalg.norm"
] | [((344, 380), 'numpy.zeros', 'np.zeros', (['(size, d)'], {'dtype': '"""float32"""'}), "((size, d), dtype='float32')\n", (352, 380), True, 'import numpy as np\n'), ((863, 885), 'numpy.linalg.norm', 'np.linalg.norm', (['vector'], {}), '(vector)\n', (877, 885), True, 'import numpy as np\n')] |
# copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applica... | [
"numpy.sort",
"paddle.nn.CrossEntropyLoss",
"paddle.mean",
"numpy.sum",
"paddle.to_tensor",
"paddle.nn.functional.binary_cross_entropy",
"paddle.reshape",
"numpy.concatenate",
"paddle.abs",
"paddle.nn.MSELoss",
"paddle.sum"
] | [((6561, 6580), 'numpy.sort', 'np.sort', (['(-neg_score)'], {}), '(-neg_score)\n', (6568, 6580), True, 'import numpy as np\n'), ((7307, 7340), 'numpy.concatenate', 'np.concatenate', (['selected_masks', '(0)'], {}), '(selected_masks, 0)\n', (7321, 7340), True, 'import numpy as np\n'), ((7362, 7394), 'paddle.to_tensor', ... |
from typing import Callable, Union, Any
from enum import Enum
import numpy as np
from casadi import sum1, if_else, vertcat, lt, SX, MX
from .path_conditions import Bounds
from .penalty import PenaltyFunctionAbstract, PenaltyOption, PenaltyNodeList
from ..interfaces.biorbd_interface import BiorbdInterface
from ..misc.... | [
"casadi.lt",
"numpy.array",
"casadi.sum1",
"casadi.vertcat"
] | [((2529, 2553), 'numpy.array', 'np.array', (['self.min_bound'], {}), '(self.min_bound)\n', (2537, 2553), True, 'import numpy as np\n'), ((2644, 2668), 'numpy.array', 'np.array', (['self.max_bound'], {}), '(self.max_bound)\n', (2652, 2668), True, 'import numpy as np\n'), ((8869, 8885), 'numpy.array', 'np.array', (['[0, ... |
import skimage.draw as skd
import skimage.io as skio
import numpy as np
import h5py
import itertools
import random
from typing import List
from dataclasses import dataclass, field
def default_float(n=1,low=0.0,high=1.0):
if n == 1:
return field(default_factory = lambda: np.random.uniform(low, high) )
e... | [
"numpy.sqrt",
"numpy.array",
"numpy.sin",
"matplotlib.pyplot.imshow",
"numpy.random.random",
"skimage.draw.ellipse",
"numpy.dot",
"matplotlib.pyplot.axis",
"numpy.round",
"random.choice",
"matplotlib.pyplot.savefig",
"skimage.draw.circle_perimeter",
"numpy.cos",
"skimage.draw.polygon",
"... | [((3454, 3490), 'numpy.zeros', 'np.zeros', (['img_size'], {'dtype': 'np.float32'}), '(img_size, dtype=np.float32)\n', (3462, 3490), True, 'import numpy as np\n'), ((3874, 3909), 'numpy.random.randint', 'np.random.randint', (['n_min', '(n_max + 1)'], {}), '(n_min, n_max + 1)\n', (3891, 3909), True, 'import numpy as np\n... |
import os
import sys
import subprocess
import numpy as np
from tqdm import tqdm
import cv2
import torch
import orjson
from torch.utils.data import Dataset
from vaetc.utils.debug import debug_print
from .utils import IMAGE_HEIGHT, IMAGE_WIDTH, ImageDataset, cache_path
class FFHQThumbnails(Dataset):
""" FFHQ-Data... | [
"orjson.loads",
"os.path.join",
"tqdm.tqdm",
"numpy.array",
"torch.tensor",
"cv2.resize",
"cv2.imread",
"vaetc.utils.debug.debug_print"
] | [((1276, 1304), 'vaetc.utils.debug.debug_print', 'debug_print', (['"""Splitting ..."""'], {}), "('Splitting ...')\n", (1287, 1304), False, 'from vaetc.utils.debug import debug_print\n'), ((2543, 2565), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (2553, 2565), False, 'import cv2\n'), ((2580, 2658... |
#!/usr/bin/env python
#
#
__author__ = '<EMAIL>'
import numpy as np
from scipy.stats import norm
from keras.models import load_model
import tensorflow as tf
from flask import Flask
from flask import jsonify
from flask import request
from flask_cors import CORS
mnist_z2=load_model('mnist-va-decoder-zdim-2.h5')
mnist_... | [
"keras.models.load_model",
"flask_cors.CORS",
"flask.Flask",
"numpy.max",
"numpy.array",
"numpy.linspace",
"flask.request.get_json",
"numpy.min",
"tensorflow.get_default_graph",
"flask.jsonify"
] | [((273, 313), 'keras.models.load_model', 'load_model', (['"""mnist-va-decoder-zdim-2.h5"""'], {}), "('mnist-va-decoder-zdim-2.h5')\n", (283, 313), False, 'from keras.models import load_model\n'), ((365, 387), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (385, 387), True, 'import tensorflow ... |
import numpy as np
from scipy.optimize import minimize
# height distribution
def vf(z, k, v0):
#v0 = 1880. # v0 = n(z = 0)
drho = 1063. - 997. # density (kg / m^3)
g = 9.81 # gravity (m / s)
#r = 0.52e-6 # radius of particle (m)
r3 = 0.140608 # (e-18 m^3)
#k = 1.380649e-23 # (m^2 kg / s^2 / K)
... | [
"numpy.exp",
"numpy.array"
] | [((623, 651), 'numpy.array', 'np.array', (['[13.80649, 1880.0]'], {}), '([13.80649, 1880.0])\n', (631, 651), True, 'import numpy as np\n'), ((365, 421), 'numpy.exp', 'np.exp', (['(-4.0 * np.pi * r3 * drho * g * z / (3.0 * k * T))'], {}), '(-4.0 * np.pi * r3 * drho * g * z / (3.0 * k * T))\n', (371, 421), True, 'import ... |
from sequence.utils.quantum_state import QuantumState
from sequence.utils.encoding import polarization
from math import sqrt
from numpy.random import default_rng
rng = default_rng()
def test_measure():
qs = QuantumState()
states = [(complex(1), complex(0)),
(complex(0), complex(1)),
... | [
"sequence.utils.quantum_state.QuantumState",
"math.sqrt",
"numpy.random.default_rng"
] | [((169, 182), 'numpy.random.default_rng', 'default_rng', ([], {}), '()\n', (180, 182), False, 'from numpy.random import default_rng\n'), ((214, 228), 'sequence.utils.quantum_state.QuantumState', 'QuantumState', ([], {}), '()\n', (226, 228), False, 'from sequence.utils.quantum_state import QuantumState\n'), ((1289, 1303... |
import numpy as np
from costs import sigmoid
def mse_gradient(y, tx, w):
err = y - tx.dot(w)
grad = -tx.T.dot(err) / len(err)
return grad, err
def hessian(w, tx):
sigm = sigmoid(tx.dot(w))
S = sigm * (1 - sigm)
return np.multiply(tx.T, S) @ tx
def log_likelihood_gradient(y, tx, w):
s = ... | [
"numpy.multiply"
] | [((245, 265), 'numpy.multiply', 'np.multiply', (['tx.T', 'S'], {}), '(tx.T, S)\n', (256, 265), True, 'import numpy as np\n')] |
import json
import numpy as np
import os
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
from tqdm import trange
import random
import numpy as np
from torch.utils.data import DataLoader
# METRICS = ['glob_acc', 'per_acc', 'glob_loss', 'per_loss', 'user_train_time', 's... | [
"os.path.exists",
"torch.unique",
"os.listdir",
"numpy.unique",
"torch.load",
"torch.stack",
"os.path.join",
"torch.square",
"torch.Tensor",
"torch.tensor",
"torch.utils.data.DataLoader",
"json.load",
"torch.clamp"
] | [((5378, 5404), 'os.listdir', 'os.listdir', (['train_data_dir'], {}), '(train_data_dir)\n', (5388, 5404), False, 'import os\n'), ((6149, 6174), 'os.listdir', 'os.listdir', (['test_data_dir'], {}), '(test_data_dir)\n', (6159, 6174), False, 'import os\n'), ((7702, 7747), 'torch.utils.data.DataLoader', 'DataLoader', (['da... |
from functools import total_ordering
from operator import is_
import numpy as np
from typing import Callable, Iterable, List, Optional, Sequence, Tuple, Union
from numpy import random
from scipy.ndimage import rotate, map_coordinates, gaussian_filter
import h5py
from itertools import chain
from batchgenerators.augment... | [
"numpy.clip",
"numpy.logical_and",
"numpy.floor_divide",
"numpy.asarray",
"numpy.any",
"numpy.squeeze",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.stack",
"scipy.ndimage.rotate",
"numpy.nonzero",
"numpy.min",
"numpy.expand_dims",
"numpy.rot90",
"numpy.maximum",
"medical_seg.ut... | [((2509, 2532), 'numpy.array', 'np.array', (['data[0].shape'], {}), '(data[0].shape)\n', (2517, 2532), True, 'import numpy as np\n'), ((2559, 2581), 'numpy.array', 'np.array', (['seg[0].shape'], {}), '(seg[0].shape)\n', (2567, 2581), True, 'import numpy as np\n'), ((4237, 4269), 'numpy.squeeze', 'np.squeeze', (['seg_re... |
from .Variables import EMBEDDINGS_PATH, SVM_MODEL_PATH,SVM_CONFIDENCE, model
from .Get_Embeddings import get_embedding
import pickle
import cv2
import numpy as np
from numpy import asarray
from numpy import savez_compressed
from numpy import load
from numpy import expand_dims
from sklearn.metrics import accuracy_score
... | [
"cv2.imwrite",
"sklearn.preprocessing.LabelEncoder",
"PIL.Image.open",
"PIL.Image.fromarray",
"numpy.asarray",
"cv2.putText",
"numpy.expand_dims",
"numpy.load",
"mtcnn.mtcnn.MTCNN"
] | [((490, 497), 'mtcnn.mtcnn.MTCNN', 'MTCNN', ([], {}), '()\n', (495, 497), False, 'from mtcnn.mtcnn import MTCNN\n'), ((605, 654), 'numpy.load', 'load', (["(EMBEDDINGS_PATH + '/Embeddings-dataset.npz')"], {}), "(EMBEDDINGS_PATH + '/Embeddings-dataset.npz')\n", (609, 654), False, 'from numpy import load\n'), ((697, 711),... |
import pandas as pd
import numpy as np
import config
class Result:
"""
A class used to represent a Result.
Attributes
----------
ticker : sequence
The stock ticker.
data : dataframe
The historical data associated with the ticker.
strategy : Strategy
An instance of ... | [
"pandas.Series",
"numpy.where",
"pandas.to_datetime",
"numpy.errstate",
"numpy.isfinite",
"numpy.isnan",
"pandas.isna",
"numpy.isnat",
"numpy.round"
] | [((4049, 4096), 'pandas.Series', 'pd.Series', (['[(x if x > 0 else 0) for x in delta]'], {}), '([(x if x > 0 else 0) for x in delta])\n', (4058, 4096), True, 'import pandas as pd\n'), ((4788, 4835), 'pandas.Series', 'pd.Series', (['[(x if x > 0 else 0) for x in delta]'], {}), '([(x if x > 0 else 0) for x in delta])\n',... |
"""
geoutils.georaster provides a toolset for working with raster data.
"""
from __future__ import annotations
import copy
import os
import warnings
from collections import abc
from numbers import Number
from typing import IO, Any, Callable, TypeVar, overload
import geopandas as gpd
import matplotlib
import matplotli... | [
"rasterio.windows.Window",
"rasterio.windows.from_bounds",
"rasterio.transform.from_bounds",
"numpy.isin",
"numpy.array",
"pyproj.Transformer.from_crs",
"numpy.nanmean",
"os.cpu_count",
"affine.Affine",
"numpy.nanmin",
"rasterio.mask.mask",
"copy.copy",
"rasterio.coords.BoundingBox",
"nump... | [((1192, 1229), 'typing.TypeVar', 'TypeVar', (['"""RasterType"""'], {'bound': '"""Raster"""'}), "('RasterType', bound='Raster')\n", (1199, 1229), False, 'from typing import IO, Any, Callable, TypeVar, overload\n'), ((12196, 12208), 'rasterio.io.MemoryFile', 'MemoryFile', ([], {}), '()\n', (12206, 12208), False, 'from r... |
import math
import pandas as pd
from hdmf.common.table import DynamicTable
from pynwb import ProcessingModule
from src.bsl_python.preprocessing.processor.processor import Processor
import numpy as np
class DeviantTone(Processor):
parameters = dict()
def __init__(self, window_spikes, trials_info, repetitions)... | [
"pynwb.ProcessingModule",
"numpy.sum",
"numpy.unique",
"hdmf.common.table.DynamicTable.from_dataframe"
] | [((1494, 1516), 'numpy.unique', 'np.unique', (['frequencies'], {}), '(frequencies)\n', (1503, 1516), True, 'import numpy as np\n'), ((2069, 2131), 'pynwb.ProcessingModule', 'ProcessingModule', ([], {'name': 'self.name', 'description': 'self.description'}), '(name=self.name, description=self.description)\n', (2085, 2131... |
import yt
import numpy as np
OCT_MASK_LIST = [8, 0, 0, 0, 0, 8, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0]
def test_octree():
# See Issue #1272
octree_mask = np.array(OCT_MASK_LIST, dtype=np.uint8)
quantities = {}
quantities[('gas', 'd... | [
"numpy.array",
"yt.load_octree",
"numpy.ones"
] | [((234, 273), 'numpy.array', 'np.array', (['OCT_MASK_LIST'], {'dtype': 'np.uint8'}), '(OCT_MASK_LIST, dtype=np.uint8)\n', (242, 273), True, 'import numpy as np\n'), ((332, 361), 'numpy.ones', 'np.ones', (['(22, 1)'], {'dtype': 'float'}), '((22, 1), dtype=float)\n', (339, 361), True, 'import numpy as np\n'), ((374, 429)... |
from ceres import optimize
import numpy as np
def func(ps):
return np.sum(ps**2)
def grad(ps):
return 2 * ps
x0 = np.array([1,2,3,4,5,6,7,8,9,10], dtype=np.double)
print(optimize(func, grad, x0))
| [
"numpy.array",
"ceres.optimize",
"numpy.sum"
] | [((126, 184), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]'], {'dtype': 'np.double'}), '([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=np.double)\n', (134, 184), True, 'import numpy as np\n'), ((73, 88), 'numpy.sum', 'np.sum', (['(ps ** 2)'], {}), '(ps ** 2)\n', (79, 88), True, 'import numpy as np\n'), ((183,... |
from typing import List
import numpy as np
from ..base import BaseAudioEncoder
from ...helper import batching
class MfccEncoder(BaseAudioEncoder):
batch_size = 64
def __init__(self, n_mfcc: int = 13, sample_rate: int = 16000, max_length: int = 100, *args, **kwargs):
super().__init__(*args, **kwa... | [
"numpy.array",
"numpy.zeros",
"librosa.feature.mfcc"
] | [((981, 996), 'numpy.array', 'np.array', (['mfccs'], {}), '(mfccs)\n', (989, 996), True, 'import numpy as np\n'), ((572, 642), 'librosa.feature.mfcc', 'librosa.feature.mfcc', ([], {'y': 'audio', 'sr': 'self.sample_rate', 'n_mfcc': 'self.n_mfcc'}), '(y=audio, sr=self.sample_rate, n_mfcc=self.n_mfcc)\n', (592, 642), Fals... |
# Here we will use the support vector machine
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
# Lets try to write the basic of support vector machine
# we will use a class of several objects and methods
class Support_Vect... | [
"matplotlib.use",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.style.use"
] | [((84, 107), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (98, 107), False, 'import matplotlib\n'), ((170, 189), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (179, 189), False, 'from matplotlib import style\n'), ((3875, 3909), 'numpy.array', 'np.array', (['[[... |
import random
from collections import defaultdict
import torch
from torch.utils.data import Dataset
from data.base_dataset import BaseDataset
from utils import load_json, compute_rel
import pickle
import networkx
import numpy as np
g_use_heuristic_relation_matrix = False
g_add_in_room_relation = False
g_add_random_pa... | [
"random.choice",
"random.shuffle",
"utils.load_json",
"torch.LongTensor",
"numpy.random.choice",
"torch.stack",
"numpy.log",
"numpy.asarray",
"utils.compute_rel",
"numpy.sum",
"collections.defaultdict",
"random.random",
"torch.FloatTensor",
"torch.cat"
] | [((1696, 1721), 'torch.LongTensor', 'torch.LongTensor', (['all_ids'], {}), '(all_ids)\n', (1712, 1721), False, 'import torch\n'), ((1737, 1756), 'torch.cat', 'torch.cat', (['all_objs'], {}), '(all_objs)\n', (1746, 1756), False, 'import torch\n'), ((1773, 1793), 'torch.cat', 'torch.cat', (['all_boxes'], {}), '(all_boxes... |
"""
Modeling Relational Data with Graph Convolutional Networks
Paper: https://arxiv.org/abs/1703.06103
Code: https://github.com/tkipf/relational-gcn
Difference compared to tkipf/relation-gcn
* l2norm applied to all weights
* remove nodes that won't be touched
"""
import argparse
import gc
import logging
from pathlib im... | [
"dgl.heterograph",
"torch.randperm",
"dgl.in_subgraph",
"numpy.array",
"dgl.optim.SparseAdam",
"torch.multiprocessing.cpu_count",
"torch.distributed.barrier",
"numpy.mean",
"torch.unique",
"dgl.to_block",
"torch.optim.SparseAdam",
"torch.nn.ModuleList",
"dgl.nn.RelGraphConv",
"torch.set_nu... | [((3078, 3131), 'torch.unique', 'th.unique', (['v'], {'return_inverse': '(True)', 'return_counts': '(True)'}), '(v, return_inverse=True, return_counts=True)\n', (3087, 3131), True, 'import torch as th\n'), ((5341, 5462), 'torch.distributed.init_process_group', 'th.distributed.init_process_group', ([], {'backend': 'back... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3
import numpy as np
import unittest
import faiss
import tempfile
import os
import io
import sys
import warnings
from mu... | [
"faiss.swig_ptr",
"io.BytesIO",
"faiss.PyCallbackIOWriter",
"os.read",
"os.path.exists",
"faiss.write_index",
"faiss.BufferedIOWriter",
"os.unlink",
"numpy.frombuffer",
"numpy.testing.assert_array_equal",
"faiss.BufferedIOReader",
"faiss.FileIOReader",
"os.close",
"os.write",
"tempfile.m... | [((587, 607), 'faiss.IndexFlatL2', 'faiss.IndexFlatL2', (['d'], {}), '(d)\n', (604, 607), False, 'import faiss\n'), ((648, 666), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (664, 666), False, 'import tempfile\n'), ((1504, 1524), 'faiss.IndexFlatL2', 'faiss.IndexFlatL2', (['d'], {}), '(d)\n', (1521, 1524),... |
# coding=utf-8
import math
import numpy as np
from torch.autograd import Variable
class GloveHelper(object):
def __init__(self, glove_file):
self.glove_file = glove_file
embeds = np.zeros((5000, 100), dtype='float32')
for i, (word, embed) in enumerate(self.embeddings):
if i =... | [
"numpy.random.normal",
"numpy.mean",
"numpy.zeros",
"numpy.std",
"numpy.random.shuffle"
] | [((203, 241), 'numpy.zeros', 'np.zeros', (['(5000, 100)'], {'dtype': '"""float32"""'}), "((5000, 100), dtype='float32')\n", (211, 241), True, 'import numpy as np\n'), ((385, 400), 'numpy.mean', 'np.mean', (['embeds'], {}), '(embeds)\n', (392, 400), True, 'import numpy as np\n'), ((420, 434), 'numpy.std', 'np.std', (['e... |
'''
=======================================================================
2016 Changes by ARM (abhilashreddy.com)
- made to work with Python 3+
- made to work with recent versions of matplotlib
=======================================================================
Author: <NAME> (<EMAIL> where cu=columbia.edu... | [
"numpy.sqrt",
"matplotlib.tri.Triangulation",
"numpy.tensordot",
"numpy.inner",
"numpy.array",
"numpy.zeros",
"numpy.cos",
"numpy.sin",
"numpy.cumsum",
"numpy.arange",
"numpy.arctan"
] | [((955, 983), 'numpy.arctan', 'np.arctan', (['(p[0, 0] / p[0, 2])'], {}), '(p[0, 0] / p[0, 2])\n', (964, 983), True, 'import numpy as np\n'), ((1035, 1085), 'numpy.array', 'np.array', (['[[ca, 0, -sa], [0, 1.0, 0], [sa, 0, ca]]'], {}), '([[ca, 0, -sa], [0, 1.0, 0], [sa, 0, ca]])\n', (1043, 1085), True, 'import numpy as... |
import torch
import sys, math
import numpy as np
import torch.jit as jit
import warnings
import copy
import torch.nn.init as init
import torch.nn as nn
from distutils.util import strtobool
from models.base import Model
from models.utils import *
from models.multi_head_att import MultiHeadedAttention
from models.ssm.... | [
"models.iefs.moe.MofE",
"torch.nn.ReLU",
"numpy.log",
"models.ssm.inference.Attention_STInf",
"torch.repeat_interleave",
"models.iefs.gated.GatedTransition",
"argparse.ArgumentParser",
"torch.mean",
"torch.nn.ModuleList",
"numpy.max",
"torch.randn",
"numpy.abs",
"torch.ones_like",
"models.... | [((1903, 1936), 'numpy.abs', 'np.abs', (["self.hparams['inf_noise']"], {}), "(self.hparams['inf_noise'])\n", (1909, 1936), True, 'import numpy as np\n'), ((4105, 4163), 'torch.nn.Linear', 'nn.Linear', (['(dim_treat + dim_data + dim_base)', 'dim_stochastic'], {}), '(dim_treat + dim_data + dim_base, dim_stochastic)\n', (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.