code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from __future__ import annotations import warnings import itertools import inspect from abc import ABC, abstractmethod from typing import List, Optional, Union, Callable, Dict, Tuple, Any, Sequence, Iterable import pandas as pd import numpy as np import joblib from tqdm import tqdm from sklearn.base import ClassifierM...
[ "sklearn.model_selection.GridSearchCV", "sklearn.preprocessing.StandardScaler", "sklearn.model_selection.HalvingGridSearchCV", "sklearn.model_selection.cross_validate", "sklearn.model_selection.train_test_split", "poniard.plot.PoniardPlotFactory", "numpy.empty", "sklearn.preprocessing.MinMaxScaler", ...
[((9861, 9882), 'tqdm.tqdm', 'tqdm', (['estimator_names'], {}), '(estimator_names)\n', (9865, 9882), False, 'from tqdm import tqdm\n'), ((20803, 20842), 'sklearn.impute.SimpleImputer', 'SimpleImputer', ([], {'strategy': '"""most_frequent"""'}), "(strategy='most_frequent')\n", (20816, 20842), False, 'from sklearn.impute...
############################################################################# # Basic Input/Output Utility Functions # v 0.02 ############################################################################# from copy import * #**********************Auxiliary function to write auxiliary/debugging information to an ASCII ...
[ "numpy.array", "PIL.Image.open" ]
[((6955, 6977), 'PIL.Image.open', 'Image.open', (['image_path'], {}), '(image_path)\n', (6965, 6977), False, 'from PIL import Image\n'), ((7168, 7187), 'numpy.array', 'np.array', (['raw_image'], {}), '(raw_image)\n', (7176, 7187), True, 'import numpy as np\n')]
import numpy as np def sigmoid(x): # TODO: Implement sigmoid function ans = 1 / (1 + np.exp(-x)) return ans inputs = np.array([0.7, -0.3]) weights = np.array([0.1, 0.8]) bias = -0.1 # TODO: Calculate the output output = sigmoid(np.dot(weights, inputs) + bias) print('Output:') print(output)
[ "numpy.dot", "numpy.array", "numpy.exp" ]
[((133, 154), 'numpy.array', 'np.array', (['[0.7, -0.3]'], {}), '([0.7, -0.3])\n', (141, 154), True, 'import numpy as np\n'), ((165, 185), 'numpy.array', 'np.array', (['[0.1, 0.8]'], {}), '([0.1, 0.8])\n', (173, 185), True, 'import numpy as np\n'), ((245, 268), 'numpy.dot', 'np.dot', (['weights', 'inputs'], {}), '(weig...
from unityagents import UnityEnvironment import numpy as np import os from collections import deque import matplotlib.pyplot as plt import torch def dqn_network(max_t=1000, episode_num=2000, eps_start=1.0, eps_end=0.01, decay=0.995): _epsd = eps_start scores = [] scores_mean = [] scores_window = de...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "unityagents.UnityEnvironment", "collections.deque" ]
[((1789, 1823), 'unityagents.UnityEnvironment', 'UnityEnvironment', (['environment_path'], {}), '(environment_path)\n', (1805, 1823), False, 'from unityagents import UnityEnvironment\n'), ((2354, 2382), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (2364, 2382), True, ...
from __future__ import division from builtins import object from past.utils import old_div from proteus import * from proteus.default_p import * from proteus.mprans import SW2D from proteus.mprans import SW2DCV from proteus.Domain import RectangularDomain import numpy as np from proteus import (Domain, Context, ...
[ "proteus.SWFlows.SWFlowProblem.SWFlowProblem", "numpy.maximum", "past.utils.old_div", "proteus.SWFlows.SWFlowProblem.OutputStepping", "proteus.Domain.RectangularDomain", "proteus.Context.Options", "numpy.sqrt" ]
[((548, 875), 'proteus.Context.Options', 'Context.Options', (["[('sw_model', 0, 'sw_model = {0,1} for {SWEs,DSWEs}'), ('final_time', 3.0,\n 'Final time for simulation'), ('dt_output', 1.0,\n 'Time interval to output solution'), ('refinement', 2,\n 'Level of refinement'), ('cfl', 0.33, 'Desired CFL restriction'...
from doubleml import DoubleMLIIVM import numpy as np from sklearn.utils import check_X_y from ._helper import _get_cond_smpls from .double_ml_aws_lambda import DoubleMLLambda from ._helper import _attach_learner, _attach_smpls class DoubleMLIIVMServerless(DoubleMLIIVM, DoubleMLLambda): def __init__(self, ...
[ "doubleml.DoubleMLIIVM.__init__", "numpy.ones_like", "numpy.zeros_like", "numpy.ravel", "sklearn.utils.check_X_y" ]
[((821, 1016), 'doubleml.DoubleMLIIVM.__init__', 'DoubleMLIIVM.__init__', (['self', 'obj_dml_data', 'ml_g', 'ml_m', 'ml_r', 'n_folds', 'n_rep', 'score', 'subgroups', 'dml_procedure', 'trimming_rule', 'trimming_threshold', 'draw_sample_splitting', 'apply_cross_fitting'], {}), '(self, obj_dml_data, ml_g, ml_m, ml_r, n_fo...
from fltk import * import copy import numpy as np import sys if '../PyCommon/modules' not in sys.path: sys.path.append('../PyCommon/modules') from PyCommon.modules.Math import mmMath as mm # from PyCommon.modules.Resource import ysMotionLoader as yf from PyCommon.modules.Renderer import ysRenderer as yr # from PyC...
[ "PyCommon.modules.Util.ysPythonEx.makeFlatList", "PyCommon.modules.ArticulatedBody.ysReferencePoints.getCM", "PyCommon.modules.ArticulatedBody.ysReferencePoints.getCP", "PyCommon.modules.Util.ysPythonEx.nested", "PyCommon.modules.ArticulatedBody.ysJacobian.makeEmptyJacobian", "PyCommon.modules.Renderer.ys...
[((108, 146), 'sys.path.append', 'sys.path.append', (['"""../PyCommon/modules"""'], {}), "('../PyCommon/modules')\n", (123, 146), False, 'import sys\n'), ((1319, 1366), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)', 'linewidth': '(200)'}), '(precision=4, linewidth=200)\n', (1338, 1366), True...
import numpy as np import cv2 import os, glob import _init_paths import caffe from fast_rcnn.config import cfg, cfg_from_file, cfg_from_list from fast_rcnn.bbox_transform import clip_boxes, bbox_transform_inv, info_syn_transform_inv_h, info_syn_transform_inv_w from fast_rcnn.nms_wrapper import nms, pnms from utils.blo...
[ "fast_rcnn.bbox_transform.info_syn_transform_inv_h", "fast_rcnn.bbox_transform.bbox_transform_inv", "glob.glob", "cv2.imshow", "numpy.round", "caffe.set_device", "numpy.max", "fast_rcnn.nms_wrapper.pnms", "fast_rcnn.nms_wrapper.nms", "fast_rcnn.bbox_transform.clip_boxes", "cv2.resize", "numpy....
[((378, 398), 'caffe.set_mode_gpu', 'caffe.set_mode_gpu', ([], {}), '()\n', (396, 398), False, 'import caffe\n'), ((399, 418), 'caffe.set_device', 'caffe.set_device', (['(0)'], {}), '(0)\n', (415, 418), False, 'import caffe\n'), ((573, 606), 'glob.glob', 'glob.glob', (['"""../images/demo/*.jpg"""'], {}), "('../images/d...
import pytest import sys sys.path.insert(0,"..") import autogenes as ag import numpy as np import pandas as pd import anndata def test_pareto_fitness(): ag.init(np.zeros((3,10))) ag.optimize(mode='fixed',nfeatures=5,verbose=False,weights=(1,-1),objectives=('distance','correlation')) assert np.array_equal(ag.p...
[ "autogenes.selection", "numpy.random.seed", "numpy.array_equal", "autogenes.main.main.select", "numpy.zeros", "sys.path.insert", "autogenes.fitness_matrix", "pytest.raises", "autogenes.optimize", "numpy.array", "numpy.random.randint", "autogenes.main._Interface__process_selection", "autogene...
[((26, 50), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (41, 50), False, 'import sys\n'), ((187, 301), 'autogenes.optimize', 'ag.optimize', ([], {'mode': '"""fixed"""', 'nfeatures': '(5)', 'verbose': '(False)', 'weights': '(1, -1)', 'objectives': "('distance', 'correlation')"}), "(mo...
#------------------------------------------------------------------------------- # pnorm # A class to compute the "p norm" of a given vector of data. This is defined as # ||x||_p = ( \sum_i |x_i|^p )^(1/p) # # The special case of p -> \infinity is given by # ||x||_\infinity = max( |x_i| ) # # Optionally we can u...
[ "numpy.zeros", "numpy.linalg.norm", "numpy.array" ]
[((921, 943), 'numpy.array', 'np.array', (['positionData'], {}), '(positionData)\n', (929, 943), True, 'import numpy as np\n'), ((1794, 1805), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1802, 1805), True, 'import numpy as np\n'), ((2632, 2643), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2640, 2643), True,...
import anndata import numpy as np import pandas as pd import scanpy.api as sc import utils.hgnc import utils.ontology def basic_curation(adata): adata.obs["assay"] = "Microwell-seq" adata.obs["assay_ontology"] = "" adata.obs["disease_ontology"] = "PATO:0000461" adata.obs["disease"] = utils.ontology.g...
[ "scanpy.api.read_h5ad", "numpy.expm1" ]
[((6674, 6691), 'numpy.expm1', 'np.expm1', (['adata.X'], {}), '(adata.X)\n', (6682, 6691), True, 'import numpy as np\n'), ((7327, 7358), 'scanpy.api.read_h5ad', 'sc.read_h5ad', (['original_filename'], {}), '(original_filename)\n', (7339, 7358), True, 'import scanpy.api as sc\n')]
""" Starts a Websocket server, with 3 datasets: MNIST eICU mortality classification eICU length of stay regression Each server keeps a subset of these dataset and has a teparate test set too. """ import logging import syft as sy from syft.workers import WebsocketServerWorker import torch import argparse ...
[ "syft.workers.WebsocketServerWorker", "numpy.isin", "argparse.ArgumentParser", "logging.basicConfig", "pandas.read_csv", "sklearn.preprocessing.RobustScaler", "torchvision.transforms.Normalize", "pandas.isnull", "syft.TorchHook", "syft.BaseDataset", "torch.tensor", "logging.getLogger", "torc...
[((1372, 1472), 'syft.BaseDataset', 'sy.BaseDataset', ([], {'data': 'selected_data', 'targets': 'selected_targets', 'transform': 'mnist_dataset.transform'}), '(data=selected_data, targets=selected_targets, transform=\n mnist_dataset.transform)\n', (1386, 1472), True, 'import syft as sy\n'), ((1624, 1644), 'pandas.re...
import sys import logging import heapq import numpy import random import time import re import math from Bio.PDB import * from Bio import SeqIO import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt # python 3 compatibility from functools import reduce from builtins import input sys.path.append('../...
[ "pymol.cmd.png", "numpy.sum", "heapq.heappush", "pymol.cmd.iterate_state", "pymol.cmd.save", "pymol.cmd.alter_state", "pymol.finish_launching", "matplotlib.pyplot.figure", "pymol.cmd.zoom", "pymol.cmd.color", "sys.path.append", "pymol.cmd.select", "math.radians", "numpy.std", "numpy.tran...
[((162, 183), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (176, 183), False, 'import matplotlib\n'), ((300, 325), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (315, 325), False, 'import sys\n'), ((347, 375), 'sys.path.append', 'sys.path.append', (['scripts_dir'...
from __future__ import absolute_import try: import unittest2 as unittest except ImportError: import unittest import neo.io.blackrockio import os import numpy as np import quantities as pq import glob from .common_io_test import BaseTestIO from ...io import tools from ..tools import assert_arrays_almost_equal...
[ "unittest.main", "os.remove", "tempfile.gettempdir", "os.path.exists", "numpy.rint", "unittest.SkipTest", "os.path.join", "numpy.concatenate" ]
[((7975, 7990), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7988, 7990), False, 'import unittest\n'), ((1626, 1670), 'os.path.join', 'os.path.join', (['self.datadir', '"""test.write.ns5"""'], {}), "(self.datadir, 'test.write.ns5')\n", (1638, 1670), False, 'import os\n'), ((2005, 2028), 'os.path.exists', 'os.pa...
import tensorflow as tf import tensorflow.contrib.slim as slim import numpy as np import matplotlib.pyplot as plt FLAGS = tf.app.flags.FLAGS import sys def MLP(input_x, output_size, name, weights_regularizer): with tf.variable_scope(name): x = slim.fully_connected(input_x, 1024, weights_regularizer = wei...
[ "numpy.load", "tensorflow.reduce_sum", "tensorflow.reshape", "tensorflow.matmul", "tensorflow.Variable", "tensorflow.reduce_max", "tensorflow.contrib.slim.l2_regularizer", "tensorflow.greater", "tensorflow.abs", "tensorflow.logical_and", "numpy.random.randn", "tensorflow.variable_scope", "te...
[((871, 891), 'numpy.load', 'np.load', (['FLAGS.Q_dir'], {}), '(FLAGS.Q_dir)\n', (878, 891), True, 'import numpy as np\n'), ((910, 940), 'numpy.load', 'np.load', (['FLAGS.stick_bases_dir'], {}), '(FLAGS.stick_bases_dir)\n', (917, 940), True, 'import numpy as np\n'), ((956, 996), 'numpy.zeros', 'np.zeros', (['[FLAGS.n_b...
from __future__ import print_function import re import dbconnect import logging import multiclasssql_legacy as multiclasssql # Legacy code for scoring cells import numpy as np import matplotlib.pyplot as plt from sys import stdin, stdout, argv, exit from time import time class FastGentleBoosting(object): def __in...
[ "matplotlib.pyplot.title", "sklearn.externals.joblib.dump", "csv.reader", "numpy.sum", "multiclasssql_legacy.create_perobject_class_table", "matplotlib.pyplot.clf", "numpy.ones", "numpy.argmin", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.tile", "multiclasssql_legacy.FilterObjectsFromC...
[((23963, 23994), 'csv.reader', 'csv.reader', (['fin'], {'delimiter': '"""\t"""'}), "(fin, delimiter='\\t')\n", (23973, 23994), False, 'import csv\n'), ((359, 421), 'logging.info', 'logging.info', (['"""Initialized New Classifier: FastGentleBoosting"""'], {}), "('Initialized New Classifier: FastGentleBoosting')\n", (37...
from os import path import os import numpy as np import nibabel as nib from torch.utils.data import DataLoader import argparse import matplotlib.pyplot as plt import warnings from clinicadl.tools.deep_learning.iotools import read_json, commandline_to_json, translate_parameters, return_logger from clinicadl.tools.deep_...
[ "argparse.Namespace", "clinicadl.tools.deep_learning.iotools.commandline_to_json", "clinicadl.tools.deep_learning.data.load_data_test", "os.path.join", "warnings.simplefilter", "torch.utils.data.DataLoader", "clinicadl.tools.deep_learning.data.get_transforms", "matplotlib.pyplot.imshow", "matplotlib...
[((633, 679), 'clinicadl.tools.deep_learning.iotools.return_logger', 'return_logger', (['options.verbose', '"""main process"""'], {}), "(options.verbose, 'main process')\n", (646, 679), False, 'from clinicadl.tools.deep_learning.iotools import read_json, commandline_to_json, translate_parameters, return_logger\n'), ((6...
import os import shutil import gym import numpy as np import pytest from stable_baselines import (A2C, ACER, ACKTR, GAIL, DDPG, DQN, PPO1, PPO2, TD3, TRPO, SAC) from stable_baselines.common.cmd_util import make_atari_env from stable_baselines.common.vec_env import VecFrameStack, DummyVec...
[ "numpy.load", "stable_baselines.PPO2", "gym.make", "stable_baselines.GAIL", "stable_baselines.common.cmd_util.make_atari_env", "stable_baselines.gail.generate_expert_traj", "pytest.raises", "stable_baselines.gail.ExpertDataset", "stable_baselines.common.vec_env.VecFrameStack", "pytest.mark.paramet...
[((677, 811), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""expert_env"""', "[('Pendulum-v0', EXPERT_PATH_PENDULUM, True), ('CartPole-v1',\n EXPERT_PATH_DISCRETE, False)]"], {}), "('expert_env', [('Pendulum-v0', EXPERT_PATH_PENDULUM,\n True), ('CartPole-v1', EXPERT_PATH_DISCRETE, False)])\n", (700, ...
import numpy as np import pickle import datetime with open("../data/dicOfMatrix.pickle",'rb') as f: data = pickle.load(f) with open("../data/factor_in_2020.pickle",'rb') as f: factor_in = pickle.load(f) with open("../data/factor_out_2020.pickle",'rb') as f: factor_out = pickle.load(f) coef = 9.3 ...
[ "numpy.exp", "pickle.load", "datetime.date", "numpy.sum" ]
[((115, 129), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (126, 129), False, 'import pickle\n'), ((202, 216), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (213, 216), False, 'import pickle\n'), ((291, 305), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (302, 305), False, 'import pickle\n'), ((1322,...
import cv2 import numpy as np from keras_squeezenet import SqueezeNet from keras.optimizers import Adam from keras.utils import np_utils from keras.layers import Activation, Dropout, Convolution2D, GlobalAveragePooling2D from keras.models import Sequential import tensorflow as tf import os from random import shuffle i...
[ "keras.layers.Convolution2D", "keras.layers.Activation", "os.path.isdir", "random.shuffle", "cv2.cvtColor", "keras.layers.Dropout", "keras.optimizers.Adam", "keras_squeezenet.SqueezeNet", "keras.layers.GlobalAveragePooling2D", "keras.utils.np_utils.to_categorical", "numpy.array", "os.path.join...
[((898, 918), 'os.listdir', 'os.listdir', (['img_path'], {}), '(img_path)\n', (908, 918), False, 'import os\n'), ((1342, 1358), 'random.shuffle', 'shuffle', (['dataset'], {}), '(dataset)\n', (1349, 1358), False, 'from random import shuffle\n'), ((1432, 1463), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categori...
import cv2 from PIL import Image, ImageOps from tqdm import tqdm from functions.folder_check import FOLDER_LIST, OUTPUT_FOLDERS import os from functions import folder_check as fldr_chk import random import math import numpy as np OUTPUT_EXTENSION = '.jpg' RED = 128 BLUE = 200 class ImgComposer: def __init__(self...
[ "functions.folder_check.get_num", "PIL.Image.new", "os.path.join", "math.ceil", "cv2.morphologyEx", "cv2.imwrite", "os.path.dirname", "math.floor", "numpy.ones", "random.choice", "PIL.Image.open", "PIL.ImageOps.mirror", "random.randrange", "numpy.array", "cv2.inRange", "os.listdir" ]
[((5480, 5504), 'random.randrange', 'random.randrange', (['(0)', '(359)'], {}), '(0, 359)\n', (5496, 5504), False, 'import random\n'), ((6056, 6084), 'random.choice', 'random.choice', (['(True, False)'], {}), '((True, False))\n', (6069, 6084), False, 'import random\n'), ((8304, 8341), 'PIL.Image.new', 'Image.new', (['"...
# Author: <NAME> # Copyright@CUHK # Please do not discolse this code to others import numpy as np import cv2 as cv import os from fnmatch import fnmatch import PolyUtil import subprocess from database import result_db def show_img(img, title, wait_key=0, output_path=None): cv.imshow(title, img) ...
[ "subprocess.Popen", "cv2.waitKey", "cv2.imwrite", "os.path.dirname", "os.walk", "numpy.zeros", "numpy.ones", "cv2.cvtColor", "cv2.fillPoly", "database.result_db", "cv2.imread", "numpy.max", "numpy.min", "cv2.imshow", "os.path.join", "fnmatch.fnmatch", "cv2.findContours", "PolyUtil....
[((293, 314), 'cv2.imshow', 'cv.imshow', (['title', 'img'], {}), '(title, img)\n', (302, 314), True, 'import cv2 as cv\n'), ((320, 340), 'cv2.waitKey', 'cv.waitKey', (['wait_key'], {}), '(wait_key)\n', (330, 340), True, 'import cv2 as cv\n'), ((487, 552), 'cv2.findContours', 'cv.findContours', (['gray_img', 'cv.RETR_EX...
# SHAM galaxy catalog class # Contact: <NAME> <<EMAIL>> import os import numpy as np from astropy.cosmology import FlatLambdaCDM #from GalaxyCatalogInterface import GalaxyCatalog GalaxyCatalog = object class SHAMGalaxyCatalog(GalaxyCatalog): """ SHAM galaxy catalog class. """ def __init...
[ "astropy.cosmology.FlatLambdaCDM", "numpy.load", "os.path.isfile", "numpy.array" ]
[((942, 964), 'numpy.load', 'np.load', (['self.filename'], {}), '(self.filename)\n', (949, 964), True, 'import numpy as np\n'), ((1023, 1067), 'astropy.cosmology.FlatLambdaCDM', 'FlatLambdaCDM', ([], {'H0': '(70.2)', 'Om0': '(0.275)', 'Ob0': '(0.046)'}), '(H0=70.2, Om0=0.275, Ob0=0.046)\n', (1036, 1067), False, 'from a...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy as np from progress.bar import Bar import time import torch try: from external.nms import soft_nms_39 except: print('NMS not imported! If you need it,' ' do \n cd $Cen...
[ "models.decode.car_pose_decode", "numpy.sqrt", "numpy.clip", "cv2.warpAffine", "numpy.array", "external.nms.soft_nms_39", "utils.image.get_affine_transform", "torch.no_grad", "torch.onnx.export", "numpy.concatenate", "torch.from_numpy" ]
[((3679, 3734), 'numpy.array', 'np.array', (['[width / 2.0, height / 2.0]'], {'dtype': 'np.float32'}), '([width / 2.0, height / 2.0], dtype=np.float32)\n', (3687, 3734), True, 'import numpy as np\n'), ((3745, 3788), 'numpy.array', 'np.array', (['[width, height]'], {'dtype': 'np.float32'}), '([width, height], dtype=np.f...
""" General Introduction: * the objective of this script is that students could see evaluation process of their models against other RL models * students could evaluate their best trained models with this script * the evaluation is done againts uploaded default best trained models with sac with default para...
[ "simstarEnv.SimstarEnv", "torch.load", "model.Model", "numpy.hstack", "torch.cuda.is_available" ]
[((2272, 2437), 'simstarEnv.SimstarEnv', 'SimstarEnv', ([], {'track': 'simstar.Environments.HungaryGrandPrix', 'port': 'port', 'add_opponents': 'ADD_OPPONENTS', 'num_opponents': 'OPPONENT_NUM', 'speed_up': '(1)', 'synronized_mode': '(True)'}), '(track=simstar.Environments.HungaryGrandPrix, port=port,\n add_opponents...
from __future__ import print_function, division, absolute_import import os import unittest import numpy as np from numpy.testing import assert_almost_equal import openmdao.api as om from openmdao.utils.assert_utils import assert_near_equal from openmdao.utils.testing_utils import use_tempdirs, require_pyoptsparse im...
[ "dymos.examples.vanderpol.vanderpol_dymos.vanderpol", "dymos.run_problem", "numpy.exp", "openmdao.api.Group", "scipy.interpolate.interp1d", "dymos.Radau", "openmdao.api.ScipyOptimizeDriver", "unittest.main", "unittest.skipIf", "openmdao.api.IndepVarComp", "numpy.zeros_like", "os.path.exists", ...
[((684, 727), 'openmdao.utils.general_utils.set_pyoptsparse_opt', 'set_pyoptsparse_opt', (['"""IPOPT"""'], {'fallback': '(True)'}), "('IPOPT', fallback=True)\n", (703, 727), False, 'from openmdao.utils.general_utils import set_pyoptsparse_opt\n'), ((15224, 15262), 'openmdao.utils.testing_utils.require_pyoptsparse', 're...
from datetime import datetime import numpy as np from numpy.random import gamma, exponential, lognormal,normal import pandas as pd from pathlib import Path import sys import niddk_covid_sicr as ncs def get_stan_dataV(full_data_path, args): df = pd.read_csv(full_data_path) if getattr(args, 'last_date', None):...
[ "niddk_covid_sicr.last_sample_as_dict", "pandas.read_csv", "numpy.random.exponential", "datetime.datetime.strptime", "numpy.where", "pathlib.Path", "numpy.random.normal" ]
[((252, 279), 'pandas.read_csv', 'pd.read_csv', (['full_data_path'], {}), '(full_data_path)\n', (263, 279), True, 'import pandas as pd\n'), ((827, 878), 'pandas.read_csv', 'pd.read_csv', (["(args.data_path / 'mitigationprior.csv')"], {}), "(args.data_path / 'mitigationprior.csv')\n", (838, 878), True, 'import pandas as...
''' Summary ------- Defines a maximum a-posterior estimator for unigrams MAPEstimator supports a common API for unigram probability estimators: * fit * predict_proba * score Resources --------- See COMP 136 course website for the complete problem description and all math details ''' import numpy as np from Vocabular...
[ "numpy.zeros" ]
[((1862, 1887), 'numpy.zeros', 'np.zeros', (['self.vocab.size'], {}), '(self.vocab.size)\n', (1870, 1887), True, 'import numpy as np\n')]
import os.path as osp import numpy as np from typing import List, Tuple, Union from dslpy.utils.raster2uint8 import rasterToUint8 try: from osgeo import gdal except: import gdal class Raster: def __init__(self, path: str, band_list: Union[List[int], Tuple[...
[ "numpy.stack", "numpy.zeros", "os.path.exists", "gdal.Open", "dslpy.utils.raster2uint8.rasterToUint8" ]
[((975, 991), 'os.path.exists', 'osp.exists', (['path'], {}), '(path)\n', (985, 991), True, 'import os.path as osp\n'), ((1054, 1069), 'gdal.Open', 'gdal.Open', (['path'], {}), '(path)\n', (1063, 1069), False, 'import gdal\n'), ((3677, 3705), 'numpy.stack', 'np.stack', (['band_array'], {'axis': '(0)'}), '(band_array, a...
# Should be run with pytest: # > python3 -m pytest import numpy import pytest import ship import utility from game_engine import handleAttack from simple_agent import (SimpleAgent) from world_state import (WorldState) # Initialize ships from the test ship list keys, ship_templates = utility.parseShips('data/test_shi...
[ "ship.Ship", "game_engine.handleAttack", "utility.parseShips", "numpy.array", "simple_agent.SimpleAgent", "world_state.WorldState" ]
[((287, 328), 'utility.parseShips', 'utility.parseShips', (['"""data/test_ships.csv"""'], {}), "('data/test_ships.csv')\n", (305, 328), False, 'import utility\n'), ((831, 844), 'simple_agent.SimpleAgent', 'SimpleAgent', ([], {}), '()\n', (842, 844), False, 'from simple_agent import SimpleAgent\n'), ((1546, 1570), 'nump...
""" Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://opensource.org/licenses/MIT THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTI...
[ "seaborn.regplot", "numpy.exp", "matplotlib.pylab.close", "matplotlib.pylab.show", "numpy.nanmean", "matplotlib.pylab.legend", "pandas.concat", "matplotlib.pylab.savefig", "numpy.nansum", "scipy.stats.pearsonr", "matplotlib.pylab.plot", "matplotlib.pylab.xlim", "pandas.Series", "matplotlib...
[((2608, 2629), 'numpy.nanmean', 'np.nanmean', (['(sim - obs)'], {}), '(sim - obs)\n', (2618, 2629), True, 'import numpy as np\n'), ((3769, 3798), 'pandas.concat', 'pd.concat', (['[sur, obs]'], {'axis': '(1)'}), '([sur, obs], axis=1)\n', (3778, 3798), True, 'import pandas as pd\n'), ((5529, 5582), 'pandas.Series', 'pd....
import torch import torch.nn as nn import numpy as np import torch.nn.functional as F class Conv2DBatchNorm(nn.Module): def __init__( self, in_channels, n_filters, k_size, stride, padding, bias=True, dilation=1, is_batchnorm=True, ): ...
[ "torch.nn.ReLU", "torch.nn.functional.grid_sample", "torch.nn.MaxPool2d", "torch.nn.ModuleList", "torch.nn.Sequential", "torch.nn.functional.avg_pool2d", "torch.nn.Conv2d", "numpy.zeros", "torch.cat", "torch.nn.functional.upsample", "torch.arange", "torch.Size", "torch.nn.Conv2DBatchNorm", ...
[((22155, 22217), 'torch.zeros', 'torch.zeros', (['oh', 'ow', '(2)'], {'dtype': 'torch.float', 'device': 'input.device'}), '(oh, ow, 2, dtype=torch.float, device=input.device)\n', (22166, 22217), False, 'import torch\n'), ((22471, 22508), 'torch.nn.functional.grid_sample', 'F.grid_sample', (['input', 'grid'], {'mode': ...
from typing import NoReturn import cv2 import numpy as np from generic_dataset.data_pipeline import DataPipeline from generic_dataset.generic_sample import synchronize_on_fields from generic_dataset.sample_generator import SampleGenerator from generic_dataset.utilities.save_load_methods import save_cv2_image_bgr, load...
[ "cv2.waitKey", "cv2.cvtColor", "generic_dataset.sample_generator.SampleGenerator", "numpy.array", "cv2.rectangle", "generic_dataset.data_pipeline.DataPipeline", "generic_dataset.generic_sample.synchronize_on_fields", "cv2.imshow", "numpy.concatenate" ]
[((563, 669), 'generic_dataset.generic_sample.synchronize_on_fields', 'synchronize_on_fields', ([], {'field_names': "{'bgr_image', 'depth_image', 'bounding_boxes'}", 'check_pipeline': '(True)'}), "(field_names={'bgr_image', 'depth_image',\n 'bounding_boxes'}, check_pipeline=True)\n", (584, 669), False, 'from generic...
import numpy as np import time import torch from torch.autograd import Variable import src.utils.utils as utils from src.utils.procrustes import get_transformation import src.utils.viz as viz def test_human(test_loader, misc, stat_2d, stat_3d, standardize_input_data, standardize_output_data, ...
[ "src.utils.procrustes.get_transformation", "ipdb.set_trace", "src.utils.utils.AverageMeter", "numpy.zeros", "time.time", "numpy.tile", "src.utils.viz.save_output_image", "numpy.vstack", "torch.from_numpy" ]
[((842, 862), 'src.utils.utils.AverageMeter', 'utils.AverageMeter', ([], {}), '()\n', (860, 862), True, 'import src.utils.utils as utils\n'), ((1309, 1320), 'time.time', 'time.time', ([], {}), '()\n', (1318, 1320), False, 'import time\n'), ((5176, 5199), 'numpy.zeros', 'np.zeros', (['outputs.shape'], {}), '(outputs.sha...
#!/usr/bin/env python3 import argparse import os from contextlib import nullcontext from tqdm import tqdm import numpy as np import torch import torch.nn.functional as F from torch.cuda.amp import GradScaler, autocast from torch.utils.data import DataLoader from util.io import store_json from vpd_dataset.single_frame...
[ "argparse.ArgumentParser", "vpd_dataset.single_frame.GenericDataset.load_default", "diving48.util.load_labels_and_embeddings", "torch.optim.AdamW", "models.module.FCNet", "numpy.mean", "torch.no_grad", "os.path.join", "torch.cuda.amp.autocast", "torch.utils.data.DataLoader", "finegym.util.load_l...
[((670, 695), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (693, 695), False, 'import argparse\n'), ((4202, 4240), 'numpy.mean', 'np.mean', (['[l[key] for l in losses[-n:]]'], {}), '([l[key] for l in losses[-n:]])\n', (4209, 4240), True, 'import numpy as np\n'), ((7757, 7869), 'torch.utils.da...
import numpy as np import json import gzip as gz chunks = 3 docid=0 for chunk_id in range(0,chunks): es_feed = gz.open("elastic/feed-%i.json.gz" % chunk_id, "wb") vespa_feed = gz.open("vespa/feed-%i.json.gz" % chunk_id, "wb") for i in range(0, 20000): doc_vector = np.random.rand(1,512)[0] norm = np.linal...
[ "numpy.random.rand", "numpy.linalg.norm", "gzip.open", "json.dumps" ]
[((114, 165), 'gzip.open', 'gz.open', (["('elastic/feed-%i.json.gz' % chunk_id)", '"""wb"""'], {}), "('elastic/feed-%i.json.gz' % chunk_id, 'wb')\n", (121, 165), True, 'import gzip as gz\n'), ((181, 230), 'gzip.open', 'gz.open', (["('vespa/feed-%i.json.gz' % chunk_id)", '"""wb"""'], {}), "('vespa/feed-%i.json.gz' % chu...
# coding=utf-8 # Author: <NAME> <<EMAIL>> # # License: BSD 3 clause import numpy as np from .base import BaseStaticEnsemble from deslib.util.aggregation import majority_voting from sklearn.utils.validation import check_is_fitted, check_X_y, check_array class StaticSelection(BaseStaticEnsemble): """Ensemble mode...
[ "sklearn.utils.validation.check_X_y", "numpy.zeros", "sklearn.utils.validation.check_is_fitted", "numpy.argsort", "deslib.util.aggregation.majority_voting", "sklearn.utils.validation.check_array" ]
[((2512, 2527), 'sklearn.utils.validation.check_X_y', 'check_X_y', (['X', 'y'], {}), '(X, y)\n', (2521, 2527), False, 'from sklearn.utils.validation import check_is_fitted, check_X_y, check_array\n'), ((2701, 2730), 'numpy.zeros', 'np.zeros', (['self.n_classifiers_'], {}), '(self.n_classifiers_)\n', (2709, 2730), True,...
""" To create library.so file: python setup.py build_ext --inplace """ from distutils.core import setup, Extension from Cython.Build import cythonize import numpy setup( ext_modules=[ Extension("MultiClassTsetlinMachine", ["MultiClassTsetlinMachine.c"], include_dirs=[numpy.get_includ...
[ "Cython.Build.cythonize", "numpy.get_include" ]
[((460, 501), 'Cython.Build.cythonize', 'cythonize', (['"""MultiClassTsetlinMachine.pyx"""'], {}), "('MultiClassTsetlinMachine.pyx')\n", (469, 501), False, 'from Cython.Build import cythonize\n'), ((521, 540), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (538, 540), False, 'import numpy\n'), ((304, 323),...
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np # In[3]: import matplotlib.pyplot as plt from os import listdir from os.path import isfile, join # In[4]: import scipy.io as scp get_ipython().run_line_magic('matplotlib', 'inline') plt.rcParams['figure.figsize'] = [14, 14] # In[28]: path...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.spy", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.bar", "scipy.io.mmread", "numpy.histogram", "numpy.sort", "numpy.cumsum", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join"...
[((465, 499), 'scipy.io.mmread', 'scp.mmread', (["(path1 + '/' + files[0])"], {}), "(path1 + '/' + files[0])\n", (475, 499), True, 'import scipy.io as scp\n'), ((496, 520), 'matplotlib.pyplot.spy', 'plt.spy', (['A'], {'markersize': '(1)'}), '(A, markersize=1)\n', (503, 520), True, 'import matplotlib.pyplot as plt\n'), ...
# Surveillance System Controller. # <NAME> # 2016 # Copyright 2016, <NAME>, 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/LICENS...
[ "argparse.ArgumentParser", "apprise.AppriseAttachment", "Camera.IPCamera", "json.dumps", "logging.Formatter", "os.path.isfile", "cv2.imencode", "cv2.rectangle", "os.path.join", "numpy.set_printoptions", "cv2.cvtColor", "cv2.imwrite", "FaceRecogniser.FaceRecogniser", "os.path.exists", "ap...
[((1568, 1614), 'os.path.join', 'os.path.join', (['fileDir', '""".."""', '"""batch-represent"""'], {}), "(fileDir, '..', 'batch-represent')\n", (1580, 1614), False, 'import os\n'), ((1626, 1663), 'os.path.join', 'os.path.join', (['fileDir', '""".."""', '"""models"""'], {}), "(fileDir, '..', 'models')\n", (1638, 1663), ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np def _lcs(string, sub): """ Computes longest common subsequence (LCS) for a pair of tokenized strings :param string : list of str : tokens from a string ...
[ "numpy.array" ]
[((3125, 3140), 'numpy.array', 'np.array', (['score'], {}), '(score)\n', (3133, 3140), True, 'import numpy as np\n'), ((3211, 3226), 'numpy.array', 'np.array', (['score'], {}), '(score)\n', (3219, 3226), True, 'import numpy as np\n')]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 import numpy as np def load_img(path, grayscale=False, target_size=None, crop_size=None): """ Load an image. # Arguments path: Path to image file. grayscale: Boolean, whether to load the image as grayscale. target_size...
[ "cv2.cvtColor", "cv2.imread", "numpy.asarray", "cv2.resize" ]
[((607, 623), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (617, 623), False, 'import cv2\n'), ((1029, 1062), 'numpy.asarray', 'np.asarray', (['img'], {'dtype': 'np.float32'}), '(img, dtype=np.float32)\n', (1039, 1062), True, 'import numpy as np\n'), ((692, 729), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2...
from effective_dimension import Model, EffectiveDimension, ClassicalNeuralNetwork import numpy as np # this code generates the data for the classical model's fisher information eigenvalue distribution plot \ # in the main figure nnsize = [4, 4, 4, 2] cnet = ClassicalNeuralNetwork(nnsize) num_inputs = 100 num_thetas =...
[ "effective_dimension.ClassicalNeuralNetwork", "numpy.save", "effective_dimension.EffectiveDimension" ]
[((260, 290), 'effective_dimension.ClassicalNeuralNetwork', 'ClassicalNeuralNetwork', (['nnsize'], {}), '(nnsize)\n', (282, 290), False, 'from effective_dimension import Model, EffectiveDimension, ClassicalNeuralNetwork\n'), ((330, 400), 'effective_dimension.EffectiveDimension', 'EffectiveDimension', (['cnet'], {'num_t...
import torch import torch.nn.functional as F from torch.autograd import Variable import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import numpy as np import copy import os import time import json import logging import torchvision class Generator(nn.Module): def __init__(self, ...
[ "torch.nn.Tanh", "torch.nn.BatchNorm1d", "torch.nn.Linear", "torch.nn.LeakyReLU", "numpy.prod", "torch.nn.Sigmoid" ]
[((476, 502), 'torch.nn.Linear', 'nn.Linear', (['latent_dim', '(128)'], {}), '(latent_dim, 128)\n', (485, 502), True, 'import torch.nn as nn\n'), ((516, 535), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['(128)'], {}), '(128)\n', (530, 535), True, 'import torch.nn as nn\n'), ((549, 580), 'torch.nn.LeakyReLU', 'nn.LeakyR...
import numpy as np from typing import Tuple from IMLearn.metalearners.adaboost import AdaBoost from IMLearn.learners.classifiers import DecisionStump from utils import * import plotly.graph_objects as go from plotly.subplots import make_subplots def generate_data(n: int, noise_ratio: float) -> Tuple[np.ndarray, np.nd...
[ "numpy.random.seed", "numpy.sum", "numpy.random.rand", "numpy.ones", "IMLearn.metalearners.adaboost.AdaBoost", "numpy.max", "numpy.array", "plotly.graph_objects.Layout", "plotly.subplots.make_subplots" ]
[((1411, 1446), 'IMLearn.metalearners.adaboost.AdaBoost', 'AdaBoost', (['DecisionStump', 'n_learners'], {}), '(DecisionStump, n_learners)\n', (1419, 1446), False, 'from IMLearn.metalearners.adaboost import AdaBoost\n'), ((2449, 2582), 'plotly.subplots.make_subplots', 'make_subplots', ([], {'rows': '(2)', 'cols': '(2)',...
#!/usr/bin/env python # -*- coding: utf-8 -*- '''recovery - <NAME> (<EMAIL>) - Oct 2017 License: MIT. See the LICENSE file for more details. This is a companion module for fakelcgen.py. It runs LCs generated using functions in that module through variable star detection and classification to see how well they are rec...
[ "matplotlib.pyplot.title", "os.mkdir", "pickle.dump", "matplotlib.pyplot.savefig", "numpy.random.seed", "numpy.abs", "numpy.ravel", "matplotlib.pyplot.suptitle", "numpy.argsort", "datetime.datetime.utcnow", "matplotlib.pyplot.figure", "pickle.load", "numpy.arange", "numpy.isclose", "matp...
[((2312, 2330), 'numpy.random.seed', 'npr.seed', (['(14600959)'], {}), '(14600959)\n', (2320, 2330), True, 'import numpy.random as npr\n'), ((2409, 2430), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (2423, 2430), False, 'import matplotlib\n'), ((582, 632), 'logging.getLogger', 'logging.getLogg...
# -*- coding: utf-8 -*- import os, sys import numpy as np from skimage import io import random, uuid import matplotlib.pyplot as plt from pydaily import filesystem def simulate_overlap(dataset_dir, cur_id, overlap_size=160, simulate_num = 50, overlap_ratio_low=0.5, overlap_ratio_high=1.0): o...
[ "numpy.random.uniform", "uuid.uuid4", "numpy.count_nonzero", "os.makedirs", "numpy.invert", "skimage.io.imsave", "random.sample", "numpy.zeros", "os.path.exists", "numpy.arange", "os.path.join", "skimage.io.imread" ]
[((333, 372), 'os.path.join', 'os.path.join', (['dataset_dir', '"""simu_train"""'], {}), "(dataset_dir, 'simu_train')\n", (345, 372), False, 'import os, sys\n'), ((384, 411), 'os.path.exists', 'os.path.exists', (['overlap_dir'], {}), '(overlap_dir)\n', (398, 411), False, 'import os, sys\n'), ((421, 445), 'os.makedirs',...
import os import random import numpy as np from PIL.Image import ANTIALIAS from keras.callbacks import ModelCheckpoint from keras.layers import Conv2D, Activation, MaxPooling2D, Flatten, Dense, Dropout from keras.models import Sequential from keras.optimizers import RMSprop, Adam class Model: def __init__(self, t...
[ "numpy.argmax", "keras.callbacks.ModelCheckpoint", "keras.layers.Activation", "keras.layers.Dropout", "random.shuffle", "keras.optimizers.Adam", "keras.layers.Flatten", "keras.layers.Dense", "keras.layers.Conv2D", "numpy.array", "keras.models.Sequential", "keras.layers.MaxPooling2D" ]
[((532, 665), 'keras.callbacks.ModelCheckpoint', 'ModelCheckpoint', (['model_path'], {'monitor': '"""val_loss"""', 'verbose': '(0)', 'save_best_only': '(False)', 'save_weights_only': '(False)', 'mode': '"""auto"""', 'period': '(5)'}), "(model_path, monitor='val_loss', verbose=0, save_best_only=\n False, save_weights...
"""The :mod:`variation` module defines classes for variation operators. Variation operators (aka genetic operators) are used in evolutionary/genetic algorithms to create "child" genomes from "parent" genomes. """ from abc import ABC, abstractmethod from typing import Sequence, Union import math from copy import copy ...
[ "pyshgp.gp.genome.Genome", "copy.copy.copy", "pyshgp.utils.instantiate_using", "numpy.random.random", "numpy.random.choice" ]
[((5615, 5623), 'pyshgp.gp.genome.Genome', 'Genome', ([], {}), '()\n', (5621, 5623), False, 'from pyshgp.gp.genome import Genome, GeneSpawner\n'), ((7011, 7019), 'pyshgp.gp.genome.Genome', 'Genome', ([], {}), '()\n', (7017, 7019), False, 'from pyshgp.gp.genome import Genome, GeneSpawner\n'), ((8278, 8286), 'pyshgp.gp.g...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright 2021 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicab...
[ "matplotlib.pyplot.title", "numpy.fft.rfft", "scipy.io.wavfile.read", "numpy.around", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.arange", "numpy.mean", "numpy.round", "os.path.join", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "numpy.log10", "matplotlib.pyplot.s...
[((1607, 1631), 'os.path.join', 'path.join', (['"""."""', '"""Sounds"""'], {}), "('.', 'Sounds')\n", (1616, 1631), True, 'import os.path as path\n'), ((1645, 1687), 'os.path.join', 'path.join', (['file_path', '"""bernard_speech.wav"""'], {}), "(file_path, 'bernard_speech.wav')\n", (1654, 1687), True, 'import os.path as...
#!/usr/bin/env python # coding: utf-8 # ##### Copyright 2019 The TensorFlow Authors. # In[ ]: #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICEN...
[ "matplotlib.pyplot.xlim", "tensorflow.py_function", "matplotlib.cm.get_cmap", "numpy.logical_and", "matplotlib.pyplot.close", "time.perf_counter", "itertools.count", "tensorflow.data.Dataset.range", "collections.defaultdict", "time.sleep", "tensorflow.concat", "tensorflow.zeros", "tensorflow...
[((9611, 9639), 'tensorflow.data.Dataset.range', 'tf.data.Dataset.range', (['(10000)'], {}), '(10000)\n', (9632, 9639), True, 'import tensorflow as tf\n'), ((3456, 3475), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (3473, 3475), False, 'import time\n'), ((9701, 9720), 'time.perf_counter', 'time.perf_cou...
from cmath import sqrt import numpy as np import networkx as nx from math import sqrt def undersegmentation_error(partition, groundtruth, tolerance=0.05): """ Computes the undersegmentation error defined as: ue(G_i) = (sum_{Area(S_i)} - area(G_i)) / area(G_i) where G_i ...
[ "numpy.sum", "numpy.count_nonzero", "math.sqrt", "numpy.argmax", "numpy.zeros", "networkx.max_weight_matching", "numpy.where", "networkx.Graph", "numpy.mean", "numpy.unique" ]
[((977, 997), 'numpy.unique', 'np.unique', (['partition'], {}), '(partition)\n', (986, 997), True, 'import numpy as np\n'), ((2655, 2675), 'numpy.unique', 'np.unique', (['partition'], {}), '(partition)\n', (2664, 2675), True, 'import numpy as np\n'), ((4112, 4159), 'numpy.where', 'np.where', (['(partition[:-1, :] != pa...
# Copyright (c) 2018 Uber Technologies, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
[ "numpy.zeros" ]
[((1191, 1216), 'numpy.zeros', 'np.zeros', (['self.batch_size'], {}), '(self.batch_size)\n', (1199, 1216), True, 'import numpy as np\n')]
import os import sys import xml.etree.ElementTree as eT from argparse import ArgumentParser import json from json import JSONEncoder import numpy as np import config parser = ArgumentParser() parser.add_argument('-f', '--filename', dest='filename', required=True) args = parser.parse_args() class NumpyArrayEncoder(...
[ "xml.etree.ElementTree.parse", "json.dump", "argparse.ArgumentParser", "config.edge_type_codes.keys", "os.path.realpath", "json.dumps", "numpy.array", "config.room_type_codes.keys", "json.JSONEncoder.default" ]
[((178, 194), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (192, 194), False, 'from argparse import ArgumentParser\n'), ((1912, 1935), 'xml.etree.ElementTree.parse', 'eT.parse', (['full_filename'], {}), '(full_filename)\n', (1920, 1935), True, 'import xml.etree.ElementTree as eT\n'), ((3168, 3185), 'n...
import math from typing import Optional, Tuple import numpy as np from squad.constants import HALF_PI, AngleType, Leg from .base import BodyParameters from .core import coord_rotate_xyz def _foot_xyz_hip_frame( hip_theta: float, femur_theta: float, leg_theta: float, body_params: Optional[BodyParame...
[ "math.asin", "math.atan2", "math.radians", "math.sin", "math.acos", "numpy.array", "math.cos", "math.degrees" ]
[((892, 905), 'math.sin', 'math.sin', (['r_h'], {}), '(r_h)\n', (900, 905), False, 'import math\n'), ((916, 929), 'math.cos', 'math.cos', (['r_h'], {}), '(r_h)\n', (924, 929), False, 'import math\n'), ((940, 953), 'math.cos', 'math.cos', (['r_f'], {}), '(r_f)\n', (948, 953), False, 'import math\n'), ((965, 984), 'math....
import base64 import gym import io import numpy as np from typing import Dict import zlib from ray.rllib.utils.annotations import DeveloperAPI def _serialize_ndarray(array: np.ndarray) -> str: """Pack numpy ndarray into Base64 encoded strings for serialization. This function uses numpy.save() instead of pic...
[ "io.BytesIO", "numpy.save", "numpy.dtype", "base64.b64decode", "gym.spaces.Tuple", "gym.spaces.Dict" ]
[((456, 468), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (466, 468), False, 'import io\n'), ((473, 492), 'numpy.save', 'np.save', (['buf', 'array'], {}), '(buf, array)\n', (480, 492), True, 'import numpy as np\n'), ((3900, 3931), 'gym.spaces.Tuple', 'gym.spaces.Tuple', ([], {'spaces': 'spaces'}), '(spaces=spaces)\n'...
import os import numpy as np from capreolus import ConfigOption, Dependency, evaluator from capreolus.sampler import PredSampler from capreolus.searcher import Searcher from capreolus.task import Task from capreolus.utils.loginit import get_logger logger = get_logger(__name__) @Task.register class ReRerankTask(Tas...
[ "capreolus.ConfigOption", "capreolus.utils.loginit.get_logger", "capreolus.Dependency", "capreolus.sampler.PredSampler", "os.path.exists", "capreolus.searcher.Searcher.load_trec_run", "capreolus.evaluator.eval_runs", "numpy.mean" ]
[((260, 280), 'capreolus.utils.loginit.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (270, 280), False, 'from capreolus.utils.loginit import get_logger\n'), ((381, 422), 'capreolus.ConfigOption', 'ConfigOption', (['"""fold"""', '"""s1"""', '"""fold to run"""'], {}), "('fold', 's1', 'fold to run')\n", (...
#!/usr/bin/env python3 import numpy as np import pickle from scipy.spatial.transform import Rotation def load_poses(path): f = open(path + '/ep_data.pkl', 'rb') data = pickle.load(f) gt_mat = np.zeros([0, 4, 4]) gt_obj_pose_mat = np.eye(4) quat = data['obj_world_pose'][3:] quat[0], quat[1], q...
[ "pickle.dump", "scipy.spatial.transform.Rotation.from_euler", "scipy.spatial.transform.Rotation.from_dcm", "numpy.zeros", "numpy.hstack", "pickle.load", "numpy.linalg.inv", "scipy.spatial.transform.Rotation.from_quat", "numpy.random.normal", "numpy.eye", "numpy.concatenate" ]
[((178, 192), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (189, 192), False, 'import pickle\n'), ((207, 226), 'numpy.zeros', 'np.zeros', (['[0, 4, 4]'], {}), '([0, 4, 4])\n', (215, 226), True, 'import numpy as np\n'), ((249, 258), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (255, 258), True, 'import numpy as...
""" Advection of particles with nemo """ import numpy as np from parcels import FieldSet, ParticleSet, JITParticle, ErrorCode, AdvectionRK4 from argparse import ArgumentParser from datetime import timedelta from datetime import datetime from glob import glob datadir = '/data2/imau/oceanparcels/hydrodynamic_data/NEMO-...
[ "numpy.load", "argparse.ArgumentParser", "parcels.FieldSet.from_nemo", "datetime.datetime", "parcels.ParticleSet", "datetime.timedelta", "glob.glob" ]
[((1587, 1611), 'numpy.load', 'np.load', (['coordinate_file'], {}), '(coordinate_file)\n', (1594, 1611), True, 'import numpy as np\n'), ((2462, 2514), 'parcels.FieldSet.from_nemo', 'FieldSet.from_nemo', (['filenames', 'variables', 'dimensions'], {}), '(filenames, variables, dimensions)\n', (2480, 2514), False, 'from pa...
import numpy as np def softmax(x): """ Normalize any vector to probabilistic distribution. :param x: numpy array or matrix :return: numpy array or matrix of the same shape to x """ xmax = np.expand_dims(np.max(x, -1), -1) e_x = np.exp(x - xmax) x = e_x / np.expand_dims(np.sum(e_x, -1),...
[ "numpy.max", "numpy.sum", "numpy.exp" ]
[((258, 274), 'numpy.exp', 'np.exp', (['(x - xmax)'], {}), '(x - xmax)\n', (264, 274), True, 'import numpy as np\n'), ((229, 242), 'numpy.max', 'np.max', (['x', '(-1)'], {}), '(x, -1)\n', (235, 242), True, 'import numpy as np\n'), ((304, 319), 'numpy.sum', 'np.sum', (['e_x', '(-1)'], {}), '(e_x, -1)\n', (310, 319), Tru...
''' Created on Jun 27, 2016 @author: rajajosh ''' from _random import Random import numpy class MyRandomClassifier(object): "Random classifier. To be used for testing/benchmarking purposes" len=0 def __init__(self): ''' Constructor ''' pass def fit...
[ "_random.Random", "numpy.asarray" ]
[((438, 446), '_random.Random', 'Random', ([], {}), '()\n', (444, 446), False, 'from _random import Random\n'), ((576, 597), 'numpy.asarray', 'numpy.asarray', (['retArr'], {}), '(retArr)\n', (589, 597), False, 'import numpy\n')]
from environments.racing.racing import RaceTrack from td_learning import td import numpy as np import argparse parser = argparse.ArgumentParser(description='Sarsa Racetrack Policy Improvement') parser.add_argument('racetrack', type=str, help='Path to racetrack csv file') parse...
[ "environments.racing.racing.RaceTrack", "td_learning.td.sarsa", "argparse.ArgumentParser", "numpy.save" ]
[((122, 195), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Sarsa Racetrack Policy Improvement"""'}), "(description='Sarsa Racetrack Policy Improvement')\n", (145, 195), False, 'import argparse\n'), ((793, 818), 'environments.racing.racing.RaceTrack', 'RaceTrack', (['args.racetrack'], {...
# coding: utf-8 import pytest import numpy as np from imageio import imread from AxonDeepSeg.data_management.data_augmentation import * class TestCore(object): def setup(self): # Remember that the stop value in "arrange" is not included x = np.arange(0, 16, dtype='uint8') y = np.arange(0,...
[ "numpy.meshgrid", "numpy.ones", "numpy.equal", "numpy.not_equal", "numpy.arange" ]
[((264, 295), 'numpy.arange', 'np.arange', (['(0)', '(16)'], {'dtype': '"""uint8"""'}), "(0, 16, dtype='uint8')\n", (273, 295), True, 'import numpy as np\n'), ((308, 339), 'numpy.arange', 'np.arange', (['(0)', '(16)'], {'dtype': '"""uint8"""'}), "(0, 16, dtype='uint8')\n", (317, 339), True, 'import numpy as np\n'), ((3...
# -*- coding: utf-8 -*- ############################################################# # IMPORTS # ############################################################# import os import sys import numpy as np import cv2 from PIL import Image, ImageEnhance from skimage...
[ "os.listdir", "cv2.equalizeHist", "os.path.abspath", "numpy.average", "cv2.cvtColor", "os.system", "cv2.addWeighted", "cv2.imread", "os.chdir" ]
[((582, 596), 'os.chdir', 'os.chdir', (['PATH'], {}), '(PATH)\n', (590, 596), False, 'import os\n'), ((554, 579), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (569, 579), False, 'import os\n'), ((1233, 1281), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cl...
# -*- coding: utf-8 -*- """ Created on Tue Oct 23 20:45:37 2018 @author: Alexandre """ ############################################################################### import numpy as np ############################################################################### from pyro.dynamic import system ###################...
[ "numpy.zeros", "numpy.ones", "numpy.linalg.inv", "numpy.array", "numpy.dot", "pyro.dynamic.system.ContinuousDynamicSystem.__init__" ]
[((13252, 13268), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (13260, 13268), True, 'import numpy as np\n'), ((13283, 13305), 'numpy.array', 'np.array', (['[0, 0, 0, 0]'], {}), '([0, 0, 0, 0])\n', (13291, 13305), True, 'import numpy as np\n'), ((1800, 1854), 'pyro.dynamic.system.ContinuousDynamicSystem._...
""" Compute onset times from time-domain audio data Spectra are computed as necessary Supported methods: - Time-domain: energy - Spectral: flux Last updated: 15 December 2012 """ from pymir import Energy from pymir import SpectralFlux import numpy from numpy import NaN, Inf, arange, isscalar, array, asarray import m...
[ "numpy.average", "pymir.SpectralFlux.spectralFlux", "numpy.isscalar", "numpy.asarray", "numpy.convolve", "numpy.array", "pymir.Energy.energy", "pymir.Energy.dEnergy", "numpy.repeat" ]
[((662, 697), 'pymir.Energy.energy', 'Energy.energy', (['audioData', 'frameSize'], {}), '(audioData, frameSize)\n', (675, 697), False, 'from pymir import Energy\n'), ((704, 740), 'pymir.Energy.dEnergy', 'Energy.dEnergy', (['audioData', 'frameSize'], {}), '(audioData, frameSize)\n', (718, 740), False, 'from pymir import...
""" Test the datasets module """ # Author: <NAME> # License: simplified BSD import contextlib import os import shutil import numpy as np import zipfile import tarfile import gzip from tempfile import mkdtemp, mkstemp import pytest from nilearn import datasets from nilearn._utils.testing import (mock_request, wrap_ch...
[ "os.mkdir", "os.remove", "numpy.sum", "os.close", "numpy.arange", "shutil.rmtree", "os.environ.pop", "os.path.join", "os.path.abspath", "nilearn.datasets.utils._filter_columns", "os.path.exists", "pytest.raises", "tempfile.mkdtemp", "nilearn.datasets.utils._md5_sum_file", "tarfile.open",...
[((447, 476), 'os.path.join', 'os.path.join', (['currdir', '"""data"""'], {}), "(currdir, 'data')\n", (459, 476), False, 'import os\n'), ((516, 532), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (530, 532), False, 'import pytest\n'), ((410, 435), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__fi...
# Copyright 2020 Google LLC # 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...
[ "fqe.util.ltlt_index_generator", "fqe.util.qubit_particle_number_sector", "fqe.util.qubit_particle_number_index_spin", "fqe.util.configuration_key_union", "fqe.util.invert_bitstring_with_mask", "fqe.util.init_qubit_vacuum", "fqe.util.configuration_key_intersection", "fqe.util.sort_configuration_keys",...
[((1692, 1718), 'fqe.util.bubblesort', 'util.bubblesort', (['test_list'], {}), '(test_list)\n', (1707, 1718), False, 'from fqe import util\n'), ((5036, 5064), 'fqe.util.ltlt_index_generator', 'util.ltlt_index_generator', (['(0)'], {}), '(0)\n', (5061, 5064), False, 'from fqe import util\n'), ((5418, 5446), 'fqe.util.lt...
from typing import Dict import numpy as np import pandas as pd from ira.series.Indicators import ATR, MovingMinMax from qlearn.tracking.trackers import TakeStopTracker class Pyramiding(TakeStopTracker): """ Pyramiding tracker. 1. Open position = size on signal, stop at entry - stop_mx * ATR ...
[ "numpy.round", "ira.series.Indicators.ATR", "ira.series.Indicators.MovingMinMax", "numpy.isfinite" ]
[((5729, 5768), 'ira.series.Indicators.ATR', 'ATR', (['self.atr_period', 'self.atr_smoother'], {}), '(self.atr_period, self.atr_smoother)\n', (5732, 5768), False, 'from ira.series.Indicators import ATR, MovingMinMax\n'), ((5912, 5984), 'numpy.round', 'np.round', (['(self.size * self.pyramiding_factor ** n)', 'self.log1...
import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from math import sqrt from math import floor from matplotlib.finance import candlestick_ohlc import csv import pandas as pd plt.rc('text', usetex=True) #Parameters brownian() # #x[0]: X(0), initial stock price #N: number of i...
[ "matplotlib.pyplot.title", "numpy.random.seed", "numpy.amin", "csv.reader", "numpy.empty", "numpy.arange", "numpy.exp", "numpy.random.normal", "pandas.DataFrame", "numpy.cumsum", "matplotlib.pyplot.rc", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.finance.candlestick_ohlc", ...
[((205, 232), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (211, 232), True, 'import matplotlib.pyplot as plt\n'), ((495, 510), 'numpy.empty', 'np.empty', (['(N + 1)'], {}), '(N + 1)\n', (503, 510), True, 'import numpy as np\n'), ((516, 531), 'numpy.empty', 'np.em...
# coding: utf-8 # # Deep Learning & Art: Neural Style Transfer # # Welcome to the second assignment of this week. In this assignment, you will learn about Neural Style Transfer. This algorithm was created by Gatys et al. (2015) (https://arxiv.org/abs/1508.06576). # # **In this assignment, you will:** # - Implement...
[ "numpy.random.seed", "numpy.random.randn", "tensorflow.global_variables_initializer", "matplotlib.pyplot.imshow", "tensorflow.reset_default_graph", "tensorflow.reshape", "tensorflow.Session", "tensorflow.pow", "tensorflow.transpose", "tensorflow.set_random_seed", "tensorflow.random_normal", "t...
[((3646, 3667), 'matplotlib.pyplot.imshow', 'imshow', (['content_image'], {}), '(content_image)\n', (3652, 3667), False, 'from matplotlib.pyplot import imshow\n'), ((7742, 7766), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (7764, 7766), True, 'import tensorflow as tf\n'), ((8691, 8710)...
""" This file is part of the repo: https://github.com/tencent-ailab/hifi3dface If you find the code useful, please cite our paper: "High-Fidelity 3D Digital Human Creation from RGB-D Selfies." <NAME>*, <NAME>*, <NAME>*, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>. arXiv: https://arxiv.org/abs/2010.05...
[ "utils.tf_LP.TF_LaplacianPyramid.downSamplePyramids", "tensorflow.reduce_sum", "tensorflow.clip_by_value", "tensorflow.reshape", "tensorflow.zeros_like", "numpy.clip", "numpy.ones", "utils.LP.LaplacianPyramid.buildLaplacianPyramids", "numpy.mean", "tensorflow.nn.conv2d", "tensorflow.reduce_max",...
[((2493, 2562), 'tensorflow.pad', 'tf.pad', ([], {'tensor': 'dX', 'paddings': '((0, 0), (0, 0), (0, 1))', 'mode': '"""constant"""'}), "(tensor=dX, paddings=((0, 0), (0, 0), (0, 1)), mode='constant')\n", (2499, 2562), True, 'import tensorflow as tf\n'), ((2620, 2689), 'tensorflow.pad', 'tf.pad', ([], {'tensor': 'dY', 'p...
# python 2.7 from __future__ import absolute_import, division, print_function import io from math import floor import numpy as np from time import sleep, time from os.path import join from control.motor import Motor from control import policy class Controller(object): def __init__(self): self.motor = Mot...
[ "numpy.load", "control.policy.adp", "numpy.save", "control.policy.adp_coupled_car_following", "control.motor.Motor", "numpy.zeros", "time.time", "control.policy.car_following_with_adp", "control.policy.car_following", "control.policy.pure_pursuit" ]
[((317, 335), 'control.motor.Motor', 'Motor', ([], {'slient': '(True)'}), '(slient=True)\n', (322, 335), False, 'from control.motor import Motor\n'), ((363, 369), 'time.time', 'time', ([], {}), '()\n', (367, 369), False, 'from time import sleep, time\n'), ((429, 466), 'numpy.load', 'np.load', (['"""./control/K_traj_IM_...
import scipy.special import scipy.integrate import numpy as np import numpy.polynomial def legendre_series(f, n): r""" Calculate the terms of the Legendre series expansion of the function ..math:`f(x)` with the first ..math:`n_terms` terms. This will be the terms up to but _excluding_ the coefficient...
[ "numpy.zeros_like", "numpy.empty", "numpy.polynomial.Polynomial", "numpy.sin", "numpy.exp", "numpy.linspace", "numpy.cos" ]
[((1600, 1614), 'numpy.exp', 'np.exp', (['(-a / k)'], {}), '(-a / k)\n', (1606, 1614), True, 'import numpy as np\n'), ((4546, 4569), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(201)'], {}), '(-1, 1, 201)\n', (4557, 4569), True, 'import numpy as np\n'), ((3003, 3043), 'numpy.empty', 'np.empty', (['(self._n_a,)']...
# %% [markdown] # # Libraries and Data # %% from zipfile import ZipFile import altair as alt import numpy as np import pandas as pd alt.data_transformers.disable_max_rows() # %% [markdown] # After downloading the dataset, we can load the train set from the zip file. # # However, for faster reloads, we stored it in a ...
[ "pandas.DataFrame", "zipfile.ZipFile", "altair.Chart", "pandas.read_feather", "pandas.to_datetime", "altair.data_transformers.disable_max_rows", "altair.Color", "pandas.Grouper", "pandas.Series", "altair.Scale", "numpy.sqrt" ]
[((134, 174), 'altair.data_transformers.disable_max_rows', 'alt.data_transformers.disable_max_rows', ([], {}), '()\n', (172, 174), True, 'import altair as alt\n'), ((1594, 1642), 'pandas.to_datetime', 'pd.to_datetime', (["train['hour']"], {'format': '"""%y%m%d%H"""'}), "(train['hour'], format='%y%m%d%H')\n", (1608, 164...
''' from functions import * ''' import pickle import os.path import numpy as np from FNN import FNN from sklearn.preprocessing import MinMaxScaler import tensorflow as tf OPTIMIZERS = [tf.train.GradientDescentOptimizer, tf.train.AdamOptimizer,\ tf.train.ProximalGradientDescentOptimizer, tf.train.RMSPropOptimizer] HO...
[ "pickle.load", "pickle.dump", "sklearn.preprocessing.MinMaxScaler", "numpy.tanh" ]
[((440, 475), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(-1, 1)'}), '(feature_range=(-1, 1))\n', (452, 475), False, 'from sklearn.preprocessing import MinMaxScaler\n'), ((579, 589), 'numpy.tanh', 'np.tanh', (['(1)'], {}), '(1)\n', (586, 589), True, 'import numpy as np\n'), ((3528, 35...
"""Find the maximum firing rate of the somas as driven by bias Set soma offset bias to max Set soma refractory bias to max (minimum refractory) Iterate through the somas, and collect spikes Plot results """ import os from time import sleep import argparse import numpy as np import matplotlib.pyplot as plt from pysto...
[ "matplotlib.pyplot.title", "argparse.ArgumentParser", "pystorm.hal.HAL.stop_traffic", "pystorm.hal.HAL", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.pyplot.axvline", "pystorm.hal.HAL.driver.BDPars.GetSomaAERAddr", "utils.file_io.set_data_dir", "matplotlib.pyplot.imshow", "numpy.savetxt...
[((564, 569), 'pystorm.hal.HAL', 'HAL', ([], {}), '()\n', (567, 569), False, 'from pystorm.hal import HAL\n'), ((716, 738), 'utils.file_io.set_data_dir', 'set_data_dir', (['__file__'], {}), '(__file__)\n', (728, 738), False, 'from utils.file_io import load_txt_data, set_data_dir\n'), ((810, 887), 'argparse.ArgumentPars...
import autoaim import math import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn from torch.autograd import Variable import sys import time # Devices if torch.cuda.is_available(): device = torch.device('cuda') print('Device: GPU.') else: device = torch.device('cpu') prin...
[ "autoaim.helpers.read_csv", "torch.cat", "numpy.arange", "torch.device", "torch.no_grad", "torch.ones", "torch.nn.BCELoss", "torch.Tensor", "numpy.linspace", "torch.nn.Linear", "autoaim.DataLoader", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "torch.cuda.is_available", "autoaim...
[((186, 211), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (209, 211), False, 'import torch\n'), ((226, 246), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (238, 246), False, 'import torch\n'), ((292, 311), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n"...
from typing import Dict, Tuple, Optional, List import os from abc import ABCMeta, abstractmethod import numpy as np import json from scipy.sparse import csr_matrix, dok_matrix import panqec from panqec.bpauli import bcommute, get_effective_error from panqec import bsparse os.environ['PANQEC_ROOT_DIR'] = os.path.dirna...
[ "json.load", "panqec.bsparse.is_empty", "numpy.logical_and", "os.path.dirname", "panqec.bsparse.empty_row", "numpy.zeros", "numpy.min", "panqec.bpauli.get_effective_error", "numpy.logical_or", "panqec.bpauli.bcommute", "scipy.sparse.dok_matrix", "os.path.join" ]
[((307, 339), 'os.path.dirname', 'os.path.dirname', (['panqec.__file__'], {}), '(panqec.__file__)\n', (322, 339), False, 'import os\n'), ((2628, 2657), 'panqec.bsparse.empty_row', 'bsparse.empty_row', (['(2 * self.n)'], {}), '(2 * self.n)\n', (2645, 2657), False, 'from panqec import bsparse\n'), ((2675, 2700), 'panqec....
# Copyright 2017 Battelle Energy Alliance, LLC # # 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 t...
[ "numpy.dtype", "xarray.open_dataset", "xarray.concat", "xarray.Dataset", "os.path.isfile", "xarray.DataArray", "xarray.load_dataset" ]
[((2878, 2898), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (2892, 2898), False, 'import os\n'), ((5029, 5049), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (5043, 5049), False, 'import os\n'), ((6261, 6278), 'xarray.Dataset', 'xr.Dataset', (['xarrs'], {}), '(xarrs)\n', (6271, 627...
import pytest import numpy as np from msibi.potentials import tail_correction, mie, alpha_array def test_tail_correction(): dr = 0.05 r = np.arange(0, 2.5, dr) V = mie(r, 1, 1) smooth_V = tail_correction(r, V, r_switch=2.25) assert smooth_V[-1] == 0.0 def test_calc_alpha_array(): alpha0 = 1...
[ "pytest.raises", "numpy.arange", "msibi.potentials.alpha_array", "msibi.potentials.tail_correction", "msibi.potentials.mie" ]
[((149, 170), 'numpy.arange', 'np.arange', (['(0)', '(2.5)', 'dr'], {}), '(0, 2.5, dr)\n', (158, 170), True, 'import numpy as np\n'), ((179, 191), 'msibi.potentials.mie', 'mie', (['r', '(1)', '(1)'], {}), '(r, 1, 1)\n', (182, 191), False, 'from msibi.potentials import tail_correction, mie, alpha_array\n'), ((207, 243),...
#!/usr/bin/env python from __future__ import print_function import rospy from geometry_msgs.msg import Twist from std_msgs.msg import Empty from nav_msgs.msg import Odometry from simple_pid import PID import numpy as np from time import sleep import sys class CoordinateSystem: def __init__(self, speed=0.5, turnSpe...
[ "simple_pid.PID", "rospy.Subscriber", "numpy.asarray", "numpy.zeros", "rospy.Publisher", "rospy.Rate", "std_msgs.msg.Empty", "geometry_msgs.msg.Twist", "time.sleep", "numpy.sin", "numpy.array", "numpy.linalg.norm", "numpy.cos" ]
[((435, 490), 'rospy.Subscriber', 'rospy.Subscriber', (['"""odom"""', 'Odometry', 'self.updatePosition'], {}), "('odom', Odometry, self.updatePosition)\n", (451, 490), False, 'import rospy\n'), ((749, 775), 'rospy.Rate', 'rospy.Rate', (['self.frequency'], {}), '(self.frequency)\n', (759, 775), False, 'import rospy\n'),...
# Copyright (c) 2021 Graphcore Ltd. All rights reserved. import unittest from pathlib import Path import sys from tensorflow import keras import tensorflow as tf import numpy as np sys.path.append(str(Path(__file__).absolute().parent.parent)) from model.model_editor import ModelEditor class CopyModelWeightsTest(unit...
[ "tensorflow.nn.relu", "numpy.random.seed", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.applications.resnet50.ResNet50", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Dense", "tensorflow.keras.Input", "numpy.zeros", "model.mod...
[((7060, 7090), 'tensorflow.keras.Input', 'keras.Input', ([], {'shape': '(32, 32, 3)'}), '(shape=(32, 32, 3))\n', (7071, 7090), False, 'from tensorflow import keras\n'), ((7454, 7492), 'tensorflow.keras.Model', 'keras.Model', (['model_input', 'model_output'], {}), '(model_input, model_output)\n', (7465, 7492), False, '...
def set_seed(seed): import random random.seed(seed) try: import numpy as np np.random.seed(seed) except: pass try: import torch torch.manual_seed(seed) except: pass
[ "torch.manual_seed", "numpy.random.seed", "random.seed" ]
[((42, 59), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (53, 59), False, 'import random\n'), ((109, 129), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (123, 129), True, 'import numpy as np\n'), ((198, 221), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (215, 2...
# Copyright (c) 2018-2019, NVIDIA CORPORATION. import pytest import numpy as np import pandas as pd import nvstrings from utils import assert_eq @pytest.mark.parametrize('pattern', ['\\d', '\\w+', '\\s', '...
[ "utils.assert_eq", "numpy.array", "pandas.Series", "pytest.mark.parametrize", "pytest.mark.xfail", "nvstrings.to_device" ]
[((150, 383), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pattern"""', "['\\\\d', '\\\\w+', '\\\\s', '\\\\S', '^.*\\\\\\\\.*$', '[1-5]+', '[a-h]+', '[A-H]+',\n '\\n', 'b.\\\\s*\\n', '.*c', '\\\\d\\\\d:\\\\d\\\\d:\\\\d\\\\d',\n '\\\\d\\\\d?:\\\\d\\\\d?:\\\\d\\\\d?', '[Hh]ello [Ww]orld', '\\\\bworld...
import numpy as np from autodiff.dualmat import DualMat2D def test_dualmat_lift() -> None: a = -3 b = DualMat2D.lift(a) # pylint: disable=C0326 c = np.array([[-3, 0], [0, -3]], dtype=int) np.testing.assert_equal(b.mat, c) def test_dualmat_init() -> None: a = -3 b = 1 # pylint: disab...
[ "numpy.testing.assert_almost_equal", "autodiff.dualmat.DualMat2D.lift", "autodiff.dualmat.DualMat2D.from_vals", "numpy.array", "numpy.testing.assert_equal" ]
[((113, 130), 'autodiff.dualmat.DualMat2D.lift', 'DualMat2D.lift', (['a'], {}), '(a)\n', (127, 130), False, 'from autodiff.dualmat import DualMat2D\n'), ((167, 206), 'numpy.array', 'np.array', (['[[-3, 0], [0, -3]]'], {'dtype': 'int'}), '([[-3, 0], [0, -3]], dtype=int)\n', (175, 206), True, 'import numpy as np\n'), ((2...
# -*- coding: utf-8 -*- import struct import numpy as np class WeightReader: def __init__(self, weight_file): with open(weight_file, 'rb') as w_f: major, = struct.unpack('i', w_f.read(4)) minor, = struct.unpack('i', w_f.read(4)) _, = struct.unpack('i...
[ "numpy.frombuffer", "yolo.net.yolonet.Yolonet", "numpy.prod" ]
[((2378, 2389), 'yolo.net.yolonet.Yolonet', 'Yolonet', (['(18)'], {}), '(18)\n', (2385, 2389), False, 'from yolo.net.yolonet import Yolonet\n'), ((2598, 2610), 'yolo.net.yolonet.Yolonet', 'Yolonet', (['(255)'], {}), '(255)\n', (2605, 2610), False, 'from yolo.net.yolonet import Yolonet\n'), ((578, 616), 'numpy.frombuffe...
# DEPENDENCIES import random from kivy.uix.gridlayout import GridLayout from kivy.properties import ObjectProperty from kivy.uix.textinput import TextInput from kivy.uix.button import Button from kivy.uix.label import Label import numpy as np import itertools # CUSTOM MODULES from globals import config_dict...
[ "kivy.uix.label.Label", "itertools.permutations", "numpy.asarray", "kivy.properties.ObjectProperty" ]
[((1587, 1607), 'kivy.properties.ObjectProperty', 'ObjectProperty', (['None'], {}), '(None)\n', (1601, 1607), False, 'from kivy.properties import ObjectProperty\n'), ((1628, 1648), 'kivy.properties.ObjectProperty', 'ObjectProperty', (['None'], {}), '(None)\n', (1642, 1648), False, 'from kivy.properties import ObjectPro...
import pandas as pd import numpy as np import math import urllib import io from PIL import Image def deg2num(lat_deg, lon_deg, zoom): lat_rad = math.radians(lat_deg) n = 2.0 ** zoom xtile = int((lon_deg + 180.0) / 360.0 * n) ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos...
[ "threading.Thread", "PIL.Image.new", "os.mkdir", "io.BytesIO", "shapely.geometry.Polygon", "math.radians", "math.tan", "numpy.asarray", "urllib.request.urlopen", "PIL.Image.open", "math.cos", "math.sinh", "math.degrees", "os.listdir" ]
[((163, 184), 'math.radians', 'math.radians', (['lat_deg'], {}), '(lat_deg)\n', (175, 184), False, 'import math\n'), ((561, 582), 'math.degrees', 'math.degrees', (['lat_rad'], {}), '(lat_rad)\n', (573, 582), False, 'import math\n'), ((4172, 4260), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '((xmax - xmin + 1) * imgsi...
''' Title : Concatenate Subdomain : Numpy Domain : Python Author : codeperfectplus Created : 7 May 2020 ''' import numpy as np N, M, P = map(int, input().split()) array1 = np.array([input().split() for _ in range(N)],int) array2 = np.array([input().split() for _ in range(M)],int) print(np.concatenate((array...
[ "numpy.concatenate" ]
[((299, 339), 'numpy.concatenate', 'np.concatenate', (['(array1, array2)'], {'axis': '(0)'}), '((array1, array2), axis=0)\n', (313, 339), True, 'import numpy as np\n')]
from styx_msgs.msg import TrafficLight import os import cv2 import numpy as np import rospy import tensorflow as tf from datetime import datetime class TLClassifier(object): def __init__(self, model_name): #TODO load classifier self.first_call = True # load frozen model cwd = os....
[ "os.mkdir", "numpy.argmax", "datetime.datetime.utcnow", "cv2.rectangle", "os.path.join", "numpy.zeros_like", "cv2.cvtColor", "cv2.imwrite", "os.path.exists", "rospy.get_time", "tensorflow.GraphDef", "numpy.dstack", "os.path.realpath", "tensorflow.Session", "tensorflow.gfile.GFile", "te...
[((467, 477), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (475, 477), True, 'import tensorflow as tf\n'), ((1405, 1440), 'tensorflow.Session', 'tf.Session', ([], {'graph': 'self.frozen_graph'}), '(graph=self.frozen_graph)\n', (1415, 1440), True, 'import tensorflow as tf\n'), ((2011, 2031), 'numpy.zeros_like', 'np...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import logging import sys import torch import numpy as np import argparse import re import os import torch.distributed as dist from contextlib import contextmanager def word_tokenize(sent): pat = re.compile(r'[\w]+|[.,!?;|]') if isinstanc...
[ "numpy.sum", "torch.argmax", "torch.cuda.device_count", "logging.Formatter", "numpy.argsort", "numpy.mean", "torch.device", "os.path.join", "argparse.ArgumentTypeError", "logging.warning", "os.path.exists", "torch.cuda.set_device", "torch.manual_seed", "logging.StreamHandler", "torch.cud...
[((274, 303), 're.compile', 're.compile', (['"""[\\\\w]+|[.,!?;|]"""'], {}), "('[\\\\w]+|[.,!?;|]')\n", (284, 303), False, 'import re\n'), ((758, 777), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (775, 777), False, 'import logging\n'), ((917, 950), 'logging.StreamHandler', 'logging.StreamHandler', (['sy...
""" template_wt Functions needed to generate a wind turbines Notes: To load this library: import cases.templates.template_wt as template_wt """ import pandas as pd import numpy as np import scipy.interpolate as scint import math import sys import sharpy.utils.generate_cases as gc import sharpy.utils.algebra as...
[ "sys.error", "numpy.ones", "sharpy.utils.generate_cases.AeroelasticInformation", "sharpy.utils.generate_cases.get_mu0_from_camber", "numpy.sin", "numpy.linalg.norm", "numpy.interp", "scipy.interpolate.interp1d", "sharpy.utils.h5utils.readh5", "sharpy.utils.generate_cases.read_column_sheet_type01",...
[((1550, 1571), 'numpy.zeros', 'np.zeros', (['(num_node,)'], {}), '((num_node,))\n', (1558, 1571), True, 'import numpy as np\n'), ((2477, 2500), 'numpy.zeros', 'np.zeros', (['(num_node, 3)'], {}), '((num_node, 3))\n', (2485, 2500), True, 'import numpy as np\n'), ((5920, 5947), 'sharpy.utils.generate_cases.AeroelasticIn...
import os import math import nrrd import logging import tifffile import warnings import numpy as np from skimage import transform from tqdm import tqdm from natsort import natsorted from concurrent.futures import ProcessPoolExecutor from imlib.general.system import get_sorted_file_paths, get_num_processes from .util...
[ "tqdm.tqdm", "logging.debug", "warnings.simplefilter", "nibabel.load", "skimage.transform.rescale", "os.path.isdir", "concurrent.futures.ProcessPoolExecutor", "imlib.general.system.get_sorted_file_paths", "os.walk", "warnings.catch_warnings", "numpy.array", "numpy.rollaxis", "tifffile.imread...
[((354, 379), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (377, 379), False, 'import warnings\n'), ((385, 416), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (406, 416), False, 'import warnings\n'), ((2219, 2242), 'os.path.isdir', 'os.path.isdir', ...
from ...isa.inst import * import numpy as np import math class _Vsenn_v(Inst): def golden(self): if 'isExcept' in self: if self['isExcept'] > 0: return np.zeros(self['vl'], dtype=self['rs1'].dtype) if 'start' in self: start = self['start'] else: ...
[ "numpy.zeros", "math.ceil" ]
[((1312, 1337), 'math.ceil', 'math.ceil', (["(self['vl'] / 8)"], {}), "(self['vl'] / 8)\n", (1321, 1337), False, 'import math\n'), ((1457, 1498), 'numpy.zeros', 'np.zeros', (['newLen'], {'dtype': "self['rs1'].dtype"}), "(newLen, dtype=self['rs1'].dtype)\n", (1465, 1498), True, 'import numpy as np\n'), ((446, 491), 'num...
"""GANomaly """ # pylint: disable=C0301,E1101,W0622,C0103,R0902,R0915 ## from collections import OrderedDict import os from re import I import time import numpy as np from tqdm import tqdm import torch.optim as optim import torch.nn as nn import torch.utils.data import torchvision.utils as vutils import pandas as pd...
[ "numpy.random.seed", "os.path.join", "torch.nn.BCELoss", "torch.nn.L1Loss", "lib.models.networks.define_D", "os.makedirs", "os.path.isdir", "os.path.exists", "time.time", "lib.visualizer.Visualizer", "numpy.mean", "random.seed", "numpy.array", "torchvision.utils.save_image", "collections...
[((973, 996), 'random.seed', 'random.seed', (['seed_value'], {}), '(seed_value)\n', (984, 996), False, 'import random\n'), ((1117, 1143), 'numpy.random.seed', 'np.random.seed', (['seed_value'], {}), '(seed_value)\n', (1131, 1143), True, 'import numpy as np\n'), ((1518, 1533), 'lib.visualizer.Visualizer', 'Visualizer', ...
# Enable import from parent package import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import sys import os sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) ) import dataio, utils, training, loss_functions, modules, diff_operators import torch import numpy as np i...
[ "torch.ones", "os.path.abspath", "scipy.io.loadmat", "torch.load", "torch.cat", "matplotlib.pyplot.figure", "matplotlib.use", "numpy.reshape", "os.path.join", "modules.SingleBVPNet" ]
[((54, 75), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (68, 75), False, 'import matplotlib\n'), ((764, 915), 'modules.SingleBVPNet', 'modules.SingleBVPNet', ([], {'in_features': '(4)', 'out_features': '(1)', 'type': 'activation', 'mode': '"""mlp"""', 'final_layer_factor': '(1.0)', 'hidden_fea...
#!/usr/bin/env python """ ONS Address Index - Land Registry Data ====================================== A simple script to process land registry sales data. The original data were downloaded on the 10th of November from: https://data.gov.uk/dataset/land-registry-monthly-price-paid-data Because the AddressBased used b...
[ "os.environ.get", "pandas.read_csv", "numpy.unique" ]
[((836, 866), 'os.environ.get', 'os.environ.get', (['"""LC_CTYPE"""', '""""""'], {}), "('LC_CTYPE', '')\n", (850, 866), False, 'import os\n'), ((1567, 1662), 'pandas.read_csv', 'pd.read_csv', (['(path + filename)'], {'low_memory': '(False)', 'parse_dates': '[2]', 'infer_datetime_format': '(True)'}), '(path + filename, ...
import torch from PIL import Image import torchvision import numpy as np import utils import json device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") IMG_SIZE=(300,300) manifest_path = "./data/safebooru-pic-meta/list.json" label_path = "./safebooru-labels-dict.json" model_path = "./safebooru-anime_v...
[ "utils.show_imgs", "json.load", "numpy.asarray", "torchvision.transforms.functional.resize", "PIL.Image.open", "torch.cuda.is_available", "numpy.array", "torch.max", "torch.device", "torch.tensor" ]
[((444, 458), 'json.load', 'json.load', (['fp1'], {}), '(fp1)\n', (453, 458), False, 'import json\n'), ((884, 900), 'numpy.asarray', 'np.asarray', (['imgs'], {}), '(imgs)\n', (894, 900), True, 'import numpy as np\n'), ((957, 975), 'torch.tensor', 'torch.tensor', (['imgs'], {}), '(imgs)\n', (969, 975), False, 'import to...
import operator import builtins import numpy as np from .nodes import slice_op from .base import Node, add, sub, mul, min_, max_, var_index, DEFAULT_SHAPES from .util import _flatten_iterable class GroupNode(Node): builtin_np = ["sum", "prod", "amax", "amin", "argmin", "argmax"] scalar_op_map = {"sum": operato...
[ "numpy.asarray", "numpy.frompyfunc", "numpy.ravel_multi_index" ]
[((3889, 3908), 'numpy.asarray', 'np.asarray', (['[value]'], {}), '([value])\n', (3899, 3908), True, 'import numpy as np\n'), ((9111, 9139), 'numpy.frompyfunc', 'np.frompyfunc', (['shifter', '(2)', '(1)'], {}), '(shifter, 2, 1)\n', (9124, 9139), True, 'import numpy as np\n'), ((2039, 2092), 'numpy.ravel_multi_index', '...