code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#%% import matplotlib.pyplot as plt import numpy as np random_variable_z_x = np.random.normal(0,1,20) random_variable_z_y = np.random.normal(0,1,20) plt.plot(random_variable_z_x,random_variable_z_y, 'ro') plt.axis('off') plt.show() #%% random_variable_z_x = random_variable_z_x/10 + random_variable_z_x/np.linalg.norm(...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.axis", "matplotlib.pyplot.figure", "numpy.random.multivariate_normal", "numpy.linalg.norm", "numpy.random.normal", "numpy.array", "matplotlib.pyplot.savefig" ]
[((78, 104), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(20)'], {}), '(0, 1, 20)\n', (94, 104), True, 'import numpy as np\n'), ((125, 151), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(20)'], {}), '(0, 1, 20)\n', (141, 151), True, 'import numpy as np\n'), ((150, 206), 'matplotlib.pyplot...
# -*- coding: utf-8 -*- r"""Classes for various optimizers (maximizers) and multistarting said optimizers. .. Note:: comments in this module are copied from the header comments in gpp_optimization.hpp. Table of Contents: 1. FILE OVERVIEW 2. OPTIMIZATION OF OBJECTIVE FUNCTIONS a. GRADIENT DESCENT i. OVERVI...
[ "numpy.empty", "numpy.mean", "numpy.array", "collections.namedtuple" ]
[((12767, 12811), 'collections.namedtuple', 'collections.namedtuple', (['"""NullParameters"""', '[]'], {}), "('NullParameters', [])\n", (12789, 12811), False, 'import collections\n'), ((13020, 13150), 'collections.namedtuple', 'collections.namedtuple', (['"""_BaseNewtonParameters"""', "['max_num_steps', 'gamma', 'time_...
import pyevtk from pyevtk import hl import numpy as np R_np = np.load('Radius_Array.npy') X_np = np.load('XCenter.npy') Y_np = np.load('YCenter.npy') Z_np = np.zeros(len(R_np)) # z coordinate needs specification hl.pointsToVTK('XYZR',X_np,Y_np,Z_np,{'radius':R_np})
[ "numpy.load", "pyevtk.hl.pointsToVTK" ]
[((65, 92), 'numpy.load', 'np.load', (['"""Radius_Array.npy"""'], {}), "('Radius_Array.npy')\n", (72, 92), True, 'import numpy as np\n'), ((100, 122), 'numpy.load', 'np.load', (['"""XCenter.npy"""'], {}), "('XCenter.npy')\n", (107, 122), True, 'import numpy as np\n'), ((130, 152), 'numpy.load', 'np.load', (['"""YCenter...
import numpy as np import importlib from pysgd.objectives import Objective # Define general gradient descent algorithm def sgd( theta0, obj='stab_tang', adapt='constant', data=np.array([]), size=50, alpha=.01, epsilon=10**-8, beta1=0.9, beta2=0.999, delta_min=10**-6, iters=1...
[ "importlib.import_module", "pysgd.objectives.Objective", "numpy.square", "numpy.zeros", "numpy.array" ]
[((193, 205), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (201, 205), True, 'import numpy as np\n'), ((547, 573), 'pysgd.objectives.Objective', 'Objective', (['obj', 'data', 'size'], {}), '(obj, data, size)\n', (556, 573), False, 'from pysgd.objectives import Objective\n'), ((781, 819), 'numpy.zeros', 'np.zeros'...
import logging import random import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch import torch.nn as nn from torch.nn import functional as F from tqdm import tqdm from beam_search import beam_decode logger = logging.getLogger(__name__) def set_seed(seed): random.seed(seed) np.ra...
[ "matplotlib.pyplot.title", "numpy.random.seed", "torch.multinomial", "torch.empty", "torch.cat", "numpy.isnan", "matplotlib.pyplot.figure", "torch.cuda.current_device", "torch.no_grad", "pandas.set_option", "matplotlib.pyplot.tight_layout", "pandas.DataFrame", "pandas.reset_option", "torch...
[((239, 266), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (256, 266), False, 'import logging\n'), ((5719, 5734), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5732, 5734), False, 'import torch\n'), ((6711, 6726), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6724, 6726), ...
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Statistical hypothesis testing for comparing benchmark results.""" try: import numpy as np except ImportError: np = None try: from scipy import st...
[ "numpy.log", "scipy.stats.shapiro", "scipy.stats.mannwhitneyu", "scipy.stats.ttest_ind", "scipy.stats.ks_2samp" ]
[((6464, 6485), 'scipy.stats.shapiro', 'stats.shapiro', (['sample'], {}), '(sample)\n', (6477, 6485), False, 'from scipy import stats\n'), ((5819, 5835), 'numpy.log', 'np.log', (['p_values'], {}), '(p_values)\n', (5825, 5835), True, 'import numpy as np\n'), ((7644, 7703), 'scipy.stats.mannwhitneyu', 'stats.mannwhitneyu...
"""Structure numpy.dtypes""" import numpy as np # TODO: replace obstacle_type_linear = np.dtype([ ('p0', np.float64, 2), ('p1', np.float64, 2), ])
[ "numpy.dtype" ]
[((89, 145), 'numpy.dtype', 'np.dtype', (["[('p0', np.float64, 2), ('p1', np.float64, 2)]"], {}), "([('p0', np.float64, 2), ('p1', np.float64, 2)])\n", (97, 145), True, 'import numpy as np\n')]
""" pysteps.verification.lifetime ============================= Estimation of precipitation lifetime from a decaying verification score function (e.g. autocorrelation function). .. autosummary:: :toctree: ../generated/ lifetime lifetime_init lifetime_accum lifetime_compute """ f...
[ "numpy.trapz", "math.exp", "numpy.sum", "numpy.argmax", "numpy.max", "numpy.min", "numpy.array", "scipy.integrate.simps" ]
[((3645, 3665), 'numpy.trapz', 'np.trapz', (['X_s'], {'x': 'X_t'}), '(X_s, x=X_t)\n', (3653, 3665), True, 'import numpy as np\n'), ((3721, 3738), 'scipy.integrate.simps', 'simps', (['X_s'], {'x': 'X_t'}), '(X_s, x=X_t)\n', (3726, 3738), False, 'from scipy.integrate import simps\n'), ((3829, 3842), 'numpy.array', 'np.ar...
import cv2 import numpy as np import time import os img = cv2.imread('test_photo/final_s 0.jpg') mask = np.zeros(img.shape, dtype=np.uint8) max_loc = (320,240) circle_radius = 80; cv2.circle(mask, max_loc, 80, (255, 255, 255), -1, 8, 0) #cv2.circle(mask,) # Apply mask (using bitwise & operator) result_array = img & m...
[ "cv2.imread", "cv2.circle", "numpy.zeros" ]
[((59, 97), 'cv2.imread', 'cv2.imread', (['"""test_photo/final_s 0.jpg"""'], {}), "('test_photo/final_s 0.jpg')\n", (69, 97), False, 'import cv2\n'), ((105, 140), 'numpy.zeros', 'np.zeros', (['img.shape'], {'dtype': 'np.uint8'}), '(img.shape, dtype=np.uint8)\n', (113, 140), True, 'import numpy as np\n'), ((181, 237), '...
import os from .tweetokenize.tokenizer import Tokenizer from collections import Counter import pandas as pd import numpy as np import pickle import keras from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspa...
[ "os.path.abspath", "pickle.dump", "keras.preprocessing.sequence.pad_sequences", "sklearn.model_selection.train_test_split", "pandas.read_csv", "numpy.zeros", "numpy.ones", "pickle.load", "collections.Counter", "os.path.join" ]
[((307, 332), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (322, 332), False, 'import os\n'), ((528, 588), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""pickles"""', '"""pinoy_wv_dict_05.pickle"""'], {}), "(BASE_DIR, 'pickles', 'pinoy_wv_dict_05.pickle')\n", (540, 588), False, 'import o...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np def legendre(N, x): """ Returns the value of Legendre Polynomial P_N(x) at position x[-1, 1]. """ P = np.zeros(2 * N) if N == 0: P[0] = 1 elif N == 1: P[1] = x else: P[0] = 1 P[1] = x for ...
[ "numpy.zeros" ]
[((185, 200), 'numpy.zeros', 'np.zeros', (['(2 * N)'], {}), '(2 * N)\n', (193, 200), True, 'import numpy as np\n')]
from _vasapy import _set import numpy as np class set(_set): def __init__(self, elem): if isinstance(elem, np.ndarray): dtype = elem.dtype elif isinstance(elem, (list, tuple)): elem = np.asarray(elem) dtype = elem.dtype else: dtype = np.dtype(...
[ "numpy.isscalar", "numpy.asarray", "numpy.dtype" ]
[((592, 626), 'numpy.asarray', 'np.asarray', (['elem'], {'dtype': 'self.dtype'}), '(elem, dtype=self.dtype)\n', (602, 626), True, 'import numpy as np\n'), ((690, 724), 'numpy.asarray', 'np.asarray', (['elem'], {'dtype': 'self.dtype'}), '(elem, dtype=self.dtype)\n', (700, 724), True, 'import numpy as np\n'), ((755, 772)...
import numpy as np import cv2 as cv import glob if __name__ == "__main__": image_file_names = glob.glob("/home/vignesh/Documents/COS700/Code/models/research/deeplab/datasets/potsdam/exp/train_on_trainval_set_mobilenetv2/vis/segmentation_results/*prediction.png") image_count = 0 image_file_names.sort() ...
[ "cv2.imwrite", "numpy.zeros", "cv2.imread", "glob.glob" ]
[((101, 279), 'glob.glob', 'glob.glob', (['"""/home/vignesh/Documents/COS700/Code/models/research/deeplab/datasets/potsdam/exp/train_on_trainval_set_mobilenetv2/vis/segmentation_results/*prediction.png"""'], {}), "(\n '/home/vignesh/Documents/COS700/Code/models/research/deeplab/datasets/potsdam/exp/train_on_trainval...
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> import os, os.path from itertools import groupby import numpy as np import csv os.chdir('/home/will/Dropbox/IpythonShare/HIVCov/') # <codecell> def fasta_iter(handle): for key, lines in groupby(handle, lambda x: x.startswith('>')): if ...
[ "csv.reader", "IPython.parallel.Client", "numpy.zeros", "numpy.arange", "numpy.array", "numpy.tile", "numpy.log10", "os.chdir", "numpy.random.shuffle" ]
[((145, 196), 'os.chdir', 'os.chdir', (['"""/home/will/Dropbox/IpythonShare/HIVCov/"""'], {}), "('/home/will/Dropbox/IpythonShare/HIVCov/')\n", (153, 196), False, 'import os, os.path\n'), ((1053, 1069), 'numpy.zeros', 'np.zeros', (['(754,)'], {}), '((754,))\n', (1061, 1069), True, 'import numpy as np\n'), ((2145, 2175)...
import cv2 import numpy as np import torch from torchvision import transforms from PIL import Image from visnav.algo import tools from visnav.algo.base import AlgorithmBase from visnav.algo.image import ImageProc from visnav.algo.tools import Stopwatch, PositioningException from poseilluminet import PoseIllu...
[ "visnav.algo.tools.PositioningException", "cv2.cvtColor", "cv2.imwrite", "torch.load", "cv2.waitKey", "numpy.flipud", "poseilluminet.PoseIllumiDataset.eval_transform", "visnav.algo.tools.angle_between_v", "visnav.algo.image.ImageProc.crop_and_zoom_image", "torch.device", "visnav.algo.image.Image...
[((1371, 1387), 'torch.load', 'torch.load', (['path'], {}), '(path)\n', (1381, 1387), False, 'import torch\n'), ((3003, 3014), 'visnav.algo.tools.Stopwatch', 'Stopwatch', ([], {}), '()\n', (3012, 3014), False, 'from visnav.algo.tools import Stopwatch, PositioningException\n'), ((3290, 3433), 'visnav.algo.image.ImagePro...
""" Metrics for assessing imputation quality Het/Hom ratio Improving imputation quality in BEAGLE for crop and livestock data - switch-error rate for imputation quality - idem ? Comparison and assessment of family- and population-based genotype imputation methods in large pedigrees - Mean squared correla...
[ "pandas.DataFrame", "numpy.multiply", "numpy.log", "os.getcwd", "numpy.power", "sys.path.insert", "scipy.stats.pearsonr", "numpy.diff", "numpy.arange", "pandas.Series", "numpy.array", "pandas.DataFrame.from_records", "genotypooler.poolSNPs.dataframe.PandasMixedVCF", "genotypooler.poolSNPs....
[((4613, 4640), 'sys.path.insert', 'sys.path.insert', (['(0)', 'rootdir'], {}), '(0, rootdir)\n', (4628, 4640), False, 'import os, sys\n'), ((5436, 5494), 'genotypooler.poolSNPs.dataframe.PandasMixedVCF', 'vcfdf.PandasMixedVCF', (['truefile'], {'format': '"""GT"""', 'indextype': 'idx'}), "(truefile, format='GT', indext...
from typing import Sequence from acme import specs from acme.jax import networks as networks_lib from acme.jax import utils as jax_utils import haiku as hk import jax import jax.numpy as jnp import numpy as onp def make_networks( spec: specs.EnvironmentSpec, policy_layer_sizes: Sequence[int] = (256, 256), ...
[ "jax.numpy.squeeze", "acme.jax.utils.zeros_like", "jax.numpy.concatenate", "acme.jax.networks.NormalTanhDistribution", "haiku.initializers.VarianceScaling", "acme.jax.utils.add_batch_dim", "haiku.transform", "numpy.prod" ]
[((445, 484), 'numpy.prod', 'onp.prod', (['spec.actions.shape'], {'dtype': 'int'}), '(spec.actions.shape, dtype=int)\n', (453, 484), True, 'import numpy as onp\n'), ((1993, 2027), 'acme.jax.utils.zeros_like', 'jax_utils.zeros_like', (['spec.actions'], {}), '(spec.actions)\n', (2013, 2027), True, 'from acme.jax import u...
import numpy as np from manim import cartesian_to_spherical, spherical_to_cartesian def test_polar_coords(): a = np.array([1, 1, 0]) b = (2, np.pi / 2, np.pi / 2) assert all( np.round(cartesian_to_spherical(a), 4) == np.round([2 ** 0.5, np.pi / 4, np.pi / 2], 4), ) assert all(np.r...
[ "manim.spherical_to_cartesian", "numpy.round", "numpy.array", "manim.cartesian_to_spherical" ]
[((120, 139), 'numpy.array', 'np.array', (['[1, 1, 0]'], {}), '([1, 1, 0])\n', (128, 139), True, 'import numpy as np\n'), ((248, 293), 'numpy.round', 'np.round', (['[2 ** 0.5, np.pi / 4, np.pi / 2]', '(4)'], {}), '([2 ** 0.5, np.pi / 4, np.pi / 2], 4)\n', (256, 293), True, 'import numpy as np\n'), ((358, 377), 'numpy.a...
""" Copyright 2019 <NAME>, <NAME> This file is part of A2DR. A2DR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. A2DR is distributed in t...
[ "a2dr.a2dr", "numpy.random.seed", "scipy.sparse.vstack", "numpy.random.randn", "numpy.empty", "networkx.cycle_graph", "networkx.laplacian_matrix", "numpy.zeros", "scipy.sparse.csc_matrix", "matplotlib.use", "scipy.sparse.eye" ]
[((813, 836), 'matplotlib.use', 'matplotlib.use', (['"""TKAgg"""'], {}), "('TKAgg')\n", (827, 836), False, 'import matplotlib\n'), ((1222, 1239), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1236, 1239), True, 'import numpy as np\n'), ((1754, 1771), 'networkx.cycle_graph', 'nx.cycle_graph', (['K'], {...
""" Copyright 2013 Lyst 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 ag...
[ "scipy.sparse.issparse", "numpy.zeros", "math.pow" ]
[((899, 917), 'scipy.sparse.issparse', 'sparse.issparse', (['X'], {}), '(X)\n', (914, 917), False, 'from scipy import sparse\n'), ((1260, 1287), 'math.pow', 'math.pow', (['scaling_factor', '(2)'], {}), '(scaling_factor, 2)\n', (1268, 1287), False, 'import math\n'), ((1039, 1068), 'numpy.zeros', 'np.zeros', (['self.dime...
"""Contains functions that aid in the HEOM simulation process via QuTiP's HEOM Solver.""" import numpy as np def system_bath_coupling_op(sites: int = 2) -> np.ndarray: """ Builds an N x N operator for the system-bath coupling, where N is the number of sites in the system. Currently only supports buil...
[ "numpy.array" ]
[((868, 895), 'numpy.array', 'np.array', (['[[1, 0], [0, -1]]'], {}), '([[1, 0], [0, -1]])\n', (876, 895), True, 'import numpy as np\n')]
# Figure 5, panels (e), (f), (g) and (h) import sys sys.path.append("../../") device_str, lang, _dpi = sys.argv[1], sys.argv[2], int(sys.argv[3]) ########################################################### from pathlib import Path reproduced_results = Path("reproduced-results") from sympy import exp as sp_exp from...
[ "sys.path.append", "sympy.symbols", "matplotlib.rc", "idpy.Utils.ManageData.ManageData", "numpy.amin", "numpy.log", "sklearn.neighbors.KernelDensity", "matplotlib.pyplot.close", "matplotlib.pyplot.subplot2grid", "numpy.zeros", "numpy.amax", "pathlib.Path", "matplotlib.pyplot.figure", "mpl_...
[((53, 78), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (68, 78), False, 'import sys\n'), ((256, 282), 'pathlib.Path', 'Path', (['"""reproduced-results"""'], {}), "('reproduced-results')\n", (260, 282), False, 'from pathlib import Path\n'), ((536, 551), 'sympy.symbols', 'sp_symbols', (...
import sys import os import logging import random import numpy as np from time import time from argparse import ArgumentParser from threading import Thread from clair.model import Clair import clair.utils as utils import clair.evaluate as evaluate import shared.param as param logging.basicConfig(format='%(message)s',...
[ "numpy.random.seed", "argparse.ArgumentParser", "clair.model.Clair", "clair.utils.new_mini_batch", "numpy.shape", "numpy.arange", "clair.utils.no_of_blosc_blocks_from", "clair.utils.dataset_info_from", "os.path.abspath", "numpy.append", "clair.utils.setup_environment", "random.seed", "numpy....
[((279, 340), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(message)s"""', 'level': 'logging.INFO'}), "(format='%(message)s', level=logging.INFO)\n", (298, 340), False, 'import logging\n'), ((2409, 2429), 'numpy.split', 'np.split', (['array', '[n]'], {}), '(array, [n])\n', (2417, 2429), True, 'imp...
import numpy as np def ReLU(z): return np.maximum(z, 0) def sigmoid(z): return (1+np.exp(-z))**(-1) def TanH(z): return (np.exp(z) - np.exp(-z))/2 def softmax(z): return np.exp(z)/np.sum(np.exp(z)) ##### Derivatives ###### def ReLU_deriv(z): z[z <= 0] = 0 z[z > 0] = 1 return z de...
[ "numpy.sum", "numpy.maximum", "numpy.exp" ]
[((44, 60), 'numpy.maximum', 'np.maximum', (['z', '(0)'], {}), '(z, 0)\n', (54, 60), True, 'import numpy as np\n'), ((458, 467), 'numpy.exp', 'np.exp', (['z'], {}), '(z)\n', (464, 467), True, 'import numpy as np\n'), ((193, 202), 'numpy.exp', 'np.exp', (['z'], {}), '(z)\n', (199, 202), True, 'import numpy as np\n'), ((...
""" Copyright 2020 The Secure, Reliable, and Intelligent Systems Lab, ETH Zurich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by appl...
[ "pandas.DataFrame", "argparse.ArgumentParser", "attack_generator.FixedCAttackGenerator", "pandas.read_csv", "utils.convert_from_tensor", "sys.path.insert", "utils.makedir", "numpy.array", "torch.device", "attack_generator.FixedEpsilonAttackGenerator", "os.path.join", "pandas.concat", "utils....
[((710, 738), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""common"""'], {}), "(0, 'common')\n", (725, 738), False, 'import sys\n'), ((739, 779), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""dataset/generation"""'], {}), "(0, 'dataset/generation')\n", (754, 779), False, 'import sys\n'), ((780, 808), 'sys.pat...
import numpy def getstat(thing, stat): if stat == 'snr': # signal-to-noise ratio m = thing.mean() s = thing.std() return m / s elif stat == 'cv': m = thing.mean() s = thing.std() return s / m elif stat == 'fano': m = thing.mean() v = thing.v...
[ "pandas.DataFrame", "numpy.asarray", "pandas.Series" ]
[((1191, 1207), 'numpy.asarray', 'numpy.asarray', (['x'], {}), '(x)\n', (1204, 1207), False, 'import numpy\n'), ((1240, 1256), 'pandas.Series', 'pandas.Series', (['x'], {}), '(x)\n', (1253, 1256), False, 'import pandas\n'), ((1279, 1298), 'pandas.DataFrame', 'pandas.DataFrame', (['x'], {}), '(x)\n', (1295, 1298), False...
import climpy.utils.mie_utils as mie import climpy.utils.aeronet_utils as aeronet import matplotlib.pyplot as plt import numpy as np import datetime as dt import os from climpy.utils.plotting_utils import JGR_page_width_inches, save_figure_bundle from climpy.utils.stats_utils import get_cdf __author__ = '<NAME> <<EMAI...
[ "matplotlib.pyplot.xscale", "matplotlib.pyplot.title", "os.path.expanduser", "numpy.log", "matplotlib.pyplot.plot", "matplotlib.pyplot.axes", "numpy.logspace", "matplotlib.pyplot.legend", "climpy.utils.plotting_utils.JGR_page_width_inches", "datetime.datetime", "numpy.append", "matplotlib.pypl...
[((1670, 1712), 'numpy.interp', 'np.interp', (['wls', "ri_vo['wl']", "ri_vo['data']"], {}), "(wls, ri_vo['wl'], ri_vo['data'])\n", (1679, 1712), True, 'import numpy as np\n'), ((1809, 1832), 'numpy.logspace', 'np.logspace', (['(-3)', '(2)', '(100)'], {}), '(-3, 2, 100)\n', (1820, 1832), True, 'import numpy as np\n'), (...
import pytest import numpy as np from copy import copy from orbit.models.dlt import DLTFull, DLTAggregated, DLTMAP from orbit.estimators.stan_estimator import StanEstimatorMCMC, StanEstimatorVI from orbit.initializer.dlt import DLTInitializer @pytest.mark.parametrize("model_class", [DLTMAP, DLTFull, DLTAggregated]) ...
[ "orbit.models.dlt.DLTFull", "numpy.log", "numpy.sum", "numpy.allclose", "copy.copy", "orbit.models.dlt.DLTAggregated", "orbit.models.dlt.DLTMAP", "pytest.mark.parametrize" ]
[((247, 319), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model_class"""', '[DLTMAP, DLTFull, DLTAggregated]'], {}), "('model_class', [DLTMAP, DLTFull, DLTAggregated])\n", (270, 319), False, 'import pytest\n'), ((833, 912), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""estimator_type"""', ...
import gym import numpy as np import torch from paper_rl.architecture.ac.core import mlp from paper_rl.logger.logger import Logger import torch.nn as nn from paper_rl.modelfree.gail import GAIL from paper_rl.architecture.ac.mlp import MLPActorCritic from stable_baselines3.common.env_util import make_vec_env import os....
[ "stable_baselines3.common.env_util.make_vec_env", "numpy.random.seed", "paper_rl.logger.logger.Logger", "numpy.log", "torch.hstack", "torch.manual_seed", "os.path.dirname", "torch.as_tensor", "paper_rl.architecture.ac.mlp.MLPActorCritic", "torch.tensor", "torch.no_grad", "paper_rl.modelfree.ga...
[((639, 679), 'stable_baselines3.common.env_util.make_vec_env', 'make_vec_env', (['env_id', 'num_cpu'], {'seed': 'seed'}), '(env_id, num_cpu, seed=seed)\n', (651, 679), False, 'from stable_baselines3.common.env_util import make_vec_env\n'), ((684, 707), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\...
# -*- coding: utf8 -*- #time:2017/9/18 10:04 #VERSION:1.0 #__OUTHOR__:guangguang #Email:<EMAIL> import numpy as np class Perceptron(object): """Perceptron classifier. Parameters ------------ eta:float Learning rate (between 0.0 and 1.0) n_iter:int Passes over the training ...
[ "numpy.dot", "numpy.zeros" ]
[((1055, 1079), 'numpy.zeros', 'np.zeros', (['(1 + X.shape[1])'], {}), '(1 + X.shape[1])\n', (1063, 1079), True, 'import numpy as np\n'), ((1584, 1606), 'numpy.dot', 'np.dot', (['X', 'self.w_[1:]'], {}), '(X, self.w_[1:])\n', (1590, 1606), True, 'import numpy as np\n')]
import tacoma as tc import networkx as nx import numpy as np import pylab as pl import seaborn as sns N = 5 sfig, sax = pl.subplots(1,2,figsize=(10,5)) neighbor_affinity = [ ([ 1, 2 ], [ 0.9, 0.1]), ([ 0, 2 ], [ 0.9, 0.9]), ([ 0, 1, 3 ], [ 0.1,...
[ "pylab.show", "tacoma.flockwork_P_varying_rates_neighbor_affinity", "numpy.zeros", "pylab.subplots", "numpy.max", "numpy.array", "networkx.Graph" ]
[((122, 156), 'pylab.subplots', 'pl.subplots', (['(1)', '(2)'], {'figsize': '(10, 5)'}), '(1, 2, figsize=(10, 5))\n', (133, 156), True, 'import pylab as pl\n'), ((455, 471), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (463, 471), True, 'import numpy as np\n'), ((703, 901), 'tacoma.flockwork_P_varying_rat...
from ringity.ring_scores import ring_score_from_persistence_diagram from ringity.centralities import net_flow, resistance from ringity.classes.diagram import PersistenceDiagram from ringity.readwrite.prompts import _yes_or_no, _assertion_statement from ringity.classes.exceptions import UnknownGraphType from gtda.homolo...
[ "networkx.floyd_warshall_numpy", "networkx.edge_current_flow_betweenness_centrality", "networkx.edge_betweenness_centrality", "ringity.classes.exceptions.UnknownGraphType", "networkx.set_edge_attributes", "ringity.centralities.net_flow", "networkx.number_of_selfloops", "ringity.classes.diagram.Persist...
[((1393, 1486), 'ringity.ring_scores.ring_score_from_persistence_diagram', 'ring_score_from_persistence_diagram', ([], {'dgm': 'dgm', 'flavour': 'flavour', 'base': 'base', 'nb_pers': 'nb_pers'}), '(dgm=dgm, flavour=flavour, base=base,\n nb_pers=nb_pers)\n', (1428, 1486), False, 'from ringity.ring_scores import ring_...
import math import numpy as np from matplotlib import pyplot as plt import root_finder import random import pylab class ProblemParameters: def __init__(self): self.L0 = 0.01 self.H0 = 0.005 self.U0 = 0.31297739987328533717 self.epsilon = self.H0 / self.L0 self.A1 = 0.001 ...
[ "numpy.random.uniform", "matplotlib.pyplot.plot", "math.sqrt", "matplotlib.pyplot.scatter", "matplotlib.pyplot.close", "pylab.arrow", "matplotlib.pyplot.axis", "math.sin", "root_finder.FindRootBisection", "math.cos", "numpy.linspace" ]
[((9008, 9042), 'numpy.linspace', 'np.linspace', (['(0)', 'pp.L0', 'pp.n_points'], {}), '(0, pp.L0, pp.n_points)\n', (9019, 9042), True, 'import numpy as np\n'), ((9252, 9290), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1.0)', 'n_particles'], {}), '(0, 1.0, n_particles)\n', (9269, 9290), True, 'import nump...
from algs.performance_pred.units.conv_unit import ConvUnit from algs.performance_pred.units.pool_unit import MaxPool, AvgPool from algs.performance_pred.units.full_layer import FullConnLayer import numpy as np import hashlib class CNN(): def __init__(self, _id, params): self.id = 'indi%05d' % (_id) ...
[ "algs.performance_pred.units.full_layer.FullConnLayer", "algs.performance_pred.units.pool_unit.AvgPool", "algs.performance_pred.units.conv_unit.ConvUnit", "numpy.random.randint", "numpy.int", "hashlib.sha224", "numpy.random.choice", "algs.performance_pred.units.pool_unit.MaxPool" ]
[((2513, 2568), 'numpy.random.randint', 'np.random.randint', (['self.min_length', '(self.max_length + 1)'], {}), '(self.min_length, self.max_length + 1)\n', (2530, 2568), True, 'import numpy as np\n'), ((7461, 7500), 'numpy.int', 'np.int', (['((kernel_size - stride_size) / 2)'], {}), '((kernel_size - stride_size) / 2)\...
import numpy as np from typing import List from src.data.skew_normal_drift_stream import SkewNormalDriftStream class MeanDriftStream(SkewNormalDriftStream): """ Meandrift stream. The meandrift stream is an artificial generated univariate data stream described in [1]_. Parameters ---------- n_sa...
[ "numpy.tile", "numpy.linspace" ]
[((1665, 1730), 'numpy.tile', 'np.tile', (['(1 / self._n_components)', '(self._n_components, n_segments)'], {}), '(1 / self._n_components, (self._n_components, n_segments))\n', (1672, 1730), True, 'import numpy as np\n'), ((1198, 1220), 'numpy.tile', 'np.tile', (['(1)', 'n_segments'], {}), '(1, n_segments)\n', (1205, 1...
# Created by <NAME> import torch import time import datetime import os import numpy as np import copy import logging from torch.autograd import grad import random from cross_loss_influence.helpers.bolukbasi_prior_work.prior_pca_debiasing import extract_txt_embeddings from torch.utils.data.dataloader import DataLoader ...
[ "numpy.set_printoptions", "numpy.random.seed", "torch.random.manual_seed", "cross_loss_influence.models.small_mlp.target_distribution", "torch.autograd.grad", "torch.sum", "torch.load", "torch.nn.KLDivLoss", "cross_loss_influence.data.scripts.generate_mog_data.plot_mog_data", "torch.nn.NLLLoss", ...
[((963, 1003), 'torch.utils.data.dataloader.DataLoader', 'DataLoader', (['train_dataset'], {'shuffle': '(False)'}), '(train_dataset, shuffle=False)\n', (973, 1003), False, 'from torch.utils.data.dataloader import DataLoader\n'), ((1223, 1263), 'torch.utils.data.dataloader.DataLoader', 'DataLoader', (['train_dataset'], ...
import numpy as np from scipy.ndimage.filters import convolve, gaussian_filter from scipy.misc import imread, imshow def gauss2D(shape=(3,3),sigma=0.5): """ 2D gaussian mask """ m,n = [(i-1.)/2. for i in shape] # Centre the indices around 0 y,x = np.ogrid[-m:m+1,-n:n+1] h = np.exp( -(x*x + y*y...
[ "numpy.zeros", "numpy.finfo", "numpy.max", "numpy.bitwise_and", "numpy.exp", "numpy.bitwise_or", "numpy.sqrt" ]
[((301, 349), 'numpy.exp', 'np.exp', (['(-(x * x + y * y) / (2.0 * sigma * sigma))'], {}), '(-(x * x + y * y) / (2.0 * sigma * sigma))\n', (307, 349), True, 'import numpy as np\n'), ((696, 744), 'numpy.exp', 'np.exp', (['(-(x * x + y * y) / (2.0 * sigma * sigma))'], {}), '(-(x * x + y * y) / (2.0 * sigma * sigma))\n', ...
# -*- coding: utf-8 -*- from __future__ import absolute_import import numpy as np import json from nltk import word_tokenize, sent_tokenize def load_task(train_file, dev_file, test_file): ''' Returns a tuple containing the training and testing data for the task. ''' train_data = get_stories(train_fi...
[ "nltk.sent_tokenize", "json.load", "numpy.array", "nltk.word_tokenize" ]
[((2844, 2855), 'numpy.array', 'np.array', (['S'], {}), '(S)\n', (2852, 2855), True, 'import numpy as np\n'), ((2857, 2868), 'numpy.array', 'np.array', (['Q'], {}), '(Q)\n', (2865, 2868), True, 'import numpy as np\n'), ((2870, 2881), 'numpy.array', 'np.array', (['A'], {}), '(A)\n', (2878, 2881), True, 'import numpy as ...
import numpy as np from keras.layers.core import Dense from keras.layers.recurrent import Recurrent, LSTM from keras import initializations, activations from keras import backend as K # from theano.printing import Print class DeepLSTM(Recurrent): '''Seq2Seq Deep Long-Short Term Memory unit. Inspired byt Sut...
[ "keras.backend.dot", "keras.layers.core.Dense", "keras.backend.concatenate", "keras.activations.get", "keras.backend.zeros_like", "keras.backend.sum", "keras.backend.zeros", "keras.backend.ndim", "numpy.cumsum", "keras.layers.recurrent.LSTM", "keras.initializations.get", "keras.backend.max" ]
[((1143, 1168), 'keras.initializations.get', 'initializations.get', (['init'], {}), '(init)\n', (1162, 1168), False, 'from keras import initializations, activations\n'), ((1195, 1226), 'keras.initializations.get', 'initializations.get', (['inner_init'], {}), '(inner_init)\n', (1214, 1226), False, 'from keras import ini...
#!/usr/bin/env python # # test_melodicimage.py - # # Author: <NAME> <<EMAIL>> # from __future__ import division import os.path as op import numpy as np import nibabel as nib import pytest import tests import fsl.data.image as fslimage import fsl.data.melodicimage as meli import fsl.data.melodicanaly...
[ "fsl.data.melodicanalysis.getReportFile", "numpy.arange", "os.path.join", "numpy.prod", "numpy.savetxt", "fsl.data.image.Image", "pytest.raises", "numpy.ceil", "fsl.data.melodicimage.MelodicImage", "tests.testdir", "tests.make_dummy_files", "tests.make_dummy_file", "fsl.data.melodicanalysis....
[((771, 803), 'os.path.join', 'op.join', (['basedir', '"""toplevel.ica"""'], {}), "(basedir, 'toplevel.ica')\n", (778, 803), True, 'import os.path as op\n'), ((821, 851), 'os.path.join', 'op.join', (['tldir', '"""analysis.ica"""'], {}), "(tldir, 'analysis.ica')\n", (828, 851), True, 'import os.path as op\n'), ((871, 91...
import subprocess, sys, time import json, numpy, mxnet import asyncio import cv2 import pose_estimation, stream_twitch FFMPEG= 'ffmpeg' FFPROBE = 'ffprobe' def get_stream_resolution(stream_name): metadata = {} while 'streams' not in metadata: info = subprocess.run([FFPROBE, '-v', 'quiet', '-print_format', 'jso...
[ "asyncio.gather", "subprocess.run", "subprocess.Popen", "asyncio.sleep", "cv2.imwrite", "numpy.frombuffer", "time.sleep", "stream_twitch.loop_send_frame", "asyncio.Queue" ]
[((1415, 1443), 'cv2.imwrite', 'cv2.imwrite', (['"""test.jpg"""', 'img'], {}), "('test.jpg', img)\n", (1426, 1443), False, 'import cv2\n'), ((1564, 1739), 'subprocess.Popen', 'subprocess.Popen', (["[FFMPEG, '-i', stream_name, '-loglevel', 'quiet', '-an', '-f', 'image2pipe',\n '-pix_fmt', 'bgr24', '-vcodec', 'rawvide...
from __future__ import print_function, division, absolute_import import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt from odin.utils import ArgController args = ArgController( ).add('--seg', 'force re-run audio segmentation', False ).add('--debug', 'enable debugging', False ).parse() import o...
[ "six.moves.cPickle.dump", "odin.preprocessing.base.DeltaExtractor", "collections.defaultdict", "os.path.isfile", "odin.preprocessing.calculate_pca", "const.utt_id", "os.path.join", "odin.preprocessing.speech.AudioReader", "odin.preprocessing.base.StackFeatures", "odin.fuel.Dataset", "numpy.genfr...
[((84, 105), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (98, 105), False, 'import matplotlib\n'), ((5576, 5593), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (5587, 5593), False, 'from collections import defaultdict\n'), ((5643, 5661), 'collections.defaultdict', 'defa...
import argparse from shutil import copyfile import numpy as np from tensorboard.backend.event_processing.event_multiplexer import EventMultiplexer from paths import LOG_DIR, MODEL_DIR from featnames import MODELS, DISCRIM_MODELS def get_lnl(em=None, run=None, name=None): tuples = em.Scalars(run, 'lnL_{}'.format(n...
[ "argparse.ArgumentParser", "tensorboard.backend.event_processing.event_multiplexer.EventMultiplexer", "numpy.argmax" ]
[((707, 721), 'numpy.argmax', 'np.argmax', (['lnl'], {}), '(lnl)\n', (716, 721), True, 'import numpy as np\n'), ((996, 1021), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1019, 1021), False, 'import argparse\n'), ((460, 478), 'tensorboard.backend.event_processing.event_multiplexer.EventMulti...
#!/usr/bin/python -u # + from SeqDataset import * #import pandas as pd import numpy as np import argparse import random import math import time #import matplotlib.pyplot as plt from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler from torch.nn.functional import softmax, relu...
[ "numpy.random.seed", "seq2func.evaluate", "torch.device", "torch.no_grad", "torch.nn.MSELoss", "torch.load", "random.seed", "torchtext.data.TabularDataset.splits", "random.setstate", "seq2func.count_parameters", "seq2func.Seq2Func", "torch.manual_seed", "torch.cuda.manual_seed", "torch.cud...
[((893, 910), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (904, 910), False, 'import random\n'), ((916, 933), 'random.getstate', 'random.getstate', ([], {}), '()\n', (931, 933), False, 'import random\n'), ((934, 954), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (948, 954), True, 'im...
"Runs the quadrants test problem with the HLLC solver." from __future__ import absolute_import import numpy as np import os from . import quadrants def test_quadrants(): claw = quadrants.setup(riemann_solver='hlle') claw.run() hlle = claw.solution.state.get_q_global() if hlle is not None: this...
[ "os.path.dirname", "nose.main", "numpy.linalg.norm", "os.path.join" ]
[((624, 635), 'nose.main', 'nose.main', ([], {}), '()\n', (633, 635), False, 'import nose\n'), ((326, 351), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (341, 351), False, 'import os\n'), ((500, 547), 'numpy.linalg.norm', 'np.linalg.norm', (['(expected_density - test_density)'], {}), '(expe...
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import dace from dace.transformation.dataflow import GPUTransformMap, InLocalStorage import numpy as np import pytest N = dace.symbol('N') @dace.program(dace.float64[N], dace.float64[N]) def cudahello(A, Vout): @dace.mapscope(_[0:ceilin...
[ "dace.float64", "dace.ndarray", "numpy.linalg.norm", "dace.symbol", "dace.program" ]
[((200, 216), 'dace.symbol', 'dace.symbol', (['"""N"""'], {}), "('N')\n", (211, 216), False, 'import dace\n'), ((220, 266), 'dace.program', 'dace.program', (['dace.float64[N]', 'dace.float64[N]'], {}), '(dace.float64[N], dace.float64[N])\n', (232, 266), False, 'import dace\n'), ((627, 658), 'dace.ndarray', 'dace.ndarra...
import numpy as np from PIL import Image from matplotlib import pyplot as plt import math import cv2 def image_resize(image, width = None, height = None, inter = cv2.INTER_AREA): # initialize the dimensions of the image to be resized and # grab the image size dim = None (h, w) = image.shape[:2] # ...
[ "numpy.load", "matplotlib.pyplot.show", "cv2.cvtColor", "cv2.imwrite", "cv2.imread", "numpy.array", "matplotlib.pyplot.subplots", "cv2.resize" ]
[((1026, 1064), 'numpy.load', 'np.load', (['"""segment_output/original.npy"""'], {}), "('segment_output/original.npy')\n", (1033, 1064), True, 'import numpy as np\n'), ((1071, 1121), 'cv2.imread', 'cv2.imread', (['"""input/original.png"""', 'cv2.IMREAD_COLOR'], {}), "('input/original.png', cv2.IMREAD_COLOR)\n", (1081, ...
from __future__ import print_function, absolute_import import numpy as np from numba import ocl from numba.ocl.testing import unittest from numba.ocl.testing import OCLTestCase class TestOclComplex(OCLTestCase): def test_ocl_complex_arg(self): @ocl.jit def foo(a, b): i = ocl.get_global...
[ "numba.ocl.get_global_id", "numpy.arange", "numba.ocl.testing.unittest.main", "numpy.allclose" ]
[((532, 547), 'numba.ocl.testing.unittest.main', 'unittest.main', ([], {}), '()\n', (545, 547), False, 'from numba.ocl.testing import unittest\n'), ((363, 396), 'numpy.arange', 'np.arange', (['(5)'], {'dtype': 'np.complex128'}), '(5, dtype=np.complex128)\n', (372, 396), True, 'import numpy as np\n'), ((306, 326), 'numb...
#!/usr/bin/env python # coding: utf-8 import numpy as np # Table Utilities def is_associative(table): indices = range(len(table)) result = True for a in indices: for b in indices: for c in indices: ab = table[a][b] bc = table[b][c] if n...
[ "numpy.where", "pprint.pprint" ]
[((1485, 1512), 'numpy.where', 'np.where', (['(table == identity)'], {}), '(table == identity)\n', (1493, 1512), True, 'import numpy as np\n'), ((2908, 2922), 'pprint.pprint', 'pp.pprint', (['tbl'], {}), '(tbl)\n', (2917, 2922), True, 'import pprint as pp\n')]
from PyDSS.pyContrReader import read_controller_settings_from_registry from PyDSS.ProfileManager.ProfileStore import ProfileManager from PyDSS.dssElementFactory import create_dss_element from PyDSS.utils.utils import make_human_readable_size from PyDSS.pyContrReader import pyContrReader as pcr from PyDSS.pyPlotReader i...
[ "PyDSS.pyPlots.pyPlots.Create", "PyDSS.dssElementFactory.create_dss_element", "PyDSS.dssBus.dssBus", "json.dumps", "opendssdirect.utils.run_command", "numpy.arange", "PyDSS.helics_interface.helics_interface", "PyDSS.SolveMode.GetSolver", "PyDSS.pyPlotReader.pyPlotReader", "os.path.join", "os.chd...
[((1518, 1590), 'os.path.join', 'os.path.join', (['rootPath', "params['Project']['Active Project']", '"""Scenarios"""'], {}), "(rootPath, params['Project']['Active Project'], 'Scenarios')\n", (1530, 1590), False, 'import os\n'), ((2840, 2869), 'PyDSS.pyLogger.getLoggerTag', 'pyLogger.getLoggerTag', (['params'], {}), '(...
from __future__ import division from __future__ import print_function import numpy as np from datetime import datetime def onehot_encoding(label, max_num_class): encoding = np.eye(max_num_class) encoding = encoding[label] return encoding def calculate_acc(output, label): correct = np.sum(np.argmax(o...
[ "numpy.eye", "datetime.datetime.now", "numpy.argmax" ]
[((179, 200), 'numpy.eye', 'np.eye', (['max_num_class'], {}), '(max_num_class)\n', (185, 200), True, 'import numpy as np\n'), ((408, 422), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (420, 422), False, 'from datetime import datetime\n'), ((309, 334), 'numpy.argmax', 'np.argmax', (['output'], {'axis': '(1...
import numpy as np from torchvision.transforms.transforms import ToPILImage import cv2 from PIL.Image import NEAREST import torch from torch.utils.data import Dataset, DataLoader from torchvision import transforms from torchvision.datasets import FashionMNIST, VOCSegmentation import pytorch_lightning as pl from typ...
[ "torch.utils.data.DataLoader", "cv2.cvtColor", "numpy.asarray", "numpy.zeros", "numpy.all", "torchvision.transforms.ToPILImage", "torchvision.transforms.ToTensor", "cv2.imread", "torchvision.transforms.CenterCrop", "torchvision.transforms.Normalize", "torch.is_tensor", "torch.tensor", "torch...
[((1464, 1484), 'torch.is_tensor', 'torch.is_tensor', (['idx'], {}), '(idx)\n', (1479, 1484), False, 'import torch\n'), ((4762, 4889), 'torch.utils.data.DataLoader', 'DataLoader', (['self.train_set'], {'batch_size': 'self.batch_size', 'shuffle': 'self.shuffle', 'num_workers': 'self.num_workers', 'pin_memory': '(True)'}...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tools and utilities for the sims module. """ from __future__ import print_function, division import re import os import io import json import warnings import datetime import numpy as np import pandas as pd from skimage.feature import register_translation from scipy.ndim...
[ "numpy.iinfo", "json.dumps", "matplotlib.pyplot.figure", "skimage.feature.register_translation", "pandas.Panel4D", "pyfits.HDUList", "matplotlib.patches.Rectangle", "numpy.finfo", "pandas.Panel", "io.open", "numpy.log10", "json.JSONEncoder.default", "matplotlib.pyplot.show", "re.split", ...
[((4435, 4445), 'matplotlib.pyplot.show', 'mpl.show', ([], {}), '()\n', (4443, 4445), True, 'import matplotlib.pyplot as mpl\n'), ((5099, 5111), 'matplotlib.pyplot.figure', 'mpl.figure', ([], {}), '()\n', (5109, 5111), True, 'import matplotlib.pyplot as mpl\n'), ((6676, 6721), 'matplotlib.collections.PatchCollection', ...
from unittest import TestCase import numpy import six from phi import struct from phi.physics.collective import StateCollection from phi.physics.domain import Domain from phi.physics.fluid import Fluid from phi.physics.world import World class TestWorld(TestCase): def test_names(self): c = StateCollect...
[ "phi.struct.map", "phi.physics.world.World", "phi.physics.domain.Domain", "numpy.testing.assert_equal", "phi.physics.collective.StateCollection" ]
[((308, 325), 'phi.physics.collective.StateCollection', 'StateCollection', ([], {}), '()\n', (323, 325), False, 'from phi.physics.collective import StateCollection\n'), ((606, 672), 'numpy.testing.assert_equal', 'numpy.testing.assert_equal', (['c.fluid.density.data.shape', '[1, 80, 1]'], {}), '(c.fluid.density.data.sha...
from time import time import math import numpy as np '''Building the CIFAR-10 VGG-Net Summary of available functions: ''' CACHE_DIR = '/home/ubuntu/notebook/tensorboard/vgg-cifar10' # CACHE_DIR = '/Users/Zhang/Research/Programming/Learning-Tensorflow-by-Models' def load_cifar10(path=None): if path is Non...
[ "numpy.std", "numpy.mean", "cPickle.load", "numpy.vstack" ]
[((1083, 1135), 'numpy.vstack', 'np.vstack', (["(batch['data'] for batch in _train_batches)"], {}), "(batch['data'] for batch in _train_batches)\n", (1092, 1135), True, 'import numpy as np\n'), ((1307, 1317), 'numpy.mean', 'np.mean', (['R'], {}), '(R)\n', (1314, 1317), True, 'import numpy as np\n'), ((1331, 1341), 'num...
import numpy as np import pytest from flme.lme_forecast_verbose import LME import flme.rutils as rutils class TestLME: """Tests for `lme.lme_forecast_verbose` """ @pytest.mark.parametrize("dimensions", [[5, 4, 3, 2], [5, 4, 1, 2]]) @pytest.mark.parametrize("random_intercept", [[5, 4, 1, 1], [5, 1, 1, 1],...
[ "numpy.random.seed", "numpy.random.randn", "numpy.zeros", "numpy.ones", "numpy.var", "numpy.all", "numpy.transpose", "numpy.mean", "numpy.linalg.norm", "flme.lme_forecast_verbose.LME", "pytest.mark.parametrize", "flme.rutils.kronecker", "numpy.prod", "numpy.sqrt" ]
[((175, 242), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dimensions"""', '[[5, 4, 3, 2], [5, 4, 1, 2]]'], {}), "('dimensions', [[5, 4, 3, 2], [5, 4, 1, 2]])\n", (198, 242), False, 'import pytest\n'), ((248, 339), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""random_intercept"""', '[[5, 4,...
# Author: <NAME> from __future__ import absolute_import, division, print_function import math, logging, numpy as np, random from itertools import izip from collections import Counter from ..utils import * from .. import reference from ..options import options from ..Worker import WorkerProcess, WorkerThread from ..Res...
[ "numpy.log", "random.seed", "itertools.izip", "numpy.exp", "collections.Counter", "numpy.log10", "numpy.repeat" ]
[((11288, 11299), 'numpy.log', 'np.log', (['EPS'], {}), '(EPS)\n', (11294, 11299), True, 'import math, logging, numpy as np, random\n'), ((11314, 11329), 'numpy.log', 'np.log', (['(1 - EPS)'], {}), '(1 - EPS)\n', (11320, 11329), True, 'import math, logging, numpy as np, random\n'), ((11344, 11365), 'numpy.log', 'np.log...
import time import numpy as np import random from MOCU import * def findRandomSequence(save_f_inv, D_save, init_MOCU_val, K_max, w, N, h , M, T, a_lower_bound_update, a_upper_bound_update, it_idx, update_cnt): optimalExperiments = [] #aaa = np.zeros((N,N)) timeComplexity = np.ones(update_...
[ "random.shuffle", "numpy.asarray", "numpy.zeros", "numpy.ones", "time.time", "numpy.mean" ]
[((305, 324), 'numpy.ones', 'np.ones', (['update_cnt'], {}), '(update_cnt)\n', (312, 324), True, 'import numpy as np\n'), ((417, 437), 'numpy.zeros', 'np.zeros', (['update_cnt'], {}), '(update_cnt)\n', (425, 437), True, 'import numpy as np\n'), ((450, 470), 'numpy.zeros', 'np.zeros', (['update_cnt'], {}), '(update_cnt)...
import os import sys import configparser import matplotlib matplotlib.use('Agg') # Don't try to use X forwarding for plots import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes import pandas as pd import numpy as np from root_pandas import read_root from scipy.optimize import cu...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.figure", "numpy.exp", "numpy.diag", "matplotlib.pyplot.close", "matplotlib.rcParams.update", "numpy.power", "scipy.stats.linregress", "pandas.IntervalIndex.from_tuples", "pandas.concat", "matplotlib.pyplot.errorbar", "root_pandas.read_root", "sci...
[((60, 81), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (74, 81), False, 'import matplotlib\n'), ((651, 702), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'errorbar.capsize': 2}"], {}), "({'errorbar.capsize': 2})\n", (677, 702), False, 'import matplotlib\n'), ((714, 865), 'r...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import numpy as np import pandas as pd from scipy import stats from datetime import datetime import h5py import logging import global_settings import data_loader from futures_tools import get_futures_chain, get_futures_actual_ticker, get_generic_futures...
[ "pandas.DataFrame", "data_loader.load_inter_comdty_generic_hist_prices", "data_loader.load_inter_comdty_spread_hist_prices", "datetime.datetime.today", "numpy.average", "numpy.std", "futures_tools.get_futures_actual_ticker", "data_loader.load_futures_hist_prices", "numpy.isnan", "logging.info", ...
[((1134, 1194), 'pandas.to_datetime', 'pd.to_datetime', (["df_futures_contracts_meta['Last_Trade_Date']"], {}), "(df_futures_contracts_meta['Last_Trade_Date'])\n", (1148, 1194), True, 'import pandas as pd\n'), ((1920, 1981), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['First_Trade_Date', 'Last_Trade_Date']"}...
import time from collections import UserDict, defaultdict from contextlib import contextmanager from datetime import datetime from functools import wraps import numpy as np import torch from .errors import DeepQMCError __all__ = () def get_flat_mesh(bounds, npts, device=None): edges = [torch.linspace(*b, n, de...
[ "subprocess.run", "torch.stack", "torch.cuda.max_memory_allocated", "torch.cat", "time.time", "collections.defaultdict", "torch.meshgrid", "torch.cuda.get_device_properties", "numpy.array", "functools.wraps", "torch.as_tensor", "torch.linspace", "datetime.datetime.now", "torch.tensor", "...
[((376, 398), 'torch.meshgrid', 'torch.meshgrid', (['*edges'], {}), '(*edges)\n', (390, 398), False, 'import torch\n'), ((1941, 1952), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1946, 1952), False, 'from functools import wraps\n'), ((5055, 5072), 'torch.tensor', 'torch.tensor', (['mem'], {}), '(mem)\n', (...
# Copyright 2019 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 a...
[ "mindspore.context.set_context", "mindspore.communication.management.init", "numpy.allclose", "mindspore.context.set_auto_parallel_context", "mindspore.ops.operations.OneHot", "numpy.split", "mindspore.common.tensor.Tensor", "mindspore.communication.management.create_group", "numpy.arange" ]
[((1060, 1104), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE'}), '(mode=context.GRAPH_MODE)\n', (1079, 1104), False, 'from mindspore import context\n'), ((1110, 1189), 'mindspore.context.set_auto_parallel_context', 'context.set_auto_parallel_context', ([], {'device_num': 'de...
import numpy as np from flask import Flask, request, jsonify, render_template import pickle import pandas as pd app = Flask(__name__) model = pickle.load(open('model.pkl', 'rb')) mac = pd.read_csv("mac_address.csv") def IotDeviceName(index,mac): iot_names = mac["IoT_Devices"].values for j,i in enumerate(iot_n...
[ "pandas.read_csv", "flask.request.form.values", "flask.Flask", "numpy.array", "flask.render_template" ]
[((119, 134), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'from flask import Flask, request, jsonify, render_template\n'), ((187, 217), 'pandas.read_csv', 'pd.read_csv', (['"""mac_address.csv"""'], {}), "('mac_address.csv')\n", (198, 217), True, 'import pandas as pd\n'), ((420, 449), ...
import re import numpy as np import matplotlib.pyplot as plt from math import dist def calculate_distance(candidate): """ Calculate the distance the candidates route takes :param candidate: the candidate we want to evaluate :return: the distance of the route specified by the candidate """ dist...
[ "math.dist", "matplotlib.pyplot.show", "numpy.average", "numpy.empty", "numpy.zeros", "matplotlib.pyplot.Rectangle", "numpy.argsort", "numpy.append", "numpy.random.randint", "numpy.array", "numpy.arange", "re.findall", "numpy.random.choice", "numpy.random.rand", "matplotlib.pyplot.subplo...
[((6636, 6672), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(12, 12)'}), '(2, 2, figsize=(12, 12))\n', (6648, 6672), True, 'import matplotlib.pyplot as plt\n'), ((8054, 8064), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (8062, 8064), True, 'import matplotlib.pyplot as plt\n')...
import cv2 import argparse import numpy as np myColors = (255,255,0) # Get names of output layers, output for YOLOv3 is ['yolo_16', 'yolo_23'] def getOutputsNames(net): layersNames = net.getLayerNames() return [layersNames[i[0] - 1] for i in net.getUnconnectedOutLayers()] # Darw a rectangle surrounding the o...
[ "cv2.resize", "cv2.putText", "cv2.dnn.NMSBoxes", "numpy.argmax", "cv2.waitKey", "cv2.getTickFrequency", "cv2.dnn.blobFromImage", "cv2.dnn.readNet", "cv2.VideoCapture", "cv2.rectangle", "cv2.imshow", "cv2.namedWindow" ]
[((712, 760), 'cv2.namedWindow', 'cv2.namedWindow', (['window_title', 'cv2.WINDOW_NORMAL'], {}), '(window_title, cv2.WINDOW_NORMAL)\n', (727, 760), False, 'import cv2\n'), ((1107, 1172), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""tiny-yolo_last.weights"""', '"""custom/tiny-yolo.cfg"""'], {}), "('tiny-yolo_last.weights...
import elemental_operations as elem import numpy as np import scipy.io as scio # Inputs matrix = [[1, 1, 2, 8], [-1, -2, 3, 1], [3, -7, 4, 10]] matrix = scio.mmread("../../../Downloads/nnc261.mtx.gz").toarray().tolist() round_number = 2 # Algorithm start col_nonzero = 0 matrix_diagonalized = [] ...
[ "numpy.abs", "numpy.transpose", "elemental_operations.el_staggering", "numpy.shape", "scipy.io.mmread", "elemental_operations.el_exchange" ]
[((434, 454), 'numpy.transpose', 'np.transpose', (['matrix'], {}), '(matrix)\n', (446, 454), True, 'import numpy as np\n'), ((946, 999), 'elemental_operations.el_staggering', 'elem.el_staggering', (['matrix', '(0)', 'matrix[0][col_nonzero]'], {}), '(matrix, 0, matrix[0][col_nonzero])\n', (964, 999), True, 'import eleme...
import copy import numpy as np import pandas as pd from dowhy.causal_refuter import CausalRefutation from dowhy.causal_refuter import CausalRefuter class AddUnobservedCommonCause(CausalRefuter): """Add an unobserved confounder for refutation. TODO: Needs scaled version of the parameters and an interpretat...
[ "dowhy.causal_refuter.CausalRefutation", "copy.deepcopy", "numpy.random.randn", "numpy.random.random", "pandas.api.types.is_bool_dtype", "numpy.ndarray" ]
[((922, 947), 'copy.deepcopy', 'copy.deepcopy', (['self._data'], {}), '(self._data)\n', (935, 947), False, 'import copy\n'), ((1179, 1298), 'dowhy.causal_refuter.CausalRefutation', 'CausalRefutation', (['self._estimate.value', 'new_effect.value'], {'refutation_type': '"""Refute: Add an Unobserved Common Cause"""'}), "(...
import matplotlib matplotlib.use('Agg') # noqa import pytest import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression, LogisticRegression from ml_utils import BaseClassModel from sklearn.datasets import load_iris @pytest.fixture(name='base', scope='session') def _base(): class Ir...
[ "pandas.DataFrame", "sklearn.datasets.load_iris", "pytest.fixture", "sklearn.linear_model.LinearRegression", "sklearn.linear_model.LogisticRegression", "matplotlib.use", "numpy.where", "pandas.to_datetime" ]
[((19, 40), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (33, 40), False, 'import matplotlib\n'), ((250, 294), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""base"""', 'scope': '"""session"""'}), "(name='base', scope='session')\n", (264, 294), False, 'import pytest\n'), ((804, 838), 'pyt...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 18 17:27:22 2020 @author: mike_ubuntu """ import numpy as np from prep.derivatives import Preprocess_derivatives if __name__ == "__main__": op_file_name = 'Preprocessing/Derivatives.npy'; filename = 'Preprocessing/wave_HP.npy' if 'npy' i...
[ "prep.derivatives.Preprocess_derivatives", "numpy.load", "numpy.transpose", "numpy.loadtxt" ]
[((494, 524), 'numpy.transpose', 'np.transpose', (['field', '(2, 0, 1)'], {}), '(field, (2, 0, 1))\n', (506, 524), True, 'import numpy as np\n'), ((529, 588), 'prep.derivatives.Preprocess_derivatives', 'Preprocess_derivatives', (['field', 'op_file_name'], {'mp_poolsize': '(24)'}), '(field, op_file_name, mp_poolsize=24)...
import numpy as np import torch import argparse import disentanglement_utils import torch.nn.functional as F import random import os import latent_spaces from sklearn.preprocessing import StandardScaler import string from torchvision import models from datasets.clevr_dataset import CausalDataset from infinite_iterator ...
[ "numpy.random.seed", "argparse.ArgumentParser", "sklearn.preprocessing.StandardScaler", "torch.cat", "torch.nn.CosineSimilarity", "numpy.arange", "torch.arange", "torchvision.transforms.Normalize", "torch.no_grad", "torch.utils.data.DataLoader", "torch.load", "torchvision.transforms.Compose", ...
[((426, 451), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (449, 451), False, 'import torch\n'), ((1527, 1552), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1550, 1552), False, 'import argparse\n'), ((4716, 4765), 'faiss.omp_set_num_threads', 'faiss.omp_set_num_thr...
import os import json from .val import * import numpy as np import cv2 from pymodbus.client.sync import ModbusTcpClient import threading import time def flag_activator (flag_add): try: with open(flag_add,'w') as f: f.close() return True except: return False def flag_remover(f...
[ "json.dump", "os.remove", "numpy.argmin", "time.sleep", "numpy.nonzero", "cv2.imread", "os.path.isfile", "numpy.shape", "numpy.array", "pymodbus.client.sync.ModbusTcpClient" ]
[((337, 361), 'os.path.isfile', 'os.path.isfile', (['flag_add'], {}), '(flag_add)\n', (351, 361), False, 'import os\n'), ((889, 934), 'json.dump', 'json.dump', (['json_dict', 'clean_json'], {'indent': '"""\t"""'}), "(json_dict, clean_json, indent='\\t')\n", (898, 934), False, 'import json\n'), ((1583, 1615), 'numpy.arr...
#!/usr/bin/env python import cv2 import numpy as np def color_detect(image_file): ## Read img = cv2.imread(image_file) ## convert to hsv hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) ## mask of green (36,25,25) ~ (86, 255,255) # mask = cv2.inRange(hsv, (36, 25, 25), (86, 255,255)) mask = cv...
[ "numpy.zeros_like", "cv2.cvtColor", "cv2.imwrite", "cv2.imread", "cv2.inRange" ]
[((106, 128), 'cv2.imread', 'cv2.imread', (['image_file'], {}), '(image_file)\n', (116, 128), False, 'import cv2\n'), ((162, 198), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (174, 198), False, 'import cv2\n'), ((318, 362), 'cv2.inRange', 'cv2.inRange', (['hsv', '(1...
import requests import numpy as np import pandas as pd import os api_key = os.getenv('api_key') demo = api_key sector = 'Technology' exchange = 'NASDAQ' marketcapmorethan = '1000000000' number_of_companies = 100 symbols = [] screener = requests.get(f'https://financialmodelingprep.com/api/v3/stock-screener?{marketcap...
[ "pandas.DataFrame.from_dict", "numpy.array", "os.getenv", "requests.get" ]
[((75, 95), 'os.getenv', 'os.getenv', (['"""api_key"""'], {}), "('api_key')\n", (84, 95), False, 'import os\n'), ((4352, 4402), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['FinMetrics'], {'orient': '"""index"""'}), "(FinMetrics, orient='index')\n", (4374, 4402), True, 'import pandas as pd\n'), ((239, 451)...
import numpy as np import matplotlib.pyplot as plt # matplotlib inline """here we have tried to understand how machine approaches to solve a classification""" def draw(x1, x2): ln = plt.plot(x1, x2) def sigmoid(score): return 1 / (1 + np.exp(-score)) n_pts = 100 np.random.seed(0) bias = np.ones(n_pts) top_re...
[ "numpy.matrix", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.ones", "numpy.exp", "numpy.random.normal", "matplotlib.pyplot.subplots", "numpy.vstack" ]
[((274, 291), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (288, 291), True, 'import numpy as np\n'), ((299, 313), 'numpy.ones', 'np.ones', (['n_pts'], {}), '(n_pts)\n', (306, 313), True, 'import numpy as np\n'), ((520, 558), 'numpy.vstack', 'np.vstack', (['(top_region, bottom_region)'], {}), '((top_r...
#import the necessary packages import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import torch.functional as F from torch.utils.data import DataLoader import torchvision from torchvision import datasets, models, transforms import numpy as np import time imp...
[ "matplotlib.pyplot.title", "torch.nn.Dropout", "torch.optim.lr_scheduler.StepLR", "numpy.clip", "matplotlib.pyplot.figure", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "torch.utils.data.DataLoader", "matplotlib.pyplot.imshow", "torch.nn.Linear", "torchvision.transforms...
[((1533, 1626), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['image_datasets[x]'], {'batch_size': '(4)', 'shuffle': '(True)', 'num_workers': '(4)'}), '(image_datasets[x], batch_size=4, shuffle=True,\n num_workers=4)\n', (1560, 1626), False, 'import torch\n'), ((1864, 1889), 'torch.cuda.is_availabl...
import sys import numpy import matplotlib.pyplot as plot #Graph output flag axis = [[],[]] #Unit Conversions """ Converts degrees latitude to meters. This conversion finds the east/west distance in meters between the supplied point and origin. The Origin is a list in the format [latitude, longitude] """ d...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.deg2rad", "numpy.sin", "numpy.cos", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((371, 395), 'numpy.deg2rad', 'numpy.deg2rad', (['origin[0]'], {}), '(origin[0])\n', (384, 395), False, 'import numpy\n'), ((808, 832), 'numpy.deg2rad', 'numpy.deg2rad', (['origin[0]'], {}), '(origin[0])\n', (821, 832), False, 'import numpy\n'), ((1132, 1156), 'numpy.deg2rad', 'numpy.deg2rad', (['origin[0]'], {}), '(o...
from future import standard_library standard_library.install_aliases() from builtins import str import numpy as np from robust.simulations import simulate from SimPleAC_setup import SimPleAC_setup from SimPleAC_save import save_obj import pickle as pickle def pof_parameters(): model, subs = SimPleAC_setup() nu...
[ "pickle.dump", "robust.simulations.simulate.generate_model_properties", "robust.simulations.simulate.variable_gamma_results", "future.standard_library.install_aliases", "SimPleAC_setup.SimPleAC_setup", "pickle.load", "numpy.linspace", "SimPleAC_save.save_obj", "builtins.str" ]
[((36, 70), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (68, 70), False, 'from future import standard_library\n'), ((297, 313), 'SimPleAC_setup.SimPleAC_setup', 'SimPleAC_setup', ([], {}), '()\n', (311, 313), False, 'from SimPleAC_setup import SimPleAC_setup\n'), ((7...
import numpy as np from skimage import feature as ski from sklearn import cluster as skl def get_surrounding_points(j): # Gets the four points surrounding coordinate j points = [(int(np.floor(j[0])), int(np.floor(j[1]))), (int(np.floor(j[0])), int(np.ceil(j[1]))), (int(np.ceil(j[0...
[ "numpy.ceil", "skimage.feature.peak_local_max", "numpy.argmax", "sklearn.cluster.KMeans", "numpy.floor", "numpy.shape", "numpy.argpartition", "numpy.max", "numpy.finfo", "numpy.array", "numpy.reshape" ]
[((987, 1020), 'numpy.max', 'np.max', (['input_tensor'], {'axis': '(0, 1)'}), '(input_tensor, axis=(0, 1))\n', (993, 1020), True, 'import numpy as np\n'), ((2513, 2535), 'numpy.shape', 'np.shape', (['input_tensor'], {}), '(input_tensor)\n', (2521, 2535), True, 'import numpy as np\n'), ((2617, 2638), 'numpy.array', 'np....
import bibtexparser from bibtexparser.bparser import BibTexParser from bibtexparser.customization import convert_to_unicode from bibtex2rst import (bibtex_path, bib_files, template_file_path, str2injcet, papers_count, sec_descriptions) from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from ...
[ "json.dump", "sklearn.manifold.TSNE", "sklearn.feature_extraction.text.TfidfVectorizer", "bibtexparser.load", "plotly.offline.plot", "numpy.array", "bibtexparser.bparser.BibTexParser", "os.path.join" ]
[((1567, 1583), 'numpy.array', 'np.array', (['papers'], {}), '(papers)\n', (1575, 1583), True, 'import numpy as np\n'), ((2616, 2693), 'plotly.offline.plot', 'plotly.offline.plot', (['[trace]'], {'filename': '"""embedding-plot.html"""', 'auto_open': '(False)'}), "([trace], filename='embedding-plot.html', auto_open=Fals...
""" Ad-hoc parameter testing, pseudo code and tests """ import cv2 import os import json from PIL import Image, ImageStat, ImageChops, ImageEnhance import numpy as np from matplotlib import pyplot as plt class PythonHistrogramAnalysisExtractor: def __init__(self, file_path): self._file_path = file_path...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "cv2.cvtColor", "matplotlib.pyplot.imshow", "cv2.calcHist", "json.dumps", "PIL.Image.open", "cv2.imread", "numpy.histogram", "cv2.split", "matplotlib.pyplot.subplots" ]
[((493, 520), 'json.dumps', 'json.dumps', (['self._json_data'], {}), '(self._json_data)\n', (503, 520), False, 'import json\n'), ((567, 594), 'PIL.Image.open', 'Image.open', (['self._file_path'], {}), '(self._file_path)\n', (577, 594), False, 'from PIL import Image, ImageStat, ImageChops, ImageEnhance\n'), ((620, 665),...
import os import numpy as np import matplotlib.pyplot as plt from pandas.io.parsers import read_csv from sklearn.utils import shuffle from keras.models import load_model, model_from_json def load_data(validation_split): # Create path to csv file cwd = os.getcwd() csv_path = os.path.join(cwd, "data/training...
[ "pandas.io.parsers.read_csv", "matplotlib.pyplot.savefig", "matplotlib.pyplot.yscale", "matplotlib.pyplot.get_cmap", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "os.getcwd", "matplotlib.pyplot.legend", "numpy.array", "numpy.squeeze", "matplotlib.pyplot.ylabel", "sklearn.utils.shuffle", ...
[((261, 272), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (270, 272), False, 'import os\n'), ((288, 326), 'os.path.join', 'os.path.join', (['cwd', '"""data/training.csv"""'], {}), "(cwd, 'data/training.csv')\n", (300, 326), False, 'import os\n'), ((431, 449), 'pandas.io.parsers.read_csv', 'read_csv', (['csv_path'], {})...
import tensorflow as tf import tensorflow.keras as keras import numpy as np import matplotlib.pyplot as plt import math from datetime import datetime from numpy import save, load, asarray import csv from skimage.io import imread from skimage.transform import resize import pickle from PIL import Image import os # tf....
[ "tensorflow.keras.models.load_model", "numpy.argmax", "tensorflow.config.list_physical_devices", "numpy.expand_dims", "tensorflow.config.experimental.set_memory_growth", "numpy.array", "skimage.transform.resize", "skimage.io.imread" ]
[((842, 907), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['h5_address'], {'custom_objects': "{'tf': tf}"}), "(h5_address, custom_objects={'tf': tf})\n", (868, 907), True, 'import tensorflow as tf\n'), ((1053, 1069), 'skimage.io.imread', 'imread', (['img_path'], {}), '(img_path)\n', (1059, 1069...
import numpy as np import sklearn import scipy import pandas as pd from sklearn.model_selection import train_test_split from sklearn.datasets import make_regression from hypster import HyPSTERRegressor SEED = 50 def test_melbourne(): data = pd.read_csv("Melbourne_Data.csv") data.head() X = data X = ...
[ "pandas.DataFrame", "hypster.HyPSTERRegressor", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.datasets.make_regression", "scipy.sparse.csr_matrix", "numpy.random.randint", "sklearn.metrics.mean_squared_error" ]
[((248, 281), 'pandas.read_csv', 'pd.read_csv', (['"""Melbourne_Data.csv"""'], {}), "('Melbourne_Data.csv')\n", (259, 281), True, 'import pandas as pd\n'), ((628, 685), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.33)', 'random_state': 'SEED'}), '(X, y, test_size=0.33, ...
#!/usr/bin/python3 from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from argparse import ArgumentParser import lipsbodypose import cv2 import numpy import math import sys from facial_landmarks import FacialLandmarksEngine class PoseRenderConstants: PartIdx = { 'NOSE': 0, ...
[ "lipsbodypose.lipsbodypose", "numpy.zeros_like", "numpy.subtract", "argparse.ArgumentParser", "numpy.empty", "numpy.cross", "math.sin", "math.acos", "cv2.rectangle", "math.cos", "facial_landmarks.FacialLandmarksEngine", "cv2.applyColorMap", "numpy.dot", "sys.exit" ]
[((2634, 2667), 'numpy.empty', 'numpy.empty', (['(0)'], {'dtype': 'numpy.uint8'}), '(0, dtype=numpy.uint8)\n', (2645, 2667), False, 'import numpy\n'), ((2678, 2712), 'numpy.empty', 'numpy.empty', (['(0)'], {'dtype': 'numpy.uint16'}), '(0, dtype=numpy.uint16)\n', (2689, 2712), False, 'import numpy\n'), ((2812, 2839), 'l...
#!/usr/bin/env python # coding: utf-8 # In[14]: import xgboost as xgb import numpy as np import pandas as pd train = pd.read_csv("./pytrain.csv", index_col = 0) test = pd.read_csv(" ./pytest.csv", index_col = 0) # In[15]: X = np.array(train.ix[:,0:311]) y = np.array(train['SalePrice']) test = np.array(test) # ...
[ "pandas.core.frame.DataFrame", "pandas.read_csv", "sklearn.preprocessing.RobustScaler", "numpy.square", "numpy.zeros", "sklearn.model_selection.KFold", "numpy.expm1", "numpy.mean", "numpy.array", "xgboost.XGBRegressor", "xgboost.cv", "xgboost.DMatrix" ]
[((120, 161), 'pandas.read_csv', 'pd.read_csv', (['"""./pytrain.csv"""'], {'index_col': '(0)'}), "('./pytrain.csv', index_col=0)\n", (131, 161), True, 'import pandas as pd\n'), ((171, 212), 'pandas.read_csv', 'pd.read_csv', (['""" ./pytest.csv"""'], {'index_col': '(0)'}), "(' ./pytest.csv', index_col=0)\n", (182, 212),...
from numpy import sqrt, vectorize, sort, absolute # Author: <NAME> def errore_ddp_digitale(V): """ Calcola l'errore della misura di ddp del multimetro digitale supponendo che si sia scelta la scala corretta. La ddp deve essere data in Volt """ V=absolute(V) if V<0.2: return sqrt...
[ "numpy.absolute", "numpy.sort", "numpy.vectorize", "numpy.sqrt" ]
[((535, 565), 'numpy.vectorize', 'vectorize', (['errore_ddp_digitale'], {}), '(errore_ddp_digitale)\n', (544, 565), False, 'from numpy import sqrt, vectorize, sort, absolute\n'), ((1129, 1159), 'numpy.vectorize', 'vectorize', (['errore_res_digitale'], {}), '(errore_res_digitale)\n', (1138, 1159), False, 'from numpy imp...
import praw import sys import json import re import requests import os from os import listdir from os.path import isfile, join from PIL import Image from resizeimage import resizeimage import colorgram import numpy as np def createImage(list_of_RGB): pixels = [ list_of_RGB, ] # Convert the pixels...
[ "os.mkdir", "colorgram.extract", "json.load", "resizeimage.resizeimage.resize_cover", "PIL.Image.open", "re.findall", "numpy.array", "requests.get", "PIL.Image.fromarray", "praw.Reddit", "os.path.join", "os.listdir" ]
[((359, 391), 'numpy.array', 'np.array', (['pixels'], {'dtype': 'np.uint8'}), '(pixels, dtype=np.uint8)\n', (367, 391), True, 'import numpy as np\n'), ((471, 493), 'PIL.Image.fromarray', 'Image.fromarray', (['array'], {}), '(array)\n', (486, 493), False, 'from PIL import Image\n'), ((1011, 1133), 'praw.Reddit', 'praw.R...
# coding: utf-8 """ one_layer_two_points.py (BSD Licensed) © 2020 (<EMAIL>) """ import numpy as np import qrcode Bits = 10 # hidden_size def init_network(): return dict( W1=np.array([np.random.randn(Bits)]), # W1=np.array([[0.1, 0.3, 0.5]]), # b1=np.array(np.random.randn(Bits).astype(int) * c) ...
[ "numpy.zeros", "numpy.dot", "numpy.array", "numpy.random.randn" ]
[((2194, 2210), 'numpy.array', 'np.array', (['[23.0]'], {}), '([23.0])\n', (2202, 2210), True, 'import numpy as np\n'), ((1571, 1584), 'numpy.dot', 'np.dot', (['x', 'W1'], {}), '(x, W1)\n', (1577, 1584), True, 'import numpy as np\n'), ((1847, 1861), 'numpy.dot', 'np.dot', (['z1', 'W2'], {}), '(z1, W2)\n', (1853, 1861),...
from comet_ml import Experiment import os import sys import gym import torch import torchvision import numpy as np import matplotlib.pyplot as plt import yaml import numba # @numba.jit(nopython=True) from tqdm import tqdm from typing import * from utils.phi import ( phi, preprocess, ) from utils.memory import...
[ "gym.make", "matplotlib.pyplot.clf", "utils.utils.epsilon_schedule", "utils.phi.preprocess", "numpy.zeros", "utils.phi.phi", "utils.utils.action_from_model_prediction", "torch.cuda.is_available", "utils.utils.action_from_trinary_to_env", "numpy.random.rand", "utils.utils.select_random_action" ]
[((1644, 1663), 'gym.make', 'gym.make', (['"""Pong-v0"""'], {}), "('Pong-v0')\n", (1652, 1663), False, 'import gym\n'), ((1486, 1511), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1509, 1511), False, 'import torch\n'), ((2067, 2093), 'utils.phi.phi', 'phi', (['preprocessed_sequence'], {}), '...
from pathlib import Path from typing_extensions import TypeVarTuple import numpy as np from myterial.utils import make_palette import brainrender as br from myterial import blue_grey_dark, blue_grey_light from fcutils.path import files # ----------------------------------- prep ----------------------------------- # ...
[ "numpy.load", "brainrender.Scene", "fcutils.path.files", "pathlib.Path", "brainrender.actors.Points" ]
[((396, 487), 'pathlib.Path', 'Path', (['"""D:\\\\Dropbox (UCL)\\\\Rotation_vte\\\\Locomotion\\\\reconstructed_probe_location"""'], {}), "(\n 'D:\\\\Dropbox (UCL)\\\\Rotation_vte\\\\Locomotion\\\\reconstructed_probe_location'\n )\n", (400, 487), False, 'from pathlib import Path\n'), ((496, 535), 'fcutils.path.fil...
from collections import Counter import re import numpy as np class SeqEntityScore(object): def __init__(self, id2label, markup='bios'): self.id2label = id2label self.markup = markup self.reset() self.outputs = [] def reset(self): self.origins = [] s...
[ "collections.Counter", "numpy.mean", "re.findall" ]
[((741, 778), 'collections.Counter', 'Counter', (['[x[0] for x in self.origins]'], {}), '([x[0] for x in self.origins])\n', (748, 778), False, 'from collections import Counter\n'), ((804, 840), 'collections.Counter', 'Counter', (['[x[0] for x in self.founds]'], {}), '([x[0] for x in self.founds])\n', (811, 840), False,...
""" Data generation for the case of Psm Envs and demonstrations. Refer to https://github.com/openai/baselines/blob/master/baselines/her/experiment/data_generation/fetch_data_generation.py """ import os import argparse import gym import time import numpy as np import imageio from surrol.const import ROOT_DIR_PATH from ...
[ "imitation.data.rollout.unwrap_traj", "gym.make", "argparse.ArgumentParser", "imitation.data.types.save", "numpy.expand_dims", "imitation.data.rollout.TrajectoryAccumulator", "time.time", "logging.info", "imitation.data.rollout.rollout_stats", "dataclasses.replace" ]
[((456, 532), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""generate demonstrations for imitation"""'}), "(description='generate demonstrations for imitation')\n", (479, 532), False, 'import argparse\n'), ((1055, 1094), 'gym.make', 'gym.make', (['args.env'], {'render_mode': '"""human"""...
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 生成100个随机点 x_data = np.random.rand(100) y_data = x_data*0.1+0.2 # 构造线性模型 k = tf.Variable(0.) b = tf.Variable(0.) y = k*x_data+b # 二次代价函数 loss = tf.reduce_mean(tf.square(y_data-y)) # 定义一...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "tensorflow.global_variables_initializer", "matplotlib.pyplot.scatter", "tensorflow.Session", "tensorflow.Variable", "tensorflow.square", "numpy.random.rand", "tensorflow.train.GradientDescentOptimizer" ]
[((151, 170), 'numpy.random.rand', 'np.random.rand', (['(100)'], {}), '(100)\n', (165, 170), True, 'import numpy as np\n'), ((210, 226), 'tensorflow.Variable', 'tf.Variable', (['(0.0)'], {}), '(0.0)\n', (221, 226), True, 'import tensorflow as tf\n'), ((230, 246), 'tensorflow.Variable', 'tf.Variable', (['(0.0)'], {}), '...
import arrayfire as af import numpy as np import scipy.sparse as sparse from sklearn.utils.sparsefuncs_fast import csr_row_norms from sklearn.utils.validation import _deprecate_positional_args def safe_sparse_dot(a, b, *, dense_output=False): """Dot product that handle the sparse matrix case correctly. Parame...
[ "sklearn.utils.sparsefuncs_fast.csr_row_norms", "scipy.sparse.issparse", "numpy.einsum", "scipy.sparse.csr_matrix", "numpy.rollaxis", "numpy.dot", "arrayfire.interop.from_ndarray", "numpy.sqrt" ]
[((2801, 2819), 'scipy.sparse.issparse', 'sparse.issparse', (['X'], {}), '(X)\n', (2816, 2819), True, 'import scipy.sparse as sparse\n'), ((2923, 2939), 'sklearn.utils.sparsefuncs_fast.csr_row_norms', 'csr_row_norms', (['X'], {}), '(X)\n', (2936, 2939), False, 'from sklearn.utils.sparsefuncs_fast import csr_row_norms\n...
from copy import copy import pytest import numpy as np from mdevaluate import utils @pytest.fixture def logdata(request): xdata = np.logspace(-1, 3, 50) ydata = np.exp(- (xdata)**0.7) return xdata, ydata def test_filon_fourier_transformation(logdata): xdata, ydata = logdata xdata_zero = copy(x...
[ "numpy.logspace", "mdevaluate.utils.histogram", "copy.copy", "numpy.isnan", "mdevaluate.utils.filon_fourier_transformation", "numpy.histogram", "numpy.isclose", "numpy.exp", "numpy.linspace", "numpy.random.rand" ]
[((137, 159), 'numpy.logspace', 'np.logspace', (['(-1)', '(3)', '(50)'], {}), '(-1, 3, 50)\n', (148, 159), True, 'import numpy as np\n'), ((172, 193), 'numpy.exp', 'np.exp', (['(-xdata ** 0.7)'], {}), '(-xdata ** 0.7)\n', (178, 193), True, 'import numpy as np\n'), ((314, 325), 'copy.copy', 'copy', (['xdata'], {}), '(xd...
#!/usr/bin/env python3 import datetime import json import urllib.parse import click import fsspec import geopandas import git import numpy as np import pandas as pd import requests from bs4 import BeautifulSoup from fuzzywuzzy import process from tenacity import retry, stop_after_attempt CRS = "+proj=aea +lat_0=23 +l...
[ "json.dump", "json.load", "tenacity.stop_after_attempt", "numpy.argmax", "fuzzywuzzy.process.extractOne", "click.option", "git.Repo", "click.command", "datetime.datetime.utcnow", "numpy.array", "requests.get", "bs4.BeautifulSoup", "fsspec.open", "geopandas.read_file" ]
[((516, 556), 'git.Repo', 'git.Repo', ([], {'search_parent_directories': '(True)'}), '(search_parent_directories=True)\n', (524, 556), False, 'import git\n'), ((6184, 6199), 'click.command', 'click.command', ([], {}), '()\n', (6197, 6199), False, 'import click\n'), ((6201, 6300), 'click.option', 'click.option', (['"""-...
from __future__ import division import numpy as np # define target list mmol=381.37 # g/mol Th_length=438. # [Aa] # target masses in GeV and number of nucleons # Hydrogen m_H=0.9389 A_H=1. Z_H=1. n_H=20. # Boron m_B=10.07 A_B=(10.*20.+11.*80.)/100. Z_B=5. n_B=4. # Oxygen m_O=14.903 A_O=(99.76*16+.04*17+.2*18)/100 Z_O=...
[ "numpy.array" ]
[((512, 568), 'numpy.array', 'np.array', (['[m_H * n_H, m_B * n_B, m_O * n_O, m_Na * n_Na]'], {}), '([m_H * n_H, m_B * n_B, m_O * n_O, m_Na * n_Na])\n', (520, 568), True, 'import numpy as np\n')]
# Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "tensorflow.nn.softmax", "tensorflow.contrib.distributions.OneHotCategorical", "tensorflow.reduce_logsumexp", "numpy.ones_like", "tensorflow.reduce_sum", "tensorflow.nn.softmax_cross_entropy_with_logits", "tensorflow.argmax", "tensorflow.reduce_mean", "tensorflow.nn.sigmoid_cross_entropy_with_logits...
[((1605, 1621), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['x'], {}), '(x)\n', (1618, 1621), True, 'import tensorflow as tf\n'), ((1727, 1797), 'tensorflow.contrib.distributions.OneHotCategorical', 'tf.contrib.distributions.OneHotCategorical', ([], {'logits': 'x', 'dtype': 'tf.float32'}), '(logits=x, dtype=tf.float32)...
import tensorflow as tf from tqdm import tqdm import numpy as np from scipy.interpolate import interp2d from sklearn.preprocessing import MinMaxScaler import os, joblib import pandas as pd class CNN(): def __init__(self, static_data,rated, models, X_train, y_train, X_val, y_val, X_test, y_test): self.stati...
[ "tensorflow.square", "tensorflow.keras.layers.Dense", "sklearn.preprocessing.MinMaxScaler", "tensorflow.reshape", "numpy.ones", "tensorflow.matmul", "tensorflow.Variable", "tensorflow.compat.v1.global_variables_initializer", "tensorflow.abs", "tensorflow.compat.v1.placeholder", "numpy.power", ...
[((1002, 1030), 'numpy.transpose', 'np.transpose', (['phi', '[1, 0, 2]'], {}), '(phi, [1, 0, 2])\n', (1014, 1030), True, 'import numpy as np\n'), ((4067, 4114), 'tensorflow.random.truncated_normal', 'tf.random.truncated_normal', (['shape'], {'stddev': '(0.001)'}), '(shape, stddev=0.001)\n', (4093, 4114), True, 'import ...
import argparse import re from pathlib import Path import lightgbm as lgb import numpy as np import pandas as pd from sklearn.preprocessing import LabelBinarizer from sklearn.metrics import make_scorer from boatrace.parser import StartTable, RaceResult from boatrace.util import Config def dcg_score(y_true, y_score, ...
[ "sklearn.preprocessing.LabelBinarizer", "numpy.sum", "argparse.ArgumentParser", "lightgbm.train", "boatrace.parser.RaceResult", "lightgbm.Dataset", "lightgbm.cv", "numpy.argsort", "pathlib.Path", "numpy.mean", "numpy.take", "numpy.array", "boatrace.parser.StartTable", "pandas.concat", "r...
[((767, 793), 'numpy.take', 'np.take', (['y_true', 'order[:k]'], {}), '(y_true, order[:k])\n', (774, 793), True, 'import numpy as np\n'), ((886, 910), 'numpy.sum', 'np.sum', (['(gain / discounts)'], {}), '(gain / discounts)\n', (892, 910), True, 'import numpy as np\n'), ((2016, 2032), 'sklearn.preprocessing.LabelBinari...