code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Module to plot a pie chart for the profiled sections of the code. TODO: Fix legend box size conflict. Make font of legends smaller. https://matplotlib.org/api/legend_api.html#matplotlib.legend.Legend TODO: Create several charts instead of hierarchic pie charts.. """ import os import pickle import numpy as np...
[ "seaborn.set", "matplotlib.colors.rgb_to_hsv", "matplotlib.use", "os.path.join", "warnings.catch_warnings", "os.path.split", "numpy.sum", "numpy.linspace", "numpy.array", "matplotlib.colors.hsv_to_rgb", "os.path.dirname", "matplotlib.pyplot.tight_layout", "warnings.simplefilter" ]
[((361, 382), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (375, 382), False, 'import matplotlib\n'), ((437, 446), 'seaborn.set', 'sns.set', ([], {}), '()\n', (444, 446), True, 'import seaborn as sns\n'), ((3567, 3598), 'numpy.linspace', 'np.linspace', (['(0.6)', '(1.0)', 'n_levels'], {}), '(0....
import numpy as np import matplotlib.pylab as plt import tensorflow as tf from keras.models import Model, Sequential from keras.layers import Input, Activation, Dense from keras.optimizers import SGD # Generate data from -20, -19.75, -19.5, .... , 20 train_x = np.arange(-20, 20, 0.25) # Calculate Target : sqrt(2x^2 +...
[ "numpy.sqrt", "numpy.array", "keras.layers.Input", "keras.optimizers.SGD", "keras.models.Model", "matplotlib.pylab.show", "keras.layers.Dense", "matplotlib.pylab.plot", "numpy.arange" ]
[((262, 286), 'numpy.arange', 'np.arange', (['(-20)', '(20)', '(0.25)'], {}), '(-20, 20, 0.25)\n', (271, 286), True, 'import numpy as np\n'), ((334, 363), 'numpy.sqrt', 'np.sqrt', (['(2 * train_x ** 2 + 1)'], {}), '(2 * train_x ** 2 + 1)\n', (341, 363), True, 'import numpy as np\n'), ((387, 404), 'keras.layers.Input', ...
import numpy as np # # blind A # # Z_Bbin sigma_e neff # # Flag_SOM_Fid # 0.1<ZB<=0.3 0.27085526185463465 0.6141903412434272 # 0.3<ZB<=0.5 0.260789170603278 1.1714443526924525 # 0.5<ZB<=0.7 0.27664489739710685 1.8306617593091257 # 0.7<ZB<=0.9 0.2616226704859973 1.2340324684694277 # 0.9<ZB<=1.2 0.2818628832701304 1.277...
[ "numpy.asarray" ]
[((978, 1095), 'numpy.asarray', 'np.asarray', (['[0.6141903412434272, 1.1714443526924525, 1.8306617593091257, \n 1.2340324684694277, 1.2777696421274052]'], {}), '([0.6141903412434272, 1.1714443526924525, 1.8306617593091257, \n 1.2340324684694277, 1.2777696421274052])\n', (988, 1095), True, 'import numpy as np\n')...
# -*- coding: utf-8 -*- from __future__ import print_function import torch import h5py import numpy as np class DatasetHDF5(torch.utils.data.Dataset): def __init__(self, hdf5fn, t, transform=None, target_transform=None): """ t: 'train' or 'val' """ super(DatasetHDF5, self).__init__...
[ "numpy.int64", "h5py.File" ]
[((341, 391), 'h5py.File', 'h5py.File', (['hdf5fn', '"""r"""'], {'libver': '"""latest"""', 'swmr': '(True)'}), "(hdf5fn, 'r', libver='latest', swmr=True)\n", (350, 391), False, 'import h5py\n'), ((888, 904), 'numpy.int64', 'np.int64', (['target'], {}), '(target)\n', (896, 904), True, 'import numpy as np\n')]
import json import numpy as np from flightsim.shapes import Cuboid class World(object): def __init__(self, world_data): """ Construct World object from data. Instead of using this constructor directly, see also class methods 'World.from_file()' for building a world from a saved .j...
[ "axes3ds.Axes3Ds", "json.dumps", "numpy.max", "matplotlib.pyplot.figure", "json.load", "flightsim.shapes.Cuboid", "numpy.arange", "matplotlib.pyplot.show" ]
[((5773, 5785), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (5783, 5785), True, 'import matplotlib.pyplot as plt\n'), ((5795, 5807), 'axes3ds.Axes3Ds', 'Axes3Ds', (['fig'], {}), '(fig)\n', (5802, 5807), False, 'from axes3ds import Axes3Ds\n'), ((5854, 5864), 'matplotlib.pyplot.show', 'plt.show', ([], {}...
import os import math from pprint import PrettyPrinter import random import numpy as np import torch # Torch must be imported before sklearn and tf import sklearn import tensorflow as tf import better_exceptions from tqdm import tqdm, trange import colorlog import colorful from utils.etc_utils import set_logger, set...
[ "utils.etc_utils.set_gpus", "tensorflow.train.Checkpoint", "modules.from_parlai.unzip", "better_exceptions.hook", "tensorflow.config.experimental.set_visible_devices", "utils.config_utils.CommandArgs", "utils.etc_utils.set_logger", "os.path.exists", "utils.config_utils.initialize_argparser", "ppri...
[((714, 738), 'better_exceptions.hook', 'better_exceptions.hook', ([], {}), '()\n', (736, 738), False, 'import better_exceptions\n'), ((755, 781), 'utils.config_utils.CommandArgs', 'config_utils.CommandArgs', ([], {}), '()\n', (779, 781), False, 'from utils import config_utils, custom_argparsers\n'), ((791, 806), 'ppri...
import gym import argparse import calendar from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.normalized_env import normalize from rllab.envs.gym_env import GymEnv from rllab.config import LOG_DIR from sandbox import RLLabRunner from sandbox.rocky.tf.algos.trpo import TRPO fro...
[ "gym.envs.register", "calendar.datetime.date.today", "numpy.prod", "os.listdir", "sandbox.rocky.tf.envs.base.TfEnv", "argparse.ArgumentParser", "rllab.envs.gym_env.GymEnv", "sandbox.rocky.tf.policies.gaussian_gru_policy.GaussianGRUPolicy", "os.path.join", "numpy.square", "os.mkdir", "sandbox.r...
[((1021, 1046), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1044, 1046), False, 'import argparse\n'), ((5024, 5175), 'gym.envs.register', 'gym.envs.register', ([], {'id': '"""SpellingCorrection-v0"""', 'entry_point': '"""rllab.envs.nlp_env:SpellingCorrection"""', 'timestep_limit': '(999)', ...
import argparse import csv import functools as fts import numpy as np import matplotlib import matplotlib.pyplot as plt from matplotlib import rc import sys rc('font',**{'family':'sans-serif','sans-serif':['Gill Sans']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino'])) r...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.savefig", "csv.DictReader", "argparse.ArgumentParser", "matplotlib.rcParams.update", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.exp", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.rc", "mat...
[((158, 225), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Gill Sans']})\n", (160, 225), False, 'from matplotlib import rc\n'), ((319, 342), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (321, 342), False, 'from matplotlib ...
import pytest import numpy as np import gbmc_v0.util_funcs as uf from ovito.data import NearestNeighborFinder @pytest.mark.skip(reason="we can't push the data to repo. It is large.") @pytest.mark.parametrize('filename0, lat_par, cut_off, num_neighbors, non_p_dir', [('data/dump_1', 4.05, 10, 1...
[ "numpy.mean", "numpy.abs", "numpy.sqrt", "gbmc_v0.util_funcs.compute_ovito_data", "numpy.where", "pytest.mark.skip", "numpy.max", "pytest.mark.parametrize", "numpy.zeros", "numpy.min", "ovito.data.NearestNeighborFinder", "numpy.shape" ]
[((113, 184), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""we can\'t push the data to repo. It is large."""'}), '(reason="we can\'t push the data to repo. It is large.")\n', (129, 184), False, 'import pytest\n'), ((186, 412), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""filename0, lat_par,...
from .plot_external_data import plot from gym_electric_motor.physical_systems import SynchronousMotorSystem from gym.spaces import Box import numpy as np class FieldOrientedController: """ This class controls the currents of synchronous motors. In the case of continuous manipulated variables, the ...
[ "numpy.clip", "numpy.where" ]
[((5589, 5662), 'numpy.clip', 'np.clip', (['action_temp', 'self.action_space.low[0]', 'self.action_space.high[0]'], {}), '(action_temp, self.action_space.low[0], self.action_space.high[0])\n', (5596, 5662), True, 'import numpy as np\n'), ((1325, 1355), 'numpy.where', 'np.where', (["(ref_states == 'i_sd')"], {}), "(ref_...
import os import shutil import tempfile import numpy as np from astropy.io import fits from soxs.spectra import Spectrum from soxs.instrument import instrument_simulator from soxs.simput import SimputSpectrum, SimputCatalog from soxs.events import filter_events def test_filter(): tmpdir = tempfile.mkdtemp() ...
[ "soxs.events.filter_events", "numpy.sqrt", "numpy.logical_and", "soxs.instrument.instrument_simulator", "soxs.simput.SimputCatalog.from_source", "soxs.spectra.Spectrum.from_powerlaw", "os.chdir", "os.getcwd", "soxs.simput.SimputSpectrum.from_spectrum", "tempfile.mkdtemp", "shutil.rmtree", "ast...
[((299, 317), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (315, 317), False, 'import tempfile\n'), ((331, 342), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (340, 342), False, 'import os\n'), ((347, 363), 'os.chdir', 'os.chdir', (['tmpdir'], {}), '(tmpdir)\n', (355, 363), False, 'import os\n'), ((541, 611)...
import numpy as np from sklearn.metrics import roc_auc_score, accuracy_score import torch import torch.nn as nn from torch.autograd import Variable from globalbaz import args, DP, device from tqdm import tqdm from models import * # Defining criterion with weighted loss based on bias to be unlearned def criterion_func...
[ "numpy.mean", "torch.log", "torch.nn.CrossEntropyLoss", "numpy.round", "tqdm.tqdm", "torch.sigmoid", "sklearn.metrics.roc_auc_score", "torch.tensor", "torch.nn.BCEWithLogitsLoss", "torch.no_grad", "torch.autograd.Variable", "torch.zeros", "torch.cat" ]
[((977, 1022), 'torch.tensor', 'torch.tensor', (['class_freq'], {'dtype': 'torch.float32'}), '(class_freq, dtype=torch.float32)\n', (989, 1022), False, 'import torch\n'), ((1104, 1150), 'torch.tensor', 'torch.tensor', (['class_freq2'], {'dtype': 'torch.float32'}), '(class_freq2, dtype=torch.float32)\n', (1116, 1150), F...
import numpy as np import argparse import matplotlib.pyplot as plt import cv2 from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Flatten from tensorflow.keras.layers import Conv2D from tensorflow.keras.optimizers import Adam from tensorflow.keras.layers import MaxPooling2...
[ "cv2.rectangle", "tensorflow.keras.layers.Dense", "cv2.destroyAllWindows", "cv2.CascadeClassifier", "cv2.ocl.setUseOpenCL", "tensorflow.keras.layers.Conv2D", "argparse.ArgumentParser", "cv2.waitKey", "tensorflow.keras.models.Sequential", "tensorflow.keras.layers.Dropout", "numpy.argmax", "cv2....
[((471, 496), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (494, 496), False, 'import argparse\n'), ((1952, 1964), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1962, 1964), False, 'from tensorflow.keras.models import Sequential\n'), ((2678, 2705), 'cv2.ocl.setUseOpen...
import sys import numpy as np import os from data_management import load_videos,load_optical_flow_dataset import config # import tensorflow as tf # tf.config.experimental_run_functions_eagerly(True) from models import ROI_C3D_AE_no_pool,Fusion_C3D_no_pool from trainer.fusionroigan import Params,Fusion_ROI_3DCAE_GAN3D...
[ "trainer.util.create_diff_mask", "data_management.load_optical_flow_dataset", "argparse.ArgumentParser", "models.ROI_C3D_AE_no_pool", "models.Fusion_C3D_no_pool", "trainer.fusionroigan.Fusion_ROI_3DCAE_GAN3D", "os.path.isfile", "data_management.load_videos", "trainer.fusionroigan.Params", "numpy.c...
[((406, 500), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fusion and Region based adversarial model training"""'}), "(description=\n 'Fusion and Region based adversarial model training')\n", (429, 500), False, 'import argparse\n'), ((1319, 1531), 'trainer.fusionroigan.Params', 'Par...
import os from functools import reduce import numpy as np import pandas as pd from sklearn.preprocessing import minmax_scale, scale class Data(): def __init__(self, no_hist_days, no_hist_weeks, target_label, root_dir="", begin_test_date=None, scale_data=None): data_daily = os.path.join(root_dir, "data/sl...
[ "pandas.read_csv", "pandas.merge", "os.path.join", "sklearn.preprocessing.scale", "skmultiflow.data.DataStream", "pandas.DateOffset", "sklearn.preprocessing.minmax_scale", "numpy.expand_dims", "pandas.DataFrame", "pandas.concat", "pandas.to_datetime" ]
[((5912, 5942), 'skmultiflow.data.DataStream', 'DataStream', (['X_test_t', 'y_test_t'], {}), '(X_test_t, y_test_t)\n', (5922, 5942), False, 'from skmultiflow.data import DataStream, RegressionGenerator\n'), ((289, 338), 'os.path.join', 'os.path.join', (['root_dir', '"""data/slovenia_daily.csv"""'], {}), "(root_dir, 'da...
import os import numpy as np def preprocess_item(filename, folder): return np.genfromtxt( f"{folder}/{filename}", delimiter=",") def load_folder_data(folder): data = [] labels = [] for _, _, files in os.walk(folder): raw_data = [preprocess_item(filename, folder) for filename in file...
[ "numpy.where", "numpy.random.choice", "numpy.max", "numpy.stack", "numpy.array", "numpy.genfromtxt", "os.walk", "numpy.random.shuffle" ]
[((81, 133), 'numpy.genfromtxt', 'np.genfromtxt', (['f"""{folder}/{filename}"""'], {'delimiter': '""","""'}), "(f'{folder}/{filename}', delimiter=',')\n", (94, 133), True, 'import numpy as np\n'), ((229, 244), 'os.walk', 'os.walk', (['folder'], {}), '(folder)\n', (236, 244), False, 'import os\n'), ((409, 427), 'numpy.s...
""" Created on Sat May 23 18:17:31 2020 celebx = 'CC1=CC=C(C=C1)C2=CC(=NN2C3=CC=C(C=C3)S(=O)(=O)N)C(F)(F)F' tiotixene = 'CN1CCN(CC1)CCC=C2C3=CC=CC=C3SC4=C2C=C(C=C4)S(=O)(=O)N(C)C' Troglitazone = 'CC1=C(C2=C(CCC(O2)(C)COC3=CC=C(C=C3)CC4C(=O)NC(=O)S4)C(=C1O)C)C' @author: akshat """ import selfies ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.savefig", "selfies.get_semantic_robust_alphabet", "matplotlib.pyplot.ylabel", "numpy.random.choice", "matplotlib.pyplot.xlabel", "rdkit.DataStructs.cDataStructs.TanimotoSimilarity", "rdkit.Chem.MolFromSmiles", "matplotlib.pyplot.style.use", "rdkit.Chem...
[((629, 659), 'rdkit.RDLogger.DisableLog', 'RDLogger.DisableLog', (['"""rdApp.*"""'], {}), "('rdApp.*')\n", (648, 659), False, 'from rdkit import RDLogger\n'), ((10876, 10901), 'matplotlib.pyplot.style.use', 'plt.style.use', (['u"""classic"""'], {}), "(u'classic')\n", (10889, 10901), True, 'import matplotlib.pyplot as ...
from analyser import Analyser from explorer import Explorer import matplotlib.pyplot as plt import numpy as np class Reporter(): def __init__(self, explorer): self.explorer = explorer self.analyser = Analyser(self.explorer.df) def plot_tir(self, in_range, below_range, above_range, fname): ...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.errorbar", "analyser.Analyser", "matplotlib.pyplot.clf", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.pie", "numpy.array", "explorer.Explorer", "matplotlib.pyplot.title" ]
[((3693, 3731), 'explorer.Explorer', 'Explorer', (['"""diaguard.csv"""'], {'verbose': '(True)'}), "('diaguard.csv', verbose=True)\n", (3701, 3731), False, 'from explorer import Explorer\n'), ((221, 247), 'analyser.Analyser', 'Analyser', (['self.explorer.df'], {}), '(self.explorer.df)\n', (229, 247), False, 'from analys...
""" Functions to solve orbiting bodies problems. Written by: <NAME> """ import numpy as np from orbitutils.solvers import rkf45 def two_body_3d_rates(t, Y, m1=1., m2=.1): """Find the state derivatives for the two body problem in 3D. Parameters ---------- t : float Time to evaluat...
[ "numpy.reshape", "numpy.delete", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.concatenate", "numpy.linalg.norm", "orbitutils.solvers.rkf45" ]
[((812, 829), 'numpy.linalg.norm', 'np.linalg.norm', (['R'], {}), '(R)\n', (826, 829), True, 'import numpy as np\n'), ((868, 885), 'numpy.zeros', 'np.zeros', (['Y.shape'], {}), '(Y.shape)\n', (876, 885), True, 'import numpy as np\n'), ((1092, 1113), 'numpy.array', 'np.array', (['[0.0, 10.0]'], {}), '([0.0, 10.0])\n', (...
# -*- coding: utf-8 -*- # Copyright 2018 IBM. # # 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 agre...
[ "qiskit_aqua.get_aer_backend", "parameterized.parameterized.expand", "numpy.array", "unittest.main", "qiskit.QuantumCircuit", "qiskit.QuantumRegister" ]
[((1055, 1112), 'parameterized.parameterized.expand', 'parameterized.expand', (['[[1], [2], [3], [4], [5], [6], [7]]'], {}), '([[1], [2], [3], [4], [5], [6], [7]])\n', (1075, 1112), False, 'from parameterized import parameterized\n'), ((2934, 2949), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2947, 2949), Fals...
import functools import warnings import matplotlib.pyplot as plt import numpy as np import seaborn as sns import tensorflow.compat.v2 as tf import tensorflow_probability as tfp from tensorflow_probability import bijectors as tfb from tensorflow_probability import distributions as tfd tf.enable_v2_behavior() warnin...
[ "tensorflow_probability.bijectors.Softplus", "tensorflow_probability.distributions.Normal", "matplotlib.pyplot.show", "ipdb.set_trace", "tensorflow_probability.distributions.JointDistributionCoroutineAutoBatched", "tensorflow.compat.v2.random.normal", "tensorflow.compat.v2.optimizers.Adam", "tensorflo...
[((289, 312), 'tensorflow.compat.v2.enable_v2_behavior', 'tf.enable_v2_behavior', ([], {}), '()\n', (310, 312), True, 'import tensorflow.compat.v2 as tf\n'), ((314, 347), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (337, 347), False, 'import warnings\n'), ((1112, 1276),...
""" ================ Plot Vertex Data ================ This plots example vertex data onto an example subject, S1, onto a flatmap using quickflat. In order for this to run, you have to have a flatmap for this subject in the pycortex filestore. The cortex.Vertex object is instantiated with a numpy array of the same si...
[ "cortex.polyutils.Surface", "cortex.Vertex", "cortex.db.get_surf", "cortex.quickshow", "numpy.random.seed", "numpy.random.randn", "matplotlib.pyplot.show" ]
[((836, 856), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (850, 856), True, 'import numpy as np\n'), ((1351, 1377), 'numpy.random.randn', 'np.random.randn', (['num_verts'], {}), '(num_verts)\n', (1366, 1377), True, 'import numpy as np\n'), ((1457, 1490), 'cortex.Vertex', 'cortex.Vertex', (['tes...
""" Test functions Author(s): <NAME> (<EMAIL>) """ import numpy as np import tensorflow as tf class Function(object): def __init__(self): pass def evaluate(self, data): x = tf.placeholder(tf.float32, shape=[None, self.dim]) y = self.equation(x) with tf.Session() as...
[ "numpy.sqrt", "matplotlib.use", "tensorflow.placeholder", "matplotlib.pyplot.plot", "tensorflow.Session", "matplotlib.pyplot.figure", "numpy.linspace", "tensorflow.cos", "numpy.vstack", "matplotlib.pyplot.scatter", "numpy.random.uniform", "tensorflow.sin", "matplotlib.pyplot.subplot", "ten...
[((2798, 2822), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (2812, 2822), False, 'import matplotlib\n'), ((2850, 2891), 'numpy.random.uniform', 'np.random.uniform', (['(-0.5)', '(0.5)'], {'size': '(N, 2)'}), '(-0.5, 0.5, size=(N, 2))\n', (2867, 2891), True, 'import numpy as np\n'), ((295...
from pddlgym.parser import PDDLDomainParser, PDDLProblemParser from pddlgym.structs import LiteralConjunction import pddlgym import os import numpy as np from itertools import count np.random.seed(0) PDDLDIR = os.path.join(os.path.dirname(pddlgym.__file__), "pddl") I, G, W, P, X, H = range(6) TRAIN_GRID1 = np.arra...
[ "numpy.flipud", "os.path.join", "os.path.dirname", "numpy.array", "numpy.argwhere", "numpy.empty", "numpy.random.seed", "pddlgym.parser.PDDLProblemParser.create_pddl_file" ]
[((182, 199), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (196, 199), True, 'import numpy as np\n'), ((313, 592), 'numpy.array', 'np.array', (['[[I, P, P, P, X, X, X, W, W, G], [W, W, X, P, X, W, W, X, X, P], [W, W, X,\n P, X, X, W, X, X, P], [W, W, X, P, X, X, X, X, X, P], [W, W, X, P, X, W,\n ...
import numpy as np import cv2 as cv from imutils.video import WebcamVideoStream import glob import time import math class PoseEstimation(): def __init__(self, mtx, dist): self.mtx = mtx self.dist = dist def detect_contourn(self, image, color): hsv = cv.cvtColor(image, cv.CO...
[ "cv2.projectPoints", "numpy.array", "cv2.arcLength", "cv2.solvePnPRansac", "numpy.dot", "numpy.concatenate", "cv2.drawContours", "numpy.ones", "cv2.minEnclosingCircle", "cv2.morphologyEx", "cv2.circle", "cv2.cvtColor", "cv2.moments", "numpy.shape", "numpy.transpose", "cv2.inRange", "...
[((296, 332), 'cv2.cvtColor', 'cv.cvtColor', (['image', 'cv.COLOR_BGR2HSV'], {}), '(image, cv.COLOR_BGR2HSV)\n', (307, 332), True, 'import cv2 as cv\n'), ((1092, 1131), 'cv2.inRange', 'cv.inRange', (['hsv', 'self.lower', 'self.upper'], {}), '(hsv, self.lower, self.upper)\n', (1102, 1131), True, 'import cv2 as cv\n'), (...
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/core.ipynb (unless otherwise specified). __all__ = ['StatsForecast'] # Cell import inspect import logging from functools import partial from os import cpu_count import numpy as np import pandas as pd # Internal Cell logging.basicConfig( format='%(asctime)s %(name)...
[ "logging.getLogger", "numpy.hstack", "ray.is_initialized", "inspect.signature", "os.cpu_count", "ray.util.multiprocessing.Pool", "ray.available_resources", "ray.init", "pandas.date_range", "numpy.arange", "itertools.repeat", "numpy.repeat", "numpy.vstack", "pandas.DataFrame", "numpy.allc...
[((268, 384), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(name)s %(levelname)s: %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(format=\n '%(asctime)s %(name)s %(levelname)s: %(message)s', datefmt=\n '%Y-%m-%d %H:%M:%S')\n", (287, 384), False, 'import logging\n'), ((...
import unittest import numpy as np import torch from pyscf import gto from torch.autograd import Variable, grad, gradcheck from qmctorch.scf import Molecule from qmctorch.wavefunction import SlaterJastrow torch.set_default_tensor_type(torch.DoubleTensor) def hess(out, pos): # compute the jacobian z = Variab...
[ "qmctorch.scf.Molecule", "torch.manual_seed", "torch.ones_like", "pyscf.gto.M", "torch.set_default_tensor_type", "torch.autograd.grad", "numpy.random.seed", "qmctorch.wavefunction.SlaterJastrow", "torch.allclose", "torch.autograd.Variable", "torch.autograd.gradcheck", "torch.zeros", "torch.r...
[((207, 256), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['torch.DoubleTensor'], {}), '(torch.DoubleTensor)\n', (236, 256), False, 'import torch\n'), ((587, 611), 'torch.zeros', 'torch.zeros', (['jacob.shape'], {}), '(jacob.shape)\n', (598, 611), False, 'import torch\n'), ((1204, 1228), 'torch.z...
#Utility file of functions and imports #Doles, Nix, Terlecky #File includes standard imports and defined functions used in multiple project files # # import random import itertools import numpy as np import pandas as pd import numpy as np import glob from sklearn.model_selection import train_test_split from sklearn.e...
[ "numpy.array", "random.random", "sklearn.externals.joblib.load", "numpy.argpartition" ]
[((2642, 2656), 'sklearn.externals.joblib.load', 'joblib.load', (['m'], {}), '(m)\n', (2653, 2656), False, 'from sklearn.externals import joblib\n'), ((4446, 4460), 'sklearn.externals.joblib.load', 'joblib.load', (['s'], {}), '(s)\n', (4457, 4460), False, 'from sklearn.externals import joblib\n'), ((5308, 5331), 'sklea...
import os import random import warnings import numpy as np from tqdm import tqdm from PIL import Image, ImageFile from torch.utils.data import Dataset from taming.data.base import ImagePaths ImageFile.LOAD_TRUNCATED_IMAGES = True Image.MAX_IMAGE_PIXELS = None def test_images(root, images): passed_images = list...
[ "taming.data.base.ImagePaths", "os.listdir", "random.shuffle", "tqdm.tqdm", "os.path.join", "warnings.catch_warnings", "os.path.splitext", "os.path.isfile", "numpy.array", "numpy.load", "numpy.save" ]
[((340, 352), 'tqdm.tqdm', 'tqdm', (['images'], {}), '(images)\n', (344, 352), False, 'from tqdm import tqdm\n'), ((751, 782), 'os.path.join', 'os.path.join', (['root', '"""train.npy"""'], {}), "(root, 'train.npy')\n", (763, 782), False, 'import os\n'), ((798, 827), 'os.path.join', 'os.path.join', (['root', '"""val.npy...
import json import numpy as np from fairseq.criterions.data_utils.task_def import TaskType, DataFormat def load_data(file_path, data_format, task_type, label_dict=None): """ :param file_path: :param data_format: :param task_type: :param label_dict: map string label to numbers. ...
[ "numpy.argmax" ]
[((2001, 2018), 'numpy.argmax', 'np.argmax', (['labels'], {}), '(labels)\n', (2010, 2018), True, 'import numpy as np\n')]
import pysplishsplash import gym import pickle import numpy as np import torch import argparse import os,sys import time from scipy.ndimage import gaussian_filter,gaussian_filter1d from scipy.stats import linregress from scipy.spatial.transform import Rotation as R import math import matplotlib.pyplot as plt from tqdm...
[ "TD3_particles.TD3", "matplotlib.pyplot.ylabel", "numpy.array", "torch.cuda.is_available", "scipy.ndimage.gaussian_filter", "gym.make", "numpy.arange", "matplotlib.pyplot.imshow", "numpy.mean", "argparse.ArgumentParser", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.linspace",...
[((1444, 1466), 'torch.cat', 'torch.cat', (['all_feat', '(0)'], {}), '(all_feat, 0)\n', (1453, 1466), False, 'import torch\n'), ((1482, 1504), 'torch.cat', 'torch.cat', (['all_part', '(0)'], {}), '(all_part, 0)\n', (1491, 1504), False, 'import torch\n'), ((2226, 2283), 'matplotlib.pyplot.plot', 'plt.plot', (['emp_avg']...
import pandas as pd import numpy as np import quandl, math, datetime from sklearn import preprocessing, svm from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from matplotlib import style style.use('ggplot') df = quandl.g...
[ "datetime.datetime.fromtimestamp", "matplotlib.pyplot.ylabel", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "numpy.array", "quandl.get", "matplotlib.style.use", "sklearn.linear_model.LinearRegression", "sklearn.preprocessing.scale", "matplot...
[((284, 303), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (293, 303), False, 'from matplotlib import style\n'), ((312, 336), 'quandl.get', 'quandl.get', (['"""WIKI/GOOGL"""'], {}), "('WIKI/GOOGL')\n", (322, 336), False, 'import quandl, math, datetime\n'), ((844, 866), 'sklearn.preproces...
import numpy as np # iterator for X with multiple observation sequences # copied from hmmlearn def iter_from_X_lengths(X, lengths): if lengths is None: yield 0, len(X) else: n_samples = X.shape[0] end = np.cumsum(lengths).astype(np.int32) start = end - lengths if end[-1]...
[ "numpy.errstate", "numpy.log", "numpy.cumsum" ]
[((632, 660), 'numpy.errstate', 'np.errstate', ([], {'divide': '"""ignore"""'}), "(divide='ignore')\n", (643, 660), True, 'import numpy as np\n'), ((677, 686), 'numpy.log', 'np.log', (['a'], {}), '(a)\n', (683, 686), True, 'import numpy as np\n'), ((236, 254), 'numpy.cumsum', 'np.cumsum', (['lengths'], {}), '(lengths)\...
import numpy as np def fg_bg_data(labels,fg_labels): ''' given cifar data convert into fg and background data inputs : original cifar labels as list, foreground labels as list returns cifar labels as binary labels with foreground data as class 0 and background data as class 1 ''' labels =...
[ "numpy.array", "numpy.logical_not", "numpy.logical_or", "numpy.max" ]
[((321, 337), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (329, 337), True, 'import numpy as np\n'), ((462, 488), 'numpy.logical_not', 'np.logical_not', (['fg_indices'], {}), '(fg_indices)\n', (476, 488), True, 'import numpy as np\n'), ((837, 853), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n...
""" References ------------ 1. https://www.baeldung.com/cs/svm-multiclass-classification 2. https://shomy.top/2017/02/20/svm04-soft-margin/ 3. http://people.csail.mit.edu/dsontag/courses/ml13/slides/lecture6.pdf """ import pandas as pd import numpy as np class MulticlassSVM: """ Simply use one-vs-rest ""...
[ "pandas.read_csv", "numpy.where", "numpy.argmax", "numpy.zeros", "numpy.full" ]
[((890, 927), 'numpy.zeros', 'np.zeros', (['(self.n_classes, n_samples)'], {}), '((self.n_classes, n_samples))\n', (898, 927), True, 'import numpy as np\n'), ((1956, 1983), 'numpy.zeros', 'np.zeros', (['(self.n_classes,)'], {}), '((self.n_classes,))\n', (1964, 1983), True, 'import numpy as np\n'), ((2360, 2379), 'numpy...
import numpy as np from ..utils.dictionary import get_lambda_max def simulate_data(n_times, n_times_atom, n_atoms, n_channels, noise_level, random_state=None): rng = np.random.RandomState(random_state) rho = n_atoms / (n_channels * n_times_atom) D = rng.normal(scale=10.0, size=(n_atoms,...
[ "numpy.array", "numpy.convolve", "numpy.random.RandomState" ]
[((191, 226), 'numpy.random.RandomState', 'np.random.RandomState', (['random_state'], {}), '(random_state)\n', (212, 226), True, 'import numpy as np\n'), ((356, 367), 'numpy.array', 'np.array', (['D'], {}), '(D)\n', (364, 367), True, 'import numpy as np\n'), ((644, 671), 'numpy.convolve', 'np.convolve', (['zk', 'dk', '...
import numpy as np #https://github.com/Robonchu/PythonSimpleManipulation def skew_mat(vector): mat = np.zeros((3, 3)) mat[0, 1] = -vector[2] mat[0, 2] = vector[1] mat[1, 0] = vector[2] mat[1, 2] = -vector[0] mat[2, 0] = -vector[1] mat[2, 1] = vector[0] return mat def rodrigues_mat(vec...
[ "numpy.sin", "numpy.eye", "numpy.zeros", "numpy.cos" ]
[((107, 123), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (115, 123), True, 'import numpy as np\n'), ((572, 581), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (578, 581), True, 'import numpy as np\n'), ((597, 619), 'numpy.zeros', 'np.zeros', (['(dof + 2, 3)'], {}), '((dof + 2, 3))\n', (605, 619), True,...
# -*- coding: utf-8 -*- import numpy as np def Chapman(Q, b_LH, a, return_exceed=False): """Chapman filter (Chapman, 1991) Args: Q (np.array): streamflow a (float): recession coefficient """ b = [b_LH[0]] x = b_LH[0] for i in range(Q.shape[0] - 1): x = (3 * a - 1) / (3...
[ "numpy.count_nonzero", "numpy.array" ]
[((398, 409), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (406, 409), True, 'import numpy as np\n'), ((515, 537), 'numpy.count_nonzero', 'np.count_nonzero', (['mask'], {}), '(mask)\n', (531, 537), True, 'import numpy as np\n')]
#!/usr/bin/env python # Copyright 2020 Johns Hopkins University (Author: <NAME>) # Apache 2.0 # This script is based on the Bayesian HMM-based xvector clustering # code released by BUTSpeech at: https://github.com/BUTSpeechFIT/VBx. # Note that this assumes that the provided labels are for a single # recording. So this...
[ "re.split", "numpy.sqrt", "numpy.ones", "argparse.ArgumentParser", "kaldi_io.read_plda", "kaldi_io.read_vec_flt_ark", "numpy.max", "numpy.argsort", "numpy.array", "numpy.zeros", "VB_diarization.VB_diarization", "scipy.special.softmax" ]
[((679, 881), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This script performs Bayesian HMM-based\n clustering of x-vectors for one recording"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(description=\n """This script performs Bayesian HMM-based\n...
from copy import copy import numpy as np from gym_chess import ChessEnvV1 from gym_chess.envs.chess_v1 import ( KING_ID, QUEEN_ID, ROOK_ID, BISHOP_ID, KNIGHT_ID, PAWN_ID, ) from gym_chess.test.utils import run_test_funcs # Blank board BASIC_BOARD = np.array([[0] * 8] * 8, dtype=np.int8) # Pa...
[ "gym_chess.test.utils.run_test_funcs", "numpy.array", "copy.copy", "gym_chess.ChessEnvV1" ]
[((276, 314), 'numpy.array', 'np.array', (['([[0] * 8] * 8)'], {'dtype': 'np.int8'}), '([[0] * 8] * 8, dtype=np.int8)\n', (284, 314), True, 'import numpy as np\n'), ((380, 397), 'copy.copy', 'copy', (['BASIC_BOARD'], {}), '(BASIC_BOARD)\n', (384, 397), False, 'from copy import copy\n'), ((461, 509), 'gym_chess.ChessEnv...
from arcgis import GIS from arcgis.features import GeoAccessor, GeoSeriesAccessor import arcpy from arcpy import env from arcpy.sa import * import numpy as np import os import pandas as pd ##### arcpy.env.overwriteOutput = True arcpy.CheckOutExtension("Spatial") def select_feature_by_attributes_arcgis(input,Attri_NM...
[ "numpy.logical_and", "arcpy.Select_analysis", "arcpy.CheckOutExtension", "pandas.merge", "os.path.join", "numpy.isin", "pandas.DataFrame.spatial.from_featureclass" ]
[((230, 264), 'arcpy.CheckOutExtension', 'arcpy.CheckOutExtension', (['"""Spatial"""'], {}), "('Spatial')\n", (253, 264), False, 'import arcpy\n'), ((659, 709), 'arcpy.Select_analysis', 'arcpy.Select_analysis', (['input', 'output', 'where_clause'], {}), '(input, output, where_clause)\n', (680, 709), False, 'import arcp...
from breidablik.interpolate.spectra import Spectra import numpy as np import pytest import warnings try: Spectra() flag = False except: flag = True # skip these tests if the trained models are not present pytestmark = pytest.mark.skipif(flag, reason = 'No trained Spectra model') class Test_find_abund: ...
[ "warnings.catch_warnings", "breidablik.interpolate.spectra.Spectra", "numpy.linspace", "pytest.raises", "pytest.mark.skipif", "warnings.simplefilter" ]
[((231, 290), 'pytest.mark.skipif', 'pytest.mark.skipif', (['flag'], {'reason': '"""No trained Spectra model"""'}), "(flag, reason='No trained Spectra model')\n", (249, 290), False, 'import pytest\n'), ((110, 119), 'breidablik.interpolate.spectra.Spectra', 'Spectra', ([], {}), '()\n', (117, 119), False, 'from breidabli...
import os import sys import cv2 import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import scipy.misc as sic class Cube2Equirec(nn.Module): def __init__(self, cube_length, equ_h): super().__init__() self.cube_length =...
[ "numpy.tile", "torch.nn.functional.grid_sample", "numpy.asarray", "numpy.min", "torch.FloatTensor", "numpy.array", "numpy.dot", "cv2.Rodrigues", "numpy.cos", "numpy.concatenate", "numpy.argmin", "numpy.sin", "numpy.meshgrid", "torch.BoolTensor", "torch.zeros", "numpy.arange", "matplo...
[((3423, 3433), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3431, 3433), True, 'import matplotlib.pyplot as plt\n'), ((566, 589), 'numpy.meshgrid', 'np.meshgrid', (['theta', 'phi'], {}), '(theta, phi)\n', (577, 589), True, 'import numpy as np\n'), ((642, 653), 'numpy.sin', 'np.sin', (['phi'], {}), '(phi)\n...
import math import re import os import numpy as np from torch.utils.data import Dataset class SutskeverDataset(Dataset): """ Loads from folder 'path' the dataset generated with 'dataset_generation.py' as numpy.ndarray. Expects one .npy file for sequence and returns numpy.ndarrays with shape (tim...
[ "os.path.exists", "os.listdir", "re.compile", "os.path.join", "math.sqrt", "os.path.isdir", "numpy.load" ]
[((810, 826), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (820, 826), False, 'import os\n'), ((1037, 1063), 're.compile', 're.compile', (['filename_regex'], {}), '(filename_regex)\n', (1047, 1063), False, 'import re\n'), ((1382, 1424), 'os.path.join', 'os.path.join', (['self._path', 'self._files[key]'], {})...
""" Plots figure S5: yt correlation of zonal-mean downward long wave radiation at the surface (top) and longwave cloud radiative forcing at the surface (bottom) with vertically and zonally integrated eddy moisture transport at 70N for (left) reanalysis data (left) and aquaplanet control simulation data (right). """ ...
[ "matplotlib.pyplot.savefig", "numpy.arange", "numpy.swapaxes", "numpy.array", "xarray.open_dataset", "matplotlib.pyplot.subplots", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.show" ]
[((1001, 1027), 'xarray.open_dataset', 'xr.open_dataset', (['filename1'], {}), '(filename1)\n', (1016, 1027), True, 'import xarray as xr\n'), ((1042, 1068), 'xarray.open_dataset', 'xr.open_dataset', (['filename2'], {}), '(filename2)\n', (1057, 1068), True, 'import xarray as xr\n'), ((1600, 1626), 'xarray.open_dataset',...
""" Generic type & functions for torch.Tensor and np.ndarray """ import torch from torch import Tensor import numpy as np from numpy import ndarray from typing import Tuple, Union, List, TypeVar TensArr = TypeVar('TensArr', Tensor, ndarray) def convert(a: TensArr, astype: type) -> TensArr: if astype == Tenso...
[ "torch.tensor", "numpy.any", "typing.TypeVar" ]
[((210, 245), 'typing.TypeVar', 'TypeVar', (['"""TensArr"""', 'Tensor', 'ndarray'], {}), "('TensArr', Tensor, ndarray)\n", (217, 245), False, 'from typing import Tuple, Union, List, TypeVar\n'), ((2063, 2088), 'numpy.any', 'np.any', (['(types != types[0])'], {}), '(types != types[0])\n', (2069, 2088), True, 'import num...
import glob import os import os.path as osp import sys import torch import torch.utils.data as data import cv2 import numpy as np import torchvision.transforms as T from layers.box_utils import point_form from PIL import ImageDraw, ImageOps, Image, ImageFont import string tv_transform = T.Compose([ T.ToTensor(), ...
[ "numpy.ones_like", "PIL.Image.open", "utils.augmentations.SSDAugmentation", "numpy.hstack", "os.path.join", "os.path.isfile", "numpy.array", "pdb.set_trace", "numpy.concatenate", "torchvision.transforms.Normalize", "torchvision.transforms.ToTensor", "sys.path.append" ]
[((787, 877), 'numpy.concatenate', 'np.concatenate', (['[boxes[:, :2] - boxes[:, 2:] / 2, boxes[:, :2] + boxes[:, 2:] / 2]', '(1)'], {}), '([boxes[:, :2] - boxes[:, 2:] / 2, boxes[:, :2] + boxes[:, 2:\n ] / 2], 1)\n', (801, 877), True, 'import numpy as np\n'), ((2849, 2906), 'sys.path.append', 'sys.path.append', (['...
# Copyright 2021 NVIDIA Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
[ "argparse.ArgumentParser", "time", "pandas.DataFrame", "numpy.random.randn", "numpy.arange" ]
[((1831, 1842), 'numpy.random.randn', 'randn', (['size'], {}), '(size)\n', (1836, 1842), False, 'from numpy.random import randn\n'), ((1853, 1899), 'pandas.DataFrame', 'pd.DataFrame', (["{'key': key, 'payload': payload}"], {}), "({'key': key, 'payload': payload})\n", (1865, 1899), True, 'import pandas as pd\n'), ((2618...
# -*- coding utf-8-*- """ Created on Tue Nov 23 10:15:35 2018 @author: galad-loth """ import numpy as npy import mxnet as mx class SSDHLoss(mx.operator.CustomOp): """ Loss layer for supervised semantics-preserving deep hashing. """ def __init__(self, w_bin, w_balance): self._w_b...
[ "numpy.mean", "mxnet.sym.Activation", "numpy.ones", "mxnet.symbol.Custom", "mxnet.nd.zeros", "mxnet.symbol.FullyConnected", "mxnet.cpu", "mxnet.sym.Variable", "numpy.zeros", "mxnet.symbol.SoftmaxOutput", "mxnet.nd.array", "numpy.maximum", "mxnet.sym.Group", "mxnet.operator.register" ]
[((968, 1001), 'mxnet.operator.register', 'mx.operator.register', (['"""ssdh_loss"""'], {}), "('ssdh_loss')\n", (988, 1001), True, 'import mxnet as mx\n'), ((2789, 2825), 'mxnet.operator.register', 'mx.operator.register', (['"""siam_dh_Loss"""'], {}), "('siam_dh_Loss')\n", (2809, 2825), True, 'import mxnet as mx\n'), (...
# MIT License # This project is a software package to automate the performance tracking of the HPC algorithms # Copyright (c) 2021. <NAME>, <NAME>, <NAME>, <NAME> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to ...
[ "model.get_field_values", "numpy.unique", "model.get_concat_dataframe", "visuals.make_graph_table", "dash_html_components.P", "specs.get_specs" ]
[((3849, 3890), 'model.get_concat_dataframe', 'model.get_concat_dataframe', (['collection_ls'], {}), '(collection_ls)\n', (3875, 3890), False, 'import model\n'), ((4451, 4571), 'visuals.make_graph_table', 'visuals.make_graph_table', (['concat_df', '"""Performance Plot"""', 'graph[0]', 'versions', 'speedup_options', 'li...
import keras import numpy as np import pandas as pd import os from keras import backend as K from keras.layers import Input, Dense, Dropout, GaussianNoise, BatchNormalization, GaussianDropout import keras.backend as backend from keras.models import Model, Sequential from keras.callbacks import ModelCheckpoint, CSVLogg...
[ "sklearn.preprocessing.LabelEncoder", "keras.backend.sum", "pandas.read_csv", "keras.callbacks.History", "keras.layers.Dense", "numpy.arange", "keras.backend.square", "numpy.random.seed", "keras.models.Model", "keras.backend.transpose", "keras.layers.GaussianNoise", "keras.callbacks.CSVLogger"...
[((1716, 1763), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x_data', 'y_data'], {'test_size': '(0.3)'}), '(x_data, y_data, test_size=0.3)\n', (1732, 1763), False, 'from sklearn.model_selection import train_test_split\n'), ((2107, 2139), 'keras.layers.Input', 'Input', ([], {'shape': '(x_train.shap...
""" A collection of classes extending the functionality of Python's builtins. email <EMAIL> """ import re import typing import string import enum import os import sys from glob import glob from pathlib import Path import copy import numpy as np import pandas as pd import matplotlib.pyplot as plt # %% ===============...
[ "pandas.read_csv", "gzip.open", "scipy.io.loadmat", "webbrowser.open", "numpy.array_split", "matplotlib.colors.CSS4_COLORS.keys", "matplotlib.pyplot.MultipleLocator", "matplotlib.pyplot.style.context", "copy.deepcopy", "numpy.sin", "numpy.arange", "textwrap.dedent", "re.split", "subprocess...
[((3278, 3284), 'pathlib.Path', 'Path', ([], {}), '()\n', (3282, 3284), False, 'from pathlib import Path\n'), ((32307, 32333), 'numpy.concatenate', 'np.concatenate', (['op'], {'axis': '(0)'}), '(op, axis=0)\n', (32321, 32333), True, 'import numpy as np\n'), ((1126, 1164), 'numpy.save', 'np.save', (['path', 'self.__dict...
import numpy as np import scipy.signal from gym.spaces import Box, Discrete import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions.normal import Normal from torch.distributions.categorical import Categorical def initialize_weights_he(m): if isinstance(m, nn.Linear) or isinstan...
[ "numpy.prod", "torch.nn.ReLU", "torch.nn.init.constant_", "torch.nn.Sequential", "torch.distributions.normal.Normal", "numpy.log", "torch.exp", "torch.squeeze", "torch.tanh", "numpy.isscalar", "torch.nn.AdaptiveAvgPool2d", "torch.argmax", "torch.nn.init.kaiming_uniform_", "torch.nn.functio...
[((962, 984), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (975, 984), True, 'import torch.nn as nn\n'), ((1035, 1044), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (1042, 1044), True, 'import torch.nn as nn\n'), ((346, 386), 'torch.nn.init.kaiming_uniform_', 'torch.nn.init.kaiming_uniform...
from __future__ import absolute_import, division, print_function, unicode_literals import unittest import io import os import tempfile import numpy as np from pystan import stan, stanc class TestStanFileIO(unittest.TestCase): def test_stan_model_from_file(self): bernoulli_model_code = """ d...
[ "numpy.mean", "pystan.stanc", "os.path.join", "io.open", "pystan.stan", "tempfile.mkdtemp", "numpy.var", "os.remove" ]
[((698, 716), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (714, 716), False, 'import tempfile\n'), ((735, 775), 'os.path.join', 'os.path.join', (['temp_dir', '"""modelcode.stan"""'], {}), "(temp_dir, 'modelcode.stan')\n", (747, 775), False, 'import os\n'), ((936, 978), 'pystan.stan', 'stan', ([], {'model_...
# -*- coding: utf-8 -*- """ Created on Sun Nov 26 15:55:37 2017 @author: Administrator """ import numpy as np#使用import导入模块numpy import matplotlib.pyplot as plt#使用import导入模块matplotlib.pyplot import plotly as py # 导入plotly库并命名为py # -------------pre def pympl = py.offline.plot_mpl # 配置中文显示 plt.rcParams['font.family'] =...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "numpy.sin", "matplotlib.pyplot.subplots", "numpy.arange" ]
[((411, 425), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (423, 425), True, 'import matplotlib.pyplot as plt\n'), ((438, 454), 'numpy.arange', 'np.arange', (['(1)', '(30)'], {}), '(1, 30)\n', (447, 454), True, 'import numpy as np\n'), ((457, 466), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (463, 4...
import matplotlib import matplotlib.pyplot as plt import os import numpy as np import torch import torch.nn.functional as F from configs.Config_chd import get_config from utilities.file_and_folder_operations import subfiles def reshape_array(numpy_array, axis=1): image_shape = numpy_array.shape[1] channel = n...
[ "matplotlib.pyplot.imshow", "utilities.file_and_folder_operations.subfiles", "torch.max", "os.path.join", "torch.argmax", "torch.tensor", "matplotlib.pyplot.figure", "configs.Config_chd.get_config", "torch.nn.functional.interpolate", "numpy.concatenate", "matplotlib.pyplot.title", "numpy.shape...
[((1511, 1523), 'configs.Config_chd.get_config', 'get_config', ([], {}), '()\n', (1521, 1523), False, 'from configs.Config_chd import get_config\n'), ((2877, 2935), 'utilities.file_and_folder_operations.subfiles', 'subfiles', (['c.scaled_image_16_dir'], {'suffix': '""".npy"""', 'join': '(False)'}), "(c.scaled_image_16_...
# 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...
[ "image_manipulation.rotate180", "official.resnet.resnet_run_loop.resnet_model_fn", "tensorflow.logging.set_verbosity", "official.resnet.resnet_run_loop.ResnetArgParser", "image_manipulation.rotate270", "numpy.array", "image_manipulation.grayscale_contrast", "tensorflow.nn.dropout", "sys.path.append"...
[((1288, 1365), 'sys.path.append', 'sys.path.append', (['"""/work/generalisation-humans-DNNs/code/accuracy_evaluation/"""'], {}), "('/work/generalisation-humans-DNNs/code/accuracy_evaluation/')\n", (1303, 1365), False, 'import sys\n'), ((1604, 1612), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (1609, 1612), False...
import numpy as np import random from nltk import word_tokenize from nltk.corpus import stopwords from nltk import WordNetLemmatizer from sklearn import svm from sklearn.model_selection import GridSearchCV import random with open('./data/vocab.txt', 'r') as fp: vocab_list = fp.read().split('\n') vocab = {wo...
[ "sklearn.model_selection.GridSearchCV", "nltk.corpus.stopwords.words", "nltk.word_tokenize", "nltk.WordNetLemmatizer", "numpy.array", "sklearn.svm.SVC" ]
[((748, 774), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (763, 774), False, 'from nltk.corpus import stopwords\n'), ((787, 806), 'nltk.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (804, 806), False, 'from nltk import WordNetLemmatizer\n'), ((826, 849), 'nlt...
'''The module creates image directories for various classes out of a dataframe for data augmentation purposes.''' #importing libraries import numpy as np import pandas as pd import os from PIL import Image def create_dir(path,class_list): ''' The function takes in the path and list of the classes to c...
[ "numpy.array", "PIL.Image.fromarray", "os.path.join", "os.mkdir" ]
[((581, 608), 'os.path.join', 'os.path.join', (['path', '"""train"""'], {}), "(path, 'train')\n", (593, 608), False, 'import os\n'), ((621, 648), 'os.path.join', 'os.path.join', (['path', '"""valid"""'], {}), "(path, 'valid')\n", (633, 648), False, 'import os\n'), ((650, 670), 'os.mkdir', 'os.mkdir', (['train_path'], {...
import cv2 import numpy as np def build_transformation_matrix(transform): """Convert transform list to transformation matrix :param transform: transform list as [dx, dy, da] :return: transform matrix as 2d (2, 3) numpy array """ transform_matrix = np.zeros((2, 3)) transform_matrix[0, 0] = np...
[ "cv2.copyMakeBorder", "numpy.array", "numpy.zeros", "numpy.arctan2", "numpy.cos", "cv2.cvtColor", "numpy.sin" ]
[((271, 287), 'numpy.zeros', 'np.zeros', (['(2, 3)'], {}), '((2, 3))\n', (279, 287), True, 'import numpy as np\n'), ((1269, 1414), 'cv2.copyMakeBorder', 'cv2.copyMakeBorder', (['frame'], {'top': 'border_size', 'bottom': 'border_size', 'left': 'border_size', 'right': 'border_size', 'borderType': 'border_mode', 'value': ...
# # Simulations: discharge of a lead-acid battery # import argparse import matplotlib.pyplot as plt import numpy as np import pickle import pybamm import shared_plotting from collections import defaultdict from shared_solutions import model_comparison, convergence_study try: from config import OUTPUT_DIR except Im...
[ "pybamm.set_logging_level", "shared_plotting.plot_variable", "numpy.array", "pybamm.lead_acid.LOQS", "shared_solutions.model_comparison", "shared_plotting.plot_voltage_components", "argparse.ArgumentParser", "shared_plotting.plot_voltages", "pybamm.rmse", "numpy.linspace", "pybamm.lead_acid.Comp...
[((515, 567), 'shared_plotting.plot_voltages', 'shared_plotting.plot_voltages', (['all_variables', 't_eval'], {}), '(all_variables, t_eval)\n', (544, 567), False, 'import shared_plotting\n'), ((813, 847), 'numpy.array', 'np.array', (['[0, 0.195, 0.375, 0.545]'], {}), '([0, 0.195, 0.375, 0.545])\n', (821, 847), True, 'i...
# Copyright 2018-2021 Lawrence Livermore National Security, LLC and other # Fat Crayon Toolkit Project Developers. See the top-level COPYRIGHT file for details. from __future__ import print_function """ Classes and routines for generating 3D objects """ import math import numpy as np from scipy.spatial import ConvexHul...
[ "math.sqrt", "math.cos", "numpy.array", "numpy.linalg.norm", "copy.deepcopy", "numpy.cross", "numpy.asarray", "numpy.dot", "numpy.random.seed", "numpy.vstack", "sys.stdout.flush", "numpy.random.normal", "re.match", "scipy.spatial.ConvexHull", "math.atan2", "numpy.transpose", "scipy.s...
[((8328, 8496), 'numpy.asarray', 'np.asarray', (['[[-0.5, -0.5, -0.5], [0.5, -0.5, -0.5], [-0.5, 0.5, -0.5], [0.5, 0.5, -0.5],\n [-0.5, -0.5, 0.5], [0.5, -0.5, 0.5], [-0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]'], {}), '([[-0.5, -0.5, -0.5], [0.5, -0.5, -0.5], [-0.5, 0.5, -0.5], [0.5,\n 0.5, -0.5], [-0.5, -0.5, 0.5], [0.5,...
import numpy as np from pommerman.constants import Item from util.analytics import Stopwatch def transform_observation(obs, p_obs=False, centralized=False): """ Transform a singular observation of the board into a stack of binary planes. :param obs: The observation containing the board ...
[ "numpy.ones", "numpy.isin", "numpy.stack", "numpy.zeros", "numpy.array", "numpy.moveaxis" ]
[((1877, 1902), 'numpy.stack', 'np.stack', (['planes'], {'axis': '(-1)'}), '(planes, axis=-1)\n', (1885, 1902), True, 'import numpy as np\n'), ((1922, 1953), 'numpy.moveaxis', 'np.moveaxis', (['transformed', '(-1)', '(0)'], {}), '(transformed, -1, 0)\n', (1933, 1953), True, 'import numpy as np\n'), ((2506, 2548), 'nump...
import gym import numpy as np class SpaceWrapper: def __init__(self, space): if isinstance(space, gym.spaces.Discrete): self.shape = () self.dtype = np.dtype(np.int64) elif isinstance(space, gym.spaces.Box): self.shape = space.shape self.dtype = np.d...
[ "numpy.dtype" ]
[((187, 205), 'numpy.dtype', 'np.dtype', (['np.int64'], {}), '(np.int64)\n', (195, 205), True, 'import numpy as np\n'), ((316, 337), 'numpy.dtype', 'np.dtype', (['space.dtype'], {}), '(space.dtype)\n', (324, 337), True, 'import numpy as np\n')]
import numpy as np import torch.nn.functional as F import math from torchvision import transforms import torch import cv2 import matplotlib import matplotlib.pyplot as plt import matplotlib.patches as patches matplotlib.use('agg') MAPS = ['map3','map4'] Scales = [0.9, 1.1] MIN_HW = 384 MAX_HW = 1584 IM_NORM_MEAN = [0...
[ "cv2.rectangle", "torch.from_numpy", "torch.nn.functional.interpolate", "torch.nn.functional.pad", "torch.floor", "torch.clamp_min", "numpy.exp", "matplotlib.pyplot.close", "torchvision.transforms.ToTensor", "cv2.waitKey", "torch.nn.functional.mse_loss", "matplotlib.use", "torch.Tensor", "...
[((209, 230), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (223, 230), False, 'import matplotlib\n'), ((1447, 1495), 'numpy.exp', 'np.exp', (['(-(x * x + y * y) / (2.0 * sigma * sigma))'], {}), '(-(x * x + y * y) / (2.0 * sigma * sigma))\n', (1453, 1495), True, 'import numpy as np\n'), ((2742, ...
#!/usr/bin/env py3 from __future__ import division, print_function, absolute_import import os import sys import re import numpy as np import pdb ''' ============================ @FileName: gen_fi_validation_data.py @Author: <NAME> (<EMAIL>) @Version: 1.0 @DateTime: 2018-03-22 17:07:19 =====================...
[ "logging.getLogger", "logging.StreamHandler", "argparse.ArgumentParser", "logging.Formatter", "numpy.zeros", "logging.FileHandler", "re.sub", "numpy.load", "time.time" ]
[((4064, 4116), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""gen_fi_validation_data"""'}), "(description='gen_fi_validation_data')\n", (4078, 4116), False, 'from argparse import ArgumentParser\n'), ((4711, 4730), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (4728, 4730), False, '...
import numpy from ._gauss_kronrod import _gauss_kronrod_integrate def _numpy_all_except(a, axis=-1): axes = numpy.arange(a.ndim) axes = numpy.delete(axes, axis) return numpy.all(a, axis=tuple(axes)) class IntegrationError(Exception): pass def integrate_adaptive( f, intervals, eps_abs=...
[ "numpy.abs", "numpy.delete", "numpy.array", "numpy.concatenate", "numpy.arange" ]
[((115, 135), 'numpy.arange', 'numpy.arange', (['a.ndim'], {}), '(a.ndim)\n', (127, 135), False, 'import numpy\n'), ((147, 171), 'numpy.delete', 'numpy.delete', (['axes', 'axis'], {}), '(axes, axis)\n', (159, 171), False, 'import numpy\n'), ((467, 489), 'numpy.array', 'numpy.array', (['intervals'], {}), '(intervals)\n'...
import torch import numpy as np from eval import metrics import gc def evaluate_user(model, eval_loader, device, mode='pretrain'): """ evaluate model on recommending items to users (primarily during pre-training step) """ model.eval() eval_loss = 0.0 n100_list, r20_list, r50_list = [], [], [] eval...
[ "torch.mean", "eval.metrics.recall_at_k_batch_torch", "torch.softmax", "numpy.array", "eval.metrics.ndcg_binary_at_k_batch_torch", "gc.collect", "torch.no_grad", "torch.cat" ]
[((1699, 1711), 'gc.collect', 'gc.collect', ([], {}), '()\n', (1709, 1711), False, 'import gc\n'), ((1833, 1853), 'torch.cat', 'torch.cat', (['n100_list'], {}), '(n100_list)\n', (1842, 1853), False, 'import torch\n'), ((1869, 1888), 'torch.cat', 'torch.cat', (['r20_list'], {}), '(r20_list)\n', (1878, 1888), False, 'imp...
import numpy as np ''' REFERENCES <NAME>., <NAME>, <NAME>, and <NAME> (2001), Plants in water-controlled ecosystems Active role in hydrologic processes and response to water stress II. Probabilistic soil moisture dynamics, Adv. Water Resour., 24(7), 707-723, doi 10.1016/S0309-1708(01)00005-7. ...
[ "numpy.mean", "numpy.log", "numpy.exp", "numpy.sum", "numpy.linspace", "numpy.array", "numpy.isnan", "numpy.var" ]
[((4089, 4098), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (4095, 4098), True, 'import numpy as np\n'), ((5333, 5347), 'numpy.exp', 'np.exp', (['sst_e1'], {}), '(sst_e1)\n', (5339, 5347), True, 'import numpy as np\n'), ((5859, 5872), 'numpy.exp', 'np.exp', (['fc_e1'], {}), '(fc_e1)\n', (5865, 5872), True, 'import num...
import math import sys import numpy as np import scipy import itertools import copy as cp from helpers import * import opt_einsum as oe import tools import time from ClusteredOperator import * from ClusteredState import * from Cluster import * from ham_build import * def compute_rspt2_correction(ci_vector, clustered...
[ "numpy.insert", "numpy.multiply", "numpy.linalg.solve", "numpy.eye", "itertools.product", "numpy.fill_diagonal", "scipy.sparse.linalg.eigsh", "numpy.dot", "numpy.zeros", "numpy.vstack", "numpy.linalg.norm", "numpy.linalg.eigh", "time.time" ]
[((419, 430), 'time.time', 'time.time', ([], {}), '()\n', (428, 430), False, 'import time\n'), ((654, 665), 'time.time', 'time.time', ([], {}), '()\n', (663, 665), False, 'import time\n'), ((1763, 1774), 'time.time', 'time.time', ([], {}), '()\n', (1772, 1774), False, 'import time\n'), ((2130, 2141), 'time.time', 'time...
import numpy as np import argparse, os, sys, h5py from hfd.variables import label_df parser = argparse.ArgumentParser(description='Add latent annotations to h5s.') parser.add_argument('folder', type=str, help='Folder to search for h5 files.') parser.add_argument('fontsize', type=int, help='Fontsize.') args = parser....
[ "numpy.stack", "os.walk", "os.path.join", "argparse.ArgumentParser" ]
[((96, 165), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Add latent annotations to h5s."""'}), "(description='Add latent annotations to h5s.')\n", (119, 165), False, 'import argparse, os, sys, h5py\n'), ((537, 552), 'os.walk', 'os.walk', (['folder'], {}), '(folder)\n', (544, 552), Fal...
import argparse import cv2 import numpy as np import torch from models.with_mobilenet import PoseEstimationWithMobileNet from modules.keypoints import extract_keypoints, group_keypoints from modules.load_state import load_state from modules.pose import Pose, track_poses from val import normalize, pad_width import ti...
[ "cv2.rectangle", "modules.keypoints.group_keypoints", "models.with_mobilenet.PoseEstimationWithMobileNet", "torch.from_numpy", "cv2.imshow", "sys.exit", "modules.keypoints.extract_keypoints", "modules.pose.Pose", "argparse.ArgumentParser", "cv2.VideoWriter", "cv2.addWeighted", "os.path.isdir",...
[((1940, 2014), 'cv2.resize', 'cv2.resize', (['img', '(0, 0)'], {'fx': 'scale', 'fy': 'scale', 'interpolation': 'cv2.INTER_CUBIC'}), '(img, (0, 0), fx=scale, fy=scale, interpolation=cv2.INTER_CUBIC)\n', (1950, 2014), False, 'import cv2\n'), ((2032, 2074), 'val.normalize', 'normalize', (['scaled_img', 'img_mean', 'img_s...
import numpy as np from gym_env.feature_processors.enums import ACTION_NAME_TO_INDEX, DOUBLE_ACTION_PARA_TYPE class Instance: # reward is the td n reward plus the target state value def __init__(self, dota_time=None, state_gf=None, state_ucf=None, ...
[ "numpy.zeros_like" ]
[((1822, 1861), 'numpy.zeros_like', 'np.zeros_like', (['target_instance.state_gf'], {}), '(target_instance.state_gf)\n', (1835, 1861), True, 'import numpy as np\n'), ((1887, 1927), 'numpy.zeros_like', 'np.zeros_like', (['target_instance.state_ucf'], {}), '(target_instance.state_ucf)\n', (1900, 1927), True, 'import nump...
import random import numpy as np class DiscreteDistribution: """ This class represents a (conditional) discrete probability distribution. More specifically, it stores the probabilities `P(output = j | input = i)` of generating an output j given an input i. Generally, such a distribution is repres...
[ "numpy.tile", "numpy.abs", "numpy.ones", "numpy.fill_diagonal", "numpy.array", "numpy.zeros", "numpy.cumsum", "numpy.dtype", "random.SystemRandom" ]
[((4440, 4474), 'numpy.zeros', 'np.zeros', (['full.probabilities.shape'], {}), '(full.probabilities.shape)\n', (4448, 4474), True, 'import numpy as np\n'), ((4483, 4508), 'numpy.fill_diagonal', 'np.fill_diagonal', (['diag', 'p'], {}), '(diag, p)\n', (4499, 4508), True, 'import numpy as np\n'), ((5406, 5427), 'random.Sy...
__copyright__ = """ Copyright (C) 2020 University of Illinois Board of Trustees Copyright (C) 2021 <NAME> """ __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,...
[ "pyrometheus.gen_thermochem_code", "pytools.convergence.EOCRecorder", "numpy.array", "numpy.linalg.norm", "numpy.where", "pytest.main", "numpy.linspace", "cantera.Solution", "numpy.abs", "numpy.ones", "cantera.ReactorNet", "jax.jacfwd", "jax.config.update", "jax.numpy.array", "pytest.mar...
[((3714, 3771), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mechname"""', "['uiuc', 'sanDiego']"], {}), "('mechname', ['uiuc', 'sanDiego'])\n", (3737, 3771), False, 'import pytest\n'), ((4057, 4114), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mechname"""', "['uiuc', 'sanDiego']"], {}), ...
import scipy.io as sio import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv2D from tensorflow.keras.layers import MaxPooling2D from tensorflow.keras.layers import Flatten from tensorflow.keras.layers import Dense from tensorflow.keras.layers import Dropout class SV...
[ "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.MaxPooling2D", "scipy.io.loadmat", "numpy.rollaxis", "tensorflow.keras.layers.Dropout", "tensorflow.keras.layers.Dense", "tensorflow.keras.models.load_model", "tensorflow.keras.layers.Flatten" ]
[((555, 578), 'scipy.io.loadmat', 'sio.loadmat', (['path_train'], {}), '(path_train)\n', (566, 578), True, 'import scipy.io as sio\n'), ((602, 624), 'scipy.io.loadmat', 'sio.loadmat', (['path_test'], {}), '(path_test)\n', (613, 624), True, 'import scipy.io as sio\n'), ((1888, 1911), 'numpy.rollaxis', 'np.rollaxis', (['...
import numpy as np import sklearn.metrics as metrics from scipy.sparse import csr_matrix def evaluation_score(label_test, predict_label): f1_micro=metrics.f1_score(label_test, predict_label, average='micro') hamm=metrics.hamming_loss(label_test,predict_label) accuracy = metrics.accuracy_score(label_test, ...
[ "numpy.mean", "sklearn.metrics.f1_score", "numpy.where", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score", "numpy.array", "sklearn.metrics.hamming_loss", "sklearn.metrics.accuracy_score" ]
[((153, 213), 'sklearn.metrics.f1_score', 'metrics.f1_score', (['label_test', 'predict_label'], {'average': '"""micro"""'}), "(label_test, predict_label, average='micro')\n", (169, 213), True, 'import sklearn.metrics as metrics\n'), ((223, 270), 'sklearn.metrics.hamming_loss', 'metrics.hamming_loss', (['label_test', 'p...
import numpy as np from pyiid.experiments.elasticscatter.kernels.cpu_nxn import * from ..kernels.cpu_flat import get_normalization_array as flat_norm from pyiid.experiments.elasticscatter.atomics import pad_pdf __author__ = 'christopher' def wrap_fq(atoms, qbin=.1, sum_type='fq'): """ Generate the reduced st...
[ "numpy.mean", "numpy.sum", "numpy.zeros", "numpy.seterr", "numpy.float32", "numpy.nan_to_num" ]
[((1033, 1064), 'numpy.zeros', 'np.zeros', (['(n, n, 3)', 'np.float32'], {}), '((n, n, 3), np.float32)\n', (1041, 1064), True, 'import numpy as np\n'), ((1126, 1154), 'numpy.zeros', 'np.zeros', (['(n, n)', 'np.float32'], {}), '((n, n), np.float32)\n', (1134, 1154), True, 'import numpy as np\n'), ((1219, 1257), 'numpy.z...
''' Abstraction of machine learning model Authors: <NAME>, <NAME> ''' import os import multiprocessing import logging import warnings import itertools import numpy as np import scipy as sp from sklearn.svm import SVC from sklearn.naive_bayes import GaussianNB from sklearn.linear_model import SGDClassifier from sklea...
[ "scipy.stats.randint", "vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer", "smapp_text_classifier.vectorizers.CachedCountVectorizer", "sklearn.linear_model.SGDClassifier", "smapp_text_classifier.vectorizers.CachedEmbeddingVectorizer", "sklearn.feature_selection.chi2", "logging.debug", "os.path...
[((4198, 4241), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'max_features': '"""auto"""'}), "(max_features='auto')\n", (4220, 4241), False, 'from sklearn.ensemble import RandomForestClassifier\n'), ((6341, 6530), 'smapp_text_classifier.vectorizers.CachedEmbeddingVectorizer', 'CachedEmbedd...
#encoding:utf-8 import cv2, numpy, sys, pickle from detector import Detector AREA_MIN = 1000 AREA_MAX = 10000 AZUL_MIN = numpy.array([100, 150, 110], numpy.uint8) AZUL_MAX = numpy.array([130, 255, 255], numpy.uint8) BLANCO_MIN = cv2.mean((200, 200, 200)) BLANCO_MAX = cv2.mean((255, 255, 255)) class Calibra...
[ "detector.Detector", "numpy.array", "sys.exit", "cv2.waitKey", "cv2.mean" ]
[((128, 169), 'numpy.array', 'numpy.array', (['[100, 150, 110]', 'numpy.uint8'], {}), '([100, 150, 110], numpy.uint8)\n', (139, 169), False, 'import cv2, numpy, sys, pickle\n'), ((182, 223), 'numpy.array', 'numpy.array', (['[130, 255, 255]', 'numpy.uint8'], {}), '([130, 255, 255], numpy.uint8)\n', (193, 223), False, 'i...
import numpy as np from PIL import Image from scipy.ndimage.morphology import binary_erosion from improc3d import quantile_scale, calc_bbox3d from .utils import MIN_UINT8, MAX_UINT8 from .utils import assign_colors, compose_image_and_labels class ImageRenderer: """Renders slices from a 3D image using PIL. N...
[ "PIL.Image.fromarray", "numpy.unique", "improc3d.quantile_scale", "numpy.max", "PIL.Image.alpha_composite", "numpy.min", "scipy.ndimage.morphology.binary_erosion", "improc3d.calc_bbox3d" ]
[((1066, 1132), 'improc3d.quantile_scale', 'quantile_scale', (['self.image'], {'lower_th': 'MIN_UINT8', 'upper_th': 'MAX_UINT8'}), '(self.image, lower_th=MIN_UINT8, upper_th=MAX_UINT8)\n', (1080, 1132), False, 'from improc3d import quantile_scale, calc_bbox3d\n'), ((1575, 1593), 'numpy.min', 'np.min', (['self.image'], ...
# Copyright (c) 2019 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, ...
[ "numpy.transpose", "numpy.asarray", "numpy.repeat" ]
[((9425, 9443), 'numpy.asarray', 'np.asarray', (['values'], {}), '(values)\n', (9435, 9443), True, 'import numpy as np\n'), ((3498, 3537), 'numpy.transpose', 'np.transpose', (['array[sls]', 'transposition'], {}), '(array[sls], transposition)\n', (3510, 3537), True, 'import numpy as np\n'), ((11394, 11422), 'numpy.trans...
""" Test Binary Relevance Model """ import unittest import numpy as np from numpy.testing import assert_array_equal from sklearn import datasets try: from sklearn.model_selection import train_test_split except ImportError: from sklearn.cross_validation import train_test_split import sklearn.linear_model from ...
[ "numpy.abs", "libact.models.LogisticRegression", "sklearn.datasets.make_multilabel_classification", "sklearn.cross_validation.train_test_split", "libact.base.dataset.Dataset", "unittest.main", "numpy.shape" ]
[((2773, 2788), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2786, 2788), False, 'import unittest\n'), ((542, 600), 'sklearn.datasets.make_multilabel_classification', 'datasets.make_multilabel_classification', ([], {'random_state': '(1126)'}), '(random_state=1126)\n', (581, 600), False, 'from sklearn import dat...
from __future__ import absolute_import, division, print_function import argparse import os import os.path as op import code import json import zipfile import torch import numpy as np from metro.utils.metric_pampjpe import get_alignMesh def load_pred_json(filepath): archive = zipfile.ZipFile(filepath, 'r') js...
[ "numpy.mean", "argparse.ArgumentParser", "zipfile.ZipFile", "metro.utils.metric_pampjpe.get_alignMesh", "numpy.asarray", "os.system", "json.dump" ]
[((283, 313), 'zipfile.ZipFile', 'zipfile.ZipFile', (['filepath', '"""r"""'], {}), "(filepath, 'r')\n", (298, 313), False, 'import zipfile\n'), ((632, 654), 'numpy.asarray', 'np.asarray', (['ref_joints'], {}), '(ref_joints)\n', (642, 654), True, 'import numpy as np\n'), ((680, 704), 'numpy.asarray', 'np.asarray', (['re...
# -*- coding: utf-8 -*- """ Created on Mon Apr 23 12:31:50 2018 @author: <NAME> """ from QChemTool import Structure from QChemTool.Development.polarizablesytem_periodic import PolarizableSystem from QChemTool import energy_units from QChemTool.QuantumChem.Fluorographene.fluorographene import orientFG import ...
[ "QChemTool.Development.polarizablesytem_periodic.PolarizableSystem", "numpy.zeros", "QChemTool.QuantumChem.Fluorographene.fluorographene.orientFG", "QChemTool.energy_units", "QChemTool.Structure" ]
[((732, 743), 'QChemTool.Structure', 'Structure', ([], {}), '()\n', (741, 743), False, 'from QChemTool import Structure\n'), ((2013, 2071), 'QChemTool.Development.polarizablesytem_periodic.PolarizableSystem', 'PolarizableSystem', ([], {'diel': 'diel', 'elstat': 'elstat', 'params': 'params'}), '(diel=diel, elstat=elstat...
import numpy as np import os from welib import weio # https://github.com/ebranlard/weio from welib.fast import fastlib as fastlib # latest fastlib is found at https://github.com/ebranlard/welib def CPLambda(): """ Determine the CP-CT Lambda Pitch matrices of a turbine. This scrip uses the function CPCT_LambdaP...
[ "numpy.linspace", "matplotlib.pyplot.figure", "numpy.savetxt", "numpy.meshgrid", "numpy.transpose", "welib.fast.fastlib.CPCT_LambdaPitch", "matplotlib.pyplot.show" ]
[((954, 983), 'numpy.linspace', 'np.linspace', (['(0.1)', '(22)', 'nLambda'], {}), '(0.1, 22, nLambda)\n', (965, 983), True, 'import numpy as np\n'), ((997, 1024), 'numpy.linspace', 'np.linspace', (['(-5)', '(40)', 'nPitch'], {}), '(-5, 40, nPitch)\n', (1008, 1024), True, 'import numpy as np\n'), ((1063, 1196), 'welib....
import os import h5py import pickle import numpy as np from termcolor import colored from torch.utils.data import Dataset, DataLoader class CIFAR10Loader(Dataset): '''Data loader for cifar10 dataset''' def __init__(self, data_path='data/cifar-10-batches-py', mode='train', transform=None): self.data_...
[ "termcolor.colored", "os.path.join", "pickle.load", "h5py.File", "numpy.concatenate" ]
[((4103, 4127), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (4112, 4127), False, 'import h5py\n'), ((2204, 2237), 'pickle.load', 'pickle.load', (['fp'], {'encoding': '"""bytes"""'}), "(fp, encoding='bytes')\n", (2215, 2237), False, 'import pickle\n'), ((1861, 1886), 'numpy.concatenate'...
""" SAMS umbrella sampling for DDR1 kinase DFG loop flip. """ __author__ = '<NAME>' ################################################################################ # IMPORTS ################################################################################ import os, os.path import sys, math import numpy as np impor...
[ "simtk.openmm.VerletIntegrator", "simtk.openmm.LocalEnergyMinimizer.minimize", "simtk.openmm.app.PDBFile", "simtk.openmm.MonteCarloBarostat", "sams.samplers.SamplerState", "simtk.openmm.CustomBondForce", "netCDF4.Dataset", "openmmtools.integrators.LangevinIntegrator", "numpy.linspace", "sams.sampl...
[((3583, 3614), 'simtk.openmm.app.PDBFile', 'app.PDBFile', (['state_pdb_filename'], {}), '(state_pdb_filename)\n', (3594, 3614), False, 'from simtk.openmm import app\n'), ((4693, 4735), 'simtk.openmm.CustomTorsionForce', 'openmm.CustomTorsionForce', (['energy_function'], {}), '(energy_function)\n', (4718, 4735), False,...
""" The board class manages the position of pieces, and conversion to and from Forsyth-Edwards Notation (FEN). This class is only used internally by the `Game` class. """ import numpy as np class Board(object): """ This class manages the position of all pieces in a chess game. The position is stored as a ...
[ "numpy.reshape", "numpy.hstack", "numpy.array", "numpy.vstack", "numpy.arange" ]
[((809, 849), 'numpy.reshape', 'np.reshape', (['np_pos', '(-1, self._row_size)'], {}), '(np_pos, (-1, self._row_size))\n', (819, 849), True, 'import numpy as np\n'), ((945, 971), 'numpy.hstack', 'np.hstack', (['(ranks, np_pos)'], {}), '((ranks, np_pos))\n', (954, 971), True, 'import numpy as np\n'), ((1125, 1151), 'num...
#!/usr/bin/env python """ Created on 2015-09-26T12:13:49 """ from __future__ import division, print_function import sys import argparse import re import time try: import numpy as np except ImportError: print('You need numpy installed') sys.exit(1) import pandas as pd from splinter.browser import Browser i...
[ "pandas.read_sql_query", "numpy.int64", "argparse.ArgumentParser", "splinter.browser.Browser", "connect_aws_db.connect_aws_db", "time.sleep", "numpy.random.uniform", "sys.exit", "pandas.DataFrame", "re.findall" ]
[((3479, 3516), 'numpy.int64', 'np.int64', (["bigdf['business_id'].values"], {}), "(bigdf['business_id'].values)\n", (3487, 3516), True, 'import numpy as np\n'), ((4060, 4069), 'splinter.browser.Browser', 'Browser', ([], {}), '()\n', (4067, 4069), False, 'from splinter.browser import Browser\n'), ((5832, 5845), 'time.s...
import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib matplotlib.rc('font', family='FreeSans', size=16) data = [] with open('weak_scaling.txt', 'r') as file: for line in file: if 'Average' in line: _line = line.split(' ') data.append(float(_line[-1])) ...
[ "matplotlib.pyplot.savefig", "numpy.asarray", "matplotlib.pyplot.figure", "matplotlib.rc", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.legend" ]
[((80, 129), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {'family': '"""FreeSans"""', 'size': '(16)'}), "('font', family='FreeSans', size=16)\n", (93, 129), False, 'import matplotlib\n'), ((478, 511), 'numpy.asarray', 'np.asarray', (['[1, 4, 9, 18, 36, 72]'], {}), '([1, 4, 9, 18, 36, 72])\n', (488, 511), True, '...
# -*- coding: utf-8 -*- """ Created on Wed Apr 7 09:58:55 2021 @author: emari """ import numpy as np import pandas as pd class node(): def __init__(self): self.parent_node = "" self.child_connections = [np.array([],dtype=object),np.array([],dtype=object),np.array([],dtype=object),np.array([],dty...
[ "pandas.DataFrame", "numpy.array", "pandas.Series" ]
[((1286, 1470), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['parent_node', 'username', 'connection_type', 'bio', 'captions',\n 'total_likes', 'total_followers', 'total_following', 'profile_img_url',\n 'root_post_url']"}), "(columns=['parent_node', 'username', 'connection_type', 'bio',\n 'captions', ...
""" marchenko_pastur.py -------------- Graph reconstruction algorithm based on <NAME>., & <NAME>. (1967). Distribution of eigenvalues for some sets of random matrices. Matematicheskii Sbornik, 114(4), 507-536. author: <NAME> Submitted as part of the 2019 NetSI Collabathon. """ from .base import BaseReconstructor i...
[ "numpy.sqrt", "numpy.corrcoef", "networkx.empty_graph", "numpy.diag", "numpy.linalg.eigh" ]
[((4505, 4520), 'numpy.corrcoef', 'np.corrcoef', (['TS'], {}), '(TS)\n', (4516, 4520), True, 'import numpy as np\n'), ((4568, 4585), 'numpy.linalg.eigh', 'np.linalg.eigh', (['C'], {}), '(C)\n', (4582, 4585), True, 'import numpy as np\n'), ((4782, 4801), 'networkx.empty_graph', 'nx.empty_graph', ([], {'n': 'N'}), '(n=N)...
import numpy as np from scipy import special as special from scipy.special import logsumexp from mimo.abstraction import MixtureDistribution from mimo.abstraction import BayesianMixtureDistribution from mimo.distributions.bayesian import CategoricalWithDirichlet from mimo.distributions.bayesian import CategoricalWith...
[ "numpy.log", "numpy.arange", "pathos.helpers.mp.current_process", "numpy.where", "sklearn.decomposition.PCA", "numpy.max", "numpy.linspace", "numpy.empty", "numpy.vstack", "matplotlib.pyplot.scatter", "matplotlib.pyplot.Rectangle", "matplotlib.pyplot.axis", "sklearn.preprocessing.MinMaxScale...
[((1361, 1396), 'numpy.bincount', 'np.bincount', (['z'], {'minlength': 'self.size'}), '(z, minlength=self.size)\n', (1372, 1396), True, 'import numpy as np\n'), ((1412, 1438), 'numpy.zeros', 'np.zeros', (['(size, self.dim)'], {}), '((size, self.dim))\n', (1420, 1438), True, 'import numpy as np\n'), ((1573, 1600), 'nump...
# ------------------------------------------------------ # Morphological Operations # # Created by <NAME> on 19/09/21. # Copyright (c) 2021 <NAME>. All rights reserved. # # ------------------------------------------------------ import cv2 import numpy as np # Image path # Tried with other images to by changing the f...
[ "cv2.imwrite", "cv2.countNonZero", "numpy.ones", "cv2.threshold", "cv2.erode", "numpy.size", "cv2.morphologyEx", "numpy.zeros", "cv2.getStructuringElement", "cv2.waitKey", "cv2.bitwise_or", "cv2.destroyAllWindows", "cv2.bitwise_not", "cv2.dilate", "cv2.subtract", "cv2.imread" ]
[((675, 698), 'cv2.imread', 'cv2.imread', (['img_path', '(0)'], {}), '(img_path, 0)\n', (685, 698), False, 'import cv2\n'), ((718, 743), 'numpy.ones', 'np.ones', (['(5, 5)', 'np.uint8'], {}), '((5, 5), np.uint8)\n', (725, 743), True, 'import numpy as np\n'), ((765, 801), 'cv2.erode', 'cv2.erode', (['img', 'kernel'], {'...
import pandas as pd import numpy as np import sys import pickle import os import shutil import time import argparse import peakutils from sklearn.ensemble import GradientBoostingRegressor from sklearn.model_selection import RandomizedSearchCV from sklearn.model_selection import train_test_split import configparser from...
[ "sys.exit", "numpy.arange", "pandas.read_feather", "os.path.exists", "numpy.mean", "argparse.ArgumentParser", "pandas.DataFrame", "sklearn.ensemble.GradientBoostingRegressor", "configparser.ExtendedInterpolation", "numpy.abs", "sklearn.model_selection.train_test_split", "pandas.merge", "os.p...
[((2876, 3049), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Using the library sequences, build run-specific coordinate estimators for the sequence-charges identified in the experiment."""'}), "(description=\n 'Using the library sequences, build run-specific coordinate estimators fo...
# 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.python.data.ops.dataset_ops.Dataset.from_tensors", "tensorflow.python.data.ops.dataset_ops.Dataset.from_sparse_tensor_slices", "numpy.array", "tensorflow.python.data.kernel_tests.test_base.default_test_combinations", "tensorflow.python.framework.sparse_tensor.SparseTensor", "tensorflow.python....
[((3710, 3721), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (3719, 3721), False, 'from tensorflow.python.platform import test\n'), ((1510, 1554), 'tensorflow.python.data.ops.dataset_ops.Dataset.from_tensors', 'dataset_ops.Dataset.from_tensors', (['components'], {}), '(components)\n', (1542, 1...
from __future__ import division, print_function, absolute_import import vzlog import vzlog.pyplot as plt import numpy as np vz = vzlog.VzLog('log-image-grids') vz.title('Image grids') rs = np.random.RandomState(0) x = rs.uniform(size=(9, 20, 20)) grid = vzlog.image.ImageGrid(x, cmap=plt.cm.rainbow) grid.save(vz.im...
[ "vzlog.image.ImageGrid", "vzlog.image.ColorImageGrid", "numpy.random.RandomState", "vzlog.VzLog" ]
[((131, 161), 'vzlog.VzLog', 'vzlog.VzLog', (['"""log-image-grids"""'], {}), "('log-image-grids')\n", (142, 161), False, 'import vzlog\n'), ((193, 217), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (214, 217), True, 'import numpy as np\n'), ((259, 304), 'vzlog.image.ImageGrid', 'vzlog.im...
import os import cv2 import pandas as pd import numpy as np import imgaug.augmenters as iaa from sklearn.utils import shuffle from tensorflow.keras.models import Sequential from tensorflow.keras import layers from tensorflow.keras.optimizers import Adam import matplotlib.pyplot as plt import matplotlib.image as mpimg...
[ "tensorflow.keras.layers.Convolution2D", "numpy.random.rand", "matplotlib.pyplot.ylabel", "tensorflow.keras.layers.Dense", "numpy.histogram", "os.listdir", "matplotlib.pyplot.xlabel", "numpy.asarray", "numpy.max", "numpy.min", "pandas.DataFrame", "cv2.cvtColor", "imgaug.augmenters.Multiply",...
[((523, 575), 'os.path.join', 'os.path.join', (['image_path_list[0]', 'image_path_list[1]'], {}), '(image_path_list[0], image_path_list[1])\n', (535, 575), False, 'import os\n'), ((814, 828), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (826, 828), True, 'import pandas as pd\n'), ((1363, 1400), 'numpy.histogra...
# -*- coding: utf-8 -*- #~ from __future__ import (unicode_literals, print_function, division, absolute_import) import numpy as np import scipy.fftpack import scipy.signal import matplotlib.cm import matplotlib.colors from .myqt import QT import pyqtgraph as pg from .base import BaseMultiChannelViewer, Base_MultiC...
[ "numpy.abs", "numpy.ceil", "numpy.power", "numpy.log", "pyqtgraph.ImageItem", "pyqtgraph.InfiniteLine", "numpy.max", "numpy.array", "numpy.zeros", "numpy.nonzero", "pyqtgraph.GraphicsLayoutWidget", "numpy.arange" ]
[((2622, 2670), 'numpy.arange', 'np.arange', (['(-len_wavelet / 2.0)', '(len_wavelet / 2.0)'], {}), '(-len_wavelet / 2.0, len_wavelet / 2.0)\n', (2631, 2670), True, 'import numpy as np\n'), ((3977, 4010), 'numpy.nonzero', 'np.nonzero', (['self.visible_channels'], {}), '(self.visible_channels)\n', (3987, 4010), True, 'i...