code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# libraries import os from pathlib import Path from collections import defaultdict import scipy import random import numpy as np import xarray as xr import pandas as pd import joblib from skimage.filters import sobel from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.metrics import r2_score...
[ "keras.regularizers.l2", "numpy.maximum", "numpy.random.seed", "numpy.nan_to_num", "numpy.polyfit", "keras.Sequential", "numpy.empty", "sklearn.model_selection.train_test_split", "sklearn.metrics.r2_score", "joblib.dump", "numpy.ones", "numpy.isnan", "sklearn.metrics.mean_absolute_error", ...
[((3032, 3099), 'xarray.open_dataset', 'xr.open_dataset', (['f"""{dir_mask}/SOCATv2019_mask_1x1_198201-201512.nc"""'], {}), "(f'{dir_mask}/SOCATv2019_mask_1x1_198201-201512.nc')\n", (3047, 3099), True, 'import xarray as xr\n'), ((3744, 3761), 'numpy.arange', 'np.arange', (['N_time'], {}), '(N_time)\n', (3753, 3761), Tr...
# Perceptron class import numpy as np from random import choice import matplotlib.pyplot as plt class Perceptron: def __init__(self): self.w = [] # train the model to fit the training data X to its correct labels y def train(self, X, y, max_itr=10**6): ''' Train a perceptron mode...
[ "random.choice", "numpy.where", "numpy.matmul", "numpy.random.rand", "numpy.add" ]
[((664, 690), 'numpy.random.rand', 'np.random.rand', (['model_size'], {}), '(model_size)\n', (678, 690), True, 'import numpy as np\n'), ((1214, 1234), 'random.choice', 'choice', (['misclass_idx'], {}), '(misclass_idx)\n', (1220, 1234), False, 'from random import choice\n'), ((1347, 1372), 'numpy.add', 'np.add', (['w', ...
import argparse import base64 import io import json from io import BytesIO from string import Template import numpy as np import requests from PIL import Image as pil_image from bitstring import BitArray from config import Config as cfg def get_hashcode_str(floatarr): """ Construct hashcode from layer outpu...
[ "io.BytesIO", "PIL.Image.new", "json.loads", "bitstring.BitArray", "json.dumps", "PIL.Image.open", "string.Template", "numpy.array", "requests.post", "argparse.ArgumentTypeError" ]
[((888, 960), 'json.dumps', 'json.dumps', (["{'signature_name': 'serving_default', 'instances': imgs_b64}"], {}), "({'signature_name': 'serving_default', 'instances': imgs_b64})\n", (898, 960), False, 'import json\n'), ((971, 1116), 'requests.post', 'requests.post', (["('%s://%s:%d/v1/models/%s:predict' % (protocol, ho...
from collections import deque import numpy as np from gym import spaces from gym.envs.atari.atari_env import AtariEnv from . import utils class MultiFrameAtariEnv(AtariEnv): metadata = {'render.modes': ['human', 'rgb_array']} no_op_steps = 30 def __init__(self, game='pong', obs_type='image', buf_size=4, gr...
[ "numpy.random.randint", "numpy.maximum", "gym.spaces.Box", "collections.deque" ]
[((720, 742), 'collections.deque', 'deque', ([], {'maxlen': 'buf_size'}), '(maxlen=buf_size)\n', (725, 742), False, 'from collections import deque\n'), ((860, 958), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(0)', 'high': '(255)', 'shape': '(self._shape[0], self._shape[1], buf_size)', 'dtype': 'np.uint8'}), '(low=0,...
#!/usr/bin/env python # # Copyright 2014 Knowledge Economy Developments Ltd # Copyright 2014 <NAME> # # <NAME> # <EMAIL> # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of ...
[ "pyfftw.FFTW.__init__", "numpy.iscomplexobj", "pyfftw.is_byte_aligned", "pyfftw.byte_align", "numpy.asarray", "numpy.dtype", "numpy.asanyarray", "pyfftw.empty_aligned", "numpy.take", "pyfftw.FFTW", "warnings.warn", "multiprocessing.cpu_count" ]
[((2465, 2487), 'numpy.dtype', 'numpy.dtype', (['"""float32"""'], {}), "('float32')\n", (2476, 2487), False, 'import numpy\n'), ((2489, 2511), 'numpy.dtype', 'numpy.dtype', (['"""float64"""'], {}), "('float64')\n", (2500, 2511), False, 'import numpy\n'), ((2537, 2562), 'numpy.dtype', 'numpy.dtype', (['"""longdouble"""'...
import os import numpy as np import cv2 def visual_loss(bbox_pred, bbox_gt, bbox_weights, kps_pred, kps_gt, kps_weights): vis_dir = '/root/Code/RepPoints/work_dirs/vis' num_inst = (bbox_weights.sum(1) > 0).sum() if num_inst == 0: return valid_ind = (bbox_weights.sum(1) > 0) num_kp = kps_...
[ "cv2.circle", "ipdb.set_trace", "cv2.imwrite", "numpy.zeros", "numpy.array", "cv2.rectangle", "os.path.join" ]
[((2113, 2144), 'os.path.join', 'os.path.join', (['vis_dir', 'out_file'], {}), '(vis_dir, out_file)\n', (2125, 2144), False, 'import os\n'), ((2149, 2175), 'cv2.imwrite', 'cv2.imwrite', (['out_path', 'vis'], {}), '(out_path, vis)\n', (2160, 2175), False, 'import cv2\n'), ((7469, 7485), 'ipdb.set_trace', 'ipdb.set_trace...
import cv2 import numpy as np cap = cv2.VideoCapture(0) bg = cv2.imread("image1.jpg") while cap.isOpened(): ret, frame = cap.read() if ret: hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) #cv2.imshow("HSV", hsv) red = np.uint8([[[0,0,255]]]) hsv_red = cv2.cvt...
[ "numpy.uint8", "cv2.bitwise_not", "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "cv2.imread", "numpy.array", "cv2.destroyAllWindows", "cv2.inRange" ]
[((40, 59), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (56, 59), False, 'import cv2\n'), ((66, 90), 'cv2.imread', 'cv2.imread', (['"""image1.jpg"""'], {}), "('image1.jpg')\n", (76, 90), False, 'import cv2\n'), ((1083, 1106), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1104,...
# -*- coding: utf-8 -*- # <nbformat>4</nbformat> # <markdowncell> # sources: # # - https://www.kaggle.com/hone5com/fraud-detection-with-variational-autoencoder # - https://www.tensorflow.org/probability/api_docs/python/tfp/layers/KLDivergenceRegularizer # <codecell> _DEBUG_ = False # general flag for deb...
[ "matplotlib.pyplot.title", "sklearn.preprocessing.StandardScaler", "tensorflow.compat.v2.enable_eager_execution", "tensorflow.compat.v2.keras.optimizers.Adam", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.callbacks.EarlyStopping", "pandas.DataFrame", "numpy.zeros_like", "tensorflo...
[((1228, 1255), 'tensorflow.compat.v2.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (1253, 1255), True, 'import tensorflow.compat.v2 as tf\n'), ((2977, 2997), 'drosoph_vae.helpers.jupyter.fix_layout', 'jupyter.fix_layout', ([], {}), '()\n', (2995, 2997), False, 'from drosoph_vae.helpers import...
# Copyright 2018 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
[ "numpy.empty_like", "cirq.protocols.qid_shape_protocol.qid_shape", "cirq.protocols.decompose_protocol._try_decompose_into_operations_and_qubits", "typing.TypeVar", "cirq.qis.one_hot" ]
[((1031, 1050), 'typing.TypeVar', 'TypeVar', (['"""TDefault"""'], {}), "('TDefault')\n", (1038, 1050), False, 'from typing import TYPE_CHECKING, Any, TypeVar, Optional\n'), ((4540, 4586), 'cirq.protocols.decompose_protocol._try_decompose_into_operations_and_qubits', '_try_decompose_into_operations_and_qubits', (['val']...
from os import path import numpy as np import warnings def get_Xy_train_test_separate(train_filename, test_filename, skip_header=0): """ Read in training and testing data files, and split each into X (all columns up to last) and y (last column). :param train_filename: The file name of the training dat...
[ "os.path.join", "numpy.genfromtxt" ]
[((1523, 1598), 'numpy.genfromtxt', 'np.genfromtxt', (['train_filename'], {'skip_header': 'skip_header', 'delimiter': 'delimiter'}), '(train_filename, skip_header=skip_header, delimiter=delimiter)\n', (1536, 1598), True, 'import numpy as np\n'), ((2843, 2878), 'os.path.join', 'path.join', (['""".."""', '"""resources"""...
import numpy as np import os import sys import scipy.stats # If there is __init__.py in the directory where this file is, then Python adds das_decennial directory to sys.path # automatically. Not sure why and how it works, therefore, keeping the following line as a double sys.path.append(os.path.dirname(os.path.dirn...
[ "programs.engine.primitives.GeometricMechanism", "programs.engine.primitives.geometric_mechanism", "os.path.dirname", "numpy.random.RandomState", "numpy.array", "numpy.exp" ]
[((595, 625), 'numpy.array', 'np.array', (['[5.5, 6.5, 7.2, 8.1]'], {}), '([5.5, 6.5, 7.2, 8.1])\n', (603, 625), True, 'import numpy as np\n'), ((674, 703), 'numpy.random.RandomState', 'np.random.RandomState', (['(137899)'], {}), '(137899)\n', (695, 703), True, 'import numpy as np\n'), ((713, 783), 'programs.engine.pri...
# Copyright 2019, The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "tensorflow.test.main", "numpy.amin", "tensorflow_model_optimization.python.core.internal.tensor_encoding.stages.research.clipping.ClipByNormEncodingStage", "tensorflow.random.normal", "tensorflow_model_optimization.python.core.internal.tensor_encoding.testing.test_utils.TestData", "tensorflow.random.unif...
[((2558, 2615), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['([2],)', '([2, 3],)', '([2, 3, 4],)'], {}), '(([2],), ([2, 3],), ([2, 3, 4],))\n', (2582, 2615), False, 'from absl.testing import parameterized\n'), ((5259, 5316), 'absl.testing.parameterized.parameters', 'parameterized.parameters',...
#! /usr/bin/python3 import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.ticker as ticker from matplotlib.patches import Rectangle import numpy as np import math import sys def verbose_usage_and_exit(): sys.stderr.write('\nheatmap.py - Draw a heatmap from a .CSV fi...
[ "matplotlib.patches.Rectangle", "matplotlib.ticker.FixedLocator", "math.log", "matplotlib.use", "numpy.array", "matplotlib.ticker.NullFormatter", "sys.stderr.write", "matplotlib.ticker.FixedFormatter", "matplotlib.pyplot.subplots" ]
[((42, 63), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (56, 63), False, 'import matplotlib\n'), ((258, 328), 'sys.stderr.write', 'sys.stderr.write', (['"""\nheatmap.py - Draw a heatmap from a .CSV file\n"""'], {}), '("""\nheatmap.py - Draw a heatmap from a .CSV file\n""")\n', (274, 328), Fals...
# Copyright 2016-2021 The <NAME> at the California Institute of # Technology (Caltech), with support from the Paul Allen Family Foundation, # Google, & National Institutes of Health (NIH) under Grant U24CA224309-01. # All rights reserved. # # Licensed under a modified Apache License, Version 2.0 (the "License"); # you ...
[ "skimage.feature.peak_local_max", "numpy.argmax", "skimage.exposure.rescale_intensity", "skimage.feature.register_translation", "skimage.morphology.dilation", "numpy.zeros_like", "numpy.copy", "logging.warning", "numpy.fft.fftn", "numpy.percentile", "skimage.morphology.watershed", "numpy.squee...
[((4296, 4316), 'numpy.zeros_like', 'np.zeros_like', (['image'], {}), '(image)\n', (4309, 4316), True, 'import numpy as np\n'), ((6511, 6538), 'numpy.copy', 'np.copy', (['prediction[..., 0]'], {}), '(prediction[..., 0])\n', (6518, 6538), True, 'import numpy as np\n'), ((6702, 6729), 'numpy.copy', 'np.copy', (['predicti...
# Contains the helper functions for the optim_preproc class from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np from copy import deepcopy import pandas as pd from aif360.algorithms import Transformer fr...
[ "pandas.DataFrame", "numpy.abs" ]
[((3125, 3264), 'pandas.DataFrame', 'pd.DataFrame', (["{'None/Paid': [0.0, 1.0, 2.0], 'Delay': [1.0, 0.0, 1.0], 'Other': [2.0, 1.0,\n 0.0]}"], {'index': "['None/Paid', 'Delay', 'Other']"}), "({'None/Paid': [0.0, 1.0, 2.0], 'Delay': [1.0, 0.0, 1.0],\n 'Other': [2.0, 1.0, 0.0]}, index=['None/Paid', 'Delay', 'Other'...
import time import numpy as np from scipy import sparse from numba import njit from numpy.linalg import norm from scipy.sparse.linalg import svds from andersoncd.lasso import ST, ST_vec def primal_logreg(Xw, y, w, alpha, rho=0): """Primal objective of L1 + L2 regularized logistic regression Parameters ...
[ "numpy.random.seed", "numpy.abs", "numpy.sum", "scipy.sparse.issparse", "numpy.ones", "numpy.arange", "numpy.exp", "numpy.linalg.norm", "scipy.sparse.linalg.norm", "numpy.isfortran", "scipy.sparse.linalg.svds", "numpy.random.choice", "numpy.asfortranarray", "numpy.hstack", "numpy.dot", ...
[((4184, 4204), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (4198, 4204), True, 'import numpy as np\n'), ((4222, 4240), 'scipy.sparse.issparse', 'sparse.issparse', (['X'], {}), '(X)\n', (4237, 4240), False, 'from scipy import sparse\n'), ((4282, 4303), 'numpy.arange', 'np.arange', (['n_features']...
# -*- coding: utf-8 -*- """ Created on Mon Dec 23 21:57:24 2019 @author: Daniel """ import numpy as np from mossycell_cat import MossyCell from basketcell import BasketCell from granulecell import GranuleCell import os from neuron import h, gui from scipy.optimize import minimize import time import pdb # load modifi...
[ "numpy.load", "scipy.optimize.minimize", "neuron.h.frecord_init", "neuron.h.Vector", "numpy.square", "neuron.h.finitialize", "neuron.h.NetCon", "neuron.h.nrn_load_dll", "neuron.h.NetStim", "numpy.around", "os.path.isfile", "neuron.h.cvode.active", "numpy.array", "numpy.arange", "numpy.sp...
[((604, 627), 'neuron.h.nrn_load_dll', 'h.nrn_load_dll', (['dll_dir'], {}), '(dll_dir)\n', (618, 627), False, 'from neuron import h, gui\n'), ((523, 540), 'os.path.isfile', 'os.path.isfile', (['x'], {}), '(x)\n', (537, 540), False, 'import os\n'), ((2308, 2319), 'neuron.h.NetStim', 'h.NetStim', ([], {}), '()\n', (2317,...
"""Functions to compute C/F splittings for use in Classical AMG. Overview -------- A C/F splitting is a partitioning of the nodes in the graph of as connection matrix (denoted S for strength) into sets of C (coarse) and F (fine) nodes. The C-nodes are promoted to the coarser grid while the F-nodes are retained on the ...
[ "pyamg.amg_core.rs_cf_splitting", "pyamg.amg_core.cljp_naive_splitting", "numpy.empty", "pyamg.util.utils.remove_diagonal", "numpy.ones", "pyamg.graph.vertex_coloring", "scipy.sparse.isspmatrix_csr" ]
[((4426, 4444), 'pyamg.util.utils.remove_diagonal', 'remove_diagonal', (['S'], {}), '(S)\n', (4441, 4444), False, 'from pyamg.util.utils import remove_diagonal\n'), ((4526, 4560), 'numpy.empty', 'np.empty', (['S.shape[0]'], {'dtype': '"""intc"""'}), "(S.shape[0], dtype='intc')\n", (4534, 4560), True, 'import numpy as n...
import numpy as np import scipy import itertools import time from math import factorial import copy as cp import sys from tpsci import * from pyscf_helper import * import pyscf ttt = time.time() np.set_printoptions(suppress=True, precision=3, linewidth=1500) pyscf.lib.num_threads(1) #with degenerate states and multip...
[ "numpy.set_printoptions", "scipy.sparse.linalg.eigsh", "pyscf.lib.num_threads", "time.time" ]
[((184, 195), 'time.time', 'time.time', ([], {}), '()\n', (193, 195), False, 'import time\n'), ((196, 259), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)', 'precision': '(3)', 'linewidth': '(1500)'}), '(suppress=True, precision=3, linewidth=1500)\n', (215, 259), True, 'import numpy as np\n'...
# -*- coding: utf-8 -*- # # Copyright 2018-2019 Data61, CSIRO # # 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 applicabl...
[ "numpy.ones_like", "tensorflow.keras.regularizers.l2", "tensorflow.keras.Input", "numpy.zeros", "numpy.ones", "tensorflow.keras.Model", "pytest.raises", "networkx.Graph", "numpy.array", "stellargraph.StellarGraph", "pytest.approx", "tensorflow.keras.models.model_from_json" ]
[((926, 936), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (934, 936), True, 'import networkx as nx\n'), ((2660, 2696), 'tensorflow.keras.Model', 'keras.Model', ([], {'inputs': 'inp', 'outputs': 'out'}), '(inputs=inp, outputs=out)\n', (2671, 2696), False, 'from tensorflow import keras\n'), ((2882, 2902), 'numpy.arra...
# =============================================================================== # Copyright 2015 <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/LI...
[ "sklearn.externals.joblib.dump", "numpy.hstack", "os.path.isfile", "numpy.array", "sklearn.externals.joblib.load", "os.path.join", "numpy.vstack" ]
[((2007, 2024), 'os.path.isfile', 'os.path.isfile', (['p'], {}), '(p)\n', (2021, 2024), False, 'import os\n'), ((2094, 2139), 'sklearn.externals.joblib.dump', 'joblib.dump', (['self._clf', 'self.persistence_path'], {}), '(self._clf, self.persistence_path)\n', (2105, 2139), False, 'from sklearn.externals import joblib\n...
# Program: caculate similarity between 2D geometry using vector # Author: <NAME>. <EMAIL> # Date: 2020.1 import cv2 import numpy import math import sys, getopt def readContour(file): pts = [] f = open(file, 'r') while True: line = f.readline() if not line: break tokens = line.split(',') i...
[ "cv2.matchShapes", "cv2.cvtColor", "cv2.waitKey", "cv2.moments", "numpy.zeros", "cv2.imshow", "numpy.array", "numpy.linalg.norm", "cv2.drawContours", "numpy.dot", "numpy.arccos", "numpy.delete" ]
[((517, 533), 'numpy.array', 'numpy.array', (['pts'], {}), '(pts)\n', (528, 533), False, 'import numpy\n'), ((1729, 1755), 'numpy.arccos', 'numpy.arccos', (['cosine_angle'], {}), '(cosine_angle)\n', (1741, 1755), False, 'import numpy\n'), ((2752, 2808), 'numpy.zeros', 'numpy.zeros', (['[normalizeSize, normalizeSize]', ...
import os from collections import defaultdict import numpy as np import torch from argparse import ArgumentParser from pytorch_lightning import Trainer, seed_everything from pytorch_lightning.callbacks import LearningRateMonitor from pytorch_lightning.loggers import TensorBoardLogger from PIL import Image from torchvis...
[ "numpy.load", "pytorch_lightning.Trainer", "pytorch_lightning.seed_everything", "argparse.ArgumentParser", "os.getcwd", "torch.zeros", "PIL.Image.fromarray", "torch.abs", "numpy.where", "numpy.array", "torch.arange", "pytorch_lightning.loggers.TensorBoardLogger", "torch.tensor", "pytorch_l...
[((3347, 3365), 'pytorch_lightning.seed_everything', 'seed_everything', (['(0)'], {}), '(0)\n', (3362, 3365), False, 'from pytorch_lightning import Trainer, seed_everything\n'), ((3716, 3737), 'pytorch_lightning.callbacks.LearningRateMonitor', 'LearningRateMonitor', ([], {}), '()\n', (3735, 3737), False, 'from pytorch_...
#!/usr/bin/env python3 import numpy as np Deep = __import__('19-deep_neural_network').DeepNeuralNetwork lib_train = np.load('../data/Binary_Train.npz') X_3D, Y = lib_train['X'], lib_train['Y'] X = X_3D.reshape((X_3D.shape[0], -1)).T np.random.seed(0) deep = Deep(X.shape[0], [5, 3, 1]) A, _ = deep.forward_prop(X) co...
[ "numpy.load", "numpy.random.seed" ]
[((119, 154), 'numpy.load', 'np.load', (['"""../data/Binary_Train.npz"""'], {}), "('../data/Binary_Train.npz')\n", (126, 154), True, 'import numpy as np\n'), ((237, 254), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (251, 254), True, 'import numpy as np\n')]
import numpy as np from numpy import ndarray from src.tests.bandit_algorithms.environments.bandit_test_environment import BanditTestEnvironment # It uses phases (so Abrupt Changes). class BanditNonStationaryTestEnvironment(BanditTestEnvironment): # n_arms = number of arms. # probabilities = probability distr...
[ "numpy.random.binomial" ]
[((1082, 1106), 'numpy.random.binomial', 'np.random.binomial', (['(1)', 'p'], {}), '(1, p)\n', (1100, 1106), True, 'import numpy as np\n')]
import numpy as np import warnings import os from pyiron.gpaw.pyiron_ase import AseJob from pyiron.atomistics.structure.atoms import pyiron_to_ase from pyiron.base.generic.parameters import GenericParameters from pyiron.base.settings.generic import Settings from ase import Atoms s = Settings() os.environ['GPAW_SETUP_P...
[ "numpy.min", "numpy.max", "numpy.linalg.norm", "pyiron.atomistics.structure.atoms.pyiron_to_ase", "numpy.array", "pyiron.base.settings.generic.Settings", "warnings.warn", "os.path.join" ]
[((285, 295), 'pyiron.base.settings.generic.Settings', 'Settings', ([], {}), '()\n', (293, 295), False, 'from pyiron.base.settings.generic import Settings\n'), ((328, 383), 'os.path.join', 'os.path.join', (['s.resource_paths[0]', '"""gpaw"""', '"""potentials"""'], {}), "(s.resource_paths[0], 'gpaw', 'potentials')\n", (...
""" This module provides functions for easy separation of data based on what kind of data it is. For example, it is helpful to distinguish between categorical and non-categorical data as categorical data is often more appropriately represented in one-hot encodings. """ import numpy as np def logical_filter(l, logica...
[ "numpy.apply_along_axis", "numpy.logical_not" ]
[((1179, 1206), 'numpy.logical_not', 'np.logical_not', (['categorical'], {}), '(categorical)\n', (1193, 1206), True, 'import numpy as np\n'), ((2279, 2319), 'numpy.apply_along_axis', 'np.apply_along_axis', (['is_int_column', '(0)', 'X'], {}), '(is_int_column, 0, X)\n', (2298, 2319), True, 'import numpy as np\n'), ((233...
import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pickle from matplotlib.colors import Normalize from matplotlib import rc from matplotlib.colors import LogNorm import glob import ipdb import h5py as h5 from matplotlib.colors import LogNorm method = 'etks' wlk = 0.0100 stat = 'anal' f = ...
[ "seaborn.heatmap", "matplotlib.pyplot.show", "numpy.transpose", "matplotlib.pyplot.figtext", "numpy.shape", "matplotlib.pyplot.figure", "matplotlib.colors.LogNorm", "numpy.array", "numpy.arange", "seaborn.color_palette", "numpy.min" ]
[((469, 511), 'numpy.array', 'np.array', (["f[method + '_' + stat + '_rmse']"], {}), "(f[method + '_' + stat + '_rmse'])\n", (477, 511), True, 'import numpy as np\n'), ((526, 570), 'numpy.array', 'np.array', (["f[method + '_' + stat + '_spread']"], {}), "(f[method + '_' + stat + '_spread'])\n", (534, 570), True, 'impor...
from typing import Tuple, Optional import cvxpy as cp import torch import numpy as np from neural_clbf.systems import ObservableSystem, PlanarLidarSystem # noqa from neural_clbf.controllers.controller import Controller from neural_clbf.experiments import ExperimentSuite class ObsMPCController(Controller): """ ...
[ "cvxpy.log_det", "numpy.linalg.eigh", "torch.clamp", "numpy.linalg.norm", "numpy.sin", "numpy.cos", "cvxpy.Variable", "torch.zeros", "cvxpy.trace", "cvxpy.quad_form", "cvxpy.sum_squares", "torch.tensor", "cvxpy.Minimize" ]
[((7180, 7212), 'torch.clamp', 'torch.clamp', (['u', 'u_lower', 'u_upper'], {}), '(u, u_lower, u_upper)\n', (7191, 7212), False, 'import torch\n'), ((3076, 3111), 'cvxpy.Variable', 'cp.Variable', (['(2, 2)'], {'symmetric': '(True)'}), '((2, 2), symmetric=True)\n', (3087, 3111), True, 'import cvxpy as cp\n'), ((3965, 39...
# built-in import time from datetime import datetime import json # third-party import numpy as np # local from epibox.common.connect_device import connect_device from epibox.exceptions.exception_manager import error_kill def start_devices(client, devices, fs, mac_channels, header): # Start acquisition with the ...
[ "epibox.exceptions.exception_manager.error_kill", "numpy.zeros", "time.sleep", "time.time", "epibox.common.connect_device.connect_device", "datetime.datetime.now" ]
[((439, 453), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (451, 453), False, 'from datetime import datetime\n'), ((1367, 1381), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1379, 1381), False, 'from datetime import datetime\n'), ((503, 514), 'time.time', 'time.time', ([], {}), '()\n', (512...
""" Utils for time series statistics -------------------------------- """ import math from typing import Tuple, Optional import matplotlib.pyplot as plt import numpy as np from scipy.stats import norm from statsmodels.tsa.seasonal import seasonal_decompose from statsmodels.tsa.stattools import acf from ..logging imp...
[ "scipy.stats.norm.ppf", "math.sqrt", "numpy.nonzero", "matplotlib.pyplot.figure", "numpy.arange", "numpy.sign", "numpy.gradient" ]
[((1817, 1831), 'numpy.gradient', 'np.gradient', (['r'], {}), '(r)\n', (1828, 1831), True, 'import numpy as np\n'), ((1869, 1886), 'numpy.sign', 'np.sign', (['gradient'], {}), '(gradient)\n', (1876, 1886), True, 'import numpy as np\n'), ((4077, 4098), 'math.sqrt', 'math.sqrt', (['(1 / length)'], {}), '(1 / length)\n', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np def polar_plot(data, label=None, offset=None, plot_circles=False, title=None, r_max=0.04, step=0.01, f=1, ...
[ "numpy.radians", "matplotlib.pyplot.subplot" ]
[((620, 656), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {'projection': '"""polar"""'}), "(111, projection='polar')\n", (631, 656), True, 'import matplotlib.pyplot as plt\n'), ((1289, 1319), 'numpy.radians', 'np.radians', (['(label_position + 5)'], {}), '(label_position + 5)\n', (1299, 1319), True, 'import...
from netCDF4 import Dataset import pandas as pd import numpy as np ncep_path = '/SubX/forecast/tas2m/daily/full/NCEP-CFSv2/' # the path where the raw data from NCEP-CFSv2 is saved gmao_path = '/SubX/forecast/tas2m/daily/full/GMAO-GEOS_V2p1/' for model in ['NCEP', 'GMAO']: if model == 'NCEP': path = ncep_...
[ "pandas.date_range", "pandas.Series", "numpy.isnan" ]
[((1220, 1240), 'pandas.Series', 'pd.Series', (['GMAO_date'], {}), '(GMAO_date)\n', (1229, 1240), True, 'import pandas as pd\n'), ((368, 409), 'pandas.date_range', 'pd.date_range', (['"""2017-07-01"""', '"""2019-12-31"""'], {}), "('2017-07-01', '2019-12-31')\n", (381, 409), True, 'import pandas as pd\n'), ((710, 730), ...
# 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 writing, software # distribu...
[ "cirq.resolve_parameters", "numpy.allclose", "cirq.testing.assert_allclose_up_to_global_phase", "numpy.ones", "openfermioncirq.CXXYYPowGate", "openfermioncirq.QuadraticFermionicSimulationGate", "numpy.arange", "numpy.exp", "pytest.mark.parametrize", "openfermioncirq.QuarticFermionicSimulationGate"...
[((1265, 1339), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""index_pair,n_qubits"""', '[((0, 1), 2), ((0, 3), 2)]'], {}), "('index_pair,n_qubits', [((0, 1), 2), ((0, 3), 2)])\n", (1288, 1339), False, 'import pytest\n'), ((9637, 9769), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""gate, expo...
# Copyright (c) 2017 Sony Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
[ "PIL.Image.fromarray", "numpy.broadcast_to", "numpy.asarray", "PIL.Image.open" ]
[((1928, 1959), 'numpy.asarray', 'np.asarray', (['ret'], {'dtype': 'np.uint8'}), '(ret, dtype=np.uint8)\n', (1938, 1959), True, 'import numpy as np\n'), ((2081, 2112), 'PIL.Image.fromarray', 'Image.fromarray', (['arr'], {'mode': 'mode'}), '(arr, mode=mode)\n', (2096, 2112), False, 'from PIL import Image\n'), ((2187, 22...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.2.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # s_ca...
[ "arpym.pricing.bsm_function", "numpy.maximum", "numpy.log", "matplotlib.patches.Rectangle", "pandas.read_csv", "arpym.tools.logo.add_logo", "matplotlib.pyplot.subplot2grid", "numpy.ones", "arpym.statistics.meancov_sp", "numpy.percentile", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figur...
[((1681, 1739), 'pandas.read_csv', 'pd.read_csv', (['(path + file)'], {'usecols': "['v_call_thor', 'log_s']"}), "(path + file, usecols=['v_call_thor', 'log_s'])\n", (1692, 1739), True, 'import pandas as pd\n'), ((2081, 2113), 'pandas.read_csv', 'pd.read_csv', (["(path + 'params.csv')"], {}), "(path + 'params.csv')\n", ...
# -*- coding: utf-8 -*- """ Created on Fri Nov 30 21:50:19 2018 @author: renxi """ # In[] BisecBSIV def BisecBSIV(PutCall,S,K,rf,q,T,a,b,MktPrice,Tol,MaxIter): # ============================================================================= # The earlier code invokes theMatlab function Bis...
[ "numpy.ones", "numpy.argmin", "numpy.arange", "numpy.exp", "numpy.interp", "numpy.fft.fft", "numpy.polynomial.laguerre.laggauss", "math.log", "numpy.fft.ifft", "numpy.conj", "math.sqrt", "numpy.random.permutation", "math.exp", "numpy.log", "numpy.logical_and", "numpy.zeros", "scipy.s...
[((3821, 3855), 'numpy.polynomial.laguerre.laggauss', 'np.polynomial.laguerre.laggauss', (['n'], {}), '(n)\n', (3852, 3855), True, 'import numpy as np\n'), ((3896, 3907), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (3904, 3907), True, 'import numpy as np\n'), ((5552, 5558), 'math.log', 'log', (['S'], {}), '(S)\n',...
import os import torch from torch import nn from torchvision.datasets import CIFAR10 from torch.utils.data import DataLoader from torchvision import transforms import pickle import numpy as np from torch.optim import lr_scheduler import shutil import argparse os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" #os.enviro...
[ "torch.nn.Dropout", "numpy.sum", "argparse.ArgumentParser", "numpy.mean", "pickle.load", "torch.no_grad", "os.path.join", "torch.utils.data.DataLoader", "torch.optim.lr_scheduler.ReduceLROnPlateau", "os.path.exists", "torch.nn.Linear", "shutil.copyfile", "torch.nn.Tanh", "os.listdir", "n...
[((360, 455), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Two-Stream Action Recognition RGB Test Case"""'}), "(description=\n 'PyTorch Two-Stream Action Recognition RGB Test Case')\n", (383, 455), False, 'import argparse\n'), ((3770, 3785), 'numpy.sum', 'np.sum', (['correct...
import pytest import numpy as np from pyGPB import GPB from pyGPB._cpu_methods import _GPB_DP_DC_FFT_Combo, _GPB_CF from pyGPB._gpu_methods import _GPB_DP_CUDA import pyGPB._cpu_methods as cpu import pyGPB._gpu_methods as gpu simple_test_cases = [ {'probs': [0.040315790866, 0.71982418469], 'weights': [4, 3], ...
[ "pyGPB.GPB", "numpy.allclose", "numpy.zeros", "pytest.raises", "numpy.array" ]
[((31755, 31780), 'numpy.array', 'np.array', (['[0.1, 0.2, 0.3]'], {}), '([0.1, 0.2, 0.3])\n', (31763, 31780), True, 'import numpy as np\n'), ((31795, 31814), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (31803, 31814), True, 'import numpy as np\n'), ((31831, 31850), 'numpy.array', 'np.array', (['[4...
""" Doubly shear layer in 2D. Special Inputs & standard value: shear_layer_width = 80, initial_perturbation_magnitude = 0.05 """ import numpy as np from lettuce.unit import UnitConversion class DoublyPeriodicShear2D: def __init__(self, resolution, reynolds_number, mach_number, lattice, shear_layer_width=80, init...
[ "numpy.stack", "numpy.zeros_like", "numpy.meshgrid", "numpy.tanh", "numpy.sin", "lettuce.unit.UnitConversion", "numpy.linspace" ]
[((540, 725), 'lettuce.unit.UnitConversion', 'UnitConversion', (['lattice'], {'reynolds_number': 'reynolds_number', 'mach_number': 'mach_number', 'characteristic_length_lu': 'resolution', 'characteristic_length_pu': '(1)', 'characteristic_velocity_pu': '(1)'}), '(lattice, reynolds_number=reynolds_number, mach_number=\n...
# @Time : 2020/9/3 # @Author : <NAME> # @Email : <EMAIL> # UPDATE: # @Time : 2020/10/16, 2020/9/15, 2020/10/25 # @Author : <NAME>, <NAME>, <NAME> # @Email : <EMAIL>, <EMAIL>, <EMAIL> """ recbole.data.kg_dataset ########################## """ import os from collections import Counter import numpy as np import ...
[ "numpy.full", "dgl.graph", "recbole.data.utils.dlapi.set", "torch.stack", "torch.cat", "torch.full", "numpy.append", "scipy.sparse.coo_matrix", "recbole.utils.utils.set_color", "numpy.arange", "os.path.isfile", "numpy.array", "collections.Counter", "os.path.join", "numpy.concatenate" ]
[((9684, 9695), 'recbole.data.utils.dlapi.set', 'dlapi.set', ([], {}), '()\n', (9693, 9695), False, 'from recbole.data.utils import dlapi\n'), ((9934, 9945), 'recbole.data.utils.dlapi.set', 'dlapi.set', ([], {}), '()\n', (9943, 9945), False, 'from recbole.data.utils import dlapi\n'), ((14338, 14349), 'recbole.data.util...
""" core class to analze Time Series data from the two-photon microscope """ import os import numpy as np import matplotlib.image as mpimg import time from read_roi import read_roi_zip import matplotlib.pyplot as plt import matplotlib.cm as cm import glob import webbrowser import winsound COLORMAPS = sorted([m for m ...
[ "matplotlib.pyplot.title", "os.mkdir", "numpy.load", "os.remove", "matplotlib.pyplot.margins", "matplotlib.pyplot.figure", "numpy.rot90", "numpy.arange", "numpy.exp", "glob.glob", "matplotlib.pyplot.gca", "numpy.convolve", "matplotlib.pyplot.fill_between", "numpy.fft.ifft2", "os.path.joi...
[((950, 973), 'os.path.exists', 'os.path.exists', (['roiFile'], {}), '(roiFile)\n', (964, 973), False, 'import os\n'), ((985, 1006), 'read_roi.read_roi_zip', 'read_roi_zip', (['roiFile'], {}), '(roiFile)\n', (997, 1006), False, 'from read_roi import read_roi_zip\n'), ((3521, 3549), 'numpy.linspace', 'np.linspace', (['(...
import pytest import xarray import dask.array as da from itertools import product from collections import namedtuple from quartical.gains.gain import gain_spec_tup from quartical.interpolation.interpolate import (load_and_interpolate_gains, convert_and_drop, ...
[ "copy.deepcopy", "quartical.interpolation.interpolate.make_interp_xds_list", "quartical.interpolation.interpolate.make_concat_xds_list", "dask.array.zeros", "pytest.fixture", "xarray.Dataset", "dask.array.compute", "pytest.raises", "dask.array.array", "numpy.arange", "collections.namedtuple", ...
[((1129, 1176), 'collections.namedtuple', 'namedtuple', (['"""BOUNDS"""', '"""min_t max_t min_f max_f"""'], {}), "('BOUNDS', 'min_t max_t min_f max_f')\n", (1139, 1176), False, 'from collections import namedtuple\n'), ((3005, 3035), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\...
import torch import torch.nn as nn from torch.autograd import Variable import numpy as np def batch_matmul(seq, weight, nonlinearity=''): s = None for i in range(seq.size(0)): _s = torch.mm(seq[i], weight) if nonlinearity == 'tanh': _s = torch.tanh(_s) _s = _s.unsq...
[ "torch.autograd.Variable", "torch.cat", "torch.mm", "torch.index_select", "torch.Tensor", "torch.nn.Softmax", "numpy.arange", "torch.sum", "torch.tanh" ]
[((199, 223), 'torch.mm', 'torch.mm', (['seq[i]', 'weight'], {}), '(seq[i], weight)\n', (207, 223), False, 'import torch\n'), ((903, 915), 'torch.nn.Softmax', 'nn.Softmax', ([], {}), '()\n', (913, 915), True, 'import torch.nn as nn\n'), ((276, 290), 'torch.tanh', 'torch.tanh', (['_s'], {}), '(_s)\n', (286, 290), False,...
#!/usr/bin/python3 from frc971.control_loops.python import control_loop from frc971.control_loops.python import controls import numpy import sys from matplotlib import pylab import glog class DrivetrainParams(object): def __init__(self, J, mass, robot_radius, ...
[ "frc971.control_loops.python.control_loop.CIM", "numpy.matrix", "frc971.control_loops.python.controls.kalman", "matplotlib.pylab.legend", "numpy.log", "frc971.control_loops.python.controls.TwoStateFeedForwards", "matplotlib.pylab.rc", "numpy.zeros", "frc971.control_loops.python.control_loop.Constant...
[((18949, 19135), 'frc971.control_loops.python.control_loop.ControlLoopWriter', 'control_loop.ControlLoopWriter', (['"""Drivetrain"""', '[drivetrain_low_low, drivetrain_low_high, drivetrain_high_low,\n drivetrain_high_high]'], {'namespaces': 'namespaces', 'scalar_type': 'scalar_type'}), "('Drivetrain', [drivetrain_l...
from typing import List, Optional import numpy as np from django.db import models from django.db.models.aggregates import Min, Max from django_pandas.managers import DataFrameManager from scipy import special from app.support.repetition import get_bow_dataframe, calculate_repetition from app_v2.db.utils import upsert...
[ "django.db.models.OneToOneField", "services.genius.remove_sections", "django.db.models.ManyToManyField", "django_pandas.managers.DataFrameManager", "app.support.repetition.get_bow_dataframe", "app_v2.db.utils.upsert", "django.db.models.ForeignKey", "django.db.models.CharField", "django.db.models.agg...
[((510, 582), 'django.db.models.OneToOneField', 'models.OneToOneField', (['"""GeniusSong"""'], {'null': '(True)', 'on_delete': 'models.SET_NULL'}), "('GeniusSong', null=True, on_delete=models.SET_NULL)\n", (530, 582), False, 'from django.db import models\n'), ((603, 677), 'django.db.models.OneToOneField', 'models.OneTo...
# -*- coding: utf-8 -*- """ Created on Tue Feb 23 11:49:11 2021 @author: peter """ import pandas as pd import numpy as np from scipy.optimize import minimize import scipy.stats as stats from abc import ABCMeta, abstractmethod from statsmodels.tools.numdiff import approx_fprime, approx_hess_cs class BaseModel(object,...
[ "pandas.DataFrame", "scipy.stats.norm.ppf", "numpy.zeros_like", "numpy.log", "numpy.zeros", "statsmodels.tools.numdiff.approx_hess_cs", "numpy.linalg.inv", "numpy.exp", "statsmodels.tools.numdiff.approx_fprime", "numpy.cov", "numpy.diag" ]
[((517, 539), 'numpy.zeros', 'np.zeros', (['params.shape'], {}), '(params.shape)\n', (525, 539), True, 'import numpy as np\n'), ((958, 986), 'numpy.zeros', 'np.zeros', (['params_trans.shape'], {}), '(params_trans.shape)\n', (966, 986), True, 'import numpy as np\n'), ((1380, 1406), 'numpy.zeros_like', 'np.zeros_like', (...
import math import numpy as np def grad(pos): u, v = pos u_grad = math.exp(u) + v*math.exp(u*v) + 2*u - 2*v -3 v_grad = 2*math.exp(2*v) + u*math.exp(u*v) - 2*u + 4*v - 2 return np.array([u_grad, v_grad]) def E(pos): u, v = pos e = math.exp(u) + math.exp(2*v) + math.exp(u*v) + u**2 - 2*u*v + 2...
[ "numpy.random.uniform", "math.exp", "numpy.sum", "numpy.zeros", "numpy.ones", "numpy.linalg.inv", "numpy.array", "numpy.sign" ]
[((195, 221), 'numpy.array', 'np.array', (['[u_grad, v_grad]'], {}), '([u_grad, v_grad])\n', (203, 221), True, 'import numpy as np\n'), ((374, 388), 'numpy.zeros', 'np.zeros', (['(2,)'], {}), '((2,))\n', (382, 388), True, 'import numpy as np\n'), ((524, 540), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (...
import logging import numpy as np from metaflow import ( conda, current, FlowSpec, Parameter, project, step, batch, ) from utils import ( find_knn, generate_index, get_clusters_embeddings, intify_clusters, reassign_clustered, assign_non_clustered, get_non_cluste...
[ "sklearn.feature_extraction.text.CountVectorizer", "metaflow.project", "utils.get_non_clusters_embeddings", "utils.assign_non_clustered", "industrial_taxonomy.getters.glass_house.embedded_org_ids", "utils.generate_index", "metaflow.batch", "industrial_taxonomy.getters.text_sectors.text_sectors", "in...
[((364, 391), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (381, 391), False, 'import logging\n'), ((463, 498), 'metaflow.project', 'project', ([], {'name': '"""industrial_taxonomy"""'}), "(name='industrial_taxonomy')\n", (470, 498), False, 'from metaflow import conda, current, FlowSpec...
#!/usr/bin/env python # Import required modules from __future__ import print_function from future import standard_library standard_library.install_aliases() from builtins import str import os import argparse import numpy as np parser = argparse.ArgumentParser(description='Running aCompCor') # Required options reqopt...
[ "numpy.sum", "argparse.ArgumentParser", "numpy.deg2rad", "future.standard_library.install_aliases", "numpy.savetxt", "numpy.zeros", "numpy.diff", "numpy.loadtxt" ]
[((123, 157), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (155, 157), False, 'from future import standard_library\n'), ((238, 293), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Running aCompCor"""'}), "(description='Running aCompCor'...
# -*- coding: utf-8 -*- import pickle import numpy as np import pandas as pd import torch from torch.autograd import Variable # N is batch size; D_in is input dimension; # H is hidden dimension; D_out is output dimension. from dataset_gen2 import DatasetGenerator2 class shn(): ''' Single Hidden Nuerual Netw...
[ "pandas.DataFrame", "dataset_gen2.DatasetGenerator2", "torch.nn.MSELoss", "pickle.dump", "torch.nn.ReLU", "pickle.load", "torch.max", "numpy.array", "torch.nn.Linear", "numpy.random.shuffle" ]
[((576, 612), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {'size_average': '(False)'}), '(size_average=False)\n', (592, 612), False, 'import torch\n'), ((1278, 1297), 'pandas.DataFrame', 'pd.DataFrame', (['train'], {}), '(train)\n', (1290, 1297), True, 'import pandas as pd\n'), ((1386, 1404), 'pandas.DataFrame', 'pd.D...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class AFMLayer(nn.Module): '''Attentional Factorization Machine. ''' def __init__(self, field_dims, embed_dim, output_dim, atten_hidden_dim, dropout): super().__init__() self.embedding = FeaturesEmbeddin...
[ "torch.nn.Dropout", "torch.nn.ReLU", "torch.nn.init.xavier_uniform_", "torch.nn.functional.dropout", "numpy.cumsum", "torch.nn.Softmax", "torch.nn.Linear", "torch.zeros", "torch.sum" ]
[((1590, 1641), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['self.embedding.weight.data'], {}), '(self.embedding.weight.data)\n', (1613, 1641), True, 'import torch.nn as nn\n'), ((2027, 2059), 'torch.nn.Linear', 'nn.Linear', (['embed_dim', 'output_dim'], {}), '(embed_dim, output_dim)\n', (2036, 2059),...
# coding: utf-8 # In[2]: get_ipython().magic('matplotlib inline') import matplotlib.pyplot as plt from keras.layers import Bidirectional, Input, LSTM, Dense, Activation, Conv1D, Flatten, Embedding, MaxPooling1D, Dropout #from keras.layers.embeddings import Embedding from keras.preprocessing.sequence import pad_seq...
[ "pandas.read_csv", "sklearn.model_selection.train_test_split", "keras.preprocessing.sequence.pad_sequences", "keras.models.Model", "keras.preprocessing.text.text_to_word_sequence", "keras.layers.Input", "pandas.DataFrame", "keras.optimizers.SGD", "autocorrect.spell", "keras.layers.Flatten", "spa...
[((726, 742), 'spacy.load', 'spacy.load', (['"""en"""'], {}), "('en')\n", (736, 742), False, 'import spacy\n'), ((818, 842), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (829, 842), True, 'import pandas as pd\n'), ((18526, 18549), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'],...
import numpy as np from scipy.ndimage import zoom from skimage.filters import median from skimage.morphology import ball, disk from skimage.transform import resize from vigra.filters import gaussianSmoothing from plantseg.pipeline import gui_logger from plantseg.pipeline.steps import GenericPipelineStep def _rescale...
[ "vigra.filters.gaussianSmoothing", "skimage.morphology.disk", "numpy.ones", "plantseg.pipeline.gui_logger.info", "scipy.ndimage.zoom", "numpy.array", "skimage.transform.resize", "numpy.array_equal", "skimage.morphology.ball" ]
[((351, 384), 'numpy.array_equal', 'np.array_equal', (['factor', '[1, 1, 1]'], {}), '(factor, [1, 1, 1])\n', (365, 384), True, 'import numpy as np\n'), ((863, 894), 'vigra.filters.gaussianSmoothing', 'gaussianSmoothing', (['image', 'sigma'], {}), '(image, sigma)\n', (880, 894), False, 'from vigra.filters import gaussia...
""" The sawyer robot starts in the center, because relying on starting from the left is unreliable. We now shape the reward to encourage the agent to lift the arm. Entropy bonus does not work super well with these Sawyer environments. Exploration should be done via other means, or provided by demonstrations. ...
[ "numpy.zeros", "numpy.ones", "numpy.random.RandomState", "numpy.mean", "numpy.linalg.norm", "gym.spaces.Box", "numpy.array", "numpy.random.normal", "collections.OrderedDict", "numpy.eye", "numpy.concatenate" ]
[((4578, 4590), 'numpy.eye', 'np.eye', (['(3)', '(3)'], {}), '(3, 3)\n', (4584, 4590), True, 'import numpy as np\n'), ((1214, 1241), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (1235, 1241), True, 'import numpy as np\n'), ((2676, 2712), 'gym.spaces.Box', 'Box', (['self.mocap_low', '...
# -*- coding: utf-8 -*- """ Created on Tue Mar 13 12:00:44 2018 @author: DLozano """ import matplotlib.pylab as plt import numpy as np import time import cv2 import sys, os #%% # dirParent = "D:/OneDrive - LA TROBE UNIVERSITY/PhD - Datasets" # dirParent = "C:/Users/dlozanoclaro/OneDrive - LA TROBE UNI...
[ "matplotlib.pylab.imshow", "numpy.ones", "numpy.argsort", "matplotlib.pylab.yticks", "numpy.mean", "matplotlib.pylab.subplots", "matplotlib.pylab.title", "numpy.round", "os.path.join", "matplotlib.pylab.figure", "matplotlib.pylab.show", "matplotlib.pylab.legend", "cv2.cvtColor", "numpy.std...
[((605, 623), 'numpy.finfo', 'np.finfo', (['np.float'], {}), '(np.float)\n', (613, 623), True, 'import numpy as np\n'), ((910, 925), 'matplotlib.pylab.imshow', 'plt.imshow', (['img'], {}), '(img)\n', (920, 925), True, 'import matplotlib.pylab as plt\n'), ((931, 946), 'matplotlib.pylab.title', 'plt.title', (['name'], {}...
# This file is part of comma, a generic and flexible library # Copyright (c) 2011 The University of Sydney # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must ...
[ "time.tzset", "numpy.datetime64", "numpy.dtype", "re.match", "os.environ.get" ]
[((1814, 1828), 'numpy.dtype', 'np.dtype', (['TYPE'], {}), '(TYPE)\n', (1822, 1828), True, 'import numpy as np\n'), ((1848, 1868), 'numpy.datetime64', 'np.datetime64', (['"""NaT"""'], {}), "('NaT')\n", (1861, 1868), True, 'import numpy as np\n'), ((1889, 1934), 'numpy.datetime64', 'np.datetime64', (['"""294247-01-09T04...
from setuptools import setup, Extension # from distutils.extension import Extension from Cython.Build import cythonize import numpy from pathlib import Path this_directory = Path(__file__).parent long_description = (this_directory / "README.md").read_text() VERSION="0.1.3" f=open("src/ldpc/VERSION","w+") f.write(VERSI...
[ "shutil.copyfile", "pathlib.Path", "Cython.Build.cythonize", "numpy.get_include" ]
[((174, 188), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (178, 188), False, 'from pathlib import Path\n'), ((413, 441), 'shutil.copyfile', 'copyfile', (['f', "('src/ldpc/' + f)"], {}), "(f, 'src/ldpc/' + f)\n", (421, 441), False, 'from shutil import copyfile\n'), ((2050, 2108), 'Cython.Build.cythonize'...
import math import struct import numpy as np from numpy.linalg import norm from indicies import PX, PY, PZ, TA, TB, TC class STLCanvas: def __init__(self): self.triangles = [] def compute_normal(self, triangle): Nraw = np.cross(np.subtract(triangle[TA], triangle[TB]), ...
[ "numpy.subtract", "math.sqrt", "struct.pack", "numpy.equal", "numpy.array", "numpy.add" ]
[((379, 435), 'math.sqrt', 'math.sqrt', (['(Nraw[PX] ** 2 + Nraw[PY] ** 2 + Nraw[PZ] ** 2)'], {}), '(Nraw[PX] ** 2 + Nraw[PY] ** 2 + Nraw[PZ] ** 2)\n', (388, 435), False, 'import math\n'), ((1108, 1181), 'numpy.array', 'np.array', (['[coord for tri in self.triangles for pt in tri for coord in pt]'], {}), '([coord for t...
import sys #sys.path.insert(0, './') import argparse import numpy as np import torch from torch.autograd import Variable from torch import nn from torch import cuda from utils.util import * from utils.extract import get_tokenizer, tokenize_underspecified_input from transformers import * import json parser = argparse.A...
[ "json.load", "argparse.ArgumentParser", "torch.autograd.Variable", "numpy.asarray", "torch.nn.functional.softmax", "torch.cuda.manual_seed_all", "utils.extract.tokenize_underspecified_input", "torch.cuda.set_device", "torch.no_grad" ]
[((310, 415), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n ArgumentDefaultsHelpFormatter)\n', (333, 415), False, 'import argparse\n'), ((3863, 3929), 'utils.extra...
import numpy as np import torch import torch.nn as nn from habitat_baselines.common.utils import Flatten from planner.base_cnn import BaseCNN class MidLevelCNN(BaseCNN): r"""A Simple 3-Conv CNN followed by a fully connected layer Takes in observations and produces an embedding of the rgb and/or depth compon...
[ "torch.nn.ReLU", "torch.nn.Sequential", "torch.nn.Conv2d", "torch.cat", "numpy.array", "torch.nn.Linear", "habitat_baselines.common.utils.Flatten" ]
[((742, 814), 'numpy.array', 'np.array', (["observation_space.spaces['midlevel'].shape[:2]"], {'dtype': 'np.uint8'}), "(observation_space.spaces['midlevel'].shape[:2], dtype=np.uint8)\n", (750, 814), True, 'import numpy as np\n'), ((2176, 2203), 'torch.cat', 'torch.cat', (['cnn_input'], {'dim': '(1)'}), '(cnn_input, di...
import numpy as np import torch import pytest from pytorch_tabnet.metrics import UnsupervisedLoss, UnsupervisedLossNumpy @pytest.mark.parametrize( "y_pred,embedded_x,obf_vars", [ ( np.random.uniform(low=-2, high=2, size=(20, 100)), np.random.uniform(low=-2, high=2, size=(20, 10...
[ "numpy.random.uniform", "numpy.ones", "numpy.random.choice", "pytorch_tabnet.metrics.UnsupervisedLossNumpy", "torch.tensor" ]
[((660, 738), 'pytorch_tabnet.metrics.UnsupervisedLossNumpy', 'UnsupervisedLossNumpy', ([], {'y_pred': 'y_pred', 'embedded_x': 'embedded_x', 'obf_vars': 'obf_vars'}), '(y_pred=y_pred, embedded_x=embedded_x, obf_vars=obf_vars)\n', (681, 738), False, 'from pytorch_tabnet.metrics import UnsupervisedLoss, UnsupervisedLossN...
# Post-Processing import pickle import pandas as pd import os import numpy as np import tensorflow as tf from matplotlib import pyplot as plt from sklearn.svm import LinearSVC as SVM from jax import hessian, jacobian, numpy as jnp import tqdm.auto as tqdm def normalize(a, axis=None): return a / np.linalg.norm...
[ "tensorflow.keras.models.load_model", "jax.numpy.einsum", "jax.hessian", "tensorflow.keras.layers.InputLayer", "numpy.linalg.eigvalsh", "tqdm.auto.tqdm", "jax.numpy.maximum", "numpy.linalg.norm", "jax.jacobian", "sklearn.svm.LinearSVC", "os.path.join", "os.listdir", "numpy.sqrt" ]
[((386, 407), 'os.listdir', 'os.listdir', (['model_dir'], {}), '(model_dir)\n', (396, 407), False, 'import os\n'), ((455, 477), 'tqdm.auto.tqdm', 'tqdm.tqdm', (['model_names'], {}), '(model_names)\n', (464, 477), True, 'import tqdm.auto as tqdm\n'), ((496, 531), 'os.path.join', 'os.path.join', (['model_dir', 'model_nam...
# Copyright (c) 2008,2015,2018,2019 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Collection of generally useful utility code from the cookbook.""" import os import numpy as np import pooch from . import __version__ POOCH = pooch.create( ...
[ "numpy.result_type", "os.path.dirname", "os.path.exists", "numpy.arange", "numpy.iterable", "pooch.os_cache" ]
[((878, 907), 'os.path.exists', 'os.path.exists', (['dev_data_path'], {}), '(dev_data_path)\n', (892, 907), False, 'import os\n'), ((2979, 2997), 'numpy.iterable', 'np.iterable', (['value'], {}), '(value)\n', (2990, 2997), True, 'import numpy as np\n'), ((325, 348), 'pooch.os_cache', 'pooch.os_cache', (['"""metpy"""'],...
# This script easily replicates ensemble results from the paper import os import sys import numpy as np import torch import torch.nn.functional as F from sklearn import metrics from utils.utils import setup_logging # These predictions are included in TOP-N ensemble # it was found via method find_best_ensemble_greed...
[ "torch.mean", "numpy.average", "torch.sum", "os.path.basename", "torch.nn.functional.softmax", "sklearn.metrics.f1_score", "torch.Tensor", "torch.max", "numpy.array", "os.path.join", "os.listdir" ]
[((3220, 3245), 'numpy.array', 'np.array', (['result_matrices'], {}), '(result_matrices)\n', (3228, 3245), True, 'import numpy as np\n'), ((4347, 4382), 'torch.max', 'torch.max', (['softmaxed_results'], {'dim': '(1)'}), '(softmaxed_results, dim=1)\n', (4356, 4382), False, 'import torch\n'), ((4624, 4684), 'sklearn.metr...
""" Copyright (C) 2018 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ from __future__ import print_function import time import numpy as np from PIL import Image from torch.autograd import Variable import torchvision...
[ "numpy.asarray", "PIL.Image.open", "torchvision.utils.make_grid", "time.time", "torch.nn.functional.upsample", "smooth_filter.smooth_filter", "PIL.Image.fromarray", "torch.no_grad", "torchvision.transforms.ToTensor" ]
[((835, 846), 'time.time', 'time.time', ([], {}), '()\n', (844, 846), False, 'import time\n'), ((2274, 2289), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2287, 2289), False, 'import torch\n'), ((3342, 3362), 'numpy.asarray', 'np.asarray', (['cont_seg'], {}), '(cont_seg)\n', (3352, 3362), True, 'import numpy as...
import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib.axes import Axes from mrivis.base import Carpet from os.path import dirname, join as pjoin, realpath, exists as pexists # test_dir = dirname(realpath(__file__)) # data_dir = realpath(pjoin(test_dir, '..', '..', 'example_datasets')) # epi_path =...
[ "numpy.count_nonzero", "numpy.zeros", "os.path.exists", "matplotlib.use", "numpy.random.randint", "mrivis.base.Carpet", "numpy.random.random", "numpy.arange", "tempfile.mktemp" ]
[((37, 58), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (51, 58), False, 'import matplotlib\n'), ((911, 956), 'numpy.random.randint', 'np.random.randint', (['min_num_dims', 'max_num_dims'], {}), '(min_num_dims, max_num_dims)\n', (928, 956), True, 'import numpy as np\n'), ((1053, 1087), 'numpy....
""" MIT License Copyright (c) 2021 porteratzo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
[ "numpy.abs", "matplotlib.cm.Set1", "open3d.geometry.PointCloud", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linalg.norm", "numpy.arange", "numpy.meshgrid", "numpy.multiply", "numpy.zeros_like", "numpy.max", "numpy.arccos", "numpy.ones_like", "numpy.asarray", "numpy.cross", "matplo...
[((1920, 1934), 'numpy.cross', 'np.cross', (['a', 'b'], {}), '(a, b)\n', (1928, 1934), True, 'import numpy as np\n'), ((1943, 1955), 'numpy.dot', 'np.dot', (['a', 'b'], {}), '(a, b)\n', (1949, 1955), True, 'import numpy as np\n'), ((1964, 1981), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {}), '(v)\n', (1978, 1981),...
"""Tests for layers.sparse""" import numpy as np import tensorflow as tf import deepr as dpr def test_layers_sparse_to_dense(): """Test for ToDense""" layer = dpr.layers.ToDense(default_value=-1) tensors = tf.sparse.SparseTensor(indices=[[0, 1], [1, 0]], values=[1, 1], dense_shape=[2, 2]) result = l...
[ "deepr.layers.ToDense", "tensorflow.Session", "numpy.testing.assert_equal", "tensorflow.sparse.SparseTensor" ]
[((171, 207), 'deepr.layers.ToDense', 'dpr.layers.ToDense', ([], {'default_value': '(-1)'}), '(default_value=-1)\n', (189, 207), True, 'import deepr as dpr\n'), ((222, 310), 'tensorflow.sparse.SparseTensor', 'tf.sparse.SparseTensor', ([], {'indices': '[[0, 1], [1, 0]]', 'values': '[1, 1]', 'dense_shape': '[2, 2]'}), '(...
from main import get_grid import unittest import pytest import numpy as np class GetGridTests(unittest.TestCase): """ Test that the relations in Appendix of Taylor et al. 1996 are satisfied. """ n_subfaces_x = 5 n_subfaces_y = 5 def setUp(self): self.x, self.y, self.lmbda, self.theta...
[ "numpy.allclose", "numpy.isnan", "pytest.main", "numpy.tan", "numpy.sin", "numpy.cos", "main.get_grid" ]
[((2210, 2233), 'pytest.main', 'pytest.main', (['[__file__]'], {}), '([__file__])\n', (2221, 2233), False, 'import pytest\n'), ((323, 369), 'main.get_grid', 'get_grid', (['self.n_subfaces_x', 'self.n_subfaces_y'], {}), '(self.n_subfaces_x, self.n_subfaces_y)\n', (331, 369), False, 'from main import get_grid\n'), ((643,...
import argparse import cv2 as cv import numpy as np import tensorflow as tf def run_inference(interpreter, input_size, image): # Pre process:Resize, float32 cast input_image = cv.resize(image, dsize=(input_size[1], input_size[0])) input_image = np.expand_dims(input_image, axis=0) input_image = input_...
[ "argparse.ArgumentParser", "numpy.expand_dims", "tensorflow.lite.Interpreter", "cv2.imread", "numpy.array", "numpy.linalg.norm", "numpy.dot", "cv2.resize" ]
[((187, 241), 'cv2.resize', 'cv.resize', (['image'], {'dsize': '(input_size[1], input_size[0])'}), '(image, dsize=(input_size[1], input_size[0]))\n', (196, 241), True, 'import cv2 as cv\n'), ((260, 295), 'numpy.expand_dims', 'np.expand_dims', (['input_image'], {'axis': '(0)'}), '(input_image, axis=0)\n', (274, 295), Tr...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
[ "warnings.simplefilter", "logging.warning", "PySide2.QtWidgets.QLabel", "matplotlib.pyplot.Rectangle", "matplotlib.pyplot.figure", "pathlib.Path", "warnings.catch_warnings", "math.log10", "numpy.nextafter", "numpy.log10", "weakref.ref" ]
[((3425, 3444), 'weakref.ref', 'weakref.ref', (['figure'], {}), '(figure)\n', (3436, 3444), False, 'import weakref\n'), ((13726, 13744), 'PySide2.QtWidgets.QLabel', 'QLabel', (['status_bar'], {}), '(status_bar)\n', (13732, 13744), False, 'from PySide2.QtWidgets import QAction, QLabel\n'), ((21560, 21585), 'warnings.cat...
import os import numpy as np import argparse parser = argparse.ArgumentParser() parser.add_argument('folder', type=str, help='data folder') parser.add_argument('search_random_state', type=int, help='random_state for hyperparams search')...
[ "os.mkdir", "argparse.ArgumentParser", "os.path.exists", "numpy.random.choice", "os.listdir" ]
[((56, 81), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (79, 81), False, 'import argparse\n'), ((1087, 1109), 'os.path.exists', 'os.path.exists', (['r_path'], {}), '(r_path)\n', (1101, 1109), False, 'import os\n'), ((1153, 1176), 'os.path.exists', 'os.path.exists', (['rr_path'], {}), '(rr_pa...
import time,threading import cv2,os,sys,socket,struct,pickle,psutil import numpy as np from tkinter import * anglelist = np.zeros(52, dtype='int') datalist=sorted(os.listdir('DATA/')) datacounter=len(datalist)+1 for i in range(len(datalist)): print(datalist) data=np.load("DATA/"+datalist[i],allow_pickle=True) ...
[ "numpy.load", "numpy.average", "numpy.zeros", "os.listdir" ]
[((121, 146), 'numpy.zeros', 'np.zeros', (['(52)'], {'dtype': '"""int"""'}), "(52, dtype='int')\n", (129, 146), True, 'import numpy as np\n'), ((163, 182), 'os.listdir', 'os.listdir', (['"""DATA/"""'], {}), "('DATA/')\n", (173, 182), False, 'import cv2, os, sys, socket, struct, pickle, psutil\n'), ((272, 321), 'numpy.l...
import numpy as np from mlagents.envs.exception import UnityException class BufferException(UnityException): """ Related to errors with the Buffer. """ pass class Buffer(dict): """ Buffer contains a dictionary of AgentBuffer. The AgentBuffers are indexed by agent_id. Buffer also contai...
[ "numpy.array", "numpy.random.shuffle" ]
[((9278, 9298), 'numpy.random.shuffle', 'np.random.shuffle', (['s'], {}), '(s)\n', (9295, 9298), True, 'import numpy as np\n'), ((9747, 9777), 'numpy.array', 'np.array', (['self[key][start:end]'], {}), '(self[key][start:end])\n', (9755, 9777), True, 'import numpy as np\n'), ((1923, 1937), 'numpy.array', 'np.array', (['...
import numpy as np import pickle class Vocab(object): def __init__(self): self.vocab = {} self.index2word = {} self.vec_index2word = {} self.unigram_table = [] def inc_or_add(self, word, cnt=1, vec=None): if word not in self.vocab: self.add_word(word, cnt, ...
[ "pickle.dump", "numpy.sum", "numpy.power", "pickle.load", "numpy.array" ]
[((3688, 3703), 'numpy.array', 'np.array', (['freqs'], {}), '(freqs)\n', (3696, 3703), True, 'import numpy as np\n'), ((3720, 3742), 'numpy.power', 'np.power', (['freqs', '(3 / 4)'], {}), '(freqs, 3 / 4)\n', (3728, 3742), True, 'import numpy as np\n'), ((3754, 3767), 'numpy.sum', 'np.sum', (['freqs'], {}), '(freqs)\n',...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import argparse import json import logging import os import random import sys from dataclasses import dataclass from pathlib import PurePath from typing import Iterable, Tuple import numpy as np import pandas as pd import t...
[ "reagent.ope.estimators.estimator.Evaluator", "argparse.ArgumentParser", "numpy.random.seed", "torch.multinomial", "reagent.ope.trainers.linear_trainers.LogisticRegressionTrainer", "pandas.read_csv", "random.sample", "torch.arange", "reagent.ope.estimators.types.ActionSpace", "reagent.ope.estimato...
[((884, 906), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (893, 906), False, 'from dataclasses import dataclass\n'), ((5684, 5706), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (5693, 5706), False, 'from dataclasses import dataclass\n'), (...
#! /usr/bin/env python import glob import math import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import Polygon import matplotlib.cm as cm import numpy as np import os import sys # Astropy packages we'll need from astropy import units as u from astropy.coordinates.sky_coo...
[ "astropy.units.Quantity", "astropy.table.Table", "numpy.abs", "matplotlib.pyplot.scatter", "matplotlib.pyplot.colorbar", "astropy.wcs.WCS", "matplotlib.patches.Polygon", "matplotlib.pyplot.figure", "matplotlib.use", "astropy.io.fits.open", "astropy.coordinates.sky_coordinate.SkyCoord", "multip...
[((73, 87), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (80, 87), True, 'import matplotlib as mpl\n'), ((1113, 1131), 'astropy.io.fits.open', 'fits.open', (['im_name'], {}), '(im_name)\n', (1122, 1131), False, 'from astropy.io import fits\n'), ((1990, 2007), 'numpy.vstack', 'np.vstack', (['merged'], ...
import numpy as np from kaa.templates import TempStrategy, Template from kaa.bundle import Bundle class SimpleStrat(TempStrategy): def __init__(self, model): super().__init__(model) self.toggle = True self.last_temp = np.copy(model.bund.T[1:]) self.iter = 0 self.change_ra...
[ "kaa.templates.Template", "numpy.copy", "kaa.bundle.Bundle" ]
[((250, 275), 'numpy.copy', 'np.copy', (['model.bund.T[1:]'], {}), '(model.bund.T[1:])\n', (257, 275), True, 'import numpy as np\n'), ((428, 442), 'kaa.templates.Template', 'Template', (['bund'], {}), '(bund)\n', (436, 442), False, 'from kaa.templates import TempStrategy, Template\n'), ((619, 671), 'kaa.bundle.Bundle',...
# Copyright 2018-2020 Xanadu Quantum 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...
[ "numpy.abs", "pennylane.measure.density_matrix", "numpy.allclose", "numpy.ones", "tensorflow.Variable", "numpy.sin", "pytest.mark.parametrize", "numpy.diag", "tensorflow.sin", "pennylane.PauliY", "pennylane.sample", "pytest.raises", "pennylane.device", "pennylane.CNOT", "pennylane.queuin...
[((9569, 9682), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""stat_func,return_type"""', '[(expval, Expectation), (var, Variance), (sample, Sample)]'], {}), "('stat_func,return_type', [(expval, Expectation), (\n var, Variance), (sample, Sample)])\n", (9592, 9682), False, 'import pytest\n'), ((13088, 13...
import numpy as np from bolero.environment.objective_functions import FUNCTIONS, ObjectiveFunction from nose.tools import assert_less, assert_almost_equal, assert_raises_regexp def test_optimum(): random_state = np.random.RandomState(0) for name, Objective in FUNCTIONS.items(): objective = Objective(r...
[ "nose.tools.assert_less", "bolero.environment.objective_functions.FUNCTIONS.items", "nose.tools.assert_raises_regexp", "nose.tools.assert_almost_equal", "numpy.random.RandomState", "bolero.environment.objective_functions.ObjectiveFunction" ]
[((218, 242), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (239, 242), True, 'import numpy as np\n'), ((270, 287), 'bolero.environment.objective_functions.FUNCTIONS.items', 'FUNCTIONS.items', ([], {}), '()\n', (285, 287), False, 'from bolero.environment.objective_functions import FUNCTIO...
import loopy as lp import numpy as np import numpy.linalg as la import ctypes import ctypes.util import os from time import time from tempfile import TemporaryDirectory from loopy.tools import (empty_aligned, address_from_numpy, build_ispc_shared_lib, cptr_from_numpy) def transform(knl, vars, stream_dtype): ...
[ "loopy.tools.address_from_numpy", "tempfile.TemporaryDirectory", "os.path.join", "loopy.tools.build_ispc_shared_lib", "loopy.set_argument_order", "time.time", "loopy.tools.cptr_from_numpy", "numpy.finfo", "loopy.assume", "loopy.generate_code_v2", "loopy.tools.empty_aligned", "numpy.linalg.norm...
[((378, 399), 'loopy.assume', 'lp.assume', (['knl', '"""n>0"""'], {}), "(knl, 'n>0')\n", (387, 399), True, 'import loopy as lp\n'), ((410, 474), 'loopy.split_iname', 'lp.split_iname', (['knl', '"""i"""', '(2 ** 18)'], {'outer_tag': '"""g.0"""', 'slabs': '(0, 1)'}), "(knl, 'i', 2 ** 18, outer_tag='g.0', slabs=(0, 1))\n"...
# -*- coding: utf-8 -*- import scipy.misc import gym env = gym.make('Maze-v0') import matplotlib.pyplot as plt import numpy as np import tensorflow as tf STATE_DIM = 2 ACTION_DIM = 4 # Set the precsion of keras otherwise the sum of probability given by softmax will not be 1 tf.keras.backend.set_floatx('float64') cl...
[ "tensorflow.one_hot", "numpy.zeros_like", "gym.make", "tensorflow.keras.layers.Dense", "tensorflow.nn.softmax_cross_entropy_with_logits", "numpy.std", "tensorflow.reduce_mean", "tensorflow.keras.activations.softmax", "numpy.mean", "tensorflow.keras.optimizers.Adam", "numpy.array", "tensorflow....
[((59, 78), 'gym.make', 'gym.make', (['"""Maze-v0"""'], {}), "('Maze-v0')\n", (67, 78), False, 'import gym\n'), ((278, 316), 'tensorflow.keras.backend.set_floatx', 'tf.keras.backend.set_floatx', (['"""float64"""'], {}), "('float64')\n", (305, 316), True, 'import tensorflow as tf\n'), ((3395, 3414), 'gym.make', 'gym.mak...
import torch import numpy as np from . import flows # Transforms to be applied to data as preprocessing class Logit(flows.Flow): """ Logit mapping of image tensor, see RealNVP paper logit(alpha + (1 - alpha) * x) where logit(x) = log(x / (1 - x)) """ def __init__(self, alpha=0.05): """ ...
[ "numpy.log", "torch.log", "torch.sigmoid", "torch.sum", "torch.nn.functional.logsigmoid", "numpy.prod" ]
[((958, 970), 'torch.log', 'torch.log', (['z'], {}), '(z)\n', (967, 970), False, 'import torch\n'), ((988, 1004), 'torch.log', 'torch.log', (['(1 - z)'], {}), '(1 - z)\n', (997, 1004), False, 'import torch\n'), ((579, 612), 'torch.nn.functional.logsigmoid', 'torch.nn.functional.logsigmoid', (['z'], {}), '(z)\n', (609, ...
import numpy as np from queue import Queue import logging import networkx as nx from graphviz import Digraph from eg_mcts.algorithm.mol_node import MolNode from eg_mcts.algorithm.reaction_node import ReactionNode from eg_mcts.algorithm.syn_route import SynRoute class SearchTree: def __init__(self, targ...
[ "numpy.argmax", "eg_mcts.algorithm.syn_route.SynRoute", "eg_mcts.algorithm.mol_node.MolNode", "logging.info", "numpy.max", "graphviz.Digraph", "eg_mcts.algorithm.reaction_node.ReactionNode", "queue.Queue" ]
[((1114, 1209), 'eg_mcts.algorithm.mol_node.MolNode', 'MolNode', ([], {'mol': 'mol', 'parent': 'parent', 'is_known': 'is_known', 'zero_known_value': 'self.zero_known_value'}), '(mol=mol, parent=parent, is_known=is_known, zero_known_value=self.\n zero_known_value)\n', (1121, 1209), False, 'from eg_mcts.algorithm.mol_...
#!/usr/bin/env python """Ancestors/Descendants.""" from __future__ import print_function import os import sys import timeit import numpy as np from numpy.random import shuffle from scipy import stats from goatools.base import download_go_basic_obo from goatools.obo_parser import GODag from goatools.test_data.godag_t...
[ "goatools.gosubdag.gosubdag.GoSubDag", "os.path.abspath", "goatools.obo_parser.GODag", "timeit.default_timer", "goatools.base.download_go_basic_obo", "numpy.random.randint", "scipy.stats.describe", "numpy.random.shuffle", "numpy.sqrt" ]
[((657, 692), 'numpy.random.randint', 'np.random.randint', (['(10)', '(100)'], {'size': '(10)'}), '(10, 100, size=10)\n', (674, 692), True, 'import numpy as np\n'), ((2310, 2371), 'goatools.base.download_go_basic_obo', 'download_go_basic_obo', (['self.obo', 'sys.stdout'], {'loading_bar': 'None'}), '(self.obo, sys.stdou...
""" Deep RL Algorithms for OpenAI Gym environments """ import os import sys import gym import argparse import numpy as np import pandas as pd import tensorflow as tf import keras.backend as K from DDQN.ddqn import DDQN from DDPG.ddpg import DDPG from keras.backend.tensorflow_backend import set_session from keras.uti...
[ "argparse.ArgumentParser", "os.makedirs", "gym.make", "DDQN.ddqn.DDQN", "os.path.exists", "utils.atari_environment.AtariEnvironment", "tensorflow.summary.FileWriter", "numpy.array", "utils.unreal_environments.Environment", "DDPG.ddpg.DDPG" ]
[((724, 782), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Training parameters"""'}), "(description='Training parameters')\n", (747, 782), False, 'import argparse\n'), ((3256, 3317), 'tensorflow.summary.FileWriter', 'tf.summary.FileWriter', (["(args.type + '/tensorboard_' + args.env)"]...
""" Module to create models of arc lines. """ import astropy import re import scipy import numpy as np import matplotlib.pyplot as plt from pkg_resources import resource_filename from astropy.io import fits from astropy.convolution import convolve, Gaussian1DKernel from astropy.table import Table from astropy import...
[ "matplotlib.pyplot.title", "astropy.convolution.convolve", "numpy.abs", "pkg_resources.resource_filename", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.exp", "pypeit.msgs.warn", "scipy.interpolate.interp1d", "numpy.round", "pypeit.msgs.info", "numpy.zeros_like", "numpy....
[((3136, 3161), 'numpy.zeros_like', 'np.zeros_like', (['wavelength'], {}), '(wavelength)\n', (3149, 3161), True, 'import numpy as np\n'), ((3461, 3496), 'pypeit.msgs.info', 'msgs.info', (['"""Creating line spectrum"""'], {}), "('Creating line spectrum')\n", (3470, 3496), False, 'from pypeit import msgs\n'), ((4416, 447...
# License: MIT import copy import numpy as np from openbox.utils.config_space.util import convert_configurations_to_array from openbox.utils.constants import MAXINT, SUCCESS from openbox.core.base import Observation from openbox.core.generic_advisor import Advisor class AsyncBatchAdvisor(Advisor): def __init__(...
[ "numpy.median", "copy.deepcopy", "openbox.utils.config_space.util.convert_configurations_to_array", "openbox.core.base.Observation" ]
[((3288, 3353), 'openbox.utils.config_space.util.convert_configurations_to_array', 'convert_configurations_to_array', (['history_container.configurations'], {}), '(history_container.configurations)\n', (3319, 3353), False, 'from openbox.utils.config_space.util import convert_configurations_to_array\n'), ((3902, 3934), ...
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
[ "json.load", "pandas.read_csv", "numpy.where", "numpy.array", "numpy.log10", "pandas.concat" ]
[((1441, 1506), 'pandas.read_csv', 'pd.read_csv', (['"""./dataset/DAVIS/affinity.txt"""'], {'header': 'None', 'sep': '""" """'}), "('./dataset/DAVIS/affinity.txt', header=None, sep=' ')\n", (1452, 1506), True, 'import pandas as pd\n'), ((2464, 2529), 'pandas.read_csv', 'pd.read_csv', (['"""./dataset/KIBA/affinity.txt""...
import os import unittest import filecmp import numpy import matplotlib as mpl mpl.use('Agg') # create plots without running X-server import matplotlib.pyplot as plt import geojsoncontour class TestContourToGeoJson(unittest.TestCase): dirname = os.path.dirname(__file__) geojson_file = os.path.join(dirname, ...
[ "unittest.main", "os.remove", "numpy.meshgrid", "geojsoncontour.contourf_to_geojson", "os.path.dirname", "os.path.exists", "geojsoncontour.contourf_to_geojson_overlap", "matplotlib.pyplot.figure", "matplotlib.use", "numpy.arange", "numpy.linspace", "geojsoncontour.contour_to_geojson", "filec...
[((80, 94), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (87, 94), True, 'import matplotlib as mpl\n'), ((253, 278), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (268, 278), False, 'import os\n'), ((298, 336), 'os.path.join', 'os.path.join', (['dirname', '"""test1.geojson"...
from math import log, exp from typing import Optional, Type, Sequence import numpy as np import pytest import torch from torch.distributions import Binomial, Distribution, Weibull, ContinuousBernoulli from foundry.glm.family.util import subset_distribution, log1mexp from tests.glm.distribution.util import assert_dist...
[ "foundry.glm.family.util.log1mexp", "torch.ones", "math.exp", "tests.glm.distribution.util.assert_dist_equal", "pytest.raises", "torch.arange", "numpy.linspace", "torch.as_tensor", "pytest.mark.parametrize", "torch.tensor" ]
[((582, 698), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ([], {'ids': "['very small', 'very large']", 'argnames': "['x']", 'argvalues': '[(-3.3119e-17,), (-700.0,)]'}), "(ids=['very small', 'very large'], argnames=['x'],\n argvalues=[(-3.3119e-17,), (-700.0,)])\n", (605, 698), False, 'import pytest\n'), (...
from collections import namedtuple import numpy as np from six import string_types from ._base import Descriptor Eig = namedtuple("eigen", "val vec min max") methods = [] def method(cls): methods.append(cls) cls.as_argument = cls.__name__ return cls class MatrixAttributeBase(Descriptor): __slots...
[ "numpy.trace", "numpy.iscomplexobj", "numpy.maximum", "numpy.log", "numpy.argmax", "numpy.abs", "numpy.argmin", "numpy.mean", "collections.namedtuple", "numpy.exp" ]
[((122, 160), 'collections.namedtuple', 'namedtuple', (['"""eigen"""', '"""val vec min max"""'], {}), "('eigen', 'val vec min max')\n", (132, 160), False, 'from collections import namedtuple\n'), ((1481, 1499), 'numpy.iscomplexobj', 'np.iscomplexobj', (['w'], {}), '(w)\n', (1496, 1499), True, 'import numpy as np\n'), (...
import os, sys from os.path import dirname, join, abspath sys.path.insert(0, abspath(join(dirname(__file__), '..'))) from Experiments.Experiment import Experiment import json import argparse from Torch_Runners.modelWrapper import ModelWrapper from DataProcess.DataReader import DataReader import pandas as pd import nump...
[ "argparse.ArgumentParser", "numpy.argmax", "pandas.read_csv", "numpy.mean", "os.path.join", "pandas.DataFrame", "torch.utils.data.DataLoader", "numpy.std", "Torch_Runners.modelWrapper.ModelWrapper", "numpy.savetxt", "os.path.dirname", "os.path.exists", "numpy.transpose", "numpy.max", "Da...
[((14209, 14234), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (14232, 14234), False, 'import argparse\n'), ((912, 953), 'Experiments.Experiment.Experiment', 'Experiment', (['expID'], {'loadPath': 'self.jsonPath'}), '(expID, loadPath=self.jsonPath)\n', (922, 953), False, 'from Experiments.Exp...
# # Copyright (C) 2019 Databricks, 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 agreed to i...
[ "databricks.koalas.dask.utils.derived_from", "pandas.api.types.is_datetime64_dtype", "databricks.koalas.ml.corr", "pyspark.sql.types.to_arrow_type", "pandas.DataFrame", "pandas.api.types.is_datetime64tz_dtype", "inspect.signature", "pandas.api.types.is_list_like", "functools.partial", "pandas.api....
[((2000, 2026), 'databricks.koalas.dask.utils.derived_from', 'derived_from', (['pd.DataFrame'], {}), '(pd.DataFrame)\n', (2012, 2026), False, 'from databricks.koalas.dask.utils import derived_from\n'), ((30867, 30893), 'databricks.koalas.dask.utils.derived_from', 'derived_from', (['pd.DataFrame'], {}), '(pd.DataFrame)\...
import numpy as np from PIL import Image from argparse import ArgumentParser import pandas as pd import os def collect_args(): """ Sets up and collects necessary arguments using ArgumentParser. Returns ------- args : argparse.Namespace Namespace containing the arguments and their...
[ "pandas.DataFrame", "numpy.sum", "argparse.ArgumentParser", "numpy.zeros", "PIL.Image.open", "numpy.array", "numpy.reshape", "os.path.join", "os.scandir" ]
[((373, 410), 'argparse.ArgumentParser', 'ArgumentParser', (['"""python intensity.py"""'], {}), "('python intensity.py')\n", (387, 410), False, 'from argparse import ArgumentParser\n'), ((3212, 3241), 'os.path.join', 'os.path.join', (['args.dir', 'fname'], {}), '(args.dir, fname)\n', (3224, 3241), False, 'import os\n')...
''' Created on May 5, 2015 @author: MHouse1 @brief draws a 2d imange showing high and low elevation this may be useful for PCB isolation routing ''' #!/usr/bin/env python """ An animated image """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animatio...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.get_cmap", "matplotlib.animation.FuncAnimation", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linspace", "numpy.cos" ]
[((331, 343), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (341, 343), True, 'import matplotlib.pyplot as plt\n'), ((401, 431), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(120)'], {}), '(0, 2 * np.pi, 120)\n', (412, 431), True, 'import numpy as np\n'), ((673, 736), 'matplotlib.animation.Fu...
import numpy as np import matplotlib.pyplot as plt from cv2 import cv2 import argparse def bgr2gray(img): img_gray = np.zeros((img.shape[0], img.shape[1])).astype(np.float64) for i in range(img.shape[0]): for j in range(img.shape[1]): img_gray[i, j] = (15 * img[i, j, 0] + 75 * img[i, j, 1]...
[ "matplotlib.pyplot.title", "numpy.sum", "argparse.ArgumentParser", "numpy.hsplit", "matplotlib.pyplot.figure", "numpy.zeros_like", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "matplotlib.pyplot.xticks", "matplotlib.pyplot.show", "numpy.ceil", "numpy.hstack", "numpy.cos", "matpl...
[((556, 584), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 12)'}), '(figsize=(20, 12))\n', (566, 584), True, 'import matplotlib.pyplot as plt\n'), ((589, 609), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(3)', '(1)'], {}), '(1, 3, 1)\n', (600, 609), True, 'import matplotlib.pyplot as plt\n...
from itertools import product import numpy as np import tensorflow as tf import pytest from dlutils.models.unet import GenericUnetBase from dlutils.models.unet import UnetBuilder from dlutils.models.unet import _abbreviate from dlutils.models.heads import add_fcn_output_layers @pytest.yield_fixture(autouse=True) de...
[ "dlutils.models.unet.UnetBuilder", "numpy.random.seed", "pytest.yield_fixture", "numpy.random.randn", "tensorflow.keras.backend.clear_session", "dlutils.models.unet.GenericUnetBase", "dlutils.models.heads.add_fcn_output_layers", "dlutils.models.unet._abbreviate", "tensorflow.keras.optimizers.Adam", ...
[((283, 317), 'pytest.yield_fixture', 'pytest.yield_fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (303, 317), False, 'import pytest\n'), ((783, 838), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""base_features"""', '[1, 2, 8, 32]'], {}), "('base_features', [1, 2, 8, 32])\n", (806, 838), False...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
[ "paddle.fluid.proto.data_feed_pb2.DataFeedDesc", "paddle.fluid.core.Dataset", "paddle.fluid.core.PSGPU", "google.protobuf.text_format.MessageToString", "numpy.array", "paddle.fluid.core._is_compiled_with_heterps", "paddle.fluid.core.BoxPS" ]
[((1061, 1089), 'paddle.fluid.proto.data_feed_pb2.DataFeedDesc', 'data_feed_pb2.DataFeedDesc', ([], {}), '()\n', (1087, 1089), False, 'from paddle.fluid.proto import data_feed_pb2\n'), ((1158, 1190), 'paddle.fluid.core.Dataset', 'core.Dataset', (['"""MultiSlotDataset"""'], {}), "('MultiSlotDataset')\n", (1170, 1190), T...