code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import torch import torch.nn as nn import numpy as np import math import skimage.metrics as metrics import scipy.ndimage.filters as filters from volsim.simulation_dataset import * from lpips.models.dist_model import DistModel as LPIPS_Model from lsim.distance_model import DistanceModel as LSIM2D_Model class Metric(...
[ "scipy.ndimage.filters.gaussian_filter", "torch.from_numpy", "numpy.array", "skimage.metrics.peak_signal_noise_ratio", "numpy.arange", "numpy.mean", "skimage.metrics.variation_of_information", "skimage.metrics.structural_similarity", "numpy.fft.fftn", "numpy.max", "numpy.stack", "skimage.metri...
[((1205, 1238), 'torch.index_select', 'torch.index_select', (['full', '(1)', 'idxA'], {}), '(full, 1, idxA)\n', (1223, 1238), False, 'import torch\n'), ((1255, 1288), 'torch.index_select', 'torch.index_select', (['full', '(1)', 'idxB'], {}), '(full, 1, idxB)\n', (1273, 1288), False, 'import torch\n'), ((1628, 1652), 'n...
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt # for overlaying images: from matplotlib import offsetbox from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.axes_grid1 import make_axes_locatable ## Plotting functions ------------------------------------------------------ def plot2...
[ "matplotlib.offsetbox.OffsetImage", "numpy.array", "numpy.max", "numpy.linspace", "matplotlib.pyplot.yticks", "matplotlib.pyplot.scatter", "numpy.min", "matplotlib.pyplot.axis", "matplotlib.cm.get_cmap", "matplotlib.pyplot.xticks", "matplotlib.pyplot.title", "matplotlib.pyplot.suptitle", "nu...
[((324, 338), 'numpy.ndarray', 'np.ndarray', (['[]'], {}), '([])\n', (334, 338), True, 'import numpy as np\n'), ((346, 358), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (354, 358), True, 'import numpy as np\n'), ((630, 657), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsiz...
import seaborn as sns import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import norm from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid1.inset_locator import mark_inset sns.set_style("darkgrid") df = pd.read_csv("ibex_35.csv") df = df....
[ "matplotlib.pyplot.hist", "matplotlib.pyplot.savefig", "pandas.read_csv", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes", "mpl_toolkits.axes_grid1.inset_locator.mark_inset", "numpy.log", "seaborn.set_style", "matplotlib.pyplot.rcPara...
[((252, 277), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (265, 277), True, 'import seaborn as sns\n'), ((284, 310), 'pandas.read_csv', 'pd.read_csv', (['"""ibex_35.csv"""'], {}), "('ibex_35.csv')\n", (295, 310), True, 'import pandas as pd\n'), ((392, 413), 'scipy.stats.norm.fit', ...
import numpy as np import matplotlib.pyplot as plt # Benchmark function def dejong5(X1, X2): n_vals = len(X1) Y = np.full( (n_vals), np.nan) for i in range(n_vals): x1, x2 = X1[i], X2[i] total = 0 A = np.zeros((2,25)) a = np.array([-32, -16, 0, 16, 32]) A[0,:...
[ "numpy.radians", "numpy.tile", "numpy.random.rand", "vae_basic.train_vae", "numpy.sin", "sklearn.preprocessing.StandardScaler", "numpy.array", "numpy.zeros", "numpy.linspace", "numpy.meshgrid", "numpy.vstack", "numpy.savetxt", "vae_basic.VecVAE", "numpy.cos", "numpy.full", "matplotlib....
[((125, 148), 'numpy.full', 'np.full', (['n_vals', 'np.nan'], {}), '(n_vals, np.nan)\n', (132, 148), True, 'import numpy as np\n'), ((957, 972), 'numpy.radians', 'np.radians', (['(-33)'], {}), '(-33)\n', (967, 972), True, 'import numpy as np\n'), ((1021, 1048), 'numpy.array', 'np.array', (['((c, -s), (s, c))'], {}), '(...
import numpy as np from ccgowl.models.functions.function import Function from ccgowl.models.functions.owl import OWL def _get_off_diagonal_entries(x): lt_indices = np.tril_indices_from(x, -1) lt_indices = list(zip(*lt_indices)) return lt_indices, np.array([x[i][j] for i, j in lt_indices]) class GOWL(Fu...
[ "numpy.array", "numpy.tril_indices_from", "ccgowl.models.functions.owl.OWL", "numpy.tril" ]
[((171, 198), 'numpy.tril_indices_from', 'np.tril_indices_from', (['x', '(-1)'], {}), '(x, -1)\n', (191, 198), True, 'import numpy as np\n'), ((262, 304), 'numpy.array', 'np.array', (['[x[i][j] for i, j in lt_indices]'], {}), '([x[i][j] for i, j in lt_indices])\n', (270, 304), True, 'import numpy as np\n'), ((527, 532)...
############################################################################### # Omid55 # Start date: 16 Oct 2018 # Modified date: 02 Apr 2019 # Author: <NAME> # Email: <EMAIL> # Dynamic networks and specificly structural balance theory utility module. ########################################################...
[ "numpy.log", "utils.adjacency2digraph", "numpy.array", "networkx.closeness_centrality", "networkx.betweenness_centrality", "utils.swap_nodes_in_matrix", "numpy.linalg.norm", "scipy.stats.pearsonr", "datetime.timedelta", "utils.check_required_columns", "numpy.mean", "seaborn.set", "numpy.wher...
[((1748, 1833), 'utils.check_required_columns', 'utils.check_required_columns', (['selected_edge_list', "['source', 'target', 'weight']"], {}), "(selected_edge_list, ['source', 'target', 'weight']\n )\n", (1776, 1833), False, 'import utils\n'), ((3343, 3431), 'utils.check_required_columns', 'utils.check_required_col...
import tensorflow as tf import numpy as np import cv2 from time import time from firebase import * from waste_index_calculator import * from threading import Thread import matplotlib.pyplot as plt IMG_HEIGHT = 320 IMG_WIDTH = 320 tflite_path = 'new_model_0_75/my_model_fp32.tflite' # tflite_path = 'new_model_0_75_-1to...
[ "cv2.imshow", "cv2.destroyAllWindows", "tensorflow.lite.Interpreter", "matplotlib.pyplot.imshow", "cv2.resizeWindow", "cv2.contourArea", "cv2.minAreaRect", "cv2.addWeighted", "cv2.waitKey", "cv2.drawContours", "cv2.boxPoints", "numpy.int0", "cv2.cvtColor", "cv2.resize", "time.time", "c...
[((373, 416), 'tensorflow.lite.Interpreter', 'tf.lite.Interpreter', ([], {'model_path': 'tflite_path'}), '(model_path=tflite_path)\n', (392, 416), True, 'import tensorflow as tf\n'), ((588, 637), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""../garbage_detection/vid3.mp4"""'], {}), "('../garbage_detection/vid3.mp4')\n"...
import glob import os.path import random import numpy as np import tensorflow as tf from tensorflow.python.platform import gfile BOTTLENECK_TENSOR_SIZE = 2048 BOTTLENECK_TENSOR_NAME = 'pool_3/_reshape:0' JPEG_DATA_TENSOR_NAME = 'DecodeJpeg/contents:0' MODEL_DIR = './inception_dec_2015' MODEL_FIL...
[ "tensorflow.nn.softmax", "tensorflow.reduce_mean", "tensorflow.cast", "tensorflow.app.run", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.GraphDef", "tensorflow.matmul", "tensorflow.ConfigProto", "tensorflow.zeros", "glob.glob", "random.randrange", "numpy.squeeze", "tensorflo...
[((2643, 2672), 'numpy.squeeze', 'np.squeeze', (['bottleneck_values'], {}), '(bottleneck_values)\n', (2653, 2672), True, 'import numpy as np\n'), ((5976, 6075), 'tensorflow.import_graph_def', 'tf.import_graph_def', (['graph_def'], {'return_elements': '[BOTTLENECK_TENSOR_NAME, JPEG_DATA_TENSOR_NAME]'}), '(graph_def, ret...
import sys sys.path.extend(["../../", "../", "./"]) import warnings warnings.filterwarnings("ignore") from sklearn.preprocessing import MinMaxScaler import gensim from sklearn.metrics import classification_report from sklearn.svm import SVC from sklearn.model_selection import GridSearchCV from sklearn import...
[ "sklearn.metrics.accuracy_score", "sklearn.model_selection.GridSearchCV", "numpy.mean", "gensim.models.word2vec.Word2Vec", "pandas.Series", "argparse.ArgumentParser", "sklearn.metrics.classification_report", "sklearn.metrics.matthews_corrcoef", "gensim.models.KeyedVectors.load_word2vec_format", "n...
[((14, 54), 'sys.path.extend', 'sys.path.extend', (["['../../', '../', './']"], {}), "(['../../', '../', './'])\n", (29, 54), False, 'import sys\n'), ((73, 106), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (96, 106), False, 'import warnings\n'), ((2402, 2419), 'numpy.ar...
#! /usr/bin/python # -*-coding: utf-8-*- from keras.datasets import mnist import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation, Dropout from keras.optimizers import SGD import matplotlib.pyplot as plt # 内置load_data() 多次加载数据都是失败 于是下载数据后 自定义方法 def load_data(path="MNIST_da...
[ "keras.models.Sequential", "keras.optimizers.SGD", "keras.layers.Activation", "keras.layers.Dense", "numpy.load", "keras.layers.Dropout", "numpy.arange" ]
[((344, 357), 'numpy.load', 'np.load', (['path'], {}), '(path)\n', (351, 357), True, 'import numpy as np\n'), ((564, 576), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (574, 576), False, 'from keras.models import Sequential\n'), ((888, 942), 'keras.optimizers.SGD', 'SGD', ([], {'lr': '(0.01)', 'decay': '(...
# -*- coding: utf-8 -*- """ Created on Mon Jun 11 23:23:26 2018 @author: user """ # importing import numpy as np #%% numpy basics array = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]) # 1*15 vector print(array.shape) a = array.reshape(3,5) #%% print("shape: ",a.shape) print("dimension: ", a.ndim) print("data ...
[ "numpy.sqrt", "numpy.ones", "numpy.add", "numpy.hstack", "numpy.random.random", "numpy.square", "numpy.exp", "numpy.array", "numpy.zeros", "numpy.linspace", "numpy.empty", "numpy.vstack", "numpy.sin", "numpy.arange" ]
[((142, 203), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]'], {}), '([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])\n', (150, 203), True, 'import numpy as np\n'), ((427, 479), 'numpy.array', 'np.array', (['[[1, 2, 3, 4], [5, 6, 7, 8], [9, 8, 7, 5]]'], {}), '([[1, 2, 3, 4], [5,...
import torch import numpy as np def dgms_tensor_list(ReducedCC, maxHomdim): """ Persistent Diagrams to tensor list Return a list of tensors, where each tensor is a Persistent Diagrams at a dimension Note: 1. We also return zero length Bar for gradient computation consideration 2. The everlastin...
[ "numpy.array" ]
[((1125, 1142), 'numpy.array', 'np.array', (['bd_inds'], {}), '(bd_inds)\n', (1133, 1142), True, 'import numpy as np\n'), ((1161, 1178), 'numpy.array', 'np.array', (['bd_pair'], {}), '(bd_pair)\n', (1169, 1178), True, 'import numpy as np\n')]
import cv2 import numpy as np import tensorflow as tf import pandas as pd def resize(image, size): img = tf.io.read_file(image) x = tf.keras.preprocessing.image.smart_resize(tf.image.decode_jpeg(img, channels=3), [size, size], interpolation='bilinear') tf.kera...
[ "cv2.rectangle", "cv2.imwrite", "pandas.read_csv", "tensorflow.io.read_file", "cv2.minMaxLoc", "numpy.array", "tensorflow.keras.preprocessing.image.save_img", "cv2.matchTemplate", "cv2.Canny", "cv2.imread", "cv2.blur", "tensorflow.image.decode_jpeg" ]
[((110, 132), 'tensorflow.io.read_file', 'tf.io.read_file', (['image'], {}), '(image)\n', (125, 132), True, 'import tensorflow as tf\n'), ((313, 360), 'tensorflow.keras.preprocessing.image.save_img', 'tf.keras.preprocessing.image.save_img', (['image', 'x'], {}), '(image, x)\n', (350, 360), True, 'import tensorflow as t...
# extract data from MMP1 atlas import os,glob,sys import nibabel import pandas,numpy basedir_input='/scratch/01329/poldrack/GOBS/GOBS_bids/derivatives/fmriprep' try: subcode=sys.argv[1] except: subcode='sub-EM2204' # load atlas surface atlasdir='/work/01329/poldrack/stampede2/code/GOBS/extract/HCP-MMP1' at...
[ "numpy.mean", "nibabel.load", "os.path.join", "numpy.zeros", "pandas.DataFrame" ]
[((885, 908), 'numpy.zeros', 'numpy.zeros', (['(360, 150)'], {}), '((360, 150))\n', (896, 908), False, 'import pandas, numpy\n'), ((1273, 1324), 'pandas.DataFrame', 'pandas.DataFrame', (['roidata.T'], {'columns': 'allatlaslabels'}), '(roidata.T, columns=allatlaslabels)\n', (1289, 1324), False, 'import pandas, numpy\n')...
import numpy as np def target_transform(y: np.array, increment: float=0.01) -> np.array: """ Transform non-negative array to R using np.log :param y: np.array :param increment: float :return: """ return np.log(y + increment) def target_inverse_transform(y_trn: np.array, increment: float=...
[ "numpy.exp", "numpy.log" ]
[((233, 254), 'numpy.log', 'np.log', (['(y + increment)'], {}), '(y + increment)\n', (239, 254), True, 'import numpy as np\n'), ((486, 499), 'numpy.exp', 'np.exp', (['y_trn'], {}), '(y_trn)\n', (492, 499), True, 'import numpy as np\n')]
from collections import defaultdict from math import ceil from pathlib import Path import numpy as np import pandas as pd import torch from torch.utils.data import Dataset, DataLoader import albumentations as albu from albumentations.pytorch.transforms import img_to_tensor from am.segment.image_utils import read_imag...
[ "albumentations.pytorch.transforms.img_to_tensor", "albumentations.RandomBrightnessContrast", "albumentations.RandomGamma", "torch.cuda.is_available", "pathlib.Path", "am.segment.image_utils.read_image", "numpy.zeros_like", "pandas.concat", "pandas.DataFrame", "albumentations.Transpose", "albume...
[((2535, 2552), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2546, 2552), False, 'from collections import defaultdict\n'), ((2913, 2989), 'pandas.DataFrame', 'pd.DataFrame', (["image_paths['source']"], {'columns': "['experiment', 'group', 'path']"}), "(image_paths['source'], columns=['experime...
from ..edge.non_recursive.jit import ( euler_tour_edge, ) # TODO cut below import typing import numpy as np import numba as nb @nb.njit def euler_tour_node( g: np.ndarray, edge_idx: np.ndarray, root: int, ) -> typing.Tuple[(np.ndarray, ) * 4]: tour, parent, depth = euler_tour_edge(g, edge_idx, root) ...
[ "numpy.full" ]
[((372, 396), 'numpy.full', 'np.full', (['n', '(-1)', 'np.int64'], {}), '(n, -1, np.int64)\n', (379, 396), True, 'import numpy as np\n')]
""" This script performs a simplified version of the procedures described in <NAME>. Theory of second order stationary random processes applied to GPS coordinate time-series. GPS Solut 22, 86 (2018). https://doi.org/10.1007/s10291-018-0748-4 This script requires the name of the GPS station to be studied as a parameter ...
[ "numpy.linalg.pinv", "pandas.read_csv", "scipy.interpolate.interp1d", "numpy.array", "sys.exit", "numpy.sin", "numpy.heaviside", "numpy.exp", "scipy.signal.sosfiltfilt", "warnings.simplefilter", "numpy.round", "numpy.abs", "statsmodels.tsa.stattools.kpss", "numpy.argmax", "numpy.isnan", ...
[((727, 789), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (748, 789), False, 'import warnings\n'), ((790, 843), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'InterpolationWarning'],...
import numpy as np import matplotlib.pyplot as plt class obeservation(object): def __init__(self, angle=360, lidarRange=300, accuracy=1, beems=1080): # angle: the angular range of lidar # lidarRange: the maximum distance of lidar's capacity # accuracy: increment step size of each laser bee...
[ "matplotlib.pyplot.imshow", "numpy.clip", "numpy.ones", "numpy.int32", "numpy.logical_or", "numpy.zeros", "numpy.linspace", "numpy.cos", "numpy.sin", "numpy.zeros_like", "matplotlib.pyplot.show" ]
[((2626, 2641), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (2634, 2641), True, 'import numpy as np\n'), ((2898, 2919), 'matplotlib.pyplot.imshow', 'plt.imshow', (['lidar_map'], {}), '(lidar_map)\n', (2908, 2919), True, 'import matplotlib.pyplot as plt\n'), ((2924, 2934), 'matplotlib.pyplot.show', 'plt.sho...
#!/usr/bin/python3 # System imports import argparse import sys import serial # Data processing imports import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import seaborn as sns font = {'family' : 'normal', 'weight' : 'bold'} import matplotlib matplotlib.rc('font', **font) def m...
[ "numpy.mean", "matplotlib.pyplot.hist", "argparse.ArgumentParser", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gca", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "matplotlib.rc", "numpy.std", "numpy.load", "matplotlib.pyplot.show" ]
[((284, 313), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **font)\n", (297, 313), False, 'import matplotlib\n'), ((352, 372), 'numpy.load', 'np.load', (['delays_file'], {}), '(delays_file)\n', (359, 372), True, 'import numpy as np\n'), ((398, 414), 'matplotlib.pyplot.plot', 'plt.plot', (['delays']...
#!/usr/bin/env python3 # coding: utf-8 """ @file: writer.py @description: @author: <NAME> @email: <EMAIL> @last modified by: <NAME> change log: 2021/07/05 create file. 2022/02/09 save raw data and result """ from stereo.core.stereo_exp_data import StereoExpData from stereo.log_manager import logger from sci...
[ "stereo.io.h5ad.write", "pickle.dump", "stereo.io.h5ad.write_key_record", "scipy.sparse.issparse", "h5py.File", "stereo.log_manager.logger.error", "numpy.array_equal", "copy.deepcopy" ]
[((750, 809), 'stereo.log_manager.logger.error', 'logger.error', (['"""The output path must be set before writing."""'], {}), "('The output path must be set before writing.')\n", (762, 809), False, 'from stereo.log_manager import logger\n'), ((819, 851), 'h5py.File', 'h5py.File', (['data.output'], {'mode': '"""w"""'}),...
import matplotlib.pyplot as plt import numpy as np import pickle from PIL import Image def compute_image_data_statistics(data_loader): """ Return the channel wise mean and std deviation for images loaded by `data_loader` (loads WebDataset defined in `datasets.py`) """ mean = 0. std = 0. n_samp...
[ "matplotlib.pyplot.imshow", "PIL.Image.open", "matplotlib.pyplot.gca", "matplotlib.pyplot.close", "matplotlib.pyplot.rcParams.update", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.Rectangle", "matplotlib.pyplot.axis", "numpy.loadtxt", "numpy.arange" ]
[((2589, 2628), 'numpy.loadtxt', 'np.loadtxt', (['attn_wt_file'], {'delimiter': '""","""'}), "(attn_wt_file, delimiter=',')\n", (2599, 2628), True, 'import numpy as np\n'), ((2687, 2724), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 6}"], {}), "({'font.size': 6})\n", (2706, 2724), True, ...
import numpy as np # Write a function that takes as input a list of numbers, and returns # the list of values given by the softmax function. def softmax(L): valList = [] total = 0 for t in range(len(L)): total += np.exp(L[t]) for i in range(len(L)): a = np.exp(L[i]) / total valL...
[ "numpy.exp" ]
[((234, 246), 'numpy.exp', 'np.exp', (['L[t]'], {}), '(L[t])\n', (240, 246), True, 'import numpy as np\n'), ((287, 299), 'numpy.exp', 'np.exp', (['L[i]'], {}), '(L[i])\n', (293, 299), True, 'import numpy as np\n')]
'''Q-learning demonstration on FrozenLake gym environment ''' from os import system from tqdm import tqdm import numpy as np import gym # for training MAX_EPISODES = 5000 MAX_MOVES_PER_EP = 200 # max number of hyperparamter combinations MAX_COMBOS = 20 # max number of chances to be given to a hyperparameter combinati...
[ "numpy.argmax", "numpy.max", "numpy.zeros", "numpy.random.uniform", "numpy.random.randn", "gym.make" ]
[((3337, 3392), 'numpy.zeros', 'np.zeros', (['[env.observation_space.n, env.action_space.n]'], {}), '([env.observation_space.n, env.action_space.n])\n', (3345, 3392), True, 'import numpy as np\n'), ((5807, 5835), 'gym.make', 'gym.make', (['"""FrozenLake8x8-v0"""'], {}), "('FrozenLake8x8-v0')\n", (5815, 5835), False, 'i...
# -*- coding:utf-8 -*- import unittest from simple_ml.evaluation import * from simple_ml.evaluation import _check_input, _get_binary_confusion_matrix, _gen_binary_pairs import numpy as np from numpy.testing import assert_array_equal from simple_ml.base.base_error import * class TestEvaluation(unittest.TestCase): ...
[ "unittest.main", "numpy.array", "simple_ml.evaluation._get_binary_confusion_matrix", "simple_ml.evaluation._gen_binary_pairs" ]
[((2826, 2841), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2839, 2841), False, 'import unittest\n'), ((372, 429), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])\n', (380, 429), True, 'import numpy as np\n'), ((532, 562),...
import argparse import sys import matplotlib.pyplot as plt import numpy as np #parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) #parser.add_argument("-f", "--file", type=str, help="Voxel file (.vxl)", required=True) #args = parser.parse_args() ## Voxel-A lens k1 = -0.158396...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.plot", "numpy.linspace", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((395, 419), 'numpy.linspace', 'np.linspace', (['(0)', '(0.9)', '(200)'], {}), '(0, 0.9, 200)\n', (406, 419), True, 'import numpy as np\n'), ((984, 1023), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'x1', 'x', 'x2', '"""r"""', 'x', 'x3', '"""k"""'], {}), "(x, x1, x, x2, 'r', x, x3, 'k')\n", (992, 1023), True, 'import...
import os os.environ['TF_CPP_MIN_LOG_LEVEL']='1' from os import listdir import sys import time import argparse import tools.ops import subprocess import numpy as np import tensorflow as tf import scipy.misc as sm from models.mfb_net_cross import * from tools.utilities import * from tools.ops import * parser = argpa...
[ "tensorflow.control_dependencies", "tensorflow.reduce_mean", "tensorflow.app.run", "os.path.exists", "argparse.ArgumentParser", "tensorflow.train.Coordinator", "tensorflow.Session", "numpy.concatenate", "tensorflow.train.exponential_decay", "tensorflow.ConfigProto", "tensorflow.summary.scalar", ...
[((315, 340), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (338, 340), False, 'import argparse\n'), ((2271, 2366), 'tensorflow.train.exponential_decay', 'tf.train.exponential_decay', (['starter_learning_rate', 'global_step', '(100000)', '(0.5)'], {'staircase': '(True)'}), '(starter_learning_r...
import argparse from pathlib import Path from PIL import Image import cv2 import numpy as np import pandas as pd import torch import torch.optim as optim import matplotlib.pyplot as plt from utils import Options, overlap_ratio from models.mdnet import MDNet, BCELoss from models.extractor import SampleGenerator, Regio...
[ "models.regressor.BBRegressor", "models.extractor.RegionExtractor", "utils.overlap_ratio", "models.mdnet.BCELoss", "matplotlib.pyplot.imshow", "argparse.ArgumentParser", "pathlib.Path", "numpy.random.seed", "utils.Options", "numpy.random.permutation", "torch.optim.SGD", "matplotlib.pyplot.paus...
[((476, 553), 'models.extractor.RegionExtractor', 'RegionExtractor', (['image', 'samples', 'opts.img_size', 'opts.padding', 'opts.batch_test'], {}), '(image, samples, opts.img_size, opts.padding, opts.batch_test)\n', (491, 553), False, 'from models.extractor import SampleGenerator, RegionExtractor\n'), ((3367, 3376), '...
# -*- coding: utf-8 -*- # test_adapter.py """ Unit for schema adapter """ from __future__ import print_function import importlib import os import random import sys import tempfile import numpy from random_words import RandomWords, LoremIpsum rw = RandomWords() li = LoremIpsum() from . import _random_integer, Py23Fi...
[ "random_words.LoremIpsum", "importlib.import_module", "numpy.random.rand", "random_words.RandomWords", "numpy.random.randint", "tempfile.NamedTemporaryFile" ]
[((250, 263), 'random_words.RandomWords', 'RandomWords', ([], {}), '()\n', (261, 263), False, 'from random_words import RandomWords, LoremIpsum\n'), ((269, 281), 'random_words.LoremIpsum', 'LoremIpsum', ([], {}), '()\n', (279, 281), False, 'from random_words import RandomWords, LoremIpsum\n'), ((822, 860), 'importlib.i...
from collections import OrderedDict as ODict from typing import IO, Sequence, Tuple, Union, List, Dict from itertools import repeat import librosa import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as tckr from numpy import ndarray import scipy.signal as scsig from hparams import hp import ge...
[ "librosa.istft", "numpy.isrealobj", "librosa.util.frame", "numpy.log10", "numpy.random.rand", "generic.convert", "numpy.linalg.norm", "numpy.exp", "numpy.maximum", "numpy.abs", "scipy.signal.windows.hann", "numpy.iscomplexobj", "numpy.finfo", "matlab_lib.Evaluation", "matplotlib.pyplot.g...
[((3525, 3558), 'generic.convert', 'gen.convert', (['data'], {'astype': 'ndarray'}), '(data, astype=ndarray)\n', (3536, 3558), True, 'import generic as gen\n'), ((3633, 3654), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'dpi': 'dpi'}), '(dpi=dpi)\n', (3645, 3654), True, 'import matplotlib.pyplot as plt\n'), ((4...
import torch import numpy as np import matplotlib.pyplot as plt from operator import itemgetter from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import ListedColormap from sklearn.metrics import confusion_matrix, roc_curve, precision_recall_curve plt.style.use('fivethirtyeight') def odds(prob): retur...
[ "numpy.arange", "matplotlib.pyplot.colorbar", "sklearn.metrics.precision_recall_curve", "matplotlib.pyplot.style.use", "numpy.zeros_like", "matplotlib.colors.ListedColormap", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.figure", "sklearn.metrics.roc_curve", "matplotlib.pyplot.tight_layout",...
[((261, 293), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (274, 293), True, 'import matplotlib.pyplot as plt\n'), ((4017, 4038), 'matplotlib.pyplot.colorbar', 'plt.colorbar', (['contour'], {}), '(contour)\n', (4029, 4038), True, 'import matplotlib.pyplot as ...
# !/usr/bin/env python # -- coding: utf-8 -- # @Author zengxiaohui # Datatime:4/30/2021 2:04 PM # @File:PIL_utils import cv2 import numpy as np import numpy import matplotlib.pyplot as plt from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageOps def PIL2cv2(image): """PIL转cv""" return cv2.cv...
[ "PIL.ImageDraw.Draw", "numpy.asarray", "PIL.ImageFont.truetype", "cv2.cvtColor" ]
[((597, 616), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['img'], {}), '(img)\n', (611, 616), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((632, 697), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""font/simhei.ttf"""', 'textSize'], {'encoding': '"""utf-8"""'}), "('font/simhei.ttf', textSize, encoding=...
from scipy.optimize import least_squares import numpy as np def reprojection_loss_function(opt_variables, points_2d, num_pts): P = opt_variables[0:12].reshape(3,4) point_3d = opt_variables[12:].reshape((num_pts, 4)) rep_error = [] for idx, pt_3d in enumerate(point_3d): pt_2d = np.array([point...
[ "numpy.array", "scipy.optimize.least_squares", "numpy.matmul" ]
[((770, 860), 'scipy.optimize.least_squares', 'least_squares', (['reprojection_loss_function', 'opt_variables'], {'args': '(points_2d, num_points)'}), '(reprojection_loss_function, opt_variables, args=(points_2d,\n num_points))\n', (783, 860), False, 'from scipy.optimize import least_squares\n'), ((305, 353), 'numpy...
import battleship as ship import pandas as pd import numpy as np def random_generation(generation_size, genes): # create dataframe for gene pool generation = pd.DataFrame(columns=['Sequence','Chromosome','Generation','Birth','Fitness','Parents']) # for each chromosome i = 0 while i < generation_s...
[ "numpy.random.choice", "numpy.array", "numpy.random.randint", "pandas.DataFrame", "battleship.accuracy" ]
[((168, 265), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Sequence', 'Chromosome', 'Generation', 'Birth', 'Fitness', 'Parents']"}), "(columns=['Sequence', 'Chromosome', 'Generation', 'Birth',\n 'Fitness', 'Parents'])\n", (180, 265), True, 'import pandas as pd\n'), ((2470, 2496), 'numpy.random.choice', 'n...
""" Agent module """ from random import randint, random import numpy as np def q_learning(environment, learning_rate, gamma, total_iteration, show=False): """ Q-learning: An off-policy TD control algorithm as described in Reinforcement Learning: An Introduction" 1998 p158 by <NAME> https://web.stanford...
[ "numpy.random.rand", "numpy.argmax", "numpy.max", "random.random", "random.randint" ]
[((768, 861), 'numpy.random.rand', 'np.random.rand', (['number_states', 'number_states', 'number_states', 'number_states', 'number_action'], {}), '(number_states, number_states, number_states, number_states,\n number_action)\n', (782, 861), True, 'import numpy as np\n'), ((1151, 1159), 'random.random', 'random', ([]...
#! /usr/bin/env python """Run a YOLO_v2 style detection model on test images.""" import argparse import colorsys import imghdr import os import random import time,cv2 import numpy as np from keras import backend as K from keras.models import load_model from PIL import Image, ImageDraw, ImageFont from yad2k.models.kera...
[ "tensorflow.boolean_mask", "keras.backend.learning_phase", "colorsys.hsv_to_rgb", "numpy.array", "os.path.exists", "argparse.ArgumentParser", "keras.backend.placeholder", "keras.backend.max", "cv2.VideoWriter", "os.mkdir", "cv2.VideoWriter_fourcc", "keras.backend.argmax", "cv2.perspectiveTra...
[((452, 548), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run a YOLO_v2 style detection model on test images.."""'}), "(description=\n 'Run a YOLO_v2 style detection model on test images..')\n", (475, 548), False, 'import argparse\n'), ((2644, 2673), 'keras.backend.argmax', 'K.argm...
# coding=utf-8 # Copyright 2022 The Google Research 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 required by applicab...
[ "tensorflow.io.gfile.GFile", "math.ceil", "math.floor", "numpy.hstack", "absl.logging.info", "collections.defaultdict" ]
[((2301, 2330), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (2324, 2330), False, 'import collections\n'), ((2549, 2592), 'absl.logging.info', 'logging.info', (['"""Done with counting the bins"""'], {}), "('Done with counting the bins')\n", (2561, 2592), False, 'from absl import log...
#!/usr/bin/env python3 """Channel coding in L2. This module contains functions used for conversion between type-1 and type-5 bits in lower MAC. These process individual bursts or blocks, and don't store state in between calls.""" import ctypes import numpy as np import numba # to make things run faster libcorrect =...
[ "ctypes.POINTER", "numpy.unpackbits", "numpy.array", "numpy.zeros", "ctypes.CDLL", "numpy.full", "ctypes.c_char_p" ]
[((321, 376), 'ctypes.CDLL', 'ctypes.CDLL', (['"""../../libcorrect/build/lib/libcorrect.so"""'], {}), "('../../libcorrect/build/lib/libcorrect.so')\n", (332, 376), False, 'import ctypes\n'), ((529, 560), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_uint16'], {}), '(ctypes.c_uint16)\n', (543, 560), False, 'import cty...
""" <NAME> created: 1/17/21 finalized: 5/4/21 weightedmedianfunc.py This code is a function that calculates the weighted median. A list of scores and their corresponding weights are passed in as arguments. Once the weighted median is calculated than a graph is generated. This is help users visualize the dat...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.axhline", "matplotlib.pyplot.bar", "numpy.cumsum", "matplotlib.pyplot.axvline", "matplotlib.pyplot.margins", "matplotlib.pyplot.show" ]
[((2782, 2830), 'numpy.cumsum', 'np.cumsum', (['[(2 * x) for x in [0] + weights[:-1]]'], {}), '([(2 * x) for x in [0] + weights[:-1]])\n', (2791, 2830), True, 'import numpy as np\n'), ((3011, 3101), 'matplotlib.pyplot.bar', 'plt.bar', (['position', 'nscores', 'diameter'], {'color': '"""#1E90FF"""', 'edgecolor': '"""bla...
import numpy as np import pqdict import generator def get_start_end(maze): r, c = maze.shape start = np.argwhere(maze == 3).flatten() end = np.argwhere(maze == 4).flatten() return tuple(start), tuple(end) def l1_distance(a, b): return np.sum(np.abs(a - np.array(b))) def solver(maze): r, c ...
[ "numpy.array", "numpy.zeros", "numpy.pad", "numpy.argwhere", "numpy.concatenate", "pqdict.minpq", "numpy.save", "generator.Prim" ]
[((549, 577), 'pqdict.minpq', 'pqdict.minpq', (['{(0): [start]}'], {}), '({(0): [start]})\n', (561, 577), False, 'import pqdict\n'), ((1649, 1707), 'numpy.pad', 'np.pad', (['maze', '(scope // 2,)', '"""constant"""'], {'constant_values': '(1)'}), "(maze, (scope // 2,), 'constant', constant_values=1)\n", (1655, 1707), Tr...
import numpy def lax_friedrichs(q_minus, q_plus, simulation): alpha = simulation.dx / simulation.dt flux = numpy.zeros_like(q_minus) f_minus = simulation.model.flux(q_minus) f_plus = simulation.model.flux(q_plus) flux[:, 1:-1] = 0.5 * ( (f_plus[:,0:-2] + f_minus[:,1:-1]) + \ ...
[ "numpy.zeros_like" ]
[((116, 141), 'numpy.zeros_like', 'numpy.zeros_like', (['q_minus'], {}), '(q_minus)\n', (132, 141), False, 'import numpy\n'), ((441, 466), 'numpy.zeros_like', 'numpy.zeros_like', (['q_minus'], {}), '(q_minus)\n', (457, 466), False, 'import numpy\n')]
#%% #%matplotlib inline #%% import tensorflow as tf #%% sess = tf.InteractiveSession() #%% import keras.backend as K K.set_image_data_format("channels_first") import keras import numpy as np from keras.layers import Dense, Dropout, Conv2D, MaxPooling2D from keras.layers import Flatten, Lambda, BatchNormalization ...
[ "keras.layers.Conv2D", "keras.metrics.categorical_accuracy", "scipy.io.loadmat", "keras.preprocessing.image.ImageDataGenerator", "keras.utils.to_categorical", "keras.layers.Dense", "matplotlib.pyplot.imshow", "os.path.exists", "os.mkdir", "keras.layers.advanced_activations.LeakyReLU", "keras.opt...
[((66, 89), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (87, 89), True, 'import tensorflow as tf\n'), ((121, 162), 'keras.backend.set_image_data_format', 'K.set_image_data_format', (['"""channels_first"""'], {}), "('channels_first')\n", (144, 162), True, 'import keras.backend as K\n'), (...
""" Created by <NAME> (<EMAIL>) """ import copy import gc import glob import numpy as np import os import random import scipy.io import shutil import time import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.optim import torchvision.transforms as transforms from PIL ...
[ "reading_stimuli.reading_stimuli", "torch.nn.CrossEntropyLoss", "torch.pow", "torch.cuda.is_available", "copy.deepcopy", "torch.set_grad_enabled", "sklearn.decomposition.PCA", "numpy.asarray", "torch.nn.init.zeros_", "torch.hub.load_state_dict_from_url", "os.mkdir", "numpy.random.permutation",...
[((847, 894), 'torch.hub.load_state_dict_from_url', 'load_state_dict_from_url', (["model_urls['alexnet']"], {}), "(model_urls['alexnet'])\n", (871, 894), False, 'from torch.hub import load_state_dict_from_url\n'), ((3680, 3707), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (3690, 3707...
import numpy as np import random from ccnlab.baselines.core import Model, ValueBasedModel class RescorlaWagner(ValueBasedModel): def __init__(self, cs_dim, ctx_dim, alpha=0.3): super().__init__() self.alpha = alpha # Learning rate. self.cs_dim = cs_dim self.ctx_dim = ctx_dim self.D = self.cs_di...
[ "numpy.identity", "numpy.array", "numpy.zeros", "random.choices" ]
[((441, 460), 'numpy.zeros', 'np.zeros', (['(self.D,)'], {}), '((self.D,))\n', (449, 460), True, 'import numpy as np\n'), ((506, 524), 'numpy.array', 'np.array', (['(cs + ctx)'], {}), '(cs + ctx)\n', (514, 524), True, 'import numpy as np\n'), ((1209, 1237), 'numpy.zeros', 'np.zeros', (['(self.D * self.T,)'], {}), '((se...
""" Run a PD-controller with the parameter from Quanser on the real device. By default all controllers in this script run infinitely. """ import torch as to import numpy as np import pyrado from pyrado.environments.pysim.quanser_qube import QQubeSim from pyrado.environments.quanser.quanser_ball_balancer import QBallBa...
[ "pyrado.utils.input_output.print_cbt", "pyrado.environments.quanser.quanser_cartpole.QCartPoleStabReal", "pyrado.environments.quanser.quanser_ball_balancer.QBallBalancerReal", "pyrado.utils.data_types.RenderMode", "numpy.minimum", "pyrado.environments.quanser.quanser_qube.QQubeReal", "pyrado.utils.argpa...
[((1091, 1160), 'numpy.array', 'np.array', (['[1.2278416, 4.5279346, -0.012385756, 6.0038762, -4.1818547]'], {}), '([1.2278416, 4.5279346, -0.012385756, 6.0038762, -4.1818547])\n', (1099, 1160), True, 'import numpy as np\n'), ((1674, 1686), 'torch.tensor', 'to.tensor', (['K'], {}), '(K)\n', (1683, 1686), True, 'import ...
import numpy as np from numpy import * from astropy import units as u from scipy.integrate import quad import math as math from math import sqrt, pi, sin, cos import matplotlib.pyplot as plt import scipy.optimize as opt from matplotlib import rcParams as rcp from matplotlib import colors from matplotlib import rc plt.r...
[ "numpy.radians", "matplotlib.pyplot.hist", "matplotlib.pyplot.ylabel", "numpy.array", "numpy.loadtxt", "numpy.genfromtxt", "numpy.arange", "matplotlib.pyplot.xlabel", "numpy.max", "matplotlib.colors.ListedColormap", "numpy.min", "numpy.remainder", "matplotlib.pyplot.xlim", "matplotlib.pypl...
[((1447, 1562), 'numpy.loadtxt', 'np.loadtxt', (['"""/home/kerky/anaconda3/SN1A_DATA/PANTHEON_DATA/Scolnic_data_updated.txt"""'], {'usecols': '[1, 2, 4, 5]'}), "(\n '/home/kerky/anaconda3/SN1A_DATA/PANTHEON_DATA/Scolnic_data_updated.txt',\n usecols=[1, 2, 4, 5])\n", (1457, 1562), True, 'import numpy as np\n'), ((...
import numpy as np from os import path def __to_float_array(x): if type(x) is list or type(x) is tuple: x = np.asarray(x) elif type(x) is not np.ndarray: raise TypeError('x is not an array_like object') if x.dtype != 'float' and x.dtype != 'int': raise TypeError('The values of x must be convertabl...
[ "numpy.sqrt", "numpy.asarray", "os.path.join", "numpy.max", "numpy.sum", "numpy.min" ]
[((115, 128), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (125, 128), True, 'import numpy as np\n'), ((894, 913), 'numpy.sum', 'np.sum', (['(1 / dy ** 2)'], {}), '(1 / dy ** 2)\n', (900, 913), True, 'import numpy as np\n'), ((921, 940), 'numpy.sum', 'np.sum', (['(x / dy ** 2)'], {}), '(x / dy ** 2)\n', (927, 9...
#!/usr/bin/env python # coding: utf-8 import random import os import sys import cv2 import csv import glob import numpy as np import time import psutil from sklearn.utils import shuffle from keras.layers import Input, Conv2D, MaxPooling2D, BatchNormalization, LeakyReLU, Flatten, Dense from keras.activations import line...
[ "numpy.reshape", "psutil.cpu_percent", "glob.glob1", "csv.writer", "numpy.array", "csv.reader", "os.getpid", "cv2.resize", "time.time", "glob.glob", "cv2.imread" ]
[((3013, 3033), 'numpy.array', 'np.array', (['X_validate'], {}), '(X_validate)\n', (3021, 3033), True, 'import numpy as np\n'), ((3051, 3146), 'numpy.reshape', 'np.reshape', (['X_validate', '[-1, X_validate.shape[1], X_validate.shape[2], X_validate.shape[3]]'], {}), '(X_validate, [-1, X_validate.shape[1], X_validate.sh...
from __future__ import print_function import os import sys import time import json import argparse import random random.seed(49999) import numpy numpy.random.seed(49999) import tensorflow tensorflow.set_random_seed(49999) from collections import OrderedDict from zoo.pipeline.api.autograd import * from zoo.pipeline.ap...
[ "sys.path.insert", "inputs.get", "keras.backend.maximum", "tensorflow.set_random_seed", "argparse.ArgumentParser", "tensorflow.Session", "json.dumps", "numpy.stack", "numpy.random.seed", "numpy.concatenate", "tensorflow.ConfigProto", "sys.stdout.flush", "collections.OrderedDict", "numpy.al...
[((113, 131), 'random.seed', 'random.seed', (['(49999)'], {}), '(49999)\n', (124, 131), False, 'import random\n'), ((145, 169), 'numpy.random.seed', 'numpy.random.seed', (['(49999)'], {}), '(49999)\n', (162, 169), False, 'import numpy\n'), ((188, 221), 'tensorflow.set_random_seed', 'tensorflow.set_random_seed', (['(499...
import numpy as np import pandas as pd import streamlit as st import matplotlib.pyplot as plt import datetime as dt plt.style.use('classic') st.title('MaxiMiser') st.write('') st.write('Simple bonus optimization strategy of opening new checking or saving accounts') st.markdown('[Project Slides](https://docs.google.com...
[ "streamlit.table", "pandas.read_csv", "streamlit.sidebar.number_input", "datetime.timedelta", "pandas.to_datetime", "streamlit.title", "datetime.datetime", "matplotlib.pyplot.plot", "matplotlib.pyplot.style.use", "streamlit.sidebar.markdown", "pandas.DataFrame", "streamlit.markdown", "matplo...
[((116, 140), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""classic"""'], {}), "('classic')\n", (129, 140), True, 'import matplotlib.pyplot as plt\n'), ((142, 163), 'streamlit.title', 'st.title', (['"""MaxiMiser"""'], {}), "('MaxiMiser')\n", (150, 163), True, 'import streamlit as st\n'), ((164, 176), 'streamlit...
#!/usr/bin/env """ CTDvPrawler_plot.py Plot data from cruises Currently --------- ctd plots plots prawler data as secondary Input - CruiseID Compatibility: ============== python >=3.6 python 2.7 """ from __future__ import absolute_import, division, print_function import argparse import datetime import os ...
[ "datetime.datetime", "os.path.exists", "plots.profile_plot.CTDProfilePlot", "argparse.ArgumentParser", "os.makedirs", "matplotlib.use", "numpy.ndim", "os.sys.path.insert", "matplotlib.pyplot.close", "numpy.array", "io_utils.EcoFOCI_netCDF_read.EcoFOCI_netCDF", "numpy.isnan", "os.path.abspath...
[((394, 408), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (401, 408), True, 'import matplotlib as mpl\n'), ((610, 643), 'os.sys.path.insert', 'os.sys.path.insert', (['(1)', 'parent_dir'], {}), '(1, parent_dir)\n', (628, 643), False, 'import os\n'), ((898, 928), 'datetime.datetime', 'datetime.datetime...
import cv2 import os import numpy as np import pandas as pd from scipy.ndimage import zoom #from matplotlib import pyplot as plt def clipped_zoom(img, zoom_factor, **kwargs): h, w = img.shape[:2] # For multichannel images we don't want to apply the zoom factor to the RGB # dimension, so instead we create...
[ "cv2.dnn.blobFromImage", "cv2.rectangle", "os.listdir", "os.path.join", "cv2.imshow", "cv2.waitKey", "numpy.zeros_like", "scipy.ndimage.zoom", "numpy.round", "cv2.imread" ]
[((1767, 1857), 'cv2.dnn.blobFromImage', 'cv2.dnn.blobFromImage', (['frameOpencvDnn', '(1.0)', '(300, 300)', '[104, 117, 123]', '(False)', '(False)'], {}), '(frameOpencvDnn, 1.0, (300, 300), [104, 117, 123], \n False, False)\n', (1788, 1857), False, 'import cv2\n'), ((2790, 2824), 'os.path.join', 'os.path.join', (['...
from .Wavefunction import Wavefunction from .LinAlg import expm, get_basis import numba import numpy as np from scipy.fft import ifft2, fft2 class Nucleus(Wavefunction): # Upon calling wilsonLine() or adjointWilsonLine(), these are properly defined _wilsonLine = None _adjointWilsonLine = None # Som...
[ "numpy.sqrt", "scipy.fft.fft2", "scipy.fft.ifft2", "numpy.zeros", "numba.jit", "numpy.dot", "numpy.cos", "numpy.transpose", "numpy.zeros_like" ]
[((9861, 9897), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)', 'cache': '(True)'}), '(nopython=True, cache=True)\n', (9870, 9897), False, 'import numba\n'), ((10643, 10679), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)', 'cache': '(True)'}), '(nopython=True, cache=True)\n', (10652, 10679), False, 'import ...
import random import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.optimizers import Adam class PushGame1D: NUM_CELLS = 10 PLAYER_VAL = 55 BOX_VAL = 155 TARGET_VAL = 255 def __init__(self): self.stateSize = self.NUM_CELLS self.actionSiz...
[ "keras.optimizers.Adam", "numpy.reshape", "keras.models.Sequential", "numpy.array", "numpy.zeros", "numpy.array_equal", "keras.layers.Dense" ]
[((347, 386), 'numpy.zeros', 'np.zeros', (['self.NUM_CELLS'], {'dtype': '"""int32"""'}), "(self.NUM_CELLS, dtype='int32')\n", (355, 386), True, 'import numpy as np\n'), ((718, 730), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (728, 730), False, 'from keras.models import Sequential\n'), ((1914, 1957), 'nu...
""" Note: gmpe and emp (emperical) used interchangeably. Calculate and plot PGVs, PGAs obsersations, simulations and gmpe. """ import sys import os import numpy as np import glob import matplotlib # Force matplotlib to not use any Xwindows backend. matplotlib.use('Agg') from matplotlib import pylab as plt from geoNet....
[ "geoNet.utils.read_statsll", "geoNet.putils.plot_IMvsRrup", "numpy.log10", "geoNet.utils.get_processed_stats_list", "geoNet.utils.get_SMS_PGV", "matplotlib.use", "geoNet.gmpe.calculateGMPE.set_faultprop", "geoNet.gmpe.readStationFile.Points_np", "geoNet.utils.get_SMS_PGA", "geoNet.utils.get_empIM_...
[((249, 270), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (263, 270), False, 'import matplotlib\n'), ((932, 1087), 'geoNet.utils.read_statsll', 'read_statsll', (['"""/nesi/projects/nesi00213/ObservedGroundMotions/ahsan/Mw4pt9_20110429_190804_11Jan2017"""', '"""20100904_103801_eventStats_2017-0...
import os, torch import numpy as np from torch import nn from torch import functional as F import tifffile from tqdm import tqdm class BCEFocalLoss(torch.nn.Module): def __init__(self, gamma=2, alpha=0.25, reduction='elementwise_mean'): super().__init__() self.gamma = gamma self....
[ "torch.nn.ReLU", "torch.nn.Sequential", "torch.sum", "os.listdir", "torch.mean", "numpy.max", "numpy.min", "torch.nn.BatchNorm3d", "torch.nn.Conv3d", "tifffile.imread", "torch.nn.Upsample", "torch.device", "torch.log", "numpy.minimum", "os.path.join", "torch.nn.Conv2d", "numpy.sum", ...
[((1836, 1926), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels', 'kernel_size'], {'padding': '(kernel_size // 2)', 'bias': 'bias'}), '(in_channels, out_channels, kernel_size, padding=kernel_size // 2,\n bias=bias)\n', (1845, 1926), False, 'from torch import nn\n'), ((2059, 2149), 'torch.nn.Conv3d', '...
''' Created on 22.02.2021 @author: <NAME> ''' from ImageBot.image_processing.general import expand_canvas from math import sqrt import numpy as np import imgaug.augmenters as iaa from ..Config import MODEL_MAX_SCALE, MODEL_MIN_SCALE, MODEL_MIN_ROT,\ MODEL_MAX_ROT, MODEL_PERCENTAGE_FLIP, MODEL_PERSPECTIVE_MIN_TRANS...
[ "numpy.uint8", "ImageBot.image_processing.general.expand_canvas", "numpy.float64", "imgaug.augmenters.Affine", "math.sqrt", "uuid.uuid4", "imgaug.augmenters.PerspectiveTransform", "ImageBot.image_processing.masks.mask_bounding_box", "imgaug.augmenters.Fliplr", "numpy.float32", "imgaug.augmenters...
[((927, 958), 'ImageBot.image_processing.masks.mask_bounding_box', 'mask_bounding_box', (['message.mask'], {}), '(message.mask)\n', (944, 958), False, 'from ImageBot.image_processing.masks import mask_bounding_box\n'), ((1610, 1652), 'ImageBot.image_processing.general.expand_canvas', 'expand_canvas', (['message.image',...
import joblib import numpy as np from flask import Flask, app from flask import jsonify # herramienta para trabajar cno arch json app = Flask(__name__) #<NAME> @app.route('/predict', methods=['GET']) def predict(): """Funcion que se expondra en la direccion 8080/predict y que muestra la prediccion hecha por ...
[ "flask.app.run", "flask.Flask", "flask.app.route", "numpy.array", "joblib.load" ]
[((138, 153), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (143, 153), False, 'from flask import Flask, app\n'), ((164, 202), 'flask.app.route', 'app.route', (['"""/predict"""'], {'methods': "['GET']"}), "('/predict', methods=['GET'])\n", (173, 202), False, 'from flask import Flask, app\n'), ((392, 523),...
# region imports import math import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import norm from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_log_error from sklearn import preprocessing from sklearn.model_selection im...
[ "numpy.log" ]
[((826, 858), 'numpy.log', 'np.log', (['(full_ds[column_name] + 3)'], {}), '(full_ds[column_name] + 3)\n', (832, 858), True, 'import numpy as np\n')]
import scipy.io.wavfile as scwav import numpy as np import pylab import librosa import pyworld as pw import os import scipy.io as scio from glob import glob from tqdm import tqdm from concurrent.futures import ProcessPoolExecutor from functools import partial from sklearn.manifold import TSNE def _power_to_db(S): ...
[ "numpy.abs", "numpy.log10", "pyworld.wav2world", "pyworld.code_spectral_envelope", "tqdm.tqdm", "numpy.asarray", "os.path.join", "numpy.random.randint", "numpy.dot", "scipy.io.wavfile.read", "functools.partial", "concurrent.futures.ProcessPoolExecutor", "numpy.linalg.svd" ]
[((405, 434), 'scipy.io.wavfile.read', 'scwav.read', ([], {'filename': 'filename'}), '(filename=filename)\n', (415, 434), True, 'import scipy.io.wavfile as scwav\n'), ((446, 474), 'numpy.asarray', 'np.asarray', (['data', 'np.float64'], {}), '(data, np.float64)\n', (456, 474), True, 'import numpy as np\n'), ((493, 531),...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import sys import json import numpy as np THIS_DIR = os.path.dirname(__file__) sys.path.append(os.path.join(THIS_DIR, os.pardir)) from confonnx.get_model_info import get_model_info def create_test...
[ "os.path.exists", "numpy.random.random_sample", "confonnx.get_model_info.get_model_info", "argparse.ArgumentParser", "os.path.join", "numpy.iinfo", "os.path.dirname", "numpy.random.randint", "json.dump" ]
[((175, 200), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (190, 200), False, 'import os\n'), ((217, 250), 'os.path.join', 'os.path.join', (['THIS_DIR', 'os.pardir'], {}), '(THIS_DIR, os.pardir)\n', (229, 250), False, 'import os\n'), ((909, 934), 'argparse.ArgumentParser', 'argparse.Argumen...
from MovieRecommender import process_data import numpy as np from scipy.sparse import csr_matrix, load_npz import random import implicit from sklearn import metrics import os import pickle def test_train_split(sparse_user_item, pct_test=0.2): ''' This function will take in the original user-item matrix and "m...
[ "os.path.exists", "random.sample", "numpy.mean", "pickle.dump", "os.makedirs", "numpy.where", "scipy.sparse.load_npz", "sklearn.metrics.auc", "MovieRecommender.process_data.main", "random.seed", "sklearn.metrics.roc_curve", "implicit.als.AlternatingLeastSquares", "scipy.sparse.csr_matrix", ...
[((2163, 2177), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (2174, 2177), False, 'import random\n'), ((2435, 2476), 'random.sample', 'random.sample', (['nonzero_pairs', 'num_samples'], {}), '(nonzero_pairs, num_samples)\n', (2448, 2476), False, 'import random\n'), ((3296, 3385), 'implicit.als.AlternatingLeast...
import os import shutil import numpy as np from util import log_util log = log_util.get_logger("file process") def create_blank_file(file_name): ''' create a blank file :param file_name: :return: ''' with open(file_name, 'w') as wt: wt.write("") log.debug("blank file %s crea...
[ "os.path.exists", "numpy.fromfile", "os.listdir", "os.makedirs", "util.log_util.get_logger", "os.path.join", "numpy.squeeze", "shutil.copytree", "numpy.array", "os.path.isfile", "os.path.isdir", "os.mkdir", "shutil.rmtree", "numpy.mod", "os.remove" ]
[((78, 113), 'util.log_util.get_logger', 'log_util.get_logger', (['"""file process"""'], {}), "('file process')\n", (97, 113), False, 'from util import log_util\n'), ((552, 568), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (562, 568), False, 'import os\n'), ((2300, 2338), 'shutil.copytree', 'shutil.copytree...
""" 感知机模型: 1、训练数据样本; 2、选取初始值; 3、判断是否为误分类点; 4、若是误分类点,则随机梯度下降,并更新权值 w 与 偏置值 b; 5、直至无误分类点。 """ #%% import numpy as np import matplotlib.pyplot as plt #%% class showPicture: def __init__(self, xSample, ySample, w, b): self.w = w self.b = b self.xData = np.linspace(-2, 2...
[ "matplotlib.pyplot.text", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "numpy.linspace", "matplotlib.pyplot.figure", "numpy.zeros", "numpy.dot", "matplotlib.pyplot.scatter", "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.p...
[((3718, 3734), 'numpy.array', 'np.array', (['(0, 0)'], {}), '((0, 0))\n', (3726, 3734), True, 'import numpy as np\n'), ((3740, 3756), 'numpy.array', 'np.array', (['(1, 1)'], {}), '((1, 1))\n', (3748, 3756), True, 'import numpy as np\n'), ((3762, 3778), 'numpy.array', 'np.array', (['(0, 1)'], {}), '((0, 1))\n', (3770, ...
import os import tempfile import unittest from nnimgproc.util.parameters import Parameters class TestParametersMethods(unittest.TestCase): def test_null(self): params = Parameters() with self.assertRaises(ValueError): params.get('none') params.set('none', None) self.a...
[ "unittest.main", "nnimgproc.util.parameters.Parameters", "tempfile.gettempdir", "numpy.random.uniform" ]
[((1870, 1885), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1883, 1885), False, 'import unittest\n'), ((185, 197), 'nnimgproc.util.parameters.Parameters', 'Parameters', ([], {}), '()\n', (195, 197), False, 'from nnimgproc.util.parameters import Parameters\n'), ((404, 416), 'nnimgproc.util.parameters.Parameters...
import numpy as np class MCAgent: def __init__(self, environment, manpower=300, episodes=1000, maxSteps=1000, epsilon=0.05, alpha=0.1, gamma=1): self.environment = environment self.actionSet = self.environment.actionSet self.manpower = manpower self.episodes = episodes self....
[ "numpy.random.choice", "numpy.random.uniform" ]
[((1456, 1488), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(0)', 'high': '(1)'}), '(low=0, high=1)\n', (1473, 1488), True, 'import numpy as np\n'), ((1520, 1552), 'numpy.random.choice', 'np.random.choice', (['self.actionSet'], {}), '(self.actionSet)\n', (1536, 1552), True, 'import numpy as np\n'), ((180...
"""High-level API for saving/loading responses from FE simulation.""" from __future__ import annotations # Print debug information for this file. import os from collections import deque from copy import deepcopy from typing import Callable, List, Optional import numpy as np from bridge_sim.model import ( Config,...
[ "numpy.array", "bridge_sim.scenarios.HealthyScenario", "bridge_sim.util.round_m", "copy.deepcopy", "numpy.save", "bridge_sim.util.print_d", "os.path.exists", "collections.deque", "bridge_sim.util.flatten", "numpy.matmul", "bridge_sim.sim.model.SimParams", "pathos.multiprocessing.Pool", "brid...
[((1988, 2030), 'numpy.matmul', 'np.matmul', (['traffic_array', 'unit_load_matrix'], {}), '(traffic_array, unit_load_matrix)\n', (1997, 2030), True, 'import numpy as np\n'), ((2937, 2954), 'bridge_sim.scenarios.HealthyScenario', 'HealthyScenario', ([], {}), '()\n', (2952, 2954), False, 'from bridge_sim.scenarios import...
# -*- coding: UTF-8 -*- """ Fazova trajektorie spinani ruznych typu zateze tranzistorem - myslim ze to byl KD503 """ #pylint: disable=invalid-name from matplotlib import pyplot as plt import numpy as np POINTS = 500 def graf_time(t, u, i, dt, dv, di, title): t_ax = [time * dt for time in t] i_ax = [curr * di...
[ "numpy.full", "matplotlib.pyplot.figure", "numpy.linspace", "numpy.zeros", "matplotlib.pyplot.title", "matplotlib.pyplot.show" ]
[((383, 402), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'dpi': '(100)'}), '(dpi=100)\n', (393, 402), True, 'from matplotlib import pyplot as plt\n'), ((607, 623), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (616, 623), True, 'from matplotlib import pyplot as plt\n'), ((628, 638), 'matplo...
import cv2 import numpy as np from random import randint animals_net = cv2.ml.ANN_MLP_create() # 设定train函数为弹性(resilient)反向传播 animals_net.setTrainMethod(cv2.ml.ANN_MLP_RPROP | cv2.ml.ANN_MLP_UPDATE_WEIGHTS) # 设置sigmoid作为激活函数 animals_net.setActivationFunction(cv2.ml.ANN_MLP_SIGMOID_SYM) # 按照书里的把隐藏层节点数设为8,效果非常差,所以改成3 ani...
[ "numpy.array", "cv2.ml.ANN_MLP_create", "random.randint" ]
[((72, 95), 'cv2.ml.ANN_MLP_create', 'cv2.ml.ANN_MLP_create', ([], {}), '()\n', (93, 95), False, 'import cv2\n'), ((343, 362), 'numpy.array', 'np.array', (['[3, 3, 4]'], {}), '([3, 3, 4])\n', (351, 362), True, 'import numpy as np\n'), ((587, 602), 'random.randint', 'randint', (['(10)', '(20)'], {}), '(10, 20)\n', (594,...
import pickle import tensorflow as tf import numpy as np NUM_HEADING_BIN = 12 NUM_OBJECT_POINT = 512 NUM_SIZE_CLUSTER = 8 g_type2class = {'car': 0, 'Van': 1, 'Truck': 2, 'pedestrian': 3, 'Person_sitting': 4, 'bicycle': 5, 'Tram': 6, 'Misc': 7} g_class2type = {g_type2class[t]: t for t in g_type2class} ...
[ "numpy.copy", "numpy.random.choice", "numpy.random.random", "pickle.load", "tensorflow.io.TFRecordWriter", "tensorflow.train.Int64List", "tensorflow.train.BytesList", "numpy.array", "numpy.zeros", "tensorflow.train.Features", "tensorflow.constant", "numpy.cos", "tensorflow.train.FloatList", ...
[((972, 1003), 'numpy.zeros', 'np.zeros', (['(NUM_SIZE_CLUSTER, 3)'], {}), '((NUM_SIZE_CLUSTER, 3))\n', (980, 1003), True, 'import numpy as np\n'), ((410, 438), 'numpy.array', 'np.array', (['[4.76, 1.93, 1.72]'], {}), '([4.76, 1.93, 1.72])\n', (418, 438), True, 'import numpy as np\n'), ((467, 512), 'numpy.array', 'np.a...
#!/usr/bin/env python import sys, json import netCDF4 as nc import numpy as np import pylab as pl import datetime as dt ############# # Constants # ############# Lv = 2.5E6 Rd = 287 Rv = 461 T0 = 273.15 E0 = 6.11 ###################################### # Data from Materhorn Field Campaign # ###########################...
[ "numpy.float", "numpy.exp", "numpy.array", "numpy.interp", "numpy.full", "json.dump" ]
[((983, 1000), 'numpy.float', 'np.float', (['lem[15]'], {}), '(lem[15])\n', (991, 1000), True, 'import numpy as np\n'), ((1009, 1026), 'numpy.float', 'np.float', (['obs[11]'], {}), '(obs[11])\n', (1017, 1026), True, 'import numpy as np\n'), ((1035, 1052), 'numpy.float', 'np.float', (['lem[13]'], {}), '(lem[13])\n', (10...
import pandas as pd import numpy as np ''' ############################################################################# DESCRIPTION DATA.PY Author: <NAME> (University of Edinburgh) This module can be used to generate random order data. Functions: - generate_orders(): Generate some input data (order ...
[ "pandas.DataFrame", "numpy.ceil", "numpy.random.default_rng" ]
[((3830, 3856), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'cols'}), '(columns=cols)\n', (3842, 3856), True, 'import pandas as pd\n'), ((3931, 3966), 'numpy.random.default_rng', 'np.random.default_rng', ([], {'seed': 'seed_no'}), '(seed=seed_no)\n', (3952, 3966), True, 'import numpy as np\n'), ((5540, 5593), ...
# Randomly simulates a determinantally-thinned Poisson point process. # # A determinantally-thinned Poisson point process is essentially a discrete # determinantal point process whose underlying state space is a single # realization of a Poisson point process defined on some bounded continuous # space. # # For more...
[ "numpy.abs", "numpy.linalg.eig", "numpy.random.poisson", "matplotlib.pyplot.ylabel", "numpy.random.rand", "numpy.ones", "numpy.sort", "matplotlib.pyplot.xlabel", "numpy.delete", "scipy.linalg.orth", "matplotlib.pyplot.close", "numpy.sum", "numpy.zeros", "numpy.exp", "numpy.outer", "mat...
[((840, 856), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (849, 856), True, 'import matplotlib.pyplot as plt\n'), ((1476, 1514), 'numpy.random.poisson', 'np.random.poisson', (['(lambda0 * areaTotal)'], {}), '(lambda0 * areaTotal)\n', (1493, 1514), True, 'import numpy as np\n'), ((1544, 158...
__author__ = '<NAME>' from PyQt4 import QtCore, QtGui from core.pco_definitions import PixelFly from threading import Thread import os, time, sys, pickle import pyqtgraph as pg from astropy.io import fits import numpy as np import matlab.engine from queue import Empty import pygame, os, time, pickle import w...
[ "pyqtgraph.PlotCurveItem", "PyQt4.QtGui.QMainWindow", "pyqtgraph.PlotItem", "numpy.log", "PyQt4.QtGui.QPushButton", "PyQt4.QtGui.QLabel", "time.sleep", "PyQt4.QtCore.QTimer.singleShot", "PyQt4.QtGui.QKeySequence", "PyQt4.QtGui.QWidget.__init__", "PyQt4.QtGui.QStatusBar", "PyQt4.QtGui.QApplicat...
[((44330, 44358), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (44348, 44358), False, 'from PyQt4 import QtCore, QtGui\n'), ((44373, 44392), 'PyQt4.QtGui.QMainWindow', 'QtGui.QMainWindow', ([], {}), '()\n', (44390, 44392), False, 'from PyQt4 import QtCore, QtGui\n'), ((1193, 122...
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import glob import shutil from collections import defaultdict import numpy as np import simplejson as json import argparse def create_dataset(number: int, directory: str) -> None: # delete old dataset and create new dataset if os.path.isdir(directory): ...
[ "os.makedirs", "argparse.ArgumentParser", "simplejson.dumps", "os.path.splitext", "simplejson.load", "os.path.isdir", "collections.defaultdict", "os.path.basename", "shutil.copy", "shutil.rmtree", "glob.glob", "numpy.random.shuffle" ]
[((292, 316), 'os.path.isdir', 'os.path.isdir', (['directory'], {}), '(directory)\n', (305, 316), False, 'import os\n'), ((355, 377), 'os.makedirs', 'os.makedirs', (['directory'], {}), '(directory)\n', (366, 377), False, 'import os\n'), ((417, 439), 'glob.glob', 'glob.glob', (['"""val2017/*"""'], {}), "('val2017/*')\n"...
""" Here the plots and visualizations """ import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np def plt_arima_forecast(y, forecasts, length_for_training=None, conf_int=False, title='Country name here', y_label='Deaths',...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.savefig", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "numpy.arange", "matplotlib.pyplot.gcf", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.clf", "matplotlib.pyplot.plot", "matplotlib.image.imread", "matplotlib.pyplot.axis", "matplot...
[((898, 907), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (905, 907), True, 'import matplotlib.pyplot as plt\n'), ((964, 1000), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y', '"""b*--"""'], {'label': '"""Real"""'}), "(x, y, 'b*--', label='Real')\n", (972, 1000), True, 'import matplotlib.pyplot as plt\n'), ...
from functools import partial import numpy as np from thequickmath.field import read_field, write_field def localise_random_field(random_field_path, output_field_path, a_x=30., b_x=10., a_z=10., b_z=10., c=1.): """ Makes a localised turbulent spot out of a homogeneously random field located in file random_f...
[ "thequickmath.field.write_field", "numpy.tanh", "functools.partial", "thequickmath.field.read_field" ]
[((898, 927), 'thequickmath.field.read_field', 'read_field', (['random_field_path'], {}), '(random_field_path)\n', (908, 927), False, 'from thequickmath.field import read_field, write_field\n'), ((943, 980), 'functools.partial', 'partial', (['window', 'a_x', 'b_x', "attr['Lx']"], {}), "(window, a_x, b_x, attr['Lx'])\n"...
import numpy as np from mgcpy.benchmarks.simulations import (circle_sim, cub_sim, exp_sim, joint_sim, linear_sim, log_sim, multi_indep_sim, multi_noise_sim, quad_sim, root_sim, sin_sim, ...
[ "mgcpy.benchmarks.simulations.square_sim", "numpy.genfromtxt", "mgcpy.benchmarks.simulations.sin_sim", "mgcpy.benchmarks.simulations.circle_sim" ]
[((617, 649), 'mgcpy.benchmarks.simulations.sin_sim', 'sin_sim', (['x', 'y'], {'period': '(16 * np.pi)'}), '(x, y, period=16 * np.pi)\n', (624, 649), False, 'from mgcpy.benchmarks.simulations import circle_sim, cub_sim, exp_sim, joint_sim, linear_sim, log_sim, multi_indep_sim, multi_noise_sim, quad_sim, root_sim, sin_s...
import numpy as np import argparse def patch_generator(img, patch_size, stride): h, w, _ = img.shape patch_t = [] for i in range(0, h-patch_size+1, stride): for j in range(0, w-patch_size+1, stride): patch_t.append(img[i: i + patch_size, j: j + patch_size, :]) return patch_t def ...
[ "numpy.rot90", "argparse.ArgumentTypeError", "numpy.flipud" ]
[((427, 441), 'numpy.flipud', 'np.flipud', (['img'], {}), '(img)\n', (436, 441), True, 'import numpy as np\n'), ((1119, 1172), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (['"""Boolean value expected."""'], {}), "('Boolean value expected.')\n", (1145, 1172), False, 'import argparse\n'), ((477, 503), 'nu...
import pdb import pickle import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import figure def batch_to_epoch(arr, num, ignore_first=False): if len(arr) == 0: return [] i = 0 epoch_vals = [] while i + num <= len(arr): if ignore_first: if i == 0: ...
[ "numpy.array", "pickle.load" ]
[((1897, 1918), 'numpy.array', 'np.array', (['experiments'], {}), '(experiments)\n', (1905, 1918), True, 'import numpy as np\n'), ((2460, 2481), 'numpy.array', 'np.array', (['experiments'], {}), '(experiments)\n', (2468, 2481), True, 'import numpy as np\n'), ((3358, 3379), 'numpy.array', 'np.array', (['experiments'], {...
""" Ancillary functions on numpy arrays """ import numpy as np def unique_rows(ar: np.ndarray, return_counts: bool= False): """unique_rows Returns the unique rows of a multidimensional array. :param ar: array_like Input array. :param return_counts: If True, also return the number of t...
[ "numpy.unique", "numpy.column_stack", "numpy.ascontiguousarray", "numpy.zeros", "numpy.dtype" ]
[((560, 602), 'numpy.unique', 'np.unique', (['ar'], {'return_counts': 'return_counts'}), '(ar, return_counts=return_counts)\n', (569, 602), True, 'import numpy as np\n'), ((629, 681), 'numpy.dtype', 'np.dtype', (['(np.void, ar.dtype.itemsize * ar.shape[1])'], {}), '((np.void, ar.dtype.itemsize * ar.shape[1]))\n', (637,...
from gym_torcs import TorcsEnv import numpy as np import random import argparse from keras.models import model_from_json, Model from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation, Flatten from keras.optimizers import Adam import tensorflow as tf from keras.engine.training impor...
[ "signal.signal", "numpy.hstack", "tensorflow.Session", "keras.backend.set_session", "numpy.asarray", "ActorNetworkPreTraining.ActorNetwork", "CriticNetwork.CriticNetwork", "numpy.zeros", "gym_torcs.TorcsEnv", "numpy.random.seed", "sys.exit", "tensorflow.ConfigProto", "ReplayBuffer.ReplayBuff...
[((606, 610), 'OU.OU', 'OU', ([], {}), '()\n', (608, 610), False, 'from OU import OU\n'), ((3609, 3629), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (3623, 3629), True, 'import numpy as np\n'), ((3790, 3806), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (3804, 3806), True, 'imp...
import itertools import numpy as np import sys from collections import defaultdict, namedtuple #Credit: #https://github.com/dennybritz/reinforcement-learning EpisodeStats = namedtuple("Stats",["episode_lengths", "episode_rewards"]) def make_epsilon_greedy_policy(Q, epsilon, decay, nA): """ Creates an epsilon...
[ "numpy.all", "collections.namedtuple", "numpy.allclose", "numpy.ones", "numpy.argmax", "numpy.zeros", "numpy.random.randint", "itertools.count", "sys.stdout.flush", "numpy.vectorize" ]
[((175, 234), 'collections.namedtuple', 'namedtuple', (['"""Stats"""', "['episode_lengths', 'episode_rewards']"], {}), "('Stats', ['episode_lengths', 'episode_rewards'])\n", (185, 234), False, 'from collections import defaultdict, namedtuple\n'), ((2122, 2150), 'numpy.vectorize', 'np.vectorize', (['exploration_fn'], {}...
import sys import matplotlib as mpl import torch.nn.functional as F import torch.optim as optim import torchvision import torchvision.transforms as transforms from tensorboardX import SummaryWriter from torch import nn from torch.autograd import Variable from tqdm import trange import gaussian import util from util i...
[ "util.totensor", "torch.nn.ReLU", "util.contains_nan", "util.kl_loss", "torch.sqrt", "torch.exp", "torch.nn.functional.sigmoid", "networkx.draw_networkx_nodes", "torch.cuda.is_available", "sys.exit", "torchvision.utils.make_grid", "util.Flatten", "torch.arange", "networkx.draw_networkx_edg...
[((336, 350), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (343, 350), True, 'import matplotlib as mpl\n'), ((1620, 1665), 'torch.sqrt', 'torch.sqrt', (['(1.0 / (gaussian.EPSILON + sigmas))'], {}), '(1.0 / (gaussian.EPSILON + sigmas))\n', (1630, 1665), False, 'import torch\n'), ((2008, 2034), 'torch.e...
from pathlib import Path import numpy as np def load_binary(path, dtype=np.float32): """Loads a binary file and returns it as a numpy.ndarray. Args: path: String or ``pathlib.Path`` object. dtype: Data type used to determine the size and byte-order of the items in the file. The r...
[ "numpy.fromfile", "numpy.convolve", "pathlib.Path" ]
[((563, 584), 'numpy.fromfile', 'np.fromfile', (['f', 'dtype'], {}), '(f, dtype)\n', (574, 584), True, 'import numpy as np\n'), ((491, 501), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (495, 501), False, 'from pathlib import Path\n'), ((659, 683), 'numpy.convolve', 'np.convolve', (['signal', 'rir'], {}), '(sign...
'''scripts/usefulFunctions.py''' """ To prevent duplicate code being pasted between methods, common functions should be put here. No code here should make or delete files. """ # External libraries import numpy as np # Internal libraries import subprocess from shutil import get_terminal_size from time import time, lo...
[ "math.ceil", "subprocess.Popen", "os.path.join", "numpy.max", "os.path.realpath", "shutil.get_terminal_size", "numpy.zeros", "platform.system", "numpy.min", "time.localtime", "time.time" ]
[((997, 1038), 'numpy.zeros', 'np.zeros', (['audioFrameCount'], {'dtype': 'np.uint8'}), '(audioFrameCount, dtype=np.uint8)\n', (1005, 1038), True, 'import numpy as np\n'), ((1617, 1658), 'numpy.zeros', 'np.zeros', (['audioFrameCount'], {'dtype': 'np.uint8'}), '(audioFrameCount, dtype=np.uint8)\n', (1625, 1658), True, '...
import os import sys import time import logging import argparse import matplotlib; matplotlib.use('Agg') import numpy as np import pandas as pd import matplotlib.pyplot as plt from itertools import filterfalse from collections import Counter from matplotlib import font_manager from GetConfig import getConfig try: ...
[ "logging.getLogger", "logging.StreamHandler", "matplotlib.pyplot.ylabel", "FilesIO.check_population", "numpy.array", "FilesIO.check_hap_input", "matplotlib.font_manager.fontManager.ttflist.extend", "sys.exit", "matplotlib.font_manager.createFontList", "argparse.ArgumentParser", "sklearn.decompos...
[((83, 104), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (97, 104), False, 'import matplotlib\n'), ((782, 793), 'GetConfig.getConfig', 'getConfig', ([], {}), '()\n', (791, 793), False, 'from GetConfig import getConfig\n'), ((845, 956), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"...
"""A simple 1D Maxwell Solver This one is based on 'maxvell1D.m' matlab routine by <NAME>. (c) <NAME> 2012, mailto: <EMAIL> """ import numpy as np ## numeric routines; arrays import pylab as plt ## plotting # Set plotting parameters params = {'axes.labelsize': 'large', 'xtick.labels...
[ "pylab.title", "pylab.xlabel", "pylab.hold", "numpy.array", "numpy.sin", "numpy.mod", "numpy.arange", "pylab.draw", "pylab.plot", "numpy.fft.fft2", "numpy.exp", "numpy.linspace", "pylab.rcParams.update", "pylab.clf", "pylab.subplot", "pylab.figure", "pylab.pause", "pylab.pcolor", ...
[((450, 477), 'pylab.rcParams.update', 'plt.rcParams.update', (['params'], {}), '(params)\n', (469, 477), True, 'import pylab as plt\n'), ((1097, 1136), 'numpy.exp', 'np.exp', (['(-(x - Lx / 2) ** 2 / sigma ** 2)'], {}), '(-(x - Lx / 2) ** 2 / sigma ** 2)\n', (1103, 1136), True, 'import numpy as np\n'), ((1137, 1149), ...
import torch import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from SVC_Utils import * from sklearn.metrics import roc_curve, auc # determine device to run network on (runs on gpu if available) device = torch.device("cuda:0" if torch.cuda.is_avail...
[ "torch.sort", "torch.ones", "numpy.ones", "matplotlib.pyplot.ylabel", "sklearn.metrics.auc", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "numpy.zeros", "sklearn.metrics.roc_curve", "numpy.empty", "torch.cuda.is_available", "torch.no_grad", "torch.zeros", "numpy.a...
[((1888, 1912), 'numpy.arange', 'np.arange', (['(0.5)', '(1)', '(0.005)'], {}), '(0.5, 1, 0.005)\n', (1897, 1912), True, 'import numpy as np\n'), ((2157, 2173), 'numpy.empty', 'np.empty', (['(0, 2)'], {}), '((0, 2))\n', (2165, 2173), True, 'import numpy as np\n'), ((2187, 2203), 'numpy.empty', 'np.empty', (['(0, 2)'], ...
# -*- coding: utf-8 -*- """Utility functions.""" import os import random import tempfile import matplotlib.pyplot as plt import numpy as np from moviepy import editor as mpy import tensorflow as tf def display_data(data, num_img): """Display some data from the dataset.""" # pylint: disable=invalid-name ...
[ "matplotlib.pyplot.imshow", "tensorflow.random.set_seed", "tensorflow.compat.v1.Summary.Image", "random.seed", "os.remove", "matplotlib.pyplot.figure", "tensorflow.compat.v1.Summary", "numpy.random.seed", "tempfile.NamedTemporaryFile", "numpy.maximum", "matplotlib.pyplot.show" ]
[((394, 431), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 4 * num_img)'}), '(figsize=(20, 4 * num_img))\n', (404, 431), True, 'import matplotlib.pyplot as plt\n'), ((801, 811), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (809, 811), True, 'import matplotlib.pyplot as plt\n'), ((872, 889...
#!/usr/bin/env python3 # This file is covered by the LICENSE file in the root of this project. import argparse import os import yaml import numpy as np import pcl # import matplotlib.pyplot as plt # from mpl_toolkits.mplot3d import Axes3D from auxiliary.laserscan import SemLaserScan import random import open3d # from ...
[ "numpy.uint8", "numpy.fromfile", "open3d.PointCloud", "rospy.init_node", "numpy.array", "rospy.Rate", "numpy.arctan2", "numpy.linalg.norm", "os.path.exists", "numpy.mean", "argparse.ArgumentParser", "numpy.random.random", "numpy.uint32", "os.path.isdir", "sensor_msgs.point_cloud2.PointFi...
[((2547, 2586), 'numpy.zeros', 'np.zeros', (['(max_key + 100)'], {'dtype': 'np.int32'}), '(max_key + 100, dtype=np.int32)\n', (2555, 2586), True, 'import numpy as np\n'), ((3009, 3024), 'random.random', 'random.random', ([], {}), '()\n', (3022, 3024), False, 'import random\n'), ((3033, 3048), 'random.random', 'random.r...
import tensorflow as tf import numpy as np from tensorflow.keras import layers from tensorflow.keras import Model import tensorflow.keras.backend as K from tensorflow.keras.initializers import glorot_normal class Identity(layers.Layer): ''' Identity layer. It returns a copy of the input. ''' # According to the Te...
[ "tensorflow.nn.conv2d", "tensorflow.add", "numpy.array", "tensorflow.keras.initializers.glorot_normal", "tensorflow.matmul", "tensorflow.nn.conv2d_transpose", "tensorflow.reshape", "tensorflow.convert_to_tensor", "tensorflow.identity", "tensorflow.keras.backend.square" ]
[((669, 688), 'tensorflow.identity', 'tf.identity', (['inputs'], {}), '(inputs)\n', (680, 688), True, 'import tensorflow as tf\n'), ((1751, 1781), 'numpy.array', 'np.array', (['self.init_weights[0]'], {}), '(self.init_weights[0])\n', (1759, 1781), True, 'import numpy as np\n'), ((1793, 1823), 'numpy.array', 'np.array',...
import pandas as pd from torch import nn, manual_seed import torch import time import os import random import numpy as np from ast import literal_eval from torch.nn import L1Loss from torch.optim import Adam def read_feature_table(path, target, variables): feature_table = pd.read_csv(path) for var in [tar...
[ "torch.manual_seed", "torch.nn.Dropout", "pandas.read_csv", "torch.nn.LSTM", "torch.nn.L1Loss", "time.strftime", "torch.Tensor", "torch.utils.data.TensorDataset", "random.seed", "numpy.random.seed", "torch.nn.Linear", "torch.utils.data.DataLoader", "torch.zeros", "torch.cat" ]
[((283, 300), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (294, 300), True, 'import pandas as pd\n'), ((1190, 1198), 'torch.nn.L1Loss', 'L1Loss', ([], {}), '()\n', (1196, 1198), False, 'from torch.nn import L1Loss\n'), ((2007, 2033), 'torch.Tensor', 'torch.Tensor', (['data[target]'], {}), '(data[targe...
""" Detection Testing Script. This scripts reads a given config file and runs the evaluation. It is an entry point that is made to evaluate standard models in FsDet. In order to let one script support evaluation of many models, this script contains logic that are specific to these built-in models and therefore may no...
[ "fsdet.config.set_global_cfg", "fsdet.config.get_cfg", "torch.manual_seed", "fsdet.engine.default_argument_parser", "detectron2.utils.comm.is_main_process", "fsdet.engine.default_setup", "fsdet.evaluation.verify_results", "random.seed", "detectron2.engine.launch", "laplacianshot.trainer.LaplacianT...
[((735, 749), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (746, 749), False, 'import random\n'), ((750, 767), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (764, 767), True, 'import numpy as np\n'), ((768, 788), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (785, 788), Fal...
import numpy as np WALL = '%' START = 'P' DOT = '.' SPACE = ' ' PATHCHAR = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' class MazeSearchNode: def __init__(self, state, parent=None, cost=0): self.state = state self.parent = parent self.cost = cost self.ate = No...
[ "numpy.zeros" ]
[((1269, 1303), 'numpy.zeros', 'np.zeros', (['(nrow, ncol)'], {'dtype': 'bool'}), '((nrow, ncol), dtype=bool)\n', (1277, 1303), True, 'import numpy as np\n')]
import numpy as np from scipy.interpolate import CubicSpline def gen_c2_spline(x, y, init_heading, slen_start, slen_end): ''' Generates a C2 continuous spline using scipy CubicSpline lib x: np.array of x-coordinate points y: np.array of y-coordinate points ''' # define mu, a virtual pat...
[ "numpy.flip", "numpy.sqrt", "numpy.power", "numpy.diff", "numpy.linspace", "numpy.zeros", "numpy.cos", "numpy.sin" ]
[((1099, 1147), 'numpy.sqrt', 'np.sqrt', (['((x[1] - x[0]) ** 2 + (y[1] - y[0]) ** 2)'], {}), '((x[1] - x[0]) ** 2 + (y[1] - y[0]) ** 2)\n', (1106, 1147), True, 'import numpy as np\n'), ((1159, 1211), 'numpy.sqrt', 'np.sqrt', (['((x[-1] - x[-2]) ** 2 + (y[-1] - y[-2]) ** 2)'], {}), '((x[-1] - x[-2]) ** 2 + (y[-1] - y[-...
import os import numpy as np import tensorflow as tf import cv2 import time import sys import pickle import ROLO_utils as util class YOLO_TF: fromfile = None tofile_img = 'test/output.jpg' tofile_txt = 'test/output.txt' imshow = True filewrite_img = False filewrite_txt = False disp_console = True weights_file...
[ "cv2.rectangle", "tensorflow.pad", "tensorflow.transpose", "cv2.imshow", "numpy.argsort", "numpy.array", "numpy.save", "os.walk", "numpy.arange", "os.path.exists", "numpy.multiply", "numpy.reshape", "ROLO_utils.choose_video_sequence", "tensorflow.Session", "tensorflow.placeholder", "nu...
[((24313, 24345), 'ROLO_utils.choose_video_sequence', 'util.choose_video_sequence', (['test'], {}), '(test)\n', (24339, 24345), True, 'import ROLO_utils as util\n'), ((24776, 24840), 'os.path.join', 'os.path.join', (['root_folder', 'sequence_name', '"""groundtruth_rect.txt"""'], {}), "(root_folder, sequence_name, 'grou...
import time from collections import OrderedDict import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader import logging from tqdm import tqdm from neuralprophet import configure from neuralprophet import time_net from neuralprophet import time_dataset from neuralprophet import df_ut...
[ "logging.getLogger", "neuralprophet.df_utils.join_dataframes", "neuralprophet.utils.fcst_df_to_last_forecast", "numpy.log", "neuralprophet.metrics.ValueMetric", "neuralprophet.df_utils.fill_linear_then_rolling_avg", "torch.cos", "torch.sum", "neuralprophet.df_utils.crossvalidation_split_df", "neur...
[((523, 557), 'logging.getLogger', 'logging.getLogger', (['"""NP.forecaster"""'], {}), "('NP.forecaster')\n", (540, 557), False, 'import logging\n'), ((7985, 8195), 'neuralprophet.configure.Normalization', 'configure.Normalization', ([], {'normalize': 'normalize', 'global_normalization': 'global_normalization', 'global...
# -*- coding: utf-8 -*- """ Benchmarks for primitive/low-level array operations. """ __all__ = [ "bench_astype", "bench_astype_numba", "bench_astype_numpy", "bench_bool_index", "bench_bool_index_numpy", "bench_compare_ops", "bench_compare_ops_numpy", "bench_mbget", "benc...
[ "logging.getLogger", "numpy.random.default_rng", "itertools.product", "numba.njit", "numpy.iinfo", "numba.prange", "numpy.dtype" ]
[((967, 994), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (984, 994), False, 'import logging\n'), ((4286, 4332), 'numba.njit', 'nb.njit', ([], {'cache': '(True)', 'parallel': '(True)', 'nogil': '(True)'}), '(cache=True, parallel=True, nogil=True)\n', (4293, 4332), True, 'import numba a...
import unittest import numpy as np import tensorflow as tf import tensorflow_probability import mvg_distributions.covariance_representations as cov_rep from mvg_distributions.sqrt_gamma_gaussian import SqrtGammaGaussian, SparseSqrtGammaGaussian from mvg_distributions.test.test_losses_base import LossesTestBase tfd =...
[ "numpy.random.normal", "numpy.diag_indices_from", "mvg_distributions.sqrt_gamma_gaussian.SqrtGammaGaussian", "numpy.sqrt", "tensorflow.matrix_diag_part", "tensorflow.reduce_sum", "mvg_distributions.sqrt_gamma_gaussian.SparseSqrtGammaGaussian", "numpy.log", "numpy.zeros", "numpy.linalg.inv", "ten...
[((5965, 5980), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5978, 5980), False, 'import unittest\n'), ((958, 1068), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.batch_size, self.features_size, self.features_size)', 'dtype': 'self.dtype.as_numpy_dtype'}), '(shape=(self.batch_size, self.features_size, self.f...