code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import tensorflow as tf from tensorflow.keras.callbacks import LearningRateScheduler import numpy as np def step_decay_schedule(initial_lr=1e-3, decay_factor=0.75, step_size=10): ''' Wrapper function to create a LearningRateScheduler with step decay schedule. ''' def schedule(epoch): return in...
[ "numpy.floor", "tensorflow.keras.callbacks.LearningRateScheduler" ]
[((391, 422), 'tensorflow.keras.callbacks.LearningRateScheduler', 'LearningRateScheduler', (['schedule'], {}), '(schedule)\n', (412, 422), False, 'from tensorflow.keras.callbacks import LearningRateScheduler\n'), ((348, 375), 'numpy.floor', 'np.floor', (['(epoch / step_size)'], {}), '(epoch / step_size)\n', (356, 375),...
import numpy as np from keras.applications.vgg16 import VGG16 from keras.applications.vgg16 import preprocess_input as preprocess_input_vgg from keras.preprocessing import image from numpy import linalg as LA from common.const import input_shape class VGGNet: def __init__(self): self.input_shape = (224, 22...
[ "numpy.zeros", "numpy.expand_dims", "keras.preprocessing.image.img_to_array", "keras.preprocessing.image.load_img", "numpy.linalg.norm", "keras.applications.vgg16.VGG16", "keras.applications.vgg16.preprocess_input" ]
[((413, 567), 'keras.applications.vgg16.VGG16', 'VGG16', ([], {'weights': 'self.weight', 'input_shape': '(self.input_shape[0], self.input_shape[1], self.input_shape[2])', 'pooling': 'self.pooling', 'include_top': '(False)'}), '(weights=self.weight, input_shape=(self.input_shape[0], self.\n input_shape[1], self.input...
import cv2 import numpy as np img = cv2.imread('images/input.jpg') rows, cols = img.shape[:2] kernel_identity = np.array([[0,0,0], [0,1,0], [0,0,0]]) kernel_3x3 = np.ones((3,3), np.float32) / 9.0 kernel_5x5 = np.ones((5,5), np.float32) / 25.0 cv2.imshow('Original', img) #-1 for keep source image depth ou...
[ "cv2.filter2D", "cv2.waitKey", "numpy.ones", "cv2.imread", "numpy.array", "cv2.imshow" ]
[((40, 70), 'cv2.imread', 'cv2.imread', (['"""images/input.jpg"""'], {}), "('images/input.jpg')\n", (50, 70), False, 'import cv2\n'), ((120, 163), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 1, 0], [0, 0, 0]]'], {}), '([[0, 0, 0], [0, 1, 0], [0, 0, 0]])\n', (128, 163), True, 'import numpy as np\n'), ((256, 283), 'cv2...
import argparse import os # workaround to unpickle olf model files import sys from pdb import set_trace as bp import numpy as np import torch import gym import my_pybullet_envs import pybullet as p import time from a2c_ppo_acktr.envs import VecPyTorch, make_vec_envs from a2c_ppo_acktr.utils import get_render_func, g...
[ "numpy.load", "os.remove", "pybullet.resetSimulation", "argparse.ArgumentParser", "os.path.isfile", "pybullet.connect", "torch.no_grad", "os.path.join", "sys.path.append", "pybullet.getContactPoints", "pybullet.setGravity", "torch.load", "os.path.exists", "pybullet.setTimeStep", "torch.z...
[((460, 483), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (478, 483), False, 'import os\n'), ((2317, 2349), 'sys.path.append', 'sys.path.append', (['"""a2c_ppo_acktr"""'], {}), "('a2c_ppo_acktr')\n", (2332, 2349), False, 'import sys\n'), ((2359, 2400), 'argparse.ArgumentParser', 'argparse....
import numpy as np import gym import time from gym import error, spaces from gym import core, spaces from gym.envs.registration import register import random # from attn_toy.env.rendering import * from copy import copy class Fourrooms(object): # metadata = {'render.modes':['human']} # state : number of stat...
[ "numpy.random.uniform", "numpy.sum", "numpy.zeros", "gym.spaces.Discrete", "numpy.shape", "numpy.random.randint", "numpy.arange", "numpy.array", "numpy.random.choice" ]
[((1493, 1511), 'gym.spaces.Discrete', 'spaces.Discrete', (['(4)'], {}), '(4)\n', (1508, 1511), False, 'from gym import core, spaces\n'), ((1625, 1654), 'gym.spaces.Discrete', 'spaces.Discrete', (['self.num_pos'], {}), '(self.num_pos)\n', (1640, 1654), False, 'from gym import core, spaces\n'), ((1833, 1868), 'numpy.ran...
''' Usage: tflite_test.py --model="mymodel.tflite" Note: may require tensorflow > 1.11 or pip install tf-nightly ''' import os from docopt import docopt import tensorflow as tf import numpy as np from irmark1.utils import FPSTimer args = docopt(__doc__) in_model = os.path.expanduser(args['--model']) ...
[ "numpy.random.random_sample", "docopt.docopt", "tensorflow.lite.Interpreter", "os.path.expanduser", "irmark1.utils.FPSTimer" ]
[((255, 270), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (261, 270), False, 'from docopt import docopt\n'), ((283, 318), 'os.path.expanduser', 'os.path.expanduser', (["args['--model']"], {}), "(args['--model'])\n", (301, 318), False, 'import os\n'), ((376, 416), 'tensorflow.lite.Interpreter', 'tf.lite...
import torch import numpy as np import torch.nn.functional as F import pdb from analysis import entropy from utils.utils import to_sqnp from utils.constants import TZ_COND_DICT, P_TZ_CONDS from models import get_reward, compute_returns, compute_a2c_loss # from task.utils import scramble_array, scramble_array_list de...
[ "numpy.random.uniform", "utils.constants.TZ_COND_DICT.values", "utils.utils.to_sqnp", "torch.stack", "models.compute_a2c_loss", "models.get_reward", "torch.nn.functional.mse_loss", "numpy.zeros", "numpy.shape", "torch.squeeze", "models.compute_returns", "numpy.array", "numpy.random.choice", ...
[((779, 799), 'numpy.zeros', 'np.zeros', (['n_examples'], {}), '(n_examples)\n', (787, 799), True, 'import numpy as np\n'), ((4026, 4046), 'numpy.array', 'np.array', (['log_dist_a'], {}), '(log_dist_a)\n', (4034, 4046), True, 'import numpy as np\n'), ((4064, 4084), 'numpy.array', 'np.array', (['log_targ_a'], {}), '(log...
# ,---------------------------------------------------------------------------, # | This module is part of the krangpower electrical distribution simulation | # | suit by <NAME> <<EMAIL>> et al. | # | Please refer to the license file published together with this code. | # | All rights not explic...
[ "opendssdirect.Basic.Start", "opendssdirect.Circuit.AllElementNames", "opendssdirect.utils.run_command", "inspect.getmembers", "pandas.DataFrame", "numpy.multiply", "numpy.transpose", "opendssdirect.CktElement.NumTerminals", "numpy.reshape", "opendssdirect.Circuit.AllBusNames", "re.sub", "copy...
[((5079, 5103), 're.compile', '_re_compile', (['"""Disk Full"""'], {}), "('Disk Full')\n", (5090, 5103), True, 'from re import compile as _re_compile\n'), ((14372, 14401), 'inspect.getmembers', '_inspect_getmembers', (['_odr.dss'], {}), '(_odr.dss)\n', (14391, 14401), True, 'from inspect import getmembers as _inspect_g...
#!/usr/bin/env python # coding: utf-8 # ## Required Frameworks # In[ ]: import matplotlib.pyplot as plt from google.colab.patches import cv2_imshow import cv2 import numpy as np import pandas as pd from keras.models import Sequential from keras.utils import to_categorical from keras.optimizers import SGD, Adam f...
[ "cv2.GaussianBlur", "numpy.argmax", "pandas.read_csv", "sklearn.model_selection.train_test_split", "google.colab.patches.cv2_imshow", "keras.layers.MaxPool2D", "cv2.cvtColor", "keras.layers.Flatten", "numpy.reshape", "matplotlib.pyplot.subplots", "cv2.resize", "keras.utils.to_categorical", "...
[((1430, 1467), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)'}), '(X, y, test_size=0.2)\n', (1446, 1467), False, 'from sklearn.model_selection import train_test_split\n'), ((1481, 1535), 'numpy.reshape', 'np.reshape', (['train_x.values', '(train_x.shape[0], 28, 28)']...
import numpy as np import cv2 def detect(path): image = cv2.imread(path) orig = image.copy() (H, W) = image.shape[:2] (origH,origW) = (H,W) (newW, newH) = (320,320) rW = W / float(newW) rH = H / float(newH) image = cv2.resize(image, (newW, newH)) (H, W) = i...
[ "cv2.dnn.blobFromImage", "cv2.dnn.readNet", "cv2.imread", "numpy.sin", "numpy.cos", "cv2.resize" ]
[((67, 83), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (77, 83), False, 'import cv2\n'), ((273, 304), 'cv2.resize', 'cv2.resize', (['image', '(newW, newH)'], {}), '(image, (newW, newH))\n', (283, 304), False, 'import cv2\n'), ((436, 484), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""frozen_east_text_detecti...
import abc import itertools from typing import Any from torch import nn from torch.nn import functional as F from torch import optim import numpy as np import torch from torch import distributions from hw2.infrastructure import pytorch_util as ptu from hw2.policies.base_policy import BasePolicy from hw2.infrastructur...
[ "hw2.infrastructure.pytorch_util.from_numpy", "torch.nn.MSELoss", "torch.distributions.Categorical", "torch.exp", "torch.Tensor", "numpy.mean", "torch.distributions.MultivariateNormal", "hw2.infrastructure.pytorch_util.to_numpy", "torch.zeros", "torch.no_grad", "torch.sum", "hw2.infrastructure...
[((3409, 3436), 'hw2.infrastructure.pytorch_util.from_numpy', 'ptu.from_numpy', (['observation'], {}), '(observation)\n', (3423, 3436), True, 'from hw2.infrastructure import pytorch_util as ptu\n'), ((3540, 3560), 'hw2.infrastructure.pytorch_util.to_numpy', 'ptu.to_numpy', (['action'], {}), '(action)\n', (3552, 3560), ...
from __future__ import absolute_import import sys import os import argparse import time import datetime import shutil import numpy as np from PIL import Image from tqdm import tqdm import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.backends.cudnn as cudnn import torch.utils.d...
[ "numpy.random.seed", "argparse.ArgumentParser", "utils.logger.Logger", "torchvision.transforms.Normalize", "os.path.join", "validator.Validator", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "torchvision.transforms.ToTensor", "datetime.datetime.now", "torchvision.transforms.R...
[((546, 564), 'numpy.random.seed', 'np.random.seed', (['(40)'], {}), '(40)\n', (560, 564), True, 'import numpy as np\n'), ((565, 586), 'torch.manual_seed', 'torch.manual_seed', (['(40)'], {}), '(40)\n', (582, 586), False, 'import torch\n'), ((620, 693), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descr...
import matplotlib.pyplot as plt import numpy as np from scipy.integrate import odeint from matplotlib.animation import FuncAnimation from functools import partial #system def van_der_pol(coords, t, mu): x, y = coords[0::2], coords[1::2] y_prime = mu*(1-x**2)*y-x out = np.column_stack([y, y_prime]) retu...
[ "matplotlib.pyplot.xlim", "functools.partial", "matplotlib.pyplot.ylim", "matplotlib.pyplot.axes", "matplotlib.pyplot.scatter", "matplotlib.pyplot.figure", "numpy.array", "numpy.linspace", "numpy.column_stack" ]
[((734, 759), 'numpy.linspace', 'np.linspace', (['(-2.5)', '(2.5)', 'M'], {}), '(-2.5, 2.5, M)\n', (745, 759), True, 'import numpy as np\n'), ((773, 819), 'numpy.array', 'np.array', (['[(x, y) for x in axis for y in axis]'], {}), '([(x, y) for x in axis for y in axis])\n', (781, 819), True, 'import numpy as np\n'), ((9...
""" An example of RL training using StableBaselines3. python -m dedo.run_rl_sb3 --env=HangGarment-v1 --rl_algo PPO --logdir=/tmp/dedo tensorboard --logdir=/tmp/dedo --bind_all --port 6006 Play the saved policy (e.g. logged to PPO_210825_204955_HangGarment-v1): python -m dedo.run_rl_sb3 --env=HangGarment-v1 \ --p...
[ "stable_baselines3.common.env_util.make_vec_env", "dedo.utils.train_utils.init_train", "copy.deepcopy", "numpy.random.seed", "gym.make", "torch.random.manual_seed", "wandb.finish", "argparse.ArgumentParser", "dedo.utils.args.get_args_parser", "dedo.utils.args.get_args", "dedo.utils.rl_sb3_utils....
[((918, 962), 'os.path.join', 'os.path.join', (['args.load_checkpt', '"""agent.zip"""'], {}), "(args.load_checkpt, 'agent.zip')\n", (930, 962), False, 'import os\n'), ((1155, 1184), 'gym.make', 'gym.make', (['args.env'], {'args': 'args'}), '(args.env, args=args)\n', (1163, 1184), False, 'import gym\n'), ((1266, 1339), ...
import os import argparse import numpy as np import tensorflow as tf from epi.models import Parameter, Model from epi.STG_Circuit import NetworkFreq import time DTYPE = tf.float32 # Parse script command-line parameters. parser = argparse.ArgumentParser() parser.add_argument("--freq", type=float, default=0.55) # freq...
[ "argparse.ArgumentParser", "epi.STG_Circuit.NetworkFreq", "epi.models.Model", "numpy.array", "epi.models.Parameter" ]
[((231, 256), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (254, 256), False, 'import argparse\n'), ((976, 1016), 'epi.models.Parameter', 'Parameter', (['"""g_el"""', '(1)'], {'lb': 'g_el_lb', 'ub': '(8.0)'}), "('g_el', 1, lb=g_el_lb, ub=8.0)\n", (985, 1016), False, 'from epi.models import Pa...
import numpy as np import pytest from scipy.integrate._ivp import rk import probnum.problems.zoo.diffeq as diffeq_zoo from probnum import _randomvariablelist, diffeq @pytest.fixture def steprule(): return diffeq.stepsize.AdaptiveSteps(0.1, atol=1e-4, rtol=1e-4) @pytest.fixture def perturbed_solution(steprule):...
[ "probnum.diffeq.perturbed.scipy_wrapper.WrappedScipyRungeKutta", "probnum.problems.zoo.diffeq.lotkavolterra", "probnum.diffeq.stepsize.AdaptiveSteps", "numpy.random.default_rng", "probnum.diffeq.perturbed.step.PerturbedStepSolver", "numpy.array" ]
[((212, 272), 'probnum.diffeq.stepsize.AdaptiveSteps', 'diffeq.stepsize.AdaptiveSteps', (['(0.1)'], {'atol': '(0.0001)', 'rtol': '(0.0001)'}), '(0.1, atol=0.0001, rtol=0.0001)\n', (241, 272), False, 'from probnum import _randomvariablelist, diffeq\n'), ((330, 350), 'numpy.array', 'np.array', (['[0.1, 0.1]'], {}), '([0....
from __future__ import print_function, division, unicode_literals import numpy as np from psy import McmcHoDina from psy.utils import r4beta attrs = np.random.binomial(1, 0.5, (5, 60)) g = r4beta(1, 2, 0, 0.6, (1, 60)) no_s = r4beta(2, 1, 0.4, 1, (1, 60)) theta = np.random.normal(0, 1, (1000, 1)) lam00 = np.random.n...
[ "numpy.random.uniform", "psy.McmcHoDina", "numpy.random.binomial", "psy.utils.r4beta", "numpy.random.normal", "psy.McmcHoDina.get_skills_p" ]
[((150, 185), 'numpy.random.binomial', 'np.random.binomial', (['(1)', '(0.5)', '(5, 60)'], {}), '(1, 0.5, (5, 60))\n', (168, 185), True, 'import numpy as np\n'), ((191, 220), 'psy.utils.r4beta', 'r4beta', (['(1)', '(2)', '(0)', '(0.6)', '(1, 60)'], {}), '(1, 2, 0, 0.6, (1, 60))\n', (197, 220), False, 'from psy.utils im...
#!/usr/bin/python3 import itertools import os import sys from pathlib import Path import numpy as np from PIL import Image np.set_printoptions(threshold=sys.maxsize) np.set_printoptions(linewidth=1000) script_dir = os.path.dirname(__file__) images_dir = os.path.join(script_dir, "images") images = [os.path.join(ima...
[ "numpy.set_printoptions", "os.makedirs", "os.path.dirname", "os.path.exists", "numpy.zeros", "PIL.Image.open", "pathlib.Path", "numpy.array", "os.path.join", "os.listdir" ]
[((127, 169), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (146, 169), True, 'import numpy as np\n'), ((170, 205), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(1000)'}), '(linewidth=1000)\n', (189, 205), True, 'import numpy as...
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
[ "numpy.stack", "functools.partial", "numpy.meshgrid", "numpy.prod", "numpy.sin", "numpy.linspace", "numpy.cos", "numpy.broadcast_to", "numpy.concatenate" ]
[((3534, 3573), 'numpy.meshgrid', 'np.meshgrid', (['*dim_ranges'], {'indexing': '"""ij"""'}), "(*dim_ranges, indexing='ij')\n", (3545, 3573), True, 'import numpy as np\n'), ((3586, 3621), 'numpy.stack', 'np.stack', (['array_index_grid'], {'axis': '(-1)'}), '(array_index_grid, axis=-1)\n', (3594, 3621), True, 'import nu...
# 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 os import pickle import numpy as np import torch import torch.nn.parallel import torch.utils.data as data class _OneHotIterator: ...
[ "numpy.ones", "numpy.random.RandomState", "numpy.random.randint", "torch.zeros", "torch.from_numpy" ]
[((1170, 1197), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (1191, 1197), True, 'import numpy as np\n'), ((1074, 1093), 'numpy.ones', 'np.ones', (['n_features'], {}), '(n_features)\n', (1081, 1093), True, 'import numpy as np\n'), ((1543, 1557), 'torch.zeros', 'torch.zeros', (['(1)']...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os.path import sys import time from six.moves import xrange import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import math import numpy as np import str...
[ "tensorflow.gfile.Exists", "argparse.ArgumentParser", "tensorflow.matmul", "tensorflow.global_variables", "tensorflow.Variable", "numpy.set_printoptions", "struct.pack", "tensorflow.cast", "tensorflow.placeholder", "tensorflow.summary.FileWriter", "tensorflow.gfile.DeleteRecursively", "tensorf...
[((1200, 1297), 'tensorflow.nn.sparse_softmax_cross_entropy_with_logits', 'tf.nn.sparse_softmax_cross_entropy_with_logits', ([], {'labels': 'labels', 'logits': 'logits', 'name': '"""xentropy"""'}), "(labels=labels, logits=logits,\n name='xentropy')\n", (1246, 1297), True, 'import tensorflow as tf\n'), ((1303, 1354),...
from PyQt5.uic import loadUi from PyQt5.QtWidgets import QWidget, QApplication, QMessageBox, QFileDialog, QMessageBox, QDesktopWidget from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtGui import QIntValidator, QDoubleValidator from PyQt5.QtTest import QTest import sys import numpy as np import copy import time from ...
[ "PyQt5.QtWidgets.QDesktopWidget", "PyQt5.QtWidgets.QApplication.setAttribute", "PyQt5.QtGui.QDoubleValidator", "numpy.interp", "PyQt5.uic.loadUi", "PyQt5.QtWidgets.QMessageBox.warning", "PyQt5.QtWidgets.QWidget.__init__", "PyQt5.QtWidgets.QFileDialog.getSaveFileName", "numpy.max", "xraydb.XrayDB",...
[((5303, 5325), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (5315, 5325), False, 'from PyQt5.QtWidgets import QWidget, QApplication, QMessageBox, QFileDialog, QMessageBox, QDesktopWidget\n'), ((5942, 5995), 'PyQt5.QtWidgets.QApplication.setAttribute', 'QApplication.setAttribute',...
import math import csv import numpy as np from random import shuffle # Sigmoidfunktion als Aktivierungsfunktion def sigmoid(x): try: return 1 / (1 + math.exp(-x)) except OverflowError: return 0 # Künstliches neuronales Netzwerk class NeuralNetwork: # Attribute: # - Anzahl Neuronen der...
[ "math.exp", "csv.reader", "numpy.vectorize", "random.shuffle", "numpy.array", "numpy.random.rand", "numpy.dot" ]
[((5305, 5320), 'random.shuffle', 'shuffle', (['irises'], {}), '(irises)\n', (5312, 5320), False, 'from random import shuffle\n'), ((1121, 1142), 'numpy.vectorize', 'np.vectorize', (['sigmoid'], {}), '(sigmoid)\n', (1133, 1142), True, 'import numpy as np\n'), ((2362, 2380), 'numpy.array', 'np.array', (['y_spread'], {})...
import io import os import xml.etree.ElementTree import requests import hashlib import logging import urllib import numpy as np import wave import shutil from operator import itemgetter from PIL import Image from urllib.parse import urlparse from nltk.tokenize import WhitespaceTokenizer logger = logging.getLogger(__...
[ "wave.open", "urllib.parse.unquote", "os.makedirs", "os.path.basename", "numpy.roll", "urllib.parse.urlparse", "os.path.exists", "logging.getLogger", "PIL.Image.open", "os.environ.get", "requests.get", "io.open", "nltk.tokenize.WhitespaceTokenizer", "operator.itemgetter", "os.path.join",...
[((300, 327), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (317, 327), False, 'import logging\n'), ((2765, 2796), 'os.environ.get', 'os.environ.get', (['"""LS_UPLOAD_DIR"""'], {}), "('LS_UPLOAD_DIR')\n", (2779, 2796), False, 'import os\n'), ((4415, 4449), 'os.path.join', 'os.path.join',...
import typing import sys import numpy as np import numba as nb import scipy.ndimage def solve(grid: np.ndarray, k: int) -> typing.NoReturn: a = np.pad(grid, pad_width=1, constant_values=0) cdt = scipy.ndimage.distance_transform_cdt( input=a, metric='taxicab', ) print(np.count_nonzero(cdt >= k)) ...
[ "numpy.pad", "numpy.count_nonzero", "numpy.zeros" ]
[((152, 196), 'numpy.pad', 'np.pad', (['grid'], {'pad_width': '(1)', 'constant_values': '(0)'}), '(grid, pad_width=1, constant_values=0)\n', (158, 196), True, 'import numpy as np\n'), ((558, 584), 'numpy.zeros', 'np.zeros', (['(h, w)', 'np.int64'], {}), '((h, w), np.int64)\n', (566, 584), True, 'import numpy as np\n'),...
import numpy as np def mask_sum(m): m1 = np.ones(m.shape, np.int8) m1[np.logical_not(m)] = 0 return m1.sum() def estimate_accuracy (method, test_img, standard_img): result = method.apply(test_img) coincidence = mask_sum(np.bitwise_and(result, standard_img)) mistake = mask_sum(np.bitwise_and(...
[ "numpy.bitwise_and", "numpy.logical_not", "numpy.bitwise_not", "numpy.ones" ]
[((47, 72), 'numpy.ones', 'np.ones', (['m.shape', 'np.int8'], {}), '(m.shape, np.int8)\n', (54, 72), True, 'import numpy as np\n'), ((80, 97), 'numpy.logical_not', 'np.logical_not', (['m'], {}), '(m)\n', (94, 97), True, 'import numpy as np\n'), ((244, 280), 'numpy.bitwise_and', 'np.bitwise_and', (['result', 'standard_i...
############################################################################### # PyDial: Multi-domain Statistical Spoken Dialogue System Software ############################################################################### # # Copyright 2015 - 2018 # Cambridge University Engineering Department Dialogue Systems Grou...
[ "ontology.FlatOntologyManager.FlatDomainOntology", "policy.feudalRL.feudalUtils.get_feudal_masks", "numpy.sum", "utils.Settings.config.getint", "numpy.argmax", "utils.Settings.config.has_option", "utils.DiaAct.DiaAct", "utils.Settings.config.get", "policy.feudalRL.DIP_parametrisation.padded_state", ...
[((2610, 2643), 'utils.ContextLogger.getLogger', 'utils.ContextLogger.getLogger', (['""""""'], {}), "('')\n", (2639, 2643), False, 'import utils\n'), ((2971, 3016), 'ontology.FlatOntologyManager.FlatDomainOntology', 'FlatOnt.FlatDomainOntology', (['self.domainString'], {}), '(self.domainString)\n', (2997, 3016), True, ...
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import numpy as np from scipy.ndimage.filters import uniform_filter1d from scipy.ndimage.fourier import fourier_gaussian from .utils import print_update, validate_tuple # When loading module, try t...
[ "numpy.asarray", "numpy.iinfo", "numpy.where", "scipy.ndimage.filters.uniform_filter1d", "pyfftw.interfaces.numpy_fft.fftn", "pyfftw.interfaces.cache.enable", "pyfftw.n_byte_align", "pyfftw.interfaces.numpy_fft.ifftn", "numpy.issubdtype" ]
[((560, 592), 'pyfftw.interfaces.cache.enable', 'pyfftw.interfaces.cache.enable', ([], {}), '()\n', (590, 592), False, 'import pyfftw\n'), ((2389, 2406), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (2399, 2406), True, 'import numpy as np\n'), ((2705, 2744), 'numpy.where', 'np.where', (['(result > thres...
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # import plotly.graph_objs as go pd.options.display.max_columns = 7 pd.options.display.max_rows = 7 # %% Data Analysis data = pd.read_csv('D:/Masaüstüm/Projects/PythonProjects/Regression Types/K Nearest Neighbors/cancer_data...
[ "matplotlib.pyplot.show", "pandas.read_csv", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "sklearn.neighbors.KNeighborsClassifier", "matplotlib.pyplot.figure", "numpy.min", "numpy.max", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel"...
[((222, 336), 'pandas.read_csv', 'pd.read_csv', (['"""D:/Masaüstüm/Projects/PythonProjects/Regression Types/K Nearest Neighbors/cancer_data.csv"""'], {}), "(\n 'D:/Masaüstüm/Projects/PythonProjects/Regression Types/K Nearest Neighbors/cancer_data.csv'\n )\n", (233, 336), True, 'import pandas as pd\n'), ((2182, 22...
import math import scipy.optimize import pandas as pd import numpy as np # Goal: Fit data to find three parameters # Goal: optimize ref resistor value # Goal: make sure min and max within range # Goal: make sure min and max +/-1C detectable class Thermistor: """ Thermistor model class. """ def __init__(sel...
[ "numpy.array" ]
[((340, 372), 'numpy.array', 'np.array', (['[0.003354, 0.00025, 0]'], {}), '([0.003354, 0.00025, 0])\n', (348, 372), True, 'import numpy as np\n')]
import numpy as np import pandas as pd from tqdm import tqdm from collections import Counter class AutoDatatyper(object): def __init__(self, vector_dim=300, num_rows=1000): self.vector_dim = vector_dim self.num_rows = num_rows self.decode_dict = {0: 'numeric', 1: 'character', 2: 'time', 3: ...
[ "numpy.vectorize", "numpy.array", "pandas.Series", "numpy.random.choice", "collections.Counter", "numpy.concatenate" ]
[((2943, 2990), 'numpy.random.choice', 'np.random.choice', (['choice_range', 'self.vector_dim'], {}), '(choice_range, self.vector_dim)\n', (2959, 2990), True, 'import numpy as np\n'), ((6439, 6466), 'numpy.concatenate', 'np.concatenate', (['concat_list'], {}), '(concat_list)\n', (6453, 6466), True, 'import numpy as np\...
try: import cv2 import numpy as np except ImportError as e: from pip._internal import main as install packages = ["numpy", "opencv-python"] for package in packages: install(["install", package]) finally: pass # Import the image Stack function from utils.stackimages import stackImages de...
[ "cv2.createTrackbar", "cv2.putText", "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "numpy.zeros", "utils.stackimages.stackImages", "cv2.imread", "pip._internal.main", "numpy.array", "cv2.getTrackbarPos", "cv2.resizeWindow", "cv2.imshow", "cv2.inRange", "cv2.namedWindow" ]
[((359, 398), 'numpy.zeros', 'np.zeros', (['[500, 500, 3]'], {'dtype': 'np.uint8'}), '([500, 500, 3], dtype=np.uint8)\n', (367, 398), True, 'import numpy as np\n'), ((439, 467), 'cv2.namedWindow', 'cv2.namedWindow', (['"""TrackBars"""'], {}), "('TrackBars')\n", (454, 467), False, 'import cv2\n'), ((472, 511), 'cv2.resi...
import os import argparse import torch import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np from models import ArcBinaryClassifier from batcher import Batcher parser = argparse.ArgumentParser() parser.add_argument('--batchSize', type=int, default=128, help='input batch size') parser.add_argume...
[ "os.makedirs", "argparse.ArgumentParser", "numpy.ma.masked_where", "matplotlib.pyplot.subplots", "models.ArcBinaryClassifier", "batcher.Batcher", "os.path.join" ]
[((194, 219), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (217, 219), False, 'import argparse\n'), ((1689, 1728), 'os.path.join', 'os.path.join', (['"""visualization"""', 'opt.name'], {}), "('visualization', opt.name)\n", (1701, 1728), False, 'import os\n'), ((1729, 1768), 'os.makedirs', 'os...
# -*- coding:utf-8 -*- __author__ = 'ljq' import heapq import multiprocessing import logging import gensim import json import os import torch import numpy as np from collections import OrderedDict from gensim.models import word2vec TEXT_DIR = '../data/content.txt' METADATA_DIR = '../data/metadata.tsv' def logger_f...
[ "logging.getLogger", "json.dumps", "logging.Formatter", "numpy.argsort", "os.path.isfile", "numpy.arange", "gensim.models.word2vec.Word2Vec.load", "gensim.models.Word2Vec.load", "multiprocessing.cpu_count", "logging.FileHandler", "json.loads", "os.path.dirname", "os.path.exists", "heapq.nl...
[((374, 397), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (391, 397), False, 'import logging\n'), ((439, 466), 'os.path.dirname', 'os.path.dirname', (['input_file'], {}), '(input_file)\n', (454, 466), False, 'import os\n'), ((541, 582), 'logging.FileHandler', 'logging.FileHandler', (['input_fi...
OIMI_R1_txt = ''' 0.2225 0.2540 0.2978 0.3302 0.3702 0.3859 0.3975 0.4020 ''' OIMI_T_txt = ''' 1.29 1.37 1.47 1.96 2.99 4.33 8.7 12.9 ''' IVF2M_R1_txt = ''' 0.2548 0.2992 0.3526 0.3805 0.4138 0.4247 0.4323 0.4355 ''' IVF2M_T_txt = ''' 0.33 0.34 0.45 0.55 1.01 1.52 2.67 3.85 ''' IVF4M_R1_txt = ''' 0.2855 0.3302 0.3739...
[ "matplotlib.backends.backend_pdf.PdfPages", "matplotlib.pyplot.plot", "matplotlib.pyplot.axis", "seaborn.despine", "matplotlib.pyplot.figure", "re.findall", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "seaborn.set" ]
[((831, 869), 'seaborn.set', 'sns.set', ([], {'style': '"""ticks"""', 'palette': '"""Set2"""'}), "(style='ticks', palette='Set2')\n", (838, 869), True, 'import seaborn as sns\n'), ((870, 883), 'seaborn.despine', 'sns.despine', ([], {}), '()\n', (881, 883), True, 'import seaborn as sns\n'), ((938, 972), 're.findall', 'r...
import numpy as np # this module is useful to work with numerical arrays from tqdm import tqdm # this module is useful to plot progress bars import torch import torchvision from torchvision import transforms from torch.utils.data import random_split from torch import nn import torch.optim as optim data_dir = 'dataset'...
[ "torch.cat", "numpy.mean", "torch.device", "torch.no_grad", "torch.nn.MSELoss", "torch.nn.Unflatten", "torch.utils.data.DataLoader", "torchvision.transforms.ToTensor", "torch.nn.LayerNorm", "torch.nn.Linear", "tqdm.tqdm", "torch.manual_seed", "torch.nn.Conv2d", "torch.nn.BatchNorm2d", "t...
[((483, 547), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', (['data_dir'], {'train': '(True)', 'download': '(False)'}), '(data_dir, train=True, download=False)\n', (509, 547), False, 'import torchvision\n'), ((564, 629), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', (['data_dir'], {'train': ...
import numpy from .ltl_nodes import build_tree class HypothesisTester(object): """Test a hypothesis about a property based on random samples. The test is posed as follows. The null hypothesis H0 is that P_{satisfied} >= prob, and the alternative hypothesis is that P_{satisfied} < prob. The parameter ...
[ "numpy.log" ]
[((1123, 1162), 'numpy.log', 'numpy.log', (['((1 - self.beta) / self.alpha)'], {}), '((1 - self.beta) / self.alpha)\n', (1132, 1162), False, 'import numpy\n'), ((1183, 1222), 'numpy.log', 'numpy.log', (['(self.beta / (1 - self.alpha))'], {}), '(self.beta / (1 - self.alpha))\n', (1192, 1222), False, 'import numpy\n'), (...
from pathlib import Path from contextlib import contextmanager import numpy as np from ._version import get_versions from .array import Array, MetaData, asarray, \ check_accessmode, delete_array, create_array, \ truncate_array from .datadir import DataDir, create_datadir from .metadata import MetaData from .r...
[ "numpy.array", "numpy.asarray", "pathlib.Path", "numpy.zeros" ]
[((8311, 8321), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (8315, 8321), False, 'from pathlib import Path\n'), ((10976, 11004), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'dtype'}), '(shape, dtype=dtype)\n', (10984, 11004), True, 'import numpy as np\n'), ((4804, 4839), 'numpy.asarray', 'np.asarray', (['a...
import numpy as np from scipy.ndimage import affine_transform from PIL import Image import random import pickle from tensorflow import keras import os import math from matplotlib import pyplot as plt data_dir = "../Dataset/train" nb_classes = 5004 def rgb2ycbcr(image): """Transfer RGB image to YCbCr. ...
[ "matplotlib.pyplot.title", "pandas.read_csv", "random.shuffle", "numpy.mean", "pickle.load", "numpy.sin", "numpy.random.randint", "tensorflow.keras.preprocessing.image.array_to_img", "tensorflow.keras.backend.epsilon", "os.path.join", "numpy.std", "matplotlib.pyplot.show", "tensorflow.keras....
[((1004, 1039), 'numpy.concatenate', 'np.concatenate', (['(Y, Cb, Cr)'], {'axis': '(2)'}), '((Y, Cb, Cr), axis=2)\n', (1018, 1039), True, 'import numpy as np\n'), ((1317, 1337), 'numpy.deg2rad', 'np.deg2rad', (['rotation'], {}), '(rotation)\n', (1327, 1337), True, 'import numpy as np\n'), ((1350, 1367), 'numpy.deg2rad'...
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from sklearn.model_selection import train_test_split def extract_repair_sequence(seq): """ Extract the sequence of node repairs """ sort_seq = seq.sort() repair_seq_order = sort_seq[0][sort_seq[0] != 0] repair_seq_nodes...
[ "matplotlib.pyplot.show", "numpy.count_nonzero", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "tensorflow.keras.layers.Dense", "sklearn.model_selection.train_test_split", "tensorflow.keras.losses.MeanAbsoluteError", "matplotlib.pyplot.figure", "tensorflow.keras.optimizers.Adam" ]
[((1556, 1604), 'sklearn.model_selection.train_test_split', 'train_test_split', (['self.X', 'self.y'], {'random_state': '(0)'}), '(self.X, self.y, random_state=0)\n', (1572, 1604), False, 'from sklearn.model_selection import train_test_split\n'), ((1653, 1711), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.A...
from pymaster import nmtlib as lib import numpy as np class NmtCovarianceWorkspace(object) : """ NmtCovarianceWorkspace objects are used to compute and store the coupling coefficients needed to calculate the Gaussian covariance matrix under the Efstathiou approximation (astro-ph/0307515). When initialized, thi...
[ "pymaster.nmtlib.read_covar_workspace_flat", "pymaster.nmtlib.write_covar_workspace_flat", "pymaster.nmtlib.write_covar_workspace", "pymaster.nmtlib.covar_workspace_free", "pymaster.nmtlib.covar_workspace_init_py", "pymaster.nmtlib.read_covar_workspace", "pymaster.nmtlib.comp_gaussian_covariance_flat", ...
[((5853, 5940), 'pymaster.nmtlib.comp_gaussian_covariance', 'lib.comp_gaussian_covariance', (['cw.wsp', 'cla1b1', 'cla1b2', 'cla2b1', 'cla2b2', '(len_a * len_b)'], {}), '(cw.wsp, cla1b1, cla1b2, cla2b1, cla2b2, len_a *\n len_b)\n', (5881, 5940), True, 'from pymaster import nmtlib as lib\n'), ((5940, 5975), 'numpy.re...
import numpy as np import matplotlib.pyplot as plt def merge_bboxes(bboxes): max_x1y1x2y2 = [np.inf, np.inf, -np.inf, -np.inf] for bbox in bboxes: max_x1y1x2y2 = [min(max_x1y1x2y2[0], bbox[0]), min(max_x1y1x2y2[1], bbox[1]), max(max_x1y1x2y2[2], bbox[2]+bbox[0]), max(max_x1y1x2y...
[ "numpy.argmax", "matplotlib.pyplot.imshow", "numpy.asarray", "matplotlib.pyplot.scatter", "matplotlib.pyplot.axis", "numpy.argmin", "matplotlib.pyplot.text", "matplotlib.pyplot.figure", "numpy.min", "numpy.max", "numpy.logical_or", "numpy.arange" ]
[((1206, 1230), 'numpy.argmin', 'np.argmin', (['eyes_ys_valid'], {}), '(eyes_ys_valid)\n', (1215, 1230), True, 'import numpy as np\n'), ((1265, 1291), 'numpy.argmax', 'np.argmax', (['ankles_ys_valid'], {}), '(ankles_ys_valid)\n', (1274, 1291), True, 'import numpy as np\n'), ((666, 694), 'matplotlib.pyplot.figure', 'plt...
#!/usr/bin/env python3 # 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 argparse import logging import os from pathlib import Path import shutil from itertools import groupby from temp...
[ "pathlib.Path.exists", "yaml.load", "argparse.ArgumentParser", "examples.speech_to_text.data_utils.gen_config_yaml", "pathlib.Path", "examples.speech_to_text.data_utils.filter_manifest_df", "shutil.rmtree", "examples.speech_to_text.data_utils.save_df_to_tsv", "os.path.exists", "torchaudio.sox_effe...
[((741, 768), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (758, 768), False, 'import logging\n'), ((12013, 12301), 'examples.speech_to_text.data_utils.gen_config_yaml', 'gen_config_yaml', (['output_root', "(spm_filename_prefix + '.model')"], {'yaml_filename': 'yaml_filename', 'specaugm...
"""Randomly assign a target class for each victim data. This file is for distributed attacking. """ import os import pdb import time import copy from tqdm import tqdm import argparse import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.backends...
[ "argparse.ArgumentParser", "model.PointNetCls", "model.PointNet2ClsSsg", "attack.FarChamferDist", "torch.no_grad", "os.path.join", "sys.path.append", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "dataset.ModelNet40Attack", "torch.utils.data.distributed.DistributedSampler", ...
[((544, 566), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (559, 566), False, 'import sys\n'), ((1087, 1104), 'tqdm.tqdm', 'tqdm', (['test_loader'], {}), '(test_loader)\n', (1091, 1104), False, 'from tqdm import tqdm\n'), ((1652, 1686), 'numpy.concatenate', 'np.concatenate', (['all_adv_pc'], ...
import cv2 import numpy as np import tensorflow as tf PB_PATH = '/home/opencv-mds/models/frozen_inference_graph.pb' VIDEO_PATH = '/home/opencv-mds/OpenCV_in_Ubuntu/Data/Lane_Detection_Videos/challenge.mp4' def import_graph(PATH_TO_FTOZEN_PB): detection_graph = tf.Graph() with detection_graph.as_default(): ...
[ "numpy.copy", "cv2.cvtColor", "tensorflow.Session", "numpy.expand_dims", "cv2.imshow", "tensorflow.get_default_graph", "cv2.VideoCapture", "tensorflow.gfile.GFile", "tensorflow.Graph", "cv2.VideoWriter", "tensorflow.import_graph_def", "tensorflow.GraphDef", "cv2.destroyAllWindows", "cv2.na...
[((267, 277), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (275, 277), True, 'import tensorflow as tf\n'), ((688, 726), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2RGB'], {}), '(image, cv2.COLOR_BGR2RGB)\n', (700, 726), False, 'import cv2\n'), ((828, 857), 'numpy.expand_dims', 'np.expand_dims', (['im...
"""Methods for processing OPA 800 tuning data.""" import numpy as np import WrightTools as wt from ._discrete_tune import DiscreteTune from ._instrument import Instrument from ._transition import Transition from ._plot import plot_tune_test from ._common import save from ._map import map_ind_points __all__ = ["tun...
[ "WrightTools.kit.get_index", "numpy.allclose", "WrightTools.kit.Spline", "numpy.nanmax" ]
[((652, 697), 'numpy.allclose', 'np.allclose', (['data.axes[0].points', 'tune_points'], {}), '(data.axes[0].points, tune_points)\n', (663, 697), True, 'import numpy as np\n'), ((774, 825), 'numpy.allclose', 'np.allclose', (['data.axes[0].points', 'tune_points[::-1]'], {}), '(data.axes[0].points, tune_points[::-1])\n', ...
# Copyright 2017 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 required by applica...
[ "tensorflow.contrib.layers.flatten", "tensorflow.python.ops.metrics.mean_squared_error", "tensorflow.python.training.training.GradientDescentOptimizer", "shutil.rmtree", "six.iterkeys", "tempfile.mkdtemp", "tensorflow.python.estimator.inputs.numpy_io.numpy_input_fn", "tensorflow.python.summary.writer....
[((2039, 2065), 'tensorflow.contrib.layers.flatten', 'layers.flatten', (['input_data'], {}), '(input_data)\n', (2053, 2065), False, 'from tensorflow.contrib import layers\n'), ((2081, 2117), 'tensorflow.python.ops.math_ops.reduce_mean', 'math_ops.reduce_mean', (['hidden'], {'axis': '(1)'}), '(hidden, axis=1)\n', (2101,...
# -*- coding: utf-8 -*- from helper import Path, os, to_device, make_dataset_1M, create_optimizer, ltensor, collate_fn, node_cls_collate_fn, get_logger, train_node_cls, test_node_cls, train_gda, test_gda from datasets import GDADataset, NodeClassification from models import SharedBilinearDecoder, GAL, NodeClassifier ...
[ "helper.train_gda", "helper.os.path.join", "numpy.stack", "models.NodeClassifier", "torch.utils.data.DataLoader", "torch.LongTensor", "models.GAL", "datasets.NodeClassification", "helper.test_node_cls", "helper.train_node_cls", "gc.collect", "helper.test_gda", "models.SharedBilinearDecoder",...
[((614, 684), 'datasets.GDADataset', 'GDADataset', (['args.train_ratings', 'args.users_train', 'args.prefetch_to_gpu'], {}), '(args.train_ratings, args.users_train, args.prefetch_to_gpu)\n', (624, 684), False, 'from datasets import GDADataset, NodeClassification\n'), ((704, 772), 'datasets.GDADataset', 'GDADataset', ([...
# Import routines import numpy as np import math import random # Defining hyperparameters m = 5 # number of cities, ranges from 1 ..... m t = 24 # number of hours, ranges from 0 .... t-1 d = 7 # number of days, ranges from 0 ... d-1 C = 5 # Per hour fuel and other costs R = 9 # per hour revenue from a passenger cl...
[ "random.choice", "numpy.random.poisson" ]
[((778, 809), 'random.choice', 'random.choice', (['self.state_space'], {}), '(self.state_space)\n', (791, 809), False, 'import random\n'), ((2128, 2148), 'numpy.random.poisson', 'np.random.poisson', (['(2)'], {}), '(2)\n', (2145, 2148), True, 'import numpy as np\n'), ((2259, 2280), 'numpy.random.poisson', 'np.random.po...
import os import pyparallelproj as ppp import numpy as np import argparse nsubsets = 1 # setup a scanner scanner = ppp.RegularPolygonPETScanner(ncrystals_per_module = np.array([16,1]), nmodules = np.array([28,1])) # setup a test image voxsize = np.array([2.,2.,2.]) ...
[ "numpy.random.rand", "pyparallelproj.SinogramProjector", "numpy.array", "pyparallelproj.PETSinogramParameters" ]
[((299, 324), 'numpy.array', 'np.array', (['[2.0, 2.0, 2.0]'], {}), '([2.0, 2.0, 2.0])\n', (307, 324), True, 'import numpy as np\n'), ((454, 480), 'numpy.random.rand', 'np.random.rand', (['n0', 'n1', 'n2'], {}), '(n0, n1, n2)\n', (468, 480), True, 'import numpy as np\n'), ((577, 643), 'pyparallelproj.PETSinogramParamet...
import os import codecs import numpy as np import matplotlib.pyplot as plt Has_Header = True CSV = 'data/valence_arousal_exp.csv' def calculate_mean_variance(data): theta = np.arctan(data[:, 0] / data[:, 1]) m_x = np.mean(np.cos(theta)) m_y = np.mean(np.sin(theta)) mu = np.arctan(m_y / m_x) R = ...
[ "numpy.sin", "matplotlib.pyplot.fill_between", "matplotlib.pyplot.imread", "codecs.open", "matplotlib.pyplot.imshow", "numpy.linspace", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "numpy.cos", "matplotlib.pyplot.ylabel", "numpy.arctan", "matplotlib.pyplot....
[((3163, 3180), 'numpy.array', 'np.array', (['group_1'], {}), '(group_1)\n', (3171, 3180), True, 'import numpy as np\n'), ((3191, 3208), 'numpy.array', 'np.array', (['group_2'], {}), '(group_2)\n', (3199, 3208), True, 'import numpy as np\n'), ((180, 214), 'numpy.arctan', 'np.arctan', (['(data[:, 0] / data[:, 1])'], {})...
import numpy import matplotlib.pyplot as plt FILE_NAME = 'rewards_nonshare.npz' def smooth(reward_vec, filter_size): l = len(reward_vec) - filter_size + 1 print(len(reward_vec)) smooth_reward_vec = numpy.zeros(l) for i in range(l): reward = numpy.mean(reward_vec[i:i+filter_size]) smoot...
[ "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.yticks", "numpy.zeros", "matplotlib.pyplot.axis", "numpy.ones", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", ...
[((212, 226), 'numpy.zeros', 'numpy.zeros', (['l'], {}), '(l)\n', (223, 226), False, 'import numpy\n'), ((415, 436), 'numpy.load', 'numpy.load', (['FILE_NAME'], {}), '(FILE_NAME)\n', (425, 436), False, 'import numpy\n'), ((570, 596), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 6)'}), '(figsize=(8, 6...
""" Contains class DistanceTo for calculations of distance between segments of a segmented images and given region(s) # Author: <NAME> (MPI for Biochemistry) # $Id$ """ from __future__ import unicode_literals from __future__ import absolute_import from builtins import zip from builtins import range __version__ = "$...
[ "scipy.ndimage.distance_transform_edt", "numpy.median", "numpy.asarray", "numpy.zeros", "numpy.argmin", "numpy.min", "numpy.where", "numpy.array" ]
[((14342, 14366), 'numpy.asarray', 'numpy.asarray', (['distances'], {}), '(distances)\n', (14355, 14366), False, 'import numpy\n'), ((2188, 2206), 'numpy.asarray', 'numpy.asarray', (['ids'], {}), '(ids)\n', (2201, 2206), False, 'import numpy\n'), ((3721, 3744), 'numpy.asarray', 'numpy.asarray', (['distance'], {}), '(di...
import numpy as np from advent.utils import project_root from advent.utils.serialization import json_load from advent.dataset.base_dataset import BaseDataset import cv2 DEFAULT_INFO_PATH = project_root / 'advent/dataset/compound_list/info.json' class BDDataSet(BaseDataset): def __init__(self, root, list_path, s...
[ "advent.utils.serialization.json_load", "numpy.zeros", "numpy.array" ]
[((755, 775), 'advent.utils.serialization.json_load', 'json_load', (['info_path'], {}), '(info_path)\n', (764, 775), False, 'from advent.utils.serialization import json_load\n'), ((803, 845), 'numpy.array', 'np.array', (["self.info['label']"], {'dtype': 'np.str'}), "(self.info['label'], dtype=np.str)\n", (811, 845), Tr...
import matplotlib.pyplot as plt import numpy as np import random XLIM = (-4, 4) YLIM = (-4, 4) def draw(): circ.set_radius(r0) circ.set_center((x0, y0)) line.set_data([x1, x2], [y1, y2]) a = (x2-x1)**2 + (y2-y1)**2 b = 2*((x2-x1)*(x1-x0)+(y2-y1)*(y1-y0)) c = (x1-x0)**2+(...
[ "matplotlib.pyplot.show", "numpy.hypot", "random.random", "matplotlib.pyplot.figure", "matplotlib.pyplot.Circle" ]
[((1742, 1754), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1752, 1754), True, 'import matplotlib.pyplot as plt\n'), ((2124, 2134), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2132, 2134), True, 'import matplotlib.pyplot as plt\n'), ((540, 566), 'numpy.hypot', 'np.hypot', (['(xl - x0)', '(...
import numpy as np import torch from config import VAL_RATIO, BATCH_SIZE, data_path from torch.utils.data import DataLoader, Dataset class TIMITDataset(Dataset): def __init__(self, X, y=None): self.data = torch.from_numpy(X).float() if y is not None: y = y.astype(np.int) se...
[ "torch.from_numpy", "numpy.load", "torch.utils.data.DataLoader", "torch.LongTensor" ]
[((686, 721), 'numpy.load', 'np.load', (["(data_path + 'train_11.npy')"], {}), "(data_path + 'train_11.npy')\n", (693, 721), True, 'import numpy as np\n'), ((740, 781), 'numpy.load', 'np.load', (["(data_path + 'train_label_11.npy')"], {}), "(data_path + 'train_label_11.npy')\n", (747, 781), True, 'import numpy as np\n'...
import argparse import json import os import sys from tqdm import tqdm from PIL import Image, ImageDraw import numpy as np import torch import torch.optim as optim from torch.utils.data import DataLoader import torch.nn.functional as F torch.backends.cudnn.benchmark = True from config import GlobalConfig from archite...
[ "argparse.ArgumentParser", "torch.argmax", "numpy.clip", "torch.no_grad", "torch.utils.data.DataLoader", "config.GlobalConfig", "PIL.ImageDraw.Draw", "tqdm.tqdm", "numpy.uint8", "torch.nn.functional.l1_loss", "numpy.concatenate", "utils.iou", "os.makedirs", "torch.stack", "os.path.isdir"...
[((427, 452), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (450, 452), False, 'import argparse\n'), ((1003, 1017), 'config.GlobalConfig', 'GlobalConfig', ([], {}), '()\n', (1015, 1017), False, 'from config import GlobalConfig\n'), ((1036, 1069), 'data.CARLA_points', 'CARLA_points', (['conf.va...
import numpy as np import matplotlib.pyplot as plt y = 0 z = np.arange(-0, 1, .02) t = -y*np.log(z)-(1-y)*np.log(1-z) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(z, t) ax.set_ylim([0,3]) ax.set_xlim([0,1]) ax.set_xlabel('y_predict') ax.set_ylabel('cross entropy') ax.set_title('y_true = 0') plt.show()
[ "matplotlib.pyplot.figure", "numpy.arange", "numpy.log", "matplotlib.pyplot.show" ]
[((62, 84), 'numpy.arange', 'np.arange', (['(-0)', '(1)', '(0.02)'], {}), '(-0, 1, 0.02)\n', (71, 84), True, 'import numpy as np\n'), ((126, 138), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (136, 138), True, 'import matplotlib.pyplot as plt\n'), ((303, 313), 'matplotlib.pyplot.show', 'plt.show', ([], {...
import math import numpy as np def truncate(number, digits) -> float: ''' Truncate number to n nearest digits. Set to -ve for decimal places Args: number (float) : the number to truncate digits (int) : nearest digits. 0 truncate to 1. 1 truncate to 10. -1 ...
[ "numpy.array", "math.trunc" ]
[((392, 420), 'math.trunc', 'math.trunc', (['(stepper * number)'], {}), '(stepper * number)\n', (402, 420), False, 'import math\n'), ((644, 676), 'numpy.array', 'np.array', (['l_l[0:-cut_end_length]'], {}), '(l_l[0:-cut_end_length])\n', (652, 676), True, 'import numpy as np\n')]
import itertools import numpy as np import pandas as pd from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix from sklearn import cross_validation __names2num = { 0: [1, 0], 1: [0, 1] } class NHLDATA(DenseDesignMatrix): def __init__(self, filename, X=None, Y=None, scaler=None, ...
[ "pandas.read_csv", "sklearn.cross_validation.train_test_split", "itertools.izip_longest", "numpy.array" ]
[((1547, 1568), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (1558, 1568), True, 'import pandas as pd\n'), ((1746, 1767), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (1757, 1767), True, 'import pandas as pd\n'), ((1022, 1098), 'sklearn.cross_validation.train_test_split...
import numpy as np import ipopt from datetime import datetime MIN = -2.0e19 MAX = 2.0e19 class Parameter: def __init__(self, D, P, jj: np.array, ll: np.array, tt0: np.array, uu: np.array, ww: np.array, mm: np.array, CC: np.ndarray, KK: np.ndarray, RR: np.ndarray, SS: np.ndarray)...
[ "numpy.divide", "numpy.multiply", "numpy.eye", "numpy.log", "numpy.random.randn", "numpy.tril", "numpy.zeros", "numpy.ones", "numpy.negative", "numpy.nonzero", "numpy.array", "numpy.matmul", "numpy.dot", "datetime.datetime.now", "numpy.concatenate" ]
[((5517, 5588), 'numpy.concatenate', 'np.concatenate', (['(para.ll, [para.D] * var.l, [0] * var.n, [MIN] * var.k)'], {}), '((para.ll, [para.D] * var.l, [0] * var.n, [MIN] * var.k))\n', (5531, 5588), True, 'import numpy as np\n'), ((5601, 5659), 'numpy.concatenate', 'np.concatenate', (['[para.uu, [MAX] * (var.l + var.n ...
"""The ALEExperiment class handles the logic for training a deep Q-learning agent in the Arcade Learning Environment. Author: <NAME> """ import logging import numpy as np import image_preprocessing # Number of rows to crop off the bottom of the (downsampled) screen. # This is appropriate for breakout, but it may nee...
[ "image_preprocessing.resize", "numpy.empty", "numpy.maximum" ]
[((1204, 1275), 'numpy.empty', 'np.empty', (['(self.buffer_length, self.height, self.width)'], {'dtype': 'np.uint8'}), '((self.buffer_length, self.height, self.width), dtype=np.uint8)\n', (1212, 1275), True, 'import numpy as np\n'), ((5843, 5900), 'numpy.maximum', 'np.maximum', (['max_image', 'self.screen_buffer[index ...
import numpy as np import torch import sched import argparse from tqdm import tqdm import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from IPython.display import clear_output from torch.utils.data import DataLoader, Dataset from tqdm import t...
[ "numpy.zeros_like", "numpy.sum", "numpy.abs", "numpy.copy", "numpy.floor", "numpy.asarray", "numpy.zeros", "numpy.ones", "numpy.argsort", "numpy.array", "sched.ScdChecker", "numpy.sqrt" ]
[((391, 410), 'numpy.argsort', 'np.argsort', (['(-scores)'], {}), '(-scores)\n', (401, 410), True, 'import numpy as np\n'), ((426, 445), 'numpy.zeros_like', 'np.zeros_like', (['rank'], {}), '(rank)\n', (439, 445), True, 'import numpy as np\n'), ((3369, 3379), 'numpy.copy', 'np.copy', (['C'], {}), '(C)\n', (3376, 3379),...
from __future__ import print_function import sys import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import torchvision.models as models import random import os import argparse import numpy as np import dataloader_clothin...
[ "sys.stdout.write", "numpy.sum", "argparse.ArgumentParser", "sklearn.mixture.GaussianMixture", "torch.cat", "sys.stdout.flush", "numpy.exp", "torch.no_grad", "torch.ones", "torch.load", "torch.softmax", "random.seed", "torch.utils.tensorboard.SummaryWriter", "torch.nn.Linear", "torch.zer...
[((442, 491), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', (['"""cloth_logs/clothing1m-odin-june6"""'], {}), "('cloth_logs/clothing1m-odin-june6')\n", (455, 491), False, 'from torch.utils.tensorboard import SummaryWriter\n'), ((502, 568), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descrip...
import dataset import utils from dataset import DataSet import compute_merw as rw import metrics as mtr import kernel_methods as kern import numpy as np import scipy.sparse.linalg as sla from scipy.sparse import csc_matrix, csr_matrix, lil_matrix import warnings from scipy.sparse.csgraph import connected_components d...
[ "dataset.DataSet", "kernel_methods.general_laplacian", "warnings.filterwarnings", "utils.get_edges_set", "metrics.auc", "kernel_methods.symmetric_normalized_laplacian", "scipy.sparse.linalg.eigsh", "kernel_methods.regularized_laplacian_kernel", "kernel_methods.heat_diffusion_kernel", "scipy.sparse...
[((354, 504), 'numpy.array', 'np.array', (['[[0.0, 0.4, 0.5, 0.6, 0.1], [0.4, 0.0, 0.3, 0.7, 0.2], [0.5, 0.3, 0.0, 0.5,\n 0.3], [0.6, 0.7, 0.5, 0.0, 0.6], [0.1, 0.2, 0.3, 0.6, 0.0]]'], {}), '([[0.0, 0.4, 0.5, 0.6, 0.1], [0.4, 0.0, 0.3, 0.7, 0.2], [0.5, 0.3, \n 0.0, 0.5, 0.3], [0.6, 0.7, 0.5, 0.0, 0.6], [0.1, 0.2,...
""" optimizers.py ~~~~~~~~~~ Collection of activation functions. Each function provides forward pass and backpropagation. """ ### --- IMPORTS --- ### # Standard Import # Third-Party Import import numpy as np class Optimizer_SGD: def __init__(self, learning_rate=1., decay=0., momentum=0.): """Stochastic...
[ "numpy.zeros_like", "numpy.sqrt" ]
[((2933, 2961), 'numpy.zeros_like', 'np.zeros_like', (['layer.weights'], {}), '(layer.weights)\n', (2946, 2961), True, 'import numpy as np\n'), ((2993, 3020), 'numpy.zeros_like', 'np.zeros_like', (['layer.biases'], {}), '(layer.biases)\n', (3006, 3020), True, 'import numpy as np\n'), ((4401, 4429), 'numpy.zeros_like', ...
import numpy as np from .electools import Elec, Result from .engine import Engine from .utils.darray import DependArray class Model(object): def __init__( self, qm_positions, positions, qm_charges, charges, cell_basis, qm_total_charge, switching_typ...
[ "numpy.any" ]
[((1040, 1070), 'numpy.any', 'np.any', (['(self.cell_basis != 0.0)'], {}), '(self.cell_basis != 0.0)\n', (1046, 1070), True, 'import numpy as np\n')]
""" Parallel-1-Serial Tests for the SimpleComm class The 'P1S' Test Suite specificially tests whether the serial behavior is the same as the 1-rank parallel behavior. If the 'Par' test suite passes with various communicator sizes (1, 2, ...), then this suite should be run to make sure that serial communication behave...
[ "io.StringIO", "asaptools.partition.Duplicate", "unittest.TextTestRunner", "numpy.testing.assert_array_equal", "asaptools.partition.EqualStride", "numpy.array", "numpy.arange", "unittest.TestLoader", "asaptools.simplecomm.create_comm" ]
[((5696, 5706), 'io.StringIO', 'StringIO', ([], {}), '()\n', (5704, 5706), False, 'from io import StringIO\n'), ((752, 787), 'asaptools.simplecomm.create_comm', 'simplecomm.create_comm', ([], {'serial': '(True)'}), '(serial=True)\n', (774, 787), False, 'from asaptools import simplecomm\n'), ((809, 845), 'asaptools.simp...
import warnings import numpy as np import pandas from . import io from astropy import time def get_sample(): """ Short to to Sample.load() """ return Sample.load() class Sample(): def __init__(self, data=None): """ """ self.set_data(data) @classmethod def load(c...
[ "matplotlib.colors.to_rgba", "dask.delayed", "ztfquery.fields.get_fields_containing_target", "astropy.time.Time", "numpy.asarray", "matplotlib.dates.ConciseDateFormatter", "matplotlib.pyplot.figure", "matplotlib.dates.AutoDateLocator", "numpy.arange", "warnings.warn", "numpy.atleast_1d", "pand...
[((12476, 12536), 'warnings.warn', 'warnings.warn', (['"""building phase coverage takes ~30s to 1min."""'], {}), "('building phase coverage takes ~30s to 1min.')\n", (12489, 12536), False, 'import warnings\n'), ((2692, 2748), 'ztfquery.fields.get_fields_containing_target', 'fields.get_fields_containing_target', (["s_['...
import os import click import datasheets import numpy as np import pandas as pd from pulp import LpVariable, LpProblem, LpMaximize, lpSum, PULP_CBC_CMD import yaml class Optimizer: def __init__(self, input_data, num_screens, budget): self.input_data = input_data self.num_screens = num_screens ...
[ "pandas.DataFrame", "pulp.lpSum", "yaml.load", "numpy.sum", "pulp.LpVariable", "click.option", "click.command", "datasheets.Client", "pulp.LpProblem", "pandas.concat", "pulp.PULP_CBC_CMD" ]
[((5203, 5218), 'click.command', 'click.command', ([], {}), '()\n', (5216, 5218), False, 'import click\n'), ((5220, 5262), 'click.option', 'click.option', (['"""--conf"""'], {'default': '"""conf.yml"""'}), "('--conf', default='conf.yml')\n", (5232, 5262), False, 'import click\n'), ((4469, 4500), 'datasheets.Client', 'd...
from typing import Type import numpy as np reveal_type(np.ModuleDeprecationWarning()) # E: numpy.ModuleDeprecationWarning reveal_type(np.VisibleDeprecationWarning()) # E: numpy.VisibleDeprecationWarning reveal_type(np.ComplexWarning()) # E: numpy.ComplexWarning reveal_type(np.RankWarning()) # E: numpy.RankWarning...
[ "numpy.VisibleDeprecationWarning", "numpy.ComplexWarning", "numpy.RankWarning", "numpy.ModuleDeprecationWarning", "numpy.AxisError", "numpy.TooHardError" ]
[((57, 86), 'numpy.ModuleDeprecationWarning', 'np.ModuleDeprecationWarning', ([], {}), '()\n', (84, 86), True, 'import numpy as np\n'), ((137, 167), 'numpy.VisibleDeprecationWarning', 'np.VisibleDeprecationWarning', ([], {}), '()\n', (165, 167), True, 'import numpy as np\n'), ((219, 238), 'numpy.ComplexWarning', 'np.Co...
""" This code was developed by <NAME>, <NAME> and <NAME> of PES University Refer to the README for the sources of the Deepspeech, Tacotron and WaveRNN implementations/folders The answer extraction code references the Hugging face run_squad.py example, modified for our use """ import sys import wave import os import au...
[ "sounddevice.rec", "audioop.tomono", "pytorch_pretrained_bert.tokenization.BertTokenizer.from_pretrained", "sounddevice.wait", "torch.device", "Tacotron_TTS.synthesizer.Synthesizer", "torch.no_grad", "os.fsdecode", "torch.load", "spacy.load", "audioop.ratecv", "soundfile.write", "pytorch_pre...
[((1125, 1135), 'gingerit.gingerit.GingerIt', 'GingerIt', ([], {}), '()\n', (1133, 1135), False, 'from gingerit.gingerit import GingerIt\n'), ((1803, 1814), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1812, 1814), False, 'import os\n'), ((1869, 1876), 'timeit.default_timer', 'timer', ([], {}), '()\n', (1874, 1876), Tr...
import pickle as pkl import scipy.sparse import numpy as np import pandas as pd from scipy import sparse as sp import networkx as nx #' from gcn.utils import * from sc_data import * from collections import defaultdict from scipy.stats import uniform #' -------- convert graph to specific format ----------- def get_val...
[ "pandas.DataFrame", "networkx.from_dict_of_lists", "numpy.concatenate", "numpy.argmax", "scipy.sparse.vstack", "numpy.zeros", "collections.defaultdict", "pickle.load", "numpy.array", "numpy.where", "pandas.concat", "numpy.unique" ]
[((464, 481), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (475, 481), False, 'from collections import defaultdict\n'), ((781, 792), 'numpy.zeros', 'np.zeros', (['l'], {}), '(l)\n', (789, 792), True, 'import numpy as np\n'), ((822, 851), 'numpy.array', 'np.array', (['mask'], {'dtype': 'np.bool'...
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import blocksparse as bs from tensorflow.python.ops import gradient_checker def ceil_div(x, y): return -(-x // y) shapes = [ # ...
[ "tensorflow.test.main", "blocksparse.float_cast", "numpy.random.uniform", "numpy.abs", "tensorflow.global_variables_initializer", "tensorflow.device", "numpy.ones", "blocksparse.dropout", "tensorflow.ConfigProto", "tensorflow.placeholder", "numpy.random.randint", "blocksparse.set_entropy" ]
[((3457, 3471), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3469, 3471), True, 'import tensorflow as tf\n'), ((890, 968), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'intra_op_parallelism_threads': '(1)', 'inter_op_parallelism_threads': '(1)'}), '(intra_op_parallelism_threads=1, inter_op_parallelis...
''' Copyright (c) 2021. IIP Lab, Wuhan University ''' import os import argparse import numpy as np import pandas as pd from scipy.stats import spearmanr import tensorflow as tf from tensorflow.keras import layers, models from tensorflow.keras import backend as K from data import * from train import * ...
[ "argparse.ArgumentParser", "numpy.empty", "tensorflow.reset_default_graph", "numpy.isnan", "tensorflow.ConfigProto", "os.path.join", "pandas.DataFrame", "tensorflow.keras.layers.Concatenate", "os.path.exists", "layers.ProductOfExpertGaussian", "numpy.save", "tensorflow.keras.backend.clear_sess...
[((4339, 4390), 'numpy.empty', 'np.empty', (['(num_videos, timesteps)'], {'dtype': 'np.float32'}), '((num_videos, timesteps), dtype=np.float32)\n', (4347, 4390), True, 'import numpy as np\n'), ((4404, 4455), 'numpy.empty', 'np.empty', (['(num_videos, timesteps)'], {'dtype': 'np.float32'}), '((num_videos, timesteps), dt...
#!/usr/bin/env python3 # This script deals with color conversions and color transformations. # # copyright (C) 2014-2017 <NAME> | <EMAIL> # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # LICENSE: # # colcol is free software; you can redistribute it and/or modify # it under the terms of the...
[ "colorsys.rgb_to_hls", "numpy.array", "colorsys.hls_to_rgb", "re.compile" ]
[((2236, 2253), 'numpy.array', 'numpy.array', (['rgb1'], {}), '(rgb1)\n', (2247, 2253), False, 'import numpy\n'), ((2265, 2282), 'numpy.array', 'numpy.array', (['rgb2'], {}), '(rgb2)\n', (2276, 2282), False, 'import numpy\n'), ((3137, 3383), 're.compile', 're.compile', (['"""^ # match beginning of string\n [#]?...
import numpy as np import cv2 import random as rng import math def areaCal(contour): area = 0 for i in range(len(contour)): area += cv2.contourArea(contour[i]) return area frame=cv2.imread('0297.jpg') sp=frame.shape data_A = np.zeros([sp[0], sp[1]], np.uint8) #out = cv2.VideoWr...
[ "cv2.contourArea", "random.randint", "cv2.cvtColor", "cv2.morphologyEx", "cv2.threshold", "cv2.imwrite", "numpy.zeros", "numpy.ones", "math.sin", "cv2.imread", "cv2.ellipse", "math.cos", "cv2.drawContours", "cv2.findContours" ]
[((217, 239), 'cv2.imread', 'cv2.imread', (['"""0297.jpg"""'], {}), "('0297.jpg')\n", (227, 239), False, 'import cv2\n'), ((266, 300), 'numpy.zeros', 'np.zeros', (['[sp[0], sp[1]]', 'np.uint8'], {}), '([sp[0], sp[1]], np.uint8)\n', (274, 300), True, 'import numpy as np\n'), ((397, 436), 'cv2.cvtColor', 'cv2.cvtColor', ...
import Aidlab from Aidlab.Signal import Signal import numpy as np from multiprocessing import Process, Queue, Array import matplotlib.pyplot as pyplot import matplotlib.animation as animation buffer_size = 500 result = None x = [i for i in range(buffer_size)] y = [] figure = pyplot.figure() axis = figure.add_subplot(...
[ "matplotlib.pyplot.show", "multiprocessing.Array", "numpy.std", "matplotlib.animation.FuncAnimation", "matplotlib.pyplot.figure", "numpy.min", "numpy.max", "multiprocessing.Process" ]
[((278, 293), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {}), '()\n', (291, 293), True, 'import matplotlib.pyplot as pyplot\n'), ((520, 572), 'matplotlib.animation.FuncAnimation', 'animation.FuncAnimation', (['figure', 'animate'], {'interval': '(2)'}), '(figure, animate, interval=2)\n', (543, 572), True, 'import...
from typing import Tuple import numpy as np from numba import jit @jit(nopython=True) def fit_bpr( data_triplets: np.ndarray, initial_user_factors: np.ndarray, initial_item_factors: np.ndarray, initial_item_biases: np.ndarray, lr_bi: float = 0.01, lr_pu: float = 0.01, lr_qi: float = 0.01,...
[ "numpy.zeros", "numba.jit", "numpy.arange", "numpy.linalg.norm", "numpy.random.choice", "numpy.exp", "numpy.dot" ]
[((70, 88), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (73, 88), False, 'from numba import jit\n'), ((2127, 2145), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (2130, 2145), False, 'from numba import jit\n'), ((3741, 3760), 'numba.jit', 'jit', ([], {'nopython': '(Fa...
from sklearn.datasets import make_friedman1 from sklearn.datasets import make_hastie_10_2 from sklearn.preprocessing import PolynomialFeatures import numpy as np def make_hastie_11_2(n_samples): X, y_org = make_hastie_10_2(n_samples=n_samples) z = np.random.randn(n_samples) y = y_org * z y[y > 0] = 1 ...
[ "sklearn.datasets.make_hastie_10_2", "numpy.random.randn", "sklearn.preprocessing.PolynomialFeatures", "numpy.random.rand", "sklearn.datasets.make_friedman1" ]
[((211, 248), 'sklearn.datasets.make_hastie_10_2', 'make_hastie_10_2', ([], {'n_samples': 'n_samples'}), '(n_samples=n_samples)\n', (227, 248), False, 'from sklearn.datasets import make_hastie_10_2\n'), ((258, 284), 'numpy.random.randn', 'np.random.randn', (['n_samples'], {}), '(n_samples)\n', (273, 284), True, 'import...
#!/usr/bin/env python3 # # Copyright (c) 2018-2020 Carnegie Mellon University # All rights reserved. # # Based on work by <NAME>. # # SPDX-License-Identifier: Apache-2.0 # """Remove similar frames based on a perceptual hash metric """ import argparse import json import os import random import shutil import imagehas...
[ "json.dump", "argparse.ArgumentParser", "random.shuffle", "numpy.asarray", "datumaro.components.project.Project.generate", "os.path.exists", "imagehash.phash", "PIL.Image.open", "PIL.Image.fromarray", "shutil.rmtree", "os.path.join" ]
[((1152, 1176), 'random.shuffle', 'random.shuffle', (['new_list'], {}), '(new_list)\n', (1166, 1176), False, 'import random\n'), ((2851, 2876), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2874, 2876), False, 'import argparse\n'), ((3640, 3689), 'os.path.join', 'os.path.join', (['args.path',...
import os import pytest import numpy as np from quantum_systems import ODQD, GeneralOrbitalSystem, SpatialOrbitalSystem @pytest.fixture(scope="module") def get_odho(): n = 2 l = 10 grid_length = 5 num_grid_points = 1001 omega = 1 odho = GeneralOrbitalSystem( n, ODQD( ...
[ "quantum_systems.ODQD.DWPotentialSmooth", "quantum_systems.ODQD.DWPotential", "quantum_systems.ODQD.GaussianPotential", "pytest.fixture", "numpy.testing.assert_allclose", "os.path.join", "quantum_systems.ODQD.HOPotential" ]
[((124, 154), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (138, 154), False, 'import pytest\n'), ((429, 459), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (443, 459), False, 'import pytest\n'), ((737, 767), 'pytest.fixture', 'p...
import numpy as np from scipy.interpolate import CloughTocher2DInterpolator as CT2DInt from mpl_toolkits.mplot3d import (Axes3D, art3d) import matplotlib as mpl import matplotlib.pyplot as plt def KinDrape_eff_NR(d, Grid, Org, Ang, OrgNode, PreShear, Plt): ## Mold definition: Hemisphere The, Phi = np.me...
[ "numpy.sum", "numpy.abs", "matplotlib.cm.get_cmap", "numpy.empty", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linalg.norm", "numpy.arange", "matplotlib.colors.Normalize", "mpl_toolkits.mplot3d.art3d.Poly3DCollection", "numpy.linspace", "matplotlib.pyplot.show", "mpl_toolkits.mplot3d.Axe...
[((489, 500), 'numpy.cos', 'np.cos', (['Phi'], {}), '(Phi)\n', (495, 500), True, 'import numpy as np\n'), ((926, 970), 'numpy.array', 'np.array', (['[[1, 0], [0, 1], [-1, 0], [0, -1]]'], {}), '([[1, 0], [0, 1], [-1, 0], [0, -1]])\n', (934, 970), True, 'import numpy as np\n'), ((985, 1029), 'numpy.array', 'np.array', ([...
from .ik import IKUtils from mp.action_sequences import ScriptedActions from mp.const import INIT_JOINT_CONF import numpy as np def get_grasp_approach_actions(env, obs, grasp): """get_grasp_approach_actions. retrieves grasp approach actions. Given the grasp (cartesian points on the object where the tips n...
[ "numpy.eye", "mp.action_sequences.ScriptedActions" ]
[((592, 647), 'mp.action_sequences.ScriptedActions', 'ScriptedActions', (['env', "obs['robot_tip_positions']", 'grasp'], {}), "(env, obs['robot_tip_positions'], grasp)\n", (607, 647), False, 'from mp.action_sequences import ScriptedActions\n'), ((1537, 1546), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (1543, 1546),...
import os import sys import pandas as pd import numpy as np import csv import pickle text_path = '../../../Cross-Modal-BERT/data/text/' dev_text = '../../../Cross-Modal-BERT/data/text/dev.tsv' train_text = '../../../Cross-Modal-BERT/data/text/train.tsv' test_text = '../../../Cross-Modal-BERT/data/text/test.tsv' ful...
[ "pickle.dump", "os.path.join", "numpy.concatenate" ]
[((945, 982), 'os.path.join', 'os.path.join', (['text_path', "(env + '.tsv')"], {}), "(text_path, env + '.tsv')\n", (957, 982), False, 'import os\n'), ((1975, 1995), 'pickle.dump', 'pickle.dump', (['data', 'f'], {}), '(data, f)\n', (1986, 1995), False, 'import pickle\n'), ((1405, 1437), 'numpy.concatenate', 'np.concate...
#!python # ---------------------------------------------------------------------------- # Copyright (c) 2017 Massachusetts Institute of Technology (MIT) # All rights reserved. # # Distributed under the terms of the BSD 3-clause license. # # The full license is in the LICENSE file, distributed with this software. # ----...
[ "string.split", "ephem.Observer", "optparse.OptionParser", "numpy.argmax", "sys.exc_info", "ephem.readtle", "datetime.datetime.utcfromtimestamp", "digital_rf.DigitalMetadataWriter", "traceback.format_exception", "ephem.Date", "numpy.float", "time.sleep", "datetime.datetime", "subprocess.ca...
[((3452, 3468), 'ephem.Observer', 'ephem.Observer', ([], {}), '()\n', (3466, 3468), False, 'import ephem\n'), ((3715, 3749), 'ephem.readtle', 'ephem.readtle', (['objName', 'tle1', 'tle2'], {}), '(objName, tle1, tle2)\n', (3728, 3749), False, 'import ephem\n'), ((6008, 6024), 'ephem.Observer', 'ephem.Observer', ([], {})...
# Import Libraries import requests; import numpy as np import math; import scipy import scipy.stats; from scipy.stats import norm import statistics from datetime import datetime, date import os; os.chdir(r'') # where the client_id is stored f = open('client_id') cid = f.read() def get_prices...
[ "math.exp", "numpy.log", "math.sqrt", "statistics.stdev", "datetime.date.today", "scipy.stats.norm.cdf", "requests.get", "os.chdir" ]
[((209, 221), 'os.chdir', 'os.chdir', (['""""""'], {}), "('')\n", (217, 221), False, 'import os\n'), ((903, 926), 'statistics.stdev', 'statistics.stdev', (['delta'], {}), '(delta)\n', (919, 926), False, 'import statistics\n'), ((940, 954), 'math.sqrt', 'math.sqrt', (['(252)'], {}), '(252)\n', (949, 954), False, 'import...
# <NAME> 2014-2020 # mlxtend Machine Learning Library Extensions # Author: <NAME> <<EMAIL>> # # License: BSD 3 clause import numpy as np def one_hot(y, num_labels='auto', dtype='float'): """One-hot encoding of class labels Parameters ---------- y : array-like, shape = [n_classlabels] Python ...
[ "numpy.array", "numpy.asarray", "numpy.max" ]
[((1136, 1149), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (1146, 1149), True, 'import numpy as np\n'), ((1352, 1366), 'numpy.max', 'np.max', (['(yt + 1)'], {}), '(yt + 1)\n', (1358, 1366), True, 'import numpy as np\n'), ((1435, 1465), 'numpy.array', 'np.array', (['[[0.0]]'], {'dtype': 'dtype'}), '([[0.0]], d...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 3 14:36:42 2019 @author: gparkes This script contains demonstration code for all sorts of sci-kit learn examples all functions generate a graph, by default we do not save these to a file Material drawn from: ttps://github.com/jakevdp/PythonDa...
[ "numpy.sum", "misc_fig.draw_ellipse", "matplotlib.pyplot.axes", "misc_fig.draw_dataframe", "sklearn.mixture.GaussianMixture", "sklearn.tree.DecisionTreeClassifier", "misc_fig.visualize_tree", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.exp", "numpy.ma.masked_array", "skle...
[((1341, 1384), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4.5)', 'facecolor': '"""w"""'}), "(figsize=(6, 4.5), facecolor='w')\n", (1351, 1384), True, 'import matplotlib.pyplot as plt\n'), ((1394, 1453), 'matplotlib.pyplot.axes', 'plt.axes', (['[0, 0, 1, 1]'], {'xticks': '[]', 'yticks': '[]', 'fram...
""" Construct a dataset with (multiple) source and target domains, from https://github.com/criteo-research/pytorch-ada/blob/master/adalib/ada/datasets/multisource.py """ import logging from enum import Enum from typing import Dict import numpy as np import torch.utils.data from sklearn.utils import check_random_state...
[ "sklearn.utils.check_random_state", "logging.debug", "kale.loaddata.sampler.SamplingConfig", "kale.loaddata.dataset_access.get_class_subset", "numpy.split", "numpy.where", "kale.loaddata.sampler.get_labels", "numpy.concatenate" ]
[((9735, 9754), 'kale.loaddata.sampler.get_labels', 'get_labels', (['dataset'], {}), '(dataset)\n', (9745, 9754), False, 'from kale.loaddata.sampler import get_labels, MultiDataLoader, SamplingConfig\n'), ((9963, 9995), 'sklearn.utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n'...
import numpy as np def dummy_median(y_actual): # dummy median predictor return np.full(y_actual.shape, np.median(y_actual))
[ "numpy.median" ]
[((112, 131), 'numpy.median', 'np.median', (['y_actual'], {}), '(y_actual)\n', (121, 131), True, 'import numpy as np\n')]
""" Rasterplots Utilities for raster image manipulation (e.g. OR maps) using PIL/Pillow and Numpy. Used for visualizing orientation maps (with and without selectivity), polar FFT spectra and afferent model weight patterns. """ import Image import ImageOps import numpy as np import colorsys rgb_to_hsv = np.vectorize(...
[ "numpy.dstack", "numpy.uint8", "numpy.vectorize", "numpy.asarray", "Image.new", "numpy.ones", "numpy.clip", "numpy.rollaxis" ]
[((307, 340), 'numpy.vectorize', 'np.vectorize', (['colorsys.rgb_to_hsv'], {}), '(colorsys.rgb_to_hsv)\n', (319, 340), True, 'import numpy as np\n'), ((354, 387), 'numpy.vectorize', 'np.vectorize', (['colorsys.hsv_to_rgb'], {}), '(colorsys.hsv_to_rgb)\n', (366, 387), True, 'import numpy as np\n'), ((732, 757), 'numpy.r...
import numpy as np from .base import e, tau def lu_decomposition(a): """Calculate matrices U and L from a given matrix A (:a). This function will raise a ValueError if matrix A isn't LU decomposable. :param a the matrix that should be decomposed into L and U. :return L: decomposed lower tri...
[ "numpy.dot", "numpy.linalg.norm", "numpy.identity", "numpy.sign" ]
[((2195, 2219), 'numpy.identity', 'np.identity', (['a0.shape[0]'], {}), '(a0.shape[0])\n', (2206, 2219), True, 'import numpy as np\n'), ((2283, 2298), 'numpy.dot', 'np.dot', (['_q', 'h.T'], {}), '(_q, h.T)\n', (2289, 2298), True, 'import numpy as np\n'), ((2300, 2321), 'numpy.dot', 'np.dot', (['h', 'ak_minus_1'], {}), ...
#!/usr/bin/python # -*- coding:utf-8 -*- import time import numpy as np import tensorflow as tf import os class NERTagger(object): """The NER Tagger Model.""" def __init__(self, is_training, config): self.batch_size = batch_size = config.batch_size self.seq_length = seq_length = config.seq_l...
[ "tensorflow.reduce_sum", "tensorflow.trainable_variables", "numpy.argmax", "tensorflow.reshape", "tensorflow.get_variable_scope", "tensorflow.nn.rnn_cell.DropoutWrapper", "tensorflow.matmul", "tensorflow.assign", "tensorflow.Variable", "tensorflow.global_variables", "numpy.exp", "os.path.join"...
[((4164, 4175), 'time.time', 'time.time', ([], {}), '()\n', (4173, 4175), False, 'import time\n'), ((4851, 4872), 'numpy.exp', 'np.exp', (['(costs / iters)'], {}), '(costs / iters)\n', (4857, 4872), True, 'import numpy as np\n'), ((462, 512), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[batch_size, seq_l...
#!/usr/bin/env python3 """Investigates the distribution for link Markov models. The link Markov model is based on the linking behavior of a given linkograph. Since the links in a linkograph are determined by ontology, the transition model is depending on the ontology. This script creates a sequence of random Markov m...
[ "matplotlib.pyplot.title", "json.load", "matplotlib.pyplot.show", "argparse.ArgumentParser", "matplotlib.pyplot.plot", "markov.Model.genModelFromLinko", "numpy.zeros", "time.time", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "markov.Model...
[((4361, 4402), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'info'}), '(description=info)\n', (4384, 4402), False, 'import argparse\n'), ((5955, 5968), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (5965, 5968), True, 'import matplotlib.pyplot as plt\n'), ((6044, 6087)...
import numpy as np def mrisensesim(size, ncoils=8, array_cent=None, coil_width=2, n_rings=None, phi=0): """Apply simulated sensitivity maps. Based on a script by <NAME>. Args: size (tuple): Size of the image array for the sensitivity coils. nc_range (int, default: 8): Number of coils to simul...
[ "numpy.radians", "numpy.zeros", "numpy.ones", "numpy.sin", "numpy.exp", "numpy.reshape", "numpy.cos", "numpy.concatenate" ]
[((2884, 2942), 'numpy.zeros', 'np.zeros', ([], {'shape': '(size[1], size[0] - side_mat.shape[1] * 2)'}), '(shape=(size[1], size[0] - side_mat.shape[1] * 2))\n', (2892, 2942), True, 'import numpy as np\n'), ((1466, 1485), 'numpy.zeros', 'np.zeros', (['(ncoils,)'], {}), '((ncoils,))\n', (1474, 1485), True, 'import numpy...
# Steven 05/17/2020 # clustering model design from time import time import pandas as pd import numpy as np # from sklearn.decomposition import PCA # from sklearn.cluster import AgglomerativeClustering from sklearn.cluster import KMeans # from sklearn.cluster import DBSCAN # from sklearn.pipeline import make_pipeline fr...
[ "pandas.DataFrame", "matplotlib.pyplot.subplot", "matplotlib.pyplot.title", "numpy.sum", "matplotlib.pyplot.show", "numpy.argmax", "sklearn.cluster.KMeans", "sklearn.preprocessing.MinMaxScaler", "time.time", "sklearn.metrics.silhouette_score", "numpy.where", "numpy.arange", "sklearn.neighbor...
[((811, 847), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': 'k', 'random_state': '(0)'}), '(n_clusters=k, random_state=0)\n', (817, 847), False, 'from sklearn.cluster import KMeans\n'), ((1380, 1400), 'numpy.sum', 'np.sum', (['((a - b) ** 2)'], {}), '((a - b) ** 2)\n', (1386, 1400), True, 'import numpy as np\...
from typing import List import gym import gym.spaces import numpy as np from pbrl.competitive.agent import Agent class CompetitiveEnv: def __init__(self, env: gym.Env, index=None, **kwargs): self.index = index assert isinstance(env.observation_space, gym.spaces.Tuple) if self.index is not...
[ "numpy.asarray", "numpy.random.RandomState", "numpy.repeat" ]
[((848, 871), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (869, 871), True, 'import numpy as np\n'), ((1456, 1485), 'numpy.asarray', 'np.asarray', (['self.observations'], {}), '(self.observations)\n', (1466, 1485), True, 'import numpy as np\n'), ((1272, 1302), 'numpy.repeat', 'np.repeat', (['...
# coding:utf-8 from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import learning_curve from sklearn.svm import SVC import LoadData import matplotlib.pyplot as plt import numpy as np # assume classifier and training data is prepared... def PlotLearningCurve(clf, X, Y): train_sizes, ...
[ "matplotlib.pyplot.title", "sklearn.ensemble.RandomForestClassifier", "LoadData.readDataSet", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.std", "matplotlib.pyplot.legend", "matplotlib.pyplot.draw", "matplotlib.pyplot.figure", "numpy.mean", "numpy.linspa...
[((597, 625), 'numpy.mean', 'np.mean', (['test_scores'], {'axis': '(1)'}), '(test_scores, axis=1)\n', (604, 625), True, 'import numpy as np\n'), ((648, 675), 'numpy.std', 'np.std', (['test_scores'], {'axis': '(1)'}), '(test_scores, axis=1)\n', (654, 675), True, 'import numpy as np\n'), ((685, 697), 'matplotlib.pyplot.f...
# -*- coding: utf-8 -*- # # Copyright (c) 2018, 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. import unittest import numpy from cclib.bridge import cclib2biopython class BiopythonTest(unittest.TestCase): """T...
[ "unittest.main", "cclib.bridge.cclib2biopython.makebiopython", "Bio.PDB.Superimposer.Superimposer", "numpy.array" ]
[((894, 909), 'unittest.main', 'unittest.main', ([], {}), '()\n', (907, 909), False, 'import unittest\n'), ((476, 503), 'numpy.array', 'numpy.array', (['[1, 8, 1]', '"""i"""'], {}), "([1, 8, 1], 'i')\n", (487, 503), False, 'import numpy\n'), ((516, 568), 'numpy.array', 'numpy.array', (['[[-1, 1, 0], [0, 0, 0], [1, 1, 0...