code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# This script tests the contrast() function. # contrast(input_img, intensity, output_img) adjusts the contrast of an image # Input: input_img: string, path for the input image file # intensity: int, intensity of contrast enhancement, between 0 and 10, defaults to 5. # display: bool, display the enhanced ...
[ "pytest.fail", "pytest.raises", "numpy.array", "numpy.array_equal", "picfixPy.contrast.contrast" ]
[((597, 760), 'numpy.array', 'np.array', (['[[[1, 55, 255], [2, 55, 255], [3, 100, 5]], [[1, 55, 255], [2, 55, 255], [3,\n 100, 5]], [[1, 55, 255], [2, 55, 255], [3, 100, 5]]]'], {'dtype': '"""uint8"""'}), "([[[1, 55, 255], [2, 55, 255], [3, 100, 5]], [[1, 55, 255], [2, 55,\n 255], [3, 100, 5]], [[1, 55, 255], [2...
"""Class for Measurement Data.""" import sys import os import numpy as np import math import time import warnings from scipy.spatial import distance import scipy.fftpack as fftp from scipy import signal def zerocrossings(data): signs = np.sign(data) # Since np.sign(0) yields 0, # we treat them as negative...
[ "numpy.abs", "scipy.spatial.distance.euclidean", "scipy.signal.filtfilt", "numpy.fft.fft", "math.floor", "numpy.einsum", "math.sin", "scipy.fftpack.fft", "numpy.mean", "numpy.array", "math.cos", "numpy.linspace", "numpy.sign", "numpy.interp", "warnings.warn", "numpy.diff", "scipy.sig...
[((242, 255), 'numpy.sign', 'np.sign', (['data'], {}), '(data)\n', (249, 255), True, 'import numpy as np\n'), ((576, 589), 'numpy.sign', 'np.sign', (['data'], {}), '(data)\n', (583, 589), True, 'import numpy as np\n'), ((2070, 2083), 'numpy.mean', 'np.mean', (['data'], {}), '(data)\n', (2077, 2083), True, 'import numpy...
# quantum machine learning: classification problem import numpy as np import matplotlib.pyplot as plt from qiskit import BasicAer from qiskit.circuit.library import ZZFeatureMap from qiskit.aqua import QuantumInstance from qiskit.aqua.algorithms import QSVM, SklearnSVM from qiskit.aqua.utils import split_dataset_to_d...
[ "qiskit.aqua.utils.map_label_to_class_name", "matplotlib.pyplot.show", "numpy.count_nonzero", "qiskit.ml.datasets.ad_hoc_data", "qiskit.aqua.algorithms.SklearnSVM", "qiskit.aqua.QuantumInstance", "qiskit.BasicAer.get_backend", "numpy.asmatrix", "qiskit.aqua.algorithms.QSVM", "qiskit.aqua.utils.spl...
[((622, 748), 'qiskit.ml.datasets.ad_hoc_data', 'ad_hoc_data', ([], {'training_size': 'training_dataset_size', 'test_size': 'testing_dataset_size', 'n': 'feature_dim', 'gap': '(0.3)', 'plot_data': '(False)'}), '(training_size=training_dataset_size, test_size=\n testing_dataset_size, n=feature_dim, gap=0.3, plot_data...
import os import cv2 import json import numpy as np import _pickle as cPickle from ..base_dataset import Base_dataset from ..common import visualize from .define import MpiiPart,MpiiColor from .format import PoseInfo from .prepare import prepare_dataset from .generate import generate_train_data,generate_eval_data def...
[ "numpy.zeros_like", "numpy.sum", "numpy.ones", "numpy.argsort", "numpy.ma.array", "numpy.where", "numpy.arange", "numpy.linalg.norm", "numpy.array", "os.path.join", "numpy.concatenate" ]
[((7841, 7888), 'numpy.linalg.norm', 'np.linalg.norm', (['all_gt_headbbxs[2:4, :]'], {'axis': '(0)'}), '(all_gt_headbbxs[2:4, :], axis=0)\n', (7855, 7888), True, 'import numpy as np\n'), ((8012, 8038), 'numpy.sum', 'np.sum', (['all_gt_vis'], {'axis': '(1)'}), '(all_gt_vis, axis=1)\n', (8018, 8038), True, 'import numpy ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from operators import spin_loop_correlator class SpinLoopCorrelatorTest(tf.test.TestCase): def test_find_states_value_encoding(self): loop_correlator =...
[ "tensorflow.test.main", "operators.spin_loop_correlator.SpinLoopCorrelator", "numpy.array", "numpy.testing.assert_equal" ]
[((5067, 5081), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (5079, 5081), True, 'import tensorflow as tf\n'), ((321, 366), 'operators.spin_loop_correlator.SpinLoopCorrelator', 'spin_loop_correlator.SpinLoopCorrelator', (['(1)', '(3)'], {}), '(1, 3)\n', (360, 366), False, 'from operators import spin_loop_c...
import numpy as np import scipy as sp from optimize import GibbsOrientationSampler, Likelihood class CryoEMSampler(GibbsOrientationSampler): def energy(self, x): fx = np.fft.fftshift(np.fft.fftn(x)) return super(CryoEMSampler, self).energy(fx) def gradient(self, x): fx = np.fft.fft...
[ "numpy.zeros_like", "numpy.log", "xfel.numeric.quadrature.ChebyshevSO3Quadrature", "optimize.GibbsOrientationSampler", "numpy.fft.fftn", "numpy.float", "scipy.ndimage.zoom", "numpy.fft.ifftn", "xfel.grid.interpolation_matrix.compute_slice_interpolation_matrix", "os.path.expanduser", "xfel.grid.i...
[((1736, 1765), 'xfel.numeric.quadrature.ChebyshevSO3Quadrature', 'ChebyshevSO3Quadrature', (['order'], {}), '(order)\n', (1758, 1765), False, 'from xfel.numeric.quadrature import GaussSO3Quadrature, ChebyshevSO3Quadrature\n'), ((2081, 2119), 'scipy.ndimage.zoom', 'zoom', (['ground_truth', '(resolution / 128.0)'], {}),...
from hashlib import md5 from urllib.request import urlopen import numpy as np from .abc import Embedding class NonLSHEmbedding(Embedding): def __init__(self, dim: int): self.__dim = dim def get_dim(self) -> int: return self.__dim def get_version(self) -> str: return f'aptl...
[ "numpy.random.SFC64", "hashlib.md5", "numpy.sum", "urllib.request.urlopen" ]
[((531, 536), 'hashlib.md5', 'md5', ([], {}), '()\n', (534, 536), False, 'from hashlib import md5\n'), ((682, 708), 'numpy.random.SFC64', 'np.random.SFC64', ([], {'seed': 'seed'}), '(seed=seed)\n', (697, 708), True, 'import numpy as np\n'), ((771, 785), 'numpy.sum', 'np.sum', (['(v ** 2)'], {}), '(v ** 2)\n', (777, 785...
# -*- coding: utf-8 -*- """ ============================= OT for image color adaptation ============================= This example presents a way of transferring colors between two images with Optimal Transport as introduced in [6] [6] <NAME>., <NAME>., <NAME>., & <NAME>. (2014). Regularized discrete optimal transpor...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "os.path.join", "matplotlib.pyplot.imshow", "os.path.realpath", "matplotlib.pyplot.scatter", "matplotlib.pyplot.axis", "numpy.random.RandomState", "numpy.clip", "matplotlib.pyplot.figure", "pathlib.Path", "ot.d...
[((610, 635), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (631, 635), True, 'import numpy as np\n'), ((1071, 1099), 'os.path.realpath', 'os.path.realpath', (['"""__file__"""'], {}), "('__file__')\n", (1087, 1099), False, 'import os\n'), ((1652, 1683), 'matplotlib.pyplot.figure', 'plt....
import numpy as np import h5py import os class FileHelper(object): def __init__(self, db): self.db = h5py.File(db) def get(self): return self.db def get(self, path): return self.db[path] def list(self, path): return [key for key in self.db[path].keys()] def sto...
[ "h5py.File", "os.fsdecode", "numpy.dtype", "os.fsencode", "os.listdir" ]
[((116, 129), 'h5py.File', 'h5py.File', (['db'], {}), '(db)\n', (125, 129), False, 'import h5py\n'), ((733, 750), 'os.fsencode', 'os.fsencode', (['path'], {}), '(path)\n', (744, 750), False, 'import os\n'), ((771, 792), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (781, 792), False, 'import os\n'),...
import numpy as np import csv import sys import math # This script counts the voxel occupancy for any boxed and binned data structure. ### Parameters/ data box_size = 1 # (box dimensions) ex: 9x9x9 voxel_size = 9 center_index = math.ceil(box_size/2) - 1 output_path = "../data/output/box_analysis/box_size_" + str(box_s...
[ "numpy.load", "csv.writer", "math.ceil" ]
[((229, 252), 'math.ceil', 'math.ceil', (['(box_size / 2)'], {}), '(box_size / 2)\n', (238, 252), False, 'import math\n'), ((2339, 2355), 'csv.writer', 'csv.writer', (['file'], {}), '(file)\n', (2349, 2355), False, 'import csv\n'), ((716, 754), 'numpy.load', 'np.load', (['input_path'], {'allow_pickle': '(True)'}), '(in...
from __future__ import absolute_import import copy import tempfile import pyarrow as pa import os import torch import zipfile import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from pysurvival import utils from pysurvival.utils._functions import _get_time_buckets cla...
[ "pysurvival.utils.check_data", "os.remove", "copy.deepcopy", "numpy.sum", "sklearn.preprocessing.StandardScaler", "zipfile.ZipFile", "os.path.basename", "pyarrow.deserialize", "os.path.dirname", "torch.load", "torch.save", "numpy.cumsum", "tempfile.mkdtemp", "pysurvival.utils._functions._g...
[((1561, 1588), 'os.path.basename', 'os.path.basename', (['path_file'], {}), '(path_file)\n', (1577, 1588), False, 'import os\n'), ((3963, 3990), 'os.path.basename', 'os.path.basename', (['path_file'], {}), '(path_file)\n', (3979, 3990), False, 'import os\n'), ((6137, 6166), 'pysurvival.utils._functions._get_time_bucke...
import pytest from arrayviews import xnd_xnd_as xnd = pytest.importorskip("xnd") try: import pyarrow as pa except ImportError: pa = None try: import pandas as pd except ImportError: pd = None try: import numpy as np except ImportError: np = None pyarrowtest = pytest.mark.skipif( pa is No...
[ "pytest.importorskip", "numpy.testing.assert_array_equal", "arrayviews.xnd_xnd_as.numpy_ndarray", "pytest.raises", "arrayviews.xnd_xnd_as.pyarrow_array", "pytest.mark.skipif", "pandas.Series", "numpy.array", "arrayviews.xnd_xnd_as.pandas_series", "pyarrow.array", "pyarrow.float64" ]
[((55, 81), 'pytest.importorskip', 'pytest.importorskip', (['"""xnd"""'], {}), "('xnd')\n", (74, 81), False, 'import pytest\n'), ((288, 357), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(pa is None)'], {'reason': '"""requires the pyarrow package"""'}), "(pa is None, reason='requires the pyarrow package')\n", (306, 3...
import cv2 import numpy as np import os import SimpleITK as sitk def load_entire_resolution(dir): # the folder name has the dimension info of the 3D image, extract folder_name = os.path.split(dir)[-1] # dim_y, dim_x, dim_z = folder_name[4:-2].split('x') # when only low level resolution is provided, w...
[ "SimpleITK.ReadImage", "SimpleITK.GetArrayFromImage", "os.path.split", "os.path.join", "os.listdir", "numpy.block" ]
[((1614, 1638), 'numpy.block', 'np.block', (['ensemble_array'], {}), '(ensemble_array)\n', (1622, 1638), True, 'import numpy as np\n'), ((188, 206), 'os.path.split', 'os.path.split', (['dir'], {}), '(dir)\n', (201, 206), False, 'import os\n'), ((814, 841), 'os.path.join', 'os.path.join', (['dir', 'y_folder'], {}), '(di...
#! /usr/bin/env python import sys import numpy as np from matplotlib import pyplot as plt def get_xy(fname): poss_str=[] x=[] y=[] f= open(fname, "r") text= f.readlines() for i in range(len(text)): if i>=18: line =text[i][:-1].split() if len(line)==2: ...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((792, 804), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (802, 804), True, 'from matplotlib import pyplot as plt\n'), ((813, 836), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time [ns]"""'], {}), "('Time [ns]')\n", (823, 836), True, 'from matplotlib import pyplot as plt\n'), ((846, 869), 'matplotli...
import cv2 import numpy as np 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] # if both the width and height are None, then return the # original image ...
[ "cv2.cvtColor", "cv2.imread", "numpy.ones", "cv2.resize" ]
[((823, 866), 'cv2.resize', 'cv2.resize', (['image', 'dim'], {'interpolation': 'inter'}), '(image, dim, interpolation=inter)\n', (833, 866), False, 'import cv2\n'), ((977, 1015), 'cv2.imread', 'cv2.imread', (['path', 'cv2.IMREAD_UNCHANGED'], {}), '(path, cv2.IMREAD_UNCHANGED)\n', (987, 1015), False, 'import cv2\n'), ((...
# Program 18a: Generating a multifractal image. # Save the image. # See Figure 18.1(b). import numpy as np import matplotlib.pyplot as plt from skimage import exposure, io, img_as_uint p1, p2, p3, p4 = 0.3, 0.4, 0.25, 0.05 p = [[p1, p2], [p3, p4]] for k in range(1, 9, 1): M = np.zeros([2 ** (k + 1), 2 ** (k + 1)]...
[ "skimage.exposure.adjust_gamma", "skimage.img_as_uint", "matplotlib.pyplot.imshow", "skimage.exposure.rescale_intensity", "skimage.io.show", "numpy.zeros", "numpy.array", "skimage.io.imsave" ]
[((607, 636), 'skimage.exposure.adjust_gamma', 'exposure.adjust_gamma', (['M', '(0.2)'], {}), '(M, 0.2)\n', (628, 636), False, 'from skimage import exposure, io, img_as_uint\n'), ((637, 688), 'matplotlib.pyplot.imshow', 'plt.imshow', (['M'], {'cmap': '"""gray"""', 'interpolation': '"""nearest"""'}), "(M, cmap='gray', i...
import numpy as np import pandas as pd #import math #import matplotlib.pyplot as plt class Planet(): """ The class called Planet is initialised with constants appropriate for the given target planet, including the atmospheric density profile and other constants """ def __init__(self, atmos_fun...
[ "pandas.DataFrame", "numpy.zeros_like", "pandas.read_csv", "numpy.sin", "numpy.array", "numpy.exp", "numpy.cos" ]
[((7382, 7402), 'numpy.zeros_like', 'np.zeros_like', (['state'], {}), '(state)\n', (7395, 7402), True, 'import numpy as np\n'), ((8695, 8766), 'numpy.array', 'np.array', (['[velocity, density * volume, angle, init_altitude, x, radius]'], {}), '([velocity, density * volume, angle, init_altitude, x, radius])\n', (8703, 8...
import numpy as np from scipy.stats import norm from matplotlib import pyplot as plt from scipy.optimize import linear_sum_assignment as optimise from scipy.stats import linregress import copy try: from openbabel.openbabel import OBConversion, OBMol, OBAtomAtomIter, OBMolAtomIter except ImportError: from openb...
[ "openbabel.openbabel.OBMolAtomIter", "numpy.sum", "numpy.argmax", "openbabel.openbabel.OBConversion", "numpy.isnan", "numpy.argsort", "openbabel.openbabel.OBMol", "numpy.exp", "numpy.std", "numpy.cumsum", "numpy.max", "scipy.stats.linregress", "numpy.linspace", "openbabel.openbabel.OBAtomA...
[((1101, 1128), 'numpy.array', 'np.array', (['calculated_shifts'], {}), '(calculated_shifts)\n', (1109, 1128), True, 'import numpy as np\n'), ((1154, 1172), 'numpy.array', 'np.array', (['C_labels'], {}), '(C_labels)\n', (1162, 1172), True, 'import numpy as np\n'), ((1289, 1317), 'copy.copy', 'copy.copy', (['calculated_...
import pandas as pd import numpy as np import argparse import seaborn as sns import os import matplotlib.pyplot as plt import ptitprince as pt from matplotlib.patches import PathPatch sns.set(style="whitegrid", font_scale=1) def get_parameters(): parser = argparse.ArgumentParser(description='Generate figure for ...
[ "argparse.ArgumentParser", "os.path.join", "os.makedirs", "pandas.read_csv", "os.path.isdir", "matplotlib.pyplot.subplots", "numpy.min", "numpy.max", "ptitprince.RainCloud", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "seaborn.set" ]
[((185, 225), 'seaborn.set', 'sns.set', ([], {'style': '"""whitegrid"""', 'font_scale': '(1)'}), "(style='whitegrid', font_scale=1)\n", (192, 225), True, 'import seaborn as sns\n'), ((263, 348), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate figure for spine generic dataset"""'}...
import os import numpy as np import scipy.stats as stats import matplotlib # If there is $DISPLAY, display the plot if os.name == 'posix' and "DISPLAY" not in os.environ: matplotlib.use('Agg') import matplotlib.pyplot as plt # noqa: E402 import glob import pathlib def plotgraph(n=100, agent='SimForgAgentWit...
[ "matplotlib.pyplot.title", "numpy.quantile", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "numpy.genfromtxt", "numpy.hstack", "matplotlib.pyplot.style.use", "matplotlib.use", "matplotlib.pyplot.figure", "numpy.array", "pathlib.Path", "matplotlib.pyplot.tight_layout" ]
[((176, 197), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (190, 197), False, 'import matplotlib\n'), ((887, 918), 'numpy.quantile', 'np.quantile', (['dataf', '(0.5)'], {'axis': '(0)'}), '(dataf, 0.5, axis=0)\n', (898, 918), True, 'import numpy as np\n'), ((929, 961), 'numpy.quantile', 'np.quan...
import logging import os import errno import datetime as dt import progressbar import numpy as np from .neuralnet import NeuralNetDetector, NeuralNetTriage from .preprocess.detect import threshold_detection from .preprocess.filter import whitening_matrix, whitening, butterworth from .preprocess.score import get_score...
[ "numpy.divide", "numpy.abs", "os.path.join", "numpy.logical_and", "numpy.concatenate", "numpy.ceil", "numpy.zeros", "numpy.amax", "numpy.append", "numpy.max", "numpy.arange", "numpy.vstack", "progressbar.ProgressBar", "datetime.datetime.now", "numpy.fromstring", "logging.getLogger" ]
[((1246, 1273), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1263, 1273), False, 'import logging\n'), ((2190, 2233), 'numpy.fromstring', 'np.fromstring', (['rec'], {'dtype': 'self.config.dtype'}), '(rec, dtype=self.config.dtype)\n', (2203, 2233), True, 'import numpy as np\n'), ((2881, ...
# -*- coding: utf-8 -*- """ Integration tests for solidspy """ import numpy as np from scipy.sparse.linalg import eigsh import solidspy.postprocesor as pos import solidspy.assemutil as ass import solidspy.solutil as sol def test_4_elements(): """2×2 mesh with uniaxial load""" nodes = np.array([ [...
[ "solidspy.assemutil.assembler", "solidspy.assemutil.DME", "numpy.allclose", "solidspy.solutil.static_sol", "numpy.zeros", "solidspy.assemutil.loadasem", "scipy.sparse.linalg.eigsh", "numpy.array", "numpy.linspace", "solidspy.postprocesor.complete_disp" ]
[((296, 409), 'numpy.array', 'np.array', (['[[0, 0, 0], [1, 2, 0], [2, 2, 2], [3, 0, 2], [4, 1, 0], [5, 2, 1], [6, 1, 2\n ], [7, 0, 1], [8, 1, 1]]'], {}), '([[0, 0, 0], [1, 2, 0], [2, 2, 2], [3, 0, 2], [4, 1, 0], [5, 2, 1],\n [6, 1, 2], [7, 0, 1], [8, 1, 1]])\n', (304, 409), True, 'import numpy as np\n'), ((526, ...
import numpy as np import glob import os import matplotlib.pyplot as plt #fileroot = '/home/common/data/cpu-b000-hp01/cryo_data/data2/20180920/' + \ # '1537461840/outputs' fileroot = '/data/smurf_data/20181107/1541621474/outputs' files = glob.glob(os.path.join(fileroot, '*freq_full_band_resp.txt')) #files = np.arra...
[ "matplotlib.pyplot.tight_layout", "numpy.abs", "matplotlib.pyplot.get_cmap", "os.path.join", "numpy.zeros", "numpy.argsort", "numpy.mean", "numpy.arange", "numpy.loadtxt", "matplotlib.pyplot.subplots" ]
[((466, 486), 'numpy.loadtxt', 'np.loadtxt', (['files[0]'], {}), '(files[0])\n', (476, 486), True, 'import numpy as np\n'), ((493, 509), 'numpy.argsort', 'np.argsort', (['freq'], {}), '(freq)\n', (503, 509), True, 'import numpy as np\n'), ((553, 594), 'numpy.zeros', 'np.zeros', (['(n_files, n_pts)'], {'dtype': 'complex...
# assemble infer result # -*- coding: utf-8 -*- # # 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/license/LICENSE-2.0 ...
[ "os.listdir", "os.path.join", "argparse.ArgumentParser", "numpy.fromfile" ]
[((744, 807), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Calculate the BLEU score"""'}), "(description='Calculate the BLEU score')\n", (767, 807), False, 'import argparse\n'), ((1123, 1145), 'os.listdir', 'os.listdir', (['source_dir'], {}), '(source_dir)\n', (1133, 1145), False, 'imp...
""" Example to show how to draw text using OpenCV """ # Import required packages: import cv2 import numpy as np import matplotlib.pyplot as plt def show_with_matplotlib(img, title): """Shows an image using matplotlib capabilities""" # Convert BGR image to RGB: img_RGB = img[:, :, ::-1] # Show the i...
[ "matplotlib.pyplot.title", "cv2.putText", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "numpy.random.randint" ]
[((958, 996), 'numpy.zeros', 'np.zeros', (['(120, 512, 3)'], {'dtype': '"""uint8"""'}), "((120, 512, 3), dtype='uint8')\n", (966, 996), True, 'import numpy as np\n'), ((1148, 1275), 'cv2.putText', 'cv2.putText', (['image', '"""Mastering OpenCV4 with Python"""', '(10, 30)', 'cv2.FONT_HERSHEY_SIMPLEX', '(0.9)', "colors['...
from kneuralnet.nn import NeuralNet import pytest import numpy as np data = np.array([[0,0,0], [0,1,1], [1,0,1], [1,1,0]]) X = np.array(data[:,0:-1]) Y = np.array([data[:,-1]]).T nand = np.array([[0,0,1], [0,1,1], [1,0,1], ...
[ "kneuralnet.nn.NeuralNet", "numpy.array" ]
[((78, 132), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 0]]'], {}), '([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 0]])\n', (86, 132), True, 'import numpy as np\n'), ((180, 203), 'numpy.array', 'np.array', (['data[:, 0:-1]'], {}), '(data[:, 0:-1])\n', (188, 203), True, 'import numpy as np\n'), (...
#!/usr/bin/env python """steering: calculates whether to brake, or where to turn, and publishes it. Uses ackerman's steering to determine where to turn. Subscribes: world_model Image calculated model of movability around the car lidar_model Image model of drivable (obstacle-free) area in front of car Publishe...
[ "rospy.logerr", "rospy.Subscriber", "numpy.sum", "cv2.bitwise_and", "numpy.sin", "image_utils.draw_pose_viz", "image_utils.create_tentacle_mask", "numpy.tan", "rospy.init_node", "numpy.linspace", "buzzmobile.msg.CarPose", "rospy.loginfo", "numpy.cos", "cv_bridge.CvBridge", "numpy.zeros",...
[((814, 824), 'cv_bridge.CvBridge', 'CvBridge', ([], {}), '()\n', (822, 824), False, 'from cv_bridge import CvBridge\n'), ((831, 886), 'rospy.Publisher', 'rospy.Publisher', (['"""auto_car_pose"""', 'CarPose'], {'queue_size': '(1)'}), "('auto_car_pose', CarPose, queue_size=1)\n", (846, 886), False, 'import rospy\n'), ((...
""" Manually defined network - directly by ndarray or with function. The data structure to generate and manage connections between neurons. Contains generation, arithmetic and get operations. Updates are handled in spikey.snn.Synapse objects. """ import numpy as np from spikey.module import Key from spikey.snn.weight.t...
[ "numpy.ma.copy", "numpy.ma.array", "spikey.module.Key", "numpy.ma.clip" ]
[((2421, 2445), 'numpy.ma.copy', 'np.ma.copy', (['self._matrix'], {}), '(self._matrix)\n', (2431, 2445), True, 'import numpy as np\n'), ((2469, 2514), 'numpy.ma.clip', 'np.ma.clip', (['self._matrix', '(0)', 'self._max_weight'], {}), '(self._matrix, 0, self._max_weight)\n', (2479, 2514), True, 'import numpy as np\n'), (...
import numpy as np from numpy import ndarray from sklearn.neighbors import KNeighborsRegressor __all__ = ["GridSampler"] class GridSampler(object): def __init__(self, data: ndarray, longitude: ndarray, latitude: ndarray, k: int = 5): """ :param data: dbz :param longitude: ...
[ "numpy.dstack", "sklearn.neighbors.KNeighborsRegressor", "numpy.isnan" ]
[((883, 937), 'sklearn.neighbors.KNeighborsRegressor', 'KNeighborsRegressor', ([], {'n_neighbors': 'k', 'weights': '"""distance"""'}), "(n_neighbors=k, weights='distance')\n", (902, 937), False, 'from sklearn.neighbors import KNeighborsRegressor\n'), ((828, 860), 'numpy.dstack', 'np.dstack', (['[longitude, latitude]'],...
def read(filename, path='dataset/'): import numpy as np return np.loadtxt(path+filename, delimiter=',') def center(data): ''' center data and return mean ''' import numpy as np mean = np.mean(data[:, 2]) data[:, 2] -= mean return mean def data_to_list(N, M, data): ''' ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.mean", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((71, 113), 'numpy.loadtxt', 'np.loadtxt', (['(path + filename)'], {'delimiter': '""","""'}), "(path + filename, delimiter=',')\n", (81, 113), True, 'import numpy as np\n'), ((218, 237), 'numpy.mean', 'np.mean', (['data[:, 2]'], {}), '(data[:, 2])\n', (225, 237), True, 'import numpy as np\n'), ((861, 888), 'matplotlib...
import numpy as np import pandas as pd from scipy.special import factorial from itertools import combinations, permutations, chain from warnings import warn class Kruskals(object): """ Class to run William Kruskal's algorithm Parameters ---------- ndarr : numpy.ndarray (dtype: float/int) ...
[ "scipy.special.factorial", "numpy.nan_to_num", "numpy.empty", "numpy.corrcoef", "numpy.isnan", "numpy.apply_along_axis", "numpy.fabs", "numpy.array", "warnings.warn", "numpy.linalg.pinv", "numpy.nanmean" ]
[((3276, 3368), 'warnings.warn', 'warn', (['"""percentage() has been deprecated, please use driver_score(percentage=True)"""'], {}), "(\n 'percentage() has been deprecated, please use driver_score(percentage=True)'\n )\n", (3280, 3368), False, 'from warnings import warn\n'), ((3952, 3990), 'numpy.linalg.pinv', 'n...
import math import os import random import cv2 as cv import numpy as np import torch from torch.utils.data import Dataset from torchvision import transforms import tensorflow as tf import tfrecord_creator from config import im_size, unknown_code, fg_path, bg_path, a_path, num_valid, valid_ratio from utils import saf...
[ "numpy.random.randint", "cv2.erode", "torchvision.transforms.Normalize", "os.path.join", "utils.maybe_random_interp", "cv2.dilate", "numpy.reshape", "cv2.destroyAllWindows", "numpy.random.shuffle", "cv2.resize", "math.ceil", "cv2.waitKey", "numpy.asarray", "tfrecord_creator.read", "torch...
[((380, 392), 'utils.parse_args', 'parse_args', ([], {}), '()\n', (390, 392), False, 'from utils import safe_crop, parse_args, maybe_random_interp\n'), ((1223, 1270), 'tfrecord_creator.read', 'tfrecord_creator.read', (['"""fg"""', '"""./data/tfrecord/"""'], {}), "('fg', './data/tfrecord/')\n", (1244, 1270), False, 'imp...
import pandas import numpy as np import scipy import time import falcon import json import backend import utils class MedianAbsoluteDeviation(object): """ A timeseries is anomalous if the deviation of its latest datapoint with respect to the median is X times larger than the median of deviations. """ ...
[ "utils.backend_retreival", "pandas.stats.moments.ewma", "utils._tail_avg", "numpy.abs", "numpy.linalg.lstsq", "time", "pandas.stats.moments.ewmstd", "scipy.stats.t.isf", "json.dumps", "numpy.histogram", "numpy.mean", "numpy.array", "pandas.Series", "scipy.array", "numpy.sqrt", "utils._...
[((388, 416), 'utils.backend_retreival', 'utils.backend_retreival', (['req'], {}), '(req)\n', (411, 416), False, 'import utils\n'), ((539, 567), 'utils._non_backend_call', 'utils._non_backend_call', (['req'], {}), '(req)\n', (562, 567), False, 'import utils\n'), ((1030, 1048), 'json.dumps', 'json.dumps', (['result'], {...
import numpy as np import math from dataset_specifications.dataset import Dataset class Mixture2DSet(Dataset): def __init__(self): super().__init__() self.name = "mixture_2d" # Mixture of 6 2D isotropic gaussians, laid out along a unit circle # Not conditional, so all x:s are just...
[ "numpy.random.randn", "numpy.zeros", "numpy.random.randint", "numpy.sin", "numpy.cos", "numpy.concatenate" ]
[((446, 474), 'numpy.random.randint', 'np.random.randint', (['(6)'], {'size': 'n'}), '(6, size=n)\n', (463, 474), True, 'import numpy as np\n'), ((633, 654), 'numpy.random.randn', 'np.random.randn', (['n', '(2)'], {}), '(n, 2)\n', (648, 654), True, 'import numpy as np\n'), ((776, 792), 'numpy.zeros', 'np.zeros', (['(n,...
import time import traceback import unittest.mock from concurrent.futures import ThreadPoolExecutor from typing import Callable, List, Optional, Tuple, TypeVar, cast import ipywidgets import ipywidgets as widgets import numpy as np import pytest import traitlets import react_ipywidgets as react from react_ipywidgets....
[ "react_ipywidgets.get_widget", "typing.cast", "react_ipywidgets.use_state_widget", "react_ipywidgets.create_context", "traceback.format_tb", "react_ipywidgets.core.component", "react_ipywidgets.core._last_interactive_vbox.close", "react_ipywidgets.core.get_widget", "pytest.mark.skipif", "numpy.ara...
[((477, 489), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (484, 489), False, 'from typing import Callable, List, Optional, Tuple, TypeVar, cast\n'), ((1235, 1263), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1249, 1263), False, 'import pytest\n'), ((1666, 1714), ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : data_preprocessing.py @Time : 2021/07/13 09:54:03 @Author : searobbersandduck @Version : 1.0 @Contact : <EMAIL> @License : (C)Copyright 2020-2021, MIT @Desc : None ''' # here put the import lib import os import sys ROOT = os.path.abs...
[ "external_lib.MedCommon.segmentation.runner.train_seg.SegmentationTrainer.load_model", "numpy.ones", "os.path.isfile", "shutil.rmtree", "os.path.join", "external_lib.MedCommon.utils.mask_utils.MaskUtils.fill_hole", "sys.path.append", "external_lib.MedCommon.segmentation.runner.train_seg.SegmentationTr...
[((382, 403), 'sys.path.append', 'sys.path.append', (['ROOT'], {}), '(ROOT)\n', (397, 403), False, 'import sys\n'), ((2465, 2481), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (2475, 2481), False, 'import os\n'), ((5307, 5326), 'os.listdir', 'os.listdir', (['in_root'], {}), '(in_root)\n', (5317, 5326), False...
""" The MIT License (MIT) Copyright (c) 2017 <NAME> """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import numpy as np import scipy as scp import logging import shutil import time import traceback from multiprocessing import Pr...
[ "mutils.json.dump", "logging.Formatter", "shutil.rmtree", "os.path.join", "logging.error", "traceback.print_exc", "logging.FileHandler", "logging.warning", "os.path.dirname", "os.path.exists", "os.path.basename", "numpy.median", "os.path.realpath", "os.makedirs", "logging.basicConfig", ...
[((352, 463), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)s %(message)s"""', 'level': 'logging.INFO', 'stream': 'sys.stdout'}), "(format='%(asctime)s %(levelname)s %(message)s', level=\n logging.INFO, stream=sys.stdout)\n", (371, 463), False, 'import logging\n'), ((532, ...
from model.MSVR import MSVR from model.utility import create_dataset,rmse from sklearn.preprocessing import MinMaxScaler import numpy as np import argparse dataPath = 'data/MackeyGlass_t17.txt' rawData = np.loadtxt(dataPath) parser = argparse.ArgumentParser( description='MSVR for Time Series Forecasting') pars...
[ "model.utility.rmse", "model.MSVR.MSVR", "argparse.ArgumentParser", "sklearn.preprocessing.MinMaxScaler", "model.utility.create_dataset", "numpy.loadtxt" ]
[((208, 228), 'numpy.loadtxt', 'np.loadtxt', (['dataPath'], {}), '(dataPath)\n', (218, 228), True, 'import numpy as np\n'), ((239, 310), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MSVR for Time Series Forecasting"""'}), "(description='MSVR for Time Series Forecasting')\n", (262, 310)...
# This script processes MIMIC-III dataset and builds a binary matrix or a count matrix depending on your input. # The output matrix is a Numpy matrix of type float32, and suitable for training medGAN. # Written by <NAME> (<EMAIL>), augmented by <NAME> (<EMAIL>) # Usage: Put this script to the folder where MIMIC-III CSV...
[ "datetime.datetime.strptime", "numpy.zeros", "torch.tensor" ]
[((1232, 1281), 'datetime.datetime.strptime', 'datetime.strptime', (['tokens[3]', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(tokens[3], '%Y-%m-%d %H:%M:%S')\n", (1249, 1281), False, 'from datetime import datetime\n'), ((4059, 4079), 'torch.tensor', 'torch.tensor', (['matrix'], {}), '(matrix)\n', (4071, 4079), False, 'import to...
#auxilliary routines import numpy as np def apply2DRotation(pointx, pointy, theta): """apply the 2D rotation matrix to a point """ if isinstance(pointx, list) and isinstance(pointy, list): #if we pass a list of points and one angle r_mat = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(t...
[ "numpy.poly1d", "numpy.hstack", "numpy.min", "numpy.sin", "numpy.array", "numpy.linspace", "numpy.cos", "numpy.dot", "numpy.vstack", "numpy.sqrt" ]
[((1866, 1904), 'numpy.linspace', 'np.linspace', (['(0)', 'time_sim', 'cop.shape[1]'], {}), '(0, time_sim, cop.shape[1])\n', (1877, 1904), True, 'import numpy as np\n'), ((1975, 2023), 'numpy.linspace', 'np.linspace', (['(0)', 'time_sim', 'current_foots.shape[0]'], {}), '(0, time_sim, current_foots.shape[0])\n', (1986,...
import json import random import collections import torch from torch.autograd import Variable import torch.utils.data as Data from torchvision.ops import box_iou from config import opt from utils import non_model from make_dataset import train_Dataset, val_Dataset from net import model_tools import numpy as np from tqd...
[ "numpy.random.seed", "numpy.argmax", "numpy.argsort", "utils.non_model.make_path_folder", "numpy.mean", "torch.no_grad", "utils.non_model.read_kwargs", "make_dataset.val_Dataset", "collections.deque", "net.model_tools.get_model", "torchvision.ops.box_iou", "torch.utils.data.DataLoader", "res...
[((367, 400), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (390, 400), False, 'import warnings\n'), ((413, 455), 'resource.getrlimit', 'resource.getrlimit', (['resource.RLIMIT_NOFILE'], {}), '(resource.RLIMIT_NOFILE)\n', (431, 455), False, 'import resource\n'), ((456, 51...
"""The Bayesian Neural Network that learns the transformation of the target distribution to the predictor distribution, which results in the conditional distribution of the predictor conditional on the target. """ import numpy as np import tensorflow as tf import tensorflow_probability as tfp from psych_metric.distri...
[ "tensorflow.keras.layers.Dense", "tensorflow.local_variables_initializer", "tensorflow.assign", "tensorflow.Variable", "tensorflow_probability.mcmc.sample_chain", "psych_metric.distrib.mcmc.get_mcmc_kernel", "tensorflow.placeholder", "numpy.swapaxes", "tensorflow.contrib.opt.NadamOptimizer", "tens...
[((1525, 1583), 'tensorflow.nn.sigmoid', 'tf.nn.sigmoid', (['(bnn_data_rot @ hidden_weights + hidden_bias)'], {}), '(bnn_data_rot @ hidden_weights + hidden_bias)\n', (1538, 1583), True, 'import tensorflow as tf\n'), ((3166, 3224), 'tensorflow.nn.sigmoid', 'tf.nn.sigmoid', (['(bnn_data_rot @ hidden_weights + hidden_bias...
# coding: utf-8 # # Text Summarization in Python # # ## Approach: # Extractive text summarization is all about finding the more important sentences from a document as a summary of that document. # Our approach is using the PageRank algorithm to find these 'important' sentences. # ## Implementation # ### 1. Impor...
[ "networkx.from_scipy_sparse_matrix", "sklearn.feature_extraction.text.CountVectorizer", "networkx.draw_circular", "networkx.pagerank", "fpdf.FPDF", "numpy.asarray", "sys.getsizeof", "PyPDF2.PdfFileReader", "fitz.open", "nltk.tokenize.punkt.PunktSentenceTokenizer", "sklearn.feature_extraction.tex...
[((6710, 6727), 'sklearn.feature_extraction.text.CountVectorizer', 'CountVectorizer', ([], {}), '()\n', (6725, 6727), False, 'from sklearn.feature_extraction.text import TfidfTransformer, CountVectorizer\n'), ((8833, 8871), 'networkx.from_scipy_sparse_matrix', 'nx.from_scipy_sparse_matrix', (['res_graph'], {}), '(res_g...
import os import numpy as np from tqdm import tqdm import mxnet as mx from mxnet import gluon, autograd from gluoncv.utils import LRScheduler from gluoncv.utils.metrics.voc_segmentation import batch_pix_accuracy, batch_intersection_union from gluoncv.model_zoo.segbase import SoftmaxCrossEntropyLoss from mylib.deepla...
[ "mxnet.nd.waitall", "tqdm.tqdm", "mylib.deeplabv3p.DeepLabv3p", "mxnet.autograd.record", "os.makedirs", "os.path.join", "gluoncv.utils.metrics.voc_segmentation.batch_intersection_union", "gluoncv.utils.metrics.voc_segmentation.batch_pix_accuracy", "os.path.exists", "numpy.spacing", "mxnet.gluon....
[((5654, 5691), 'os.path.expanduser', 'os.path.expanduser', (['"""~/myDataset/voc"""'], {}), "('~/myDataset/voc')\n", (5672, 5691), False, 'import os\n'), ((870, 913), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.mxnet/datasets/voc"""'], {}), "('~/.mxnet/datasets/voc')\n", (888, 913), False, 'import os\n'), ((1...
import numpy as np data2 = [[1,2,3,4], [5,6,7,8]] arr2 = np.array(data2) print(arr2) print(arr2.shape) data3 = [[1,2,3,4], [5,6,7,8,9]] print(data3) arr3 = np.array(data3) print(arr3) print(arr3.shape) data4 = [[1,2,3,4], [5,6,7,8], [9,10,11,12]] arr4 = np.array(data4) arr5 = np.array([[1,2,3], [4,5,6,7]]) ar...
[ "numpy.array" ]
[((59, 74), 'numpy.array', 'np.array', (['data2'], {}), '(data2)\n', (67, 74), True, 'import numpy as np\n'), ((161, 176), 'numpy.array', 'np.array', (['data3'], {}), '(data3)\n', (169, 176), True, 'import numpy as np\n'), ((261, 276), 'numpy.array', 'np.array', (['data4'], {}), '(data4)\n', (269, 276), True, 'import n...
import os import numpy as np import cv2 import threading import time import logging import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import itertools class Analysis: def __init__(self, datasets_dir, ground_truth_filename, number_top, log_analysis, debug=True, record_nones=F...
[ "matplotlib.pyplot.title", "os.mkdir", "matplotlib.pyplot.suptitle", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.arange", "cv2.rectangle", "cv2.imshow", "matplotlib.pyplot.tight_layout", "os.path.join", "numpy.set_printoptions", "matplotlib.pyplot.close", "matplotlib.pyplot.imshow", ...
[((102, 123), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (116, 123), False, 'import matplotlib\n'), ((2128, 2157), 'os.listdir', 'os.listdir', (['self.datasets_dir'], {}), '(self.datasets_dir)\n', (2138, 2157), False, 'import os\n'), ((6385, 6414), 'os.listdir', 'os.listdir', (['self.datasets...
from environment import * import numpy as np def policy_evaluation(env, policy, gamma, theta, max_iterations): value = np.zeros(env.n_states, dtype=np.float) # TODO iterations = 0 # limit algorithm to max_interactions while iterations < max_iterations: iterations += 1 # initialize...
[ "numpy.array", "numpy.abs", "numpy.zeros" ]
[((125, 163), 'numpy.zeros', 'np.zeros', (['env.n_states'], {'dtype': 'np.float'}), '(env.n_states, dtype=np.float)\n', (133, 163), True, 'import numpy as np\n'), ((1242, 1292), 'numpy.zeros', 'np.zeros', (['(env.n_states, env.n_actions)'], {'dtype': 'int'}), '((env.n_states, env.n_actions), dtype=int)\n', (1250, 1292)...
""" Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany 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/LI...
[ "argparse.ArgumentParser", "numpy.isnan", "bpreg.network_architecture.bpr_model.BodyPartRegression", "numpy.arange", "torch.device", "torch.no_grad", "sys.path.append", "bpreg.settings.model_settings.ModelSettings", "os.path.exists", "numpy.transpose", "bpreg.score_processing.BodyPartExaminedDic...
[((754, 779), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (769, 779), False, 'import os, sys\n'), ((13034, 13049), 'bpreg.settings.model_settings.ModelSettings', 'ModelSettings', ([], {}), '()\n', (13047, 13049), False, 'from bpreg.settings.model_settings import ModelSettings\n'), ((13...
#!/usr/bin/env python # coding: utf-8 # ./session.py from __future__ import division import os from glob import glob import shutil import numpy as np import pandas as pd from prody import * from .sblu import pwrmsd, rmsd from .inout import extract from .transform import read_ftresults, read_rotations, apply_ftresu...
[ "os.path.basename", "pandas.read_csv", "numpy.mean", "os.path.split", "os.path.join", "shutil.copy" ]
[((483, 526), 'os.path.join', 'os.path.join', (['self.raw_path', '"""ft.000.00.gz"""'], {}), "(self.raw_path, 'ft.000.00.gz')\n", (495, 526), False, 'import os\n'), ((550, 593), 'os.path.join', 'os.path.join', (['self.raw_path', '"""ft.002.00.gz"""'], {}), "(self.raw_path, 'ft.002.00.gz')\n", (562, 593), False, 'import...
#!/opt/anaconda2/bin/python # -*- coding: utf-8 -*- """ ################################################################################ # # Copyright (c) 2015 <NAME> # All rights reserved # Distributed under the terms of the MIT license # ############################################################################...
[ "matplotlib.pyplot.show", "argparse.ArgumentParser", "os.path.basename", "sys.argv.append", "numpy.zeros", "sys.path.insert", "sys.argv.extend", "numpy.array", "sys.stderr.write", "matplotlib.pyplot.subplots", "argparse.FileType" ]
[((990, 1018), 'sys.path.insert', 'sys_path.insert', (['(0)', '"""./Pipe"""'], {}), "(0, './Pipe')\n", (1005, 1018), True, 'from sys import path as sys_path\n'), ((1578, 1633), 'numpy.zeros', 'np.zeros', (['(p * patch_size, q * patch_size)'], {'dtype': 'float'}), '((p * patch_size, q * patch_size), dtype=float)\n', (15...
import tomopy import numpy as np import dxchange from util import * import time import os PI = 3.1415927 # ============================================ theta_st = 0 theta_end = PI n_epochs = 200 sino_range = (600, 601, 1) center = 958 downsample = (3, 0, 0) # ============================================ def recons...
[ "tomopy.recon", "tomopy.downsample", "time.time", "dxchange.read_aps_32id", "numpy.linspace", "os.path.join", "tomopy.normalize" ]
[((585, 596), 'time.time', 'time.time', ([], {}), '()\n', (594, 596), False, 'import time\n'), ((649, 695), 'dxchange.read_aps_32id', 'dxchange.read_aps_32id', (['fname'], {'sino': 'sino_range'}), '(fname, sino=sino_range)\n', (671, 695), False, 'import dxchange\n'), ((809, 840), 'tomopy.normalize', 'tomopy.normalize',...
from asyncio import Queue from enum import Enum import numpy as np import torch import math import csv from datetime import datetime import numpy as np producer_queue = Queue(maxsize=1) consumer_queue = Queue(maxsize=1) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class ActionSpace(Enum): ...
[ "csv.writer", "math.pow", "numpy.zeros", "datetime.datetime.now", "numpy.array", "torch.cuda.is_available", "asyncio.Queue" ]
[((171, 187), 'asyncio.Queue', 'Queue', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (176, 187), False, 'from asyncio import Queue\n'), ((205, 221), 'asyncio.Queue', 'Queue', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (210, 221), False, 'from asyncio import Queue\n'), ((3223, 3341), 'numpy.array', 'np.array', (["[acceler...
from copy import copy as copy from numpy import dot as dot from numpy import histogram as histogram from numpy import zeros as zeros from scipy.special import gammaincc as gammaincc class ComplexityTest: @staticmethod def linear_complexity_test(binary_data:str, verbose=False, block_size=500): """ ...
[ "numpy.zeros", "copy.copy", "numpy.histogram", "numpy.dot", "scipy.special.gammaincc" ]
[((4127, 4135), 'numpy.zeros', 'zeros', (['n'], {}), '(n)\n', (4132, 4135), True, 'from numpy import zeros as zeros\n'), ((4148, 4156), 'numpy.zeros', 'zeros', (['n'], {}), '(n)\n', (4153, 4156), True, 'from numpy import zeros as zeros\n'), ((2705, 2751), 'scipy.special.gammaincc', 'gammaincc', (['(degree_of_freedom / ...
from math import isnan import numpy as np def nan_leastsquare(measured_vals, updated_model, weights, x, y=None): """ Least square statistic with optional weights. This function is a copy of the original astropy code handling nan values. Parameters ---------- measured_vals : `~numpy.nda...
[ "numpy.nanmean" ]
[((986, 1031), 'numpy.nanmean', 'np.nanmean', (['((model_vals - measured_vals) ** 2)'], {}), '((model_vals - measured_vals) ** 2)\n', (996, 1031), True, 'import numpy as np\n'), ((1057, 1114), 'numpy.nanmean', 'np.nanmean', (['((weights * (model_vals - measured_vals)) ** 2)'], {}), '((weights * (model_vals - measured_v...
# ################################################################################################## # Copyright (c) 2020 - Fundação CERTI # All rights reserved. # ################################################################################################## import numpy numpy.seterr(divide="ignore", invalid="ign...
[ "numpy.seterr" ]
[((278, 325), 'numpy.seterr', 'numpy.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (290, 325), False, 'import numpy\n')]
# # Copyright (C) 2020 IBM. All Rights Reserved. # # See LICENSE.txt file in the root directory # of this source tree for licensing information. # from pathlib import Path from typing import Dict, Iterable, List, Optional, Tuple, Union import cv2 import holoviews as hv import numpy as np from IPython.display import d...
[ "numpy.argmax", "cv2.cvtColor", "numpy.argmin", "vsrl.symmap.utils.draw_rects", "vsrl.symmap.utils.to_grayscale", "numpy.array", "numpy.where" ]
[((2041, 2052), 'numpy.array', 'np.array', (['s'], {}), '(s)\n', (2049, 2052), True, 'import numpy as np\n'), ((2190, 2211), 'vsrl.symmap.utils.to_grayscale', 'to_grayscale', (['raw_img'], {}), '(raw_img)\n', (2202, 2211), False, 'from vsrl.symmap.utils import draw_rects, drop_zeros, to_grayscale\n'), ((1421, 1436), 'v...
""" A collection of functions for managing multi-fidelity functions. -- <EMAIL> """ # pylint: disable=import-error # pylint: disable=no-member # pylint: disable=invalid-name # pylint: disable=relative-import # pylint: disable=super-on-old-class import numpy as np # Local imports from utils.general_utils import map...
[ "numpy.random.shuffle", "numpy.indices", "numpy.random.random", "utils.general_utils.map_to_bounds", "numpy.array", "numpy.linspace", "numpy.vstack", "numpy.sqrt", "utils.general_utils.map_to_cube", "numpy.repeat" ]
[((1255, 1277), 'numpy.array', 'np.array', (['fidel_bounds'], {}), '(fidel_bounds)\n', (1263, 1277), True, 'import numpy as np\n'), ((1303, 1326), 'numpy.array', 'np.array', (['domain_bounds'], {}), '(domain_bounds)\n', (1311, 1326), True, 'import numpy as np\n'), ((9648, 9690), 'numpy.repeat', 'np.repeat', (['self.fin...
# <NAME>, ddk960, 11096287 # a6q1 # CMPT 141, Assignment 6 # Arrarys # Continue your codes based on this starter file import numpy as np import csv import math as m def perchange(nval,row): lis=[] lis=[abs(((nval[row][i]-nval[row][i-1])/nval[row][i-1])*100) for i in range(1,5)] return lis # put the csv ...
[ "numpy.array", "csv.reader", "numpy.sum" ]
[((408, 436), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""","""'}), "(f, delimiter=',')\n", (418, 436), False, 'import csv\n'), ((934, 949), 'numpy.array', 'np.array', (['data2'], {}), '(data2)\n', (942, 949), True, 'import numpy as np\n'), ((1027, 1053), 'numpy.sum', 'np.sum', (['data_array'], {'axis': '(0)'}...
import math import numpy as np from mindspore.common.tensor import Tensor def _average_units(shape): if not shape: return 1 if len(shape) == 1: return float(shape[0]) if len(shape) == 2: return float(shape[0] + shape[1]) / 2. raise RuntimeError("not support shape.") ...
[ "numpy.random.uniform", "math.sqrt", "numpy.zeros", "numpy.ones", "mindspore.common.tensor.Tensor", "numpy.random.normal" ]
[((471, 493), 'math.sqrt', 'math.sqrt', (['(3.0 * scale)'], {}), '(3.0 * scale)\n', (480, 493), False, 'import math\n'), ((612, 626), 'mindspore.common.tensor.Tensor', 'Tensor', (['values'], {}), '(values)\n', (618, 626), False, 'from mindspore.common.tensor import Tensor\n'), ((711, 723), 'mindspore.common.tensor.Tens...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 7 14:31:56 2017 @author: <NAME> """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import animation from scipy.spatial import ConvexHull from scipy.misc import imread import time import datetime from pylab i...
[ "matplotlib.pyplot.title", "sklearn.preprocessing.MinMaxScaler", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.mean", "pandas.read_table", "pandas.DataFrame", "matplotlib.pyplot.close", "numpy.isfinite", "matplotlib.pyplot.subplots", "pandas.ExcelWriter", "datetime.datetime.fromtimestamp",...
[((1164, 1348), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['period', 'participant', 'dwg', 'viewing', 'viewingAvgHullArea',\n 'viewingTime', 'dwgAvgHullArea', 'dwgTime', 'participantAvgHullArea',\n 'participantTime']"}), "(columns=['period', 'participant', 'dwg', 'viewing',\n 'viewingAvgHullArea', ...
import numpy as np import matplotlib.pyplot as plt # def verguero(): # lista = list(range(10))*2 # encontro = True # cuenta = 0 # while encontro: # rand1 = int(np.random.uniform(0,20)) # media1 = lista.pop(rand1) # rand2 = int(np.random.uniform(0,19)) # media2 = lista.po...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "numpy.random.random", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.hist2d", "matplotlib.pyplot.subplots" ]
[((2506, 2543), 'matplotlib.pyplot.hist2d', 'plt.hist2d', (['x_lista', 'y_lista'], {'bins': '(50)'}), '(x_lista, y_lista, bins=50)\n', (2516, 2543), True, 'import matplotlib.pyplot as plt\n'), ((2578, 2588), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2586, 2588), True, 'import matplotlib.pyplot as plt\n')...
""" Transforms the map.png files from EWAP scenarios using their H.txt files. """ import argparse from pathlib import Path import numpy as np from matplotlib.image import imread from PIL import Image parser = argparse.ArgumentParser() parser.add_argument( 'map_file', help='path to map.png image file containi...
[ "argparse.ArgumentParser", "numpy.savetxt", "numpy.zeros", "numpy.ones", "numpy.indices", "numpy.max", "numpy.array", "numpy.matmul", "numpy.round" ]
[((212, 237), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (235, 237), False, 'import argparse\n'), ((953, 981), 'numpy.matmul', 'np.matmul', (['hmat', 'h_pixel_pos'], {}), '(hmat, h_pixel_pos)\n', (962, 981), True, 'import numpy as np\n'), ((1281, 1329), 'numpy.array', 'np.array', (['[shifte...
import pytest import numpy as np import skgstat as skg import scipy # produce a random dataset np.random.seed(42) rcoords = np.random.gamma(40, 10, size=(500, 2)) np.random.seed(42) rvals = np.random.normal(10, 4, 500) def test_invalid_dist_func(): # instantiate metrix space ms = skg.MetricSpace(rcoords, dist...
[ "numpy.meshgrid", "numpy.random.seed", "skgstat.MetricSpace", "skgstat.MetricSpacePair", "numpy.random.gamma", "pytest.raises", "numpy.arange", "skgstat.RasterEquidistantMetricSpace", "numpy.random.normal", "numpy.array", "pytest.approx", "numpy.concatenate", "skgstat.Variogram" ]
[((96, 114), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (110, 114), True, 'import numpy as np\n'), ((125, 163), 'numpy.random.gamma', 'np.random.gamma', (['(40)', '(10)'], {'size': '(500, 2)'}), '(40, 10, size=(500, 2))\n', (140, 163), True, 'import numpy as np\n'), ((164, 182), 'numpy.random.seed...
from ..base import RNGDataFlow from ...utils import logger,fs import os import numpy as np def load_data_from_npzs(fnames): if not isinstance(fnames, list): fnames = [fnames] Xs = [] Ys = [] for fname in fnames: d = np.load(fname) logger.info('Loading from {}'.format(fname)) ...
[ "numpy.stack", "numpy.load", "numpy.asarray", "numpy.zeros", "os.path.exists", "numpy.array", "numpy.arange" ]
[((1450, 1612), 'numpy.array', 'np.array', (['[0.16845114, 0.23258652, 0.00982927, 0.31658215, 0.0448627, 0.09724055, \n 0.01172954, 0.01126809, 0.05865686, 0.00639231, 0.00291665, 0.03948423]'], {}), '([0.16845114, 0.23258652, 0.00982927, 0.31658215, 0.0448627, \n 0.09724055, 0.01172954, 0.01126809, 0.05865686, ...
from enum import Enum import numpy as np from math import sqrt from table import Table class Data: def __init__(self, params=[], labelValues=None): # , trainCount, testCount """ params = [dict] """ self.params = params self.labelValues = labelValues self.x = [] ...
[ "numpy.full", "matplotlib.pyplot.show", "math.sqrt", "matplotlib.pyplot.scatter", "numpy.array", "numpy.concatenate" ]
[((5688, 5761), 'matplotlib.pyplot.scatter', 'plt.scatter', (["training['x']", "training['y']"], {'c': "training['label']", 'alpha': '(0.5)'}), "(training['x'], training['y'], c=training['label'], alpha=0.5)\n", (5699, 5761), True, 'import matplotlib.pyplot as plt\n'), ((5766, 5776), 'matplotlib.pyplot.show', 'plt.show...
import numpy from mpmath import mp from sympy import Rational as frac from sympy import sqrt from ..helpers import article, fsd, pm, pm_array, pm_array0, untangle from ._helpers import SphereScheme, cartesian_to_spherical_sympy citation = article( authors=["<NAME>"], title="Optimal Numerical Integration on a ...
[ "sympy.Rational", "sympy.sqrt", "numpy.array", "numpy.column_stack", "numpy.sqrt" ]
[((960, 970), 'sympy.Rational', 'frac', (['(1)', '(2)'], {}), '(1, 2)\n', (964, 970), True, 'from sympy import Rational as frac\n'), ((1664, 1672), 'sympy.sqrt', 'sqrt', (['r2'], {}), '(r2)\n', (1668, 1672), False, 'from sympy import sqrt\n'), ((1681, 1689), 'sympy.sqrt', 'sqrt', (['s2'], {}), '(s2)\n', (1685, 1689), F...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 6 17:25:11 2020 @author: nmei """ import os from tqdm import tqdm import numpy as np import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.model_selection import LeavePOut,cross_validate from sklearn....
[ "seaborn.heatmap", "sklearn.preprocessing.StandardScaler", "numpy.abs", "numpy.sum", "pandas.read_csv", "os.path.join", "sklearn.base.clone", "pandas.DataFrame", "matplotlib.pyplot.subplots", "pandas.concat", "seaborn.set_style", "numpy.fill_diagonal", "pandas.read_excel", "sklearn.linear_...
[((531, 553), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (544, 553), True, 'import seaborn as sns\n'), ((665, 711), 'os.path.join', 'os.path.join', (['working_dir', '"""sampled_words.csv"""'], {}), "(working_dir, 'sampled_words.csv')\n", (677, 711), False, 'import os\n'), ((726, 852), '...
"""Takeoff-hover-land for one CF. Useful to validate hardware config.""" from pycrazyswarm import Crazyswarm from scipy.integrate import solve_ivp import numpy as np import math import matplotlib.pyplot as plt from mpl_toolkits import mplot3d SETUP_DURATION = 2.0 TAKEOFF_DURATION = 2.0 HEIGHT = 1.0 X_INITIAL = 0.0...
[ "matplotlib.pyplot.show", "pycrazyswarm.Crazyswarm", "math.atan2", "matplotlib.pyplot.axes", "math.sqrt", "scipy.integrate.solve_ivp", "numpy.transpose", "numpy.hstack", "matplotlib.pyplot.figure", "numpy.sin", "numpy.array", "numpy.cos", "numpy.sign", "numpy.linspace", "matplotlib.pyplo...
[((1361, 1373), 'pycrazyswarm.Crazyswarm', 'Crazyswarm', ([], {}), '()\n', (1371, 1373), False, 'from pycrazyswarm import Crazyswarm\n'), ((1800, 1874), 'numpy.array', 'np.array', (['[[X_INITIAL, Y_INITIAL, Z_INITIAL, Alpha_INITIAL, Beta_INITIAL]]'], {}), '([[X_INITIAL, Y_INITIAL, Z_INITIAL, Alpha_INITIAL, Beta_INITIAL...
import json import numpy as np class LocationMapBounds: def __init__(self, t=0, y=0, x=0): self._t = t self._y = y self._x = x @property def t(self): return self._t @property def y(self): return self._y @property def x(self): return self._x c...
[ "numpy.zeros", "numpy.sum", "json.dumps" ]
[((861, 891), 'numpy.zeros', 'np.zeros', (['[bounds.y, bounds.x]'], {}), '([bounds.y, bounds.x])\n', (869, 891), True, 'import numpy as np\n'), ((2175, 2362), 'json.dumps', 'json.dumps', (["{'meta_data': {'time_delta': self.time_delta, 'bounds': {'t': self.bounds.t,\n 'y': self.bounds.y, 'x': self.bounds.x}}, 'map':...
import operator import pytest import numpy as np from ...core import ProxyTypeError from ...containers import Tuple, List from ...identifier import parameter from ..bool_ import Bool from ..string import Str from ..number import Float, Int, Number, _binop_result from ...core.tests.utils import operator_test class ...
[ "numpy.uint32", "numpy.float16", "numpy.uint64", "numpy.uint8", "numpy.datetime64", "numpy.float32", "pytest.raises", "numpy.float64", "numpy.int32", "numpy.int64", "numpy.uint16", "pytest.mark.parametrize", "numpy.int16", "numpy.int8" ]
[((4683, 6791), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""operator, accepted_types, return_type"""', "[['__abs__', (), Int], ['__add__', (Int, Float, Bool), {Float: Float, Int:\n Int, Bool: Int}], ['__div__', (Int, Float, Bool), (Int, Float)], [\n '__divmod__', (Int, Float, Bool), {Float: Tuple[...
#!/usr/bin/env python """ Calculate statistical results for FITS images """ import os import sys import re import argparse import logging import textwrap import os.path from astropy.io import fits from astropy import stats import numpy as np # put parent directory into sys.path bp = os.path.dirname(os.path.realpath(_...
[ "numpy.abs", "astropy.stats.sigma_clipped_stats", "mutils.init_logging", "numpy.shape", "numpy.mean", "imutils.subtract_bias", "imutils.get_requested_image_hduids", "logging.error", "numpy.std", "logging.warning", "mutils.init_warnings", "numpy.max", "imutils.auto_biastype", "os.sep.join",...
[((354, 384), 'os.sep.join', 'os.sep.join', (["(bp[:-1] + ['lib'])"], {}), "(bp[:-1] + ['lib'])\n", (365, 384), False, 'import os\n'), ((385, 412), 'sys.path.insert', 'sys.path.insert', (['(0)', 'modpath'], {}), '(0, modpath)\n', (400, 412), False, 'import sys\n'), ((4240, 4270), 'mutils.init_logging', 'mu.init_logging...
import datetime import os import logging import torch as th import numpy as np from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter import ttools from dps_3d import datasets from dps_3d.interfaces import VectorizerInterface from dps_3d.models import PrimsModel LOG = logging.get...
[ "ttools.callbacks.CheckpointingCallback", "ttools.Trainer", "numpy.random.seed", "torch.utils.data.DataLoader", "ttools.callbacks.TensorBoardLoggingCallback", "torch.manual_seed", "dps_3d.datasets.ShapenetDataset", "dps_3d.models.PrimsModel", "datetime.datetime.now", "dps_3d.interfaces.VectorizerI...
[((309, 336), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (326, 336), False, 'import logging\n'), ((338, 357), 'torch.manual_seed', 'th.manual_seed', (['(123)'], {}), '(123)\n', (352, 357), True, 'import torch as th\n'), ((397, 416), 'numpy.random.seed', 'np.random.seed', (['(123)'], {...
import sys import os import time import dill as pickle import pprint import numpy as np import pandas as pd import tensorflow as tf sys.path.append('keras-tcn') from tcn import tcn import h5py import matplotlib.pyplot as plt from sklearn.model_selection import KFold from sklearn.model_selection import train_test_spl...
[ "sys.path.append", "numpy.load", "numpy.std", "keras.callbacks.ModelCheckpoint", "hyperopt.hp.choice", "keras.layers.Dropout", "keras.layers.merge.concatenate", "keras.optimizers.Adam", "keras.models.Input", "keras.models.Model", "numpy.mean", "numpy.arange", "keras.callbacks.EarlyStopping",...
[((133, 161), 'sys.path.append', 'sys.path.append', (['"""keras-tcn"""'], {}), "('keras-tcn')\n", (148, 161), False, 'import sys\n'), ((2303, 2327), 'numpy.arange', 'np.arange', (['(0.0)', '(0.9)', '(0.1)'], {}), '(0.0, 0.9, 0.1)\n', (2312, 2327), True, 'import numpy as np\n'), ((1499, 1547), 'numpy.load', 'np.load', (...
# Copyright (c) 2021 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...
[ "paddle.to_tensor", "numpy.random.rand", "numpy.random.seed", "paddle.nn.BatchNorm2D" ]
[((747, 766), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (761, 766), True, 'import numpy as np\n'), ((892, 919), 'paddle.nn.BatchNorm2D', 'BatchNorm2D', ([], {'num_features': '(3)'}), '(num_features=3)\n', (903, 919), False, 'from paddle.nn import BatchNorm2D\n'), ((924, 946), 'paddle.to_tensor'...
import time import os import re import sys import numpy as np class node: def __init__(self, id): self.id = id self.packets = [] self.sent = np.zeros(100000) self.received = np.zeros(100000) self.overflows = 0 self.n_sent = 0 def search_node(nodes,n): if(len(nod...
[ "numpy.sum", "numpy.zeros", "re.match", "numpy.mean", "re.compile" ]
[((459, 650), 're.compile', 're.compile', (['"""^.*?(?P<mins>([0-9]+)):(?P<secs>([0-9]+)).(?P<mils>([0-9]+))\tID:1\t\\\\[INFO:\\\\sApp\\\\s\\\\s\\\\s\\\\s\\\\s\\\\s\\\\s]\\\\sReceived\\\\s(?P<seqno>([0-9]+))\\\\sfrom\\\\s0(?P<source>([0-9]))"""'], {}), "(\n '^.*?(?P<mins>([0-9]+)):(?P<secs>([0-9]+)).(?P<mils>([0-9]+...
import json import os import pickle from itertools import groupby from pathlib import Path from typing import Dict, List, Tuple import checksum import numpy as np import pandas as pd from IPython import get_ipython from mmcv import Config from mmdet.core import eval_map from tqdm import tqdm from vinbigdata import Box...
[ "vinbigdata.mmdetid2classname.values", "numpy.zeros", "os.system", "vinbigdata.utils.rel2abs", "pathlib.Path", "mmcv.Config.fromfile", "numpy.array", "checksum.get_for_file", "IPython.get_ipython", "vinbigdata.utils.abs2rel", "vinbigdata.utils.is_interactive" ]
[((1169, 1211), 'checksum.get_for_file', 'checksum.get_for_file', (["model_data['model']"], {}), "(model_data['model'])\n", (1190, 1211), False, 'import checksum\n'), ((1375, 1412), 'checksum.get_for_file', 'checksum.get_for_file', (['ids_file_final'], {}), '(ids_file_final)\n', (1396, 1412), False, 'import checksum\n'...
#import argparse import sys import numpy as np input_files=open(sys.argv[1],'r') gene_list_file=open(sys.argv[2],'r') gene_list=[] for gene in gene_list_file: gene_list.append(gene.strip()) gene_list_file.close() sample_of_interest=sys.argv[3] output_file=open(sys.argv[4],'w') outlier_levels=int(sys.argv[5]) if sy...
[ "numpy.percentile", "sys.exit" ]
[((2089, 2152), 'sys.exit', 'sys.exit', (['"""Sample of interest not found in list of input files"""'], {}), "('Sample of interest not found in list of input files')\n", (2097, 2152), False, 'import sys\n'), ((433, 494), 'sys.exit', 'sys.exit', (['"""Input file header argument must be True or False."""'], {}), "('Input...
#-----------------------------------------------------------------------------# # Colorado Cannabis Cultivation and Dispensaries # February 2017 # Sources: # https://www.colorado.gov/pacific/enforcement/med-licensed-facilities # https://demography.dola.colorado.go...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.annotate", "numpy.zeros", "matplotlib.pyplot.box", "matplotlib.pyplot.colorbar", "pandas.read_excel", "matplotlib.patches.Polygon", "matplotlib.colors.rgb2hex", "matplotlib.pyplot.rc", "matplotlib.pyplot.gca", "matplotlib.pyplot.gcf", "mpl_toolkits....
[((798, 825), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (804, 825), True, 'import matplotlib.pyplot as plt\n'), ((873, 944), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (879, 944...
""" Final assignment for this week! In this assignment you will learn to implement and use gradient checking. You are part of a team working to make mobile payments available globally, and are asked to build a deep learning model to detect fraud--whenever someone makes a payment, you want to see if the pay...
[ "numpy.sum", "numpy.log", "numpy.copy", "gc_utils.vector_to_dictionary", "numpy.zeros", "gc_utils.sigmoid", "gc_utils.dictionary_to_vector", "gc_utils.relu", "numpy.linalg.norm", "gc_utils.gradients_to_vector", "numpy.int64", "numpy.dot" ]
[((3353, 3386), 'numpy.linalg.norm', 'np.linalg.norm', (['(grad - gradapprox)'], {}), '(grad - gradapprox)\n', (3367, 3386), True, 'import numpy as np\n'), ((5357, 5365), 'gc_utils.relu', 'relu', (['Z1'], {}), '(Z1)\n', (5361, 5365), False, 'from gc_utils import sigmoid, relu, dictionary_to_vector, vector_to_dictionary...
import numpy as np import matplotlib.pyplot as plt import scipy.optimize def Att(f, ft, a): return a/((1+(f/ft)**2)**0.5) def derivata(f, ft, a): return -a*(f/ft)*((1+(f/ft)**2)**(-1.5)) def Bode(f, ft): return 20*(np.log10(ft/f)) def derivataBode(f, ft): return np.abs(-20/(np.log(10)*f)) Vout,...
[ "matplotlib.pyplot.xscale", "matplotlib.pyplot.subplot", "matplotlib.pyplot.yscale", "numpy.diag", "matplotlib.pyplot.show", "numpy.log", "matplotlib.pyplot.plot", "numpy.logspace", "matplotlib.pyplot.legend", "numpy.genfromtxt", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pypl...
[((336, 389), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data.txt"""'], {'skip_header': '(1)', 'unpack': '(True)'}), "('data.txt', skip_header=1, unpack=True)\n", (349, 389), True, 'import numpy as np\n'), ((1579, 1602), 'numpy.logspace', 'np.logspace', (['(1)', '(5)', '(4000)'], {}), '(1, 5, 4000)\n', (1590, 1602), Tr...
""" gen_data_utils -------------- Miscellanious functions for generating fake data to test MDN performance. """ import numpy as np import keras import matplotlib.pyplot as plt from IPython.display import clear_output def u_shape(n=1000,x=None): """ Create upside-down u (unimodal) data parameters ----...
[ "numpy.random.uniform", "numpy.power", "numpy.random.rand", "numpy.random.normal" ]
[((945, 962), 'numpy.power', 'np.power', (['ps', '(0.8)'], {}), '(ps, 0.8)\n', (953, 962), True, 'import numpy as np\n'), ((1015, 1056), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0.0 * ps)', 'scale': '(1.0)'}), '(loc=0.0 * ps, scale=1.0)\n', (1031, 1056), True, 'import numpy as np\n'), ((1061, 1108), 'n...
# coding: utf-8 ''' # def a function to calcualte sugar margin __author__ = "<NAME>" __copyright__ = "Zhejian Peng" __license__ = MIT LICENSE __version__ = "1.0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Developing" __update__ = ''' import numpy as np import pandas as pd from scipy.special import ...
[ "numpy.log", "numpy.zeros", "pandas.read_excel", "numpy.array", "scipy.stats.t.ppf", "scipy.special.gamma", "numpy.sqrt" ]
[((3980, 4027), 'pandas.read_excel', 'pd.read_excel', (['"""Sugar 11 Historical Prices.xls"""'], {}), "('Sugar 11 Historical Prices.xls')\n", (3993, 4027), True, 'import pandas as pd\n'), ((4199, 4228), 'numpy.array', 'np.array', (["sugar_data['CLOSE']"], {}), "(sugar_data['CLOSE'])\n", (4207, 4228), True, 'import nump...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 29 16:53:20 2019 @author: jlee """ import numpy as np import glob, os from astropy.io import fits # ----- Directories ----- # # Basic directories cpath = os.path.abspath(".")+"/" dir_root = os.path.abspath("../")+"/" # Same as 'dir_iraf' dir_...
[ "os.path.abspath", "os.system", "astropy.io.fits.getheader", "numpy.mean", "numpy.array", "numpy.linspace", "glob.glob" ]
[((1443, 1469), 'numpy.array', 'np.array', (['[6550.0, 6580.0]'], {}), '([6550.0, 6580.0])\n', (1451, 1469), True, 'import numpy as np\n'), ((229, 249), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (244, 249), False, 'import glob, os\n'), ((265, 287), 'os.path.abspath', 'os.path.abspath', (['"""....
import tensorflow as tf import numpy as np from configuration import Config from core.models.resnet import resnet_18, resnet_34, resnet_50, resnet_101, resnet_152 from core.models.dla import dla_34, dla_60, dla_102, dla_169 from core.models.efficientdet import d0, d1, d2, d3, d4, d5, d6, d7 from data.dataloader import...
[ "core.models.efficientdet.d5", "core.loss.CombinedLoss", "core.models.efficientdet.d4", "tensorflow.reshape", "numpy.clip", "tensorflow.keras.layers.MaxPool2D", "numpy.tile", "core.models.efficientdet.d0", "tensorflow.split", "core.models.efficientdet.d2", "core.models.dla.dla_169", "core.mode...
[((400, 411), 'core.models.resnet.resnet_18', 'resnet_18', ([], {}), '()\n', (409, 411), False, 'from core.models.resnet import resnet_18, resnet_34, resnet_50, resnet_101, resnet_152\n'), ((442, 453), 'core.models.resnet.resnet_34', 'resnet_34', ([], {}), '()\n', (451, 453), False, 'from core.models.resnet import resn...
import tensorflow as tf import os import contractions import tensorflow as tf import pandas as pd import numpy as np import time import rich from rich.progress import track import spacy from model.encoder import Encoder from model.decoder import Decoder from config import params from preprocess import * from dataset ...
[ "tensorflow.keras.losses.SparseCategoricalCrossentropy", "tensorflow.not_equal", "tensorflow.train.Checkpoint", "tensorflow.reduce_mean", "time.time", "model.encoder.Encoder", "tensorflow.train.latest_checkpoint", "numpy.mean", "model.decoder.Decoder", "os.path.join", "tensorflow.GradientTape", ...
[((2018, 2033), 'model.encoder.Encoder', 'Encoder', (['params'], {}), '(params)\n', (2025, 2033), False, 'from model.encoder import Encoder\n'), ((2044, 2059), 'model.decoder.Decoder', 'Decoder', (['params'], {}), '(params)\n', (2051, 2059), False, 'from model.decoder import Decoder\n'), ((498, 519), 'tensorflow.reduce...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Seismic plotter. :copyright: 2016-22 Agile Scientific :license: Apache 2.0 """ import argparse import os import time import glob import re import datetime import sys import yaml import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mtick from ...
[ "PIL.Image.new", "argparse.ArgumentParser", "numpy.amin", "numpy.argmin", "matplotlib.pyplot.figure", "yaml.safe_load", "glob.iglob", "os.path.join", "utils.add_scribble", "seismic.Seismic.from_segy", "plotter.plot_histogram", "utils.add_rings", "notice.Notice.fail", "numpy.zeros_like", ...
[((533, 544), 'time.time', 'time.time', ([], {}), '()\n', (542, 544), False, 'import time\n'), ((1828, 1868), 'numpy.percentile', 'np.percentile', (['s.data', "cfg['percentile']"], {}), "(s.data, cfg['percentile'])\n", (1841, 1868), True, 'import numpy as np\n'), ((2519, 2530), 'time.time', 'time.time', ([], {}), '()\n...
#!/usr/bin/env python import numpy as np import rospy from geometry_msgs.msg import PoseStamped, TwistStamped from styx_msgs.msg import Lane, Waypoint from std_msgs.msg import Int32 from scipy.spatial import KDTree from copy import deepcopy import math ''' This node will publish waypoints from the car's current pos...
[ "copy.deepcopy", "rospy.logerr", "rospy.Subscriber", "math.sqrt", "styx_msgs.msg.Lane", "rospy.Publisher", "rospy.Rate", "rospy.is_shutdown", "numpy.array", "rospy.init_node", "scipy.spatial.KDTree", "numpy.dot", "styx_msgs.msg.Waypoint" ]
[((969, 1004), 'rospy.init_node', 'rospy.init_node', (['"""waypoint_updater"""'], {}), "('waypoint_updater')\n", (984, 1004), False, 'import rospy\n'), ((1014, 1074), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/current_pose"""', 'PoseStamped', 'self.pose_cb'], {}), "('/current_pose', PoseStamped, self.pose_cb)\n", (...
# __author__ : slade # __time__ : 17/12/21 import pandas as pd import numpy as np from xgboost.sklearn import XGBClassifier from sklearn.preprocessing import OneHotEncoder from sklearn.linear_model.logistic import LogisticRegression from sklearn.grid_search import GridSearchCV # load data X_train = pd.read_csv('ensem...
[ "pandas.DataFrame", "sklearn.externals.joblib.dump", "pandas.read_csv", "xgboost.sklearn.XGBClassifier", "sklearn.preprocessing.OneHotEncoder", "sklearn.linear_model.logistic.LogisticRegression", "numpy.array" ]
[((5327, 5568), 'xgboost.sklearn.XGBClassifier', 'XGBClassifier', ([], {'learning_rate': '(0.1)', 'n_estimators': '(100)', 'max_depth': '(3)', 'subsample': '(0.7)', 'min_child_weight': '(0.8)', 'colsample_bytree': '(0.7)', 'objective': '"""binary:logistic"""', 'scale_pos_weight': '(1.002252816020025)', 'reg_alpha': '(0...
#!/usr/local/bin/python3 # -*- coding: utf-8 -*- # DESCRIPTION: Given a directory with text files passed as argument # to the script, a stratified (by directory) sample of file texts # is created. # # Usage example: # python get_random_sample.py --directory=../../../Fall\ 2017/deidentified/ --n_files=2 # python ge...
[ "argparse.ArgumentParser", "os.makedirs", "os.path.dirname", "os.walk", "os.path.exists", "numpy.random.choice", "shutil.copyfile", "os.path.join", "re.sub" ]
[((654, 723), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get Random Sample of Textfiles"""'}), "(description='Get Random Sample of Textfiles')\n", (677, 723), False, 'import argparse\n'), ((1001, 1040), 're.sub', 're.sub', (['"""\\\\.\\\\.[\\\\\\\\\\\\/]"""', '""""""', 'filename'], {...
""" Test script for meslas.sampling """ import torch import numpy as np from meslas.means import ConstantMean from meslas.covariance.spatial_covariance_functions import Matern32 from meslas.covariance.cross_covariances import UniformMixing from meslas.covariance.heterotopic import FactorCovariance from meslas.geometry...
[ "meslas.covariance.heterotopic.FactorCovariance", "meslas.random_fields.GRF", "meslas.means.ConstantMean", "meslas.covariance.spatial_covariance_functions.Matern32", "torch.Tensor", "numpy.sqrt" ]
[((530, 560), 'meslas.covariance.spatial_covariance_functions.Matern32', 'Matern32', ([], {'lmbda': '(0.1)', 'sigma': '(1.0)'}), '(lmbda=0.1, sigma=1.0)\n', (538, 560), False, 'from meslas.covariance.spatial_covariance_functions import Matern32\n'), ((708, 760), 'meslas.covariance.heterotopic.FactorCovariance', 'Factor...
"""Initializers. Functions to initialize posterior distribution variables. * :func:`.xavier` - Xavier initializer * :func:`.scale_xavier` - Xavier initializer scaled for scale parameters * :func:`.pos_xavier` - positive-only initizlier ---------- """ import numpy as np from probflow.utils.settings import get_bac...
[ "tensorflow.math.log", "numpy.log", "probflow.utils.ops.ones", "tensorflow.reduce_prod", "torch.Tensor", "probflow.utils.settings.get_datatype", "probflow.utils.settings.get_backend", "torch.log" ]
[((432, 445), 'probflow.utils.settings.get_backend', 'get_backend', ([], {}), '()\n', (443, 445), False, 'from probflow.utils.settings import get_backend, get_datatype\n'), ((861, 874), 'probflow.utils.settings.get_backend', 'get_backend', ([], {}), '()\n', (872, 874), False, 'from probflow.utils.settings import get_ba...
import math import numpy as np from PuzzleLib.Containers import Sequential from PuzzleLib.Modules import Conv2D, MaxPool2D, Activation, relu, Flatten, Linear from PuzzleLib.Datasets import Cifar10Loader from PuzzleLib.Visual import showImageBasedFilters, showFilters from PuzzleLib.Handlers import Trainer, Validator ...
[ "PuzzleLib.Containers.Sequential", "PuzzleLib.Modules.Flatten", "PuzzleLib.Handlers.Trainer", "numpy.random.seed", "PuzzleLib.Modules.Activation", "PuzzleLib.Optimizers.MomentumSGD", "PuzzleLib.Datasets.Cifar10Loader", "PuzzleLib.Modules.Linear", "PuzzleLib.Modules.MaxPool2D", "PuzzleLib.Cost.Cros...
[((430, 442), 'PuzzleLib.Containers.Sequential', 'Sequential', ([], {}), '()\n', (440, 442), False, 'from PuzzleLib.Containers import Sequential\n'), ((1098, 1113), 'PuzzleLib.Datasets.Cifar10Loader', 'Cifar10Loader', ([], {}), '()\n', (1111, 1113), False, 'from PuzzleLib.Datasets import Cifar10Loader\n'), ((1226, 1246...
""" Utility Algorithm Nodes. These nodes are mainly used for testing. """ from __future__ import division, unicode_literals, print_function, absolute_import import numpy as np import traitlets as tl # Internal dependencies from podpac.core.coordinates import Coordinates from podpac.core.algorithm.algorithm import Al...
[ "numpy.meshgrid", "traitlets.Enum", "podpac.core.coordinates.Coordinates", "numpy.sin", "numpy.arange" ]
[((2063, 2099), 'podpac.core.coordinates.Coordinates', 'Coordinates', (['[c]'], {'validate_crs': '(False)'}), '([c], validate_crs=False)\n', (2074, 2099), False, 'from podpac.core.coordinates import Coordinates\n'), ((3056, 3089), 'numpy.meshgrid', 'np.meshgrid', (['*crds'], {'indexing': '"""ij"""'}), "(*crds, indexing...
import numpy as np import os from simplestat import statinf fns=["results/"+zw for zw in os.listdir("results")] fs=[np.load(fn) for fn in fns] aucs=[float(f["auc"]) for f in fs] outdims=[int(f["outdim"]) for f in fs] q={} for auc,outdim in zip(aucs,outdims): if not outdim in q.keys():q[outdim]=[] q[outdim...
[ "numpy.std", "numpy.load", "numpy.mean", "os.listdir" ]
[((119, 130), 'numpy.load', 'np.load', (['fn'], {}), '(fn)\n', (126, 130), True, 'import numpy as np\n'), ((376, 390), 'numpy.mean', 'np.mean', (['q[xx]'], {}), '(q[xx])\n', (383, 390), True, 'import numpy as np\n'), ((90, 111), 'os.listdir', 'os.listdir', (['"""results"""'], {}), "('results')\n", (100, 111), False, 'i...
import cv2 # import tensorflow as tf from tensorflow import keras import numpy as np # tf.config.set_visible_devices([], 'GPU') # tf.device("cpu") def load_image(image_path): if image_path.endswith(".gif"): cap = cv2.VideoCapture(image_path) ret, data = cap.read() else: data = cv2.imre...
[ "numpy.load", "numpy.zeros", "numpy.expand_dims", "cv2.VideoCapture", "cv2.imread", "cv2.resize" ]
[((227, 255), 'cv2.VideoCapture', 'cv2.VideoCapture', (['image_path'], {}), '(image_path)\n', (243, 255), False, 'import cv2\n'), ((312, 334), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (322, 334), False, 'import cv2\n'), ((404, 427), 'cv2.resize', 'cv2.resize', (['data', 'shape'], {}), '(data,...
import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy.ndimage import map_coordinates from skimage import data import pytest from tadataka.interpolation import interpolation def test_interpolation(): image = np.array([ [0, 1, 5], [0, 0, 2], ...
[ "pytest.raises", "tadataka.interpolation.interpolation", "numpy.array" ]
[((264, 336), 'numpy.array', 'np.array', (['[[0, 1, 5], [0, 0, 2], [4, 3, 2], [5, 6, 1]]'], {'dtype': 'np.float64'}), '([[0, 1, 5], [0, 0, 2], [4, 3, 2], [5, 6, 1]], dtype=np.float64)\n', (272, 336), True, 'import numpy as np\n'), ((423, 469), 'numpy.array', 'np.array', (['[[0.1, 1.2], [1.1, 2.1], [2.0, 2.3]]'], {}), '...
import argparse import polygon_primitives.polygon as pp import polygon_primitives.edge as pe import utm from shapely.geometry import Polygon import geopandas import numpy as np import cv2 _projections = {} def compute_centroid(points): centroid = np.mean(points) return centroid def parse_polygon_file(filenam...
[ "utm.from_latlon", "polygon_primitives.edge.Edge", "argparse.ArgumentParser", "shapely.geometry.Polygon", "numpy.transpose", "cv2.findFundamentalMat", "numpy.linalg.svd", "numpy.mean", "numpy.array", "polygon_primitives.polygon.Polygon", "numpy.dot" ]
[((253, 268), 'numpy.mean', 'np.mean', (['points'], {}), '(points)\n', (260, 268), True, 'import numpy as np\n'), ((2016, 2032), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (2024, 2032), True, 'import numpy as np\n'), ((2050, 2070), 'numpy.array', 'np.array', (['ref_points'], {}), '(ref_points)\n', (2058...
# --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.13.7 # kernelspec: # display_name: Python [conda env:gis_38] # language: python # name: conda-env-gis_38-p...
[ "numpy.dstack", "pandas.DataFrame", "numpy.meshgrid", "math.pow", "numpy.empty", "xarray.open_dataset", "numpy.zeros", "time.time", "numpy.shape", "geopandas.GeoDataFrame", "numpy.array", "math.log", "resource.getrusage", "numpy.ndarray", "pyproj.Geod" ]
[((2076, 2111), 'numpy.array', 'np.array', (['[-124.730225, -124.72317]'], {}), '([-124.730225, -124.72317])\n', (2084, 2111), True, 'import numpy as np\n'), ((2119, 2151), 'numpy.array', 'np.array', (['[24.878002, 24.884838]'], {}), '([24.878002, 24.884838])\n', (2127, 2151), True, 'import numpy as np\n'), ((3861, 391...
# Implementing Gradient Descent using TensorFlow import numpy as np import tensorflow as tf from sklearn.datasets import fetch_california_housing from sklearn.preprocessing import StandardScaler # Get data housing = fetch_california_housing() m, n = housing.data.shape # Learning parameters n_epochs = 2500 learning_r...
[ "tensorflow.random_uniform", "sklearn.preprocessing.StandardScaler", "tensorflow.global_variables_initializer", "tensorflow.Session", "numpy.ones", "tensorflow.constant", "sklearn.datasets.fetch_california_housing", "tensorflow.matmul", "tensorflow.train.MomentumOptimizer", "tensorflow.square", ...
[((218, 244), 'sklearn.datasets.fetch_california_housing', 'fetch_california_housing', ([], {}), '()\n', (242, 244), False, 'from sklearn.datasets import fetch_california_housing\n'), ((502, 565), 'tensorflow.constant', 'tf.constant', (['housing_data_plus_bias'], {'dtype': 'tf.float32', 'name': '"""X"""'}), "(housing_d...
import json import random import numpy as np from Source.Utility.Pathfinding.Graph import Graph class GameMetrics: def __init__(self): self.game_state = 0 # always set game state before getting metrics def set_game_state(self, game_state): self.game_state = game_state def get_distance...
[ "numpy.power", "Source.Utility.Pathfinding.Graph.Graph" ]
[((6184, 6298), 'Source.Utility.Pathfinding.Graph.Graph', 'Graph', (["self.game_state['cells']", 'x', 'y', "self.game_state['width']", "self.game_state['height']", 'new_direction', '(69)'], {}), "(self.game_state['cells'], x, y, self.game_state['width'], self.\n game_state['height'], new_direction, 69)\n", (6189, 62...