code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from math import cos, sin import numpy as np from ....simulator import Agent from .quintic_polynomials_planner import quinic_polynomials_planner class TeacherQuinticPolynomials(Agent): def learn(self, state, action): raise NotImplementedError() def explore(self, state, horizon=1): raise NotI...
[ "numpy.array", "math.cos", "math.sin" ]
[((953, 976), 'numpy.array', 'np.array', (['trajectory[3]'], {}), '(trajectory[3])\n', (961, 976), True, 'import numpy as np\n'), ((1292, 1303), 'math.cos', 'cos', (['action'], {}), '(action)\n', (1295, 1303), False, 'from math import cos, sin\n'), ((1343, 1354), 'math.sin', 'sin', (['action'], {}), '(action)\n', (1346...
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "os.listdir", "mindspore.context.set_context", "mindspore.ops.Argmax", "numpy.random.seed", "argparse.ArgumentParser", "mindspore.ops.ExpandDims", "numpy.fromfile", "mindspore.ops.L2Normalize", "mindspore.Tensor", "mindspore.ops.BatchMatMul", "functools.reduce", "os.path.join", "src.util.Ave...
[((1547, 1585), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'shot_shape'], {}), '(lambda x, y: x * y, shot_shape)\n', (1553, 1585), False, 'from functools import reduce\n'), ((1602, 1641), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'query_shape'], {}), '(lambda x, y: x * y, query_shape)\n', (16...
# Import modulov import numpy as np import matplotlib.pyplot as plt from matplotlib import rc rc('text', usetex=True) # Výpočtová oblasť xmin = -1.0 xmax = 1.0 xn = 101 # Počet vzorkovacích bodov funkcie "f" na intervale "[xmin, xmax]" ymin = xmin ymax = xmax yn = xn # Počet vzorkovacích bodov funkc...
[ "matplotlib.rc", "matplotlib.pyplot.show", "numpy.abs", "numpy.sin", "numpy.linspace", "numpy.cos", "matplotlib.pyplot.subplots" ]
[((94, 117), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (96, 117), False, 'from matplotlib import rc\n'), ((783, 830), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(12.0 / 2.54, 8.0 / 2.54)'}), '(figsize=(12.0 / 2.54, 8.0 / 2.54))\n', (795, 830), True, '...
import numpy as np import scipy from ._hist import take_bins __all__ = ['ecdf'] __EPSILON__ = 1e-8 #-------------------------------------------------------------------- def ecdf(x,y=None): ''' Empirical Cumulative Density Function (ECDF). Parameters ----------- * x,y: 1d ndarrays, if y ...
[ "numpy.asarray", "numpy.searchsorted", "numpy.sort", "numpy.cumsum", "numpy.max", "numpy.array", "numpy.concatenate" ]
[((969, 980), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (977, 980), True, 'import numpy as np\n'), ((989, 999), 'numpy.sort', 'np.sort', (['x'], {}), '(x)\n', (996, 999), True, 'import numpy as np\n'), ((1165, 1187), 'numpy.concatenate', 'np.concatenate', (['(x, y)'], {}), '((x, y))\n', (1179, 1187), True, 'impo...
import operator import math import numpy as np from rtlsdr import RtlSdr import matplotlib.pyplot as plt # Available sample rates ''' 3200000Hz 2800000Hz 2560000Hz 2400000Hz 2048000Hz 1920000Hz 1800000Hz 1400000Hz 1024000Hz 900001Hz 250000Hz ''' # Receiver class. This needs receiving parameters and will receive data ...
[ "rtlsdr.RtlSdr", "numpy.fft.fft", "numpy.mean", "numpy.array", "numpy.fft.fftshift", "numpy.linspace", "numpy.hanning", "numpy.log10" ]
[((446, 454), 'rtlsdr.RtlSdr', 'RtlSdr', ([], {}), '()\n', (452, 454), False, 'from rtlsdr import RtlSdr\n'), ((1237, 1303), 'numpy.linspace', 'np.linspace', ([], {'start': 'start_freq', 'stop': 'stop_freq', 'num': 'self.resolution'}), '(start=start_freq, stop=stop_freq, num=self.resolution)\n', (1248, 1303), True, 'im...
from __future__ import print_function import numpy as np def faces_with_repeated_vertices(f): if f.shape[1] == 3: return np.unique(np.concatenate([ np.where(f[:, 0] == f[:, 1])[0], np.where(f[:, 0] == f[:, 2])[0], np.where(f[:, 1] == f[:, 2])[0], ])) else: ...
[ "numpy.where" ]
[((734, 749), 'numpy.where', 'np.where', (['(f < 0)'], {}), '(f < 0)\n', (742, 749), True, 'import numpy as np\n'), ((174, 202), 'numpy.where', 'np.where', (['(f[:, 0] == f[:, 1])'], {}), '(f[:, 0] == f[:, 1])\n', (182, 202), True, 'import numpy as np\n'), ((219, 247), 'numpy.where', 'np.where', (['(f[:, 0] == f[:, 2])...
import argparse import numpy as np from packaging import version import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="2,3" from PIL import Image import matplotlib.pyplot as plt import cv2 from skimage.transform import rotate import torch from torch.autograd import Variable impo...
[ "os.makedirs", "argparse.ArgumentParser", "numpy.argmax", "torch.autograd.Variable", "torch.load", "dataset.refuge.REFUGE", "os.path.exists", "packaging.version.parse", "torch.nn.Upsample", "models.unet.UNet" ]
[((1465, 1516), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Unet Network"""'}), "(description='Unet Network')\n", (1488, 1516), False, 'import argparse\n'), ((2912, 2947), 'models.unet.UNet', 'UNet', (['(3)'], {'n_classes': 'args.num_classes'}), '(3, n_classes=args.num_classes)\n', (2...
# TODO: Explain 8 corners logic at the top and use it consistently # Add comments of explanation import numpy as np import scipy.spatial from .rotation import rotate_points_along_z def get_size(box): """ Args: box: 8x3 Returns: size: [dx, dy, dz] """ distance = scipy.spatial.dist...
[ "numpy.arctan2", "numpy.sum", "numpy.logical_and", "numpy.roll", "numpy.zeros", "numpy.transpose", "numpy.mean", "numpy.array", "numpy.reshape", "numpy.matmul", "numpy.tile", "numpy.vstack" ]
[((646, 662), 'numpy.arctan2', 'np.arctan2', (['a', 'b'], {}), '(a, b)\n', (656, 662), True, 'import numpy as np\n'), ((1004, 1031), 'numpy.reshape', 'np.reshape', (['center', '(-1, 3)'], {}), '(center, (-1, 3))\n', (1014, 1031), True, 'import numpy as np\n'), ((1417, 1441), 'numpy.transpose', 'np.transpose', (['corner...
""" Compute resonances using the cxroots library (contour integration techniques) Authors: <NAME>, <NAME> Karlsruhe Institute of Technology, Germany University of California, Merced Last modified: 20/04/2021 """ from sys import argv import matplotlib.pyplot as plt import numpy as np ...
[ "scipy.special.h1vp", "numpy.size", "numpy.abs", "scipy.special.ivp", "numpy.amin", "numpy.angle", "numpy.argsort", "numpy.shape", "cxroots.Circle", "numpy.where", "scipy.special.iv", "numpy.loadtxt", "numpy.linspace", "cxroots.AnnulusSector", "numpy.amax", "scipy.special.hankel1", "...
[((482, 493), 'numpy.sqrt', 'np.sqrt', (['(-ε)'], {}), '(-ε)\n', (489, 493), True, 'import numpy as np\n'), ((834, 902), 'cxroots.AnnulusSector', 'AnnulusSector', ([], {'center': '(0.0)', 'radii': '(rMin, rMax)', 'phiRange': '(aMin, aMax)'}), '(center=0.0, radii=(rMin, rMax), phiRange=(aMin, aMax))\n', (847, 902), Fals...
import sys import ReadFile import pickle import World import importlib.util import os.path as osp import policy_generator as pg import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator import numpy as np def module_from_file(module_name, file_path): spec = importlib.ut...
[ "matplotlib.pyplot.title", "numpy.meshgrid", "matplotlib.pyplot.show", "ReadFile.ReadConfiguration", "ReadFile.ReadFilesList", "numpy.zeros", "matplotlib.pyplot.subplots", "policy_generator.generate_group_testing_tests_policy", "numpy.arange", "numpy.array", "matplotlib.pyplot.ylabel", "matplo...
[((573, 601), 'os.path.join', 'osp.join', (['path', '"""config.txt"""'], {}), "(path, 'config.txt')\n", (581, 601), True, 'import os.path as osp\n'), ((740, 790), 'os.path.join', 'osp.join', (['example_path', 'config_obj.agents_filename'], {}), '(example_path, config_obj.agents_filename)\n', (748, 790), True, 'import o...
from django.db import connection import numpy as np def getstudentcoursewisePLO(studentID, courseID): with connection.cursor() as cursor: cursor.execute(''' SELECT p.ploNum as plonum,100*(sum(e.obtainedMarks)/sum(a.totalMarks)) as plopercent FROM app_registration_t r, ...
[ "numpy.round", "numpy.array", "django.db.connection.cursor" ]
[((112, 131), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (129, 131), False, 'from django.db import connection\n'), ((930, 949), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (947, 949), False, 'from django.db import connection\n'), ((1672, 1691), 'django.db.connection....
#Color dict import numpy as np # import wandb import cv2 import torch import os colors = { '0':[(128, 64, 128), (244, 35, 232), (0, 0, 230), (220, 190, 40), (70, 70, 70), (70, 130, 180), (0, 0, 0)], '1':[(128, 64, 128), (250, 170, 160), (244, 35, 232), (230, 150, 140), (220, 20, 60), (255, 0, 0), (0, 0, 230),...
[ "numpy.zeros" ]
[((1692, 1735), 'numpy.zeros', 'np.zeros', (['(mask.shape[0], mask.shape[1], 3)'], {}), '((mask.shape[0], mask.shape[1], 3))\n', (1700, 1735), True, 'import numpy as np\n')]
""" @author: <NAME>, Energy Information Networks & Systems @ TU Darmstadt """ import numpy as np import tensorflow as tf from models.igc import ImplicitGenerativeCopula, GMMNCopula from models.utils import cdf_interpolator import pyvinecopulib as pv from models import mv_copulas import matplotlib.pyplot as plt class...
[ "models.mv_copulas.GaussianCopula", "numpy.random.uniform", "matplotlib.pyplot.subplot", "numpy.zeros_like", "tensorflow.keras.models.load_model", "models.igc.GMMNCopula", "pyvinecopulib.FitControlsVinecop", "matplotlib.pyplot.suptitle", "models.igc.ImplicitGenerativeCopula", "numpy.sort", "matp...
[((1004, 1020), 'numpy.zeros_like', 'np.zeros_like', (['z'], {}), '(z)\n', (1017, 1020), True, 'import numpy as np\n'), ((1203, 1219), 'numpy.zeros_like', 'np.zeros_like', (['u'], {}), '(u)\n', (1216, 1219), True, 'import numpy as np\n'), ((2538, 2565), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(16, 3...
""" This module contains methods/objects that facilitate basic operations. """ # std pkgs import numpy as np import random from typing import Dict, List, Optional, Union from pathlib import Path import pickle # non-std pkgs import matplotlib.pyplot as plt def hamming_dist(k1, k2): val = 0 for ind, char in e...
[ "pickle.load", "random.choice", "numpy.random.choice" ]
[((2668, 2688), 'pickle.load', 'pickle.load', (['hash_tb'], {}), '(hash_tb)\n', (2679, 2688), False, 'import pickle\n'), ((856, 901), 'numpy.random.choice', 'np.random.choice', (["['N', 'D']", '(1)'], {'p': '[0.5, 0.5]'}), "(['N', 'D'], 1, p=[0.5, 0.5])\n", (872, 901), True, 'import numpy as np\n'), ((956, 1001), 'nump...
import numpy as np import cv2 import os from glob import glob from tqdm import tqdm img_h, img_w = 256, 256 means, stdevs = [], [] img_list = [] TRAIN_DATASET_PATH = 'data/Real/subset/train/B' image_fns = glob(os.path.join(TRAIN_DATASET_PATH, '*.*')) for single_img_path in tqdm(image_fns): img = cv2.imread(sing...
[ "tqdm.tqdm", "numpy.concatenate", "numpy.std", "cv2.imread", "numpy.mean", "os.path.join", "cv2.resize" ]
[((278, 293), 'tqdm.tqdm', 'tqdm', (['image_fns'], {}), '(image_fns)\n', (282, 293), False, 'from tqdm import tqdm\n'), ((444, 476), 'numpy.concatenate', 'np.concatenate', (['img_list'], {'axis': '(3)'}), '(img_list, axis=3)\n', (458, 476), True, 'import numpy as np\n'), ((213, 252), 'os.path.join', 'os.path.join', (['...
# ###################################################################### # Copyright (c) 2014, Brookhaven Science Associates, Brookhaven # # National Laboratory. All rights reserved. # # # # Redistribution and use in ...
[ "numpy.zeros", "logging.getLogger", "six.iterkeys" ]
[((2744, 2771), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2761, 2771), False, 'import logging\n'), ((4791, 4823), 'numpy.zeros', 'np.zeros', (['(num_keys, num_coords)'], {}), '((num_keys, num_coords))\n', (4799, 4823), True, 'import numpy as np\n'), ((4341, 4365), 'six.iterkeys', 's...
import math import numpy as np from uam_simulator import my_utils from uam_simulator import pathPlanning from uam_simulator import orca import gurobipy as grb from gurobipy import GRB import time as python_time class Flightplan: def __init__(self, t0, dt, positions, times=None): self.start_time = t0 ...
[ "math.asin", "math.atan2", "math.copysign", "numpy.linalg.norm", "uam_simulator.pathPlanning.AStar_8grid", "numpy.copy", "numpy.arcsin", "math.cos", "math.ceil", "uam_simulator.orca.ORCA", "numpy.asarray", "gurobipy.Model", "math.sin", "numpy.dot", "math.floor", "uam_simulator.my_utils...
[((25063, 25086), 'numpy.linalg.norm', 'np.linalg.norm', (['rel_pos'], {}), '(rel_pos)\n', (25077, 25086), True, 'import numpy as np\n'), ((25344, 25379), 'math.asin', 'math.asin', (['(ownship_agent.radius / d)'], {}), '(ownship_agent.radius / d)\n', (25353, 25379), False, 'import math\n'), ((25420, 25454), 'math.atan2...
import random import time import numpy as np import copy from itertools import compress random.seed(123) #remove columns from adj matrix. #TODO needs additional scaling? #Be carefull too not modify the initial complete support matrix def get_sub_sampled_support(complete_support, node_to_keep): index_array = comp...
[ "numpy.isin", "numpy.sum", "numpy.zeros", "random.seed", "numpy.argwhere" ]
[((89, 105), 'random.seed', 'random.seed', (['(123)'], {}), '(123)\n', (100, 105), False, 'import random\n'), ((403, 438), 'numpy.zeros', 'np.zeros', (['complete_support[1].shape'], {}), '(complete_support[1].shape)\n', (411, 438), True, 'import numpy as np\n'), ((1324, 1370), 'numpy.zeros', 'np.zeros', (['initial_trai...
''' precision_and_recall.py Run MATCH with PeTaL data. Last modified on 10 August 2021. DESCRIPTION precision_and_recall.py produces three plots from results in MATCH/PeTaL. These three plots appear in plots/YYYYMMDD_precision_recall and are as follows: - HHMMSS_label...
[ "matplotlib.pyplot.title", "os.mkdir", "numpy.load", "matplotlib.pyplot.clf", "numpy.argmax", "click.option", "logging.getLogger", "numpy.mean", "click.Path", "os.path.join", "os.path.exists", "click.command", "datetime.datetime.now", "tqdm.tqdm", "matplotlib.pyplot.ylim", "matplotlib....
[((1459, 1516), 'collections.namedtuple', 'namedtuple', (['"""Stats"""', '"""threshold topk precision recall f1"""'], {}), "('Stats', 'threshold topk precision recall f1')\n", (1469, 1516), False, 'from collections import namedtuple\n'), ((1519, 1534), 'click.command', 'click.command', ([], {}), '()\n', (1532, 1534), F...
####################데이터프레임의 문자열 컬럼들을 합치는 등의 작업으로 새로운 컬럼 생성####################################### #이용함수 apply import pandas as pd import numpy as np from pandas import DataFrame, Series # df = pd.DataFrame({'id' : [1,2,10,20,100,200], # "name":['aaa','bbb','ccc','ddd','eee','fff']}) # print(df) # ...
[ "numpy.arange", "pandas.Series" ]
[((5890, 5901), 'pandas.Series', 'Series', (['mdr'], {}), '(mdr)\n', (5896, 5901), False, 'from pandas import DataFrame, Series\n'), ((6222, 6233), 'pandas.Series', 'Series', (['mdc'], {}), '(mdc)\n', (6228, 6233), False, 'from pandas import DataFrame, Series\n'), ((4245, 4258), 'numpy.arange', 'np.arange', (['(20)'], ...
# -*- coding: utf-8 -*- # Copyright 2016 The TensorFlow 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...
[ "tensorflow.app.flags.DEFINE_float", "yaml.load", "click.option", "collections.defaultdict", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.interp", "tensorflow.app.flags.DEFINE_integer", "cv2.cvtColor", "matplotlib.pyplot.imshow", "datasets.dataset_factory.get_dataset", "numpy.max", "t...
[((33480, 33493), 'click.group', 'click.group', ([], {}), '()\n', (33491, 33493), False, 'import click\n'), ((33532, 33561), 'click.argument', 'click.argument', (['"""config_file"""'], {}), "('config_file')\n", (33546, 33561), False, 'import click\n'), ((33563, 33605), 'click.option', 'click.option', (['"""--use_cached...
''' File: \resource.py Project: NumberRecongization Created Date: Monday March 26th 2018 Author: Huisama ----- Last Modified: Saturday March 31st 2018 11:08:21 pm Modified By: Huisama ----- Copyright (c) 2018 Hui ''' import os import scipy.misc as scm import random import numpy as np import PIL # STD_WIDTH = 667 # S...
[ "numpy.dstack", "random.shuffle", "os.walk", "random.choice", "numpy.array", "os.path.splitext", "scipy.misc.imresize", "os.path.join", "scipy.misc.imread" ]
[((1508, 1535), 'scipy.misc.imread', 'scm.imread', (['image_file_path'], {}), '(image_file_path)\n', (1518, 1535), True, 'import scipy.misc as scm\n'), ((3505, 3534), 'random.shuffle', 'random.shuffle', (['self.neg_data'], {}), '(self.neg_data)\n', (3519, 3534), False, 'import random\n'), ((3543, 3572), 'random.shuffle...
import tensorflow as tf import numpy as np # training set. Contains a row of size 5 per train example. The row is same as a sentence, with words replaced # by its equivalent unique index. The below dataset contains 6 unique words numbered 0-5. Ideally the word vector for # 4 and 5 indexed words should be same. X_trai...
[ "tensorflow.random_uniform", "tensorflow.nn.embedding_lookup", "tensorflow.global_variables_initializer", "tensorflow.Session", "numpy.array", "tensorflow.name_scope", "tensorflow.expand_dims" ]
[((324, 368), 'numpy.array', 'np.array', (['[[0, 1, 4, 2, 3], [0, 1, 5, 2, 3]]'], {}), '([[0, 1, 4, 2, 3], [0, 1, 5, 2, 3]])\n', (332, 368), True, 'import numpy as np\n'), ((406, 422), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (414, 422), True, 'import numpy as np\n'), ((453, 480), 'tensorflow.name_sco...
from astropy.io import ascii, fits from astropy.table import QTable, Table import arviz as az from astropy.coordinates import SkyCoord from astropy import units as u import os import pymoc from astropy import wcs from astropy.table import vstack, hstack import numpy as np import xidplus # # Applying XID+CIGALE to E...
[ "astropy.convolution.Gaussian2DKernel", "numpy.abs", "numpy.argmin", "numpy.arange", "astropy.table.hstack", "pymoc.util.catalog.catalog_to_moc", "numpy.random.choice", "subprocess.Popen", "astropy.table.QTable", "numpy.min", "astropy.io.fits.open", "pyvo.dal.TAPService", "astropy.table.Tabl...
[((1773, 1791), 'astropy.io.fits.open', 'fits.open', (['pswfits'], {}), '(pswfits)\n', (1782, 1791), False, 'from astropy.io import ascii, fits\n'), ((1965, 1991), 'astropy.wcs.WCS', 'wcs.WCS', (['hdulist[1].header'], {}), '(hdulist[1].header)\n', (1972, 1991), False, 'from astropy import wcs\n'), ((2007, 2042), 'numpy...
""" Project: RadarBook File: optimum_binary_example.py Created by: <NAME> On: 10/11/2018 Created with: PyCharm Copyright (C) 2019 Artech House (<EMAIL>) This file is part of Introduction to Radar Using Python and MATLAB and can not be copied and/or distributed without the express permission of Artech House. """ import...
[ "numpy.ceil", "matplotlib.backends.backend_qt5agg.FigureCanvas", "matplotlib.figure.Figure", "numpy.arange", "matplotlib.backends.backend_qt5agg.NavigationToolbar2QT", "PyQt5.QtWidgets.QApplication" ]
[((3146, 3168), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (3158, 3168), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow\n'), ((1104, 1112), 'matplotlib.figure.Figure', 'Figure', ([], {}), '()\n', (1110, 1112), False, 'from matplotlib.figure import Figure\n'), ((11...
import math import tensorflow as tf import cv2 import numpy as np from scipy import signal def image_normalization(image: np.ndarray, new_min=0, new_max=255) -> np.ndarray: """ Normalize the input image to a given range set by min and max parameter Args: image ([type]): [description] new_m...
[ "numpy.math.exp", "numpy.meshgrid", "tensorflow.image.rgb_to_grayscale", "numpy.sum", "scipy.signal.convolve2d", "tensorflow.cast", "cv2.imread", "numpy.min", "numpy.arange", "numpy.max", "numpy.math.ceil", "numpy.round", "cv2.resize" ]
[((640, 666), 'tensorflow.cast', 'tf.cast', (['image', 'np.float32'], {}), '(image, np.float32)\n', (647, 666), True, 'import tensorflow as tf\n'), ((780, 821), 'tensorflow.cast', 'tf.cast', (['normalized_image', 'original_dtype'], {}), '(normalized_image, original_dtype)\n', (787, 821), True, 'import tensorflow as tf\...
import numpy as np from matplotlib import pyplot as plt def loadFile(filename): f = open(filename,'r') text = f.read() f.close() rewards = [] steps = [] for line in text.split('\n'): pieces = line.split(',') if(len(pieces) == 2): rewards.append(float(pieces[0])) steps.append(int(piec...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.plot", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((559, 579), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(1)', '(1)'], {}), '(2, 1, 1)\n', (570, 579), True, 'from matplotlib import pyplot as plt\n'), ((580, 597), 'matplotlib.pyplot.plot', 'plt.plot', (['rewards'], {}), '(rewards)\n', (588, 597), True, 'from matplotlib import pyplot as plt\n'), ((600, 636)...
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2021 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
[ "unittest.main", "numpy.full", "numpy.stack", "numpy.testing.assert_array_equal", "torch.randn", "torch.nn.CosineSimilarity", "mc_cnn.run.computes_cost_volume_mc_cnn_fast", "mc_cnn.dataset_generator.middlebury_generator.MiddleburyGenerator", "numpy.arange", "numpy.testing.assert_allclose", "mc_c...
[((21139, 21154), 'unittest.main', 'unittest.main', ([], {}), '()\n', (21152, 21154), False, 'import unittest\n'), ((1942, 1986), 'torch.randn', 'torch.randn', (['(64, 4, 4)'], {'dtype': 'torch.float64'}), '((64, 4, 4), dtype=torch.float64)\n', (1953, 1986), False, 'import torch\n'), ((2010, 2054), 'torch.randn', 'torc...
import matplotlib.pyplot as plt import numpy as np import pandas as pd import sqlite3 from sklearn.metrics import auc from sklearn.metrics import roc_curve def add_truth(data, database): data = data.sort_values('event_no').reset_index(drop = True) with sqlite3.connect(database) as con: query = 'select ...
[ "matplotlib.pyplot.title", "pandas.read_csv", "matplotlib.pyplot.subplot2grid", "numpy.random.default_rng", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "matplotlib.pyplot.tick_params", "pandas.DataFrame", "numpy.std", "numpy.log10", "matplotlib.pyplot.legend", "matplotlib.pyplo...
[((1250, 1272), 'numpy.log10', 'np.log10', (["df['energy']"], {}), "(df['energy'])\n", (1258, 1272), True, 'import numpy as np\n'), ((1323, 1348), 'numpy.random.default_rng', 'np.random.default_rng', (['(42)'], {}), '(42)\n', (1344, 1348), True, 'import numpy as np\n'), ((1520, 1529), 'numpy.std', 'np.std', (['w'], {})...
from preprocessing.vectorizers import Doc2VecVectorizer from nnframework.data_builder import DataBuilder import pandas as pd import constants as const import numpy as np def generate_d2v_vectors(source_file): df = pd.read_csv(source_file) messages = df["Message"].values vectorizer = Doc2VecVectorizer() ...
[ "pandas.read_csv", "numpy.save", "preprocessing.vectorizers.Doc2VecVectorizer" ]
[((219, 243), 'pandas.read_csv', 'pd.read_csv', (['source_file'], {}), '(source_file)\n', (230, 243), True, 'import pandas as pd\n'), ((298, 317), 'preprocessing.vectorizers.Doc2VecVectorizer', 'Doc2VecVectorizer', ([], {}), '()\n', (315, 317), False, 'from preprocessing.vectorizers import Doc2VecVectorizer\n'), ((579,...
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.3 # kernelspec: # display_name: Python 3 # name: python3 # --- # + [markdown] id="M_qo7DmLJKLP" # #Class-Conditional Bernoulli Mixture Model...
[ "jax.nn.log_softmax", "conditional_bernoulli_mix_utils.fake_test_data", "jax.random.PRNGKey", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "numpy.full", "conditional_bernoulli_mix_utils.get_decoded_samples", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "jax.vmap", "ma...
[((1137, 1174), 'conditional_bernoulli_mix_utils.get_emnist_images_per_class', 'get_emnist_images_per_class', (['select_n'], {}), '(select_n)\n', (1164, 1174), False, 'from conditional_bernoulli_mix_utils import fake_test_data, encode, decode, get_decoded_samples, get_emnist_images_per_class\n'), ((1705, 1813), 'condit...
__author__ = 'palmer' # every method in smoothing should accept (im,**args) def median(im, **kwargs): from scipy import ndimage im = ndimage.filters.median_filter(im,**kwargs) return im def hot_spot_removal(xic, q=99.): import numpy as np xic_q = np.percentile(xic, q) xic[xic > xic_q] = xic_q ...
[ "numpy.percentile", "scipy.ndimage.filters.median_filter" ]
[((141, 184), 'scipy.ndimage.filters.median_filter', 'ndimage.filters.median_filter', (['im'], {}), '(im, **kwargs)\n', (170, 184), False, 'from scipy import ndimage\n'), ((268, 289), 'numpy.percentile', 'np.percentile', (['xic', 'q'], {}), '(xic, q)\n', (281, 289), True, 'import numpy as np\n')]
# coding: utf-8 # MultiPerceptron # queueを使った学習 # 学習step数を記録 # 学習データはCSVの代わりにジェネレータを搭載 # 3x11x4のNNモデルに変更 # scoreを追加 import os _FILE_DIR=os.path.abspath(os.path.dirname(__file__)) import time import tensorflow as tf import threading from sklearn.utils import shuffle import sys sys.path.append(_FILE_DIR+'/..') from gene...
[ "tensorflow.train.Coordinator", "tensorflow.reset_default_graph", "tensorflow.matmul", "numpy.random.randint", "tensorflow.Variable", "tensorflow.truncated_normal", "sys.path.append", "tensorflow.nn.softmax", "tensorflow.nn.relu", "tensorflow.nn.softmax_cross_entropy_with_logits", "os.path.dirna...
[((278, 312), 'sys.path.append', 'sys.path.append', (["(_FILE_DIR + '/..')"], {}), "(_FILE_DIR + '/..')\n", (293, 312), False, 'import sys\n'), ((369, 393), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (391, 393), True, 'import tensorflow as tf\n'), ((776, 793), 'generator.SensorGenerat...
# # Copyright (c) 2022 salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause # from abc import ABC import logging import os from os.path import abspath, dirname, join import sys i...
[ "pandas.DataFrame", "unittest.main", "os.path.abspath", "numpy.random.seed", "os.makedirs", "logging.basicConfig", "torch.manual_seed", "merlion.utils.TimeSeries.from_pd", "merlion.models.defaults.DefaultDetector.load", "merlion.post_process.threshold.AggregateAlarms", "random.seed", "pandas.t...
[((716, 743), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (733, 743), False, 'import logging\n'), ((774, 798), 'torch.manual_seed', 'torch.manual_seed', (['(12345)'], {}), '(12345)\n', (791, 798), False, 'import torch\n'), ((803, 821), 'random.seed', 'random.seed', (['(12345)'], {}), '...
# treemodels.py from __future__ import division import gtk from debug import * import numpy as np import matplotlib.pyplot as plt class CountingActivitiesModel (gtk.GenericTreeModel): """Gtk TreeModel for CountingActivity's in a Log.""" def __init__ (self, log): gtk.GenericTreeModel.__init__ (sel...
[ "gtk.GenericTreeModel.__init__", "gtk.gdk.Pixbuf", "numpy.sum", "matplotlib.pyplot.get_cmap" ]
[((286, 321), 'gtk.GenericTreeModel.__init__', 'gtk.GenericTreeModel.__init__', (['self'], {}), '(self)\n', (315, 321), False, 'import gtk\n'), ((1999, 2034), 'gtk.GenericTreeModel.__init__', 'gtk.GenericTreeModel.__init__', (['self'], {}), '(self)\n', (2028, 2034), False, 'import gtk\n'), ((3661, 3696), 'gtk.GenericTr...
import sys import torch from torch.autograd import Variable import numpy as np import os from os import path import argparse import random import copy from tqdm import tqdm import pickle from scorer.data_helper.json_reader import read_sorted_scores, read_pair_anno_scores, read_articles, \ read_processed_scores, rea...
[ "numpy.random.seed", "argparse.ArgumentParser", "numpy.argmax", "random.shuffle", "numpy.mean", "torch.nn.Softmax", "pickle.load", "numpy.random.normal", "scipy.stats.kendalltau", "torch.no_grad", "os.path.join", "numpy.unique", "torch.nn.BCELoss", "os.path.exists", "random.seed", "tor...
[((1669, 1696), 'random.shuffle', 'random.shuffle', (['article_ids'], {}), '(article_ids)\n', (1683, 1696), False, 'import random\n'), ((3637, 3660), 'torch.nn.Softmax', 'torch.nn.Softmax', ([], {'dim': '(1)'}), '(dim=1)\n', (3653, 3660), False, 'import torch\n'), ((4015, 4033), 'torch.nn.BCELoss', 'torch.nn.BCELoss', ...
import numpy as np from matplotlib import pyplot as plt n = 100 x = range(0,n) y = range(0,n) for k in range(0, n): y[k] = y[k] + 3*np.random.randn() + 100 plt.figure(figsize=(20,10)) plt.scatter(x, y) plt.savefig("./images/rawData.png") X = np.zeros([n,1]) target = np.zeros([n,1]) X[:,0] = x target[:,0] = y np....
[ "numpy.random.randn", "matplotlib.pyplot.scatter", "numpy.savetxt", "numpy.zeros", "matplotlib.pyplot.figure", "matplotlib.pyplot.savefig" ]
[((162, 190), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (172, 190), True, 'from matplotlib import pyplot as plt\n'), ((190, 207), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x', 'y'], {}), '(x, y)\n', (201, 207), True, 'from matplotlib import pyplot as plt\n'), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # basic import import os import os.path as op import sys import time sys.path.insert(0, op.join(op.dirname(__file__),'..','..')) # python libs import numpy as np import xarray as xr # custom libs from teslakit.project_site import PathControl from teslakit.extremes import...
[ "numpy.load", "os.path.dirname", "teslakit.extremes.FitGEV_KMA_Frechet", "teslakit.project_site.PathControl", "os.path.join" ]
[((408, 421), 'teslakit.project_site.PathControl', 'PathControl', ([], {}), '()\n', (419, 421), False, 'from teslakit.project_site import PathControl\n'), ((456, 515), 'os.path.join', 'op.join', (['p_tests', '"""ClimateEmulator"""', '"""gev_fit_kma_fretchet"""'], {}), "(p_tests, 'ClimateEmulator', 'gev_fit_kma_fretchet...
import os import sys import cv2 import time import caffe import numpy as np import config sys.path.append('../') from fast_mtcnn import fast_mtcnn from gen_landmark import expand_mtcnn_box, is_valid_facebox, extract_baidu_lm72 from baidu import call_baidu_api def create_net(model_dir, iter_num): model_path = os.pa...
[ "sys.path.append", "gen_landmark.extract_baidu_lm72", "fast_mtcnn.fast_mtcnn", "baidu.call_baidu_api", "gen_landmark.is_valid_facebox", "cv2.imwrite", "gen_landmark.expand_mtcnn_box", "time.sleep", "cv2.imread", "numpy.swapaxes", "caffe.Net", "os.path.join", "cv2.resize" ]
[((90, 112), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (105, 112), False, 'import sys\n'), ((315, 380), 'os.path.join', 'os.path.join', (['model_dir', "('landmark_iter_%d.caffemodel' % iter_num)"], {}), "(model_dir, 'landmark_iter_%d.caffemodel' % iter_num)\n", (327, 380), False, 'import o...
import numpy import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import r2_score x = [1,2,3,4] x=numpy.array(x) print(x.shape) x=x.reshape(2,-1) print(x.shape) print(x) x=x.reshape(-1) print(x.shape) print(x) y = [2,4,6,8] #x*2=[2,4,6,8] #x*x=[1,4,9,16] #sum(x) = 10 pf=numpy.polyfit(x,y,3) print...
[ "numpy.poly1d", "numpy.array", "numpy.polyfit" ]
[((119, 133), 'numpy.array', 'numpy.array', (['x'], {}), '(x)\n', (130, 133), False, 'import numpy\n'), ((294, 316), 'numpy.polyfit', 'numpy.polyfit', (['x', 'y', '(3)'], {}), '(x, y, 3)\n', (307, 316), False, 'import numpy\n'), ((349, 365), 'numpy.poly1d', 'numpy.poly1d', (['pf'], {}), '(pf)\n', (361, 365), False, 'im...
import numpy as np import tensorflow as tf import random import _pickle as pkl import matplotlib.pyplot as plt from pylab import rcParams import scipy import scipy.stats as stats from tensorflow.python.ops import gen_nn_ops config_gpu = tf.ConfigProto() config_gpu.gpu_options.allow_growth = True MEAN_IMAGE = np.zeros(...
[ "tensorflow.reduce_sum", "numpy.abs", "tensorflow.keras.losses.MSE", "numpy.argmax", "numpy.clip", "tensorflow.ConfigProto", "numpy.mean", "numpy.arange", "numpy.linalg.norm", "numpy.random.normal", "_pickle.load", "numpy.zeros_like", "tensorflow.nn.top_k", "tensorflow.placeholder", "num...
[((237, 253), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (251, 253), True, 'import tensorflow as tf\n'), ((598, 626), 'numpy.zeros', 'np.zeros', (['(100, 227, 227, 3)'], {}), '((100, 227, 227, 3))\n', (606, 626), True, 'import numpy as np\n'), ((635, 648), 'numpy.zeros', 'np.zeros', (['(100)'], {}), ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 21 15:05:24 2018 @author: Hendry """ from read_data import * from TokenizeSentences import * import numpy as np def onehot(data,nClass): data2 = np.zeros([len(data),nClass]) for i in range(nClass): data2[np.where(data==i),i]= 1 return data2 ...
[ "numpy.argwhere", "numpy.where", "numpy.array", "numpy.unique" ]
[((2079, 2103), 'numpy.array', 'np.array', (['trainTitleDocs'], {}), '(trainTitleDocs)\n', (2087, 2103), True, 'import numpy as np\n'), ((2117, 2136), 'numpy.array', 'np.array', (['trainDocs'], {}), '(trainDocs)\n', (2125, 2136), True, 'import numpy as np\n'), ((2151, 2171), 'numpy.array', 'np.array', (['trainTitle'], ...
#!/usr/bin/env python # # Author: <NAME>. # Created: Dec 11, 2014. """Some utility functions to handle images.""" import math import numpy as np import PIL.Image from PIL.Image import ROTATE_180, ROTATE_90, ROTATE_270, FLIP_TOP_BOTTOM, FLIP_LEFT_RIGHT import skimage.transform def imcast(img, dtype, color_space="defa...
[ "math.sqrt", "numpy.empty", "numpy.asarray", "numpy.zeros", "numpy.array" ]
[((7824, 7872), 'numpy.empty', 'np.empty', (['mosaic_image_shape'], {'dtype': 'mosaic_dtype'}), '(mosaic_image_shape, dtype=mosaic_dtype)\n', (7832, 7872), True, 'import numpy as np\n'), ((4631, 4644), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (4639, 4644), True, 'import numpy as np\n'), ((7259, 7281), 'nump...
# -*- coding:utf-8 -*- import os import sys import numpy as np from simulater import Simulater from play_back import PlayBack, PlayBacks COMMAND = ['UP', 'DOWN', 'LEFT', 'RIGHT'] def get_max_command(target_dict): return max([(v,k) for k,v in target_dict.items()])[1] def simplify(command): return command[...
[ "numpy.random.uniform", "simulater.Simulater", "play_back.PlayBacks", "numpy.random.normal", "numpy.random.choice", "play_back.PlayBack" ]
[((768, 788), 'simulater.Simulater', 'Simulater', (['file_name'], {}), '(file_name)\n', (777, 788), False, 'from simulater import Simulater\n'), ((1127, 1138), 'play_back.PlayBacks', 'PlayBacks', ([], {}), '()\n', (1136, 1138), False, 'from play_back import PlayBack, PlayBacks\n'), ((929, 947), 'numpy.random.normal', '...
from numpy.linalg import cholesky import numpy as np def senti2cate(x): if x<=-0.6: return 0 elif x>-0.6 and x<=-0.2: return 1 elif x>-0.2 and x<0.2: return 2 elif x>=0.2 and x<0.6: return 3 elif x>=0.6: return 4 def dcg_score(y_true, y_score,...
[ "numpy.random.uniform", "numpy.sum", "numpy.zeros", "numpy.argsort", "numpy.mean", "numpy.array", "numpy.take", "numpy.random.multivariate_normal", "numpy.reshape", "numpy.cov", "numpy.repeat" ]
[((379, 405), 'numpy.take', 'np.take', (['y_true', 'order[:k]'], {}), '(y_true, order[:k])\n', (386, 405), True, 'import numpy as np\n'), ((497, 522), 'numpy.sum', 'np.sum', (['(gains / discounts)'], {}), '(gains / discounts)\n', (503, 522), True, 'import numpy as np\n'), ((757, 779), 'numpy.take', 'np.take', (['y_true...
import numpy as np import re lineRegex = re.compile(r"(turn on|turn off|toggle) (\d+),(\d+) through (\d+),(\d+)") def day6(fileName): lights = np.zeros((1000, 1000), dtype=bool) with open(fileName) as infile: for line in infile: match = lineRegex.match(line) if match: for x in range(int(match[2]), int(m...
[ "numpy.zeros", "re.compile" ]
[((42, 117), 're.compile', 're.compile', (['"""(turn on|turn off|toggle) (\\\\d+),(\\\\d+) through (\\\\d+),(\\\\d+)"""'], {}), "('(turn on|turn off|toggle) (\\\\d+),(\\\\d+) through (\\\\d+),(\\\\d+)')\n", (52, 117), False, 'import re\n'), ((146, 180), 'numpy.zeros', 'np.zeros', (['(1000, 1000)'], {'dtype': 'bool'}), ...
import numpy as np import tensorflow as tf def discretize(value,action_dim,n_outputs): discretization = tf.round(value) discretization = tf.minimum(tf.constant(n_outputs-1, dtype=tf.float32,shape=[1,action_dim]), tf.maximum(tf.constant(0, dtype=tf.float32,shape=[1,action_dim]), tf....
[ "tensorflow.Session", "tensorflow.constant", "tensorflow.round", "tensorflow.to_int32", "numpy.array", "tensorflow.to_float" ]
[((113, 128), 'tensorflow.round', 'tf.round', (['value'], {}), '(value)\n', (121, 128), True, 'import tensorflow as tf\n'), ((359, 386), 'tensorflow.to_int32', 'tf.to_int32', (['discretization'], {}), '(discretization)\n', (370, 386), True, 'import tensorflow as tf\n'), ((426, 484), 'numpy.array', 'np.array', (['(0, 0....
import numpy as np from scipy.interpolate import RegularGridInterpolator from scipy.ndimage.filters import gaussian_filter """ Elastic deformation of images as described in <NAME>, "Best Practices for Convolutional Neural Networks applied to Visual Document Analysis", in Proc. of the International Conference on D...
[ "numpy.random.rand", "scipy.interpolate.RegularGridInterpolator", "numpy.arange", "numpy.reshape" ]
[((1499, 1599), 'scipy.interpolate.RegularGridInterpolator', 'RegularGridInterpolator', (['coords', 'img_numpy'], {'method': 'method', 'bounds_error': '(False)', 'fill_value': 'c_val'}), '(coords, img_numpy, method=method, bounds_error=\n False, fill_value=c_val)\n', (1522, 1599), False, 'from scipy.interpolate impo...
# Copyright 2020 The TensorFlow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "numpy.sum", "numpy.maximum", "tensorflow.compat.v1.reduce_mean", "tensorflow.compat.v1.transpose", "tensorflow.compat.v1.matmul", "tensorflow.compat.v1.gather", "tensorflow.compat.v1.disable_eager_execution", "os.path.join", "numpy.pad", "tensorflow.compat.v1.square", "tensorflow.compat.v1.sque...
[((980, 1008), 'tensorflow.compat.v1.disable_eager_execution', 'tf.disable_eager_execution', ([], {}), '()\n', (1006, 1008), True, 'import tensorflow.compat.v1 as tf\n'), ((4902, 4929), 'tensorflow_graphics.projects.cvxnet.lib.libmise.mise.MISE', 'mise.MISE', (['(32)', '(3)', 'level_set'], {}), '(32, 3, level_set)\n', ...
import keras import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.datasets import mnist x_train = None y_train = None x_test = None y_test = None def init(): global x_train, y_train, x_test, y_test (x_train_tmp, y_train_tmp), (x_test_tmp, y_test_tmp) = mnist.load_d...
[ "keras.datasets.mnist.load_data", "numpy.zeros", "time.time", "keras.layers.Dense", "keras.models.Sequential" ]
[((308, 325), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (323, 325), False, 'from keras.datasets import mnist\n'), ((490, 516), 'numpy.zeros', 'np.zeros', (['(train_size, 10)'], {}), '((train_size, 10))\n', (498, 516), True, 'import numpy as np\n'), ((601, 626), 'numpy.zeros', 'np.zeros', ([...
from __future__ import print_function import sys, h5py as h5, numpy as np, yt, csv from time import time, sleep from PreFRBLE.file_system import * from PreFRBLE.parameter import * from time import time def TimeElapsed( func, *args, **kwargs ): """ measure time taken to compute function """ def MeasureTime(): ...
[ "os.open", "h5py.File", "csv.reader", "os.unlink", "fcntl.flock", "time.sleep", "time.time", "numpy.where", "numpy.array", "os.close", "sys.exit" ]
[((3834, 3865), 'numpy.array', 'np.array', (['FRBs'], {'dtype': 'FRB_dtype'}), '(FRBs, dtype=FRB_dtype)\n', (3842, 3865), True, 'import sys, h5py as h5, numpy as np, yt, csv\n'), ((333, 339), 'time.time', 'time', ([], {}), '()\n', (337, 339), False, 'from time import time\n'), ((735, 784), 'sys.exit', 'sys.exit', (['""...
#!/usr/bin/env python """SequenceMotifDecomposer is a motif finder algorithm. @author: <NAME> @email: <EMAIL> """ import logging import multiprocessing as mp import os from collections import defaultdict from eden import apply_async import numpy as np from scipy.sparse import vstack from eden.util.iterated_maximum_s...
[ "pylab.close", "sklearn.cluster.MiniBatchKMeans", "weblogolib.jpeg_formatter", "Bio.Seq.Seq", "Bio.SeqIO.write", "numpy.nan_to_num", "weblogolib.eps_formatter", "random.sample", "scipy.cluster.hierarchy.linkage", "joblib.dump", "eden.apply_async", "sklearn.metrics.classification_report", "co...
[((1145, 1172), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1162, 1172), False, 'import logging\n'), ((2325, 2335), 'numpy.sort', 'np.sort', (['x'], {}), '(x)\n', (2332, 2335), True, 'import numpy as np\n'), ((3092, 3110), 'numpy.vstack', 'np.vstack', (['cluster'], {}), '(cluster)\n',...
import yaml import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import os import torch import torchvision import matplotlib.pyplot as plt import seaborn as sns import torch.nn as nn from torch.utils.data import Dataset, DataLoader import torchvision.tr...
[ "yaml.safe_load", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "torch.utils.data.DataLoader", "torchvision.transforms.RandomRotation", "torch.load", "torch.exp", "torchvision.transforms.CenterCrop", "torchvision.transforms.RandomHorizontalFlip", "math.sqrt", "torch.cuda...
[((596, 626), 'os.path.join', 'os.path.join', (['data_dir', '"""test"""'], {}), "(data_dir, 'test')\n", (608, 626), False, 'import os\n'), ((876, 898), 'yaml.safe_load', 'yaml.safe_load', (['stream'], {}), '(stream)\n', (890, 898), False, 'import yaml\n'), ((1167, 1242), 'torchvision.transforms.Normalize', 'transforms....
import more_itertools as mit import numpy as np # Methods to do dynamic error thresholding on timeseries data # Implementation inspired by: https://arxiv.org/pdf/1802.04431.pdf def get_forecast_errors(y_hat, y_true, window_size=5, batch_size=30,...
[ "numpy.std", "more_itertools.consecutive_groups", "numpy.percentile", "numpy.mean", "numpy.arange" ]
[((4460, 4484), 'numpy.mean', 'np.mean', (['smoothed_errors'], {}), '(smoothed_errors)\n', (4467, 4484), True, 'import numpy as np\n'), ((4497, 4520), 'numpy.std', 'np.std', (['smoothed_errors'], {}), '(smoothed_errors)\n', (4503, 4520), True, 'import numpy as np\n'), ((4884, 4913), 'numpy.arange', 'np.arange', (['(2.5...
# -*- coding: utf-8 -*- """ Created on Thu Nov 7 21:27:18 2019 @author: biyef """ from PIL import Image, ImageFilter import tensorflow as tf import matplotlib.pyplot as plt import mnist_lenet5_backward import mnist_lenet5_forward import numpy as np def imageprepare(): im = Image.open('D:/workspace/machine-learn...
[ "matplotlib.pyplot.show", "tensorflow.train.Saver", "tensorflow.global_variables_initializer", "matplotlib.pyplot.imshow", "tensorflow.argmax", "tensorflow.Session", "PIL.Image.open", "mnist_lenet5_forward.forward", "tensorflow.placeholder", "numpy.reshape", "tensorflow.Graph", "tensorflow.tra...
[((282, 348), 'PIL.Image.open', 'Image.open', (['"""D:/workspace/machine-learning/mnist/img/origin-9.png"""'], {}), "('D:/workspace/machine-learning/mnist/img/origin-9.png')\n", (292, 348), False, 'from PIL import Image, ImageFilter\n'), ((353, 367), 'matplotlib.pyplot.imshow', 'plt.imshow', (['im'], {}), '(im)\n', (36...
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import jsonlines import torch import random import numpy as np import _pickle as cPickle class Flickr30kRetrievalDatabase(torch.utils.data.Da...
[ "_pickle.load", "numpy.load", "jsonlines.open", "random.choice" ]
[((902, 927), 'jsonlines.open', 'jsonlines.open', (['imdb_path'], {}), '(imdb_path)\n', (916, 927), False, 'import jsonlines\n'), ((2703, 2736), 'random.choice', 'random.choice', (['self.image_id_list'], {}), '(self.image_id_list)\n', (2716, 2736), False, 'import random\n'), ((2827, 2867), 'random.choice', 'random.choi...
""" Script for generating a reversed dictionary """ import argparse import numpy as np import sys def parse_arguments(args_to_parse): description = "Load a *.npy archive of a dictionary and swap (reverse) the dictionary keys and values around" parser = argparse.ArgumentParser(description=description) gen...
[ "numpy.load", "numpy.save", "argparse.ArgumentParser" ]
[((264, 312), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (287, 312), False, 'import argparse\n'), ((877, 920), 'numpy.save', 'np.save', (['args.output_file', 'reversed_wordvec'], {}), '(args.output_file, reversed_wordvec)\n', (884, 920), Tr...
import numpy as np import cv2 import glob import sys sys.path.append("../") import calipy Rt_path = "./CameraData/Rt.json" TVRt_path = "./Cameradata/TVRt.json" Rt_back_to_front = calipy.Transform(Rt_path).inv() Rt_TV_to_back = calipy.Transform(TVRt_path) Rt_TV_to_front = Rt_back_to_front.dot(Rt_TV_to_back) #origin ...
[ "sys.path.append", "numpy.transpose", "calipy.Transform", "calipy.vtkRenderer", "numpy.array" ]
[((53, 75), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (68, 75), False, 'import sys\n'), ((229, 256), 'calipy.Transform', 'calipy.Transform', (['TVRt_path'], {}), '(TVRt_path)\n', (245, 256), False, 'import calipy\n'), ((950, 968), 'calipy.Transform', 'calipy.Transform', ([], {}), '()\n', (...
from .generator_traj import generate_traj, EmptyError from .motion_type import random_rot from ..features.prePostTools import traj_to_dist import numpy as np def generate_n_steps(N, nstep, ndim, sub=False, noise_level=0.25): add = 0 if ndim == 3: add = 1 size = nstep X_train = np.zeros((N, ...
[ "numpy.sum", "numpy.zeros", "numpy.random.random", "numpy.array", "numpy.random.normal", "numpy.random.rand", "numpy.concatenate" ]
[((307, 335), 'numpy.zeros', 'np.zeros', (['(N, size, 5 + add)'], {}), '((N, size, 5 + add))\n', (315, 335), True, 'import numpy as np\n'), ((370, 393), 'numpy.zeros', 'np.zeros', (['(N, size, 10)'], {}), '((N, size, 10))\n', (378, 393), True, 'import numpy as np\n'), ((416, 433), 'numpy.zeros', 'np.zeros', (['(N, 27)'...
import numpy as np, networkx as nx, math from scipy.sparse.csgraph import dijkstra from scipy.sparse import csr_matrix, identity def make_Zs(Y,ind1,ind0,pscores1,pscores0,subsample=False): """Generates vector of Z_i's, used to construct HT estimator. Parameters ---------- Y : numpy float array ...
[ "math.sqrt", "numpy.ix_", "numpy.ones", "networkx.connected_components", "scipy.sparse.csgraph.dijkstra", "numpy.sqrt" ]
[((1433, 1460), 'numpy.ones', 'np.ones', (['Y.size'], {'dtype': 'bool'}), '(Y.size, dtype=bool)\n', (1440, 1460), True, 'import numpy as np, networkx as nx, math\n'), ((1789, 1804), 'numpy.ones', 'np.ones', (['Y.size'], {}), '(Y.size)\n', (1796, 1804), True, 'import numpy as np, networkx as nx, math\n'), ((3827, 3862),...
# THE FOLLOWING CODE CAN BE USED IN YOUR SAGEMAKER NOTEBOOK TO TEST AN UPLOADED IMAGE TO YOUR S3 BUCKET AGAINST YOUR MODEL import os import urllib.request import boto3 from IPython.display import Image import cv2 import json import numpy as np # input the S3 bucket you are using for this project and the file path fo...
[ "boto3.client", "numpy.argmax", "cv2.imwrite", "cv2.imread", "IPython.display.Image" ]
[((567, 585), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (579, 585), False, 'import boto3\n'), ((712, 737), 'cv2.imread', 'cv2.imread', (['tmp_file_name'], {}), '(tmp_file_name)\n', (722, 737), False, 'import cv2\n'), ((925, 963), 'cv2.imwrite', 'cv2.imwrite', (['resized_file_name', 'newimg'], {}),...
import numpy as np from sklearn.metrics import accuracy_score from sklearn.metrics import precision_recall_curve from sklearn.metrics import auc from sklearn.metrics import matthews_corrcoef from sklearn.metrics import roc_auc_score from sklearn.metrics import roc_curve from sklearn.metrics import classification_repor...
[ "numpy.sum", "scripts.visualization.plot_roc_curve", "sklearn.metrics.roc_curve", "numpy.argmax", "scripts.visualization.plot_confusion_matrix", "sklearn.metrics.classification_report", "sklearn.metrics.roc_auc_score", "sklearn.metrics.precision_recall_curve", "sklearn.metrics.auc", "sklearn.metri...
[((1023, 1040), 'numpy.argmax', 'np.argmax', (['fscore'], {}), '(fscore)\n', (1032, 1040), True, 'import numpy as np\n'), ((1546, 1569), 'numpy.arange', 'np.arange', (['(0)', '(1)', '(0.0001)'], {}), '(0, 1, 0.0001)\n', (1555, 1569), True, 'import numpy as np\n'), ((1746, 1763), 'numpy.argmax', 'np.argmax', (['scores']...
##################################################################################################################### ##################################################################################################################### # See how TROPOMI NO2 responds to the Suez Canal blockage # When downloading the ...
[ "pandas.read_csv", "geoviews.extension", "matplotlib.pyplot.figure", "numpy.arange", "glob.glob", "geoviews.renderer", "numpy.round", "os.chdir", "pandas.DataFrame", "matplotlib.pyplot.close", "pandas.merge", "matplotlib.pyplot.rcParams.update", "datetime.timedelta", "geopandas.read_file",...
[((1696, 1819), 'os.chdir', 'os.chdir', (['"""/rds/projects/2018/maraisea-glu-01/Study/Research_Data/TROPOMI/project_2_Suez_Canal/Oversample_output"""'], {}), "(\n '/rds/projects/2018/maraisea-glu-01/Study/Research_Data/TROPOMI/project_2_Suez_Canal/Oversample_output'\n )\n", (1704, 1819), False, 'import os\n'), (...
import torch import torchvision import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.distributions as dists import numpy as np import scipy.io import foolbox import input_data import argparse from tqdm import tqdm import data_loader import math import os import tensorflow as t...
[ "numpy.random.seed", "argparse.ArgumentParser", "data_loader.load_dataset", "numpy.nan_to_num", "numpy.argmax", "torch.sqrt", "torch.nn.init.uniform_", "cleverhans.attacks.FastGradientMethod", "torch.nn.functional.dropout", "torch.randn", "tensorflow.ConfigProto", "numpy.arange", "cleverhans...
[((542, 567), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (565, 567), False, 'import argparse\n'), ((1379, 1408), 'numpy.random.seed', 'np.random.seed', (['args.randseed'], {}), '(args.randseed)\n', (1393, 1408), True, 'import numpy as np\n'), ((1409, 1441), 'torch.manual_seed', 'torch.manua...
""" From http://arxiv.org/pdf/1204.0375.pdf """ from numpy import dot, sum, tile, linalg from numpy.linalg import inv def kf_predict(X, P, A, Q, B, U): """ X: The mean state estimate of the previous step (k−1). P: The state covariance of previous step (k−1). A: The transition n × n matrix. Q: The ...
[ "numpy.dot", "numpy.linalg.inv" ]
[((811, 820), 'numpy.dot', 'dot', (['H', 'X'], {}), '(H, X)\n', (814, 820), False, 'from numpy import dot, sum, tile, linalg\n'), ((427, 436), 'numpy.dot', 'dot', (['A', 'X'], {}), '(A, X)\n', (430, 436), False, 'from numpy import dot, sum, tile, linalg\n'), ((439, 448), 'numpy.dot', 'dot', (['B', 'U'], {}), '(B, U)\n'...
import numpy as np def LoadData(FileName): ''' Loads hollow data into structured numpy array of floats and returns a tuple of column headers along with the structured array. ''' data = np.genfromtxt(FileName, names=True, delimiter=',') return data.dtype.names, data def SegmentDataByAspect(F...
[ "numpy.genfromtxt" ]
[((208, 258), 'numpy.genfromtxt', 'np.genfromtxt', (['FileName'], {'names': '(True)', 'delimiter': '""","""'}), "(FileName, names=True, delimiter=',')\n", (221, 258), True, 'import numpy as np\n')]
import os from os.path import join import cv2 import pickle import torch import numpy as np import pandas as pd import torch.utils.data as data class InteriorNet(data.Dataset): def __init__(self, root_dir, label_name='_raycastingV2', pred_dir='pred', method_name='sharpnet_pred', ...
[ "numpy.load", "torch.utils.data.DataLoader", "numpy.ascontiguousarray", "os.path.exists", "cv2.imread", "pickle.load", "os.path.join", "sys.exit" ]
[((3710, 3758), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': '(4)', 'shuffle': '(False)'}), '(dataset, batch_size=4, shuffle=False)\n', (3720, 3758), False, 'from torch.utils.data import DataLoader\n'), ((3400, 3419), 'numpy.load', 'np.load', (['label_path'], {}), '(label_path)\n', (3407, 3...
# -*- coding: utf-8 -*- """ Created on Wed Aug 29 15:47:36 2018 @author: akurnizk """ import flopy import numpy as np import sys,os import matplotlib.pyplot as plt # Location of BitBucket folder containing cgw folder cgw_code_dir = 'E:\python' sys.path.insert(0,cgw_code_dir) from cgw.utils import ge...
[ "flopy.modflow.ModflowOc", "numpy.amin", "cgw.utils.raster_utils.subsection_griddata", "numpy.empty", "numpy.ones", "numpy.isnan", "cgw.utils.general_utils.quick_plot", "matplotlib.pyplot.figure", "matplotlib.pyplot.contour", "cgw.utils.feature_utils.nodes_to_cc", "os.path.join", "numpy.meshgr...
[((261, 293), 'sys.path.insert', 'sys.path.insert', (['(0)', 'cgw_code_dir'], {}), '(0, cgw_code_dir)\n', (276, 293), False, 'import sys, os\n'), ((537, 607), 'flopy.modflow.Modflow', 'flopy.modflow.Modflow', (['modelname'], {'exe_name': '"""mf2005"""', 'model_ws': 'work_dir'}), "(modelname, exe_name='mf2005', model_ws...
# Functions of img processing. from functools import total_ordering import config import numpy as np import copy import torch import cv2 from skimage.color import rgb2gray from XCSLBP import XCSLBP def extractPixelBlock(originalImg, labels): ''' input_param: originalImg: Original pixels matrix that sq...
[ "torch.eq", "copy.deepcopy", "numpy.meshgrid", "skimage.color.rgb2gray", "numpy.arctan2", "numpy.append", "numpy.array", "numpy.sqrt", "cv2.Sobel", "torch.tensor", "XCSLBP.XCSLBP" ]
[((637, 658), 'copy.deepcopy', 'copy.deepcopy', (['labels'], {}), '(labels)\n', (650, 658), False, 'import copy\n'), ((766, 791), 'numpy.array', 'np.array', (['[255, 255, 255]'], {}), '([255, 255, 255])\n', (774, 791), True, 'import numpy as np\n'), ((2226, 2247), 'numpy.array', 'np.array', (['featureList'], {}), '(fea...
#fuzzytest.py #<NAME> #<NAME> #fuzzy clustering for testFun.dat from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt import skfuzzy as fuzz colors = ['b', 'orange', 'g', 'r', 'c', 'm', 'y', 'k', 'Brown', 'ForestGreen'] # Insert his test data instead !!!! # Then our data ...
[ "matplotlib.pyplot.show", "numpy.argmax", "numpy.zeros", "skfuzzy.cluster.cmeans", "numpy.array", "matplotlib.pyplot.subplots", "numpy.vstack" ]
[((430, 441), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (438, 441), True, 'import numpy as np\n'), ((446, 470), 'numpy.zeros', 'np.zeros', ([], {'shape': '(200, 2)'}), '(shape=(200, 2))\n', (454, 470), True, 'import numpy as np\n'), ((925, 939), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (93...
from sklearn.neighbors import NearestNeighbors import Sv import logging import pandas as pd import numpy as np import functools import os import math logger = logging.getLogger('marin') logger.setLevel(logging.DEBUG) def point_processing(tracks_data): """ input: tracking data matrix ouput: column of dist...
[ "numpy.sum", "math.atan2", "pandas.read_csv", "numpy.mean", "numpy.linalg.norm", "numpy.std", "pandas.merge", "numpy.transpose", "os.path.exists", "sklearn.neighbors.NearestNeighbors", "math.cos", "numpy.log10", "pandas.concat", "math.sqrt", "os.path.basename", "os.path.getsize", "fu...
[((160, 186), 'logging.getLogger', 'logging.getLogger', (['"""marin"""'], {}), "('marin')\n", (177, 186), False, 'import logging\n'), ((705, 759), 'numpy.vstack', 'np.vstack', (['[tracks.lat_m, tracks.long_m, tracks.z_gps]'], {}), '([tracks.lat_m, tracks.long_m, tracks.z_gps])\n', (714, 759), True, 'import numpy as np\...
# This is sample baseline for CIKM Personalization Cup 2016 # by <NAME> & <NAME> import numpy as np import pandas as pd import datetime start_time = datetime.datetime.now() print("Running baseline. Now it's", start_time.isoformat()) # Loading queries (assuming data placed in <dataset-train/> queries = pd.read_csv('d...
[ "pandas.read_csv", "datetime.datetime.now", "numpy.array" ]
[((151, 174), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (172, 174), False, 'import datetime\n'), ((2686, 2709), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2707, 2709), False, 'import datetime\n'), ((306, 361), 'pandas.read_csv', 'pd.read_csv', (['"""dataset-train/trai...
# python import warnings # Third party imports import numpy as np # grAdapt from .base import Initial from grAdapt.utils.sampling import sample_corner_bounds class VerticesForceRandom(Initial): """ Samples all vertices if n_evals >= 2 ** len(bounds). Else, a subset of vertices is sampled. """ d...
[ "numpy.log2", "numpy.hstack", "grAdapt.utils.sampling.sample_corner_bounds", "numpy.tile", "numpy.vstack" ]
[((1438, 1481), 'grAdapt.utils.sampling.sample_corner_bounds', 'sample_corner_bounds', (['self.bounds[:d_tilde]'], {}), '(self.bounds[:d_tilde])\n', (1458, 1481), False, 'from grAdapt.utils.sampling import sample_corner_bounds\n'), ((2071, 2105), 'numpy.tile', 'np.tile', (['fix_corners', '(n_tilde, 1)'], {}), '(fix_cor...
import numpy as np import pickle class onehot: def __init__(self, sentences): self.__sentences = sentences self.__data = {} self.__count = {} self.__build() def __build(self): self.__word_num = 1 for sentence in self.__sentences: for word ...
[ "numpy.zeros" ]
[((748, 782), 'numpy.zeros', 'np.zeros', (['(self.__word_num - 1, 1)'], {}), '((self.__word_num - 1, 1))\n', (756, 782), True, 'import numpy as np\n')]
import torch import torch.nn.functional as F import gym import gym.spaces import numpy as np def autocrop_observations(observations, cell_size, output_size=None): shape = observations.size()[3:] if output_size is None: new_shape = tuple(map(lambda x: (x // cell_size) * cell_size, shape)) else: ...
[ "torch.gather", "torch.nn.functional.avg_pool2d", "torch.nn.functional.mse_loss", "numpy.zeros", "torch.nn.functional.binary_cross_entropy_with_logits", "numpy.clip", "gym.spaces.Box", "torch.no_grad" ]
[((2582, 2631), 'torch.gather', 'torch.gather', (['action_values[:, :-1]', '(2)', 'q_actions'], {}), '(action_values[:, :-1], 2, q_actions)\n', (2594, 2631), False, 'import torch\n'), ((2644, 2681), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['pseudo_rewards', 'q_actions'], {}), '(pseudo_rewards, q_actions)\n', (26...
import numpy as np from scipy.spatial.transform import Rotation import numpy as np import pybullet as p def todegree(w): return w*180/np.pi def torad(w): return w*np.pi/180 def angle(v1, v2): v1_u = unit_vector(v1) v2_u = unit_vector(v2) return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))...
[ "numpy.abs", "numpy.dot", "numpy.asarray", "pybullet.getMatrixFromQuaternion", "numpy.cross", "numpy.zeros", "numpy.sign", "numpy.sin", "numpy.array", "numpy.linalg.norm", "numpy.cos", "numpy.matmul", "scipy.spatial.transform.Rotation.from_matrix", "numpy.eye", "scipy.spatial.transform.R...
[((583, 594), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (591, 594), True, 'import numpy as np\n'), ((605, 614), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (611, 614), True, 'import numpy as np\n'), ((792, 805), 'numpy.array', 'np.array', (['vec'], {}), '(vec)\n', (800, 805), True, 'import numpy as np\n'), ...
from collections.abc import Iterable import numpy as np import pandas as pd import param import xarray as xr from matplotlib.colors import LinearSegmentedColormap, rgb2hex from .configuration import DEFAULTS, EASES, INTERPS, PRECEDENCES, REVERTS from .util import is_str class Easing(param.Parameterized): inter...
[ "numpy.isnan", "numpy.sin", "numpy.arange", "numpy.tile", "matplotlib.colors.rgb2hex", "param.Integer", "numpy.full", "matplotlib.colors.LinearSegmentedColormap.from_list", "numpy.power", "param.edit_constant", "numpy.linspace", "numpy.repeat", "numpy.ceil", "numpy.roll", "numpy.hstack",...
[((324, 453), 'param.ClassSelector', 'param.ClassSelector', ([], {'default': 'None', 'class_': 'Iterable', 'doc': 'f"""Interpolation method; {INTERPS}"""', 'precedence': "PRECEDENCES['interp']"}), "(default=None, class_=Iterable, doc=\n f'Interpolation method; {INTERPS}', precedence=PRECEDENCES['interp'])\n", (343, ...
from mmdnn.conversion.rewriter.rewriter import UnitRewriterBase import numpy as np import re class LSTMRewriter(UnitRewriterBase): def __init__(self, graph, weights_dict): return super(LSTMRewriter, self).__init__(graph, weights_dict) def process_lstm_cell(self, match_result): if 'lstm_cell...
[ "re.sub", "numpy.split" ]
[((666, 695), 'numpy.split', 'np.split', (['w', '[-1 * num_units]'], {}), '(w, [-1 * num_units])\n', (674, 695), True, 'import numpy as np\n'), ((2259, 2302), 're.sub', 're.sub', (['"""(_\\\\d+)*$"""', '""""""', 'op_name_splits[-2]'], {}), "('(_\\\\d+)*$', '', op_name_splits[-2])\n", (2265, 2302), False, 'import re\n')...
from spefit.pdf.base import PDFParameter, PDF from spefit.common.stats import normal_pdf import numpy as np from numpy.testing import assert_allclose import pytest def test_pdf_parameter(): initial = 1 limits = (0, 4) fixed = True multi = True param = PDFParameter(initial=initial, limits=limits, ...
[ "spefit.pdf.base.PDF.__subclasses__", "numpy.trapz", "spefit.pdf.base.PDF", "spefit.pdf.base.PDF._prepare_parameters", "spefit.pdf.base.PDFParameter", "spefit.pdf.base.PDF.from_name", "pytest.raises", "numpy.array", "numpy.exp", "numpy.linspace", "numpy.array_equal" ]
[((275, 345), 'spefit.pdf.base.PDFParameter', 'PDFParameter', ([], {'initial': 'initial', 'limits': 'limits', 'fixed': 'fixed', 'multi': 'multi'}), '(initial=initial, limits=limits, fixed=fixed, multi=multi)\n', (287, 345), False, 'from spefit.pdf.base import PDFParameter, PDF\n'), ((493, 537), 'spefit.pdf.base.PDFPara...
# Copyright 2020 Alibaba Group Holding Limited. 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 ...
[ "numpy.asarray", "tf_euler.python.euler_ops.type_ops.get_edge_type_id", "tf_euler.python.euler_ops.base.nebula_client.execute_query", "tensorflow.py_func" ]
[((1686, 1801), 'tensorflow.py_func', 'tf.py_func', (['_nebula_random_walk', '[nodes, edge_types, p, q, default_node]', '[tf.int64]', '(True)', '"""NebulaRandomWalk"""'], {}), "(_nebula_random_walk, [nodes, edge_types, p, q, default_node], [\n tf.int64], True, 'NebulaRandomWalk')\n", (1696, 1801), True, 'import tens...
import numpy as np from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch from torch.autograd import Variable from load_memmap import * class AxonDataset(Dataset): """" Inherits pytorch Dataset class to load Axon Dataset """ def __init__(self, data_name='crops64...
[ "numpy.load", "torch.autograd.Variable", "numpy.zeros", "numpy.expand_dims", "numpy.nonzero", "numpy.max", "torch.Tensor", "numpy.array", "numpy.arange", "torch.cuda.is_available", "torch.max", "torch.min", "numpy.unique" ]
[((2945, 2972), 'torch.Tensor', 'torch.Tensor', (['sample_x_data'], {}), '(sample_x_data)\n', (2957, 2972), False, 'import torch\n'), ((2997, 3024), 'torch.Tensor', 'torch.Tensor', (['sample_y_data'], {}), '(sample_y_data)\n', (3009, 3024), False, 'import torch\n'), ((5674, 5701), 'torch.Tensor', 'torch.Tensor', (['sam...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for Truthcoin's consensus functions. Verifies that the consensus algorithm works as expected. Check test_answers.txt for expected results. """ from __future__ import division, unicode_literals, absolute_import import os import sys import platform import json impo...
[ "platform.python_version", "unittest.TextTestRunner", "os.path.realpath", "json.dumps", "numpy.isnan", "numpy.array", "unittest.TestLoader", "os.path.join", "consensus.Factory" ]
[((360, 385), 'platform.python_version', 'platform.python_version', ([], {}), '()\n', (383, 385), False, 'import platform\n'), ((484, 510), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (500, 510), False, 'import os\n'), ((531, 560), 'os.path.join', 'os.path.join', (['HERE', 'os.pardir'], ...
""" Comparing different kernels using cv2.filter2D() """ # Import required packages: import cv2 import numpy as np import matplotlib.pyplot as plt def show_with_matplotlib(color_img, title, pos): """Shows an image using matplotlib capabilities""" # Convert BGR image to RGB img_RGB = color_img[:, :, ::-1...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "cv2.filter2D", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.imshow", "matplotlib.pyplot.axis", "cv2.imread", "matplotlib.pyplot.figure", "numpy.array" ]
[((475, 502), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 6)'}), '(figsize=(12, 6))\n', (485, 502), True, 'import matplotlib.pyplot as plt\n'), ((503, 604), 'matplotlib.pyplot.suptitle', 'plt.suptitle', (['"""Comparing different kernels using cv2.filter2D()"""'], {'fontsize': '(14)', 'fontweight': ...
import os import re import sys import argparse import json import numpy as np from glob import glob import cv2 from utils.plot_utils import RandomColor def parse_args(): parser = argparse.ArgumentParser( description='Monocular 3D Tracking Visualizer', formatter_class=argpa...
[ "numpy.random.seed", "cv2.VideoWriter_fourcc", "argparse.ArgumentParser", "os.makedirs", "os.path.isdir", "utils.plot_utils.RandomColor", "cv2.imread", "os.path.isfile", "os.path.splitext", "cv2.VideoWriter", "os.listdir", "re.compile" ]
[((2253, 2284), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'mp4v'"], {}), "(*'mp4v')\n", (2275, 2284), False, 'import cv2\n'), ((2295, 2314), 'numpy.random.seed', 'np.random.seed', (['(777)'], {}), '(777)\n', (2309, 2314), True, 'import numpy as np\n'), ((2326, 2341), 'utils.plot_utils.RandomColor', 'Rando...
# -------------- #Importing header files import pandas as pd from sklearn.model_selection import train_test_split as tts # Code starts here data= pd.read_csv(path) X= data.drop(['customer.id','paid.back.loan'],1) y=data['paid.back.loan'] X_train, X_test, y_train, y_test = tts(X,y,random_state=0,test_size=0.3) # C...
[ "sklearn.model_selection.GridSearchCV", "matplotlib.pyplot.show", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "matplotlib.pyplot.axis", "sklearn.tree.DecisionTreeClassifier", "sklearn.tree.export_graphviz", "sklearn.preprocessing.LabelEncoder", ...
[((150, 167), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (161, 167), True, 'import pandas as pd\n'), ((279, 319), 'sklearn.model_selection.train_test_split', 'tts', (['X', 'y'], {'random_state': '(0)', 'test_size': '(0.3)'}), '(X, y, random_state=0, test_size=0.3)\n', (282, 319), True, 'from sklearn....
# -*- coding: utf-8 -*- # @Time : 19-11-19 22:25 # @Author : <NAME> # @Reference : None # @File : cut_twist_join.py # @IDE : PyCharm Community Edition """ 将身份证正反面从原始图片中切分出来。 需要的参数有: 1.图片所在路径。 输出结果为: 切分后的身份证正反面图片。 """ import os import cv2 import numpy ...
[ "cv2.getPerspectiveTransform", "cv2.adaptiveThreshold", "numpy.argsort", "cv2.boxPoints", "cv2.minAreaRect", "cv2.erode", "os.path.join", "cv2.contourArea", "cv2.subtract", "cv2.dilate", "cv2.cvtColor", "os.path.exists", "cv2.convertScaleAbs", "cv2.morphologyEx", "os.listdir", "cv2.Sob...
[((1470, 1507), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (1482, 1507), False, 'import cv2\n'), ((2259, 2312), 'cv2.Sobel', 'cv2.Sobel', (['img_blurred'], {'ddepth': 'cv2.CV_32F', 'dx': '(1)', 'dy': '(0)'}), '(img_blurred, ddepth=cv2.CV_32F, dx=1, dy=0)\n', (226...
#!/usr/bin/env python # coding: utf-8 # # Desafio 4 # # Neste desafio, vamos praticar um pouco sobre testes de hipóteses. Utilizaremos o _data set_ [2016 Olympics in Rio de Janeiro](https://www.kaggle.com/rio2016/olympic-games/), que contém dados sobre os atletas das Olimpíadas de 2016 no Rio de Janeiro. # # Esse _d...
[ "matplotlib.pyplot.show", "numpy.log", "numpy.random.seed", "scipy.stats.shapiro", "pandas.read_csv", "scipy.stats.normaltest", "scipy.stats.ttest_ind", "IPython.core.pylabtools.figsize", "seaborn.boxplot", "seaborn.distplot", "statsmodels.api.qqplot", "scipy.stats.t.sf", "scipy.stats.jarque...
[((944, 958), 'IPython.core.pylabtools.figsize', 'figsize', (['(12)', '(8)'], {}), '(12, 8)\n', (951, 958), False, 'from IPython.core.pylabtools import figsize\n'), ((960, 969), 'seaborn.set', 'sns.set', ([], {}), '()\n', (967, 969), True, 'import seaborn as sns\n'), ((994, 1021), 'pandas.read_csv', 'pd.read_csv', (['"...
import numpy as np from tensorflow import keras import pandas as pd import os class DcmDataGenerator(keras.utils.Sequence): """Generates data for Keras Sequence based data generator. Suitable for building data generator for training and prediction. """ def __init__(self, images_path, dim=(15, 512, 51...
[ "numpy.moveaxis", "numpy.load", "numpy.random.seed", "pandas.read_csv", "numpy.empty", "numpy.any", "numpy.array", "os.path.join", "os.listdir" ]
[((519, 542), 'os.listdir', 'os.listdir', (['images_path'], {}), '(images_path)\n', (529, 542), False, 'import os\n'), ((1054, 1074), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1068, 1074), True, 'import numpy as np\n'), ((1791, 1833), 'numpy.empty', 'np.empty', (['(1, *self.dim)'], {'dtype': '...
""" generate periodic boundary condition (PBC). Two methods to detect and partition the surface-nodes: 1. graph-method: (recommended, can deal with arbitrary deformed shape): use dictionary-data-structure to map facet-nodes to element-number, where the surface-facet is shared ...
[ "numpy.array" ]
[((9765, 9790), 'numpy.array', 'np.array', (['obj.nodes[node]'], {}), '(obj.nodes[node])\n', (9773, 9790), True, 'import numpy as np\n'), ((11978, 12003), 'numpy.array', 'np.array', (['obj.nodes[node]'], {}), '(obj.nodes[node])\n', (11986, 12003), True, 'import numpy as np\n')]
import numpy as np import torch from torchvision import datasets, transforms DEFAULT_DATA_DIR = "/is/rg/al/Projects/prob-models/data/" class ReconstructionDataset(torch.utils.data.Dataset): def __init__( self, name, split="train", flatten=True, train_split=0.8, data_dir=None ): assert split i...
[ "torch.stack", "numpy.random.RandomState", "torchvision.transforms.ToTensor" ]
[((1027, 1071), 'torch.stack', 'torch.stack', (['[x[0] for x in dataset]'], {'axis': '(0)'}), '([x[0] for x in dataset], axis=0)\n', (1038, 1071), False, 'import torch\n'), ((1201, 1226), 'numpy.random.RandomState', 'np.random.RandomState', (['(45)'], {}), '(45)\n', (1222, 1226), True, 'import numpy as np\n'), ((656, 6...
## l2_attack.py -- attack a network optimizing for l_2 distance ## ## Copyright (C) 2016, <NAME> <<EMAIL>>. ## ## This program is licenced under the BSD 2-Clause licence, ## contained in the LICENCE file in this directory. ## Modified by <NAME> 2017 import tensorflow as tf import numpy as np BINARY_SEARCH_STEPS = 9 ...
[ "numpy.arctanh", "tensorflow.reduce_sum", "tensorflow.add_n", "numpy.copy", "numpy.argmax", "tensorflow.maximum", "tensorflow.variables_initializer", "numpy.zeros", "numpy.ones", "tensorflow.placeholder", "tensorflow.global_variables", "numpy.array", "tensorflow.tanh", "numpy.dot", "tens...
[((3887, 3920), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', 'shape'], {}), '(tf.float32, shape)\n', (3901, 3920), True, 'import tensorflow as tf\n'), ((3948, 4000), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '(batch_size, num_labels)'], {}), '(tf.float32, (batch_size, num_labels))\n', (...
# -*- encoding:utf-8 -*- """ 买入择时示例因子:动态自适应双均线策略 """ from __future__ import absolute_import from __future__ import print_function from __future__ import division import math import numpy as np from .ABuFactorBuyBase import AbuFactorBuyXD, BuyCallMixin from ..IndicatorBu.ABuNDMa import calc_ma_from_prices from ....
[ "numpy.arange", "math.ceil" ]
[((4463, 4513), 'numpy.arange', 'np.arange', (['self.resample_min', 'self.resample_max', '(5)'], {}), '(self.resample_min, self.resample_max, 5)\n', (4472, 4513), True, 'import numpy as np\n'), ((2821, 2851), 'math.ceil', 'math.ceil', (['(self.ma_slow * 0.15)'], {}), '(self.ma_slow * 0.15)\n', (2830, 2851), False, 'imp...
import math import click import os.path import shutil import atoms_simulator import numpy import matplotlib.pyplot as plt def get_project_path(): return os.path.dirname(atoms_simulator.__file__) def get_path(path): i = 1 while True: if not os.path.lexists(f"{path}{i}"): return f"{pat...
[ "matplotlib.pyplot.title", "atoms_simulator.Settings", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "atoms_simulator.simulate", "click.option", "click.echo", "numpy.arange", "matplotlib.pyplot.ylabel", "click.group", "matplotlib.pyplot.grid", "shutil.copy", "matplotlib.pyplot.xlabel" ]
[((345, 358), 'click.group', 'click.group', ([], {}), '()\n', (356, 358), False, 'import click\n'), ((983, 1080), 'click.option', 'click.option', (['"""-g"""', '"""--graphics"""', '"""graphics"""'], {'help': '"""Turn on pygame simulation"""', 'is_flag': '(True)'}), "('-g', '--graphics', 'graphics', help=\n 'Turn on ...
import pandas as pd import numpy as np import torch def min_max_x(x): for index, col in enumerate(x.T): min_col = np.min(col) max_col = np.max(col) if min_col != max_col: x.T[index] = (x.T[index] - min_col)/(max_col - min_col) else: x.T[index] = x.T[index] - min_col return x def load_dataset(path='./...
[ "numpy.random.seed", "pandas.read_csv", "numpy.min", "numpy.max", "numpy.random.shuffle", "torch.from_numpy" ]
[((384, 404), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (398, 404), True, 'import numpy as np\n'), ((411, 428), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (422, 428), True, 'import pandas as pd\n'), ((118, 129), 'numpy.min', 'np.min', (['col'], {}), '(col)\n', (124, 129), Tru...
import hashlib import json import numpy as np from jina import Executor, DocumentArray, requests class TagsHasher(Executor): """Convert an arbitrary set of tags into a fixed-dimensional matrix using the hashing trick. Unlike FeatureHashser, you should only use Jaccard/Hamming distance when searching docume...
[ "numpy.zeros", "json.dumps", "numpy.sign" ]
[((2435, 2455), 'numpy.zeros', 'np.zeros', (['self.n_dim'], {}), '(self.n_dim)\n', (2443, 2455), True, 'import numpy as np\n'), ((2582, 2592), 'numpy.sign', 'np.sign', (['h'], {}), '(h)\n', (2589, 2592), True, 'import numpy as np\n'), ((2707, 2719), 'numpy.sign', 'np.sign', (['val'], {}), '(val)\n', (2714, 2719), True,...
"""A class with static methods which can be used to access the data about experiments. This includes reading logs to parse success cases, reading images, costs and speed. """ import numpy as np from glob import glob import torch import pandas import re import json from functools import lru_cache import imageio EPISO...
[ "json.load", "numpy.sum", "torch.stack", "numpy.argmax", "numpy.std", "imageio.imread", "torch.load", "numpy.zeros", "numpy.mean", "numpy.array", "glob.glob", "numpy.squeeze", "functools.lru_cache", "re.search", "re.compile" ]
[((494, 514), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (503, 514), False, 'from functools import lru_cache\n'), ((4233, 4255), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(100)'}), '(maxsize=100)\n', (4242, 4255), False, 'from functools import lru_cache\n'), ((13831, 1385...
# Copyright 2018-2020 Xanadu Quantum Technologies Inc. # 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...
[ "benchmark_utils.create_qnode", "numpy.random.randn", "pennylane.RX", "numpy.cos", "pennylane.PauliZ" ]
[((861, 889), 'pennylane.RX', 'qml.RX', (['p[aux][2]'], {'wires': '[0]'}), '(p[aux][2], wires=[0])\n', (867, 889), True, 'import pennylane as qml\n'), ((912, 925), 'pennylane.PauliZ', 'qml.PauliZ', (['(0)'], {}), '(0)\n', (922, 925), True, 'import pennylane as qml\n'), ((2281, 2348), 'benchmark_utils.create_qnode', 'bu...
import numpy as np a = np.array([1, 2, 3]) b = np.array([4, 5, 6]) dot_product = np.dot(a, b) print(dot_product)
[ "numpy.dot", "numpy.array" ]
[((24, 43), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (32, 43), True, 'import numpy as np\n'), ((48, 67), 'numpy.array', 'np.array', (['[4, 5, 6]'], {}), '([4, 5, 6])\n', (56, 67), True, 'import numpy as np\n'), ((83, 95), 'numpy.dot', 'np.dot', (['a', 'b'], {}), '(a, b)\n', (89, 95), True, 'impo...
from contextlib import ExitStack as DoesNotRaise from typing import Tuple, Optional import numpy as np import pytest from onemetric.cv.utils.iou import box_iou, mask_iou, box_iou_batch @pytest.mark.parametrize( "box_true, box_detection, expected_result, exception", [ (None, None, None, pytest.raises...
[ "numpy.testing.assert_array_equal", "numpy.zeros", "numpy.ones", "contextlib.ExitStack", "pytest.raises", "numpy.array", "onemetric.cv.utils.iou.mask_iou", "onemetric.cv.utils.iou.box_iou_batch", "onemetric.cv.utils.iou.box_iou" ]
[((1550, 1605), 'onemetric.cv.utils.iou.box_iou', 'box_iou', ([], {'box_true': 'box_true', 'box_detection': 'box_detection'}), '(box_true=box_true, box_detection=box_detection)\n', (1557, 1605), False, 'from onemetric.cv.utils.iou import box_iou, mask_iou, box_iou_batch\n'), ((3366, 3435), 'onemetric.cv.utils.iou.box_i...
""" @author: <NAME>,<NAME> """ import numpy as np import streamlit as st import pandas as pd import plotly.graph_objects as go import plotly.express as px st.title("Synapse Unsupervised Models") uploaded_file = st.file_uploader("Choose a csv file", type="csv") if uploaded_file is not None: data = pd.read_csv(...
[ "numpy.sum", "pandas.read_csv", "streamlit.title", "numpy.argmin", "streamlit.sidebar.selectbox", "numpy.linalg.svd", "numpy.mean", "pandas.DataFrame", "streamlit.subheader", "numpy.random.randn", "streamlit.sidebar.checkbox", "numpy.std", "streamlit.info", "numpy.reshape", "numpy.cov", ...
[((159, 198), 'streamlit.title', 'st.title', (['"""Synapse Unsupervised Models"""'], {}), "('Synapse Unsupervised Models')\n", (167, 198), True, 'import streamlit as st\n'), ((216, 265), 'streamlit.file_uploader', 'st.file_uploader', (['"""Choose a csv file"""'], {'type': '"""csv"""'}), "('Choose a csv file', type='csv...