code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#%% train ddpg import os import gym import numpy as np from stable_baselines import DDPG from stable_baselines.ddpg.policies import MlpPolicy from stable_baselines.ddpg.policies import LnMlpPolicy from stable_baselines.common.noise import NormalActionNoise from stable_baselines.bench import Monitor from stable_baseline...
[ "utils.snap_code", "os.makedirs", "stable_baselines.bench.Monitor", "numpy.zeros", "numpy.ones", "Arm2DEnv.ArmModel" ]
[((486, 526), 'os.makedirs', 'os.makedirs', (['log_dir_root'], {'exist_ok': '(True)'}), '(log_dir_root, exist_ok=True)\n', (497, 526), False, 'import os\n'), ((566, 589), 'utils.snap_code', 'snap_code', (['log_dir_root'], {}), '(log_dir_root)\n', (575, 589), False, 'from utils import SaveOnBestTrainingRewardCallback, s...
import lammpstools import dumpreader import numpy as np import sys if len(sys.argv) < 2: print >> sys.stderr, "Pass a dump file!" sys.exit(-1) fname = sys.argv[1] d = dumpreader.dumpreader(fname) b = d.getblock() # Assume particles on sphere. R2 = 0.0; c = 1.0 / float(b.meta.N) for i in range(0,b.meta.N): ...
[ "numpy.dot", "dumpreader.dumpreader", "sys.exit" ]
[((178, 206), 'dumpreader.dumpreader', 'dumpreader.dumpreader', (['fname'], {}), '(fname)\n', (199, 206), False, 'import dumpreader\n'), ((139, 151), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (147, 151), False, 'import sys\n'), ((330, 352), 'numpy.dot', 'np.dot', (['b.x[i]', 'b.x[i]'], {}), '(b.x[i], b.x[i])\n'...
import glob import pandas as pd import numpy as np import cv2 visual = True col_names = ['youtube_id', 'timestamp_ms', 'class_id', 'class_name', 'object_id', 'object_presence', 'xmin', 'xmax', 'ymin', 'ymax'] df = pd.DataFrame.from_csv('yt_bb_detection_validation.csv', header=None, index_col=False) df.c...
[ "cv2.waitKey", "pandas.DataFrame.from_csv", "cv2.imread", "numpy.array", "cv2.rectangle", "glob.glob", "cv2.imshow" ]
[((230, 319), 'pandas.DataFrame.from_csv', 'pd.DataFrame.from_csv', (['"""yt_bb_detection_validation.csv"""'], {'header': 'None', 'index_col': '(False)'}), "('yt_bb_detection_validation.csv', header=None,\n index_col=False)\n", (251, 319), True, 'import pandas as pd\n'), ((385, 438), 'glob.glob', 'glob.glob', (['"""...
import numpy as np import SimpleITK as sitk import os def find_percentiles(x): x_flat = np.reshape(x, (-1, 1)) x_float = x_flat.astype(np.float64) y = np.ma.masked_where(x_float == 0, x_float) y = np.ma.filled(y, np.nan) return np.nanpercentile(y, 25), np.nanpercentile(y, 50), np.nanpercentile(y, 75) heatmaps_di...
[ "numpy.nanpercentile", "os.makedirs", "numpy.ma.masked_where", "SimpleITK.ReadImage", "numpy.zeros", "os.path.exists", "SimpleITK.GetArrayFromImage", "numpy.reshape", "SimpleITK.GetImageFromArray", "numpy.ma.filled", "os.path.join" ]
[((359, 409), 'os.path.join', 'os.path.join', (['heatmaps_dir', '"""edema_heatmap.nii.gz"""'], {}), "(heatmaps_dir, 'edema_heatmap.nii.gz')\n", (371, 409), False, 'import os\n'), ((433, 486), 'os.path.join', 'os.path.join', (['heatmaps_dir', '"""necrosis_heatmap.nii.gz"""'], {}), "(heatmaps_dir, 'necrosis_heatmap.nii.g...
"""Shuffles input examples in time and writes them to new file.""" import random import os.path import argparse import numpy from gewittergefahr.gg_utils import error_checking from gewittergefahr.deep_learning import input_examples SEPARATOR_STRING = '\n\n' + '*' * 50 + '\n\n' INPUT_DIR_ARG_NAME = 'input_example_dir...
[ "gewittergefahr.deep_learning.input_examples.find_many_example_files", "argparse.ArgumentParser", "gewittergefahr.gg_utils.error_checking.assert_is_geq", "gewittergefahr.deep_learning.input_examples.find_example_file", "random.choice", "gewittergefahr.deep_learning.input_examples.read_example_file", "nu...
[((2053, 2078), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2076, 2078), False, 'import argparse\n'), ((3724, 3953), 'gewittergefahr.deep_learning.input_examples.find_many_example_files', 'input_examples.find_many_example_files', ([], {'top_directory_name': 'top_input_dir_name', 'shuffled':...
# -*- coding: utf-8 -*- """ @author: <NAME> """ import matplotlib.figure as figure import matplotlib.pyplot as plt import numpy as np values = np.arange(0.001, 1, 0.001, dtype=float) logit = np.log(values / (1 - values)) inverse_logit = np.exp(logit) / (1 + np.exp(logit)) plt.rcParams['font.size'] = 18 ...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "numpy.log", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "numpy.arange", "numpy.exp", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.figure.figaspect" ]
[((154, 193), 'numpy.arange', 'np.arange', (['(0.001)', '(1)', '(0.001)'], {'dtype': 'float'}), '(0.001, 1, 0.001, dtype=float)\n', (163, 193), True, 'import numpy as np\n'), ((203, 232), 'numpy.log', 'np.log', (['(values / (1 - values))'], {}), '(values / (1 - values))\n', (209, 232), True, 'import numpy as np\n'), ((...
# LM model imports import os import time import torch from torch import optim from models.context2vec.src.mscc_eval import mscc_evaluation from models.context2vec.src.model import Context2vec from models.context2vec.src.args import parse_args from models.context2vec.src.dataset import WikiDataset from models.context2...
[ "nltk.stem.PorterStemmer", "numpy.argmax", "collections.defaultdict", "models.context2vec.src.utils.load_vocab", "os.path.join", "nltk.stem.WordNetLemmatizer", "cv2.cvtColor", "torch.load", "models.context2vec.src.model.Context2vec", "editdistance.eval", "re.search", "cv2.resize", "numpy.sta...
[((1465, 1487), 'numpy.stack', 'np.stack', (['imgs'], {'axis': '(0)'}), '(imgs, axis=0)\n', (1473, 1487), True, 'import numpy as np\n'), ((2270, 2285), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (2283, 2285), False, 'from nltk.stem import PorterStemmer, WordNetLemmatizer\n'), ((2307, 2326), 'nltk.ste...
import sys from keras.models import Sequential from keras.layers import Dense from keras.optimizers import Adam import numpy as np import csv from sklearn import metrics from sklearn.model_selection import KFold, StratifiedKFold from sklearn.metrics import mean_squared_error import copy kf = KFold(n_splits=10, shuffle...
[ "copy.deepcopy", "keras.optimizers.Adam", "sklearn.model_selection.KFold", "keras.layers.Dense", "numpy.array", "numpy.where", "keras.models.Sequential" ]
[((294, 326), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': '(10)', 'shuffle': '(True)'}), '(n_splits=10, shuffle=True)\n', (299, 326), False, 'from sklearn.model_selection import KFold, StratifiedKFold\n'), ((499, 510), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (507, 510), True, 'import numpy as n...
import numpy as np from keras.preprocessing.image import ImageDataGenerator class Augmentation(object): def __init__(self, train_data, label_data, aug_size=32, aug_configs=None): self.train_data = train_data self.label_data = label_data self.aug_size = aug_size self.data_gen_args ...
[ "keras.preprocessing.image.ImageDataGenerator", "numpy.append" ]
[((419, 459), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**self.data_gen_args)\n', (437, 459), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((480, 520), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**self.data_gen_args)...
import numpy as np import torch import cv2 from torch.nn.functional import interpolate from openmixup.models.utils import batch_shuffle_ddp @torch.no_grad() def cutmix(img, gt_label, alpha=1.0, lam=None, dist_mode=False, **kwargs): r""" CutMix augmentation. "CutMix: Regularization Strategy to Train Strong Cl...
[ "cv2.saliency.StaticSaliencyFineGrained_create", "numpy.random.uniform", "torch.randint", "torch.stack", "openmixup.models.utils.batch_shuffle_ddp", "numpy.random.beta", "numpy.argmax", "torch.roll", "numpy.clip", "numpy.random.randint", "numpy.int", "torch.arange", "torch.rand", "torch.nn...
[((143, 158), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (156, 158), False, 'import torch\n'), ((3514, 3529), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3527, 3529), False, 'import torch\n'), ((5937, 5952), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5950, 5952), False, 'import torch\n'), ((...
import numpy as np class Example5: def __init__(self): self.l = np.array([-2., np.NINF]) self.u = np.array([ 1., np.Inf]) self.x_init = np.array([-2., 5.]) self.n0 = 0 self.n12 = 1 self.opt_x = np.array([-1., 0.]) self.opt_f = self.fun(self.opt_x) def f...
[ "numpy.array" ]
[((78, 103), 'numpy.array', 'np.array', (['[-2.0, np.NINF]'], {}), '([-2.0, np.NINF])\n', (86, 103), True, 'import numpy as np\n'), ((120, 143), 'numpy.array', 'np.array', (['[1.0, np.Inf]'], {}), '([1.0, np.Inf])\n', (128, 143), True, 'import numpy as np\n'), ((166, 187), 'numpy.array', 'np.array', (['[-2.0, 5.0]'], {...
# coding = utf-8 """将minist数据记录为record格式 """ import os import gzip import sys import numpy as np import tensorflow as tf def read_imgs(filename, num_images): """读入图片数据 :param filename: :param num_images: :return: """ with gzip.open(filename) as bytestream: bytestream.read(16) ...
[ "tensorflow.train.BytesList", "sys.stdout.write", "tensorflow.python_io.TFRecordWriter", "gzip.open", "tensorflow.train.Int64List", "tensorflow.image.encode_png", "numpy.frombuffer", "tensorflow.Session", "tensorflow.placeholder", "sys.stdout.flush", "tensorflow.train.FloatList", "tensorflow.G...
[((3467, 3513), 'tensorflow.python_io.TFRecordWriter', 'tf.python_io.TFRecordWriter', (['training_filename'], {}), '(training_filename)\n', (3494, 3513), True, 'import tensorflow as tf\n'), ((3548, 3591), 'os.path.join', 'os.path.join', (['DATA_DIR', 'TRAIN_DATA_FILENAME'], {}), '(DATA_DIR, TRAIN_DATA_FILENAME)\n', (35...
import numpy as np import matplotlib.pyplot as plt from .utils import * from .MTM import MTM class LiverDeform(MTM): def __init__(self, mesh_filename='liver_matdata_meter.json',E=1e4, v=0.4, gamma=-5, timeinterval=0.1,dt=1e-4,lamu_times=1e-1): MTM.__init__(self,E=E,v=v,gamma=gamma,timeinterval=tim...
[ "numpy.argwhere" ]
[((2143, 2181), 'numpy.argwhere', 'np.argwhere', (['(liver.tet_elements == 190)'], {}), '(liver.tet_elements == 190)\n', (2154, 2181), True, 'import numpy as np\n')]
from worldengine.simulations.basic import find_threshold_f import numpy class HumiditySimulation(object): @staticmethod def is_applicable(world): return world.has_precipitations() and world.has_irrigation() and ( not world.has_humidity()) def execute(self, world, seed): assert...
[ "worldengine.simulations.basic.find_threshold_f", "numpy.zeros" ]
[((584, 637), 'numpy.zeros', 'numpy.zeros', (['(world.height, world.width)'], {'dtype': 'float'}), '((world.height, world.width), dtype=float)\n', (595, 637), False, 'import numpy\n'), ((1028, 1068), 'worldengine.simulations.basic.find_threshold_f', 'find_threshold_f', (['data', 'humids[6]', 'ocean'], {}), '(data, humi...
# This code is part of Qiskit. # # (C) Copyright IBM 2022. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "qiskit.opflow.PauliSumOp.from_list", "qiskit.circuit.library.RealAmplitudes", "qiskit_neko.decorators.component_attr", "numpy.random.default_rng", "qiskit_machine_learning.neural_networks.TwoLayerQNN", "qiskit.circuit.library.ZZFeatureMap", "qiskit.utils.QuantumInstance" ]
[((1114, 1179), 'qiskit_neko.decorators.component_attr', 'decorators.component_attr', (['"""terra"""', '"""backend"""', '"""machine_learning"""'], {}), "('terra', 'backend', 'machine_learning')\n", (1139, 1179), False, 'from qiskit_neko import decorators\n'), ((1332, 1361), 'qiskit.utils.QuantumInstance', 'QuantumInsta...
import os from collections import Counter import pprint import numpy as np from tqdm import tqdm ''' File to process the raw `wiki_{num}_string.txt_new.txt` ''' def collect_files(): rest = [] for file in os.listdir('.'): if 'wiki_' in file: rest.append(file) return rest def process_on...
[ "tqdm.tqdm", "numpy.min", "numpy.mean", "numpy.max", "collections.Counter", "os.listdir" ]
[((214, 229), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (224, 229), False, 'import os\n'), ((1115, 1126), 'tqdm.tqdm', 'tqdm', (['files'], {}), '(files)\n', (1119, 1126), False, 'from tqdm import tqdm\n'), ((1308, 1324), 'collections.Counter', 'Counter', (['lengths'], {}), '(lengths)\n', (1315, 1324), F...
import os import numpy as np import pytest import tensorflow as tf from keras.optimizers import SGD from pymc3.variational.callbacks import CheckParametersConvergence from csrank.choicefunction import * from csrank.experiments.constants import * from csrank.experiments.util import metrics_on_predictions from csrank.m...
[ "numpy.random.seed", "keras.optimizers.SGD", "pymc3.variational.callbacks.CheckParametersConvergence", "pytest.fixture", "numpy.random.RandomState", "tensorflow.set_random_seed", "numpy.isclose", "numpy.mean", "csrank.metrics_np.subset_01_loss", "csrank.tests.test_ranking.check_learner" ]
[((566, 608), 'keras.optimizers.SGD', 'SGD', ([], {'lr': '(0.001)', 'momentum': '(0.9)', 'nesterov': '(True)'}), '(lr=0.001, momentum=0.9, nesterov=True)\n', (569, 608), False, 'from keras.optimizers import SGD\n'), ((1680, 1710), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n"...
import argparse from typing import Dict, List, Optional, Union import matplotlib.pyplot as plt import mlflow import numpy as np import yaml import air_quality_uci_dataset import air_quality_uci_rnn def train_and_evaluate(this_type: Optional[Union[List[str], str]], train_size: float, time_steps: int, ...
[ "mlflow.start_run", "air_quality_uci_rnn.AirQualityUciRNN", "argparse.ArgumentParser", "mlflow.keras.autolog", "mlflow.set_experiment", "air_quality_uci_dataset.AirQualityUciDataset", "mlflow.log_artifact", "numpy.min", "numpy.max", "yaml.safe_load", "matplotlib.pyplot.xlabel", "matplotlib.pyp...
[((1389, 1454), 'air_quality_uci_dataset.AirQualityUciDataset', 'air_quality_uci_dataset.AirQualityUciDataset', ([], {'this_type': 'this_type'}), '(this_type=this_type)\n', (1433, 1454), False, 'import air_quality_uci_dataset\n'), ((1508, 1546), 'air_quality_uci_rnn.AirQualityUciRNN', 'air_quality_uci_rnn.AirQualityUci...
import numpy as np import pandas as pd from supervised import AutoML COLS = 10 for ROWS in [1000, 5000, 10000]: X = np.random.uniform(size=(ROWS, COLS)) y = np.random.randint(0, 2, size=(ROWS,)) automl = AutoML(results_path=f"AutoML_{ROWS//1000}k", mode="Explain", features_selection=True) automl.fit(...
[ "numpy.random.uniform", "numpy.random.randint", "supervised.AutoML" ]
[((122, 158), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(ROWS, COLS)'}), '(size=(ROWS, COLS))\n', (139, 158), True, 'import numpy as np\n'), ((167, 204), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2)'], {'size': '(ROWS,)'}), '(0, 2, size=(ROWS,))\n', (184, 204), True, 'import numpy as np\...
import errno import inspect import multiprocessing.pool import os import random import re import sys import datetime as DT import dataclasses from enum import IntFlag import dill as pickle import matplotlib as mpl from matplotlib import pyplot as plt import numpy as np from mlworkflow import get_callable, Dataset fr...
[ "dill.Pickler", "os.path.isfile", "numpy.arange", "os.path.join", "numpy.nanmean", "matplotlib.backends.backend_agg.FigureCanvasAgg", "numpy.isfinite", "dill.load", "matplotlib.figure.Figure", "numpy.nanvar", "datetime.datetime.now", "dill.Unpickler", "os.strerror", "dill.dump", "os.gete...
[((413, 439), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (429, 439), False, 'import os\n'), ((2236, 2259), 'os.path.isabs', 'os.path.isabs', (['filename'], {}), '(filename)\n', (2249, 2259), False, 'import os\n'), ((2980, 2997), 'datetime.datetime.now', 'DT.datetime.now', ([], {}), '()\...
# # Tests for the Finite Volume Method # import pybamm from tests import ( get_mesh_for_testing, get_p2d_mesh_for_testing, get_1p1d_mesh_for_testing, ) import numpy as np from scipy.sparse import kron, eye import unittest class TestFiniteVolume(unittest.TestCase): def test_node_to_edge_to_node(self): ...
[ "tests.get_1p1d_mesh_for_testing", "pybamm.Discretisation", "pybamm.upwind", "pybamm.SpatialVariable", "numpy.ones", "scipy.sparse.eye", "pybamm.Integral", "unittest.main", "pybamm.surf", "pybamm.downwind", "pybamm.laplacian", "tests.get_mesh_for_testing", "pybamm.Variable", "numpy.ones_li...
[((20896, 20911), 'unittest.main', 'unittest.main', ([], {}), '()\n', (20909, 20911), False, 'import unittest\n'), ((367, 389), 'tests.get_mesh_for_testing', 'get_mesh_for_testing', ([], {}), '()\n', (387, 389), False, 'from tests import get_mesh_for_testing, get_p2d_mesh_for_testing, get_1p1d_mesh_for_testing\n'), ((4...
import torch import torch.cuda import logging import numpy as np import pandas as pd import random from datetime import datetime import os import sys sys.path.append('../../') from src.datasets.MURADataset import MURA_TrainValidTestSplitter, MURA_Dataset from src.models.ARAE import ARAE from src.models.networks.AE_Res...
[ "numpy.random.seed", "pandas.read_csv", "logging.Formatter", "torch.set_num_threads", "torch.device", "src.models.ARAE.ARAE", "sys.path.append", "logging.FileHandler", "random.seed", "datetime.datetime.today", "torch.manual_seed", "torch.cuda.manual_seed", "torch.cuda.is_available", "src.d...
[((150, 175), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (165, 175), False, 'import sys\n'), ((905, 943), 'os.path.isdir', 'os.path.isdir', (["(OUTPUT_PATH + 'models/')"], {}), "(OUTPUT_PATH + 'models/')\n", (918, 943), False, 'import os\n'), ((943, 978), 'os.makedirs', 'os.makedirs',...
""" This module provides graphing functionality for visualising level data over time. """ # pylint: disable=relative-beyond-top-level import math import os import datetime import numpy as np from matplotlib import pyplot as plt from matplotlib.dates import DateFormatter try: from .utils import flatten from ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.yscale", "analysis.moving_average", "matplotlib.pyplot.style.use", "numpy.arange", "matplotlib.pyplot.gca", "matplotlib.pyplot.fill_between", "matplotlib.pyplot.tight_layout", "os.path.join", "os.path.dirname", "matplotlib.dates.DateFormatter", "nu...
[((631, 680), 'os.path.join', 'os.path.join', (['RESOURCES', '"""proplot_style.mplstyle"""'], {}), "(RESOURCES, 'proplot_style.mplstyle')\n", (643, 680), False, 'import os\n'), ((572, 597), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (587, 597), False, 'import os\n'), ((3309, 3319), 'matpl...
from planer import read_net, resize import numpy as np import scipy.ndimage as ndimg import random, math, itertools from tqdm import tqdm import os.path as osp root = osp.abspath(osp.dirname(__file__)) def progress(i, n, bar=[None]): if bar[0] is None: bar[0] = tqdm() bar[0].total = n bar[0].update(1) ...
[ "numpy.divide", "tqdm.tqdm", "planer.resize", "math.ceil", "numpy.random.rand", "os.path.dirname", "numpy.asarray", "numpy.zeros", "planer.read_net", "numpy.ones", "numpy.linalg.norm", "numpy.exp", "numpy.linspace", "numpy.sign", "numpy.arange", "itertools.product", "concurrent.futur...
[((180, 201), 'os.path.dirname', 'osp.dirname', (['__file__'], {}), '(__file__)\n', (191, 201), True, 'import os.path as osp\n'), ((734, 777), 'numpy.zeros', 'np.zeros', (['((1, 3) + img.shape[2:])', 'img.dtype'], {}), '((1, 3) + img.shape[2:], img.dtype)\n', (742, 777), True, 'import numpy as np\n'), ((786, 815), 'num...
import os from torchvision import datasets import numpy as np from scipy.io import loadmat from .base_load_data import base_load_data import wget class dynamic_mnist_loader(base_load_data): def __init__(self, args, use_fixed_validation=False, no_binarization=False): super(dynamic_mnist_loader, self).__init...
[ "numpy.zeros", "os.path.exists", "wget.download", "numpy.swapaxes", "os.path.join" ]
[((3867, 3931), 'os.path.join', 'os.path.join', (['"""datasets"""', 'self.args.dataset_name', '"""chardata.mat"""'], {}), "('datasets', self.args.dataset_name, 'chardata.mat')\n", (3879, 3931), False, 'import os\n'), ((443, 491), 'os.path.join', 'os.path.join', (['"""datasets"""', 'self.args.dataset_name'], {}), "('dat...
""" data generator for feeding data into pytorch models """ import os, sys import json import math from random import shuffle, randint, uniform, sample from copy import deepcopy from functools import reduce from typing import Optional, List, Tuple, Sequence, NoReturn import numpy as np np.set_printoptions(precision=5,...
[ "json.dump", "copy.deepcopy", "torch_ecg.databases.CPSC2019", "numpy.set_printoptions", "tqdm.tqdm", "json.load", "math.ceil", "os.path.abspath", "random.shuffle", "numpy.zeros", "torch.set_default_tensor_type", "torch_ecg._preprocessors.PreprocManager.from_config", "math.floor", "os.path....
[((288, 335), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(5)', 'suppress': '(True)'}), '(precision=5, suppress=True)\n', (307, 335), True, 'import numpy as np\n'), ((926, 975), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['torch.DoubleTensor'], {}), '(torch.DoubleTensor)...
import os import tempfile import zipfile import shutil from urllib.request import urlretrieve from sktime.utils.data_io import load_from_tsfile_to_dataframe from sklearn.utils.multiclass import class_distribution import pandas as pd import numpy as np NonExistentKey = -1 DIRNAME = "database" MODULE = os.path.dirnam...
[ "zipfile.ZipFile", "os.makedirs", "numpy.amin", "os.path.basename", "os.path.dirname", "numpy.asarray", "os.path.exists", "urllib.request.urlretrieve", "tempfile.mkdtemp", "pandas.Series", "shutil.rmtree", "sktime.utils.data_io.load_from_tsfile_to_dataframe", "os.path.join", "os.listdir", ...
[((306, 331), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (321, 331), False, 'import os\n'), ((2421, 2450), 'os.path.join', 'os.path.join', (['MODULE', 'DIRNAME'], {}), '(MODULE, DIRNAME)\n', (2433, 2450), False, 'import os\n'), ((4938, 4959), 'os.path.basename', 'os.path.basename', (['url...
from scipy import * from pylab import * import numpy as np import cv2 as cv2 # image = imread("img/me1.jpg")[:, :, 0] image = cv2.imread("img//test.jpg") print(f'width: {image.shape[1]} pixels') print(f'height: {image.shape[0]} pixels') print(f'channels: {image.shape[2]}') cv2.imshow('image', image) cv2...
[ "cv2.waitKey", "cv2.cvtColor", "cv2.imwrite", "numpy.zeros", "cv2.rectangle", "cv2.imread", "numpy.random.randint", "cv2.CascadeClassifier", "cv2.imshow" ]
[((131, 158), 'cv2.imread', 'cv2.imread', (['"""img//test.jpg"""'], {}), "('img//test.jpg')\n", (141, 158), True, 'import cv2 as cv2\n'), ((289, 315), 'cv2.imshow', 'cv2.imshow', (['"""image"""', 'image'], {}), "('image', image)\n", (299, 315), True, 'import cv2 as cv2\n'), ((317, 331), 'cv2.waitKey', 'cv2.waitKey', ([...
'''Underwater Detection Experiment.''' from lrp import Linear_Reward_Penalty as LRP from mse import MSE from environment import Environment from pinger import Pinger import numpy as np # Define the number of discrete depths between the surface and seabed. num_actions = 6 n = 10000 interval = 1 time_between = (n / inte...
[ "mse.MSE", "numpy.argmax", "numpy.zeros", "environment.Environment", "lrp.Linear_Reward_Penalty" ]
[((426, 450), 'environment.Environment', 'Environment', (['num_actions'], {}), '(num_actions)\n', (437, 450), False, 'from environment import Environment\n'), ((684, 700), 'lrp.Linear_Reward_Penalty', 'LRP', (['num_actions'], {}), '(num_actions)\n', (687, 700), True, 'from lrp import Linear_Reward_Penalty as LRP\n'), (...
from __future__ import absolute_import # Interface to various QP solvers from builtins import object import numpy as np import mathprogbasepy.quadprog.solvers.solvers as s # Solver Constants OPTIMAL = "optimal" OPTIMAL_INACCURATE = "optimal inaccurate" PRIMAL_INFEASIBLE = "primal infeasible" PRIMAL_INFEASIBLE_INACCURA...
[ "numpy.ones" ]
[((2495, 2514), 'numpy.ones', 'np.ones', (['P.shape[0]'], {}), '(P.shape[0])\n', (2502, 2514), True, 'import numpy as np\n'), ((2563, 2582), 'numpy.ones', 'np.ones', (['P.shape[0]'], {}), '(P.shape[0])\n', (2570, 2582), True, 'import numpy as np\n')]
import os from pathlib import Path import artm import numpy as np class RankingByModel: def __init__(self, model_path, metric): """ Class for ranking document search between language pairs. Parameters ---------- model_path: str a path to the artm model direct...
[ "artm.BatchVectorizer", "os.path.dirname", "artm.load_artm_model", "numpy.argsort", "os.path.isfile", "numpy.mean", "pathlib.Path", "numpy.argwhere", "os.listdir" ]
[((509, 541), 'artm.load_artm_model', 'artm.load_artm_model', (['model_path'], {}), '(model_path)\n', (529, 541), False, 'import artm\n'), ((638, 666), 'os.path.isfile', 'os.path.isfile', (['path_to_data'], {}), '(path_to_data)\n', (652, 666), False, 'import os\n'), ((1802, 1827), 'numpy.mean', 'np.mean', (['average_po...
from typing import Union, Tuple, List, Optional, Dict from pathlib import Path import sqlite3 import numpy as np from numpy.typing import NDArray import pandas as pd import cv2 from lxml import etree import h5py from napari_imsmicrolink.utils.points import apply_rotmat_points from napari_imsmicrolink.utils.ims_coords i...
[ "numpy.invert", "cv2.approxPolyDP", "pandas.read_csv", "cv2.arcLength", "numpy.argmax", "numpy.ones", "pathlib.Path", "lxml.etree.iterparse", "numpy.arange", "pandas.read_table", "numpy.round", "numpy.unique", "pandas.DataFrame", "napari_imsmicrolink.utils.points.apply_rotmat_points", "n...
[((2509, 2618), 'pandas.read_table', 'pd.read_table', (['data_fp'], {'header': 'None', 'skiprows': '(2)', 'sep': '""" """', 'names': "['X-pos', 'Y-pos', 'spot-name', 'region']"}), "(data_fp, header=None, skiprows=2, sep=' ', names=['X-pos',\n 'Y-pos', 'spot-name', 'region'])\n", (2522, 2618), True, 'import pandas as...
# noqa: D100 from __future__ import annotations import numpy as np import xarray as xr from numba import float32, float64, vectorize from xclim.core.calendar import date_range, datetime_to_decimal_year from xclim.core.units import amount2rate, convert_units_to, declare_units, units2pint from xclim.indices.helpers imp...
[ "numpy.arctan2", "xclim.indices.helpers.extraterrestrial_solar_radiation", "xclim.indices.helpers.time_correction_for_solar_angle", "xclim.core.units.convert_units_to", "numpy.exp", "xclim.core.calendar.datetime_to_decimal_year", "numpy.power", "numpy.arcsin", "numpy.linspace", "numba.float64", ...
[((968, 1035), 'xclim.core.units.declare_units', 'declare_units', ([], {'tas': '"""[temperature]"""', 'tdps': '"""[temperature]"""', 'hurs': '"""[]"""'}), "(tas='[temperature]', tdps='[temperature]', hurs='[]')\n", (981, 1035), False, 'from xclim.core.units import amount2rate, convert_units_to, declare_units, units2pin...
# -*- coding: utf-8 -*- """Find new relations between entities. This file contains functions that find predicted relations from a logistic regression model given model embeddings The model and embeddings are trained and created from a graph containing drugs, targets and side effects. The graph used contained nodeIDs ...
[ "bionev.utils.load_embedding", "pandas.read_csv", "numpy.array", "networkx.read_edgelist", "joblib.load", "operator.itemgetter" ]
[((1079, 1099), 'bionev.utils.load_embedding', 'load_embedding', (['path'], {}), '(path)\n', (1093, 1099), False, 'from bionev.utils import load_embedding\n'), ((1135, 1156), 'numpy.array', 'np.array', (['node_vector'], {}), '(node_vector)\n', (1143, 1156), True, 'import numpy as np\n'), ((1943, 1966), 'joblib.load', '...
#!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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, merg...
[ "morphablegraphs.constraints.spatial_constraints.keyframe_constraints.Direction2DConstraint", "numpy.zeros", "transformations.quaternion_matrix", "morphablegraphs.constraints.spatial_constraints.keyframe_constraints.GlobalTransformConstraint", "numpy.linalg.norm", "numpy.array", "morphablegraphs.constra...
[((2138, 2154), 'numpy.zeros', 'np.zeros', (['n_dims'], {}), '(n_dims)\n', (2146, 2154), True, 'import numpy as np\n'), ((4625, 4650), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (4648, 4650), False, 'import collections\n'), ((5827, 5856), 'numpy.linalg.norm', 'np.linalg.norm', (['local_dir_...
import pyclesperanto_prototype as cle import numpy as np def test_label_nonzero_pixel_count_ratio_map(): labels1 = np.asarray([[1, 2, 2, 3]]) labels2 = np.asarray([[1, 2, 0, 0]]) reference12 = np.asarray([[1, 0.5, 0.5, 0]]) reference21 = np.asarray([[1, 1, 0, 0]]) result = cle.label_nonzero_pixel...
[ "pyclesperanto_prototype.label_nonzero_pixel_count_ratio_map", "numpy.asarray", "numpy.array_equal" ]
[((120, 146), 'numpy.asarray', 'np.asarray', (['[[1, 2, 2, 3]]'], {}), '([[1, 2, 2, 3]])\n', (130, 146), True, 'import numpy as np\n'), ((161, 187), 'numpy.asarray', 'np.asarray', (['[[1, 2, 0, 0]]'], {}), '([[1, 2, 0, 0]])\n', (171, 187), True, 'import numpy as np\n'), ((207, 237), 'numpy.asarray', 'np.asarray', (['[[...
''' Test Sciris math functions. ''' import numpy as np import pylab as pl import sciris as sc import pytest if 'doplot' not in locals(): doplot = False def test_utils(): sc.heading('Testing utilities') o = sc.objdict() print('Testing sc.approx()') assert sc.approx(2*6, 11.9999999, eps=1e-6) # Ret...
[ "sciris.safedivide", "sciris.findinds", "pylab.randn", "sciris.smooth", "pylab.linspace", "sciris.tic", "sciris.findnearest", "sciris.objdict", "sciris.randround", "sciris.normsum", "sciris.approx", "numpy.random.randn", "sciris.toc", "pytest.raises", "sciris.normalize", "sciris.smooth...
[((179, 210), 'sciris.heading', 'sc.heading', (['"""Testing utilities"""'], {}), "('Testing utilities')\n", (189, 210), True, 'import sciris as sc\n'), ((220, 232), 'sciris.objdict', 'sc.objdict', ([], {}), '()\n', (230, 232), True, 'import sciris as sc\n'), ((278, 317), 'sciris.approx', 'sc.approx', (['(2 * 6)', '(11....
#!/usr/bin/env python3 ################# # img_to_vec.py # ################# import numpy as np import imutils import cv2 import os import sys ROOT_DIR = os.path.abspath("../") sys.path.append(ROOT_DIR) from webcam import pre_recognition def img_to_vec(image_path, detector, embedder, min_prob_filter): ''' ...
[ "sys.path.append", "os.path.abspath", "numpy.argmax", "webcam.pre_recognition.extract_vector", "cv2.imread", "numpy.array", "imutils.resize", "webcam.pre_recognition.locate_faces" ]
[((157, 179), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (172, 179), False, 'import os\n'), ((180, 205), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (195, 205), False, 'import sys\n'), ((905, 927), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2016 <NAME> (http://www.jdhp.org) # 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 limit...
[ "numpy.fft.irfft2", "numpy.fft.ifftshift", "matplotlib.pyplot.show", "argparse.ArgumentParser", "matplotlib.pyplot.subplots", "PIL.Image.open", "numpy.fft.fftshift", "numpy.fft.rfft2", "matplotlib.pyplot.savefig" ]
[((1857, 1911), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""An FFT snippet."""'}), "(description='An FFT snippet.')\n", (1880, 1911), False, 'import argparse\n'), ((2564, 2599), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(14, 8)'}), '(2, 2, figsize=(14...
import numpy as np class Bat: def __init__(self, min_x, max_x, min_v, max_v, fitness_func, f_min, f_max, dimensions, alpha, gamma): self.min_velocity = min_v self.max_velocity = max_v self.min_position = min_x self.max_position = max_x self.min_frequency = f_min sel...
[ "numpy.random.uniform", "numpy.zeros", "numpy.exp", "numpy.clip" ]
[((497, 520), 'numpy.random.uniform', 'np.random.uniform', (['(1)', '(2)'], {}), '(1, 2)\n', (514, 520), True, 'import numpy as np\n'), ((546, 569), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (563, 569), True, 'import numpy as np\n'), ((665, 700), 'numpy.zeros', 'np.zeros', (['self.n...
import numpy as np from numpy.linalg import svd from cv2 import cv2 import pickle images = ["bear.jpg"] def compress_show_color_images_reshape(name, k): image = cv2.imread(name) image = np.asarray(image) original_shape = image.shape image_reshaped = image.reshape((original_shape[0],original_shape[1]*3...
[ "cv2.cv2.imread", "numpy.asarray", "numpy.linalg.svd", "pickle.dump" ]
[((167, 183), 'cv2.cv2.imread', 'cv2.imread', (['name'], {}), '(name)\n', (177, 183), False, 'from cv2 import cv2\n'), ((196, 213), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (206, 213), True, 'import numpy as np\n'), ((335, 375), 'numpy.linalg.svd', 'svd', (['image_reshaped'], {'full_matrices': '(Fal...
import pathlib import shutil import meshzoo import numpy as np import pytest from numba_celltree import CellTree2d from numba_celltree.constants import MAX_N_VERTEX @pytest.fixture def datadir(tmpdir, request): data = pathlib.Path(__file__).parent / "data" shutil.copy(data / "triangles.txt", tmpdir / "trian...
[ "numpy.concatenate", "meshzoo.disk", "numba_celltree.CellTree2d", "pytest.raises", "pathlib.Path", "numpy.array", "numpy.loadtxt", "numpy.arange", "numpy.array_equal", "shutil.copy" ]
[((595, 629), 'numpy.array', 'np.array', (['nodes2'], {'dtype': 'np.float64'}), '(nodes2, dtype=np.float64)\n', (603, 629), True, 'import numpy as np\n'), ((638, 669), 'numpy.array', 'np.array', (['faces2'], {'dtype': 'np.intc'}), '(faces2, dtype=np.intc)\n', (646, 669), True, 'import numpy as np\n'), ((269, 330), 'shu...
############################################################################# # # Author: <NAME>, <NAME> # # Copyright: <NAME> TSRI 2000 # ############################################################################# # # # $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/autoflexCommands.py,v 1.69.2.2 2016/02/1...
[ "tkinter.StringVar", "DejaVu.IndexedPolylines.IndexedPolylines", "MolKit.protein.ResidueSet", "DejaVu.Points.CrossSet", "Pmv.moleculeViewer.EditAtomsEvent", "MolKit.bondSelector.RotatableBondSelector", "tkinter.simpledialog.SimpleDialog", "AutoDockTools.atomTypeTools.AutoDock4_AtomTyper", "MolKit.bo...
[((5162, 5174), 'ViewerFramework.VFCommand.CommandGUI', 'CommandGUI', ([], {}), '()\n', (5172, 5174), False, 'from ViewerFramework.VFCommand import CommandGUI\n'), ((10989, 11001), 'ViewerFramework.VFCommand.CommandGUI', 'CommandGUI', ([], {}), '()\n', (10999, 11001), False, 'from ViewerFramework.VFCommand import Comma...
# this is a follow up on face-recognition2.py. # attempt to use a video file based on face-recognition2.py import os from model import create_model import numpy as np import os.path import matplotlib.pyplot as plt from align import AlignDlib from sklearn.preprocessing import LabelEncoder from sklearn.svm import Linear...
[ "sklearn.svm.LinearSVC", "numpy.array", "numpy.arange", "sklearn.preprocessing.LabelEncoder" ]
[((558, 594), 'numpy.array', 'np.array', (['[m.name for m in metadata]'], {}), '([m.name for m in metadata])\n', (566, 594), True, 'import numpy as np\n'), ((605, 619), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (617, 619), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((924, ...
from unittest import TestCase from unittest.mock import Mock, create_autospec import numpy as np import pandas as pd from acnportal.acnsim import Simulator from acnportal.acnsim.network import ChargingNetwork from acnportal.algorithms import BaseAlgorithm from acnportal.acnsim.events import EventQueue, Event from dat...
[ "unittest.mock.create_autospec", "acnportal.acnsim.network.ChargingNetwork", "unittest.mock.Mock", "acnportal.acnsim.models.EVSE", "numpy.array", "acnportal.acnsim.Simulator", "acnportal.acnsim.events.Event" ]
[((453, 467), 'unittest.mock.Mock', 'Mock', (['datetime'], {}), '(datetime)\n', (457, 467), False, 'from unittest.mock import Mock, create_autospec\n'), ((486, 503), 'acnportal.acnsim.network.ChargingNetwork', 'ChargingNetwork', ([], {}), '()\n', (501, 503), False, 'from acnportal.acnsim.network import ChargingNetwork\...
import chess import numpy as np root = None # MCTS class class MctsNode(): def __init__(self, state, parent=None, parent_action=None): ''' Initialise a board state ''' self.state = state self.board = chess.Board(state) self.parent = parent if self.parent...
[ "chess.Board", "numpy.argmax" ]
[((249, 267), 'chess.Board', 'chess.Board', (['state'], {}), '(state)\n', (260, 267), False, 'import chess\n'), ((3189, 3207), 'numpy.argmax', 'np.argmax', (['weights'], {}), '(weights)\n', (3198, 3207), True, 'import numpy as np\n')]
import random import numpy as np import json from tqdm import tqdm class IUR_Dataset: def __init__( self, data_path, num_sample_per_author=4, episode_length=16, max_token_length=32, num_authors=None, ): self.dataset_path = data_path self.num_sam...
[ "numpy.array", "random.randint" ]
[((1376, 1401), 'random.randint', 'random.randint', (['(0)', 'maxval'], {}), '(0, maxval)\n', (1390, 1401), False, 'import random\n'), ((2598, 2619), 'numpy.array', 'np.array', (['[author_id]'], {}), '([author_id])\n', (2606, 2619), True, 'import numpy as np\n'), ((2456, 2475), 'numpy.array', 'np.array', (['input_ids']...
#!/usr/bin/env python # ------------------------------------------------------------------------------------------------------% # Created by "<NAME>" at 14:51, 17/03/2020 % # ...
[ "numpy.random.uniform", "copy.deepcopy", "numpy.abs", "numpy.power", "numpy.mean", "numpy.random.randint", "math.gamma", "numpy.sin", "numpy.random.rand" ]
[((2036, 2045), 'numpy.abs', 'np.abs', (['E'], {}), '(E)\n', (2042, 2045), True, 'import numpy as np\n'), ((1748, 1767), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (1765, 1767), True, 'import numpy as np\n'), ((1920, 1939), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (1937, 1939),...
# -------------------------------------------------------- # Tensorflow VCL # Licensed under The MIT License [see LICENSE for details] # Written by <NAME> # -------------------------------------------------------- """ Change the HICO-DET detection results to the right format. """ import pickle import numpy as np impo...
[ "os.makedirs", "os.path.join", "os.path.exists", "numpy.ones", "scipy.io.savemat", "datetime.datetime.now", "numpy.argsort", "ult.tools.get_convert_matrix", "os.listdir" ]
[((2192, 2212), 'ult.tools.get_convert_matrix', 'get_convert_matrix', ([], {}), '()\n', (2210, 2212), False, 'from ult.tools import get_convert_matrix\n'), ((2084, 2131), 'scipy.io.savemat', 'sio.savemat', (['savefile', "{'all_boxes': all_boxes}"], {}), "(savefile, {'all_boxes': all_boxes})\n", (2095, 2131), True, 'imp...
''' Set of functions useful in some modules 2021 - <NAME> & <NAME> ''' import inspect import numpy as np from numpy import dot from numpy.linalg import inv from scipy.stats import gaussian_kde import matplotlib.pyplot as plt import deepdish as dd # Prepare matrices for spline reconstruction def spline_preparation(z_k...
[ "numpy.trapz", "deepdish.io.load", "matplotlib.pyplot.show", "matplotlib.pyplot.hist", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.zeros", "scipy.stats.gaussian_kde", "numpy.max", "numpy.where", "inspect.getargspec", "numpy.exp", "numpy.linspace", "numpy.linalg.inv", "numpy.min", ...
[((555, 574), 'numpy.zeros', 'np.zeros', (['(n_mat - 1)'], {}), '(n_mat - 1)\n', (563, 574), True, 'import numpy as np\n'), ((714, 746), 'numpy.zeros', 'np.zeros', (['[n_mat - 2, n_mat - 2]'], {}), '([n_mat - 2, n_mat - 2])\n', (722, 746), True, 'import numpy as np\n'), ((755, 783), 'numpy.zeros', 'np.zeros', (['[n_mat...
from copy import deepcopy import numpy as np from khan.common import get_mauna_kea_summit_extinction from khan.pipeline.images import CCDImage def correct_for_airmass_extinction(data: list[list[CCDImage]]) \ -> list[list[CCDImage]]: """ Apply the wavelength- and airmass-dependent flux correction. Fo...
[ "copy.deepcopy", "khan.common.get_mauna_kea_summit_extinction", "numpy.shape", "numpy.tile", "numpy.interp", "khan.pipeline.images.CCDImage" ]
[((702, 745), 'khan.common.get_mauna_kea_summit_extinction', 'get_mauna_kea_summit_extinction', ([], {'value': '(True)'}), '(value=True)\n', (733, 745), False, 'from khan.common import get_mauna_kea_summit_extinction\n'), ((814, 828), 'numpy.shape', 'np.shape', (['data'], {}), '(data)\n', (822, 828), True, 'import nump...
import carla import numpy as np class Vehicle: def __init__(self, controller, vehicle_id, auto_pilot=True, dashcam=True, third_camera=True, color=None): self.controller = controller self.world = self.controller.world self.blueprint = self.controller.world.get_blueprint_library().find(vehic...
[ "carla.Location", "carla.Rotation", "numpy.random.choice" ]
[((431, 471), 'numpy.random.choice', 'np.random.choice', (['recommend_spawn_points'], {}), '(recommend_spawn_points)\n', (447, 471), True, 'import numpy as np\n'), ((1187, 1220), 'carla.Location', 'carla.Location', ([], {'x': '(1.5)', 'y': '(0)', 'z': '(1.2)'}), '(x=1.5, y=0, z=1.2)\n', (1201, 1220), False, 'import car...
import matplotlib import matplotlib.cm import numpy as np import matplotlib.pyplot as plt import torch def ShowMissclassifiedImages(model, data, class_id, device,dataType='val', num_images=12,save_as="misclassified.jpg"): dataloaders, class_names = data.dataloaders, data.class_names was_training = model.train...
[ "matplotlib.pyplot.show", "numpy.transpose", "numpy.clip", "matplotlib.pyplot.figure", "numpy.array", "torch.max", "torch.no_grad" ]
[((2107, 2134), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 6)'}), '(figsize=(12, 6))\n', (2117, 2134), True, 'import matplotlib.pyplot as plt\n'), ((437, 452), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (450, 452), False, 'import torch\n'), ((2144, 2159), 'torch.no_grad', 'torch.no_grad',...
from typing import List import os import numpy as np from data import VECTORS_DIR from transformers import AutoTokenizer class Tokenizer(object): def __init__(self): pass def tokenize(self, sequences: List[List[str]], max_sequence_size=100, **kwargs): raise NotImplementedError class BERTT...
[ "numpy.asarray", "transformers.AutoTokenizer.from_pretrained", "os.path.join" ]
[((432, 475), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['bert_version'], {}), '(bert_version)\n', (461, 475), False, 'from transformers import AutoTokenizer\n'), ((1550, 1573), 'numpy.asarray', 'np.asarray', (['word_inputs'], {}), '(word_inputs)\n', (1560, 1573), True, 'import num...
import numpy as np import torch class Rocket: """ This rocket has state [x, z, theta, xdot, zdot, thetadot], where x/z are the position or the center of the rocket. theta is the angle between the rocket and the verticle line. """ def __init__(self): self.length = 0.2 self.mass ...
[ "numpy.eye", "torch.stack", "numpy.zeros", "torch.cat", "torch.cos", "numpy.sin", "numpy.array", "numpy.cos", "numpy.dot", "torch.sin", "numpy.concatenate" ]
[((1451, 1467), 'numpy.zeros', 'np.zeros', (['(6, 6)'], {}), '((6, 6))\n', (1459, 1467), True, 'import numpy as np\n'), ((1480, 1496), 'numpy.zeros', 'np.zeros', (['(6, 2)'], {}), '((6, 2))\n', (1488, 1496), True, 'import numpy as np\n'), ((1515, 1527), 'numpy.cos', 'np.cos', (['x[2]'], {}), '(x[2])\n', (1521, 1527), T...
#!/usr/bin/python """ SP8_tiff.py <NAME>, 20 Sept 2020 mailto:<EMAIL> required packages: matplotlib, numpy, scipy, czifile, roipoly, tifffile """ from SZmicroscopy import * import numpy as np ################ Set tiff format # img_array = Read_1by1_TCYX(n_time=2, n_channel=3) # for 1by1 reading # img_arra...
[ "numpy.savetxt", "numpy.concatenate" ]
[((519, 579), 'numpy.concatenate', 'np.concatenate', (['(img_array1, img_array2, img_array3)'], {'axis': '(0)'}), '((img_array1, img_array2, img_array3), axis=0)\n', (533, 579), True, 'import numpy as np\n'), ((1045, 1120), 'numpy.concatenate', 'np.concatenate', (['(cell[:, :, 0].T, cell[:, :, 1].T, cell[:, :, 2].T)'],...
import numpy as np from pyearth import Earth from timeit import Timer # The robot arm example, as defined in: # Fast MARS, <NAME>, Technical Report No.110, May 1993, section 6.2. np.random.seed(2) nb_examples = 400 theta1 = np.random.uniform(0, 2 * np.pi, size=nb_examples) theta2 = np.random.uniform(0, 2 * np.pi, siz...
[ "numpy.random.uniform", "numpy.random.seed", "pyearth.Earth", "numpy.sin", "numpy.cos", "numpy.concatenate", "numpy.sqrt" ]
[((181, 198), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (195, 198), True, 'import numpy as np\n'), ((226, 275), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(2 * np.pi)'], {'size': 'nb_examples'}), '(0, 2 * np.pi, size=nb_examples)\n', (243, 275), True, 'import numpy as np\n'), ((285, 334...
import numpy as np import math import dlib def ExtractNormalLandMark(image): # Initialization landx = np.zeros((1, 68), np.float64) landy = np.zeros((1, 68), np.float64) detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat"...
[ "math.atan", "numpy.zeros", "numpy.mean", "dlib.get_frontal_face_detector", "dlib.shape_predictor" ]
[((119, 148), 'numpy.zeros', 'np.zeros', (['(1, 68)', 'np.float64'], {}), '((1, 68), np.float64)\n', (127, 148), True, 'import numpy as np\n'), ((162, 191), 'numpy.zeros', 'np.zeros', (['(1, 68)', 'np.float64'], {}), '((1, 68), np.float64)\n', (170, 191), True, 'import numpy as np\n'), ((210, 242), 'dlib.get_frontal_fa...
from .. import moment import numpy as np import pandas as pd import datetime as dt import tzlocal import pytz import time class TestMoment: def test_moment(self): test0 = float(1580780607) test = test0 assert moment.Moment(test)._posix == test0 test = dt.datetime.fromtimestamp(test...
[ "tzlocal.get_localzone", "pandas.Timestamp.fromtimestamp", "numpy.datetime64", "numpy.testing.assert_array_equal", "time.time", "numpy.arange", "pandas.to_datetime", "datetime.timedelta", "datetime.datetime.fromtimestamp", "numpy.testing.assert_array_almost_equal" ]
[((290, 322), 'datetime.datetime.fromtimestamp', 'dt.datetime.fromtimestamp', (['test0'], {}), '(test0)\n', (315, 322), True, 'import datetime as dt\n'), ((389, 408), 'numpy.datetime64', 'np.datetime64', (['test'], {}), '(test)\n', (402, 408), True, 'import numpy as np\n'), ((475, 508), 'pandas.Timestamp.fromtimestamp'...
# Call this function after running gld_align to visualize the aligned data. # Assumptions: # uE Interface : Channel 1, microelectrode recording, sampled at 32 kHz. # Lf Interface : Channel 1, EOG channel, sampled at 1 kHz. # Sync Interface: Digin 1, TTL input, sampled at 32 kHZ. import numpy as np import matplotlib.pyp...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((404, 415), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (412, 415), True, 'import numpy as np\n'), ((3883, 3896), 'matplotlib.pyplot.figure', 'plt.figure', (['n'], {}), '(n)\n', (3893, 3896), True, 'import matplotlib.pyplot as plt\n'), ((3901, 3924), 'matplotlib.pyplot.title', 'plt.title', (['"""EOG delays"""'],...
import pandas as pd import numpy as np from scipy import integrate, stats from numpy import absolute, mean from itertools import islice import statsmodels.api as sm from statsmodels.formula.api import ols import statsmodels.stats.multicomp import seaborn as sns import matplotlib.pyplot as plt import statsmodels.formu...
[ "pandas.DataFrame", "numpy.logical_and", "pandas.read_csv", "statsmodels.formula.api.mixedlm", "scipy.stats.ttest_rel", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "scipy.stats.ttest_ind", "statsmodels.api.stats.anova_lm", "seaborn.swarmplot", "pandas.notnull", "seaborn.boxplot", ...
[((962, 1003), 'pandas.read_csv', 'pd.read_csv', (['raw_data_location3'], {'header': '(0)'}), '(raw_data_location3, header=0)\n', (973, 1003), True, 'import pandas as pd\n'), ((1027, 1041), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1039, 1041), True, 'import pandas as pd\n'), ((1063, 1077), 'pandas.DataFra...
import numpy from coopihc.policy.BasePolicy import BasePolicy from coopihc.base.Space import Space class BadlyDefinedLikelihoodError(Exception): pass class ELLDiscretePolicy(BasePolicy): """ELLDiscretePolicy Explicitly defined Likelihood Policy. A policy which is described by an explicit probabilistic ...
[ "numpy.random.default_rng", "coopihc.base.Space.Space.cartesian_product" ]
[((2069, 2099), 'numpy.random.default_rng', 'numpy.random.default_rng', (['seed'], {}), '(seed)\n', (2093, 2099), False, 'import numpy\n'), ((3870, 3907), 'coopihc.base.Space.Space.cartesian_product', 'Space.cartesian_product', (['action_space'], {}), '(action_space)\n', (3893, 3907), False, 'from coopihc.base.Space im...
import cv2 import numpy as np def hough(orig_frame): frame = cv2.GaussianBlur(orig_frame, (5, 5), 0) hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) low_yellow = np.array([0, 0, 215]) up_yellow = np.array([117, 255, 255]) mask = cv2.inRange(hsv, low_yellow, up_yellow) edges = cv2.Canny(ma...
[ "cv2.GaussianBlur", "cv2.VideoWriter_fourcc", "numpy.ones", "cv2.VideoWriter", "cv2.HoughLinesP", "cv2.erode", "cv2.rectangle", "cv2.imshow", "cv2.inRange", "cv2.line", "cv2.cvtColor", "cv2.imwrite", "cv2.setMouseCallback", "cv2.setTrackbarPos", "cv2.getTrackbarPos", "cv2.boundingRect"...
[((631, 658), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Trackbar"""'], {}), "('Trackbar')\n", (646, 658), False, 'import cv2\n'), ((668, 697), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""danu1.mp4"""'], {}), "('danu1.mp4')\n", (684, 697), False, 'import cv2\n'), ((874, 938), 'cv2.createTrackbar', 'cv2.createTrackba...
""" What is the grid world is less grid like - sort of like zelda? """ from enum import Enum import numpy as np import random import gym from gym.spaces import Box, Discrete, Tuple class Direction(Enum): NOOP = 0 N = 1 S = 2 W = 3 E = 4 NE = 5 NW = 6 SE = 7 SW = 8 direction_delt...
[ "numpy.sum", "gym.spaces.Discrete", "numpy.zeros", "castle.base.play_random", "gym.spaces.Box" ]
[((3862, 3878), 'castle.base.play_random', 'play_random', (['env'], {}), '(env)\n', (3873, 3878), False, 'from castle.base import play_blocking, play_random\n'), ((1688, 1713), 'numpy.zeros', 'np.zeros', (['(height, width)'], {}), '((height, width))\n', (1696, 1713), True, 'import numpy as np\n'), ((2557, 2568), 'gym.s...
## # create Features form live data and compare them with trained SVM Model # ## import json import numpy as np import pickle import sys from p300Functions import filterDownsampleData from sklearn import preprocessing debug = False # enable/disable debug Mode avgChannel = False # avg all channel in Featur...
[ "sys.stdin.read", "sklearn.preprocessing.scale", "numpy.argmax", "numpy.median", "numpy.any", "pickle.load", "numpy.array", "p300Functions.filterDownsampleData" ]
[((812, 838), 'numpy.array', 'np.array', (['volts'], {'dtype': '"""f"""'}), "(volts, dtype='f')\n", (820, 838), True, 'import numpy as np\n'), ((854, 883), 'numpy.array', 'np.array', (['baseline'], {'dtype': '"""f"""'}), "(baseline, dtype='f')\n", (862, 883), True, 'import numpy as np\n'), ((1118, 1180), 'p300Functions...
################################################################################################# # Given two sorted arrays arr1[] and arr2[] non-decreasing order with size n and m. The task is # # to merge the two sorted arrays into sorted array (in non-decreasing order). # ##########################...
[ "numpy.sort", "numpy.concatenate" ]
[((750, 786), 'numpy.concatenate', 'np.concatenate', (['(arr1, arr2)'], {'axis': '(1)'}), '((arr1, arr2), axis=1)\n', (764, 786), True, 'import numpy as np\n'), ((801, 820), 'numpy.sort', 'np.sort', (['merged_arr'], {}), '(merged_arr)\n', (808, 820), True, 'import numpy as np\n')]
import gym from gym import error, spaces, utils from gym.utils import seeding import pygame import numpy as np import cv2 from .action import Action from .arrow import * from .kiloBot import KiloBot import os class KiloBotEnv(gym.Env): metadata={'render.modes':['human']} BLACK=(0,0,0);WHITE=(255,255,255);BLUE=...
[ "numpy.sum", "numpy.random.random_sample", "numpy.ones", "numpy.random.randint", "numpy.sin", "pygame.display.quit", "pygame.surfarray.array3d", "pygame.display.set_mode", "pygame.display.set_caption", "pygame.quit", "pygame.Surface", "numpy.square", "pygame.init", "pygame.display.get_init...
[((348, 361), 'pygame.init', 'pygame.init', ([], {}), '()\n', (359, 361), False, 'import pygame\n'), ((2350, 2369), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (2367, 2369), False, 'import pygame\n'), ((4030, 4068), 'numpy.array', 'np.array', (['histvalues'], {'dtype': 'np.float32'}), '(histvalues, dtyp...
import unittest import cdms2 import numpy import subprocess import tempfile import os class CDMSNc3(unittest.TestCase): def testOutputNC3(self): tempdir = tempfile.mkdtemp() data = numpy.random.random((12,10)) cdms2.useNetcdf3() fnm = os.path.join(tempdir,"temp_cdms2file.nc") ...
[ "cdms2.open", "cdms2.useNetcdf3", "subprocess.Popen", "tempfile.mkdtemp", "numpy.random.random", "os.path.join" ]
[((168, 186), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (184, 186), False, 'import tempfile\n'), ((202, 231), 'numpy.random.random', 'numpy.random.random', (['(12, 10)'], {}), '((12, 10))\n', (221, 231), False, 'import numpy\n'), ((239, 257), 'cdms2.useNetcdf3', 'cdms2.useNetcdf3', ([], {}), '()\n', (25...
import pandas as pd import numpy as np from sklearn.linear_model import Lasso from sklearn.impute import SimpleImputer from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from sklearn.preprocessing import PolynomialFeatures, OneHotEncoder, MinMaxScaler from sklearn.ensemble import Baggi...
[ "sklearn.impute.SimpleImputer", "pandas.read_csv", "sklearn.model_selection.cross_val_score", "sklearn.preprocessing.MinMaxScaler", "sklearn.preprocessing.OneHotEncoder", "sklearn.linear_model.Lasso", "sklearn.preprocessing.PolynomialFeatures", "sklearn.ensemble.BaggingRegressor", "numpy.log1p" ]
[((412, 455), 'pandas.read_csv', 'pd.read_csv', (['"""../train.csv"""'], {'index_col': '"""Id"""'}), "('../train.csv', index_col='Id')\n", (423, 455), True, 'import pandas as pd\n'), ((463, 505), 'pandas.read_csv', 'pd.read_csv', (['"""../test.csv"""'], {'index_col': '"""Id"""'}), "('../test.csv', index_col='Id')\n", (...
""" Generate Graeco-Latin Squares """ from .latin_square import latin_square from .utils import _unroll import numpy as np _MAX_ITERATIONS = 10000 def greaco_latin_square(k, factor_1_labels=None, factor_2_labels=None, seed=None, unroll=None): """ Creates a k by k Greaco-Latin Square Design A greaco-latin s...
[ "numpy.array" ]
[((2575, 2604), 'numpy.array', 'np.array', (['greaco_latin_square'], {}), '(greaco_latin_square)\n', (2583, 2604), True, 'import numpy as np\n')]
import torch import argparse import numpy as np import skimage.io as sio from scipy.ndimage import zoom import matplotlib.pylab as plt from models.docs import DOCSNet def load_image(filename, rgb_mean, input_size=512): im = sio.imread(filename) h, w = im.shape[:2] if h>=w and h>input_size: im=zoo...
[ "numpy.pad", "argparse.ArgumentParser", "matplotlib.pylab.subplot", "matplotlib.pylab.imshow", "models.docs.DOCSNet", "torch.load", "scipy.ndimage.zoom", "torch.cuda.is_available", "numpy.tile", "torch.device", "skimage.io.imread", "matplotlib.pylab.show" ]
[((230, 250), 'skimage.io.imread', 'sio.imread', (['filename'], {}), '(filename)\n', (240, 250), True, 'import skimage.io as sio\n'), ((732, 778), 'numpy.pad', 'np.pad', (['im', 'pad', '"""constant"""'], {'constant_values': '(0)'}), "(im, pad, 'constant', constant_values=0)\n", (738, 778), True, 'import numpy as np\n')...
# -*- coding: utf-8 -*- """ Created on Mon Dec 7 15:32:25 2020 @author: sliakat """ from readSpe import readSpe from matplotlib import pyplot as plt import numpy as np import tkinter as tk from tkinter import filedialog plt.close(fig='all') root = tk.Tk() root.withdraw() regionToDisplay=0 #this wi...
[ "numpy.size", "matplotlib.pyplot.close", "tkinter.filedialog.askopenfilenames", "matplotlib.pyplot.figure", "readSpe.readSpe", "tkinter.Tk" ]
[((237, 257), 'matplotlib.pyplot.close', 'plt.close', ([], {'fig': '"""all"""'}), "(fig='all')\n", (246, 257), True, 'from matplotlib import pyplot as plt\n'), ((266, 273), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (271, 273), True, 'import tkinter as tk\n'), ((352, 381), 'tkinter.filedialog.askopenfilenames', 'filedial...
#----------------------------------------------------------------------------- # This file is part of the 'Simple-10GbE-RUDP-KCU105-Example'. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu/display/ppa...
[ "numpy.frombuffer", "pyrogue.LocalVariable" ]
[((1683, 1741), 'numpy.frombuffer', 'np.frombuffer', (['fullData'], {'dtype': '"""uint64"""', 'count': 'num64bWords'}), "(fullData, dtype='uint64', count=num64bWords)\n", (1696, 1741), True, 'import numpy as np\n'), ((2362, 2460), 'pyrogue.LocalVariable', 'pr.LocalVariable', ([], {'name': '"""DebugPrint"""', 'descripti...
import csv import threading import os import socket import sys import logging import time import argparse import datetime import numpy as np import glob import pandas import cv2 from numpy import sin,sign,eye, zeros,cos, ones,vstack,hstack, matmul,transpose, quantile, mean, std , maximum, minimum, amax,amin fro...
[ "numpy.minimum", "numpy.maximum", "numpy.amin", "numpy.quantile", "numpy.std", "pytope.Polytope", "numpy.zeros", "numpy.hstack", "numpy.amax", "controlpy.synthesis.controller_lqr_discrete_time", "numpy.mean", "numpy.linalg.norm", "numpy.array", "scipy.special.seterr", "numpy.eye", "gur...
[((807, 830), 'scipy.special.seterr', 'sc.seterr', ([], {'all': '"""ignore"""'}), "(all='ignore')\n", (816, 830), True, 'import scipy.special as sc\n'), ((978, 994), 'controlpy.synthesis.controller_lqr_discrete_time', 'dlqr', (['A', 'B', 'Q', 'R'], {}), '(A, B, Q, R)\n', (982, 994), True, 'from controlpy.synthesis impo...
""" Unit tests for train_pg_f18.py """ import numpy as np from mock import patch from sklearn import preprocessing from train_pg_f18 import Agent class TestPolicyGradients(object): def test_normalize(self): with patch.object(Agent, "__init__", lambda p1, p2, p3, p4: None): agent = Agent(None...
[ "mock.patch.object", "sklearn.preprocessing.scale", "train_pg_f18.Agent", "numpy.ones", "numpy.array", "numpy.testing.assert_allclose" ]
[((228, 288), 'mock.patch.object', 'patch.object', (['Agent', '"""__init__"""', '(lambda p1, p2, p3, p4: None)'], {}), "(Agent, '__init__', lambda p1, p2, p3, p4: None)\n", (240, 288), False, 'from mock import patch\n'), ((310, 333), 'train_pg_f18.Agent', 'Agent', (['None', 'None', 'None'], {}), '(None, None, None)\n',...
import numpy as np def centeredfft2(Z, FsX, FsY): """ Computes a 2D fft centered at 0. Or in other words, compute the 2D fft, and then fftshift it. """ M = np.size(Z, 1) N = np.size(Z, 0) k = np.array(range(-M // 2, M // 2)) freqX = k / (M / FsX) k = np.array(range(-N // 2, N // 2...
[ "numpy.size", "numpy.fft.fftshift", "numpy.fft.fft2" ]
[((177, 190), 'numpy.size', 'np.size', (['Z', '(1)'], {}), '(Z, 1)\n', (184, 190), True, 'import numpy as np\n'), ((199, 212), 'numpy.size', 'np.size', (['Z', '(0)'], {}), '(Z, 0)\n', (206, 212), True, 'import numpy as np\n'), ((441, 461), 'numpy.fft.fftshift', 'np.fft.fftshift', (['fft'], {}), '(fft)\n', (456, 461), T...
from math import ceil, sqrt import numpy as np def hoeffding_n_given_t_and_p_one_sided(t:np.double, p:np.double, C=0.5) -> int: """ Return n such that with probability at least p, P(E[X] < \bar X_n + t). Where \bar X_n is the mean of n samples. Parameters ---------- t : double one s...
[ "numpy.log", "math.sqrt" ]
[((1501, 1527), 'math.sqrt', 'sqrt', (['(1 / p_bound_violated)'], {}), '(1 / p_bound_violated)\n', (1505, 1527), False, 'from math import ceil, sqrt\n'), ((576, 589), 'numpy.log', 'np.log', (['(1 - p)'], {}), '(1 - p)\n', (582, 589), True, 'import numpy as np\n'), ((1139, 1160), 'numpy.log', 'np.log', (['(0.5 * (1 - p)...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 4 12:48:00 2020 @author: kpmurphy """ import matplotlib.pyplot as plt import numpy as np from sklearn.datasets import make_classification, make_blobs from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LogisticReg...
[ "numpy.sum", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.draw", "sklearn.preprocessing.PolynomialFeatures", "matplotlib.pyplot.figure", "sklearn.linear_model.LogisticRegression", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots" ]
[((1613, 1625), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1623, 1625), True, 'import matplotlib.pyplot as plt\n'), ((1626, 1679), 'matplotlib.pyplot.plot', 'plt.plot', (['C_list', 'err_train_list', '"""x-"""'], {'label': '"""train"""'}), "(C_list, err_train_list, 'x-', label='train')\n", (1634, 1679)...
from tqdm import tqdm import os import argparse import logging import numpy as np import torch import torchvision.transforms as transforms from torch.utils.data import DataLoader from model.networks import BaseNet from model.losses import loss_fn from model.dataset_utils import CenterCrop, Normalise, ToTensor from mo...
[ "argparse.ArgumentParser", "os.path.isfile", "numpy.mean", "torch.device", "utils.xutils.Params", "utils.xutils.save_dict_to_json", "os.path.join", "model.dataset_utils.ToTensor", "utils.xutils.set_summary_writer", "torch.utils.data.DataLoader", "model.networks.BaseNet", "os.path.exists", "m...
[((5072, 5122), 'utils.xutils.set_summary_writer', 'xutils.set_summary_writer', (['args.model_dir', '"""train"""'], {}), "(args.model_dir, 'train')\n", (5097, 5122), False, 'from utils import xutils, flow_utils\n'), ((5148, 5196), 'utils.xutils.set_summary_writer', 'xutils.set_summary_writer', (['args.model_dir', '"""v...
import numpy as np import pytest from gpflow.kernels import SquaredExponential @pytest.fixture def test_data(): x_dim, y_dim, w_dim = 2, 1, 2 num_data = 31 x_data = np.random.random((num_data, x_dim)) * 5 w_data = np.random.random((num_data, w_dim)) w_data[: (num_data // 2), :] = 0.2 * w_data[: (...
[ "numpy.random.random", "numpy.zeros", "numpy.concatenate", "gpflow.kernels.SquaredExponential" ]
[((233, 268), 'numpy.random.random', 'np.random.random', (['(num_data, w_dim)'], {}), '((num_data, w_dim))\n', (249, 268), True, 'import numpy as np\n'), ((361, 401), 'numpy.concatenate', 'np.concatenate', (['[x_data, w_data]'], {'axis': '(1)'}), '([x_data, w_data], axis=1)\n', (375, 401), True, 'import numpy as np\n')...
import numpy as np from subsbml import * cell = System('cell') # B1 - promoter sigX - utr1 - tetR # B1 - pLac - utr1 - sigmaX (constituitively expressed protein sigmaX - input plasmid) B1 = cell.createSubsystem('models/B1.xml','B1') # SBML model gets converted to Level 3 Version 1 libsbml.writeSBML(B1.getSBMLDocument...
[ "numpy.linspace" ]
[((389, 426), 'numpy.linspace', 'np.linspace', (['(0)', '(14 * 60 * 60000)', '(1000)'], {}), '(0, 14 * 60 * 60000, 1000)\n', (400, 426), True, 'import numpy as np\n')]
import functools import numpy as np import tensorflow as tf import tensorflow.contrib.layers as ly from tensorflow.python.framework import ops from resnet_rnn import resnet_block, resnet_deconv_block, resnet_conv, resnet_deconv, upsample_conv, mean_pool, unrolled_lstm_conv, unrolled_lstm_deconv, unrolled_gru_conv, unr...
[ "tensorflow.nn.batch_normalization", "tensorflow.identity", "tensorflow.maximum", "tensorflow.reshape", "numpy.ones", "tensorflow.sqrt", "numpy.prod", "tensorflow.get_variable", "tensorflow.nn.moments", "tensorflow.variable_scope", "tensorflow.concat", "tensorflow.equal", "tensorflow.contrib...
[((33383, 33420), 'tensorflow.random_normal_initializer', 'tf.random_normal_initializer', (['(0)', '(0.02)'], {}), '(0, 0.02)\n', (33411, 33420), True, 'import tensorflow as tf\n'), ((849, 897), 'tensorflow.nn.moments', 'tf.nn.moments', (['inputs', '(0, 2, 3)'], {'keep_dims': '(True)'}), '(inputs, (0, 2, 3), keep_dims=...
"""Inferer for DeepSpeech2 model.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys #reload(sys) #sys.setdefaultencoding('utf-8') import argparse import functools import paddle.fluid as fluid from data_utils.data import DataGenerator from model_...
[ "functools.partial", "paddle.fluid.CUDAPlace", "soundfile.read", "numpy.average", "argparse.ArgumentParser", "model_utils.model.DeepSpeech2Model", "utils.utility.print_arguments", "data_utils.data.DataGenerator", "codecs.open", "json.dumps", "model_utils.model_check.check_cuda", "time.time", ...
[((679, 723), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (702, 723), False, 'import argparse\n'), ((734, 784), 'functools.partial', 'functools.partial', (['add_arguments'], {'argparser': 'parser'}), '(add_arguments, argparser=parser)\n', (751, 784)...
import numpy as np class AnchorParameters: def __init__(self, sizes, strides, ratios, scales): self.sizes = sizes self.strides = strides self.ratios = ratios self.scales = scales def num_anchors(self): return len(self.ratios) * len(self.scales) AnchorParameters.de...
[ "numpy.stack", "numpy.meshgrid", "numpy.transpose", "numpy.zeros", "numpy.shape", "numpy.array", "numpy.reshape", "numpy.tile", "numpy.arange", "numpy.concatenate" ]
[((777, 803), 'numpy.zeros', 'np.zeros', (['(num_anchors, 4)'], {}), '((num_anchors, 4))\n', (785, 803), True, 'import numpy as np\n'), ((1510, 1539), 'numpy.meshgrid', 'np.meshgrid', (['shift_x', 'shift_y'], {}), '(shift_x, shift_y)\n', (1521, 1539), True, 'import numpy as np\n'), ((1554, 1579), 'numpy.reshape', 'np.r...
from __future__ import division import os import torch import numpy as np import torch.nn.functional as F from mmcv.runner import load_checkpoint from mmcv.parallel import MMDataParallel from gae.datasets import build_dataset, build_dataloader from gae.online_evaluation import online_evaluate from utils import (clu...
[ "utils.get_cluster_idxs", "numpy.load", "gae.datasets.build_dataset", "gae.datasets.build_dataloader", "utils.write_meta", "utils.clusters2labels", "evaluation.evaluate", "torch.nn.functional.softmax", "os.path.isfile", "numpy.savez_compressed", "numpy.array", "proposals.graph.graph_clustering...
[((2864, 2892), 'gae.datasets.build_dataset', 'build_dataset', (['cfg.test_data'], {}), '(cfg.test_data)\n', (2877, 2892), False, 'from gae.datasets import build_dataset, build_dataloader\n'), ((2909, 2960), 'os.path.join', 'os.path.join', (['cfg.work_dir', '"""pred_edges_scores.npz"""'], {}), "(cfg.work_dir, 'pred_edg...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ============================================================================= """generate_data - Contains data processing functions for the Graph Generation Component""" # ============================================================================= # Imports # ========...
[ "pickle.dump", "networkx.from_numpy_matrix", "numpy.amin", "numpy.tril", "numpy.ix_", "numpy.zeros", "networkx.to_numpy_matrix", "networkx.read_graphml", "numpy.nonzero", "networkx.bfs_successors", "numpy.asmatrix", "numpy.random.randint", "networkx.get_node_attributes", "numpy.random.perm...
[((1285, 1301), 'numpy.asmatrix', 'np.asmatrix', (['adj'], {}), '(adj)\n', (1296, 1301), True, 'import numpy as np\n'), ((1310, 1360), 'networkx.from_numpy_matrix', 'nx.from_numpy_matrix', (['adj'], {'create_using': 'nx.DiGraph'}), '(adj, create_using=nx.DiGraph)\n', (1330, 1360), True, 'import networkx as nx\n'), ((23...
from cvgutils.nn.jaxUtils.unet_model import UNet import jax.numpy as jnp import jax import optax from jaxopt import OptaxSolver import tensorflow as tf import tqdm import numpy as np from deepfnf_utils.dataset import Dataset import cvgutils.Utils as cvgutil import deepfnf_utils.tf_utils as tfu import cvgutils.Viz as Vi...
[ "cvgutils.nn.jaxUtils.unet_model.UNet", "optax.adam", "argparse.ArgumentParser", "jax.random.PRNGKey", "cvgutils.Utils.loadPickle", "implicit_diff.diff_solver.parse_arguments", "tqdm.trange", "jax.numpy.concatenate", "deepfnf_utils.dataset.Dataset.parse_arguments", "deepfnf_utils.tf_utils.camera_t...
[((1312, 1337), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1335, 1337), False, 'import argparse\n'), ((1380, 1414), 'cvgutils.Viz.logger.parse_arguments', 'Viz.logger.parse_arguments', (['parser'], {}), '(parser)\n', (1406, 1414), True, 'import cvgutils.Viz as Viz\n'), ((1424, 1455), 'deep...
import os, sys PROJECT_PATH = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) sys.path.append(PROJECT_PATH) import numpy as np import matplotlib.pyplot as plt from scipy.special import psi, polygamma from keras.utils import to_categorical from modules.data_loaders.base_line_loaders import load_fas...
[ "tensorflow.ConfigProto", "modules.data_loaders.base_line_loaders.load_fashion_mnist", "numpy.arange", "keras.backend.tensorflow_backend.set_session", "sys.path.append", "scripts.detached_transformer_od_hits.calc_approx_alpha_sum", "os.path.dirname", "scripts.detached_transformer_od_hits.fixed_point_d...
[((99, 128), 'sys.path.append', 'sys.path.append', (['PROJECT_PATH'], {}), '(PROJECT_PATH)\n', (114, 128), False, 'import os, sys\n'), ((770, 786), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (784, 786), True, 'import tensorflow as tf\n'), ((884, 909), 'tensorflow.Session', 'tf.Session', ([], {'config...
""" -*- binomial tree class for pricing options -*- """ class tree: def __init__(self, params = None, **kwargs): import numpy as np import pathlib import os ################## unpacking of params dict and/or keyword arguments ###################### kwunion = kwargs ...
[ "matplotlib.pyplot.title", "numpy.maximum", "numpy.ones", "matplotlib.pyplot.figure", "matplotlib.pyplot.style.use", "numpy.arange", "numpy.exp", "pathlib.Path", "itertools.cycle", "os.path.join", "numpy.full", "numpy.zeros_like", "os.path.exists", "numpy.tril_indices_from", "scipy.stats...
[((15056, 15081), 'numpy.ones', 'np.ones', (['(colnum, colnum)'], {}), '((colnum, colnum))\n', (15063, 15081), True, 'import numpy as np\n'), ((16210, 16230), 'numpy.zeros_like', 'np.zeros_like', (['spots'], {}), '(spots)\n', (16223, 16230), True, 'import numpy as np\n'), ((16450, 16480), 'numpy.zeros_like', 'np.zeros_...
"""Lite graph objects used by pecanpy.""" import numpy as np from numba import boolean, jit class SparseGraph: """Sparse Graph object that stores graph as adjacency list. Note: By default the ``SparseGraph`` object converts the data to Compact Sparse Row (csr) format after reading data from ...
[ "numpy.load", "numpy.minimum", "numpy.logical_and", "numpy.zeros", "numpy.ones", "numpy.where", "numba.jit", "numpy.fromiter", "numpy.savez" ]
[((16215, 16245), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'nogil': '(True)'}), '(nopython=True, nogil=True)\n', (16218, 16245), False, 'from numba import boolean, jit\n'), ((19246, 19276), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'nogil': '(True)'}), '(nopython=True, nogil=True)\n', (19249, 19276), False...
import os import pickle import numpy as np path = './data/cloning/experts/' for file in os.listdir(path): if file[-2:] == '.p': with open(path+file, 'rb') as f: data = pickle.loads(f.read()) print(file) print('action size: {}'.format(data['actions'][0].shape)) print('min action: {}'.for...
[ "numpy.min", "numpy.max", "os.listdir" ]
[((91, 107), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (101, 107), False, 'import os\n'), ((324, 347), 'numpy.min', 'np.min', (["data['actions']"], {}), "(data['actions'])\n", (330, 347), True, 'import numpy as np\n'), ((385, 408), 'numpy.max', 'np.max', (["data['actions']"], {}), "(data['actions'])\n", (...
import os import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow.keras import layers class GAN: def __init__(self, param): # load data self.dataset = param.get("dataset", -1) # choose CNN setup for the dataset if self.dataset == "MNIST": ...
[ "tensorflow.math.negative", "tensorflow.keras.layers.Reshape", "tensorflow.clip_by_value", "tensorflow.keras.layers.Dense", "matplotlib.pyplot.clf", "tensorflow.keras.layers.LeakyReLU", "matplotlib.pyplot.figure", "tensorflow.keras.Sequential", "tensorflow.keras.layers.Lambda", "tensorflow.keras.l...
[((1347, 1409), 'numpy.zeros', 'np.zeros', (['[self.batch_num, self.total_epoch, self.critic_step]'], {}), '([self.batch_num, self.total_epoch, self.critic_step])\n', (1355, 1409), True, 'import numpy as np\n'), ((1431, 1475), 'numpy.zeros', 'np.zeros', (['[self.batch_num, self.total_epoch]'], {}), '([self.batch_num, s...
""" Anova ===== Statistical tools for time-series analysis. * One-way: Find time intervals where signals recorded under single conditions differ from the baseline. * Two-way: Find interactions between varying conditions time intervals of the recorded signal. * Repeated-measures: Find time intervals where ...
[ "pandas.DataFrame", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.array", "tabulate.tabulate", "numpy.linspace", "scipy.stats.f.cdf" ]
[((2223, 2235), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2233, 2235), True, 'import matplotlib.pyplot as plt\n'), ((2507, 2519), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (2517, 2519), True, 'import matplotlib.pyplot as plt\n'), ((2524, 2534), 'matplotlib.pyplot.show', 'plt.show', ...
# dataloader for 7-Scenes / when testing F-Net and MaGNet import os import random import glob import numpy as np import torch import torch.utils.data.distributed from PIL import Image from torch.utils.data import Dataset, DataLoader from torchvision import transforms # read camera pose def _read_ExtM_from_txt(fpath...
[ "torch.utils.data.DataLoader", "numpy.copy", "numpy.zeros", "numpy.ones", "numpy.transpose", "os.path.exists", "PIL.Image.open", "numpy.linalg.inv", "numpy.arange", "numpy.array", "numpy.sign", "numpy.eye", "torchvision.transforms.Normalize", "torch.from_numpy" ]
[((338, 347), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (344, 347), True, 'import numpy as np\n'), ((633, 652), 'numpy.linalg.inv', 'np.linalg.inv', (['ExtM'], {}), '(ExtM)\n', (646, 652), True, 'import numpy as np\n'), ((823, 882), 'torch.utils.data.DataLoader', 'DataLoader', (['self.t_samples', '(1)'], {'shuffle...
# import pytest import itertools import operator import numpy as np from kronecker import mKPGM as model def test_different_probabilities_avg_edges(): b = 2 k = 5 l = 2 theta = [[0.7, 0.4], [0.4, 0.5]] vertices = range(operator.pow(b, k)) n = 100 possible_edges = list(itertools.product(ve...
[ "numpy.power", "numpy.square", "kronecker.mKPGM.mKPGM", "operator.pow", "itertools.product" ]
[((724, 738), 'numpy.power', 'np.power', (['S', 'k'], {}), '(S, k)\n', (732, 738), True, 'import numpy as np\n'), ((241, 259), 'operator.pow', 'operator.pow', (['b', 'k'], {}), '(b, k)\n', (253, 259), False, 'import operator\n'), ((300, 337), 'itertools.product', 'itertools.product', (['vertices'], {'repeat': '(2)'}), ...
import chainer import numpy as np from test.util import generate_kernel_test_case, wrap_template from webdnn.graph.placeholder import Placeholder from webdnn.frontend.chainer.converter import ChainerConverter from webdnn.frontend.chainer.placeholder_variable import PlaceholderVariable @wrap_template def template(r=2...
[ "test.util.generate_kernel_test_case", "webdnn.frontend.chainer.placeholder_variable.PlaceholderVariable", "chainer.functions.space2depth", "numpy.random.rand", "webdnn.frontend.chainer.converter.ChainerConverter", "webdnn.graph.placeholder.Placeholder" ]
[((429, 465), 'chainer.functions.space2depth', 'chainer.functions.space2depth', (['vx', 'r'], {}), '(vx, r)\n', (458, 465), False, 'import chainer\n'), ((573, 768), 'test.util.generate_kernel_test_case', 'generate_kernel_test_case', ([], {'description': 'f"""[chainer] F.Depth2Space {description}"""', 'graph': 'graph', ...
import numpy as np import os import json import random import torch from builtins import range from config import opt import sys ################################## For config ################################## def read_kwargs(kwargs): if 'path_key' not in kwargs: print('Error: no path key') sys.ex...
[ "os.mkdir", "json.load", "numpy.sum", "numpy.maximum", "random.sample", "random.shuffle", "os.path.exists", "numpy.ones", "numpy.where", "numpy.array", "torch.device", "sys.exit", "torch.tensor", "builtins.range", "numpy.concatenate" ]
[((1893, 1914), 'builtins.range', 'range', (['(2)', 'path_length'], {}), '(2, path_length)\n', (1898, 1914), False, 'from builtins import range\n'), ((2455, 2475), 'numpy.array', 'np.array', (['class_list'], {}), '(class_list)\n', (2463, 2475), True, 'import numpy as np\n'), ((2595, 2623), 'random.shuffle', 'random.shu...
# Cuda Kernel Original work by <NAME> (@Oh233) # https://github.com/msracver/FCIS # Modified by <NAME> (@knorth55) import numpy as np import six from chainer.backends import cuda from chainer import function from chainer.utils import type_check if cuda.available: import cupy as cp def _roi_pooling_slice(size,...
[ "chainer.utils.type_check.expect", "numpy.average", "numpy.ceil", "six.moves.range", "cupy.empty", "numpy.empty", "numpy.floor", "numpy.zeros", "chainer.backends.cuda.cupy.zeros", "chainer.backends.cuda.cupy.ElementwiseKernel" ]
[((368, 391), 'numpy.floor', 'np.floor', (['(size * stride)'], {}), '(size * stride)\n', (376, 391), True, 'import numpy as np\n'), ((407, 435), 'numpy.ceil', 'np.ceil', (['((size + 1) * stride)'], {}), '((size + 1) * stride)\n', (414, 435), True, 'import numpy as np\n'), ((1001, 1143), 'chainer.utils.type_check.expect...
#!/usr/bin/env python """ General description is in the dosctring of a function below, and in click decorators. Motivation, FAQ, and detailed description of _some_ features is here. FAQ --- Q: What happens to block numbers from old style trajectories? A: they are put in the data dict under "block" key, the same w...
[ "os.mkdir", "os.remove", "click.option", "os.path.isfile", "os.path.join", "shutil.copy", "pandas.DataFrame", "os.path.abspath", "polychrom.hdf5_format.HDF5Reporter", "os.path.exists", "polychrom.hdf5_format.load_URI", "click.command", "re.search", "polychrom.hdf5_format.list_URIs", "num...
[((3800, 3815), 'click.command', 'click.command', ([], {}), '()\n', (3813, 3815), False, 'import click\n'), ((3817, 3946), 'click.option', 'click.option', (['"""--input-style"""'], {'default': '"""old"""', 'show_default': '(True)', 'help': '"""old (block*.dat) or new (HDF5) style for input files"""'}), "('--input-style...
# -*- coding: utf-8 -*- # !@time: 2021/6/19 10:19 下午 # !@author: superMC @email: <EMAIL> # !@fileName: TextRNN_selfAtt.py import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch import matmul class Config(object): """配置参数""" def __init__(self, dataset, embedding): ...
[ "torch.nn.Dropout", "numpy.load", "torch.nn.Embedding", "torch.nn.Embedding.from_pretrained", "torch.nn.LayerNorm", "torch.nn.LSTM", "torch.nn.Softmax", "torch.cuda.is_available", "torch.nn.Linear", "torch.matmul", "torch.nn.AdaptiveAvgPool1d" ]
[((2083, 2122), 'torch.nn.Dropout', 'nn.Dropout', (['attn_dropout'], {'inplace': '(False)'}), '(attn_dropout, inplace=False)\n', (2093, 2122), True, 'import torch.nn as nn\n'), ((2146, 2164), 'torch.nn.Softmax', 'nn.Softmax', ([], {'dim': '(-1)'}), '(dim=-1)\n', (2156, 2164), True, 'import torch.nn as nn\n'), ((2465, 2...