code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# --------------------------- # <NAME>, <NAME>, <NAME> -- 2019 # The University of Oxford, The Alan Turing Institute # contact: <EMAIL>, <EMAIL>, <EMAIL> # --------------------------- from src_tf2.data_processing.utils import load_dataset from src_tf2.GNIs import GNIs import tensorflow as tf from absl import flags i...
[ "numpy.random.seed", "tensorflow.estimator.TrainSpec", "tensorflow.get_default_graph", "tensorflow.compat.v1.app.run", "absl.flags.DEFINE_bool", "os.path.exists", "src_tf2.data_processing.utils.load_dataset", "absl.flags.DEFINE_integer", "absl.flags.DEFINE_float", "json.dump", "tensorflow.estima...
[((423, 454), 'tensorflow.compat.v1.set_random_seed', 'tf.compat.v1.set_random_seed', (['(0)'], {}), '(0)\n', (451, 454), True, 'import tensorflow as tf\n'), ((455, 472), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (469, 472), True, 'import numpy as np\n'), ((474, 551), 'absl.flags.DEFINE_string', 'f...
from typing import Dict, List import numpy as np from xain.types import FederatedDataset, Partition PartitionStat = Dict[str, List[int]] class DSStats: def __init__(self, name: str, ds: FederatedDataset): self.name = name self.ds = ds def __repr__(self) -> str: width = 120 ...
[ "numpy.concatenate", "numpy.unique" ]
[((2336, 2368), 'numpy.unique', 'np.unique', (['y'], {'return_counts': '(True)'}), '(y, return_counts=True)\n', (2345, 2368), True, 'import numpy as np\n'), ((1439, 1465), 'numpy.concatenate', 'np.concatenate', (['ys'], {'axis': '(0)'}), '(ys, axis=0)\n', (1453, 1465), True, 'import numpy as np\n')]
import sys import numpy from PyQt5.QtWidgets import QApplication, QMessageBox, QSizePolicy from PyQt5.QtGui import QIntValidator, QDoubleValidator from orangewidget import gui from orangewidget.settings import Setting from oasys.widgets import gui as oasysgui, congruence from oasys.widgets.exchange import DataExchan...
[ "PyQt5.QtWidgets.QSizePolicy", "orangewidget.settings.Setting", "numpy.exp", "oasys.widgets.gui.widgetBox", "PyQt5.QtWidgets.QApplication", "xraylib.Refractive_Index_Im", "xraylib.Refractive_Index_Re", "numpy.ones_like", "PyQt5.QtGui.QDoubleValidator", "oasys.widgets.congruence.checkNumber", "xr...
[((1232, 1242), 'orangewidget.settings.Setting', 'Setting', (['(1)'], {}), '(1)\n', (1239, 1242), False, 'from orangewidget.settings import Setting\n'), ((1257, 1270), 'orangewidget.settings.Setting', 'Setting', (['"""Be"""'], {}), "('Be')\n", (1264, 1270), False, 'from orangewidget.settings import Setting\n'), ((1286,...
#!/usr/bin/env python3 import os import json import csv import rospy from sensor_msgs.msg import Image from cv_bridge import CvBridge import cv2 from PIL import Image as PilImage import numpy as np import tf from panoptic_mapping_msgs.msg import DetectronLabel, DetectronLabels class DetectronPlayer(object): de...
[ "rospy.Subscriber", "csv.reader", "os.path.isfile", "os.path.join", "rospy.logwarn", "panoptic_mapping_msgs.msg.DetectronLabels", "rospy.init_node", "tf.transformations.quaternion_from_matrix", "rospy.logfatal", "panoptic_mapping_msgs.msg.DetectronLabel", "cv_bridge.CvBridge", "json.load", "...
[((5190, 5241), 'rospy.init_node', 'rospy.init_node', (['"""detectron_player"""'], {'anonymous': '(True)'}), "('detectron_player', anonymous=True)\n", (5205, 5241), False, 'import rospy\n'), ((5287, 5299), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (5297, 5299), False, 'import rospy\n'), ((433, 518), 'rospy.get_para...
""" The MIT License (MIT) Copyright (c) 2017 <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, publis...
[ "numpy.argmax", "sklearn.metrics.accuracy_score", "numpy.zeros", "numpy.histogram", "numpy.max", "numpy.unique" ]
[((1940, 1962), 'numpy.zeros', 'np.zeros', (['y_true.shape'], {}), '(y_true.shape)\n', (1948, 1962), True, 'import numpy as np\n'), ((1976, 1993), 'numpy.unique', 'np.unique', (['y_true'], {}), '(y_true)\n', (1985, 1993), True, 'import numpy as np\n'), ((2261, 2278), 'numpy.unique', 'np.unique', (['y_pred'], {}), '(y_p...
import numpy as np import tensorflow as tf from tensorflow import keras import model # -------------------- cerate dataset: print("Created dataset: 10000 samples") # sample variables n_samples = 10000 def noise(n_samples) : return np.random.normal(0.0, 0.1, size=n_samples) A = noise(n_samples) X = np.exp(-0.5 * A * ...
[ "numpy.random.uniform", "tensorflow.keras.losses.MeanSquaredError", "matplotlib.pyplot.show", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.scatter", "model.Model", "matplotlib.pyplot.figure", "numpy.sin", "tensorflow.keras.optimizers.Adam", "numpy.exp", "numpy.random.normal", "numpy.mean",...
[((632, 666), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', 'n_samples'], {}), '(0, 1, n_samples)\n', (649, 666), True, 'import numpy as np\n'), ((1254, 1296), 'tensorflow.keras.optimizers.Adam', 'keras.optimizers.Adam', ([], {'learning_rate': '(0.001)'}), '(learning_rate=0.001)\n', (1275, 1296), False, ...
import tensorflow as tf if tf.__version__ == '1.5.0': import keras from keras.engine import Layer from tensorflow import sparse_tensor_to_dense as to_dense else: from tensorflow import keras from tensorflow.keras.layers import Layer from tensorflow.sparse import to_dense import numpy as np fro...
[ "tensorflow.sparse.to_dense", "tensorflow.gather", "tensorflow.nn.top_k", "tensorflow.pad", "tensorflow.reshape", "tensorflow.to_int32", "tensorflow.shape", "tensorflow.equal", "numpy.array", "tensorflow.where", "tensorflow.map_fn", "tensorflow.unique", "tensorflow.expand_dims" ]
[((1542, 1576), 'tensorflow.to_int32', 'tf.to_int32', (['classifications[:, 4]'], {}), '(classifications[:, 4])\n', (1553, 1576), True, 'import tensorflow as tf\n'), ((2546, 2572), 'tensorflow.gather', 'tf.gather', (['class_ids', 'keep'], {}), '(class_ids, keep)\n', (2555, 2572), True, 'import tensorflow as tf\n'), ((2...
"""Test animations.""" # pylint: disable=wrong-import-position import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt from celluloid import Camera def test_single(): """Test plt.figure()""" fig = plt.figure() camera = Camera(fig) for _ in range(10): p...
[ "celluloid.Camera", "numpy.zeros", "numpy.ones", "matplotlib.pyplot.figure", "matplotlib.use", "numpy.arange", "matplotlib.pyplot.subplots" ]
[((100, 121), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (114, 121), False, 'import matplotlib\n'), ((248, 260), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (258, 260), True, 'from matplotlib import pyplot as plt\n'), ((274, 285), 'celluloid.Camera', 'Camera', (['fig'], {}), '...
#!/usr/bin/env python import rospy from geometry_msgs.msg import Twist from sensor_msgs.msg import Joy import numpy as np class G29Control(): def __init__(self): # Mapping # 0 -> 450 degree == 0 -> 1 ratio_constant = 7.854 # orientation:steering = 1:1 self.steering_ratio = rat...
[ "rospy.Subscriber", "rospy.Publisher", "geometry_msgs.msg.Twist", "rospy.Rate", "numpy.clip", "rospy.is_shutdown", "rospy.init_node" ]
[((1296, 1331), 'rospy.init_node', 'rospy.init_node', (['"""g29_control_node"""'], {}), "('g29_control_node')\n", (1311, 1331), False, 'import rospy\n'), ((1372, 1386), 'rospy.Rate', 'rospy.Rate', (['(60)'], {}), '(60)\n', (1382, 1386), False, 'import rospy\n'), ((453, 517), 'rospy.Publisher', 'rospy.Publisher', (['"""...
""" A module for testing/debugging call routines """ import logging import os import traceback import numpy as np from datetime import datetime logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) def print_errors(func): def new_func(*args, **kwargs): try: return func(*args, **k...
[ "traceback.print_exc", "numpy.isfortran", "datetime.datetime.now", "os.environ.get", "numpy.savez", "os.path.join", "logging.getLogger" ]
[((154, 181), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (171, 181), False, 'import logging\n'), ((1050, 1083), 'os.path.join', 'os.path.join', (['DUMP_PATH', 'filename'], {}), '(DUMP_PATH, filename)\n', (1062, 1083), False, 'import os\n'), ((1135, 1161), 'numpy.savez', 'np.savez', ([...
#!/usr/bin/env python # coding: utf-8 # # What's this TensorFlow business? # # You've written a lot of code in this assignment to provide a whole host of neural network functionality. Dropout, Batch Norm, and 2D convolutions are some of the workhorses of deep learning in computer vision. You've also worked hard to ma...
[ "tensorflow.keras.layers.Dense", "tensorflow.keras.metrics.Mean", "tensorflow.keras.backend.random_normal", "tensorflow.reshape", "tensorflow.keras.optimizers.SGD", "tensorflow.matmul", "numpy.arange", "tensorflow.nn.conv2d", "tensorflow.keras.layers.MaxPool2D", "tensorflow.keras.Sequential", "n...
[((5761, 5812), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (5805, 5812), True, 'import tensorflow as tf\n'), ((5844, 5898), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['de...
# Copyright 2021 <NAME> & <NAME>. 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 applicable law or ...
[ "tensorflow.keras.preprocessing.image.ImageDataGenerator", "numpy.abs", "numpy.argmax", "utils.tools.multiAccuracy", "numpy.mean", "models.fileloader.file_loader", "os.path.join", "sys.path.append", "utils.tools.get_callbacks", "utils.pre_process_multimnist.generate_tf_data_test", "tensorflow.ke...
[((1262, 1283), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1277, 1283), False, 'import sys\n'), ((8069, 8091), 'numpy.mean', 'np.mean', (['((v_ - v) ** 2)'], {}), '((v_ - v) ** 2)\n', (8076, 8091), True, 'import numpy as np\n'), ((8146, 8159), 'models.fileloader.file_loader', 'file_loader', ...
# coding: utf-8 # refer to https://blog.csdn.net/zzzzjh/article/details/80633573 import numpy as np import random import matplotlib.pyplot as plt import time class GA(object): def __init__(self, x_range, fitness_function, pop_size, iteration_max, p_crossover, p_mutation, plot): self.bounds_begin = x_range[...
[ "numpy.random.uniform", "numpy.log2", "matplotlib.pyplot.scatter", "time.time", "numpy.random.randint", "matplotlib.pyplot.pause" ]
[((735, 797), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2)'], {'size': '(self.pop_size, self.bit_length)'}), '(0, 2, size=(self.pop_size, self.bit_length))\n', (752, 797), True, 'import numpy as np\n'), ((2013, 2032), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (2030, 2032), True, 'impo...
import numpy as np import random from .helpers import normalize class Env: def __init__(self, n=5, d=5, B=1.0, noise='normal'): self.n = n self.d = d self.B = B # initialize kernel parameters self.init_kernel() # initialize noise parameters self....
[ "numpy.random.binomial", "numpy.random.random_sample", "numpy.argmax", "random.shuffle", "numpy.linalg.norm", "numpy.random.normal", "numpy.dot" ]
[((540, 576), 'numpy.random.random_sample', 'np.random.random_sample', (['(1, self.d)'], {}), '((1, self.d))\n', (563, 576), True, 'import numpy as np\n'), ((594, 642), 'numpy.linalg.norm', 'np.linalg.norm', (['_x'], {'ord': '(2)', 'axis': '(1)', 'keepdims': '(True)'}), '(_x, ord=2, axis=1, keepdims=True)\n', (608, 642...
import json import time import cv2 import numpy as np import torch import torch.nn as nn from nets.retinaface import RetinaFace from utils.anchors import Anchors from utils.config import cfg_mnet, cfg_re50 from utils.utils import letterbox_image, preprocess_input from utils.utils_bbox import (decode, deco...
[ "json.load", "cv2.putText", "cv2.circle", "torch.load", "nets.retinaface.RetinaFace", "torch.cat", "time.time", "numpy.shape", "utils.utils.letterbox_image", "cv2.rectangle", "utils.anchors.Anchors", "numpy.array", "torch.cuda.is_available", "utils.utils_bbox.non_max_suppression", "torch...
[((4695, 4715), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (4704, 4715), False, 'import json\n'), ((5170, 5197), 'numpy.array', 'np.array', (['image', 'np.float32'], {}), '(image, np.float32)\n', (5178, 5197), True, 'import numpy as np\n'), ((5381, 5396), 'numpy.shape', 'np.shape', (['image'], {}),...
# ============================================================================= # Copyright 2021 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
[ "numpy.ones_like", "ptlflow.data.flow_transforms.ToTensor", "torch.norm", "ptlflow.models_dict.keys", "ptlflow.get_model", "numpy.isnan", "ptlflow.utils.utils.InputPadder", "pathlib.Path", "torch.cuda.is_available", "ptlflow.get_model_reference", "torch.nn.functional.interpolate", "pytest.mark...
[((12907, 12999), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""Requires to download all checkpoints. Just run occasionally."""'}), "(reason=\n 'Requires to download all checkpoints. Just run occasionally.')\n", (12923, 12999), False, 'import pytest\n'), ((13066, 13092), 'ptlflow.models_dict.keys', 'pt...
# Copyright 2017 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
[ "sys.stdout.write", "os.mkdir", "tensorflow.identity", "tensorflow.local_variables_initializer", "tensorflow.matmul", "tensorflow.get_default_graph", "tensorflow.reduce_max", "os.path.join", "time.asctime", "tensorflow.one_hot", "os.path.exists", "tensorflow.sign", "tensorflow.placeholder", ...
[((5001, 5049), 'sys.stdout.write', 'sys.stdout.write', (['"""\n<log> Building graph..."""'], {}), '("""\n<log> Building graph...""")\n', (5017, 5049), False, 'import sys\n'), ((5075, 5103), 'sys.stdout.write', 'sys.stdout.write', (['"""</log>\n"""'], {}), "('</log>\\n')\n", (5091, 5103), False, 'import sys\n'), ((1112...
import torch import pdb from .gpu_memory_tools import * import numpy as np class Batch_Size_Estimator: def __init__(self, net, opt, loss_func, dataset, gpu_id=0): self.__gpu_info = GPU_MEM_INFO(gpu_id) self.__device = torch.device("cuda:"+str(gpu_id)) self.__net = net self.__lo...
[ "torch.cuda.max_memory_allocated", "numpy.array", "torch.cuda.empty_cache", "torch.cuda.reset_max_memory_allocated" ]
[((1149, 1173), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (1171, 1173), False, 'import torch\n'), ((1182, 1221), 'torch.cuda.reset_max_memory_allocated', 'torch.cuda.reset_max_memory_allocated', ([], {}), '()\n', (1219, 1221), False, 'import torch\n'), ((1545, 1568), 'numpy.array', 'np.array...
import numpy as np class EnvironmentModel: def __init__(self, n_states, n_actions, seed=None): """ Constructor for the Environment Model of the Reinforcement learning framework :param n_states: Number of states in the Environment :param n_actions: Number of possible actions in...
[ "numpy.random.RandomState" ]
[((525, 552), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (546, 552), True, 'import numpy as np\n')]
#!/usr/bin/env python # # Utilities for handling expression data. # # import os, sys gitpath = os.path.expanduser("~/git/cshlwork") sys.path.append(gitpath) import argparse import datetime import io import logging import traceback from configparser import ConfigParser import numpy as np import pandas as pd impor...
[ "argparse.ArgumentParser", "pandas.read_csv", "scipy.cluster.hierarchy.linkage", "os.path.isfile", "scipy.spatial.distance.pdist", "sys.path.append", "pandas.DataFrame", "os.path.dirname", "traceback.format_exc", "configparser.ConfigParser", "datetime.datetime.now", "pandas.concat", "numpy.f...
[((99, 135), 'os.path.expanduser', 'os.path.expanduser', (['"""~/git/cshlwork"""'], {}), "('~/git/cshlwork')\n", (117, 135), False, 'import os, sys\n'), ((136, 160), 'sys.path.append', 'sys.path.append', (['gitpath'], {}), '(gitpath)\n', (151, 160), False, 'import os, sys\n'), ((637, 651), 'configparser.ConfigParser', ...
import tensorflow as tf import numpy as np import random import logging from GamePlayer.Player import AverageRandomPlayer from Environment.Wizard import Wizard from Environment.Wizard import MAX_ROUNDS from Environment.Card import Card class TrickPrediction(object): n_hidden_1 = 40 def __init__(self, sessio...
[ "tensorflow.reduce_sum", "numpy.sum", "numpy.concatenate", "tensorflow.summary.scalar", "tensorflow.train.Saver", "random.sample", "tensorflow.losses.mean_squared_error", "GamePlayer.Player.AverageRandomPlayer", "tensorflow.layers.dense", "numpy.zeros", "tensorflow.variable_scope", "tensorflow...
[((475, 521), 'logging.getLogger', 'logging.getLogger', (['"""wizard-rl.TrickPrediction"""'], {}), "('wizard-rl.TrickPrediction')\n", (492, 521), False, 'import logging\n'), ((2164, 2204), 'tensorflow.summary.scalar', 'tf.summary.scalar', (['"""loss_tp"""', 'self._loss'], {}), "('loss_tp', self._loss)\n", (2181, 2204),...
import io from itertools import count from collections import OrderedDict import numpy as np import matplotlib.patches as mpatches from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvas # noqa from PIL import Image from .datasets import Label class AnomalyDetector: def ...
[ "matplotlib.backends.backend_agg.FigureCanvas", "io.BytesIO", "itertools.count", "numpy.hstack", "numpy.any", "numpy.argsort", "matplotlib.figure.Figure", "numpy.where", "numpy.reshape", "numpy.fromiter", "collections.OrderedDict", "matplotlib.patches.Patch", "PIL.Image.frombytes", "numpy....
[((2727, 2759), 'numpy.where', 'np.where', (['(self.data_labels == -1)'], {}), '(self.data_labels == -1)\n', (2735, 2759), True, 'import numpy as np\n'), ((3007, 3020), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3018, 3020), False, 'from collections import OrderedDict\n'), ((3998, 4028), 'numpy.fromit...
import numpy as np import os import sys import ntpath import time from . import util from . import html from scipy.misc import imresize from config import * import cv2 import imageio import torch import torchvision.transforms as transforms import projections.operations as operations if sys.version_info[0] == 2: V...
[ "projections.operations.make_depth_pairs_from_coord", "ntpath.basename", "os.makedirs", "numpy.abs", "cv2.imwrite", "visdom.Visdom", "numpy.ones", "projections.operations.make_depth_texture_pairs_from_coord", "time.strftime", "numpy.array", "os.path.splitext", "os.path.join", "numpy.concaten...
[((438, 493), 'numpy.ones', 'np.ones', (['(img.shape[0], img.shape[1], 3)'], {'dtype': '"""uint8"""'}), "((img.shape[0], img.shape[1], 3), dtype='uint8')\n", (445, 493), True, 'import numpy as np\n'), ((1009, 1039), 'ntpath.basename', 'ntpath.basename', (['image_path[0]'], {}), '(image_path[0])\n', (1024, 1039), False,...
from __future__ import print_function import numpy as np class PoseHelper(object): # dummy class to comply to original interface def __init__(self, body_part, pbc): self.pbc = pbc self.body_part = body_part def xyz(self): return self.body_part.current_position() def rpy(self): ...
[ "numpy.array" ]
[((1820, 1851), 'numpy.array', 'np.array', (['[x, y, z, a, b, c, d]'], {}), '([x, y, z, a, b, c, d])\n', (1828, 1851), True, 'import numpy as np\n'), ((2742, 2776), 'numpy.array', 'np.array', (['[vx, vy, vz, wx, wy, wz]'], {}), '([vx, vy, vz, wx, wy, wz])\n', (2750, 2776), True, 'import numpy as np\n'), ((11444, 11468)...
import numpy as np import pandas as pd from sklearn.utils import shuffle def relu(x): return x * (x > 0) def error_rate(p, t): return np.mean(p != t) def getKaggleMNIST(): # MNIST data: # column 0 is labels # column 1-785 is data, with values 0 .. 255 # total size of CSV: (42000, 1, 28, 2...
[ "pandas.read_csv", "sklearn.utils.shuffle", "numpy.mean", "numpy.random.randn" ]
[((147, 162), 'numpy.mean', 'np.mean', (['(p != t)'], {}), '(p != t)\n', (154, 162), True, 'import numpy as np\n'), ((412, 426), 'sklearn.utils.shuffle', 'shuffle', (['train'], {}), '(train)\n', (419, 426), False, 'from sklearn.utils import shuffle\n'), ((670, 693), 'numpy.random.randn', 'np.random.randn', (['*shape'],...
# Este arquivo contém as funções usadas para ajustar as curvas PV # e outras funções úteis ############################################################### BIBLIOTECAS: import numpy as np # para fazer contas e mexer com matrizes import pandas as pd # para montar DataFrames (tabelas de bancos de dados) f...
[ "matplotlib.pyplot.title", "math.erf", "numpy.abs", "matplotlib.pyplot.figure", "pathlib.Path", "numpy.linalg.norm", "numpy.exp", "pickle.load", "scipy.interpolate.interp1d", "pandas.DataFrame", "pandas.concat", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "scipy.optimize.curve_fi...
[((2876, 2895), 'numpy.array', 'np.array', (['saida_lst'], {}), '(saida_lst)\n', (2884, 2895), True, 'import numpy as np\n'), ((5006, 5050), 'pandas.concat', 'pd.concat', (['dataframes_lst'], {'ignore_index': '(True)'}), '(dataframes_lst, ignore_index=True)\n', (5015, 5050), True, 'import pandas as pd\n'), ((5406, 5442...
import torch import tables import os import pickle import numpy as np import math import datetime import torchvision import cv2 import glob from pathlib import Path def CheckPaths(paths,dataset_name): assert paths['path_to_superpoint_checkpoint']!=None , "Path missing!! Update 'path_to_superpoint_checkpoint' on...
[ "os.remove", "pickle.dump", "numpy.sum", "numpy.empty", "torch.cat", "os.path.isfile", "pathlib.Path", "pickle.load", "torch.nn.functional.grid_sample", "math.pow", "os.path.exists", "tables.Float64Atom", "torch.zeros", "datetime.datetime.now", "math.ceil", "torch.norm", "numpy.asarr...
[((12861, 12987), 'torch.tensor', 'torch.tensor', (['[[0.16901332, 0.41111228, 0.16901332], [0.41111228, 1.0, 0.41111228], [\n 0.16901332, 0.41111228, 0.16901332]]'], {}), '([[0.16901332, 0.41111228, 0.16901332], [0.41111228, 1.0, \n 0.41111228], [0.16901332, 0.41111228, 0.16901332]])\n', (12873, 12987), False, '...
import numpy as np def create_D(Nx, Ny): diff = np.vstack([np.eye(Nx, Nx, k=0) - np.eye(Nx, Nx, k=-1), np.hstack([np.zeros(Nx - 1), -1])]) D = np.vstack([np.kron(np.eye(Ny), diff), np.kron(diff, np.eye(Nx))]) return D def laplacian(Nx, Ny): D = create_D(Nx, Ny) return D.T.dot(D)
[ "numpy.eye", "numpy.zeros" ]
[((65, 84), 'numpy.eye', 'np.eye', (['Nx', 'Nx'], {'k': '(0)'}), '(Nx, Nx, k=0)\n', (71, 84), True, 'import numpy as np\n'), ((87, 107), 'numpy.eye', 'np.eye', (['Nx', 'Nx'], {'k': '(-1)'}), '(Nx, Nx, k=-1)\n', (93, 107), True, 'import numpy as np\n'), ((172, 182), 'numpy.eye', 'np.eye', (['Ny'], {}), '(Ny)\n', (178, 1...
import numpy as np import cProfile def list_add_two(l, iterations): for _ in range(iterations): l = [i + 2 for i in l] return l def array_add_two(a, iterations): for _ in range(iterations): a = a + 2 return a def test(): my_list = list(range(1000000)) my_array = np.array(my...
[ "numpy.array", "cProfile.run" ]
[((429, 451), 'cProfile.run', 'cProfile.run', (['"""test()"""'], {}), "('test()')\n", (441, 451), False, 'import cProfile\n'), ((309, 326), 'numpy.array', 'np.array', (['my_list'], {}), '(my_list)\n', (317, 326), True, 'import numpy as np\n')]
import numpy as np from cost_functions import trajectory_cost_fn import time class Controller(): def __init__(self): pass # Get the appropriate action(s) for this state(s) def get_action(self, state): pass class RandomController(Controller): def __init__(self, env): self.env = env def get_action(self, s...
[ "numpy.array", "numpy.argmin" ]
[((1383, 1414), 'numpy.argmin', 'np.argmin', (['trajectory_cost_list'], {}), '(trajectory_cost_list)\n', (1392, 1414), True, 'import numpy as np\n'), ((1302, 1320), 'numpy.array', 'np.array', (['obs_list'], {}), '(obs_list)\n', (1310, 1320), True, 'import numpy as np\n'), ((1322, 1340), 'numpy.array', 'np.array', (['ac...
""" Run this script if you wish to save the images for any further use and not load it as a MAT file """ import h5py import os import numpy as np import cv2 matPath = './data/nyu_depth_v2_labeled.mat' img_folder = 'imgs' dep_folder = 'deps' if not os.path.exists(img_folder): os.makedirs(img_folder) if not os.pat...
[ "h5py.File", "os.makedirs", "numpy.empty", "os.path.exists", "numpy.amax", "cv2.normalize", "cv2.resize" ]
[((375, 393), 'h5py.File', 'h5py.File', (['matPath'], {}), '(matPath)\n', (384, 393), False, 'import h5py\n'), ((251, 277), 'os.path.exists', 'os.path.exists', (['img_folder'], {}), '(img_folder)\n', (265, 277), False, 'import os\n'), ((283, 306), 'os.makedirs', 'os.makedirs', (['img_folder'], {}), '(img_folder)\n', (2...
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 : """Computes the bounding sphere around sets of points.""" import argparse from collections import Counter, OrderedDict from itertools import chain, combinations import logging import os # import miniball import numpy as np import pandas as pd from cc_emergency....
[ "pandas.DataFrame", "argparse.ArgumentParser", "numpy.logical_and", "os.path.basename", "cc_emergency.utils.vectors.angular_distance", "numpy.asarray", "numpy.linalg.norm", "collections.OrderedDict", "collections.Counter" ]
[((450, 545), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Computes the bounding sphere around sets of points."""'}), "(description=\n 'Computes the bounding sphere around sets of points.')\n", (473, 545), False, 'import argparse\n'), ((1903, 1930), 'os.path.basename', 'os.path.base...
from typing import Sequence, List, Optional import numpy as np import torch from ..basic_typing import Tensor, TensorNCX from ..transforms.stack import stack def flip(array: Tensor, axis: int) -> Tensor: """ Flip an axis of an array Args: array: a :class:`numpy.ndarray` or :class:`torch.Tensor` ...
[ "numpy.random.rand", "torch.flip", "numpy.flip" ]
[((2347, 2373), 'numpy.random.rand', 'np.random.rand', (['nb_samples'], {}), '(nb_samples)\n', (2361, 2373), True, 'import numpy as np\n'), ((490, 515), 'numpy.flip', 'np.flip', (['array'], {'axis': 'axis'}), '(array, axis=axis)\n', (497, 515), True, 'import numpy as np\n'), ((1298, 1328), 'numpy.random.rand', 'np.rand...
""" gradient and hessian readers """ import numpy import autoread as ar import autoparse.pattern as app import autoparse.find as apf def gradient(output_string): """ read gradient from the output string """ # Grab a block of text containing the gradient block_ptt = ('Molecular gradient' + ...
[ "autoparse.pattern.escape", "autoparse.pattern.one_or_more", "numpy.shape", "autoparse.find.last_capture", "autoparse.pattern.maybe" ]
[((443, 485), 'autoparse.find.last_capture', 'apf.last_capture', (['block_ptt', 'output_string'], {}), '(block_ptt, output_string)\n', (459, 485), True, 'import autoparse.find as apf\n'), ((1115, 1132), 'numpy.shape', 'numpy.shape', (['grad'], {}), '(grad)\n', (1126, 1132), False, 'import numpy\n'), ((340, 383), 'autop...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 20 17:38:34 2020 @author: mlampert """ import os import copy import numpy as np import pickle import pandas import time as time_module import flap import flap_nstx thisdir = os.path.dirname(os.path.realpath(__file__)) fn = os.path.join(thisdir,"...
[ "matplotlib.backends.backend_pdf.PdfPages", "pandas.read_csv", "flap.CoordinateMode", "matplotlib.pyplot.figure", "numpy.arange", "os.path.join", "numpy.unique", "flap.config.get_all_section", "flap.get_data_object_ref", "os.path.exists", "flap.Intervals", "matplotlib.pyplot.pause", "os.path...
[((298, 339), 'os.path.join', 'os.path.join', (['thisdir', '"""../flap_nstx.cfg"""'], {}), "(thisdir, '../flap_nstx.cfg')\n", (310, 339), False, 'import os\n'), ((339, 369), 'flap.config.read', 'flap.config.read', ([], {'file_name': 'fn'}), '(file_name=fn)\n', (355, 369), False, 'import flap\n'), ((370, 390), 'flap_nst...
# -*- coding: utf-8 -*- """ Created on Fri Apr 2 14:54:37 2021 @author: dv516 """ from algorithms.Bayesian_opt_Pyro.utilities_full import BayesOpt from test_functions import rosenbrock_constrained import numpy as np import pickle import pyro pyro.enable_validation(True) # can help with debugging def Problem_rose...
[ "pyro.enable_validation", "pickle.dump", "numpy.maximum", "algorithms.Bayesian_opt_Pyro.utilities_full.BayesOpt", "numpy.zeros", "pyro.set_rng_seed", "numpy.array", "numpy.random.normal" ]
[((247, 275), 'pyro.enable_validation', 'pyro.enable_validation', (['(True)'], {}), '(True)\n', (269, 275), False, 'import pyro\n'), ((1869, 1905), 'numpy.array', 'np.array', (['[[-1.5, 1.5], [-1.5, 1.5]]'], {}), '([[-1.5, 1.5], [-1.5, 1.5]])\n', (1877, 1905), True, 'import numpy as np\n'), ((1908, 1929), 'numpy.array'...
# Copyright 2020 Regents of the University of Minnesota. # # 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 applic...
[ "argparse.ArgumentParser", "mtap.RemoteProcessor", "mtap.Event", "mtap.EventsClient", "pathlib.Path", "numpy.array", "datetime.datetime.now" ]
[((6962, 6992), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (6976, 6992), False, 'from argparse import ArgumentParser, Namespace\n'), ((4839, 4865), 'pathlib.Path', 'Path', (['conf.input_directory'], {}), '(conf.input_directory)\n', (4843, 4865), False, 'from pathli...
from dataclasses import dataclass import os import pathlib import random import numpy as np import torch from logger import logger class Configuration(object): DEFAULT_RANDOM_SEED = 777 @classmethod def apply(cls, random_seed=DEFAULT_RANDOM_SEED): Configuration.set_torch_seed(random_seed=rando...
[ "numpy.random.seed", "torch.manual_seed", "torch.cuda.manual_seed", "logger.logger.info", "pathlib.Path", "random.seed", "os.path.join" ]
[((1124, 1167), 'os.path.join', 'os.path.join', (['CURRENT_MODULE_PATH', '"""config"""'], {}), "(CURRENT_MODULE_PATH, 'config')\n", (1136, 1167), False, 'import os\n'), ((1194, 1235), 'os.path.join', 'os.path.join', (['CURRENT_MODULE_PATH', '"""data"""'], {}), "(CURRENT_MODULE_PATH, 'data')\n", (1206, 1235), False, 'im...
import numpy as np import torch from .distributions import CRP_Generator from ..utils.graph_utils import shuffle_adj_matrix_batch_and_labels from ..utils.graph_utils import create_torch_geom_batch, create_dgl_batch from ..utils.graph_utils import create_torch_geom_single_graph, create_dgl_single_graph from ..utils.grap...
[ "numpy.tril_indices", "numpy.sum", "numpy.random.rand", "numpy.empty", "numpy.random.beta", "numpy.zeros", "torch.cat", "numpy.insert", "torch.normal", "numpy.random.randint", "numpy.arange", "numpy.repeat", "torch.zeros", "numpy.all", "torch.from_numpy" ]
[((1412, 1432), 'numpy.all', 'np.all', (['(clusters > 0)'], {}), '(clusters > 0)\n', (1418, 1432), True, 'import numpy as np\n'), ((1446, 1462), 'numpy.sum', 'np.sum', (['clusters'], {}), '(clusters)\n', (1452, 1462), True, 'import numpy as np\n'), ((1567, 1595), 'numpy.zeros', 'np.zeros', (['[batch_size, N, N]'], {}),...
import numpy as np import pandas as pd import os import time import datetime from joblib import Parallel, delayed data_path = '../data/' in_dir = os.path.join(data_path, 'backtest/') ### create order folders #### def generate_order(df, start, end): # df['date'] = df.index.map(lambda x: x[1].date()) # df.set_...
[ "pandas.DataFrame", "os.listdir", "os.makedirs", "os.path.exists", "joblib.Parallel", "pandas.read_pickle", "joblib.delayed", "os.path.join", "numpy.random.lognormal" ]
[((147, 183), 'os.path.join', 'os.path.join', (['data_path', '"""backtest/"""'], {}), "(data_path, 'backtest/')\n", (159, 183), False, 'import os\n'), ((605, 624), 'pandas.DataFrame', 'pd.DataFrame', (['order'], {}), '(order)\n', (617, 624), True, 'import pandas as pd\n'), ((838, 864), 'pandas.read_pickle', 'pd.read_pi...
import chainer import chainer.functions as F import chainer.initializers as I import chainer.links as L import chainer.optimizers as O from chainer import reporter import numpy as np def toOneHot(n, n_participants): res = np.eye(n_participants, dtype=np.float32)[n] return res class BaselineClassifier(chainer....
[ "numpy.full", "chainer.Variable", "chainer.reporter.report", "chainer.functions.reshape", "chainer.functions.softmax", "numpy.eye", "chainer.initializers.Uniform" ]
[((227, 267), 'numpy.eye', 'np.eye', (['n_participants'], {'dtype': 'np.float32'}), '(n_participants, dtype=np.float32)\n', (233, 267), True, 'import numpy as np\n'), ((523, 573), 'numpy.full', 'np.full', (['target.shape', 'self.mean'], {'dtype': 'np.float32'}), '(target.shape, self.mean, dtype=np.float32)\n', (530, 57...
import glob from time import time from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.callbacks import TensorBoard from keras.optimizers import RMSprop from numpy.random import seed from sklearn.model_selection import StratifiedKFold from keras.models import load_model from keras. models import Model...
[ "keras.models.load_model", "numpy.random.seed", "os.makedirs", "os.path.exists", "tensorflow.set_random_seed", "time.time", "sklearn.model_selection.StratifiedKFold", "keras.optimizers.RMSprop", "os.listdir" ]
[((558, 565), 'numpy.random.seed', 'seed', (['(1)'], {}), '(1)\n', (562, 565), False, 'from numpy.random import seed\n'), ((605, 623), 'tensorflow.set_random_seed', 'set_random_seed', (['(2)'], {}), '(2)\n', (620, 623), False, 'from tensorflow import set_random_seed\n'), ((4757, 4945), 'keras.models.load_model', 'load_...
import unittest import numpy as np import spdivik.score from spdivik.distance import ScipyDistance, KnownMetric class TestDunn(unittest.TestCase): def test_computes_inter_to_intracluster_distances_rate(self): data = np.array([[1], [3], [4], [6]]) centroids = np.array([[2], [5]]) labels =...
[ "numpy.array", "spdivik.distance.ScipyDistance" ]
[((232, 262), 'numpy.array', 'np.array', (['[[1], [3], [4], [6]]'], {}), '([[1], [3], [4], [6]])\n', (240, 262), True, 'import numpy as np\n'), ((283, 303), 'numpy.array', 'np.array', (['[[2], [5]]'], {}), '([[2], [5]])\n', (291, 303), True, 'import numpy as np\n'), ((321, 354), 'numpy.array', 'np.array', (['[1, 1, 2, ...
import torch import torch.nn as nn import numpy as np from typing import Dict, Tuple from yacs.config import CfgNode class FCHead(nn.Module): def __init__(self, cfg: CfgNode): """ Fully connected head for camera and betas regression. Args: cfg (CfgNode): Model config as yacs Cf...
[ "torch.nn.Linear", "torch.nn.init.xavier_uniform_", "torch.nn.ReLU", "numpy.load" ]
[((786, 843), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['self.layers[2].weight'], {'gain': '(0.02)'}), '(self.layers[2].weight, gain=0.02)\n', (809, 843), True, 'import torch.nn as nn\n'), ((867, 896), 'numpy.load', 'np.load', (['cfg.SMPL.MEAN_PARAMS'], {}), '(cfg.SMPL.MEAN_PARAMS)\n', (874, 896), T...
import numpy as np def make_continuous_copy(alpha): alpha = (alpha + np.pi) % (2.0 * np.pi) - np.pi continuous_x = np.zeros_like(alpha) continuous_x[0] = alpha[0] for i in range(1, len(alpha)): if not (np.sign(alpha[i]) == np.sign(alpha[i - 1])) and np.abs(alpha[i]) > np.pi / 2: co...
[ "numpy.full_like", "numpy.zeros_like", "numpy.abs", "numpy.isnan", "numpy.sign" ]
[((125, 145), 'numpy.zeros_like', 'np.zeros_like', (['alpha'], {}), '(alpha)\n', (138, 145), True, 'import numpy as np\n'), ((764, 787), 'numpy.full_like', 'np.full_like', (['x', 'np.nan'], {}), '(x, np.nan)\n', (776, 787), True, 'import numpy as np\n'), ((737, 753), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(...
##### file path # input path_df_D = "tianchi_fresh_comp_train_user.csv" path_df_part_1 = "df_part_1.csv" path_df_part_2 = "df_part_2.csv" path_df_part_3 = "df_part_3.csv" path_df_part_1_tar = "df_part_1_tar.csv" path_df_part_2_tar = "df_part_2_tar.csv" path_df_part_1_uic_label = "df_part_1_uic_label.csv" ...
[ "pandas.read_csv", "pandas.get_dummies", "pandas.merge", "numpy.datetime64", "pandas.to_datetime" ]
[((11749, 11814), 'pandas.merge', 'pd.merge', (['df_part_3_u_b_time', 'df_part_3_u_b4_time'], {'on': "['user_id']"}), "(df_part_3_u_b_time, df_part_3_u_b4_time, on=['user_id'])\n", (11757, 11814), True, 'import pandas as pd\n'), ((26533, 26598), 'pandas.merge', 'pd.merge', (['df_part_3_i_b_time', 'df_part_3_i_b4_time']...
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 h5py import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin import tensorflow as tf import sklearn.preprocessing ...
[ "numpy.sum", "data_utils.unNormalizeData", "numpy.mean", "numpy.arange", "numpy.random.randint", "data_utils.normalization_stats", "numpy.copy", "numpy.std", "numpy.power", "sklearn.preprocessing.LabelEncoder", "numpy.random.RandomState", "data_utils.expmap2rotmat", "h5py.File", "data_util...
[((1057, 1090), 'sklearn.preprocessing.LabelEncoder', 'data_preprocessing.LabelEncoder', ([], {}), '()\n', (1088, 1090), True, 'import sklearn.preprocessing as data_preprocessing\n'), ((2916, 2983), 'data_utils.load_data', 'data_utils.load_data', (['data_dir', 'train_subject_ids', 'actions', 'one_hot'], {}), '(data_dir...
import librosa import numpy def extract_max(pitches, magnitudes, shape): new_pitches = [] new_magnitudes = [] for i in range(0, shape[1]): new_pitches.append(numpy.max(pitches[:, i])) new_magnitudes.append(numpy.max(magnitudes[:, i])) return numpy.asarray(new_pitches), numpy.asarray(ne...
[ "numpy.asarray", "numpy.ones", "numpy.shape", "librosa.core.piptrack", "numpy.max", "librosa.load" ]
[((812, 891), 'librosa.core.piptrack', 'librosa.core.piptrack', ([], {'y': 'y', 'sr': 'sr', 'S': 'None', 'fmin': 'fmin', 'fmax': 'fmax', 'threshold': '(0.75)'}), '(y=y, sr=sr, S=None, fmin=fmin, fmax=fmax, threshold=0.75)\n', (833, 891), False, 'import librosa\n'), ((952, 972), 'numpy.shape', 'numpy.shape', (['pitches'...
import os import random import sys from collections import OrderedDict, defaultdict from datetime import datetime from os import path from time import sleep, time import matplotlib import matplotlib.pyplot as plt import numpy as np import torch from scipy import ndimage from torch import nn, optim from torch.nn.parall...
[ "matplotlib.rc", "numpy.argmax", "collections.defaultdict", "matplotlib.pyplot.figure", "numpy.mean", "sys.exc_info", "torch.cuda.current_device", "torch.no_grad", "os.path.join", "matplotlib.pyplot.close", "datetime.datetime.now", "tqdm.tqdm", "time.sleep", "matplotlib.use", "datetime.d...
[((519, 540), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (533, 540), False, 'import matplotlib\n'), ((571, 602), 'os.makedirs', 'os.makedirs', (['dir'], {'exist_ok': '(True)'}), '(dir, exist_ok=True)\n', (582, 602), False, 'import os\n'), ((1819, 1836), 'collections.defaultdict', 'defaultdict...
import tensorflow as tf model = tf.keras.models.load_model('model_car_damage.h5') import streamlit as st st.write(""" # upload car image """ ) st.write("This is a simple image classification web app to predict type of car damage") file = st.file_uploader("Please upload an image file", type=["...
[ "tensorflow.keras.models.load_model", "streamlit.image", "PIL.ImageOps.fit", "cv2.cvtColor", "numpy.argmax", "numpy.asarray", "streamlit.file_uploader", "streamlit.write", "PIL.Image.open", "streamlit.text", "cv2.resize" ]
[((32, 81), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""model_car_damage.h5"""'], {}), "('model_car_damage.h5')\n", (58, 81), True, 'import tensorflow as tf\n'), ((105, 159), 'streamlit.write', 'st.write', (['"""\n # upload car image\n """'], {}), '("""\n # upload c...
# File: bayesian_gp.py # File Created: Thursday, 7th November 2019 9:55:27 am # Author: <NAME> (<EMAIL>) """ Simple Bayesian Gaussian process Example usage: >>> model = BayesianGP(x, y) >>> model.raw_scales_prior = Normal(mean_scales, std_scales) # Optional >>> model.fit() >>> mf, vf = model.predict_f(x_test) >>> my...
[ "torch.triangular_solve", "functools.partial", "pyro.distributions.transforms.ExpTransform", "pyro.distributions.Delta", "pyro.sample", "pyro.infer.mcmc.MCMC", "torch.cholesky", "torch.exp", "pyro.infer.mcmc.NUTS", "torch.set_num_threads", "torch.clamp", "torch.transpose", "torch.zeros", "...
[((649, 673), 'torch.set_num_threads', 'torch.set_num_threads', (['(1)'], {}), '(1)\n', (670, 673), False, 'import torch\n'), ((743, 782), 'functools.partial', 'partial', (['torch.zeros'], {'dtype': 'torch_dtype'}), '(torch.zeros, dtype=torch_dtype)\n', (750, 782), False, 'from functools import partial\n'), ((790, 828)...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import logging as log import os import sys import tarfile from functools import lru_cache from pathlib import Path from typing import Any, Dict, List, Tuple import numpy as np import pandas as pd import pyproj import rasterio import urllib3 logging = log.getL...
[ "json.dump", "os.remove", "rasterio.open", "logging.getLogger", "numpy.around", "pathlib.Path", "numpy.array", "urllib3.PoolManager", "pyproj.Transformer.from_crs", "tarfile.open", "functools.lru_cache", "sys.exit" ]
[((312, 339), 'logging.getLogger', 'log.getLogger', (['"""cm-hdd_cdd"""'], {}), "('cm-hdd_cdd')\n", (325, 339), True, 'import logging as log\n'), ((5667, 5689), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(256)'}), '(maxsize=256)\n', (5676, 5689), False, 'from functools import lru_cache\n'), ((6630, 6641), 'f...
import os import matplotlib.pyplot as plt import random import h5py import numpy as np import warnings from sklearn.neighbors import kneighbors_graph from sklearn.cluster import SpectralClustering from sklearn.cluster import KMeans from sklearn.cluster import MeanShift from sklearn.cluster import estimate_ban...
[ "numpy.load", "h5py.File", "warnings.filterwarnings", "sklearn.cluster.SpectralClustering", "sklearn.metrics.silhouette_score", "sklearn.neighbors.kneighbors_graph", "os.path.join" ]
[((556, 624), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""', '""".*Graph is not fully connected*"""'], {}), "('ignore', '.*Graph is not fully connected*')\n", (579, 624), False, 'import warnings\n'), ((731, 756), 'h5py.File', 'h5py.File', (['file_name', '"""r"""'], {}), "(file_name, 'r')\n", (7...
import os from glob import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.ndimage import label from IPython.display import display _LABEL_MAP = {'normal': 0, 'aggressive_long_accel': 1, 'aggressive_turn': 2, 'aggressive_bump': 3} _COL_NAMES = ['timestamp', 'ac...
[ "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.hist", "numpy.count_nonzero", "pandas.read_csv", "pandas.DataFrame.from_dict", "numpy.zeros", "IPython.display.display", "numpy.nonzero", "scipy.ndimage.label", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join" ]
[((6649, 6669), 'scipy.ndimage.label', 'label', (['manual_labels'], {}), '(manual_labels)\n', (6654, 6669), False, 'from scipy.ndimage import label\n'), ((6682, 6700), 'numpy.zeros', 'np.zeros', (['n_labels'], {}), '(n_labels)\n', (6690, 6700), True, 'import numpy as np\n'), ((6816, 6842), 'matplotlib.pyplot.hist', 'pl...
""" This is a longer example that applies time domain beamforming towards a source of interest in the presence of a strong interfering source. """ from __future__ import division, print_function import os import numpy as np import matplotlib.pyplot as plt from scipy.io import wavfile import pyroomacoustics as pra fr...
[ "pyroomacoustics.linear_2D_array", "pyroomacoustics.transform.stft.analysis", "pyroomacoustics.circular_2D_array", "pyroomacoustics.Beamformer", "os.path.dirname", "scipy.io.wavfile.write", "pyroomacoustics.hann", "matplotlib.pyplot.subplots", "pyroomacoustics.highpass", "pyroomacoustics.ShoeBox",...
[((556, 574), 'pyroomacoustics.hann', 'pra.hann', (['fft_size'], {}), '(fft_size)\n', (564, 574), True, 'import pyroomacoustics as pra\n'), ((779, 797), 'numpy.array', 'np.array', (['[2, 1.5]'], {}), '([2, 1.5])\n', (787, 797), True, 'import numpy as np\n'), ((1057, 1075), 'numpy.ceil', 'np.ceil', (['(Lg_t * Fs)'], {})...
import cv2 import numpy as np import math as mt import matplotlib.pyplot as plt def RGB2HSI(rgb_img): ''' RGB image 2 HSI image ''' rgb_img = np.array(rgb_img, dtype="float32") n, m = rgb_img.shape[0], rgb_img.shape[1] hsi_img = rgb_img.copy() B, G, R = cv2.split(rgb_img) [B, G, R] ...
[ "numpy.abs", "numpy.floor", "numpy.ones", "numpy.clip", "numpy.random.randint", "numpy.mean", "numpy.exp", "numpy.random.normal", "cv2.rectangle", "cv2.minMaxLoc", "cv2.erode", "numpy.fft.ifft2", "cv2.matchTemplate", "numpy.multiply", "cv2.dilate", "cv2.cvtColor", "matplotlib.pyplot....
[((163, 197), 'numpy.array', 'np.array', (['rgb_img'], {'dtype': '"""float32"""'}), "(rgb_img, dtype='float32')\n", (171, 197), True, 'import numpy as np\n'), ((287, 305), 'cv2.split', 'cv2.split', (['rgb_img'], {}), '(rgb_img)\n', (296, 305), False, 'import cv2\n'), ((363, 379), 'numpy.zeros', 'np.zeros', (['(n, m)'],...
# Copyright 2019 Huawei Technologies Co., Ltd # # 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...
[ "mindspore.dataset.transforms.c_transforms.Slice", "numpy.testing.assert_array_equal", "pytest.raises", "numpy.array", "mindspore.dataset.NumpySlicesDataset" ]
[((873, 903), 'mindspore.dataset.NumpySlicesDataset', 'ds.NumpySlicesDataset', (['[array]'], {}), '([array])\n', (894, 903), True, 'import mindspore.dataset as ds\n'), ((916, 931), 'numpy.array', 'np.array', (['array'], {}), '(array)\n', (924, 931), True, 'import numpy as np\n'), ((1119, 1161), 'numpy.testing.assert_ar...
import numpy as np import librosa class AudioTransform: def __init__(self, always_apply=False, p=0.5): self.always_apply = always_apply self.p = p def __call__(self, y: np.ndarray): if self.always_apply: return self.apply(y) else: if np.random.rand() < ...
[ "numpy.random.uniform", "librosa.effects.time_stretch", "numpy.random.randint", "numpy.random.rand", "numpy.sqrt", "librosa.effects.pitch_shift" ]
[((784, 820), 'numpy.random.uniform', 'np.random.uniform', (['*self.noise_level'], {}), '(*self.noise_level)\n', (801, 820), True, 'import numpy as np\n'), ((1258, 1303), 'numpy.random.uniform', 'np.random.uniform', (['self.min_snr', 'self.max_snr'], {}), '(self.min_snr, self.max_snr)\n', (1275, 1303), True, 'import nu...
import os import sys import argparse import configparser import multiprocessing from datetime import datetime import pytz import math import matplotlib.pylab as plt #plt.use('Agg') sys.path.append(os.getcwd()) import random import numpy as np from glob import glob import shutil import torch import torch.nn as nn impor...
[ "numpy.sum", "argparse.ArgumentParser", "numpy.ones", "numpy.argmin", "src.lib.trainer.trainer.Trainer", "os.path.join", "torch.utils.data.DataLoader", "torch.load", "src.lib.datasets.sampler.BalancedBatchSampler", "src.lib.utils.cmd_args.create_classifier_parser", "configparser.ConfigParser", ...
[((197, 208), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (206, 208), False, 'import os\n'), ((906, 1025), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'add_help': '(False)'}), '(description=__doc__, formatter_class=argp...
''' License copyright <NAME> (PTB) 2020 This software is licensed under the BSD-like license: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyrigh...
[ "compressedftir.utils.relative_residual", "numpy.ma.masked_equal", "compressedftir.utils.ht", "numpy.zeros", "numpy.transpose", "scipy.linalg.svd", "scipy.sparse.csr_matrix", "scipy.sparse.linalg.spsolve", "numpy.dot", "compressedftir.utils.scipy_block_diag", "numpy.sqrt" ]
[((2427, 2469), 'numpy.zeros', 'np.zeros', (['(curr_r, _n)'], {'dtype': 'Xomega.dtype'}), '((curr_r, _n), dtype=Xomega.dtype)\n', (2435, 2469), True, 'import numpy as np\n'), ((2480, 2508), 'scipy.sparse.csr_matrix', 'csr_matrix', (['(curr_r, curr_r)'], {}), '((curr_r, curr_r))\n', (2490, 2508), False, 'from scipy.spar...
import logging as log import unittest import numpy as np from mock import patch, mock_open from lstm import preprocessing as prep class PreProcessingTest(unittest.TestCase): @patch("builtins.open", mock_open(read_data="hello foo bar!")) def test_load_data(self): path = "data path" text = pr...
[ "lstm.preprocessing.get_batches", "mock.mock_open", "lstm.preprocessing.load_data", "lstm.preprocessing.one_hot_encode", "numpy.array", "lstm.preprocessing.tokenize" ]
[((318, 338), 'lstm.preprocessing.load_data', 'prep.load_data', (['path'], {}), '(path)\n', (332, 338), True, 'from lstm import preprocessing as prep\n'), ((207, 244), 'mock.mock_open', 'mock_open', ([], {'read_data': '"""hello foo bar!"""'}), "(read_data='hello foo bar!')\n", (216, 244), False, 'from mock import patch...
from http.server import HTTPServer, BaseHTTPRequestHandler import cgi from datetime import datetime import hashlib import json import numpy as np from biobert_ner.run_ner import BioBERT, FLAGS from convert import pubtator2dict_list, pubtator_biocxml2dict_list, \ get_pub_annotation, get_pubtator from normalize impo...
[ "biobert_ner.run_ner.BioBERT", "os.remove", "os.mkdir", "numpy.random.seed", "argparse.ArgumentParser", "socket.socket", "json.dumps", "convert.get_pub_annotation", "os.path.isfile", "os.path.join", "urllib.parse.urlparse", "json.loads", "utils.filter_entities", "normalize.Normalizer", "...
[((21802, 21851), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (21815, 21851), False, 'import socket\n'), ((22724, 22743), 'os.listdir', 'os.listdir', (['dirname'], {}), '(dirname)\n', (22734, 22743), False, 'import os\n'), ((25665, 25690), ...
# BSD 2-CLAUSE LICENSE # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # Redistributions in ...
[ "greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator.summary", "numpy.timedelta64", "pmdarima.arima.AutoARIMA", "modin.pandas.DataFrame", "modin.pandas.infer_freq", "numpy.repeat" ]
[((8259, 9370), 'pmdarima.arima.AutoARIMA', 'AutoARIMA', ([], {'start_p': 'self.start_p', 'd': 'self.d', 'start_q': 'self.start_q', 'max_p': 'self.max_p', 'max_d': 'self.max_d', 'max_q': 'self.max_q', 'start_P': 'self.start_P', 'D': 'self.D', 'start_Q': 'self.start_Q', 'max_P': 'self.max_P', 'max_D': 'self.max_D', 'max...
import numpy as np ''' Numpy axes: Axis 1: ====> |-------+-------+-------+-------+ | R/C | col 1 | col 2 | ... | |-------+-------+-------+-------+ Axis 0: | row 1 | | | | || --------+-------+-------+-------+ || | row 2 | | | |...
[ "numpy.concatenate" ]
[((1764, 1798), 'numpy.concatenate', 'np.concatenate', (['[matrix1, matrix2]'], {}), '([matrix1, matrix2])\n', (1778, 1798), True, 'import numpy as np\n')]
import pandas as pd import numpy as np import matplotlib.pyplot as plt # reading the dataset data = pd.read_csv("dataset.csv") data_label0 = data[data['Label'] == 0] data_label1 = data[data['Label'] == 1] # splitting the dataset into 2 sets: train set and test set train_set = data.sample(frac=0.8) test_set = data.dro...
[ "matplotlib.pyplot.show", "pandas.read_csv", "matplotlib.pyplot.scatter", "numpy.ones", "numpy.append", "numpy.random.normal" ]
[((101, 127), 'pandas.read_csv', 'pd.read_csv', (['"""dataset.csv"""'], {}), "('dataset.csv')\n", (112, 127), True, 'import pandas as pd\n'), ((2174, 2184), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2182, 2184), True, 'import matplotlib.pyplot as plt\n'), ((1706, 1726), 'numpy.append', 'np.append', (['z0...
import os import shutil from typing import List import numpy as np import torch ORIGIN_DIR = 'data/UTKFace' DESTINATION_DIR = 'data/renamed' def rename_files(): if not os.path.exists(DESTINATION_DIR): os.makedirs(DESTINATION_DIR) else: x = input("Do you want to rewrite the folder? Y/N").lowe...
[ "os.makedirs", "os.path.exists", "torch.max", "numpy.linspace", "shutil.rmtree", "os.path.join", "os.listdir" ]
[((176, 207), 'os.path.exists', 'os.path.exists', (['DESTINATION_DIR'], {}), '(DESTINATION_DIR)\n', (190, 207), False, 'import os\n'), ((217, 245), 'os.makedirs', 'os.makedirs', (['DESTINATION_DIR'], {}), '(DESTINATION_DIR)\n', (228, 245), False, 'import os\n'), ((621, 643), 'os.listdir', 'os.listdir', (['ORIGIN_DIR'],...
#!/usr/bin/env python3 """Turn evaluation file into sequences of videos. Not sure how I'm going to make this method-agnostic.""" import argparse import json import os import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from scipy.misc import imread import h5py import addpaths # noqa from...
[ "numpy.stack", "h5py.File", "matplotlib.pyplot.show", "argparse.ArgumentParser", "os.makedirs", "scipy.io.loadmat", "numpy.argmin", "scipy.misc.imread", "numpy.random.randint", "numpy.arange", "plot_seqs.draw_poses", "os.path.join", "numpy.concatenate" ]
[((601, 626), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (624, 626), False, 'import argparse\n'), ((4361, 4413), 'os.path.join', 'os.path.join', (['POSE_DIR', "('pose_clip_%d.mat' % tmp2_id)"], {}), "(POSE_DIR, 'pose_clip_%d.mat' % tmp2_id)\n", (4373, 4413), False, 'import os\n'), ((4429, 4...
# To import required modules: import numpy as np import time import os import sys import matplotlib import matplotlib.cm as cm #for color maps import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec #for specifying plot attributes from matplotlib import ticker #for setting contour plots to log scale im...
[ "matplotlib.pyplot.show", "numpy.copy", "matplotlib.pyplot.close", "os.path.realpath", "corner.quantile", "numpy.diff", "numpy.array", "numpy.exp" ]
[((3401, 3431), 'numpy.copy', 'np.copy', (['active_params_symbols'], {}), '(active_params_symbols)\n', (3408, 3431), True, 'import numpy as np\n'), ((3881, 3924), 'numpy.array', 'np.array', (["data_train['active_params_names']"], {}), "(data_train['active_params_names'])\n", (3889, 3924), True, 'import numpy as np\n'),...
from enum import Enum import numpy as np class TradeDirection(Enum): LONG = 1 #SHORT = -1 class Trade(): def __init__(self, entry_price : float, quantity : float, direction : TradeDirection, take_profit_pct : float, commission_pct : float = 0.001, stop_loss_pct : float = None, leverage : i...
[ "unittest.main", "numpy.clip" ]
[((3405, 3420), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3418, 3420), False, 'import unittest\n'), ((586, 611), 'numpy.clip', 'np.clip', (['leverage', '(1)', '(100)'], {}), '(leverage, 1, 100)\n', (593, 611), True, 'import numpy as np\n')]
# -*- coding:utf-8 -*- import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.rc('font',family='Times New Roman') plt.rc('font',size=9.5) import random import os cwd = r'..\large_scale_synchronization_r4' import csv def main(nb_DC,nb_warehouse,nb_pick_up_station,square_length): wit...
[ "matplotlib.pyplot.title", "numpy.floor", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.arange", "os.path.join", "pandas.DataFrame", "matplotlib.pyplot.yticks", "matplotlib.pyplot.rc", "matplotlib.pyplot.xticks", "matplotlib.pyplot.show", "csv.writer", "matplotlib.pyplot.ylim", ...
[((106, 146), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""Times New Roman"""'}), "('font', family='Times New Roman')\n", (112, 146), True, 'import matplotlib.pyplot as plt\n'), ((146, 170), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': '(9.5)'}), "('font', size=9.5)\n", (152, 170), T...
from x2df.examples.__example__ import AbstractExample from scipy import signal from math import pi from numpy import linspace from pandas import DataFrame class Example(AbstractExample): def createDF(self): f = 10 omega = 2 * pi * f Ds = linspace(0.1, 2, 10) df = DataFrame() ...
[ "pandas.DataFrame", "scipy.signal.step", "numpy.linspace", "scipy.signal.lti" ]
[((268, 288), 'numpy.linspace', 'linspace', (['(0.1)', '(2)', '(10)'], {}), '(0.1, 2, 10)\n', (276, 288), False, 'from numpy import linspace\n'), ((302, 313), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (311, 313), False, 'from pandas import DataFrame\n'), ((326, 354), 'numpy.linspace', 'linspace', (['(0)', '(10...
import pandas as pd import numpy as np import scipy.optimize import numdifftools as nd from pyswarm import pso from matplotlib import pyplot import pickle import time size = 7 train_time = 7 max_time = 8 state_map_dict = {0:'KY', 1:'OH', 2:'PA', 3:'VA', 4:'WV'} county_map_dict = {0:'NELSON', 1:'AUGUSTA', 2:'ROCKBRIDG...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.legend", "numpy.random.rand", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((1100, 1133), 'pandas.read_csv', 'pd.read_csv', (['"""MCM_NFLIS_Data.csv"""'], {}), "('MCM_NFLIS_Data.csv')\n", (1111, 1133), True, 'import pandas as pd\n'), ((1469, 1512), 'pandas.read_csv', 'pd.read_csv', (['"""ACS_10_5YR_DP02_with_ann.csv"""'], {}), "('ACS_10_5YR_DP02_with_ann.csv')\n", (1480, 1512), True, 'import...
"""SIFT Detector-Descriptor implementation. The detector was proposed in 'Distinctive Image Features from Scale-Invariant Keypoints' and is implemented by wrapping over OpenCV's API. References: - https://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf - https://docs.opencv.org/3.4.2/d5/d3c/classcv_1_1xfeatures2d_1_1SIFT.html ...
[ "gtsfm.utils.features.cast_to_gtsfm_keypoints", "numpy.argsort", "cv2.SIFT_create", "gtsfm.utils.images.rgb_to_gray_cv", "gtsfm.common.keypoints.Keypoints" ]
[((1349, 1382), 'gtsfm.utils.images.rgb_to_gray_cv', 'image_utils.rgb_to_gray_cv', (['image'], {}), '(image)\n', (1375, 1382), True, 'import gtsfm.utils.images as image_utils\n'), ((1438, 1454), 'cv2.SIFT_create', 'cv.SIFT_create', ([], {}), '()\n', (1452, 1454), True, 'import cv2 as cv\n'), ((1640, 1691), 'gtsfm.utils...
import numpy as np import time import subprocess import json HOST = "http://localhost:3000" CLUSTER = "test" PART = 'main-part' USERS = np.array(['user1_1', 'user2_1', 'user3_1']) STATES = np.array(['COMPLETED', 'CANCELLED', 'FAILED', 'TIMEOUT']) STATES_P = np.array([0.47, 0.07, 0.24, 0.22]) TIME_START = 1646082000 ...
[ "numpy.random.default_rng", "subprocess.Popen", "numpy.array", "json.dumps" ]
[((138, 181), 'numpy.array', 'np.array', (["['user1_1', 'user2_1', 'user3_1']"], {}), "(['user1_1', 'user2_1', 'user3_1'])\n", (146, 181), True, 'import numpy as np\n'), ((191, 248), 'numpy.array', 'np.array', (["['COMPLETED', 'CANCELLED', 'FAILED', 'TIMEOUT']"], {}), "(['COMPLETED', 'CANCELLED', 'FAILED', 'TIMEOUT'])\...
"""Useful functions.""" import os import numpy as np import pandas as pd import pkgutil # TODO: this is the only dependency that requires a compiler. It does not ship a # pre-compiled wheel. Perhaps we can write a python/numpy implementation? from ushuffle import shuffle def make_directory(dirpath, verbose=1): "...
[ "os.mkdir", "pkgutil.get_loader", "numpy.argmax", "os.path.isdir", "numpy.asarray", "numpy.asanyarray", "numpy.zeros", "numpy.random.default_rng", "numpy.array", "pandas.Series", "numpy.eye" ]
[((1576, 1605), 'pkgutil.get_loader', 'pkgutil.get_loader', (['model_zoo'], {}), '(model_zoo)\n', (1594, 1605), False, 'import pkgutil\n'), ((2693, 2717), 'numpy.asanyarray', 'np.asanyarray', (['sequences'], {}), '(sequences)\n', (2706, 2717), True, 'import numpy as np\n'), ((2973, 3022), 'numpy.zeros', 'np.zeros', (['...
""" cv2.erode() method : cv2.erode() method is used to perform erosion on the image. The basic idea of erosion is just like soil erosion only, it erodes away the boundaries of foreground object (Always try to keep foreground in white). It is normally performed on binary images. It needs two inputs,...
[ "cv2.waitKey", "cv2.destroyAllWindows", "numpy.ones", "numpy.hstack", "cv2.imread", "cv2.erode", "cv2.imshow" ]
[((799, 815), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (809, 815), False, 'import cv2\n'), ((909, 934), 'numpy.ones', 'np.ones', (['(6, 6)', 'np.uint8'], {}), '((6, 6), np.uint8)\n', (916, 934), True, 'import numpy as np\n'), ((972, 1013), 'cv2.erode', 'cv2.erode', (['image', 'kernel', 'cv2.BORDER_WRAP']...
from dxtorch.dxtensor import Tensor from .module import Module import numpy as np class Flatten(Module): def __init__(self, start_dim: int = 1, end_dim: int = -1) -> None: super().__init__() self.start_dim = start_dim self.end_dim = end_dim def forward(self, x: Tensor) -> Tensor: start_dim = self...
[ "numpy.prod" ]
[((461, 510), 'numpy.prod', 'np.prod', (['x.shape[self.start_dim:self.end_dim + 1]'], {}), '(x.shape[self.start_dim:self.end_dim + 1])\n', (468, 510), True, 'import numpy as np\n')]
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
[ "nethash.hash_b6", "nethash.hash_b5", "nethash.hash_b3", "nethash.hash_u4", "numpy.std", "nethash.hash_u6", "dpkt.ethernet.Ethernet", "socket.inet_ntop", "nethash.hash_u3", "nethash.hash_u5", "collections.OrderedDict", "nethash.hash_b4", "sys.exit", "csv.DictWriter" ]
[((2009, 2022), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2020, 2022), False, 'from collections import OrderedDict\n'), ((2051, 2064), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2062, 2064), False, 'from collections import OrderedDict\n'), ((9605, 9632), 'numpy.std', 'np.std', (["fl...
from scipy.integrate import odeint import pandas as pd import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import networkx as nx class SavingsCoreBest: def __init__( self, adjacency=None, savings_rate=None, capital=None, tau=3, ...
[ "matplotlib.pyplot.title", "numpy.argmax", "numpy.random.exponential", "numpy.ones", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.exp", "numpy.random.normal", "matplotlib.pyplot.gca", "pandas.DataFrame", "networkx.adj_matrix", "scipy.integrate.odeint", "numpy.linspace", "matp...
[((2390, 2440), 'numpy.random.exponential', 'np.random.exponential', ([], {'scale': 'self.tau', 'size': 'self.n'}), '(scale=self.tau, size=self.n)\n', (2411, 2440), True, 'import numpy as np\n'), ((2665, 2687), 'numpy.array', 'np.array', (['savings_rate'], {}), '(savings_rate)\n', (2673, 2687), True, 'import numpy as n...
from Bio import SeqIO from collections import Counter import numpy as np import pandas as pd from pathlib import Path from typing import Dict, List, Tuple import matplotlib.pyplot as plt def sample_records(genome_loc: Path, genome_red_loc: Path, num_records: int): """ Samples n reads from a fasta file and saves t...
[ "Bio.SeqIO.parse", "matplotlib.pyplot.show", "Bio.SeqIO.write", "numpy.log2", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots" ]
[((1127, 1163), 'Bio.SeqIO.parse', 'SeqIO.parse', (['genome_red_loc', '"""fasta"""'], {}), "(genome_red_loc, 'fasta')\n", (1138, 1163), False, 'from Bio import SeqIO\n'), ((4647, 4662), 'matplotlib.pyplot.subplots', 'plt.subplots', (['k'], {}), '(k)\n', (4659, 4662), True, 'import matplotlib.pyplot as plt\n'), ((5224, ...
import sys sys.path.insert(0, '..') from utils import data import os import sklearn import numpy as np from sklearn.neighbors import ( KNeighborsClassifier, DistanceMetric ) import json from shapely.geometry import Point import matplotlib.pyplot as plt import geopandas as gpd import geoplot as g...
[ "numpy.ones", "os.path.join", "utils.data.load_csv_data", "numpy.insert", "numpy.reshape", "matplotlib.pyplot.subplots", "datetime.date.date", "matplotlib.pyplot.show", "pandas.date_range", "matplotlib.pyplot.legend", "datetime.date", "datetime.datetime.strptime", "matplotlib.pyplot.gcf", ...
[((12, 36), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (27, 36), False, 'import sys\n'), ((887, 983), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""csse_covid_19_time_series"""', '"""time_series_covid19_confirmed_US.csv"""'], {}), "(BASE_PATH, 'csse_covid_19_time_series',\n ...
""" Unittest module for proximal operator. """ import pytest import numpy as np import torch from carpet.checks import check_random_state from carpet.proximity import (pseudo_soft_th_tensor, pseudo_soft_th_numpy) @pytest.mark.parametrize('seed', [None]) @pytest.mark.parametrize('lbda', [...
[ "numpy.testing.assert_allclose", "carpet.proximity.pseudo_soft_th_numpy", "carpet.checks.check_random_state", "torch.Tensor", "pytest.mark.parametrize" ]
[((246, 285), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""seed"""', '[None]'], {}), "('seed', [None])\n", (269, 285), False, 'import pytest\n'), ((287, 335), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lbda"""', '[0.1, 0.5, 1.0]'], {}), "('lbda', [0.1, 0.5, 1.0])\n", (310, 335), False, '...
# create by <NAME>, minor adjusted by <NAME> import warnings import numpy as np import scipy.sparse as sp from scipy.optimize import fsolve from scipy.spatial.distance import pdist from scipy.linalg import eig from scipy.integrate import odeint from sklearn.neighbors import NearestNeighbors from .scVectorField import ...
[ "numpy.fft.rfft", "numpy.abs", "scipy.sparse.issparse", "numpy.sin", "scipy.spatial.distance.pdist", "numpy.linalg.norm", "numpy.atleast_2d", "numpy.zeros_like", "warnings.simplefilter", "scipy.optimize.fsolve", "numpy.expm1", "warnings.catch_warnings", "numpy.real", "numpy.linspace", "n...
[((674, 690), 'numpy.atleast_2d', 'np.atleast_2d', (['X'], {}), '(X)\n', (687, 690), True, 'import numpy as np\n'), ((1554, 1565), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (1562, 1565), True, 'import numpy as np\n'), ((2130, 2144), 'scipy.optimize.fsolve', 'fsolve', (['F', 'x01'], {}), '(F, x01)\n', (2136, 2144...
import numpy as np import matplotlib.pyplot as plt ''' log_names = ['log.txt'] for log_name in log_names: data = np.loadtxt(log_name, skiprows=1) losses = [] curr = 0 loss = 0 for ind in data: if ind[0] == curr: loss += ind[2] + ind[3] + ind[4] else: losses...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.axvline", "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((627, 651), 'numpy.loadtxt', 'np.loadtxt', (['"""errors.txt"""'], {}), "('errors.txt')\n", (637, 651), True, 'import numpy as np\n'), ((684, 716), 'matplotlib.pyplot.scatter', 'plt.scatter', (['etas', 'errors'], {'s': '(0.9)'}), '(etas, errors, s=0.9)\n', (695, 716), True, 'import matplotlib.pyplot as plt\n'), ((717,...
import numpy as np import random import scipy.stats import math import tensorflow as tf from .utils import calc_cross_distances class DistributionWrapper: def __init__(self, sample_fn, pdf_fn): self.sample_fn = sample_fn self.pdf_fn = pdf_fn def sample(self, *args): return self.sample...
[ "tensorflow.reduce_sum", "tensorflow.cumsum", "tensorflow.gather_nd", "tensorflow.maximum", "tensorflow.reshape", "tensorflow.reduce_all", "tensorflow.matmul", "tensorflow.linalg.det", "tensorflow.linalg.inv", "tensorflow.reduce_prod", "tensorflow.sqrt", "tensorflow.math.log", "tensorflow.ra...
[((2899, 2928), 'numpy.array', 'np.array', (['center'], {'dtype': 'float'}), '(center, dtype=float)\n', (2907, 2928), True, 'import numpy as np\n'), ((2937, 2961), 'numpy.array', 'np.array', (['T'], {'dtype': 'float'}), '(T, dtype=float)\n', (2945, 2961), True, 'import numpy as np\n'), ((3660, 3678), 'numpy.array', 'np...
import numpy as np import torch import torch.utils.data from transformer import Constants as c from tqdm import tqdm def paired_collate_fn(insts): src_insts, tgt_insts = list(zip(*insts)) src_insts = collate_fn(src_insts) tgt_insts = collate_fn(tgt_insts) return (*src_insts, *tgt_insts) def collate...
[ "numpy.random.randint", "torch.LongTensor" ]
[((696, 723), 'torch.LongTensor', 'torch.LongTensor', (['batch_seq'], {}), '(batch_seq)\n', (712, 723), False, 'import torch\n'), ((740, 767), 'torch.LongTensor', 'torch.LongTensor', (['batch_pos'], {}), '(batch_pos)\n', (756, 767), False, 'import torch\n'), ((5300, 5355), 'numpy.random.randint', 'np.random.randint', (...
import numpy as np import autofit as af import autolens as al from autolens.lens.subhalo import SubhaloResult class TestSubhaloResult: def test__result_derived_properties(self): lower_limit_lists = [[0.0, 0.0], [0.0, 0.5], [0.5, 0.0], [0.5, 0.5]] grid_search_result = af.GridSearchRe...
[ "autolens.lens.subhalo.SubhaloResult", "autofit.UniformPrior", "numpy.array" ]
[((624, 697), 'autolens.lens.subhalo.SubhaloResult', 'SubhaloResult', ([], {'grid_search_result': 'grid_search_result', 'result_no_subhalo': '(1)'}), '(grid_search_result=grid_search_result, result_no_subhalo=1)\n', (637, 697), False, 'from autolens.lens.subhalo import SubhaloResult\n'), ((812, 846), 'numpy.array', 'np...
#!/usr/bin/python import matplotlib.pyplot as plt import numpy as np import sys import string benchmark = 'class' mydpi = 600 pltsize = (9, 3.2) data = { 'class_fine_grained' : { '2_slices' : [0.864, 0.966, 0.973, 0.871, 0.842, 0.881, 0.85, 0.793, 0.945, 0.956, 0.783, 0.84, 0.847, 0.856, 0.863, 0.861, 0...
[ "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefig", "numpy.arange", "matplotlib.pyplot.subplots" ]
[((1734, 1746), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (1743, 1746), True, 'import numpy as np\n'), ((1835, 1864), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'pltsize'}), '(figsize=pltsize)\n', (1847, 1864), True, 'import matplotlib.pyplot as plt\n'), ((3562, 3580), 'matplotlib.pyplot.ti...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import json from dipy.tracking.streamlinespeed import length import numpy as np from scilpy.io.streamlines import load_tractogram_with_reference from scilpy.io.utils import (add_json_args, add_reference_arg, ...
[ "scilpy.io.utils.assert_inputs_exist", "dipy.tracking.streamlinespeed.length", "argparse.ArgumentParser", "numpy.std", "numpy.min", "numpy.mean", "numpy.max", "scilpy.io.utils.add_json_args", "scilpy.io.utils.add_reference_arg", "scilpy.io.streamlines.load_tractogram_with_reference" ]
[((386, 583), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute streamlines min, mean and max length, as well as standard deviation of length in mm."""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'Compute streamlines min, mean and max length,...
# Dada uma placa quadrada 1x1 m^2 e as temperaturas de fronteiras # calcule a temperatura nesta placa e visualize a distribuição # usando Gauss-Seidel e um grid nxn # Aluno: <NAME> # NºUSP: 4182085 import GaussSeidel as gsd import numpy as np import matplotlib.pyplot as plt # Retorna a matriz de coeficie...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "numpy.identity", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.ylabel", "GaussSeidel.initialX", "matplotlib.pyplot.xlabel", "GaussSeidel.solve" ]
[((480, 498), 'numpy.zeros', 'np.zeros', (['m', 'float'], {}), '(m, float)\n', (488, 498), True, 'import numpy as np\n'), ((2652, 2663), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (2660, 2663), True, 'import numpy as np\n'), ((3005, 3023), 'GaussSeidel.initialX', 'gsd.initialX', (['A', 'b'], {}), '(A, b)\n', (3...
# -*- coding: utf-8 -*- """ Build new Fiber to Fiber """ import matplotlib matplotlib.use('agg') import glob import numpy as np import os.path as op import splinelab import fitsio from astropy.io import fits from distutils.dir_util import mkpath from input_utils import setup_parser, set_daterange, setup_logging from...
[ "input_utils.setup_logging", "numpy.nanmedian", "fitsio.read", "numpy.arange", "numpy.interp", "os.path.join", "numpy.array_split", "numpy.unique", "os.path.dirname", "numpy.isfinite", "numpy.linspace", "scipy.interpolate.splrep", "os.path.basename", "numpy.median", "input_utils.setup_pa...
[((76, 97), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (90, 97), False, 'import matplotlib\n'), ((547, 572), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'nknots'], {}), '(0, 1, nknots)\n', (558, 572), True, 'import numpy as np\n'), ((581, 603), 'splinelab.augknt', 'splinelab.augknt', (['...
from flask import Flask, request, json from flask_cors import CORS from bs4 import BeautifulSoup import requests import base64 from PIL import Image import numpy as np import io import re from eval import evaluate from locateWord import find_word import os app = Flask(__name__) CORS(app) links = "" words = "" imgArra...
[ "io.BytesIO", "flask_cors.CORS", "flask.Flask", "base64.b64decode", "numpy.array", "requests.get", "flask.json.loads", "bs4.BeautifulSoup", "eval.evaluate", "locateWord.find_word", "re.sub" ]
[((264, 279), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (269, 279), False, 'from flask import Flask, request, json\n'), ((280, 289), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (284, 289), False, 'from flask_cors import CORS\n'), ((417, 449), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html_text...
# import the necessary packages from imutils.video import VideoStream from imutils.video import FPS import numpy as np import argparse import pickle import imutils import time import math import cv2 import os class RecognizeFaceGenderAge(object): def __init__(self): # construct the argument parser and...
[ "imutils.video.VideoStream", "imutils.video.FPS", "cv2.putText", "argparse.ArgumentParser", "numpy.argmax", "cv2.waitKey", "cv2.dnn.readNetFromTorch", "cv2.dnn.blobFromImage", "cv2.imshow", "cv2.dnn.readNet", "time.sleep", "cv2.rectangle", "numpy.array", "cv2.dnn.readNetFromCaffe", "imut...
[((354, 379), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (377, 379), False, 'import argparse\n'), ((1777, 1837), 'os.path.sep.join', 'os.path.sep.join', (["[self.args['detector'], 'deploy.prototxt']"], {}), "([self.args['detector'], 'deploy.prototxt'])\n", (1793, 1837), False, 'import os\n'...
import numpy as np from PIL import Image import requests from keras import backend from keras.models import Model from keras.applications.vgg16 import VGG16 from scipy.optimize import fmin_l_bfgs_b from matplotlib import pyplot as plt iterations = 10#迭代次数 CHANNELS = 3 image_size = 300 #图片大小 image_width = image_size ima...
[ "PIL.Image.new", "numpy.clip", "keras.backend.transpose", "keras.backend.pow", "keras.applications.vgg16.VGG16", "keras.backend.permute_dimensions", "keras.backend.placeholder", "keras.backend.concatenate", "matplotlib.pyplot.imshow", "keras.backend.gradients", "matplotlib.pyplot.show", "numpy...
[((791, 819), 'PIL.Image.open', 'Image.open', (['input_image_path'], {}), '(input_image_path)\n', (801, 819), False, 'from PIL import Image\n'), ((932, 960), 'PIL.Image.open', 'Image.open', (['style_image_path'], {}), '(style_image_path)\n', (942, 960), False, 'from PIL import Image\n'), ((1119, 1159), 'numpy.asarray',...
# coding: utf-8 from __future__ import division, print_function __author__ = "adrn <<EMAIL>>" # Third-party import astropy.units as u import astropy.coordinates as coord import numpy as np import gala.dynamics as gd # Project from ..core import Ophiuchus from ...data import OphiuchusData def test_roundtrip_transfo...
[ "gala.dynamics.CartesianOrbit", "numpy.random.uniform", "numpy.allclose", "numpy.abs" ]
[((624, 671), 'numpy.allclose', 'np.allclose', (['o.distance.value', 'g.distance.value'], {}), '(o.distance.value, g.distance.value)\n', (635, 671), True, 'import numpy as np\n'), ((724, 772), 'numpy.allclose', 'np.allclose', (['g2.distance.value', 'g.distance.value'], {}), '(g2.distance.value, g.distance.value)\n', (7...
import numpy as np # reshape b1 = np.arange(15) # b1 = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] b2 = b1.reshape((3,5)) b2 = b2.reshape(1,-1) b3 = b1[::-1].reshape(1,-1) # b2 = [[ 0 1 2 3 4] # [ 5 6 7 8 9] # [10 11 12 13 14]] print(b1.shape,b2.shape,b3.shape) b4 = np.concatenate([b2, b3]) print(f"b4 =...
[ "numpy.vstack", "numpy.arange", "numpy.concatenate" ]
[((35, 48), 'numpy.arange', 'np.arange', (['(15)'], {}), '(15)\n', (44, 48), True, 'import numpy as np\n'), ((283, 307), 'numpy.concatenate', 'np.concatenate', (['[b2, b3]'], {}), '([b2, b3])\n', (297, 307), True, 'import numpy as np\n'), ((339, 358), 'numpy.vstack', 'np.vstack', (['[b2, b3]'], {}), '([b2, b3])\n', (34...
import glob import joblib import fitsio import os import numpy as np import meds import tqdm from meds.defaults import BMASK_EDGE BINS = np.linspace(-20, 20, 41) + 0.5 BANDS = ["g", "r", "i", "z", "Y"] BCEN = (BINS[:-1] + BINS[1:])/2 def _convert_to_index(row, col, dbox=100, edge=50): xind = (col.astype(int) - ...
[ "os.path.basename", "numpy.std", "os.path.exists", "os.system", "joblib.Parallel", "numpy.any", "numpy.mean", "numpy.array", "numpy.linspace", "glob.glob", "joblib.delayed", "meds.MEDS" ]
[((2276, 2303), 'os.system', 'os.system', (['"""mkdir -p hdata"""'], {}), "('mkdir -p hdata')\n", (2285, 2303), False, 'import os\n'), ((139, 163), 'numpy.linspace', 'np.linspace', (['(-20)', '(20)', '(41)'], {}), '(-20, 20, 41)\n', (150, 163), True, 'import numpy as np\n'), ((2464, 2518), 'joblib.Parallel', 'joblib.Pa...
from keras.backend.tensorflow_backend import set_session from keras.layers import Input from keras.layers.convolutional import Conv2D, MaxPooling2D from keras.layers.core import Dense, Flatten from keras.losses import mean_squared_error, binary_crossentropy from keras.models import Model, load_model from keras.op...
[ "keras.models.load_model", "keras.layers.core.Dense", "keras.optimizers.SGD", "keras.layers.convolutional.MaxPooling2D", "tensorflow.Session", "keras.optimizers.Adam", "tensorflow.logging.set_verbosity", "keras.models.Model", "tensorflow.ConfigProto", "pickle.load", "numpy.array", "keras.layer...
[((501, 543), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (525, 543), True, 'import tensorflow as tf\n'), ((586, 602), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (600, 602), True, 'import tensorflow as tf\n'), ((681, 706), 'tenso...
import numpy as np import vaex def test_correlation(): df = vaex.example() # A single column pair xy = yx = df.correlation('x', 'y') xy_expected = np.corrcoef(df.x.values, df.y.values)[0,1] np.testing.assert_array_almost_equal(xy, xy_expected, decimal=5) np.testing.assert_array_almost_equal...
[ "numpy.corrcoef", "vaex.example", "numpy.testing.assert_array_almost_equal", "numpy.array" ]
[((67, 81), 'vaex.example', 'vaex.example', ([], {}), '()\n', (79, 81), False, 'import vaex\n'), ((214, 278), 'numpy.testing.assert_array_almost_equal', 'np.testing.assert_array_almost_equal', (['xy', 'xy_expected'], {'decimal': '(5)'}), '(xy, xy_expected, decimal=5)\n', (250, 278), True, 'import numpy as np\n'), ((659...
import math import numpy as np from numpy.linalg import norm from gensim.models import Word2Vec import pickle from tfidf import calculate_tf_query, calculate_idf, calculate_tf_doc def load_doc_tfidf(path): with open(path, 'rb') as doc_tfidf_file: doc_tfidf = pickle.load(doc_tfidf_file) return doc_tfid...
[ "tfidf.calculate_tf_query", "numpy.seterr", "numpy.zeros", "pickle.load", "numpy.linalg.norm", "numpy.dot", "gensim.models.Word2Vec.load" ]
[((1895, 1924), 'gensim.models.Word2Vec.load', 'Word2Vec.load', (['w2v_model_path'], {}), '(w2v_model_path)\n', (1908, 1924), False, 'from gensim.models import Word2Vec\n'), ((2680, 2709), 'gensim.models.Word2Vec.load', 'Word2Vec.load', (['w2v_model_path'], {}), '(w2v_model_path)\n', (2693, 2709), False, 'from gensim.m...