code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" To generate images with a pre-trained rcGAN model. This is a mix of the image quilting algorithm over GAN generated patches. @author: <NAME> """ import os import sys import heapq import argparse import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.utils.data import t...
[ "matplotlib.pyplot.title", "numpy.sum", "argparse.ArgumentParser", "heapq.heappush", "heapq.heappushpop", "matplotlib.pyplot.margins", "concurrent.futures.ProcessPoolExecutor", "torch.cat", "torch.randn", "torch.cuda.device_count", "numpy.argmin", "numpy.ones", "numpy.random.randint", "num...
[((693, 718), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (716, 718), False, 'import argparse\n'), ((21233, 21256), 'matplotlib.pyplot.imread', 'plt.imread', (['source_path'], {}), '(source_path)\n', (21243, 21256), True, 'import matplotlib.pyplot as plt\n'), ((21590, 21615), 'torch.cuda.dev...
# -*- coding: utf-8 -*- """Cost matrix computation.""" import numpy as np from numba import jit @jit(nopython=True) def _calc_cumsum_matrix_jit(X, w_list, p_ar, open_begin): """Fast implementation by numba.jit.""" len_x, len_y = X.shape # cumsum matrix D = np.ones((len_x, len_y), dtype=np.float64) * ...
[ "numpy.zeros", "numba.jit", "numpy.ones" ]
[((100, 118), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (103, 118), False, 'from numba import jit\n'), ((638, 677), 'numpy.zeros', 'np.zeros', (['num_pattern'], {'dtype': 'np.float64'}), '(num_pattern, dtype=np.float64)\n', (646, 677), True, 'import numpy as np\n'), ((710, 753), 'numpy.zero...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : Feb-01-20 06:51 # @Author : <NAME> (<EMAIL>) # @Link : https://www.kaggle.com/uysimty/keras-cnn-dog-or-cat-classification import numpy as np import pandas as pd from keras.preprocessing.image import ImageDataGenerator, load_img from keras.utils i...
[ "keras.preprocessing.image.ImageDataGenerator", "os.mkdir", "pickle.dump", "sklearn.model_selection.train_test_split", "tensorflow.local_variables_initializer", "os.path.isfile", "numpy.arange", "matplotlib.pyplot.tight_layout", "os.path.join", "pandas.DataFrame", "os.path.exists", "keras.call...
[((1161, 1214), 'model.simple_CNN', 'simple_CNN', (['IMAGE_WIDTH', 'IMAGE_HEIGHT', 'IMAGE_CHANNELS'], {}), '(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS)\n', (1171, 1214), False, 'from model import simple_CNN\n'), ((1366, 1425), 'os.path.join', 'os.path.join', (['MODEL_SAVES_DIR', '"""model_24-val_acc-0.7852.h5"""'], {})...
"""K-prototypes clustering""" # Author: <NAME> <<EMAIL>> # License: MIT from collections import defaultdict import numpy as np from .KModes import KModes def euclidean_dissim(a, b): """Euclidean distance dissimilarity function""" return np.sum((a - b) ** 2, axis=1) def move_point_num(point, ipoint, to_cl...
[ "numpy.sum", "numpy.random.randn", "numpy.std", "numpy.empty", "numpy.asanyarray", "numpy.zeros", "numpy.argmin", "collections.defaultdict", "numpy.mean", "numpy.random.choice", "numpy.argwhere" ]
[((250, 278), 'numpy.sum', 'np.sum', (['((a - b) ** 2)'], {'axis': '(1)'}), '((a - b) ** 2, axis=1)\n', (256, 278), True, 'import numpy as np\n'), ((980, 1012), 'numpy.empty', 'np.empty', (['npoints'], {'dtype': '"""int64"""'}), "(npoints, dtype='int64')\n", (988, 1012), True, 'import numpy as np\n'), ((4144, 4163), 'n...
# coding: utf-8 # In[1]: import numpy as np # In[2]: def IOU(box,boxes): '''裁剪的box和图片所有人脸box的iou值 参数: box:裁剪的box,当box维度为4时表示box左上右下坐标,维度为5时,最后一维为box的置信度 boxes:图片所有人脸box,[n,4] 返回值: iou值,[n,] ''' #box面积 box_area=(box[2]-box[0]+1)*(box[3]-box[1]+1) #boxes面积,[n,] ar...
[ "numpy.minimum", "numpy.maximum" ]
[((399, 430), 'numpy.maximum', 'np.maximum', (['box[0]', 'boxes[:, 0]'], {}), '(box[0], boxes[:, 0])\n', (409, 430), True, 'import numpy as np\n'), ((437, 468), 'numpy.maximum', 'np.maximum', (['box[1]', 'boxes[:, 1]'], {}), '(box[1], boxes[:, 1])\n', (447, 468), True, 'import numpy as np\n'), ((475, 506), 'numpy.minim...
from individual.case import Case from linear.stability import Stability import glob import configobj import numpy as np class Actual: def __init__(self, path_to_source): self.path = path_to_source self.systems = ['aeroelastic', 'aerodynamic', 'structural'] self.cases = dict() for ...
[ "numpy.ones_like", "numpy.concatenate", "configobj.ConfigObj", "numpy.argsort", "numpy.array", "pdb.set_trace", "linear.stability.Stability", "glob.glob", "numpy.vstack" ]
[((4722, 4754), 'numpy.array', 'np.array', (['[0, 0, 0]'], {'dtype': 'float'}), '([0, 0, 0], dtype=float)\n', (4730, 4754), True, 'import numpy as np\n'), ((5499, 5520), 'numpy.array', 'np.array', (['param_array'], {}), '(param_array)\n', (5507, 5520), True, 'import numpy as np\n'), ((5537, 5560), 'numpy.argsort', 'np....
import time import gym import numpy as np import concurrent.futures import os import sys from stable_baselines3 import PPO, SAC, TD3 from stable_baselines3.common.vec_env import VecEnv, VecEnvWrapper, DummyVecEnv, SubprocVecEnv, VecNormalize, VecMonitor, VecCheckNan from stable_baselines3.common.env_util import make_v...
[ "sys.path.append", "stable_baselines3.PPO", "stable_baselines3.common.env_checker.check_env", "os.path.dirname", "os.path.realpath", "stable_baselines3.common.logger.configure", "numpy.zeros", "numpy.ones", "stable_baselines3.common.utils.set_random_seed", "pkg.drivers.PureFTG", "stable_baseline...
[((706, 734), 'sys.path.append', 'sys.path.append', (['current_dir'], {}), '(current_dir)\n', (721, 734), False, 'import sys\n'), ((1089, 1139), 'os.path.join', 'os.path.join', (['root_path', '"""gym"""', '"""f110_gym"""', '"""envs"""'], {}), "(root_path, 'gym', 'f110_gym', 'envs')\n", (1101, 1139), False, 'import os\n...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init from torch import nn import numpy as np import math ########################################################################## ##### P A R T S ############################################### ###############################...
[ "torch.nn.InstanceNorm2d", "torch.nn.InstanceNorm1d", "torch.nn.init.constant_", "torch.ones", "torch.nn.init.kaiming_normal_", "torch.nn.ReflectionPad2d", "torch.nn.functional.avg_pool2d", "torch.nn.functional.adaptive_avg_pool2d", "torch.nn.Upsample", "torch.Tensor", "torch.nn.Linear", "torc...
[((19115, 19137), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (19128, 19137), False, 'from torch import nn\n'), ((510, 525), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (523, 525), False, 'from torch import nn\n'), ((682, 708), 'torch.nn.Sequential', 'nn.Sequential', (['*self...
""" Step 3: Download the results, train and evaluate the model, and upload it to S3. The S3 part requires you to have AWS configured in your engine/conf/config.json file. It may also be necessary to call GlobalInit() before upload to ensure the config is loaded """ import logging from pathlib import Path import nump...
[ "pandas.DataFrame", "numpy.count_nonzero", "sm.engine.annotation.scoring_model.save_scoring_model_to_db", "sm.engine.annotation.scoring_model.upload_catboost_scoring_model", "pathlib.Path.home", "sm.engine.annotation.scoring_model.add_derived_features", "sm.engine.util.GlobalInit", "sm.engine.annotati...
[((867, 894), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (884, 894), False, 'import logging\n'), ((5072, 5127), 'sm.fdr_engineering.train_model.cv_train', 'cv_train', (['train_metrics_df', 'splits', 'features', 'cb_params'], {}), '(train_metrics_df, splits, features, cb_params)\n', (5...
import h5py import numpy as np complex32 = np.dtype([('r', np.float16), ('i', np.float16)]) def to_complex32(z: np.array): zf = np.zeros(z.shape, dtype=complex32) zf['r'] = z.real zf['i'] = z.imag return zf def read_c4_dataset_as_c8(ds: h5py.Dataset, key=np.s_[...]): """ Read a complex floa...
[ "numpy.dtype", "numpy.zeros" ]
[((44, 92), 'numpy.dtype', 'np.dtype', (["[('r', np.float16), ('i', np.float16)]"], {}), "([('r', np.float16), ('i', np.float16)])\n", (52, 92), True, 'import numpy as np\n'), ((135, 169), 'numpy.zeros', 'np.zeros', (['z.shape'], {'dtype': 'complex32'}), '(z.shape, dtype=complex32)\n', (143, 169), True, 'import numpy a...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import mpl_toolkits plt.rcParams['font.size'] = 9.0 arr=[] data = pd.read_csv("kc_house_data.csv") data2= pd.read_csv("datafile.csv") data3=pd.read_csv("houseShortage.csv") while(1): print("Choose the parameters to visualize...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "pandas.read_csv", "matplotlib.pyplot.scatter", "matplotlib.pyplot.bar", "matplotlib.pyplot.legend", "numpy.arange", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots" ]
[((161, 193), 'pandas.read_csv', 'pd.read_csv', (['"""kc_house_data.csv"""'], {}), "('kc_house_data.csv')\n", (172, 193), True, 'import pandas as pd\n'), ((201, 228), 'pandas.read_csv', 'pd.read_csv', (['"""datafile.csv"""'], {}), "('datafile.csv')\n", (212, 228), True, 'import pandas as pd\n'), ((235, 267), 'pandas.re...
## ObjectiveFunc.py -- Perform Gradient Estimation and Evaluation for a Given Function ## ## Copyright (C) 2018, IBM Corp ## <NAME> <<EMAIL>> ## <NAME> <<EMAIL>> ## <NAME> <<EMAIL>> ## ## Licensed under the Apache License, Version 2.0 (the "License"); ...
[ "numpy.random.uniform", "numpy.arctanh", "numpy.size", "numpy.random.seed", "numpy.tanh", "numpy.sum", "numpy.log", "numpy.square", "numpy.zeros", "numpy.expand_dims", "numpy.amax", "numpy.array", "numpy.arange", "numpy.random.normal" ]
[((864, 884), 'numpy.random.seed', 'np.random.seed', (['(2018)'], {}), '(2018)\n', (878, 884), True, 'import numpy as np\n'), ((1097, 1129), 'numpy.arctanh', 'np.arctanh', (['(origImgs * 1.9999999)'], {}), '(origImgs * 1.9999999)\n', (1107, 1129), True, 'import numpy as np\n'), ((1774, 1831), 'numpy.random.uniform', 'n...
import unittest import numpy as np import scipy.signal import sys sys.path.append("..") import features def zeros(sig_len=1024): signal = np.zeros(sig_len) return (signal, np.fft.rfft(signal)) def ones(sig_len=1024): signal = np.ones(sig_len) return (signal, np.fft.rfft(signal)) def sine(periods=1...
[ "sys.path.append", "unittest.main", "numpy.fft.rfft", "features.spectral_brightness", "numpy.fft.irfft", "numpy.log", "numpy.random.randn", "numpy.allclose", "numpy.zeros", "numpy.ones", "numpy.linspace", "numpy.all" ]
[((66, 87), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (81, 87), False, 'import sys\n'), ((144, 161), 'numpy.zeros', 'np.zeros', (['sig_len'], {}), '(sig_len)\n', (152, 161), True, 'import numpy as np\n'), ((242, 258), 'numpy.ones', 'np.ones', (['sig_len'], {}), '(sig_len)\n', (249, 258), Tru...
import numpy as np import numpy.testing as npt import pandas as pd from stumpy import aampi, core, config import pytest import naive substitution_locations = [(slice(0, 0), 0, -1, slice(1, 3), [0, 3])] substitution_values = [np.nan, np.inf] def test_aampi_int_input(): with pytest.raises(TypeError): aampi...
[ "numpy.random.seed", "numpy.ones", "naive.aamp", "numpy.random.randint", "numpy.arange", "pytest.mark.parametrize", "numpy.full", "numpy.testing.assert_almost_equal", "pytest.raises", "naive.replace_inf", "numpy.ceil", "naive.distance", "naive.aampi_egress", "pandas.Series", "numpy.argwh...
[((4750, 4808), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""substitute"""', 'substitution_values'], {}), "('substitute', substitution_values)\n", (4773, 4808), False, 'import pytest\n'), ((4810, 4883), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""substitution_locations"""', 'substitution_...
# -*- coding: utf-8 -*- import numpy as np import pytest from endochrone.utils import lazy_test_runner as ltr import endochrone.time_series.arima as arima __author__ = "nickwood" __copyright__ = "nickwood" __license__ = "mit" def test_ar1_model(): x = np.arange(0, 10, 0.2) AR1 = arima.ArModel(order=1, calc...
[ "endochrone.time_series.arima.MaModel", "endochrone.time_series.arima.ArModel", "numpy.sum", "pytest.raises", "numpy.mean", "numpy.array", "numpy.arange", "endochrone.utils.lazy_test_runner", "pytest.approx", "numpy.all" ]
[((3288, 3293), 'endochrone.utils.lazy_test_runner', 'ltr', ([], {}), '()\n', (3291, 3293), True, 'from endochrone.utils import lazy_test_runner as ltr\n'), ((260, 281), 'numpy.arange', 'np.arange', (['(0)', '(10)', '(0.2)'], {}), '(0, 10, 0.2)\n', (269, 281), True, 'import numpy as np\n'), ((293, 341), 'endochrone.tim...
"""Tests for the quantized layers.""" import numpy import pytest from concrete.quantization import QuantizedArray, QuantizedLinear # QuantizedLinear unstable with n_bits>23 # and hard to test with numpy.isclose with n_bits < 8 N_BITS_LIST = [20, 16, 8] @pytest.mark.parametrize( "n_bits", [pytest.param(n_bit...
[ "numpy.random.uniform", "pytest.param", "numpy.isclose", "concrete.quantization.QuantizedLinear", "concrete.quantization.QuantizedArray" ]
[((964, 1015), 'numpy.random.uniform', 'numpy.random.uniform', ([], {'size': '(n_examples, n_features)'}), '(size=(n_examples, n_features))\n', (984, 1015), False, 'import numpy\n'), ((1031, 1061), 'concrete.quantization.QuantizedArray', 'QuantizedArray', (['n_bits', 'inputs'], {}), '(n_bits, inputs)\n', (1045, 1061), ...
import numpy as np class Random(object): def __init__(self, min_range, max_range, distribution): self.__minRange = min_range self.__maxRange = max_range self.__distribution = distribution if self.__distribution == 'normal': interval = range(self.__minRange, self.__...
[ "numpy.random.uniform", "numpy.std", "numpy.rint", "numpy.mean", "numpy.random.normal" ]
[((358, 375), 'numpy.mean', 'np.mean', (['interval'], {}), '(interval)\n', (365, 375), True, 'import numpy as np\n'), ((401, 417), 'numpy.std', 'np.std', (['interval'], {}), '(interval)\n', (407, 417), True, 'import numpy as np\n'), ((1027, 1039), 'numpy.rint', 'np.rint', (['num'], {}), '(num)\n', (1034, 1039), True, '...
import gym import random import numpy as np import keras from statistics import mean, median from collections import Counter from keras.models import Model, Sequential, load_model from keras.layers import Input, Dense LR = 1e-3 env = gym.make('CartPole-v1') env.reset() def saveGoodGames(nr=10000): observations...
[ "numpy.load", "gym.make", "keras.layers.Dense", "numpy.array", "numpy.mean", "keras.models.Sequential" ]
[((237, 260), 'gym.make', 'gym.make', (['"""CartPole-v1"""'], {}), "('CartPole-v1')\n", (245, 260), False, 'import gym\n'), ((1058, 1080), 'numpy.array', 'np.array', (['observations'], {}), '(observations)\n', (1066, 1080), True, 'import numpy as np\n'), ((1095, 1112), 'numpy.array', 'np.array', (['actions'], {}), '(ac...
import json import numpy as np class NumpyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.ndarray): return obj.tolist() if isinstance(obj, np.integer): return int(obj) elif isinstance(obj, np.floating): return float(obj) ...
[ "numpy.array" ]
[((490, 507), 'numpy.array', 'np.array', (['*w'], {}), '(*w, **k)\n', (498, 507), True, 'import numpy as np\n')]
# The heat conduction test case is from Smith, "Uncertainty quantification: theory, implementation and applications", 2013. # In this test case, experimental data are provided. # We implement the experimental data here and save them in a csv file. # This script needs to be run when no data_heat_conduction_0.csv file...
[ "pandas.DataFrame", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.arange", "heat_conduction.HeatConduction" ]
[((578, 604), 'numpy.arange', 'np.arange', (['(10.0)', '(70.0)', '(4.0)'], {}), '(10.0, 70.0, 4.0)\n', (587, 604), True, 'import numpy as np\n'), ((617, 649), 'heat_conduction.HeatConduction', 'heat_conduction.HeatConduction', ([], {}), '()\n', (647, 649), False, 'import heat_conduction\n'), ((1035, 1087), 'pandas.Data...
import os import re import sys import numpy as np from constant import * import torch #wordVec=np.load(dataPath+"wordVec.npy") class Dataset: def __init__(self,Tag): print(Tag) self.words=np.load(Tag+"_wordEmb.npy") self.inMask=np.load(Tag+"_inMask.npy") self.label=np.load(Tag+"_lab...
[ "numpy.load", "numpy.zeros_like", "numpy.save", "torch.LongTensor", "torch.FloatTensor", "numpy.append", "numpy.max", "numpy.where" ]
[((209, 238), 'numpy.load', 'np.load', (["(Tag + '_wordEmb.npy')"], {}), "(Tag + '_wordEmb.npy')\n", (216, 238), True, 'import numpy as np\n'), ((257, 285), 'numpy.load', 'np.load', (["(Tag + '_inMask.npy')"], {}), "(Tag + '_inMask.npy')\n", (264, 285), True, 'import numpy as np\n'), ((303, 330), 'numpy.load', 'np.load...
import os import tensorflow as tf import numpy as np from tensorflow.contrib.rnn import LSTMCell from q_learning.q_network import MentorAgent, ExperienceBuffer, update_target_graph, perform_update, process_capture import gym import universe tf.reset_default_graph() env = gym.make('Pong-v0') # Network constants FILT...
[ "numpy.abs", "tensorflow.trainable_variables", "tensorflow.reset_default_graph", "numpy.random.randint", "numpy.mean", "q_learning.q_network.perform_update", "q_learning.q_network.process_capture", "os.path.exists", "q_learning.q_network.MentorAgent", "tensorflow.summary.FileWriter", "numpy.resh...
[((243, 267), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (265, 267), True, 'import tensorflow as tf\n'), ((275, 294), 'gym.make', 'gym.make', (['"""Pong-v0"""'], {}), "('Pong-v0')\n", (283, 294), False, 'import gym\n'), ((948, 1000), 'tensorflow.contrib.rnn.LSTMCell', 'LSTMCell', ([],...
import argparse from itertools import product import os.path as osp import numpy as np import pandas as pd import scipy.spatial import scipy.optimize import tqdm def x_3(array): return array ** 3 def module_x(array): return np.abs(array - 0.2) def sin(array): return array * np.sin(1 / array) def br...
[ "pandas.DataFrame", "numpy.random.uniform", "numpy.sum", "numpy.abs", "argparse.ArgumentParser", "numpy.random.seed", "numpy.asarray", "os.path.realpath", "numpy.argmin", "numpy.min", "numpy.sin", "numpy.arange", "numpy.random.normal", "itertools.product", "numpy.vstack", "numpy.sqrt" ...
[((237, 256), 'numpy.abs', 'np.abs', (['(array - 0.2)'], {}), '(array - 0.2)\n', (243, 256), True, 'import numpy as np\n'), ((379, 410), 'numpy.arange', 'np.arange', (['left', 'right', 'epsilon'], {}), '(left, right, epsilon)\n', (388, 410), True, 'import numpy as np\n'), ((450, 464), 'numpy.min', 'np.min', (['values']...
from kapteyn import maputils import numpy from service import * fignum = 20 fig = plt.figure(figsize=figsize) frame = fig.add_axes(plotbox) theta_a = 45 t1 = 20.0; t2 = 70.0 eta = abs(t1-t2)/2.0 title = r"""Conic perspective projection (COP) with: $\theta_a=45^\circ$, $\theta_1=20^\circ$ and $\theta_2=70^\circ$. (Cal....
[ "kapteyn.maputils.FITSimage", "numpy.arange" ]
[((665, 693), 'numpy.arange', 'numpy.arange', (['(0)', '(370.0)', '(30.0)'], {}), '(0, 370.0, 30.0)\n', (677, 693), False, 'import numpy\n'), ((718, 745), 'numpy.arange', 'numpy.arange', (['(-30)', '(90)', '(15.0)'], {}), '(-30, 90, 15.0)\n', (730, 745), False, 'import numpy\n'), ((779, 820), 'kapteyn.maputils.FITSimag...
# This program is for being able to measure model accuracy in the Kaggle Digit # Recognizer competition. This program only uses the training set, subsetting # part of the data to be used as a test set. This lets the user get instant # feedback as to the accuracy of the algorithm and more quickly tweak it for # improvem...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.get_cmap", "pandas.read_csv", "matplotlib.pyplot.axis", "sklearn.metrics.classification_report", "numpy.not_equal", "sklearn.decomposition.PCA", "sklearn.svm.SVC", "sklearn.metrics.confusion_matr...
[((1176, 1214), 'pandas.read_csv', 'pandas.read_csv', (['"""train.csv"""'], {'header': '(0)'}), "('train.csv', header=0)\n", (1191, 1214), False, 'import pandas\n'), ((2592, 2651), 'sklearn.decomposition.PCA', 'decomposition.PCA', ([], {'n_components': 'num_components', 'whiten': '(True)'}), '(n_components=num_componen...
import gym import tensorflow as tf from tensorflow.keras import layers import numpy as np import matplotlib.pyplot as plt import tensorflow_probability as tfp # inspired from https://github.com/lubiluk/ddpg from Lux_Project_Env import frozen_lake class DDPG: def __init__(self, config): self.state_dim =...
[ "tensorflow.keras.layers.Reshape", "tensorflow.keras.layers.Dense", "numpy.ones", "numpy.mean", "numpy.random.normal", "tensorflow.math.square", "tensorflow.random_uniform_initializer", "numpy.zeros_like", "tensorflow.keras.layers.Concatenate", "tensorflow_probability.distributions.Categorical", ...
[((9677, 9721), 'Lux_Project_Env.frozen_lake.FrozenLakeEnv', 'frozen_lake.FrozenLakeEnv', ([], {'is_slippery': '(False)'}), '(is_slippery=False)\n', (9702, 9721), False, 'from Lux_Project_Env import frozen_lake\n'), ((11278, 11303), 'matplotlib.pyplot.plot', 'plt.plot', (['avg_reward_list'], {}), '(avg_reward_list)\n',...
import itertools import os import subprocess import sys import typing import numpy as np from analysis import plot_constants, video_data, video_utils, video_analysis from analysis import video_analysis def gnuplot_write_arrays(stream: typing.TextIO=sys.stdout, *args: np.ndarray) -> None: ...
[ "analysis.video_utils.transit_point_with_error", "os.path.basename", "os.path.dirname", "analysis.video_utils.knots_to_m_p_s", "analysis.video_utils.transit_line_past_observer", "analysis.video_utils.intersect_two_lines", "analysis.video_analysis.observer_position_mean_std_from_full_transits", "numpy....
[((3887, 4124), 'analysis.video_analysis.observer_position_mean_std_from_aspects', 'video_analysis.observer_position_mean_std_from_aspects', ([], {'baseline': 'plot_constants.OBSERVER_XY_MINIMUM_BASELINE', 'ignore_first_n': 'plot_constants.OBSERVER_XY_IGNORE_N_FIRST_BEARINGS', 't_range': 'plot_constants.OBSERVER_XY_TIM...
# coding: utf-8 # In[1]: import os import datetime import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import statsmodels.api as sm import skimage from skimage import data, img_as_float import skimage.transform as trans import rasterio import fiona import cartopy ...
[ "numpy.arctan2", "cartopy.feature.NaturalEarthFeature", "matplotlib.pyplot.figure", "numpy.arange", "pyphenocam.headerextraction.get_exposure", "shapely.geometry.Polygon", "numpy.degrees", "matplotlib.pyplot.imshow", "IPython.display.display", "datetime.timedelta", "matplotlib.pyplot.subplots", ...
[((436, 461), 'sys.path.append', 'sys.path.append', (['"""..\\\\.."""'], {}), "('..\\\\..')\n", (451, 461), False, 'import sys\n'), ((484, 559), 'sys.path.append', 'sys.path.append', (['"""J:\\\\Projects\\\\NCCSC\\\\phenocam\\\\Tools\\\\DaymetPy\\\\daymetpy"""'], {}), "('J:\\\\Projects\\\\NCCSC\\\\phenocam\\\\Tools\\\\...
import gc import glob import math import numpy as np import os import pandas as pd import sys def file_is_empty(path): return os.path.exists(path) and os.stat(path).st_size == 0 # Opens a single capture file, filtering as needed def open_capture(capture_path, metric_name, unwanted_labels): print("[open_captur...
[ "math.pow", "os.stat", "os.path.exists", "pandas.read_json", "gc.collect", "math.log", "os.path.join", "numpy.gradient" ]
[((2622, 2639), 'math.pow', 'math.pow', (['(1024)', 'i'], {}), '(1024, i)\n', (2630, 2639), False, 'import math\n'), ((131, 151), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (145, 151), False, 'import os\n'), ((384, 439), 'pandas.read_json', 'pd.read_json', (['capture_path'], {'lines': '(True)', 'ch...
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt exf=pd.ExcelFile("f2m.xlsx") df=exf.parse('f2m_ratios') #print(df) df1=df.groupby(["Age","Year"],as_index=False).sum() #print(df1) dfu=df1.pivot("Age","Year","Ratio") dfu.reset_index() flat=pd.DataFrame(dfu.to_record...
[ "matplotlib.pyplot.title", "seaborn.heatmap", "matplotlib.pyplot.show", "pandas.ExcelFile", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((101, 125), 'pandas.ExcelFile', 'pd.ExcelFile', (['"""f2m.xlsx"""'], {}), "('f2m.xlsx')\n", (113, 125), True, 'import pandas as pd\n'), ((430, 456), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (440, 456), True, 'import matplotlib.pyplot as plt\n'), ((460, 547), 'seabor...
import time import datetime import gym import numpy as np import pandas as pd from scipy import stats, special from banditry.base import Seedable from banditry.experiment import ReplicationMetrics def register_env(env, num_arms, num_context, num_time_steps=1000, num_replications=100, version=0, see...
[ "scipy.stats.norm", "numpy.ndarray", "scipy.stats.truncnorm", "numpy.zeros", "gym.spaces.Discrete.__init__", "time.time", "numpy.random.RandomState", "scipy.special.expit", "banditry.base.Seedable.__init__", "gym.envs.registry.env_specs.pop", "gym.spaces.Box", "pandas.Series", "numpy.linspac...
[((448, 495), 'gym.envs.registry.env_specs.pop', 'gym.envs.registry.env_specs.pop', (['env_name', 'None'], {}), '(env_name, None)\n', (479, 495), False, 'import gym\n'), ((2309, 2456), 'banditry.experiment.ReplicationMetrics', 'ReplicationMetrics', (['self.env.initial_seed', 'self.env.num_time_steps', 'self.env.num_pre...
# Fix paths for imports to work in unit tests ---------------- if __name__ == "__main__": from _fix_paths import fix_paths fix_paths() # ------------------------------------------------------------ # Load libraries --------------------------------------------- from typing import Dict import numpy as np # ...
[ "_fix_paths.fix_paths", "numpy.round", "attribute.AttrSet" ]
[((133, 144), '_fix_paths.fix_paths', 'fix_paths', ([], {}), '()\n', (142, 144), False, 'from _fix_paths import fix_paths\n'), ((5730, 5760), 'attribute.AttrSet', 'attribute.AttrSet', (['names', 'vals'], {}), '(names, vals)\n', (5747, 5760), False, 'import attribute\n'), ((1415, 1429), 'numpy.round', 'np.round', (['v',...
from unittest import SkipTest import chainer import numpy as np from test.util import generate_kernel_test_case, wrap_template from webdnn.graph.placeholder import Placeholder from webdnn.frontend.chainer.converter import ChainerConverter from webdnn.frontend.chainer.placeholder_variable import PlaceholderVariable ...
[ "test.util.generate_kernel_test_case", "webdnn.frontend.chainer.placeholder_variable.PlaceholderVariable", "chainer.functions.average_pooling_2d", "unittest.SkipTest", "numpy.random.rand", "webdnn.frontend.chainer.converter.ChainerConverter", "webdnn.graph.placeholder.Placeholder" ]
[((623, 700), 'chainer.functions.average_pooling_2d', 'chainer.functions.average_pooling_2d', (['vx'], {'ksize': 'ksize', 'stride': 'stride', 'pad': 'pad'}), '(vx, ksize=ksize, stride=stride, pad=pad)\n', (659, 700), False, 'import chainer\n'), ((943, 1095), 'test.util.generate_kernel_test_case', 'generate_kernel_test_...
import numpy as np import fractions as f from scipy.linalg import circulant import matplotlib.pyplot as plt from scipy import signal import random import time x3 = 100*signal.triang(8) x3 = np.tile(x3, 16*11*10) x3_1 = x3 - np.mean(x3) x1 = 80*signal.cosine(11) x1 = np.tile(x1, 8*16*10) x1_1 = x1 - np.mean(x1) x2 = 70...
[ "scipy.signal.triang", "matplotlib.pyplot.show", "time.time", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.tile", "numpy.linalg.svd", "numpy.random.rand", "scipy.signal.cosine" ]
[((191, 216), 'numpy.tile', 'np.tile', (['x3', '(16 * 11 * 10)'], {}), '(x3, 16 * 11 * 10)\n', (198, 216), True, 'import numpy as np\n'), ((268, 292), 'numpy.tile', 'np.tile', (['x1', '(8 * 16 * 10)'], {}), '(x1, 8 * 16 * 10)\n', (275, 292), True, 'import numpy as np\n'), ((344, 368), 'numpy.tile', 'np.tile', (['x2', '...
import tensorflow as tf from networks import model, losses from data_loader.dataset_read import get_image, batch_images from nets import nets_factory from preprocessing import preprocessing_factory import os import cv2 import numpy as np slim = tf.contrib.slim class StyleTransfer: def __init__(self, FLAGS): ...
[ "tensorflow.gfile.Exists", "tensorflow.train.Coordinator", "nets.nets_factory.get_network_fn", "tensorflow.trainable_variables", "tensorflow.identity", "tensorflow.logging.info", "tensorflow.logging.set_verbosity", "tensorflow.global_variables", "tensorflow.train.latest_checkpoint", "networks.loss...
[((360, 370), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (368, 370), True, 'import tensorflow as tf\n'), ((647, 668), 'tensorflow.global_variables', 'tf.global_variables', ([], {}), '()\n', (666, 668), True, 'import tensorflow as tf\n'), ((865, 895), 'tensorflow.train.Saver', 'tf.train.Saver', (['save_variables'...
import numpy as np class ReplayBuffer: def __init__(self, size, miniBatchSize): self.buffer = [] self.miniBatchSize = miniBatchSize self.maxSize = size # append new state, remove oldest if full def append(self, state, action, reward, terminal, nState): if len(self.buffer) ...
[ "numpy.random.RandomState" ]
[((503, 526), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (524, 526), True, 'import numpy as np\n')]
import numpy as np def load_dataset(): """ (function) load_dataset ----------------------- Load test dataset Parameter --------- - None Return ------ - dataset """ # Create test dataset post_list = [['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ...
[ "numpy.log", "numpy.ones" ]
[((2078, 2096), 'numpy.ones', 'np.ones', (['num_words'], {}), '(num_words)\n', (2085, 2096), True, 'import numpy as np\n'), ((2098, 2116), 'numpy.ones', 'np.ones', (['num_words'], {}), '(num_words)\n', (2105, 2116), True, 'import numpy as np\n'), ((2445, 2470), 'numpy.log', 'np.log', (['(p0_num / p0_denom)'], {}), '(p0...
"""Plot figure 6: attack rates vs R0.""" import numpy as np import pandas as pd from scipy.stats import linregress import matplotlib as mplt import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cm import matplotlib.font_manager as font_manager import cmocean import cmasher import...
[ "numpy.linalg.eigvals", "os.path.abspath", "pandas.read_csv", "matplotlib.pyplot.subplots", "matplotlib.pyplot.minorticks_off", "numpy.arange", "numpy.loadtxt", "scipy.stats.linregress", "os.path.split", "os.path.join" ]
[((628, 647), 'os.path.abspath', 'os.path.abspath', (['""""""'], {}), "('')\n", (643, 647), False, 'import os\n'), ((1013, 1049), 'os.path.join', 'os.path.join', (['analysisdir', '"""figures"""'], {}), "(analysisdir, 'figures')\n", (1025, 1049), False, 'import os\n'), ((1067, 1122), 'os.path.join', 'os.path.join', (['a...
import numpy as np import pandas as pd from keras.layers import Dense from keras.models import Sequential from keras.optimizers import Adam import pickle import matplotlib.pyplot as plt import lime import lime.lime_tabular from lime.lime_tabular import LimeTabularExplainer # fix random seed for reproducibility np.ran...
[ "matplotlib.pyplot.title", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "keras.optimizers.Adam", "keras.layers.Dense", "numpy.array", "keras.models.Sequential", "matplotlib.pyplot.xlabel", ...
[((314, 331), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (328, 331), True, 'import numpy as np\n'), ((353, 398), 'pandas.read_csv', 'pd.read_csv', (['"""covid_filtered_1-5_allMin5.csv"""'], {}), "('covid_filtered_1-5_allMin5.csv')\n", (364, 398), True, 'import pandas as pd\n'), ((1067, 1086), 'panda...
import numpy as np from numpy.random import choice from gerel.genome.factories import copy from random import random from gerel.mutators.mutator import Mutator from gerel.algorithms.NEAT.functions import curry_weight_mutator, curry_crossover, add_node, add_edge class NEATMutator(Mutator): def __init__( ...
[ "numpy.random.uniform", "gerel.algorithms.NEAT.functions.curry_weight_mutator", "gerel.genome.factories.copy", "gerel.algorithms.NEAT.functions.curry_crossover", "random.random", "numpy.random.choice", "gerel.algorithms.NEAT.functions.add_edge", "gerel.algorithms.NEAT.functions.add_node" ]
[((2416, 2610), 'gerel.algorithms.NEAT.functions.curry_weight_mutator', 'curry_weight_mutator', (['weight_mutation_likelihood', 'weight_mutation_rate_random', 'weight_mutation_variance', 'weight_mutation_rate_uniform'], {'weight_low': 'weight_low', 'weight_high': 'weight_high'}), '(weight_mutation_likelihood,\n weig...
#!/usr/bin/env python # FizzPyX - FizzPyXPlot # Copyright (C) 2017 <NAME> # GNU GPLv3 from __future__ import division from matplotlib.pyplot import figure, plot, title, xlabel, ylabel, xlim, ylim, savefig from numpy import argsort, abs, mean, arange, argmax from numpy.fft import fft, rfft, fftfreq # from Numpy_Neuron...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "RawNumpyNeurons.FizzPyX.solutionGenerator", "RawNumpyNeurons.FizzPyX.FitzhughNagumoGen", "numpy.abs", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.argmax", "numpy.fft.fft", "numpy.fft.rfft", "numpy.argsort", "matplotlib.pyplot...
[((570, 610), 'RawNumpyNeurons.FizzPyX.solutionGenerator', 'solutionGenerator', (['modelname', 'solvername'], {}), '(modelname, solvername)\n', (587, 610), False, 'from RawNumpyNeurons.FizzPyX import solutionGenerator, CoupledOscillatorsGen, FitzhughNagumoGen\n'), ((750, 758), 'matplotlib.pyplot.figure', 'figure', ([],...
import numpy as np import matplotlib.pyplot as plt # Simulations for the evolution of parasitic viral strains # Author: <NAME> # System to be visualized numerically # Inspired from "The Equations of Life" (<NAME>) # S is the host susceptible population # I1, I2 are the strain 1 or strain 2 infected # R is the "remove...
[ "numpy.zeros", "numpy.arange", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((562, 586), 'numpy.arange', 'np.arange', (['(1)', 'span', 'step'], {}), '(1, span, step)\n', (571, 586), True, 'import numpy as np\n'), ((1633, 1644), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1641, 1644), True, 'import numpy as np\n'), ((1654, 1665), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1662, 16...
# -*- coding: utf-8 -*- import os import struct import numpy as np import matplotlib.pyplot as plt def load_mnist(path, kind='train'): """load_mnist Load MNIST data from path and save as numpy.ndarray(label, data...) Args: path (filepath): where the dataset file is kind (string): "%s" mea...
[ "matplotlib.pyplot.show", "os.path.join", "numpy.fromfile", "matplotlib.pyplot.subplots", "matplotlib.pyplot.tight_layout" ]
[((368, 417), 'os.path.join', 'os.path.join', (['path', "('%s-labels.idx1-ubyte' % kind)"], {}), "(path, '%s-labels.idx1-ubyte' % kind)\n", (380, 417), False, 'import os\n'), ((436, 485), 'os.path.join', 'os.path.join', (['path', "('%s-images.idx3-ubyte' % kind)"], {}), "(path, '%s-images.idx3-ubyte' % kind)\n", (448, ...
from kivy.app import App import numpy as np from kivyplot import Plot2D class MainApp(App): def build(self): N = 20 points = [np.array([ i, np.sin(2*np.pi*i/(N-1) + np.pi/2)]) for i in range(N)] self.root = Plot2D(xmin=0, xmax=N, stepx=1) self....
[ "numpy.sin", "kivyplot.Plot2D" ]
[((275, 306), 'kivyplot.Plot2D', 'Plot2D', ([], {'xmin': '(0)', 'xmax': 'N', 'stepx': '(1)'}), '(xmin=0, xmax=N, stepx=1)\n', (281, 306), False, 'from kivyplot import Plot2D\n'), ((187, 230), 'numpy.sin', 'np.sin', (['(2 * np.pi * i / (N - 1) + np.pi / 2)'], {}), '(2 * np.pi * i / (N - 1) + np.pi / 2)\n', (193, 230), T...
import trimesh import numpy as np import os from . import backend def encode_mesh(mesh, compression_level): """ Encodes a quantized mesh into Neuroglancer-compatible Draco format Parameters ---------- mesh : trimesh.base.Trimesh A Trimesh mesh object to encode compression_level : int ...
[ "numpy.asarray" ]
[((1766, 1803), 'numpy.asarray', 'np.asarray', (['vertices'], {'dtype': 'np.uint32'}), '(vertices, dtype=np.uint32)\n', (1776, 1803), True, 'import numpy as np\n'), ((1831, 1865), 'numpy.asarray', 'np.asarray', (['faces'], {'dtype': 'np.uint32'}), '(faces, dtype=np.uint32)\n', (1841, 1865), True, 'import numpy as np\n'...
import sys sys.path.append(".") import numpy as np import pygsp as gsp import sgw_tools as sgw import matplotlib.pyplot as plt G = gsp.graphs.Comet(20, 11) G.estimate_lmax() g = gsp.filters.Heat(G) data = sgw.kernelCentrality(G, g) nodes = np.arange(G.N) ranking = sorted(nodes, key=lambda v: data[v][0]) sgw.plotGr...
[ "sys.path.append", "matplotlib.pyplot.show", "pygsp.filters.Heat", "sgw_tools.kernelCentrality", "numpy.arange", "pygsp.graphs.Comet", "sgw_tools.plotGraph" ]
[((11, 31), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (26, 31), False, 'import sys\n'), ((133, 157), 'pygsp.graphs.Comet', 'gsp.graphs.Comet', (['(20)', '(11)'], {}), '(20, 11)\n', (149, 157), True, 'import pygsp as gsp\n'), ((181, 200), 'pygsp.filters.Heat', 'gsp.filters.Heat', (['G'], {}), '...
import warnings import numpy as np import scipy.integrate import scipy.special import matplotlib.streamplot import bokeh.application import bokeh.application.handlers import bokeh.layouts import bokeh.models import bokeh.palettes import bokeh.plotting import colorcet from .jsfunctions import jsfuns def _sin_plot...
[ "numpy.maximum", "numpy.empty_like", "numpy.sin", "numpy.array", "numpy.exp", "numpy.linspace", "numpy.log10", "numpy.sqrt" ]
[((367, 397), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(200)'], {}), '(0, 2 * np.pi, 200)\n', (378, 397), True, 'import numpy as np\n'), ((406, 415), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (412, 415), True, 'import numpy as np\n'), ((5781, 5804), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', ...
import warnings import csv import numpy as np import pandas as pd import torch from genetic_algorithm import GeneticAlgorithm as ga from genetic_algorithm import cross_entropy_one_hot from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.preprocessing import OneHotEnc...
[ "pandas.DataFrame", "sklearn.datasets.load_iris", "numpy.random.seed", "csv.writer", "warnings.filterwarnings", "genetic_algorithm.GeneticAlgorithm", "torch.manual_seed", "sklearn.model_selection.train_test_split", "sklearn.preprocessing.OneHotEncoder", "torch.device", "torch.tensor" ]
[((388, 421), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (411, 421), False, 'import warnings\n'), ((431, 450), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (443, 450), False, 'import torch\n'), ((3488, 3499), 'sklearn.datasets.load_iris', 'load_iri...
import numpy as np import pandas as pd import sqlite3 from sklearn.linear_model import LogisticRegression from sklearn.linear_model import LogisticRegressionCV from sklearn.preprocessing import StandardScaler from sklearn.model_selection import GridSearchCV from pickle import dump #################### # uncomment th...
[ "sklearn.preprocessing.StandardScaler", "pandas.read_csv", "pandas.get_dummies", "numpy.isfinite", "pandas.read_excel", "sklearn.linear_model.LogisticRegressionCV", "sklearn.linear_model.LogisticRegression", "numpy.where", "numpy.array", "pandas.Series", "numpy.linspace", "pandas.qcut", "pan...
[((585, 633), 'pandas.read_csv', 'pd.read_csv', (['"""joined_data.csv"""'], {'low_memory': '(False)'}), "('joined_data.csv', low_memory=False)\n", (596, 633), True, 'import pandas as pd\n'), ((1268, 1321), 'pandas.read_excel', 'pd.read_excel', (['"""tu_exp_fields.xlsx"""'], {'sheet_name': '"""EXP"""'}), "('tu_exp_field...
# - <NAME> <<EMAIL>> """Flask app for annotating ROIs.""" import os import json from glob import glob import flask import numpy as np from . import utils as ut APP = flask.Flask("plseg-roi") @APP.route("/", methods=["GET"]) def index(): """Return html file.""" return flask.send_file(APP.ldir+"/cset.html", ...
[ "os.mkdir", "json.load", "json.loads", "os.path.isdir", "numpy.asarray", "flask.Flask", "flask.json.jsonify", "json.dumps", "os.path.isfile", "flask.request.get_data", "glob.glob", "flask.send_file" ]
[((169, 193), 'flask.Flask', 'flask.Flask', (['"""plseg-roi"""'], {}), "('plseg-roi')\n", (180, 193), False, 'import flask\n'), ((281, 338), 'flask.send_file', 'flask.send_file', (["(APP.ldir + '/cset.html')"], {'cache_timeout': '(0)'}), "(APP.ldir + '/cset.html', cache_timeout=0)\n", (296, 338), False, 'import flask\n...
""" Title: example_processing.py Author: <NAME> and <NAME> Creation Date: 20170220 Last Modified: 20170220 Purpose: This script serves as a representative example of our data processing pipeline. This script reads in a set of csv files containing the output from the MACSQuant Flow Cytomter (...
[ "pandas.DataFrame", "os.listdir", "mwc_induction_utils.auto_gauss_gate", "pandas.read_csv", "numpy.append", "numpy.array", "pandas.Series", "pandas.concat" ]
[((1203, 1292), 'numpy.array', 'np.array', (["['auto', 'delta', 'RBS1L', 'RBS1', 'RBS1027', 'RBS446', 'RBS1147', 'HG104']"], {}), "(['auto', 'delta', 'RBS1L', 'RBS1', 'RBS1027', 'RBS446', 'RBS1147',\n 'HG104'])\n", (1211, 1292), True, 'import numpy as np\n'), ((1334, 1377), 'numpy.array', 'np.array', (['[0, 0, 870, ...
# coding: utf-8 import tr import sys, cv2, time, os from PIL import Image, ImageDraw, ImageFont import numpy import csv import getVerticalBorder _BASEDIR = os.path.dirname(os.path.abspath(__file__)) os.chdir(_BASEDIR) def get_table(ocr_results, row_x): ''' 对ocr的结果进行整理,根据结果中的位置信息整理出表格 :param ...
[ "os.path.abspath", "getVerticalBorder.get_row_x", "numpy.asarray", "tr.run", "PIL.Image.open", "os.chdir" ]
[((209, 227), 'os.chdir', 'os.chdir', (['_BASEDIR'], {}), '(_BASEDIR)\n', (217, 227), False, 'import sys, cv2, time, os\n'), ((181, 206), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (196, 206), False, 'import sys, cv2, time, os\n'), ((1935, 1955), 'PIL.Image.open', 'Image.open', (['img_pat...
"""Train script for dagger learning. Currently uses SimpleAgent as the expert. The training is performed on one processor, but evaluation is run on multiple processors TODO: make code less redundant if not using the value loss it will store and do many unnecessary operations Example args: python train_dagger.py --num-p...
[ "random.shuffle", "numpy.mean", "envs.get_env_info", "os.path.join", "utils.load_agents", "utils.get_train_vars", "os.path.exists", "torch.FloatTensor", "arguments.get_args", "utils.validate_how_train", "torch.zeros", "utils.torch_numpy_stack", "torch.manual_seed", "torch.autograd.Variable...
[((1106, 1116), 'arguments.get_args', 'get_args', ([], {}), '()\n', (1114, 1116), False, 'from arguments import get_args\n'), ((1313, 1343), 'utils.validate_how_train', 'utils.validate_how_train', (['args'], {}), '(args)\n', (1337, 1343), False, 'import utils\n'), ((1493, 1545), 'utils.get_train_vars', 'utils.get_train...
import os import argparse import matplotlib import matplotlib.pyplot as plt import numpy as onp import jax.numpy as np import jax.random as random from jax import vmap from jax.config import config as jax_config import numpyro.distributions as dist from numpyro.handlers import seed, substitute, trace from numpyro.hmc_...
[ "jax.config.config.update", "os.mkdir", "jax.random.split", "os.stat", "matplotlib.pyplot.clf", "matplotlib.pyplot.close", "matplotlib.pyplot.setp", "jax.device_get", "numpy.percentile", "jax.random.PRNGKey", "matplotlib.pyplot.cla", "numpy.arange", "numpyro.diagnostics.effective_sample_size...
[((915, 969), 'jax.config.config.update', 'jax_config.update', (['"""jax_platform_name"""', "args['device']"], {}), "('jax_platform_name', args['device'])\n", (932, 969), True, 'from jax.config import config as jax_config\n'), ((1147, 1160), 'sklearn.utils.shuffle', 'shuffle', (['X', 'Y'], {}), '(X, Y)\n', (1154, 1160)...
# Andrei, 2018 """ Collect data. """ from argparse import ArgumentParser import numpy as np import cv2 import os import time from utils import read_cfg from get_camera import VideoLoad from get_obd import OBDLoader import matplotlib.pyplot as plt from can_utils import validate_data as validate_can_data from can_u...
[ "can_utils.CanPlot", "argparse.ArgumentParser", "phone_data_utils.validate_data", "matplotlib.pyplot.clf", "cv2.waitKey", "get_obd.OBDLoader", "can_utils.validate_data", "phone_data_utils.PhonePlot", "numpy.zeros", "matplotlib.pyplot.show", "time.time", "matplotlib.pyplot.ion", "matplotlib.p...
[((612, 628), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (626, 628), False, 'from argparse import ArgumentParser\n'), ((984, 1023), 'os.path.join', 'os.path.join', (['experiment_path', 'CFG_FILE'], {}), '(experiment_path, CFG_FILE)\n', (996, 1023), False, 'import os\n'), ((1050, 1095), 'os.path.join...
import logging import os from pathlib import Path from pickle import load from typing import Callable, List import numpy as np import pandas as pd import tensorflow as tf from dotenv import load_dotenv from tensorflow import keras from tensorflow.keras import backend as K from tensorflow.keras.callbacks import CSVLogg...
[ "numpy.moveaxis", "pandas.read_csv", "tensorflow.reshape", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.callbacks.CSVLogger", "pathlib.Path", "pickle.load", "tensorflow.keras.metrics.MeanAbsoluteError", "numpy.round", "pandas.DataFrame", "os.path.exists", "tensorflow.cast", ...
[((494, 527), 'dotenv.load_dotenv', 'load_dotenv', ([], {'dotenv_path': 'env_path'}), '(dotenv_path=env_path)\n', (505, 527), False, 'from dotenv import load_dotenv\n'), ((475, 484), 'pathlib.Path', 'Path', (['"""."""'], {}), "('.')\n", (479, 484), False, 'from pathlib import Path\n'), ((1518, 1534), 'tensorflow.shape'...
# %% import csv import numpy as np import time import gurobipy as gp from gurobipy import GRB # %% class MCF: def __init__(self, dowFile): self.nunNodes = 0 self.numArcs = 0 self.numComm = 0 self.numScen = 0 self.arcOD = {} self.arcV = {} self.arcCap = {} ...
[ "csv.reader", "numpy.sum", "numpy.zeros", "gurobipy.Model", "time.time", "numpy.arange", "gurobipy.quicksum", "numpy.unique" ]
[((2276, 2287), 'time.time', 'time.time', ([], {}), '()\n', (2285, 2287), False, 'import time\n'), ((2300, 2320), 'gurobipy.Model', 'gp.Model', (['"""DetEquiv"""'], {}), "('DetEquiv')\n", (2308, 2320), True, 'import gurobipy as gp\n'), ((4556, 4581), 'gurobipy.Model', 'gp.Model', (['"""MasterProblem"""'], {}), "('Maste...
# -*- coding: utf-8 -*- # # Copyright 2020 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 applicable law o...
[ "numpy.empty", "numpy.zeros", "pytest.raises", "numpy.array", "numpy.random.rand", "stellargraph.IndexedArray" ]
[((718, 732), 'stellargraph.IndexedArray', 'IndexedArray', ([], {}), '()\n', (730, 732), False, 'from stellargraph import IndexedArray\n'), ((919, 940), 'numpy.array', 'np.array', (['[10, -1, 2]'], {}), '([10, -1, 2])\n', (927, 940), True, 'import numpy as np\n'), ((991, 1014), 'numpy.random.rand', 'np.random.rand', ([...
#! /usr/bin/python3 import numpy as np import matplotlib.pyplot as plt from nephelae.database import NephelaeDataServer from nephelae_utils.analysis import TimedData, estimate_wind # This is an example showing how to estimate the advective wind (average (x,y) # wind) from the data of an aircraft flight. # First loa...
[ "nephelae.database.NephelaeDataServer.load", "nephelae_utils.analysis.estimate_wind", "matplotlib.pyplot.show", "numpy.array", "matplotlib.pyplot.subplots" ]
[((481, 518), 'nephelae.database.NephelaeDataServer.load', 'NephelaeDataServer.load', (['databasePath'], {}), '(databasePath)\n', (504, 518), False, 'from nephelae.database import NephelaeDataServer\n'), ((1241, 1330), 'numpy.array', 'np.array', (['[[s.position.t, s.position.x, s.position.y, s.position.z] for s in stat...
from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import os import time import tensorflow as tf from tensorflow import keras import random class dataset(object): def __init__(self, train_data=None, train_labels=None, test_data=None, test_labels=None): ...
[ "numpy.asarray", "random.randint" ]
[((387, 409), 'numpy.asarray', 'np.asarray', (['train_data'], {}), '(train_data)\n', (397, 409), True, 'import numpy as np\n'), ((660, 684), 'numpy.asarray', 'np.asarray', (['train_labels'], {}), '(train_labels)\n', (670, 684), True, 'import numpy as np\n'), ((803, 824), 'numpy.asarray', 'np.asarray', (['test_data'], {...
#!/usr/bin/env python import numpy as N from load import ROOT as R from gna import constructors as C from gna.env import env from gna.unittest import * import numpy as N def polyratio_prepare(nsname, nominator, denominator): inp = N.arange(1, 11, dtype='d') x = C.Points(inp) ns = env.globalns(nsname) ...
[ "numpy.allclose", "gna.constructors.Points", "gna.env.env.globalns", "numpy.arange", "gna.constructors.PolyRatio" ]
[((237, 263), 'numpy.arange', 'N.arange', (['(1)', '(11)'], {'dtype': '"""d"""'}), "(1, 11, dtype='d')\n", (245, 263), True, 'import numpy as N\n'), ((272, 285), 'gna.constructors.Points', 'C.Points', (['inp'], {}), '(inp)\n', (280, 285), True, 'from gna import constructors as C\n'), ((295, 315), 'gna.env.env.globalns'...
''' MIT License Copyright (c) 2022 <NAME> 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, distribu...
[ "matplotlib.pyplot.title", "numpy.load", "numpy.nansum", "matplotlib.pyplot.show", "argparse.ArgumentParser", "numpy.sum", "numpy.isreal", "matplotlib.pyplot.bar", "matplotlib.pyplot.legend", "numpy.isnan", "numpy.arange", "matplotlib.pyplot.gca", "datasets.build_predicates", "matplotlib.p...
[((2381, 2425), 'matplotlib.pyplot.xticks', 'plt.xticks', (['x', 'keys'], {'rotation': '(0)', 'fontsize': '(20)'}), '(x, keys, rotation=0, fontsize=20)\n', (2391, 2425), True, 'import matplotlib.pyplot as plt\n'), ((2506, 2537), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['ylabel'], {'fontsize': '(18)'}), '(ylabel, fon...
from keras.engine.training import Model from keras.engine.topology import merge import numpy as np import keras.backend as K from contextlib import contextmanager import keras.callbacks as cbks TODO = "todo" @contextmanager def trainable(model, trainable): trainables = [] for layer in model.layers: ...
[ "numpy.random.uniform", "keras.engine.topology.merge", "numpy.zeros_like", "keras.callbacks.History", "keras.callbacks.BaseLogger", "numpy.argmax", "keras.callbacks.CallbackList", "numpy.zeros", "numpy.ones", "keras.engine.training.Model", "keras.callbacks.ProgbarLogger", "numpy.concatenate" ]
[((525, 549), 'numpy.argmax', 'np.argmax', (['prob'], {'axis': '(-1)'}), '(prob, axis=-1)\n', (534, 549), True, 'import numpy as np\n'), ((561, 580), 'numpy.zeros_like', 'np.zeros_like', (['prob'], {}), '(prob)\n', (574, 580), True, 'import numpy as np\n'), ((1472, 1503), 'numpy.random.uniform', 'np.random.uniform', ([...
import geopandas as gpd gpd.options.use_pygeos=False import pandas as pd import os, json, geojson import glob import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np from geopandas.plotting import plot_polygon_collection root = os.getcwd() ne = gpd.read_file(os.path.join(root,'data','ne_10m_count...
[ "numpy.stack", "matplotlib.pyplot.show", "os.path.join", "os.getcwd", "numpy.ones", "numpy.isnan", "numpy.clip", "numpy.array", "numpy.linspace", "numpy.log10", "matplotlib.pyplot.subplots" ]
[((250, 261), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (259, 261), False, 'import os, json, geojson\n'), ((2363, 2387), 'numpy.log10', 'np.log10', (["ne['N_obs_S2']"], {}), "(ne['N_obs_S2'])\n", (2371, 2387), True, 'import numpy as np\n'), ((2411, 2437), 'numpy.log10', 'np.log10', (["ne['N_obs_SPOT']"], {}), "(ne['N...
""" * * Copyright (c) 2021 <NAME> * 2021 Autonomous Systems Lab ETH Zurich * 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 retain ...
[ "pandas.DataFrame", "numpy.ones", "numpy.arange", "numpy.array", "numpy.interp", "pandas.concat", "numpy.vstack" ]
[((2910, 2924), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2922, 2924), True, 'import pandas as pd\n'), ((3977, 3991), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (3989, 3991), True, 'import pandas as pd\n'), ((4009, 4041), 'numpy.arange', 'np.arange', (['t_start', 't_end', 'T_des'], {}), '(t_star...
import tensorflow as tf import matplotlib.pyplot as plt import numpy as np from tensorflow.keras.preprocessing.image import ImageDataGenerator def generate_iterator(path, augmentation = True, color_mode = 'rgb', batch_size = 32, shuffle = True, target_size = (128, 128), see...
[ "matplotlib.pyplot.subplot", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "numpy.argmax", "matplotlib.pyplot.imshow", "matplotlib.pyplot.axis", "numpy.max", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout" ]
[((2968, 2994), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (2978, 2994), True, 'import matplotlib.pyplot as plt\n'), ((3437, 3455), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (3453, 3455), True, 'import matplotlib.pyplot as plt\n'), ((1639, ...
#!/usr/bin/env python """ <NAME> May 2020 path planner """ import rospy from geometry_msgs.msg import PoseStamped from geometry_msgs.msg import Pose from geometry_msgs.msg import Point from std_msgs.msg import Int8 from nav_msgs.msg import Path from visualization_msgs.msg import Marker, MarkerArray import uav_motion.ms...
[ "yaml.load", "rospy.Subscriber", "numpy.arctan2", "actionlib.SimpleActionClient", "rospy.ServiceProxy", "open3d.geometry.PointCloud", "numpy.sin", "numpy.linalg.norm", "utils.open3d_ros_conversion.convertCloudFromRosToOpen3d", "os.path.join", "geometry_msgs.msg.PoseStamped", "sensor_msgs.msg.P...
[((932, 948), 'rospkg.RosPack', 'rospkg.RosPack', ([], {}), '()\n', (946, 948), False, 'import rospkg\n'), ((1004, 1059), 'os.path.join', 'os.path.join', (['pkg_path', '"""config"""', '"""target_mapping.yaml"""'], {}), "(pkg_path, 'config', 'target_mapping.yaml')\n", (1016, 1059), False, 'import os\n'), ((1099, 1143), ...
import time, pyaudio, wave, sys, serial import numpy as np from base64 import b16encode from pyfirmata import Arduino, util arduino = serial.Serial('/dev/cu.usbmodem1411', 9600) # import portaudio CHUNK = 2**12 ## used to be 11 before I changed it; if it fucks up it is most definitely because i change the chunk size ...
[ "serial.Serial", "numpy.abs", "numpy.fft.fft", "numpy.fft.fftfreq", "numpy.sin", "numpy.max", "pyaudio.PyAudio" ]
[((135, 178), 'serial.Serial', 'serial.Serial', (['"""/dev/cu.usbmodem1411"""', '(9600)'], {}), "('/dev/cu.usbmodem1411', 9600)\n", (148, 178), False, 'import time, pyaudio, wave, sys, serial\n'), ((566, 583), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (581, 583), False, 'import time, pyaudio, wave, sys, s...
import logging import numpy as np from sklearn.decomposition import NMF as NMFSklearn from sklearn.preprocessing import normalize from scipy.sparse.linalg import eigs, LinearOperator from config import num_tokens from util import load_json, save_json from tools.tokenizer_w2v import W2VTokenizer from tools.vocab import...
[ "numpy.maximum", "numpy.sum", "numpy.invert", "numpy.argmax", "numpy.abs", "tools.tokenizer_w2v.W2VTokenizer", "numpy.argsort", "numpy.full", "numpy.real", "base.topic.TopicFrame", "sklearn.decomposition.NMF", "numpy.square", "util.load_json", "tools.vocab.Vocab", "sklearn.preprocessing....
[((524, 538), 'tools.tokenizer_w2v.W2VTokenizer', 'W2VTokenizer', ([], {}), '()\n', (536, 538), False, 'from tools.tokenizer_w2v import W2VTokenizer\n'), ((560, 567), 'tools.vocab.Vocab', 'Vocab', ([], {}), '()\n', (565, 567), False, 'from tools.vocab import Vocab\n'), ((588, 627), 'util.load_json', 'load_json', (['"""...
""" """ # Use relative imports when importing objects from elsewhere in the library from ..scale import scale01 import numpy as np test_input_cosmological_params = np.array([0.14, 0.967, 0.8, -5.0, 1.0]) def test_scale01(): res = scale01(test_input_cosmological_params) assert res.shape == test_input_cosm...
[ "numpy.array" ]
[((165, 204), 'numpy.array', 'np.array', (['[0.14, 0.967, 0.8, -5.0, 1.0]'], {}), '([0.14, 0.967, 0.8, -5.0, 1.0])\n', (173, 204), True, 'import numpy as np\n')]
import numpy import re import time from tqdm import tqdm import random from recombee_api_client.api_client import RecombeeClient from recombee_api_client.api_requests import ( AddDetailView, RecommendItemsToUser, Batch, AddRating, ResetDatabase, AddUserProperty, AddItemProperty, SetItemValues) from recombee_ap...
[ "tqdm.tqdm", "xminds.compat.logger.info", "xminds.ds.scaling.linearscaling", "recombee_api_client.api_requests.RecommendItemsToUser", "random.choice", "recombee_api_client.api_client.RecombeeClient", "xminds.lib.utils.retry", "time.time", "time.sleep", "recombee_api_client.api_requests.ResetDataba...
[((6197, 6240), 'xminds.lib.utils.retry', 'retry', ([], {'base': '(10)', 'multiplier': '(1.2)', 'max_retry': '(2)'}), '(base=10, multiplier=1.2, max_retry=2)\n', (6202, 6240), False, 'from xminds.lib.utils import retry\n'), ((7886, 7929), 'xminds.lib.utils.retry', 'retry', ([], {'base': '(10)', 'multiplier': '(1.1)', '...
import gym import copy import random import numpy as np import matplotlib.pyplot as plt class Node: def __init__(self, parent=None, action=None): self.parent = parent # parent of this node self.action = action # action leading from parent to this node self.children = [] self.sum_...
[ "copy.deepcopy", "matplotlib.pyplot.show", "gym.make", "random.uniform", "numpy.argmax", "random.choice", "numpy.mean" ]
[((2551, 2561), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2559, 2561), True, 'import matplotlib.pyplot as plt\n'), ((2585, 2604), 'gym.make', 'gym.make', (['"""Taxi-v3"""'], {}), "('Taxi-v3')\n", (2593, 2604), False, 'import gym\n'), ((1085, 1103), 'copy.deepcopy', 'copy.deepcopy', (['env'], {}), '(env)\...
''' This script uses a high SNR pixel from a pre-processed histogram image and extracts the IRF of that scene The data collected by this setup has a bi-modal IRF due to lens inter-reflections which explains the two peaks. NOTE: This script may not work well with data acquired in synchronous mode that has p...
[ "matplotlib.pyplot.title", "numpy.load", "matplotlib.pyplot.clf", "numpy.arange", "research_utils.io_ops.load_json", "bimodal2unimodal_hist_img.bimodal2unimodal_crop", "os.path.join", "sys.path.append", "matplotlib.pyplot.imshow", "scipy.ndimage.gaussian_filter", "os.path.exists", "matplotlib....
[((545, 573), 'sys.path.append', 'sys.path.append', (['"""./tof-lib"""'], {}), "('./tof-lib')\n", (560, 573), False, 'import sys\n'), ((1178, 1207), 'research_utils.io_ops.load_json', 'load_json', (['"""scan_params.json"""'], {}), "('scan_params.json')\n", (1187, 1207), False, 'from research_utils.io_ops import load_js...
""" test iotools for PSM3 """ import os from pvlib.iotools import psm3 from conftest import DATA_DIR, RERUNS, RERUNS_DELAY import numpy as np import pandas as pd import pytest from requests import HTTPError from io import StringIO import warnings TMY_TEST_DATA = DATA_DIR / 'test_psm3_tmy-2017.csv' YEAR_TEST_DATA = DA...
[ "pvlib.iotools.psm3.parse_psm3", "pvlib.iotools.psm3.read_psm3", "io.StringIO", "pandas.read_csv", "numpy.allclose", "pytest.fixture", "pvlib.iotools.psm3.get_psm3", "pytest.raises", "pytest.mark.flaky", "pytest.mark.parametrize", "warnings.warn" ]
[((859, 889), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (873, 889), False, 'import pytest\n'), ((2690, 2749), 'pytest.mark.flaky', 'pytest.mark.flaky', ([], {'reruns': 'RERUNS', 'reruns_delay': 'RERUNS_DELAY'}), '(reruns=RERUNS, reruns_delay=RERUNS_DELAY)\n', (2707, 2749...
#coding=utf-8 import argparse import os import time import logging import random import torch import torch.backends.cudnn as cudnn import torch.optim from torch.utils.data import DataLoader cudnn.benchmark = True import numpy as np import models from data import datasets from utils import Parser,str2bool from pred...
[ "numpy.random.seed", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "torch.manual_seed", "os.path.dirname", "torch.load", "torch.cuda.manual_seed", "logging.info", "os.path.isfile", "predict.validate_softmax", "torch.cuda.is_available", "random.seed", "utils.Parser", "torch.nn.D...
[((358, 383), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (381, 383), False, 'import argparse\n'), ((1982, 2007), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1997, 2007), False, 'import os\n'), ((2150, 2183), 'os.path.join', 'os.path.join', (['ckpts', 'args.res...
""" #Trains a ResNet on the CIFAR10 dataset. """ from __future__ import print_function import keras from keras.layers import Dense, Conv2D, BatchNormalization, Activation from keras.layers import AveragePooling2D, Input, Flatten from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint, LearningRa...
[ "keras.models.load_model", "os.remove", "argparse.ArgumentParser", "json.dumps", "keras.applications.resnet.ResNet50", "numpy.mean", "glob.glob", "keras.applications.resnet.ResNet152", "keras.datasets.cifar10.load_data", "keras.layers.Flatten", "send_signal.send", "keras.utils.to_categorical",...
[((893, 959), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tensorflow Cifar10 Training"""'}), "(description='Tensorflow Cifar10 Training')\n", (916, 959), False, 'import argparse\n'), ((1903, 1914), 'os.getpid', 'os.getpid', ([], {}), '()\n', (1912, 1914), False, 'import os\n'), ((1927...
# 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.random.uniform", "benchmark_utils.create_qnode", "pennylane.broadcast", "numpy.random.seed", "pennylane.numpy.array", "pennylane.PauliZ" ]
[((1253, 1272), 'numpy.random.seed', 'np.random.seed', (['(143)'], {}), '(143)\n', (1267, 1272), True, 'import numpy as np\n'), ((1290, 1339), 'numpy.random.uniform', 'np.random.uniform', ([], {'high': '(2 * pi)', 'size': 'self.n_wires'}), '(high=2 * pi, size=self.n_wires)\n', (1307, 1339), True, 'import numpy as np\n'...
# 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...
[ "numpy.sum", "numpy.ones", "graph_embedding.simulations.heterogeneous_sbm_utils.GetCrossLinks", "collections.defaultdict", "numpy.argsort", "numpy.identity", "graph_tool.generation.generate_sbm", "graph_tool.stats.remove_parallel_edges", "numpy.outer", "graph_tool.stats.remove_self_loops", "nump...
[((5799, 5828), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (5822, 5828), False, 'import collections\n'), ((10872, 10905), 'numpy.zeros', 'np.zeros', (['num_vertices'], {'dtype': 'int'}), '(num_vertices, dtype=int)\n', (10880, 10905), True, 'import numpy as np\n'), ((12704, 12714),...
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import scipy.io from scipy.interpolate import griddata import time from plotting import newfig, savefig import matplotlib.gridspec as gridspec from mpl_toolkits.axes_grid1 import make_axes_locatable class...
[ "time.strftime", "tensorflow.matmul", "tensorflow.ConfigProto", "numpy.linalg.norm", "numpy.arange", "tensorflow.truncated_normal", "numpy.meshgrid", "numpy.random.randn", "numpy.std", "tensorflow.concat", "tensorflow.placeholder", "numpy.random.choice", "tensorflow.gradients", "plotting.n...
[((5492, 5509), 'numpy.meshgrid', 'np.meshgrid', (['x', 'y'], {}), '(x, y)\n', (5503, 5509), True, 'import numpy as np\n'), ((5527, 5567), 'numpy.concatenate', 'np.concatenate', (['(x_star, y_star)'], {'axis': '(1)'}), '((x_star, y_star), axis=1)\n', (5541, 5567), True, 'import numpy as np\n'), ((7140, 7187), 'numpy.ra...
#!/usr/bin/env python3 """Calculates the Frechet Inception Distance (FID) to evalulate GANs The FID metric calculates the distance between two distributions of images. Typically, we have summary statistics (mean & covariance matrix) of one of these distributions, while the 2nd distribution is given by a GAN. When run a...
[ "numpy.trace", "numpy.load", "numpy.abs", "argparse.ArgumentParser", "pathlib.Path", "numpy.mean", "numpy.atleast_2d", "os.path.exists", "numpy.isfinite", "torch.nn.functional.adaptive_avg_pool2d", "utils.inception.InceptionV3", "numpy.cov", "numpy.diagonal", "numpy.save", "numpy.iscompl...
[((1833, 1894), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'formatter_class': 'ArgumentDefaultsHelpFormatter'}), '(formatter_class=ArgumentDefaultsHelpFormatter)\n', (1847, 1894), False, 'from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter\n'), ((2655, 2675), 'PIL.Image.open', 'Image.open', (['fi...
import numpy as np from ..chain import parallel_test, serial_test from ...constraints.affine import constraints, gaussian_hit_and_run def test_gaussian_chain(): n = 30 A = np.eye(n)[:3] b = np.ones(A.shape[0]) con = constraints(A, b) state = np.random.standard_normal(n) state[:3] = 0 g...
[ "numpy.eye", "numpy.random.standard_normal", "numpy.sum", "numpy.ones" ]
[((206, 225), 'numpy.ones', 'np.ones', (['A.shape[0]'], {}), '(A.shape[0])\n', (213, 225), True, 'import numpy as np\n'), ((267, 295), 'numpy.random.standard_normal', 'np.random.standard_normal', (['n'], {}), '(n)\n', (292, 295), True, 'import numpy as np\n'), ((184, 193), 'numpy.eye', 'np.eye', (['n'], {}), '(n)\n', (...
from collections import defaultdict, Counter import re import math import numpy as np import os import psutil import zipfile import pandas as pd import tensorflow as tf import bert from bert import run_classifier from bert import optimization from bert import tokenization from bert import modeling import dill import pi...
[ "Model", "bert.tokenization.validate_case_matches_checkpoint", "numpy.sum", "TokenGenerator.maskedId", "tensorflow.get_collection", "tensorflow.reset_default_graph", "SpellCorrector", "tensorflow.global_variables_initializer", "tensorflow.nn.log_softmax", "tensorflow.keras.preprocessing.sequence.p...
[((566, 636), 'bert.tokenization.validate_case_matches_checkpoint', 'tokenization.validate_case_matches_checkpoint', (['(False)', 'BERT_INIT_CHKPNT'], {}), '(False, BERT_INIT_CHKPNT)\n', (611, 636), False, 'from bert import tokenization\n'), ((649, 719), 'bert.tokenization.FullTokenizer', 'tokenization.FullTokenizer', ...
import binascii import itertools import os import time import numpy import six import chainer from chainer import configuration from chainer import cuda from chainer import function from chainer.functions.activation import relu from chainer.functions.activation import tanh from chainer.functions.array import concat f...
[ "numpy.uint64", "chainer.functions.array.reshape.reshape", "chainer.cuda.cupy.split", "chainer.cuda.cupy.zeros_like", "six.moves.zip", "chainer.functions.array.split_axis.split_axis", "chainer.functions.noise.dropout.dropout", "chainer.functions.activation.relu.relu", "chainer.functions.array.stack....
[((843, 866), 'chainer.functions.array.stack.stack', 'stack.stack', (['ws'], {'axis': '(1)'}), '(ws, axis=1)\n', (854, 866), False, 'from chainer.functions.array import stack\n'), ((898, 952), 'chainer.functions.array.reshape.reshape', 'reshape.reshape', (['w', '((shape[0] * shape[1],) + shape[2:])'], {}), '(w, (shape[...
import logging import warnings import os import re import os import numpy as np import pandas as pd from copy import deepcopy from lib_utils_io import read_file_tif, read_obj, write_obj, write_file_tif, create_darray_3d from lib_utils_system import fill_tags2string, make_folder from lib_utils_statistics import filt...
[ "os.remove", "os.walk", "lib_utils_statistics.compute_moments_data_gamma_distribution", "pandas.DatetimeIndex", "lib_utils_statistics.filter_data", "os.path.join", "lib_utils_io.read_obj", "numpy.nanmean", "lib_utils_io.write_file_tif", "logging.error", "warnings.simplefilter", "logging.warnin...
[((710, 732), 'pandas.Timestamp', 'pd.Timestamp', (['time_run'], {}), '(time_run)\n', (722, 732), True, 'import pandas as pd\n'), ((2326, 2392), 'os.path.join', 'os.path.join', (['self.folder_name_ancillary', 'self.file_name_ancillary'], {}), '(self.folder_name_ancillary, self.file_name_ancillary)\n', (2338, 2392), Fal...
""" This module formulate the FlowOCT problem in gurobipy. """ from gurobipy import Model, GRB, quicksum, LinExpr import numpy as np import pandas as pd class FlowOPT_Robust: def __init__(self, X, t, y, ipw, y_hat, robust, treatments_set, tree, X_col_labels, ...
[ "pandas.DataFrame", "gurobipy.Model", "numpy.arange", "gurobipy.quicksum", "gurobipy.LinExpr" ]
[((1292, 1329), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'columns': 'X_col_labels'}), '(X, columns=X_col_labels)\n', (1304, 1329), True, 'import pandas as pd\n'), ((1560, 1589), 'numpy.arange', 'np.arange', (['(0)', 'self.X.shape[0]'], {}), '(0, self.X.shape[0])\n', (1569, 1589), True, 'import numpy as np\n'), ((17...
import numpy as np from multiagent.core import World, Agent, Landmark from multiagent.scenario import BaseScenario class Scenario(BaseScenario): def make_world(self, **kwargs): self.before_make_world(**kwargs) world = World() world.np_random = self.np_random # set any world proper...
[ "numpy.square", "numpy.zeros", "multiagent.core.Landmark", "numpy.array", "numpy.exp", "multiagent.core.World", "numpy.concatenate", "multiagent.core.Agent" ]
[((241, 248), 'multiagent.core.World', 'World', ([], {}), '()\n', (246, 248), False, 'from multiagent.core import World, Agent, Landmark\n'), ((5981, 6079), 'numpy.concatenate', 'np.concatenate', (['([agent.state.p_vel] + [agent.state.p_pos] + entity_pos + other_pos + other_vel\n )'], {}), '([agent.state.p_vel] + [a...
import os import pytest import numpy as np from quantum_systems import ( BasisSet, GeneralOrbitalSystem, TwoDimensionalDoubleWell, TwoDimensionalHarmonicOscillator, ) from quantum_systems.quantum_dots.two_dim.two_dim_helper import ( get_double_well_one_body_elements, theta_1_tilde_integral, ...
[ "numpy.abs", "quantum_systems.quantum_dots.two_dim.two_dim_helper.get_double_well_one_body_elements", "pytest.fixture", "numpy.linalg.eigh", "quantum_systems.BasisSet.add_spin_one_body", "numpy.array", "numpy.exp", "quantum_systems.TwoDimensionalHarmonicOscillator", "quantum_systems.quantum_dots.two...
[((3950, 3980), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (3964, 3980), False, 'import pytest\n'), ((1867, 1952), 'quantum_systems.TwoDimensionalDoubleWell', 'TwoDimensionalDoubleWell', (['l', 'radius', 'num_grid_points'], {'barrier_strength': '(0)', 'axis': '(0)'}), '(l...
import numpy as np from numpy import clip, inf from statsmodels.tsa.holtwinters import Holt class HoltWintersPredictor(object): def __init__(self, data_in, num_prediction_periods): self.__history = data_in self.__num_prediction_periods = num_prediction_periods y = np.array(data_in).resha...
[ "numpy.array", "numpy.clip", "statsmodels.tsa.holtwinters.Holt" ]
[((342, 365), 'numpy.clip', 'np.clip', (['y', '(1e-05)', 'None'], {}), '(y, 1e-05, None)\n', (349, 365), True, 'import numpy as np\n'), ((426, 464), 'statsmodels.tsa.holtwinters.Holt', 'Holt', (['y'], {'exponential': '(True)', 'damped': '(True)'}), '(y, exponential=True, damped=True)\n', (430, 464), False, 'from statsm...
""".""" import numpy as np import pyaccel from siriuspy.namesys import SiriusPVName as _PVName from siriuspy.devices import SOFB from ..optimization import SimulAnneal from ..utils import ThreadedMeasBaseClass as _BaseClass, \ ParamsBaseClass as _ParamsBaseClass class Params(_ParamsBaseClass): """.""" ...
[ "numpy.dot", "numpy.hstack", "pyaccel.lattice.set_attribute", "numpy.array", "numpy.mean", "pyaccel.tracking.find_m44", "pyaccel.lattice.find_indices", "siriuspy.namesys.SiriusPVName", "numpy.eye", "numpy.linalg.solve", "siriuspy.devices.SOFB" ]
[((4472, 4546), 'pyaccel.tracking.find_m44', 'pyaccel.tracking.find_m44', (['model'], {'indices': '"""open"""', 'fixed_point': '[0, 0, 0, 0]'}), "(model, indices='open', fixed_point=[0, 0, 0, 0])\n", (4497, 4546), False, 'import pyaccel\n'), ((6843, 6868), 'numpy.hstack', 'np.hstack', (['[respx, respy]'], {}), '([respx...
import numpy as np import torch import torch.nn as nn from ....ops.iou3d_nms import iou3d_nms_utils class ProposalTargetLayer(nn.Module): def __init__(self, roi_sampler_cfg): super().__init__() self.roi_sampler_cfg = roi_sampler_cfg def forward(self, batch_dict): """ Args: ...
[ "torch.nonzero", "torch.cat", "torch.max", "numpy.random.permutation", "numpy.random.rand", "numpy.round", "torch.from_numpy" ]
[((7329, 7365), 'torch.cat', 'torch.cat', (['(fg_inds, bg_inds)'], {'dim': '(0)'}), '((fg_inds, bg_inds), dim=0)\n', (7338, 7365), False, 'import torch\n'), ((5197, 5273), 'numpy.round', 'np.round', (['(self.roi_sampler_cfg.FG_RATIO * self.roi_sampler_cfg.ROI_PER_IMAGE)'], {}), '(self.roi_sampler_cfg.FG_RATIO * self.ro...
#!/usr/bin/python3.6 ######################################################## ## FEDERAL UNIVERSITY OF MINAS GERAIS ## ## COMPUTER SCIENCE DEPARTMENT ## ## WIRELESS NETWORKS LABORATORY ## ## ## ## A...
[ "argparse.ArgumentParser", "socket.socket", "regression.Regression", "select.select", "numpy.array", "configparser.ConfigParser", "copa_api.APICopa" ]
[((811, 884), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Machine Learning Regression Module"""'}), "(description='Machine Learning Regression Module')\n", (834, 884), False, 'import argparse\n'), ((1858, 1885), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n...
from __future__ import division import numpy as np import scipy import pandas as pd import copy import sklearn from scipy.cluster import hierarchy import matplotlib as mpl from matplotlib import pyplot as plt import seaborn as sns import gc def calc_DE_mannwhitneyu(X, names1, names2): pvalues ...
[ "numpy.sum", "numpy.abs", "scipy.cluster.hierarchy.linkage", "numpy.isnan", "gc.collect", "numpy.mean", "scipy.spatial.distance.pdist", "matplotlib.pyplot.tight_layout", "pandas.DataFrame", "matplotlib.colors.Normalize", "seaborn.clustermap", "numpy.std", "scipy.stats.mannwhitneyu", "numpy...
[((971, 1095), 'pandas.DataFrame', 'pd.DataFrame', (["{'pvalue': pvalues, 'medianA': medianA, 'medianB': medianB, 'meanA': meanA,\n 'meanB': meanB}"], {'index': 'X.index'}), "({'pvalue': pvalues, 'medianA': medianA, 'medianB': medianB,\n 'meanA': meanA, 'meanB': meanB}, index=X.index)\n", (983, 1095), True, 'impo...
# -*- coding: utf-8 -*- """ Created on Tue Mar 24 17:11:22 2020 @author: chens """ #from os.path import dirname import numpy as np import geoist as gi import geoist.others.fetch_data as data from geoist.others.fetch_data import _retrieve_file as downloadurl from geoist.others.fetch_data import usgs_catalog from geois...
[ "geoist.catalog.QCreport.qcinit", "geoist.log.info", "geoist.catalog.Smoothing.SmoothMFD", "geoist.catalog.Selection.AreaSelect", "numpy.cumsum", "geoist.others.fetch_data._retrieve_file", "geoist.catalog.QCreport.generate_html", "geoist.catalog.Exploration.RateDensityPlot", "geoist.catalog.Explorat...
[((905, 942), 'geoist.others.fetch_data._retrieve_file', 'downloadurl', (['(url + filename)', 'filename'], {}), '(url + filename, filename)\n', (916, 942), True, 'from geoist.others.fetch_data import _retrieve_file as downloadurl\n'), ((1069, 1119), 'geoist.others.fetch_data.usgs_catalog', 'usgs_catalog', (['usgsfile',...
import numpy as np def generate_frame(num_datapoints, size_side, thickness): """ Generates a square with specified num_datapoints and size_side, cenetered at the origin :param int num_datapoints: number of datapoints that constitute the square :param int size_side: length of the side of the square ...
[ "numpy.tile", "numpy.linspace" ]
[((622, 678), 'numpy.linspace', 'np.linspace', (['(-size_side / 2)', '(size_side / 2)'], {'num': 'num_side'}), '(-size_side / 2, size_side / 2, num=num_side)\n', (633, 678), True, 'import numpy as np\n'), ((936, 955), 'numpy.tile', 'np.tile', (['avgline', '(2)'], {}), '(avgline, 2)\n', (943, 955), True, 'import numpy a...
# Copyright (c) 2020 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...
[ "sys.path.append", "unittest.main", "paddle.fluid.data", "paddle.fluid._C_ops.sum", "paddle.fluid.core.XPUPlace", "paddle.enable_static", "numpy.empty", "paddle.fluid.dygraph.guard", "paddle.add_n", "paddle.ones", "numpy.random.random", "paddle.fluid.layers.fill_constant", "paddle.fluid.XPUP...
[((662, 683), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (677, 683), False, 'import sys\n'), ((1039, 1061), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (1059, 1061), False, 'import paddle\n'), ((6191, 6206), 'paddle.enable_static', 'enable_static', ([], {}), '()\n', (620...
import torch import datetime import numpy import random from .opt import * from .visualization import * def initialize(args): # create and init device print("{} | Torch Version: {}".format(datetime.datetime.now(), torch.__version__)) if args.seed > 0: print("Set to reproducibility mo...
[ "numpy.random.seed", "torch.manual_seed", "torch.load", "torch.cuda.manual_seed_all", "random.seed", "torch.cuda.is_available", "datetime.datetime.now" ]
[((370, 398), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (387, 398), False, 'import torch\n'), ((408, 445), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['args.seed'], {}), '(args.seed)\n', (434, 445), False, 'import torch\n'), ((455, 483), 'numpy.random.seed', 'nump...
""" Functions for loading and handling Digital Earth Africa data. """ # Import required packages import os from osgeo import gdal import requests import zipfile import warnings import numpy as np import xarray as xr import pandas as pd import datetime import pytz from collections import Counter from datacube.utils im...
[ "copy.deepcopy", "datacube.utils.masking.create_mask_value", "zipfile.ZipFile", "os.remove", "os.path.basename", "os.getcwd", "warnings.warn", "pandas.isnull", "xarray.merge", "odc.algo.mask_cleanup", "datetime.datetime", "numpy.arange", "xarray.DataArray", "requests.get", "collections.C...
[((8105, 8121), 'copy.deepcopy', 'deepcopy', (['kwargs'], {}), '(kwargs)\n', (8113, 8121), False, 'from copy import deepcopy\n'), ((19625, 19654), 'xarray.merge', 'xr.merge', (['[ds_data, ds_masks]'], {}), '([ds_data, ds_masks])\n', (19633, 19654), True, 'import xarray as xr\n'), ((23457, 23486), 'osgeo.gdal.GetDriverB...
import glfw from OpenGL.GL import * import numpy as np from OpenGL.GLU import * def render(): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glEnable(GL_DEPTH_TEST) glMatrixMode(GL_PROJECTION) glLoadIdentity() glOrtho(-2,2, -2,2, -1,1) glMatrixMode(GL_MODELVIEW) glLoadIdentity() ...
[ "glfw.swap_interval", "glfw.poll_events", "glfw.make_context_current", "glfw.get_time", "glfw.window_should_close", "glfw.init", "numpy.sin", "numpy.array", "glfw.terminate", "glfw.swap_buffers", "glfw.create_window" ]
[((344, 359), 'glfw.get_time', 'glfw.get_time', ([], {}), '()\n', (357, 359), False, 'import glfw\n'), ((1836, 1890), 'glfw.create_window', 'glfw.create_window', (['(480)', '(480)', '"""2018008659"""', 'None', 'None'], {}), "(480, 480, '2018008659', None, None)\n", (1854, 1890), False, 'import glfw\n'), ((1951, 1984), ...
import numpy as np import heapq from typing import Union class Graph: def __init__(self, adjacency_mat: Union[np.ndarray, str]): """ Unlike project 2, this Graph class takes an adjacency matrix as input. `adjacency_mat` can either be a 2D numpy array of floats or the path to a CSV file containing ...
[ "numpy.zeros_like", "heapq.heappush", "heapq.heapify", "heapq.heappop", "numpy.loadtxt" ]
[((1599, 1626), 'numpy.zeros_like', 'np.zeros_like', (['self.adj_mat'], {}), '(self.adj_mat)\n', (1612, 1626), True, 'import numpy as np\n'), ((2124, 2151), 'heapq.heapify', 'heapq.heapify', (['logged_edges'], {}), '(logged_edges)\n', (2137, 2151), False, 'import heapq\n'), ((925, 953), 'numpy.loadtxt', 'np.loadtxt', (...
from .common_setup import * import os from ..callbacks import DatapackStoreCallback, GetLearnIndices, StoreHyperparameters, callback_sequence, PlotRhat, PlotEss from ..misc import make_example_datapack from ..settings import float_type,dist_type from threading import Lock import tensorflow as tf import numpy as np d...
[ "numpy.random.uniform", "numpy.ones_like", "tensorflow.convert_to_tensor", "threading.Lock", "numpy.isclose", "numpy.linalg.norm", "os.path.join" ]
[((2019, 2038), 'numpy.ones_like', 'np.ones_like', (['phase'], {}), '(phase)\n', (2031, 2038), True, 'import numpy as np\n'), ((2409, 2454), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['store_array', 'tf.float64'], {}), '(store_array, tf.float64)\n', (2429, 2454), True, 'import tensorflow as tf\n'), ((959...