code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# - coding: utf-8 -*-
# python 3.5
import numpy as np
import cv2
import os
import random
BKroot = "/home/shinpoi/dataset/backgrounds"
ITEMroot = "/home/shinpoi/dataset/humans/"
def histogram_matching(srcArr, dstArr, srcPNG=True):
src_HSV = cv2.cvtColor(srcArr, cv2.COLOR_RGB2HSV)
srcHist = cv2.ca... | [
"cv2.resize",
"cv2.GaussianBlur",
"numpy.load",
"cv2.bitwise_not",
"random.randint",
"cv2.cvtColor",
"cv2.calcHist",
"random.sample",
"os.walk",
"numpy.zeros",
"random.random",
"cv2.imread",
"numpy.array",
"numpy.arange",
"numpy.random.permutation",
"cv2.flip",
"numpy.concatenate"
] | [((259, 298), 'cv2.cvtColor', 'cv2.cvtColor', (['srcArr', 'cv2.COLOR_RGB2HSV'], {}), '(srcArr, cv2.COLOR_RGB2HSV)\n', (271, 298), False, 'import cv2\n'), ((471, 502), 'numpy.zeros', 'np.zeros', (['(256)'], {'dtype': 'np.float32'}), '(256, dtype=np.float32)\n', (479, 502), True, 'import numpy as np\n'), ((597, 636), 'cv... |
# function that returns [deps/dt, dX/dt, dR/dt]
import math
import numpy as np
import copy
from scipy.integrate import odeint
class viscoPlastic2D:
def __init__(self, E, v, R1, k, K, a, b, c, n, trial, Emax):
self.E = E
self.v = v
self.R1 = R1
self.k = k
self.K = K
... | [
"copy.deepcopy",
"scipy.integrate.odeint",
"numpy.zeros",
"math.floor",
"numpy.array",
"numpy.matmul"
] | [((1323, 1342), 'copy.deepcopy', 'copy.deepcopy', (['z[6]'], {}), '(z[6])\n', (1336, 1342), False, 'import copy\n'), ((1376, 1395), 'copy.deepcopy', 'copy.deepcopy', (['z[7]'], {}), '(z[7])\n', (1389, 1395), False, 'import copy\n'), ((1518, 1543), 'numpy.matmul', 'np.matmul', (['stiff', '(ET - Ei)'], {}), '(stiff, ET -... |
import chainer
from chainer import training
from chainer.training import extensions, ParallelUpdater
from chainer.training.triggers import ManualScheduleTrigger
from chainer.datasets import TransformDataset
from chainercv.datasets import VOCBboxDataset, voc_bbox_label_names
from chainercv import transforms
from ... | [
"chainercv.transforms.flip",
"chainer.training.extensions.observe_lr",
"numpy.random.seed",
"argparse.ArgumentParser",
"utils.cocoapi_evaluator.COCOAPIEvaluator",
"chainer.iterators.SerialIterator",
"chainercv.transforms.image.resize.resize",
"chainer.training.extensions.LogReport",
"traceback.print... | [((1268, 1324), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Mask RCNN trainer"""'}), "(description='Mask RCNN trainer')\n", (1291, 1324), False, 'import argparse\n'), ((4069, 4135), 'chainer.dataset.convert.concat_examples', 'chainer.dataset.convert.concat_examples', (['batch', 'devic... |
from sklearn.model_selection import train_test_split, cross_val_score, KFold
from sklearn.metrics import mean_squared_error
from sklearn.metrics import classification_report
from sklearn.preprocessing import StandardScaler, MinMaxScaler, normalize
from sklearn.metrics import roc_auc_score
from sklearn.metrics import ro... | [
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"sklearn.model_selection.cross_val_score",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.metrics.classification_report",
"matplotlib.pyplot.figure",
"sklearn.metrics.mean_squared_error",
"... | [((3258, 3306), 'sklearn.model_selection.train_test_split', 'train_test_split', (['self.X', 'self.y'], {'test_size': '(0.33)'}), '(self.X, self.y, test_size=0.33)\n', (3274, 3306), False, 'from sklearn.model_selection import train_test_split, cross_val_score, KFold\n'), ((3807, 3828), 'numpy.array', 'np.array', (['self... |
"""test_3_mac_receive_jpg.py -- receive & display jpg stream.
A simple test program that uses imagezmq to receive an image jpg stream from a
Raspberry Pi and display it as a video steam.
1. Run this program in its own terminal window on the mac:
python test_3_mac_receive_jpg.py
This "receive and display images" prog... | [
"cv2.waitKey",
"numpy.frombuffer",
"imagezmq.ImageHub",
"cv2.imshow"
] | [((964, 983), 'imagezmq.ImageHub', 'imagezmq.ImageHub', ([], {}), '()\n', (981, 983), False, 'import imagezmq\n'), ((1203, 1230), 'cv2.imshow', 'cv2.imshow', (['rpi_name', 'image'], {}), '(rpi_name, image)\n', (1213, 1230), False, 'import cv2\n'), ((1260, 1274), 'cv2.waitKey', 'cv2.waitKey', (['(1)'], {}), '(1)\n', (12... |
#!/usr/bin/env python3
import os
from pathlib import Path
import numpy as np
import tensorflow as tf
import cv2
from cv_bridge import CvBridge, CvBridgeError
import rospy
from hrl_object_detection.msg import FloatList
from sensor_msgs.msg import Image
from object_detection.utils import ops as utils_ops
from object_d... | [
"numpy.absolute",
"rospy.Subscriber",
"pathlib.Path",
"numpy.arange",
"cv2.rectangle",
"cv2.cvtColor",
"rospy.Rate",
"tensorflow.cast",
"rospy.is_shutdown",
"cv2.LUT",
"rospy.init_node",
"numpy.asarray",
"numpy.sort",
"cv_bridge.CvBridge",
"tensorflow.convert_to_tensor",
"rospy.Publish... | [((573, 583), 'cv_bridge.CvBridge', 'CvBridge', ([], {}), '()\n', (581, 583), False, 'from cv_bridge import CvBridge, CvBridgeError\n'), ((6669, 6725), 'rospy.Publisher', 'rospy.Publisher', (['"""/image_with_box"""', 'Image'], {'queue_size': '(10)'}), "('/image_with_box', Image, queue_size=10)\n", (6684, 6725), False, ... |
import pandas as pd
import numpy as np
from verstack.categoric_encoders.args_validators import is_not_bool_na_sentinel
class Factorizer():
'''
Assing numeric labels to categoric column (binary/multiclass).
Can make transformation without transforming original NaN values, or assign any user defined \
... | [
"pandas.factorize",
"verstack.categoric_encoders.args_validators.is_not_bool_na_sentinel",
"numpy.vectorize",
"pandas.Series"
] | [((877, 913), 'verstack.categoric_encoders.args_validators.is_not_bool_na_sentinel', 'is_not_bool_na_sentinel', (['na_sentinel'], {}), '(na_sentinel)\n', (900, 913), False, 'from verstack.categoric_encoders.args_validators import is_not_bool_na_sentinel\n'), ((2341, 2363), 'pandas.Series', 'pd.Series', (['df[colname]']... |
"""
molpy.py
A nice molecule manipulation package.
Handles the primary functions
"""
import numpy as np
from .util import distance
def canvas(with_attribution=True):
"""
Placeholder function to show example docstring (NumPy format)
Replace this function and doc string for your own project
Paramete... | [
"numpy.asarray"
] | [((796, 826), 'numpy.asarray', 'np.asarray', (['symbols'], {'dtype': 'str'}), '(symbols, dtype=str)\n', (806, 826), True, 'import numpy as np\n'), ((851, 884), 'numpy.asarray', 'np.asarray', (['geometry'], {'dtype': 'float'}), '(geometry, dtype=float)\n', (861, 884), True, 'import numpy as np\n')] |
import json
from os.path import dirname, join
import numpy as np
import pandas as pd
from sklearn.preprocessing import KBinsDiscretizer
def _discretize(vector, **kwargs):
"""Discretizes vector with sklearn.preprocessing.KBinsDiscretizer.
Parameters
----------
vector : np.array
kwargs
Arg... | [
"pandas.DataFrame",
"json.load",
"os.path.dirname",
"numpy.apply_along_axis",
"sklearn.preprocessing.KBinsDiscretizer",
"os.path.join"
] | [((530, 574), 'sklearn.preprocessing.KBinsDiscretizer', 'KBinsDiscretizer', ([], {'encode': '"""ordinal"""'}), "(encode='ordinal', **kwargs)\n", (546, 574), False, 'from sklearn.preprocessing import KBinsDiscretizer\n'), ((1781, 1798), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (1788, 1798), Fals... |
import datetime
import json
import logging
import os
import sys
import time
from urllib.parse import urlparse
import boto3
import click
import numpy as np
import pandas as pd
logging.basicConfig(
format="[%(asctime)s] %(message)s", level=logging.INFO, datefmt="%Y-%m-%d %H:%M:%S"
)
timeout_seconds = 10800
SEED = 1... | [
"click.version_option",
"numpy.random.seed",
"boto3.client",
"pandas.read_csv",
"click.option",
"json.dumps",
"boto3.resource",
"click.Path",
"os.path.join",
"urllib.parse.urlparse",
"os.path.dirname",
"logging.log",
"click.command",
"datetime.timedelta",
"numpy.random.choice",
"json.d... | [((177, 285), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(asctime)s] %(message)s"""', 'level': 'logging.INFO', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(format='[%(asctime)s] %(message)s', level=logging.INFO,\n datefmt='%Y-%m-%d %H:%M:%S')\n", (196, 285), False, 'import logging\n'), ((12099,... |
import itertools
import os
import h5py
import numpy as np
from skimage import io, img_as_float32, img_as_uint, img_as_ubyte
from skimage.transform import rescale
class ims:
def __init__(self, file, ResolutionLevelLock=0, write=False, cache_location=None, mem_size=None, disk_size=2000, squeeze_output=True):
... | [
"h5py.File",
"numpy.minimum",
"skimage.img_as_float32",
"os.makedirs",
"skimage.transform.rescale",
"os.path.basename",
"skimage.img_as_uint",
"numpy.maximum",
"os.path.exists",
"numpy.zeros",
"numpy.clip",
"skimage.img_as_ubyte",
"os.path.splitext",
"numpy.squeeze",
"os.path.split",
"... | [((21471, 21500), 'skimage.img_as_float32', 'img_as_float32', (['workingVolume'], {}), '(workingVolume)\n', (21485, 21500), False, 'from skimage import io, img_as_float32, img_as_uint, img_as_ubyte\n'), ((21525, 21591), 'skimage.transform.rescale', 'rescale', (['workingVolume', 'rescaleFactor'], {'anti_aliasing': 'anti... |
import numpy as np
import math
from icrestimator import ICREstimator
global tolerance
tolerance = 0.05
def init_icre(alphas, ls, bs):
alphas = np.array(alphas)
ls = np.array(ls)
bs = np.array(bs)
epsilon = np.zeros(shape=(3, 1))
icre = ICREstimator(epsilon, alphas, ls, bs)
return icre
def te... | [
"icrestimator.ICREstimator",
"math.sqrt",
"numpy.allclose",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.array"
] | [((150, 166), 'numpy.array', 'np.array', (['alphas'], {}), '(alphas)\n', (158, 166), True, 'import numpy as np\n'), ((176, 188), 'numpy.array', 'np.array', (['ls'], {}), '(ls)\n', (184, 188), True, 'import numpy as np\n'), ((198, 210), 'numpy.array', 'np.array', (['bs'], {}), '(bs)\n', (206, 210), True, 'import numpy a... |
#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function, unicode_literals
import matplotlib.pyplot as plt
import numpy as np
import argparse
import re
import os
# Describe arguments and options.
parser = argparse.ArgumentParser(description='Create ROC curves based on StegExpose reports... | [
"numpy.trapz",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"os.path.join",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.axis",
"re.match",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig"
] | [((238, 328), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create ROC curves based on StegExpose reports."""'}), "(description=\n 'Create ROC curves based on StegExpose reports.')\n", (261, 328), False, 'import argparse\n'), ((6298, 6320), 'numpy.trapz', 'np.trapz', (['f5_ys', 'f5_x... |
import caffe
import numpy as np
import pickle
TEST_LAYER_NAME = 'bn205'
# TEST_LAYER_NAME = None
net = caffe.Net('proto.prototxt', caffe.TEST)
params = pickle.load(open('params.pkl', 'rb'))
for key in params:
if not key in net.params:
break
if 'kernel' in params[key]:
# net.params[key][0].data[:] = np.trans... | [
"caffe.Net",
"numpy.ones"
] | [((108, 147), 'caffe.Net', 'caffe.Net', (['"""proto.prototxt"""', 'caffe.TEST'], {}), "('proto.prototxt', caffe.TEST)\n", (117, 147), False, 'import caffe\n'), ((1332, 1357), 'numpy.ones', 'np.ones', (['[1, 3, 112, 112]'], {}), '([1, 3, 112, 112])\n', (1339, 1357), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.functional as F
from lxml import etree
from tqdm import tqdm
from pytorch_extras import RAdam, SingleCycleScheduler
from pytorch_transformers import GPT2Model, GPT2Tokenizer
from deps.torch_tr... | [
"tqdm.tqdm",
"torch.tensor",
"torch.eye",
"pytorch_extras.SingleCycleScheduler",
"numpy.prod",
"pathlib.Path",
"torch.nn.functional.log_softmax",
"lxml.etree.parse",
"models.SSTClassifier",
"torch.sum",
"numpy.random.shuffle"
] | [((7210, 7362), 'models.SSTClassifier', 'SSTClassifier', ([], {'d_depth': '(mw.model.hparams.n_layer + 1)', 'd_emb': 'mw.model.hparams.n_hidden', 'd_inp': '(64)', 'd_cap': '(2)', 'n_parts': '(64)', 'n_classes': 'n_classes', 'n': 'MAX_LEN'}), '(d_depth=mw.model.hparams.n_layer + 1, d_emb=mw.model.hparams.\n n_hidden,... |
#!/usr/bin/env python
# encoding: utf-8
"""
test_geotiff.py
Created by <NAME> on 2013-09-18.
"""
from __future__ import division, print_function, absolute_import
from builtins import str
import os
import numpy as np
import pytest
from pygaarst import geotiff
from pygaarst.rasterhelpers import PygaarstRasterError
DAT... | [
"pytest.raises",
"numpy.isclose",
"pygaarst.geotiff.GeoTIFF",
"builtins.str",
"os.path.join"
] | [((353, 395), 'os.path.join', 'os.path.join', (['DATADIR', '"""LC8_754_8bit.tiff"""'], {}), "(DATADIR, 'LC8_754_8bit.tiff')\n", (365, 395), False, 'import os\n'), ((411, 451), 'os.path.join', 'os.path.join', (['DATADIR', '"""bogota_crop.tif"""'], {}), "(DATADIR, 'bogota_crop.tif')\n", (423, 451), False, 'import os\n'),... |
"""
UNSUPERVISED LEARNING METRICS
Author: <NAME>
License: MIT License
Source: http://www.github.com/bstienen/AUMVC
Implementation of the Area under the Mass-Volume Curve algorithm as by
- <NAME> and <NAME>, Scoring anomalies: a M-estimation
formulation approach. 2013-04
Implementation is inspired by
h... | [
"numpy.amin",
"numpy.amax",
"numpy.percentile",
"sklearn.metrics.auc",
"numpy.mean",
"numpy.linspace",
"numpy.random.choice",
"warnings.warn",
"numpy.prod"
] | [((1928, 1951), 'numpy.amin', 'np.amin', (['X_test'], {'axis': '(0)'}), '(X_test, axis=0)\n', (1935, 1951), True, 'import numpy as np\n'), ((1963, 1986), 'numpy.amax', 'np.amax', (['X_test'], {'axis': '(0)'}), '(X_test, axis=0)\n', (1970, 1986), True, 'import numpy as np\n'), ((2133, 2153), 'numpy.prod', 'np.prod', (['... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Slightech Co., Ltd. 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/... | [
"sys.stdout.write",
"matplotlib.pyplot.figure",
"os.path.isfile",
"os.path.join",
"os.path.abspath",
"os.path.exists",
"numpy.max",
"os.path.normpath",
"matplotlib.pyplot.show",
"os.path.basename",
"data.ROSBag",
"pandas.cut",
"numpy.min",
"pandas.Series",
"numpy.argwhere",
"numpy.memm... | [((839, 876), 'os.path.join', 'os.path.join', (['TOOLBOX_DIR', '"""internal"""'], {}), "(TOOLBOX_DIR, 'internal')\n", (851, 876), False, 'import os\n'), ((9640, 9670), 'os.path.normpath', 'os.path.normpath', (['dataset_path'], {}), '(dataset_path)\n', (9656, 9670), False, 'import os\n'), ((795, 820), 'os.path.abspath',... |
import json
import numpy as np
import pkg_resources
import pickle
from .. import utils
from .. import ExcursionProblem
datafile = pkg_resources.resource_filename('excursion','testcases/data/checkmate_dense.json')
def modify(zv):
return np.log(zv)-np.log(0.05)
truthX, truthy_obs, truthy_exp = [], [], []
for p,_,... | [
"numpy.array",
"numpy.log",
"pkg_resources.resource_filename"
] | [((132, 219), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""excursion"""', '"""testcases/data/checkmate_dense.json"""'], {}), "('excursion',\n 'testcases/data/checkmate_dense.json')\n", (163, 219), False, 'import pkg_resources\n'), ((618, 634), 'numpy.array', 'np.array', (['truthX'], {}... |
from numpy import genfromtxt
import matplotlib.pyplot as plt
import mpl_finance
import numpy as np
import uuid
import pandas as pd
import ta
from ta import add_all_ta_features
from ta.utils import dropna
from ta.volatility import BollingerBands
# Load datas
df = pd.read_csv(r'C:\mlvisualtrader\financial_data\Binance_B... | [
"matplotlib.pyplot.clf",
"pandas.read_csv",
"numpy.ones",
"matplotlib.pyplot.figure",
"mpl_finance.candlestick2_ochl",
"ta.utils.dropna",
"ta.volatility.bollinger_hband_indicator",
"ta.trend.EMAIndicator",
"numpy.genfromtxt",
"matplotlib.pyplot.autoscale",
"matplotlib.pyplot.cla",
"ta.trend.SM... | [((264, 364), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\mlvisualtrader\\\\financial_data\\\\Binance_BTCUSDT_1h_Backtest.csv"""'], {'sep': '""","""'}), "(\n 'C:\\\\mlvisualtrader\\\\financial_data\\\\Binance_BTCUSDT_1h_Backtest.csv',\n sep=',')\n", (275, 364), True, 'import pandas as pd\n'), ((399, 409), 'ta.u... |
# This scripts assumes that the dataframe has been created and saved in data.txt
import sys
sys.path.insert(1, '../src/MyAIGuide/utilities')
import pickle
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats
from dataFrameUtilities import check_if_zero_then_adjust_var_and_pla... | [
"peaksAnalysisFunctions.calculateForAllRegionsParticipant2",
"matplotlib.pyplot.show",
"sys.path.insert",
"numpy.max",
"pickle.load",
"matplotlib.pyplot.subplots"
] | [((93, 141), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../src/MyAIGuide/utilities"""'], {}), "(1, '../src/MyAIGuide/utilities')\n", (108, 141), False, 'import sys\n'), ((589, 607), 'pickle.load', 'pickle.load', (['input'], {}), '(input)\n', (600, 607), False, 'import pickle\n'), ((1208, 1238), 'matplotlib.pypl... |
import numpy as np
import matplotlib.pyplot as pyplot
import matplotlib as mplot
from matplotlib import rc
import easygui as eg
import matplotlib.cm as cm
def time_series(f):
line = f.readline().split('\t')
# For some reason the last element of 'line' comes with a '\n' last element. Removing this '\n' character:... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"numpy.array",
"easygui.ynbox",
"matplotlib.cm.rainbow",
"easygui.multchoicebox"
] | [((6534, 6547), 'matplotlib.pyplot.show', 'pyplot.show', ([], {}), '()\n', (6545, 6547), True, 'import matplotlib.pyplot as pyplot\n'), ((1805, 1894), 'easygui.multchoicebox', 'eg.multchoicebox', (['"""What steps do you want to plot?"""', '"""LT2PY step selecion"""', 'step_info'], {}), "('What steps do you want to plot... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Bridge for using cclib data in PySCF (https://github.com/pyscf/pyscf)."""
from cclib.parser.utils import find... | [
"numpy.full_like",
"numpy.zeros",
"numpy.shape",
"numpy.array",
"cclib.parser.utils.PeriodicTable",
"cclib.parser.utils.find_package",
"numpy.unique"
] | [((504, 525), 'cclib.parser.utils.find_package', 'find_package', (['"""pyscf"""'], {}), "('pyscf')\n", (516, 525), False, 'from cclib.parser.utils import find_package, PeriodicTable, convertor\n'), ((1415, 1430), 'cclib.parser.utils.PeriodicTable', 'PeriodicTable', ([], {}), '()\n', (1428, 1430), False, 'from cclib.par... |
# -*- coding: utf-8 -*-
#
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# Using this computer program means that you agree to the terms
# in the LICENSE file included with this software distribution.
# Any use not explicitly grant... | [
"numpy.load",
"numpy.zeros_like",
"numpy.clip",
"torch.nn.functional.interpolate",
"torch.from_numpy"
] | [((2552, 2586), 'torch.nn.functional.interpolate', 'F.interpolate', (['texture', '[256, 256]'], {}), '(texture, [256, 256])\n', (2565, 2586), True, 'import torch.nn.functional as F\n'), ((1263, 1280), 'numpy.load', 'np.load', (['tex_path'], {}), '(tex_path)\n', (1270, 1280), True, 'import numpy as np\n'), ((3474, 3505)... |
#################################################################################
# argument parser
#################################################################################
# --dataset: str, 'melanoma', 'oct', or 'chestx', dataset type
# --model_path: str, path to model weight '*/*.h5'
# --model_type:... | [
"tensorflow.random.set_seed",
"numpy.load",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.sum",
"tensorflow.keras.layers.Dense",
"numpy.argmax",
"tensorflow.keras.applications.resnet50.ResNet50",
"tensorflow.image.grayscale_to_rgb",
"tensorflow.keras.optimizers.SGD",
"logging.Formatter"... | [((963, 996), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (986, 996), False, 'import warnings\n'), ((1840, 1854), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (1847, 1854), True, 'import matplotlib as mpl\n'), ((2250, 2269), 'logging.getLogger', 'loggi... |
import numpy as np
from scipy.stats import norm
from sklearn.model_selection import train_test_split
from keras.callbacks import EarlyStopping
import warnings
import keras.backend as K
from keras.initializers import glorot_uniform
import tensorflow as tf
from sklearn.model_selection import KFold
import os
class HPermT... | [
"os.mkdir",
"numpy.sum",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"os.path.exists",
"numpy.mean",
"numpy.array",
"numpy.random.permutation"
] | [((5414, 5502), 'numpy.random.permutation', 'np.random.permutation', (['Z[:, self.inf_feats[k][0][:, None], self.inf_feats[k][1], :]'], {}), '(Z[:, self.inf_feats[k][0][:, None], self.inf_feats[k]\n [1], :])\n', (5435, 5502), True, 'import numpy as np\n'), ((5531, 5577), 'numpy.random.permutation', 'np.random.permut... |
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.arrays import *
from mos3d.models.world.objects import GridWorldObject
import mos3d.util as util
import numpy as np
class Robot(GridWorldObject):
# By default, the robot has a camera, and
# it looks into the direction (-1, 0... | [
"mos3d.util.R_euler",
"mos3d.util.cube",
"numpy.array",
"mos3d.util.generate_vbo_elements",
"mos3d.util.R_quat",
"mos3d.util.quat_to_euler"
] | [((867, 893), 'mos3d.util.cube', 'util.cube', ([], {'color': '(1, 0, 0)'}), '(color=(1, 0, 0))\n', (876, 893), True, 'import mos3d.util as util\n'), ((966, 1019), 'mos3d.util.generate_vbo_elements', 'util.generate_vbo_elements', (['vertices', 'indices', 'colors'], {}), '(vertices, indices, colors)\n', (992, 1019), True... |
from __future__ import print_function, division
import numpy as np
import matplotlib.pyplot as plt
from qutip import *
from torch.utils.data import Dataset
def normalize(a):
a_oo = a - np.real(a).min()
return a_oo/np.abs(a_oo).max()
def get_state(theta, phi):
ket0, ket1 = np.array([[1.],[0.]]), np.array([[0... | [
"numpy.abs",
"numpy.linalg.qr",
"numpy.sin",
"numpy.meshgrid",
"numpy.random.randn",
"matplotlib.pyplot.close",
"numpy.kron",
"numpy.linspace",
"numpy.real",
"matplotlib.pyplot.subplots",
"numpy.complex",
"numpy.diagonal",
"numpy.asarray",
"numpy.cos",
"numpy.dot",
"numpy.random.unifor... | [((5417, 5432), 'numpy.linalg.qr', 'np.linalg.qr', (['Z'], {}), '(Z)\n', (5429, 5432), True, 'import numpy as np\n'), ((5523, 5535), 'numpy.dot', 'np.dot', (['Q', 'D'], {}), '(Q, D)\n', (5529, 5535), True, 'import numpy as np\n'), ((285, 309), 'numpy.array', 'np.array', (['[[1.0], [0.0]]'], {}), '([[1.0], [0.0]])\n', (... |
import os
from os.path import join
import sys
import socket
import subprocess
import json
import importlib
import numpy as np
import pyneal_helper_tools as helper_tools
# get dictionary with relevant paths for tests within this module
paths = helper_tools.get_pyneal_test_paths()
if paths['pynealDir'] not in sys.path... | [
"pyneal_helper_tools.get_pyneal_test_paths",
"socket.socket",
"sys.path.insert",
"numpy.array",
"os.path.join",
"importlib.util.module_from_spec"
] | [((246, 282), 'pyneal_helper_tools.get_pyneal_test_paths', 'helper_tools.get_pyneal_test_paths', ([], {}), '()\n', (280, 282), True, 'import pyneal_helper_tools as helper_tools\n'), ((574, 611), 'importlib.util.module_from_spec', 'importlib.util.module_from_spec', (['spec'], {}), '(spec)\n', (605, 611), False, 'import ... |
import numpy as np
import random
from argparse import ArgumentParser
from keras.models import Model
from keras.utils import plot_model, to_categorical
from keras import backend as K
import tensorflow as tf
import os, shutil
from data import load_npz, convert_to_npz
from net import attach_classifier, create_base_networ... | [
"argparse.ArgumentParser",
"net.create_base_network",
"bhtsne.tsne",
"numpy.power",
"keras.backend.set_session",
"tensorflow.Session",
"data.load_npz",
"tensorflow.ConfigProto",
"os.path.split",
"os.path.join",
"numpy.concatenate"
] | [((507, 523), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (521, 523), True, 'import tensorflow as tf\n'), ((631, 656), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (641, 656), True, 'import tensorflow as tf\n'), ((659, 678), 'keras.backend.set_session', 'K.set_s... |
import sys
from pathlib import Path
from PIL import Image
import numpy as np
RESOLUTIONS = ['HR']
DIML_PATH = Path(sys.argv[1]).resolve()
SAVE_PATH = DIML_PATH / 'npy'
TRAIN_RATIO = 0.9
assert DIML_PATH.exists()
SAVE_PATH.mkdir(exist_ok=True, parents=True)
for split in ('train', 'val', 'test'):
for resolution i... | [
"pathlib.Path",
"numpy.iinfo",
"PIL.Image.open"
] | [((112, 129), 'pathlib.Path', 'Path', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (116, 129), False, 'from pathlib import Path\n'), ((1336, 1358), 'PIL.Image.open', 'Image.open', (['depth_file'], {}), '(depth_file)\n', (1346, 1358), False, 'from PIL import Image\n'), ((1449, 1468), 'numpy.iinfo', 'np.iinfo', (['np.uint16... |
import arcpy
import numpy
import scipy
from scipy import spatial
#inputs
inFeatures = arcpy.GetParameterAsText(0) #input features (type: feature class, required)
targetFeatures = arcpy.GetParameterAsText(1) #near features (type: feature class, required)
toReturn = arcpy.GetParameter(2) #number of near features to ret... | [
"scipy.spatial.distance.cdist",
"arcpy.GetParameter",
"arcpy.GetParameterAsText",
"arcpy.da.SearchCursor",
"arcpy.mapping.ListDataFrames",
"arcpy.Describe",
"numpy.asarray",
"arcpy.AddMessage",
"arcpy.RefreshActiveView",
"numpy.array",
"arcpy.AddWarning",
"scipy.spatial.cKDTree",
"arcpy.mapp... | [((88, 115), 'arcpy.GetParameterAsText', 'arcpy.GetParameterAsText', (['(0)'], {}), '(0)\n', (112, 115), False, 'import arcpy\n'), ((181, 208), 'arcpy.GetParameterAsText', 'arcpy.GetParameterAsText', (['(1)'], {}), '(1)\n', (205, 208), False, 'import arcpy\n'), ((267, 288), 'arcpy.GetParameter', 'arcpy.GetParameter', (... |
import os
import re
import fileinput
import time
import subprocess
import numpy as np
from sklearn.utils import class_weight
import nibabel as nib
from nibabel import load as load_nii
import torch
from torch.autograd import Variable
from skimage import transform as skt
def deepMask(args, model, id, t1w_np, t2w_np, t1... | [
"nibabel.Nifti1Image",
"numpy.stack",
"numpy.logical_and",
"nibabel.load",
"time.gmtime",
"torch.autograd.Variable",
"os.path.dirname",
"torch.argmax",
"numpy.asarray",
"fileinput.FileInput",
"time.time",
"numpy.nonzero",
"skimage.transform.resize",
"subprocess.call",
"os.path.join"
] | [((428, 439), 'time.time', 'time.time', ([], {}), '()\n', (437, 439), False, 'import time\n'), ((802, 831), 'torch.autograd.Variable', 'Variable', (['data'], {'volatile': '(True)'}), '(data, volatile=True)\n', (810, 831), False, 'from torch.autograd import Variable\n'), ((870, 897), 'torch.argmax', 'torch.argmax', (['o... |
# -*- coding: utf-8 -*-
"""
The Evolved Transformer and large-scale evolution of image classifiers
======================================================================
Implement evolution to exploit configurations with fixed resource efficiently
"""
import copy
import importlib
import logging
import numpy as np
f... | [
"copy.deepcopy",
"numpy.log",
"importlib.import_module",
"numpy.ones",
"numpy.array",
"orion.core.utils.format_trials.tuple_to_trial",
"logging.getLogger"
] | [((433, 460), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (450, 460), False, 'import logging\n'), ((5757, 5787), 'copy.deepcopy', 'copy.deepcopy', (['self.population'], {}), '(self.population)\n', (5770, 5787), False, 'import copy\n'), ((5824, 5855), 'copy.deepcopy', 'copy.deepcopy', (... |
'''.
Jul 03, 2018.
<NAME>, <EMAIL>
'''
import numpy as np
from random import shuffle
import os
import pandas as pd
from abc import abstractmethod
from imblearn.under_sampling import RandomUnderSampler
from imblearn.over_sampling import RandomOverSampler, SMOTE
from FAE.DataContainer.DataContainer import DataContaine... | [
"imblearn.under_sampling.RandomUnderSampler",
"os.path.isdir",
"imblearn.over_sampling.RandomOverSampler",
"imblearn.over_sampling.SMOTE",
"numpy.squeeze",
"os.path.join"
] | [((939, 964), 'numpy.squeeze', 'np.squeeze', (['one_case_data'], {}), '(one_case_data)\n', (949, 964), True, 'import numpy as np\n'), ((1584, 1618), 'imblearn.under_sampling.RandomUnderSampler', 'RandomUnderSampler', ([], {'random_state': '(0)'}), '(random_state=0)\n', (1602, 1618), False, 'from imblearn.under_sampling... |
from sklearn.naive_bayes import GaussianNB
import numpy as np
import itertools
import csv
import pickle
import psutil
def __loadData(dataFile, isNumericData = False):
data = []
with open(dataFile, 'rt') as csvfile:
datas = csv.reader(csvfile, delimiter = ',')
for row in datas:
if ro... | [
"sklearn.naive_bayes.GaussianNB",
"pickle.dump",
"csv.reader",
"numpy.sum",
"psutil.virtual_memory",
"numpy.apply_along_axis",
"numpy.array"
] | [((2019, 2031), 'sklearn.naive_bayes.GaussianNB', 'GaussianNB', ([], {}), '()\n', (2029, 2031), False, 'from sklearn.naive_bayes import GaussianNB\n'), ((2359, 2410), 'numpy.apply_along_axis', 'np.apply_along_axis', (['normalization', '(1)', 'testTraining'], {}), '(normalization, 1, testTraining)\n', (2378, 2410), True... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_psst
----------------------------------
Tests for `psst` module.
"""
import numpy as np
import pytest as pt
import traitlets as T
import psst
from psst.case.generator import Generator, GeneratorView, GeneratorCostView
from .test_generator import default_gener... | [
"pytest.fixture",
"psst.case.generator.GeneratorCostView",
"numpy.all",
"psst.case.generator.GeneratorView"
] | [((327, 353), 'pytest.fixture', 'pt.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (337, 353), True, 'import pytest as pt\n'), ((397, 409), 'pytest.fixture', 'pt.fixture', ([], {}), '()\n', (407, 409), True, 'import pytest as pt\n'), ((507, 519), 'pytest.fixture', 'pt.fixture', ([], {}), '()\n', (517,... |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
"""
Functions to detected aggregated spots and foci.
"""
import numpy as np
import bigfish.stack as stack
from sklearn.cluster import DBSCAN
# ### Detect foci ###
def detect_foci(spots, voxel_size_z=None, voxel_size_yx=100, radius=350,
... | [
"sklearn.cluster.DBSCAN",
"numpy.concatenate",
"numpy.array",
"bigfish.stack.check_array",
"numpy.unique"
] | [((1926, 1974), 'bigfish.stack.check_array', 'stack.check_array', (['spots'], {'ndim': '(2)', 'dtype': 'np.int64'}), '(spots, ndim=2, dtype=np.int64)\n', (1943, 1974), True, 'import bigfish.stack as stack\n'), ((5543, 5587), 'sklearn.cluster.DBSCAN', 'DBSCAN', ([], {'eps': 'radius', 'min_samples': 'nb_min_spots'}), '(e... |
#! /usr/bin/python3
# -*- coding:utf-8 -*-
import numpy as np
from outils import *
class Layer :
def __init__(self, entry, neurones, activation, learning_rate) :
# entry is the number of neurones of the previous layer
# neurones is the number of neurones of the current layer
# activation ... | [
"numpy.dot",
"numpy.zeros",
"numpy.random.normal",
"numpy.sqrt"
] | [((421, 471), 'numpy.random.normal', 'np.random.normal', (['(0)', 'sigma'], {'size': '[neurones, entry]'}), '(0, sigma, size=[neurones, entry])\n', (437, 471), True, 'import numpy as np\n'), ((491, 534), 'numpy.random.normal', 'np.random.normal', (['(0)', 'sigma'], {'size': '[neurones]'}), '(0, sigma, size=[neurones])\... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
from keras import backend as K
from keras.datasets import mnist
from keras.utils import np_utils
import keras
import numpy as np
import tensorflow as tf
os.e... | [
"numpy.save",
"keras.datasets.mnist.load_data",
"keras.backend.function",
"tensorflow.Session",
"tensorflow.ConfigProto",
"keras.utils.np_utils.to_categorical",
"numpy.array",
"models.carlini_models.carlini_mnist_model",
"os.path.join",
"numpy.concatenate"
] | [((416, 432), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (430, 432), True, 'import tensorflow as tf\n'), ((479, 504), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (489, 504), True, 'import tensorflow as tf\n'), ((630, 647), 'keras.datasets.mnist.load_data', 'mn... |
from typing import Tuple, Sequence
import numpy as np
from . import DefaultAgent
from mdde.agent.abc import NodeAgentMapping
class SingleNodeDefaultAgent(DefaultAgent):
"""Default agent allowing only a single data node to be managed. Generates a uniform action space."""
def __init__(self,
... | [
"numpy.insert"
] | [((7145, 7175), 'numpy.insert', 'np.insert', (['obs', '(2)', 'own'], {'axis': '(2)'}), '(obs, 2, own, axis=2)\n', (7154, 7175), True, 'import numpy as np\n')] |
# Copyright 2018 The trfl Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"tensorflow.test.main",
"numpy.random.uniform",
"numpy.absolute",
"numpy.stack",
"numpy.abs",
"tensorflow.global_variables_initializer",
"tensorflow.reshape",
"numpy.square",
"tensorflow.concat",
"numpy.amax",
"tensorflow.placeholder",
"tensorflow.zeros",
"numpy.array",
"trfl.pixel_control... | [((7341, 7355), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (7353, 7355), True, 'import tensorflow as tf\n'), ((1308, 1329), 'numpy.prod', 'np.prod', (['obs_size[4:]'], {}), '(obs_size[4:])\n', (1315, 1329), True, 'import numpy as np\n'), ((1418, 1450), 'numpy.random.uniform', 'np.random.uniform', ([], {'... |
import tensorflow as tf
from tensorflow.keras import preprocessing
import streamlit as st
import numpy as np
import webbrowser
from PIL import Image
url = "https://github.com/NavinBondade/Identifying-Nine-Tomato-Disease-With-Deep-Learning"
st.set_page_config(page_title='Tomato Diseases Identification Tool', i... | [
"streamlit.set_page_config",
"streamlit.markdown",
"streamlit.columns",
"tensorflow.keras.models.load_model",
"streamlit.image",
"numpy.argmax",
"tensorflow.keras.preprocessing.image.img_to_array",
"numpy.expand_dims",
"streamlit.write",
"streamlit.title",
"PIL.Image.open",
"streamlit.download... | [((250, 352), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Tomato Diseases Identification Tool"""', 'initial_sidebar_state': '"""auto"""'}), "(page_title='Tomato Diseases Identification Tool',\n initial_sidebar_state='auto')\n", (268, 352), True, 'import streamlit as st\n'), ((352, 404)... |
# Copyright 2020 The TensorFlow Ranking 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"tensorflow.nn.zero_fraction",
"tensorflow_ranking.python.utils.sort_by_scores",
"numpy.ones",
"tensorflow.estimator.TrainSpec",
"tensorflow.reduce_max",
"absl.flags.DEFINE_list",
"six.iteritems",
"tensorflow.compat.v1.app.run",
"tensorflow.compat.v1.train.AdagradOptimizer",
"tensorflow.compat.v1.... | [((788, 865), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""train_path"""', 'None', '"""Input file path used for training."""'], {}), "('train_path', None, 'Input file path used for training.')\n", (807, 865), False, 'from absl import flags\n'), ((866, 944), 'absl.flags.DEFINE_string', 'flags.DEFINE_string',... |
import argparse
import os
import pickle
import time
# import warnings
import numpy as np
from csv import writer
import warnings
import matplotlib.pyplot as plt
# utils imports
from power_planner.utils.utils_ksp import KspUtils
from power_planner.utils.utils_costs import CostUtils
from power_planner.evaluate_path import... | [
"numpy.absolute",
"numpy.sum",
"argparse.ArgumentParser",
"csv.writer",
"numpy.asarray",
"power_planner.utils.utils_costs.CostUtils.compute_angle_costs",
"numpy.ones",
"power_planner.utils.utils_ksp.KspUtils.path_distance",
"time.time",
"numpy.any",
"pickle.load",
"numpy.where",
"numpy.dot",... | [((3044, 3069), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3067, 3069), False, 'import argparse\n'), ((3394, 3423), 'os.path.join', 'os.path.join', (['""".."""', '"""outputs"""'], {}), "('..', 'outputs')\n", (3406, 3423), False, 'import os\n'), ((3435, 3460), 'os.path.join', 'os.path.join'... |
"""
this preprocessor, adds optical flow information to the input sequence to the
netwwork.
this works based on two ideas, an overall flow and a per 5 frame flow calculation
"""
from src.preprocessing.preprocessor import preprocessor
import numpy as np
import cv2
from numpy import array, zeros
import os
from glob impor... | [
"numpy.zeros_like",
"cv2.cartToPolar",
"cv2.cvtColor",
"cv2.copyMakeBorder",
"numpy.expand_dims",
"numpy.var",
"cv2.imread",
"numpy.max",
"cv2.calcOpticalFlowFarneback",
"cv2.normalize",
"numpy.vstack",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((8096, 8114), 'numpy.vstack', 'np.vstack', (['train_x'], {}), '(train_x)\n', (8105, 8114), True, 'import numpy as np\n'), ((8133, 8151), 'numpy.vstack', 'np.vstack', (['train_y'], {}), '(train_y)\n', (8142, 8151), True, 'import numpy as np\n'), ((8173, 8194), 'numpy.vstack', 'np.vstack', (['train_vars'], {}), '(train... |
import GRT
import sys
import numpy as np
import argparse
def main():
# Parse the data filename from the argument list
parser = argparse.ArgumentParser(description='Process some data.')
parser.add_argument('filename', help='A data file')
args = parser.parse_args()
filename = args.filename
# Lo... | [
"GRT.ClusterTree",
"numpy.loadtxt",
"argparse.ArgumentParser",
"sys.exit"
] | [((136, 193), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some data."""'}), "(description='Process some data.')\n", (159, 193), False, 'import argparse\n'), ((392, 427), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'delimiter': '""","""'}), "(filename, delimiter=',')\n", (40... |
#!/usr/bin/env python
import numpy as np
import util
delay = .005
Fs = 48000
reps = 100
tail_samples = int(Fs*2.)
delay_samples = int(delay*Fs)
signal = np.tile(np.r_[np.random.standard_normal(Fs*2)*.1, np.zeros(Fs*2)], reps)
signal = np.vstack((np.r_[np.zeros(delay_samples), signal], np.r_[signal, np.zeros(delay_sampl... | [
"numpy.zeros",
"numpy.random.standard_normal",
"util.writewave"
] | [((387, 429), 'util.writewave', 'util.writewave', (['"""noise.wav"""', 'signal', 'Fs', '(3)'], {}), "('noise.wav', signal, Fs, 3)\n", (401, 429), False, 'import util\n'), ((357, 384), 'numpy.zeros', 'np.zeros', (['(tail_samples, 2)'], {}), '((tail_samples, 2))\n', (365, 384), True, 'import numpy as np\n'), ((203, 219),... |
import cv2
import os
import glob
import numpy as np
import subprocess
IN_PATH = '/data5/xin/i3d/HDHIT310Q_4171741/png'
OUT_PATH = '/data5/xin/i3d/HDHIT310Q_4171741/npy'
# IN_PATH = '/data5/xin/i3d/'
# OUT_PATH = '/data5/xin/i3d/npy'
FRAME_RATE = 25
IMAGE_SIZE = 224
FRAME_PER_CHUNK = 100
OVERLAP = 20
EXPECTED_SHAPE =... | [
"numpy.stack",
"cv2.cvtColor",
"numpy.float32",
"numpy.zeros",
"cv2.imread",
"numpy.min",
"numpy.array",
"os.path.join",
"cv2.resize"
] | [((464, 485), 'numpy.min', 'np.min', (['im_shape[0:2]'], {}), '(im_shape[0:2])\n', (470, 485), True, 'import numpy as np\n'), ((549, 638), 'cv2.resize', 'cv2.resize', (['im', 'None', 'None'], {'fx': 'im_scale', 'fy': 'im_scale', 'interpolation': 'cv2.INTER_LINEAR'}), '(im, None, None, fx=im_scale, fy=im_scale, interpol... |
# PointNetVLAD datasets: based on Oxford RobotCar and Inhouse
# Code adapted from PointNetVLAD repo: https://github.com/mikacuy/pointnetvlad
import numpy as np
import os
import pandas as pd
from sklearn.neighbors import KDTree
import pickle
import argparse
# For training and test data splits
X_WIDTH = 150
Y_WIDTH = 1... | [
"pandas.DataFrame",
"pickle.dump",
"argparse.ArgumentParser",
"os.path.exists",
"sklearn.neighbors.KDTree",
"numpy.array",
"os.path.join"
] | [((1220, 1253), 'os.path.join', 'os.path.join', (['base_path', 'filename'], {}), '(base_path, filename)\n', (1232, 1253), False, 'import os\n'), ((4593, 4660), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate evaluation datasets"""'}), "(description='Generate evaluation datasets')... |
import numpy as np
# moves: up->1, down->2,left->3,right->4
# board: 0->wall, 1->empty, 2->destination
# , 3->destination with box, 4->box, 5->player
class BruteSolve:
def __init__(self, basic_state):
# int -> tuple(np.array)
self.state_by_id = {0:basic_state}
# tuple(np.array) -> stat... | [
"numpy.argwhere",
"numpy.rot90",
"numpy.array"
] | [((4209, 4556), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 1, 0, 0], [0, 0, 0, \n 0, 2, 4, 4, 2, 1, 0], [0, 0, 0, 0, 0, 0, 2, 1, 2, 0], [0, 0, 0, 0, 0, 0,\n 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 4, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 4,\n 0], [0, 0, 0, 0, 0, 0, 0, 0, 5, 0], [... |
from utils.common import to_numpy, rec_fn_apply
import torch
import cv2
import torchvision
import os
import csv
from PIL import Image
from torchvision import transforms
MAX_LOG_IMAGES = 4
import numpy as np
def log_images_hook(model, iteration, loop_type, inp, target, output, meta, epoch, writer, classes=None, meter_... | [
"cv2.putText",
"torch.FloatTensor",
"numpy.ones"
] | [((1461, 1490), 'torch.FloatTensor', 'torch.FloatTensor', (['text_image'], {}), '(text_image)\n', (1478, 1490), False, 'import torch\n'), ((1187, 1205), 'numpy.ones', 'np.ones', (['(h, w, 3)'], {}), '((h, w, 3))\n', (1194, 1205), True, 'import numpy as np\n'), ((1282, 1412), 'cv2.putText', 'cv2.putText', (['text_image'... |
"""
Copyright 2019 <NAME>
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, software ... | [
"numpy.array",
"random.seed",
"numpy.random.seed"
] | [((747, 767), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (761, 767), True, 'import numpy as np\n'), ((771, 788), 'random.seed', 'random.seed', (['(1337)'], {}), '(1337)\n', (782, 788), False, 'import random\n'), ((825, 942), 'numpy.array', 'np.array', (['[[1.1, 2.1, 3.1], [1.2, 2.2, 3.2], [1.3... |
# -*- coding: utf-8 -*-
"""
Interpolated Model
------------------
Model interpolated from some surrogate model
"""
import numpy as np
import os
from scipy import interpolate
from sklearn.gaussian_process import GaussianProcessRegressor
from .model import model_base
class interpolated(model_base):
def __init__(sel... | [
"scipy.interpolate.interp1d",
"numpy.load",
"sklearn.gaussian_process.GaussianProcessRegressor"
] | [((520, 534), 'numpy.load', 'np.load', (['fname'], {}), '(fname)\n', (527, 534), True, 'import numpy as np\n'), ((1347, 1411), 'scipy.interpolate.interp1d', 'interpolate.interp1d', (['self.t_interp', 'y'], {'fill_value': '"""extrapolate"""'}), "(self.t_interp, y, fill_value='extrapolate')\n", (1367, 1411), False, 'from... |
import numpy as np
from scipy import linalg
class GaussianProcess:
def compute_rho_corr_func_point(self, a, b, this_rho):
"""Compute correlation between two points a and b."""
corr = np.prod(this_rho**(4 * (a - b)**2))
return corr
def compute_rho_corr_func(self, a, b, this_rho):
... | [
"numpy.diag",
"scipy.linalg.cho_factor",
"scipy.linalg.cho_solve",
"numpy.zeros",
"numpy.array",
"numpy.matmul",
"numpy.dot",
"numpy.prod"
] | [((204, 243), 'numpy.prod', 'np.prod', (['(this_rho ** (4 * (a - b) ** 2))'], {}), '(this_rho ** (4 * (a - b) ** 2))\n', (211, 243), True, 'import numpy as np\n'), ((2349, 2417), 'numpy.zeros', 'np.zeros', (['(self.N_output * self.N_data, self.N_output * self.N_data)'], {}), '((self.N_output * self.N_data, self.N_outpu... |
import gym
import numpy as np
from gym import Wrapper
def make_non_absorbing(observation):
return np.concatenate([observation, [0.0]], -1)
class AbsorbingStatesWrapper(Wrapper):
def __init__(self, env):
super().__init__(env)
low = env.observation_space.low
high = env.observation_spa... | [
"gym.spaces.Box",
"numpy.zeros_like",
"gym.make",
"numpy.concatenate"
] | [((104, 144), 'numpy.concatenate', 'np.concatenate', (['[observation, [0.0]]', '(-1)'], {}), '([observation, [0.0]], -1)\n', (118, 144), True, 'import numpy as np\n'), ((1434, 1455), 'gym.make', 'gym.make', (['"""Hopper-v2"""'], {}), "('Hopper-v2')\n", (1442, 1455), False, 'import gym\n'), ((421, 450), 'numpy.concatena... |
# cording: utf-8
"""
gradient_check.py
[誤差逆伝搬により,正しく勾配が求められ,正しいアドレスに格納できているか] を確認するファイルです.
上手く更新が行われない場合の原因究明にお役立てください.
"""
import os,sys
import numpy as np
import matplotlib.pyplot as plt
import networkgraph
from agent import Agent
from dataset.mnist import load_mnist
from common.multi_layer_net_exte... | [
"os.path.abspath",
"numpy.abs",
"common.optimizer.SGD",
"numpy.ones",
"numpy.split",
"dataset.mnist.load_mnist",
"numpy.eye"
] | [((479, 505), 'dataset.mnist.load_mnist', 'load_mnist', ([], {'normalize': '(True)'}), '(normalize=True)\n', (489, 505), False, 'from dataset.mnist import load_mnist\n'), ((581, 601), 'numpy.split', 'np.split', (['x_train', 'n'], {}), '(x_train, n)\n', (589, 601), True, 'import numpy as np\n'), ((619, 639), 'numpy.spli... |
"""
Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University.
All rights reserved.
Description :
Author:<NAME>
"""
import numpy as np
import threading, random
import tensorflow as tf
class memory_pooling(object):
"""a class offer the APIs of experience replay in reinforcement learning... | [
"random.sample",
"numpy.std",
"threading.Lock",
"tensorflow.group",
"numpy.array",
"numpy.mean",
"numpy.random.normal",
"numpy.sqrt"
] | [((6312, 6331), 'tensorflow.group', 'tf.group', (['*copy_ops'], {}), '(*copy_ops)\n', (6320, 6331), True, 'import tensorflow as tf\n'), ((6800, 6819), 'tensorflow.group', 'tf.group', (['*copy_ops'], {}), '(*copy_ops)\n', (6808, 6819), True, 'import tensorflow as tf\n'), ((699, 715), 'threading.Lock', 'threading.Lock', ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (С) ABBYY (BIT Software), 1993 - 2019. All rights reserved.
"""
Скрипт для оценки результата работы сети (численно) и получения визуализаций
"""
import argparse
import logging
import os
import time
import numpy as np
from semantic_segmentation.data_generators impo... | [
"semantic_segmentation.net.NetManager",
"semantic_segmentation.model_runner.ModelRunner",
"os.makedirs",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.join",
"numpy.zeros",
"time.time",
"logging.info",
"semantic_segmentation.data_generators.BatchGenerator",
"semantic_segmentation.ne... | [((470, 495), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (493, 495), False, 'import argparse\n'), ((2927, 2964), 'os.makedirs', 'os.makedirs', (['args.dest'], {'exist_ok': '(True)'}), '(args.dest, exist_ok=True)\n', (2938, 2964), False, 'import os\n'), ((2970, 3031), 'logging.basicConfig', ... |
import os
import pickle
import kenlm
import numpy as np
from s2search.text import fix_text, fix_author_text
from s2search.features import make_features, posthoc_score_adjust
class S2Ranker:
"""A class to encapsulate the Semantic Scholar search ranker.
Arguments:
data_dir {str} -- where the language m... | [
"s2search.text.fix_author_text",
"s2search.features.posthoc_score_adjust",
"pickle.load",
"os.path.join",
"numpy.log1p"
] | [((641, 693), 'os.path.join', 'os.path.join', (['data_dir', '"""titles_abstracts_lm.binary"""'], {}), "(data_dir, 'titles_abstracts_lm.binary')\n", (653, 693), False, 'import os\n'), ((728, 771), 'os.path.join', 'os.path.join', (['data_dir', '"""authors_lm.binary"""'], {}), "(data_dir, 'authors_lm.binary')\n", (740, 77... |
import unittest
import numpy as np
from utils.trapezoidal_generator import TrapezoidalGenerator
class TestTrapezoidalGenerator(unittest.TestCase):
epsilon = 0.001
tg = TrapezoidalGenerator(dq_max=1, ddq_max=10)
def test_generator(self):
self.tg.set_limits(2, 2)
q_init = 0
q_final... | [
"utils.trapezoidal_generator.TrapezoidalGenerator",
"numpy.abs",
"numpy.array"
] | [((179, 221), 'utils.trapezoidal_generator.TrapezoidalGenerator', 'TrapezoidalGenerator', ([], {'dq_max': '(1)', 'ddq_max': '(10)'}), '(dq_max=1, ddq_max=10)\n', (199, 221), False, 'from utils.trapezoidal_generator import TrapezoidalGenerator\n'), ((347, 367), 'numpy.array', 'np.array', (['[1.0, 2.5]'], {}), '([1.0, 2.... |
"""
A class MinHashing that builds a minHash signature (in the form of a vector or a set) of a given length n
from a given set of integers (a set of hashed shingles).
"""
import numpy as np
import sympy
class MinHashing:
def __init__(self, seed=1337):
self.seed = seed
def _get_prime_above(self, n):... | [
"LSH.LSH",
"numpy.random.seed",
"DataLoader.DataLoader",
"numpy.ones_like",
"numpy.iinfo",
"sympy.nextprime",
"Shingling.Shingling",
"numpy.where",
"numpy.random.permutation"
] | [((3365, 3396), 'DataLoader.DataLoader', 'DataLoader', (['"""Data/bbc-text.csv"""'], {}), "('Data/bbc-text.csv')\n", (3375, 3396), False, 'from DataLoader import DataLoader\n'), ((3512, 3530), 'Shingling.Shingling', 'Shingling', (['docs', '(9)'], {}), '(docs, 9)\n', (3521, 3530), False, 'from Shingling import Shingling... |
import pandas as pd
import numpy as np
import statistics
import tensorflow
from tensorflow import keras
from numpy import asarray
from numpy import savetxt
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from keras.models import Sequential
from keras.preprocessing.image import ImageDataGenera... | [
"matplotlib.pyplot.title",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.argmax",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"keras.layers.Dropout",
"matplotlib.pyplot.ylabel",
"... | [((1379, 1451), 'pandas.read_csv', 'pd.read_csv', (['"""D:\\\\project\\\\feature_vectors_syscalls_frequency_5_Cat.csv"""'], {}), "('D:\\\\project\\\\feature_vectors_syscalls_frequency_5_Cat.csv')\n", (1390, 1451), True, 'import pandas as pd\n'), ((2122, 2183), 'sklearn.model_selection.train_test_split', 'train_test_spl... |
import warnings
import numpy as np
import nibabel as nib
from .base_extractor import BaseExtractor
from .utils import mask_data, label_timeseries
def _check_cifti(fname):
"""Verify that file is read as a cifti"""
img = nib.load(fname)
if not isinstance(img, nib.Cifti2Image):
raise ValueError(f'{f... | [
"nibabel.load",
"numpy.asarray",
"numpy.hstack",
"numpy.arange",
"warnings.warn"
] | [((230, 245), 'nibabel.load', 'nib.load', (['fname'], {}), '(fname)\n', (238, 245), True, 'import nibabel as nib\n'), ((3515, 3701), 'warnings.warn', 'warnings.warn', (['f"""dlabel has shape {dlabel.shape[1]} and dtseries has shape {dtseries.shape[1]}. Aligning files via brain structures present in each file. Double ch... |
import tensorflow as tf
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
import tflearn
import numpy as np
'''
Snake Neural Network
A simple neural network used to play the snake game
Current inputs:
1. Distance Left wall
2. Distance Top Wall... | [
"tflearn.layers.estimator.regression",
"tflearn.layers.core.input_data",
"tflearn.fully_connected",
"numpy.argmax",
"tflearn.layers.core.fully_connected",
"tflearn.DNN",
"numpy.array"
] | [((599, 638), 'numpy.array', 'np.array', (['[i[0] for i in training_data]'], {}), '([i[0] for i in training_data])\n', (607, 638), True, 'import numpy as np\n'), ((796, 849), 'tflearn.layers.core.input_data', 'input_data', ([], {'shape': '[None, input_size, 1]', 'name': '"""input"""'}), "(shape=[None, input_size, 1], n... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import platform
import sys
from subprocess import CalledProcessError
from subprocess import Popen
from subprocess import check_call
import numpy as np
from parsable import parsable
from treecat.conf... | [
"treecat.testutil.tempdir",
"os.environ.copy",
"numpy.ones",
"subprocess.CalledProcessError",
"treecat.training.train_ensemble",
"os.path.join",
"subprocess.check_call",
"os.path.abspath",
"treecat.format.pickle_dump",
"os.path.dirname",
"treecat.generate.generate_dataset_file",
"subprocess.Po... | [((489, 514), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (504, 514), False, 'import os\n'), ((527, 546), 'parsable.parsable.Parsable', 'parsable.Parsable', ([], {}), '()\n', (544, 546), False, 'from parsable import parsable\n'), ((746, 789), 'os.path.join', 'os.path.join', (['dirname', '"... |
'''This provides visualization tools for Keras.'''
import subprocess
import warnings
import numpy as np
from PIL import Image
from bokeh.plotting import (cursession, figure, output_server, show)
from keras.callbacks import Callback
from keras.preprocessing.image import load_img
class BokehCallback(Callback):
d... | [
"subprocess.Popen",
"bokeh.plotting.figure",
"bokeh.plotting.output_server",
"numpy.asarray",
"bokeh.plotting.cursession",
"numpy.zeros",
"numpy.clip",
"numpy.append",
"keras.preprocessing.image.load_img",
"keras.callbacks.Callback.__init__",
"numpy.array",
"bokeh.plotting.show",
"PIL.Image.... | [((7962, 7994), 'numpy.asarray', 'np.asarray', (['img'], {'dtype': '"""float32"""'}), "(img, dtype='float32')\n", (7972, 7994), True, 'import numpy as np\n'), ((10344, 10380), 'subprocess.Popen', 'subprocess.Popen', (["['shotwell', name]"], {}), "(['shotwell', name])\n", (10360, 10380), False, 'import subprocess\n'), (... |
# run with
# `mpirun -n n_proc python3 multi_send-recv.py int_flag`
# int_flag > 0 - use non-blocking recv
# int_flag = 0 - use blocking recv
import sys
import numpy as np
from mpi4py import MPI
def overlap_map(N, n):
"""
Returns the structured array of id pairs and labels.
Labels characterize the overla... | [
"numpy.full",
"mpi4py.MPI.Finalize",
"mpi4py.MPI.Wtime",
"numpy.rec.fromarrays",
"numpy.arange",
"numpy.row_stack",
"numpy.column_stack",
"sys.exit"
] | [((1974, 2004), 'numpy.full', 'np.full', (['pack_size', 'rank', '"""f8"""'], {}), "(pack_size, rank, 'f8')\n", (1981, 2004), True, 'import numpy as np\n'), ((2791, 2802), 'mpi4py.MPI.Wtime', 'MPI.Wtime', ([], {}), '()\n', (2800, 2802), False, 'from mpi4py import MPI\n'), ((3061, 3075), 'mpi4py.MPI.Finalize', 'MPI.Final... |
import numpy as np
class normalizer:
def __init__(self, size, eps=1e-2, default_clip_range=np.inf):
self.size = size
self.eps = eps
self.default_clip_range = default_clip_range
# some local information
self.local_sum = np.zeros(self.size, np.float32)
self.local_sumsq... | [
"numpy.square",
"numpy.zeros",
"numpy.ones",
"numpy.clip"
] | [((264, 295), 'numpy.zeros', 'np.zeros', (['self.size', 'np.float32'], {}), '(self.size, np.float32)\n', (272, 295), True, 'import numpy as np\n'), ((323, 354), 'numpy.zeros', 'np.zeros', (['self.size', 'np.float32'], {}), '(self.size, np.float32)\n', (331, 354), True, 'import numpy as np\n'), ((382, 405), 'numpy.zeros... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import shutil
import os
# Supress tensorflow interanal logs
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.layers.expe... | [
"os.mkdir",
"tensorflow.distribute.get_strategy",
"pandas.read_csv",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Sequential",
"shutil.rmtree",
"tensorflow.keras.callbacks.EarlyStopping",
"pandas.DataFrame",
"tensorflow.distribute.cluster_resolver.TPUClusterResolver",
"tensorflow.config.list... | [((692, 717), 'os.path.exists', 'os.path.exists', (['DIRECOTRY'], {}), '(DIRECOTRY)\n', (706, 717), False, 'import os\n'), ((781, 800), 'os.mkdir', 'os.mkdir', (['DIRECOTRY'], {}), '(DIRECOTRY)\n', (789, 800), False, 'import os\n'), ((801, 817), 'os.mkdir', 'os.mkdir', (['MODELS'], {}), '(MODELS)\n', (809, 817), False,... |
# encoding=utf8
import numpy as np
from datasets import load_metric
# the code below refers to the https://github.com/Yale-LILY/FeTaQA/blob/main/end2end/train.py
def postprocess_text(preds, references_s, metric_name):
preds = [pred.strip() for pred in preds]
references_s = [[reference.strip() for ref... | [
"numpy.mean",
"json.load",
"datasets.load_metric"
] | [((4371, 4383), 'json.load', 'json.load', (['f'], {}), '(f)\n', (4380, 4383), False, 'import json\n'), ((1656, 1680), 'datasets.load_metric', 'load_metric', (['metric_name'], {}), '(metric_name)\n', (1667, 1680), False, 'from datasets import load_metric\n'), ((4013, 4039), 'numpy.mean', 'np.mean', (['avg_bleurt_scores'... |
import numpy as np
import pandas as pd
from datetime import datetime
import pytest
import empyrical
from vectorbt import defaults
from vectorbt.records.drawdowns import Drawdowns
from tests.utils import isclose
day_dt = np.timedelta64(86400000000000)
index = pd.DatetimeIndex([
datetime(2018, 1, 1),
datetime... | [
"empyrical.tail_ratio",
"empyrical.excess_sharpe",
"empyrical.conditional_value_at_risk",
"numpy.isnan",
"pandas.DatetimeIndex",
"pytest.mark.parametrize",
"empyrical.value_at_risk",
"empyrical.beta",
"pandas.DataFrame",
"empyrical.omega_ratio",
"empyrical.downside_risk",
"empyrical.max_drawdo... | [((223, 253), 'numpy.timedelta64', 'np.timedelta64', (['(86400000000000)'], {}), '(86400000000000)\n', (237, 253), True, 'import numpy as np\n'), ((419, 516), 'pandas.DataFrame', 'pd.DataFrame', (["{'a': [1, 2, 3, 4, 5], 'b': [5, 4, 3, 2, 1], 'c': [1, 2, 3, 2, 1]}"], {'index': 'index'}), "({'a': [1, 2, 3, 4, 5], 'b': [... |
"""
********************************************
test_generator_moduL_formelfrage.py
@digitalfellowship - Stand 07/2021
Autor: <NAME>
********************************************
Dieses Modul dient der Erstellung der Formelfragen-GUI
sowie den Formelfragen in XML Struktur
"""
from tkinter import ttk
fro... | [
"Test_Generator_Module.test_generator_modul_datenbanken_erstellen.Import_Export_Database.excel_import_to_db",
"os.walk",
"Test_Generator_Module.test_generator_modul_taxonomie_und_textformatierung.Textformatierung.set_position_for_picture_1",
"Test_Generator_Module.test_generator_modul_taxonomie_und_textformat... | [((5633, 5680), 'sqlite3.connect', 'sqlite3.connect', (['self.database_formelfrage_path'], {}), '(self.database_formelfrage_path)\n', (5648, 5680), False, 'import sqlite3\n'), ((19804, 19853), 'sqlite3.connect', 'sqlite3.connect', (['self.test_settings_database_path'], {}), '(self.test_settings_database_path)\n', (1981... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 01:11:07 2020
@author: liorr
"""
import numpy as np
import warnings
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import pickle
from typing import List
import tensorflow as tf
class nn_Model:
def __init__(self,controller):
self.contro... | [
"tensorflow.keras.layers.sum",
"tensorflow.keras.models.load_model",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.AveragePooling1D",
"numpy.isinf",
"numpy.isnan",
"tensorflow.keras.models.Model",
"tensorflow.keras.backend.abs",
"tensorflow.keras.laye... | [((1347, 1400), 'tensorflow.keras.Sequential', 'tf.keras.Sequential', (['lstm_layers'], {'name': '"""Siamese-lstm"""'}), "(lstm_layers, name='Siamese-lstm')\n", (1366, 1400), True, 'import tensorflow as tf\n'), ((3629, 3681), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', ([], {'filepath': 'self.sc... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 16:12:22 2021
@author: aschauer
"""
import os
import logging
from collections import defaultdict
from matplotlib.transforms import Affine2D
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.metrics import r2_score, mean_squared_error
import mat... | [
"cv_results_database.get_cv_results_as_df",
"numpy.polyfit",
"sklearn.metrics.r2_score",
"collections.defaultdict",
"numpy.arange",
"matplotlib.legend_handler.HandlerTuple.__init__",
"matplotlib.pyplot.tight_layout",
"matplotlib.legend_handler.HandlerTuple",
"os.path.abspath",
"matplotlib.lines.Li... | [((604, 631), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (621, 631), False, 'import logging\n'), ((663, 698), 'seaborn.set_color_codes', 'sns.set_color_codes', ([], {'palette': '"""deep"""'}), "(palette='deep')\n", (682, 698), True, 'import seaborn as sns\n'), ((705, 727), 'cv_results... |
from argparse import ArgumentParser
from os import path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d import Axes3D, proj3d
import numpy
from plotypus.preprocessing import Fourier
from matplotlib import rc
rc('font', **... | [
"matplotlib.rc",
"mpl_toolkits.mplot3d.proj3d.proj_transform",
"argparse.ArgumentParser",
"numpy.linalg.lstsq",
"matplotlib.patches.FancyArrowPatch.draw",
"matplotlib.pyplot.close",
"plotypus.utils.make_sure_path_exists",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.array",
"numpy.loadtx... | [((74, 95), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (88, 95), False, 'import matplotlib\n'), ((307, 374), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (309, 374), False, 'from matplotlib import rc\n'), ((372, 395), 'mat... |
import logging
import numpy as np
import itertools
logger = logging.getLogger(__name__)
# #######################################
# ############ set_action ###############
# #######################################
def ctrl_set_action(sim, action):
"""
For torque actuators it copies the action into mujoco ct... | [
"numpy.abs",
"numpy.log",
"numpy.square",
"numpy.zeros",
"logging.getLogger",
"numpy.split",
"itertools.chain.from_iterable",
"numpy.concatenate"
] | [((61, 88), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (78, 88), False, 'import logging\n'), ((2162, 2208), 'numpy.concatenate', 'np.concatenate', (['[sim.data.qpos, sim.data.qvel]'], {}), '([sim.data.qpos, sim.data.qvel])\n', (2176, 2208), True, 'import numpy as np\n'), ((463, 504), ... |
import data.shaders.shader_program as sp
import data.tools.maths as m
import numpy
class skybox_shader(sp.ShaderProgram):
VERTEX_FILE = "data\\shaders\\skybox_vertex_shader.txt"
FRAGMENT_FILE = "data\\shaders\\skybox_fragment_shader.txt"
ROTATION_SPEED = 1.0
current_rotation = 0.0
def __init__(self):
... | [
"numpy.radians",
"data.tools.maths.Maths"
] | [((1890, 1926), 'numpy.radians', 'numpy.radians', (['self.current_rotation'], {}), '(self.current_rotation)\n', (1903, 1926), False, 'import numpy\n'), ((1691, 1700), 'data.tools.maths.Maths', 'm.Maths', ([], {}), '()\n', (1698, 1700), True, 'import data.tools.maths as m\n'), ((1873, 1882), 'data.tools.maths.Maths', 'm... |
import numpy as np
import matplotlib.pyplot as plt
plt.figure()
data = np.loadtxt("temperaturas.dat")
plt.show(data)
plt.savefig("calor.png") | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"numpy.loadtxt",
"matplotlib.pyplot.savefig"
] | [((57, 69), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (67, 69), True, 'import matplotlib.pyplot as plt\n'), ((77, 107), 'numpy.loadtxt', 'np.loadtxt', (['"""temperaturas.dat"""'], {}), "('temperaturas.dat')\n", (87, 107), True, 'import numpy as np\n'), ((108, 122), 'matplotlib.pyplot.show', 'plt.show'... |
"""
primitive plotting for ex2
"""
import numpy as np
import matplotlib.pyplot as plt
xs = {}
xs["n,g"] = np.loadtxt("ex2/rp082209.tot")
xs["n,n"] = np.loadtxt("ex2/rp082208.tot")
xs["n,2n"] = np.loadtxt("ex2/rp082207.tot")
exp = {}
exp["n,g"] = np.loadtxt("ng.exp")
fig, ax = plt.subplots()
ax.plot(xs["n,g"][:, 0]... | [
"matplotlib.pyplot.subplots",
"numpy.loadtxt",
"matplotlib.pyplot.show"
] | [((108, 138), 'numpy.loadtxt', 'np.loadtxt', (['"""ex2/rp082209.tot"""'], {}), "('ex2/rp082209.tot')\n", (118, 138), True, 'import numpy as np\n'), ((151, 181), 'numpy.loadtxt', 'np.loadtxt', (['"""ex2/rp082208.tot"""'], {}), "('ex2/rp082208.tot')\n", (161, 181), True, 'import numpy as np\n'), ((195, 225), 'numpy.loadt... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.patches as patches
import pylab
import glob
from scipy import interpolate
import math
#Let us begin with the discrete values
epsilon = np.arange(12, dtype= 'f')
epsilon[0] = 3.0
epsilon[1] = 8.0
epsilon[2] = 15.0
epsilon[3]... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.close",
"matplotlib.pyplot.text",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.xlabel",
... | [((232, 256), 'numpy.arange', 'np.arange', (['(12)'], {'dtype': '"""f"""'}), "(12, dtype='f')\n", (241, 256), True, 'import numpy as np\n'), ((503, 527), 'numpy.arange', 'np.arange', (['(12)'], {'dtype': '"""f"""'}), "(12, dtype='f')\n", (512, 527), True, 'import numpy as np\n'), ((745, 769), 'numpy.arange', 'np.arange... |
"""Automatic-differentiation-based initialization routines."""
import itertools
import numpy as np
from probnum import problems, randprocs, randvars
from ._interface import InitializationRoutine
# pylint: disable="import-outside-toplevel"
try:
import jax
from jax.config import config
from jax.experimen... | [
"jax.config.config.update",
"jax.jvp",
"jax.numpy.array",
"jax.jacrev",
"numpy.asarray",
"itertools.islice",
"jax.numpy.zeros",
"jax.jacfwd",
"jax.numpy.stack",
"jax.experimental.jet.jet"
] | [((372, 409), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (385, 409), False, 'from jax.config import config\n'), ((1434, 1475), 'jax.numpy.zeros', 'jnp.zeros', (['(mean.shape[0], mean.shape[0])'], {}), '((mean.shape[0], mean.shape[0]))\n', (1443, ... |
from .util import cos_sim, dot_score
from .faiss_index import FaissBinaryIndex
import logging
import sys
import torch
import faiss
import numpy as np
from typing import Dict, List
logger = logging.getLogger(__name__)
#Parent class for any dense model
class DenseRetrievalBinaryCodeSearch:
def __init__(self, m... | [
"numpy.vstack",
"faiss.IndexBinaryHash",
"logging.getLogger"
] | [((190, 217), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (207, 217), False, 'import logging\n'), ((2196, 2264), 'faiss.IndexBinaryHash', 'faiss.IndexBinaryHash', (['(corpus_embeddings.shape[1] * 8)', 'hash_num_bits'], {}), '(corpus_embeddings.shape[1] * 8, hash_num_bits)\n', (2217, 22... |
#-*- coding: utf-8 -*-
# 구현 대상
# https://github.com/jcjohnson/densecap/tree/master/eval
# 참고
# https://sites.google.com/site/hyunguk1986/personal-study/-ap-map-recall-precision
from metric.meteor import Meteor
import numpy as np
from ..utils.cython_bbox import bbox_overlaps
from ..datasets.visual_genome_l... | [
"numpy.average",
"numpy.ascontiguousarray",
"metric.meteor.Meteor",
"numpy.zeros"
] | [((3240, 3268), 'numpy.zeros', 'np.zeros', (['(pred_num, gt_num)'], {}), '((pred_num, gt_num))\n', (3248, 3268), True, 'import numpy as np\n'), ((846, 854), 'metric.meteor.Meteor', 'Meteor', ([], {}), '()\n', (852, 854), False, 'from metric.meteor import Meteor\n'), ((2178, 2227), 'numpy.ascontiguousarray', 'np.asconti... |
# 2020.06.05
# active learning: query by committee
# modified from Xiou
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from scipy.stats import entropy
import time
class QBC():
def __init__(self, learners, init=0.01, n_increment=200, n_iter=40, per... | [
"pickle.dump",
"numpy.sum",
"numpy.argmax",
"scipy.stats.entropy",
"sklearn.metrics.accuracy_score",
"numpy.unique",
"numpy.zeros",
"time.time",
"numpy.argsort",
"pickle.load",
"numpy.mean",
"sklearn.svm.SVC",
"numpy.delete",
"numpy.concatenate"
] | [((3867, 3902), 'sklearn.svm.SVC', 'SVC', ([], {'gamma': '"""auto"""', 'probability': '(True)'}), "(gamma='auto', probability=True)\n", (3870, 3902), False, 'from sklearn.svm import SVC\n'), ((680, 722), 'scipy.stats.entropy', 'entropy', (['prob'], {'base': 'self.num_class', 'axis': '(1)'}), '(prob, base=self.num_class... |
"""
This module contains relatively simple functions needed for calculation of mean-squared displacements (MSD) of atoms from series of time snapshots.
The "simple" means that functions do not use sophisticated algorithms for recognition of different diffusion modes,
and can be correctly applied only if the dependence ... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"copy.deepcopy",
"numpy.linalg.lstsq",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.array",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.round",
... | [((5980, 5991), 'md_format_converter_mi.structure', 'structure', ([], {}), '()\n', (5989, 5991), False, 'from md_format_converter_mi import structure\n'), ((6081, 6101), 'numpy.array', 'np.array', (['st.mark_at'], {}), '(st.mark_at)\n', (6089, 6101), True, 'import numpy as np\n'), ((6122, 6139), 'numpy.array', 'np.arra... |
import keras
from keras.models import load_model
import sys
import cv2
import numpy as np
x_test = np.zeros((0,4608))
model = load_model(r"D:\Code\Hackathons\BookJudger\NeuralNet\hdmodel.h5")
im = cv2.imread(sys.argv[1])
im = cv2.resize(im, (32, 48))
im = np.divide(im, 255)
im = im.flatten()
x_test = np.concatenate([x... | [
"keras.models.load_model",
"numpy.divide",
"numpy.concatenate",
"numpy.zeros",
"cv2.imread",
"cv2.resize"
] | [((100, 119), 'numpy.zeros', 'np.zeros', (['(0, 4608)'], {}), '((0, 4608))\n', (108, 119), True, 'import numpy as np\n'), ((127, 196), 'keras.models.load_model', 'load_model', (['"""D:\\\\Code\\\\Hackathons\\\\BookJudger\\\\NeuralNet\\\\hdmodel.h5"""'], {}), "('D:\\\\Code\\\\Hackathons\\\\BookJudger\\\\NeuralNet\\\\hdm... |
# -*- coding: utf-8 -*-
import os
from typing import Union, Iterable, List, Tuple
# from typing import Callable
import numpy as np
import networkx as nx
# from scipy.integrate import odeint
from scipy.integrate import solve_ivp
import dill
import re
import yaml
import itertools
from scipy.special import softmax
from mu... | [
"sklearn.datasets.load_iris",
"numpy.abs",
"numpy.sum",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"collections.defaultdict",
"sklearn.metrics.f1_score",
"numpy.mean",
"numpy.linalg.norm",
"numpy.exp",
"numpy.sin",
"yaml.safe_load",
"numpy.zeros_like",
"networkx.erdos_reny... | [((504, 542), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (["{'font.size': 14}"], {}), "({'font.size': 14})\n", (523, 542), True, 'import matplotlib as mpl\n'), ((24404, 24430), 'sklearn.datasets.load_iris', 'load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (24413, 24430), False, 'from sklear... |
import numpy as np
from lib.deriv.adtools import cstest
def squeeze(A,axis=None):
A = np.squeeze(A,axis=axis)
return A.item() if A.ndim==0 else A
def logsumexp(X, axis=0, keepdims = False, deriv=False):
"""
This is a complex-step friendly version of logsumexp.
"""
maxX = np.real(X).max(axis=a... | [
"lib.deriv.adtools.cstest",
"numpy.random.randn",
"numpy.isscalar",
"numpy.exp",
"numpy.real",
"numpy.squeeze"
] | [((91, 115), 'numpy.squeeze', 'np.squeeze', (['A'], {'axis': 'axis'}), '(A, axis=axis)\n', (101, 115), True, 'import numpy as np\n'), ((519, 532), 'numpy.exp', 'np.exp', (['(X - Y)'], {}), '(X - Y)\n', (525, 532), True, 'import numpy as np\n'), ((950, 961), 'numpy.random.randn', 'randn', (['(2)', '(3)'], {}), '(2, 3)\n... |
import logging
import re
import gensim
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
from gensim.models import doc2vec
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_... | [
"sklearn.ensemble.RandomForestClassifier",
"logging.basicConfig",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"numpy.zeros",
"logging.info",
"sklearn.metrics.f1_score",
"gensim.models.doc2vec.Doc2Vec",
"numpy.array",
"nltk.corpus.stopwords.wor... | [((337, 432), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.INFO)\n", (356, 432), False, 'import logging\n'), ((525, 568), 'pandas.read_csv', 'pd.read_cs... |
import networkx as nx
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
### requesting data via network
protein_list = ['TPH1','COMT','SLC18A2','HTR1B','HTR2C','HTR2A','MAOA',
'TPH2','HTR1A','HTR7','SLC6A4','GABBR2','POMC','GNAI3',
... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axis",
"networkx.draw_networkx",
"matplotlib.pyplot.figure",
"networkx.spring_layout",
"networkx.Graph",
"numpy.array",
"requests.get"
] | [((494, 511), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (506, 511), False, 'import requests\n'), ((808, 849), 'pandas.DataFrame', 'pd.DataFrame', (['data[1:-1]'], {'columns': 'data[0]'}), '(data[1:-1], columns=data[0])\n', (820, 849), True, 'import pandas as pd\n'), ((1156, 1198), 'networkx.Graph', 'nx.... |
# coding=utf-8
"""Text Classifier based on bert."""
from __future__ import absolute_import, division, print_function
import collections
import csv
import gc
import io
import logging
import math
import multiprocessing
import os
import pickle
import time
from multiprocessing import Pool, cpu_count
from multiprocessing.d... | [
"tensorflow.clip_by_value",
"modeling.BertModel",
"matplotlib.pyplot.figure",
"numpy.arange",
"tokenization.FullTokenizer",
"tensorflow.train.get_or_create_global_step",
"tensorflow.squeeze",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.grid",
"tensorflow.expand_dims",
"tensorflow.python_io.TFRe... | [((823, 834), 'multiprocessing.cpu_count', 'cpu_count', ([], {}), '()\n', (832, 834), False, 'from multiprocessing import Pool, cpu_count\n'), ((25365, 25394), 'sklearn.metrics.auc', 'sklearn.metrics.auc', (['fpr', 'tpr'], {}), '(fpr, tpr)\n', (25384, 25394), False, 'import sklearn\n'), ((25399, 25411), 'matplotlib.pyp... |
import numpy as np
import matplotlib.pyplot as plt
def plotLossGraph(loss_history, iter_count):
plt.figure()
plt.plot(np.arange(iter_count), loss_history)
plt.xlabel('Number of Iterations')
plt.ylabel('Loss')
plt.show()
| [
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((102, 114), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (112, 114), True, 'import matplotlib.pyplot as plt\n'), ((169, 203), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Number of Iterations"""'], {}), "('Number of Iterations')\n", (179, 203), True, 'import matplotlib.pyplot as plt\n'), ((208, 226)... |
"""
@version:
author:yunnaidan
@time: 2018/10/26
@file: PIdatabase.py
@function:
"""
import os
import time
import obspy
import numpy as np
from scipy.integrate import simps
from obspy.core.utcdatetime import UTCDateTime
import multiprocessing
from dyntripy.utils import psd, load_gf, gf
def psd_integral(pxx_all, f, f... | [
"dyntripy.utils.gf",
"os.path.exists",
"obspy.core.utcdatetime.UTCDateTime",
"time.sleep",
"numpy.where",
"dyntripy.utils.load_gf",
"dyntripy.utils.psd",
"multiprocessing.Pool",
"scipy.integrate.simps"
] | [((398, 435), 'numpy.where', 'np.where', (['((f >= f_min) & (f <= f_max))'], {}), '((f >= f_min) & (f <= f_max))\n', (406, 435), True, 'import numpy as np\n'), ((805, 842), 'scipy.integrate.simps', 'simps', (['pxx_tar_remove_response', 'f_tar'], {}), '(pxx_tar_remove_response, f_tar)\n', (810, 842), False, 'from scipy.... |
from .series import Series
from collections.abc import Iterable
import numpy as np
import pandas as pd
import random
class DataFrame:
def __init__(self, values, index=None, columns=None, copy=True):
self.dict = {}
l = 0
try:
if columns is not None:
for key in col... | [
"pandas.DataFrame",
"numpy.vectorize",
"numpy.empty",
"numpy.append",
"numpy.array"
] | [((7065, 7111), 'pandas.DataFrame', 'pd.DataFrame', (['self.dict', 'self.index'], {'copy': 'copy'}), '(self.dict, self.index, copy=copy)\n', (7077, 7111), True, 'import pandas as pd\n'), ((1460, 1486), 'numpy.array', 'np.array', (['index'], {'copy': 'copy'}), '(index, copy=copy)\n', (1468, 1486), True, 'import numpy as... |
import inspect
import tubular.testing.helpers as h
import tubular
import pandas as pd
import numpy as np
from unittest import mock
from _pytest.mark.structures import ParameterSet
def test_arguments():
"""Test arguments for arguments of tubular.testing.helpers.index_preserved_params."""
expected_arguments = ... | [
"pandas.DataFrame",
"unittest.mock.patch.object",
"numpy.random.seed",
"inspect.getfullargspec",
"tubular.testing.helpers.assert_equal_dispatch",
"tubular.testing.helpers.index_preserved_params",
"numpy.random.randint",
"pandas.concat"
] | [((361, 409), 'inspect.getfullargspec', 'inspect.getfullargspec', (['h.index_preserved_params'], {}), '(h.index_preserved_params)\n', (383, 409), False, 'import inspect\n'), ((1033, 1096), 'pandas.DataFrame', 'pd.DataFrame', (["{'a': [1, 2, 3], 'b': [4, 5, 6]}"], {'index': '[7, 8, 9]'}), "({'a': [1, 2, 3], 'b': [4, 5, ... |
import cv2 as cv
import numpy as np
from skimage.color import label2rgb
from skimage.morphology import diamond
from matching_pcb.image import to_rgb
def _color(mask, color):
return np.stack([mask * c for c in color], axis=2)
def draw_bbox(image, bbox, color=(255, 0, 0)):
x1, y1, w, h = list(map(int, bbox))... | [
"numpy.stack",
"numpy.zeros_like",
"skimage.color.label2rgb",
"cv2.dilate",
"skimage.morphology.diamond",
"matching_pcb.image.to_rgb",
"numpy.clip",
"cv2.rectangle",
"PIL.Image.fromarray",
"numpy.concatenate"
] | [((188, 233), 'numpy.stack', 'np.stack', (['[(mask * c) for c in color]'], {'axis': '(2)'}), '([(mask * c) for c in color], axis=2)\n', (196, 233), True, 'import numpy as np\n'), ((374, 410), 'cv2.rectangle', 'cv.rectangle', (['image', 'pt1', 'pt2', 'color'], {}), '(image, pt1, pt2, color)\n', (386, 410), True, 'import... |
#!/usr/local/bin/python
import argparse
import base64
import collections
import filecmp
import json
import logging
import ntpath
import numpy
import os
import re
import shutil
from io import BytesIO
from PIL import Image
from pxr import Usd, UsdGeom, Sdf, UsdShade, Gf, UsdSkel, Vt, Ar, UsdUtils
from _gltf2usd.gltf2... | [
"pxr.UsdSkel.DecomposeTransform",
"pxr.Vt.FloatArray",
"pxr.Ar.GetResolver",
"base64.b64decode",
"pxr.Vt.QuatfArray",
"os.path.isfile",
"numpy.arange",
"filecmp.cmp",
"os.path.join",
"pxr.UsdGeom.Xform.Define",
"pxr.Usd.ZipFile.Open",
"os.path.abspath",
"_gltf2usd.version.Version.get_version... | [((539, 573), '_gltf2usd.version.Version.get_version_name', 'version.Version.get_version_name', ([], {}), '()\n', (571, 573), False, 'from _gltf2usd import version\n'), ((1414, 1443), 'logging.getLogger', 'logging.getLogger', (['"""gltf2usd"""'], {}), "('gltf2usd')\n", (1431, 1443), False, 'import logging\n'), ((1539, ... |
from unittest.mock import patch
import numpy as np
import pytest
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QListWidget
from nexus_constructor.field_attrs import FieldAttrFrame, FieldAttrsDialog
from nexus_constructor.model.module import Dataset
from nexus_constructor.model.value_type import ValueTyp... | [
"nexus_constructor.field_attrs.FieldAttrsDialog",
"pytest.fixture",
"unittest.mock.patch",
"tests.ui_tests.ui_test_utils.show_and_close_window",
"numpy.ushort",
"numpy.arange",
"nexus_constructor.model.module.Dataset",
"numpy.array_equal"
] | [((931, 963), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (945, 963), False, 'import pytest\n'), ((1040, 1066), 'nexus_constructor.field_attrs.FieldAttrsDialog', 'FieldAttrsDialog', (['template'], {}), '(template)\n', (1056, 1066), False, 'from nexus_constructor.field_... |
import numpy as np
from samplers import *
from utils import *
from joblib import Parallel, delayed
'''
Attacks for the ARA approach to Adversarial Classification
'''
def compute_probability(x, params):
l = params["l"]
prb = np.zeros(l)
for c in range(l):
# Sample from p^*(x|x')
sample = pa... | [
"numpy.random.uniform",
"numpy.abs",
"numpy.argmax",
"numpy.zeros",
"numpy.expand_dims",
"numpy.ones",
"numpy.mean",
"numpy.array",
"joblib.Parallel",
"numpy.dot",
"joblib.delayed"
] | [((234, 245), 'numpy.zeros', 'np.zeros', (['l'], {}), '(l)\n', (242, 245), True, 'import numpy as np\n'), ((1625, 1639), 'numpy.array', 'np.array', (['atts'], {}), '(atts)\n', (1633, 1639), True, 'import numpy as np\n'), ((2817, 2831), 'numpy.array', 'np.array', (['atts'], {}), '(atts)\n', (2825, 2831), True, 'import n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.