code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# The model for the skin cancer classifier
# Import the libraries
import numpy as np
import keras
from keras import backend as K
from keras.layers.core import Dense, Dropout
from keras.optimizers import Adam
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Model
from keras.models impor... | [
"matplotlib.pyplot.ylabel",
"keras.utils.vis_utils.plot_model",
"keras.preprocessing.image.ImageDataGenerator",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.yticks",
"keras.models.Model",
"keras.optimizers.Adam",
"numpy.ceil",
"matplotlib.pyplot.xticks",
"keras.call... | [((524, 566), 'keras.backend.tensorflow_backend._get_available_gpus', 'K.tensorflow_backend._get_available_gpus', ([], {}), '()\n', (564, 566), True, 'from keras import backend as K\n'), ((890, 935), 'numpy.ceil', 'np.ceil', (['(num_train_samples / train_batch_size)'], {}), '(num_train_samples / train_batch_size)\n', (... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import csv
import math
from sklearn.metrics import r2_score
from sklearn.linear_model import LinearRegression
from matplotlib import font_manager
resol = 0.1
query_TK = 293
total = 19
total_s = 15
sample = 6
sample_s = 1
ref_clk = ... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"numpy.log",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"numpy.asarray",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.yscale",
"csv.reader",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.gca",
"matplotlib.font_mana... | [((535, 584), 'matplotlib.font_manager.findSystemFonts', 'font_manager.findSystemFonts', ([], {'fontpaths': 'font_dirs'}), '(fontpaths=font_dirs)\n', (563, 584), False, 'from matplotlib import font_manager\n'), ((1156, 1189), 'numpy.linspace', 'np.linspace', (['TK_min', 'TK_max', 'N_TK'], {}), '(TK_min, TK_max, N_TK)\n... |
import random
import cv2
cv2.setNumThreads(0)
import imgaug as ia
import numpy as np
import torch
from PIL import Image
from trains import Task
from imgaug import augmenters as iaa
from torchvision.transforms import functional as F
from torchvision.transforms import transforms
def get_transform(train, image_size):
... | [
"imgaug.augmenters.GaussianBlur",
"numpy.array",
"imgaug.augmenters.Resize",
"imgaug.augmenters.Fliplr",
"imgaug.augmenters.ChannelShuffle",
"trains.Task.current_task",
"imgaug.augmenters.MultiplyHueAndSaturation",
"imgaug.augmenters.LinearContrast",
"random.choice",
"imgaug.augmenters.AdditiveGau... | [((25, 45), 'cv2.setNumThreads', 'cv2.setNumThreads', (['(0)'], {}), '(0)\n', (42, 45), False, 'import cv2\n'), ((3390, 3405), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (3398, 3405), True, 'import numpy as np\n'), ((3854, 3892), 'torch.zeros', 'torch.zeros', (['(0, 1)'], {'dtype': 'torch.int64'}), '((0, ... |
import numpy as np
def B_to_b(B):
x_indices = [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
y_indices = [0, 0, 3, 1, 3, 1, 3, 2, 3, 2, 3]
return np.array(B[x_indices, y_indices])
def b_to_B(b):
B = np.zeros((6, 4))
x_indices = [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
y_indices = [0, 0, -1, 1, -1, 1, -1, 2, -1, ... | [
"numpy.array",
"numpy.zeros"
] | [((147, 180), 'numpy.array', 'np.array', (['B[x_indices, y_indices]'], {}), '(B[x_indices, y_indices])\n', (155, 180), True, 'import numpy as np\n'), ((205, 221), 'numpy.zeros', 'np.zeros', (['(6, 4)'], {}), '((6, 4))\n', (213, 221), True, 'import numpy as np\n'), ((554, 582), 'numpy.zeros', 'np.zeros', (['(chain_lengt... |
import NeuralNetwork as NN
import numpy as np
import matplotlib.pyplot as plt
import tools
def train(path_to_datas, save_model_path):
# 读取MNIST数据集
train_datas, labels = tools.load_mnist(path_to_datas, 'train')
print("The total numbers of datas : ", len(train_datas))
train_labels = np.zeros((labels.shap... | [
"tools.load_mnist",
"numpy.argmax",
"numpy.zeros",
"tools.drawDataCurve",
"NeuralNetwork.MLP",
"numpy.arange"
] | [((178, 218), 'tools.load_mnist', 'tools.load_mnist', (['path_to_datas', '"""train"""'], {}), "(path_to_datas, 'train')\n", (194, 218), False, 'import tools\n'), ((299, 330), 'numpy.zeros', 'np.zeros', (['(labels.shape[0], 10)'], {}), '((labels.shape[0], 10))\n', (307, 330), True, 'import numpy as np\n'), ((758, 859), ... |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from dace.transformation.dataflow import MapFusion
from dace.transformation.interstate import FPGATransformSDFG
from mapfusion_test import multiple_fusions, fusion_with_transient
import numpy as np
def multiple_fusions_fpga():
sdfg = mult... | [
"numpy.allclose",
"numpy.random.rand",
"numpy.zeros",
"mapfusion_test.multiple_fusions.to_sdfg",
"numpy.linalg.norm",
"numpy.zeros_like",
"mapfusion_test.fusion_with_transient.to_sdfg"
] | [((316, 342), 'mapfusion_test.multiple_fusions.to_sdfg', 'multiple_fusions.to_sdfg', ([], {}), '()\n', (340, 342), False, 'from mapfusion_test import multiple_fusions, fusion_with_transient\n'), ((575, 591), 'numpy.zeros_like', 'np.zeros_like', (['A'], {}), '(A)\n', (588, 591), True, 'import numpy as np\n'), ((600, 616... |
#!/usr/bin/env python
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__company__ = "Robotic Beverage Technologies Inc"
__status__ = "Development"
__date__ = "Late Updated: 2020-05-11"
__doc__ = "Class to operate at least 64 servos, 16 relays, and 32 motors at once with latency less then 100 ms"
# Useful docum... | [
"gpiozero.Motor.reverse",
"gpiozero.Motor.enable",
"time.sleep",
"numpy.empty",
"gpiozero.Motor.forward",
"gpiozero.Servo.dettach",
"gpiozero.Servo.value",
"gpiozero.Motor.disable"
] | [((5488, 5522), 'numpy.empty', 'np.empty', (['numOfWires'], {'dtype': 'object'}), '(numOfWires, dtype=object)\n', (5496, 5522), True, 'import numpy as np\n'), ((8218, 8231), 'gpiozero.Servo.value', 'Servo.value', ([], {}), '()\n', (8229, 8231), False, 'from gpiozero import Motor, Servo, LED, Energenie, OutputDevice\n')... |
from __future__ import print_function
import math
import numpy
import theano
import itertools
from theano import tensor, Op
from theano.gradient import disconnected_type
from fuel.utils import do_not_pickle_attributes
from picklable_itertools.extras import equizip
from collections import defaultdict, deque
from toposo... | [
"lvsr.error_rate.edit_distance",
"theano.tensor.ltensor3",
"lvsr.error_rate._bleu",
"theano.tensor.tensor3",
"theano.gradient.disconnected_type",
"lvsr.error_rate._edit_distance_matrix",
"numpy.zeros",
"theano.tensor.as_tensor_variable",
"lvsr.error_rate.reward_matrix",
"numpy.zeros_like",
"lvsr... | [((990, 1058), 'numpy.zeros', 'numpy.zeros', (['(recognized.shape + (self.alphabet_size,))'], {'dtype': '"""int64"""'}), "(recognized.shape + (self.alphabet_size,), dtype='int64')\n", (1001, 1058), False, 'import numpy\n'), ((1092, 1160), 'numpy.zeros', 'numpy.zeros', (['(recognized.shape + (self.alphabet_size,))'], {'... |
import sys
from torch.utils.data import Dataset, DataLoader
import os
import os.path as osp
import glob
import numpy as np
import random
import cv2
import pickle as pkl
import json
import h5py
import torch
import matplotlib.pyplot as plt
from lib.utils.misc import process_dataset_for_video
class Surreal... | [
"os.path.exists",
"pickle.dump",
"numpy.random.random_sample",
"random.seed",
"h5py.File",
"torch.from_numpy",
"numpy.array",
"lib.utils.misc.process_dataset_for_video",
"numpy.random.randint",
"numpy.random.seed",
"numpy.concatenate",
"numpy.linalg.norm",
"numpy.random.shuffle"
] | [((1614, 1644), 'h5py.File', 'h5py.File', (['self.data_path', '"""r"""'], {}), "(self.data_path, 'r')\n", (1623, 1644), False, 'import h5py\n'), ((1667, 1684), 'numpy.array', 'np.array', (['fp[key]'], {}), '(fp[key])\n', (1675, 1684), True, 'import numpy as np\n'), ((2422, 2444), 'numpy.array', 'np.array', (["fp['seqle... |
import numpy as np
class BayesDiscri:
def __init__(self):
'''
:__init__: 初始化BayesDiscri类
'''
self.varipro=[] # 各个特征xk在各个类别yi下的条件概率
self.priorpro={} # 各个类别yi的先验概率
self.respro=[] # 测试集中每个样本向量属于各个类别的概率
def train(self, data, rowvar=False):
... | [
"numpy.array",
"numpy.shape"
] | [((797, 811), 'numpy.shape', 'np.shape', (['data'], {}), '(data)\n', (805, 811), True, 'import numpy as np\n'), ((840, 854), 'numpy.shape', 'np.shape', (['data'], {}), '(data)\n', (848, 854), True, 'import numpy as np\n'), ((2711, 2727), 'numpy.array', 'np.array', (['[data]'], {}), '([data])\n', (2719, 2727), True, 'im... |
from __future__ import division
import numpy as np
import six
from keras.models import Model
from keras.layers import (
Input,
Activation,
Dense,
Flatten
)
from keras.layers.convolutional import (
Conv2D,
MaxPooling2D,
AveragePooling2D
)
from keras.layers.merge import add
from keras.layers.n... | [
"numpy.zeros",
"keras.regularizers.l2"
] | [((436, 460), 'numpy.zeros', 'np.zeros', (['(1, 34, 34, 3)'], {}), '((1, 34, 34, 3))\n', (444, 460), True, 'import numpy as np\n'), ((473, 497), 'numpy.zeros', 'np.zeros', (['(1, 10, 10, 3)'], {}), '((1, 10, 10, 3))\n', (481, 497), True, 'import numpy as np\n'), ((1135, 1145), 'keras.regularizers.l2', 'l2', (['(0.0001)... |
from typing import Tuple
import numpy as np
import math
class Point2D:
def __init__(self, x_init, y_init):
self.x = x_init
self.y = y_init
def as_tuple(self):
return self.x, self.y
def as_int_tuple(self):
return int(self.x), int(self.y)
def shift(self, x, y):
... | [
"numpy.argmin",
"math.sqrt"
] | [((528, 600), 'math.sqrt', 'math.sqrt', (['((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2)'], {}), '((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2)\n', (537, 600), False, 'import math\n'), ((748, 768), 'numpy.argmin', 'np.argmin', (['distances'], {}), '(distances)\n', (757, 768), True, '... |
'''
Usage 1: python3 split_and_run.py --dataset [dataset name] --num_split [# of split] --metric [distance measure] --num_leaves [num_leaves] --num_search [num_leaves_to_search] --coarse_training_size [coarse traing sample size] --fine_training_size [fine training sample size] --threshold [threshold] --reorder [reorder... | [
"numpy.fromfile",
"runfaiss.faiss_search",
"math.log",
"numpy.argsort",
"numpy.array",
"ctypes.CDLL",
"numpy.linalg.norm",
"numpy.load",
"argparse.ArgumentParser",
"scann.scann_ops_pybind.builder",
"numpy.sort",
"numpy.memmap",
"multiprocessing.pool.ThreadPool",
"runfaiss.faiss_search_flat... | [((559, 605), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Options"""'}), "(description='Options')\n", (582, 605), False, 'import argparse\n'), ((84982, 85009), 'os.path.isdir', 'os.path.isdir', (['"""/arc-share"""'], {}), "('/arc-share')\n", (84995, 85009), False, 'import os\n'), ((85... |
__author__ = '<NAME>'
"""
graph_builder is used by negative_samples_generator.py to get what is needed to build the negative samples.
"""
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import corpus2graph.util as util
import corpus2graph.multi_processing
class NoGraph:
def __init__(sel... | [
"networkx.stochastic_graph",
"networkx.number_of_selfloops",
"networkx.is_directed",
"numpy.power",
"networkx.selfloop_edges",
"networkx.DiGraph",
"corpus2graph.util.read_valid_vocabulary",
"networkx.Graph",
"networkx.average_clustering",
"numpy.sum",
"numpy.zeros",
"numpy.matmul",
"networkx... | [((1731, 1765), 'numpy.zeros', 'np.zeros', (['(vocab_size, vocab_size)'], {}), '((vocab_size, vocab_size))\n', (1739, 1765), True, 'import numpy as np\n'), ((2954, 3002), 'numpy.sum', 'np.sum', (['stochastic_matrix'], {'axis': '(1)', 'keepdims': '(True)'}), '(stochastic_matrix, axis=1, keepdims=True)\n', (2960, 3002), ... |
"""
==========================
Yet another Sankey diagram
==========================
This example showcases a more complex sankey diagram.
"""
from __future__ import print_function
__author__ = "<NAME> <<EMAIL>>"
__version__ = "Time-stamp: <10/02/2010 16:49 <EMAIL>>"
import numpy as np
def sankey(ax,
o... | [
"numpy.radians",
"matplotlib.path.Path",
"numpy.absolute",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.patches.PathPatch",
"numpy.sign",
"matplotlib.pyplot.show"
] | [((1071, 1091), 'numpy.absolute', 'np.absolute', (['outputs'], {}), '(outputs)\n', (1082, 1091), True, 'import numpy as np\n'), ((1107, 1123), 'numpy.sign', 'np.sign', (['outputs'], {}), '(outputs)\n', (1114, 1123), True, 'import numpy as np\n'), ((1171, 1190), 'numpy.absolute', 'np.absolute', (['inputs'], {}), '(input... |
import pickle
import keras
import uuid
#pytorch
import torch as t
import torch.nn as nn
from torch.autograd import Variable
import torch.utils.data as Data
import torchvision
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"pickle.dumps",
"sys.getsizeof",
"flask_socketio.SocketIO",
"torch.nn.Conv2d",
"uuid.uuid4",
"numpy.sum",
"numpy.zeros",
"torch.cuda.is_available",
"torch.nn.MaxPool2d",
"time.sleep",
"torch.nn.Linear",
"time.time"
] | [((7576, 7597), 'torch.cuda.is_available', 't.cuda.is_available', ([], {}), '()\n', (7595, 7597), True, 'import torch as t\n'), ((7646, 7667), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (7665, 7667), True, 'import torch.nn as nn\n'), ((1616, 1636), 'numpy.sum', 'np.sum', (['client_sizes'], {}... |
import numpy as np
#from cvxopt import matrix
import pickle
from l1ls import l1ls
import copy
import pdb
import os
feats_file = 'gt_feats.pkl'
mode = 'gt'
with open(feats_file, 'rb') as f:
feats = pickle.load(f)
num_classes = len(feats)
dicts_list = []
dicts_num = 192
max_iters = 25
min_tol = 1e-2
lamda = 1e-3... | [
"numpy.abs",
"pickle.dump",
"pickle.load",
"l1ls.l1ls",
"os.path.dirname",
"numpy.matmul",
"numpy.concatenate",
"numpy.linalg.norm",
"numpy.random.randn"
] | [((203, 217), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (214, 217), False, 'import pickle\n'), ((489, 530), 'numpy.random.randn', 'np.random.randn', (['feat.shape[0]', 'dicts_num'], {}), '(feat.shape[0], dicts_num)\n', (504, 530), True, 'import numpy as np\n'), ((564, 612), 'numpy.linalg.norm', 'np.linalg.nor... |
import cv2 as cv
import numpy as np
resizeValue = 1
x,y = np.meshgrid(range(7),range(6))
worldPoints = np.hstack((x.reshape(42,1),y.reshape(42,1),np.zeros((42,1)))).astype(np.float32)
criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)
objPoints = []
imgPoints =[]
numberOfFramesUsed = 0
cap ... | [
"cv2.findCirclesGrid",
"cv2.drawChessboardCorners",
"cv2.FileStorage",
"cv2.imshow",
"cv2.cornerSubPix",
"cv2.getOptimalNewCameraMatrix",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.calibrateCamera",
"cv2.GaussianBlur",
"cv2.waitKey"
] | [((322, 378), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""http://192.168.0.102:8000/stream.mjpg"""'], {}), "('http://192.168.0.102:8000/stream.mjpg')\n", (337, 378), True, 'import cv2 as cv\n'), ((2714, 2736), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n', (2734, 2736), True, 'import cv2 as cv\n'),... |
'''
Utility functions to analyze particle data.
@author: <NAME> <<EMAIL>>
Units: unless otherwise noted, all quantities are in (combinations of):
mass [M_sun]
position [kpc comoving]
distance, radius [kpc physical]
velocity [km / s]
time [Gyr]
'''
# system ----
from __future__ import absolute_imp... | [
"numpy.log10",
"numpy.sqrt",
"numpy.array",
"numpy.isfinite",
"numpy.arange",
"numpy.nanargmin",
"numpy.isscalar",
"numpy.sort",
"numpy.asarray",
"numpy.ndim",
"numpy.max",
"numpy.concatenate",
"numpy.min",
"numpy.abs",
"numpy.argmax",
"numpy.interp",
"numpy.shape",
"numpy.intersec... | [((1139, 1159), 'numpy.isscalar', 'np.isscalar', (['species'], {}), '(species)\n', (1150, 1159), True, 'import numpy as np\n'), ((6332, 6382), 'numpy.array', 'np.array', (['ids_all'], {'dtype': 'part[spec][id_name].dtype'}), '(ids_all, dtype=part[spec][id_name].dtype)\n', (6340, 6382), True, 'import numpy as np\n'), ((... |
#!/usr/bin/env python3
# Ensure environmental variable i.e. paths are set to used the modules
from xf_fintech_python import DeviceManager, HJM
import numpy as np
import argparse
def zcbAnalytical(rawData, maturity, tau = 0.5):
# Take last row
fc = np.copy(rawData[rawData.shape[0] - 1])
fc *= 0.... | [
"numpy.copy",
"numpy.random.rand",
"argparse.ArgumentParser",
"xf_fintech_python.DeviceManager.getDeviceList",
"numpy.exp",
"xf_fintech_python.HJM",
"numpy.loadtxt"
] | [((1152, 1254), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Example of Heath-Jarrow-Morton framework running on a FPGA"""'}), "(description=\n 'Example of Heath-Jarrow-Morton framework running on a FPGA')\n", (1175, 1254), False, 'import argparse\n'), ((1500, 1539), 'numpy.loadtxt'... |
#
#*******************************************************************************
# Copyright 2014-2020 Intel Corporation
#
# 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.a... | [
"numpy.asarray",
"numpy.isscalar"
] | [((1031, 1045), 'numpy.isscalar', 'np.isscalar', (['X'], {}), '(X)\n', (1042, 1045), True, 'import numpy as np\n'), ((1059, 1072), 'numpy.asarray', 'np.asarray', (['X'], {}), '(X)\n', (1069, 1072), True, 'import numpy as np\n')] |
#El promedio histórico del salario de los egresados de una universidad
#es salario_historico, la desviación estándar es
#de std_salario_historico.
#Calcule con un método Monte Carlo el salario promedio
#salario_promedio que una muestra aleatoria de n_egresados debe tener
#para considerar que cualquier otro grupo de ... | [
"numpy.sort",
"numpy.sqrt"
] | [((1865, 1875), 'numpy.sort', 'np.sort', (['x'], {}), '(x)\n', (1872, 1875), True, 'import numpy as np\n'), ((1794, 1814), 'numpy.sqrt', 'np.sqrt', (['n_egresados'], {}), '(n_egresados)\n', (1801, 1814), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from PIL import ImageDraw
import scipy
from scipy import ndimage
import skimage
from skimage.morphology import medial_axis
import time
import cv2
import random
import os
import sys
from scipy import linalg as LA
def find_files(files, dirs=[], con... | [
"os.listdir",
"numpy.load",
"os.path.join"
] | [((1881, 1897), 'numpy.load', 'np.load', (['load_fn'], {}), '(load_fn)\n', (1888, 1897), True, 'import numpy as np\n'), ((1115, 1150), 'os.path.join', 'os.path.join', (['load_root', 'class_name'], {}), '(load_root, class_name)\n', (1127, 1150), False, 'import os\n'), ((1734, 1768), 'os.path.join', 'os.path.join', (['lo... |
import numpy as np
import re
import random
def prepare_data():
"""This method prepares input positive and negative datasets as bitvectors for the Rap1 binding problem. Output: three lists of bitvectors, one containing positive samples, negative samples that are similar to positive samples, and negative examples t... | [
"numpy.ones",
"numpy.array",
"numpy.zeros",
"numpy.concatenate",
"re.findall"
] | [((5076, 5089), 'numpy.array', 'np.array', (['pos'], {}), '(pos)\n', (5084, 5089), True, 'import numpy as np\n'), ((5099, 5112), 'numpy.array', 'np.array', (['neg'], {}), '(neg)\n', (5107, 5112), True, 'import numpy as np\n'), ((5121, 5153), 'numpy.concatenate', 'np.concatenate', (['(Xp, Xn)'], {'axis': '(0)'}), '((Xp,... |
import os
import sys
import numpy as np
import scipy.io as sio
import more_itertools as mit
chan = ['Fp1','AF3','F3','F7','FC5','FC1','C3','T7','CP5','CP1','P3','P7','PO3','O1','Oz','Pz','Fp2','AF4','Fz','F4','F8','FC6','FC2','Cz','C4','T8','CP6','CP2','P4','P8','PO4','O2']
nLabel, nTrial, nUser, nChannel, nT... | [
"scipy.io.loadmat",
"numpy.savetxt",
"more_itertools.windowed",
"os.system",
"numpy.genfromtxt"
] | [((607, 625), 'scipy.io.loadmat', 'sio.loadmat', (['fname'], {}), '(fname)\n', (618, 625), True, 'import scipy.io as sio\n'), ((1567, 1615), 'numpy.genfromtxt', 'np.genfromtxt', (['"""features_raw.csv"""'], {'delimiter': '""","""'}), "('features_raw.csv', delimiter=',')\n", (1580, 1615), True, 'import numpy as np\n'), ... |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: mo-mo-
#
# Created: 05/08/2018
# Copyright: (c) mo-mo- 2018
# Licence: <your licence>
#-------------------------------------------------------------------------------
... | [
"numpy.where",
"numpy.array"
] | [((366, 377), 'numpy.array', 'np.array', (['l'], {}), '(l)\n', (374, 377), True, 'import numpy as np\n'), ((495, 514), 'numpy.where', 'np.where', (["(l2 == 'C')"], {}), "(l2 == 'C')\n", (503, 514), True, 'import numpy as np\n')] |
import numpy as np
import tensorflow as tf
from DeepSparseCoding.tf1x.ops.init_ops import L2NormalizedTruncatedNormalInitializer
from DeepSparseCoding.tf1x.utils.trainable_variable_dict import TrainableVariableDict
class AeModule(object):
def __init__(self, data_tensor, layer_types, enc_channels, dec_channels, patc... | [
"numpy.prod",
"tensorflow.shape",
"tensorflow.group",
"tensorflow.nn.dropout",
"tensorflow.nn.conv2d_transpose",
"tensorflow.matmul",
"tensorflow.compat.v1.keras.initializers.VarianceScaling",
"tensorflow.square",
"DeepSparseCoding.tf1x.ops.init_ops.L2NormalizedTruncatedNormalInitializer",
"tensor... | [((1547, 1570), 'DeepSparseCoding.tf1x.utils.trainable_variable_dict.TrainableVariableDict', 'TrainableVariableDict', ([], {}), '()\n', (1568, 1570), False, 'from DeepSparseCoding.tf1x.utils.trainable_variable_dict import TrainableVariableDict\n'), ((4283, 4348), 'numpy.all', 'np.all', (["('conv' in self.enc_layer_type... |
# ---
# jupyter:
# jupytext:
# metadata_filter:
# cells:
# additional: all
# notebook:
# additional: all
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Pyth... | [
"ipywidgets.HBox",
"bqplot.Axis",
"ipywidgets.IntSlider",
"ipywidgets.Play",
"os.path.abspath",
"bqplot.Scatter",
"numpy.array",
"ipywidgets.jslink",
"bqplot.Tooltip",
"bqplot.Lines",
"bqplot.Figure",
"numpy.interp",
"bqplot.LinearScale",
"bqplot.LogScale",
"numpy.arange"
] | [((3611, 3714), 'bqplot.Tooltip', 'Tooltip', ([], {'fields': "['name', 'x', 'y']", 'labels': "['Country Name', 'Income per Capita', 'Life Expectancy']"}), "(fields=['name', 'x', 'y'], labels=['Country Name',\n 'Income per Capita', 'Life Expectancy'])\n", (3618, 3714), False, 'from bqplot import LogScale, LinearScale... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
try:
import cPickle as pickle
except:
import pickle
import numpy as np
import scipy.misc
IMAGE_SIZE = 32
def to_one_hot(y, num_label):
"""Converts a one-dimensional label array to a two-dime... | [
"numpy.mean",
"numpy.eye",
"pickle.dump",
"os.path.join",
"numpy.array",
"os.path.dirname",
"numpy.std",
"numpy.genfromtxt",
"numpy.arange",
"numpy.random.shuffle"
] | [((354, 371), 'numpy.eye', 'np.eye', (['num_label'], {}), '(num_label)\n', (360, 371), True, 'import numpy as np\n'), ((3542, 3580), 'os.path.join', 'os.path.join', (['prefix', '"""testLabels.csv"""'], {}), "(prefix, 'testLabels.csv')\n", (3554, 3580), False, 'import os\n'), ((3600, 3672), 'numpy.genfromtxt', 'np.genfr... |
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.dates as mdates
from matplotlib.dates import DateFormatter, num2date
from matplotlib import patches
import matplotlib.patches as mpatches
from matplotlib import ticker, cm, colors
import sys
sys.path.insert(0, ... | [
"sys.path.insert",
"matplotlib.use",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.ticker.LogFormatterSciNotation",
"numpy.meshgrid",
"numpy.nansum",
"numpy.load",
"numpy.arange",
"matplotlib.colors.LogNorm"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((301, 325), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (316, 325), False, 'import sys\n'), ((326, 361), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../u... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 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,... | [
"cv2.rectangle",
"cv2.seamlessClone",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"copy.deepcopy",
"scripts.Traditional.forwardwarping.forward.for_warping",
"imutils.face_utils.rect_to_bb",
"scripts.Traditional.InverseWarping.inverse.inv_warping",
"dlib.shape_predictor",
"sys.path.remo... | [((1314, 1377), 'sys.path.remove', 'sys.path.remove', (['"""/opt/ros/kinetic/lib/python2.7/dist-packages"""'], {}), "('/opt/ros/kinetic/lib/python2.7/dist-packages')\n", (1329, 1377), False, 'import sys\n'), ((2697, 2726), 'cv2.boundingRect', 'cv2.boundingRect', (['convex_hull'], {}), '(convex_hull)\n', (2713, 2726), F... |
####################################################################################################
#
# Project: Embedded Learning Library (ELL)
# File: darknet_to_ell_impporter_test.py (importers)
# Authors: <NAME>
#
# Requires: Python 3.x
#
######################################################################... | [
"logging.getLogger",
"logging.basicConfig",
"numpy.testing.assert_array_almost_equal",
"numpy.flipud",
"ell.neural.utilities.ell_map_from_float_predictor",
"darknet_to_ell.predictor_from_darknet_model",
"os.path.join",
"unittest.main",
"sys.exc_info",
"os.path.abspath",
"numpy.arange"
] | [((524, 551), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (541, 551), False, 'import logging\n'), ((552, 613), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(message)s"""'}), "(level=logging.INFO, format='%(message)s')\n", (571, 613), False... |
###########################################################################
# #
# physical_validation, #
# a python package to test the physical validity of MD results #
# ... | [
"numpy.array",
"numpy.round"
] | [((1657, 1672), 'numpy.array', 'np.array', (['bonds'], {}), '(bonds)\n', (1665, 1672), True, 'import numpy as np\n'), ((1750, 1769), 'numpy.array', 'np.array', (['positions'], {}), '(positions)\n', (1758, 1769), True, 'import numpy as np\n'), ((4541, 4556), 'numpy.array', 'np.array', (['value'], {}), '(value)\n', (4549... |
import h5py
import numpy as np
file = h5py.File('/data2/wt/openimages/vc_feature/1coco_train_all_bu_2.hdf5', 'r')
for keys in file:
feature = file[keys]['feature'][:]
np.save('/data2/wt/openimages/vc_feature/coco_vc_all_bu/'+keys+'.npy', feature)
| [
"numpy.save",
"h5py.File"
] | [((42, 117), 'h5py.File', 'h5py.File', (['"""/data2/wt/openimages/vc_feature/1coco_train_all_bu_2.hdf5"""', '"""r"""'], {}), "('/data2/wt/openimages/vc_feature/1coco_train_all_bu_2.hdf5', 'r')\n", (51, 117), False, 'import h5py\n'), ((182, 269), 'numpy.save', 'np.save', (["('/data2/wt/openimages/vc_feature/coco_vc_all_... |
import numpy as np
import os
import scipy.io.wavfile as sp_wr
import random
random.seed(0)
def load_data():
speech_path=os.path.join('speech-command/')
path =[speech_path+"zero/",
speech_path+"one/",
speech_path+"two/",
speech_path+"three/",
speec... | [
"numpy.mean",
"numpy.savez",
"os.listdir",
"random.sample",
"random.shuffle",
"os.path.join",
"random.seed",
"numpy.array",
"numpy.zeros",
"scipy.io.wavfile.read",
"numpy.vstack",
"numpy.std",
"numpy.arange"
] | [((84, 98), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (95, 98), False, 'import random\n'), ((2423, 2556), 'numpy.savez', 'np.savez', (['"""Dspeech-command/numbers.npz"""'], {'x_train': 'x_train', 'y_train': 'y_train', 'x_val': 'x_val', 'y_val': 'y_val', 'x_test': 'x_test', 'y_test': 'y_test'}), "('Dspeech-c... |
''' a set of utilities to create matrix representations (Laplacians) of graphs
'''
import numpy as np
def complete_gl(n):
"""
return the Laplacian of a complete graph (all nodes are connected to all
edges)
Parameters
----------
n : int
number of nodes in the graph
Examples
--... | [
"numpy.eye",
"numpy.ones",
"numpy.diag",
"numpy.zeros",
"numpy.random.randint",
"numpy.triu"
] | [((2031, 2047), 'numpy.zeros', 'np.zeros', (['(v, v)'], {}), '((v, v))\n', (2039, 2047), True, 'import numpy as np\n'), ((3510, 3526), 'numpy.zeros', 'np.zeros', (['(v, v)'], {}), '((v, v))\n', (3518, 3526), True, 'import numpy as np\n'), ((568, 583), 'numpy.ones', 'np.ones', (['(n, n)'], {}), '((n, n))\n', (575, 583),... |
# flake8: noqa
# Copyright (c) 2017 <NAME>
# Copyright (c) 2016-2017 The pytsrepr Developers
# <https://github.com/holgern/pytsrepr>
# See LICENSE for license details.
from __future__ import division, print_function, absolute_import
from .paa import *
from . import data
from pytsrepr.versio... | [
"numpy.testing.Tester"
] | [((635, 643), 'numpy.testing.Tester', 'Tester', ([], {}), '()\n', (641, 643), False, 'from numpy.testing import Tester\n')] |
# --------------
# Using Numpy
print('Using Numpy')
import numpy as np
# Not every data format will be in csv there are other file formats also.
# This exercise will help you deal with other file formats and how toa read it.
data_ipl = np.genfromtxt(path, delimiter=',',dtype='str' ,skip_header=True)
# How many matche... | [
"collections.Counter",
"numpy.genfromtxt",
"pandas.read_csv"
] | [((237, 302), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'dtype': '"""str"""', 'skip_header': '(True)'}), "(path, delimiter=',', dtype='str', skip_header=True)\n", (250, 302), True, 'import numpy as np\n'), ((1654, 1692), 'collections.Counter', 'Counter', (['records_with_six_runs[:, -10]']... |
"""
Tests for inequality.py
"""
import numpy as np
from numpy.testing import assert_allclose, assert_raises
from scipy.stats import linregress
from quantecon import lorenz_curve, gini_coefficient, \
shorrocks_index, rank_size
def test_lorenz_curve():
"""
Tests `lorenz` function, which calculates the l... | [
"numpy.random.normal",
"quantecon.lorenz_curve",
"quantecon.shorrocks_index",
"numpy.repeat",
"numpy.testing.assert_allclose",
"numpy.log",
"numpy.testing.assert_raises",
"numpy.random.exponential",
"numpy.random.pareto",
"numpy.exp",
"numpy.random.randint",
"numpy.random.weibull",
"numpy.ra... | [((727, 742), 'quantecon.lorenz_curve', 'lorenz_curve', (['y'], {}), '(y)\n', (739, 742), False, 'from quantecon import lorenz_curve, gini_coefficient, shorrocks_index, rank_size\n'), ((747, 798), 'numpy.testing.assert_allclose', 'assert_allclose', (['cum_people', 'cum_income'], {'rtol': '(0.001)'}), '(cum_people, cum_... |
#!/usr/bin/env python2
import numpy as np
import cPickle
from numpy.linalg import norm
from numpy import exp, sqrt, sum, square
NUCLEAR_CHARGE = dict()
NUCLEAR_CHARGE["H"] = 1.0
NUCLEAR_CHARGE["C"] = 6.0
NUCLEAR_CHARGE["N"] = 7.0
NUCLEAR_CHARGE["O"] = 8.0
NUCLEAR_CHARGE["S"] = 16.0
COULOMB_MATRIX_SIZE = 23
HOF_DFTB... | [
"numpy.array",
"numpy.zeros",
"cPickle.load",
"numpy.linalg.norm"
] | [((3210, 3262), 'numpy.zeros', 'np.zeros', (['(COULOMB_MATRIX_SIZE, COULOMB_MATRIX_SIZE)'], {}), '((COULOMB_MATRIX_SIZE, COULOMB_MATRIX_SIZE))\n', (3218, 3262), True, 'import numpy as np\n'), ((3826, 3841), 'cPickle.load', 'cPickle.load', (['f'], {}), '(f)\n', (3838, 3841), False, 'import cPickle\n'), ((2014, 2033), 'n... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
### importing OGB-LSC
from ogb.lsc import PCQM4MEvaluator
from ogb.lsc.pcqm4m_pyg import PygPCQM4MDataset
import torch
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
from torch.optim.lr_scheduler import StepLR
fro... | [
"numpy.hstack",
"torch.nn.L1Loss",
"torch.cuda.is_available",
"sklearn.model_selection.KFold",
"ogb.lsc.pcqm4m_pyg.PygPCQM4MDataset",
"sys.path.append",
"torch.utils.tensorboard.SummaryWriter",
"torch_geometric.data.dataloader.DataLoader",
"ogb.lsc.PCQM4MEvaluator",
"utils.config.get_args",
"num... | [((428, 448), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (443, 448), False, 'import sys\n'), ((583, 600), 'torch.nn.L1Loss', 'torch.nn.L1Loss', ([], {}), '()\n', (598, 600), False, 'import torch\n'), ((1350, 1374), 'torch.cat', 'torch.cat', (['y_true'], {'dim': '(0)'}), '(y_true, dim=0)\n', (13... |
import json
import os
import os.path
import cv2
import numpy as np
import torch
import torch.utils.data as data_utl
from tqdm import tqdm
from dataset.vidor import VidOR
from frames import extract_all_frames
def video_to_tensor(pic):
"""Convert a ``numpy.ndarray`` to tensor.
Converts a numpy.ndarray (T x H ... | [
"os.path.exists",
"argparse.ArgumentParser",
"videotransforms.CenterCrop",
"dataset.vidor.VidOR",
"numpy.asarray",
"os.path.join",
"torch.from_numpy",
"videotransforms.RandomCrop",
"torch.utils.data.DataLoader",
"json.load",
"cv2.resize",
"cv2.imread",
"frames.extract_all_frames",
"videotr... | [((997, 1071), 'os.path.join', 'os.path.join', (['image_dir', 'video_path_splits[-2]', 'video_path_splits[-1][:-4]'], {}), '(image_dir, video_path_splits[-2], video_path_splits[-1][:-4])\n', (1009, 1071), False, 'import os\n'), ((1915, 1951), 'numpy.asarray', 'np.asarray', (['frames'], {'dtype': 'np.float32'}), '(frame... |
import io
import dash
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
from dash_extensions.enrich import Dash, ServersideOutput, Output, Input, State, Trigger
from dash.exceptions import PreventUpdate
import plotly.graph_objs as go
import pandas a... | [
"dash_extensions.enrich.Input",
"numpy.hstack",
"dash_core_components.Input",
"io.BytesIO",
"numpy.column_stack",
"plotly.graph_objs.Scatter",
"dash_core_components.Store",
"numpy.array",
"utils.convert_latex",
"dash_bootstrap_components.Input",
"dash_core_components.send_data_frame",
"dash_bo... | [((927, 1133), 'dash_core_components.Dropdown', 'dcc.Dropdown', ([], {'options': "[{'label': 'Analytical Model', 'value': 'analytical'}, {'label':\n 'Offline Model', 'value': 'offline'}]", 'className': '"""m-1"""', 'id': '"""model_select"""', 'value': '"""analytical"""', 'clearable': '(False)'}), "(options=[{'label'... |
import numpy as np
import pandas as pd
__base32 = '0123456789bcdefghjkmnpqrstuvwxyz'
__decodemap = { }
for i in range(len(__base32)):
__decodemap[__base32[i]] = i
del i
def decode_exactly(geohash):
lat_interval, lon_interval = (-90.0, 90.0), (-180.0, 180.0)
lat_err, lon_err = 90.0, 180.0
is_even = True... | [
"pandas.DataFrame",
"shapely.geometry.Polygon",
"numpy.log10"
] | [((2748, 2762), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2760, 2762), True, 'import pandas as pd\n'), ((3660, 3838), 'shapely.geometry.Polygon', 'Polygon', (['[[lon - lon_err, lat - lat_err], [lon - lon_err, lat + lat_err], [lon +\n lon_err, lat + lat_err], [lon + lon_err, lat - lat_err], [lon - lon_er... |
# tensorflow, numpy를 사용하기위해 import
import tensorflow as tf
import numpy as np
# Deep learning을 위해 데이터를 읽습니다.
data = np.loadtxt('./data.csv',delimiter=',',unpack=True,dtype='float32')
# csv자료의 0부터 2번째 까지의 feature를 x_data에 넣습니다.
# 나머지는 분류가 되는 데이터로 y_data에 넣습니다.
x_data = np.transpose(data[0:3])
y_data = np.transpose(da... | [
"tensorflow.train.AdamOptimizer",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.random_uniform",
"tensorflow.argmax",
"tensorflow.matmul",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"numpy.loadtxt",
"numpy.transpose"
] | [((118, 187), 'numpy.loadtxt', 'np.loadtxt', (['"""./data.csv"""'], {'delimiter': '""","""', 'unpack': '(True)', 'dtype': '"""float32"""'}), "('./data.csv', delimiter=',', unpack=True, dtype='float32')\n", (128, 187), True, 'import numpy as np\n'), ((272, 295), 'numpy.transpose', 'np.transpose', (['data[0:3]'], {}), '(... |
import torch
import numpy as np
from tqdm import tqdm
from typing import Union, List, Tuple, Any, Dict
from easydict import EasyDict
from .dataset import preprocess, InferenceDataset, InferenceDatasetWithKeypoints
from .network import build_spin
from .. import BasePose3dRunner, BasePose3dRefiner, ACTIONS
from iPERCor... | [
"iPERCore.tools.utils.dataloaders.build_inference_loader",
"numpy.copy",
"torch.as_tensor",
"iPERCore.tools.utils.geometry.boxes.cal_head_bbox",
"iPERCore.tools.utils.filesio.persistence.load_toml_file",
"torch.load",
"tqdm.tqdm",
"iPERCore.tools.human_digitalizer.bodynets.SMPL",
"torch.tensor",
"... | [((811, 830), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (823, 830), False, 'import torch\n'), ((2079, 2107), 'torch.load', 'torch.load', (["cfg['ckpt_path']"], {}), "(cfg['ckpt_path'])\n", (2089, 2107), False, 'import torch\n'), ((2970, 2984), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n... |
import os
import gzip
import time
import copy
import random
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
fro... | [
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"gzip.open",
"torch.max",
"numpy.array",
"torch.cuda.is_available",
"torch.sum",
"numpy.frombuffer",
"torchvision.transforms.ToTensor",
"sklearn.model_selection.train_test_split",
"torch.save",
"torch.no_grad",
"torch.nn.functional.max_pool2d"... | [((1911, 1941), 'os.path.join', 'os.path.join', (['data_dir', 'x_name'], {}), '(data_dir, x_name)\n', (1923, 1941), False, 'import os\n'), ((1955, 1985), 'os.path.join', 'os.path.join', (['data_dir', 'y_name'], {}), '(data_dir, y_name)\n', (1967, 1985), False, 'import os\n'), ((2528, 2539), 'numpy.array', 'np.array', (... |
'''
实验:
用ngram来分类
其中ngram为单一数据训练模型
ngram-batch为带batch的ngram训练模型
训练取了10epoch
训练好后将原始数据通过ngram得到的特征向量保存到了./data/ngram_featrue_x.npy
0.5219466871716006
'''
import numpy as np
from sklearn.linear_model import LogisticRegression
import pandas as pd
x_train = np.array(np.load('./data/ngram_featrue_x.npy'))
y_t... | [
"numpy.mean",
"numpy.load",
"sklearn.linear_model.LogisticRegression"
] | [((327, 356), 'numpy.load', 'np.load', (['"""./data/y_train.npy"""'], {}), "('./data/y_train.npy')\n", (334, 356), True, 'import numpy as np\n'), ((413, 433), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (431, 433), False, 'from sklearn.linear_model import LogisticRegression\n'), (... |
"""
Figure 3. Heterovalent bispecific
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from .figureCommon import getSetup, subplotLabel, setFontSize, heatmap, cellPopulations, overlapCellPopulation
from valentbind import polyc, polyfc
pairs = [(r"$R_1^{hi}R_2^{lo}$", r"$R_1^{med}R_2^... | [
"numpy.power",
"matplotlib.pyplot.Normalize",
"numpy.zeros",
"matplotlib.cm.ScalarMappable",
"matplotlib.pyplot.clabel",
"numpy.meshgrid",
"numpy.logspace",
"valentbind.polyfc",
"valentbind.polyc",
"numpy.arange"
] | [((3081, 3131), 'numpy.logspace', 'np.logspace', (['abundRange[0]', 'abundRange[1]', 'nAbdPts'], {}), '(abundRange[0], abundRange[1], nAbdPts)\n', (3092, 3131), True, 'import numpy as np\n'), ((3247, 3280), 'numpy.meshgrid', 'np.meshgrid', (['abundScan', 'abundScan'], {}), '(abundScan, abundScan)\n', (3258, 3280), True... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ============================================================================ #
from matplotlib.ticker import ScalarFormatter
import numpy as np
import matplotlib.pyplot as plt
# ============================================================================ #
# prepare figu... | [
"matplotlib.ticker.ScalarFormatter",
"numpy.empty",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((337, 371), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(4)', '(1)'], {'figsize': '(6, 8)'}), '(4, 1, figsize=(6, 8))\n', (349, 371), True, 'import matplotlib.pyplot as plt\n'), ((1664, 1674), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1672, 1674), True, 'import matplotlib.pyplot as plt\n'), ((525,... |
# coding=utf-8
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import SGDClassifier
from sklearn.metrics import roc_curve, auc
from sklearn.svm import SVC
import data_processing
import globe
import word2vec_gensim_train as train
# 分类流程 liyu
def run_li():
# 读入数据
# pos_file_path = ... | [
"data_processing.data_split",
"sklearn.linear_model.SGDClassifier",
"word2vec_gensim_train.text_vecs_zx",
"sklearn.svm.SVC",
"sklearn.metrics.auc",
"matplotlib.pyplot.plot",
"word2vec_gensim_train.train_test",
"numpy.array",
"sklearn.metrics.roc_curve",
"data_processing.read_data",
"matplotlib.p... | [((594, 649), 'data_processing.read_data', 'data_processing.read_data', (['pos_file_path', 'neg_file_path'], {}), '(pos_file_path, neg_file_path)\n', (619, 649), False, 'import data_processing\n'), ((660, 702), 'data_processing.data_split', 'data_processing.data_split', (['tmp[0]', 'tmp[1]'], {}), '(tmp[0], tmp[1])\n',... |
#!/usr/bin/env python
#
# Tests the basic methods of the DREAM MCMC method.
#
# This file is part of PINTS.
# Copyright (c) 2017-2019, University of Oxford.
# For licensing information, see the LICENSE file distributed with the PINTS
# software package.
#
import unittest
import numpy as np
import pints
import pints... | [
"numpy.random.normal",
"pints.GaussianLogLikelihood",
"pints.UniformLogPrior",
"pints.DreamMCMC",
"pints.toy.LogisticModel",
"shared.StreamCapture",
"pints.LogPosterior",
"numpy.array",
"numpy.linspace",
"pints.MCMCController",
"numpy.random.seed",
"unittest.main",
"numpy.all",
"pints.Sing... | [((7693, 7708), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7706, 7708), False, 'import unittest\n'), ((806, 823), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (820, 823), True, 'import numpy as np\n'), ((872, 891), 'pints.toy.LogisticModel', 'toy.LogisticModel', ([], {}), '()\n', (889, 891),... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 12 09:57:11 2016
@author: smrak
"""
import numpy as np
from pandas import read_hdf
import matplotlib.pyplot as plt
from scipy import interpolate
from scipy import signal
#fs = 10
#order = 5
#highcut = 0.025
#nyq = 0.5 * fs
#high = highcut / nyq
#b, a = signal.butter(ord... | [
"numpy.arange",
"matplotlib.pyplot.plot",
"scipy.signal.butter",
"scipy.interpolate.interp1d",
"numpy.array",
"scipy.signal.lfilter",
"numpy.isfinite",
"numpy.std",
"pandas.read_hdf"
] | [((984, 996), 'pandas.read_hdf', 'read_hdf', (['fn'], {}), '(fn)\n', (992, 996), False, 'from pandas import read_hdf\n'), ((1080, 1119), 'numpy.array', 'np.array', (["data['C1', sv, skip:, 'data']"], {}), "(data['C1', sv, skip:, 'data'])\n", (1088, 1119), True, 'import numpy as np\n'), ((1195, 1219), 'numpy.arange', 'n... |
import time
import multiprocessing as mp
from multiprocessing import Pool as ProcessPool
import numpy as np
import pandas as pd
from floris.utils.tools import valid_ops as vops
from floris.utils.tools import farm_config as fconfig
from floris.utils.visualization import wflo_eval as vweval
from floris.utils.visualizat... | [
"multiprocessing.cpu_count",
"numpy.argsort",
"floris.utils.tools.valid_ops.winds_discretization",
"numpy.array",
"floris.utils.tools.valid_ops.grids2layout",
"floris.utils.tools.valid_ops.wind_turbines_sort",
"floris.utils.tools.valid_ops.wt_power_reorder",
"floris.utils.visualization.wflo_opt.wt_pow... | [((11682, 11722), 'floris.utils.tools.valid_ops.coordinate_transform', 'vops.coordinate_transform', (['layout', 'theta'], {}), '(layout, theta)\n', (11707, 11722), True, 'from floris.utils.tools import valid_ops as vops\n'), ((11738, 11769), 'floris.utils.tools.valid_ops.wind_turbines_sort', 'vops.wind_turbines_sort', ... |
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Test that `LocalSnapshot` and `LocalSnapshotGPU` work."""
from copy import deepcopy
import hoomd
from hoomd.data.array import HOOMDGPUArray
import numpy as n... | [
"numpy.allclose",
"numpy.issubdtype",
"pytest.mark.skipif",
"numpy.array",
"cupy.allclose",
"pytest.raises",
"cupy.array",
"copy.deepcopy",
"pytest.fixture",
"numpy.linspace",
"pytest.skip",
"hoomd.Snapshot"
] | [((637, 708), 'pytest.mark.skipif', 'pytest.mark.skipif', (['skip_mpi4py'], {'reason': '"""mpi4py could not be imported."""'}), "(skip_mpi4py, reason='mpi4py could not be imported.')\n", (655, 708), False, 'import pytest\n'), ((7926, 7957), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='... |
from abc import ABC
import numpy as np
import gym
import mujoco_py
from gym.envs.registration import register
def change_fetch_model(change_model):
import os
import shutil
gym_folder = os.path.dirname(gym.__file__)
xml_folder = 'envs/robotics/assets/fetch'
full_folder_path = os.path.join(gym_folde... | [
"os.path.exists",
"shutil.copy2",
"os.path.join",
"gym.spaces.Box",
"os.path.dirname",
"numpy.zeros",
"numpy.array",
"mujoco_py.GlfwContext",
"mujoco_py.MjRenderContextOffscreen",
"numpy.concatenate",
"numpy.linalg.norm",
"gym.envs.robotics.utils.robot_get_obs",
"gym.make",
"numpy.round"
] | [((199, 228), 'os.path.dirname', 'os.path.dirname', (['gym.__file__'], {}), '(gym.__file__)\n', (214, 228), False, 'import os\n'), ((298, 334), 'os.path.join', 'os.path.join', (['gym_folder', 'xml_folder'], {}), '(gym_folder, xml_folder)\n', (310, 334), False, 'import os\n'), ((355, 399), 'os.path.join', 'os.path.join'... |
import numpy as np
import scipy.sparse
from typing import Text, Union, Optional, Dict, Any
from rasa.nlu.constants import FEATURIZER_CLASS_ALIAS
from rasa.nlu.components import Component
from rasa.utils.tensorflow.constants import MEAN_POOLING, MAX_POOLING
class Features:
"""Stores the features produces by any f... | [
"numpy.mean",
"numpy.max",
"numpy.zeros",
"scipy.sparse.hstack",
"numpy.concatenate"
] | [((2344, 2400), 'numpy.concatenate', 'np.concatenate', (['(features, additional_features)'], {'axis': '(-1)'}), '((features, additional_features), axis=-1)\n', (2358, 2400), True, 'import numpy as np\n'), ((2895, 2934), 'scipy.sparse.hstack', 'hstack', (['[features, additional_features]'], {}), '([features, additional_... |
#!/usr/bin/env python
#--------Include modules---------------
from copy import copy
import rospy
from visualization_msgs.msg import Marker
from geometry_msgs.msg import Point
from nav_msgs.msg import OccupancyGrid
import tf
from rrt_slam.msg import PointArray
from time import time
from numpy import array
from numpy im... | [
"functions.robot",
"nav_msgs.msg.OccupancyGrid",
"rospy.is_shutdown",
"functions.informationGain",
"rospy.init_node",
"rospy.get_param",
"functions.discount",
"numpy.array",
"rospy.Rate",
"numpy.linalg.norm",
"rospy.sleep",
"copy.copy",
"rospy.Subscriber"
] | [((540, 555), 'nav_msgs.msg.OccupancyGrid', 'OccupancyGrid', ([], {}), '()\n', (553, 555), False, 'from nav_msgs.msg import OccupancyGrid\n'), ((581, 596), 'nav_msgs.msg.OccupancyGrid', 'OccupancyGrid', ([], {}), '()\n', (594, 596), False, 'from nav_msgs.msg import OccupancyGrid\n'), ((607, 622), 'nav_msgs.msg.Occupanc... |
# Lint as: python3
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
"numpy.ones",
"lingvo.compat.zeros_like",
"lingvo.compat.test.main",
"numpy.random.randint",
"numpy.linspace",
"numpy.zeros",
"numpy.concatenate",
"numpy.random.uniform",
"lingvo.compat.Graph"
] | [((5136, 5150), 'lingvo.compat.test.main', 'tf.test.main', ([], {}), '()\n', (5148, 5150), True, 'from lingvo import compat as tf\n'), ((1002, 1061), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-1.0)', 'high': '(1.0)', 'size': '(num_bboxes, 3)'}), '(low=-1.0, high=1.0, size=(num_bboxes, 3))\n', (1019, 1... |
import random
import matplotlib.pyplot as plt
import numpy as np
def cmap(label: str) -> str:
"""Return RGB string of color for given standard psp label"""
_, pp_family, pp_z, pp_type, pp_version = label.split("/")
if pp_family == "sg15" and pp_version == "v1.0":
return "#000000"
if pp_fami... | [
"random.seed",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.tight_layout",
"random.randint",
"numpy.arange"
] | [((875, 892), 'random.seed', 'random.seed', (['ascn'], {}), '(ascn)\n', (886, 892), False, 'import random\n'), ((1071, 1120), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(1024 * px, 360 * px)'}), '(1, 1, figsize=(1024 * px, 360 * px))\n', (1083, 1120), True, 'import matplotlib.pyplot as ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 22 11:53:09 2022
@author: Oliver
"""
import numpy as np
from matplotlib import pyplot as plt
import cv2 as cv
from PIL import Image
from PIL.ImageOps import grayscale
from .pattern_tools import patchmaker, align_pattern, microns_into_pattern
def histogram_patches(patch... | [
"PIL.Image.open",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.savefig",
"cv2.drawContours",
"matplotlib.pyplot.clf",
"cv2.boundingRect",
"cv2.contourArea",
"PIL.ImageOps.grayscale",
"numpy.array",
"cv2.findContours",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show"
] | [((541, 553), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (549, 553), True, 'import numpy as np\n'), ((695, 726), 'matplotlib.pyplot.hist', 'plt.hist', (['brightness'], {'bins': 'bins'}), '(brightness, bins=bins)\n', (703, 726), True, 'from matplotlib import pyplot as plt\n'), ((731, 745), 'matplotlib.pyplot.xli... |
# Copyright 2019 The PlaNet Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
"collections.namedtuple",
"planet.control.wrappers.ActionRepeat",
"planet.control.wrappers.LimitDuration",
"gym.spaces.Dict",
"dm_control.suite.load",
"gym.spaces.Box",
"numpy.array",
"planet.envs.carla.env.CarlaEnv",
"functools.partial",
"planet.control.wrappers.ConvertTo32Bit",
"planet.control... | [((884, 962), 'collections.namedtuple', 'collections.namedtuple', (['"""Task"""', '"""name, env_ctor, max_length, state_components"""'], {}), "('Task', 'name, env_ctor, max_length, state_components')\n", (906, 962), False, 'import collections\n'), ((1215, 1303), 'functools.partial', 'functools.partial', (['_dm_control_... |
from collections import Counter
import numpy as np
import tensorflow as tf
from copy import copy
from constraint.dfa import DFA
class Constraint(object):
def __init__(self,
name,
dfa_string,
is_hard,
violation_reward=None,
tran... | [
"constraint.dfa.DFA.from_string",
"numpy.eye",
"numpy.ones",
"numpy.array",
"numpy.zeros",
"numpy.stack",
"numpy.isnan",
"numpy.argwhere"
] | [((431, 458), 'constraint.dfa.DFA.from_string', 'DFA.from_string', (['dfa_string'], {}), '(dfa_string)\n', (446, 458), False, 'from constraint.dfa import DFA\n'), ((1507, 1528), 'numpy.zeros', 'np.zeros', (['num_actions'], {}), '(num_actions)\n', (1515, 1528), True, 'import numpy as np\n'), ((3368, 3392), 'numpy.ones',... |
import os
import zipfile
import csv
import pandas as pd
import requests
import json
from itertools import islice
import sklearn.preprocessing
from lightfm.data import Dataset
import pandas
import numpy as np
from lightfm import LightFM
# restaurant_metadata = pd.read_json('rating_final.json', lines=True)
from scipy... | [
"pandas.Series",
"lightfm.data.Dataset",
"lightfm.LightFM",
"json.load",
"pandas.read_json",
"numpy.arange"
] | [((5044, 5057), 'json.load', 'json.load', (['ff'], {}), '(ff)\n', (5053, 5057), False, 'import json\n'), ((5070, 5083), 'json.load', 'json.load', (['df'], {}), '(df)\n', (5079, 5083), False, 'import json\n'), ((5091, 5103), 'json.load', 'json.load', (['f'], {}), '(f)\n', (5100, 5103), False, 'import json\n'), ((5114, 5... |
# coding: utf-8
""" Some photometry tools for stellar spectroscopists """
from __future__ import (division, print_function, absolute_import,
unicode_literals)
import numpy as np
from scipy import interpolate
from astropy.io import ascii
from .robust_polyfit import polyfit
import logging
import ... | [
"logging.getLogger",
"numpy.abs",
"numpy.log10",
"numpy.sqrt",
"numpy.logical_and",
"numpy.where",
"scipy.interpolate.griddata",
"numpy.log",
"numpy.argmax",
"scipy.interpolate.interp1d",
"numpy.sum",
"numpy.polyval",
"numpy.ravel",
"numpy.vectorize",
"astropy.io.ascii.read"
] | [((343, 370), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (360, 370), False, 'import logging\n'), ((5600, 5625), 'numpy.vectorize', 'np.vectorize', (['_gmr_to_BmV'], {}), '(_gmr_to_BmV)\n', (5612, 5625), True, 'import numpy as np\n'), ((11620, 11650), 'numpy.vectorize', 'np.vectorize',... |
import copy
import itertools
import seaborn as sns
import glob
import os
import math
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import imutils
import numpy as np
import time
from pre_processing import Pre_Processing
import cv2
class Roads():
def __init__(self):
self.road_parm ... | [
"cv2.norm",
"numpy.sqrt",
"numpy.hstack",
"math.cos",
"numpy.array",
"pre_processing.Pre_Processing",
"os.path.exists",
"cv2.arcLength",
"cv2.merge",
"cv2.drawContours",
"math.degrees",
"cv2.circle",
"math.atan2",
"time.time",
"os.makedirs",
"math.pow",
"os.path.join",
"itertools.c... | [((355, 371), 'pre_processing.Pre_Processing', 'Pre_Processing', ([], {}), '()\n', (369, 371), False, 'from pre_processing import Pre_Processing\n'), ((5401, 5442), 'itertools.combinations', 'itertools.combinations', (['large_contours', '(2)'], {}), '(large_contours, 2)\n', (5423, 5442), False, 'import itertools\n'), (... |
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dense, Activation, Flatten, SimpleRNN, Dropout
from tensorflow.keras.models import Sequential
import os
import json
import pickle
import scipy.io as sio
import matplotlib.pyplot as plt
from keras.utils import np_utils
from sklearn.... | [
"matplotlib.pyplot.ylabel",
"scipy.io.loadmat",
"numpy.array",
"tensorflow.keras.layers.Dense",
"os.path.exists",
"numpy.reshape",
"tensorflow.keras.layers.SimpleRNN",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.random.seed",
"sklearn.metrics.mean_absolute_error",
"tensorflow.... | [((770, 811), 'scipy.io.loadmat', 'sio.loadmat', (['"""data\\\\0HP\\\\normal_0_97.mat"""'], {}), "('data\\\\0HP\\\\normal_0_97.mat')\n", (781, 811), True, 'import scipy.io as sio\n'), ((1021, 1055), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (103... |
import matplotlib.pyplot as plt
import numpy as np
class RefDataType:
def __init__(self,length,steps,coverage,cv,marker,color,label):
self.length = length
self.steps = steps
self.coverage = coverage
self.cv = cv
self.marker = marker
self.color = color
self.label = label
def get_prop(self, prop_str):
... | [
"numpy.array",
"numpy.log2",
"numpy.log10",
"matplotlib.pyplot.show"
] | [((6007, 6017), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (6015, 6017), True, 'import matplotlib.pyplot as plt\n'), ((2195, 2224), 'numpy.array', 'np.array', (['[a[1] for a in row]'], {}), '([a[1] for a in row])\n', (2203, 2224), True, 'import numpy as np\n'), ((2564, 2577), 'numpy.log10', 'np.log10', (['... |
import numpy as np
import matplotlib.pyplot as plt
import cv2
from pathlib import Path
from skimage import io
import matplotlib.animation as ani
from IPython.display import HTML
import matplotlib
source_dir = Path('./data/source/test_img')
target_dir = Path('./results/target/test_latest/images')
#target_dir = Path('.... | [
"numpy.hstack",
"pathlib.Path",
"cv2.VideoWriter",
"cv2.VideoWriter_fourcc",
"cv2.resize"
] | [((211, 241), 'pathlib.Path', 'Path', (['"""./data/source/test_img"""'], {}), "('./data/source/test_img')\n", (215, 241), False, 'from pathlib import Path\n'), ((255, 298), 'pathlib.Path', 'Path', (['"""./results/target/test_latest/images"""'], {}), "('./results/target/test_latest/images')\n", (259, 298), False, 'from ... |
#!/usr/bin/env python
import rospy
import os
from move_base_msgs.msg import MoveBaseActionResult
from numpy.random import choice
# Taken from icanhazdadjoke.com
jokes = [
"I'm tired of following my dreams. I'm just going to ask them where they are going and meet up with them later."
"Did you hear about the gu... | [
"rospy.on_shutdown",
"numpy.random.choice",
"rospy.init_node",
"rospy.Rate",
"rospy.spin",
"os.system",
"rospy.Subscriber",
"rospy.loginfo"
] | [((2455, 2503), 'rospy.init_node', 'rospy.init_node', (['"""dad_joke_node"""'], {'anonymous': '(True)'}), "('dad_joke_node', anonymous=True)\n", (2470, 2503), False, 'import rospy\n'), ((2530, 2562), 'rospy.loginfo', 'rospy.loginfo', (['"""Ready for jokes"""'], {}), "('Ready for jokes')\n", (2543, 2562), False, 'import... |
# Libraries
from random import choice, random, shuffle
import pandas as pd
import numpy as np
from math import exp, sqrt
# Import an Excel file into Python
file_name, sheet = "TSP.xlsx", "Arkusz1"
data = pd.read_excel(file_name, sheet_name = sheet, engine = 'openpyxl')
# Getting initial solution
solution =... | [
"random.choice",
"numpy.double",
"random.shuffle",
"math.sqrt",
"pandas.read_excel",
"random.random",
"math.exp"
] | [((213, 274), 'pandas.read_excel', 'pd.read_excel', (['file_name'], {'sheet_name': 'sheet', 'engine': '"""openpyxl"""'}), "(file_name, sheet_name=sheet, engine='openpyxl')\n", (226, 274), True, 'import pandas as pd\n'), ((378, 395), 'random.shuffle', 'shuffle', (['solution'], {}), '(solution)\n', (385, 395), False, 'fr... |
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.nn.functional as F
import torch.utils.data
import numpy as np
import math
import time
import os
import pickle
import random
import nmslib
import sys
from scipy... | [
"scipy.sparse.lil_matrix",
"numpy.repeat",
"numpy.hstack",
"torch.mean",
"numpy.argsort",
"numpy.zeros",
"torch.utils.data.DataLoader",
"numpy.ravel",
"torch.set_grad_enabled",
"scipy.sparse.csr_matrix",
"time.time",
"numpy.arange",
"network.HNSW"
] | [((688, 717), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (710, 717), False, 'import torch\n'), ((1209, 1258), 'numpy.zeros', 'np.zeros', (['(top_k * batch_size, 2)'], {'dtype': 'np.int64'}), '((top_k * batch_size, 2), dtype=np.int64)\n', (1217, 1258), True, 'import numpy as np\n... |
import hypothesis.extra.numpy as hnp
import numpy as np
from hypothesis import settings
from numpy.testing import assert_allclose
from mygrad.tensor_base import Tensor
from ..custom_strategies import adv_integer_index, basic_indices
from ..wrappers.uber import backprop_test_factory, fwdprop_test_factory
def test_ge... | [
"mygrad.tensor_base.Tensor",
"hypothesis.extra.numpy.arrays",
"numpy.ix_",
"numpy.array",
"hypothesis.settings",
"hypothesis.extra.numpy.array_shapes"
] | [((1323, 1346), 'hypothesis.settings', 'settings', ([], {'deadline': 'None'}), '(deadline=None)\n', (1331, 1346), False, 'from hypothesis import settings\n'), ((1892, 1915), 'hypothesis.settings', 'settings', ([], {'deadline': 'None'}), '(deadline=None)\n', (1900, 1915), False, 'from hypothesis import settings\n'), ((2... |
# -*- coding: utf-8 -*-
#
from __future__ import division
import numpy
import sympy
from ..helpers import untangle
class WissmannBecker(object):
"""
<NAME> and <NAME>,
Partially Symmetric Cubature Formulas for Even Degrees of Exactness,
SIAM J. Numer. Anal., 23(3), 676–685, 10 pages,
<https://do... | [
"numpy.array"
] | [((3965, 3986), 'numpy.array', 'numpy.array', (['[[0, a]]'], {}), '([[0, a]])\n', (3976, 3986), False, 'import numpy\n'), ((4014, 4047), 'numpy.array', 'numpy.array', (['[[+a, +b], [-a, +b]]'], {}), '([[+a, +b], [-a, +b]])\n', (4025, 4047), False, 'import numpy\n')] |
from keras.layers import Conv2D, Input,MaxPool2D, Reshape,Activation,Flatten, Dense
from keras.models import Model, Sequential
from keras.layers.advanced_activations import PReLU
from keras.optimizers import adam
from keras.utils import to_categorical
import matplotlib.pyplot as plt
import numpy as np
import keras.back... | [
"os.path.exists",
"MTCNNx.create_Kao_Onet",
"MTCNNx.combine_cls_bbox_landmark",
"tables.open_file",
"_pickle.load",
"keras.utils.to_categorical",
"numpy.swapaxes",
"numpy.array",
"gc.collect",
"sys.path.append",
"keras.optimizers.adam"
] | [((571, 619), 'sys.path.append', 'sys.path.append', (['"""/home/wk/e/mtcnn/keras-mtcnn/"""'], {}), "('/home/wk/e/mtcnn/keras-mtcnn/')\n", (586, 619), False, 'import sys\n'), ((753, 779), 'os.path.exists', 'os.path.exists', (['cache_file'], {}), '(cache_file)\n', (767, 779), False, 'import os\n'), ((2377, 2406), 'MTCNNx... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import json
import threading
import io
import numpy as np
import mlflow
from flask import send_file
from PIL import Image
from queue import Queue
from backwardcompatibilityml.helpers import training
from backwardcompatibilityml.metrics ... | [
"os.path.exists",
"PIL.Image.fromarray",
"io.BytesIO",
"numpy.zeros",
"flask.send_file",
"threading.Thread",
"queue.Queue",
"backwardcompatibilityml.helpers.training.compatibility_sweep"
] | [((5589, 5596), 'queue.Queue', 'Queue', ([], {}), '()\n', (5594, 5596), False, 'from queue import Queue\n'), ((5745, 5752), 'queue.Queue', 'Queue', ([], {}), '()\n', (5750, 5752), False, 'from queue import Queue\n'), ((5818, 6569), 'threading.Thread', 'threading.Thread', ([], {'target': 'training.compatibility_sweep', ... |
import numpy as np
from noduleCADEvaluationLUNA16 import noduleCADEvaluation
import os
import csv
from multiprocessing import Pool
import functools
import SimpleITK as sitk
from config_testing import config
from layers import nms
annotations_filename = './labels/new_nodule.csv'
annotations_excluded_filename = './lab... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"csv.writer",
"numpy.exp",
"numpy.array",
"layers.nms",
"multiprocessing.Pool",
"functools.partial",
"numpy.expand_dims",
"numpy.load",
"noduleCADEvaluationLUNA16.noduleCADEvaluation",
"numpy.save"
] | [((1211, 1230), 'numpy.array', 'np.array', (['[1, 1, 1]'], {}), '([1, 1, 1])\n', (1219, 1230), True, 'import numpy as np\n'), ((1249, 1318), 'numpy.load', 'np.load', (["(sideinfopath + bboxfname[:-8] + '_origin.npy')"], {'mmap_mode': '"""r"""'}), "(sideinfopath + bboxfname[:-8] + '_origin.npy', mmap_mode='r')\n", (1256... |
# -*- coding: utf-8 -*-
import numpy, matplotlib.pyplot as plt, time
from sklearn.metrics import mean_squared_error, accuracy_score, roc_auc_score
class ExternalRNN(object):
"""Class that implements a External Recurent Neural Network"""
def __init__(self, hidden_layer_size=3, learning_rate=0.2, max_epochs=100... | [
"numpy.repeat",
"numpy.random.rand",
"numpy.ones",
"numpy.roll",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.mean_squared_error",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"numpy.exp",
"numpy.append",
"numpy.nan_to_num"
] | [((786, 854), 'numpy.random.rand', 'numpy.random.rand', (['(1 + self.input_layer_size)', 'self.hidden_layer_size'], {}), '(1 + self.input_layer_size, self.hidden_layer_size)\n', (803, 854), False, 'import numpy, matplotlib.pyplot as plt, time\n'), ((873, 942), 'numpy.random.rand', 'numpy.random.rand', (['(1 + self.hidd... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"numpy.repeat",
"math.ceil",
"six.add_metaclass",
"numpy.sum",
"numpy.zeros",
"numpy.argwhere",
"paddle.abs",
"numpy.cumsum"
] | [((3223, 3253), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (3240, 3253), False, 'import six\n'), ((5200, 5230), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (5217, 5230), False, 'import six\n'), ((7291, 7306), 'numpy.cumsum', 'np.cumsum', (... |
# Copyright 2020 Neural Networks and Deep Learning lab, MIPT
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"numpy.isfinite",
"deeppavlov.core.common.metrics_registry.register_metric",
"sklearn.metrics.mean_squared_error"
] | [((771, 808), 'deeppavlov.core.common.metrics_registry.register_metric', 'register_metric', (['"""mean_squared_error"""'], {}), "('mean_squared_error')\n", (786, 808), False, 'from deeppavlov.core.common.metrics_registry import register_metric\n'), ((1192, 1248), 'sklearn.metrics.mean_squared_error', 'mean_squared_erro... |
#!/usr/bin/env python
# _*_ coding: UTF-8 _*_
import json
import codecs
import argparse
import numpy as np
def compute_edit_distance(hypothesis: list, reference: list):
insert, delete, substitute = 0, 0, 0
correct = 0
len_hyp, len_ref = len(hypothesis), len(reference)
if len_hyp == 0 or len_ref =... | [
"json.load",
"numpy.zeros",
"codecs.open",
"json.dump"
] | [((391, 443), 'numpy.zeros', 'np.zeros', (['(len_hyp + 1, len_ref + 1)'], {'dtype': 'np.int16'}), '((len_hyp + 1, len_ref + 1), dtype=np.int16)\n', (399, 443), True, 'import numpy as np\n'), ((532, 583), 'numpy.zeros', 'np.zeros', (['(len_hyp + 1, len_ref + 1)'], {'dtype': 'np.int8'}), '((len_hyp + 1, len_ref + 1), dty... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from helpers import load_problem
experiments = ['synth', 'iso']
cases = ['spacefilling', 'alt', 'refine']
#experiments = ['synth']
#experiments = ['iso']
#cases = ['spacefilling', 'refine']
run_idx = 0
for experiment in experiments:
# load exp... | [
"helpers.load_problem",
"numpy.median",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"numpy.random.seed",
"numpy.savetxt",
"numpy.load"
] | [((3557, 3594), 'numpy.load', 'np.load', (['"""output/failure_example.npz"""'], {}), "('output/failure_example.npz')\n", (3564, 3594), True, 'import numpy as np\n'), ((3666, 3696), 'numpy.zeros', 'np.zeros', (['(n_eval.size - 1, 3)'], {}), '((n_eval.size - 1, 3))\n', (3674, 3696), True, 'import numpy as np\n'), ((3792,... |
# Copyright 2021 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... | [
"numpy.fromfile",
"os.listdir",
"PIL.Image.open",
"argparse.ArgumentParser",
"src.eval_utils.metrics",
"pycocotools.coco.COCO",
"os.path.join",
"numpy.squeeze",
"numpy.array"
] | [((862, 920), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""ssd acc calculation"""'}), "(description='ssd acc calculation')\n", (885, 920), False, 'import argparse\n'), ((1332, 1353), 'PIL.Image.open', 'Image.open', (['file_name'], {}), '(file_name)\n', (1342, 1353), False, 'from PIL im... |
from datetime import datetime,timedelta
import numpy as np
import json
from urllib.request import urlopen
from html.parser import HTMLParser
import os
# -----------------------------------------------
# General
# -----------------------------------------------
def get_dir(dirname,json_file='input/dirs.json'):
with... | [
"datetime.datetime",
"numpy.copy",
"html.parser.HTMLParser.__init__",
"os.listdir",
"numpy.logical_and",
"numpy.where",
"datetime.datetime.strptime",
"os.rename",
"datetime.datetime.datetime",
"numpy.argsort",
"numpy.array",
"numpy.isnan",
"json.load",
"datetime.timedelta",
"urllib.reque... | [((1518, 1539), 'os.listdir', 'os.listdir', (['input_dir'], {}), '(input_dir)\n', (1528, 1539), False, 'import os\n'), ((2193, 2249), 'numpy.logical_and', 'np.logical_and', (['(array >= start_value)', '(array <= end_value)'], {}), '(array >= start_value, array <= end_value)\n', (2207, 2249), True, 'import numpy as np\n... |
import os
import argparse
import subprocess
import numpy as np
import pandas as pd
def training_model(filename, technique, pruning_rate, layer):
""" Training the pruned model """
# Opens the temporary file
f = open('../eval.txt', 'a+')
# Training with pre-trained weights
if technique.upper() != ... | [
"argparse.ArgumentParser",
"os.chdir",
"subprocess.call",
"numpy.arange",
"os.remove"
] | [((744, 790), 'subprocess.call', 'subprocess.call', (['command'], {'shell': '(True)', 'stdout': 'f'}), '(command, shell=True, stdout=f)\n', (759, 790), False, 'import subprocess\n'), ((1341, 1387), 'subprocess.call', 'subprocess.call', (['command'], {'shell': '(True)', 'stdout': 'f'}), '(command, shell=True, stdout=f)\... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 6 13:45:30 2019
@author: LOVESA
"""
#importing relevant packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os
import cv2
import math
from os.path import isfile, join
import Helper as Functions
#Paramet... | [
"matplotlib.pyplot.imshow",
"Helper.region_of_interest",
"Helper.canny",
"numpy.copy",
"Helper.hough_lines",
"numpy.ones",
"Helper.weighted_img",
"numpy.array",
"Helper.grayscale",
"Helper.gaussian_blur"
] | [((910, 927), 'matplotlib.pyplot.imshow', 'plt.imshow', (['image'], {}), '(image)\n', (920, 927), True, 'import matplotlib.pyplot as plt\n'), ((1136, 1162), 'Helper.grayscale', 'Functions.grayscale', (['image'], {}), '(image)\n', (1155, 1162), True, 'import Helper as Functions\n'), ((1168, 1197), 'matplotlib.pyplot.ims... |
import csv # csv libary
import cv2
from math import ceil
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from scipy import ndimage
# Global Parameters
epochs = 5
batch_size = 32
validation_split = 0.2
correction =... | [
"keras.layers.core.Flatten",
"matplotlib.pyplot.ylabel",
"scipy.ndimage.imread",
"numpy.array",
"keras.layers.pooling.MaxPooling2D",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"csv.reader",
"matplotlib.pyplot.savefig",
"keras.layers.convolutional.Cropping2D",
"sklearn.model_selection.... | [((3208, 3259), 'sklearn.model_selection.train_test_split', 'train_test_split', (['lines'], {'test_size': 'validation_split'}), '(lines, test_size=validation_split)\n', (3224, 3259), False, 'from sklearn.model_selection import train_test_split\n'), ((3916, 3928), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n... |
import scipy.io as io
import numpy as np
import os
from dataset.data_util import pil_load_img
from dataset.dataload import TextDataset, TextInstance
class TotalText(TextDataset):
def __init__(self, data_root, ignore_list=None, is_training=True, transform=None):
super().__init__(transform)
self.da... | [
"os.listdir",
"scipy.io.loadmat",
"os.path.join",
"util.augmentation.Augmentation",
"numpy.stack",
"dataset.data_util.pil_load_img",
"dataset.dataload.TextInstance"
] | [((2619, 2663), 'util.augmentation.Augmentation', 'Augmentation', ([], {'size': '(512)', 'mean': 'means', 'std': 'stds'}), '(size=512, mean=means, std=stds)\n', (2631, 2663), False, 'from util.augmentation import BaseTransform, Augmentation\n'), ((628, 697), 'os.path.join', 'os.path.join', (['data_root', '"""Images"""'... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from ..pr... | [
"numpy.issubdtype"
] | [((1355, 1405), 'numpy.issubdtype', 'np.issubdtype', (['op.classes_.dtype', 'np.signedinteger'], {}), '(op.classes_.dtype, np.signedinteger)\n', (1368, 1405), True, 'import numpy as np\n')] |
import pandas as pd
import numpy as np
import pytest
from nltk.metrics.distance import masi_distance
from pandas.testing import assert_series_equal
from crowdkit.aggregation.utils import get_accuracy
from crowdkit.metrics.data import alpha_krippendorff, consistency, uncertainty
from crowdkit.metrics.performers import ... | [
"pandas.Series",
"pandas.DataFrame.from_records",
"numpy.unique",
"crowdkit.aggregation.utils.get_accuracy",
"numpy.testing.assert_allclose",
"crowdkit.metrics.data.alpha_krippendorff",
"crowdkit.metrics.performers.accuracy_on_aggregates",
"pandas.Index",
"crowdkit.metrics.data.consistency",
"pyte... | [((394, 421), 'crowdkit.metrics.data.consistency', 'consistency', (['toy_answers_df'], {}), '(toy_answers_df)\n', (405, 421), False, 'from crowdkit.metrics.data import alpha_krippendorff, consistency, uncertainty\n'), ((4908, 4993), 'crowdkit.metrics.data.uncertainty', 'uncertainty', (['answers', 'performers_skills'], ... |
import albumentations
from albumentations.pytorch import ToTensorV2
import cv2
import numpy as np
def crop_image_from_gray(img, tol=7):
if img.ndim == 2:
mask = img > tol
return img[np.ix_(mask.any(1), mask.any(0))]
elif img.ndim == 3:
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
... | [
"albumentations.pytorch.ToTensorV2",
"albumentations.MedianBlur",
"albumentations.RandomBrightnessContrast",
"albumentations.Cutout",
"albumentations.VerticalFlip",
"albumentations.IAAAdditiveGaussianNoise",
"albumentations.HueSaturationValue",
"numpy.stack",
"albumentations.Normalize",
"albumenta... | [((280, 317), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (292, 317), False, 'import cv2\n'), ((1166, 1211), 'albumentations.Resize', 'albumentations.Resize', (['image_size', 'image_size'], {}), '(image_size, image_size)\n', (1187, 1211), False, 'import albumentat... |
"""
Short corridor with switched actions (Example 13.1) of Sutton and Barto's
"Reinforcement learning"
"""
import numpy as np
class ShortCorridor():
"""Short corridor with switched actions"""
def __init__(self):
self.num_states = 4
self.states = self.state_space()
self.a... | [
"numpy.array"
] | [((1538, 1555), 'numpy.array', 'np.array', (['[-1, 1]'], {}), '([-1, 1])\n', (1546, 1555), True, 'import numpy as np\n'), ((2172, 2188), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (2180, 2188), True, 'import numpy as np\n'), ((2234, 2250), 'numpy.array', 'np.array', (['[1, 0]'], {}), '([1, 0])\n', (2242... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [
"numpy.random.rand",
"jax.nn.log_softmax",
"numpy.log",
"language.mentionmemory.utils.metric_utils.compute_cross_entropy_loss_with_positives_and_negatives_masks",
"numpy.array",
"numpy.random.random",
"jax.numpy.asarray",
"numpy.random.seed",
"language.mentionmemory.utils.metric_utils.compute_loss_a... | [((5319, 5683), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(0, 1, 29, 31, 31)', '(1, 1000000, 29, 31)', '(2, 1000000, 29, 31)', '(3, 100, 29, 1001)', '(4, 100, 323, 31)', '(5, 1, 29, 31, 1, 31)', '(6, 1, 29, 31, 0, 31)', '(7, 1, 29, 31, 31, 1)', '(8, 1, 29, 31, 31, 0)', '(9, 1, 29, 31, 1, 1... |
"""
Multi object tracking results and ground truth
- conversion,
- evaluation,
- visualization.
For more help run this file as a script with --help parameter.
PyCharm debugger could have problems debugging inside this module due to a bug:
https://stackoverflow.com/questions/47988936/debug-properly-with-pycharm-modul... | [
"motmetrics.io.render_summary",
"numpy.sqrt",
"pandas.read_csv",
"pandas.DataFrame",
"motmetrics.utils.compare_to_groundtruth",
"tqdm.tqdm",
"h5py.File",
"motmetrics.metrics.create",
"numpy.concatenate",
"numpy.moveaxis",
"warnings.warn",
"numpy.load",
"pandas.concat",
"numpy.arange",
"s... | [((836, 876), 'pandas.read_csv', 'pd.read_csv', (['filename_or_buffer'], {'nrows': '(2)'}), '(filename_or_buffer, nrows=2)\n', (847, 876), True, 'import pandas as pd\n'), ((2010, 2064), 'pandas.read_csv', 'pd.read_csv', (['filename_or_buffer'], {'delim_whitespace': '(True)'}), '(filename_or_buffer, delim_whitespace=Tru... |
import numpy as np
class Poblacion:
"""Posibles soluciones del óptimo de una función.
Esta clase crea posibles soluciones para una función a optimizar. Toma la dimensión
del espacio, los límites de búsqueda y el número de elementos a tomar en cuenta.
Attributes:
dimension: Un entero que dete... | [
"numpy.clip",
"numpy.copy",
"numpy.zeros",
"numpy.random.uniform"
] | [((1557, 1624), 'numpy.random.uniform', 'np.random.uniform', (['*self.lim'], {'size': '(self.elementos, self.dimension)'}), '(*self.lim, size=(self.elementos, self.dimension))\n', (1574, 1624), True, 'import numpy as np\n'), ((3821, 3867), 'numpy.zeros', 'np.zeros', (['(self.elementos, self.dimension + 1)'], {}), '((se... |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# 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 c... | [
"torch.nn.Conv1d",
"torch.max",
"math.log2",
"torch.nn.functional.pad",
"torch.nn.functional.softmax",
"torch.tanh",
"torch.nn.ModuleList",
"utils.print_etr",
"torch.nn.Embedding",
"numpy.random.choice",
"torch.nn.functional.relu",
"time.time",
"torch.cat",
"torch.cuda.FloatTensor",
"tor... | [((2235, 2352), 'torch.nn.Conv1d', 'torch.nn.Conv1d', (['in_channels', 'out_channels'], {'kernel_size': 'kernel_size', 'stride': 'stride', 'dilation': 'dilation', 'bias': 'bias'}), '(in_channels, out_channels, kernel_size=kernel_size, stride=\n stride, dilation=dilation, bias=bias)\n', (2250, 2352), False, 'import t... |
from sklearn.svm import LinearSVC
import numpy as np
import scipy
from Blob import Blob
import logging
import time
import IAlgorithm
__author__ = 'simon'
class Classificator(IAlgorithm.IAlgorithm):
def __init__(self, classificator, use_sparse = None):
''' Trains a classificator in training phase and pre... | [
"logging.debug",
"logging.warning",
"numpy.array",
"Blob.Blob",
"scipy.sparse.vstack",
"logging.error"
] | [((666, 712), 'logging.debug', 'logging.debug', (["('Using sparse: %s' % use_sparse)"], {}), "('Using sparse: %s' % use_sparse)\n", (679, 712), False, 'import logging\n'), ((2530, 2637), 'logging.warning', 'logging.warning', (["('Training the model with feature dim %i, this might take a while' % data.\n shape[1])"],... |
import numpy as np
import brainscore
from brainio.assemblies import DataAssembly
from brainscore.benchmarks._properties_common import PropertiesBenchmark, _assert_grating_activations
from brainscore.benchmarks._properties_common import calc_spatial_frequency_tuning
from brainscore.metrics.ceiling import NeuronalProper... | [
"brainscore.get_assembly",
"brainscore.benchmarks._properties_common.PropertiesBenchmark",
"numpy.ones",
"numpy.argmax",
"brainscore.benchmarks._properties_common.calc_spatial_frequency_tuning",
"brainscore.metrics.distribution_similarity.BootstrapDistributionSimilarity",
"numpy.zeros",
"numpy.argwher... | [((2276, 2326), 'result_caching.store', 'store', ([], {'identifier_ignore': "['responses', 'baseline']"}), "(identifier_ignore=['responses', 'baseline'])\n", (2281, 2326), False, 'from result_caching import store\n'), ((1318, 1356), 'brainscore.get_assembly', 'brainscore.get_assembly', (['ASSEMBLY_NAME'], {}), '(ASSEMB... |
import tensorflow as tf
import numpy as np
class MaxoutNN():
def __init__(self, input_dim, hidden_layers, output_dim):
self.input_dim = input_dim
self.hidden_layers = hidden_layers
self.output_dim = output_dim
self.inp = tf.placeholder(tf.float32, [None, self.input_dim], 'inp')
... | [
"tensorflow.contrib.layers.batch_norm",
"numpy.prod",
"tensorflow.get_variable",
"tensorflow.contrib.layers.layer_norm",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.softmax_cross_entropy_with_logits_v2",
"tensorflow.global_variables_initializer",
"tensorflow.argmax",
"tensorflow... | [((259, 316), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.input_dim]', '"""inp"""'], {}), "(tf.float32, [None, self.input_dim], 'inp')\n", (273, 316), True, 'import tensorflow as tf\n'), ((339, 400), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.output_dim]', '"""... |
import warnings
warnings.simplefilter("ignore", UserWarning)
import pandas as pd
import dill as pickle
import functools
import os
from sklearn.feature_selection import f_regression, mutual_info_regression
from sklearn.mixture import BayesianGaussianMixture as GMM
from scipy.stats import spearmanr, pearsonr
import scipy... | [
"scipy.stats.spearmanr",
"os.path.exists",
"numpy.sqrt",
"pandas.read_csv",
"os.makedirs",
"tqdm.tqdm",
"os.getcwd",
"os.path.isfile",
"dill.dump",
"sklearn.mixture.BayesianGaussianMixture",
"functools.partial",
"numpy.sign",
"warnings.simplefilter",
"scipy.stats.norm.cdf",
"numpy.isinf"... | [((16, 60), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'UserWarning'], {}), "('ignore', UserWarning)\n", (37, 60), False, 'import warnings\n'), ((418, 504), 'pandas.read_csv', 'pd.read_csv', (['sif_file'], {'names': "['UpGene', 'Type', 'DownGene']", 'sep': '"""\t"""', 'header': 'None'}), "(sif_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.