code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import gym import numpy as np from EnvOpenDogStand import EnvOpenDogStand from EnvOpenDogForward import EnvOpenDogForward from EnvOpenDogForwardSimple import EnvOpenDogForwardSimple import time from es import CMAES import tensorflow as tf import gc import pickle from tensorforce.agents import PPOAgent render = True e...
[ "tensorflow.layers.Dense", "numpy.nan_to_num", "numpy.zeros", "numpy.clip", "time.sleep", "gc.collect", "EnvOpenDogForwardSimple.EnvOpenDogForwardSimple", "numpy.array", "numpy.concatenate" ]
[((325, 364), 'EnvOpenDogForwardSimple.EnvOpenDogForwardSimple', 'EnvOpenDogForwardSimple', ([], {'renders': 'render'}), '(renders=render)\n', (348, 364), False, 'from EnvOpenDogForwardSimple import EnvOpenDogForwardSimple\n'), ((1451, 1463), 'numpy.zeros', 'np.zeros', (['(12)'], {}), '(12)\n', (1459, 1463), True, 'imp...
import torch import torch.nn as nn import numpy as np from lib.utils.federated_utils import * from lib.utils.avgmeter import AverageMeter def train(train_dloader_list, model_list, classifier_list, optimizer_list, classifier_optimizer_list, epoch, writer, num_classes, domain_weight, source_domains, batchnorm...
[ "torch.log_softmax", "torch.topk", "numpy.random.beta", "torch.nn.CrossEntropyLoss", "torch.cat", "torch.softmax", "lib.utils.avgmeter.AverageMeter", "torch.randperm", "torch.no_grad", "torch.sum" ]
[((7097, 7111), 'lib.utils.avgmeter.AverageMeter', 'AverageMeter', ([], {}), '()\n', (7109, 7111), False, 'from lib.utils.avgmeter import AverageMeter\n'), ((8302, 8335), 'torch.topk', 'torch.topk', (['tmp_label'], {'k': '(1)', 'dim': '(1)'}), '(tmp_label, k=1, dim=1)\n', (8312, 8335), False, 'import torch\n'), ((4898,...
from datetime import timedelta as delta from os import path import numpy as np import xarray as xr from parcels import ( AdvectionRK4, FieldSet, JITParticle, ParticleFile, ParticleSet, ScipyParticle, ) ptype = {"scipy": ScipyParticle, "jit": JITParticle} def run_mitgcm_zonally_reentrant(mode...
[ "parcels.FieldSet.from_mitgcm", "os.path.dirname", "xarray.open_dataset", "datetime.timedelta", "numpy.testing.assert_allclose", "parcels.ParticleSet.from_line" ]
[((836, 903), 'parcels.FieldSet.from_mitgcm', 'FieldSet.from_mitgcm', (['filenames', 'variables', 'dimensions'], {'mesh': '"""flat"""'}), "(filenames, variables, dimensions, mesh='flat')\n", (856, 903), False, 'from parcels import AdvectionRK4, FieldSet, JITParticle, ParticleFile, ParticleSet, ScipyParticle\n'), ((1301...
#!/usr/bin/env python3 # Train a convolutional neural network to recognize good and bad coffee beans. # # Based on the InceptionV3 model and weights, with fine tuning following along "Fine-tune InceptionV3 on a new set of # classes" in https://keras.io/applications/#usage-examples-for-image-classification-models # # F...
[ "keras.preprocessing.image.ImageDataGenerator", "numpy.random.seed", "keras.optimizers.SGD", "keras.backend.set_session", "keras.models.Model", "tensorflow.set_random_seed", "keras.layers.GlobalAveragePooling2D", "tensorflow.ConfigProto", "keras.layers.Dense", "random.seed", "keras.applications....
[((1622, 1640), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (1636, 1640), True, 'import numpy as np\n'), ((1714, 1728), 'random.seed', 'rn.seed', (['(12345)'], {}), '(12345)\n', (1721, 1728), True, 'import random as rn\n'), ((1902, 1980), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'intra_op_...
import numpy as np from dgl import DGLGraph from rdkit import Chem from rdkit.Chem import rdMolDescriptors as rdDesc from utils import one_of_k_encoding_unk, one_of_k_encoding def get_atom_features(atom, stereo, features, explicit_H=False): """ Method that computes atom level features from rdkit atom object ...
[ "utils.one_of_k_encoding_unk", "dgl.DGLGraph", "numpy.array", "rdkit.Chem.FindMolChiralCenters", "rdkit.Chem.rdMolDescriptors.GetFeatureInvariants", "rdkit.Chem.MolFromSmiles" ]
[((1613, 1636), 'numpy.array', 'np.array', (['atom_features'], {}), '(atom_features)\n', (1621, 1636), True, 'import numpy as np\n'), ((2259, 2279), 'numpy.array', 'np.array', (['bond_feats'], {}), '(bond_feats)\n', (2267, 2279), True, 'import numpy as np\n'), ((2557, 2567), 'dgl.DGLGraph', 'DGLGraph', ([], {}), '()\n'...
import os, sys, json, time, io, random from base64 import b64decode import numpy as np from PIL import Image import tensorflow as tf import tensorflow.keras.backend as K from tensorflow.keras.models import Model from tensorflow.keras.preprocessing import image from tensorflow.keras.layers import Input,Flatten,Lambda,De...
[ "tensorflow.keras.layers.Dense", "tensorflow.keras.applications.resnet_v2.ResNet50V2", "numpy.argmax", "tensorflow.keras.preprocessing.image.img_to_array", "numpy.expand_dims", "base64.b64decode", "tensorflow.keras.models.Model", "tensorflow.keras.preprocessing.image.load_img", "tensorflow.keras.bac...
[((1524, 1542), 'tensorflow.keras.layers.Input', 'Input', (['input_shape'], {}), '(input_shape)\n', (1529, 1542), False, 'from tensorflow.keras.layers import Input, Flatten, Lambda, Dense\n'), ((1554, 1624), 'tensorflow.keras.applications.resnet_v2.ResNet50V2', 'ResNet50V2', ([], {'include_top': '(False)', 'weights': '...
from core.util_classes.viewer import OpenRAVEViewer from core.util_classes.openrave_body import OpenRAVEBody from core.util_classes import robot_predicates from core.util_classes.items import Item from core.util_classes.robots import Robot from functools import reduce import core.util_classes.baxter_constants as const...
[ "numpy.random.random_sample", "math.atan2", "ipdb.set_trace", "numpy.allclose", "core.util_classes.openrave_body.OpenRAVEBody.transform_from_obj_pose", "numpy.linalg.norm", "sco_py.expr.Expr", "numpy.round", "numpy.multiply", "numpy.linspace", "functools.reduce", "numpy.hstack", "core.util_c...
[((1709, 1761), 'core.util_classes.openrave_body.OpenRAVEBody.transform_from_obj_pose', 'OpenRAVEBody.transform_from_obj_pose', (['pose', 'rotation'], {}), '(pose, rotation)\n', (1745, 1761), False, 'from core.util_classes.openrave_body import OpenRAVEBody\n'), ((2158, 2171), 'numpy.array', 'np.array', (['pos'], {}), '...
# ------------------------------------------------------------------------------ # IMPORTS # ------------------------------------------------------------------------------ from sys import version_info from sys import path as syspath from os import path import json _CURRENT_DIRECTORY =...
[ "numpy.abs", "json.loads", "numpy.copy", "cv2.cvtColor", "packaging.version.parse", "click.option", "util.animateImages", "click.command", "urllib.request.urlretrieve", "util.install", "numpy.rint", "numpy.array", "numpy.round", "os.path.join", "cv2.cornerHarris", "util.load_image_RGB"...
[((2870, 2914), 'os.path.join', 'path.join', (['_CURRENT_DIRECTORY', '"""../../data/"""'], {}), "(_CURRENT_DIRECTORY, '../../data/')\n", (2879, 2914), False, 'from os import path\n'), ((2962, 3001), 'os.path.join', 'path.join', (['_PATH_2_DATA', '_IMG_ORIG_NAME'], {}), '(_PATH_2_DATA, _IMG_ORIG_NAME)\n', (2971, 3001), ...
""" ==================== Experiment Control ==================== Handles experiment specifications for `paper_experiments.py` """ import os import argparse import numpy as np import math # vivarium-core imports from vivarium.library.units import units # directories from vivarium_cell.plots.multibody_physics import ...
[ "vivarium.plots.topology.plot_compartment_topology", "numpy.random.uniform", "vivarium_cell.plots.multibody_physics.plot_tags", "argparse.ArgumentParser", "os.makedirs", "os.path.exists", "vivarium_cell.plots.multibody_physics.plot_snapshots", "os.path.join", "vivarium.plots.agents_multigen.plot_age...
[((2128, 2178), 'vivarium.plots.agents_multigen.plot_agents_multigen', 'plot_agents_multigen', (['data', 'plot_settings', 'out_dir'], {}), '(data, plot_settings, out_dir)\n', (2148, 2178), False, 'from vivarium.plots.agents_multigen import plot_agents_multigen\n'), ((3057, 3124), 'argparse.ArgumentParser', 'argparse.Ar...
# Zooplankton community model III # Two stage-structured consumer species feeding on two resources # For units and references, see Appendix S2, Table 2 # Created by <NAME> (2020) import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # Body masses (ng dry weight): B_J1 = 100 # juve...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "scipy.integrate.odeint", "matplotlib.pyplot.legend", "numpy.transpose", "matplotlib.pyplot.figure", "numpy.array", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((7363, 7409), 'numpy.array', 'np.array', (['[0.01, 0.01, 0.01, 0.01, 0.01, 0.01]'], {}), '([0.01, 0.01, 0.01, 0.01, 0.01, 0.01])\n', (7371, 7409), True, 'import numpy as np\n'), ((7428, 7453), 'numpy.linspace', 'np.linspace', (['(0)', '(300)', '(1000)'], {}), '(0, 300, 1000)\n', (7439, 7453), True, 'import numpy as n...
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import json import argparse from nbodykit.lab import * from pmesh.pm import ParticleMesh from matplotlib.gridspec import GridSpec dk = 0.02 c = plt.rcParams['axes.prop_cycle'].by_key()['color'] def plot_loss(path): loss_t...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.loglog", "matplotlib.pyplot.yscale", "matplotlib.rc", "numpy.abs", "argparse.ArgumentParser", "numpy.nan_to_num", "numpy.load", "matplotlib.pyplot.subplot2grid", "numpy.einsum", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "matpl...
[((37, 58), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (51, 58), False, 'import matplotlib\n'), ((327, 362), 'numpy.loadtxt', 'np.loadtxt', (["(path + '/trainLoss.txt')"], {}), "(path + '/trainLoss.txt')\n", (337, 362), True, 'import numpy as np\n'), ((376, 409), 'numpy.loadtxt', 'np.loadtxt'...
import numpy as np import sys import networkx as nx from sklearn.metrics import pairwise_distances from scipy import stats from shapely.geometry import Polygon from scipy.spatial import ConvexHull import multiprocessing as mp import ctypes #HELPERS: from sklearn.preprocessing import LabelEncoder from sklearn.preproces...
[ "networkx.shortest_path_length", "numpy.fill_diagonal", "numpy.multiply", "networkx.from_numpy_matrix", "scipy.stats.zscore", "sklearn.metrics.pairwise_distances", "sklearn.preprocessing.OneHotEncoder", "numpy.zeros", "sklearn.preprocessing.LabelEncoder", "sys.intern", "networkx.draw", "numpy....
[((408, 424), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (416, 424), True, 'import numpy as np\n'), ((445, 459), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (457, 459), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((539, 566), 'sklearn.preprocessing.OneHotEncod...
import sys import os import numpy as np from pyhrt.utils import bh_predictions, tpr, fdr, pretty_str def add_if_finished(trial, all_p_values, all_tpr, all_fdr, truth, fdr_threshold): if not np.any(np.isnan(all_p_values[trial])): predictions = bh_predictions(all_p_values[trial], fdr_threshold) all_...
[ "numpy.full", "numpy.load", "numpy.copy", "os.path.exists", "pyhrt.utils.tpr", "pyhrt.utils.fdr", "numpy.isnan", "numpy.array", "sys.stdout.flush", "numpy.loadtxt", "pyhrt.utils.bh_predictions", "numpy.nanmean" ]
[((638, 686), 'numpy.array', 'np.array', (['[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]'], {}), '([0, 5, 10, 15, 20, 25, 30, 35, 40, 45])\n', (646, 686), True, 'import numpy as np\n'), ((1492, 1561), 'numpy.full', 'np.full', (['(ntrials, P, intervals.shape[0], intervals.shape[0])', 'np.nan'], {}), '((ntrials, P, intervals.s...
import hetu as ht from hetu import init from hetu import onnx as ax import onnxruntime as rt import numpy as np import onnx from onnx_tf.backend import prepare import tensorflow.compat.v1 as tf import argparse import six.moves.cPickle as pickle import gzip import os import pdb import ctypes import time batch_size...
[ "hetu.cpu", "hetu.init.zeros", "hetu.concat_op", "numpy.random.RandomState", "hetu.Variable", "onnxruntime.InferenceSession", "onnx_tf.backend.prepare", "hetu.slice_op", "hetu.relu_op", "hetu.init.random_normal", "hetu.matmul_op", "hetu.onnx.hetu2onnx.export", "onnx.load", "hetu.Executor" ...
[((415, 424), 'hetu.cpu', 'ht.cpu', (['(0)'], {}), '(0)\n', (421, 424), True, 'import hetu as ht\n'), ((660, 724), 'hetu.init.random_normal', 'init.random_normal', (['(diminput, dimhidden)'], {'stddev': '(0.1)', 'name': '"""W1"""'}), "((diminput, dimhidden), stddev=0.1, name='W1')\n", (678, 724), False, 'from hetu impo...
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=missing-docstring,invalid-name import timeit import tvm import tvm.testing from tvm import te import numpy print("# Manually Optimizing Matrix Multiplication with TE") print("\n## Preparation and Performance Baseline") # The size of the matrix # (M, ...
[ "tvm.te.reduce_axis", "tvm.te.placeholder", "numpy.zeros", "tvm.build", "tvm.device", "tvm.te.compute", "tvm.te.create_schedule", "tvm.target.Target", "tvm.lower", "numpy.random.rand", "tvm.tir.indexmod", "tvm.te.sum" ]
[((1126, 1171), 'tvm.target.Target', 'tvm.target.Target', ([], {'target': 'target', 'host': '"""llvm"""'}), "(target=target, host='llvm')\n", (1143, 1171), False, 'import tvm\n'), ((1178, 1209), 'tvm.device', 'tvm.device', (['target.kind.name', '(0)'], {}), '(target.kind.name, 0)\n', (1188, 1209), False, 'import tvm\n'...
# Copyright 2014 Diamond Light Source Ltd. # # 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.expand_dims" ]
[((1701, 1734), 'numpy.expand_dims', 'np.expand_dims', (['proj_data'], {'axis': '(1)'}), '(proj_data, axis=1)\n', (1715, 1734), True, 'import numpy as np\n')]
""" IDEAS: 1. start with simplest: use padded sequence from encoder to decoder 2. group sequence of same lengths (so that the model no needa encode and decode padder) """ import numpy as np import torch import torch.nn as nn from src.common.logger import get_logger logger = get_logger(__name__) class LSTMAutoEncode...
[ "torch.nn.Dropout", "src.common.logger.get_logger", "torch.nn.Linear", "torch.zeros", "torch.nn.LeakyReLU", "torch.nn.LSTM", "numpy.sqrt" ]
[((277, 297), 'src.common.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (287, 297), False, 'from src.common.logger import get_logger\n'), ((787, 801), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', ([], {}), '()\n', (799, 801), True, 'import torch.nn as nn\n'), ((1332, 1405), 'torch.nn.LSTM', 'nn.LSTM', ...
""" Example of ordinary Monte Carlo rejection sampling integrating circle area """ import numpy as np import scipy.stats from matplotlib.colors import Normalize from pylab import *; ion() import probayes as pb # PARAMETERS radius = 1. set_size = {-10000} # SETUP CIRCLE FUNCTION AND RVs def inside(x, y): return np....
[ "numpy.logical_not", "numpy.min", "numpy.mean", "numpy.array", "numpy.max", "probayes.RV" ]
[((554, 574), 'probayes.RV', 'pb.RV', (['"""x"""', 'xy_range'], {}), "('x', xy_range)\n", (559, 574), True, 'import probayes as pb\n'), ((579, 599), 'probayes.RV', 'pb.RV', (['"""y"""', 'xy_range'], {}), "('y', xy_range)\n", (584, 599), True, 'import probayes as pb\n'), ((778, 808), 'probayes.RV', 'pb.RV', (['"""coef""...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import logging import numpy as np import sys import torch import torch.nn.functional as F import kaldi_io from .. import FairseqDa...
[ "kaldi_io.read_mat", "torch.LongTensor", "pdb.Pdb.interaction", "numpy.lexsort", "numpy.random.randint", "torch.BoolTensor", "logging.getLogger", "torch.from_numpy" ]
[((336, 363), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (353, 363), False, 'import logging\n'), ((1227, 1257), 'numpy.random.randint', 'np.random.randint', (['(0)', '(diff + 1)'], {}), '(0, diff + 1)\n', (1244, 1257), True, 'import numpy as np\n'), ((4452, 4476), 'kaldi_io.read_mat',...
#taken from: #https://medium.com/sigmoid/a-brief-introduction-to-gans-and-how-to-code-them-2620ee465c30 #https://github.com/sarvasvkulpati/intro_to_gans/blob/master/intro_to_gans.ipynb import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm #progress bar from keras.layers import Input from keras.mode...
[ "os.mkdir", "numpy.ones", "keras.models.Model", "matplotlib.pyplot.figure", "keras.layers.Input", "shutil.rmtree", "os.path.join", "matplotlib.pyplot.tight_layout", "keras.initializers.RandomNormal", "utils.keras_persistence.all_inside.load", "matplotlib.pyplot.imshow", "os.path.exists", "os...
[((581, 608), 'keras.optimizers.Adam', 'Adam', ([], {'lr': '(0.0002)', 'beta_1': '(0.5)'}), '(lr=0.0002, beta_1=0.5)\n', (585, 608), False, 'from keras.optimizers import Adam\n'), ((705, 717), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (715, 717), False, 'from keras.models import Model, Sequential\n'), ...
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np plt.style.use('ggplot') data = np.loadtxt("S.txt", delimiter=",") elements = data[:,0] smaxp = data[:,1]/1e6 # MPa seqv = data[:,2]/1e6 # MPa plt.plot(elements, smaxp, "r-*", label="Max. Principal") plt.plot(elements, seqv, "g-x", label="Mises...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.style.use", "numpy.loadtxt", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((75, 98), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (88, 98), True, 'import matplotlib.pyplot as plt\n'), ((107, 141), 'numpy.loadtxt', 'np.loadtxt', (['"""S.txt"""'], {'delimiter': '""","""'}), "('S.txt', delimiter=',')\n", (117, 141), True, 'import numpy as np\n'), ((21...
# -*- coding: utf-8 -*- # coding=utf-8 # Copyright 2019 The SGNMT Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
[ "copy.deepcopy", "cam.sgnmt.utils.argmax", "heapq.heappush", "heapq.heapify", "heapq.heappop", "logging.fatal", "numpy.exp", "cam.sgnmt.decoding.core.PartialHypothesis" ]
[((5196, 5238), 'numpy.exp', 'np.exp', (['[(-c) for c, _ in self.open_nodes]'], {}), '([(-c) for c, _ in self.open_nodes])\n', (5202, 5238), True, 'import numpy as np\n'), ((5517, 5541), 'heapq.heappop', 'heappop', (['self.open_nodes'], {}), '(self.open_nodes)\n', (5524, 5541), False, 'from heapq import heappop, heappu...
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import itertools from itertools import product from itertools import izip_longest import copy from glob import glob import six from six import string_types, iteritems import yaml import json import jsonpickle jsonpickle.set_encoder_options('json', sort...
[ "copy.deepcopy", "logging.FileHandler", "logging.basicConfig", "itertools.izip_longest", "numpy.dtype", "bakfu.Chain.load_chain", "logging.Formatter", "jsonpickle.dumps", "jsonpickle.set_encoder_options", "deepdiff.DeepDiff", "functools.lru_cache", "six.iteritems", "scipy.optimize.basinhoppi...
[((277, 341), 'jsonpickle.set_encoder_options', 'jsonpickle.set_encoder_options', (['"""json"""'], {'sort_keys': '(True)', 'indent': '(4)'}), "('json', sort_keys=True, indent=4)\n", (307, 341), False, 'import jsonpickle\n'), ((446, 486), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(...
# %% [markdown] ### Library # %% import platform import tensorflow as tf import numpy as np import matplotlib import matplotlib.pyplot as plt # %% print('Python version:', platform.python_version()) print('Tensorflow Version:', tf.__version__) print('Matplotlib Version:', matplotlib.__version__) # %% [markdown] ###...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.dstack", "platform.python_version", "matplotlib.pyplot.show", "numpy.abs", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "tensorflow.keras.datasets.cifar10.load_data", "matplotlib.pyplot.figure", "numpy.fft.fftshift", "nu...
[((374, 411), 'tensorflow.keras.datasets.cifar10.load_data', 'tf.keras.datasets.cifar10.load_data', ([], {}), '()\n', (409, 411), True, 'import tensorflow as tf\n'), ((175, 200), 'platform.python_version', 'platform.python_version', ([], {}), '()\n', (198, 200), False, 'import platform\n'), ((659, 689), 'matplotlib.pyp...
#!/usr/bin/python #------------------------------------------------------------------------------ # Name: singleJob.py # Author: <NAME>, 20150205 # Last Modified: 20150309 #This is a follow-up to the lookThresh.py script; it reads the top_jobs.txt list # and analyses each candidate job for stats etc...
[ "numpy.array", "string.split", "numpy.sum", "os.getcwd" ]
[((2674, 2687), 'numpy.sum', 'np.sum', (['yHist'], {}), '(yHist)\n', (2680, 2687), True, 'import numpy as np\n'), ((1724, 1744), 'numpy.array', 'np.array', (['singleTwoF'], {}), '(singleTwoF)\n', (1732, 1744), True, 'import numpy as np\n'), ((1746, 1766), 'numpy.array', 'np.array', (['singleFreq'], {}), '(singleFreq)\n...
import pyscreenshot as ImageGrab import numpy as np import cv2 import win32api from PIL import Image from pytesseract import * from time import time import random class ScreenInfo: def __init__(self, coordinates): # Define the box where the screenshot shall be taken self._coordinates = tuple(coordi...
[ "random.randint", "cv2.medianBlur", "cv2.waitKey", "cv2.cvtColor", "pyscreenshot.grab", "time.time", "numpy.array", "PIL.Image.fromarray", "cv2.destroyAllWindows", "cv2.resize", "win32api.GetCursorPos" ]
[((3052, 3066), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (3063, 3066), False, 'import cv2\n'), ((3071, 3094), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3092, 3094), False, 'import cv2\n'), ((536, 559), 'win32api.GetCursorPos', 'win32api.GetCursorPos', ([], {}), '()\n', (557, 559)...
import numpy as np import speaker_verification_handler class IvectorExtractor(speaker_verification_handler.SpeakerVerificationHandler): """ """ base_requested_output_names = ['attractor'] def __init__(self, conf, evalconf, dataconf, store_dir, exp_dir, task): super(IvectorExtractor, self).__init__(conf, evalc...
[ "numpy.linalg.norm" ]
[((1075, 1129), 'numpy.linalg.norm', 'np.linalg.norm', (['handled_output'], {'axis': '(-1)', 'keepdims': '(True)'}), '(handled_output, axis=-1, keepdims=True)\n', (1089, 1129), True, 'import numpy as np\n')]
import torch import numpy as np from torch import nn from torchvision import transforms class PreActLeNet(nn.Module): def __init__(self, scale=25, num_classes=10): super().__init__() self.scale = scale self.sizes = self.scale * np.array([1, 2, 16]) self.fc_1_size...
[ "torch.nn.ReLU", "torch.nn.Conv2d", "numpy.array", "torch.nn.Linear", "torch.nn.MaxPool2d", "torchvision.transforms.Normalize", "torchvision.transforms.ToTensor" ]
[((276, 296), 'numpy.array', 'np.array', (['[1, 2, 16]'], {}), '([1, 2, 16])\n', (284, 296), True, 'import numpy as np\n'), ((401, 431), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', 'self.sizes[0]', '(5)'], {}), '(1, self.sizes[0], 5)\n', (410, 431), False, 'from torch import nn\n'), ((446, 455), 'torch.nn.ReLU', 'nn.ReLU'...
# Copyright (C) 2019 Project AGI # # 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 writi...
[ "tensorflow.reduce_sum", "pagi.utils.tf_utils.tf_do_training", "tensorflow.maximum", "tensorflow.reshape", "tensorflow.divide", "numpy.prod", "tensorflow.nn.softmax", "tensorflow.add_n", "pagi.utils.tf_utils.tf_create_optimizer", "tensorflow.placeholder_with_default", "tensorflow.train.get_or_cr...
[((2184, 2703), 'tensorflow.contrib.training.HParams', 'tf.contrib.training.HParams', ([], {'training_interval': '[0, -1]', 'loss_type': '"""cross-entropy"""', 'optimize': '"""accuracy"""', 'optimizer': '"""adam"""', 'learning_rate': '(0.0005)', 'nonlinearity': "['leaky-relu']", 'bias': '(True)', 'batch_size': '(80)', ...
# coding=utf-8 # Author: <NAME> Cruz <<EMAIL>> # # License: BSD 3 clause import numpy as np from deslib.dcs.base import DCS # This method works similarly to the LCA technique. The only difference is that it uses # the scores obtained by the base classifiers as well as the distance between the test sample # ...
[ "numpy.zeros", "numpy.random.RandomState" ]
[((4236, 4259), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (4257, 4259), True, 'import numpy as np\n'), ((6581, 6609), 'numpy.zeros', 'np.zeros', (['self.n_classifiers'], {}), '(self.n_classifiers)\n', (6589, 6609), True, 'import numpy as np\n')]
#! /usr/bin/env python # Example scipt to show integration of a 2D spectrum import nmrglue as ng import numpy as np # read in the data from a NMRPipe file dic,data = ng.pipe.read("../../common_data/2d_pipe/test.ft2") # read in the integration limits peak_list = np.recfromtxt("limits.in") # prepare the output file f...
[ "numpy.recfromtxt", "nmrglue.pipe.read" ]
[((168, 218), 'nmrglue.pipe.read', 'ng.pipe.read', (['"""../../common_data/2d_pipe/test.ft2"""'], {}), "('../../common_data/2d_pipe/test.ft2')\n", (180, 218), True, 'import nmrglue as ng\n'), ((265, 291), 'numpy.recfromtxt', 'np.recfromtxt', (['"""limits.in"""'], {}), "('limits.in')\n", (278, 291), True, 'import numpy ...
import math import numpy as np from gym import spaces from envs.DishRackEnv import rack_lower, rack_upper from reality.RealEnv import RealEnv class RealDishRackEnv(RealEnv): observation_space = spaces.Box(np.array([-3.] * 7 + [-math.inf] * 3 + [rack_lower[2]]), np.array([3.] *...
[ "numpy.array" ]
[((213, 269), 'numpy.array', 'np.array', (['([-3.0] * 7 + [-math.inf] * 3 + [rack_lower[2]])'], {}), '([-3.0] * 7 + [-math.inf] * 3 + [rack_lower[2]])\n', (221, 269), True, 'import numpy as np\n'), ((305, 359), 'numpy.array', 'np.array', (['([3.0] * 7 + [math.inf] * 3 + [rack_upper[2]])'], {}), '([3.0] * 7 + [math.inf]...
from __future__ import division, print_function import os import sys import numpy as np from PIL import Image import keras from keras.models import Sequential, load_model from keras.layers import (Conv2D, MaxPooling2D, Cropping2D, Flatten, Dense, Dropout) from keras.layers.advanced_activations...
[ "sys.stdout.write", "keras.preprocessing.image.ImageDataGenerator", "keras.models.load_model", "keras.optimizers.Adadelta", "numpy.sum", "numpy.random.seed", "keras.layers.Cropping2D", "os.path.isfile", "numpy.mean", "numpy.arange", "sys.stdout.flush", "keras.constraints.maxnorm", "keras.lay...
[((930, 998), 'numpy.array', 'np.array', (['[x0 >= 0, x1 <= img_shape[0], y0 >= 0, y1 <= img_shape[1]]'], {}), '([x0 >= 0, x1 <= img_shape[0], y0 >= 0, y1 <= img_shape[1]])\n', (938, 998), True, 'import numpy as np\n'), ((1137, 1150), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (1145, 1150), True, 'import nump...
import scipy.integrate as integrate import numpy as np import math import warnings warnings.filterwarnings('ignore') from .wave_func import Y def angular_matrix_element( l1: int, m1: int, l2: int, m2: int, op=lambda theta, phi: 1 ) -> float: ''' Matrix element of an operator (written in the coor...
[ "numpy.sin", "warnings.filterwarnings" ]
[((83, 116), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (106, 116), False, 'import warnings\n'), ((899, 912), 'numpy.sin', 'np.sin', (['theta'], {}), '(theta)\n', (905, 912), True, 'import numpy as np\n')]
import numpy as np from revgraph.core.functions.base.generic_function import GenericFunction, gradient_wrt_arg class Conv2D(GenericFunction): """ Reference: This implementation is hugely based on the repository https://www.github.com/renmengye/np-conv2d """ def apply(self, a, b, padding='VALID', ...
[ "numpy.pad", "numpy.ceil", "numpy.floor", "revgraph.core.functions.base.generic_function.gradient_wrt_arg", "numpy.zeros", "numpy.transpose" ]
[((982, 1001), 'revgraph.core.functions.base.generic_function.gradient_wrt_arg', 'gradient_wrt_arg', (['(0)'], {}), '(0)\n', (998, 1001), False, 'from revgraph.core.functions.base.generic_function import GenericFunction, gradient_wrt_arg\n'), ((2340, 2359), 'revgraph.core.functions.base.generic_function.gradient_wrt_ar...
"""K-means clustering""" # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # License: BSD 3 clause import warnings import num...
[ "numpy.empty", "scipy.sparse.issparse", "sklearn_import.utils.validation.check_random_state", "numpy.ones", "numpy.mean", "sklearn_import.utils.validation.check_is_fitted", "sklearn_import.cluster._k_means._assign_labels_csr", "numpy.var", "sklearn_import.metrics.pairwise.pairwise_distances_argmin_m...
[((2339, 2388), 'numpy.empty', 'np.empty', (['(n_clusters, n_features)'], {'dtype': 'X.dtype'}), '((n_clusters, n_features), dtype=X.dtype)\n', (2347, 2388), True, 'import numpy as np\n'), ((2867, 2881), 'scipy.sparse.issparse', 'sp.issparse', (['X'], {}), '(X)\n', (2878, 2881), True, 'import scipy.sparse as sp\n'), ((...
import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.animation as animation from skimage.metrics import structural_similarity as ssim from multiprocessing import Pool from functools import partial import os k = 0.01 dt = 0.02 def spread_one_colour(image, g, dt0, dim, ld=0.01): """ ...
[ "matplotlib.pyplot.title", "functools.partial", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "os.path.join", "matplotlib.pyplot.plot", "matplotlib.pyplot.imshow", "matplotlib.pyplot.legend", "cv2.imread", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.exp", "multiproces...
[((808, 829), 'numpy.exp', 'np.exp', (['(-(x * k) ** 2)'], {}), '(-(x * k) ** 2)\n', (814, 829), True, 'import numpy as np\n'), ((1057, 1071), 'numpy.gradient', 'np.gradient', (['x'], {}), '(x)\n', (1068, 1071), True, 'import numpy as np\n'), ((1583, 1598), 'numpy.gradient', 'np.gradient', (['xs'], {}), '(xs)\n', (1594...
# # import sklearn as sk import cv2 import RLpDefinitions as definitions import numpy as np import matplotlib.pyplot as plt from imutils import paths import pickle import os import RDetectPlates as DetPlt import RLpPreprocess as preprocess from sklearn.neural_network import MLPClassifier def datacll(grayplt, plate):...
[ "imutils.paths.list_images", "pickle.dump", "matplotlib.pyplot.close", "matplotlib.pyplot.imshow", "cv2.moments", "RLpPreprocess.kmeans_seg", "RDetectPlates.RDetectPlates", "os.path.exists", "cv2.threshold", "cv2.imread", "pickle.load", "numpy.array", "sklearn.neural_network.MLPClassifier", ...
[((3877, 4032), 'sklearn.neural_network.MLPClassifier', 'MLPClassifier', ([], {'hidden_layer_sizes': '(20, 3)', 'max_iter': '(150)', 'alpha': '(0.0001)', 'solver': '"""sgd"""', 'verbose': '(10)', 'tol': '(0.0001)', 'random_state': '(1)', 'learning_rate_init': '(0.1)'}), "(hidden_layer_sizes=(20, 3), max_iter=150, alpha...
"""An example showing a simple control loop""" from os import path from fractions import Fraction import numpy as np # pylint: disable=import-error import matplotlib.pyplot as plt # pylint: disable=import-error from sdf4sim import cs, sdf, autoconfig def controller_parameters(K, T1, Ts): """The controller para...
[ "numpy.abs", "numpy.sum", "sdf4sim.sdf.Dst", "numpy.sin", "sdf4sim.autoconfig.null_jacobi_initial_tokens", "numpy.exp", "sdf4sim.cs.time_expired", "fractions.Fraction", "os.path.join", "sdf4sim.sdf.InputPort", "sdf4sim.cs.execute", "os.path.abspath", "sdf4sim.cs.Src", "numpy.linspace", "...
[((2315, 2342), 'numpy.sqrt', 'np.sqrt', (['(KR * K / (TI * Ts))'], {}), '(KR * K / (TI * Ts))\n', (2322, 2342), True, 'import numpy as np\n'), ((2524, 2596), 'numpy.arctan', 'np.arctan', (['(TI * (1 - KR) * omegad / (TI * (1 - KR) * omegan * zeta - KR))'], {}), '(TI * (1 - KR) * omegad / (TI * (1 - KR) * omegan * zeta...
import os import random import pickle import torch import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as mcolors from argparse import ArgumentParser from utils.misc import * from model.cartpole import * from settings.cartpole import * parser = ArgumentParser() parser.add_argument("-r", "--rep...
[ "numpy.zeros_like", "argparse.ArgumentParser", "os.path.join", "numpy.logical_and", "numpy.zeros", "matplotlib.pyplot.style.use", "pickle.load", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.pyplot.cm.get_cmap", "torch.tensor" ]
[((271, 287), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (285, 287), False, 'from argparse import ArgumentParser\n'), ((1290, 1336), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""utils/qb-common_dark.mplstyle"""'], {}), "('utils/qb-common_dark.mplstyle')\n", (1303, 1336), True, 'import matpl...
# SPDX-License-Identifier: MIT # Copyright (c) 2021 ETH Zurich, <NAME> import numpy as np class ButcherTableau(object): def __init__(self, a, b): self.a = a self.b = b self.c = np.sum(a, axis=1) self.stages = a.shape[0] def __repr__(self): return "".join([type(self).__...
[ "numpy.zeros", "numpy.sum" ]
[((207, 224), 'numpy.sum', 'np.sum', (['a'], {'axis': '(1)'}), '(a, axis=1)\n', (213, 224), True, 'import numpy as np\n'), ((638, 668), 'numpy.zeros', 'np.zeros', (['(1, self.stages - i)'], {}), '((1, self.stages - i))\n', (646, 668), True, 'import numpy as np\n')]
""" ------------------------------------------------------------------ FILE: _cluster_report.py AUTHOR: <NAME> DATE: 21-05-2020 ------------------------------------------------------------------ This file is an extension of the cluster.Cluster class. It provides class methods for performing basic analysis procedure...
[ "numpy.zeros_like", "numpy.sum", "numpy.subtract", "numpy.ndenumerate", "numpy.power", "numpy.zeros", "unyt.gravitational_constant.in_units", "numpy.append", "numpy.sort", "numpy.linalg.norm", "numpy.where", "numpy.array", "warnings.warn", "numpy.concatenate", "numpy.sqrt" ]
[((1057, 1128), 'unyt.gravitational_constant.in_units', 'gravitational_constant.in_units', (['"""(1e6*pc)*(km/s)**2/(1e10*solar_mass)"""'], {}), "('(1e6*pc)*(km/s)**2/(1e10*solar_mass)')\n", (1088, 1128), False, 'from unyt import hydrogen_mass, boltzmann_constant, gravitational_constant, parsec, solar_mass\n'), ((3812,...
import numpy as np from rubin_sim.maf.utils import m52snr import rubin_sim.maf.metrics as metrics import os from rubin_sim.utils import uniformSphere import rubin_sim.maf.slicers as slicers import glob from rubin_sim.photUtils import Dust_values from rubin_sim.data import get_data_dir __all__ = ['Tde_lc', 'TdePopMetri...
[ "numpy.random.uniform", "numpy.size", "rubin_sim.data.get_data_dir", "os.path.join", "numpy.abs", "numpy.unique", "numpy.zeros", "numpy.genfromtxt", "numpy.where", "rubin_sim.maf.slicers.UserPointsSlicer", "numpy.interp", "rubin_sim.utils.uniformSphere", "rubin_sim.photUtils.Dust_values" ]
[((6399, 6433), 'rubin_sim.utils.uniformSphere', 'uniformSphere', (['n_events'], {'seed': 'seed'}), '(n_events, seed=seed)\n', (6412, 6433), False, 'from rubin_sim.utils import uniformSphere\n'), ((6451, 6508), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 't_start', 'high': 't_end', 'size': 'n_events'}), '...
""" ====================== Basic Usage of powspec ====================== """ import matplotlib.pyplot as plt # sphinx_gallery_thumbnail_path = '_static/demo.png' import astropy.units as u from astropy.convolution import Gaussian2DKernel from astropy.visualization import quantity_support import numpy as np from powsp...
[ "astropy.convolution.Gaussian2DKernel", "numpy.random.uniform", "astropy.units.Quantity", "matplotlib.pyplot.show", "numpy.sum", "astropy.visualization.quantity_support", "matplotlib.pyplot.figure", "numpy.max", "powspec.powspec.power_spectral_density", "numpy.exp", "powspec.utils.generator.gen_...
[((425, 443), 'astropy.visualization.quantity_support', 'quantity_support', ([], {}), '()\n', (441, 443), False, 'from astropy.visualization import quantity_support\n'), ((1031, 1043), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1041, 1043), True, 'import matplotlib.pyplot as plt\n'), ((1381, 1391), 'm...
from flask import Flask from flask import Response from flask_cors import CORS import json from os import path import pandas as pd import numpy as np app = Flask(__name__) CORS(app) here = path.abspath(path.dirname(__file__)) print(here) data_path = path.join(here, 'data', 'iris.csv') iris = pd.read_csv(data_path)...
[ "flask_cors.CORS", "pandas.read_csv", "os.path.dirname", "flask.Flask", "json.dumps", "numpy.random.choice", "os.path.join" ]
[((158, 173), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (163, 173), False, 'from flask import Flask\n'), ((174, 183), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (178, 183), False, 'from flask_cors import CORS\n'), ((254, 289), 'os.path.join', 'path.join', (['here', '"""data"""', '"""iris.csv...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import os class ScannetDatasetConfig(object): def __init__(self, meta_data_path): self.max_num_points = 50000 ...
[ "numpy.stack", "numpy.transpose", "numpy.zeros", "numpy.max", "numpy.array", "os.path.join", "numpy.concatenate" ]
[((4915, 4941), 'numpy.zeros', 'np.zeros', (['(dx.shape[0], 4)'], {}), '((dx.shape[0], 4))\n', (4923, 4941), True, 'import numpy as np\n'), ((4954, 4980), 'numpy.zeros', 'np.zeros', (['(dx.shape[0], 4)'], {}), '((dx.shape[0], 4))\n', (4962, 4980), True, 'import numpy as np\n'), ((5367, 5416), 'numpy.stack', 'np.stack',...
#!/usr/bin/env python # coding: utf-8 # In[1]: # %load load_packages.py from __future__ import absolute_import, division, print_function # TensorFlow and tf.keras import tensorflow as tf from tensorflow import keras # Helper libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd import cv...
[ "tensorflow.keras.layers.Dense", "numpy.argmax", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.figure", "cv2.imshow", "numpy.unique", "tensorflow.keras.layers.Flatten", "random.randint", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "matplotlib.pyplot.colorbar", "cv2...
[((459, 499), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""'}), "(action='ignore')\n", (482, 499), False, 'import warnings\n'), ((3162, 3266), 'sklearn.model_selection.train_test_split', 'train_test_split', (['train_images', 'train_labels'], {'stratify': 'train_labels', 'test_size'...
import sys print(sys.path) import numpy as np import matplotlib.pyplot as plt import pandas as pd import time from utils.MCIM import spinVis from utils.MCIM import spinLattice from utils.MCIM import metropolisAlgorithm from utils.MCIM import torusPlotLine def routine(p): # beta_array = np.linspace(p.T_MIN, p.T_M...
[ "pandas.DataFrame", "utils.MCIM.metropolisAlgorithm", "utils.MCIM.spinLattice", "utils.MCIM.spinVis", "matplotlib.pyplot.close", "numpy.empty", "time.time", "numpy.linspace", "matplotlib.pyplot.subplots", "pandas.concat", "matplotlib.pyplot.savefig" ]
[((444, 464), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'd'}), '(data=d)\n', (456, 464), True, 'import pandas as pd\n'), ((510, 555), 'utils.MCIM.spinLattice', 'spinLattice', (['p.M', 'p.N', 'p.J', 'p.mu', '"""line"""', 'p.k'], {}), "(p.M, p.N, p.J, p.mu, 'line', p.k)\n", (521, 555), False, 'from utils.MCIM imp...
import numpy as np import pickle class TrendDetector: def __init__(self, config, decay=.99): self.model_path = config['model'] self.model = {} self.decay = decay def _compute_mean_std(self, history, window=28): """ Compute mean and standard deviation for historical da...
[ "numpy.array" ]
[((505, 538), 'numpy.array', 'np.array', (['history[-window - 1:-1]'], {}), '(history[-window - 1:-1])\n', (513, 538), True, 'import numpy as np\n')]
from typing import Union, Optional, Iterator, Iterable, Generator import numpy from anndata import AnnData from os import PathLike import os.path from pathlib import Path import scipy import pandas as pd import gzip import bz2 def anndata_from_expression_csv(filename: str, key: str, transpose: bool, top_n_rows: int =...
[ "pandas.read_csv", "numpy.transpose", "pathlib.Path", "scipy.sparse.csr_matrix", "numpy.array" ]
[((2461, 2495), 'pandas.read_csv', 'pd.read_csv', (['new_filename'], {'nrows': '(2)'}), '(new_filename, nrows=2)\n', (2472, 2495), True, 'import pandas as pd\n'), ((4329, 4343), 'pathlib.Path', 'Path', (['filename'], {}), '(filename)\n', (4333, 4343), False, 'from pathlib import Path\n'), ((7110, 7143), 'numpy.array', ...
#!/usr/bin/env python """ Convert simulation trial to LIBEOS format """ import os import numpy as np from glob import glob from builtins import chr from progressbar import ProgressBar, ETA, Bar ETHEMIS_FILE_EXTENSION = '.etm' class ETM(object): HEADER = b'EOS_ETHEMIS' PAD_VALUE = 0xFF ALIGNMENT = 4 V...
[ "numpy.load", "argparse.ArgumentParser", "os.path.basename", "os.path.isdir", "builtins.chr", "numpy.ravel", "progressbar.Bar", "progressbar.ETA", "numpy.max", "numpy.min", "numpy.array", "os.path.join" ]
[((2408, 2462), 'os.path.join', 'os.path.join', (['outputdir', '(base + ETHEMIS_FILE_EXTENSION)'], {}), '(outputdir, base + ETHEMIS_FILE_EXTENSION)\n', (2420, 2462), False, 'import os\n'), ((2511, 2529), 'numpy.load', 'np.load', (['inputfile'], {}), '(inputfile)\n', (2518, 2529), True, 'import numpy as np\n'), ((2766, ...
#-*- coding: utf-8 -*- import tensorflow as tf import numpy as np import re from lib import train_utils from konlpy.tag import Mecab class CAM2(object): def __init__(self, config): tf.reset_default_graph() self.sess = tf.Session() self.config = config self.is_training = False self.tokenizer = Mecab() s...
[ "tensorflow.reset_default_graph", "numpy.zeros", "tensorflow.Session", "lib.train_utils.create_or_load_model", "numpy.argsort", "numpy.mean", "numpy.array", "numpy.dot", "re.sub", "konlpy.tag.Mecab" ]
[((188, 212), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (210, 212), True, 'import tensorflow as tf\n'), ((227, 239), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (237, 239), True, 'import tensorflow as tf\n'), ((309, 316), 'konlpy.tag.Mecab', 'Mecab', ([], {}), '()\n', (314,...
import itertools from time import time from types import FunctionType from warnings import warn import numpy as np import pandas as pd from gplearn.fitness import _Fitness, weighted_pearson, weighted_spearman, mean_square_error, root_mean_square_error, \ log_loss, mean_absolute_error from gplearn.functions import ...
[ "numpy.argmax", "numpy.mean", "numpy.arange", "gplearn.utils._partition_estimators", "numpy.unique", "pandas.DataFrame", "numpy.cumsum", "numpy.apply_along_axis", "numpy.bincount", "numpy.cov", "numpy.var", "sklearn.utils.validation.check_array", "numpy.fill_diagonal", "numpy.corrcoef", ...
[((15427, 15433), 'time.time', 'time', ([], {}), '()\n', (15431, 15433), False, 'from time import time\n'), ((15547, 15584), 'gplearn.utils.check_random_state', 'check_random_state', (['self.random_state'], {}), '(self.random_state)\n', (15565, 15584), False, 'from gplearn.utils import _partition_estimators, check_rand...
from grass import script as grass import numpy as np #! written by ADW on 16 Jan 2015 # Released to the public domain # This is to make a raster grid of the ICE only in an arbitrary location # and at an arbitrary resolution that you, the user, define. # Before running this script, open a new location with your desi...
[ "numpy.array", "grass.script.run_command", "grass.script.read_command" ]
[((542, 597), 'grass.script.run_command', 'grass.run_command', (['"""g.region"""'], {'flags': '"""p"""', 'save': '"""Output"""'}), "('g.region', flags='p', save='Output')\n", (559, 597), True, 'from grass import script as grass\n'), ((704, 722), 'numpy.array', 'np.array', (['icenames'], {}), '(icenames)\n', (712, 722),...
# -*- coding: utf-8 -*- """ @brief test log(time=20s) """ import unittest import numpy from numpy.random import RandomState from sklearn import __version__ as sklver from sklearn import datasets from sklearn.exceptions import ConvergenceWarning try: from sklearn.utils._testing import ignore_warnings except Imp...
[ "unittest.main", "sklearn.datasets.load_iris", "sklearn.utils.testing.ignore_warnings", "pyquickhelper.texthelper.compare_module_version", "sklearn.datasets.make_blobs", "numpy.random.RandomState", "numpy.ones", "numpy.array", "numpy.vstack", "mlinsights.mlmodel.ClassifierAfterKMeans" ]
[((677, 721), 'sklearn.utils.testing.ignore_warnings', 'ignore_warnings', ([], {'category': 'ConvergenceWarning'}), '(category=ConvergenceWarning)\n', (692, 721), False, 'from sklearn.utils.testing import ignore_warnings\n'), ((1290, 1334), 'sklearn.utils.testing.ignore_warnings', 'ignore_warnings', ([], {'category': '...
import pandas as pd import numpy as np #定义csv文件的位置 file_name = 'E:\\Data-analysis\\finial-design\\all.csv' # 声明csv文件的路径,后面的参数是字符编码 file_path = open(file_name,'r', encoding='UTF-8') # 将文件读入到DataFrame对象中 house_data = pd.read_csv(file_path) # 输出对象 # print(house_data) # 一:数据预处理 # 0.判断数据中是否有空值 # print(pd.isnull(house_data...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "pandas.read_csv", "matplotlib.pyplot.axes", "matplotlib.pyplot.legend", "matplotlib.pyplot.text", "numpy.array", "matplotlib.pyplot.pie", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.unique" ]
[((215, 237), 'pandas.read_csv', 'pd.read_csv', (['file_path'], {}), '(file_path)\n', (226, 237), True, 'import pandas as pd\n'), ((2566, 2582), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(0)', '(100)'], {}), '(0, 100)\n', (2574, 2582), True, 'import matplotlib.pyplot as plt\n'), ((2582, 2598), 'matplotlib.pyplot.xlabel'...
# Copyright (c) 2020 <NAME> <EMAIL> All rights reserved. import cv2 import numpy as np def ofn(video_name, feature_num, interval, speed=1): cap = cv2.VideoCapture(video_name) ret, img = cap.read() fps = int(cap.get(cv2.CAP_PROP_FPS)) # img = cv2.resize(img, (0,0), fx = 1, fy = 1) w = int(cap.get(cv...
[ "numpy.zeros_like", "cv2.VideoWriter_fourcc", "cv2.drawMatches", "cv2.waitKey", "cv2.BFMatcher", "cv2.VideoCapture", "cv2.ORB_create", "cv2.VideoWriter", "cv2.resizeWindow", "cv2.imshow", "cv2.add", "cv2.namedWindow", "numpy.sqrt" ]
[((151, 179), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video_name'], {}), '(video_name)\n', (167, 179), False, 'import cv2\n'), ((404, 421), 'cv2.VideoWriter', 'cv2.VideoWriter', ([], {}), '()\n', (419, 421), False, 'import cv2\n'), ((435, 477), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (['"""m"""', '"""p""...
import numpy as np import sklearn import utils from copy import deepcopy def true_positive_rate(y_true, y_pred_proba, thresholds): tprs = [] for threshold in thresholds: y_pred = 1 * (y_pred_proba >= threshold) tp = (1 * ((y_true + y_pred) == 2)).sum() fn = (1 * ((y_true - y_pred) == 1...
[ "copy.deepcopy", "sklearn.metrics.roc_curve", "numpy.asarray", "utils.get_n_classes", "sklearn.metrics.precision_recall_curve", "sklearn.metrics.auc", "numpy.arange", "sklearn.metrics.average_precision_score", "utils.one_hot_encode" ]
[((376, 392), 'numpy.asarray', 'np.asarray', (['tprs'], {}), '(tprs)\n', (386, 392), True, 'import numpy as np\n'), ((697, 713), 'numpy.asarray', 'np.asarray', (['fprs'], {}), '(fprs)\n', (707, 713), True, 'import numpy as np\n'), ((1040, 1057), 'numpy.asarray', 'np.asarray', (['precs'], {}), '(precs)\n', (1050, 1057),...
import numpy as np import pathos as pa def check_and_set_jobs(n_jobs, logger=None): """Check and set passed number of jobs. Checks whether passed `n_jobs` has correct type and value, raises if not. If n_jobs exceeds the number of available CPUs found by `Pathos` (this might include hardware threads)...
[ "pathos.helpers.cpu_count", "numpy.random.PCG64", "numpy.random.SeedSequence", "numpy.random.default_rng", "pathos.pools.ProcessPool", "numpy.arange", "pylfi.Prior", "numpy.array_split", "numpy.concatenate" ]
[((1108, 1130), 'pathos.helpers.cpu_count', 'pa.helpers.cpu_count', ([], {}), '()\n', (1128, 1130), True, 'import pathos as pa\n'), ((2179, 2199), 'numpy.arange', 'np.arange', (['n_samples'], {}), '(n_samples)\n', (2188, 2199), True, 'import numpy as np\n'), ((2213, 2243), 'numpy.array_split', 'np.array_split', (['inpu...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import unittest import logging import time import random import numpy as np import sparse as sp import pytest from econml.tree import DepthFirstTreeBuilder, BestSplitter, Tree, MSE from econml.grf import LinearMome...
[ "numpy.random.seed", "numpy.abs", "numpy.sum", "econml.grf._utils.fast_max_eigv", "econml.grf._utils.fast_min_eigv", "econml.utilities.cross_product", "numpy.ones", "numpy.mean", "numpy.arange", "numpy.random.normal", "numpy.linalg.pinv", "numpy.random.RandomState", "numpy.linalg.eig", "ec...
[((3282, 3340), 'econml.tree.Tree', 'Tree', (['n_features', 'n_outputs', 'n_relevant_outputs', 'store_jac'], {}), '(n_features, n_outputs, n_relevant_outputs, store_jac)\n', (3286, 3340), False, 'from econml.tree import DepthFirstTreeBuilder, BestSplitter, Tree, MSE\n'), ((4200, 4374), 'econml.tree.BestSplitter', 'Best...
'''Compute decibels dB(x) = 10.*log10(|x|).''' import numpy as np # convert X to decibels def dB(X,floor=None): if (floor != None): return 10.*np.log10(np.maximum(floor, np.abs(X))) else: return 10.*np.log10(np.abs(X))
[ "numpy.abs" ]
[((221, 230), 'numpy.abs', 'np.abs', (['X'], {}), '(X)\n', (227, 230), True, 'import numpy as np\n'), ((177, 186), 'numpy.abs', 'np.abs', (['X'], {}), '(X)\n', (183, 186), True, 'import numpy as np\n')]
""" This is a module containing functions to generate the ATLAST pupil and simple coronagraphs from HCIPy. """ import os import numpy as np import matplotlib.pyplot as plt import astropy.units as u import logging import hcipy import poppy from pastis.config import CONFIG_PASTIS import pastis.util as util log = loggin...
[ "hcipy.make_pupil_grid", "poppy.dms.HexSegmentedDeformableMirror", "numpy.sum", "numpy.abs", "matplotlib.pyplot.suptitle", "hcipy.make_focal_grid_from_pupil_grid", "numpy.arange", "numpy.exp", "hcipy.evaluate_supersampled", "os.path.join", "pastis.util.aber_to_opd", "hcipy.Wavefront", "hcipy...
[((314, 333), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (331, 333), False, 'import logging\n'), ((368, 406), 'pastis.config.CONFIG_PASTIS.get', 'CONFIG_PASTIS.get', (['"""telescope"""', '"""name"""'], {}), "('telescope', 'name')\n", (385, 406), False, 'from pastis.config import CONFIG_PASTIS\n'), ((42...
__author__ = 'manabchetia' ''' This script creates the balanced dataset as described in the paper (UNDERSAMPLING) ''' from os import listdir, makedirs from os.path import join, exists import random import shutil import errno import numpy as np # MINC_DIR = '../../../data/MINC/' # CATEGORIES_FILE = join(MINC_DIR, 'm...
[ "os.makedirs", "os.path.exists", "numpy.argmin", "shutil.copytree", "os.path.join", "shutil.copy" ]
[((717, 757), 'os.path.join', 'join', (['MINC_DIR', '"""minc"""', '"""categories.txt"""'], {}), "(MINC_DIR, 'minc', 'categories.txt')\n", (721, 757), False, 'from os.path import join, exists\n'), ((770, 793), 'os.path.join', 'join', (['MINC_DIR', '"""patch"""'], {}), "(MINC_DIR, 'patch')\n", (774, 793), False, 'from os...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from scipy.sparse import coo_matrix from .array import DNAFragArray from .constants import GENOME_DOMAIN_NAME, COUNTS_RANGE_NAME, INSERT_DOMAIN_NAME class DNAFragMultiArray(DNAFragArray): ...
[ "scipy.sparse.coo_matrix", "numpy.concatenate" ]
[((1579, 1597), 'numpy.concatenate', 'np.concatenate', (['ai'], {}), '(ai)\n', (1593, 1597), True, 'import numpy as np\n'), ((1611, 1629), 'numpy.concatenate', 'np.concatenate', (['aj'], {}), '(aj)\n', (1625, 1629), True, 'import numpy as np\n'), ((1643, 1661), 'numpy.concatenate', 'np.concatenate', (['av'], {}), '(av)...
import h5py import numpy as np import pandas as pd from pandas import DataFrame import threading from functools import lru_cache import os from scipy.io import loadmat def flatten(d, parent_key='', sep='/'): items = [] for k,v in d.items(): new_key = parent_key + sep + k if parent_key else k ...
[ "pandas.DataFrame", "h5py.File", "os.walk", "numpy.array", "pandas.read_parquet", "pandas.concat", "numpy.concatenate" ]
[((2049, 2060), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (2058, 2060), False, 'from pandas import DataFrame\n'), ((2083, 2094), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (2092, 2094), False, 'from pandas import DataFrame\n'), ((5464, 5475), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (5473, 54...
import pygame, sys import numpy as np #initialize pygame pygame.init() #variables width= 600 height= 600 line_width= 10 crimson=(220, 20, 60) line_color= (52, 235, 232) board_rows=3 board_cols=3 circle_radius= 50 circle_width= 15 circle_color = (153, 102, 255) square_color = (153, 102, 255) square_width= 15 space= 55 ...
[ "pygame.draw.line", "pygame.event.get", "pygame.display.set_mode", "numpy.zeros", "pygame.init", "pygame.display.update", "pygame.display.set_caption", "sys.exit" ]
[((57, 70), 'pygame.init', 'pygame.init', ([], {}), '()\n', (68, 70), False, 'import pygame, sys\n'), ((376, 416), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(width, height)'], {}), '((width, height))\n', (399, 416), False, 'import pygame, sys\n'), ((418, 460), 'pygame.display.set_caption', 'pygame.displa...
""" Use this python file as for interactive jupyter notebook data analysis. This isn't an .ipynb file format, but you can export output cells into a notebook after analysis. Using a regular python file as my workflow, I have a clearler view of the defined variables. Also, you can better commit code and have full...
[ "pandas.DataFrame", "numpy.random.randint", "pandas.set_option" ]
[((631, 669), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(120)'], {}), "('display.max_rows', 120)\n", (644, 669), True, 'import pandas as pd\n'), ((671, 712), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(120)'], {}), "('display.max_columns', 120)\n", (684, 712), True, '...
from braket.circuits import circuit import numpy @circuit.subroutine(register=True) def CU3Gate(theta, phi, lam, dtype=None): cos = numpy.cos(theta/2) sin = numpy.sin(theta/2) exp1 = numpy.exp(1j*lam) exp2 = numpy.exp(1j*phi) exp3 = numpy.exp(1j*(phi+lam)) return numpy.array([[1, 0, 0, 0], ...
[ "braket.circuits.circuit.subroutine", "numpy.sin", "numpy.array", "numpy.exp", "numpy.cos" ]
[((52, 85), 'braket.circuits.circuit.subroutine', 'circuit.subroutine', ([], {'register': '(True)'}), '(register=True)\n', (70, 85), False, 'from braket.circuits import circuit\n'), ((138, 158), 'numpy.cos', 'numpy.cos', (['(theta / 2)'], {}), '(theta / 2)\n', (147, 158), False, 'import numpy\n'), ((167, 187), 'numpy.s...
# -*- coding: utf-8 -*- # Copyright 2019 IBM. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
[ "numpy.matrix", "numpy.random.random_sample", "scipy.io.loadmat", "numpy.zeros", "numpy.array", "traceback.format_exc", "numpy.random.normal", "math.log", "tables.open_file" ]
[((9239, 9286), 'tables.open_file', 'tables.open_file', ([], {'filename': 'matlabfile', 'mode': '"""r"""'}), "(filename=matlabfile, mode='r')\n", (9255, 9286), False, 'import tables\n'), ((3678, 3695), 'numpy.matrix', 'np.matrix', (['self.A'], {}), '(self.A)\n', (3687, 3695), True, 'import numpy as np\n'), ((4360, 4377...
''' perform histogram equilisation on an image ''' import cv2 import numpy as np img = cv2.imread('lenna.jpg', 0) eq = cv2.equalizeHist( img ) result = np.hstack(( img, eq) ) cv2.imwrite('equliz.jpg', result)
[ "cv2.equalizeHist", "cv2.imread", "cv2.imwrite", "numpy.hstack" ]
[((90, 116), 'cv2.imread', 'cv2.imread', (['"""lenna.jpg"""', '(0)'], {}), "('lenna.jpg', 0)\n", (100, 116), False, 'import cv2\n'), ((122, 143), 'cv2.equalizeHist', 'cv2.equalizeHist', (['img'], {}), '(img)\n', (138, 143), False, 'import cv2\n'), ((155, 175), 'numpy.hstack', 'np.hstack', (['(img, eq)'], {}), '((img, e...
############################################################################## # This file is a part of PFFDTD. # # PFFTD is released under the MIT License. # For details see the LICENSE file. # # Copyright 2021 <NAME>. # # File name: myfuncs.py # # Description: Miscellaneous python/numpy functions. Not all used or us...
[ "numpy.sum", "numpy.abs", "numpy.floor", "os.popen", "pathlib.Path", "numpy.sin", "numpy.linalg.norm", "numpy.round", "multiprocessing.cpu_count", "numpy.atleast_2d", "numpy.float_", "struct.pack", "numpy.finfo", "numpy.ceil", "numpy.log2", "numpy.linalg.inv", "common.myasserts.asser...
[((760, 778), 'numpy.finfo', 'np.finfo', (['np.float'], {}), '(np.float)\n', (768, 778), True, 'import numpy as np\n'), ((1762, 1779), 'numpy.deg2rad', 'np.deg2rad', (['thx_d'], {}), '(thx_d)\n', (1772, 1779), True, 'import numpy as np\n'), ((1790, 1807), 'numpy.deg2rad', 'np.deg2rad', (['thy_d'], {}), '(thy_d)\n', (18...
""" ## Script for training the UNet Semantic Segmentation Network ## Example: ## >> python3 train_unet.py --name heusler --samples 5000 --epochs 100 -------------------------------------------------- ## Author: <NAME>. ## Email: <EMAIL> ## Version: 1.0.0 -------------------------------------------------- ## License: M...
[ "numpy.load", "numpy.save", "os.makedirs", "argparse.ArgumentParser", "unet.get_weights.get_weights", "unet.data.UnetDataGenerator", "utils.data_split", "unet.unet.AtomUnet", "os.path.splitext", "os.path.join" ]
[((806, 831), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (829, 831), False, 'import argparse\n'), ((2238, 2276), 'os.path.join', 'os.path.join', (['"""data"""', 'mode', '"""matrices"""'], {}), "('data', mode, 'matrices')\n", (2250, 2276), False, 'import os\n'), ((2388, 2430), 'os.path.join'...
import numpy as np class PostProcessor: """Generic post processor for processing predictions """ def __init__(self, floor_at_zero=True, round_decimals=2): self.floor_at_zero = floor_at_zero self.round_decimals = round_decimals def process(self, y_pred): """process predictions...
[ "numpy.round", "numpy.array" ]
[((651, 685), 'numpy.array', 'np.array', (['[1.2352, 25.25123, -8.9]'], {}), '([1.2352, 25.25123, -8.9])\n', (659, 685), True, 'import numpy as np\n'), ((549, 586), 'numpy.round', 'np.round', (['y_pred', 'self.round_decimals'], {}), '(y_pred, self.round_decimals)\n', (557, 586), True, 'import numpy as np\n')]
#!/usr/bin/env python # coding: utf-8 # In[ ]: # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra i...
[ "matplotlib.pyplot.title", "seaborn.lineplot", "sklearn.model_selection.GridSearchCV", "pandas.read_csv", "sklearn.model_selection.train_test_split", "numpy.logspace", "sklearn.metrics.accuracy_score", "sklearn.metrics.classification_report", "sklearn.tree.DecisionTreeClassifier", "matplotlib.pypl...
[((1170, 1203), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1193, 1203), False, 'import warnings\n'), ((1204, 1229), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (1217, 1229), True, 'import seaborn as sns\n'), ((1246, 1310), 'pandas...
""" Generic plotters and formatters. (c) 2019- <NAME>. Copywright: Ask for permission writing to <EMAIL>. """ import numpy as np import matplotlib.pyplot as plt # from autologging import logged, traced class Plotter(object): """ Generic plotting mix-in. The plott method wraps the plot method of child classes. ...
[ "fullwavepy.plot.plt1d.plot_1d", "matplotlib.pyplot.close", "fullwavepy.generic.parse.strip", "numpy.clip", "matplotlib.pyplot.figure", "fullwavepy.ndat.arrays.Arr3d", "matplotlib.pyplot.gca", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "fullwavepy.plot.plt2d.compare_2d", "matplotl...
[((4977, 4988), 'fullwavepy.ndat.arrays.Arr3d', 'Arr3d', (['arg1'], {}), '(arg1)\n', (4982, 4988), False, 'from fullwavepy.ndat.arrays import Arr3d\n'), ((4996, 5007), 'fullwavepy.ndat.arrays.Arr3d', 'Arr3d', (['arg2'], {}), '(arg2)\n', (5001, 5007), False, 'from fullwavepy.ndat.arrays import Arr3d\n'), ((6022, 6049), ...
# Goal here is to automate saving out dithered positions (RA, Dec, rotTelPos) # for non-MAF users. See function documentation below for details. # # <NAME>: <EMAIL> # ########################################################################################## import matplotlib matplotlib.use('Agg') import matplotlib.pypl...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.suptitle", "pandas.DataFrame", "lsst.sims.maf.metricBundles.MetricBundleGroup", "matplotlib.pyplot.close", "lsst.sims.maf.db.ResultsDb", "matplotlib.pyplot.subplots", "lsst.sims.maf.db.OpsimDatabase", "matplotlib.pyplot.show", "lsst.sims.maf.stackers.R...
[((276, 297), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (290, 297), False, 'import matplotlib\n'), ((3313, 3324), 'time.time', 'time.time', ([], {}), '()\n', (3322, 3324), False, 'import time\n'), ((4345, 4356), 'time.time', 'time.time', ([], {}), '()\n', (4354, 4356), False, 'import time\n'...
# %% """Simple script to run benchmarks.py for a bunch of parameters""" from benchmarks import do_benchmark import benchmarks import numpy as np from itertools import product categorical_datasets = [ # "seismic_bumps", # "ai4i2020", # "diabetic_retinopathy", # "bank_marketing", # "default_credit_c...
[ "numpy.random.randint", "benchmarks.do_benchmark", "itertools.product" ]
[((787, 810), 'numpy.random.randint', 'np.random.randint', (['(1000)'], {}), '(1000)\n', (804, 810), True, 'import numpy as np\n'), ((860, 903), 'benchmarks.do_benchmark', 'do_benchmark', (['DATASET_NAME', '"""rf"""'], {'seed': 'seed'}), "(DATASET_NAME, 'rf', seed=seed)\n", (872, 903), False, 'from benchmarks import do...
import gym gym.logger.set_level(40) # suppress warnings (please remove if gives error) import numpy as np from collections import deque import matplotlib.pyplot as plt import torch torch.manual_seed(0) # set random seed import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.distr...
[ "matplotlib.pyplot.show", "gym.make", "torch.manual_seed", "Policy.Policy", "torch.cat", "gym.logger.set_level", "matplotlib.pyplot.figure", "numpy.mean", "torch.cuda.is_available", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "collections.deque" ]
[((11, 35), 'gym.logger.set_level', 'gym.logger.set_level', (['(40)'], {}), '(40)\n', (31, 35), False, 'import gym\n'), ((183, 203), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (200, 203), False, 'import torch\n'), ((637, 654), 'collections.deque', 'deque', ([], {'maxlen': '(100)'}), '(maxlen=100)...
# coding: utf-8 #Q13#Q14#Q15#Q16 import numpy as np import matplotlib.pyplot as plt train_data = np.loadtxt('hw2_adaboost_train.dat.txt') test_data = np.loadtxt('hw2_adaboost_test.dat.txt') train_x = train_data[:,0:2] train_y = train_data[:,-1] train_num = len(train_x) test_x = test_data[:,0:2] test_y = test_data[:,-1...
[ "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "numpy.log", "numpy.zeros", "numpy.ones", "numpy.append", "numpy.mean", "numpy.array", "numpy.loadtxt", "numpy.sign", "numpy.dot", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig", "nump...
[((98, 138), 'numpy.loadtxt', 'np.loadtxt', (['"""hw2_adaboost_train.dat.txt"""'], {}), "('hw2_adaboost_train.dat.txt')\n", (108, 138), True, 'import numpy as np\n'), ((151, 190), 'numpy.loadtxt', 'np.loadtxt', (['"""hw2_adaboost_test.dat.txt"""'], {}), "('hw2_adaboost_test.dat.txt')\n", (161, 190), True, 'import numpy...
# Copyright 2021 <NAME> <<EMAIL>>, <NAME>, <NAME>, <NAME>, <NAME> <<EMAIL>> # # SPDX-License-Identifier: Beerware OR MIT from .constellmod import ConstellationModulator from .. import common import typing as t import math import numpy as np def generate_psk_constellation(M: int) -> t.List[complex]: """ Genera...
[ "math.sin", "math.cos", "math.sqrt", "numpy.sqrt" ]
[((1324, 1336), 'numpy.sqrt', 'np.sqrt', (['snr'], {}), '(snr)\n', (1331, 1336), True, 'import numpy as np\n'), ((686, 701), 'math.cos', 'math.cos', (['phi_m'], {}), '(phi_m)\n', (694, 701), False, 'import math\n'), ((934, 951), 'math.sqrt', 'math.sqrt', (['energy'], {}), '(energy)\n', (943, 951), False, 'import math\n...
import os import numpy as np import random import myInception_v3 import torch from torch.utils.data import DataLoader from torchvision import models, transforms from myDataReader import ClsDataset from myUtils import save_temp_excel, GetParser, ProbBoxPlot, NetPrediction, EvalMetrics, EvalMetricsV2, RocPlot, pa...
[ "os.remove", "numpy.random.seed", "myUtils.ProbBoxPlot", "torchvision.transforms.Normalize", "os.path.join", "myUtils.save_temp_excel", "torch.utils.data.DataLoader", "myUtils.RocPlot", "os.path.exists", "random.seed", "myUtils.NetPrediction", "torch.manual_seed", "myUtils.EvalMetricsV2", ...
[((398, 414), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (408, 414), False, 'import os\n'), ((661, 683), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (672, 683), False, 'import random\n'), ((689, 714), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (703,...
# Standard library import os import sys import time # Third-party import h5py import numpy as np # Project from hq.log import logger def worker(task): for i in range(1_000_000): j = i**2 return {'j': j} def callback(result): if result is None: return def main(pool): tasks = np....
[ "schwimmbad.mpi.MPIPool", "numpy.arange", "sys.exit" ]
[((317, 332), 'numpy.arange', 'np.arange', (['(1000)'], {}), '(1000)\n', (326, 332), True, 'import numpy as np\n'), ((609, 620), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (617, 620), False, 'import sys\n'), ((561, 570), 'schwimmbad.mpi.MPIPool', 'MPIPool', ([], {}), '()\n', (568, 570), False, 'from schwimmbad.mpi...
#!/usr/bin/python3 #coding:utf8 import cv2 import numpy as np from PIL import Image, ImageDraw, ImageFont def cv2ImgAddText(image, text, x, y, textColor=(0, 255, 0), textSize=20): image = Image.fromarray(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)) draw = ImageDraw.Draw(image) fontText = ImageFont.truetype("...
[ "PIL.ImageDraw.Draw", "numpy.asarray", "cv2.cvtColor", "PIL.ImageFont.truetype" ]
[((263, 284), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (277, 284), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((300, 389), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""/usr/share/fonts/chinese/simsun.ttc"""', 'textSize'], {'encoding': '"""utf-8"""'}), "('/usr/share/fo...
from scipy.spatial.distance import euclidean import numpy as np def compute_angle(atom_a, atom_b, atom_c): # atom_a/b/c are numpy arrays for atomic positions ba = atom_a - atom_b bc = atom_c - atom_b cosine_angle = np.dot(ba, bc) / (np.linalg.norm(ba) * np.linalg.norm(bc)) angle = np.arccos(cosin...
[ "numpy.degrees", "numpy.allclose", "numpy.linalg.norm", "numpy.dot", "numpy.arccos" ]
[((305, 328), 'numpy.arccos', 'np.arccos', (['cosine_angle'], {}), '(cosine_angle)\n', (314, 328), True, 'import numpy as np\n'), ((340, 357), 'numpy.degrees', 'np.degrees', (['angle'], {}), '(angle)\n', (350, 357), True, 'import numpy as np\n'), ((234, 248), 'numpy.dot', 'np.dot', (['ba', 'bc'], {}), '(ba, bc)\n', (24...
import os import argparse import pprint as pp import numpy as np import pickle from datetime import timedelta from torch.utils.data import DataLoader from problems.tsp.problem_tsp import * if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--problem", type=str, default="tsp") ...
[ "numpy.stack", "numpy.sum", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "numpy.std", "numpy.mean" ]
[((232, 257), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (255, 257), False, 'import argparse\n'), ((937, 984), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': 'opts.batch_size'}), '(dataset, batch_size=opts.batch_size)\n', (947, 984), False, 'from torch.utils.data ...
import tensorflow as tf import numpy import matplotlib.pyplot as plt rng = numpy.random # Parameters learning_rate = 0.01 training_epochs = 1000 display_step = 50 # Training Data train_X = numpy.asarray([3.3,4.4,5.5,6.71,6.93,4.168,9.779,6.182,7.59,2.167,7.042,10.791,5.313,7.997,5.654,9.27,3.1]) train_Y = numpy.asarr...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "tensorflow.global_variables_initializer", "numpy.asarray", "matplotlib.pyplot.legend", "tensorflow.Session", "tensorflow.pow", "tensorflow.placeholder", "tensorflow.multiply", "tensorflow.train.GradientDescentOptimizer" ]
[((191, 318), 'numpy.asarray', 'numpy.asarray', (['[3.3, 4.4, 5.5, 6.71, 6.93, 4.168, 9.779, 6.182, 7.59, 2.167, 7.042, 10.791,\n 5.313, 7.997, 5.654, 9.27, 3.1]'], {}), '([3.3, 4.4, 5.5, 6.71, 6.93, 4.168, 9.779, 6.182, 7.59, 2.167,\n 7.042, 10.791, 5.313, 7.997, 5.654, 9.27, 3.1])\n', (204, 318), False, 'import...
import numpy as np from stylo.color import RGB8 from stylo.domain import get_real_domain from stylo.image import Image from stylo.image.image import Drawable, render_drawable class LayeredImage(Image): def __init__(self, background=None, scale=2, colorspace=None): self.scale = scale if backgroun...
[ "numpy.full", "stylo.image.image.Drawable", "stylo.image.image.render_drawable", "stylo.domain.get_real_domain" ]
[((814, 856), 'stylo.domain.get_real_domain', 'get_real_domain', (['width', 'height', 'self.scale'], {}), '(width, height, self.scale)\n', (829, 856), False, 'from stylo.domain import get_real_domain\n'), ((937, 989), 'numpy.full', 'np.full', (['dimensions', 'self.background'], {'dtype': 'np.uint8'}), '(dimensions, sel...
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '.')) import numpy as np import pystan import pandas import pickle import seaborn as sns import matplotlib.pyplot as plt import mcmc_tools np.random.seed(seed=1234) n1 = 30 n2 = 20 y1 = np.random.normal(loc=0.0, scale=5.0, size=n1) y2 = n...
[ "pandas.DataFrame", "numpy.random.seed", "matplotlib.pyplot.show", "os.path.dirname", "numpy.random.normal", "mcmc_tools.sampling", "seaborn.violinplot" ]
[((219, 244), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(1234)'}), '(seed=1234)\n', (233, 244), True, 'import numpy as np\n'), ((268, 313), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0.0)', 'scale': '(5.0)', 'size': 'n1'}), '(loc=0.0, scale=5.0, size=n1)\n', (284, 313), True, 'import numpy as...
import numpy as np from .unitgenerator import UnitGenerator class Oscillator(UnitGenerator): def __init__(self,freq,phase = 0,duration=None,pitch_type = "freq"): super().__init__(duration=duration) if pitch_type == "freq": self.set_freq(freq) else: raise ValueError("Invalid freq type to ", self.__class__,...
[ "numpy.cumsum", "numpy.sin", "numpy.ones" ]
[((1294, 1307), 'numpy.sin', 'np.sin', (['angle'], {}), '(angle)\n', (1300, 1307), True, 'import numpy as np\n'), ((748, 767), 'numpy.ones', 'np.ones', (['num_frames'], {}), '(num_frames)\n', (755, 767), True, 'import numpy as np\n'), ((985, 1001), 'numpy.cumsum', 'np.cumsum', (['omega'], {}), '(omega)\n', (994, 1001),...
# -*- coding: utf-8 -*- """ Created on Wed Feb 26 11:06:17 2020 @author: <NAME>lets Lab_1 """ import re import numpy as np from .parsing_tools import timestring_to_epoch_time PVMassSpec_time_match = r"[0-9]{2}-[0-9]{2}-[0-9]{4} [0-9]{2}'[0-9]{2}'[0-9]{2}" # it has a ridiculous format def PVMS_title_to_timestring...
[ "numpy.array", "numpy.append", "re.search" ]
[((341, 380), 're.search', 're.search', (['PVMassSpec_time_match', 'title'], {}), '(PVMassSpec_time_match, title)\n', (350, 380), False, 'import re\n'), ((1462, 1474), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1470, 1474), True, 'import numpy as np\n'), ((2505, 2528), 'numpy.append', 'np.append', (['data[col]...
from pathlib import Path from tempfile import TemporaryDirectory from typing import List from unittest import mock import numpy from numpy import ndarray from bio_embeddings.embed.pipeline import run class MockElmoEmbedder: # noinspection PyUnusedLocal def __init__(self, options_file: str, weight_file: str,...
[ "numpy.load", "tempfile.TemporaryDirectory", "unittest.mock.patch", "pathlib.Path", "bio_embeddings.embed.pipeline.run" ]
[((373, 411), 'numpy.load', 'numpy.load', (['"""test-data/embeddings.npz"""'], {}), "('test-data/embeddings.npz')\n", (383, 411), False, 'import numpy\n'), ((666, 751), 'unittest.mock.patch', 'mock.patch', (['"""bio_embeddings.embed.seqvec_embedder.ElmoEmbedder"""', 'MockElmoEmbedder'], {}), "('bio_embeddings.embed.seq...
from functools import partial import numpy as np import pandas as pd from dimsm.dimension import Dimension from dimsm.measurement import Measurement from dimsm.process import Process, default_gen_vmat from dimsm.smoother import Smoother # generate simulate data x = np.linspace(0, 1, 50) s = 0.1 y = np.sin(2*np.pi*x...
[ "pandas.DataFrame", "functools.partial", "dimsm.measurement.Measurement", "dimsm.smoother.Smoother", "numpy.random.randn", "numpy.sin", "numpy.linspace", "dimsm.process.Process" ]
[((270, 291), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(50)'], {}), '(0, 1, 50)\n', (281, 291), True, 'import numpy as np\n'), ((457, 487), 'pandas.DataFrame', 'pd.DataFrame', (["{'x': x, 'y': y}"], {}), "({'x': x, 'y': y})\n", (469, 487), True, 'import pandas as pd\n'), ((495, 527), 'dimsm.measurement.Measure...
""" Helpers for implementing models. """ import math import numpy as np import tensorflow as tf def mini_batches(size_per_index, batch_size=None): """ Generate mini-batches of size batch_size. The size_per_index list is the size of each batch element. Batches are generated such that the sum of ...
[ "tensorflow.ones", "tensorflow.abs", "math.sqrt", "tensorflow.concat", "tensorflow.variable_scope", "tensorflow.tile", "tensorflow.shape", "tensorflow.layers.conv2d", "tensorflow.square", "numpy.random.permutation" ]
[((1789, 1832), 'tensorflow.ones', 'tf.ones', (['tensor.shape.ndims'], {'dtype': 'tf.int32'}), '(tensor.shape.ndims, dtype=tf.int32)\n', (1796, 1832), True, 'import tensorflow as tf\n'), ((1852, 1891), 'tensorflow.concat', 'tf.concat', (['[[batch_size], ones]'], {'axis': '(0)'}), '([[batch_size], ones], axis=0)\n', (18...
import random import os import math import numpy as np import sys from PIL import Image from util.utils import show from metrics import AEBatch, SEBatch import time import torch import scipy.io as scio import h5py import util.utils as util class Estimator(object): def __init__(self, setting, eval_loader, criterion...
[ "torch.cuda.synchronize", "numpy.sum", "scipy.io.loadmat", "util.utils.tensor2im", "metrics.SEBatch", "numpy.mean", "torch.no_grad", "torch.nn.MSELoss", "random.randint", "metrics.AEBatch", "torch.squeeze", "numpy.reshape", "h5py.File", "torch.zeros_like", "math.ceil", "os.path.basenam...
[((321, 354), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {'reduction': '"""sum"""'}), "(reduction='sum')\n", (337, 354), False, 'import torch\n'), ((5550, 5603), 'util.utils.show', 'show', (['origin_image', 'eval_gt_map', 'eval_pred_map', 'index'], {}), '(origin_image, eval_gt_map, eval_pred_map, index)\n', (5554, 56...
''' Runs unit tests for various SPy spatial functions. To run the unit tests, type the following from the system command line: # python -m spectral.tests.spatial ''' from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np from numpy.testing import assert_allclose fr...
[ "spectral.algorithms.spatial.map_classes", "spectral.algorithms.spatial.map_class_ids", "spectral.tests.run.print_summary", "spectral.algorithms.spatial.get_window_bounds", "spectral.tests.run.parse_args", "spectral.open_image", "spectral.algorithms.spatial.map_window", "numpy.array", "numpy.alltrue...
[((6931, 6943), 'spectral.tests.run.parse_args', 'parse_args', ([], {}), '()\n', (6941, 6943), False, 'from spectral.tests.run import parse_args, reset_stats, print_summary\n'), ((6948, 6961), 'spectral.tests.run.reset_stats', 'reset_stats', ([], {}), '()\n', (6959, 6961), False, 'from spectral.tests.run import parse_a...
import numpy as np import os import sys # import tensorflow as tf import cv2 from matplotlib import pyplot as plt # inside jupyter uncomment next line # %matplotlib inline import random import time from pycocotools.coco import COCO import skimage.io as io def draw_segmentation_mask(img,anns): for ann in anns: ...
[ "matplotlib.pyplot.show", "cv2.cvtColor", "matplotlib.pyplot.imshow", "numpy.zeros", "matplotlib.pyplot.axis", "pycocotools.coco.COCO", "numpy.array", "numpy.int32", "skimage.io.imread" ]
[((505, 542), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2GRAY'], {}), '(img, cv2.COLOR_RGB2GRAY)\n', (517, 542), False, 'import cv2\n'), ((867, 880), 'pycocotools.coco.COCO', 'COCO', (['annFile'], {}), '(annFile)\n', (871, 880), False, 'from pycocotools.coco import COCO\n'), ((1495, 1526), 'skimage.io.imre...
import dgl import numpy as np from torch.utils.data import Dataset import torch class RandomWalkSampler(Dataset): def __init__(self, g, rw_walks: int, window_size: int, neg_size: int, metapath=None, rw_prob=None, rw_length=None): self.g = g self.start_idx = [0] for i, num_nodes in enumera...
[ "numpy.concatenate", "torch.LongTensor", "dgl.sampling.random_walk", "numpy.array", "numpy.random.rand", "torch.tensor", "numpy.round", "numpy.random.shuffle", "numpy.sqrt" ]
[((1417, 1546), 'dgl.sampling.random_walk', 'dgl.sampling.random_walk', ([], {'g': 'self.g', 'nodes': 'self.start_nodes', 'metapath': 'self.metapath', 'prob': 'self.rw_prob', 'length': 'self.rw_length'}), '(g=self.g, nodes=self.start_nodes, metapath=self.\n metapath, prob=self.rw_prob, length=self.rw_length)\n', (14...
# coding: utf-8 r"""Bspline""" import numpy as np import scipy.interpolate as si def bspline(cv, n=100, degree=3, periodic=False): """Calculate n samples on a bspline Parameters ---------- cv : Array ov control vertices n : Number of samples to return degree: Curve degree p...
[ "numpy.asarray", "numpy.clip", "numpy.arange", "numpy.linspace", "scipy.interpolate.splev", "numpy.concatenate" ]
[((466, 480), 'numpy.asarray', 'np.asarray', (['cv'], {}), '(cv)\n', (476, 480), True, 'import numpy as np\n'), ((1113, 1153), 'numpy.linspace', 'np.linspace', (['periodic', '(count - degree)', 'n'], {}), '(periodic, count - degree, n)\n', (1124, 1153), True, 'import numpy as np\n'), ((589, 638), 'numpy.concatenate', '...
# -*- coding: utf-8 -*- import torchvision.transforms as transforms import os import torch import numpy as np from torch.utils.data import Dataset, DataLoader import time import cv2 from scipy.interpolate import griddata from tutils import * from torch import nn from dataloader import data_process, print_img, uv2bw, bw...
[ "numpy.load", "os.remove", "dataloader.uv2bw.uv2backward_trans_3", "cv2.cvtColor", "cv2.threshold", "os.path.exists", "dataloader.bw2deform.bw2deform", "cv2.imread", "numpy.min", "numpy.max", "numpy.where", "numpy.append", "dataloader.data_process.process_auto", "os.path.join", "os.scand...
[((16032, 16061), 'os.scandir', 'os.scandir', (["(data_dir + 'img/')"], {}), "(data_dir + 'img/')\n", (16042, 16061), False, 'import os\n'), ((1320, 1347), 'cv2.resize', 'cv2.resize', (['ori', '(256, 256)'], {}), '(ori, (256, 256))\n', (1330, 1347), False, 'import cv2\n'), ((15599, 15623), 'os.path.exists', 'os.path.ex...
from citylearn import CityLearn, building_loader, auto_size from energy_models import HeatPump, EnergyStorage, Building import numpy as np import logging import sys import time from itertools import count logger = logging.getLogger('spam_application') logger.setLevel(logging.INFO) ch = logging.StreamHandler() ch.s...
[ "numpy.full", "logging.StreamHandler", "numpy.zeros", "numpy.argmin", "logging.getLogger" ]
[((218, 255), 'logging.getLogger', 'logging.getLogger', (['"""spam_application"""'], {}), "('spam_application')\n", (235, 255), False, 'import logging\n'), ((292, 315), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (313, 315), False, 'import logging\n'), ((1632, 1706), 'numpy.full', 'np.full', (['...