code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
Authors: <NAME>, <NAME> and <NAME>
All rights reserved, 2017.
"""
__all__ = ['filter_bank']
import torch
import numpy as np
import scipy.fftpack as fft
def filter_bank_real(M, N, J, L=8):
"""
Builds in Fourier the Morlet filters used for the scattering transform.
Each single filter is prov... | [
"numpy.multiply",
"numpy.ones",
"torch.load",
"scipy.fftpack.fft2",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.dot",
"numpy.cos",
"torch.save",
"numpy.exp",
"numpy.sin",
"numpy.fft.fftshift",
"numpy.real",
"numpy.imag"
] | [((1842, 1862), 'scipy.fftpack.fft2', 'fft.fft2', (['phi_signal'], {}), '(phi_signal)\n', (1850, 1862), True, 'import scipy.fftpack as fft\n'), ((4651, 4705), 'numpy.zeros', 'np.zeros', (['(M // 2 ** res, N // 2 ** res)', 'np.complex64'], {}), '((M // 2 ** res, N // 2 ** res), np.complex64)\n', (4659, 4705), True, 'imp... |
import os.path
import numpy as np
from lyapunov_reachability.speculation_tabular.base import QBase
import cplex
from cplex.exceptions import CplexSolverError
class LyapunovQAgent(QBase):
def __init__(
self, env, confidence, nb_states, nb_actions, initial_policy, terminal_states, seed=None... | [
"numpy.savez",
"numpy.ones",
"numpy.random.rand",
"numpy.where",
"numpy.random.choice",
"numpy.max",
"numpy.sum",
"numpy.zeros",
"cplex.Cplex",
"numpy.isnan",
"numpy.min",
"numpy.argmin",
"numpy.load",
"cplex.SparsePair"
] | [((473, 505), 'numpy.ones', 'np.ones', (['(nb_states, nb_actions)'], {}), '((nb_states, nb_actions))\n', (480, 505), True, 'import numpy as np\n'), ((577, 610), 'numpy.zeros', 'np.zeros', (['(nb_states, nb_actions)'], {}), '((nb_states, nb_actions))\n', (585, 610), True, 'import numpy as np\n'), ((1034, 1051), 'numpy.l... |
# -*- coding: utf-8 -*-
# author: peilun
# 特征融合
# 15
import numpy as np
import os
input_dir = "../aic19-track1-mtmc/train"
def load_ft_file(feature_file):
# load ft file
img2deepft_dict = {}
file = open(feature_file, 'r')
count = 0
while True:
line = file.readline()
count += 1
... | [
"numpy.zeros",
"os.listdir",
"os.path.join"
] | [((1024, 1045), 'os.listdir', 'os.listdir', (['input_dir'], {}), '(input_dir)\n', (1034, 1045), False, 'import os\n'), ((1210, 1231), 'os.listdir', 'os.listdir', (['scene_dir'], {}), '(scene_dir)\n', (1220, 1231), False, 'import os\n'), ((440, 451), 'numpy.zeros', 'np.zeros', (['l'], {}), '(l)\n', (448, 451), True, 'im... |
import numpy as np
from numpy.testing import assert_equal
from terrapin.flow_direction import aread8, convert_d8_directions
test_sets = [
# source:
# http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000051000000
# lower right corner of flow accumulation array is 2 in url but it should be 1... | [
"numpy.array",
"terrapin.flow_direction.convert_d8_directions",
"numpy.testing.assert_equal",
"terrapin.flow_direction.aread8"
] | [((425, 564), 'numpy.array', 'np.array', (['[[2, 2, 2, 4, 4, 8], [2, 2, 2, 4, 4, 8], [1, 1, 2, 4, 8, 4], [128, 128, 1, \n 2, 4, 8], [2, 2, 1, 4, 4, 4], [1, 1, 1, 1, 4, 16]]'], {}), '([[2, 2, 2, 4, 4, 8], [2, 2, 2, 4, 4, 8], [1, 1, 2, 4, 8, 4], [128,\n 128, 1, 2, 4, 8], [2, 2, 1, 4, 4, 4], [1, 1, 1, 1, 4, 16]])\n'... |
import random
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
print("Welcome to Polarization Model Simulator")
tutorialMode = input("Do you want to use in tutorial mode? (y/n): ")
while tutorialMode != 'y' and tutorialMode != 'n':
tutorialMode = input("Please input y/... | [
"numpy.random.normal",
"numpy.abs",
"numpy.random.rand",
"numpy.ones",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"numpy.linspace",
"numpy.empty",
"numpy.concatenate",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"numpy.arange",
"matplotlib.pypl... | [((6322, 6366), 'numpy.empty', 'np.empty', (['(SIZE_OF_AGENTS, NUMBER_OF_TRIALS)'], {}), '((SIZE_OF_AGENTS, NUMBER_OF_TRIALS))\n', (6330, 6366), True, 'import numpy as np\n'), ((6368, 6377), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (6375, 6377), True, 'import matplotlib.pyplot as plt\n'), ((7384, 7407), 'm... |
from typing import Optional, Union, Callable
import numpy as np
from caput import memh5
from cora.util.cosmology import Cosmology
from cora.util import units, cubicspline as cs
from draco.core import containers
from ..util.nputil import FloatArrayLike
class InterpolatedFunction(memh5.BasicCont):
"""A containe... | [
"numpy.dstack",
"cora.util.cubicspline.LogInterpolater",
"cora.util.cubicspline.SinhInterpolater",
"cora.util.cosmology.Cosmology",
"cora.util.cubicspline.Interpolater"
] | [((5205, 5241), 'cora.util.cosmology.Cosmology', 'Cosmology', ([], {}), "(**self.attrs['cosmology'])\n", (5214, 5241), False, 'from cora.util.cosmology import Cosmology\n'), ((1720, 1737), 'numpy.dstack', 'np.dstack', (['[x, f]'], {}), '([x, f])\n', (1729, 1737), True, 'import numpy as np\n'), ((1834, 1855), 'cora.util... |
import os
import sys
import math
import xml.etree.ElementTree as ET
import numpy as np
import torch
import torch.nn.functional as F
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import utils.quaternion as quat
def chamfer_dist(pc1, pc2):
"""Chamfer distance between two point clouds."""
... | [
"xml.etree.ElementTree.parse",
"torch.gesv",
"torch.sqrt",
"scipy.interpolate.interp1d",
"torch.tensor",
"numpy.zeros",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.figure",
"torch.nn.functional.interpolate",
"torch.zeros",
"torch.inverse",
"matplotlib.pyplot.show"
] | [((1288, 1307), 'torch.sqrt', 'torch.sqrt', (['pc_dist'], {}), '(pc_dist)\n', (1298, 1307), False, 'import torch\n'), ((2998, 3020), 'torch.gesv', 'torch.gesv', (['eye', 'b_mat'], {}), '(eye, b_mat)\n', (3008, 3020), False, 'import torch\n'), ((3578, 3601), 'xml.etree.ElementTree.parse', 'ET.parse', (['skeleton_path'],... |
__author__ = 'Prateek'
import numpy as np
from preprocessing import label_encoder
def convert_to_1D(array):
'''
Converts a numpy array into an array of 1 dimension.
:param array: input numpy array
:return: 1D array
'''
return np.ravel(array)
def calAccuracy(true,pred):
'''
:param t... | [
"preprocessing.label_encoder",
"numpy.unique",
"numpy.subtract",
"numpy.zeros",
"numpy.ravel"
] | [((253, 268), 'numpy.ravel', 'np.ravel', (['array'], {}), '(array)\n', (261, 268), True, 'import numpy as np\n'), ((1182, 1197), 'preprocessing.label_encoder', 'label_encoder', ([], {}), '()\n', (1195, 1197), False, 'from preprocessing import label_encoder\n'), ((1076, 1091), 'numpy.unique', 'np.unique', (['true'], {})... |
import numpy as np
import pickle
import os
import matplotlib.pylab as plt
plt.close('all')
def save_obj(obj, name ):
with open(name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
def load_obj(name ):
with open(name + '.pkl', 'rb') as f:
return pickle.load(f)
d = load_obj('... | [
"matplotlib.pylab.gca",
"matplotlib.pylab.savefig",
"pickle.dump",
"os.listdir",
"matplotlib.pylab.figure",
"matplotlib.pylab.pause",
"pickle.load",
"numpy.zeros",
"matplotlib.pylab.plot",
"numpy.loadtxt",
"matplotlib.pylab.close"
] | [((74, 90), 'matplotlib.pylab.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (83, 90), True, 'import matplotlib.pylab as plt\n'), ((514, 534), 'numpy.zeros', 'np.zeros', (['(nstep, 3)'], {}), '((nstep, 3))\n', (522, 534), True, 'import numpy as np\n'), ((706, 762), 'numpy.loadtxt', 'np.loadtxt', (["(fileDir + '... |
import importlib
import time
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.spatial.distance import jensenshannon
from scipy.stats import gaussian_kde
from ..core.prior import PriorDict
from ..core.sampler.base_sampler import SamplerError
from ..core.utils import logger, reflect
from ..gw.sourc... | [
"numpy.sqrt",
"numpy.random.rand",
"importlib.util.find_spec",
"numpy.log",
"numpy.array",
"numpy.mod",
"scipy.spatial.distance.jensenshannon",
"numpy.atleast_2d",
"scipy.stats.gaussian_kde",
"numpy.random.random",
"numpy.max",
"numpy.linspace",
"numpy.min",
"numpy.isinf",
"numpy.random.... | [((29652, 29668), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (29666, 29668), True, 'import numpy as np\n'), ((1038, 1071), 'numpy.mod', 'np.mod', (['position', 'self.nproposals'], {}), '(position, self.nproposals)\n', (1044, 1071), True, 'import numpy as np\n'), ((13838, 13849), 'time.time', 'time.time', ... |
import math
import os
import numpy as np
import cv2
import skimage.transform
from scipy.io import loadmat
import scipy.spatial as spatial
import matplotlib.pyplot as plt
import torchvision
from math import cos, sin, atan2, asin
import scipy.misc
def get_vertices(pos):
all_vertices = np.reshape(pos, [resolution**2,... | [
"numpy.sqrt",
"math.cos",
"numpy.array",
"cv2.warpPerspective",
"numpy.linalg.norm",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.reshape",
"numpy.cross",
"numpy.asarray",
"math.sin",
"numpy.max",
"numpy.dot",
"numpy.empty",
"numpy.concatenate",
"numpy.min",
"numpy.identity",
"... | [((19286, 19322), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (19298, 19322), False, 'import cv2\n'), ((21309, 21831), 'numpy.array', 'np.array', (['[8444, 8529, 8702, 8763, 9168, 9203, 9246, 9281, 10877, 11016, 13407, 13611,\n 13694, 13866, 13931, 14857, 14908, ... |
from flare.framework.algorithm import Algorithm
from flare.common import common_functions as comf
from torch.distributions import Categorical
import torch
import torch.optim as optim
import numpy as np
from copy import deepcopy
class SimpleAC(Algorithm):
"""
A simple Actor-Critic that has a feedforward policy... | [
"torch.ones_like",
"copy.deepcopy",
"flare.common.common_functions.idx_select",
"numpy.random.uniform",
"torch.no_grad"
] | [((2781, 2796), 'copy.deepcopy', 'deepcopy', (['model'], {}), '(model)\n', (2789, 2796), False, 'from copy import deepcopy\n'), ((4850, 4882), 'flare.common.common_functions.idx_select', 'comf.idx_select', (['q_value', 'action'], {}), '(q_value, action)\n', (4865, 4882), True, 'from flare.common import common_functions... |
"""File import/export functions.
"""
import copy
import datetime
import math
import re
from typing import List, Optional, TextIO, Tuple, Union
from xml.etree import ElementTree
from xml.etree.ElementTree import Element
import click
import numpy as np
import svgpathtools as svg
import svgwrite
from svgwrite.extensions ... | [
"svgwrite.Drawing",
"xml.etree.ElementTree.Element",
"numpy.array",
"datetime.datetime.now",
"svgwrite.extensions.Inkscape",
"click.echo",
"copy.deepcopy",
"xml.etree.ElementTree.SubElement",
"svgpathtools.Document"
] | [((4909, 4931), 'svgpathtools.Document', 'svg.Document', (['filename'], {}), '(filename)\n', (4921, 4931), True, 'import svgpathtools as svg\n'), ((6725, 6747), 'svgpathtools.Document', 'svg.Document', (['filename'], {}), '(filename)\n', (6737, 6747), True, 'import svgpathtools as svg\n'), ((11882, 11941), 'svgwrite.Dr... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cross_decomposition import CCA
from sklearn.metrics import confusion_matrix
import functools
def find_correlation_cca_method1(signal, reference_signals, n_components=2):
r"""
Perform canonical correlation analysis (CCA)
Reference: https://git... | [
"numpy.trace",
"numpy.linalg.pinv",
"sklearn.cross_decomposition.CCA",
"functools.reduce",
"numpy.corrcoef",
"numpy.argmax",
"numpy.max",
"numpy.squeeze",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.sum",
"sklearn.metrics.confusion_matrix"
] | [((1041, 1058), 'sklearn.cross_decomposition.CCA', 'CCA', (['n_components'], {}), '(n_components)\n', (1044, 1058), False, 'from sklearn.cross_decomposition import CCA\n'), ((1070, 1092), 'numpy.zeros', 'np.zeros', (['n_components'], {}), '(n_components)\n', (1078, 1092), True, 'import numpy as np\n'), ((1106, 1142), '... |
from base.base_test import BaseTest
from tqdm import tqdm
import numpy as np
from utils.utils_plotting import *
import cv2
import gc
def accuracy(a, b):
c = np.equal(a, b).astype(float)
acc = sum(c) / len(c)
return acc
def print_alphas_conv(alp):
for i in range(np.shape(alp)[1]):
curr_im = al... | [
"numpy.mean",
"numpy.multiply",
"numpy.add",
"numpy.argmax",
"numpy.equal",
"numpy.append",
"numpy.array",
"numpy.nonzero",
"numpy.shape"
] | [((1821, 1840), 'numpy.mean', 'np.mean', (['losses_val'], {}), '(losses_val)\n', (1828, 1840), True, 'import numpy as np\n'), ((1870, 1891), 'numpy.mean', 'np.mean', (['accs_add_val'], {}), '(accs_add_val)\n', (1877, 1891), True, 'import numpy as np\n'), ((1921, 1942), 'numpy.mean', 'np.mean', (['accs_mul_val'], {}), '... |
"""
Copyright (c) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | [
"numpy.max",
"numpy.array",
"numpy.size",
"numpy.min"
] | [((1174, 1186), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1182, 1186), True, 'import numpy as np\n'), ((1259, 1271), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1267, 1271), True, 'import numpy as np\n'), ((1344, 1356), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1352, 1356), True, 'import num... |
from pathlib import Path
from astropy.io import fits
import numpy as np
import pickle
#calibration io
def save_image(data, imname):
hdu = fits.PrimaryHDU(data)
hdu.writeto(imname, overwrite = True)
return None
def load_calib_img(calib_dir, img_number, style = 'wirc', img_type = ''):
fname = get_img_name(calib_di... | [
"numpy.median",
"astropy.io.fits.PrimaryHDU",
"pathlib.Path",
"numpy.append",
"numpy.array",
"astropy.io.fits.open",
"numpy.arange"
] | [((141, 162), 'astropy.io.fits.PrimaryHDU', 'fits.PrimaryHDU', (['data'], {}), '(data)\n', (156, 162), False, 'from astropy.io import fits\n'), ((1382, 1394), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1390, 1394), True, 'import numpy as np\n'), ((1535, 1566), 'numpy.array', 'np.array', (['to_extract'], {'dtyp... |
import numpy as np
import random
random.seed(2301)
np.random.seed(795118)
from sklearn.cluster import KMeans
from sklearn.cluster import AgglomerativeClustering
from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import Normalizer
from sklearn.preprocessing import MinMaxScaler
from sklearn.p... | [
"sklearn.cluster.KMeans",
"random.choice",
"numpy.argmax",
"random.seed",
"numpy.max",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"numpy.random.seed",
"numpy.argmin",
"random.random",
"random.randint"
] | [((35, 52), 'random.seed', 'random.seed', (['(2301)'], {}), '(2301)\n', (46, 52), False, 'import random\n'), ((54, 76), 'numpy.random.seed', 'np.random.seed', (['(795118)'], {}), '(795118)\n', (68, 76), True, 'import numpy as np\n'), ((12488, 12503), 'random.random', 'random.random', ([], {}), '()\n', (12501, 12503), F... |
import scipy.linalg as spla
import numpy as np
M11 = 1.01
M12 = 1.00
M13 = 1.00
M21 = 1.00
M22 = 1.01
M23 = 1.00
M31 = 1.00
M32 = 1.00
M33 = 1.00
A = np.array([[M11, M12, M13],
[M21, M22, M23],
[M31, M32, M33]])
b = np.array([[4], [7.9999999999999999]])
def np_inv(A, b):
return np... | [
"numpy.linalg.solve",
"numpy.linalg.pinv",
"numpy.diag",
"numpy.array",
"numpy.dot",
"numpy.linalg.inv",
"numpy.linalg.svd"
] | [((154, 215), 'numpy.array', 'np.array', (['[[M11, M12, M13], [M21, M22, M23], [M31, M32, M33]]'], {}), '([[M11, M12, M13], [M21, M22, M23], [M31, M32, M33]])\n', (162, 215), True, 'import numpy as np\n'), ((250, 272), 'numpy.array', 'np.array', (['[[4], [8.0]]'], {}), '([[4], [8.0]])\n', (258, 272), True, 'import nump... |
#Code for creating halton sampling in low n-dimensions
# references : - https://gist.github.com/tupui/cea0a91cc127ea3890ac0f002f887bae
# - https://www.w3resource.com/python-exercises/list/python-data-type-list-exercise-34.php
import numpy as np
def primes (n):
#Defining prime numbers for base using s... | [
"numpy.stack"
] | [((1327, 1352), 'numpy.stack', 'np.stack', (['sample'], {'axis': '(-1)'}), '(sample, axis=-1)\n', (1335, 1352), True, 'import numpy as np\n')] |
import numpy as np
from numpy.testing import assert_, assert_almost_equal
from astroML.time_series import search_frequencies
from astroML.utils import check_random_state
# TODO: add tests of lomb_scargle inputs & significance
# TODO: add tests of bootstrap
def test_search_frequencies():
rng = np.random.RandomS... | [
"numpy.arange",
"astroML.time_series.search_frequencies",
"numpy.testing.assert_almost_equal",
"numpy.array",
"numpy.sin",
"numpy.random.RandomState"
] | [((303, 327), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (324, 327), True, 'import numpy as np\n'), ((337, 361), 'numpy.arange', 'np.arange', (['(0)', '(10.0)', '(0.01)'], {}), '(0, 10.0, 0.01)\n', (346, 361), True, 'import numpy as np\n'), ((411, 424), 'numpy.sin', 'np.sin', (['(w * t... |
#!/usr/bin/env python
from manimlib.imports import *
import numpy as np
class Grid(VGroup):
CONFIG = {
"height": 6.0,
"width": 6.0,
}
def __init__(self, rows, columns, **kwargs):
digest_config(self, kwargs, locals())
super().__init__(**kwargs)
x_step = self.width ... | [
"numpy.sin",
"numpy.array",
"numpy.arange"
] | [((394, 435), 'numpy.arange', 'np.arange', (['(0)', '(self.width + x_step)', 'x_step'], {}), '(0, self.width + x_step, x_step)\n', (403, 435), True, 'import numpy as np\n'), ((617, 659), 'numpy.arange', 'np.arange', (['(0)', '(self.height + y_step)', 'y_step'], {}), '(0, self.height + y_step, y_step)\n', (626, 659), Tr... |
import sys
sys.path.append("../")
from autogl.datasets import build_dataset_from_name
from autogl.solver.classifier.link_predictor import AutoLinkPredictor
from autogl.module.train.evaluation import Auc
import yaml
import random
import torch
import numpy as np
if __name__ == "__main__":
from argparse import Argu... | [
"torch.manual_seed",
"argparse.ArgumentParser",
"autogl.solver.classifier.link_predictor.AutoLinkPredictor.from_config",
"random.seed",
"torch.cuda.set_device",
"torch.cuda.is_available",
"autogl.datasets.build_dataset_from_name",
"numpy.random.seed",
"torch.cuda.manual_seed",
"sys.path.append",
... | [((12, 34), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (27, 34), False, 'import sys\n'), ((376, 466), 'argparse.ArgumentParser', 'ArgumentParser', (['"""auto link prediction"""'], {'formatter_class': 'ArgumentDefaultsHelpFormatter'}), "('auto link prediction', formatter_class=\n Argument... |
import sys
sys.path.append('.') #get rid of this at some point with central test script or when package is built
import MSI.utilities.run_simulations_without_optimization as rswo
import pandas as pd
import numpy as np
#start here
files_to_include = [['Hong_0_updated.yaml'],
['Hong_2_updated.... | [
"MSI.utilities.run_simulations_without_optimization.running_simulations_without_optimization",
"numpy.array",
"sys.path.append"
] | [((13, 33), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (28, 33), False, 'import sys\n'), ((13742, 14376), 'MSI.utilities.run_simulations_without_optimization.running_simulations_without_optimization', 'rswo.running_simulations_without_optimization', (['cti_file', '(0.01)', '(1)', '(1)', 'workin... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
"""
Unit tests for kernel operations, tested for the forward and the backward pass
... | [
"numpy.prod",
"numpy.ones_like",
"scipy.signal.convolve",
"cntk.pooling",
"cntk.convolution",
"numpy.asarray",
"pytest.mark.parametrize",
"numpy.zeros_like",
"numpy.arange"
] | [((938, 1025), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""convolution_map, convolution_input"""', 'CONVOLUTION_OPERANDS'], {}), "('convolution_map, convolution_input',\n CONVOLUTION_OPERANDS)\n", (961, 1025), False, 'import pytest\n'), ((2480, 2572), 'pytest.mark.parametrize', 'pytest.mark.parametri... |
# -*- coding: utf-8 -*-
"""Padding transformer, pad unequal length panel to max length or fixed length."""
import numpy as np
import pandas as pd
from sktime.transformations.base import BaseTransformer
__all__ = ["PaddingTransformer"]
__author__ = ["abostrom"]
class PaddingTransformer(BaseTransformer):
"""Paddi... | [
"pandas.DataFrame",
"numpy.full"
] | [((2318, 2367), 'numpy.full', 'np.full', (['self.pad_length_', 'self.fill_value', 'float'], {}), '(self.pad_length_, self.fill_value, float)\n', (2325, 2367), True, 'import numpy as np\n'), ((3579, 3596), 'pandas.DataFrame', 'pd.DataFrame', (['pad'], {}), '(pad)\n', (3591, 3596), True, 'import pandas as pd\n')] |
#!/usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
extensions = [
Extension("ace", ["MCNPtools/ace.pyx"],
include_dirs=[numpy.get_include()])
]
setup(name='MCNPtools',
version='0.1',
description='... | [
"numpy.get_include"
] | [((660, 679), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (677, 679), False, 'import numpy\n'), ((232, 251), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (249, 251), False, 'import numpy\n')] |
"""Load ASL BIDS filter class"""
import os
import json
import numpy as np
import nibabel as nib
from asldro.filters.basefilter import BaseFilter, FilterInputValidationError
from asldro.containers.image import NiftiImageContainer
from asldro.validators.parameters import (
Parameter,
ParameterValidator,
is... | [
"os.path.exists",
"nibabel.load",
"asldro.validators.parameters.isinstance_validator",
"numpy.squeeze",
"asldro.filters.basefilter.FilterInputValidationError",
"json.load"
] | [((3176, 3222), 'nibabel.load', 'nib.load', (['self.inputs[self.KEY_IMAGE_FILENAME]'], {}), '(self.inputs[self.KEY_IMAGE_FILENAME])\n', (3184, 3222), True, 'import nibabel as nib\n'), ((8798, 8844), 'nibabel.load', 'nib.load', (['self.inputs[self.KEY_IMAGE_FILENAME]'], {}), '(self.inputs[self.KEY_IMAGE_FILENAME])\n', (... |
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
SMOOTH = 1e-6
def iou_numpy(outputs: np.array, labels: np.array):
# outputs = outputs.squeeze(2)
intersection = (outputs & labels).sum((0, 1))
union = (outputs | labels).sum((0, 1))
iou = (intersection + SMOOTH) / (union + SMO... | [
"matplotlib.pyplot.imshow",
"numpy.clip",
"matplotlib.pyplot.xticks",
"cv2.threshold",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"cv2.imread",
"matplotlib.pyplot.show"
] | [((470, 600), 'cv2.imread', 'cv.imread', (['"""/Users/mac/Desktop/Rice-COMP576/sartorius-cell-instance-segmentation/train/0030fd0e6378/0030fd0e6378.png"""', '(0)'], {}), "(\n '/Users/mac/Desktop/Rice-COMP576/sartorius-cell-instance-segmentation/train/0030fd0e6378/0030fd0e6378.png'\n , 0)\n", (479, 600), True, 'im... |
import numpy as np
import random
from boxenv import *
from agent import *
NB_SKILLS = 6
COND = 'OUR'
STATE_DIM = 2
DIM = STATE_DIM
policy_function = GaussianPolicyFunction(STATE_DIM + NB_SKILLS, 2)
policy = GaussianPolicy()
d = SkillDiscriminator(DIM, NB_SKILLS)
# initial training task list
# TASKS = [(0.5, 0.8), (... | [
"numpy.random.default_rng",
"random.seed",
"numpy.stack",
"numpy.zeros",
"numpy.random.seed",
"numpy.concatenate",
"numpy.linalg.norm"
] | [((434, 458), 'numpy.random.default_rng', 'np.random.default_rng', (['(1)'], {}), '(1)\n', (455, 458), True, 'import numpy as np\n'), ((2404, 2421), 'numpy.stack', 'np.stack', (['rewards'], {}), '(rewards)\n', (2412, 2421), True, 'import numpy as np\n'), ((792, 814), 'numpy.linalg.norm', 'np.linalg.norm', (['(s1 - g)']... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... | [
"graph.matches.matches.get_pow2_match_group",
"importer.tflite.new_tflite_graph_all.TfliteImporter",
"execution.graph_executer.GraphExecuter",
"numpy.abs",
"execution.quantization_mode.QuantizationMode.all_dequantize",
"graph.matches.matches.get_fusion",
"graph.matches.matches.get_scale8_match_group",
... | [((1421, 1437), 'importer.tflite.new_tflite_graph_all.TfliteImporter', 'TfliteImporter', ([], {}), '()\n', (1435, 1437), False, 'from importer.tflite.new_tflite_graph_all import TfliteImporter\n'), ((1531, 1547), 'importer.tflite.new_tflite_graph_all.TfliteImporter', 'TfliteImporter', ([], {}), '()\n', (1545, 1547), Fa... |
import pandas as pd
import numpy as np
import scipy as sp
from scipy.special import expit as sigmoid_function
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('ggplot')
def load_data(location):
""" Given a directory string, returns a pandas dataframe containing hw data."""
# diction... | [
"matplotlib.pyplot.imshow",
"numpy.insert",
"scipy.io.loadmat",
"numpy.log",
"numpy.argmax",
"pandas.get_dummies",
"scipy.misc.toimage",
"scipy.special.expit",
"numpy.zeros",
"matplotlib.style.use",
"matplotlib.pyplot.figure",
"numpy.dot",
"numpy.random.randint",
"pandas.DataFrame",
"mat... | [((167, 190), 'matplotlib.style.use', 'mpl.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (180, 190), True, 'import matplotlib as mpl\n'), ((381, 404), 'scipy.io.loadmat', 'sp.io.loadmat', (['location'], {}), '(location)\n', (394, 404), True, 'import scipy as sp\n'), ((413, 436), 'pandas.DataFrame', 'pd.DataFrame'... |
import numpy as np
import matplotlib.pyplot as plt
####################
def merge_dicts(list_of_dicts):
results = {}
for d in list_of_dicts:
for key in d.keys():
if key in results.keys():
results[key].append(d[key])
else:
results[key] = [d[key]]... | [
"numpy.mean",
"numpy.where",
"matplotlib.pyplot.gcf",
"numpy.array",
"numpy.sum",
"numpy.around",
"numpy.load",
"matplotlib.pyplot.subplots"
] | [((562, 637), 'numpy.array', 'np.array', (['[0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12, 0.13, 0.14, 0.15]'], {}), '([0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12, 0.13, 0.14, 0.15])\n', (570, 637), True, 'import numpy as np\n'), ((3293, 3311), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {}), '(2... |
import collections
import logging
import pickle
from typing import Any, Dict, Hashable, Iterable, Iterator, Mapping, Optional, Sequence, Union
import warnings
import numpy as np
from smqtk_dataprovider import from_uri
from smqtk_descriptors import DescriptorElement
from smqtk_classifier.interfaces.classify_descripto... | [
"logging.getLogger",
"smqtk_descriptors.DescriptorElement.get_many_vectors",
"smqtk_dataprovider.from_uri",
"numpy.random.rand",
"pickle.dumps",
"pickle.load",
"numpy.linalg.norm",
"warnings.warn",
"sklearn.svm.SVC"
] | [((376, 403), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (393, 403), False, 'import logging\n'), ((514, 604), 'warnings.warn', 'warnings.warn', (['"""scipy.stats not importable: SkLearnSvmClassifier will not be usable."""'], {}), "(\n 'scipy.stats not importable: SkLearnSvmClassifi... |
# author: <NAME>, <NAME>
# data: 2020-11-27
"""Creates eda plots for the pre-processed training data from the open hotel booking demand dataset
(from https://www.sciencedirect.com/science/article/pii/S2352340918315191#f0010). Saves the results
as csv and svg files.
Usage: eda_ms2.py --train=<train_data_file>... | [
"pandas.read_csv",
"altair.Color",
"selenium.webdriver.Chrome",
"altair.Chart",
"altair.repeat",
"altair.Scale",
"pandas.Categorical",
"altair.data_transformers.enable",
"altair.X",
"altair.Y",
"altair.Tooltip",
"pandas.DataFrame",
"pandas.concat",
"docopt.docopt",
"numpy.round"
] | [((847, 865), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (863, 865), False, 'from selenium import webdriver\n'), ((1042, 1085), 'altair.data_transformers.enable', 'alt.data_transformers.enable', (['"""data_server"""'], {}), "('data_server')\n", (1070, 1085), True, 'import altair as alt\n'), ((10... |
"""
Food Nonfood Classifier
"""
import tensorflow as tf
import numpy as np
class FoodNonfood(object):
def __init__(self, model_file=None):
self.categories = ['food', 'nonfood']
self.model_version = None
self.load_graph()
def load_graph(self, model_file=None):
"""load_graph
... | [
"tensorflow.Graph",
"tensorflow.Session",
"tensorflow.image.resize_bilinear",
"tensorflow.GraphDef",
"numpy.squeeze",
"tensorflow.import_graph_def",
"tensorflow.subtract",
"tensorflow.expand_dims",
"tensorflow.cast",
"tensorflow.read_file",
"tensorflow.image.decode_jpeg"
] | [((1936, 1959), 'tensorflow.read_file', 'tf.read_file', (['file_name'], {}), '(file_name)\n', (1948, 1959), True, 'import tensorflow as tf\n'), ((1979, 2031), 'tensorflow.image.decode_jpeg', 'tf.image.decode_jpeg', (['file_reader'], {'channels': 'channels'}), '(file_reader, channels=channels)\n', (1999, 2031), True, 'i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
# 最优化算法;
# Sigmoid 函数,fx = 1/(1 + e ** -x);
# Sigmoid 函数输入:x = w0x0 + w1x1 + w2x2 + ... + wnxn
def loadDataSet():
dataMat = []
labelMat = []
fr = open('./data.csv')
for line in fr.readlines():
lineArr = line.strip().split()
... | [
"numpy.exp",
"numpy.mat",
"numpy.shape",
"numpy.ones"
] | [((590, 608), 'numpy.mat', 'np.mat', (['dataMathIn'], {}), '(dataMathIn)\n', (596, 608), True, 'import numpy as np\n'), ((667, 687), 'numpy.shape', 'np.shape', (['dataMatrix'], {}), '(dataMatrix)\n', (675, 687), True, 'import numpy as np\n'), ((767, 782), 'numpy.ones', 'np.ones', (['(n, 1)'], {}), '((n, 1))\n', (774, 7... |
# Import all libraries we will use
import random
import numpy as np
import cv2
def create_image(p):
# let's create a heigth x width matrix with all pixels in black color
heigth = 1080
width = 1920
diameter = 50
x_correction = int(0.7 * diameter / 2)
y_correction = int(0.7 * diameter / 2)
... | [
"cv2.rectangle",
"random.uniform",
"cv2.drawContours",
"numpy.ones",
"numpy.array"
] | [((326, 363), 'numpy.ones', 'np.ones', (['(heigth, width, 3)', 'np.uint8'], {}), '((heigth, width, 3), np.uint8)\n', (333, 363), True, 'import numpy as np\n'), ((512, 532), 'random.uniform', 'random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (526, 532), False, 'import random\n'), ((567, 587), 'random.uniform', 'random... |
import hypothesis.extra.numpy as hnp
import hypothesis.strategies as st
import numpy as np
import pytest
from hypothesis import given, settings
from numpy.testing import assert_array_equal
from mygrad import Tensor
from tests.custom_strategies import tensors, valid_constant_arg
real_types = (
hnp.integer_dtypes()... | [
"numpy.dtype",
"tests.custom_strategies.valid_constant_arg",
"hypothesis.extra.numpy.unsigned_integer_dtypes",
"hypothesis.strategies.data",
"hypothesis.strategies.tuples",
"pytest.mark.parametrize",
"hypothesis.extra.numpy.integer_dtypes",
"mygrad.Tensor",
"tests.custom_strategies.tensors",
"hypo... | [((1173, 1198), 'hypothesis.settings', 'settings', ([], {'max_examples': '(30)'}), '(max_examples=30)\n', (1181, 1198), False, 'from hypothesis import given, settings\n'), ((1908, 1962), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""src_constant"""', '[True, False]'], {}), "('src_constant', [True, False])... |
from __future__ import print_function, division, absolute_import
import numpy as np
from . import models
import multiprocessing as multi
from collections import MutableMapping
from ..plasma import plasma
########################################
# Physical constants, DO NOT OVERWRITE #
#################################... | [
"numpy.trapz",
"numpy.sqrt",
"multiprocessing.Process",
"numpy.asarray",
"numpy.tanh",
"numpy.max",
"numpy.exp",
"numpy.zeros",
"numpy.linspace",
"numpy.concatenate",
"numpy.meshgrid",
"multiprocessing.Queue",
"numpy.arange"
] | [((1010, 1028), 'numpy.zeros', 'np.zeros', (['(nx, ny)'], {}), '((nx, ny))\n', (1018, 1028), True, 'import numpy as np\n'), ((1402, 1425), 'numpy.arange', 'np.arange', (['(1)', '(nx + 1)', '(1)'], {}), '(1, nx + 1, 1)\n', (1411, 1425), True, 'import numpy as np\n'), ((1438, 1461), 'numpy.arange', 'np.arange', (['(1)', ... |
from sklearn.tree import DecisionTreeClassifier
import unittest
import pandas as pd
import optuna
from optuna.samplers import TPESampler
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
import numpy as np
import warnings
from avaliacao import Experimento, OtimizacaoOb... | [
"resultado.Resultado",
"metodo.ScikitLearnAprendizadoDeMaquina",
"numpy.average",
"sklearn.tree.DecisionTreeClassifier",
"unittest.main",
"resultado.Fold.gerar_k_folds",
"numpy.array",
"resultado.Fold",
"warnings.simplefilter",
"pandas.DataFrame",
"optuna.samplers.TPESampler",
"optuna.create_s... | [((517, 566), 'numpy.array', 'np.array', (['[0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2]'], {}), '([0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2])\n', (525, 566), True, 'import numpy as np\n'), ((571, 620), 'numpy.array', 'np.array', (['[0, 1, 1, 2, 2, 1, 2, 1, 2, 0, 2, 2, 1]'], {}), '([0, 1, 1, 2, 2, 1, 2, 1, 2, 0, 2, 2, 1])\n', ... |
"""
This module is designed for final visualization code.
"""
# import all the necessory python packages
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import statistics as stats
import pylab as pl
import pandas as pd
# Set specific parameters for the visualizations
large = 22; med = 16; smal... | [
"matplotlib.pyplot.ylabel",
"seaborn.set_style",
"numpy.arange",
"seaborn.set",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.yticks",
"numpy.random.seed",
"numpy.vstack",
"pandas.DataFrame",
"matplotlib.pyplot.xticks... | [((572, 599), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['params'], {}), '(params)\n', (591, 599), True, 'import matplotlib.pyplot as plt\n'), ((600, 634), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-whitegrid"""'], {}), "('seaborn-whitegrid')\n", (613, 634), True, 'import matplotli... |
# -*- coding: utf-8 -*-
import os
import importlib.util
import logging
import random
import numpy as np
from renormalizer.utils.utils import sizeof_fmt
logger = logging.getLogger(__name__)
GPU_KEY = "RENO_GPU"
USE_GPU = False
if importlib.util.find_spec("cupy"):
import cupy as xp
gpu_id = os.environ.ge... | [
"logging.getLogger",
"cupy.random.seed",
"cupy.cuda.Device",
"cupy.cuda.device.Device",
"os.environ.get",
"random.seed",
"numpy.random.seed",
"cupy.get_default_memory_pool"
] | [((166, 193), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (183, 193), False, 'import logging\n'), ((790, 810), 'cupy.random.seed', 'xp.random.seed', (['(2019)'], {}), '(2019)\n', (804, 810), True, 'import cupy as xp\n'), ((811, 831), 'numpy.random.seed', 'np.random.seed', (['(9012)'], ... |
#!/usr/bin/env python
"""Provides some common functionality for cop robots.
Much of a cop's functionality is defined by the ``robot`` module, but
this module provides cops with the tools it uses to hunt the robbers,
such as:
* sensors (both human and camera) to collect environment information;
* a fusion_engin... | [
"logging.debug",
"cops_and_robots.fusion.fusion_engine.FusionEngine",
"cops_and_robots.robo_tools.robot.ImaginaryRobot",
"shapely.geometry.Point",
"numpy.array",
"cops_and_robots.map_tools.map_elements.MapObject",
"logging.info",
"cops_and_robots.fusion.camera.Camera",
"cops_and_robots.robo_tools.qu... | [((5248, 5458), 'cops_and_robots.fusion.fusion_engine.FusionEngine', 'FusionEngine', (["fe_cfg['probability_type']", 'self.missing_robber_names', 'self.map.feasible_layer', 'robber_model'], {'rosbag_process': 'rosbag_process', 'use_STM': "fe_cfg['use_STM']", 'use_velocity': "fe_cfg['use_velocity']"}), "(fe_cfg['probabi... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LightSource
from mpl_toolkits.basemap import Basemap, shiftgrid, cm
from osgeo import gdal
print("Reading csv")
csv = np.genfromtxt('data/happiness.csv', delimiter=',')
dataByDate = {}
print("Grouping rows by date")
for row in csv:
... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.zeros",
"mpl_toolkits.basemap.Basemap",
"numpy.linspace",
"numpy.meshgrid",
"numpy.genfromtxt",
"numpy.arange"
] | [((201, 251), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data/happiness.csv"""'], {'delimiter': '""","""'}), "('data/happiness.csv', delimiter=',')\n", (214, 251), True, 'import numpy as np\n'), ((583, 595), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (593, 595), True, 'import matplotlib.pyplot as plt\n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
... | [
"subprocess.check_output",
"os.path.exists",
"inspect.Signature",
"multiprocessing.pool.map_async",
"itertools.product",
"inspect.signature",
"functools.wraps",
"os.path.dirname",
"numpy.array",
"pandas.read_hdf",
"inspect.Parameter",
"pandas.DataFrame",
"datetime.timedelta",
"toolz.partit... | [((4684, 4707), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (4701, 4707), False, 'import inspect\n'), ((5172, 5210), 'inspect.Signature', 'inspect.Signature', ([], {'parameters': 'new_pars'}), '(parameters=new_pars)\n', (5189, 5210), False, 'import inspect\n'), ((5496, 5509), 'glob.glob', 'glo... |
from commlib import qam_constellation
import matplotlib.pyplot as plt
import numpy as np
SNRbdBs = np.arange(0.5, 25, 0.5)
n = np.arange(1,7,1)
Ms = np.array([4, 16, 64, 256])
Ms = Ms.astype(int)
Pest = np.zeros( [SNRbdBs.size, Ms.size] )
Pebt = np.zeros( [SNRbdBs.size, Ms.size] )
threshold = 1e-4
for i, SNRbdB in ... | [
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"commlib.qam_constellation",
"matplotlib.pyplot.close",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylim",
"numpy.arange"
] | [((100, 123), 'numpy.arange', 'np.arange', (['(0.5)', '(25)', '(0.5)'], {}), '(0.5, 25, 0.5)\n', (109, 123), True, 'import numpy as np\n'), ((128, 146), 'numpy.arange', 'np.arange', (['(1)', '(7)', '(1)'], {}), '(1, 7, 1)\n', (137, 146), True, 'import numpy as np\n'), ((150, 176), 'numpy.array', 'np.array', (['[4, 16, ... |
""" Utility functions operating on operation matrices """
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Govern... | [
"numpy.sqrt",
"cvxpy.trace",
"numpy.array",
"numpy.isreal",
"numpy.linalg.norm",
"numpy.imag",
"scipy.linalg.logm",
"numpy.diag_indices",
"numpy.conjugate",
"numpy.asarray",
"numpy.tensordot",
"numpy.take",
"numpy.real",
"scipy.linalg.expm",
"numpy.dot",
"numpy.empty",
"numpy.concate... | [((1418, 1440), 'numpy.zeros', '_np.zeros', (['(N, N)', '"""d"""'], {}), "((N, N), 'd')\n", (1427, 1440), True, 'import numpy as _np\n'), ((1701, 1726), 'scipy.linalg.sqrtm', '_spl.sqrtm', (['A'], {'disp': '(False)'}), '(A, disp=False)\n', (1711, 1726), True, 'import scipy.linalg as _spl\n'), ((2617, 2634), 'numpy.lina... |
import numpy
import scipy.stats
import scipy.optimize
have_sklearn = False
# noinspection PyBroadException
try:
import sklearn.linear_model
have_sklearn = True
except Exception:
pass
# methods to avoid calling statsmodels which seems to be incompatible with many
# versions of other packages we need:
# ... | [
"numpy.mean",
"numpy.minimum",
"numpy.logical_not",
"numpy.asarray",
"numpy.log",
"numpy.max",
"numpy.exp",
"numpy.zeros",
"numpy.min",
"numpy.maximum"
] | [((1101, 1132), 'numpy.minimum', 'numpy.minimum', (['est', '(1 - epsilon)'], {}), '(est, 1 - epsilon)\n', (1114, 1132), False, 'import numpy\n'), ((1143, 1170), 'numpy.maximum', 'numpy.maximum', (['est', 'epsilon'], {}), '(est, epsilon)\n', (1156, 1170), False, 'import numpy\n'), ((3531, 3551), 'numpy.asarray', 'numpy.... |
# -*- coding: utf-8 -*-
"""
This enables to parameterize a desired scenario to mock a multi-partner ML project.
"""
from datasets import dataset_mnist, dataset_cifar10, dataset_titanic
from sklearn.model_selection import train_test_split
import datetime
import os
import numpy as np
import matplotlib.pyplot as plt
impo... | [
"numpy.clip",
"numpy.arange",
"utils.get_random_index_from_weighted_list",
"os.path.exists",
"partner.Partner",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.close",
"numpy.empty",
"numpy.random.seed",
"numpy.concatenate",
"pandas.DataFrame",
"operator.attrgetter",
"random.... | [((2238, 2287), 'loguru.logger.debug', 'logger.debug', (['f"""Dataset selected: {dataset_name}"""'], {}), "(f'Dataset selected: {dataset_name}')\n", (2250, 2287), False, 'from loguru import logger\n'), ((3246, 3520), 'dataset.Dataset', 'Dataset', (['dataset_name', 'dataset_module.x_train', 'dataset_module.x_test', 'dat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import gensim.downloader as api
from gensim.models.word2vec import Word2Vec
import numpy as np
from sklearn.linear_model import LinearRegression
import pickle
w2v = api.load('word2vec-google-news-300')
models = ['Guardian_Pre', 'Guardian_Post', 'Daily Mail_Pre', 'Daily M... | [
"numpy.tile",
"pickle.dump",
"gensim.downloader.load",
"numpy.array",
"sklearn.linear_model.LinearRegression"
] | [((214, 250), 'gensim.downloader.load', 'api.load', (['"""word2vec-google-news-300"""'], {}), "('word2vec-google-news-300')\n", (222, 250), True, 'import gensim.downloader as api\n'), ((858, 873), 'numpy.array', 'np.array', (['ylist'], {}), '(ylist)\n', (866, 873), True, 'import numpy as np\n'), ((884, 921), 'sklearn.l... |
import sys
sys.path.append("../..")
from bempp import lib as blib
#from bempp import visualization as vis
import numpy as np
import tempfile
import os
import subprocess
import math
def evalBoundaryData(point):
return 1
def evalNullData(point):
return 0
def Keijzer(n):
th = math.asin(... | [
"numpy.sqrt",
"bempp.lib.createModifiedHelmholtz3dDoubleLayerBoundaryOperator",
"math.cos",
"bempp.lib.createModifiedHelmholtz3dSingleLayerBoundaryOperator",
"bempp.lib.createGridFactory",
"bempp.lib.createContext",
"sys.path.append",
"bempp.lib.createAccuracyOptions",
"os.remove",
"bempp.lib.crea... | [((12, 36), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (27, 36), False, 'import sys\n'), ((689, 741), 'numpy.sqrt', 'np.sqrt', (['(mua1 / kappa1 + 1.0j * omega / (c * kappa1))'], {}), '(mua1 / kappa1 + 1.0j * omega / (c * kappa1))\n', (696, 741), True, 'import numpy as np\n'), ((807, 85... |
import numpy as np
import os
from bolero.behavior_search import BlackBoxSearch
from bolero.representation import ConstantBehavior
from bolero.optimizer import NoOptimizer
from bolero.utils.testing import assert_pickle
from nose.tools import assert_false, assert_true, assert_raises_regexp
from numpy.testing import asser... | [
"bolero.optimizer.NoOptimizer",
"os.path.exists",
"nose.tools.assert_raises_regexp",
"bolero.behavior_search.BlackBoxSearch",
"numpy.array",
"numpy.zeros",
"numpy.empty",
"bolero.representation.ConstantBehavior",
"bolero.utils.testing.assert_pickle",
"os.remove"
] | [((508, 587), 'nose.tools.assert_raises_regexp', 'assert_raises_regexp', (['TypeError', '"""expects instance of Optimizer"""', 'bs.init', '(5)', '(5)'], {}), "(TypeError, 'expects instance of Optimizer', bs.init, 5, 5)\n", (528, 587), False, 'from nose.tools import assert_false, assert_true, assert_raises_regexp\n'), (... |
import time
import shutil
import dlib
import numpy as np
import PIL.Image
import torch
from torchvision.transforms import transforms
import dnnlib
import legacy
from configs import GENERATOR_CONFIGS
from dlib_utils.face_alignment import image_align
from dlib_utils.landmarks_detector import LandmarksDetector
from tor... | [
"dlib_utils.landmarks_detector.LandmarksDetector",
"legacy.load_network_pkl",
"dlib_utils.face_alignment.image_align",
"dnnlib.util.open_url",
"torch.jit.load",
"pivot_tuning_inversion.training.coaches.multi_id_coach.MultiIDCoach",
"numpy.array",
"torch_utils.misc.copy_params_and_buffers",
"configs.... | [((789, 818), 'dlib_utils.landmarks_detector.LandmarksDetector', 'LandmarksDetector', (['model_path'], {}), '(model_path)\n', (806, 818), False, 'from dlib_utils.landmarks_detector import LandmarksDetector\n'), ((1029, 1063), 'shutil.copy', 'shutil.copy', (['imgpath', 'self.tmp_src'], {}), '(imgpath, self.tmp_src)\n', ... |
import cv2
import numpy as np
import os
def singlewords():
name = "binary.png"
img = cv2.imread(name)
shape = img.shape
print ("shape: ", shape)
#new_img = img.copy()
position_array = np.zeros((shape))
count = 1
for x in range(0, shape[0]):
for y in range(0, shape[1]):
... | [
"cv2.imwrite",
"os.path.exists",
"os.listdir",
"numpy.zeros",
"os.mkdir",
"cv2.imread"
] | [((96, 112), 'cv2.imread', 'cv2.imread', (['name'], {}), '(name)\n', (106, 112), False, 'import cv2\n'), ((211, 226), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (219, 226), True, 'import numpy as np\n'), ((8769, 8784), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (8777, 8784), True, 'import nu... |
import sys
import numpy as np
import tensorflow as tf
from tensorflow.python.training import training_util
from .. import evaluator, metrics
from ..configuration import *
from .doc2vec_train_doc_prediction import doc2vec_prediction_model
from .doc2vec_train_doc_prediction import DocPredictionDataset
class DocPredicti... | [
"logging.getLogger",
"tensorflow.python.training.training_util.get_or_create_global_step",
"tensorflow.Variable",
"tensorflow.reduce_sum",
"numpy.sum",
"tensorflow.control_dependencies",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.assign_add",
"tensorflow.nn.softmax",
"tensorflo... | [((427, 443), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (441, 443), True, 'import tensorflow as tf\n'), ((1526, 1596), 'tensorflow.nn.softmax_cross_entropy_with_logits', 'tf.nn.softmax_cross_entropy_with_logits', ([], {'labels': 'targets', 'logits': 'logits'}), '(labels=targets, logits=logits)\n', (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 11 14:33:43 2017
@author: Lorna
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 11 07:38:39 2017
@author: Lorna
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
"""
Data str... | [
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.meshgrid",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.show"
] | [((760, 821), 'numpy.linspace', 'np.linspace', (['(0)', 'T_final'], {'num': 'N_t', 'endpoint': '(True)', 'retstep': '(True)'}), '(0, T_final, num=N_t, endpoint=True, retstep=True)\n', (771, 821), True, 'import numpy as np\n'), ((823, 884), 'numpy.linspace', 'np.linspace', (['(0)', 'X_final'], {'num': 'N_x', 'endpoint':... |
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import numpy as np
import pytest
import torch
import torch.nn as nn
from mmcv.parallel import MMDistributedDataParallel
from mmcv.runner import EpochBasedRunner, build_optimizer
from mmcv.utils import get_logger
from torch.utils.data import DataLoader, Datase... | [
"mmcv.utils.get_logger",
"torch.nn.GroupNorm",
"numpy.mean",
"mmcv.runner.build_optimizer",
"torch.utils.data.DataLoader",
"mmaction.utils.PreciseBNHook",
"mmcv.runner.EpochBasedRunner",
"torch.nn.BatchNorm1d",
"numpy.array",
"torch.cuda.is_available",
"pytest.raises",
"torch.tensor",
"torch... | [((2701, 2739), 'torch.utils.data.DataLoader', 'DataLoader', (['test_dataset'], {'batch_size': '(2)'}), '(test_dataset, batch_size=2)\n', (2711, 2739), False, 'from torch.utils.data import DataLoader, Dataset\n'), ((2783, 2820), 'mmcv.runner.build_optimizer', 'build_optimizer', (['model', 'optimizer_cfg'], {}), '(model... |
import pandas as pd
import networkx as nx
import numpy as np
import scipy.sparse as sp
import torch
from sklearn.metrics import accuracy_score, f1_score
graph_name = "ppi"
def build_dataframe(input_data: pd.DataFrame, col_name: str, preserve_int_col_name=False) -> pd.DataFrame:
"""
Given an input DataFra... | [
"sklearn.metrics.f1_score",
"scipy.sparse.diags",
"pandas.read_csv",
"scipy.sparse.eye",
"numpy.power",
"networkx.Graph",
"torch.from_numpy",
"numpy.equal",
"numpy.zeros",
"networkx.parse_edgelist",
"networkx.to_scipy_sparse_matrix",
"numpy.vstack",
"scipy.sparse.coo_matrix",
"pandas.DataF... | [((830, 857), 'pandas.DataFrame', 'pd.DataFrame', (['vertices_dict'], {}), '(vertices_dict)\n', (842, 857), True, 'import pandas as pd\n'), ((1050, 1101), 'pandas.read_csv', 'pd.read_csv', (['vertices_path'], {'sep': '""","""', 'index_col': '"""id"""'}), "(vertices_path, sep=',', index_col='id')\n", (1061, 1101), True,... |
from sys import argv
import Base
from Base import Net
from Base import Node, Board
import Base_Test
import numpy as np
import copy
import atexit
import matplotlib.pyplot as plt
import Base_Test
from netlist_parser import parse_file
def show_graph():
# b = Board(0, nets, min_cost_placement, 12, 12)
... | [
"Base.Net",
"Base.unlock_all_nodes",
"Base.get_total_cost",
"Base.Node",
"netlist_parser.parse_file",
"matplotlib.pyplot.plot",
"Base.random_place_board",
"Base.get_connected_nodes",
"Base.find_node_at",
"numpy.random.randint",
"Base.swap",
"copy.deepcopy",
"matplotlib.pyplot.pause",
"copy... | [((744, 771), 'atexit.register', 'atexit.register', (['show_graph'], {}), '(show_graph)\n', (759, 771), False, 'import atexit\n'), ((652, 671), 'matplotlib.pyplot.plot', 'plt.plot', (['cost_list'], {}), '(cost_list)\n', (660, 671), True, 'import matplotlib.pyplot as plt\n'), ((677, 687), 'matplotlib.pyplot.show', 'plt.... |
"""Бивектор углового и линейного параметра"""
import numpy
import math
import zencad.util
class screw:
"""Геометрический винт.
Состоит из угловой и линейной части."""
__slots__ = ['ang', 'lin']
def __init__(self, ang=(0, 0, 0), lin=(0, 0, 0)):
self.ang = zencad.util.vector3(ang)
... | [
"numpy.array"
] | [((2786, 2875), 'numpy.array', 'numpy.array', (['[self.lin.x, self.lin.y, self.lin.z, self.ang.x, self.ang.y, self.ang.z]'], {}), '([self.lin.x, self.lin.y, self.lin.z, self.ang.x, self.ang.y,\n self.ang.z])\n', (2797, 2875), False, 'import numpy\n')] |
"""
Deprecated file: Just keeping it, separate loading into numpy arrays is needed in future
"""
from utils import generate_file_name_from_labels
from constants import DATA_PATH, label_dict, folder_labels
from obspy import read
import os
import warnings
import numpy as np
def load_data(file_name, training_folder, f... | [
"obspy.read",
"utils.generate_file_name_from_labels",
"os.path.exists",
"os.listdir",
"numpy.array",
"os.path.isdir"
] | [((1020, 1061), 'utils.generate_file_name_from_labels', 'generate_file_name_from_labels', (['file_name'], {}), '(file_name)\n', (1050, 1061), False, 'from utils import generate_file_name_from_labels\n'), ((3240, 3262), 'os.listdir', 'os.listdir', (['train_path'], {}), '(train_path)\n', (3250, 3262), False, 'import os\n... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
import pickle as pickle
import glob
import os
print(glob.glob(os.path.expanduser("~/storage/metadata/kaggle-heart/predictions/j7_jeroen_ch.pkl")))
predictions = pickle.load(open(glob.glob(os.path.expanduser("~/storage/metadata/... | [
"matplotlib.animation.FuncAnimation",
"numpy.linspace",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.get_current_fig_manager",
"os.path.expanduser",
"matplotlib.pyplot.show"
] | [((419, 447), 'numpy.linspace', 'np.linspace', (['(0.0)', '(600.0)', '(600)'], {}), '(0.0, 600.0, 600)\n', (430, 447), True, 'import numpy as np\n'), ((532, 544), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (542, 544), True, 'import matplotlib.pyplot as plt\n'), ((553, 582), 'matplotlib.pyplot.get_curre... |
#!/usr/bin/env python
import os
import numpy as np
from scipy.interpolate import interp1d
from pyPanair.preprocess import wgs_creator
from pyPanair.utilities import bspline
def main(x1, x2, y1, y2, y3, aoas=(7.42), target_dir=""):
""" create a LaWGS file for twisted rectangular wing
reference case 3... | [
"pyPanair.preprocess.wgs_creator.Network",
"pyPanair.preprocess.wgs_creator.naca4digit",
"os.path.join",
"scipy.interpolate.interp1d",
"pyPanair.utilities.bspline",
"pyPanair.preprocess.wgs_creator.LaWGS",
"numpy.array",
"numpy.linspace"
] | [((335, 367), 'pyPanair.preprocess.wgs_creator.LaWGS', 'wgs_creator.LaWGS', (['"""ADODG_case3"""'], {}), "('ADODG_case3')\n", (352, 367), False, 'from pyPanair.preprocess import wgs_creator\n'), ((526, 573), 'numpy.array', 'np.array', (['((0, 0), (x1, y1), (x2, y2), (1, y3))'], {}), '(((0, 0), (x1, y1), (x2, y2), (1, y... |
import tensorflow as tf
import numpy as np
from models.autoencoder_models import stacked_denoising_autoencoder
from utils import datasets, utilities
# #################### #
# Flags definition #
# #################### #
flags = tf.app.flags
FLAGS = flags.FLAGS
# Global configuration
flags.DEFINE_string('dataset'... | [
"utils.datasets.load_cifar10_dataset",
"utils.datasets.load_mnist_dataset",
"numpy.load",
"models.autoencoder_models.stacked_denoising_autoencoder.StackedDenoisingAutoencoder",
"utils.utilities.random_seed_np_tf"
] | [((5453, 5492), 'utils.utilities.random_seed_np_tf', 'utilities.random_seed_np_tf', (['FLAGS.seed'], {}), '(FLAGS.seed)\n', (5480, 5492), False, 'from utils import datasets, utilities\n'), ((6781, 7733), 'models.autoencoder_models.stacked_denoising_autoencoder.StackedDenoisingAutoencoder', 'stacked_denoising_autoencode... |
"""This module provides a generalized implementation of UNet.
See the `UNet` class docstring for more information.
"""
import attr
from typing import List, Optional, Text
from sleap.nn.architectures import encoder_decoder
from sleap.nn.config import UNetConfig
import numpy as np
import tensorflow as tf
@attr.s(auto... | [
"attr.s",
"sleap.nn.architectures.encoder_decoder.SimpleConvBlock",
"sleap.nn.architectures.encoder_decoder.SimpleUpsamplingBlock",
"numpy.log2",
"tensorflow.keras.layers.MaxPool2D"
] | [((309, 334), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (315, 334), False, 'import attr\n'), ((1419, 1444), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (1425, 1444), False, 'import attr\n'), ((1205, 1321), 'tensorflow.keras.layers.MaxPool2D', 'tf.k... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
'''
#+DESCRITION: online segmentation
#+FROM: github.com/durant35/SqueezeSeg
#+DATE: 2018-08-08-Wed
#+AUTHOR: <NAME> (<EMAIL>)
'''
import sys
import os.path
import numpy as np
from PIL import Image
import tensorflow as tf
import rospy
from sen... | [
"numpy.uint8",
"rospy.Publisher",
"numpy.reshape",
"tensorflow.train.Saver",
"numpy.stack",
"utils.clock.Clock",
"numpy.uint32",
"std_msgs.msg.Header",
"rospy.spin",
"rospy.Time",
"sensor_msgs.point_cloud2.PointField",
"tensorflow.ConfigProto",
"rospy.Subscriber",
"sys.path.append",
"sen... | [((500, 633), 'sys.path.append', 'sys.path.append', (['"""/home/dyros-vehicle/gitrepo/ims_ros/catkin_ws_kinetic/src/squeezeseg_cpp_preprocessing/script/squeezeseg"""'], {}), "(\n '/home/dyros-vehicle/gitrepo/ims_ros/catkin_ws_kinetic/src/squeezeseg_cpp_preprocessing/script/squeezeseg'\n )\n", (515, 633), False, '... |
'''
Created on 12.11.2017
@author: Felix
'''
import Covariance as Covariance
import Optimization as Optimization
import pandas as pd
import numpy as np
class Portfolio():
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
print('creating portf... | [
"numpy.exp",
"pandas.ExcelWriter",
"Covariance.Covariance",
"numpy.sqrt"
] | [((3168, 3203), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['self.excelOuputFile'], {}), '(self.excelOuputFile)\n', (3182, 3203), True, 'import pandas as pd\n'), ((870, 947), 'Covariance.Covariance', 'Covariance.Covariance', (['self.securityList', 'fluctuationmode', 'startDate', 'endDate'], {}), '(self.securityList, fluc... |
import inspect
import os
import sys
import warnings
from collections import OrderedDict
from typing import Callable, Union, Iterable
import requests
import numpy as np
from numpy.random.mtrand import RandomState
from matrx.agents.agent_brain import AgentBrain
from matrx.agents.capabilities.capability import SenseCapa... | [
"numpy.clip",
"matrx.utils.utils._get_line_coords",
"matrx.utils.utils._white_noise",
"inspect.signature",
"inspect.getfullargspec",
"matrx.API.api.run_api",
"matrx.utils.utils.get_inheritence_path",
"matrx.objects.agent_body.AgentBody",
"matrx.grid_world.GridWorld",
"matrx.utils.utils.create_sens... | [((6726, 6760), 'numpy.random.RandomState', 'np.random.RandomState', (['random_seed'], {}), '(random_seed)\n', (6747, 6760), True, 'import numpy as np\n'), ((19054, 19097), 'matrx.utils.utils.get_inheritence_path', 'get_inheritence_path', (['agent_brain.__class__'], {}), '(agent_brain.__class__)\n', (19074, 19097), Fal... |
import os
import sys
import time
import numpy
a = numpy.full(20000000, 1.0, dtype = numpy.float64)
b = numpy.full(20000000, 1.0, dtype = numpy.float64)
# Stride 1
time1 = time.time()
for _ in range(2000):
sum = numpy.dot(a, b)
time2 = time.time() - time1
print("Time for dot product of 20M elements, stride 1, 40.0... | [
"numpy.full",
"numpy.dot",
"time.time"
] | [((51, 97), 'numpy.full', 'numpy.full', (['(20000000)', '(1.0)'], {'dtype': 'numpy.float64'}), '(20000000, 1.0, dtype=numpy.float64)\n', (61, 97), False, 'import numpy\n'), ((104, 150), 'numpy.full', 'numpy.full', (['(20000000)', '(1.0)'], {'dtype': 'numpy.float64'}), '(20000000, 1.0, dtype=numpy.float64)\n', (114, 150... |
import sys
sys.path.append('..')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.optimize
import projgrad
from scipy.stats.mstats import gmean
import matplotlib
colors = matplotlib.rcParams['axes.prop_cycle'].by_key()['color']
black = matplotlib.rcParams['axes.labelcolor']
tcellcol... | [
"numpy.ones",
"numpy.log",
"optparse.OptionParser",
"matplotlib.pyplot.style.use",
"numpy.heaviside",
"plotting.label_axes",
"numpy.sum",
"numpy.linspace",
"numpy.array",
"matplotlib.ticker.ScalarFormatter",
"projgrad.minimize",
"numpy.logspace",
"sys.path.append",
"matplotlib.pyplot.subpl... | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((440, 454), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (452, 454), False, 'from optparse import OptionParser\n'), ((3822, 3846), 'numpy.linspace', 'np.linspace', (['(0)', '(4)', '(N + 1)'... |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Tests for qiskit.Result"""
import unittest
from numpy import array_equal
import qiskit
from qiskit.wrapper import execu... | [
"qiskit.wrapper.available_backends",
"qiskit.ClassicalRegister",
"qiskit.wrapper.register",
"numpy.array_equal",
"qiskit.wrapper.execute",
"unittest.main",
"qiskit.QuantumCircuit",
"qiskit.QuantumRegister"
] | [((4808, 4834), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (4821, 4834), False, 'import unittest\n'), ((518, 543), 'qiskit.QuantumRegister', 'qiskit.QuantumRegister', (['(1)'], {}), '(1)\n', (540, 543), False, 'import qiskit\n'), ((557, 584), 'qiskit.ClassicalRegister', 'qiskit.Cla... |
# -*- coding: utf-8 -*-
"""Augmentation methods.
- Author: Curt-Park
- Email: <EMAIL>
- Reference:
https://arxiv.org/pdf/1805.09501.pdf
https://github.com/kakaobrain/fast-autoaugment/
"""
from abc import ABC
from itertools import chain
import random
from typing import List, Tuple
from PIL.Image import Image
... | [
"random.sample",
"src.augmentation.transforms.transforms_info",
"src.utils.to_onehot",
"numpy.random.beta",
"itertools.chain.from_iterable",
"torch.tensor",
"random.random",
"src.utils.get_rand_bbox_coord",
"random.randint"
] | [((694, 711), 'src.augmentation.transforms.transforms_info', 'transforms_info', ([], {}), '()\n', (709, 711), False, 'from src.augmentation.transforms import transforms_info\n'), ((2385, 2430), 'random.sample', 'random.sample', (['self.policies'], {'k': 'self.n_select'}), '(self.policies, k=self.n_select)\n', (2398, 24... |
# Author: <NAME>, https://users.soe.ucsc.edu/~cicekm/
from .InputEstimatorABC import InputEstimatorABC
from .FaceDetectors import CVFaceDetector
from .LandmarkDetectors import LandmarkDetector
from ...Paths import CV2Res10SSD_frozen_face_model_path
from abc import ABC, abstractmethod
import numpy as np, math
from pyka... | [
"numpy.reshape",
"numpy.ones",
"cv2.projectPoints",
"numpy.linalg.norm",
"math.degrees",
"numpy.array",
"numpy.zeros",
"cv2.solvePnP",
"cv2.Rodrigues",
"numpy.matmul",
"numpy.concatenate",
"cv2.calibrateCamera",
"pykalman.KalmanFilter",
"cv2.hconcat"
] | [((680, 694), 'numpy.zeros', 'np.zeros', (['(3,)'], {}), '((3,))\n', (688, 694), True, 'import numpy as np, math\n'), ((2491, 2505), 'numpy.zeros', 'np.zeros', (['(3,)'], {}), '((3,))\n', (2499, 2505), True, 'import numpy as np, math\n'), ((4014, 4135), 'numpy.array', 'np.array', (['[[focal_length[0], 0, camera_center[... |
import numpy as np
import time
import cv2
def sample_angle():
d = np.random.binomial(1,0.5)
theta = np.random.uniform(np.pi/12, np.pi - np.pi/12) * (-1)**d
return theta
class Player():
def __init__(self, x, board_size, bat_size, dtheta = np.pi/12, dy = 3):
self.x = x
self.y = np.... | [
"numpy.abs",
"cv2.line",
"numpy.min",
"time.sleep",
"cv2.imshow",
"numpy.random.randint",
"cv2.circle",
"numpy.remainder",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin",
"cv2.waitKey",
"numpy.random.binomial",
"numpy.arctan"
] | [((71, 97), 'numpy.random.binomial', 'np.random.binomial', (['(1)', '(0.5)'], {}), '(1, 0.5)\n', (89, 97), True, 'import numpy as np\n'), ((109, 158), 'numpy.random.uniform', 'np.random.uniform', (['(np.pi / 12)', '(np.pi - np.pi / 12)'], {}), '(np.pi / 12, np.pi - np.pi / 12)\n', (126, 158), True, 'import numpy as np\... |
import os
import numpy as np
import random
import torch
from torch.utils.data import DataLoader
from torchvision import models, transforms
import myInception_v3
from myDataReader import ClsDataset
from myUtils import save_temp_excel, GetParser, ProbBoxPlot, NetPrediction, EvalMetrics, EvalMetricsV2, patient_res... | [
"os.remove",
"os.path.exists",
"numpy.savez",
"os.listdir",
"myUtils.NetPrediction",
"os.path.isdir",
"numpy.random.seed",
"myUtils.EvalMetricsV2",
"torchvision.transforms.ToTensor",
"myUtils.EvalMetrics",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"myUtils.GetParse... | [((386, 402), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (396, 402), False, 'import os\n'), ((649, 671), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (660, 671), False, 'import random\n'), ((677, 702), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (691,... |
import cv2
import numpy as np
def valid_odd_size(size):
"""
Validates that a kernel shape is of odd ints and of with 2 dimensions
:param size: the shape (size) to be checked
:return: False if size is invalid
"""
if type(size) not in (list, tuple):
return False
if len(size) != 2:
... | [
"numpy.zeros",
"cv2.getStructuringElement",
"numpy.ones"
] | [((1046, 1100), 'cv2.getStructuringElement', 'cv2.getStructuringElement', (['cv2.MORPH_CROSS'], {'ksize': 'size'}), '(cv2.MORPH_CROSS, ksize=size)\n', (1071, 1100), False, 'import cv2\n'), ((1526, 1579), 'cv2.getStructuringElement', 'cv2.getStructuringElement', (['cv2.MORPH_RECT'], {'ksize': 'size'}), '(cv2.MORPH_RECT,... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 12:05:08 2018
@author: Alexandre
"""
###############################################################################
import numpy as np
###############################################################################
from pyro.dynamic import pendulum
from pyro.control i... | [
"numpy.array",
"pyro.dynamic.pendulum.DoublePendulum",
"pyro.control.nonlinear.ComputedTorqueController"
] | [((423, 448), 'pyro.dynamic.pendulum.DoublePendulum', 'pendulum.DoublePendulum', ([], {}), '()\n', (446, 448), False, 'from pyro.dynamic import pendulum\n'), ((456, 495), 'pyro.control.nonlinear.ComputedTorqueController', 'nonlinear.ComputedTorqueController', (['sys'], {}), '(sys)\n', (490, 495), False, 'from pyro.cont... |
import pandas as pd
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import utilities
def fig_for_location(data, country=None, state=None, num_start=100, case_type="confirmed", averaged_days=5,
yaxes_type='log', doubling_guides=None):
"""Creates... | [
"utilities.location_name",
"numpy.exp2",
"plotly.graph_objects.Scatter",
"pandas.DataFrame",
"numpy.log2"
] | [((969, 1006), 'pandas.DataFrame', 'pd.DataFrame', (["{'current': series_sum}"], {}), "({'current': series_sum})\n", (981, 1006), True, 'import pandas as pd\n'), ((1472, 1525), 'utilities.location_name', 'utilities.location_name', ([], {'country': 'country', 'state': 'state'}), '(country=country, state=state)\n', (1495... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from learner_Q import LearnerQ
import logging
_logger = logging.getLogger(__name__)
class LearnerPLPR(LearnerQ):
def __init__(self, action_count=4, name='PPR',
epsilon=1.0, epsilon_change=-0.0005, alpha=0.05, gamma=0.95,
... | [
"logging.getLogger",
"numpy.random.RandomState"
] | [((121, 148), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (138, 148), False, 'import logging\n'), ((343, 367), 'numpy.random.RandomState', 'np.random.RandomState', (['(1)'], {}), '(1)\n', (364, 367), True, 'import numpy as np\n')] |
import numpy as np
import cv2
from .utils import distance
def get_dewarped_table(im, corners):
# check input
if im is None:
return None
if len(corners) != 4:
return None
target_w = int(max(distance(corners[0], corners[1]), distance(corners[2], corners[3])))
target_h = in... | [
"cv2.warpPerspective",
"numpy.float32",
"cv2.getPerspectiveTransform"
] | [((489, 508), 'numpy.float32', 'np.float32', (['corners'], {}), '(corners)\n', (499, 508), True, 'import numpy as np\n'), ((520, 546), 'numpy.float32', 'np.float32', (['target_corners'], {}), '(target_corners)\n', (530, 546), True, 'import numpy as np\n'), ((570, 609), 'cv2.getPerspectiveTransform', 'cv2.getPerspective... |
import numpy
import matplotlib.pyplot as plot
def relu(arr):
return numpy.maximum(0, arr)
x = numpy.arange(-10, 10, 0.1)
y = relu(x)
plot.plot(x, y, label="Sigmoid function")
plot.xlabel('x')
plot.ylabel('y')
plot.show()
| [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.maximum",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((102, 128), 'numpy.arange', 'numpy.arange', (['(-10)', '(10)', '(0.1)'], {}), '(-10, 10, 0.1)\n', (114, 128), False, 'import numpy\n'), ((141, 182), 'matplotlib.pyplot.plot', 'plot.plot', (['x', 'y'], {'label': '"""Sigmoid function"""'}), "(x, y, label='Sigmoid function')\n", (150, 182), True, 'import matplotlib.pypl... |
# -*- coding: utf-8 -*-
"""
HISTORY:
Created on Wed May 27 14:27:16 2020
Project: Vortex GUI
Author: DIVE-LINK (www.dive-link.net), <EMAIL>
<NAME> (SemperAnte), <EMAIL>
TODO:
DESCRIPTION:
InformationWidget
slots:
loadImage
startImage
clearImage
"""
fr... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTextEdit",
"PyQt5.QtCore.pyqtSignal",
"numpy.ceil",
"numpy.packbits",
"PyQt5.QtGui.QFont",
"PyQt5.QtCore.QTimer",
"numpy.unpackbits",
"numpy.iinfo",
"utility.runManualTest",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtWidgets.QProgressBar",
"matplotlib.pypl... | [((663, 679), 'PyQt5.QtCore.pyqtSignal', 'qtc.pyqtSignal', ([], {}), '()\n', (677, 679), True, 'from PyQt5 import QtCore as qtc\n'), ((1141, 1165), 'PyQt5.QtCore.pyqtSlot', 'qtc.pyqtSlot', (['np.ndarray'], {}), '(np.ndarray)\n', (1153, 1165), True, 'from PyQt5 import QtCore as qtc\n'), ((1829, 1843), 'PyQt5.QtCore.pyqt... |
from .. import ccllib as lib
from ..core import check
from ..background import omega_x
from .massdef import MassDef, MassDef200m
import numpy as np
class HaloBias(object):
""" This class enables the calculation of halo bias functions.
We currently assume that all halo bias functions can be written
as func... | [
"numpy.exp",
"numpy.log10",
"numpy.ndim",
"numpy.atleast_1d"
] | [((3626, 3641), 'numpy.log10', 'np.log10', (['M_use'], {}), '(M_use)\n', (3634, 3641), True, 'import numpy as np\n'), ((4780, 4796), 'numpy.atleast_1d', 'np.atleast_1d', (['M'], {}), '(M)\n', (4793, 4796), True, 'import numpy as np\n'), ((11314, 11340), 'numpy.exp', 'np.exp', (['(-(4.0 / ld) ** 4.0)'], {}), '(-(4.0 / l... |
from sklearn.cluster import * # https://scikit-learn.org/stable/modules/classes.html#module-sklearn.cluster
from sklearn.linear_model import * # https://scikit-learn.org/stable/modules/classes.html#module-sklearn.linear_model
from sklearn.naive_bayes import * # https://scikit-learn.org/stable/modules/classes.html#mo... | [
"numpy.amin",
"sklearn.model_selection.train_test_split",
"numpy.sort",
"numpy.sum",
"numpy.array",
"numpy.finfo",
"numpy.arange"
] | [((1274, 1322), 'sklearn.model_selection.train_test_split', 'model_selection.train_test_split', (['x', 'y'], {}), '(x, y, **kwargs)\n', (1306, 1322), False, 'from sklearn import model_selection\n'), ((1636, 1650), 'numpy.sort', 'np.sort', (['array'], {}), '(array)\n', (1643, 1650), True, 'import numpy as np\n'), ((1688... |
"""Helper functions for finding and plotting a pareto front."""
from os.path import join
from typing import Dict, MutableMapping, Optional
# import sys
# from PyQt5.QtWidgets import QApplication
import numpy as np
from plotly import offline
import plotly.express as px
import plotly.graph_objects as go
import matplotl... | [
"plotly.express.scatter",
"numpy.ones",
"plotly.offline.plot",
"os.path.join",
"mat_discover.utils.plotting.matplotlibify",
"numpy.any",
"numpy.max",
"numpy.argsort",
"numpy.array",
"numpy.linspace",
"plotly.graph_objects.Line",
"numpy.nanmax",
"numpy.nan_to_num"
] | [((784, 797), 'numpy.max', 'np.max', (['costs'], {}), '(costs)\n', (790, 797), True, 'import numpy as np\n'), ((810, 838), 'numpy.nan_to_num', 'np.nan_to_num', (['costs'], {'nan': 'mx'}), '(costs, nan=mx)\n', (823, 838), True, 'import numpy as np\n'), ((858, 893), 'numpy.ones', 'np.ones', (['costs.shape[0]'], {'dtype':... |
#import
from src.project_parameters import ProjectParameters
from DeepLearningTemplate.predict_gui import BasePredictGUI
from src.predict import Predict
from DeepLearningTemplate.data_preparation import AudioLoader, parse_transforms
from tkinter import Button, messagebox
import numpy as np
from matplotlib.backends.back... | [
"numpy.abs",
"tkinter.messagebox.showerror",
"src.predict.Predict",
"matplotlib.figure.Figure",
"src.project_parameters.ProjectParameters",
"DeepLearningTemplate.data_preparation.parse_transforms",
"playsound.playsound",
"tkinter.Button",
"numpy.array",
"gradio.inputs.Audio",
"gradio.outputs.Tex... | [((632, 678), 'src.predict.Predict', 'Predict', ([], {'project_parameters': 'project_parameters'}), '(project_parameters=project_parameters)\n', (639, 678), False, 'from src.predict import Predict\n'), ((751, 806), 'DeepLearningTemplate.data_preparation.AudioLoader', 'AudioLoader', ([], {'sample_rate': 'project_paramet... |
#!/usr/bin/env python3
from tensorflow.python.saved_model import tag_constants
from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2
import rospy
import rospkg
from visualization_msgs.msg import Marker, MarkerArray
from sensor_msgs.msg import Image
from statek_ml.msg import Dyna... | [
"sys.path.insert",
"visualization_msgs.msg.Marker",
"rospy.logwarn",
"visualization_msgs.msg.MarkerArray",
"rospy.init_node",
"math.sqrt",
"numpy.array",
"rospy.Rate",
"tensorflow.python.framework.convert_to_constants.convert_variables_to_constants_v2",
"tensorflow.saved_model.load",
"numpy.resh... | [((538, 554), 'rospkg.RosPack', 'rospkg.RosPack', ([], {}), '()\n', (552, 554), False, 'import rospkg\n'), ((614, 638), 'sys.path.insert', 'sys.path.insert', (['(1)', 'path'], {}), '(1, path)\n', (629, 638), False, 'import sys\n'), ((10941, 10992), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.expe... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 15 01:45:23 2018
@author: JAE
"""
import torch
import torch.multiprocessing as mp
import random
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from collections import namedtuple, deque
import gym
import copy
import ... | [
"random.sample",
"torch.nn.functional.mse_loss",
"collections.deque",
"numpy.reshape",
"torch.nn.ReLU",
"random.randint",
"torch.argmax",
"torch.from_numpy",
"numpy.array",
"numpy.resize",
"torch.nn.Linear",
"torch.no_grad",
"random.random",
"gym.make",
"torch.multiprocessing.Manager"
] | [((779, 821), 'numpy.reshape', 'np.reshape', (['x', '(1, x.shape[1], x.shape[0])'], {}), '(x, (1, x.shape[1], x.shape[0]))\n', (789, 821), True, 'import numpy as np\n'), ((3066, 3089), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (3074, 3089), False, 'import gym\n'), ((5055, 5074), 'collect... |
"""
Credits:
Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise)
This source code is licensed under the MIT license found in the LICENSE
file in the root directory of this source tree.
"""
import numpy as np
import pytest... | [
"pytest.approx",
"numpy.mean",
"numpy.median",
"numpy.amin",
"eolearn.geometry.SuperpixelSegmentationTask",
"eolearn.geometry.FelzenszwalbSegmentationTask",
"numpy.amax",
"eolearn.geometry.SlicSegmentationTask"
] | [((2346, 2361), 'numpy.amin', 'np.amin', (['result'], {}), '(result)\n', (2353, 2361), True, 'import numpy as np\n'), ((2365, 2399), 'pytest.approx', 'pytest.approx', (['expected_min', 'delta'], {}), '(expected_min, delta)\n', (2378, 2399), False, 'import pytest\n'), ((2443, 2458), 'numpy.amax', 'np.amax', (['result'],... |
import numpy as np
from mpi4py import MPI
from tqdm import tqdm
from ..prob_calculators import get_p_cos1_given_xeff_q_a1, get_p_a1_given_xeff_q
comm = MPI.COMM_WORLD
pe = comm.Get_rank() # identity of this process (process element, sometimes called rank)
nprocs = comm.Get_size() # number of processes
root = nprocs... | [
"tqdm.tqdm",
"numpy.append",
"numpy.array",
"numpy.concatenate",
"numpy.arange"
] | [((527, 567), 'tqdm.tqdm', 'tqdm', (['a1s'], {'desc': 'f"""Building p_cos1 cache"""'}), "(a1s, desc=f'Building p_cos1 cache')\n", (531, 567), False, 'from tqdm import tqdm\n'), ((887, 898), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (895, 898), True, 'import numpy as np\n'), ((734, 764), 'numpy.append', 'np.appen... |
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
"""
A plugin to graph the pixel values along a straight line bisecting a cube.
**Plugin Type: Local**
``LineProfile`` is a local plugin, which means it is associated with a
channel. An instance can be opened f... | [
"ginga.gw.Widgets.build_info",
"ginga.gw.Widgets.Button",
"ginga.gw.Widgets.hadjust",
"ginga.gw.Widgets.Splitter",
"ginga.gw.Widgets.HBox",
"ginga.gw.Widgets.get_oriented_box",
"ginga.util.toolbox.generate_cfg_example",
"ginga.util.plots.Plot",
"ginga.gw.Widgets.Label",
"ginga.gw.Plot.PlotWidget",... | [((23868, 23927), 'ginga.util.toolbox.generate_cfg_example', 'generate_cfg_example', (['"""plugin_LineProfile"""'], {'package': '"""ginga"""'}), "('plugin_LineProfile', package='ginga')\n", (23888, 23927), False, 'from ginga.util.toolbox import generate_cfg_example\n'), ((3671, 3685), 'ginga.gw.Widgets.VBox', 'Widgets.... |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | [
"skbio.util._decorator.overrides",
"skbio.util._decorator.stable",
"numpy.in1d"
] | [((3745, 3766), 'skbio.util._decorator.stable', 'stable', ([], {'as_of': '"""0.4.0"""'}), "(as_of='0.4.0')\n", (3751, 3766), False, 'from skbio.util._decorator import stable\n'), ((3772, 3796), 'skbio.util._decorator.overrides', 'overrides', (['IUPACSequence'], {}), '(IUPACSequence)\n', (3781, 3796), False, 'from skbio... |
import torch as th
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
class PolicyValueNetwork(nn.Module):
def __init__(self, lower_size, prev_size, policy_size, hidden_size=64, proj_size=32):
super(PolicyValueNetwork, ... | [
"torch.nn.functional.tanh",
"numpy.ones",
"analysis.notes_to_midi",
"IPython.embed",
"datasets.fetch_two_voice_species1",
"numpy.array",
"torch.cat",
"torch.nn.Linear",
"torch.nn.functional.relu",
"torch.nn.functional.log_softmax",
"torch.FloatTensor",
"torch.nn.Embedding"
] | [((2482, 2508), 'datasets.fetch_two_voice_species1', 'fetch_two_voice_species1', ([], {}), '()\n', (2506, 2508), False, 'from datasets import fetch_two_voice_species1\n'), ((4994, 5056), 'numpy.array', 'np.array', (['[[tb_map[ldi] for ldi in ld[0]] for ld in list_data]'], {}), '([[tb_map[ldi] for ldi in ld[0]] for ld i... |
#!/usr/bin/env python3
# Copyright 2020 Stanford University
#
# 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 applicab... | [
"numpy.copyto",
"pygion.task",
"numpy.array",
"pygion.Region",
"pygion.Partition.by_field"
] | [((735, 756), 'pygion.task', 'task', ([], {'privileges': '[WD]'}), '(privileges=[WD])\n', (739, 756), False, 'from pygion import task, Partition, Region, RW, WD\n'), ((791, 1015), 'numpy.array', 'np.array', (['[[([0, 1],), ([1, 0],), ([0, 1],), ([1, 0],)], [([1, 1],), ([1, 0],), ([0, \n 1],), ([1, 1],)], [([0, 0],),... |
import os
import re
import csv
import codecs
import numpy as np
import pandas as pd
from nltk.corpus import stopwords
from nltk.stem import SnowballStemmer
from string import punctuation
from gensim.models import KeyedVectors
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_... | [
"keras.backend.sum",
"pandas.read_csv",
"re.compile",
"keras.backend.reshape",
"keras.backend.floatx",
"keras.layers.Dense",
"keras.preprocessing.sequence.pad_sequences",
"nltk.corpus.stopwords.words",
"numpy.asarray",
"keras.layers.LSTM",
"keras.models.Model",
"keras.callbacks.EarlyStopping",... | [((4168, 4196), 'pandas.read_csv', 'pd.read_csv', (['TRAIN_DATA_FILE'], {}), '(TRAIN_DATA_FILE)\n', (4179, 4196), True, 'import pandas as pd\n'), ((4207, 4234), 'pandas.read_csv', 'pd.read_csv', (['TEST_DATA_FILE'], {}), '(TEST_DATA_FILE)\n', (4218, 4234), True, 'import pandas as pd\n'), ((4492, 4531), 're.compile', 'r... |
import numpy as np
__author__ = "<NAME>"
__copyright__ = "Copyright 2020"
class EKF:
"""Creates a N-dimensional Kalman filter.
Parameters
----------
x_init : numpy.ndarray, optional
Initial state vector: What we know about the (probable) start state.
P_init : numpy.ndarray, optional
... | [
"numpy.dot",
"numpy.linalg.inv"
] | [((4911, 4923), 'numpy.dot', 'np.dot', (['K', 'y'], {}), '(K, y)\n', (4917, 4923), True, 'import numpy as np\n'), ((6988, 7008), 'numpy.linalg.inv', 'np.linalg.inv', (['R_res'], {}), '(R_res)\n', (7001, 7008), True, 'import numpy as np\n'), ((7029, 7049), 'numpy.dot', 'np.dot', (['z_res', 'R_res'], {}), '(z_res, R_res)... |
# Copyright 2019 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.full",
"sklearn.metrics.accuracy_score"
] | [((1170, 1214), 'numpy.full', 'np.full', (['(X.shape[0],)', 'self._majority_label'], {}), '((X.shape[0],), self._majority_label)\n', (1177, 1214), True, 'import numpy as np\n'), ((1365, 1390), 'sklearn.metrics.accuracy_score', 'accuracy_score', (['y', 'y_pred'], {}), '(y, y_pred)\n', (1379, 1390), False, 'from sklearn.... |
"""GenerativeModel class for ... generative models"""
import numpy as np
import tensorflow as tf
from netlds.network import Network
class GenerativeModel(object):
"""Base class for generative models"""
# use same data type throughout graph construction
dtype = tf.float32
def __init__(
s... | [
"tensorflow.get_variable",
"tensorflow.transpose",
"tensorflow.reduce_sum",
"tensorflow.multiply",
"tensorflow.scan",
"tensorflow.set_random_seed",
"tensorflow.log",
"numpy.arange",
"tensorflow.eye",
"tensorflow.tensordot",
"tensorflow.placeholder",
"tensorflow.matmul",
"tensorflow.square",
... | [((12317, 12389), 'tensorflow.initializers.truncated_normal', 'tf.initializers.truncated_normal', ([], {'mean': '(0.0)', 'stddev': '(0.1)', 'dtype': 'self.dtype'}), '(mean=0.0, stddev=0.1, dtype=self.dtype)\n', (12349, 12389), True, 'import tensorflow as tf\n'), ((12431, 12470), 'tensorflow.initializers.zeros', 'tf.ini... |
"""CONTINUOUSLY ADOPTIVE MEAN SHIFT"""
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
cap = cv.VideoCapture('pedestrian.mp4')
ret,frame = cap.read()
x,y,w,h = 950,570,70,60
track = (x,y,w,h)
roi = frame[y:y+h, x:x+w]
hsv_roi = cv.cvtColor(roi, cv.COLOR_BGR2HSV)
mask = cv.inRange(hsv... | [
"cv2.calcHist",
"cv2.normalize",
"cv2.calcBackProject",
"cv2.CamShift",
"cv2.boxPoints",
"cv2.polylines",
"numpy.int0",
"cv2.imshow",
"numpy.array",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.waitKey"
] | [((119, 152), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""pedestrian.mp4"""'], {}), "('pedestrian.mp4')\n", (134, 152), True, 'import cv2 as cv\n'), ((263, 297), 'cv2.cvtColor', 'cv.cvtColor', (['roi', 'cv.COLOR_BGR2HSV'], {}), '(roi, cv.COLOR_BGR2HSV)\n', (274, 297), True, 'import cv2 as cv\n'), ((394, 444), 'cv2.cal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.