code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from __future__ import division import os import numpy as np import math from PIL import Image from skimage.metrics import structural_similarity as ssim import matplotlib as mpl mpl.use('TkAgg') import matplotlib.pyplot as plt def save_img(image_tensor, filename): image_numpy = image_tensor.squeeze(0).float().num...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "math.sqrt", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "matplotlib.use", "skimage.metrics.structural_similarity", "numpy.mean", "numpy.loadtxt", "PIL.Image.fromarray", "matplotlib.pyplot.ylabel", "ma...
[((178, 194), 'matplotlib.use', 'mpl.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (185, 194), True, 'import matplotlib as mpl\n'), ((481, 509), 'PIL.Image.fromarray', 'Image.fromarray', (['image_numpy'], {}), '(image_numpy)\n', (496, 509), False, 'from PIL import Image\n'), ((580, 607), 'numpy.mean', 'np.mean', (['((img...
""" Implementation of circular fingerprint calculation. Class developed from a pre-existing class from <NAME>, postdoc in Computational Chemistry (led by <NAME>) and under the supervision of Ola Engkvist and <NAME>. """ import numpy as np # Linear algebra import pandas as pd # Data wrangling # Chemistry packages fr...
[ "pandas.DataFrame", "rdkit.DataStructs.ConvertToNumpyArray", "rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect", "numpy.zeros", "rdkit.Chem.MolFromSmiles" ]
[((1803, 1823), 'pandas.DataFrame', 'pd.DataFrame', (['np_fps'], {}), '(np_fps)\n', (1815, 1823), True, 'import pandas as pd\n'), ((950, 976), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['smiles'], {}), '(smiles)\n', (968, 976), False, 'from rdkit import Chem\n'), ((1521, 1575), 'rdkit.Chem.AllChem.GetMorganFin...
""" Contains Batch classes for images """ import os import warnings from numbers import Number import numpy as np import PIL import PIL.ImageOps import PIL.ImageChops import PIL.ImageFilter import PIL.ImageEnhance from scipy.ndimage.filters import gaussian_filter from scipy.ndimage.interpolation import map_coordinates...
[ "PIL.Image.new", "numpy.clip", "PIL.ImageChops.invert", "numpy.random.randint", "os.path.join", "PIL.Image.merge", "numpy.unique", "numpy.stack", "numpy.random.binomial", "numpy.asarray", "PIL.ImageOps.expand", "scipy.ndimage.interpolation.map_coordinates", "PIL.ImageOps.mirror", "PIL.Imag...
[((5854, 5930), 'numpy.unique', 'np.unique', (['[image.size for image in self.images]'], {'return_counts': '(True)', 'axis': '(0)'}), '([image.size for image in self.images], return_counts=True, axis=0)\n', (5863, 5930), True, 'import numpy as np\n'), ((9325, 9357), 'PIL.Image.fromarray', 'PIL.Image.fromarray', (['imag...
import glob import scipy.io as ff import pandas as pd import yt import numpy as np import os as os props=['M','x','y','z','vx','vy','vz','jx_g','jy_g','jz_g','dMB','dME','dM','rho','cs','dv','Esave','jx_bh','jy_bh','jz_bh','spinmag','eps_sink', 'rho_stars', 'rho_dm', 'vx_stars', 'vy_stars', 'vz_stars', 'vx_dm', 'vy_d...
[ "pandas.DataFrame", "numpy.log", "numpy.copy", "os.path.exists", "os.system", "numpy.diff", "glob.glob", "yt.load", "scipy.io.FortranFile", "numpy.sqrt" ]
[((429, 453), 'os.system', 'os.system', (['"""mkdir sinks"""'], {}), "('mkdir sinks')\n", (438, 453), True, 'import os as os\n'), ((454, 484), 'os.system', 'os.system', (['"""mv sink_* ./sinks"""'], {}), "('mv sink_* ./sinks')\n", (463, 484), True, 'import os as os\n'), ((492, 519), 'glob.glob', 'glob.glob', (['"""outp...
import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import numpy as np import tensorflow as tf tf.get_logger().setLevel('ERROR') from dante_by_rev_syl.data_preparation import text_in_rev_syls, text_in_syls_rhyme from dante_by_rev_s...
[ "os.path.abspath", "tensorflow.keras.models.load_model", "os.makedirs", "dante_by_rev_syl.generate_dante.generate_text", "os.path.dirname", "dante_by_rev_syl.text_processing.prettify_text", "dante_by_rev_syl.data_preparation.text_in_rev_syls", "dante_by_rev_syl.data_preparation.text_in_syls_rhyme", ...
[((808, 851), 'dante_by_rev_syl.text_processing.clean_comedy', 'clean_comedy', (['divine_comedy', 'special_tokens'], {}), '(divine_comedy, special_tokens)\n', (820, 851), False, 'from dante_by_rev_syl.text_processing import clean_comedy, prettify_text, special_tokens\n'), ((953, 986), 'os.path.join', 'os.path.join', ([...
__author__ = '<NAME>' import os import numpy as np import matplotlib.pyplot as plt noisePath = "/Volumes/MYSD/项目/汽车齿轮高效配对/E04.参考资料/实验数据/数据及说明/12组特征齿轮试验/特征齿轮实验振动噪声数据/" drivingXs = [] drivingYs = [] drivingZs = [] drivedXs = [] drivedYs = [] drivedZs = [] Noises = [] fileList = os.listdir(noisePath) for i in range(0, ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "os.path.isfile", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join", "os.listdir", "matplotlib.pyplot.savefig" ]
[((280, 301), 'os.listdir', 'os.listdir', (['noisePath'], {}), '(noisePath)\n', (290, 301), False, 'import os\n'), ((1410, 1449), 'matplotlib.pyplot.plot', 'plt.plot', (['X', 'noise_10'], {'label': '"""noise_10"""'}), "(X, noise_10, label='noise_10')\n", (1418, 1449), True, 'import matplotlib.pyplot as plt\n'), ((1450,...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # File: mnist.py import os import gzip import numpy from six.moves import range from ...utils import logger from ...utils.fs import download, get_dataset_path from ..base import RNGDataFlow __all__ = ['Mnist', 'FashionMnist'] def maybe_download(url, work_directory): ...
[ "gzip.open", "numpy.frombuffer", "numpy.dtype", "os.path.exists", "IPython.embed", "os.path.join" ]
[((443, 481), 'os.path.join', 'os.path.join', (['work_directory', 'filename'], {}), '(work_directory, filename)\n', (455, 481), False, 'import os\n'), ((493, 517), 'os.path.exists', 'os.path.exists', (['filepath'], {}), '(filepath)\n', (507, 517), False, 'import os\n'), ((899, 918), 'gzip.open', 'gzip.open', (['filenam...
import sys print("Python 버전:", sys.version) import pandas as pd print("pandas 버전:", pd.__version__) import matplotlib print("matplotlib 버전:", matplotlib.__version__) import numpy as np print("NumPy 버전:", np.__version__) import scipy as sp print("SciPy 버전:", sp.__version__) import IPython print("IPython 버전:", IPyth...
[ "pandas.DataFrame", "sklearn.datasets.load_iris", "sklearn.model_selection.train_test_split", "sklearn.neighbors.KNeighborsClassifier", "numpy.mean", "numpy.array", "pandas.plotting.scatter_matrix" ]
[((454, 465), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (463, 465), False, 'from sklearn.datasets import load_iris\n'), ((1079, 1157), 'sklearn.model_selection.train_test_split', 'train_test_split', (["iris_dataset['data']", "iris_dataset['target']"], {'random_state': '(0)'}), "(iris_dataset['data'],...
# Copyright (c) Microsoft Corporation and contributors. # Licensed under the MIT License. import numpy as np import pandas as pd import platform import pytest from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from sklearn.tree import DecisionTreeClassifier from fairlearn.postprocessing i...
[ "pandas.DataFrame", "numpy.random.seed", "numpy.random.normal", "numpy.random.choice", "platform.system", "pytest.mark.parametrize" ]
[((608, 666), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""Mitigator"""', '[ThresholdOptimizer]'], {}), "('Mitigator', [ThresholdOptimizer])\n", (631, 666), False, 'import pytest\n'), ((668, 753), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""constraints"""', "['demographic_parity', 'equali...
import os import platform ## replace disutils and also watch out! https://stackoverflow.com/questions/29048623/does-setuptools-build-ext-behaves-differently-from-distutils-one from Cython.Distutils import build_ext from numpy.distutils.system_info import get_info # from distutils.core import setup # from distutils.ex...
[ "platform.system", "numpy.distutils.system_info.get_info", "setuptools.Extension", "setuptools.find_packages" ]
[((973, 988), 'numpy.distutils.system_info.get_info', 'get_info', (['"""mkl"""'], {}), "('mkl')\n", (981, 988), False, 'from numpy.distutils.system_info import get_info\n'), ((1775, 1792), 'platform.system', 'platform.system', ([], {}), '()\n', (1790, 1792), False, 'import platform\n'), ((2686, 2880), 'setuptools.Exten...
# Video Synthesis via Transform-Based Tensor Neural Network # <NAME> # 8/4/2020 # <EMAIL> import tensorflow as tf import scipy.io as sio import numpy as np import DefineParam as DP import h5py # Get param pixel_w, ...
[ "h5py.File", "scipy.io.loadmat", "numpy.transpose", "tensorflow.constant", "numpy.shape", "tensorflow.placeholder", "DefineParam.get_param" ]
[((460, 474), 'DefineParam.get_param', 'DP.get_param', ([], {}), '()\n', (472, 474), True, 'import DefineParam as DP\n'), ((1630, 1692), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, pixel_h, pixel_w, nOfModel]'], {}), '(tf.float32, [None, pixel_h, pixel_w, nOfModel])\n', (1644, 1692), True, 'impo...
""" This module includes tools to correct CDF values for a weighted sum of Bernoulli RVs using linear integer programming """ __author__ = "<NAME>" __license__ = "MIT" __version__ = "0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __all__ = ["cdf_corrected"] import numpy as np from cvxopt import glpk, matrix f...
[ "numpy.matrix", "numpy.concatenate", "cvxopt.matrix", "numpy.extract", "numpy.empty", "numpy.unique", "numpy.zeros", "numpy.identity", "numpy.ones", "numpy.append", "numpy.random.randint", "numpy.arange", "numpy.asmatrix", "numpy.random.permutation", "numpy.dot", "numpy.delete", "num...
[((1730, 1753), 'numpy.dot', 'np.dot', (['w', 'target_indiv'], {}), '(w, target_indiv)\n', (1736, 1753), True, 'import numpy as np\n'), ((1886, 1942), 'numpy.arange', 'np.arange', (['(target_value_z - k)', '(target_value_z + k + 1)', '(1)'], {}), '(target_value_z - k, target_value_z + k + 1, 1)\n', (1895, 1942), True, ...
from .Core import * import numpy as np import moderngl from PIL import Image class DemoCDB(Filter): def __init__(self): super().__init__() self.addInputPort("Resolution", "vec2", (256,256)) self.addInputPort("PhiSamples", "vec3", (0,360,360)) self.addInputPort("ThetaSamples", "vec3...
[ "numpy.array", "moderngl.create_standalone_context" ]
[((474, 521), 'moderngl.create_standalone_context', 'moderngl.create_standalone_context', ([], {'require': '(330)'}), '(require=330)\n', (508, 521), False, 'import moderngl\n'), ((598, 662), 'numpy.array', 'np.array', (['[1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0]'], {}), '([1.0, 1.0, -1.0, 1.0, -1.0, -1.0, ...
import os import cv2 import time import argparse import multiprocessing import numpy as np import tensorflow as tf import time from multiprocessing import Queue, Pool from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as vis_util class ObjectClassifier: def __...
[ "cv2.cvtColor", "object_detection.utils.label_map_util.create_category_index", "numpy.expand_dims", "object_detection.utils.label_map_util.convert_label_map_to_categories", "tensorflow.Session", "time.sleep", "tensorflow.ConfigProto", "tensorflow.gfile.GFile", "tensorflow.Graph", "tensorflow.impor...
[((858, 933), 'os.path.join', 'os.path.join', (['"""/home/pi/ARC/"""', 'self.MODEL_NAME', '"""frozen_inference_graph.pb"""'], {}), "('/home/pi/ARC/', self.MODEL_NAME, 'frozen_inference_graph.pb')\n", (870, 933), False, 'import os\n'), ((1228, 1277), 'object_detection.utils.label_map_util.load_labelmap', 'label_map_util...
import tensorflow as tf import numpy as np import os import time class Net(): def __init__(self, path=None): self.sess = tf.Session() tf.keras.backend.set_session(self.sess) self.checkpoint_path = path self.cp_callback = tf.keras.callbacks.ModelCheckpoint( self.checkpo...
[ "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.Dropout", "tensorflow.keras.layers.Dense", "tensorflow.convert_to_tensor", "numpy.asarray", "tensorflow.Session", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.layers.InputLayer", "tensorflow.keras.layers.MaxPool2D", "ten...
[((135, 147), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (145, 147), True, 'import tensorflow as tf\n'), ((156, 195), 'tensorflow.keras.backend.set_session', 'tf.keras.backend.set_session', (['self.sess'], {}), '(self.sess)\n', (184, 195), True, 'import tensorflow as tf\n'), ((260, 359), 'tensorflow.keras.ca...
"""#Calculates the individual ln likelihood # function li=posthoc_dist(data,xt,x,a,bpop,d,bhat,... # EPS,model_switch,... # hlf,hlg,hle,... # INTER) # % from davidian and giltinan p 173 # dmat= diag(d); # # fg_bhat=fg(x,a,bpop,bhat); ...
[ "project.feval.feval", "numpy.log", "numpy.transpose", "numpy.matmul", "numpy.linalg.det", "project.diag_matlab.diag_matlab", "numpy.linalg.cholesky" ]
[((1129, 1196), 'project.feval.feval', 'feval', (["poped_db['model']['fg_pointer']", 'x', 'a', 'bpop', 'b_ind', 'bocc_ind'], {}), "(poped_db['model']['fg_pointer'], x, a, bpop, b_ind, bocc_ind)\n", (1134, 1196), False, 'from project.feval import feval\n'), ((1209, 1288), 'project.feval.feval', 'feval', (["poped_db['mod...
import string from typing import Dict, Callable, List, Union import numpy as np import spacy def spacy_wrap(fn: Callable, language: str = "en_core_web_sm", **kwargs) -> Callable: """ Wrap the function so that it runs the input text data through a spacy model before the function call. """ from alle...
[ "allennlp.common.util.get_spacy_model", "numpy.random.choice" ]
[((2068, 2138), 'numpy.random.choice', 'np.random.choice', (['[x for x in string.ascii_letters + string.digits]', 'n'], {}), '([x for x in string.ascii_letters + string.digits], n)\n', (2084, 2138), True, 'import numpy as np\n'), ((498, 533), 'allennlp.common.util.get_spacy_model', 'get_spacy_model', (['language'], {})...
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "numpy.mean", "numpy.isinf", "numpy.isnan", "time.time" ]
[((1726, 1737), 'time.time', 'time.time', ([], {}), '()\n', (1735, 1737), False, 'import time\n'), ((2286, 2297), 'time.time', 'time.time', ([], {}), '()\n', (2295, 2297), False, 'import time\n'), ((1851, 1862), 'time.time', 'time.time', ([], {}), '()\n', (1860, 1862), False, 'import time\n'), ((2174, 2194), 'numpy.mea...
from __future__ import division, print_function, absolute_import from itertools import groupby from warnings import warn import numpy as np from scipy.sparse import find, coo_matrix EPS = np.finfo(float).eps def validate_first_step(first_step, t0, t_bound): """Assert that first_step is valid and return it.""" ...
[ "numpy.abs", "numpy.maximum", "numpy.empty", "numpy.argsort", "numpy.arange", "numpy.linalg.norm", "numpy.diag", "numpy.unique", "numpy.full", "numpy.empty_like", "numpy.equal", "numpy.finfo", "numpy.max", "scipy.sparse.coo_matrix", "numpy.real", "numpy.asarray", "scipy.sparse.find",...
[((190, 205), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (198, 205), True, 'import numpy as np\n'), ((1485, 1501), 'numpy.asarray', 'np.asarray', (['atol'], {}), '(atol)\n', (1495, 1501), True, 'import numpy as np\n'), ((1607, 1623), 'numpy.any', 'np.any', (['(atol < 0)'], {}), '(atol < 0)\n', (1613, 1623...
#-*- coding:utf-8 -*- # &Author AnFany # 适用于多维输出 import numpy as np import tensorflow as tf '''基于TensorFlow构建训练函数''' # 创建激活函数 def activate(input_layer, weights, biases, actfunc): layer = tf.add(tf.matmul(input_layer, weights), biases) if actfunc == 'relu': return tf.nn.relu(layer) el...
[ "tensorflow.nn.relu", "tensorflow.train.Saver", "tensorflow.nn.tanh", "tensorflow.global_variables_initializer", "tensorflow.Session", "tensorflow.nn.sigmoid", "tensorflow.placeholder", "tensorflow.matmul", "tensorflow.random_normal", "numpy.random.rand", "tensorflow.train.AdamOptimizer", "num...
[((904, 978), 'tensorflow.placeholder', 'tf.placeholder', ([], {'shape': '[None, Input_Dimen]', 'dtype': 'tf.float32', 'name': '"""x_data"""'}), "(shape=[None, Input_Dimen], dtype=tf.float32, name='x_data')\n", (918, 978), True, 'import tensorflow as tf\n'), ((2269, 2303), 'tensorflow.train.AdamOptimizer', 'tf.train.Ad...
# formulas for this file from: # http://www.easyrgb.com/index.php?X=MATH import numpy as np import contextlib import math # Converts sRGB color to CIE's XYZ. # defaults to white, in order to quickly assert white point in CIE-L*a*b*. def rgb2xyz(rgb = [255, 255, 255]): # normalize gamut rgb = np.array(rgb) / 2...
[ "numpy.array", "numpy.zeros", "numpy.vectorize" ]
[((333, 344), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (341, 344), True, 'import numpy as np\n'), ((1033, 1044), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (1041, 1044), True, 'import numpy as np\n'), ((303, 316), 'numpy.array', 'np.array', (['rgb'], {}), '(rgb)\n', (311, 316), True, 'import numpy as ...
"""infinite_jukebox.py - (c) 2017 - <NAME> - <EMAIL> An attempt to re-create the amazing Infinite Jukebox (http://www.infinitejuke.com) created by <NAME> of Echo Nest. Uses the Remixatron module to do most of the work. """ import argparse import curses import curses.textpad import numpy as np import os import pygame...
[ "pygame.event.wait", "argparse.ArgumentParser", "pygame.mixer.init", "curses.endwin", "curses.textpad.Textbox", "curses.initscr", "curses.tigetnum", "soundfile.write", "curses.curs_set", "pygame.mixer.Sound", "os.path.basename", "signal.getsignal", "signal.signal", "pygame.mixer.quit", "...
[((976, 1097), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description', 'epilog': 'epilog', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=description, epilog=epilog,\n formatter_class=argparse.RawDescriptionHelpFormatter)\n', (999, 1097), False, 'import a...
import matplotlib.figure as mf import matplotlib.ticker as ticker import numpy as np import scipy.interpolate as ip _GREY400 = "#BDBDBD" _LSTYLES = ("-", "--", "-.", ":") _RED100 = "#FFCDD2" _RED300 = "#E57373" _RED700 = "#D32F2F" def profile(name, data_exp, data_fit): fig, ax1, ax2 = _create_fig(name) _pl...
[ "matplotlib.ticker.MaxNLocator", "numpy.sort", "matplotlib.figure.Figure", "numpy.max", "numpy.min", "scipy.interpolate.interp1d" ]
[((553, 564), 'matplotlib.figure.Figure', 'mf.Figure', ([], {}), '()\n', (562, 564), True, 'import matplotlib.figure as mf\n'), ((3993, 4004), 'matplotlib.figure.Figure', 'mf.Figure', ([], {}), '()\n', (4002, 4004), True, 'import matplotlib.figure as mf\n'), ((4635, 4682), 'scipy.interpolate.interp1d', 'ip.interp1d', (...
import argparse from abc import ABC from pathlib import Path import numpy as np import epoch_counter from main import add_arguments from qlearning.network import TeacherAgent from qlearning.teacher import TeacherEnv from trainer import Trainer class EpochCounter(epoch_counter.EpochCounter): infos_name = "infos"...
[ "argparse.ArgumentParser", "qlearning.network.TeacherAgent", "qlearning.teacher.TeacherEnv", "pathlib.Path", "numpy.array", "main.add_arguments" ]
[((2409, 2434), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2432, 2434), False, 'import argparse\n'), ((2622, 2643), 'main.add_arguments', 'add_arguments', (['PARSER'], {}), '(PARSER)\n', (2635, 2643), False, 'from main import add_arguments\n'), ((1802, 1927), 'qlearning.teacher.TeacherEnv'...
#!/usr/bin/env python # coding: utf-8 # # Experiments @Fischer in Montebelluna 28.02.20 # We had the oppurtunity to use the Flexometer for ski boots of Fischer with their help at Montebelluna. The idea is to validate our system acquiring simultaneously data by our sensor setup and the one from their machine. With the...
[ "pandas.DataFrame", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "pandas.date_range", "matplotlib.pyplot.plot", "pandas.merge", "matplotlib.pyplot.ylabel", "scipy.interpolate.interp1d", "matplotlib.pyplot.figure", "numpy.array", "scipy.signal.find_peak...
[((2043, 2079), 'IPython.display.set_matplotlib_formats', 'set_matplotlib_formats', (['"""png"""', '"""pdf"""'], {}), "('png', 'pdf')\n", (2065, 2079), False, 'from IPython.display import set_matplotlib_formats\n'), ((3094, 3144), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(5)', '(5)'], {'figsize': '(13, 11)', 's...
# -*- coding: utf-8 -*- """ File file_util.py @author:ZhengYuwei """ import os import logging import functools import tensorflow as tf from dataset.dataset_util import DatasetUtil class FileUtil(object): """ 从标签文件中,构造返回(image, label)的tf.data.Dataset数据集 标签文件内容如下: image_name label0,label1,label2,... ...
[ "tensorflow.string_split", "tensorflow.image.per_image_standardization", "tensorflow.string_to_number", "dataset.dataset_util.DatasetUtil.batch_prefetch", "tensorflow.image.resize_images", "functools.partial", "tensorflow.reverse", "cv2.waitKey", "tensorflow.data.Dataset.zip", "tensorflow.enable_e...
[((4853, 4880), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (4878, 4880), True, 'import tensorflow as tf\n'), ((5209, 5220), 'time.time', 'time.time', ([], {}), '()\n', (5218, 5220), False, 'import time\n'), ((774, 831), 'tensorflow.string_join', 'tf.string_join', (['[root_path, ...
import unittest from os.path import join import numpy as np from shapely.geometry import shape from rastervision2.core.data import ClassConfig from rastervision2.core import Box from rastervision2.core.data import ( Scene, IdentityCRSTransformer, SemanticSegmentationLabelSource, RasterizedSourceConfig, Raster...
[ "unittest.main", "numpy.full", "rastervision2.core.data.Scene", "rastervision2.core.Box.make_square", "rastervision2.core.data.ClassConfig", "rastervision2.pipeline.file_system.file_to_json", "numpy.zeros", "tests_v2.data_file_path", "rastervision2.core.data.IdentityCRSTransformer", "rastervision2...
[((5815, 5830), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5828, 5830), False, 'import unittest\n'), ((779, 802), 'rastervision2.pipeline.rv_config.get_tmp_dir', 'rv_config.get_tmp_dir', ([], {}), '()\n', (800, 802), False, 'from rastervision2.pipeline import rv_config\n'), ((832, 865), 'rastervision2.core.da...
''' Copyright (c) 2020, 2021 <NAME> <<EMAIL>>, <NAME> <<EMAIL>> This code is free software; you can redistribute it and/or modify it under the terms of the BSD License. @author: <NAME>, <NAME> @contact: <EMAIL>, <EMAIL> ''' import sys,argparse import os,glob import numpy as np import pandas as pd from scipy import ...
[ "numpy.ceil", "os.makedirs", "argparse.ArgumentParser", "pandas.DataFrame.from_dict", "cooler.Cooler", "numpy.arange", "sys.exit" ]
[((546, 571), 'cooler.Cooler', 'cooler.Cooler', (['matrixfile'], {}), '(matrixfile)\n', (559, 571), False, 'import cooler\n'), ((2163, 2186), 'numpy.arange', 'np.arange', (['total_chunks'], {}), '(total_chunks)\n', (2172, 2186), True, 'import numpy as np\n'), ((5073, 5112), 'os.makedirs', 'os.makedirs', (['args.outdir'...
import numpy as np import matplotlib.pyplot as plt c = 1E-10 #m V_0 = 8E-15 #J m = 9.109E-31 hbar = 1.0546E-34 #J s z_0 = (c/hbar)*np.sqrt(2*m*V_0) max_iter = 1000 def find_pairs(f, step, a, b): x = a pairs = [] while (x + step < b): if (f(x+step)/f(x) < 0): pairs.append([x, x+step]) ...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.tan", "numpy.sin", "numpy.linspace", "numpy.cos", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((1031, 1055), 'numpy.linspace', 'np.linspace', (['(0)', '(15)', '(1000)'], {}), '(0, 15, 1000)\n', (1042, 1055), True, 'import numpy as np\n'), ((1666, 1689), 'numpy.linspace', 'np.linspace', (['(-15)', '(15)', '(5)'], {}), '(-15, 15, 5)\n', (1677, 1689), True, 'import numpy as np\n'), ((1688, 1709), 'matplotlib.pypl...
import numpy as np def mean_tau_w(tau_a, w_a): return np.average( tau_a / w_a, weights=w_a) def var_tau_w(tau_a, w_a, av): return np.sum( w_a*(tau_a/w_a - av)**2) / (np.sum(w_a) ) def check_moments_w(tau_a, w_a): _av = mean_tau_w(tau_a, w_a) _var = var_tau_w(tau_a, w_a, _av) return _av, _var ...
[ "numpy.any", "numpy.average", "numpy.sum", "numpy.column_stack" ]
[((59, 95), 'numpy.average', 'np.average', (['(tau_a / w_a)'], {'weights': 'w_a'}), '(tau_a / w_a, weights=w_a)\n', (69, 95), True, 'import numpy as np\n'), ((888, 923), 'numpy.column_stack', 'np.column_stack', (['(x_l, av_l, var_l)'], {}), '((x_l, av_l, var_l))\n', (903, 923), True, 'import numpy as np\n'), ((141, 178...
# coding: utf-8 # # Neurodesign comparison of design generators # # In this notebook, we will compare 3 methods to generate an experimental design: # - a design optimised using the genetic algorithm # - a design optimised using simulations # - a randomly drawn design # # We will do so using simulations: what is the...
[ "neurodesign.optimisation", "matplotlib.pyplot.subplot", "matplotlib.pyplot.title", "matplotlib.pyplot.plot", "numpy.median", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.percentile", "matplotlib.pyplot.figure", "numpy.mean", "numpy.array", "seaborn.dist...
[((1283, 1505), 'neurodesign.experiment', 'experiment', ([], {'TR': '(2)', 'n_trials': '(450)', 'P': '[0.25, 0.25, 0.25]', 'C': '[[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 0, -1]]', 'n_stimuli': '(3)', 'rho': '(0.3)', 'resolution': '(0.1)', 'stim_duration': '(1)', 'ITImodel': '"""exponential"""', 'ITImin': '(0.3)', 'ITImean...
import matplotlib.pyplot as plt from common import Config from disjoint_set import DisjointSet from itertools import product import itertools import numpy as np import networkx as nx import GPy import logging import random import scipy from myAcquisitionLCB import MyAcquisitionLCB from datasets import ComponentFunctio...
[ "datasets.ComponentFunction", "matplotlib.pyplot.clf", "numpy.allclose", "numpy.einsum", "numpy.isclose", "numpy.random.normal", "numpy.copy", "scipy.linalg.cho_solve", "disjoint_set.DisjointSet", "networkx.to_numpy_matrix", "itertools.product", "numpy.log10", "myAcquisitionLCB.MyAcquisition...
[((1362, 1385), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(1024)'}), '(maxsize=1024)\n', (1371, 1385), False, 'from functools import lru_cache\n'), ((4890, 4899), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (4897, 4899), True, 'import matplotlib.pyplot as plt\n'), ((9403, 9450), 'numpy.array', 'np...
import os import numpy as np import tflowtools as TFT import tensorflow as tf import fileinput import random import mnist_basics as mnist random.seed(123) np.random.seed(123) tf.set_random_seed(123) def replaceSeparator(file): with open(file, "r") as file: with open("data_sets/gamma.txt.bak", "w") as out...
[ "numpy.random.seed", "tensorflow.matmul", "numpy.mean", "numpy.linalg.norm", "mnist_basics.load_all_flat_cases", "tflowtools.gen_initialized_session", "numpy.std", "tensorflow.set_random_seed", "tensorflow.placeholder", "random.seed", "tflowtools.show_results", "random.random", "tensorflow.t...
[((139, 155), 'random.seed', 'random.seed', (['(123)'], {}), '(123)\n', (150, 155), False, 'import random\n'), ((156, 175), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (170, 175), True, 'import numpy as np\n'), ((176, 199), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(123)'], {}), '(12...
from typing import ( Optional ) import numpy as np def rolling_window( array: np.ndarray, size: int, shift: Optional[int] = None, stride: int = 1 ) -> np.ndarray: """Gets an `size`-period rolling window for `array` as an 1d array |-------- size:3 --------| |- stride:1 -| | ...
[ "numpy.lib.stride_tricks.as_strided" ]
[((889, 1044), 'numpy.lib.stride_tricks.as_strided', 'np.lib.stride_tricks.as_strided', (['array'], {'shape': '((steps, size) + array.shape[1:])', 'strides': '((item_stride * shift, item_stride * stride) + array.strides[1:])'}), '(array, shape=(steps, size) + array.shape[1:\n ], strides=(item_stride * shift, item_st...
import itertools import pathlib import tempfile import slab import numpy tmpdir = pathlib.Path(tempfile.gettempdir()) def test_low_high_pass(): for i in range(10): sound = slab.Sound.whitenoise(duration=2.0) for kind, fir in itertools.product(["lp", "hp"], [False, True]): edge_freq = nu...
[ "slab.Filter.load", "numpy.abs", "slab.Sound.whitenoise", "slab.Filter.equalizing_filterbank", "numpy.random.randint", "numpy.testing.assert_almost_equal", "numpy.linspace", "itertools.product", "numpy.testing.assert_equal", "slab.Filter.collapse_subbands", "slab.Filter._center_freqs", "numpy....
[((95, 116), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (114, 116), False, 'import tempfile\n'), ((852, 887), 'slab.Sound.whitenoise', 'slab.Sound.whitenoise', ([], {'duration': '(2.0)'}), '(duration=2.0)\n', (873, 887), False, 'import slab\n'), ((909, 955), 'itertools.product', 'itertools.product'...
from pioneer.common import platform as platform_utils from pioneer.common.trace_processing import TraceProcessingCollection, Smooth, Clip, ZeroBaseline, Realign, RemoveStaticNoise, Desaturate from pioneer.common import clouds from pioneer.das.api.samples import FastTrace, Echo from pioneer.das.view.windows import Windo...
[ "pioneer.common.trace_processing.RemoveStaticNoise", "pioneer.das.api.samples.Echo", "numpy.argmax", "pioneer.common.trace_processing.TraceProcessingCollection", "pioneer.common.trace_processing.ZeroBaseline", "numpy.flipud", "pioneer.common.trace_processing.Desaturate", "pioneer.common.trace_processi...
[((520, 541), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(20)'], {}), '(0, 1, 20)\n', (531, 541), True, 'import numpy as np\n'), ((1180, 1230), 'pioneer.common.platform.parse_datasource_name', 'platform_utils.parse_datasource_name', (['self.ds_name'], {}), '(self.ds_name)\n', (1216, 1230), True, 'from pioneer.co...
import matplotlib import numpy as np matplotlib.use('Agg') import shap def test_random_single_image(): """ Just make sure the image_plot function doesn't crash. """ shap.image_plot(np.random.randn(3, 20,20), np.random.randn(3, 20,20), show=False) def test_random_multi_image(): """ Just make sure the ...
[ "matplotlib.use", "numpy.random.randn" ]
[((37, 58), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (51, 58), False, 'import matplotlib\n'), ((195, 221), 'numpy.random.randn', 'np.random.randn', (['(3)', '(20)', '(20)'], {}), '(3, 20, 20)\n', (210, 221), True, 'import numpy as np\n'), ((222, 248), 'numpy.random.randn', 'np.random.randn'...
import decimal import random from .properties import Properties from .singleton import Singleton import numpy as np import sys import threading import re import os.path import logging import copy # This module should be usable on systems without wx. verbose = True p = Properties() class DBException(Exception): ...
[ "csv.reader", "numpy.sum", "random.sample", "MySQLdb.cursors.SSCursor", "numpy.isnan", "numpy.mean", "threading.currentThread", "logging.error", "logging.warning", "re.findall", "numpy.linspace", "re.search", "copy.deepcopy", "re.match", "numpy.isinf", "wx.App", "sqlite3.connect", ...
[((8500, 8544), 're.findall', 're.findall', (['""" \'\\\\w+\\\\.[Cc][Ss][Vv]\' """', 'lines'], {}), '(" \'\\\\w+\\\\.[Cc][Ss][Vv]\' ", lines)\n', (8510, 8544), False, 'import re\n'), ((99522, 99530), 'wx.App', 'wx.App', ([], {}), '()\n', (99528, 99530), False, 'import wx\n'), ((99535, 99594), 'logging.basicConfig', 'lo...
# Import dependencies from sklearn.model_selection import train_test_split import numpy as np import argparse # Set size and seed test_size = 0.2 random_state = 42 # Establish arguments as file paths ap = argparse.ArgumentParser() ap.add_argument("-images", "--images", required=True, help="images npy location") ap.a...
[ "sklearn.model_selection.train_test_split", "numpy.load", "numpy.save", "argparse.ArgumentParser" ]
[((207, 232), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (230, 232), False, 'import argparse\n'), ((526, 546), 'numpy.load', 'np.load', (['images_path'], {}), '(images_path)\n', (533, 546), True, 'import numpy as np\n'), ((551, 570), 'numpy.load', 'np.load', (['masks_path'], {}), '(masks_pa...
#!/usr/bin/env python import os import time import warnings from combat import combat import numpy as np import pandas as pd import patsy import pytest from rpy2.rinterface import RRuntimeWarning from rpy2.robjects import r from types import FunctionType @pytest.fixture def r_result(): warnings.filterwarnings("...
[ "warnings.filterwarnings", "pandas.read_csv", "numpy.allclose", "patsy.dmatrix", "time.time", "combat.combat", "os.path.join" ]
[((295, 354), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'RRuntimeWarning'}), "('ignore', category=RRuntimeWarning)\n", (318, 354), False, 'import warnings\n'), ((419, 458), 'pandas.read_csv', 'pd.read_csv', (['"""r-batch.csv"""'], {'index_col': '(0)'}), "('r-batch.csv', index...
import numpy as np import h5py from asciitree import LeftAligned from collections import OrderedDict from asciitree.drawing import BoxStyle, BOX_DOUBLE, BOX_BLANK # from ipdb import set_trace as stop __all__ = ['i0_allen', '_extract_parameter_cycles', 'isint', 'fvoigt', 'lower_dict_keys', 'show_tree'] def i0_allen(wa...
[ "h5py.File", "numpy.asarray", "asciitree.drawing.BoxStyle", "numpy.imag", "numpy.real", "numpy.sign", "numpy.interp", "collections.OrderedDict" ]
[((763, 912), 'numpy.asarray', 'np.asarray', (['[0.12, -1.3, -0.1, -0.1, 0.38, 0.74, 0.88, 0.98, 1.03, 0.92, 0.91, 0.99, \n 0.97, 0.93, 0.88, 0.73, 0.64, 0.57, 0.48, 0.35, 0.22, 0.15]'], {}), '([0.12, -1.3, -0.1, -0.1, 0.38, 0.74, 0.88, 0.98, 1.03, 0.92, \n 0.91, 0.99, 0.97, 0.93, 0.88, 0.73, 0.64, 0.57, 0.48, 0....
# Adopted from https://github.com/KiroSummer/A_Syntax-aware_MTL_Framework_for_Chinese_SRL # Inference functions for the SRL model. import numpy as np def decode_spans(span_starts, span_ends, span_scores, labels_inv): """ Args: span_starts: [num_candidates,] span_scores: [num_candidates, num_labe...
[ "numpy.max", "numpy.zeros", "numpy.argmax" ]
[((427, 457), 'numpy.argmax', 'np.argmax', (['span_scores'], {'axis': '(1)'}), '(span_scores, axis=1)\n', (436, 457), True, 'import numpy as np\n'), ((4476, 4501), 'numpy.argmax', 'np.argmax', (['scores'], {'axis': '(1)'}), '(scores, axis=1)\n', (4485, 4501), True, 'import numpy as np\n'), ((4881, 4912), 'numpy.zeros',...
#!/usr/bin/python3 from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from dataloader import TestDataset from collec...
[ "torch.nn.Dropout", "torch.sqrt", "torch.empty", "torch.cat", "collections.defaultdict", "torch.cos", "torch.fft.irfft", "torch.nn.functional.normalize", "torch.no_grad", "torch.Tensor", "torch.nn.functional.relu", "torch.zeros", "torch.nn.Linear", "torch.nn.functional.max_pool2d", "torc...
[((1923, 1969), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['self.entity_embedding'], {}), '(self.entity_embedding)\n', (1946, 1969), True, 'import torch.nn as nn\n'), ((2243, 2291), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['self.relation_embedding'], {}), '(self.relation_embeddin...
"""Data generators """ import glob import os import json from pathlib import Path from typing import Tuple, List, Union from PIL import Image import numpy as np import tensorflow as tf from tensorflow.keras.utils import Sequence def encode_sentence(s: str, tokenizer) -> np.ndarray: """Encode a sentence with bert...
[ "json.load", "tensorflow.zeros_like", "tensorflow.concat", "PIL.Image.open", "tensorflow.ones_like", "pathlib.Path", "numpy.array", "glob.glob", "tensorflow.ragged.constant", "numpy.random.shuffle" ]
[((998, 1022), 'tensorflow.ragged.constant', 'tf.ragged.constant', (['data'], {}), '(data)\n', (1016, 1022), True, 'import tensorflow as tf\n'), ((1122, 1157), 'tensorflow.concat', 'tf.concat', (['[cls, sentence]'], {'axis': '(-1)'}), '([cls, sentence], axis=-1)\n', (1131, 1157), True, 'import tensorflow as tf\n'), ((1...
import numpy as np from tensorflow.keras import backend as K from tensorflow.keras import layers, models, optimizers from tensorflow.keras.layers import Layer from tensorflow.keras.layers import Input, Conv2D, Activation, Dense, Dropout, Lambda, Reshape, Concatenate from tensorflow.keras.layers import BatchNormalizati...
[ "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.layers.Concatenate", "tensorflow.keras.layers.Reshape", "tensorflow.keras.models.Model", "tensorflow.keras.models.Sequential", "tensorflow.keras.layers.Input", "tensorflow.keras.layers.Conv2DTranspose", ...
[((630, 654), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': 'input_shape'}), '(shape=input_shape)\n', (635, 654), False, 'from tensorflow.keras.layers import Input, Conv2D, Activation, Dense, Dropout, Lambda, Reshape, Concatenate\n'), ((2916, 2971), 'tensorflow.keras.models.Model', 'models.Model', ([], {'inp...
import numpy as np import torch from scipy.stats import invgamma from genrl.agents.bandits.contextual.base import DCBAgent from genrl.agents.bandits.contextual.common import NeuralBanditModel, TransitionDB from genrl.utils.data_bandits.base import DataBasedBandit class NeuralLinearPosteriorAgent(DCBAgent): """De...
[ "torch.ones", "torch.eye", "torch.argmax", "torch.mm", "genrl.agents.bandits.contextual.common.TransitionDB", "scipy.stats.invgamma.rvs", "numpy.random.multivariate_normal", "torch.zeros", "torch.inverse", "torch.tensor" ]
[((3113, 3211), 'torch.zeros', 'torch.zeros', ([], {'size': '(self.n_actions, self.latent_dim + 1)', 'device': 'self.device', 'dtype': 'torch.float'}), '(size=(self.n_actions, self.latent_dim + 1), device=self.device,\n dtype=torch.float)\n', (3124, 3211), False, 'import torch\n'), ((3993, 4018), 'genrl.agents.bandi...
import os import pathlib import pandas as pd import numpy as np import matplotlib.pyplot as plt from src.models.walk_forward_predictor import WalkForwardPredictor from src.models.lr import LRegression from src.utils import series_to_supervised # Get data path or create a directory if it does not exist # TODO: This ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.log", "src.models.walk_forward_predictor.WalkForwardPredictor", "src.utils.series_to_supervised", "matplotlib.pyplot.close", "os.getcwd", "src.models.lr.LRegression", "os.path.join" ]
[((888, 949), 'src.utils.series_to_supervised', 'series_to_supervised', (['gold_etf_data'], {'n_in': 'n_features', 'n_out': '(1)'}), '(gold_etf_data, n_in=n_features, n_out=1)\n', (908, 949), False, 'from src.utils import series_to_supervised\n'), ((1090, 1120), 'src.models.lr.LRegression', 'LRegression', ([], {'name':...
import numpy as np def collapse(probas, output_type = 'bin'): """ Parameters ---------- probas: An array of probablities. output_type: If ternary, output can be -1, 0 and 1. Returns ------- b: An array of binary states, whose dimensionality is identical to probas. """ p = n...
[ "numpy.zeros_like", "numpy.abs", "numpy.ones_like", "numpy.log", "numpy.count_nonzero", "numpy.sum", "numpy.asarray", "numpy.zeros", "numpy.amax", "numpy.where", "numpy.reshape", "numpy.exp", "numpy.random.rand", "numpy.dot" ]
[((319, 333), 'numpy.abs', 'np.abs', (['probas'], {}), '(probas)\n', (325, 333), True, 'import numpy as np\n'), ((400, 460), 'numpy.where', 'np.where', (['(probas >= 0)', 'b', "{'bin': 0, 'ter': -b}[output_type]"], {}), "(probas >= 0, b, {'bin': 0, 'ter': -b}[output_type])\n", (408, 460), True, 'import numpy as np\n'),...
from typing import List, Optional import numpy as np import xarray as xr from .parse_ad2cp import Ad2cpDataPacket, Field, HeaderOrDataRecordFormats from .set_groups_base import SetGroupsBase, set_encodings def merge_attrs(datasets: List[xr.Dataset]) -> List[xr.Dataset]: """ Merges attrs from a list of datas...
[ "numpy.pad", "xarray.combine_by_coords", "xarray.Dataset", "xarray.merge", "numpy.array" ]
[((5034, 5052), 'xarray.merge', 'xr.merge', (['datasets'], {}), '(datasets)\n', (5042, 5052), True, 'import xarray as xr\n'), ((16546, 16804), 'xarray.Dataset', 'xr.Dataset', ([], {'attrs': "{'sonar_manufacturer': 'Nortek', 'sonar_model': 'AD2CP',\n 'sonar_serial_number': '', 'sonar_software_name': '',\n 'sonar_s...
''' Model utilities ''' import random import cv2 import matplotlib.pyplot as plt import numpy as np import pandas as pd from tensorflow.keras import backend as K from tensorflow import GradientTape from tensorflow.keras.models import Model from tensorflow import cast, reduce_mean from sklearn.metrics import roc_auc_s...
[ "pandas.DataFrame", "tensorflow.keras.backend.pow", "numpy.uint8", "numpy.maximum", "numpy.sum", "sklearn.metrics.roc_curve", "tensorflow.keras.backend.sum", "tensorflow.keras.backend.mean", "tensorflow.reduce_mean", "numpy.ones", "sklearn.metrics.roc_auc_score", "tensorflow.cast", "tensorfl...
[((3976, 4087), 'pandas.DataFrame', 'pd.DataFrame', (['metrics'], {'columns': "['Accuracy', 'Sensitivity', 'Specificity', 'PPV', 'Auc_score']", 'index': 'labels'}), "(metrics, columns=['Accuracy', 'Sensitivity', 'Specificity',\n 'PPV', 'Auc_score'], index=labels)\n", (3988, 4087), True, 'import pandas as pd\n'), ((4...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Raccoon # import math import sys from openbabel import openbabel as ob import numpy as np from . import obutils def get_vector(coor1, coord2): """ calculate normalized vector between atoms""" vec = np.array([coord2[0] - coord1[0], coord2[1] - coord1[1], coo...
[ "math.sqrt", "math.radians", "numpy.asarray", "numpy.zeros", "numpy.cross", "math.sin", "math.acos", "numpy.sin", "numpy.array", "math.cos", "numpy.cos", "numpy.mean", "numpy.array_equal", "numpy.dot", "sys.exc_info", "numpy.atleast_2d" ]
[((261, 350), 'numpy.array', 'np.array', (['[coord2[0] - coord1[0], coord2[1] - coord1[1], coord2[2] - coord1[2]]', '"""f"""'], {}), "([coord2[0] - coord1[0], coord2[1] - coord1[1], coord2[2] - coord1[\n 2]], 'f')\n", (269, 350), True, 'import numpy as np\n'), ((811, 852), 'numpy.array', 'np.array', (['vector[1]', '...
""" Getting the data ================ In this section, we will dicuss how to get functional data to use in scikit-fda. We will briefly describe the :class:`~skfda.representation.grid.FDataGrid` class, which is the type that scikit-fda uses for storing and working with functional data in discretized form. We will discu...
[ "sklearn.datasets.load_digits", "skfda.datasets.fetch_cran", "matplotlib.pyplot.show", "numpy.power", "skfda.datasets.fetch_ucr", "skfda.FDataGrid", "skfda.misc.covariances.Exponential", "skfda.datasets.fetch_growth" ]
[((3229, 3294), 'skfda.FDataGrid', 'skfda.FDataGrid', ([], {'data_matrix': 'data_matrix', 'grid_points': 'grid_points'}), '(data_matrix=data_matrix, grid_points=grid_points)\n', (3244, 3294), False, 'import skfda\n'), ((3317, 3327), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3325, 3327), True, 'import mat...
# yolov4-tf2 wrapper import tensorflow as tf import pdb ################## ## Needed for my current setup gpu_devices = tf.config.experimental.list_physical_devices('GPU') for device in gpu_devices: tf.config.experimental.set_memory_growth(device, True) ################## # import keras import keras import sys s...
[ "keras_retinanet.utils.image.preprocess_image", "sys.path.insert", "tensorflow.config.experimental.set_memory_growth", "keras_retinanet.models.load_model", "numpy.expand_dims", "tensorflow.config.experimental.list_physical_devices", "keras_retinanet.utils.image.resize_image" ]
[((120, 171), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (164, 171), True, 'import tensorflow as tf\n'), ((319, 348), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../src/"""'], {}), "(0, '../src/')\n", (334, 348), False...
import multiprocessing as mp import os from threading import Thread from human_tracker import camera_capture from database import ImageDB from absl import app, flags, logging from absl.flags import FLAGS import numpy as np import pandas as pd import signal, sys import datetime as dt import shutil import time flags.DEF...
[ "multiprocessing.log_to_stderr", "os.path.isfile", "database.ImageDB", "absl.flags.DEFINE_boolean", "os.path.join", "absl.flags.DEFINE_integer", "absl.flags.DEFINE_float", "datetime.datetime.now", "threading.Thread", "absl.flags.FLAGS.video.isdigit", "numpy.asarray", "time.sleep", "pandas.re...
[((311, 370), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""framework"""', '"""tf"""', '"""(tf, tflite, trt)"""'], {}), "('framework', 'tf', '(tf, tflite, trt)')\n", (330, 370), False, 'from absl import app, flags, logging\n'), ((371, 457), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""weights"""'...
import gzip import json import os import pickle import random import re import zipfile import h5py import jieba import numpy as np import requests from bs4 import BeautifulSoup from BUG.function.zhtools.langconv import Converter from BUG.load_package import p def load_data_cat(path): train_dataset = h5py.File(p...
[ "pickle.dump", "BUG.load_package.p.asarray", "random.shuffle", "pickle.load", "numpy.random.randint", "numpy.arange", "os.path.join", "json.loads", "os.path.exists", "numpy.max", "numpy.reshape", "requests.get", "re.sub", "h5py.File", "jieba.cut", "numpy.asarray", "bs4.BeautifulSoup"...
[((309, 332), 'h5py.File', 'h5py.File', (['path[0]', '"""r"""'], {}), "(path[0], 'r')\n", (318, 332), False, 'import h5py\n'), ((356, 397), 'numpy.array', 'np.array', (["train_dataset['train_set_x'][:]"], {}), "(train_dataset['train_set_x'][:])\n", (364, 397), True, 'import numpy as np\n'), ((448, 489), 'numpy.array', ...
# Copyright (c) OpenMMLab. All rights reserved. from typing import Dict, List, Optional, Tuple, Union import mmcv import numpy as np import torch import torch.nn as nn from mmcls.core.visualization import imshow_infos from mmcls.datasets.pipelines import Compose from mmcls.models import build_classifier from mmcv.para...
[ "mmcv.parallel.collate", "mmcv.parallel.scatter", "mmcls.datasets.pipelines.Compose", "mmcv.Config.fromfile", "numpy.array", "mmcv.runner.load_checkpoint", "mmcls.core.visualization.imshow_infos", "torch.no_grad", "mmcv.imread", "mmcls.models.build_classifier" ]
[((1530, 1560), 'mmcls.models.build_classifier', 'build_classifier', (['config.model'], {}), '(config.model)\n', (1546, 1560), False, 'from mmcls.models import build_classifier\n'), ((2486, 2503), 'mmcls.datasets.pipelines.Compose', 'Compose', (['pipeline'], {}), '(pipeline)\n', (2493, 2503), False, 'from mmcls.dataset...
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "os.path.abspath", "copy.deepcopy", "argparse.ArgumentParser", "os.path.isdir", "yaml.dump", "numpy.transpose", "time.time", "os.path.isfile", "yaml.safe_load", "numpy.array", "python.keypoint_preprocess.expand_crop" ]
[((831, 875), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (854, 875), False, 'import argparse\n'), ((8355, 8369), 'yaml.dump', 'yaml.dump', (['cfg'], {}), '(cfg)\n', (8364, 8369), False, 'import yaml\n'), ((9028, 9054), 'os.path.abspath', 'os.path.a...
from collections.abc import Mapping from ctypes import c_int, c_int32, c_double, c_char_p, POINTER, c_size_t from weakref import WeakValueDictionary import numpy as np from numpy.ctypeslib import as_array from openmc.exceptions import AllocationError, InvalidIDError, OpenMCError from . import _dll, Nuclide from .core...
[ "ctypes.c_int32", "ctypes.c_double", "ctypes.c_int", "numpy.asarray", "numpy.ctypeslib.as_array", "ctypes.POINTER", "weakref.WeakValueDictionary" ]
[((493, 509), 'ctypes.POINTER', 'POINTER', (['c_int32'], {}), '(c_int32)\n', (500, 509), False, 'from ctypes import c_int, c_int32, c_double, c_char_p, POINTER, c_size_t\n'), ((511, 527), 'ctypes.POINTER', 'POINTER', (['c_int32'], {}), '(c_int32)\n', (518, 527), False, 'from ctypes import c_int, c_int32, c_double, c_ch...
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np from scipy.ndimage.interpolation import zoom from .care_standard import CARE from ..data import PercentileNormalizer, PadAndCropResizer from ..utils import _raise, axes_dict class UpsamplingCARE(CARE): """CARE ...
[ "scipy.ndimage.interpolation.zoom", "numpy.ones" ]
[((1991, 2008), 'numpy.ones', 'np.ones', (['img.ndim'], {}), '(img.ndim)\n', (1998, 2008), True, 'import numpy as np\n'), ((2072, 2099), 'scipy.ndimage.interpolation.zoom', 'zoom', (['img', 'factors'], {'order': '(1)'}), '(img, factors, order=1)\n', (2076, 2099), False, 'from scipy.ndimage.interpolation import zoom\n')...
from util import mean_max_similarity_semantic from natsort import natsorted import numpy as np import os import glob import sys def L2_norm_semantic(semantic_embedding): ret = [] for embedding in semantic_embedding: ret.append(embedding / np.linalg.norm(embedding)) return np.array(ret) def sema...
[ "numpy.load", "os.makedirs", "os.path.basename", "os.path.exists", "numpy.linalg.norm", "numpy.array", "util.mean_max_similarity_semantic", "os.path.join" ]
[((296, 309), 'numpy.array', 'np.array', (['ret'], {}), '(ret)\n', (304, 309), True, 'import numpy as np\n'), ((1806, 1864), 'os.path.join', 'os.path.join', (['topics_data_folder', 'query_id', '"""video_action"""'], {}), "(topics_data_folder, query_id, 'video_action')\n", (1818, 1864), False, 'import os\n'), ((2474, 25...
import gym import numpy as np from smarts.core.sensors import Observation class Reward(gym.Wrapper): def __init__(self, env: gym.Env): super().__init__(env) def reset(self, **kwargs): return self.env.reset(**kwargs) def step(self, action): obs, env_reward, done, info = self.env....
[ "numpy.float32" ]
[((1005, 1023), 'numpy.float32', 'np.float32', (['reward'], {}), '(reward)\n', (1015, 1023), True, 'import numpy as np\n'), ((760, 778), 'numpy.float32', 'np.float32', (['reward'], {}), '(reward)\n', (770, 778), True, 'import numpy as np\n'), ((900, 918), 'numpy.float32', 'np.float32', (['reward'], {}), '(reward)\n', (...
import argparse import numpy as np from sklearn.cluster import KMeans import sklearn.decomposition from mnist import load_mnist import gmm import classifier import kmeans as kmeans_ parser = argparse.ArgumentParser( prog='em', description='train model with em' ) parser.add_argument('--path', default='/home/...
[ "argparse.ArgumentParser", "kmeans.load_kmeans", "mnist.load_mnist", "numpy.mean", "numpy.reshape", "classifier.classifier" ]
[((194, 263), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""em"""', 'description': '"""train model with em"""'}), "(prog='em', description='train model with em')\n", (217, 263), False, 'import argparse\n'), ((575, 611), 'kmeans.load_kmeans', 'kmeans_.load_kmeans', (['"""kmeans-20.dat"""'], {})...
import numpy import six import chainer from chainer import backend from chainer import utils import chainerx def assert_allclose(x, y, atol=1e-5, rtol=1e-4, verbose=True): """Asserts if some corresponding element of x and y differs too much. This function can handle both CPU and GPU arrays simultaneously. ...
[ "chainer.utils.force_array", "numpy.set_printoptions", "numpy.abs", "numpy.argmax", "chainer.backend.CpuDevice", "numpy.array2string", "six.StringIO", "chainer.backend.get_device_from_array", "numpy.testing.assert_allclose", "chainer.using_device", "numpy.get_printoptions" ]
[((598, 618), 'chainer.utils.force_array', 'utils.force_array', (['x'], {}), '(x)\n', (615, 618), False, 'from chainer import utils\n'), ((653, 673), 'chainer.utils.force_array', 'utils.force_array', (['y'], {}), '(y)\n', (670, 673), False, 'from chainer import utils\n'), ((692, 766), 'numpy.testing.assert_allclose', '...
import numpy as np def randomization(n): """ Arg: n - an integer Returns: A - a randomly-generated nx1 Numpy array. """ A = np.random.random((n,1)) return A raise NotImplementedError def operations(h, w): """ Takes two inputs, h and w, and makes two Numpy arrays A and ...
[ "numpy.multiply", "numpy.vectorize", "numpy.sum", "numpy.tanh", "numpy.random.random", "numpy.linalg.norm", "numpy.add" ]
[((157, 181), 'numpy.random.random', 'np.random.random', (['(n, 1)'], {}), '((n, 1))\n', (173, 181), True, 'import numpy as np\n'), ((698, 722), 'numpy.random.random', 'np.random.random', (['(h, w)'], {}), '((h, w))\n', (714, 722), True, 'import numpy as np\n'), ((730, 754), 'numpy.random.random', 'np.random.random', (...
""" Copyright (c) 2021, Electric Power Research Institute All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this li...
[ "pandas.DataFrame", "dervet.MicrogridDER.ContinuousSizing.ContinuousSizing.__init__", "cvxpy.NonPos", "storagevet.Technology.PVSystem.PV.__init__", "pandas.Period", "pandas.Series", "cvxpy.Variable", "dervet.MicrogridDER.DERExtension.DERExtension.__init__", "numpy.dot" ]
[((2372, 2406), 'storagevet.Technology.PVSystem.PV.__init__', 'PVSystem.PV.__init__', (['self', 'params'], {}), '(self, params)\n', (2392, 2406), False, 'from storagevet.Technology import PVSystem\n'), ((2415, 2450), 'dervet.MicrogridDER.DERExtension.DERExtension.__init__', 'DERExtension.__init__', (['self', 'params'],...
#!/usr/bin/python3 from __future__ import division from __future__ import print_function from __future__ import absolute_import import sys from pathlib import Path import numpy as np import matplotlib.pyplot as plt import posthoc_learn.banalg as banalg from posthoc_learn.config import posthoc_config as config from po...
[ "matplotlib.pyplot.title", "numpy.load", "numpy.amin", "numpy.savez_compressed", "numpy.random.randint", "numpy.arange", "pathlib.Path", "numpy.random.normal", "posthoc_learn.banalg.LinUCB", "numpy.cumsum", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "numpy.linalg.inv", "matplotl...
[((640, 656), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (649, 656), True, 'import matplotlib.pyplot as plt\n'), ((665, 691), 'numpy.arange', 'np.arange', (['regret.shape[0]'], {}), '(regret.shape[0])\n', (674, 691), True, 'import numpy as np\n'), ((805, 819), 'matplotlib.pyplot.xlim', 'plt.x...
# -*- coding: utf-8 -*- # -------------------------------------------- # Author: <NAME> # Date: 2021/6/13 17:46 # Description: # -------------------------------------------- import mkl import faiss import pickle import numpy as np from typing import List, Dict from .constant import INDEX_PATH, FEATURES_PATH mk...
[ "faiss.read_index", "pickle.load", "numpy.array", "mkl.get_max_threads", "numpy.atleast_2d" ]
[((318, 339), 'mkl.get_max_threads', 'mkl.get_max_threads', ([], {}), '()\n', (337, 339), False, 'import mkl\n'), ((587, 615), 'faiss.read_index', 'faiss.read_index', (['index_path'], {}), '(index_path)\n', (603, 615), False, 'import faiss\n'), ((1952, 1974), 'numpy.atleast_2d', 'np.atleast_2d', (['vectors'], {}), '(ve...
import numpy as np from scipy.interpolate import griddata # functions to massage the raw data including data from bad channels. def fill_bad_channel(pdata, rpos, zpos, good_channels, cutoff): # cutoff = 0.003 [m] # ## fake data # dist = np.sqrt((rpos - 1.8)**2 + (zpos - 0)**2) # pdata = 0.1*(1 - (dist...
[ "numpy.meshgrid", "numpy.sum", "scipy.interpolate.griddata", "numpy.isnan", "numpy.min", "numpy.max", "numpy.exp", "numpy.sqrt" ]
[((949, 968), 'numpy.meshgrid', 'np.meshgrid', (['ri', 'zi'], {}), '(ri, zi)\n', (960, 968), True, 'import numpy as np\n'), ((978, 1033), 'scipy.interpolate.griddata', 'griddata', (['(rpos, zpos)', 'pdata', '(ri, zi)'], {'method': 'imethod'}), '((rpos, zpos), pdata, (ri, zi), method=imethod)\n', (986, 1033), False, 'fr...
# local imports import time import yaml import json import numpy as np import os def yaml_import(file_directory): with open(file_directory) as f: return yaml.full_load(f) def write_json(json_data, file_name): with open('../static/{}.json'.format(file_name), 'w') as f: json.dum...
[ "json.dump", "numpy.load", "json.load", "os.rename", "yaml.full_load", "os.path.realpath", "time.time", "os.chdir" ]
[((524, 535), 'time.time', 'time.time', ([], {}), '()\n', (533, 535), False, 'import time\n'), ((1460, 1478), 'os.chdir', 'os.chdir', (['dir_path'], {}), '(dir_path)\n', (1468, 1478), False, 'import os\n'), ((1526, 1555), 'os.rename', 'os.rename', (['file', 'file_nospace'], {}), '(file, file_nospace)\n', (1535, 1555), ...
""" This module contains the different solvers that are available for Pastas. All solvers inherit from the BaseSolver class, which contains general method for selecting the correct time series to misfit and options to weight the residuals or noise series. To solve a model the following syntax can be used: >>> ml.s...
[ "numpy.sum", "scipy.linalg.svd", "numpy.diag", "lmfit.Minimizer", "pandas.DataFrame", "lmfit.Parameters", "numpy.random.randn", "scipy.optimize.least_squares", "numpy.finfo", "numpy.max", "numpy.var", "pandas.DataFrame.from_dict", "numpy.min", "numpy.dot", "numpy.concatenate", "numpy.o...
[((514, 533), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (523, 533), False, 'from logging import getLogger\n'), ((6274, 6317), 'pandas.DataFrame.from_dict', 'DataFrame.from_dict', (['data'], {'orient': '"""columns"""'}), "(data, orient='columns')\n", (6293, 6317), False, 'from pandas import D...
""" nitrogen.linalg.packed ------------------------- Packed-storage matrices and routines. The lower triangle is stored in row-major order. (For symmetric matrices, this is equivalent to upper triangle column-major order. For Hermitian matrices, this is the conjugate of the upper triangle in column-major order.) """ ...
[ "numpy.divide", "numpy.uint64", "numpy.abs", "numpy.multiply", "numpy.zeros", "numpy.add", "numpy.copyto", "numpy.ndarray", "warnings.warn", "numpy.sqrt" ]
[((724, 755), 'numpy.uint64', 'np.uint64', (['(k - I * (I + 1) // 2)'], {}), '(k - I * (I + 1) // 2)\n', (733, 755), True, 'import numpy as np\n'), ((1031, 1062), 'numpy.uint64', 'np.uint64', (['(i * (i + 1) // 2 + j)'], {}), '(i * (i + 1) // 2 + j)\n', (1040, 1062), True, 'import numpy as np\n'), ((1748, 1788), 'numpy...
import torch import networkx as nx import numpy as np from oil.utils.utils import export,FixedNumpySeed from src.systems.rigid_body import RigidBody, BodyGraph, project_onto_constraints from src.animation import Animation import copy @export class ChainPendulum(RigidBody): d=2 dt=.03 integration_time=3 ...
[ "numpy.stack", "copy.deepcopy", "torch.stack", "torch.where", "oil.utils.utils.FixedNumpySeed", "numpy.random.rand", "src.systems.rigid_body.BodyGraph", "torch.randn", "networkx.get_edge_attributes", "src.systems.rigid_body.project_onto_constraints", "networkx.get_node_attributes", "torch.zero...
[((405, 416), 'src.systems.rigid_body.BodyGraph', 'BodyGraph', ([], {}), '()\n', (414, 416), False, 'from src.systems.rigid_body import RigidBody, BodyGraph, project_onto_constraints\n'), ((804, 821), 'copy.deepcopy', 'copy.deepcopy', (['ms'], {}), '(ms)\n', (817, 821), False, 'import copy\n'), ((1294, 1371), 'torch.ze...
# -*- coding: utf-8 -*- from typing import Union, List import numpy as np from astartool.common import BIT_EACH from snowland.gis_tool import NDS_180_DEGREES, NDS_360_DEGREES, NDS_90_DEGREES, RULE_MORTON_TO_LONLAT npl = np.linalg npa = np.array def dms_to_nds(dms: Union[np.ndarray, List, float]): if isinstance...
[ "numpy.zeros_like", "numpy.zeros" ]
[((1128, 1167), 'numpy.zeros_like', 'np.zeros_like', (['nds_lat'], {'dtype': 'np.uint64'}), '(nds_lat, dtype=np.uint64)\n', (1141, 1167), True, 'import numpy as np\n'), ((3070, 3098), 'numpy.zeros', 'np.zeros', (['(2)'], {'dtype': 'np.uint32'}), '(2, dtype=np.uint32)\n', (3078, 3098), True, 'import numpy as np\n')]
import pytest import tempfile from flaky import flaky import numpy as np import deepchem as dc from deepchem.feat import MolGraphConvFeaturizer from deepchem.models.tests.test_graph_models import get_dataset try: import dgl import dgllife import torch from deepchem.models import GATModel has_torch_and_dgl =...
[ "deepchem.models.tests.test_graph_models.get_dataset", "deepchem.models.GATModel", "deepchem.molnet.load_bace_classification", "deepchem.feat.MolGraphConvFeaturizer", "tempfile.mkdtemp", "deepchem.data.NumpyDataset", "deepchem.molnet.load_delaney", "numpy.all" ]
[((443, 467), 'deepchem.feat.MolGraphConvFeaturizer', 'MolGraphConvFeaturizer', ([], {}), '()\n', (465, 467), False, 'from deepchem.feat import MolGraphConvFeaturizer\n'), ((509, 557), 'deepchem.models.tests.test_graph_models.get_dataset', 'get_dataset', (['"""regression"""'], {'featurizer': 'featurizer'}), "('regressi...
import numpy as np import mp2 as mp2 import hartree_fock as hf import noble_gas_model as noble_gas_model if __name__ == "__main__": NobleGasModel = noble_gas_model.NobleGasModel() atomic_coordinates = np.array([[0.0,0.0,0.0], [3.0,4.0,5.0]]) mp2_instance = mp2.MP2(NobleGasModel,atomic_coordinates) mp2_...
[ "numpy.array", "noble_gas_model.NobleGasModel", "mp2.MP2" ]
[((153, 184), 'noble_gas_model.NobleGasModel', 'noble_gas_model.NobleGasModel', ([], {}), '()\n', (182, 184), True, 'import noble_gas_model as noble_gas_model\n'), ((210, 254), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0], [3.0, 4.0, 5.0]]'], {}), '([[0.0, 0.0, 0.0], [3.0, 4.0, 5.0]])\n', (218, 254), True, 'import nu...
import cv2 import numpy as np import argparse import os if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("images_path", help="Path to images.") args = parser.parse_args() images_path = args.images_path print("Images Path: {0}".format(images_path)) background ...
[ "cv2.subtract", "argparse.ArgumentParser", "cv2.waitKey", "cv2.threshold", "numpy.ones", "cv2.destroyWindow", "cv2.erode", "cv2.imshow", "os.path.join" ]
[((98, 123), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (121, 123), False, 'import argparse\n'), ((402, 438), 'cv2.imshow', 'cv2.imshow', (['"""background"""', 'background'], {}), "('background', background)\n", (412, 438), False, 'import cv2\n'), ((442, 456), 'cv2.waitKey', 'cv2.waitKey', ...
import sys import itk import numpy as np import torch from collections import OrderedDict class SegmentationPostProcessing(): """ Post-processing callable that remembers some intermediate steps. Given a binary lung segmentation (with labels 0=background and 1=lung) this will return a segmentation that picks ou...
[ "itk.ConnectedComponentImageFilter", "numpy.zeros_like", "numpy.copy", "itk.BinaryFillholeImageFilter", "itk.array_from_image", "numpy.array", "collections.OrderedDict", "numpy.unique" ]
[((771, 784), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (782, 784), False, 'from collections import OrderedDict\n'), ((1425, 1438), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1436, 1438), False, 'from collections import OrderedDict\n'), ((1737, 1779), 'itk.ConnectedComponentImageFilt...
import numpy n = int(input()) a,b = ( numpy.array([input().split() for _ in range(n)], int) for _ in range(2) ) print(numpy.dot(a,b)) #https://www.hackerrank.com/challenges/np-dot-and-cross/problem
[ "numpy.dot" ]
[((119, 134), 'numpy.dot', 'numpy.dot', (['a', 'b'], {}), '(a, b)\n', (128, 134), False, 'import numpy\n')]
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "numpy.abs", "numpy.sum", "mindspore.ops.Reshape", "scipy.linalg.fractional_matrix_power", "numpy.identity", "numpy.linalg.matrix_power", "numpy.asmatrix", "numpy.array", "scipy.sparse.linalg.eigs" ]
[((1267, 1287), 'numpy.asmatrix', 'np.asmatrix', (['adj_mat'], {}), '(adj_mat)\n', (1278, 1287), True, 'import numpy as np\n'), ((1313, 1334), 'numpy.identity', 'np.identity', (['n_vertex'], {}), '(n_vertex)\n', (1324, 1334), True, 'import numpy as np\n'), ((1537, 1575), 'scipy.linalg.fractional_matrix_power', 'fractio...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (C) 2016 <NAME> (<EMAIL>) 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 b...
[ "sys.stdout.write", "random.uniform", "tensorflow.argmax", "numpy.asarray", "tensorflow.arg_max", "tensorflow.placeholder", "tensorflow.cast", "tensorflow.zeros", "sys.stdout.flush", "tensorflow.matmul", "tensorflow.initialize_all_variables", "tensorflow.log", "tensorflow.InteractiveSession"...
[((1492, 1535), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, 4]'}), '(tf.float32, shape=[None, 4])\n', (1506, 1535), True, 'import tensorflow as tf\n'), ((1545, 1588), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, 3]'}), '(tf.float32, shape=[None, 3])\n...
#!/usr/bin/env python3 """Compute vanishing points from images. Usage: demo.py [options] <yaml-config> <checkpoint> <image> demo.py ( -h | --help ) Arguments: <yaml-config> Path to the yaml hyper-parameter file <checkpoint> Path to the checkpoint <image> ...
[ "numpy.load", "numpy.random.seed", "numpy.abs", "docopt.docopt", "matplotlib.pyplot.suptitle", "numpy.argmax", "numpy.clip", "torch.cuda.device_count", "numpy.argsort", "matplotlib.pyplot.figure", "pprint.pprint", "torch.device", "torch.no_grad", "vpd.config.M.update", "numpy.unique", ...
[((1539, 1558), 'numpy.argsort', 'np.argsort', (['(-scores)'], {}), '(-scores)\n', (1549, 1558), True, 'import numpy as np\n'), ((2256, 2293), 'numpy.flatnonzero', 'np.flatnonzero', (['(vps_prob >= threshold)'], {}), '(vps_prob >= threshold)\n', (2270, 2293), True, 'import numpy as np\n'), ((2361, 2396), 'numpy.clip', ...
''' COTR dataset ''' import random import time import numpy as np import torch from torchvision.transforms import functional as tvtf from torch.utils import data import cv2 import imutils # from COTR.datasets import megadepth_dataset from COTR.datasets import tracking_datasets from COTR.utils import debug_utils, uti...
[ "COTR.datasets.tracking_datasets.get_dataset", "torch.cat", "numpy.sin", "numpy.arange", "numpy.linalg.norm", "COTR.datasets.utils.geom.get_pts_inbound_lrt", "numpy.transpose", "numpy.random.choice", "torch.zeros", "torch.is_tensor", "COTR.datasets.utils.geom.safe_inverse", "cv2.resize", "nu...
[((649, 672), 'torch.is_tensor', 'torch.is_tensor', (['tensor'], {}), '(tensor)\n', (664, 672), False, 'import torch\n'), ((947, 975), 'numpy.transpose', 'np.transpose', (['img', '(1, 2, 0)'], {}), '(img, (1, 2, 0))\n', (959, 975), True, 'import numpy as np\n'), ((1032, 1060), 'numpy.transpose', 'np.transpose', (['img'...
import tensorflow as tf from multiprocessing import Process, Queue import os import datetime import numpy as np from impala.model import ImpalaModel, Learner, Actor from impala.replay_buffer import UniformBuffer, PrioritizedBuffer from common.logger import TensorBoardWriter, CSVWriter, CombinedWriter import utils as U ...
[ "impala.model.ImpalaModel", "tensorflow.ConfigProto", "multiprocessing.Queue", "utils.dump_dict_as_json", "os.path.join", "tensorflow.train.Server", "impala.replay_buffer.PrioritizedBuffer", "tensorflow.train.StopAtStepHook", "impala.model.Actor", "datetime.datetime.now", "common.logger.Combined...
[((5313, 5353), 'os.path.join', 'os.path.join', (['"""/tmp/impala"""', 'date_string'], {}), "('/tmp/impala', date_string)\n", (5325, 5353), False, 'import os\n'), ((5407, 5473), 'tensorflow.train.Server', 'tf.train.Server', (['cluster'], {'job_name': 'job_name', 'task_index': 'task_index'}), '(cluster, job_name=job_nam...
# -------------------------------------------------------- # SiamMask # Licensed under The MIT License # Written by <NAME> (wangqiang2015 at ia.ac.cn) # -------------------------------------------------------- from pycocotools.coco import COCO import cv2 import numpy as np color_bar = np.random.randint(0, 255, (90, 3)...
[ "cv2.waitKey", "pycocotools.coco.COCO", "numpy.random.randint", "cv2.imshow" ]
[((287, 321), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(90, 3)'], {}), '(0, 255, (90, 3))\n', (304, 321), True, 'import numpy as np\n'), ((450, 463), 'pycocotools.coco.COCO', 'COCO', (['annFile'], {}), '(annFile)\n', (454, 463), False, 'from pycocotools.coco import COCO\n'), ((978, 999), 'cv2.ims...
#!/usr/bin/env python3 import sys import math import numpy as np import glob import scipy.optimize as optimization import os from itertools import islice import re #Angle Types: # 1-16 -> SPS # 17-20 -> SBB # 21-36 -> 3PSB5 # 37-52 -> 5PSB3 WC = { 'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A' } typeAngle =...
[ "numpy.zeros" ]
[((3348, 3380), 'numpy.zeros', 'np.zeros', (['(nangles + 1)'], {'dtype': 'int'}), '(nangles + 1, dtype=int)\n', (3356, 3380), True, 'import numpy as np\n'), ((3391, 3423), 'numpy.zeros', 'np.zeros', (['(nangles + 1)'], {'dtype': 'int'}), '(nangles + 1, dtype=int)\n', (3399, 3423), True, 'import numpy as np\n'), ((3434,...
import torch import torch.nn as nn import copy import numpy as np from . import util as util __all__ = ['JParameter','JTensor'] ########################################################## ### Auto-Jacobian ########################################################## class JParameter(nn.Parameter): r"""Special type ...
[ "copy.deepcopy", "numpy.sum", "torch.eye", "numpy.zeros", "torch.Tensor", "torch.zeros", "torch.sum", "torch.Tensor._make_subclass", "torch.from_numpy" ]
[((483, 536), 'torch.Tensor._make_subclass', 'torch.Tensor._make_subclass', (['cls', 'data', 'requires_grad'], {}), '(cls, data, requires_grad)\n', (510, 536), False, 'import torch\n'), ((453, 467), 'torch.Tensor', 'torch.Tensor', ([], {}), '()\n', (465, 467), False, 'import torch\n'), ((3194, 3223), 'copy.deepcopy', '...
# Code adapted from https://github.com/liucong3/camelyon17 # and https://github.com/cv-lee/Camelyon17 import openslide import cv2 import numpy as np import pandas as pd import os import csv import argparse from tqdm import tqdm from xml.etree.ElementTree import parse from PIL import Image PATCH_LEVEL ...
[ "pandas.DataFrame", "openslide.OpenSlide", "xml.etree.ElementTree.parse", "os.makedirs", "argparse.ArgumentParser", "cv2.cvtColor", "cv2.imwrite", "cv2.threshold", "numpy.zeros", "numpy.array", "cv2.rectangle", "os.path.join", "pandas.concat" ]
[((1690, 1721), 'openslide.OpenSlide', 'openslide.OpenSlide', (['slide_path'], {}), '(slide_path)\n', (1709, 1721), False, 'import openslide\n'), ((2355, 2405), 'numpy.zeros', 'np.zeros', (['slide.level_dimensions[mask_level][::-1]'], {}), '(slide.level_dimensions[mask_level][::-1])\n', (2363, 2405), True, 'import nump...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "tensorflow.reduce_sum", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Dropout", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.Conv1D", "tensorflow.reshape", "tensorflow.reduce_mean", "tensorflow.constant", "tensorflow.matmul", "te...
[((1735, 1763), 'numpy.random.normal', 'np.random.normal', ([], {'size': 'shape'}), '(size=shape)\n', (1751, 1763), True, 'import numpy as np\n'), ((1776, 1792), 'numpy.linalg.svd', 'np.linalg.svd', (['W'], {}), '(W)\n', (1789, 1792), True, 'import numpy as np\n'), ((1372, 1411), 'tensorflow.keras.layers.Dense', 'tf.ke...
""" Author: <NAME> Date: 21.04.2020 Brief: Script to test the optimal convex data sampling alogrithm """ import matplotlib.pyplot as plt import numpy as np import scipy.optimize import tensorflow as tf from src.networks.configmodel import init_neural_closure from src import utils from src import math def quad_func(...
[ "src.networks.configmodel.init_neural_closure", "numpy.abs", "tensorflow.convert_to_tensor", "numpy.asarray", "tensorflow.reshape", "numpy.ones", "tensorflow.constant", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.stack", "tensorflow.keras.callbacks.CSVLogger", "tensorflow.concat", ...
[((413, 422), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (419, 422), True, 'import numpy as np\n'), ((1810, 1830), 'src.math.EntropyTools', 'math.EntropyTools', (['(1)'], {}), '(1)\n', (1827, 1830), False, 'from src import math\n'), ((4882, 4905), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['u'], {}), '...
import xml.etree.ElementTree as ElementTree import tensorflow as tf import numpy as np class Force: def get_weighting(self): return 1 class HarmonicBondForce(Force): def __init__(self, atom1, atom2, length, k): self.atom1 = atom1 self.atom2 = atom2 self.length = tf.constant(length) self.k = tf.constant(k)...
[ "xml.etree.ElementTree.parse", "tensorflow.reduce_sum", "tensorflow.random.uniform", "tensorflow.math.acos", "tensorflow.constant", "tensorflow.math.sqrt", "tensorflow.Variable", "tensorflow.tensordot", "numpy.sign", "tensorflow.norm" ]
[((275, 294), 'tensorflow.constant', 'tf.constant', (['length'], {}), '(length)\n', (286, 294), True, 'import tensorflow as tf\n'), ((306, 320), 'tensorflow.constant', 'tf.constant', (['k'], {}), '(k)\n', (317, 320), True, 'import tensorflow as tf\n'), ((1009, 1028), 'numpy.sign', 'np.sign', (['self.angle'], {}), '(sel...
import rospy import numpy as np #import tf import argparse import os import yaml from scipy.spatial.transform import Rotation as R from nav_msgs.msg import Odometry T_frame1_to_frame2 = None base_odom = None args_ = None def get_args(): parser = argparse.ArgumentParser() parser.add_argument('--nodename', d...
[ "scipy.spatial.transform.Rotation", "yaml.load", "rospy.Subscriber", "argparse.ArgumentParser", "numpy.copy", "numpy.identity", "rospy.Publisher", "numpy.linalg.inv", "rospy.init_node", "scipy.spatial.transform.Rotation.from_matrix", "numpy.array", "rospy.spin" ]
[((255, 280), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (278, 280), False, 'import argparse\n'), ((1423, 1436), 'scipy.spatial.transform.Rotation', 'R', (['quaternion'], {}), '(quaternion)\n', (1424, 1436), True, 'from scipy.spatial.transform import Rotation as R\n'), ((1448, 1462), 'numpy...
from __future__ import division import numpy as np from matplotlib import pyplot as plt import seaborn.apionly as sns from scipy import stats def fitMVN(): # set plotting style sns.set_style("darkgrid") # load PM dataset pm_daily = np.loadtxt('../data/epa_hourly/alabamatest.csv', delimiter=',') #...
[ "numpy.sum", "scipy.stats.norm.rvs", "numpy.ones", "numpy.shape", "scipy.stats.chi2.rvs", "matplotlib.pyplot.figure", "numpy.mean", "numpy.std", "numpy.savetxt", "numpy.transpose", "numpy.max", "numpy.loadtxt", "seaborn.apionly.set_style", "scipy.stats.norm.ppf", "scipy.stats.chi2.ppf", ...
[((187, 212), 'seaborn.apionly.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (200, 212), True, 'import seaborn.apionly as sns\n'), ((251, 314), 'numpy.loadtxt', 'np.loadtxt', (['"""../data/epa_hourly/alabamatest.csv"""'], {'delimiter': '""","""'}), "('../data/epa_hourly/alabamatest.csv', deli...
from pymorph import hmax import numpy as np def test_hmax(): a = np.array([1,1,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,1,1,1,], np.uint8) assert np.all(hmax(a, a.max()) == 0) for i in range(1,5): assert hmax(a,i).max() == a.max()-i
[ "pymorph.hmax", "numpy.array" ]
[((69, 159), 'numpy.array', 'np.array', (['[1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 1]', 'np.uint8'], {}), '([1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 1],\n np.uint8)\n', (77, 159), True, 'import numpy as np\n'), ((217, 227), 'pymorph.hmax', 'hmax', (['a', 'i'], {}), '(a,...
import numpy as np import nltk import string from sklearn.pipeline import Pipeline from sklearn.linear_model import SGDClassifier from sklearn.metrics import accuracy_score,f1_score, roc_curve, confusion_matrix from nltk.stem.wordnet import WordNetLemmatizer from sklearn.model_selection import train_test_split, cross_v...
[ "sklearn.model_selection.GridSearchCV", "sklearn.feature_extraction.text.CountVectorizer", "nltk.re.sub", "sklearn.linear_model.SGDClassifier", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "numpy.genfromtxt", "sklear...
[((529, 665), 'numpy.genfromtxt', 'np.genfromtxt', (['CONST_WIKI_ALL'], {'delimiter': '"""|\\\\-/|"""', 'skip_header': '(1)', 'dtype': "{'names': ('klass', 'text'), 'formats': (np.int, '|S1000')}"}), "(CONST_WIKI_ALL, delimiter='|\\\\-/|', skip_header=1, dtype={\n 'names': ('klass', 'text'), 'formats': (np.int, '|S1...
import copy import numpy as np from ..numerics.fem import domain2d_fem as FEM from ._mesh import Mesh from meshpy import triangle from scipy import sparse from numba import jit from numpy.linalg import det class Domain2d(Mesh): def __init__(self, curves=None, triangles=None, vertices=None): super(Domain2...
[ "meshpy.triangle.build", "copy.deepcopy", "numpy.minimum", "numpy.maximum", "numpy.zeros_like", "matplotlib.pyplot.show", "numpy.ceil", "numpy.empty", "numpy.floor", "matplotlib.pyplot.triplot", "numpy.ones", "meshpy.triangle.MeshInfo", "numpy.hstack", "scipy.sparse.csr_matrix", "numba.j...
[((3195, 3213), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (3198, 3213), False, 'from numba import jit\n'), ((4374, 4392), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (4377, 4392), False, 'from numba import jit\n'), ((21200, 21218), 'numba.jit', 'jit', ([], {'nopyt...
# this file contains the integral kernel functions that are used for computing # the elevation and velocity solutions import numpy as np from params import Nt,eps_shelf,delta,dt from scipy.signal import fftconvolve #---------------------------convolution operator-------------------------------- def conv(a,b): ret...
[ "scipy.signal.fftconvolve", "numpy.sign", "numpy.exp", "numpy.sqrt" ]
[((1396, 1435), 'numpy.sqrt', 'np.sqrt', (['(4 * delta * B_ ** 2 + chi ** 2)'], {}), '(4 * delta * B_ ** 2 + chi ** 2)\n', (1403, 1435), True, 'import numpy as np\n'), ((1639, 1678), 'numpy.sqrt', 'np.sqrt', (['(4 * delta * B_ ** 2 + chi ** 2)'], {}), '(4 * delta * B_ ** 2 + chi ** 2)\n', (1646, 1678), True, 'import nu...
import numpy as np from sklearntools.earth import Earth import pandas from sklearntools.sym.printers import model_to_code, exec_module from sklearntools.sym.sym_predict import sym_predict from numpy.ma.testutils import assert_array_almost_equal import execjs from sklearntools.calibration import LogTransformer,\ Res...
[ "numpy.random.seed", "numpy.ravel", "sklearn.ensemble.gradient_boosting.HuberLossFunction", "numpy.random.exponential", "numpy.isnan", "numpy.exp", "numpy.random.normal", "sklearn.ensemble.gradient_boosting.GradientBoostingClassifier", "sklearntools.sym.sym_predict.sym_predict", "pandas.DataFrame"...
[((1223, 1240), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1237, 1240), True, 'import numpy as np\n'), ((1291, 1321), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(m, 10)'}), '(size=(m, 10))\n', (1307, 1321), True, 'import numpy as np\n'), ((1334, 1359), 'numpy.random.normal', 'np.rand...
import torch import torch.nn as nn import numpy as np from collections import OrderedDict class Generator(nn.Module): def __init__(self, latent_dim, img_shape): super().__init__() self.img_shape = img_shape def block(in_feat, out_feat, normalize=True): layers = [nn.Linear(i...
[ "torch.nn.Dropout", "torch.nn.BatchNorm1d", "torch.nn.Linear", "torch.nn.LeakyReLU", "numpy.prod", "torch.nn.Sigmoid" ]
[((1125, 1156), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', (['(0.2)'], {'inplace': '(True)'}), '(0.2, inplace=True)\n', (1137, 1156), True, 'import torch.nn as nn\n'), ((1170, 1185), 'torch.nn.Dropout', 'nn.Dropout', (['(0.5)'], {}), '(0.5)\n', (1180, 1185), True, 'import torch.nn as nn\n'), ((1199, 1218), 'torch.nn.Linear'...
import numpy as np import os, sys import scipy.optimize as opt import scipy.io import time import argparse sys.path.append('../..') from srlife import receiver, library def id_cycles(times, period, days): """ Helper to separate out individual cycles by index Parameters: times Tube times period ...
[ "sys.path.append", "numpy.ndindex", "numpy.maximum", "argparse.ArgumentParser", "numpy.sum", "os.getcwd", "numpy.polyval", "numpy.zeros", "numpy.mod", "time.time", "numpy.shape", "srlife.library.load_material", "numpy.max", "numpy.diff", "numpy.array", "numpy.where", "numpy.sqrt" ]
[((108, 132), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (123, 132), False, 'import os, sys\n'), ((401, 422), 'numpy.mod', 'np.mod', (['times', 'period'], {}), '(times, period)\n', (407, 422), True, 'import numpy as np\n'), ((941, 969), 'numpy.max', 'np.max', (['temperatures'], {'axis':...
""" ckwg +31 Copyright 2020 by Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the ...
[ "kwiver.vital.types.ActivityType", "numpy.array" ]
[((1815, 1819), 'kwiver.vital.types.ActivityType', 'AT', ([], {}), '()\n', (1817, 1819), True, 'from kwiver.vital.types import ActivityType as AT\n'), ((1908, 1923), 'kwiver.vital.types.ActivityType', 'AT', (['"""name"""', '(2.0)'], {}), "('name', 2.0)\n", (1910, 1923), True, 'from kwiver.vital.types import ActivityTyp...