code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# 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...
[ "numpy.log10", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.fill_between", "numpy.array", "matplotlib.ticker.ScalarFormatter", "numpy.genfromtxt", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.axhline", "matplotlib.pyplot.close", "matplotlib.gridspec.GridSpec", "ma...
[((2221, 2297), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../../data/MR_earthlike_rocky.txt"""'], {'names': "['mass', 'radius']"}), "('../../data/MR_earthlike_rocky.txt', names=['mass', 'radius'])\n", (2234, 2297), True, 'import numpy as np\n'), ((2349, 2419), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../../data/MR_p...
import cv2 as cv import numpy as np img = cv.imread("D:/Programming/Python_Projects/Computer_Vision/Resources/Image/park.jfif") cv.imshow('Park', img) blank = np.zeros(img.shape[:2], dtype='uint8') # cv.imshow('Blank Image', blank) circle = cv.circle(blank.copy(), (img.shape[1]//2 + 45,img.shape[0]//2), 100...
[ "cv2.bitwise_and", "cv2.imshow", "numpy.zeros", "cv2.waitKey", "cv2.bitwise_or", "cv2.imread" ]
[((46, 136), 'cv2.imread', 'cv.imread', (['"""D:/Programming/Python_Projects/Computer_Vision/Resources/Image/park.jfif"""'], {}), "(\n 'D:/Programming/Python_Projects/Computer_Vision/Resources/Image/park.jfif')\n", (55, 136), True, 'import cv2 as cv\n'), ((133, 155), 'cv2.imshow', 'cv.imshow', (['"""Park"""', 'img']...
import numpy as np import math from numpy import * import copy from MST_Direction import * def CalM(CtgDirection,DFlag,weight_mat): M = 0 D = 1 ContigCount = len(CtgDirection) for n1 in range(ContigCount-1): for n2 in range(n1,ContigCount): if DFlag[n1][n2]!=0: D +=weight_mat[n1][n2] M +...
[ "numpy.abs", "numpy.ones", "numpy.argmax", "numpy.diag", "numpy.array", "numpy.dot", "numpy.zeros", "numpy.sign", "copy.deepcopy" ]
[((495, 516), 'numpy.zeros', 'np.zeros', (['ContigCount'], {}), '(ContigCount)\n', (503, 516), True, 'import numpy as np\n'), ((524, 544), 'numpy.ones', 'np.ones', (['ContigCount'], {}), '(ContigCount)\n', (531, 544), True, 'import numpy as np\n'), ((1096, 1118), 'numpy.array', 'np.array', (['CtgDirection'], {}), '(Ctg...
# Data loading based on https://github.com/NVIDIA/flownet2-pytorch from ast import NotEq import numpy as np import torch import torch.utils.data as data from torch.utils.data import DistributedSampler import torch.nn.functional as F import os import math import random from glob import glob import os.path as osp impor...
[ "torch.utils.data.DistributedSampler", "utils.augmentor.FlowAugmentor", "torch.from_numpy", "utils.frame_utils.read_gen", "numpy.array", "utils.utils.print0", "os.listdir", "numpy.random.seed", "utils.augmentor.SparseFlowAugmentor", "numpy.tile", "sklearn.model_selection.train_test_split", "to...
[((26076, 26247), 'torch.utils.data.DataLoader', 'data.DataLoader', (['train_dataset'], {'batch_size': 'args.batch_size', 'sampler': 'train_sampler', 'pin_memory': '(True)', 'shuffle': 'shuffle', 'num_workers': 'args.num_workers', 'drop_last': '(True)'}), '(train_dataset, batch_size=args.batch_size, sampler=\n train...
import pandas as pd from sklearn import preprocessing from sklearn.feature_extraction.text import ENGLISH_STOP_WORDS from sklearn.feature_extraction.text import TfidfVectorizer import os from sklearn.decomposition import TruncatedSVD from sklearn.metrics import f1_score from sklearn.metrics import accuracy_score from s...
[ "numpy.mean", "matplotlib.pyplot.grid", "pandas.read_csv", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.show", "matplotlib.pyplot.xlabel", "sklearn.tree.DecisionTreeClassifier", "sklearn.neighbors.KNeighborsClassifier", "sklearn.ensemble.RandomForestClassifier", "sklearn.decomposition.TruncatedS...
[((730, 774), 'pandas.read_csv', 'pd.read_csv', (['"""train_gossipcop_vol2.csv"""', '""","""'], {}), "('train_gossipcop_vol2.csv', ',')\n", (741, 774), True, 'import pandas as pd\n'), ((995, 1064), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'sublinear_tf': '(True)', 'max_df': '(0.29)', ...
# Implementation of various helper functions import matplotlib.pyplot as plt import numpy as np from numpy import pi from scipy.integrate import quad from scipy.special import kve import sys # Electron rest energy in eV mc2 = 0.51099895000e6 def averagedIonizationCrossSection(T, C, DI_eV, betaStar): """ ""...
[ "matplotlib.pyplot.semilogy", "numpy.sqrt", "numpy.isscalar", "numpy.where", "numpy.log", "numpy.exp", "numpy.zeros", "numpy.linspace", "scipy.special.kve", "matplotlib.pyplot.show" ]
[((368, 380), 'numpy.zeros', 'np.zeros', (['nT'], {}), '(nT)\n', (376, 380), True, 'import numpy as np\n'), ((1537, 1556), 'numpy.sqrt', 'np.sqrt', (['(1 + p ** 2)'], {}), '(1 + p ** 2)\n', (1544, 1556), True, 'import numpy as np\n'), ((2157, 2176), 'numpy.sqrt', 'np.sqrt', (['(1 + p ** 2)'], {}), '(1 + p ** 2)\n', (21...
import numpy as np raw = np.load('data/training_data_bounty_attack_mobilenet.npy') converted_data = [] for data in raw: # data[0] if data[1] == [0,0,0,0]: data[1] = [0,0,0,0,1] else: data[1].append(0) if data[2] == [0,0]: data[2] = [0,0,1] else: data[2].append(0) ...
[ "numpy.load", "numpy.save" ]
[((27, 84), 'numpy.load', 'np.load', (['"""data/training_data_bounty_attack_mobilenet.npy"""'], {}), "('data/training_data_bounty_attack_mobilenet.npy')\n", (34, 84), True, 'import numpy as np\n'), ((379, 425), 'numpy.save', 'np.save', (['"""data/converted2.npy"""', 'converted_data'], {}), "('data/converted2.npy', conv...
from flask import Flask, request, url_for, redirect, render_template, jsonify, abort import pandas as pd import pickle import numpy as np import json from sklearn.preprocessing import StandardScaler app = Flask(__name__) model = pickle.load(open('model.pkl', 'rb')) cols = ['ph', 'Hardness', 'Solids', 'Chloramines', '...
[ "flask.render_template", "pandas.read_csv", "flask.Flask", "json.dumps", "sklearn.preprocessing.StandardScaler", "numpy.array", "flask.request.form.values", "pandas.DataFrame" ]
[((206, 221), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (211, 221), False, 'from flask import Flask, request, url_for, redirect, render_template, jsonify, abort\n'), ((436, 465), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (451, 465), False, 'from flask ...
import os import sys import os.path as op import random import torch import torch.nn as nn import six import torch.optim as optim from torch.autograd import Variable import pandas as pd import numpy as np import pickle import csv from torch.utils.data import Dataset from torch.utils.data import DataLoader import filena...
[ "torch.cuda.is_available", "sys.exit", "os.listdir", "numpy.asarray", "numpy.max", "numpy.issubdtype", "os.mkdir", "torch.optim.lr_scheduler.ReduceLROnPlateau", "numpy.full", "csv.writer", "torch.save", "time.time", "torch.cat", "utils.deps_from_tsv", "pickle.dump", "torch.load", "os...
[((1572, 1637), 'numpy.full', 'np.full', (['((num_samples, maxlen) + sample_shape)', 'value'], {'dtype': 'dtype'}), '((num_samples, maxlen) + sample_shape, value, dtype=dtype)\n', (1579, 1637), True, 'import numpy as np\n'), ((488, 513), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (511, 513)...
import numpy as np class Gene: """ Gene class Attributes: ----------- CITY_NUM {int} -- the number of cities GENE_SIZE {int} -- gene size gene {np.ndarray} -- gene representation route {list[int]} -- route converted from gene """ def __init__(self, gene_size, city...
[ "numpy.zeros", "numpy.random.randint" ]
[((680, 720), 'numpy.zeros', 'np.zeros', (['self.GENE_SIZE'], {'dtype': 'np.int32'}), '(self.GENE_SIZE, dtype=np.int32)\n', (688, 720), True, 'import numpy as np\n'), ((781, 824), 'numpy.random.randint', 'np.random.randint', (['(0)', '(self.GENE_SIZE - i)', '(1)'], {}), '(0, self.GENE_SIZE - i, 1)\n', (798, 824), True,...
# -*- coding: utf-8 -*- # @Time : 2019-05-21 19:55 # @Author : LeeHW # @File : Prepare_data.py # @Software: PyCharm from glob import glob from flags import * import os from scipy import misc import numpy as np import datetime import imageio from multiprocessing.dummy import Pool as ThreadPool import argparse pa...
[ "scipy.misc.imrotate", "os.makedirs", "argparse.ArgumentParser", "scipy.misc.imsave", "os.path.join", "datetime.datetime.now", "os.path.isdir", "scipy.misc.imresize", "imageio.imread", "numpy.mod", "multiprocessing.dummy.Pool" ]
[((327, 352), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (350, 352), False, 'import argparse\n'), ((754, 777), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (775, 777), False, 'import datetime\n'), ((862, 909), 'os.path.join', 'os.path.join', (['args.save_dir', 'args.m...
# Copyright 2015 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 required by applica...
[ "tensorflow.transpose", "tensorflow.FixedLengthRecordReader", "six.moves.xrange", "tensorflow.train.shuffle_batch", "numpy.arange", "tensorflow.summary.image", "tensorflow.gfile.Exists", "tensorflow.decode_raw", "tensorflow.random_crop", "numpy.concatenate", "numpy.frombuffer", "tensorflow.tra...
[((3084, 3173), 'tensorflow.FixedLengthRecordReader', 'tf.FixedLengthRecordReader', ([], {'record_bytes': 'record_bytes', 'header_bytes': '(0)', 'footer_bytes': '(0)'}), '(record_bytes=record_bytes, header_bytes=0,\n footer_bytes=0)\n', (3110, 3173), True, 'import tensorflow as tf\n'), ((3399, 3433), 'tensorflow.dec...
from abc import abstractmethod from typing import Any, Dict, Optional, Sequence, Tuple import gym import numpy as np from gym import spaces from gym.utils import seeding from gym_simplifiedtetris.envs._simplified_tetris_engine import _SimplifiedTetrisEngine class _SimplifiedTetrisBaseEnv(gym.Env): """ All c...
[ "gym_simplifiedtetris.envs._simplified_tetris_engine._SimplifiedTetrisEngine", "gym.spaces.Discrete", "numpy.any", "numpy.append", "numpy.array", "gym.utils.seeding.np_random" ]
[((736, 771), 'gym.spaces.Discrete', 'spaces.Discrete', (['self._num_actions_'], {}), '(self._num_actions_)\n', (751, 771), False, 'from gym import spaces\n'), ((1989, 2122), 'gym_simplifiedtetris.envs._simplified_tetris_engine._SimplifiedTetrisEngine', '_SimplifiedTetrisEngine', ([], {'grid_dims': 'grid_dims', 'piece_...
"quantify shape and depth diversity of FHIR data" # conda create -n py39 python=3.9 # conda activate py39 # pip install rich, numpy # python fhir.py from dataclasses import dataclass from itertools import chain from typing import Dict, List, Optional, Tuple import json import os from plotly.subplots import make_subpl...
[ "plotly.graph_objects.Bar", "os.listdir", "plotly.subplots.make_subplots", "os.path.join", "dataclasses.dataclass", "numpy.array", "rich.print", "itertools.chain.from_iterable", "json.load" ]
[((4384, 4406), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (4393, 4406), False, 'from dataclasses import dataclass\n'), ((5640, 5662), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (5649, 5662), False, 'from dataclasses import dataclass\n'...
## PSYC493 - Directed Studies ## Jack 'jryzkns' Zhou 2018 ## code used for calculating a range of ## tolerable values of approximate the sine ratio with the identity from matplotlib.pyplot import plot, show, xlabel, ylabel, title, axis from math import sin, pi, log from numpy import arange def diff(x): retu...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "math.log", "matplotlib.pyplot.title", "math.sin", "numpy.arange", "matplotlib.pyplot.show" ]
[((397, 423), 'numpy.arange', 'arange', (['(0.01)', '(pi / 2)', '(0.01)'], {}), '(0.01, pi / 2, 0.01)\n', (403, 423), False, 'from numpy import arange\n'), ((599, 609), 'matplotlib.pyplot.plot', 'plot', (['x', 'y'], {}), '(x, y)\n', (603, 609), False, 'from matplotlib.pyplot import plot, show, xlabel, ylabel, title, ax...
""" Calibration and image printing utility functions """ import matplotlib.pyplot as plt import torchvision import numpy as np __all__ = ['make_image', 'show_batch', 'write_calibration'] def write_calibration( avg_confs_in_bins, acc_in_bin_list, prop_bin, min_bin, max_bin, min_pred=0, wr...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.tight_layout", "torchvision.utils.make_grid", "numpy.transpose", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((470, 484), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (482, 484), True, 'import matplotlib.pyplot as plt\n'), ((1811, 1841), 'numpy.transpose', 'np.transpose', (['npimg', '(1, 2, 0)'], {}), '(npimg, (1, 2, 0))\n', (1823, 1841), True, 'import numpy as np\n'), ((2023, 2041), 'matplotlib.pyplot.ims...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- """ fiberassign.targets ===================== Functions for loading the target list """ from __future__ import absolute_import, division, print_function import numpy as np import fitsio # FIXME: If / when SV bit names diverge ...
[ "numpy.isscalar", "desitarget.targets.main_cmx_or_sv", "desitarget.targetmask.desi_mask.names", "scipy.spatial.KDTree", "fitsio.FITS", "numpy.asarray", "numpy.flatnonzero", "desitarget.sv3.sv3_targetmask.desi_mask.names", "desitarget.cmx.cmx_targetmask.cmx_mask.names", "numpy.array", "numpy.zero...
[((19268, 19292), 'numpy.isscalar', 'np.isscalar', (['desi_target'], {}), '(desi_target)\n', (19279, 19292), True, 'import numpy as np\n'), ((22804, 22824), 'desitarget.targets.main_cmx_or_sv', 'main_cmx_or_sv', (['data'], {}), '(data)\n', (22818, 22824), False, 'from desitarget.targets import main_cmx_or_sv\n'), ((252...
# coding: utf-8 # # Extract NECOFS data using NetCDF4-Python and analyze/visualize with Pandas # In[1]: # Plot forecast water levels from NECOFS model from list of lon,lat locations # (uses the nearest point, no interpolation) import netCDF4 import datetime as dt import pandas as pd import numpy as np import matplo...
[ "datetime.datetime", "numpy.sqrt", "matplotlib.pyplot.ylabel", "datetime.datetime.utcnow", "netCDF4.date2index", "netCDF4.num2date", "netCDF4.Dataset", "pandas.DataFrame", "datetime.timedelta" ]
[((3103, 3156), 'netCDF4.date2index', 'netCDF4.date2index', (['start', 'time_var'], {'select': '"""nearest"""'}), "(start, time_var, select='nearest')\n", (3121, 3156), False, 'import netCDF4\n'), ((3163, 3215), 'netCDF4.date2index', 'netCDF4.date2index', (['stop', 'time_var'], {'select': '"""nearest"""'}), "(stop, tim...
""" Simple ICP localisation demo Compute position of each scan using ICP with respect to the previous one author: <NAME> """ import readDatasets as datasets import matplotlib.pyplot as plt import icp import numpy as np import copy # Reading data #scanList = datasets.read_fr079(0) scanList = datasets.read_u2is(0) ...
[ "matplotlib.pyplot.savefig", "numpy.random.rand", "icp.icp", "readDatasets.read_u2is", "readDatasets.transform_scan", "copy.deepcopy", "matplotlib.pyplot.pause", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((298, 319), 'readDatasets.read_u2is', 'datasets.read_u2is', (['(0)'], {}), '(0)\n', (316, 319), True, 'import readDatasets as datasets\n'), ((365, 388), 'copy.deepcopy', 'copy.deepcopy', (['scanList'], {}), '(scanList)\n', (378, 388), False, 'import copy\n'), ((506, 554), 'matplotlib.pyplot.subplots', 'plt.subplots',...
from typing import Tuple, List import numpy as np from math import ceil def create_node(coordinates:Tuple[int, float, float]) -> dict: """ Dado o valor do indice e das coordenadas no formtato (indice, x, y), cria um dicionario com o valores das cidades. Em primeira instancia, a capacidade de uma cida...
[ "numpy.zeros" ]
[((2773, 2814), 'numpy.zeros', 'np.zeros', (['(clients, clients)'], {'dtype': 'float'}), '((clients, clients), dtype=float)\n', (2781, 2814), True, 'import numpy as np\n')]
"""Defines metrics used to evaluate uncertainty.""" import numpy as np from scipy.stats import norm from utils.util import to_one_hot def gaussian_nll(y, mu, var): """Calculates the negative log likelihood of Gaussian distribution. Args: y: numpy array, shape [batch_size], the true labels. ...
[ "numpy.sqrt", "numpy.log", "numpy.equal", "utils.util.to_one_hot", "numpy.arange", "numpy.mean", "numpy.histogram", "numpy.where", "numpy.max", "numpy.linspace", "numpy.ma.masked_array", "numpy.abs", "numpy.digitize", "numpy.argmax", "numpy.argpartition", "numpy.absolute", "numpy.sum...
[((2492, 2527), 'numpy.zeros_like', 'np.zeros_like', (['expected_conf_levels'], {}), '(expected_conf_levels)\n', (2505, 2527), True, 'import numpy as np\n'), ((2898, 2915), 'numpy.mean', 'np.mean', (['pred_var'], {}), '(pred_var)\n', (2905, 2915), True, 'import numpy as np\n'), ((3406, 3435), 'numpy.zeros', 'np.zeros',...
import abc import numpy as np class Waveform(abc.ABC): _waveform = None @property @abc.abstractmethod def waveform(self) -> np.ndarray: raise NotImplementedError def __len__(self): return len(self.waveform) def shift(self, shift=0): """ :param shift: shift ...
[ "numpy.zeros" ]
[((1324, 1340), 'numpy.zeros', 'np.zeros', (['length'], {}), '(length)\n', (1332, 1340), True, 'import numpy as np\n'), ((541, 556), 'numpy.zeros', 'np.zeros', (['shift'], {}), '(shift)\n', (549, 556), True, 'import numpy as np\n'), ((658, 673), 'numpy.zeros', 'np.zeros', (['shift'], {}), '(shift)\n', (666, 673), True,...
""" Collection of Data Science helper functions """ import pandas as pd import numpy as np from sklearn.metrics import confusion_matrix from sklearn.utils.multiclass import unique_labels import seaborn as sns def confusion_plot(y_true, y_pred, cmap='viridis'): """ Plots a confusion matrix using the Seaborn ...
[ "numpy.ones", "seaborn.heatmap", "numpy.zeros", "sklearn.utils.multiclass.unique_labels", "sklearn.metrics.confusion_matrix" ]
[((349, 369), 'sklearn.utils.multiclass.unique_labels', 'unique_labels', (['y_val'], {}), '(y_val)\n', (362, 369), False, 'from sklearn.utils.multiclass import unique_labels\n'), ((629, 679), 'seaborn.heatmap', 'sns.heatmap', (['table'], {'annot': '(True)', 'fmt': '"""d"""', 'cmap': 'cmap'}), "(table, annot=True, fmt='...
''' TODO: Median trimmer ''' import numpy as np def mad(arr,axis=None): mid = np.median(arr,axis=axis) return np.median(abs(arr-mid),axis=axis) def bin_median(x,y,nbin): binsize = (x.max()-x.min()) / (2*nbin) bin_centers = np.linspace(x.min()+binsize,x.max()-binsize,nbin) binned = np.empty(...
[ "numpy.randint", "numpy.mean", "numpy.median", "os.listdir", "numpy.polyfit", "numpy.delete", "matplotlib.pyplot.plot", "os.chdir", "numpy.sum", "numpy.zeros", "numpy.empty", "numpy.polyval", "numpy.isnan", "numpy.std", "astropy.io.fits.open", "numpy.arange", "matplotlib.pyplot.show"...
[((84, 109), 'numpy.median', 'np.median', (['arr'], {'axis': 'axis'}), '(arr, axis=axis)\n', (93, 109), True, 'import numpy as np\n'), ((311, 325), 'numpy.empty', 'np.empty', (['nbin'], {}), '(nbin)\n', (319, 325), True, 'import numpy as np\n'), ((338, 352), 'numpy.empty', 'np.empty', (['nbin'], {}), '(nbin)\n', (346, ...
import numpy as np from matplotlib import pyplot as plt class SMForward: ''' Object for performing soil-moisture phase contribution simulations based on sensitivity of soil dielectric properties to soil moisture ''' mvs: np.array = None de_real = None de_imag = None def __init__(self,...
[ "numpy.radians", "numpy.sqrt", "matplotlib.pyplot.legend", "matplotlib.pyplot.plot", "numpy.zeros", "numpy.cos", "numpy.sin", "numpy.nan_to_num", "matplotlib.pyplot.show" ]
[((955, 1006), 'matplotlib.pyplot.plot', 'plt.plot', (['self.mvs', 'self.de_real'], {'label': '"""Real Part"""'}), "(self.mvs, self.de_real, label='Real Part')\n", (963, 1006), True, 'from matplotlib import pyplot as plt\n'), ((1015, 1071), 'matplotlib.pyplot.plot', 'plt.plot', (['self.mvs', 'self.de_imag'], {'label': ...
import numpy as np from layers import ( FullyConnectedLayer, ReLULayer, ConvolutionalLayer, MaxPoolingLayer, Flattener, softmax_with_cross_entropy, l2_regularization, softmax ) class ConvNet: """ Implements a very simple conv net Input -> Conv[3x3] -> Relu -> Maxpool[4x4] -> Conv[3x3...
[ "layers.FullyConnectedLayer", "layers.ReLULayer", "layers.ConvolutionalLayer", "numpy.argmax", "layers.softmax_with_cross_entropy", "layers.softmax", "layers.Flattener", "layers.MaxPoolingLayer" ]
[((2511, 2545), 'layers.softmax_with_cross_entropy', 'softmax_with_cross_entropy', (['out', 'y'], {}), '(out, y)\n', (2537, 2545), False, 'from layers import FullyConnectedLayer, ReLULayer, ConvolutionalLayer, MaxPoolingLayer, Flattener, softmax_with_cross_entropy, l2_regularization, softmax\n'), ((2804, 2816), 'layers...
# start, prepare data, data ready, finish, FMP FP_DATA = { 'Chart.JS': [ [32.4, 45.1, 297.6, 1042.4, 1054.8], [33.6, 43.4, 285.1, 1041.6, 1064.5], [30.9, 40.9, 292.7, 1036.2, 1056.8], ], 'TimeChart': [ [29.9, 57.2, 255.2, 288.3, 853.2], [36.2, 43.9, 236.9, 271.5, 837....
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.barh", "numpy.array", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.title", "matplotlib.pyplot.legend" ]
[((897, 926), 'matplotlib.pyplot.title', 'plt.title', (['"""First Paint Time"""'], {}), "('First Paint Time')\n", (906, 926), True, 'import matplotlib.pyplot as plt\n'), ((927, 943), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""ms"""'], {}), "('ms')\n", (937, 943), True, 'import matplotlib.pyplot as plt\n'), ((944, ...
#!/usr/local/bin/python3 """ Script to generate a fixture of a chain with N complex links. Usage: python generate_complex_chainmail_fixture.py N """ import json import pathlib import numpy import shapely.geometry import shapely.ops from fixture_utils import * def generate_link_polygons() -> list: """Generate ...
[ "numpy.radians", "numpy.array", "numpy.full", "pathlib.Path" ]
[((2548, 2568), 'numpy.radians', 'numpy.radians', (['angle'], {}), '(angle)\n', (2561, 2568), False, 'import numpy\n'), ((1023, 1072), 'numpy.array', 'numpy.array', (['[width / 2, height - half_thickness]'], {}), '([width / 2, height - half_thickness])\n', (1034, 1072), False, 'import numpy\n'), ((1199, 1232), 'numpy.a...
import torch import networkx as nx import numpy as np import pickle as pkl import scipy.sparse as sp def Graph_load_batch( min_num_nodes=20, max_num_nodes=1000, name="ENZYMES", node_attributes=True, graph_labels=True, ): """ load many graphs, e.g. enzymes load ENZYMES and PROTEIN and DD...
[ "numpy.asmatrix", "networkx.bfs_successors", "numpy.arange", "networkx.grid_2d_graph", "networkx.from_dict_of_lists", "numpy.sort", "numpy.ix_", "networkx.karate_club_graph", "numpy.random.permutation", "networkx.ladder_graph", "numpy.amin", "networkx.adjacency_matrix", "numpy.nonzero", "n...
[((424, 434), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (432, 434), True, 'import networkx as nx\n'), ((3325, 3350), 'numpy.sort', 'np.sort', (['test_idx_reorder'], {}), '(test_idx_reorder)\n', (3332, 3350), True, 'import numpy as np\n'), ((3906, 3934), 'networkx.from_dict_of_lists', 'nx.from_dict_of_lists', (['g...
# -*- coding: utf-8 -*- import hashlib import logging import os import warnings from collections.abc import MutableMapping from pathlib import Path from typing import Callable, Dict, List, Optional, Union import imageio import numpy as np from matplotlib import cm, colors, patches from matplotlib import pyplot as plt ...
[ "logging.getLogger", "eyepy.core.config.SEG_MAPPING.values", "numpy.sqrt", "pathlib.Path.home", "scipy.io.loadmat", "eyepy.core.drusen.DefaultDrusenFinder", "numpy.array", "numpy.moveaxis", "hashlib.sha1", "numpy.save", "numpy.less", "numpy.greater", "pathlib.Path", "numpy.stack", "numpy...
[((581, 608), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (598, 608), False, 'import logging\n'), ((4282, 4296), 'numpy.isnan', 'np.isnan', (['data'], {}), '(data)\n', (4290, 4296), True, 'import numpy as np\n'), ((4502, 4515), 'numpy.copy', 'np.copy', (['data'], {}), '(data)\n', (4509...
import numpy as np import pytest from doddle.words import Dictionary, Word, WordSeries, load_dictionary class TestWords: def test_word_compares_correctly(self) -> None: # Arrange word1 = Word("SNAKE") word2 = Word("SHARK") word3 = Word("snake") word4 = Word(word1) ...
[ "doddle.words.load_dictionary", "doddle.words.Dictionary", "doddle.words.WordSeries", "numpy.array", "doddle.words.Word", "pytest.raises", "numpy.all", "numpy.arange" ]
[((210, 223), 'doddle.words.Word', 'Word', (['"""SNAKE"""'], {}), "('SNAKE')\n", (214, 223), False, 'from doddle.words import Dictionary, Word, WordSeries, load_dictionary\n'), ((240, 253), 'doddle.words.Word', 'Word', (['"""SHARK"""'], {}), "('SHARK')\n", (244, 253), False, 'from doddle.words import Dictionary, Word, ...
import numpy as np from ..optics import OpticalElement, Wavefront class MonochromaticPropagator(OpticalElement): def __init__(self, wavelength): self.wavelength = wavelength def make_propagator(monochromatic_propagator): class Propagator(OpticalElement): def __init__(self, *args, **kwargs): self.wavelengths ...
[ "numpy.abs", "numpy.array" ]
[((662, 701), 'numpy.abs', 'np.abs', (['(wavelength - wavelength_closest)'], {}), '(wavelength - wavelength_closest)\n', (668, 701), True, 'import numpy as np\n'), ((564, 590), 'numpy.array', 'np.array', (['self.wavelengths'], {}), '(self.wavelengths)\n', (572, 590), True, 'import numpy as np\n')]
# Copyright 2021 <NAME> # All rights reserved. import numpy import pyaudio from snyth import Settings from snyth.debug.samples import get_voice_samples def play_voice_sync(audio, voice, realtime=True, seconds=1): frames_per_buffer = Settings.instance().sample_rate//voice.frame_rate stream = audio.open(rate=S...
[ "numpy.array", "snyth.Settings.instance", "numpy.concatenate" ]
[((963, 999), 'numpy.array', 'numpy.array', (['[]'], {'dtype': 'numpy.float32'}), '([], dtype=numpy.float32)\n', (974, 999), False, 'import numpy\n'), ((240, 259), 'snyth.Settings.instance', 'Settings.instance', ([], {}), '()\n', (257, 259), False, 'from snyth import Settings\n'), ((1526, 1572), 'numpy.concatenate', 'n...
# Author : <NAME> # Date : 5/31/19 # License: MIT # Purpose: # # Notes : # # Questions: # # References : # import sys import re import datetime import random import copy import operator import numpy from classes import GTF_ENTRY from classes import FASTQ_READ from classes import CHROMOSOME from classes import GENE...
[ "operator.attrgetter", "re.split", "classes.GENE", "classes.TRANSCRIPT", "error.exit_with_error", "numpy.random.normal", "classes.reverse_complement", "classes.INSERT", "classes.FASTQ_READ", "classes.EXON", "datetime.datetime.now", "copy.deepcopy", "classes.GTF_ENTRY", "classes.CHROMOSOME"...
[((1370, 1393), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1391, 1393), False, 'import datetime\n'), ((2029, 2052), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2050, 2052), False, 'import datetime\n'), ((2666, 2689), 'datetime.datetime.now', 'datetime.datetime.now', ([...
from collections import namedtuple import matplotlib.pyplot as plt import numpy as np import pandas as pd import ray import stats Configuration = namedtuple('Configuration', ['banditCount']) Observation = namedtuple('Observation', ['step', 'reward', 'agentIndex', 'lastActions']) def smoke_test(agent): config =...
[ "stats.get_los", "stats.print_inline_stats", "collections.namedtuple", "numpy.random.rand", "ray.get", "stats.get_wins", "stats.get_mean_and_ci", "numpy.sum", "numpy.zeros", "pandas.DataFrame", "numpy.full", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((149, 193), 'collections.namedtuple', 'namedtuple', (['"""Configuration"""', "['banditCount']"], {}), "('Configuration', ['banditCount'])\n", (159, 193), False, 'from collections import namedtuple\n'), ((208, 282), 'collections.namedtuple', 'namedtuple', (['"""Observation"""', "['step', 'reward', 'agentIndex', 'lastA...
""" Tests the LIME wrapper. """ # Author: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # License: new BSD import pytest try: import lime except ImportError: # pragma: no cover pytest.skip( 'Skipping lime wrapper tests -- lime missing.', allow_module_level=True) else: del lime import impor...
[ "fatf.transparency.lime.Lime", "fatf.utils.testing.transparency.InvalidModel", "numpy.ones", "fatf.utils.testing.imports.module_import_tester", "fatf.utils.models.KNN", "pytest.warns", "numpy.array", "pytest.raises", "importlib.reload", "fatf.utils.testing.transparency.NonProbabilisticModel", "p...
[((1083, 1111), 'numpy.array', 'np.array', (['[0, 1, 0.08, 0.54]'], {}), '([0, 1, 0.08, 0.54])\n', (1091, 1111), True, 'import numpy as np\n'), ((1233, 1242), 'fatf.utils.models.KNN', 'fum.KNN', ([], {}), '()\n', (1240, 1242), True, 'import fatf.utils.models as fum\n'), ((2933, 2972), 'fatf.utils.testing.transparency.N...
import os import sys from datetime import datetime, timedelta import numpy as np quick_hist = False quick_bar = True #quick_bar = False def d4_computation_time_nparray( top='' ): dirs = [ f.name for f in os.scandir( top ) ] #if f.is_file() ] path_l = [] ftimes = [] ctimes = [] # Prepare file p...
[ "numpy.mean", "numpy.copy", "numpy.sqrt", "matplotlib.pyplot.savefig", "matplotlib.pyplot.clf", "os.scandir", "numpy.argmax", "os.path.join", "matplotlib.pyplot.close", "numpy.array", "numpy.zeros", "numpy.nanmean", "numpy.isnan", "os.path.isfile", "matplotlib.pyplot.subplots", "numpy....
[((11344, 11360), 'numpy.array', 'np.array', (['ctimes'], {}), '(ctimes)\n', (11352, 11360), True, 'import numpy as np\n'), ((1623, 1640), 'numpy.array', 'np.array', (['scale_l'], {}), '(scale_l)\n', (1631, 1640), True, 'import numpy as np\n'), ((2255, 2278), 'numpy.zeros', 'np.zeros', (['scale_l.shape'], {}), '(scale_...
# -*- coding: utf-8 -*- import codecs as cs import nltk import numpy as np from utils import sample_token4,LoadGoldEntity from keras.utils import np_utils import pickle SPARSE = 'Sparse_word' PADDING= 'padding' E1_B = 'entity1begin' E1_E = 'entity1end' E2_B = 'entity2begin' E2_E = 'entity2end' #一些用到的字典 small = {'a','...
[ "utils.sample_token4", "nltk.tokenize.word_tokenize", "numpy.array", "numpy.zeros", "utils.LoadGoldEntity", "codecs.open" ]
[((2962, 2990), 'codecs.open', 'cs.open', (['abdir', '"""r"""', '"""utf-8"""'], {}), "(abdir, 'r', 'utf-8')\n", (2969, 2990), True, 'import codecs as cs\n'), ((3139, 3166), 'codecs.open', 'cs.open', (['edir', '"""r"""', '"""utf-8"""'], {}), "(edir, 'r', 'utf-8')\n", (3146, 3166), True, 'import codecs as cs\n'), ((3752,...
import numpy as np import cv2 import glob import matplotlib.pyplot as plt import pickle from pipeline import pipeline from tracker import LineTracker # ## Apply a perspective transform to rectify binary image to create a "birds-eye view" def warper(img, src, dst): # Compute and apply perpective transform img_...
[ "cv2.getPerspectiveTransform", "numpy.absolute", "cv2.putText", "cv2.addWeighted", "cv2.warpPerspective", "numpy.array", "pipeline.pipeline" ]
[((364, 401), 'cv2.getPerspectiveTransform', 'cv2.getPerspectiveTransform', (['src', 'dst'], {}), '(src, dst)\n', (391, 401), False, 'import cv2\n'), ((415, 477), 'cv2.warpPerspective', 'cv2.warpPerspective', (['img', 'M', 'img_size'], {'flags': 'cv2.INTER_NEAREST'}), '(img, M, img_size, flags=cv2.INTER_NEAREST)\n', (4...
# Copyright 2017 reinforce.io. 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.shape", "tensorflow.train.SingularMonitoredSession", "tensorforce.util.shape", "tensorflow.train.Scaffold", "tensorflow.control_dependencies", "tensorforce.core.optimizers.GlobalOptimizer", "copy.deepcopy", "tensorflow.reduce_mean", "tensorflow.scan", "tensorflow.variables_initializer"...
[((22742, 23075), 'tensorflow.train.Saver', 'tf.train.Saver', ([], {'var_list': 'global_variables', 'reshape': '(False)', 'sharded': '(False)', 'max_to_keep': '(5)', 'keep_checkpoint_every_n_hours': '(10000.0)', 'name': 'None', 'restore_sequentially': '(False)', 'saver_def': 'None', 'builder': 'None', 'defer_build': '(...
import os import argparse import numpy as np import tokenization from run_classifier import ColaProcessor, SstProcessor, MrpcProcessor, QqpProcessor, QnliProcessor, MnliProcessor, RteProcessor, SnliProcessor, WnliProcessor from run_classifier import file_based_convert_examples_to_features def grade(basepath): task...
[ "numpy.array", "argparse.ArgumentParser" ]
[((1767, 1778), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (1775, 1778), True, 'import numpy as np\n'), ((1791, 1806), 'numpy.array', 'np.array', (['y_hat'], {}), '(y_hat)\n', (1799, 1806), True, 'import numpy as np\n'), ((1861, 1886), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1884,...
import numpy as np from denoising.utils import * # from denoising.bm3d import BM3D # from denoising.non_local_means import NLM # from denoising.bilateral_filter import bilateral_filter # from denoising.wavelet import wavelet_soft_thresholding, \ # wavelet_hard_thresholding # from denoising.wiener import wiener_fil...
[ "numpy.array" ]
[((1231, 1256), 'numpy.array', 'np.array', (['filtered_images'], {}), '(filtered_images)\n', (1239, 1256), True, 'import numpy as np\n')]
from skimage import data, filters from skimage.color import rgb2gray from matplotlib import pyplot as plt from skimage.transform import rescale, resize, downscale_local_mean from skimage.filters import threshold_otsu, try_all_threshold, threshold_multiotsu import numpy as np from skimage.filters.thresholding import _cr...
[ "skimage.filters.try_all_threshold", "numpy.ptp", "skimage.filters.threshold_otsu", "skimage.data.camera", "skimage.transform.downscale_local_mean", "numpy.max", "skimage.data.cat", "numpy.min", "numpy.argmin", "skimage.filters.thresholding._cross_entropy", "skimage.transform.rescale", "skimag...
[((367, 377), 'skimage.data.cat', 'data.cat', ([], {}), '()\n', (375, 377), False, 'from skimage import data, filters\n'), ((386, 406), 'skimage.filters.sobel', 'filters.sobel', (['image'], {}), '(image)\n', (399, 406), False, 'from skimage import data, filters\n'), ((420, 454), 'matplotlib.pyplot.subplots', 'plt.subpl...
import os import shutil from aidapy.hist import total_systematic_histogram from aidapy.hist import hist2array #from .style_mpl import atlas_mpl_style import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.ticker import AutoMinorLocator, MultipleLocator import matplotl...
[ "os.path.exists", "matplotlib.patches.Rectangle", "numpy.sqrt", "os.makedirs", "matplotlib.font_manager.FontProperties", "aidapy.hist.total_systematic_histogram", "numpy.delete", "numpy.ediff1d", "numpy.max", "numpy.array", "matplotlib.pyplot.figure", "matplotlib.gridspec.GridSpec", "numpy.m...
[((560, 576), 'matplotlib.font_manager.FontProperties', 'FontProperties', ([], {}), '()\n', (574, 576), False, 'from matplotlib.font_manager import FontProperties\n'), ((835, 862), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (845, 862), True, 'import matplotlib.pyplot ...
import unittest import hail as hl import hail.expr.aggregators as agg from subprocess import DEVNULL, call as syscall import numpy as np from struct import unpack import hail.utils as utils from hail.linalg import BlockMatrix from math import sqrt from .utils import resource, doctest_resource, startTestHailContext, st...
[ "hail.utils.range_matrix_table", "hail.float32", "hail.de_novo", "subprocess.call", "hail.utils.uri_path", "hail.export_gen", "hail.realized_relationship_matrix", "hail.locus_interval", "hail.mendel_errors", "hail.case", "hail.is_nan", "numpy.diag", "hail.hwe_normalized_pca", "hail.len", ...
[((3082, 3153), 'hail.identity_by_descent', 'hl.identity_by_descent', (['dataset', "dataset['dummy_maf']"], {'min': '(0.0)', 'max': '(1.0)'}), "(dataset, dataset['dummy_maf'], min=0.0, max=1.0)\n", (3104, 3153), True, 'import hail as hl\n'), ((3364, 3402), 'hail.impute_sex', 'hl.impute_sex', (['ds.GT'], {'include_par':...
import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation, Dropout from keras.layers import LSTM from keras.callbacks import ModelCheckpoint from random import randint from keras.utils import np_utils import sys inp = sys.argv[1] outFile = sys.argv[2] with open(inp) as f: ...
[ "numpy.reshape", "keras.callbacks.ModelCheckpoint", "numpy.log", "numpy.asarray", "numpy.argmax", "keras.models.Sequential", "numpy.exp", "keras.layers.LSTM", "numpy.random.multinomial", "keras.utils.np_utils.to_categorical", "numpy.sum", "keras.layers.Activation", "keras.layers.Dense", "k...
[((753, 792), 'numpy.reshape', 'np.reshape', (['dataX', '(n_patterns, seq, 1)'], {}), '(dataX, (n_patterns, seq, 1))\n', (763, 792), True, 'import numpy as np\n'), ((823, 853), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['dataY'], {}), '(dataY)\n', (846, 853), False, 'from keras.utils import np_...
import logging from multiprocessing.managers import SyncManager from typing import List, Tuple, cast, Union import numpy as np import tensorflow as tf import gpbasics.DataHandling.DataInput as di import gpbasics.KernelBasics.Kernel as k import gpbasics.global_parameters as global_param import gpminference.ChangePoint...
[ "logging.debug", "gpminference.ChangePointDetection.BaseKernelSCPD.WhiteNoiseCPD", "gpbasics.Statistics.GaussianProcess.BlockwiseGaussianProcess", "logging.info", "tensorflow.reduce_min", "gpbasics.KernelBasics.Operators.ChangePointOperator", "gpbasics.global_parameters.ensure_init", "gpbasics.global_...
[((946, 972), 'gpbasics.global_parameters.ensure_init', 'global_param.ensure_init', ([], {}), '()\n', (970, 972), True, 'import gpbasics.global_parameters as global_param\n'), ((4492, 4906), 'gpminference.KernelSearch.ParallelApproach.ParallelKernelSearch', 'pks.ParallelKernelSearch', (['self.strategy_type', 'strategy_...
""" Classification dataset routines. """ __all__ = ['img_normalization'] import numpy as np def img_normalization(img, mean_rgb, std_rgb): """ Normalization as in the ImageNet-1K validation procedure. Parameters ---------- img : np.array i...
[ "numpy.array" ]
[((590, 620), 'numpy.array', 'np.array', (['mean_rgb', 'np.float32'], {}), '(mean_rgb, np.float32)\n', (598, 620), True, 'import numpy as np\n'), ((643, 672), 'numpy.array', 'np.array', (['std_rgb', 'np.float32'], {}), '(std_rgb, np.float32)\n', (651, 672), True, 'import numpy as np\n')]
""" Generic Data Source Class DataSource is the root class for all other podpac defined data sources, including user defined data sources. """ from __future__ import division, unicode_literals, print_function, absolute_import from collections import OrderedDict from copy import deepcopy import warnings import logging...
[ "logging.getLogger", "traitlets.default", "podpac.core.utils.common_doc", "traitlets.Dict", "traitlets.Instance", "traitlets.List", "numpy.isin", "traitlets.Enum", "numpy.array", "traitlets.validate", "podpac.core.coordinates.utils.make_coord_delta_array", "podpac.core.node.COMMON_NODE_DOC.cop...
[((824, 851), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (841, 851), False, 'import logging\n'), ((5883, 5905), 'podpac.core.node.COMMON_NODE_DOC.copy', 'COMMON_NODE_DOC.copy', ([], {}), '()\n', (5903, 5905), False, 'from podpac.core.node import COMMON_NODE_DOC\n'), ((5981, 6008), 'po...
"""High-dimensional output This module concerns the following use-case: we make a parameter study over some input parameters x and the domain code yields an output vector y contains many entries. This is typically the case, when y is function-valued, i.e. depends on an indenpendent variable t, or even "pixel-valued" o...
[ "numpy.linalg.eigh", "numpy.mean", "numpy.empty", "numpy.diag" ]
[((2200, 2218), 'numpy.mean', 'np.mean', (['ytrain', '(0)'], {}), '(ytrain, 0)\n', (2207, 2218), True, 'import numpy as np\n'), ((2272, 2297), 'numpy.linalg.eigh', 'eigh', (['(self.dy @ self.dy.T)'], {}), '(self.dy @ self.dy.T)\n', (2276, 2297), False, 'from numpy.linalg import eigh\n'), ((2641, 2666), 'numpy.empty', '...
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import print_function, division import numpy as np from numpy.testing import assert_allclose, assert_equal import os import tempfile from astropy.io import fits from astropy.tests.helper import pytest from astropy.units import Quantity from...
[ "numpy.ones_like", "numpy.ones", "astropy.tests.helper.pytest.mark.skipif", "numpy.testing.assert_allclose", "scipy.ndimage.convolve", "astropy.coordinates.angles.Angle", "os.removedirs", "tempfile.mkdtemp", "astropy.io.fits.open", "astropy.units.Quantity" ]
[((684, 719), 'astropy.tests.helper.pytest.mark.skipif', 'pytest.mark.skipif', (['"""not HAS_SCIPY"""'], {}), "('not HAS_SCIPY')\n", (702, 719), False, 'from astropy.tests.helper import pytest\n'), ((1531, 1566), 'astropy.tests.helper.pytest.mark.skipif', 'pytest.mark.skipif', (['"""not HAS_SCIPY"""'], {}), "('not HAS_...
import click import json from collections import defaultdict import random import os import boto3 import imageio from PIL import ImageFont, ImageDraw, Image import cv2 import numpy as np from retry.api import retry_call def generate_url(s3, bucket_name, key): return s3.generate_presigned_url( ClientMetho...
[ "cv2.rectangle", "click.argument", "PIL.Image.fromarray", "boto3.client", "os.makedirs", "click.option", "os.path.join", "PIL.ImageFont.truetype", "numpy.ascontiguousarray", "numpy.array", "PIL.ImageDraw.Draw", "os.path.basename", "click.command", "random.randint" ]
[((451, 466), 'click.command', 'click.command', ([], {}), '()\n', (464, 466), False, 'import click\n'), ((468, 494), 'click.argument', 'click.argument', (['"""filename"""'], {}), "('filename')\n", (482, 494), False, 'import click\n'), ((496, 524), 'click.argument', 'click.argument', (['"""output_dir"""'], {}), "('outpu...
from os import listdir from os.path import join import numpy as np from cv2 import resize from imageio import imread def txt_to_array(path): with open(path) as file: return [[float(word.strip()) for word in line.split(' ')] for line in file] def load_pictures(args): basedir = args.datadir downs...
[ "numpy.ceil", "os.listdir", "numpy.asarray", "os.path.join", "numpy.floor", "numpy.diag", "numpy.linalg.norm", "imageio.imread", "cv2.resize", "numpy.arange" ]
[((384, 404), 'os.path.join', 'join', (['basedir', '"""rgb"""'], {}), "(basedir, 'rgb')\n", (388, 404), False, 'from os.path import join\n'), ((421, 442), 'os.path.join', 'join', (['basedir', '"""pose"""'], {}), "(basedir, 'pose')\n", (425, 442), False, 'from os.path import join\n'), ((964, 988), 'numpy.asarray', 'np.a...
import matplotlib #matplotlib.style.use('classic') matplotlib.use('Agg') import matplotlib.pyplot as pl import numpy as np from brian2.units import * import sys, pickle with open('data/plst_net_red_arec0.05_affwd0.10_N4993_T50000ms_stdphom_selfrm.p', 'rb') as pfile: st005_010 = pickle.load(pfile) st005_010...
[ "numpy.histogram", "matplotlib.use", "pickle.load", "matplotlib.rc", "matplotlib.pyplot.subplots" ]
[((52, 73), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (66, 73), False, 'import matplotlib\n'), ((1308, 1342), 'matplotlib.rc', 'matplotlib.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (1321, 1342), False, 'import matplotlib\n'), ((288, 306), 'pickle.load', 'pickle....
import torch from torch import nn, Tensor from torch.nn.utils.rnn import PackedSequence from sklearn import metrics import numpy as np from tqdm import tqdm from typing import Optional from collections import OrderedDict class LSTM_CNN2(nn.Module): def __init__(self, input_dim=390, hidden_dim=8, lstm_layers=1): ...
[ "torch.nn.MaxPool1d", "torch.nn.ReLU", "torch.nn.Dropout", "torch.nn.LSTM", "torch.nn.Flatten", "torch.nn.init.xavier_uniform_", "torch.sigmoid", "numpy.floor", "torch.nn.LayerNorm", "torch.nn.init.zeros_", "torch.nn.functional.dropout", "torch.nn.utils.rnn.PackedSequence", "torch.nn.init.or...
[((2436, 2460), 'torch.nn.Dropout', 'nn.Dropout', (['self.dropout'], {}), '(self.dropout)\n', (2446, 2460), False, 'from torch import nn, Tensor\n'), ((3749, 3775), 'torch.nn.Dropout', 'nn.Dropout', (['self.drop_conv'], {}), '(self.drop_conv)\n', (3759, 3775), False, 'from torch import nn, Tensor\n'), ((3797, 3830), 't...
r""" Piezo-elasticity problem - linear elastic material with piezoelectric effects. Find :math:`\ul{u}`, :math:`\phi` such that: .. math:: - \omega^2 \int_{Y} \rho\ \ul{v} \cdot \ul{u} + \int_{Y} D_{ijkl}\ e_{ij}(\ul{v}) e_{kl}(\ul{u}) - \int_{Y_2} g_{kij}\ e_{ij}(\ul{v}) \nabla_k \phi = 0 \;, \qu...
[ "numpy.tile", "numpy.eye", "numpy.ones", "os.path.dirname", "sfepy.discrete.fem.MeshIO.any_from_filename" ]
[((1055, 1080), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1070, 1080), False, 'import os\n'), ((1086, 1146), 'sfepy.discrete.fem.MeshIO.any_from_filename', 'MeshIO.any_from_filename', (['filename_mesh'], {'prefix_dir': 'conf_dir'}), '(filename_mesh, prefix_dir=conf_dir)\n', (1110, 1146)...
# -*- coding: utf-8 -*- """ Created on Wed Jan 2 16:14:47 2019 @author: <NAME> """ import numpy as np import matplotlib.pyplot as plt from lbl_ir.data_objects.ir_map import sample_info, ir_map def lorentzian(x,x0,gamma=10): return 1/(np.power((x-x0)/gamma,2)+1) def gaussian(x,x0=0,sigma=10): return 1/...
[ "numpy.random.rand", "lbl_ir.data_objects.ir_map.ir_map", "numpy.where", "matplotlib.pyplot.plot", "numpy.linspace", "numpy.random.seed", "numpy.flipud", "numpy.random.multivariate_normal", "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.subplots_adjust", "matplotlib.py...
[((3933, 3966), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'random_state'}), '(seed=random_state)\n', (3947, 3966), True, 'import numpy as np\n'), ((4070, 4120), 'numpy.zeros', 'np.zeros', (['(self.ptsPerCluster * self.Nclusters, 3)'], {}), '((self.ptsPerCluster * self.Nclusters, 3))\n', (4078, 4120), True, '...
import numpy from pymodm import MongoModel, fields, EmbeddedMongoModel from sklearn import metrics from sklearn.metrics import confusion_matrix from newsgac.common.fields import ObjectField from newsgac.common.mixins import CreatedUpdated, DeleteObjectsMixin from newsgac.learners import LearnerSVC from newsgac.learne...
[ "sklearn.metrics.f1_score", "sklearn.metrics.confusion_matrix", "pymodm.fields.DateTimeField", "newsgac.pipelines.get_sk_pipeline.get_sk_pipeline", "newsgac.common.fields.ObjectField", "newsgac.tasks.models.TrackedTask", "sklearn.metrics.precision_score", "pymodm.fields.FloatField", "numpy.array", ...
[((604, 623), 'pymodm.fields.FloatField', 'fields.FloatField', ([], {}), '()\n', (621, 623), False, 'from pymodm import MongoModel, fields, EmbeddedMongoModel\n'), ((643, 662), 'pymodm.fields.FloatField', 'fields.FloatField', ([], {}), '()\n', (660, 662), False, 'from pymodm import MongoModel, fields, EmbeddedMongoMode...
from functools import partial import numpy as np import matplotlib.pyplot as plt from open_spiel.python.project.part_1.dynamics_lenient_boltzmannq import dynamics_lb # True for field plot, False for phase plot PLOT_FLAG = False payoff_stag_hunt = np.array([[[1, 0], [2 / 3, 2 / 3]], [[1, 2 / 3], [0, 2 / 3]]]) # Sta...
[ "numpy.array", "matplotlib.pyplot.figure", "functools.partial", "matplotlib.pyplot.show" ]
[((251, 313), 'numpy.array', 'np.array', (['[[[1, 0], [2 / 3, 2 / 3]], [[1, 2 / 3], [0, 2 / 3]]]'], {}), '([[[1, 0], [2 / 3, 2 / 3]], [[1, 2 / 3], [0, 2 / 3]]])\n', (259, 313), True, 'import numpy as np\n'), ((333, 361), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (3...
import pandas as pd import numpy as np class Maze: def __init__(self,goal=[3,3],trap1=[0,3],trap2=[3,1],position=0): pass ''' def printTable(self,p=None): p = random_position() table = pd.DataFrame(np.zeros((4,4),dtype=int),columns=None) table.iloc[3,3]='X' ...
[ "pandas.DataFrame", "numpy.random.randint", "numpy.zeros" ]
[((783, 807), 'numpy.random.randint', 'np.random.randint', (['(0)', '(16)'], {}), '(0, 16)\n', (800, 807), True, 'import numpy as np\n'), ((1459, 1598), 'pandas.DataFrame', 'pd.DataFrame', (["{'linhas': [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3], 'colunas': [0,\n 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]}"]...
import logging from functools import partial import cv2 import os import json from collections import defaultdict import numpy as np import pandas as pd import torch from tensorboardX import SummaryWriter from torch.utils.data import DataLoader from evaluation.inception import InceptionScore from sg2im.data.dataset_par...
[ "logging.getLogger", "sg2im.utils.log_scalar_dict", "evaluation.inception.InceptionScore", "sg2im.model.get_conv_converse", "sg2im.meta_models.MetaGeneratorModel", "scripts.args.get_args", "numpy.mean", "tensorboardX.SummaryWriter", "torch.mean", "sg2im.data.dataset_params.get_dataset", "scripts...
[((5334, 5373), 'sg2im.data.dataset_params.get_dataset', 'get_dataset', (['args.dataset', '"""test"""', 'args'], {}), "(args.dataset, 'test', args)\n", (5345, 5373), False, 'from sg2im.data.dataset_params import get_dataset, get_collate_fn\n'), ((5419, 5439), 'sg2im.data.dataset_params.get_collate_fn', 'get_collate_fn'...
# -*- coding: utf-8 -*- """ Created on Sat Apr 02 20:35:11 2016 @author: perrytsao """ import numpy as np import matplotlib.pyplot as plt import sys import glob import os plt.close('all') if len(sys.argv)>1: fltname='flight_data\\'+sys.argv[1] else: search_dir = "flight_data\\" # remove anything fro...
[ "matplotlib.pyplot.hold", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "matplotlib.pyplot.close", "matplotlib.pyplot.figure", "glob.glob", "os.path.getmtime", "numpy.load", "matplotlib.pyplot.subplot", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((174, 190), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (183, 190), True, 'import matplotlib.pyplot as plt\n'), ((761, 798), 'numpy.load', 'np.load', (["(fltname + '_controldata.npy')"], {}), "(fltname + '_controldata.npy')\n", (768, 798), True, 'import numpy as np\n'), ((813, 854), 'num...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Nov 7 23:24:19 2019 @author: usuario """ import cv2 import numpy cam = cv2.VideoCapture(0) kernel = numpy.ones((5 ,5), numpy.uint8) while (True): ret, frame = cam.read() rangomax = numpy.array([50, 255, 50]) # B, G, R rangomin = numpy....
[ "numpy.ones", "cv2.inRange", "cv2.imshow", "numpy.array", "cv2.morphologyEx", "cv2.circle", "cv2.VideoCapture", "cv2.waitKey", "cv2.boundingRect" ]
[((142, 161), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (158, 161), False, 'import cv2\n'), ((171, 202), 'numpy.ones', 'numpy.ones', (['(5, 5)', 'numpy.uint8'], {}), '((5, 5), numpy.uint8)\n', (181, 202), False, 'import numpy\n'), ((262, 288), 'numpy.array', 'numpy.array', (['[50, 255, 50]'], {}),...
import typing class ReadStdin: def __call__( self, ) -> bytes: return next(self.__chunks) def __init__( self, ) -> typing.NoReturn: import sys self.__buf = ( sys.stdin.buffer ) self.__chunks = ( self.__read_chunks() ) def int( self, ) -> int: return ...
[ "numpy.argsort", "numpy.zeros", "numpy.vstack", "sys.stdin.read", "numpy.arange" ]
[((3104, 3126), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'int'}), '(n, dtype=int)\n', (3112, 3126), True, 'import numpy as np\n'), ((3318, 3330), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (3327, 3330), True, 'import numpy as np\n'), ((3395, 3414), 'numpy.argsort', 'np.argsort', (['a[:, 0]'], {}), '(a[:, 0]...
import os, sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import unittest import scikit_posthocs._posthocs as sp import seaborn as sb import numpy as np class TestPosthocs(unittest.TestCase): df = sb.load_dataset("exercise") df_bn = np.array([[4,3,4,4,5,6,3], ...
[ "scikit_posthocs._posthocs.posthoc_vanwaerden", "numpy.allclose", "scikit_posthocs._posthocs.posthoc_durbin", "scikit_posthocs._posthocs.posthoc_conover", "seaborn.load_dataset", "scikit_posthocs._posthocs.posthoc_conover_friedman", "numpy.array", "os.path.dirname", "scikit_posthocs._posthocs.postho...
[((241, 268), 'seaborn.load_dataset', 'sb.load_dataset', (['"""exercise"""'], {}), "('exercise')\n", (256, 268), True, 'import seaborn as sb\n'), ((281, 360), 'numpy.array', 'np.array', (['[[4, 3, 4, 4, 5, 6, 3], [1, 2, 3, 5, 6, 7, 7], [1, 2, 6, 4, 1, 5, 1]]'], {}), '([[4, 3, 4, 4, 5, 6, 3], [1, 2, 3, 5, 6, 7, 7], [1, ...
from matplotlib import pyplot, ticker import numpy as np # import seaborn as sns from scipy import stats import yt from grid_figure import GridFigure if __name__ == "__main__": my_fig = GridFigure(3, 1, figsize=(4.5, 7), left_buffer=0.22, right_buffer=0.02, bottom_b...
[ "matplotlib.ticker.NullFormatter", "matplotlib.pyplot.savefig", "numpy.linspace", "yt.load", "grid_figure.GridFigure", "numpy.logspace" ]
[((192, 323), 'grid_figure.GridFigure', 'GridFigure', (['(3)', '(1)'], {'figsize': '(4.5, 7)', 'left_buffer': '(0.22)', 'right_buffer': '(0.02)', 'bottom_buffer': '(0.09)', 'top_buffer': '(0.02)', 'vertical_buffer': '(0)'}), '(3, 1, figsize=(4.5, 7), left_buffer=0.22, right_buffer=0.02,\n bottom_buffer=0.09, top_buf...
# * @Author: abhinav.mazumdar # * @Date: 2020-09-02 23:08:21 # * @Last Modified by:abhinav.mazumdar # * @Last Modified time: 2020-09-02 23:08:49 # This model classifies movie (IMDB Dataset)reviews as positive # or negative ( binary classification) from keras.datasets import imdb from keras import models from ker...
[ "keras.datasets.imdb.load_data", "numba.cuda.select_device", "numpy.asarray", "keras.models.Sequential", "numba.cuda.close", "keras.layers.Dense" ]
[((712, 743), 'keras.datasets.imdb.load_data', 'imdb.load_data', ([], {'num_words': '(10000)'}), '(num_words=10000)\n', (726, 743), False, 'from keras.datasets import imdb\n'), ((2386, 2405), 'keras.models.Sequential', 'models.Sequential', ([], {}), '()\n', (2403, 2405), False, 'from keras import models\n'), ((4203, 42...
import numpy as np from .. import Circuit, DcOp, Resistor, Mos from ..analysis import Contour def cmos_inv(vgs): class CmosInv(Circuit): """ Cmos Inverter """ def define(self): self.create_nodes(1) vdd = self.create_forced_node(name='vdd', v=1.0) g = self.creat...
[ "numpy.linspace" ]
[((811, 835), 'numpy.linspace', 'np.linspace', (['(0)', '(1.0)', '(101)'], {}), '(0, 1.0, 101)\n', (822, 835), True, 'import numpy as np\n')]
import os import time import pickle import random import numpy as np from PIL import Image import torchvision.transforms as transforms from utils import cv_utils from data.dataset import DatasetBase class AusDataset(DatasetBase): def __init__(self, opt, is_for_train): super(AusDataset, self).__init__(opt,...
[ "os.path.exists", "PIL.Image.fromarray", "random.randint", "utils.cv_utils.read_cv2_img", "os.path.join", "pickle.load", "os.path.splitext", "torchvision.transforms.RandomHorizontalFlip", "torchvision.transforms.RandomCrop", "torchvision.transforms.Normalize", "numpy.random.uniform", "torchvis...
[((1264, 1311), 'numpy.random.uniform', 'np.random.uniform', (['(-0.02)', '(0.02)', 'real_cond.shape'], {}), '(-0.02, 0.02, real_cond.shape)\n', (1281, 1311), True, 'import numpy as np\n'), ((2599, 2633), 'torchvision.transforms.Compose', 'transforms.Compose', (['transform_list'], {}), '(transform_list)\n', (2617, 2633...
import matplotlib.pyplot as plt import numpy as np import torch import cv2 import os def find_card(I): # 识别出车牌区域并返回该区域的图像 [y, x, z] = I.shape # y取值范围分析 Blue_y = np.zeros((y, 1)) for i in range(y): for j in range(x): # 蓝色rgb范围 temp = I[i, j, :] if (I[i, j...
[ "matplotlib.pyplot.imshow", "cv2.merge", "numpy.argmax", "matplotlib.pyplot.subplot", "numpy.zeros", "os.mkdir", "cv2.cvtColor", "cv2.resize", "cv2.imread", "matplotlib.pyplot.show" ]
[((179, 195), 'numpy.zeros', 'np.zeros', (['(y, 1)'], {}), '((y, 1))\n', (187, 195), True, 'import numpy as np\n'), ((402, 419), 'numpy.argmax', 'np.argmax', (['Blue_y'], {}), '(Blue_y)\n', (411, 419), True, 'import numpy as np\n'), ((605, 621), 'numpy.zeros', 'np.zeros', (['(1, x)'], {}), '((1, x))\n', (613, 621), Tru...
import numpy from sklearn import preprocessing def linear(intrinsic_process): assert intrinsic_process.shape[0] == 2 observed_process = numpy.empty((3, intrinsic_process.shape[1]), dtype=numpy.float64) observed_process[0] = intrinsic_process[0] observed_process[1] = intrinsic_process[1] observed_p...
[ "numpy.copy", "numpy.mean", "numpy.sqrt", "numpy.power", "numpy.where", "numpy.max", "numpy.angle", "numpy.sum", "numpy.zeros", "numpy.exp", "numpy.empty", "numpy.sign", "numpy.cos", "numpy.min", "numpy.sin", "sklearn.preprocessing.MinMaxScaler", "numpy.arctan" ]
[((146, 211), 'numpy.empty', 'numpy.empty', (['(3, intrinsic_process.shape[1])'], {'dtype': 'numpy.float64'}), '((3, intrinsic_process.shape[1]), dtype=numpy.float64)\n', (157, 211), False, 'import numpy\n'), ((473, 502), 'numpy.copy', 'numpy.copy', (['intrinsic_process'], {}), '(intrinsic_process)\n', (483, 502), Fals...
import sys import numpy as np from timeit import default_timer as timer start = None end = None A = np.asmatrix(sys.argv[1]) A = A.astype(float) I = np.identity(A.shape[0], dtype=float) N = np.concatenate((A, I),axis=1) start = timer() # itera as colunas for c in range(0, A.shape[1] - 1): #procura coluna pivô nã...
[ "numpy.identity", "numpy.copy", "numpy.asmatrix", "timeit.default_timer", "numpy.concatenate" ]
[((102, 126), 'numpy.asmatrix', 'np.asmatrix', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (113, 126), True, 'import numpy as np\n'), ((151, 187), 'numpy.identity', 'np.identity', (['A.shape[0]'], {'dtype': 'float'}), '(A.shape[0], dtype=float)\n', (162, 187), True, 'import numpy as np\n'), ((192, 222), 'numpy.concatenat...
#!/usr/bin/env python # coding: utf-8 # # NumPy # # # In[32]: # NumPy is a library for scientific computations in Python. # Numpy is one of the packages you have to know if you're going to do data science with Python. # It is a Python library that provides support for large, multidimensional arrays along with ma...
[ "numpy.eye", "numpy.ones", "numpy.hstack", "numpy.random.random", "numpy.array", "numpy.zeros", "numpy.linspace", "numpy.vstack", "numpy.concatenate", "numpy.full", "numpy.dtype", "numpy.transpose", "numpy.arange" ]
[((1485, 1504), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (1493, 1504), True, 'import numpy as np\n'), ((1507, 1552), 'numpy.array', 'np.array', (['[(1, 2, 3), (6, 7, 8)]'], {'dtype': 'float'}), '([(1, 2, 3), (6, 7, 8)], dtype=float)\n', (1515, 1552), True, 'import numpy as np\n'), ((1553, 1625),...
""" Created on 2018-10-29 @author: <NAME> <EMAIL> """ import copy import networkx as nx import torch.nn as nn import numpy as np from nord.neural_nets import NeuralDescriptor from nord.neural_nets.layers import Identity, ScaleLayer from nord.utils import get_random_value from .chromosom...
[ "matplotlib.pyplot.show", "numpy.random.choice", "networkx.DiGraph", "networkx.all_simple_paths", "networkx.simple_cycles", "ast.literal_eval", "numpy.argsort", "nord.utils.get_random_value", "matplotlib.pyplot.figure", "copy.deepcopy", "networkx.draw", "nord.neural_nets.NeuralDescriptor" ]
[((1577, 1595), 'nord.utils.get_random_value', 'get_random_value', ([], {}), '()\n', (1593, 1595), False, 'from nord.utils import get_random_value\n'), ((3098, 3117), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (3111, 3117), False, 'import copy\n'), ((4370, 4391), 'ast.literal_eval', 'ast.literal_eval...
# -------------- # Code starts here import numpy as np # Code starts here # Adjacency matrix adj_mat = np.array([[0,0,0,0,0,0,1/3,0], [1/2,0,1/2,1/3,0,0,0,0], [1/2,0,0,0,0,0,0,0], [0,1,0,0,0,0,0,0], [0,0,1/2,1/3,0,0,1/3,0], ...
[ "numpy.ones", "numpy.linalg.eig", "numpy.max", "numpy.array", "numpy.dot", "numpy.linalg.norm" ]
[((106, 397), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0, 1 / 3, 0], [1 / 2, 0, 1 / 2, 1 / 3, 0, 0, 0, 0], [1 / 2,\n 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1 / 2, 1 / 3, 0,\n 0, 1 / 3, 0], [0, 0, 0, 1 / 3, 1 / 3, 0, 0, 1 / 2], [0, 0, 0, 0, 1 / 3,\n 0, 0, 1 / 2], [0, 0, 0, 0, 1 / 3, 1, 1 /...
import numpy as np from ..base import Parameter from .optimizer import BaseOptimizer from benderopt.utils import logb from .random import RandomOptimizer class ParzenEstimator(BaseOptimizer): """ Parzen Estimator This estimator is largely inspired from TPE and hyperopt. https://papers.nips.cc/paper/4443-...
[ "numpy.clip", "benderopt.utils.logb", "numpy.random.choice", "numpy.argsort", "numpy.array", "numpy.concatenate", "numpy.maximum" ]
[((4961, 5010), 'numpy.array', 'np.array', (["parameter.search_space['probabilities']"], {}), "(parameter.search_space['probabilities'])\n", (4969, 5010), True, 'import numpy as np\n'), ((6366, 6390), 'numpy.argsort', 'np.argsort', (['unsorted_mus'], {}), '(unsorted_mus)\n', (6376, 6390), True, 'import numpy as np\n'),...
# Equipe Machine big deep data learning vovozinha science from ple.games.catcher import Catcher from ple import PLE import numpy as np import random exploration_rate = 0.1 gamma = 0.9 alpha = 0.6 class RandomAgent: def __init__(self, actions): self.actions = actions self.q_table = np.empty((301, 301, 3)) #(play...
[ "random.uniform", "random.choice", "random.randrange", "ple.PLE", "numpy.empty", "ple.games.catcher.Catcher" ]
[((2107, 2152), 'ple.games.catcher.Catcher', 'Catcher', ([], {'width': '(256)', 'height': '(256)', 'init_lives': '(10)'}), '(width=256, height=256, init_lives=10)\n', (2114, 2152), False, 'from ple.games.catcher import Catcher\n'), ((2158, 2213), 'ple.PLE', 'PLE', (['game'], {'fps': '(30)', 'display_screen': '(True)', ...
import numpy as np def rgb2yuv(r, g, b, mode="ycbcr"): # 8 bit full scale Y Cb Cr Y = [0.299, 0.587, 0.114] U = [-0.169, -0.331, 0.5] V = [0.5, -0.419, -0.081] yuv = np.asarray([Y, U, V]) if mode == "ycbcr": return yuv.dot(np.asarray([r, g, b])) elif mode == "yuv": return ...
[ "numpy.array", "numpy.asarray" ]
[((188, 209), 'numpy.asarray', 'np.asarray', (['[Y, U, V]'], {}), '([Y, U, V])\n', (198, 209), True, 'import numpy as np\n'), ((527, 548), 'numpy.asarray', 'np.asarray', (['[r, g, b]'], {}), '([r, g, b])\n', (537, 548), True, 'import numpy as np\n'), ((568, 591), 'numpy.asarray', 'np.asarray', (['[[y, u, v]]'], {}), '(...
## writed by <NAME> 2022-05-05 __all__ = ["filter_nan"] import numpy as np def filter_nan(sim, obs): count = len(obs) - np.isnan(obs).sum() s1 = np.empty(count) o1 = np.empty(count) k=0 for i in range(len(obs)): if np.isnan(obs[i]): continue else: o1[k] =...
[ "numpy.empty", "numpy.isnan" ]
[((158, 173), 'numpy.empty', 'np.empty', (['count'], {}), '(count)\n', (166, 173), True, 'import numpy as np\n'), ((183, 198), 'numpy.empty', 'np.empty', (['count'], {}), '(count)\n', (191, 198), True, 'import numpy as np\n'), ((248, 264), 'numpy.isnan', 'np.isnan', (['obs[i]'], {}), '(obs[i])\n', (256, 264), True, 'im...
import numpy as np import nibabel as nib import copy from eisen.transforms.imaging import CreateConstantFlags from eisen.transforms.imaging import RenameFields from eisen.transforms.imaging import FilterFields from eisen.transforms.imaging import ResampleNiftiVolumes from eisen.transforms.imaging import NiftiToNumpy f...
[ "numpy.eye", "eisen.transforms.imaging.ResampleNiftiVolumes", "numpy.random.rand", "eisen.transforms.imaging.NiftiToNumpy", "numpy.ones", "numpy.arange", "eisen.transforms.imaging.NumpyToNifti", "numpy.asanyarray", "numpy.max", "numpy.array_equal", "eisen.transforms.imaging.CropCenteredSubVolume...
[((665, 718), 'eisen.transforms.imaging.CreateConstantFlags', 'CreateConstantFlags', (["['flag1', 'flag2']", '[32.2, 42.0]'], {}), "(['flag1', 'flag2'], [32.2, 42.0])\n", (684, 718), False, 'from eisen.transforms.imaging import CreateConstantFlags\n'), ((744, 814), 'eisen.transforms.imaging.CreateConstantFlags', 'Creat...
""" Based on https://github.com/nshepperd/gpt-2/blob/finetuning/train.py """ import json from pathlib import Path import sys import shutil from typing import List, Tuple import fire import numpy as np import matplotlib.pyplot as plt import sentencepiece as spm import tensorflow as tf import tqdm from . import model, ...
[ "fire.Fire", "matplotlib.pyplot.ylabel", "sentencepiece.SentencePieceProcessor", "tensorflow.nn.sparse_softmax_cross_entropy_with_logits", "sys.exit", "numpy.mean", "pathlib.Path", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "tensorflow.Session", "tensorflow.placeholder", "tensorflow...
[((434, 450), 'fire.Fire', 'fire.Fire', (['train'], {}), '(train)\n', (443, 450), False, 'import fire\n'), ((1235, 1263), 'sentencepiece.SentencePieceProcessor', 'spm.SentencePieceProcessor', ([], {}), '()\n', (1261, 1263), True, 'import sentencepiece as spm\n'), ((1313, 1327), 'pathlib.Path', 'Path', (['run_path'], {}...
#!/usr/bin/env python # coding: utf-8 # # Feature Engineering import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import re import seaborn as sns import statsmodels.api as sm import sys from scipy import stats from scipy.special import boxcox1p, logit from scipy.stats import norm, skew fr...
[ "scipy.special.boxcox1p", "sklearn.preprocessing.PolynomialFeatures", "seaborn.distplot", "matplotlib.pyplot.ylabel", "os.path.join", "scipy.stats.norm.fit", "matplotlib.pyplot.close", "matplotlib.pyplot.figure", "scipy.special.logit", "importlib.reload", "pandas.DataFrame", "matplotlib.pyplot...
[((505, 528), 'importlib.reload', 'importlib.reload', (['utils'], {}), '(utils)\n', (521, 528), False, 'import importlib\n'), ((544, 568), 'importlib.reload', 'importlib.reload', (['params'], {}), '(params)\n', (560, 568), False, 'import importlib\n'), ((651, 696), 'os.path.join', 'os.path.join', (['""".."""', '"""data...
import numpy as np import sys from gaussquad2d import gaussquad1d, gaussquad2d, gaussquad3d from masternodes import masternodes from shap import * sys.path.insert(0, '../util') sys.path.insert(0, '../mesh') def mkmaster(mesh, ndim, pgauss=None): if ndim == 2: if pgauss == None: pgauss = mesh[...
[ "gaussquad2d.gaussquad1d", "sys.path.insert", "numpy.allclose", "numpy.linalg.pinv", "gaussquad2d.gaussquad3d", "gaussquad2d.gaussquad2d", "numpy.squeeze", "import_util.load_mat", "numpy.diag", "numpy.concatenate", "numpy.ravel", "masternodes.masternodes", "numpy.set_printoptions" ]
[((148, 177), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../util"""'], {}), "(0, '../util')\n", (163, 177), False, 'import sys\n'), ((178, 207), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../mesh"""'], {}), "(0, '../mesh')\n", (193, 207), False, 'import sys\n'), ((3940, 4005), 'numpy.set_printoptions', ...
import numpy as np import pandas as pd import random class DataPreHandle: # min-max标准化(线性标准化) @staticmethod def min_max_normalization(X: pd.DataFrame): for n in range(X.shape[1]): X[:, n] = (X[:, n] - np.min(X[:, n])) / (np.max(X[:, n]) - np.min(X[:, n])) return X # z-sco...
[ "numpy.max", "random.randint", "numpy.min" ]
[((2139, 2163), 'random.randint', 'random.randint', (['(0)', '(i - 1)'], {}), '(0, i - 1)\n', (2153, 2163), False, 'import random\n'), ((236, 251), 'numpy.min', 'np.min', (['X[:, n]'], {}), '(X[:, n])\n', (242, 251), True, 'import numpy as np\n'), ((256, 271), 'numpy.max', 'np.max', (['X[:, n]'], {}), '(X[:, n])\n', (2...
# -*- coding: utf-8 -*- """ Created on Wed Dec 14 10:42:00 2016 @author: fbx182 """ import pandas as pd import numpy as np def resample(df, sr=0.1524, fill=None): """ Resamples an input DataFrame to a specified sample rate Empty cells can be filled with the fill argument """ #Calculate the index n...
[ "numpy.digitize", "numpy.random.randint", "pandas.concat" ]
[((1938, 1971), 'numpy.digitize', 'np.digitize', (['df.index', 'otherindex'], {}), '(df.index, otherindex)\n', (1949, 1971), True, 'import numpy as np\n'), ((1002, 1041), 'pandas.concat', 'pd.concat', (['[df_num, df_non_num]'], {'axis': '(1)'}), '([df_num, df_non_num], axis=1)\n', (1011, 1041), True, 'import pandas as ...
from collections import namedtuple import random import numpy as np import torch # very exhaustive but as a result code is very easy to read ;) Transition = namedtuple('Transition', 's a r done') Transitions = namedtuple('Transitions', 's a r done') # functionally the same as Transition NStepTransitions = namedtuple...
[ "torch.tensor", "random.sample", "collections.namedtuple", "numpy.zeros" ]
[((159, 197), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', '"""s a r done"""'], {}), "('Transition', 's a r done')\n", (169, 197), False, 'from collections import namedtuple\n'), ((212, 251), 'collections.namedtuple', 'namedtuple', (['"""Transitions"""', '"""s a r done"""'], {}), "('Transitions', 's a ...
# -*- coding: utf-8 -*- """w11_LogReg_Hierarchy.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1GQGlQibsvHyTPEczCmzK-G7k8kQBHzAO ## Постановка задачи Загрузим данные, приведем их к числовым, заполним пропуски, нормализуем данные и оптимизируем п...
[ "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.make_scorer", "sklearn.metrics.cohen_kappa_score", "sklearn.linear_model.LogisticRegression", "sklearn.preprocessing.StandardScaler", "numpy.iinfo", "numpy.finfo", "pandas.DataFrame" ]
[((1222, 1310), 'pandas.read_csv', 'pd.read_csv', (['"""https://video.ittensive.com/machine-learning/prudential/train.csv.gz"""'], {}), "(\n 'https://video.ittensive.com/machine-learning/prudential/train.csv.gz')\n", (1233, 1310), True, 'import pandas as pd\n'), ((3596, 3626), 'sklearn.preprocessing.StandardScaler',...
import numpy as np from scipy import interpolate from .gps_jax import sample_gp, rbf_kernel class NHGPS(): """ This class is used for data generation from the NH-GPS model. """ def __init__(self, intensity_bound, time_bound, hypers, num_trials=1): """ This method initializes the mode...
[ "scipy.interpolate.InterpolatedUnivariateSpline", "numpy.where", "scipy.interpolate.bisplev", "numpy.equal", "numpy.exp", "numpy.array", "numpy.argwhere", "scipy.interpolate.bisplrep", "numpy.random.uniform" ]
[((3045, 3062), 'numpy.array', 'np.array', (['history'], {}), '(history)\n', (3053, 3062), True, 'import numpy as np\n'), ((4847, 4888), 'numpy.array', 'np.array', (['temporal_gp_interpolated_points'], {}), '(temporal_gp_interpolated_points)\n', (4855, 4888), True, 'import numpy as np\n'), ((4903, 4960), 'numpy.argwher...
# -*- coding: utf-8 -*- """Structures data in ML-friendly ways.""" import re import copy import datetime as dt import random import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from avaml import Error, setenvironment as se, _NONE, CSV_VERSION, REGIONS, merge, REGION_ELEV from avaml...
[ "pandas.read_csv", "avaml.aggregatedata.time_parameters.to_time_parameters", "numpy.char.zfill", "varsomdata.getmisc.get_season_from_date", "numpy.equal", "copy.copy", "avaml.aggregatedata.download._get_weather_obs", "pandas.MultiIndex.from_tuples", "datetime.timedelta", "re.search", "pandas.Ser...
[((12939, 12955), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (12953, 12955), False, 'from sklearn.preprocessing import StandardScaler\n'), ((6420, 6477), 'avaml.aggregatedata.download._get_regobs_obs', '_get_regobs_obs', (['None', 'regobs_types'], {'date': 'date', 'days': 'days'}), '(No...
# -*- coding: utf-8 -*- """Digital filter bandpass zero-phase implementation (filtfilt). Apply a digital filter forward and backward to a signal. """ import numpy as np import matplotlib.pyplot as plt from scipy.signal import butter, filtfilt, sosfiltfilt, freqz from splearn.fourier import fast_fourier_transform def ...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.title", "numpy.sqrt", "matplotlib.pyplot.ylabel", "scipy.signal.filtfilt", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "scipy.signal.butter", "splearn.fourier.fast_fourier_transform", "scipy.signal.freqz", "scipy.signal.sosfiltfilt", "matp...
[((1122, 1154), 'scipy.signal.sosfiltfilt', 'sosfiltfilt', (['sos', 'signal'], {'axis': '(2)'}), '(sos, signal, axis=2)\n', (1133, 1154), False, 'from scipy.signal import butter, filtfilt, sosfiltfilt, freqz\n'), ((2760, 2782), 'scipy.signal.filtfilt', 'filtfilt', (['b', 'a', 'signal'], {}), '(b, a, signal)\n', (2768, ...
from __future__ import print_function, division import numpy as np import matplotlib.pyplot as plt from scipy.integrate import trapz import multiprocessing as mp import h5py def airy_func(wavelength, cos_th, d, F): Q = (2. * F / np.pi)**2 airy = 1.0 / (1.0 + Q * np.sin(np.pi * 2.e6 * d * cos_th / wavelength)**...
[ "numpy.sqrt", "numpy.hstack", "multiprocessing.Process", "h5py.File", "numpy.exp", "numpy.array_split", "numpy.linspace", "numpy.vstack", "numpy.concatenate", "numpy.sin", "multiprocessing.Queue", "numpy.zeros_like", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((613, 662), 'numpy.exp', 'np.exp', (['(-0.5 * (wavelength - w) ** 2 / sigma ** 2)'], {}), '(-0.5 * (wavelength - w) ** 2 / sigma ** 2)\n', (619, 662), True, 'import numpy as np\n'), ((4128, 4154), 'numpy.vstack', 'np.vstack', (['(a[::-1, :], a)'], {}), '((a[::-1, :], a))\n', (4137, 4154), True, 'import numpy as np\n'...
import os os.environ["CUDA_VISIBLE_DEVICES"] = "-1" #remove this line if you've a GPU import numpy as np import argparse import matplotlib.pyplot as plt import cv2 from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Flatten from tensorflow.keras.layers import Conv2D from ...
[ "cv2.ocl.setUseOpenCL", "cv2.rectangle", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Dropout", "numpy.argmax", "cv2.putText", "cv2.waitKey", "tensorflow.keras.layers.Dense", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.cvtColor", "t...
[((497, 509), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (507, 509), False, 'from tensorflow.keras.models import Sequential\n'), ((1178, 1205), 'cv2.ocl.setUseOpenCL', 'cv2.ocl.setUseOpenCL', (['(False)'], {}), '(False)\n', (1198, 1205), False, 'import cv2\n'), ((1418, 1437), 'cv2.VideoCaptur...
import glob import cv2 import numpy as np import math from demo import rot, get_bbox, retrive_bbox3d class rgblDataLoader(): def __init__(self): self.dirPre = ['../ROB599Perception/deploy/trainval/a*/*_image.jpg', '../ROB599Perception/deploy/trainval/b*/*_image.jpg', '../ROB599Perception/de...
[ "numpy.ones_like", "numpy.random.choice", "numpy.where", "numpy.zeros", "glob.glob", "cv2.cvtColor", "numpy.linalg.norm", "cv2.resize", "cv2.GaussianBlur", "numpy.amax", "numpy.divide", "cv2.imread" ]
[((1236, 1289), 'numpy.zeros', 'np.zeros', (['(batch_size, 240, 320, 3)'], {'dtype': 'np.float32'}), '((batch_size, 240, 320, 3), dtype=np.float32)\n', (1244, 1289), True, 'import numpy as np\n'), ((1305, 1356), 'numpy.zeros', 'np.zeros', (['(batch_size, 60, 80, 1)'], {'dtype': 'np.float32'}), '((batch_size, 60, 80, 1)...
#!/usr/bin/python3 -B """ A convenience wrapper for Matplotlib. """ import sys # built-in module import time # built-in module import inspect # built-in module import warnings # built-in module import numpy as np # pip install...
[ "numpy.clip", "inspect.signature", "time.sleep", "numpy.array", "sys.exit", "numpy.sin", "numpy.arange", "matplotlib.get_backend", "matplotlib.pyplot.close", "numpy.linspace", "matplotlib.gridspec.GridSpec", "numpy.ceil", "matplotlib.pyplot.savefig", "numpy.cos", "numpy.nonzero", "matp...
[((10479, 10487), 'matplotlib.pyplot.ion', 'pp.ion', ([], {}), '()\n', (10485, 10487), True, 'import matplotlib.pyplot as pp\n'), ((12186, 12225), 'numpy.linspace', 'np.linspace', (['(-2 * np.pi)', '(2 * np.pi)', '(100)'], {}), '(-2 * np.pi, 2 * np.pi, 100)\n', (12197, 12225), True, 'import numpy as np\n'), ((12375, 12...
import enum import pickle import typing from abc import ABC, abstractmethod from pathlib import Path import h5py import numpy as np from shapely.geometry import MultiPoint from src.utils import hash_file class PoseHashException(Exception): pass class PoseEstimation(ABC): """ abstract base class for Po...
[ "pickle.dump", "pickle.load", "h5py.File", "numpy.zeros", "numpy.arctan2", "src.utils.hash_file", "numpy.arange", "shapely.geometry.MultiPoint" ]
[((1502, 1522), 'src.utils.hash_file', 'hash_file', (['file_path'], {}), '(file_path)\n', (1511, 1522), False, 'from src.utils import hash_file\n'), ((6555, 6613), 'numpy.arctan2', 'np.arctan2', (['base_neck_offset_xy[1]', 'base_neck_offset_xy[0]'], {}), '(base_neck_offset_xy[1], base_neck_offset_xy[0])\n', (6565, 6613...
import os import sys import numpy as np def ADD_err(gt_pose, est_pose, model): def transform_points(points_3d, mat): rot = np.matmul(mat[:3, :3], points_3d.T) return rot.transpose() + mat[:3, 3] v_A = transform_points(model, gt_pose) v_B = transform_points(model, est_pose) v_A = np.arr...
[ "numpy.mean", "numpy.abs", "numpy.sqrt", "numpy.ones", "numpy.array", "numpy.random.randint", "numpy.matmul", "numpy.linalg.norm" ]
[((314, 340), 'numpy.array', 'np.array', (['[x for x in v_A]'], {}), '([x for x in v_A])\n', (322, 340), True, 'import numpy as np\n'), ((351, 377), 'numpy.array', 'np.array', (['[x for x in v_B]'], {}), '([x for x in v_B])\n', (359, 377), True, 'import numpy as np\n'), ((707, 733), 'numpy.array', 'np.array', (['[x for...
from distutils.version import LooseVersion import numpy as np from numpy.testing import assert_allclose, assert_array_equal import pytest import scipy.spatial.distance import tensorflow as tf from .. import losses def test_dice(): x = np.zeros(4) y = np.zeros(4) out = losses.dice(x, y, axis=None).numpy(...
[ "numpy.ones", "numpy.testing.assert_allclose", "numpy.array", "numpy.zeros", "numpy.empty", "distutils.version.LooseVersion" ]
[((243, 254), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (251, 254), True, 'import numpy as np\n'), ((263, 274), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (271, 274), True, 'import numpy as np\n'), ((326, 349), 'numpy.testing.assert_allclose', 'assert_allclose', (['out', '(0)'], {}), '(out, 0)\n', (341...
#!/usr/bin/python # # Copyright 2020 DeepMind Technologies Limited # # 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 a...
[ "numpy.clip", "numpy.abs", "dm_env.specs.Array", "dm_env.TimeStep", "numpy.argsort", "numpy.array", "numpy.linspace", "numpy.zeros", "dm_env.specs.BoundedArray", "numpy.concatenate", "numpy.meshgrid" ]
[((1273, 1333), 'dm_env.specs.Array', 'specs.Array', (['shape'], {'dtype': 'np.int32', 'name': "(base_name + '_spec')"}), "(shape, dtype=np.int32, name=base_name + '_spec')\n", (1284, 1333), False, 'from dm_env import specs\n'), ((1391, 1453), 'dm_env.specs.Array', 'specs.Array', (['shape'], {'dtype': 'np.float32', 'na...
from collections import deque from threading import Thread from time import sleep from typing import Dict import numpy as np from core.data.command import Command from core.device.abstract import Connector from core.device.manager import DeviceManager from core.task.abstract import BaseTask from core.task.manager imp...
[ "numpy.mean", "numpy.median", "collections.deque", "core.task.manager.TaskManager", "core.device.manager.DeviceManager", "time.sleep", "core.utils.observable.Observable", "core.data.command.Command", "threading.Thread" ]
[((725, 740), 'collections.deque', 'deque', ([], {'maxlen': '(2)'}), '(maxlen=2)\n', (730, 740), False, 'from collections import deque\n'), ((922, 934), 'core.utils.observable.Observable', 'Observable', ([], {}), '()\n', (932, 934), False, 'from core.utils.observable import Observable, Observer\n'), ((2053, 2131), 'cor...
""" Code for: Trade-offs in Large Scale Distributed Tuplewise Estimation and Learning Author: <NAME> """ import os import argparse import logging import json import matplotlib.pyplot as plt import numpy as np import make_exps as me DEFAULT_BASE_DIR = "exps" def make_runs(start_run=0, end_run=25, ...
[ "matplotlib.pyplot.savefig", "argparse.ArgumentParser", "make_exps.get_final_graph_legend", "matplotlib.pyplot.style.use", "matplotlib.pyplot.rcParams.update", "matplotlib.pyplot.figure", "make_exps.convert_data_to_pickle", "make_exps.load_all_results_and_plot", "make_exps.make_exps", "numpy.array...
[((1443, 1467), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""default"""'], {}), "('default')\n", (1456, 1467), True, 'import matplotlib.pyplot as plt\n'), ((1472, 1499), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (1478, 1499), True, 'import matplotlib.p...