code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#!/usr/bin/env python from __future__ import print_function import rospy import yaml import numpy as np #np.dot import os.path from math import cos, sin from sensor_msgs.msg import JointState from integ_gkd_models.srv import Dynamic_inverse,Dynamic_inverseResponse path=os.path.dirname(__file__) with open(os.path.jo...
[ "integ_gkd_models.srv.Dynamic_inverseResponse", "rospy.init_node", "sensor_msgs.msg.JointState", "rospy.Service", "math.cos", "yaml.safe_load", "numpy.dot", "numpy.linalg.inv", "rospy.spin", "math.sin" ]
[((367, 384), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (381, 384), False, 'import yaml\n'), ((1142, 1154), 'sensor_msgs.msg.JointState', 'JointState', ([], {}), '()\n', (1152, 1154), False, 'from sensor_msgs.msg import JointState\n'), ((1244, 1275), 'integ_gkd_models.srv.Dynamic_inverseResponse', 'Dyna...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 29 18:13:24 2021 @author: tae-jun_yoon """ import numpy as np from scipy.signal import savgol_filter from scipy.optimize import newton from PyOECP import References def ListReferences(): AvailableReferences = dir(References) for EachRefer...
[ "numpy.copy", "numpy.log10", "numpy.ones", "numpy.imag", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "scipy.optimize.newton", "numpy.array", "matplotlib.pyplot.figure", "numpy.real", "matplotlib.pyplot.title", "pprint.pprint", "matplotlib.pyplot.show" ]
[((688, 723), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 5)', 'dpi': '(250)'}), '(figsize=(5, 5), dpi=250)\n', (698, 723), True, 'import matplotlib.pyplot as plt\n'), ((738, 762), 'numpy.array', 'np.array', (['[1000000000.0]'], {}), '([1000000000.0])\n', (746, 762), True, 'import numpy as np\n'), (...
""" Script for training the TempDPSOM model Tensorboard instructions: - from command line run: tensorboard --logdir="logs/{EXPERIMENT_NAME}/train" --port 8011 - go to: http://localhost:8011/ """ import uuid import sys import timeit from datetime import date import numpy as np try: import tensorflow.compat.v1 a...
[ "TempDPSOM_model.TDPSOM", "numpy.array", "sacred.stflow.LogFileWriter", "sys.exit", "sklearn.metrics.normalized_mutual_info_score", "numpy.arange", "numpy.mean", "numpy.reshape", "tensorflow.Session", "math.isnan", "numpy.exp", "numpy.stack", "utils.print_trainable_vars", "tensorflow.get_d...
[((844, 873), 'sacred.Experiment', 'sacred.Experiment', (['"""hyperopt"""'], {}), "('hyperopt')\n", (861, 873), False, 'import sacred\n'), ((330, 354), 'tensorflow.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (352, 354), True, 'import tensorflow as tf\n'), ((894, 956), 'sacred.observers.FileStorage...
import pandas as pd import numpy as np from sklearn.preprocessing import OneHotEncoder from datasets.dataset import Dataset class AdultDataset(Dataset): def __init__(self): super().__init__(name="Adult Census", description="The Adult Census dataset") self.cat_mappings = { "education...
[ "sklearn.preprocessing.OneHotEncoder", "numpy.sort", "numpy.array", "numpy.zeros", "numpy.concatenate", "pandas.DataFrame", "numpy.genfromtxt" ]
[((3298, 3426), 'numpy.genfromtxt', 'np.genfromtxt', (['"""https://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data"""'], {'delimiter': '""", """', 'dtype': 'str'}), "(\n 'https://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data'\n , delimiter=', ', dtype=str)\n", (3311, 3426),...
import rasterio as rio import rasterio.mask as riom import rasterio.plot as riop from rasterio.transform import Affine import matplotlib.pyplot as plt import fiona as fio import numpy as np import geopandas as gpd from shapely.geometry import Polygon import os from IPython import embed class DatasetManipulator: d...
[ "matplotlib.pyplot.text", "matplotlib.pyplot.show", "rasterio.open", "matplotlib.pyplot.plot", "numpy.squeeze", "rasterio.plot.show", "shapely.geometry.Polygon", "fiona.open", "numpy.moveaxis", "rasterio.mask.mask", "numpy.pad", "matplotlib.pyplot.subplots", "numpy.arange", "rasterio.trans...
[((538, 560), 'rasterio.open', 'rio.open', (['dataset_path'], {}), '(dataset_path)\n', (546, 560), True, 'import rasterio as rio\n'), ((4520, 4611), 'numpy.pad', 'np.pad', (['array', '((0, 0), (0, pad_ver), (0, pad_hor))'], {'mode': '"""constant"""', 'constant_values': '(0)'}), "(array, ((0, 0), (0, pad_ver), (0, pad_h...
import pickle from sklearn.decomposition import PCA import numpy as np class PCA_reduction: def __init__(self, pca_path): self.pca_reload = pickle.load(open(pca_path,'rb')) def reduce_size(self, vector): return self.pca_reload.transform([vector])[0] @staticmethod def create_new_pca_model(vectors, path_to_sa...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "sklearn.decomposition.PCA", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.axhline", "matplotlib.pyplot.figure", "numpy.cumsum", "matplotlib.pyplot.title", "sklearn.preprocessing.MinMaxScaler" ]
[((406, 420), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {}), '()\n', (418, 420), False, 'from sklearn.preprocessing import MinMaxScaler\n'), ((478, 515), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': 'percentage_variance'}), '(n_components=percentage_variance)\n', (481, 515), False, 'from s...
import matplotlib.pyplot as pl import anndata as ad import pandas as pd import numpy as np import scanpy as sc import scvelo as scv from scipy.sparse import issparse import matplotlib.gridspec as gridspec from scipy.stats import gaussian_kde, spearmanr, pearsonr from goatools.obo_parser import GODag from goatools.anno....
[ "pandas.read_csv", "gzip.open", "goatools.obo_parser.GODag", "numpy.isin", "scipy.interpolate.interp1d", "numpy.array", "scanpy.tl.score_genes_cell_cycle", "csv.Sniffer", "pandas.read_excel", "pandas.unique", "goatools.anno.genetogo_reader.Gene2GoReader", "numpy.mean", "scipy.stats.gaussian_...
[((953, 970), 'scipy.sparse.issparse', 'issparse', (['adata.X'], {}), '(adata.X)\n', (961, 970), False, 'from scipy.sparse import issparse\n'), ((2807, 2915), 'pandas.read_excel', 'pd.read_excel', (["(signatures_path + '/colonoid_cancer_uhlitz_markers_revised.xlsx')"], {'skiprows': '(1)', 'index_col': '(0)'}), "(signat...
""" Author: <NAME> and <NAME> E-mail author: <EMAIL> Last Modified: May 7 2020 """ import math import pandas as pd import motmetrics as mm import numpy as np from collections import defaultdict from Metrics import Metrics """ Create individual metrics class for new challenge. The new metrics class inherits functiona...
[ "motmetrics.MOTAccumulator", "numpy.log10", "numpy.asarray", "numpy.zeros", "motmetrics.metrics.create", "numpy.linalg.norm", "math.isnan" ]
[((8546, 8578), 'motmetrics.MOTAccumulator', 'mm.MOTAccumulator', ([], {'auto_id': '(False)'}), '(auto_id=False)\n', (8563, 8578), True, 'import motmetrics as mm\n'), ((13173, 13197), 'numpy.zeros', 'np.zeros', (['(X_ele, Y_ele)'], {}), '((X_ele, Y_ele))\n', (13181, 13197), True, 'import numpy as np\n'), ((13660, 13679...
# -*- coding: utf-8 -*- import unittest import sys import os import multiprocessing import tempfile import time import random import numpy as np if __name__ == '__main__': # add ../.. directory to python path such that we can import the main # module HERE = os.path.dirname(os.path.realpath(__file__)) ...
[ "numpy.all", "sys.path.insert", "numpy.random.random", "unittest.TextTestRunner", "multiprocessing.Process", "os.path.join", "time.sleep", "os.path.realpath", "tempfile.gettempdir", "numpy.empty", "random.random", "h5pyswmr.File", "unittest.TestLoader" ]
[((382, 411), 'sys.path.insert', 'sys.path.insert', (['(0)', 'PROJ_PATH'], {}), '(0, PROJ_PATH)\n', (397, 411), False, 'import sys\n'), ((289, 315), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (305, 315), False, 'import os\n'), ((349, 376), 'os.path.join', 'os.path.join', (['HERE', '"""....
from scipy.misc import comb import math def ensemble_error(n_classifier, error): k_start = int(math.ceil(n_classifier / 2.)) probs = [comb(n_classifier, k) * error ** k * (1 - error) ** (n_classifier - k) for k in range(k_start, n_classifier + 1)] return sum(probs) import numpy as np error...
[ "matplotlib.pyplot.grid", "math.ceil", "scipy.misc.comb", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((329, 355), 'numpy.arange', 'np.arange', (['(0.0)', '(1.01)', '(0.01)'], {}), '(0.0, 1.01, 0.01)\n', (338, 355), True, 'import numpy as np\n'), ((489, 559), 'matplotlib.pyplot.plot', 'plt.plot', (['error_range', 'ens_errors'], {'label': '"""Ensemble error"""', 'linewidth': '(2)'}), "(error_range, ens_errors, label='E...
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
[ "numpy.prod", "nnunet.training.loss_functions.dice_loss.DC_and_CE_loss", "torch.rand", "torch.nn.ModuleList", "monai.networks.nets.ViT", "monai.networks.blocks.UnetrPrUpBlock", "monai.networks.blocks.UnetrUpBlock", "numpy.array", "torch.no_grad", "nnunet.network_architecture.generic_modular_UNet.g...
[((16605, 16678), 'nnunet.training.loss_functions.dice_loss.DC_and_CE_loss', 'DC_and_CE_loss', (["{'batch_dice': True, 'smooth': 1e-05, 'do_bg': False}", '{}'], {}), "({'batch_dice': True, 'smooth': 1e-05, 'do_bg': False}, {})\n", (16619, 16678), False, 'from nnunet.training.loss_functions.dice_loss import DC_and_CE_lo...
""" DANet for image segmentation, implemented in Chainer. Original paper: 'Dual Attention Network for Scene Segmentation,' https://arxiv.org/abs/1809.02983. """ __all__ = ['DANet', 'danet_resnetd50b_cityscapes', 'danet_resnetd101b_cityscapes'] import os import chainer.functions as F from chainer import link ...
[ "chainer.functions.max", "chainer.functions.batch_matmul", "os.path.join", "chainer.functions.softmax", "numpy.zeros", "functools.partial", "chainer.functions.resize_images", "chainer.initializers._get_initializer", "chainer.variable.Parameter" ]
[((8388, 8427), 'os.path.join', 'os.path.join', (['"""~"""', '""".chainer"""', '"""models"""'], {}), "('~', '.chainer', 'models')\n", (8400, 8427), False, 'import os\n'), ((2543, 2592), 'chainer.functions.batch_matmul', 'F.batch_matmul', (['proj_query', 'proj_key'], {'transa': '(True)'}), '(proj_query, proj_key, transa...
import numpy as np import cv2 #K&D for the wide angle camera used DIM=(1920, 1080) K=np.array([[1276.399158532128, 0.0, 930.054799272954], [0.0, 1274.1510638009997, 510.7404213142207], [0.0, 0.0, 1.0]]) D=np.array([[0.10664484858106192], [-2.4113027405249046], [12.185556649445054], [-20.93957191606188]]) cap = cv2.Vi...
[ "cv2.imwrite", "numpy.eye", "cv2.remap", "cv2.imshow", "numpy.array", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.waitKey" ]
[((86, 208), 'numpy.array', 'np.array', (['[[1276.399158532128, 0.0, 930.054799272954], [0.0, 1274.1510638009997, \n 510.7404213142207], [0.0, 0.0, 1.0]]'], {}), '([[1276.399158532128, 0.0, 930.054799272954], [0.0, \n 1274.1510638009997, 510.7404213142207], [0.0, 0.0, 1.0]])\n', (94, 208), True, 'import numpy as ...
from time import time import math, os from utils import * import scanpy as sc from sklearn import metrics from sklearn.cluster import KMeans import torch import torch.nn as nn from torch.autograd import Variable from torch.nn import Parameter import torch.nn.functional as F import torch.optim as optim from torch.utils....
[ "preprocess.read_dataset", "sklearn.metrics.adjusted_rand_score", "numpy.array", "sklearn.metrics.normalized_mutual_info_score", "preprocess.normalize", "os.path.exists", "argparse.ArgumentParser", "scanpy.AnnData", "scipy.spatial.distance_matrix", "h5py.File", "numpy.savetxt", "numpy.transpos...
[((592, 697), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""train"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='train', formatter_class=argparse.\n ArgumentDefaultsHelpFormatter)\n", (615, 697), False, 'import argparse\n'), ((1990, 2015), 'h5py.Fi...
import numpy as np import matplotlib.patches as mpatches from matplotlib.colors import LinearSegmentedColormap from scipy import stats """ Load 8 simulations (main experiment) print for each simulation: SimID: Performance(mean,std) rejcetedBlocks maxMinDist """ #load data folder1='2020_09_23_mainExperiment_fina...
[ "numpy.max", "numpy.mean", "numpy.zeros", "numpy.std" ]
[((414, 430), 'numpy.zeros', 'np.zeros', (['(8, 2)'], {}), '((8, 2))\n', (422, 430), True, 'import numpy as np\n'), ((445, 456), 'numpy.zeros', 'np.zeros', (['(8)'], {}), '(8)\n', (453, 456), True, 'import numpy as np\n'), ((468, 479), 'numpy.zeros', 'np.zeros', (['(8)'], {}), '(8)\n', (476, 479), True, 'import numpy a...
from util import * import numpy as np import cv2 def questao9A(img): ''' aplicar o filtro 0 -1 0 + + -1 5 -1 + + 0 -1 0 ''' kernel = np.array(([0,-1,0],[-1, 5, -1],[ 0, -1, 0])) return applyFilter3x3(img, kernel) def questao9B(img): ''' aplicar o filtro 0 0 0 + + 0 1 ...
[ "numpy.array", "cv2.filter2D" ]
[((164, 211), 'numpy.array', 'np.array', (['([0, -1, 0], [-1, 5, -1], [0, -1, 0])'], {}), '(([0, -1, 0], [-1, 5, -1], [0, -1, 0]))\n', (172, 211), True, 'import numpy as np\n'), ((359, 403), 'numpy.array', 'np.array', (['([0, 0, 0], [0, 1, 0], [0, 0, -1])'], {}), '(([0, 0, 0], [0, 1, 0], [0, 0, -1]))\n', (367, 403), Tr...
# Copyright: (c) 2021, <NAME> import numpy as np import sys sys.path.append('../../pyCuSDR') from lib import * packetData = lambda: createBitSequence(10000,seed=123) # gives us a default 10000 bit length packet zeropad = lambda sig,n: np.concatenate((np.zeros(n),sig,np.zeros(n))) # pre and post pad signal with zer...
[ "numpy.random.get_state", "numpy.log10", "numpy.random.set_state", "numpy.sqrt", "numpy.array", "sys.path.append", "numpy.mod", "numpy.repeat", "numpy.exp", "numpy.random.seed", "numpy.concatenate", "numpy.tile", "numpy.abs", "numpy.ones", "numpy.iscomplexobj", "numpy.sum", "numpy.ra...
[((62, 94), 'sys.path.append', 'sys.path.append', (['"""../../pyCuSDR"""'], {}), "('../../pyCuSDR')\n", (77, 94), False, 'import sys\n'), ((730, 761), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2)', 'n_bits'], {}), '(0, 2, n_bits)\n', (747, 761), True, 'import numpy as np\n'), ((2078, 2111), 'numpy.array',...
import numpy as np import numpy.testing as npt from stumpy import core import pytest def naive_rolling_window_dot_product(Q, T): window = len(Q) result = np.zeros(len(T) - window + 1) for i in range(len(result)): result[i] = np.dot(T[i:i + window], Q) return result test_data = [ (np.array(...
[ "stumpy.core.compute_mean_std", "stumpy.core.calculate_distance_profile", "stumpy.core.z_norm", "numpy.square", "pytest.mark.parametrize", "numpy.testing.assert_almost_equal", "numpy.dot", "stumpy.core.sliding_dot_product", "numpy.array", "numpy.sum", "numpy.random.uniform", "stumpy.core.rolli...
[((570, 612), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""Q, T"""', 'test_data'], {}), "('Q, T', test_data)\n", (593, 612), False, 'import pytest\n'), ((785, 827), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""Q, T"""', 'test_data'], {}), "('Q, T', test_data)\n", (808, 827), False, 'import...
from .tree_utils import load_tree from .tree import * from anytree import NodeMixin, RenderTree, render import pickle """ Operator test functions * root : currently empty root node of a tree * _a : does nothing currently * _b : does nothing currently """ def root(): return "Executing Operator roo...
[ "numpy.array", "anytree.exporter.JsonExporter", "tree_utils.load_pipeline", "forecasting.mlp_model", "tree_utils.load_tree" ]
[((1960, 2038), 'anytree.exporter.JsonExporter', 'JsonExporter', ([], {'indent': '(2)', 'sort_keys': '(True)', 'default': "(lambda o: '<not serializable>')"}), "(indent=2, sort_keys=True, default=lambda o: '<not serializable>')\n", (1972, 2038), False, 'from anytree.exporter import JsonExporter\n'), ((3744, 3775), 'tre...
import numpy as np import torch import matplotlib.pylab from fiery.utils.instance import predict_instance_segmentation_and_trajectories DEFAULT_COLORMAP = matplotlib.pylab.cm.jet def flow_to_image(flow: np.ndarray, autoscale: bool = False) -> np.ndarray: """ Applies colour map to flow which should be a 2 ch...
[ "numpy.uint8", "fiery.utils.instance.predict_instance_segmentation_and_trajectories", "numpy.sqrt", "numpy.logical_not", "numpy.array", "numpy.arctan2", "numpy.arange", "torch.unique", "numpy.repeat", "numpy.asarray", "numpy.max", "numpy.stack", "numpy.concatenate", "numpy.min", "numpy.o...
[((578, 602), 'numpy.sqrt', 'np.sqrt', (['(u ** 2 + v ** 2)'], {}), '(u ** 2 + v ** 2)\n', (585, 602), True, 'import numpy as np\n'), ((616, 627), 'numpy.max', 'np.max', (['rad'], {}), '(rad)\n', (622, 627), True, 'import numpy as np\n'), ((899, 912), 'numpy.min', 'np.min', (['image'], {}), '(image)\n', (905, 912), Tru...
#------------------------------------------------------------------------------- # Copyright (c) 2012 <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...
[ "unittest.main", "numpy.array", "numpy.random.seed", "complex_systems.mobility.stabrnd.stabrnd" ]
[((1763, 1778), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1776, 1778), False, 'import unittest\n'), ((1551, 1604), 'numpy.array', 'N.array', (['[[2.92229997], [-0.78181396], [-0.44122327]]'], {}), '([[2.92229997], [-0.78181396], [-0.44122327]])\n', (1558, 1604), True, 'import numpy as N\n'), ((1611, 1632), '...
import pandas as pd import numpy as np def downgrade_dtypes(df): """Downgrade column types in the dataframe from float64/int64 type to float32/int32 type Parameters ---------- df : DataFrame Returns ------- df: DataFrame the output column types will be changed from float64...
[ "numpy.clip", "pandas.DataFrame" ]
[((1213, 1235), 'numpy.clip', 'np.clip', (['y_test', '(0)', '(20)'], {}), '(y_test, 0, 20)\n', (1220, 1235), True, 'import numpy as np\n'), ((1252, 1310), 'pandas.DataFrame', 'pd.DataFrame', (["{'ID': test.index, 'item_cnt_month': y_test}"], {}), "({'ID': test.index, 'item_cnt_month': y_test})\n", (1264, 1310), True, '...
from __future__ import division import gzip import numpy as np import pandas as pd from astropy.io import fits import matplotlib.pyplot as plt from VALDextraction import VALDmail from plot_fits import get_wavelength plt.rcParams['xtick.direction'] = 'in' plt.rcParams['ytick.direction'] = 'in' plt.rcParams['axes.spines...
[ "numpy.median", "astropy.io.fits.getheader", "pandas.read_csv", "matplotlib.pyplot.xticks", "numpy.random.choice", "matplotlib.pyplot.gca", "pandas.merge", "matplotlib.pyplot.plot", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.ylabel", "gzip.open", "matplotlib.pyplot.vlines", "astropy.io.f...
[((572, 638), 'pandas.read_csv', 'pd.read_csv', (['"""Fe1.moog"""'], {'names': 'names', 'delimiter': '"""\\\\s+"""', 'skiprows': '(1)'}), "('Fe1.moog', names=names, delimiter='\\\\s+', skiprows=1)\n", (583, 638), True, 'import pandas as pd\n'), ((716, 793), 'pandas.read_csv', 'pd.read_csv', (['"""linelist_newEW.moog"""...
from datetime import datetime from sklearn.model_selection import train_test_split from IMLearn import BaseEstimator from challenge.agoda_cancellation_estimator import AgodaCancellationEstimator import numpy as np import pandas as pd def load_data(filename: str, have_true_val: bool = True): """ Load Agoda bo...
[ "pandas.isnull", "pandas.read_csv", "datetime.datetime.strptime", "sklearn.model_selection.train_test_split", "numpy.random.seed", "challenge.agoda_cancellation_estimator.AgodaCancellationEstimator", "pandas.get_dummies" ]
[((3016, 3077), 'datetime.datetime.strptime', 'datetime.strptime', (['data_row[first_data_name][:10]', '"""%Y-%m-%d"""'], {}), "(data_row[first_data_name][:10], '%Y-%m-%d')\n", (3033, 3077), False, 'from datetime import datetime\n'), ((3087, 3149), 'datetime.datetime.strptime', 'datetime.strptime', (['data_row[second_d...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.1.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # S_Pr...
[ "matplotlib.pyplot.grid", "numpy.sqrt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.fill_between", "numpy.array", "numpy.arange", "numpy.mean", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.style.use", "numpy.diff", "numpy.max", "numpy.exp", "numpy.min", "matplotlib.pyplot.xticks", "...
[((1088, 1112), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (1101, 1112), True, 'import matplotlib.pyplot as plt\n'), ((1499, 1530), 'ARPM_utils.struct_to_dict', 'struct_to_dict', (["db['StocksSPX']"], {}), "(db['StocksSPX'])\n", (1513, 1530), False, 'from ARPM_utils import...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import subprocess import threading from pathlib import Path import numpy as np import torch def fasta_file_path(pre...
[ "subprocess.check_output", "threading.local", "pathlib.Path", "numpy.fromstring", "numpy.stack", "numpy.load" ]
[((638, 655), 'threading.local', 'threading.local', ([], {}), '()\n', (653, 655), False, 'import threading\n'), ((678, 707), 'pathlib.Path', 'Path', (['f"""{path}.fasta.idx.npy"""'], {}), "(f'{path}.fasta.idx.npy')\n", (682, 707), False, 'from pathlib import Path\n'), ((1861, 2004), 'subprocess.check_output', 'subproce...
# -*- coding: utf-8 -*- from litNlp.predict import SA_Model_Predict import numpy as np # 加载模型的字典项 tokenize_path = 'model/tokenizer.pickle' # train_method : 模型训练方式,默认 textcnn ,可选:bilstm , gru train_method = 'textcnn' # 模型的保存位置,后续用于推理 sa_model_path_m = 'model/{}.h5'.format(train_method) # 开始输入待测样例 predict_text = ['这个...
[ "litNlp.predict.SA_Model_Predict", "numpy.asarray" ]
[((352, 413), 'litNlp.predict.SA_Model_Predict', 'SA_Model_Predict', (['tokenize_path', 'sa_model_path_m'], {'max_len': '(100)'}), '(tokenize_path, sa_model_path_m, max_len=100)\n', (368, 413), False, 'from litNlp.predict import SA_Model_Predict\n'), ((475, 495), 'numpy.asarray', 'np.asarray', (['sa_score'], {}), '(sa_...
import os import glob import random import numpy as np import torchaudio as T from torch.utils.data import Dataset, DataLoader from torch.utils.data.distributed import DistributedSampler def create_dataloader(params, train, is_distributed=False): dataset = AudioDataset(params, train) return DataLoader( ...
[ "random.shuffle", "os.path.join", "torchaudio.transforms.Resample", "numpy.random.randint", "torch.utils.data.distributed.DistributedSampler", "os.path.basename", "torchaudio.load_wav" ]
[((924, 1033), 'torchaudio.transforms.Resample', 'T.transforms.Resample', (['params.new_sample_rate', 'params.sample_rate'], {'resampling_method': '"""sinc_interpolation"""'}), "(params.new_sample_rate, params.sample_rate,\n resampling_method='sinc_interpolation')\n", (945, 1033), True, 'import torchaudio as T\n'), ...
import os import numpy as np import torch from config.adacrowd import cfg from datasets.adacrowd.WE.loading_data import loading_data from datasets.adacrowd.WE.setting import cfg_data from trainer_adacrowd import Trainer_AdaCrowd seed = cfg.SEED if seed is not None: np.random.seed(seed) torch.manual_seed(seed...
[ "torch.manual_seed", "os.path.realpath", "trainer_adacrowd.Trainer_AdaCrowd", "numpy.random.seed", "torch.cuda.manual_seed", "torch.cuda.set_device" ]
[((698, 743), 'trainer_adacrowd.Trainer_AdaCrowd', 'Trainer_AdaCrowd', (['loading_data', 'cfg_data', 'pwd'], {}), '(loading_data, cfg_data, pwd)\n', (714, 743), False, 'from trainer_adacrowd import Trainer_AdaCrowd\n'), ((273, 293), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (287, 293), True, 'i...
""" Functions to test if two floats are equal to within relative and absolute tolerances. This dynamically chooses a cython implementation if available. """ from debtcollector import removals from numpy import allclose as _allclose, isinf from dit import ditParams __all__ = ( 'close', 'allclose', ) @remov...
[ "debtcollector.removals.remove", "numpy.isinf", "numpy.allclose" ]
[((315, 384), 'debtcollector.removals.remove', 'removals.remove', ([], {'message': '"""Use numpy.isclose instead"""', 'version': '"""1.0.2"""'}), "(message='Use numpy.isclose instead', version='1.0.2')\n", (330, 384), False, 'from debtcollector import removals\n'), ((633, 702), 'debtcollector.removals.remove', 'removal...
import pandas as pd from Stock import get_stock_data_2min_56days from Twitter_CEO import get_CEOs_twitter_posts from Twitter_Company import get_company_twitter_posts from Analysis import find_stock_movement from statistical_tests import contingency_table_company, contingency_table_ceo, run_chisquared_company, run_chis...
[ "Analysis.find_stock_movement", "statistical_tests.contingency_table_company", "statistical_tests.contingency_table_ceo", "statistical_tests.run_chisquared_company", "numpy.sqrt", "pandas.read_csv", "statistical_tests.run_chisquared_ceo", "numpy.array", "numpy.sum", "Twitter_Company.get_company_tw...
[((519, 561), 'pandas.read_csv', 'pd.read_csv', (['"""assets/twitter_accounts.csv"""'], {}), "('assets/twitter_accounts.csv')\n", (530, 561), True, 'import pandas as pd\n'), ((636, 671), 'Stock.get_stock_data_2min_56days', 'get_stock_data_2min_56days', (['symbols'], {}), '(symbols)\n', (662, 671), False, 'from Stock im...
import numpy as np import pandas as pd import simpy from sim_utils.audit import Audit from sim_utils.data import Data from sim_utils.patient import Patient import warnings warnings.filterwarnings("ignore") class Model(object): def __init__(self, scenario): """ """ self.env = simpy.En...
[ "pandas.Series", "numpy.random.normal", "numpy.mean", "sim_utils.patient.Patient", "simpy.Environment", "numpy.max", "numpy.sum", "numpy.zeros", "sim_utils.audit.Audit", "pandas.DataFrame", "sim_utils.data.Data", "warnings.filterwarnings" ]
[((175, 208), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (198, 208), False, 'import warnings\n'), ((312, 331), 'simpy.Environment', 'simpy.Environment', ([], {}), '()\n', (329, 331), False, 'import simpy\n'), ((383, 400), 'sim_utils.data.Data', 'Data', (['self.params']...
import gzip import io import logging import os import six import arff import numpy as np import scipy.sparse from six.moves import cPickle as pickle import xmltodict from .data_feature import OpenMLDataFeature from ..exceptions import PyOpenMLError from .._api_calls import _perform_api_call logger = logging.getLogg...
[ "logging.getLogger", "struct.calcsize", "os.path.exists", "os.path.getsize", "xmltodict.parse", "gzip.open", "six.moves.cPickle.load", "arff.ArffDecoder", "six.moves.cPickle.dump", "io.open", "numpy.array", "numpy.sum", "sys.stdout.flush", "six.moves.zip" ]
[((305, 332), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (322, 332), False, 'import logging\n'), ((6772, 6792), 'struct.calcsize', 'struct.calcsize', (['"""P"""'], {}), "('P')\n", (6787, 6792), False, 'import struct\n'), ((7200, 7218), 'arff.ArffDecoder', 'arff.ArffDecoder', ([], {}),...
import pathlib import warnings import numpy as np import pytest import xarray as xr from tests.fixtures import generate_dataset from xcdat.dataset import ( _has_cf_compliant_time, _keep_single_var, _postprocess_dataset, _preprocess_non_cf_dataset, _split_time_units_attr, decode_non_cf_time, ...
[ "numpy.array", "xcdat.dataset._postprocess_dataset", "pytest.fixture", "xcdat.dataset.open_mfdataset", "pathlib.Path", "numpy.datetime64", "warnings.simplefilter", "numpy.dtype", "xcdat.dataset._preprocess_non_cf_dataset", "xarray.Dataset", "xcdat.dataset.open_dataset", "xcdat.dataset.decode_n...
[((413, 465), 'xcdat.logger.setup_custom_logger', 'setup_custom_logger', (['"""xcdat.dataset"""'], {'propagate': '(True)'}), "('xcdat.dataset', propagate=True)\n", (432, 465), False, 'from xcdat.logger import setup_custom_logger\n'), ((496, 524), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autous...
from functools import partial from . import utils import numpy as np import jax.numpy as jnp import jax.random as random from jax import grad, jit, vmap, lax, jacrev, jacfwd, jvp, vjp, hessian #class Lattice(seed, cell_params, sim_params, def random_c0(subkeys, odds_c, n): """Make random initial conditions g...
[ "numpy.sqrt", "jax.lax.fori_loop", "jax.numpy.log", "numpy.array", "jax.numpy.matmul", "numpy.arange", "jax.random.split", "jax.numpy.eye", "numpy.ndim", "numpy.linspace", "numpy.random.normal", "jax.random.uniform", "numpy.add.outer", "jax.numpy.logical_xor", "jax.numpy.ones", "jax.vm...
[((3941, 4018), 'jax.vmap', 'vmap', (['local_alignment_change'], {'in_axes': '(None, None, None, None, 0, None, None)'}), '(local_alignment_change, in_axes=(None, None, None, None, 0, None, None))\n', (3945, 4018), False, 'from jax import grad, jit, vmap, lax, jacrev, jacfwd, jvp, vjp, hessian\n'), ((4794, 4832), 'func...
import json import argparse from prepare_data import setup # Support command-line options parser = argparse.ArgumentParser() parser.add_argument('--big-model', action='store_true', help='Use the bigger model with more conv layers') parser.add_argument('--use-data-dir', action='store_true', help='Use custom data direct...
[ "numpy.savez", "argparse.ArgumentParser", "prepare_data.setup" ]
[((100, 125), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (123, 125), False, 'import argparse\n'), ((594, 618), 'prepare_data.setup', 'setup', (['args.use_data_dir'], {}), '(args.use_data_dir)\n', (599, 618), False, 'from prepare_data import setup\n'), ((1072, 1310), 'numpy.savez', 'np.savez...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data # (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP # (c) 07/2019-present : DESY PHOTON SCIENCE # authors: # <NAME>, <EMAIL> try: import hdf5plugin # for P10, should be im...
[ "numpy.sqrt", "matplotlib.pyplot.ylabel", "bcdi.graph.colormap.ColormapFactory", "scipy.interpolate.interp1d", "scipy.ndimage.measurements.center_of_mass", "sys.exit", "matplotlib.pyplot.imshow", "pathlib.Path", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.fft.fftn", "numpy.dif...
[((2623, 2632), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (2630, 2632), True, 'from matplotlib import pyplot as plt\n'), ((2640, 2647), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (2645, 2647), True, 'import tkinter as tk\n'), ((2676, 2797), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', (...
from typing import Tuple import numpy as np class ParallelEnv: def __init__(self, envs): self.env = envs self.num_envs = len(envs) self.seed(0) def seed(self, seed: int): [env.seed(seed + idx) for idx, env in enumerate(self.env)] def reset(self) -> np.ndarray: s ...
[ "numpy.concatenate" ]
[((368, 393), 'numpy.concatenate', 'np.concatenate', (['s'], {'axis': '(0)'}), '(s, axis=0)\n', (382, 393), True, 'import numpy as np\n'), ((725, 750), 'numpy.concatenate', 'np.concatenate', (['s'], {'axis': '(0)'}), '(s, axis=0)\n', (739, 750), True, 'import numpy as np\n'), ((763, 788), 'numpy.concatenate', 'np.conca...
import time import numpy as np from PIL import Image as pil_image from keras.preprocessing.image import save_img from keras import layers from keras.applications import vgg16 from keras import backend as K import matplotlib.pyplot as plt def normalize(x): """utility function to normalize a tensor. # Argument...
[ "numpy.clip", "keras.applications.vgg16.VGG16", "keras.backend.gradients", "matplotlib.pyplot.imshow", "keras.backend.image_data_format", "numpy.random.random", "keras.backend.square", "numpy.diff", "keras.backend.epsilon", "numpy.abs", "numpy.random.randn", "time.time", "matplotlib.pyplot.s...
[((903, 919), 'numpy.clip', 'np.clip', (['x', '(0)', '(1)'], {}), '(x, 0, 1)\n', (910, 919), True, 'import numpy as np\n'), ((10772, 10822), 'keras.applications.vgg16.VGG16', 'vgg16.VGG16', ([], {'weights': '"""imagenet"""', 'include_top': '(False)'}), "(weights='imagenet', include_top=False)\n", (10783, 10822), False,...
import random import xarray as xr import numpy as np import scipy as sp import networkx as nx from collections import deque from skimage.morphology import cube from scipy.interpolate import interp1d from statsmodels.distributions.empirical_distribution import ECDF from joblib import Parallel, delayed def label_functi...
[ "random.sample", "collections.deque", "numpy.unique", "numpy.random.rand", "numpy.float64", "scipy.ndimage.find_objects", "networkx.Graph", "scipy.interpolate.interp1d", "joblib.Parallel", "numpy.array", "numpy.any", "statsmodels.distributions.empirical_distribution.ECDF", "numpy.random.rand...
[((419, 426), 'collections.deque', 'deque', ([], {}), '()\n', (424, 426), False, 'from collections import deque\n'), ((587, 615), 'numpy.unique', 'np.unique', (['pore_object[mask]'], {}), '(pore_object[mask])\n', (596, 615), True, 'import numpy as np\n'), ((966, 978), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', ...
import numpy as np import matplotlib import pylab as pl import pandas from ae_measure2 import * from feature_extraction import * import glob import os import pandas as pd from sklearn.decomposition import PCA from sklearn.cluster import KMeans from sklearn.metrics import davies_bouldin_score from sklearn.pr...
[ "sklearn.cluster.KMeans", "numpy.hstack", "numpy.where", "sklearn.metrics.adjusted_rand_score", "sklearn.preprocessing.StandardScaler", "numpy.vstack" ]
[((607, 641), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': 'k', 'n_init': '(20000)'}), '(n_clusters=k, n_init=20000)\n', (613, 641), False, 'from sklearn.cluster import KMeans\n'), ((878, 894), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (892, 894), False, 'from sklearn.prepro...
""" This file is based on dominant_invariant_subspace.m from the manopt MATLAB package. The optimization is performed on the Grassmann manifold, since only the space spanned by the columns of X matters. The implementation is short to show how Manopt can be used to quickly obtain a prototype. To make the implementation...
[ "numpy.sqrt", "pymanopt.solvers.TrustRegions", "pymanopt.Problem", "theano.tensor.matrix", "pymanopt.manifolds.Grassmann", "numpy.isreal", "numpy.linalg.norm", "numpy.random.randn", "numpy.spacing", "theano.tensor.dot" ]
[((2022, 2037), 'pymanopt.manifolds.Grassmann', 'Grassmann', (['n', 'p'], {}), '(n, p)\n', (2031, 2037), False, 'from pymanopt.manifolds import Grassmann\n'), ((2046, 2056), 'theano.tensor.matrix', 'T.matrix', ([], {}), '()\n', (2054, 2056), True, 'import theano.tensor as T\n'), ((2140, 2178), 'pymanopt.Problem', 'Prob...
""" Implementation of pairwise ranking using scikit-learn LinearSVC Reference: "Large Margin Rank Boundaries for Ordinal Regression", <NAME>, <NAME>, <NAME>. """ import itertools import numpy as np def transform_pairwise(X, y): """Transforms data into pairs with balanced labels for ranking Transforms a n...
[ "numpy.ones", "numpy.asarray", "numpy.sign" ]
[((1221, 1234), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (1231, 1234), True, 'import numpy as np\n'), ((1753, 1770), 'numpy.asarray', 'np.asarray', (['X_new'], {}), '(X_new)\n', (1763, 1770), True, 'import numpy as np\n'), ((1573, 1599), 'numpy.sign', 'np.sign', (['(y[i, 0] - y[j, 0])'], {}), '(y[i, 0] - y[...
## @ingroup Plots # Mission_Plots.py # # Created: Mar 2020, <NAME> # Apr 2020, <NAME> # Sep 2020, <NAME> # Apr 2021, <NAME> # ---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- from ...
[ "matplotlib.pyplot.grid", "numpy.sqrt", "numpy.array", "matplotlib.ticker.ScalarFormatter", "numpy.linalg.norm", "numpy.sin", "plotly.graph_objects.Surface", "numpy.atleast_2d", "numpy.zeros_like", "numpy.max", "numpy.linspace", "numpy.empty", "numpy.concatenate", "numpy.min", "matplotli...
[((1230, 1255), 'matplotlib.pyplot.figure', 'plt.figure', (['save_filename'], {}), '(save_filename)\n', (1240, 1255), True, 'import matplotlib.pyplot as plt\n'), ((2293, 2311), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (2309, 2311), True, 'import matplotlib.pyplot as plt\n'), ((3052, 3077)...
import torch import numpy as np # check if CUDA is available train_on_gpu = torch.cuda.is_available() device=torch.device('cuda' if torch.cuda.is_available() else 'cpu') if not train_on_gpu: print('CUDA is not available. Training on CPU ...') else: print('CUDA is available! Training on GPU ...') ...
[ "torch.nn.Tanh", "torch.nn.Softmax", "torch.utils.data.random_split", "torch.nn.Sequential", "torch.nn.DataParallel", "numpy.sum", "torchvision.datasets.CIFAR10", "torch.cuda.is_available", "torch.nn.NLLLoss", "numpy.zeros", "torchvision.transforms.Normalize", "torch.utils.data.DataLoader", ...
[((81, 106), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (104, 106), False, 'import torch\n'), ((567, 662), 'torchvision.datasets.CIFAR10', 'torchvision.datasets.CIFAR10', ([], {'root': '"""./data"""', 'train': '(True)', 'download': '(True)', 'transform': 'transform'}), "(root='./data', trai...
import sympy from cached_property import cached_property from devito import Dimension from devito.types import SparseTimeFunction from devito.logger import error import numpy as np __all__ = ['PointSource', 'Receiver', 'Shot', 'RickerSource', 'GaborSource', 'TimeAxis'] class TimeAxis(object): """ Data obj...
[ "numpy.ceil", "sympy.Function.__new__", "devito.logger.error", "numpy.exp", "numpy.linspace", "numpy.cos", "devito.types.SparseTimeFunction.__new__" ]
[((2466, 2510), 'numpy.linspace', 'np.linspace', (['self.start', 'self.stop', 'self.num'], {}), '(self.start, self.stop, self.num)\n', (2477, 2510), True, 'import numpy as np\n'), ((4445, 4521), 'devito.types.SparseTimeFunction.__new__', 'SparseTimeFunction.__new__', (['cls'], {'dimensions': '[grid.time_dim, p_dim]'}),...
import numpy as np #I'm dumb, so I'm reducing the problem to 2D so I can see what's happening ##Make fake data # an N x 5 array containing a regular mesh representing the stimulus params stim_params=np.mgrid[10:25,20:22].reshape(2,-1).T # an N x 3 array representing the output values for each simulation run stimnum=...
[ "numpy.lexsort", "numpy.unique", "numpy.arange", "numpy.random.permutation" ]
[((429, 472), 'numpy.random.permutation', 'np.random.permutation', (['stim_params.shape[0]'], {}), '(stim_params.shape[0])\n', (450, 472), True, 'import numpy as np\n'), ((1200, 1234), 'numpy.lexsort', 'np.lexsort', (['stim_params[:, ::-1].T'], {}), '(stim_params[:, ::-1].T)\n', (1210, 1234), True, 'import numpy as np\...
import numpy as np from math import pi from numpy import linalg as LA def project_point(vector, point): """Given a line vector and a point, projects the point on the line, resulting to a point that is closest to the given point. Args: vector: A 2D array of points in the form [[x1, y1], [x2, ...
[ "numpy.power", "numpy.subtract", "numpy.dot", "numpy.arctan2", "numpy.linalg.norm", "numpy.mod" ]
[((533, 555), 'numpy.subtract', 'np.subtract', (['point', 'p0'], {}), '(point, p0)\n', (544, 555), True, 'import numpy as np\n'), ((565, 584), 'numpy.subtract', 'np.subtract', (['p1', 'p0'], {}), '(p1, p0)\n', (576, 584), True, 'import numpy as np\n'), ((1417, 1436), 'numpy.subtract', 'np.subtract', (['p1', 'p0'], {}),...
import numpy as np """ Q: Write a binomial tree program to calculate the put prices of Bermuda options. For such options, early exercise is allowed only on specific dates. Inputs: S (stock price) X (strike price) r (continuously compounded annual interest rate in percentage) s (annual volatility in perce...
[ "numpy.exp", "numpy.sqrt" ]
[((932, 950), 'numpy.exp', 'np.exp', (['(r * deltaT)'], {}), '(r * deltaT)\n', (938, 950), True, 'import numpy as np\n'), ((967, 982), 'numpy.sqrt', 'np.sqrt', (['deltaT'], {}), '(deltaT)\n', (974, 982), True, 'import numpy as np\n')]
import itertools from collections import defaultdict import numpy as np from scipy import stats def max_accuracy(y_true, y_pred): names_true, names_pred, max_result = list(set(y_true)), list(set(y_pred)), 0 for perm in itertools.permutations(names_pred): acc = np.average([1. if names_true.index(ti) =...
[ "numpy.tile", "numpy.diagonal", "numpy.reshape", "numpy.repeat", "scipy.stats.rankdata", "numpy.power", "itertools.combinations", "numpy.array", "numpy.sum", "collections.defaultdict", "itertools.permutations" ]
[((230, 264), 'itertools.permutations', 'itertools.permutations', (['names_pred'], {}), '(names_pred)\n', (252, 264), False, 'import itertools\n'), ((2183, 2212), 'scipy.stats.rankdata', 'stats.rankdata', (['(-measure1_ari)'], {}), '(-measure1_ari)\n', (2197, 2212), False, 'from scipy import stats\n'), ((2233, 2262), '...
import os import numpy as np import pytest import tensorflow as tf from bentoml.tensorflow import TensorflowModel from tests._internal.frameworks.tensorflow_utils import ( KerasSequentialModel, NativeModel, NativeRaggedModel, ) native_data = [[1, 2, 3, 4, 5]] native_tensor = tf.constant(np.asfarray(nativ...
[ "tensorflow.ragged.constant", "bentoml.tensorflow.TensorflowModel", "bentoml.tensorflow.TensorflowModel.load", "os.path.join", "numpy.asfarray", "tests._internal.frameworks.tensorflow_utils.KerasSequentialModel", "tests._internal.frameworks.tensorflow_utils.NativeModel", "tests._internal.frameworks.te...
[((392, 441), 'tensorflow.ragged.constant', 'tf.ragged.constant', (['ragged_data'], {'dtype': 'tf.float64'}), '(ragged_data, dtype=tf.float64)\n', (410, 441), True, 'import tensorflow as tf\n'), ((303, 327), 'numpy.asfarray', 'np.asfarray', (['native_data'], {}), '(native_data)\n', (314, 327), True, 'import numpy as np...
#import open3d import os, sys import cv2 import numpy as np import argparse imgs_path = 'result/kitti_tracking/0019/' target_size = (1920, 1080) target_fps = 8.0 # 输出文件名 target_video = 'out.mp4' # 是否保存 resize 的中间图像 saveResizeFlag = False img_types = ('.bmp', '.dib', '.png', '.jpg', '.jpeg', '.pbm', '.pgm', '.ppm', '.t...
[ "numpy.copy", "os.path.exists", "os.listdir", "numpy.fromfile", "numpy.ones", "cv2.imwrite", "cv2.VideoWriter", "numpy.zeros", "os.mkdir", "cv2.VideoWriter_fourcc", "cv2.cvtColor" ]
[((490, 546), 'numpy.ones', 'np.ones', (['(img.shape[0], img.shape[1], 3)'], {'dtype': 'np.uint8'}), '((img.shape[0], img.shape[1], 3), dtype=np.uint8)\n', (497, 546), True, 'import numpy as np\n'), ((790, 824), 'numpy.zeros', 'np.zeros', (['hlsImg.shape', 'np.float32'], {}), '(hlsImg.shape, np.float32)\n', (798, 824),...
''' Function: load the train data. Author: Charles 微信公众号: Charles的皮卡丘 ''' import os import glob import torch import random import numpy as np import pandas as pd from PIL import Image from torch.utils.data import Dataset from skimage.transform import resize '''load data''' class ImageFolder(Dataset): def __init__...
[ "PIL.Image.open", "random.shuffle", "os.path.join", "torch.from_numpy", "pandas.read_excel", "pandas.DataFrame", "numpy.transpose", "skimage.transform.resize" ]
[((843, 865), 'pandas.read_excel', 'pd.read_excel', (['labpath'], {}), '(labpath)\n', (856, 865), True, 'import pandas as pd\n'), ((1135, 1160), 'pandas.DataFrame', 'pd.DataFrame', (['self.labels'], {}), '(self.labels)\n', (1147, 1160), True, 'import pandas as pd\n'), ((1321, 1370), 'skimage.transform.resize', 'resize'...
# Author: <NAME>, <NAME>, 2008 # Clustering of position weight matrices based on # "A Novel Bayesian DNA Motif Comparison Method for Clustering and Retrieval" # Habib et al, 2008 # PLOS Computational Biology, Volume 4, Issue 2 import math import numpy import copy import os,sys SENSE = 0 ANTISENSE = 1 CUTOFF = {0.2...
[ "numpy.log", "numpy.ones", "math.log" ]
[((919, 933), 'numpy.log', 'numpy.log', (['E_p'], {}), '(E_p)\n', (928, 933), False, 'import numpy\n'), ((3223, 3243), 'numpy.ones', 'numpy.ones', (['A1.shape'], {}), '(A1.shape)\n', (3233, 3243), False, 'import numpy\n'), ((707, 730), 'math.log', 'math.log', (['(bp + 1e-07)', '(2)'], {}), '(bp + 1e-07, 2)\n', (715, 73...
''' Created on Feb 8, 2017 @author: julien ''' from inspect import isfunction, isclass from random import Random import numpy rand = Random() class ParameterConstraint(object): levels = ['row', 'block', 'layer'] def __init__(self, namespace_id, name, value, **kwargs): self.namespace_id = namesp...
[ "random.Random", "inspect.isclass", "inspect.isfunction", "numpy.random.normal" ]
[((138, 146), 'random.Random', 'Random', ([], {}), '()\n', (144, 146), False, 'from random import Random\n'), ((1069, 1085), 'inspect.isclass', 'isclass', (['element'], {}), '(element)\n', (1076, 1085), False, 'from inspect import isfunction, isclass\n'), ((1089, 1108), 'inspect.isfunction', 'isfunction', (['element'],...
# """ # The code will split the training set into k-fold for cross-validation # """ # import os # import numpy as np # from sklearn.model_selection import StratifiedKFold # root = './data/2018/MICCAI_BraTS_2018_Data_Training' # valid_data_dir = './data/2018/MICCAI_BraTS_2018_Data_Validation' # def wri...
[ "os.listdir", "os.path.join", "sklearn.model_selection.StratifiedKFold", "numpy.array", "sys.exit" ]
[((1652, 1670), 'os.listdir', 'os.listdir', (['backup'], {}), '(backup)\n', (1662, 1670), False, 'import os\n'), ((2857, 2917), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': '(5)', 'shuffle': '(True)', 'random_state': '(2018)'}), '(n_splits=5, shuffle=True, random_state=2018)\n', (2872...
# Copyright (c) 2012-2018, University of Strathclyde # Authors: <NAME> # License: BSD-3-Clause """ This is an examplar script to produce a plot of the cycle-averaged magnitude and phase of the fields """ import sys import numpy as np from numpy import pi from numpy import arange import matplotlib.pyplot as plt impor...
[ "matplotlib.pyplot.ylabel", "puffdata.fdata", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "retrieve.getPow", "matplotlib.pyplot.subplot", "numpy.arange" ]
[((548, 562), 'puffdata.fdata', 'fdata', (['h5fname'], {}), '(h5fname)\n', (553, 562), False, 'from puffdata import fdata\n'), ((901, 948), 'retrieve.getPow', 'getPow', (['h5fname', 'cfr', 'dfr'], {'irtype': 'gav', 'qScale': '(0)'}), '(h5fname, cfr, dfr, irtype=gav, qScale=0)\n', (907, 948), False, 'from retrieve impor...
from keras.models import load_model import cv2 import numpy as np model = load_model('models\model_final_bin.h5') model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) img = cv2.imread('2.jpg') img = cv2.resize(img,(256,256)) img = np.reshape(img...
[ "cv2.resize", "keras.models.load_model", "numpy.reshape", "cv2.imread" ]
[((79, 119), 'keras.models.load_model', 'load_model', (['"""models\\\\model_final_bin.h5"""'], {}), "('models\\\\model_final_bin.h5')\n", (89, 119), False, 'from keras.models import load_model\n'), ((246, 265), 'cv2.imread', 'cv2.imread', (['"""2.jpg"""'], {}), "('2.jpg')\n", (256, 265), False, 'import cv2\n'), ((273, ...
import numpy as np import random def heightmap_1D(iter, smoothing, seed, init): """Create 2^iter + 1 linear heightmap via midpoint displacement. """ if init == None: random.seed(seed + "init") heightmap = np.array([random.random(), random.random()]) else: heightmap = init r...
[ "random.uniform", "random.choice", "numpy.delete", "numpy.floor", "numpy.ndenumerate", "random.seed", "numpy.array", "numpy.zeros", "numpy.cos", "numpy.sin", "numpy.meshgrid", "random.random", "random.randint" ]
[((319, 348), 'random.seed', 'random.seed', (["(seed + 'iterate')"], {}), "(seed + 'iterate')\n", (330, 348), False, 'import random\n'), ((1161, 1190), 'random.seed', 'random.seed', (["(seed + 'iterate')"], {}), "(seed + 'iterate')\n", (1172, 1190), False, 'import random\n'), ((3847, 3877), 'numpy.zeros', 'np.zeros', (...
import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch import torch.nn as nn from baselines.common import tf_util as U from baselines.ppo1 import mlp_policy from codes.envs.utils import make_env from codes.model.expert_policy.normal_mlp import NormalMLPPolicy from codes....
[ "numpy.prod", "collections.OrderedDict", "baselines.ppo1.mlp_policy.MlpPolicy", "codes.envs.utils.make_env", "baselines.common.tf_util.make_session", "torch.load", "tensorflow.get_default_session", "numpy.asarray", "torch.from_numpy", "torch.save", "tensorflow.get_default_graph", "codes.model....
[((672, 694), 'codes.envs.utils.make_env', 'make_env', (['env_id', 'seed'], {}), '(env_id, seed)\n', (680, 694), False, 'from codes.envs.utils import make_env\n'), ((3029, 3062), 'torch.save', 'torch.save', (['state_dict', 'file_name'], {}), '(state_dict, file_name)\n', (3039, 3062), False, 'import torch\n'), ((3442, 3...
from unittest import TestCase from dexpy.simplex_centroid import build_simplex_centroid from dexpy.eval import det_xtxi from dexpy.model import make_quadratic_model import numpy as np import patsy class TestSimplexCentroid(TestCase): @classmethod def test_d_optimality(cls): answer_d = [ 2.513455e3, 2....
[ "numpy.testing.assert_allclose", "dexpy.simplex_centroid.build_simplex_centroid", "patsy.dmatrix", "dexpy.eval.det_xtxi", "dexpy.model.make_quadratic_model" ]
[((865, 923), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['answer_d', 'actual_d'], {'rtol': '(1e-05)'}), '(answer_d, actual_d, rtol=1e-05)\n', (891, 923), True, 'import numpy as np\n'), ((475, 500), 'dexpy.simplex_centroid.build_simplex_centroid', 'build_simplex_centroid', (['i'], {}), '(i)\n', (49...
""" This script define the helper function for the agent to use """ import numpy as np from collections import deque import torch.nn as nn import cv2 from src.params import * # from params import * def init_weight(layers): for layer in layers: if type(layer) == nn.Conv2d or type(layer)==nn.Linear: ...
[ "torch.nn.init.constant_", "torch.nn.init.xavier_uniform_", "numpy.zeros", "cv2.cvtColor", "cv2.resize" ]
[((651, 690), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_RGB2GRAY'], {}), '(frame, cv2.COLOR_RGB2GRAY)\n', (663, 690), False, 'import cv2\n'), ((846, 867), 'numpy.zeros', 'np.zeros', (['(1, 84, 84)'], {}), '((1, 84, 84))\n', (854, 867), True, 'import numpy as np\n'), ((327, 364), 'torch.nn.init.xavier_unifor...
# -*- coding: utf-8 -*- """ :mod:`channel.worker` -- Multi-device sync API for a single computation device ============================================================================== .. module:: worker :platform: Unix :synopsis: Provide methods for single device Theano code that enable homogeneo...
[ "signal.signal", "pygpu.collectives.GpuCommCliqueId", "posix_ipc.unlink_shared_memory", "argparse.ArgumentParser", "six.add_metaclass", "base64.b64encode", "posix_ipc.SharedMemory", "pygpu.collectives.GpuComm", "theano.gpuarray.get_context", "zmq.Poller", "numpy.ndarray", "os.getpid", "sys.e...
[((1847, 1879), 'six.add_metaclass', 'six.add_metaclass', (['SingletonType'], {}), '(SingletonType)\n', (1864, 1879), False, 'import six\n'), ((3355, 3368), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (3366, 3368), False, 'import zmq\n'), ((3443, 3454), 'os.getpid', 'os.getpid', ([], {}), '()\n', (3452, 3454), Fals...
import matplotlib.pyplot as plt import numpy as np import statistics as st from scipy import stats data = [[73,65,70],[64,61,67],[72,63,66],[58,71,56],[54,70,61],[57,48,56]] Averaget = [] for i in data: Averaget.append(st.mean(i)) #define global vars eoverD = 0.0063 vis = 0.001002 # Pa * s D = float(0.012...
[ "statistics.mean", "numpy.log10", "matplotlib.pyplot.ylabel", "numpy.arange", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.linspace", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((1372, 1402), 'numpy.linspace', 'np.linspace', (['minRe', 'maxRe', '(100)'], {}), '(minRe, maxRe, 100)\n', (1383, 1402), True, 'import numpy as np\n'), ((1462, 1490), 'numpy.linspace', 'np.linspace', (['minRe', 'maxRe', '(3)'], {}), '(minRe, maxRe, 3)\n', (1473, 1490), True, 'import numpy as np\n'), ((1491, 1510), 'm...
import os from fnmatch import fnmatch import pickle # General Processing import numpy as np import pandas as pd import collections # DECOMPOSITION from sklearn.decomposition import NMF from scipy.linalg import svd # NLU from ibm_cloud_sdk_core.authenticators import IAMAuthenticator from ibm_watson import NaturalLan...
[ "pandas.Series", "sklearn.decomposition.NMF", "os.path.exists", "collections.namedtuple", "numpy.sqrt", "os.listdir", "pickle.dump", "pickle.dumps", "seaborn.clustermap", "cloud_object_store.CloudObjectStore", "numpy.square", "numpy.array", "ibm_watson.NaturalLanguageUnderstandingV1", "fnm...
[((605, 618), 'numpy.array', 'np.array', (['lst'], {}), '(lst)\n', (613, 618), True, 'import numpy as np\n'), ((623, 650), 'numpy.random.shuffle', 'np.random.shuffle', (['shuffled'], {}), '(shuffled)\n', (640, 650), True, 'import numpy as np\n'), ((1124, 1142), 'numpy.sqrt', 'np.sqrt', (['(vec @ vec)'], {}), '(vec @ ve...
#!/usr/bin/env python # coding: utf-8 """ This script assembles the training dataset from the folder relative to different bags """ from __future__ import print_function, division import os import glob import torch import pandas as pd import numpy as np from torch.utils.data import Dataset, ConcatDataset from torchvi...
[ "torch.utils.data.ConcatDataset", "torchvision.transforms.RandomAffine", "torchvision.transforms.ToPILImage", "pandas.read_csv", "os.path.join", "opts.parser.parse_args", "numpy.array", "torch.tensor", "numpy.sum", "numpy.cumsum", "img_utils.load_img", "torchvision.transforms.ToTensor", "war...
[((407, 426), 'opts.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (424, 426), False, 'from opts import parser\n'), ((462, 495), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (485, 495), False, 'import warnings\n'), ((2936, 2960), 'glob.glob', 'glob.glob', (["...
""" Copyright 2018 Novartis Institutes for BioMedical Research 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 agr...
[ "numpy.prod", "numpy.log", "numpy.argsort", "numpy.array", "numpy.arange", "keras.models.Model.load", "numpy.repeat", "numpy.where", "hnswlib.Index", "numpy.asarray", "numpy.max", "keras.models.Model", "numpy.min", "warnings.simplefilter", "numpy.frombuffer", "sklearn.preprocessing.Min...
[((3118, 3149), 'numpy.round', 'np.round', (['x0'], {'decimals': 'decimals'}), '(x0, decimals=decimals)\n', (3126, 3149), True, 'import numpy as np\n'), ((3160, 3191), 'numpy.round', 'np.round', (['x1'], {'decimals': 'decimals'}), '(x1, decimals=decimals)\n', (3168, 3191), True, 'import numpy as np\n'), ((3202, 3233), ...
import random import scipy import numpy as np import h5py class DataLoader(object): def __init__(self, cfg): self.cfg = cfg self.augment = cfg.data_augment def get_data(self, mode='train'): h5f = h5py.File('./classification/DataLoaders/mnist_background.h5', 'r') self.x_test = ...
[ "random.uniform", "numpy.reshape", "h5py.File", "numpy.squeeze", "numpy.zeros", "random.getrandbits", "scipy.ndimage.interpolation.rotate", "numpy.random.permutation" ]
[((1956, 1973), 'numpy.squeeze', 'np.squeeze', (['batch'], {}), '(batch)\n', (1966, 1973), True, 'import numpy as np\n'), ((1990, 2011), 'numpy.zeros', 'np.zeros', (['batch.shape'], {}), '(batch.shape)\n', (1998, 2011), True, 'import numpy as np\n'), ((231, 297), 'h5py.File', 'h5py.File', (['"""./classification/DataLoa...
""" SPDX-FileCopyrightText: 2021 International Photoacoustic Standardisation Consortium (IPASC) SPDX-FileCopyrightText: 2021 <NAME> SPDX-FileCopyrightText: 2021 <NAME> SPDX-License-Identifier: MIT """ from scipy.signal import hilbert, hilbert2 import numpy as np def hilbert_transform_1_d(signal, axis=-1): """ ...
[ "numpy.abs", "scipy.signal.hilbert2", "numpy.where", "numpy.nanmax", "scipy.signal.hilbert" ]
[((1259, 1273), 'numpy.abs', 'np.abs', (['signal'], {}), '(signal)\n', (1265, 1273), True, 'import numpy as np\n'), ((447, 473), 'scipy.signal.hilbert', 'hilbert', (['signal'], {'axis': 'axis'}), '(signal, axis=axis)\n', (454, 473), False, 'from scipy.signal import hilbert, hilbert2\n'), ((688, 704), 'scipy.signal.hilb...
"""Run Monte Carlo simulations.""" from joblib import Parallel, delayed from frbpoppy import Survey, CosmicPopulation, SurveyPopulation, pprint from datetime import datetime from copy import deepcopy from glob import glob import frbpoppy.paths import os import numpy as np import pandas as pd from tqdm import tqdm impo...
[ "pandas.read_csv", "numpy.array", "os.cpu_count", "copy.deepcopy", "datetime.datetime.today", "os.remove", "numpy.linspace", "os.path.isdir", "os.mkdir", "frbpoppy.SurveyPopulation", "pandas.DataFrame", "numpy.meshgrid", "glob.glob", "uuid.uuid4", "os.path.isfile", "numpy.isnan", "fr...
[((745, 784), 'pandas.read_csv', 'pd.read_csv', (['self.filename'], {'index_col': '(0)'}), '(self.filename, index_col=0)\n', (756, 784), True, 'import pandas as pd\n'), ((2877, 2902), 'numpy.linspace', 'np.linspace', (['(-2.5)', '(-1)', '(11)'], {}), '(-2.5, -1, 11)\n', (2888, 2902), True, 'import numpy as np\n'), ((29...
import keras import logging import numpy as np import tensorflow as tf from collections import OrderedDict, deque from keras.layers import Input, Dense, Lambda, Dropout, Dot, Permute, Reshape, Embedding, Concatenate, Multiply from keras.models import Model, load_model import os import sys sys.path.append('../utils...
[ "keras.initializers.RandomUniform", "nprf_knrm_pair_generator.NPRFKNRMPairGenerator", "collections.OrderedDict", "evaluations.evaluate_trec", "logging.info", "keras.layers.Dot", "nprf_knrm_config.NPRFKNRMConfig", "file_operation.load_pickle", "file_operation.write_result_to_trec_format", "keras.la...
[((295, 323), 'sys.path.append', 'sys.path.append', (['"""../utils/"""'], {}), "('../utils/')\n", (310, 323), False, 'import sys\n'), ((324, 354), 'sys.path.append', 'sys.path.append', (['"""../metrics/"""'], {}), "('../metrics/')\n", (339, 354), False, 'import sys\n'), ((5364, 5380), 'nprf_knrm_config.NPRFKNRMConfig',...
import numpy as np import numba n = 12 x, _ = np.polynomial.chebyshev.chebgauss(n) V = np.polynomial.chebyshev.chebvander(x, n-1) a = np.exp(np.sin(x)) b = np.cos(x)*a c = np.linalg.solve(V, a) def chebeval1(x, c): x2 = 2*x c0 = c[-2] c1 = c[-1] for i in range(3, len(c) + 1): tmp = c0 ...
[ "numpy.abs", "numpy.linalg.solve", "numpy.sin", "numpy.polynomial.chebyshev.chebder", "numpy.zeros", "numpy.cos", "numpy.polynomial.chebyshev.chebvander", "numpy.polynomial.chebyshev.chebgauss" ]
[((48, 84), 'numpy.polynomial.chebyshev.chebgauss', 'np.polynomial.chebyshev.chebgauss', (['n'], {}), '(n)\n', (81, 84), True, 'import numpy as np\n'), ((89, 133), 'numpy.polynomial.chebyshev.chebvander', 'np.polynomial.chebyshev.chebvander', (['x', '(n - 1)'], {}), '(x, n - 1)\n', (123, 133), True, 'import numpy as np...
from sporco.util import tikhonov_filter import pywt import numpy as np from imageio import imread def Fusion_DWT_db2(image1, image2): # decomposing each image using Discrete wavelet transform(DWT) with Daubechies filter (db2) coefficients_1 = pywt.wavedec2(image1, 'db2', level=2) coefficients_2 = pywt.wav...
[ "pywt.wavedec2", "sporco.util.tikhonov_filter", "numpy.where", "numpy.asanyarray", "imageio.imread", "pywt.waverec2" ]
[((253, 290), 'pywt.wavedec2', 'pywt.wavedec2', (['image1', '"""db2"""'], {'level': '(2)'}), "(image1, 'db2', level=2)\n", (266, 290), False, 'import pywt\n'), ((312, 349), 'pywt.wavedec2', 'pywt.wavedec2', (['image2', '"""db2"""'], {'level': '(2)'}), "(image2, 'db2', level=2)\n", (325, 349), False, 'import pywt\n'), (...
#!/usr/local/bin import pickle import itertools import heapq from collections import defaultdict import numpy as np import pandas as pd from scipy.stats import binom import matplotlib.pyplot as plt def generate_mi(rsIDs): """ Usefuls for reindexing for a new subset of rsIDS """ BASES = ['A', 'C', 'G', '...
[ "itertools.chain", "itertools.cycle", "pandas.read_csv", "numpy.logical_and", "pickle.load", "numpy.logical_or", "pandas.Panel", "scipy.stats.binom.sf", "heapq.nlargest", "collections.defaultdict", "numpy.isnan", "pandas.MultiIndex.from_tuples" ]
[((341, 385), 'itertools.chain', 'itertools.chain', (['*[([i] * 4) for i in rsIDs]'], {}), '(*[([i] * 4) for i in rsIDs])\n', (356, 385), False, 'import itertools\n'), ((446, 501), 'pandas.MultiIndex.from_tuples', 'pd.MultiIndex.from_tuples', (['tuples'], {'names': "['ID', 'BASE']"}), "(tuples, names=['ID', 'BASE'])\n"...
import numpy as np import json dist_npy = './result/submit/dist_65.npy' #生成的dist矩阵,距离越小越相似 dist = np.load(dist_npy,allow_pickle=True) rank = np.argsort(dist) rank0 = rank[:,0] print(len(rank0)) print(len(set(rank0))) query_name_npy = './result/submit/query_name.npy' gallery_name_npy = './result/submit/gallery_name.np...
[ "numpy.argsort", "numpy.load", "json.dump" ]
[((98, 134), 'numpy.load', 'np.load', (['dist_npy'], {'allow_pickle': '(True)'}), '(dist_npy, allow_pickle=True)\n', (105, 134), True, 'import numpy as np\n'), ((142, 158), 'numpy.argsort', 'np.argsort', (['dist'], {}), '(dist)\n', (152, 158), True, 'import numpy as np\n'), ((337, 379), 'numpy.load', 'np.load', (['quer...
# Copyright (c) 2019 Sony Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
[ "numpy.full", "nnabla_ext.cuda.experimental.dali_iterator.create_dali_iterator_from_data_iterator", "pytest.mark.skipif" ]
[((758, 805), 'pytest.mark.skipif', 'pytest.mark.skipif', (['"""not dali_iterator.enabled"""'], {}), "('not dali_iterator.enabled')\n", (776, 805), False, 'import pytest\n'), ((1606, 1683), 'nnabla_ext.cuda.experimental.dali_iterator.create_dali_iterator_from_data_iterator', 'dali_iterator.create_dali_iterator_from_dat...
# coding: utf8 import unittest import numpy as np import sys sys.path.append('..') from dppy.beta_ensemble_polynomial_potential_core import TracyWidom class TestTracyWidom(unittest.TestCase): """ Based on the work of Bornemann 2010 `https://arxiv.org/pdf/0804.2543.pdf <https://arxiv.org/pdf/0804.2543.pdf>`_ ...
[ "numpy.allclose", "numpy.where", "numpy.sin", "dppy.beta_ensemble_polynomial_potential_core.TracyWidom", "numpy.array", "numpy.linspace", "unittest.main", "numpy.meshgrid", "sys.path.append" ]
[((64, 85), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (79, 85), False, 'import sys\n'), ((336, 348), 'dppy.beta_ensemble_polynomial_potential_core.TracyWidom', 'TracyWidom', ([], {}), '()\n', (346, 348), False, 'from dppy.beta_ensemble_polynomial_potential_core import TracyWidom\n'), ((3120,...
"""Assorted plotting functions. AUTHOR: <NAME> <britta.wstnr[at]gmail.com> """ import numpy as np import matplotlib.pyplot as plt from nilearn.plotting import plot_stat_map from nilearn.image import index_img def plot_score_std(x_ax, scores, title=None, colors=None, legend=None): if colors is None: colo...
[ "matplotlib.pyplot.imshow", "numpy.abs", "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gca", "matplotlib.pyplot.xlabel", "nilearn.image.index_img", "matplotlib.pyplot.colorbar", "numpy.max", "matplotlib.pyplot.figure", "numpy.std", "matplotlib.pyplot.title", "ma...
[((781, 814), 'matplotlib.pyplot.axvline', 'plt.axvline', ([], {'x': '(0.0)', 'color': '"""black"""'}), "(x=0.0, color='black')\n", (792, 814), True, 'import matplotlib.pyplot as plt\n'), ((818, 835), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""AUC"""'], {}), "('AUC')\n", (828, 835), True, 'import matplotlib.pyplot...
#! /usr/bin/python ################################################################################################### # # Python Simulator for Sapphire Lattice Crypto-Processor # # Author: <NAME> # Last Modified: 25-Nov-2019 # # Inputs: Parameters (n,q), Operating Conditions, Program, Simulation Options # Outputs: I...
[ "matplotlib.pyplot.ylabel", "math.log", "random.getrandbits", "math.exp", "os.path.exists", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.asarray", "matplotlib.pyplot.yticks", "matplotlib.pyplot.xticks", "re.match", "re.sub", "sys.argv.index", "matplotlib.pyplot.show", "ma...
[((3369, 3432), 're.match', 're.match', (['"""config\\\\(n=(\\\\d+),q=(\\\\d+)\\\\)"""', 'instr_t', '(re.M | re.I)'], {}), "('config\\\\(n=(\\\\d+),q=(\\\\d+)\\\\)', instr_t, re.M | re.I)\n", (3377, 3432), False, 'import math, sys, os, re, random\n'), ((4544, 4591), 're.match', 're.match', (['"""c(\\\\d)=(\\\\d+)"""', ...
""" Copyright 2020 <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, distribute, sublicense...
[ "tf2_ros.transform_broadcaster.TransformBroadcaster", "rclpy.ok", "time.sleep", "numpy.array", "std_msgs.msg.Header", "geometry_msgs.msg.Quaternion", "rclpy.spin_once", "numpy.cos", "numpy.sin", "rclpy.init", "rclpy.shutdown", "rclpy.node.ParameterDescriptor" ]
[((6625, 6646), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (6635, 6646), False, 'import rclpy\n'), ((7176, 7192), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()\n', (7190, 7192), False, 'import rclpy\n'), ((1782, 1808), 'tf2_ros.transform_broadcaster.TransformBroadcaster', 'TransformBroadca...
# ============================================================================== # Copyright (C) 2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # ============================================================================== """Openvino Tensorflow BiasAdd operation test """ from __future__ import absolu...
[ "tensorflow.compat.v1.placeholder", "numpy.reshape", "tensorflow.compat.v1.disable_eager_execution", "numpy.random.seed", "tensorflow.nn.bias_add" ]
[((459, 497), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (495, 497), True, 'import tensorflow as tf\n'), ((530, 547), 'numpy.random.seed', 'np.random.seed', (['(8)'], {}), '(8)\n', (544, 547), True, 'import numpy as np\n'), ((712, 748), 'numpy.reshape', 'np...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 25 19:53:57 2019 @author: george gaussian experiment for HMMS """ import sys sys.path.append('../') import numpy as np from _experiments import gauss_seq1d from _misc import make_supervised, compute_forw, make_supervised2 from HMMs import MHMM i...
[ "_misc.compute_forw", "numpy.array", "numpy.zeros", "numpy.random.seed", "numpy.concatenate", "sys.path.append", "_experiments.gauss_seq1d", "matplotlib.pyplot.subplots", "numpy.arange", "HMMs.MHMM" ]
[((151, 173), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (166, 173), False, 'import sys\n'), ((352, 374), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(0)'}), '(seed=0)\n', (366, 374), True, 'import numpy as np\n'), ((468, 486), 'numpy.array', 'np.array', (['[a0, a1]'], {}), '([a0,...
import numpy as np import random import tensorflow as tf import matplotlib.pyplot as plt from AirSimClient import * import sys import time import random import msvcrt np.set_printoptions(threshold=np.nan) # if true, use Q-learning. Else, use SARSA qlearning = True readWeights = True # read in saved weights to resume ...
[ "msvcrt.kbhit", "numpy.sqrt", "numpy.random.rand", "matplotlib.pyplot.ylabel", "tensorflow.tanh", "numpy.multiply", "tensorflow.random_normal", "tensorflow.placeholder", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "tensorflow.Session", "numpy.max", "matplotlib.pyplot.close", "ten...
[((168, 205), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan'}), '(threshold=np.nan)\n', (187, 205), True, 'import numpy as np\n'), ((3295, 3350), 'tensorflow.placeholder', 'tf.placeholder', ([], {'shape': '[1, num_inputs]', 'dtype': 'tf.float32'}), '(shape=[1, num_inputs], dtype=tf.float32...
import numpy as np from RLL17code import RLL17code from PolarCode import PolarCode class Scheme(): def __init__(self, m, n, k, nc, nCodewords): self.n = n self.m = m self.nCodewords = nCodewords self.rateRLL = m / n self.rll = RLL17code() self.polar = Pola...
[ "RLL17code.RLL17code", "numpy.reshape", "PolarCode.PolarCode", "numpy.ndarray.flatten", "numpy.zeros" ]
[((282, 293), 'RLL17code.RLL17code', 'RLL17code', ([], {}), '()\n', (291, 293), False, 'from RLL17code import RLL17code\n'), ((316, 344), 'PolarCode.PolarCode', 'PolarCode', (['nc', 'k', 'nCodewords'], {}), '(nc, k, nCodewords)\n', (325, 344), False, 'from PolarCode import PolarCode\n'), ((503, 544), 'numpy.zeros', 'np...
import numpy from numpy.testing import assert_allclose from cogent3.draw.drawable import Drawable from cogent3.maths.geometry import SimplexTransform from cogent3.util.union_dict import UnionDict __author__ = "<NAME> and <NAME>" __copyright__ = "Copyright 2007-2019, The Cogent Project" __credits__ = ["<NAME>", "<NA...
[ "itertools.combinations", "numpy.array", "cogent3.util.union_dict.UnionDict", "cogent3.maths.geometry.SimplexTransform" ]
[((5495, 5525), 'numpy.array', 'numpy.array', (['data'], {'dtype': 'float'}), '(data, dtype=float)\n', (5506, 5525), False, 'import numpy\n'), ((5543, 5594), 'numpy.array', 'numpy.array', (['[(v @ self.transformer) for v in data]'], {}), '([(v @ self.transformer) for v in data])\n', (5554, 5594), False, 'import numpy\n...
# This code is part of Qiskit. # # (C) Copyright IBM 2020, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
[ "qiskit.providers.aer.pulse.de.type_utils.StateTypeConverter", "qiskit.providers.aer.pulse.de.type_utils.StateTypeConverter.from_outer_instance_inner_type_spec", "numpy.abs", "qiskit.providers.aer.pulse.de.type_utils.StateTypeConverter.from_instances", "qiskit.providers.aer.pulse.de.type_utils.type_spec_fro...
[((974, 1000), 'numpy.array', 'np.array', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (982, 1000), True, 'import numpy as np\n'), ((1019, 1041), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (1027, 1041), True, 'import numpy as np\n'), ((1200, 1226), 'numpy.array', 'np.array', (['[[1, 2...
# -*- coding: UTF8 -*- """ container class for results author: <NAME> This file is part of evo (github.com/MichaelGrupp/evo). evo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, ...
[ "logging.getLogger", "numpy.mean", "numpy.append", "numpy.array_equal", "copy.deepcopy" ]
[((805, 832), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (822, 832), False, 'import logging\n'), ((3415, 3440), 'copy.deepcopy', 'copy.deepcopy', (['results[0]'], {}), '(results[0])\n', (3428, 3440), False, 'import copy\n'), ((3826, 3873), 'numpy.mean', 'np.mean', (['(array, result.np...
#!/usr/bin/env python3 import tensorflow as tf import numpy as np import os import math import foolbox import scipy import matplotlib.pyplot as plt from PIL import Image #Utilizes the FoolBox Python library (https://github.com/bethgelab/foolbox) to implement a variety #of adversarial attacks against deep-learning mo...
[ "numpy.clip", "foolbox.criteria.Misclassification", "scipy.spatial.distance.hamming", "foolbox.models.ModelWithEstimatedGradients", "os.path.exists", "tensorflow.Session", "numpy.asarray", "os.mkdir", "numpy.concatenate", "numpy.argmax", "numpy.any", "numpy.squeeze", "numpy.isnan", "scipy....
[((450, 486), 'foolbox.criteria.Misclassification', 'foolbox.criteria.Misclassification', ([], {}), '()\n', (484, 486), False, 'import foolbox\n'), ((7022, 7077), 'numpy.asarray', 'np.asarray', (['[a.adversarial_class for a in adversarials]'], {}), '([a.adversarial_class for a in adversarials])\n', (7032, 7077), True, ...
import glob import os import sys from argparse import ArgumentParser from datetime import datetime import numpy as np import torch import torch.utils.data as Data from Functions import generate_grid, Dataset_epoch, Predict_dataset, transform_unit_flow_to_flow_cuda, \ generate_grid_unit from miccai2021_model impor...
[ "numpy.save", "miccai2021_model.Miccai2021_LDR_conditional_laplacian_unit_disp_add_lvl1", "numpy.reshape", "argparse.ArgumentParser", "os.path.isdir", "os.mkdir", "miccai2021_model.NCC", "sys.stdout.flush", "glob.glob", "miccai2021_model.SpatialTransformNearest_unit", "Functions.Dataset_epoch", ...
[((627, 643), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (641, 643), False, 'from argparse import ArgumentParser\n'), ((16340, 16354), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (16352, 16354), False, 'from datetime import datetime\n'), ((16409, 16423), 'datetime.datetime.now', 'date...
# -*- coding: utf-8 -*- """ Created on Fri Oct 9 13:55:54 2020 @author: lenovouser """ import matplotlib.pyplot as plt import numpy as np def f(x,y): # the height function return (1 - x / 2 + x**5 + y**3) * np.exp(-x**2 -y**2) n = 256 x = np.linspace(-3, 3, n) y = np.linspace(-3, 3, n) X,Y = np.meshgrid(x,...
[ "matplotlib.pyplot.xticks", "matplotlib.pyplot.colorbar", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.yticks", "matplotlib.pyplot.clabel", "numpy.meshgrid", "matplotlib.pyplot.show" ]
[((252, 273), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', 'n'], {}), '(-3, 3, n)\n', (263, 273), True, 'import numpy as np\n'), ((278, 299), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', 'n'], {}), '(-3, 3, n)\n', (289, 299), True, 'import numpy as np\n'), ((306, 323), 'numpy.meshgrid', 'np.meshgrid', (['x', ...
import tensorflow as tf import numpy as np from keras import backend as K from keras.models import Sequential, model_from_json from keras.layers import Lambda from tensorflow.python.framework import ops from scipy.ndimage.interpolation import zoom import keras import tempfile import os def loss_calculation(x, categor...
[ "tensorflow.python.framework.ops.RegisterGradient", "keras.backend.sum", "keras.backend.learning_phase", "keras.backend.gradients", "keras.backend.floatx", "scipy.ndimage.interpolation.zoom", "tensorflow.cast", "numpy.mean", "keras.backend.image_data_format", "keras.backend.square", "numpy.max",...
[((947, 977), 'keras.backend.sum', 'K.sum', (['model.layers[-1].output'], {}), '(model.layers[-1].output)\n', (952, 977), True, 'from keras import backend as K\n'), ((2211, 2233), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (2231, 2233), True, 'import tensorflow as tf\n'), ((3258, 3292), '...
import tensorflow as tf import numpy as np import pandas as pd import pickle import sys sys.path.append('/Users/slade/Documents/Code/machine-learning/Python/ffm/tools.py') from tools import transfer_data, get_batch class Args(object): # number of latent factors k = 6 # num of fields f = 24 # num ...
[ "tensorflow.local_variables_initializer", "pandas.read_csv", "tensorflow.contrib.layers.l2_regularizer", "tensorflow.multiply", "tensorflow.truncated_normal_initializer", "tensorflow.gradients", "numpy.array", "tensorflow.zeros_initializer", "sys.path.append", "tensorflow.clip_by_global_norm", "...
[((89, 177), 'sys.path.append', 'sys.path.append', (['"""/Users/slade/Documents/Code/machine-learning/Python/ffm/tools.py"""'], {}), "(\n '/Users/slade/Documents/Code/machine-learning/Python/ffm/tools.py')\n", (104, 177), False, 'import sys\n'), ((4709, 4737), 'pandas.read_csv', 'pd.read_csv', (['train_data_path'], ...
# -*- coding: utf-8 -*- """ 根据手工标注的标签生成npy文件,每个npy文件保存了一个二维数组(width, height, 8+1), 前8个通道是图像数据,最后一个通道是标签 """ import os import sys import glob import json import tqdm import skimage.io import numpy as np import matplotlib.pyplot as plt def find_bnd(img): """ 从标签图像中找到标注的区域(矩形),标签图像是与卫星图大小一致的RGBA图像,未标注的 ...
[ "matplotlib.pyplot.imshow", "os.path.exists", "os.makedirs", "matplotlib.pyplot.show", "tqdm.tqdm", "os.path.join", "os.path.splitext", "json.dumps", "os.path.split", "numpy.expand_dims", "numpy.concatenate", "matplotlib.pyplot.title", "numpy.load", "matplotlib.pyplot.subplot", "matplotl...
[((1677, 1693), 'tqdm.tqdm', 'tqdm.tqdm', (['masks'], {}), '(masks)\n', (1686, 1693), False, 'import tqdm\n'), ((2822, 2848), 'numpy.random.shuffle', 'np.random.shuffle', (['dat_all'], {}), '(dat_all)\n', (2839, 2848), True, 'import numpy as np\n'), ((1342, 1368), 'os.path.exists', 'os.path.exists', (['output_dir'], {}...
# Author: <NAME> # Date: 5 Feb 2019 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
[ "tensorflow.random.uniform", "tensorflow.slice", "tensorflow.image.resize_images", "tensorflow.shape", "tensorflow.pad", "tensorflow.transpose", "numpy.random.rand", "tensorflow.placeholder", "tensorflow.Session", "numpy.random.randint", "tensorflow.image.crop_and_resize", "tensorflow.get_defa...
[((2660, 2718), 'tensorflow.pad', 'tf.pad', (['tensor_3d', '((0, 0), (0, pad_size), (0, 0), (0, 0))'], {}), '(tensor_3d, ((0, 0), (0, pad_size), (0, 0), (0, 0)))\n', (2666, 2718), True, 'import tensorflow as tf\n'), ((2829, 2857), 'numpy.random.randint', 'np.random.randint', (['(0)', 'maxval'], {}), '(0, maxval)\n', (2...
from pyunicorn.timeseries import RecurrencePlot import numpy as np from statistics import median import time # Measure the times (in ms) of evaluating an expression n times def measuretime(f, n, *args): t = [0]*n res = f(*args) for n in range(n): t0 = time.time() f(*args) t[n] = tim...
[ "statistics.median", "numpy.array", "pyunicorn.timeseries.RecurrencePlot", "numpy.loadtxt", "time.time" ]
[((522, 611), 'pyunicorn.timeseries.RecurrencePlot', 'RecurrencePlot', (['v'], {'metric': 'metric', 'sparse_rqa': 'metric_sup', 'threshold': '(1.2)', 'dim': '(3)', 'tau': '(6)'}), '(v, metric=metric, sparse_rqa=metric_sup, threshold=1.2, dim=\n 3, tau=6)\n', (536, 611), False, 'from pyunicorn.timeseries import Recur...
# -*- coding: utf-8 -*- """ Created on Thu Jun 23 13:37:10 2016 @author: kroboth """ import collections import numpy.linalg as linalg # TODO: # * Catch actual exceptions instead of all of them class EventLibrary(object): """ EventLibrary Maintain a list of events. The class is used by the Sequence...
[ "collections.namedtuple", "numpy.linalg.norm" ]
[((2132, 2179), 'collections.namedtuple', 'collections.namedtuple', (['"""find"""', "['id', 'found']"], {}), "('find', ['id', 'found'])\n", (2154, 2179), False, 'import collections\n'), ((1874, 1908), 'numpy.linalg.norm', 'linalg.norm', (['(self.data[ind] - data)'], {}), '(self.data[ind] - data)\n', (1885, 1908), True,...
import numpy as np import pandas as pd from scipy import ndimage from scipy.cluster import hierarchy from scipy.spatial import distance_matrix from matplotlib import pyplot as plt from sklearn import manifold, datasets from sklearn.cluster import AgglomerativeClustering from sklearn.datasets.samples_generator import ma...
[ "pandas.read_csv", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.cm.nipy_spectral", "scipy.cluster.hierarchy.fcluster", "sklearn.cluster.AgglomerativeClustering", "matplotlib.pyplot.xlabel", "numpy.max", "numpy.linspace", "matplotlib.pyplot.yticks", "scipy.cluster.hierarchy.linkage", "matplotli...
[((339, 429), 'sklearn.datasets.samples_generator.make_blobs', 'make_blobs', ([], {'n_samples': '(50)', 'centers': '[[4, 4], [-2, -1], [1, 1], [10, 4]]', 'cluster_std': '(0.9)'}), '(n_samples=50, centers=[[4, 4], [-2, -1], [1, 1], [10, 4]],\n cluster_std=0.9)\n', (349, 429), False, 'from sklearn.datasets.samples_gen...
import cv2 import numpy as np def main(): #window_name="Cam feed" #cv2.namedWindow(window_name) cap=cv2.VideoCapture(0) #filename = 'F:\sample.avi' #codec=cv2.VideoWriter_fourcc('X','V','I','D') #framerate=30 #resolution = (500,500) # VideoFileOutput = cv2.VideoWriter(filename,codec...
[ "cv2.drawContours", "numpy.ones", "cv2.threshold", "cv2.imshow", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.cvtColor", "cv2.findContours", "cv2.GaussianBlur", "cv2.waitKey", "cv2.absdiff" ]
[((114, 133), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (130, 133), False, 'import cv2\n'), ((1162, 1185), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1183, 1185), False, 'import cv2\n'), ((594, 621), 'cv2.absdiff', 'cv2.absdiff', (['frame1', 'frame2'], {}), '(frame1, fram...
""" Run script to parse a vietnamese text - set variables DEBUG, PLOT, TEST based on your use case. - set variable file to the filename you want to analyze - Run: - Will create a report of distribution of sounds - Will plot if you set PLOT=True """ import numpy as np import time import os import ma...
[ "os.path.exists", "os.path.getsize", "matplotlib.pyplot.grid", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "numpy.arange", "matplotlib.pyplot.gca", "matplotlib.pyplot.xlabel", "numpy.sum", "matplotlib.pyplot.figure", "matplotlib.pyplot.bar", "numpy.array", "matplotlib.pyplot.titl...
[((1564, 1589), 'numpy.sum', 'np.sum', (['vowel_cnt'], {'axis': '(1)'}), '(vowel_cnt, axis=1)\n', (1570, 1589), True, 'import numpy as np\n'), ((1843, 1863), 'os.path.exists', 'os.path.exists', (['file'], {}), '(file)\n', (1857, 1863), False, 'import os\n'), ((1878, 1899), 'os.path.getsize', 'os.path.getsize', (['file'...
import os import numpy import cv2 import random import colorsys from Controller.nuclick.nuclick import gen_mask nuclei_annotation_data_root = "static/data/nuclei_annotation_data/" color = [[0, 128, 0, 0], [255, 0, 209, 128], [0, 255, 255, 128], [0, 0, 255, 128], [0, 0, 255, 128], [255, 191, 0, 128], [0, 0, 0...
[ "cv2.imwrite", "os.path.exists", "numpy.mean", "cv2.drawContours", "cv2.convertScaleAbs", "cv2.threshold", "colorsys.hls_to_rgb", "numpy.max", "numpy.array", "numpy.zeros", "numpy.argwhere", "random.random", "Controller.nuclick.nuclick.gen_mask", "numpy.savetxt", "numpy.loadtxt", "cv2....
[((2055, 2089), 'cv2.imread', 'cv2.imread', (['region_image_file_name'], {}), '(region_image_file_name)\n', (2065, 2089), False, 'import cv2\n'), ((2790, 2856), 'numpy.savetxt', 'numpy.savetxt', (['boundary_file_name', 'result'], {'fmt': '"""%d"""', 'delimiter': '""","""'}), "(boundary_file_name, result, fmt='%d', deli...