code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import json import zipfile import numpy as np import pandas as pd import matplotlib.pyplot as plt # reading training data df = pd.read_csv('train.csv', converters={'POLYLINE': lambda x: json.loads(x)[:]},nrows=1000) latLong = np.array([]) allTrajectoryLatLong=[p for p in df['POLYLINE'] if len(p)>0] #for oneTrajecto...
[ "json.loads", "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "matplotlib.pyplot.show" ]
[((229, 241), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (237, 241), True, 'import numpy as np\n'), ((975, 987), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (985, 987), True, 'import matplotlib.pyplot as plt\n'), ((1178, 1211), 'matplotlib.pyplot.title', 'plt.title', (['"""Taxi trip end points""...
from __future__ import print_function, division import torch import torch.nn as nn import numpy as np import torchvision from torchvision import datasets, models, transforms from torch.utils.data import Dataset, DataLoader import os from PIL import Image class TestDataset(Dataset): """Face Landmarks dataset."...
[ "os.listdir", "PIL.Image.open", "torchvision.transforms.RandomHorizontalFlip", "os.path.join", "torchvision.transforms.RandomVerticalFlip", "torchvision.transforms.ColorJitter", "numpy.array", "torchvision.transforms.Normalize", "torch.utils.data.DataLoader", "torchvision.transforms.ToTensor" ]
[((2173, 2282), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_dataset'], {'batch_size': 'batch_size', 'shuffle': '(True)', 'num_workers': 'num_workers'}), '(train_dataset, batch_size=batch_size, shuffle=\n True, num_workers=num_workers)\n', (2200, 2282), False, 'import torch\n'), ((829, 854)...
"""Code from https://github.com/tambetm/simple_dqn/blob/master/src/replay_memory.py""" import os import random import logging import numpy as np from .utils import save_npy, load_npy class ReplayMemory: def __init__(self, config, model_dir): self.model_dir = model_dir self.cnn_format = config.cnn_format ...
[ "os.path.join", "numpy.transpose", "numpy.empty", "random.randint" ]
[((380, 422), 'numpy.empty', 'np.empty', (['self.memory_size'], {'dtype': 'np.uint8'}), '(self.memory_size, dtype=np.uint8)\n', (388, 422), True, 'import numpy as np\n'), ((444, 488), 'numpy.empty', 'np.empty', (['self.memory_size'], {'dtype': 'np.integer'}), '(self.memory_size, dtype=np.integer)\n', (452, 488), True, ...
# -*- coding: utf-8 -*- """svhn.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1cr_mqeEfw7how-r9MAqqZqJqyepX31yS """ import numpy as np import matplotlib.pyplot as plt #import seaborn as sns import h5py #import tensorflow as tf #import os #impor...
[ "keras.layers.Conv2D", "scipy.io.loadmat", "tensorflow.keras.callbacks.EarlyStopping", "numpy.array", "keras.layers.Activation", "keras.layers.Dense", "numpy.where", "numpy.delete", "numpy.dot", "keras.layers.Flatten", "keras.layers.MaxPooling2D", "keras.layers.normalization.BatchNormalization...
[((984, 997), 'scipy.io.loadmat', 'loadmat', (['path'], {}), '(path)\n', (991, 997), False, 'from scipy.io import loadmat\n'), ((1187, 1199), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (1196, 1199), True, 'import numpy as np\n'), ((2780, 2821), 'numpy.delete', 'np.delete', (['X_train', 'train_samples'], {'axis'...
import gym import numpy as np from gym import spaces class NormalizedActionWrapper(gym.ActionWrapper): """Environment wrapper to normalize the action space to [-scale, scale] Args: env (gym.env): OpenAI Gym environment to wrap around scale (float): Scale for normalizing action. Default: 1.0. ...
[ "numpy.clip", "numpy.isfinite", "gym.spaces.Box" ]
[((556, 625), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-scale)', 'high': 'scale', 'shape': 'self.env.action_space.shape'}), '(low=-scale, high=scale, shape=self.env.action_space.shape)\n', (566, 625), False, 'from gym import spaces\n'), ((719, 759), 'numpy.clip', 'np.clip', (['action', '(-self.scale)', 'self.scal...
import pandas as pd import numpy as np import scipy.optimize import numdifftools as nd from pyswarm import pso import time state_map_dict = {0:'KY', 1:'OH', 2:'PA', 3:'VA', 4:'WV'} time_map_dict = {0:2010, 1:2011, 2:2012, 3:2013, 4:2014, 5:2015, 6:2016, 7:2017} full2abbrev_dict = {'Kentucky':'KY', 'Ohio':'OH', 'Pennsy...
[ "pyswarm.pso", "numpy.random.rand", "pandas.read_csv" ]
[((382, 415), 'pandas.read_csv', 'pd.read_csv', (['"""MCM_NFLIS_Data.csv"""'], {}), "('MCM_NFLIS_Data.csv')\n", (393, 415), True, 'import pandas as pd\n'), ((504, 547), 'pandas.read_csv', 'pd.read_csv', (['"""ACS_10_5YR_DP02_with_ann.csv"""'], {}), "('ACS_10_5YR_DP02_with_ann.csv')\n", (515, 547), True, 'import pandas ...
from hdmf.common import CSRMatrix from hdmf.testing import TestCase, H5RoundTripMixin import scipy.sparse as sps import numpy as np class TestCSRMatrix(TestCase): def test_from_sparse_matrix(self): data = np.array([1, 2, 3, 4, 5, 6]) indices = np.array([0, 2, 2, 0, 1, 2]) indptr = np.arr...
[ "numpy.asarray", "hdmf.common.CSRMatrix", "numpy.array", "scipy.sparse.csr_matrix", "numpy.testing.assert_array_equal" ]
[((221, 249), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6]'], {}), '([1, 2, 3, 4, 5, 6])\n', (229, 249), True, 'import numpy as np\n'), ((268, 296), 'numpy.array', 'np.array', (['[0, 2, 2, 0, 1, 2]'], {}), '([0, 2, 2, 0, 1, 2])\n', (276, 296), True, 'import numpy as np\n'), ((314, 336), 'numpy.array', 'np.array', (...
import pandas as pd import numpy as np import requests # finance-datareader installed # now : cvxopt version 1.2.6 # python interpreter : 3.9.6 import FinanceDataReader as fdr # print(fdr.__version__) # 0.9.31 # 한국거래소 krx 불러오기 df_krx = fdr.StockListing('KRX') # print(df_krx) # [6813 rows x 10 columns] # 데이터 파악 # df...
[ "pypfopt.discrete_allocation.DiscreteAllocation", "FinanceDataReader.DataReader", "pypfopt.risk_models.sample_cov", "pypfopt.discrete_allocation.get_latest_prices", "numpy.array", "pypfopt.expected_returns.mean_historical_return", "pypfopt.efficient_frontier.EfficientFrontier", "pandas.DataFrame", "...
[((239, 262), 'FinanceDataReader.StockListing', 'fdr.StockListing', (['"""KRX"""'], {}), "('KRX')\n", (255, 262), True, 'import FinanceDataReader as fdr\n'), ((577, 593), 'numpy.array', 'np.array', (['assets'], {}), '(assets)\n', (585, 593), True, 'import numpy as np\n'), ((1029, 1043), 'pandas.DataFrame', 'pd.DataFram...
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.13.0 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # # Fleet Cl...
[ "fleet_clustering.filters.find_valid_ssvid", "collections.OrderedDict", "skimage.color.hsv2rgb", "fleet_clustering.distances.create_composite_lonlat_array", "pandas.read_gbq", "fleet_clustering.animation.make_anim", "imp.reload", "numpy.argmax", "fleet_clustering.distances.compute_distances_4", "c...
[((3276, 3312), 'fleet_clustering.bq.load_carriers_by_year', 'bq.load_carriers_by_year', (['(2017)', '(2018)'], {}), '(2017, 2018)\n', (3300, 3312), False, 'from fleet_clustering import bq\n'), ((3642, 3712), 'pandas.read_gbq', 'pd.read_gbq', (['query'], {'dialect': '"""standard"""', 'project_id': '"""world-fishing-827...
import torch from torch import Tensor from typing import List, Tuple, Any, Optional from torchvision.transforms import functional as F import torchvision import torch.utils.data as torch_data from torchvision import transforms from PIL import Image from copy import deepcopy import math import os import numpy as np c...
[ "numpy.clip", "torch.as_tensor", "numpy.sqrt", "numpy.random.rand", "math.sqrt", "numpy.array", "copy.deepcopy", "torchvision.transforms.functional.get_image_size", "torch.randint", "torchvision.transforms.ToTensor", "numpy.random.beta", "torchvision.transforms.functional.resized_crop", "tor...
[((464, 485), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (483, 485), False, 'from torchvision import transforms\n'), ((1249, 1271), 'copy.deepcopy', 'deepcopy', (['source_image'], {}), '(source_image)\n', (1257, 1271), False, 'from copy import deepcopy\n'), ((3276, 3305), 'PIL.Image.fro...
import numpy as np import os import cv2 from skimage.io import imread from skimage.io import imsave from os.path import join import sys import matplotlib.pyplot as plt import argparse def add_noise(noise_typ, image, sigma): if noise_typ == "gauss": row, col, ch = image.shape mean = 0 gauss = np.random.normal(...
[ "numpy.random.normal", "numpy.copy", "numpy.ceil", "os.path.exists", "os.listdir", "numpy.unique", "os.makedirs", "numpy.random.poisson", "numpy.where", "os.path.join", "numpy.squeeze", "skimage.io.imread", "numpy.expand_dims", "os.system", "numpy.log2", "numpy.random.randn" ]
[((303, 348), 'numpy.random.normal', 'np.random.normal', (['mean', 'sigma', '(row, col, ch)'], {}), '(mean, sigma, (row, col, ch))\n', (319, 348), True, 'import numpy as np\n'), ((521, 535), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (528, 535), True, 'import numpy as np\n'), ((563, 600), 'numpy.ceil', 'np....
""" Description: Author: <NAME> (<EMAIL>) Date: 2021-06-06 01:55:29 LastEditors: <NAME> (<EMAIL>) LastEditTime: 2021-06-06 01:55:30 """ import os import argparse import json import logging import logging.handlers import time from collections import OrderedDict from datetime import datetime from pathlib import Path fro...
[ "logging.getLogger", "logging.StreamHandler", "argparse.Namespace", "logging.error", "logging.info", "os.path.exists", "numpy.mean", "argparse.ArgumentParser", "pathlib.Path", "tensorflow.compat.v1.logging.set_verbosity", "numpy.ndim", "functools.wraps", "numpy.max", "logging.root.setLevel...
[((752, 765), 'pathlib.Path', 'Path', (['dirname'], {}), '(dirname)\n', (756, 765), False, 'from pathlib import Path\n'), ((1272, 1283), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1277, 1283), False, 'from functools import wraps, partial\n'), ((4770, 4793), 'logging.StreamHandler', 'logging.StreamHandler'...
import os import glob import logging import numpy as np import skimage.io import skimage.transform import skimage.color from joblib import Parallel, delayed from pprint import pformat from utils import CONFIG config = CONFIG.DatasetLoader log = logging.getLogger('DatasetLoader') log.setLevel(config.log.level) class ...
[ "logging.getLogger", "os.path.exists", "numpy.asarray", "os.path.join", "joblib.Parallel", "os.path.abspath", "joblib.delayed" ]
[((246, 280), 'logging.getLogger', 'logging.getLogger', (['"""DatasetLoader"""'], {}), "('DatasetLoader')\n", (263, 280), False, 'import logging\n'), ((547, 579), 'joblib.Parallel', 'Parallel', ([], {'n_jobs': 'config.par_jobs'}), '(n_jobs=config.par_jobs)\n', (555, 579), False, 'from joblib import Parallel, delayed\n'...
import os import time import numpy as np import pandas as pd from oplrareg.solvers import get_solver_definition from modSAR.dataset import QSARDatasetIO from modSAR.graph import GraphUtils from copy import deepcopy from sklearn.externals.joblib import Parallel, delayed from sklearn.metrics import mean_absolute_error,...
[ "sklearn.model_selection.ParameterGrid", "copy.deepcopy", "sklearn.externals.joblib.delayed", "sklearn.model_selection.ParameterSampler", "modSAR.graph.GraphUtils.find_optimal_threshold", "sklearn.metrics.mean_squared_error", "pandas.ExcelFile", "sklearn.externals.joblib.Parallel", "oplrareg.solvers...
[((601, 623), 'pandas.ExcelFile', 'pd.ExcelFile', (['filename'], {}), '(filename)\n', (613, 623), True, 'import pandas as pd\n'), ((6046, 6083), 'pandas.concat', 'pd.concat', (['results'], {'ignore_index': '(True)'}), '(results, ignore_index=True)\n', (6055, 6083), True, 'import pandas as pd\n'), ((6895, 6932), 'sklear...
from matplotlib import pyplot as plt import pandas as pd import seaborn as sns import numpy as np def heatmap(x, y, freq_labels = 1, show_grid = True, invert_yaxis = False, **kwargs, ): color = kwargs.get('color', [1]*len...
[ "seaborn.color_palette", "seaborn.diverging_palette", "matplotlib.pyplot.GridSpec", "numpy.linspace", "matplotlib.pyplot.subplot" ]
[((2880, 2923), 'matplotlib.pyplot.GridSpec', 'plt.GridSpec', (['(1)', '(15)'], {'hspace': '(0.2)', 'wspace': '(0.1)'}), '(1, 15, hspace=0.2, wspace=0.1)\n', (2892, 2923), True, 'from matplotlib import pyplot as plt\n'), ((3055, 3085), 'matplotlib.pyplot.subplot', 'plt.subplot', (['plot_grid[:, :-1]'], {}), '(plot_grid...
# test_yuzu_naive_equality.py # Author: <NAME> <<EMAIL>> """ Testing the yuzu ISM implementation is equivalent to the naive ISM implementation using the built-in models. These are regression tests. """ import numpy import torch from nose.tools import assert_raises from numpy.testing import assert_array_almost_equal...
[ "torch.nn.MaxPool1d", "torch.nn.ReLU", "numpy.testing.assert_array_almost_equal", "nose.tools.assert_raises", "torch.nn.BatchNorm1d", "numpy.zeros", "yuzu.precompute", "yuzu.naive_ism.naive_ism", "torch.nn.Linear", "numpy.random.RandomState", "yuzu.yuzu_ism", "torch.nn.Conv1d", "numpy.arange...
[((547, 597), 'numpy.zeros', 'numpy.zeros', (['(n_seqs, 4, seq_len)'], {'dtype': '"""float32"""'}), "((n_seqs, 4, seq_len), dtype='float32')\n", (558, 597), False, 'import numpy\n'), ((747, 819), 'yuzu.precompute', 'precompute', (['model'], {'seq_len': 'X.shape[2]', 'n_choices': 'X.shape[1]', 'alpha': 'alpha'}), '(mode...
import numpy as np from omegaconf import OmegaConf def calculate_initial_lr(cfg: OmegaConf) -> float: """ Proposed initial learning rates by SimCLR paper. Note: SimCLR paper says squared learning rate is better when the size of mini-batches is small. :param cfg: Hydra's config. :return: Initial ...
[ "numpy.sqrt" ]
[((544, 581), 'numpy.sqrt', 'np.sqrt', (["cfg['experiment']['batches']"], {}), "(cfg['experiment']['batches'])\n", (551, 581), True, 'import numpy as np\n')]
import numpy as np from tensorflow.keras.models import model_from_json from tensorflow.keras.applications.inception_v3 import InceptionV3 from tensorflow.keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img from PIL import Image import cv2 import urllib.request import numpy as np ...
[ "tensorflow.keras.models.model_from_json", "tensorflow.keras.preprocessing.image.img_to_array", "PIL.Image.open", "numpy.argmax" ]
[((575, 609), 'tensorflow.keras.models.model_from_json', 'model_from_json', (['loaded_model_json'], {}), '(loaded_model_json)\n', (590, 609), False, 'from tensorflow.keras.models import model_from_json\n'), ((1111, 1128), 'PIL.Image.open', 'Image.open', (['image'], {}), '(image)\n', (1121, 1128), False, 'from PIL impor...
#!/usr/bin/python # # This file is part of PyRQA. # Copyright 2015 <NAME>, <NAME>. """ Distance metrics. """ import math import numpy as np from pyrqa.abstract_classes import AbstractMetric class TaxicabMetric(AbstractMetric): """ Taxicab metric (L1) """ name = 'taxicab_metric' @classmethod ...
[ "math.pow", "math.sqrt", "math.fabs", "numpy.finfo", "numpy.arange" ]
[((514, 544), 'numpy.arange', 'np.arange', (['embedding_dimension'], {}), '(embedding_dimension)\n', (523, 544), True, 'import numpy as np\n'), ((942, 972), 'numpy.arange', 'np.arange', (['embedding_dimension'], {}), '(embedding_dimension)\n', (951, 972), True, 'import numpy as np\n'), ((1513, 1543), 'numpy.arange', 'n...
#!/usr/bin/env python3 """ Base class(es) for text classifiers. The file defines some of the common classes/functions as well as the interface (including a command line interface). """ import sys, os, time, csv, re, itertools, random, json import gzip from hashlib import md5 import numpy as np from collections import...
[ "sklearn.model_selection.StratifiedShuffleSplit", "csv.DictReader", "gzip.open", "re.compile", "sklearn.model_selection.StratifiedKFold", "numpy.array", "random.getrandbits", "logging.info", "numpy.arange", "os.remove", "argparse.ArgumentParser", "itertools.product", "numpy.vstack", "os.ge...
[((411, 477), 'logging.basicConfig', 'basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(message)s"""'}), "(level=logging.DEBUG, format='%(asctime)s %(message)s')\n", (422, 477), False, 'from logging import debug, info, warning, basicConfig\n'), ((618, 660), 're.compile', 're.compile', (['"""\\\\...
import numpy as np import pandas as pd import pytest from gmpy2 import bit_mask from rulelist.datastructure.data import Data from rulelist.rulelistmodel.categoricalmodel.categoricalstatistic import CategoricalFixedStatistic, \ CategoricalFreeStatistic @pytest.fixture def constant_parameters(): input_n_cutpoi...
[ "rulelist.rulelistmodel.categoricalmodel.categoricalstatistic.CategoricalFreeStatistic", "rulelist.datastructure.data.Data", "rulelist.rulelistmodel.categoricalmodel.categoricalstatistic.CategoricalFixedStatistic", "gmpy2.bit_mask", "pandas.DataFrame", "numpy.arange" ]
[((593, 621), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'dictinput'}), '(data=dictinput)\n', (605, 621), True, 'import pandas as pd\n'), ((1050, 1079), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'dictoutput'}), '(data=dictoutput)\n', (1062, 1079), True, 'import pandas as pd\n'), ((1097, 1217), 'rulelist....
#!/usr/bin/env python """ Copyright (C) 2019 <NAME> Ltd Copyright (C) 2019 <NAME>, ETH Zurich 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 th...
[ "numpy.mean", "collections.OrderedDict", "pandas.read_csv", "os.path.join", "os.path.isdir", "pandas.DataFrame" ]
[((1478, 1507), 'pandas.read_csv', 'read_csv', (['file_path'], {'sep': '"""\t"""'}), "(file_path, sep='\\t')\n", (1486, 1507), False, 'from pandas import read_csv\n'), ((2583, 2643), 'pandas.DataFrame', 'pd.DataFrame', (['all_preds'], {'columns': 'columns', 'index': 'all_patients'}), '(all_preds, columns=columns, index...
import gym import tensorflow as tf from tensorflow.keras import layers import numpy as np import matplotlib.pyplot as plt from exploration import OUActionNoise from rpm import Buffer, update_target from ddpg import DDPG from shield import Shield from lundar_landing import LunarLanderContinuous # from conjugate_prior...
[ "numpy.mean", "numpy.abs", "rpm.update_target", "matplotlib.pyplot.ylabel", "lundar_landing.LunarLanderContinuous", "ipdb.set_trace", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "ddpg.DDPG", "conjugate_prior.NormalNormalKnownVar", "shield.Shield", "tensorflow.convert_to_tensor", "m...
[((6259, 6282), 'lundar_landing.LunarLanderContinuous', 'LunarLanderContinuous', ([], {}), '()\n', (6280, 6282), False, 'from lundar_landing import LunarLanderContinuous\n'), ((6380, 6396), 'ipdb.set_trace', 'ipdb.set_trace', ([], {}), '()\n', (6394, 6396), False, 'import ipdb\n'), ((6786, 6935), 'ddpg.DDPG', 'DDPG', (...
import os import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader import argparse import time import numpy as np from models.attention_model import AttentionModelBddDetection, AttentionModelMultiBddDetection from models.feature_model import FeatureModelBddDetection from mo...
[ "dataset.multiBddDetectionDataset.MultiBddDetection", "ats.utils.logging.AttentionSaverMultiBatchBddDetection", "torch.nn.CrossEntropyLoss", "ats.utils.regularizers.MultinomialEntropy", "torch.cuda.is_available", "models.attention_model.AttentionModelBddDetection", "os.path.exists", "dataset.bdd_detec...
[((970, 1025), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (993, 1025), False, 'import warnings\n'), ((1772, 1873), 'torch.utils.data.DataLoader', 'DataLoader', (['train_dataset'], {'batch_size': 'opts.batch_size', 'shuffle...
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2017 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal #...
[ "logging.getLogger", "fabio.fabioimage.FabioImage", "numpy.equal", "silx.image.shapes.draw_line", "numpy.array", "sys.exc_info", "numpy.isfinite", "fabio.open", "silx.third_party.EdfFile.EdfFile", "os.remove", "os.path.exists", "os.path.isdir", "numpy.empty", "numpy.ones", "os.path.split...
[((2042, 2069), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2059, 2069), False, 'import logging\n'), ((2717, 2751), 'numpy.array', 'numpy.array', (['()'], {'dtype': 'numpy.uint8'}), '((), dtype=numpy.uint8)\n', (2728, 2751), False, 'import numpy\n'), ((3435, 3469), 'numpy.array', 'num...
import os import skimage from skimage import io, util from skimage.draw import circle import numpy as np import math def circularcrop(img, border=200, threshold=20000, threshold1=100): """ This function trims the circular image by border pixels, nullifies outside borders and crops the total img to the disk...
[ "skimage.draw.circle", "math.sqrt", "numpy.argmax", "numpy.sum", "numpy.zeros", "skimage.util.crop", "numpy.argmin" ]
[((627, 646), 'numpy.sum', 'np.sum', (['img'], {'axis': '(2)'}), '(img, axis=2)\n', (633, 646), True, 'import numpy as np\n'), ((798, 822), 'numpy.argmax', 'np.argmax', (['cols[0:width]'], {}), '(cols[0:width])\n', (807, 822), True, 'import numpy as np\n'), ((890, 919), 'numpy.argmax', 'np.argmax', (['rows[0:height / 2...
#!/bin/env/python # -*- encoding: utf-8 -*- """ GridWorld Environment """ from __future__ import division, print_function import cv2 import numpy as np from matplotlib import pyplot as plt from markov_rlzoo import MDPEnv, MDPState class GridWorld(MDPEnv): def __init__(self, shape: tuple = (4, 4), ends: list = ...
[ "numpy.uint8", "matplotlib.pyplot.imshow", "markov_rlzoo.MDPState", "numpy.max", "cv2.imshow", "numpy.zeros", "cv2.resize", "cv2.waitKey", "matplotlib.pyplot.show" ]
[((3015, 3035), 'numpy.zeros', 'np.zeros', (['self.shape'], {}), '(self.shape)\n', (3023, 3035), True, 'import numpy as np\n'), ((3202, 3215), 'numpy.max', 'np.max', (['frame'], {}), '(frame)\n', (3208, 3215), True, 'import numpy as np\n'), ((3302, 3317), 'numpy.uint8', 'np.uint8', (['frame'], {}), '(frame)\n', (3310, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import os import random import sys import time import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin import tensorflow ...
[ "tensorflow.app.flags.DEFINE_float", "tensorflow.initialize_all_variables", "tensorflow.gfile.Exists", "numpy.random.random_sample", "tensorflow.app.flags.DEFINE_integer", "tracer.data_utils.decode_base", "tensorflow.Session", "os.path.join", "numpy.argmax", "tensorflow.app.flags.DEFINE_string", ...
[((857, 922), 'tensorflow.app.flags.DEFINE_float', 'tf.app.flags.DEFINE_float', (['"""learning_rate"""', '(0.5)', '"""Learning rate."""'], {}), "('learning_rate', 0.5, 'Learning rate.')\n", (882, 922), True, 'import tensorflow as tf\n'), ((923, 1026), 'tensorflow.app.flags.DEFINE_float', 'tf.app.flags.DEFINE_float', ([...
import cv2 import os import sys import numpy as np def main(argv): content = argv[0] style = argv[1] output = argv[2] loss_ratio = "1" interim_content = "img_without_alpha.jpg" interim_output = "interim_" + output exec_format = "python run_test.py --content {} --style_model {} --output {}" ...
[ "cv2.imwrite", "cv2.merge", "numpy.zeros", "os.system", "cv2.resize", "cv2.imread", "os.remove" ]
[((525, 548), 'cv2.imread', 'cv2.imread', (['content', '(-1)'], {}), '(content, -1)\n', (535, 548), False, 'import cv2\n'), ((572, 643), 'cv2.resize', 'cv2.resize', (['img_with_alpha', '(norm_icon_w, norm_icon_h)', 'cv2.INTER_CUBIC'], {}), '(img_with_alpha, (norm_icon_w, norm_icon_h), cv2.INTER_CUBIC)\n', (582, 643), F...
""" Lyapunov module ================= Module with the classes of multi-thread the computation of the various `Lyapunov vectors`_ and `exponents`_. Integrate using the `Runge-Kutta method`_ defined in the :mod:`~.integrators.integrate` module. See :cite:`lyap-KP2012` for more details on the Lya...
[ "multiprocessing.JoinableQueue", "multiprocessing.cpu_count", "numpy.array", "qgs.functions.util.solve_triangular_matrix", "numpy.mod", "numpy.arange", "numpy.linalg.qr", "numpy.random.random", "numpy.diff", "qgs.functions.util.reverse", "numpy.concatenate", "numpy.abs", "numpy.eye", "qgs....
[((20501, 20528), 'numpy.zeros', 'np.zeros', (['(1, n_dim, n_dim)'], {}), '((1, n_dim, n_dim))\n', (20509, 20528), True, 'import numpy as np\n'), ((20541, 20554), 'numpy.eye', 'np.eye', (['n_dim'], {}), '(n_dim)\n', (20547, 20554), True, 'import numpy as np\n'), ((20755, 20798), 'numpy.zeros', 'np.zeros', (['(n_traj, n...
import numpy as np def pack_selector_from_mask(boolarray): """ pack all contiguous selectors into slices. Remember that tiledb multi_index requires INCLUSIVE indices. """ if boolarray is None: return slice(None) assert type(boolarray) == np.ndarray assert boolarray.dtype == bool...
[ "numpy.nonzero" ]
[((337, 358), 'numpy.nonzero', 'np.nonzero', (['boolarray'], {}), '(boolarray)\n', (347, 358), True, 'import numpy as np\n')]
# The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol # # 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...
[ "sklearn.datasets.load_iris", "datetime.datetime.utcfromtimestamp", "datetime.datetime.utcnow", "numpy.array", "hyperstream.TimeInterval", "numpy.testing.assert_almost_equal", "numpy.nanmean", "datetime.timedelta" ]
[((4352, 4363), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (4361, 4363), False, 'from sklearn.datasets import load_iris\n'), ((4735, 4752), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (4750, 4752), False, 'from datetime import datetime, timedelta\n'), ((4811, 4839), 'datetime.date...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import itertools rng = np.random.RandomState(42) def svdw(m): n = m.shape[0] assert m.shape == (n, n) u, s, vt = np.linalg.svd(m) w = u @ vt assert np.allclose(u.T @ u, np.eye(n)) assert np.allclose(w.T @ w, np.eye(n)) asse...
[ "numpy.abs", "numpy.eye", "numpy.linalg.matrix_rank", "numpy.linalg.det", "numpy.diag", "numpy.zeros", "numpy.empty_like", "numpy.empty", "numpy.linalg.svd", "numpy.random.RandomState", "numpy.set_printoptions" ]
[((91, 116), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (112, 116), True, 'import numpy as np\n'), ((194, 210), 'numpy.linalg.svd', 'np.linalg.svd', (['m'], {}), '(m)\n', (207, 210), True, 'import numpy as np\n'), ((605, 640), 'numpy.empty', 'np.empty', (['(n, n * n)'], {'dtype': 'M....
import numpy as np class TwoStepDom(object): '''Class to get the two step dominance matrix and rankings''' def __init__(self, N_teams, week, sq_weight=0.25, decay_penalty=0.5): self.w_sq = sq_weight self.w_l = 1. - sq_weight self.win_matrix = np.zeros(shape=(N_teams,N_teams)) self.w...
[ "numpy.zeros", "numpy.linalg.matrix_power" ]
[((276, 310), 'numpy.zeros', 'np.zeros', ([], {'shape': '(N_teams, N_teams)'}), '(shape=(N_teams, N_teams))\n', (284, 310), True, 'import numpy as np\n'), ((1219, 1261), 'numpy.linalg.matrix_power', 'np.linalg.matrix_power', (['self.win_matrix', '(2)'], {}), '(self.win_matrix, 2)\n', (1241, 1261), True, 'import numpy a...
import io from logging import raiseExceptions from typing import Any import magic import numpy as np import pandas as pd from icecream import ic from PIL import Image import cv2 from .file_management import get_buffer_category, get_buffer_type, get_mime_category from pathlib import Path def _open(input, btype=None, ...
[ "numpy.uint8", "icecream.ic", "pandas.read_csv", "pathlib.Path", "io.BytesIO", "logging.raiseExceptions", "pandas.read_html", "numpy.fromstring", "pandas.read_json" ]
[((485, 528), 'icecream.ic', 'ic', (['"""Converting io.BytesIO to bytes object"""'], {}), "('Converting io.BytesIO to bytes object')\n", (487, 528), False, 'from icecream import ic\n'), ((1157, 1174), 'icecream.ic', 'ic', (['"""infere type"""'], {}), "('infere type')\n", (1159, 1174), False, 'from icecream import ic\n'...
import numpy as np from topocalc.horizon import horizon from smrf.envphys.constants import (GRAVITY, IR_MAX, IR_MIN, MOL_AIR, SEA_LEVEL, STD_AIRTMP, STD_LAPSE, VISIBLE_MAX, VISIBLE_MIN) from smrf.envphys.solar.irradiance import direct_solar_irradi...
[ "numpy.copy", "numpy.mean", "numpy.abs", "numpy.arccos", "numpy.zeros_like", "topocalc.horizon.horizon", "smrf.envphys.thermal.topotherm.hysat", "smrf.envphys.solar.twostream.twostream", "smrf.envphys.solar.irradiance.direct_solar_irradiance" ]
[((1896, 1950), 'smrf.envphys.solar.irradiance.direct_solar_irradiance', 'direct_solar_irradiance', (['date_time'], {'w': 'wavelength_range'}), '(date_time, w=wavelength_range)\n', (1919, 1950), False, 'from smrf.envphys.solar.irradiance import direct_solar_irradiance\n'), ((2042, 2077), 'topocalc.horizon.horizon', 'ho...
# Visualization function import numpy as np import matplotlib.pyplot as plt from math import ceil from PIL import Image from scipy.ndimage.filters import gaussian_filter def img_combine(img, ncols=5, size=1, path=False): """ Draw the images with array img: image array to plot - size = n x im_w x im_h x 3 ...
[ "PIL.Image.fromarray", "math.ceil", "matplotlib.pyplot.savefig", "scipy.ndimage.filters.gaussian_filter", "numpy.hstack", "numpy.zeros", "numpy.vstack", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((399, 506), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': 'nrows', 'ncols': 'ncols', 'sharex': '(True)', 'sharey': '(True)', 'figsize': '(ncols * size, nrows * size)'}), '(nrows=nrows, ncols=ncols, sharex=True, sharey=True, figsize=(\n ncols * size, nrows * size))\n', (411, 506), True, 'import matpl...
''' May 2020 by <NAME> <EMAIL> https://www.github.com/sebbarb/ ''' import sys sys.path.append('../lib/') import numpy as np import pandas as pd from lifelines import CoxPHFitter from utils import * import feather from hyperparameters import Hyperparameters from pdb import set_trace as bp def mai...
[ "hyperparameters.Hyperparameters", "lifelines.CoxPHFitter", "numpy.dot", "pandas.DataFrame", "numpy.load", "sys.path.append" ]
[((86, 112), 'sys.path.append', 'sys.path.append', (['"""../lib/"""'], {}), "('../lib/')\n", (101, 112), False, 'import sys\n'), ((379, 396), 'hyperparameters.Hyperparameters', 'Hyperparameters', ([], {}), '()\n', (394, 396), False, 'from hyperparameters import Hyperparameters\n'), ((409, 470), 'numpy.load', 'np.load',...
# -*- coding: utf-8 -*- from typing import Iterable, Union import numpy as np import pytrol.util.graphprocessor as gp class Network: def __init__(self, graph: np.ndarray, edges_to_vertices: np.ndarray, edges_lgts: np.ndarray, edge_activations, vertices: dict, edges: dict, locat...
[ "pytrol.util.graphprocessor.v_to_v_tc_paths", "pytrol.util.graphprocessor.edge", "pytrol.util.graphprocessor.build_tc_neighbours", "pytrol.util.graphprocessor.target", "numpy.array", "pytrol.util.graphprocessor.fw_distances", "pytrol.util.graphprocessor.min_and_max_dists", "numpy.zeros", "numpy.lina...
[((956, 998), 'numpy.array', 'np.array', (['edge_activations'], {'dtype': 'np.int16'}), '(edge_activations, dtype=np.int16)\n', (964, 998), True, 'import numpy as np\n'), ((1064, 1098), 'pytrol.util.graphprocessor.build_tc_neighbours', 'gp.build_tc_neighbours', (['self.graph'], {}), '(self.graph)\n', (1086, 1098), True...
from os.path import join import cv2 import numpy as np from sklearn.utils import shuffle import config as cfg import random def trans_image(image, steer, trans_range): # Translation tr_x = trans_range * np.random.uniform() - trans_range / 2 steer_ang = steer + tr_x / trans_range * 0.4 tr_y = 40 * np.r...
[ "cv2.warpAffine", "random.choice", "sklearn.utils.shuffle", "numpy.zeros", "numpy.random.uniform", "cv2.resize", "numpy.float32" ]
[((359, 399), 'numpy.float32', 'np.float32', (['[[1, 0, tr_x], [0, 1, tr_y]]'], {}), '([[1, 0, tr_x], [0, 1, tr_y]])\n', (369, 399), True, 'import numpy as np\n'), ((415, 457), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'Trans_M', '(320, 160)'], {}), '(image, Trans_M, (320, 160))\n', (429, 457), False, 'import cv2\...
import numpy def predict_salary(payment_from, payment_to): if not payment_from and not payment_to: return None elif payment_from and payment_to: return numpy.mean([payment_from, payment_to]) elif payment_from: return payment_from * 1.2 else: return payment_to * 0.8
[ "numpy.mean" ]
[((178, 216), 'numpy.mean', 'numpy.mean', (['[payment_from, payment_to]'], {}), '([payment_from, payment_to])\n', (188, 216), False, 'import numpy\n')]
#!/usr/bin/env python import roslib; roslib.load_manifest('numpy_eigen'); roslib.load_manifest('rostest'); import numpy_eigen import numpy_eigen.test as npe import numpy import sys # http://docs.python.org/library/unittest.html#test-cases import unittest class TestEigen(unittest.TestCase): def assertMatrixClos...
[ "numpy.random.random", "numpy.abs", "rostest.rosrun", "roslib.load_manifest" ]
[((37, 72), 'roslib.load_manifest', 'roslib.load_manifest', (['"""numpy_eigen"""'], {}), "('numpy_eigen')\n", (57, 72), False, 'import roslib\n'), ((74, 105), 'roslib.load_manifest', 'roslib.load_manifest', (['"""rostest"""'], {}), "('rostest')\n", (94, 105), False, 'import roslib\n'), ((5140, 5194), 'rostest.rosrun', ...
import numpy as np from numpy.random import choice, uniform import json from enum import Enum import os import math from gtts import gTTS DIR = Enum('DIR', 'right left up down clock anticlock bigger smaller') ACTION = Enum('ACTION', 'shift rotate roll jump grow circle') SPEED = Enum('SPEED', 'slow fast') SHAPE = Enum(...
[ "os.listdir", "os.makedirs", "numpy.random.choice", "os.path.join", "os.path.isfile", "os.path.isdir", "enum.Enum", "numpy.random.uniform", "numpy.arange", "os.remove" ]
[((145, 209), 'enum.Enum', 'Enum', (['"""DIR"""', '"""right left up down clock anticlock bigger smaller"""'], {}), "('DIR', 'right left up down clock anticlock bigger smaller')\n", (149, 209), False, 'from enum import Enum\n'), ((219, 271), 'enum.Enum', 'Enum', (['"""ACTION"""', '"""shift rotate roll jump grow circle""...
import cv2 import numpy as np import pyrealsense2 as rs class DepthFiltering(): def __init__(self, temporal_smoothing=5): self.temporal_smoothing = temporal_smoothing self.dec_filter = rs.decimation_filter() # Decimation - reduces depth frame density self.spat_filter = rs.spatial_filter()...
[ "pyrealsense2.temporal_filter", "numpy.dstack", "pyrealsense2.decimation_filter", "pyrealsense2.hole_filling_filter", "cv2.convertScaleAbs", "numpy.hstack", "numpy.where", "pyrealsense2.disparity_transform", "cv2.imshow", "pyrealsense2.spatial_filter", "cv2.namedWindow" ]
[((207, 229), 'pyrealsense2.decimation_filter', 'rs.decimation_filter', ([], {}), '()\n', (227, 229), True, 'import pyrealsense2 as rs\n'), ((301, 320), 'pyrealsense2.spatial_filter', 'rs.spatial_filter', ([], {}), '()\n', (318, 320), True, 'import pyrealsense2 as rs\n'), ((409, 429), 'pyrealsense2.temporal_filter', 'r...
# -*- coding: utf-8 -*- import os import copy import odl import torch import numpy as np from math import ceil from tqdm import tqdm from warnings import warn from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from torch.optim.lr_scheduler import CyclicLR, OneCycleLR from dival...
[ "dival.measure.PSNR", "torch.max", "torch.min", "torch.nn.MSELoss", "torch.cuda.is_available", "torch.random.manual_seed", "torch.set_grad_enabled", "numpy.asarray", "warnings.warn", "odl.power_method_opnorm", "torch.cat", "torch.device", "math.ceil", "torch.load", "tqdm.tqdm", "os.pat...
[((499, 524), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (514, 524), False, 'import os\n'), ((5460, 5487), 'torch.random.manual_seed', 'torch.random.manual_seed', (['(1)'], {}), '(1)\n', (5484, 5487), False, 'import torch\n'), ((5998, 6016), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}...
import numpy as np import csv from collections import namedtuple import json import torch import torch.nn.utils.rnn as rnn_utils import torch.nn as nn import torch.optim as optim from torchsummary import summary from data_index import get_dataset, get_batch import data_index import math #import data_index.info as info ...
[ "torch.manual_seed", "os.path.exists", "torch.nn.ReLU", "math.ceil", "torch.nn.LSTM", "torch.load", "numpy.array", "torch.nn.utils.rnn.pack_padded_sequence", "data_index.get_batch", "torch.nn.Linear", "torchsummary.summary", "torch.nn.utils.rnn.pad_packed_sequence", "torch.device" ]
[((394, 427), 'torch.manual_seed', 'torch.manual_seed', (["config['seed']"], {}), "(config['seed'])\n", (411, 427), False, 'import torch\n'), ((3415, 3431), 'numpy.array', 'np.array', (['losses'], {}), '(losses)\n', (3423, 3431), True, 'import numpy as np\n'), ((3527, 3577), 'math.ceil', 'math.ceil', (["(data_index.TRA...
import pytest import numpy as np import discretisedfield as df import micromagneticmodel as mm class TestZeeman: @pytest.fixture(autouse=True) def _setup_calculator(self, calculator): self.calculator = calculator def setup(self): p1 = (-10e-9, -5e-9, -3e-9) p2 = (10e-9, 5e-9, 3e-9...
[ "micromagneticmodel.System", "numpy.sin", "discretisedfield.Field", "numpy.subtract", "numpy.cos", "pytest.fixture", "discretisedfield.Region", "micromagneticmodel.Zeeman", "discretisedfield.Mesh" ]
[((120, 148), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (134, 148), False, 'import pytest\n'), ((344, 367), 'discretisedfield.Region', 'df.Region', ([], {'p1': 'p1', 'p2': 'p2'}), '(p1=p1, p2=p2)\n', (353, 367), True, 'import discretisedfield as df\n'), ((795, 815), 'micromagn...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # test_recoverstats.py # # Copyright 2016 <NAME> <<EMAIL>> # import os import shlex import subprocess import sys sys.path.insert(0, os.path.abspath('..')) import numpy as np import matplotlib.pyplot as plt from scipy.stats import stats import sep from astropy.convol...
[ "propercoadd.SingleImage", "imsim.simtools.delta_point", "astropy.table.Table", "matplotlib.pyplot.ylabel", "photutils.daofind", "matplotlib.pyplot.imshow", "imsim.simtools.cartesian_product", "photutils.psf.IntegratedGaussianPRF", "matplotlib.pyplot.axhline", "numpy.linspace", "imsim.simtools.i...
[((2203, 2249), 'os.path.abspath', 'os.path.abspath', (['"""./test_images/recover_stats"""'], {}), "('./test_images/recover_stats')\n", (2218, 2249), False, 'import os\n'), ((2255, 2294), 'numpy.linspace', 'np.linspace', (['(5 * FWHM)', '(N - 5 * FWHM)', '(10)'], {}), '(5 * FWHM, N - 5 * FWHM, 10)\n', (2266, 2294), Tru...
import numpy as np import os.path as osp from unittest import TestCase from datumaro.components.project import Project from datumaro.components.extractor import Extractor, DatasetItem from datumaro.util.test_utils import TestDir from datumaro.util.image import save_image class ImageDirFormatTest(TestCase): clas...
[ "datumaro.util.test_utils.TestDir", "datumaro.components.project.Project.import_from", "os.path.join", "numpy.ones" ]
[((583, 592), 'datumaro.util.test_utils.TestDir', 'TestDir', ([], {}), '()\n', (590, 592), False, 'from datumaro.util.test_utils import TestDir\n'), ((824, 871), 'datumaro.components.project.Project.import_from', 'Project.import_from', (['test_dir.path', '"""image_dir"""'], {}), "(test_dir.path, 'image_dir')\n", (843, ...
import corner as triangle import numpy as np from matplotlib import rcParams run_name='Mtheory_nax20_DM_run1' chain=np.load(run_name+'.npy') nwalkers, nsteps,ndim = np.shape(chain) burnin = nsteps/4 # Make sample chain removing burnin combinedUSE=chain[:,burnin:,:].reshape((-1,ndim)) # Priors lFL3min,lFL3max=100.,11...
[ "numpy.exp", "numpy.shape", "numpy.load", "numpy.linspace" ]
[((117, 143), 'numpy.load', 'np.load', (["(run_name + '.npy')"], {}), "(run_name + '.npy')\n", (124, 143), True, 'import numpy as np\n'), ((166, 181), 'numpy.shape', 'np.shape', (['chain'], {}), '(chain)\n', (174, 181), True, 'import numpy as np\n'), ((1021, 1060), 'numpy.linspace', 'np.linspace', (['lFL3min', 'lFL3max...
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import numpy as np def slidingCoefficient(longSlipValue, latSlipValue, asymptoteValue, asymptoteSlipLong, asymptoteLatSlip): combinedSlip = np.sqrt(latSl...
[ "matplotlib.pyplot.figure", "numpy.sqrt", "numpy.arange", "matplotlib.pyplot.show" ]
[((1559, 1571), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1569, 1571), True, 'import matplotlib.pyplot as plt\n'), ((1607, 1632), 'numpy.arange', 'np.arange', (['(0.0)', '(0.9)', '(0.01)'], {}), '(0.0, 0.9, 0.01)\n', (1616, 1632), True, 'import numpy as np\n'), ((1637, 1658), 'numpy.arange', 'np.aran...
from __future__ import print_function from __future__ import division from . import _C import numpy as np import random from scipy.stats import t from copy import copy, deepcopy from fuzzytools import numba as ftnumba from . import flux_magnitude as flux_magnitude OBS_NOISE_RANGE = 1 CHECK = _C.CHECK MIN_POINTS_LIGHT...
[ "numpy.clip", "numpy.mean", "numpy.all", "numpy.random.choice", "numpy.where", "numpy.log", "numpy.argmax", "numpy.max", "numpy.argsort", "numpy.array", "random.random", "numpy.sum", "numpy.concatenate", "numpy.min", "numpy.argmin", "copy.copy" ]
[((1613, 1647), 'numpy.clip', 'np.clip', (['new_obs', 'min_lim', 'max_lim'], {}), '(new_obs, min_lim, max_lim)\n', (1620, 1647), True, 'import numpy as np\n'), ((1659, 1694), 'numpy.clip', 'np.clip', (['new_obs', 'obs_min_lim', 'None'], {}), '(new_obs, obs_min_lim, None)\n', (1666, 1694), True, 'import numpy as np\n'),...
import cv2 import numpy as np def projective_transform(img, points_img, points_another, width, height): """ 2画像間で射影変換を行う Parameters ---------- img : numpy.ndarray 入力画像 points_img: list of lists 画像 `img` における対応点 points_another : list of lists もう一方の画像における対応点 w...
[ "cv2.warpPerspective", "numpy.float32", "cv2.cvtColor", "cv2.findHomography" ]
[((661, 683), 'numpy.float32', 'np.float32', (['points_img'], {}), '(points_img)\n', (671, 683), True, 'import numpy as np\n'), ((705, 731), 'numpy.float32', 'np.float32', (['points_another'], {}), '(points_another)\n', (715, 731), True, 'import numpy as np\n'), ((763, 812), 'cv2.findHomography', 'cv2.findHomography', ...
import numpy as np import scipy.sparse as sp from scipy.sparse.linalg import eigsh def spec_proj(W,k,alg=3): n = W.shape[0] deg = sp.spdiags(np.sum(W,1).T,0,n,n) L = deg - W if alg == 1: E,V = eigsh(L,k,sigma=-1,tol=1e-6,return_eigenvectors=True) V1 = V elif alg == 2: E...
[ "numpy.sum", "numpy.multiply", "scipy.sparse.spdiags", "scipy.sparse.linalg.eigsh" ]
[((223, 281), 'scipy.sparse.linalg.eigsh', 'eigsh', (['L', 'k'], {'sigma': '(-1)', 'tol': '(1e-06)', 'return_eigenvectors': '(True)'}), '(L, k, sigma=-1, tol=1e-06, return_eigenvectors=True)\n', (228, 281), False, 'from scipy.sparse.linalg import eigsh\n'), ((150, 162), 'numpy.sum', 'np.sum', (['W', '(1)'], {}), '(W, 1...
# 4 of case study import numpy as np np.random.seed(123) # Starting step step = 50 # Roll the dice dice= np.random.randint(1,7) # Finish the control construct if dice <= 2 : step = step - 1 elif dice <=5 : step= step+1 else: step = step + np.random.randint(1,7) # Print out dice and step print(dice) prin...
[ "numpy.random.randint", "numpy.random.seed" ]
[((37, 56), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (51, 56), True, 'import numpy as np\n'), ((107, 130), 'numpy.random.randint', 'np.random.randint', (['(1)', '(7)'], {}), '(1, 7)\n', (124, 130), True, 'import numpy as np\n'), ((254, 277), 'numpy.random.randint', 'np.random.randint', (['(1)'...
import tarfile import numpy as np import os import sys import h5py from scipy import ndimage import random import pickle from matplotlib import pyplot as plt def maybe_extract(filename, force=False): root = os.path.splitext(os.path.splitext(filename)[0])[0] # remove .tar.gz if os.path.isdir(root) and not for...
[ "matplotlib.pyplot.imshow", "tarfile.open", "pickle.dump", "os.listdir", "scipy.ndimage.zoom", "matplotlib.pyplot.show", "os.path.join", "pickle.load", "os.path.splitext", "h5py.File", "scipy.ndimage.imread", "os.path.dirname", "matplotlib.pyplot.figure", "os.path.isdir", "numpy.ndarray"...
[((2678, 2732), 'random.randint', 'random.randint', (['(0)', '(single_digit_size - crop_digit_size)'], {}), '(0, single_digit_size - crop_digit_size)\n', (2692, 2732), False, 'import random\n'), ((3337, 3362), 'os.path.dirname', 'os.path.dirname', (['mat_file'], {}), '(mat_file)\n', (3352, 3362), False, 'import os\n'),...
import numpy as np import os from .utils.utils import get_yolo_boxes, makedirs def evaluate_full(model, generator, obj_thresh = 0.5, nms_thresh = 0.5, net_h = 416, net_w = 416, save_path = ""): # Predict box...
[ "numpy.where", "numpy.argmax", "os.path.split", "numpy.argsort", "numpy.array", "numpy.sum", "numpy.zeros", "os.path.isdir", "numpy.append", "numpy.concatenate", "numpy.expand_dims", "numpy.finfo", "numpy.cumsum", "numpy.maximum" ]
[((10891, 10908), 'numpy.maximum', 'np.maximum', (['iw', '(0)'], {}), '(iw, 0)\n', (10901, 10908), True, 'import numpy as np\n'), ((10918, 10935), 'numpy.maximum', 'np.maximum', (['ih', '(0)'], {}), '(ih, 0)\n', (10928, 10935), True, 'import numpy as np\n'), ((11595, 11633), 'numpy.concatenate', 'np.concatenate', (['([...
# -*- coding: utf-8 -*- """ Created on Mon Jun 11 21:43:14 2018 @author: robot """ import plotly.plotly as py import plotly.graph_objs as go import plotly import random import numpy as np import copy as cp import copy import readCfg.read_cfg as rd from IPython.display import HTML,display import colorlover as cl impo...
[ "readCfg.read_cfg.Read_Cfg", "plotly.plotly.image.save_as", "plotly.plotly.sign_in", "math.floor", "plotly.offline.plot", "colorlover.interp", "numpy.zeros", "copy.deepcopy" ]
[((6172, 6219), 'plotly.plotly.sign_in', 'py.sign_in', (['"""tesla_fox"""', '"""HOTRQ3nIOdYUUszDIfgN"""'], {}), "('tesla_fox', 'HOTRQ3nIOdYUUszDIfgN')\n", (6182, 6219), True, 'import plotly.plotly as py\n'), ((6316, 6340), 'readCfg.read_cfg.Read_Cfg', 'rd.Read_Cfg', (['cfgFileName'], {}), '(cfgFileName)\n', (6327, 6340...
from tabula import read_pdf import re import spacy from spacy import displacy from collections import Counter import en_core_web_sm nlp = en_core_web_sm.load() import PyPDF2 from dateutil import parser from fpdf import FPDF import locale locale.setlocale(locale.LC_ALL,'') import numpy as np import matplotlib as mpl imp...
[ "en_core_web_sm.load", "matplotlib.ticker.ScalarFormatter", "fpdf.FPDF", "tabula.read_pdf.getNumPages", "numpy.arange", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "matplotlib.pyplot.yscale", "PyPDF2.PdfFileReader", "dateutil.parser.parse", "matplotlib.pypl...
[((138, 159), 'en_core_web_sm.load', 'en_core_web_sm.load', ([], {}), '()\n', (157, 159), False, 'import en_core_web_sm\n'), ((238, 273), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '""""""'], {}), "(locale.LC_ALL, '')\n", (254, 273), False, 'import locale\n'), ((390, 445), 'tabula.read_pdf', 'read_pdf',...
from __future__ import division from __future__ import print_function import prettytensor as pt import tensorflow as tf import numpy as np import scipy.misc import os import sys from six.moves import range from progressbar import ETA, Bar, Percentage, ProgressBar from misc.config import cfg from misc.utils import mk...
[ "numpy.array", "progressbar.Percentage", "progressbar.ProgressBar", "tensorflow.summary.image", "tensorflow.random_normal", "tensorflow.train.Coordinator", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.concat", "tensorflow.ConfigProto", "sys.stdout.flush", "tensorflow.stack", "...
[((490, 552), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[]'], {'name': '"""generator_learning_rate"""'}), "(tf.float32, [], name='generator_learning_rate')\n", (504, 552), True, 'import tensorflow as tf\n'), ((619, 685), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[]'], {'name': '"""...
import numpy as np from matplotlib import pyplot from env import StochasticMAB # Use Bernoulli reward distribution, and Beta-Kernel for sampling def subsample_ts(total_time_slot, arm_num, seed=10): distribution = "Gaussian" bandit_model = StochasticMAB(n_arms=arm_num, random_type=distribution) total_rewar...
[ "numpy.sqrt", "env.StochasticMAB", "numpy.average", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.random.randint", "numpy.var", "matplotlib.pyplot.show" ]
[((249, 304), 'env.StochasticMAB', 'StochasticMAB', ([], {'n_arms': 'arm_num', 'random_type': 'distribution'}), '(n_arms=arm_num, random_type=distribution)\n', (262, 304), False, 'from env import StochasticMAB\n'), ((645, 693), 'numpy.random.randint', 'np.random.randint', (['(0)', 'arm_num', 'subsample_arm_num'], {}), ...
#!/usr/bin/env python3 from argparse import ArgumentParser import os import subprocess import numpy as np from transformers import RobertaTokenizer, RobertaModel import torch import tqdm from chg.db.database import get_store # fix odd fault... os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' def remove_color_ascii(msg...
[ "transformers.RobertaTokenizer.from_pretrained", "argparse.ArgumentParser", "subprocess.Popen", "tqdm.tqdm", "torch.stack", "pdb.post_mortem", "numpy.sum", "torch.tensor", "transformers.RobertaModel.from_pretrained", "torch.no_grad", "chg.db.database.get_store" ]
[((334, 443), 'subprocess.Popen', 'subprocess.Popen', (['"""sed \'s/\x1b\\\\[[0-9;]*m//g\'"""'], {'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE', 'shell': '(True)'}), '("sed \'s/\\x1b\\\\[[0-9;]*m//g\'", stdin=subprocess.PIPE,\n stdout=subprocess.PIPE, shell=True)\n', (350, 443), False, 'import subprocess\n...
# -*- coding: utf8 -*- # engine # helper class for cuatro # <NAME> 2021 import numpy as np import random import copy import time version = 'engine.v.1.0.0' class State: """instance attributes: size: int: size of one side of the board (defines a cube that holds the game) win: int: how many items in a row...
[ "numpy.array", "numpy.zeros", "time.time", "copy.deepcopy" ]
[((18413, 18432), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (18426, 18432), False, 'import copy\n'), ((2578, 2589), 'time.time', 'time.time', ([], {}), '()\n', (2587, 2589), False, 'import time\n'), ((2660, 2703), 'numpy.zeros', 'np.zeros', (['(self.size, self.size, self.size)'], {}), '((self.size, ...
""" Created on 16/03/2012 @author: victor """ import unittest import pyproct.clustering.test.data as test_data from pyproct.clustering.cluster import Cluster, cluster_from_tuple, get_cluster_sizes, gen_clusters_from_class_list import numpy from pyRMSD.condensedMatrix import CondensedMatrix import os class Test(unitt...
[ "pyproct.clustering.cluster.gen_clusters_from_class_list", "pyproct.clustering.cluster.Cluster.to_dic", "os.path.join", "pyproct.clustering.cluster.Cluster.from_dic", "pyproct.clustering.cluster.cluster_from_tuple", "pyRMSD.condensedMatrix.CondensedMatrix", "pyproct.clustering.cluster.Cluster", "unitt...
[((8271, 8286), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8284, 8286), False, 'import unittest\n'), ((383, 430), 'pyproct.clustering.cluster.Cluster', 'Cluster', ([], {'prototype': '(0)', 'elements': '[0, 4, 5, 7, 13]'}), '(prototype=0, elements=[0, 4, 5, 7, 13])\n', (390, 430), False, 'from pyproct.clusteri...
""" Code to plot average nearest neighbor distance between fish in a school as a function of group size - one line per water temperature. """ # imports import sys, os import numpy as np import matplotlib.pyplot as plt import pickle from matplotlib import cm in_dir1 = '../../output/temp_collective/roi/...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.locator_params", "matplotlib.pyplot.close", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((746, 762), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (755, 762), True, 'import matplotlib.pyplot as plt\n'), ((800, 827), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 8)'}), '(figsize=(12, 8))\n', (810, 827), True, 'import matplotlib.pyplot as plt\n'), ((1158, 1197...
import numpy as np import json from importlib import reload import os from models.core.tf_models.cae_model import CAE import pickle import tensorflow as tf import dill from collections import deque from models.core.tf_models import utils from scipy.interpolate import CubicSpline import time from models.core...
[ "tensorflow.train.Checkpoint", "numpy.array", "numpy.arange", "dill.load", "os.listdir", "numpy.repeat", "numpy.reshape", "collections.deque", "scipy.interpolate.CubicSpline", "numpy.stack", "numpy.random.seed", "numpy.concatenate", "numpy.ceil", "numpy.all", "pickle.load", "numpy.squa...
[((349, 366), 'importlib.reload', 'reload', (['cae_model'], {}), '(cae_model)\n', (355, 366), False, 'from importlib import reload\n'), ((3529, 3582), 'numpy.zeros', 'np.zeros', (['[st_arr.shape[0], steps_n, st_arr.shape[1]]'], {}), '([st_arr.shape[0], steps_n, st_arr.shape[1]])\n', (3537, 3582), True, 'import numpy as...
""" Artificial Intelligence for Humans Volume 2: Nature-Inspired Algorithms Python Version http://www.aifh.org http://www.jeffheaton.com Code repository: https://github.com/jeffheaton/aifh Copyright 2014 by <NAME> Licensed under the Apache License, Version 2.0 (the "License"); ...
[ "random.choice", "os.path.realpath", "numpy.array", "normalize.Normalize", "copy.deepcopy", "os.path.abspath", "random.random", "sys.path.append", "random.randint" ]
[((3424, 3500), 'os.path.abspath', 'os.path.abspath', (["(aifh_dir + os.sep + '..' + os.sep + 'lib' + os.sep + 'aifh')"], {}), "(aifh_dir + os.sep + '..' + os.sep + 'lib' + os.sep + 'aifh')\n", (3439, 3500), False, 'import os\n'), ((3501, 3526), 'sys.path.append', 'sys.path.append', (['aifh_dir'], {}), '(aifh_dir)\n', ...
# -*- coding: utf-8 -*- # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.stats import mode from sklearn.preprocessing import LabelEncoder from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.linear...
[ "numpy.mean", "pandas.read_csv", "matplotlib.pyplot.show", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.hlines", "xgboost.XGBRegressor", "matplotlib.pyplot.scatter", "matplotlib.pyplot.title", "pandas.concat", "sklearn.model_selection.cross_val_score" ]
[((2098, 2130), 'pandas.read_csv', 'pd.read_csv', (['"""data/train_av.csv"""'], {}), "('data/train_av.csv')\n", (2109, 2130), True, 'import pandas as pd\n'), ((2146, 2177), 'pandas.read_csv', 'pd.read_csv', (['"""data/test_av.csv"""'], {}), "('data/test_av.csv')\n", (2157, 2177), True, 'import pandas as pd\n'), ((3687,...
import sys import string import numpy as np import astropy.units as u from astropy.table import Column, Table from astropy.io import ascii from astropy.coordinates import SkyCoord from astroquery.simbad import Simbad from astroquery.esasky import ESASky from astroquery.gaia import Gaia star = sys.argv[1] #star = 'H...
[ "numpy.shape", "astropy.io.ascii.write", "astroquery.simbad.Simbad.query_object", "astroquery.gaia.Gaia.launch_job", "numpy.array", "astropy.table.Column", "sys.exit", "astroquery.simbad.Simbad.query_objectids", "astroquery.simbad.Simbad.add_votable_fields" ]
[((484, 579), 'astroquery.simbad.Simbad.add_votable_fields', 'Simbad.add_votable_fields', (['"""pm"""', '"""plx"""', '"""rv_value"""', '"""rvz_error"""', '"""flux(V)"""', '"""flux_error(V)"""'], {}), "('pm', 'plx', 'rv_value', 'rvz_error', 'flux(V)',\n 'flux_error(V)')\n", (509, 579), False, 'from astroquery.simbad ...
# -*- coding: utf-8 -*- """lhs_opt.py: Module to generate design matrix from an optimized Latin Hypercube design """ import numpy as np from . import lhs __author__ = "<NAME>" def create_ese(n: int, d: int, seed: int, max_outer: int, obj_function: str="w2_discrepancy", threshold_init: f...
[ "numpy.random.seed" ]
[((1869, 1889), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1883, 1889), True, 'import numpy as np\n')]
""" Created on Thu Apr 9 @author: nrw This plots residuals, And also takes shelved torque data, adds in torque estimate and residual data And writes it all to a CSV """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import plotly.plotly as py import plotly.offline as po import plotly.graph_o...
[ "plotly.tools.make_subplots", "numpy.sqrt", "numpy.hstack", "numpy.array_str", "sklearn.linear_model.Ridge", "plotly.graph_objs.Scatter", "sklearn.metrics.mean_squared_error", "numpy.dot", "shelve.open", "numpy.savetxt", "numpy.linalg.lstsq", "sklearn.metrics.mean_absolute_error", "sklearn.l...
[((1372, 1440), 'sklearn.linear_model.Ridge', 'Ridge', ([], {'fit_intercept': '(True)', 'alpha': '(1.0)', 'random_state': '(0)', 'normalize': '(True)'}), '(fit_intercept=True, alpha=1.0, random_state=0, normalize=True)\n', (1377, 1440), False, 'from sklearn.linear_model import Ridge\n'), ((1449, 1480), 'sklearn.linear_...
import numpy as np import random from collections import defaultdict class Agent: def __init__(self, nA=6): """ Initialize agent. Params ====== - nA: number of actions available to the agent """ self.nA = nA self.Q = defaultdict(lambda: np.zeros(self.nA)) ...
[ "random.random", "numpy.argmax", "numpy.zeros", "numpy.arange" ]
[((515, 530), 'random.random', 'random.random', ([], {}), '()\n', (528, 530), False, 'import random\n'), ((566, 590), 'numpy.argmax', 'np.argmax', (['self.Q[state]'], {}), '(self.Q[state])\n', (575, 590), True, 'import numpy as np\n'), ((301, 318), 'numpy.zeros', 'np.zeros', (['self.nA'], {}), '(self.nA)\n', (309, 318)...
# -*- coding: UTF-8 -*- """ 图像分类模型的训练主体 """ import paddle.fluid as fluid import numpy as np import paddle import reader import os import utils import config from ma_convcardseresnext import Ma_ConvCardSeResNeXt def build_optimizer(parameter_list=None): """ 构建优化器 :return: """ epoch = config.train_p...
[ "os.path.exists", "paddle.fluid.dygraph.load_dygraph", "paddle.fluid.dygraph.guard", "paddle.fluid.dygraph.to_variable", "paddle.fluid.layers.softmax", "os.path.join", "paddle.fluid.layers.cross_entropy", "ma_convcardseresnext.Ma_ConvCardSeResNeXt", "reader.custom_image_reader", "paddle.fluid.laye...
[((1127, 1166), 'utils.logger.info', 'utils.logger.info', (['"""use Adam optimizer"""'], {}), "('use Adam optimizer')\n", (1144, 1166), False, 'import utils\n'), ((2183, 2215), 'utils.logger.info', 'utils.logger.info', (['"""start train"""'], {}), "('start train')\n", (2200, 2215), False, 'import utils\n'), ((1396, 146...
import os from sys import argv import numpy as np from statistics import variance,mean # https://numpy.org/doc/stable/reference/generated/numpy.linalg.lstsq.html path = argv[1] pwd = os.environ["PWD"]+"/" list_of_files = [] for root, dirs, files in os.walk(pwd + path): for file in files: list_of_files.appe...
[ "os.path.join", "numpy.linalg.lstsq", "os.walk" ]
[((250, 269), 'os.walk', 'os.walk', (['(pwd + path)'], {}), '(pwd + path)\n', (257, 269), False, 'import os\n'), ((840, 873), 'numpy.linalg.lstsq', 'np.linalg.lstsq', (['A', 'y'], {'rcond': 'None'}), '(A, y, rcond=None)\n', (855, 873), True, 'import numpy as np\n'), ((323, 347), 'os.path.join', 'os.path.join', (['root'...
import sys from preprocess.ConjointTriad import ConjointTriad from preprocess.PreprocessUtils import readFasta from preprocess.PreprocessUtils import AllvsAllSim from preprocess.CTD_Composition import CTD_Composition from preprocess.CTD_Transition import CTD_Transition from preprocess.CTD_Distribution import CTD_...
[ "preprocess.EGBW.EGBW", "preprocess.SkipGram.SkipGram", "numpy.hstack", "preprocess.AutoCovariance.AutoCovariance", "preprocess.LDCTD.LDCTD", "preprocess.GearyAC.GearyAC", "preprocess.Chaos.Chaos", "preprocess.AAC.AAC", "preprocess.PSSMLST.PSSMLST", "preprocess.QuasiSequenceOrder.QuasiSequenceOrde...
[((1544, 1555), 'time.time', 'time.time', ([], {}), '()\n', (1553, 1555), False, 'import time\n'), ((1567, 1606), 'preprocess.PreprocessUtils.readFasta', 'readFasta', (["(folderName + 'allSeqs.fasta')"], {}), "(folderName + 'allSeqs.fasta')\n", (1576, 1606), False, 'from preprocess.PreprocessUtils import readFasta\n'),...
import sys import casadi import numpy as np import matplotlib.pyplot as plt from car_model import calc_wheel_centric_velocities, create_car_model, calc_sigma_xy, calc_wheel_centric_forces, \ calc_wheel_physics from car_sim_gen.constants import WheelConstants from acados_template.acados_ocp_formulation_helper imp...
[ "casadi.Function", "matplotlib.pyplot.show", "car_model.calc_wheel_centric_velocities", "acados_template.acados_ocp_formulation_helper.get_symbol_idx", "matplotlib.pyplot.gca", "car_model.calc_sigma_xy", "car_model.calc_wheel_physics", "matplotlib.pyplot.plot", "casadi.vertcat", "numpy.linspace", ...
[((371, 389), 'car_model.create_car_model', 'create_car_model', ([], {}), '()\n', (387, 389), False, 'from car_model import calc_wheel_centric_velocities, create_car_model, calc_sigma_xy, calc_wheel_centric_forces, calc_wheel_physics\n'), ((399, 418), 'casadi.MX.sym', 'casadi.MX.sym', (['"""vr"""'], {}), "('vr')\n", (4...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import math import operator, collections import numpy as np import scipy.ndimage import matplotlib.pyplot as plt from features import extract_features from save_features import feature_vector, dump, load, label_vec data_dir = '../data/CXR_png_complete/' # 0 -...
[ "save_features.feature_vector", "os.listdir", "numpy.unique", "math.floor", "save_features.label_vec", "matplotlib.pyplot.plot", "numpy.asarray", "numpy.argmax", "math.log", "matplotlib.pyplot.subplot", "numpy.sum", "matplotlib.pyplot.figure", "numpy.zeros", "operator.itemgetter", "numpy...
[((478, 491), 'matplotlib.pyplot.figure', 'plt.figure', (['(0)'], {}), '(0)\n', (488, 491), True, 'import matplotlib.pyplot as plt\n'), ((564, 586), 'matplotlib.pyplot.plot', 'plt.plot', (['vertical_sum'], {}), '(vertical_sum)\n', (572, 586), True, 'import matplotlib.pyplot as plt\n'), ((709, 738), 'features.extract_fe...
import numpy as np from . import torch_warp as t_warp import torch from torch.autograd import Variable import scipy # this file is to find the TVL1 energy of the optical flow vector def compute_flow_gradient(flowvector,pixelposx,pixelposy,imgwidth,imgheight): ux_grad = 0 uy_grad = 0 if pixelposx > 0 and ...
[ "numpy.array", "torch.norm", "torch.abs", "torch.Tensor" ]
[((1706, 1738), 'torch.Tensor', 'torch.Tensor', (['[ux_grad, uy_grad]'], {}), '([ux_grad, uy_grad])\n', (1718, 1738), False, 'import torch\n'), ((2104, 2146), 'torch.abs', 'torch.abs', (['(wrapped_first_image - img1.data)'], {}), '(wrapped_first_image - img1.data)\n', (2113, 2146), False, 'import torch\n'), ((2162, 218...
from abc import ABC, abstractmethod from functools import partial from typing import Union, Dict, Callable from contextlib import suppress from gzip import GzipFile from pathlib import Path import os import json import pickle import numpy as np from ..local import Storage __all__ = ( 'Serializer', 'SerializerEr...
[ "pickle.dumps", "json.dump", "json.dumps", "numpy.asarray", "pickle.load", "numpy.issubdtype", "gzip.GzipFile", "functools.partial", "contextlib.suppress", "json.load", "numpy.load", "numpy.save" ]
[((3641, 3658), 'numpy.asarray', 'np.asarray', (['value'], {}), '(value)\n', (3651, 3658), True, 'import numpy as np\n'), ((1778, 1795), 'json.dumps', 'json.dumps', (['value'], {}), '(value)\n', (1788, 1795), False, 'import json\n'), ((2483, 2502), 'pickle.dumps', 'pickle.dumps', (['value'], {}), '(value)\n', (2495, 25...
""" MAPSCI: Multipole Approach of Predicting and Scaling Cross Interactions Handles the primary functions """ import numpy as np import scipy.optimize as spo import logging logger = logging.getLogger(__name__) def calc_distance_array(bead_dict, tol=0.01, max_factor=2, lower_bound="rmin"): r""" Calculation...
[ "logging.getLogger", "numpy.mean", "numpy.sqrt", "scipy.optimize.brentq", "numpy.size", "numpy.log", "numpy.any", "mapsci.quick_plots.plot_potential", "numpy.diag", "numpy.array", "numpy.linspace", "numpy.zeros", "numpy.sum", "numpy.isnan", "numpy.finfo", "numpy.all", "mapsci.quick_p...
[((186, 213), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (203, 213), False, 'import logging\n'), ((2156, 2199), 'numpy.linspace', 'np.linspace', (['rm', '(max_factor * rm)'], {'num': '(10000)'}), '(rm, max_factor * rm, num=10000)\n', (2167, 2199), True, 'import numpy as np\n'), ((5069...
import cv2 import sys import numpy as np def videoAnnotate(vin): print('video in file: {}'.format(vin)) inFile = cv2.VideoCapture(vin) fOutname = '_'.join(['combined', vin]) print('video in file: {}'.format(vin)) print('video out file: {}'.format(fOutname)) #check if the...
[ "cv2.imwrite", "numpy.zeros", "cv2.VideoCapture", "cv2.VideoWriter_fourcc", "cv2.resize", "cv2.imread" ]
[((134, 155), 'cv2.VideoCapture', 'cv2.VideoCapture', (['vin'], {}), '(vin)\n', (150, 155), False, 'import cv2\n'), ((716, 747), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'MP4V'"], {}), "(*'MP4V')\n", (738, 747), False, 'import cv2\n'), ((1810, 1831), 'cv2.imread', 'cv2.imread', (['imgFname2'], {}), '(img...
import tarfile from datetime import timedelta from pathlib import Path from time import perf_counter import PIL.Image import h5py import numpy as np from tqdm import tqdm from torchdata.logger import log from torchdata.utils import download_file, remote_file, md5sum MPII_Joint_Names = ['right_ankle', 'right_knee', ...
[ "numpy.eye", "tarfile.open", "pathlib.Path", "tqdm.tqdm", "time.perf_counter", "numpy.ndim", "h5py.File", "torchdata.logger.log.info", "numpy.array", "datetime.timedelta", "numpy.matmul", "numpy.ndarray", "torchdata.utils.remote_file", "numpy.pad", "torchdata.utils.download_file", "tor...
[((1798, 1812), 'pathlib.Path', 'Path', (['data_dir'], {}), '(data_dir)\n', (1802, 1812), False, 'from pathlib import Path\n'), ((2959, 2973), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (2971, 2973), False, 'from time import perf_counter\n'), ((3146, 3182), 'torchdata.logger.log.info', 'log.info', (['"""[1/...
import unittest import numpy from oo_trees.dataset import Dataset from oo_trees.attribute import * from oo_trees.splitter import * class TestDataset(unittest.TestCase): def test_entropy(self): X = numpy.array([[0, 1], [0, 0]]) y = numpy.array(['H', 'T']) dataset = Dataset(X, y) c0, ...
[ "oo_trees.dataset.Dataset", "numpy.array", "numpy.testing.assert_array_equal" ]
[((210, 239), 'numpy.array', 'numpy.array', (['[[0, 1], [0, 0]]'], {}), '([[0, 1], [0, 0]])\n', (221, 239), False, 'import numpy\n'), ((252, 275), 'numpy.array', 'numpy.array', (["['H', 'T']"], {}), "(['H', 'T'])\n", (263, 275), False, 'import numpy\n'), ((294, 307), 'oo_trees.dataset.Dataset', 'Dataset', (['X', 'y'], ...
# -*- coding:utf-8 -*- import argparse import torch import os import cv2 import pyssim import codecs from scipy.ndimage import gaussian_filter from numpy.lib.stride_tricks import as_strided as ast from PIL import Image from torch.autograd import Variable import torch.nn as nn import numpy as np import time, math import...
[ "numpy.uint8", "torch.from_numpy", "numpy.array", "torch.cuda.is_available", "numpy.rot90", "math.log10", "os.path.exists", "numpy.mean", "os.listdir", "pyssim.compute_ssim", "argparse.ArgumentParser", "numpy.asarray", "os.mkdir", "collections.OrderedDict", "numpy.flipud", "model.sk_op...
[((457, 506), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SKNet Test"""'}), "(description='SKNet Test')\n", (480, 506), False, 'import argparse\n'), ((1281, 1292), 'time.time', 'time.time', ([], {}), '()\n', (1290, 1292), False, 'import time, math\n'), ((1335, 1393), 'codecs.open', 'c...
# coding=utf-8 # Copyright 2018 The Google AI Language Team 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 ...
[ "tensorflow.compat.v1.FixedLenSequenceFeature", "language.orqa.utils.bert_utils.pad_or_truncate", "language.orqa.utils.bert_utils.get_tokenizer", "tensorflow.compat.v1.cast", "tensorflow.compat.v1.parse_single_example", "tensorflow.compat.v1.cond", "tensorflow.compat.v1.random.uniform", "numpy.linspac...
[((1188, 1245), 'tensorflow.compat.v1.parse_single_example', 'tf.parse_single_example', (['serialized_example', 'feature_spec'], {}), '(serialized_example, feature_spec)\n', (1211, 1245), True, 'import tensorflow.compat.v1 as tf\n'), ((1526, 1572), 'language.orqa.utils.bert_utils.get_tokenizer', 'bert_utils.get_tokeniz...
import numpy as np from numpy.random import default_rng def random_crop(data, size, padding, rng=default_rng()): x = rng.integers(2 * padding, size=data.shape[:-3] + (1, 1, 1)) y = rng.integers(2 * padding, size=data.shape[:-3] + (1, 1, 1)) arange = np.arange(size) rows = x + arange.reshape((size, 1,...
[ "numpy.clip", "numpy.flip", "numpy.random.default_rng", "numpy.array", "numpy.pad", "numpy.zeros_like", "numpy.arange", "numpy.take_along_axis" ]
[((100, 113), 'numpy.random.default_rng', 'default_rng', ([], {}), '()\n', (111, 113), False, 'from numpy.random import default_rng\n'), ((265, 280), 'numpy.arange', 'np.arange', (['size'], {}), '(size)\n', (274, 280), True, 'import numpy as np\n'), ((414, 484), 'numpy.pad', 'np.pad', (['data', '(((0, 0),) * (data.ndim...
# Copyright (c) 2015, <NAME> (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from GPy.inference.latent_function_inference.var_dtc import VarDTC from GPy.util.linalg import jitchol, tdot, dtrtri, dtrtrs, backsub_both_sides,\ dpotrs, dpotri, symmetrify, mdot from GPy...
[ "logging.getLogger", "numpy.trace", "numpy.sqrt", "numpy.log", "paramz.caching.Cacher", "numpy.einsum", "GPy.util.linalg.jitchol", "numpy.dot", "numpy.eye", "numpy.ones", "ipdb.set_trace", "numpy.square", "GPy.util.linalg.symmetrify", "GPy.util.linalg.mdot", "GPy.util.linalg.dtrtri", "...
[((492, 509), 'numpy.log', 'np.log', (['(2 * np.pi)'], {}), '(2 * np.pi)\n', (498, 509), True, 'import numpy as np\n'), ((543, 570), 'logging.getLogger', 'logging.getLogger', (['"""vardtc"""'], {}), "('vardtc')\n", (560, 570), False, 'import logging, itertools\n'), ((9570, 9596), 'numpy.dot', 'np.dot', (['data_term', '...
# -*-coding:utf8-*- """ author:zhangyu 用线性模型检查文件,在测试中 email:<EMAIL> """ from __future__ import division import numpy as np from sklearn.externals import joblib import math import sys sys.path.append("../") import LR.util.get_feature_num as gf def get_test_data(test_file: str, feature_num_file: str): """ Arg...
[ "sys.exit", "numpy.genfromtxt", "LR.util.get_feature_num.get_feature_num", "sklearn.externals.joblib.load", "numpy.dot", "numpy.frompyfunc", "math.exp", "sys.path.append" ]
[((185, 207), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (200, 207), False, 'import sys\n'), ((437, 473), 'LR.util.get_feature_num.get_feature_num', 'gf.get_feature_num', (['feature_num_file'], {}), '(feature_num_file)\n', (455, 473), True, 'import LR.util.get_feature_num as gf\n'), ((491, ...
from credentials.blob_credentials import facts_sas_token, facts_container from azure.storage.blob import ContainerClient, BlobClient import pandas as pd import os import json import colorsys import random import numpy as np import cv2 import imageio from matplotlib import patches from matplotlib.patches import Polygon ...
[ "azure.storage.blob.BlobClient", "cv2.filter2D", "colorsys.hsv_to_rgb", "numpy.array", "cv2.imdecode", "numpy.arange", "matplotlib.pyplot.imshow", "os.path.exists", "numpy.max", "matplotlib.pyplot.close", "numpy.stack", "cv2.contourArea", "azure.storage.blob.ContainerClient", "pandas.DataF...
[((552, 656), 'azure.storage.blob.ContainerClient', 'ContainerClient', ([], {'account_url': 'account_url', 'container_name': 'facts_container', 'credential': 'facts_sas_token'}), '(account_url=account_url, container_name=facts_container,\n credential=facts_sas_token)\n', (567, 656), False, 'from azure.storage.blob i...
# -*- coding: UTF-8 -*- """ 此脚本用于展示使用惩罚项解决模型幻觉的问题 """ import os import numpy as np import statsmodels.api as sm from sklearn import linear_model import matplotlib.pyplot as plt import pandas as pd def read_data(path): """ 使用pandas读取数据 """ data = pd.read_csv(path) return data def generate_rand...
[ "sklearn.linear_model.Lasso", "pandas.read_csv", "numpy.arange", "numpy.array", "numpy.random.randint", "matplotlib.pyplot.figure", "statsmodels.api.add_constant", "numpy.random.seed", "os.path.abspath", "numpy.logspace", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((267, 284), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (278, 284), True, 'import pandas as pd\n'), ((363, 383), 'numpy.random.seed', 'np.random.seed', (['(4873)'], {}), '(4873)\n', (377, 383), True, 'import numpy as np\n'), ((395, 424), 'numpy.random.randint', 'np.random.randint', (['(2)'], {'size'...
import pytz import sys import numpy as np from datetime import datetime from metrics import utils QUERY_CONTENT = '*' # return a list of throughputs computed per call def get_service_throughput_per_hit(service, computation_timestamp, time_window): print(service,file=sys.stderr) query_ids = QUERY_CONTENT + f'...
[ "metrics.utils.es_query", "metrics.utils.parse_timestamp", "metrics.utils.extract_vdc_id", "datetime.datetime.now", "numpy.array", "metrics.utils.get_services", "metrics.utils.get_blueprint_id", "metrics.utils.get_timestamp_timewindow" ]
[((395, 426), 'metrics.utils.es_query', 'utils.es_query', ([], {'query': 'query_ids'}), '(query=query_ids)\n', (409, 426), False, 'from metrics import utils\n'), ((475, 523), 'metrics.utils.es_query', 'utils.es_query', ([], {'query': 'query_ids', 'size': 'total_hits'}), '(query=query_ids, size=total_hits)\n', (489, 523...
import numpy as np def lonlat2km(lon1,lat1,lon2,lat2): con=radians(lat1) ymeter=111132.92-559.8*np.cos(2*con)+1.175*np.cos(4*con)-0.0023*np.cos(6*con) xmeter=111412.84*np.cos(con)-93.5*np.cos(3*con)+0.0118*np.cos(5*con) east=(lon2-lon1)*xmeter/1000 north=(lat2-lat1)*ymeter/1000 return eas...
[ "numpy.cos" ]
[((148, 163), 'numpy.cos', 'np.cos', (['(6 * con)'], {}), '(6 * con)\n', (154, 163), True, 'import numpy as np\n'), ((222, 237), 'numpy.cos', 'np.cos', (['(5 * con)'], {}), '(5 * con)\n', (228, 237), True, 'import numpy as np\n'), ((127, 142), 'numpy.cos', 'np.cos', (['(4 * con)'], {}), '(4 * con)\n', (133, 142), True,...
#!/usr/bin/env python import numpy as np from pycrazyswarm import * def test_yaml_string_load(): crazyflies_yaml = """ crazyflies: - channel: 100 id: 1 initialPosition: [1.0, 0.0, 0.0] - channel: 100 id: 10 initialPosition: [0.0, -1.0, 0.0] """ swarm = Crazyswarm(craz...
[ "numpy.all" ]
[((536, 582), 'numpy.all', 'np.all', (['(cf1.initialPosition == [1.0, 0.0, 0.0])'], {}), '(cf1.initialPosition == [1.0, 0.0, 0.0])\n', (542, 582), True, 'import numpy as np\n'), ((615, 663), 'numpy.all', 'np.all', (['(cf10.initialPosition == [0.0, -1.0, 0.0])'], {}), '(cf10.initialPosition == [0.0, -1.0, 0.0])\n', (621...
import numpy as np import netket as nk import sys from shutil import move import mpi4py.MPI as mpi import symmetries L = 150 msr = True rank = mpi.COMM_WORLD.Get_rank() if rank == 0: with open("result.txt", "w") as fl: fl.write("L, energy (real), energy (imag), energy_error\n") g = nk.graph.Hypercube(le...
[ "netket.custom.J1J2", "netket.graph.Hypercube", "numpy.imag", "netket.optimizer.Sgd", "netket.hilbert.Spin", "numpy.real", "netket.custom.get_symms_chain", "netket.machine.JastrowSymm", "netket.variational.estimate_expectations", "numpy.load", "mpi4py.MPI.COMM_WORLD.Get_rank", "netket.sampler....
[((145, 170), 'mpi4py.MPI.COMM_WORLD.Get_rank', 'mpi.COMM_WORLD.Get_rank', ([], {}), '()\n', (168, 170), True, 'import mpi4py.MPI as mpi\n'), ((299, 346), 'netket.graph.Hypercube', 'nk.graph.Hypercube', ([], {'length': 'L', 'n_dim': '(1)', 'pbc': '(True)'}), '(length=L, n_dim=1, pbc=True)\n', (317, 346), True, 'import ...
from pyexpat import features import numpy as np from src.io import npy_events_tools from src.io import psee_loader import tqdm import os from numpy.lib import recfunctions as rfn import torch import time import math import argparse def generate_agile_event_volume_cuda(events, shape, events_window = 50000, volume_bins...
[ "numpy.fromfile", "torch.nn.functional.interpolate", "torch.arange", "os.path.exists", "os.listdir", "argparse.ArgumentParser", "numpy.where", "numpy.stack", "torch.zeros_like", "pyexpat.features.astype", "src.io.psee_loader.PSEELoader", "torch.abs", "numpy.nonzero", "torch.cuda.empty_cach...
[((1558, 1582), 'numpy.nonzero', 'np.nonzero', (['dense_tensor'], {}), '(dense_tensor)\n', (1568, 1582), True, 'import numpy as np\n'), ((1763, 1866), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""visualize one or several event files along with their boxes"""'}), "(description=\n 'vi...
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt # Data preprocessing data = pd.read_csv("RealEstate.csv") # Converting Pandas dataframe to numpy array X = data.loc[:, ['Bedrooms', 'Bathrooms',...
[ "numpy.mean", "pandas.read_csv", "sklearn.model_selection.train_test_split", "numpy.array", "sklearn.linear_model.LinearRegression" ]
[((203, 232), 'pandas.read_csv', 'pd.read_csv', (['"""RealEstate.csv"""'], {}), "('RealEstate.csv')\n", (214, 232), True, 'import pandas as pd\n'), ((429, 483), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'Y'], {'test_size': '(0.33)', 'random_state': '(0)'}), '(X, Y, test_size=0.33, random_st...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os import matplotlib.pyplot as plt import numpy as np import torch import torchvision.datasets.folder from PIL import Image, ImageFile from torch.utils.data import TensorDataset from torchvision import transforms from torchvision.datasets i...
[ "torchvision.transforms.ToPILImage", "numpy.hstack", "torchvision.transforms.ColorJitter", "numpy.array", "torchvision.transforms.functional.rotate", "numpy.sin", "numpy.divide", "numpy.random.RandomState", "matplotlib.pyplot.imshow", "numpy.multiply", "numpy.stack", "torchvision.datasets.Imag...
[((2642, 2682), 'torchvision.datasets.CIFAR10', 'CIFAR10', (['root'], {'train': '(True)', 'download': '(True)'}), '(root, train=True, download=True)\n', (2649, 2682), False, 'from torchvision.datasets import MNIST, ImageFolder, CIFAR10\n'), ((2713, 2754), 'torchvision.datasets.CIFAR10', 'CIFAR10', (['root'], {'train': ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Reference: <NAME>, et al. "Pixeldefend: Leveraging generative models to understand and defend against adversarial examples," in ICLR, 2018. # Reference Implementation from Authors (TensorFlow): https://github.com/yang-song/pixeldefend # ***********************************...
[ "os.path.exists", "numpy.copy", "Defenses.DefenseMethods.External.pixel_cnn_pp.utils.decode", "torch.gt", "torch.nn.DataParallel", "torch.from_numpy", "Defenses.DefenseMethods.External.pixel_cnn_pp.utils.load_part_of_model", "numpy.array", "torch.range", "Defenses.DefenseMethods.External.pixel_cnn...
[((1955, 1992), 'torch.nn.DataParallel', 'nn.DataParallel', (['self.pixel_cnn_model'], {}), '(self.pixel_cnn_model)\n', (1970, 1992), True, 'import torch.nn as nn\n'), ((2323, 2363), 'os.path.exists', 'os.path.exists', (['pixel_cnn_model_location'], {}), '(pixel_cnn_model_location)\n', (2337, 2363), False, 'import os\n...
# -*- coding: utf-8 -*- """ """ import os from datetime import datetime from typing import Union, Optional, Any, List, NoReturn from numbers import Real import wfdb import numpy as np np.set_printoptions(precision=5, suppress=True) import pandas as pd from ..utils.common import ( ArrayLike, get_record_list_re...
[ "numpy.set_printoptions" ]
[((185, 232), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(5)', 'suppress': '(True)'}), '(precision=5, suppress=True)\n', (204, 232), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- import os import math import codecs import random import numpy as np from glob import glob from PIL import Image from keras.utils import np_utils, Sequence from sklearn.model_selection import train_test_split class BaseSequence(Sequence): """ 基础的数据流生成器,每次迭代返回一个batch BaseSequence可直...
[ "PIL.Image.fromarray", "PIL.Image.open", "random.shuffle", "sklearn.model_selection.train_test_split", "os.path.join", "numpy.array", "keras.utils.np_utils.to_categorical", "os.path.basename", "numpy.full", "codecs.open", "numpy.random.shuffle" ]
[((2422, 2449), 'random.shuffle', 'random.shuffle', (['label_files'], {}), '(label_files)\n', (2436, 2449), False, 'import random\n'), ((2974, 3018), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['labels', 'num_classes'], {}), '(labels, num_classes)\n', (2997, 3018), False, 'from keras.utils impor...