code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# Official modules
import numpy as np
#from mnist import MNIST
from sklearn.linear_model import RidgeClassifier
# Pelenet modules
from ._abstract import Experiment
from ..network import ReservoirNetwork
"""
@desc: Train output on support neuron activity from assemblies
"""
class AssemblyOutputExperiment(Experiment):
... | [
"numpy.load",
"numpy.sum",
"numpy.ones",
"numpy.where",
"numpy.array",
"numpy.arange",
"sklearn.linear_model.RidgeClassifier",
"numpy.concatenate",
"numpy.sqrt"
] | [((3724, 3740), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (3732, 3740), True, 'import numpy as np\n'), ((3758, 3774), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (3766, 3774), True, 'import numpy as np\n'), ((5231, 5285), 'numpy.concatenate', 'np.concatenate', (['(train0, train1, test0, ... |
import numpy as np
from numba import njit
import scipy.optimize as optim
import torch
from stew.utils import create_diff_matrix
import itertools
@njit
def stew_reg(X, y, D, lam):
return np.linalg.inv(X.T @ X + lam * D) @ X.T @ y
def stew_loss(beta, X, y, D, lam):
residuals = y - X @ beta
l = residuals.T... | [
"torch.nn.MSELoss",
"numpy.minimum",
"numpy.dot",
"numpy.zeros",
"numpy.argmin",
"torch.clamp",
"numpy.linalg.inv",
"torch.pow",
"torch.nn.Linear",
"stew.utils.create_diff_matrix",
"itertools.product",
"torch.no_grad",
"torch.abs",
"torch.tensor",
"torch.from_numpy"
] | [((1195, 1213), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (1211, 1213), False, 'import torch\n'), ((9011, 9048), 'stew.utils.create_diff_matrix', 'create_diff_matrix', (['self.num_features'], {}), '(self.num_features)\n', (9029, 9048), False, 'from stew.utils import create_diff_matrix\n'), ((9726, 9770)... |
from config import model_name
import pandas as pd
import swifter
import json
import math
from tqdm import tqdm
from os import path
from pathlib import Path
import random
from nltk.tokenize import word_tokenize
import numpy as np
import csv
import importlib
from transformers import RobertaTokenizer, RobertaModel
import ... | [
"pandas.DataFrame",
"numpy.save",
"json.loads",
"importlib.import_module",
"transformers.RobertaTokenizer.from_pretrained",
"random.shuffle",
"pandas.merge",
"transformers.RobertaModel.from_pretrained",
"pathlib.Path",
"torch.cuda.is_available",
"pandas.Series",
"pandas.read_table",
"torch.t... | [((783, 893), 'pandas.read_table', 'pd.read_table', (['source'], {'header': 'None', 'names': "['impression_id', 'user', 'time', 'clicked_news', 'impressions']"}), "(source, header=None, names=['impression_id', 'user', 'time',\n 'clicked_news', 'impressions'])\n", (796, 893), True, 'import pandas as pd\n'), ((3280, 3... |
import modules.utils as utils
import numpy as np
import cv2
import scipy
import keras
from modules.logging import logger
import modules.utils as utils
import random
import tensorflow as tf
import keras
from keras import models
from keras import layers
from keras.layers import convolutional
from keras.layers import cor... | [
"modules.utils.show_image",
"numpy.sum",
"cv2.bitwise_and",
"numpy.ones",
"keras.models.Model",
"modules.utils.is_far_from_others",
"numpy.shape",
"modules.utils.crop_image_fill",
"numpy.mean",
"modules.utils.add_sample_to_dataset",
"keras.layers.core.Flatten",
"keras.layers.Input",
"cv2.abs... | [((500, 521), 'numpy.array', 'np.array', (['[0, 0, 160]'], {}), '([0, 0, 160])\n', (508, 521), True, 'import numpy as np\n'), ((535, 558), 'numpy.array', 'np.array', (['[200, 0, 200]'], {}), '([200, 0, 200])\n', (543, 558), True, 'import numpy as np\n'), ((572, 594), 'numpy.array', 'np.array', (['[10, 40, 75]'], {}), '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
IEMOCAP Speech 2D Spectrograms
Quadrant
->data.py
Created on Sat May 9 15:32:48 2020
@author: <NAME>
@email:<EMAIL>
"""
import torch
from torch.utils import data
from torch.utils.data import Dataset
import os
import numpy as np
import pandas as pd
from torch.util... | [
"torch.Tensor",
"torch.is_tensor",
"numpy.float",
"Spectrum.Spectrum_3D_Tensors"
] | [((2026, 2057), 'Spectrum.Spectrum_3D_Tensors', 'Spectrum_3D_Tensors', (['sig', '(16000)'], {}), '(sig, 16000)\n', (2045, 2057), False, 'from Spectrum import Spectrum_3D_Tensors\n'), ((981, 1003), 'torch.is_tensor', 'torch.is_tensor', (['index'], {}), '(index)\n', (996, 1003), False, 'import torch\n'), ((1072, 1103), '... |
import numpy as np
def get_matrix():
A = np.random.random((20, 3))
while np.linalg.matrix_rank(A) < 3:
A = np.random.random((20, 3))
B = np.random.random((3, 5))
while np.linalg.matrix_rank(B) < 3:
B = np.random.random((20, 3))
origin_matrix = np.dot(A, B)
if np.linalg.mat... | [
"numpy.zeros",
"numpy.linalg.svd",
"numpy.random.random",
"numpy.linalg.matrix_rank",
"numpy.random.randint",
"numpy.array",
"numpy.linalg.norm",
"numpy.dot"
] | [((46, 71), 'numpy.random.random', 'np.random.random', (['(20, 3)'], {}), '((20, 3))\n', (62, 71), True, 'import numpy as np\n'), ((159, 183), 'numpy.random.random', 'np.random.random', (['(3, 5)'], {}), '((3, 5))\n', (175, 183), True, 'import numpy as np\n'), ((287, 299), 'numpy.dot', 'np.dot', (['A', 'B'], {}), '(A, ... |
import torch
import torch.nn as nn
import numpy as np
from torch.nn import functional as F
import math
from utils.tools import make_positions
def Embedding(num_embeddings, embedding_dim, padding_idx=None):
m = nn.Embedding(num_embeddings, embedding_dim, padding_idx=padding_idx)
nn.init.normal_(m.weight, mean... | [
"torch.nn.Embedding",
"torch.nn.functional.dropout",
"torch.cos",
"numpy.sin",
"torch.nn.init.constant_",
"torch.arange",
"torch.nn.init.calculate_gain",
"numpy.power",
"torch.nn.Conv1d",
"torch.FloatTensor",
"torch.nn.Linear",
"torch.zeros",
"math.log",
"torch.nn.init.xavier_uniform_",
... | [((217, 285), 'torch.nn.Embedding', 'nn.Embedding', (['num_embeddings', 'embedding_dim'], {'padding_idx': 'padding_idx'}), '(num_embeddings, embedding_dim, padding_idx=padding_idx)\n', (229, 285), True, 'import torch.nn as nn\n'), ((290, 350), 'torch.nn.init.normal_', 'nn.init.normal_', (['m.weight'], {'mean': '(0)', '... |
import os.path
import unittest
import numpy
from openquake.hazardlib import geo, imt
from openquake.hazardlib.shakemap import (
get_shakemap_array, get_sitecol_shakemap, to_gmfs, amplify_ground_shaking,
spatial_correlation_array, spatial_covariance_array,
cross_correlation_matrix, cholesky)
aae = numpy.tes... | [
"openquake.hazardlib.shakemap.cholesky",
"openquake.hazardlib.shakemap.to_gmfs",
"openquake.hazardlib.shakemap.cross_correlation_matrix",
"openquake.hazardlib.shakemap.spatial_correlation_array",
"openquake.hazardlib.imt.from_string",
"numpy.dtype",
"numpy.zeros",
"openquake.hazardlib.geo.geodetic.dis... | [((515, 615), 'numpy.dtype', 'numpy.dtype', (["[('lon', float), ('lat', float), ('val', imt_dt), ('std', imt_dt), ('vs30',\n float)]"], {}), "([('lon', float), ('lat', float), ('val', imt_dt), ('std',\n imt_dt), ('vs30', float)])\n", (526, 615), False, 'import numpy\n'), ((373, 391), 'openquake.hazardlib.imt.from... |
# importing numpy, pandas, and matplotlib
import numpy as np
import pandas as pd
import matplotlib
import multiprocessing
matplotlib.use('agg')
import matplotlib.pyplot as plt
# importing sklearn
from sklearn.model_selection import train_test_split
from sklearn.model_selection import StratifiedKFold
from sklearn.decom... | [
"keras.models.load_model",
"matplotlib.pyplot.title",
"os.remove",
"numpy.random.seed",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"keras.backend.set_value",
"sklearn.metrics.accuracy_score",
"keras.models.Model",
"os.path.isfile",
"sklearn.metric... | [((122, 143), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (136, 143), False, 'import matplotlib\n'), ((1225, 1242), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (1239, 1242), True, 'import numpy as np\n'), ((21201, 21226), 'argparse.ArgumentParser', 'argparse.ArgumentParser',... |
from utils import parse_args, create_experiment_dirs, calculate_flops
from model import MobileNet
from train import Train
from data_loader import DataLoader
from summarizer import Summarizer
import tensorflow as tf
from crop_face import FaceCropper
import cv2
import numpy as np
def main():
# Parse the JSON argumen... | [
"tensorflow.reset_default_graph",
"tensorflow.local_variables_initializer",
"tensorflow.ConfigProto",
"tensorflow.train.latest_checkpoint",
"cv2.rectangle",
"cv2.imshow",
"train.Train",
"utils.create_experiment_dirs",
"crop_face.FaceCropper",
"cv2.cvtColor",
"summarizer.Summarizer",
"data_load... | [((566, 616), 'utils.create_experiment_dirs', 'create_experiment_dirs', (['config_args.experiment_dir'], {}), '(config_args.experiment_dir)\n', (588, 616), False, 'from utils import parse_args, create_experiment_dirs, calculate_flops\n'), ((663, 687), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {})... |
import numpy as np
import open3d as o3d
import networkx as nx
from scipy.spatial.distance import cdist
def crack2graph(pcd, category):
""" Create connected graph for cracks from point cloud. """
# compute all pairwise distances (upper triangle)
points = np.array(pcd.points)
normals = np.array(pcd.norm... | [
"scipy.spatial.distance.cdist",
"numpy.isin",
"numpy.triu",
"networkx.is_connected",
"numpy.power",
"open3d.geometry.PointCloud",
"networkx.relabel_nodes",
"networkx.shortest_path",
"networkx.Graph",
"numpy.array",
"networkx.has_path",
"networkx.cycle_basis"
] | [((268, 288), 'numpy.array', 'np.array', (['pcd.points'], {}), '(pcd.points)\n', (276, 288), True, 'import numpy as np\n'), ((303, 324), 'numpy.array', 'np.array', (['pcd.normals'], {}), '(pcd.normals)\n', (311, 324), True, 'import numpy as np\n'), ((336, 357), 'scipy.spatial.distance.cdist', 'cdist', (['points', 'poin... |
# Taken From http://stackoverflow.com/questions/32551610/overlapping-probability-of-two-normal-distribution-with-scipy
from numpy import roots, log
from scipy.stats import norm
def solve_norm_intersect(m1, m2, std1, std2):
a = 1 / (2 * std1 ** 2) - 1 / (2 * std2 ** 2)
b = m2 / (std2 ** 2) - m1 / (std1 ** 2)
... | [
"scipy.stats.norm.cdf",
"numpy.roots",
"numpy.log"
] | [((412, 428), 'numpy.roots', 'roots', (['[a, b, c]'], {}), '([a, b, c])\n', (417, 428), False, 'from numpy import roots, log\n'), ((598, 619), 'scipy.stats.norm.cdf', 'norm.cdf', (['r', 'm2', 'std2'], {}), '(r, m2, std2)\n', (606, 619), False, 'from scipy.stats import norm\n'), ((384, 400), 'numpy.log', 'log', (['(std2... |
import os
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader, ConcatDataset, Sampler
from deepSM.smutils import SMFile
from deepSM import utils
import deepSM.beat_time_converter as BTC
from deepSM import wavutils
import h5py
from importlib import reload
reload(BTC)
reload(wavutils)
rel... | [
"h5py.File",
"torch.utils.data.ConcatDataset",
"numpy.zeros",
"deepSM.wavutils.pad_wav",
"deepSM.beat_time_converter.BeatTimeConverter",
"deepSM.smutils.SMFile",
"importlib.reload",
"deepSM.wavutils.gen_fft_features",
"numpy.array"
] | [((288, 299), 'importlib.reload', 'reload', (['BTC'], {}), '(BTC)\n', (294, 299), False, 'from importlib import reload\n'), ((300, 316), 'importlib.reload', 'reload', (['wavutils'], {}), '(wavutils)\n', (306, 316), False, 'from importlib import reload\n'), ((317, 330), 'importlib.reload', 'reload', (['utils'], {}), '(u... |
from __future__ import absolute_import
from celeryTasks.celery import app
# The function takes as input:
# 1) src_path: Input image, directory, or npy.
# 2) socketid: The socket id of the connection.
# 3) result_path: The folder path where the result image will be stored.
# It should be full path in case of a sing... | [
"os.path.abspath",
"numpy.load",
"caffe.io.load_image",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"caffe.set_mode_cpu",
"time.time",
"json.dumps",
"os.path.isfile",
"traceback.format_exc",
"redis.StrictRedis",
"celeryTasks.celery.app.task",
"os.path.join",
"operator.itemget... | [((709, 737), 'celeryTasks.celery.app.task', 'app.task', ([], {'ignore_result': '(True)'}), '(ignore_result=True)\n', (717, 737), False, 'from celeryTasks.celery import app\n'), ((931, 983), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': 'config.REDIS_HOST', 'port': '(6379)'}), '(host=config.REDIS_HOST, port=6... |
import os
import cv2
import pathlib
import numpy as np
class image_warper():
def __init__(self, image_path, save_folder="out", windows_size=(1200, 700)):
self.image_path = image_path
self.save_folder = save_folder
self.windows_size = windows_size
self.setup()
def setup(self):... | [
"cv2.warpPerspective",
"cv2.circle",
"os.path.join",
"cv2.waitKey",
"cv2.imwrite",
"cv2.imshow",
"cv2.imread",
"os.path.isfile",
"cv2.setMouseCallback",
"numpy.array",
"os.path.splitext",
"pathlib.Path",
"cv2.resizeWindow",
"cv2.destroyAllWindows",
"cv2.findHomography",
"cv2.getWindowP... | [((407, 459), 'cv2.namedWindow', 'cv2.namedWindow', (['self.window_name', 'cv2.WINDOW_NORMAL'], {}), '(self.window_name, cv2.WINDOW_NORMAL)\n', (422, 459), False, 'import cv2\n'), ((468, 546), 'cv2.resizeWindow', 'cv2.resizeWindow', (['self.window_name', 'self.windows_size[0]', 'self.windows_size[1]'], {}), '(self.wind... |
# -*- coding: utf-8 -*-
import json
import re
import warnings
import numpy as np
from bs4 import BeautifulSoup
from astropy.io import ascii
from astropy.time import Time
from astropy.table import Table, QTable, Column
import astropy.units as u
from astropy.coordinates import EarthLocation, Angle, SkyCoord
from astrop... | [
"astropy.units.Quantity",
"astropy.table.Table",
"astropy.io.ascii.read",
"warnings.simplefilter",
"json.loads",
"astropy.time.Time",
"astropy.table.QTable",
"astropy.time.Time.now",
"numpy.isfinite",
"astropy.table.Column",
"bs4.BeautifulSoup",
"astropy.coordinates.Angle",
"astropy.coordina... | [((25249, 25265), 'astropy.units.Quantity', 'u.Quantity', (['step'], {}), '(step)\n', (25259, 25265), True, 'import astropy.units as u\n'), ((26552, 26578), 'astropy.units.Unit', 'u.Unit', (['proper_motion_unit'], {}), '(proper_motion_unit)\n', (26558, 26578), True, 'import astropy.units as u\n'), ((56084, 56096), 'ast... |
"""
Strategies that try to maximize the posterior mean function.
"""
from argparse import Namespace
import numpy as np
from OCBO.cstrats.cts_opt import ContinuousOpt
from dragonfly.utils.option_handler import get_option_specs
from OCBO.util.misc_util import sample_grid, uniform_draw, knowledge_gradient
pm_args = [\
... | [
"numpy.abs",
"OCBO.util.misc_util.sample_grid",
"numpy.asarray",
"OCBO.util.misc_util.knowledge_gradient",
"numpy.split",
"numpy.hstack",
"numpy.max",
"numpy.min",
"numpy.tile",
"OCBO.util.misc_util.uniform_draw",
"numpy.sqrt",
"numpy.vstack",
"dragonfly.utils.option_handler.get_option_specs... | [((328, 425), 'dragonfly.utils.option_handler.get_option_specs', 'get_option_specs', (['"""judge_act_size"""', '(False)', '(50)', '"""Number of points to use to judge candidates."""'], {}), "('judge_act_size', False, 50,\n 'Number of points to use to judge candidates.')\n", (344, 425), False, 'from dragonfly.utils.o... |
import numpy as np
import pandas as pd
import xarray as xr
import Grid
import pf_dynamic_sph
import os
import sys
from timeit import default_timer as timer
from copy import copy
if __name__ == "__main__":
start = timer()
# ---- INITIALIZE GRIDS ----
higherCutoff = True; cutoffRat = 1.5
betterResolu... | [
"pf_dynamic_sph.quenchDynamics_DataGeneration",
"numpy.ceil",
"timeit.default_timer",
"copy.copy",
"numpy.arange",
"numpy.array",
"numpy.linspace",
"Grid.Grid",
"os.getenv",
"sys.exit",
"numpy.sqrt"
] | [((220, 227), 'timeit.default_timer', 'timer', ([], {}), '()\n', (225, 227), True, 'from timeit import default_timer as timer\n'), ((584, 609), 'Grid.Grid', 'Grid.Grid', (['"""CARTESIAN_3D"""'], {}), "('CARTESIAN_3D')\n", (593, 609), False, 'import Grid\n'), ((889, 926), 'numpy.ceil', 'np.ceil', (['(NGridPoints_desired... |
import os.path
import numpy as np
import matplotlib.pyplot as plt
from .logger import log
from .act_on_image import ActOnImage
from .bpcs_steg import arr_bpcs_complexity, conjugate, max_bpcs_complexity
from .array_message import get_n_message_grids
from .array_grid import get_next_grid_dims
def histogram_of_complexi... | [
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.copy"
] | [((575, 587), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (585, 587), True, 'import matplotlib.pyplot as plt\n'), ((2705, 2734), 'numpy.array', 'np.array', (['self.arr'], {'copy': '(True)'}), '(self.arr, copy=True)\n', (2713, 2734), True, 'import numpy as np\n'), ((3019, 3048), 'numpy.array', 'np.array'... |
from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
__author__ = "bigfatnoob"
import lib
import argparse
import numpy as np
from joblib import Parallel, delayed
import multiprocessing
import pandas as pd
CNT_PROBE_LIMITS = {
1:... | [
"pandas.DataFrame",
"os.path.abspath",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.random.randint",
"joblib.Parallel",
"joblib.delayed",
"multiprocessing.cpu_count"
] | [((85, 105), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (100, 105), False, 'import os\n'), ((477, 502), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (500, 502), False, 'import argparse\n'), ((973, 1000), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {... |
#conding: utf-8
import cv2
import numpy as np
classificador = cv2.CascadeClassifier("haarcascade-frontalface-default.xml")
classificadorOlho = cv2.CascadeClassifier("haarcascade-eye.xml")
camera = cv2.VideoCapture(0)
amostra = 1
numeroAmostra = 25
id = input('Digite seu identificador: ')
largura, altura = 220, 220
pr... | [
"numpy.average",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.CascadeClassifier",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((63, 123), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade-frontalface-default.xml"""'], {}), "('haarcascade-frontalface-default.xml')\n", (84, 123), False, 'import cv2\n'), ((144, 188), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade-eye.xml"""'], {}), "('haarcascade-eye.xml')... |
"""
ttrvna
Author: <NAME>
Institution: University of Missouri Kansas City
Created: 6/20/2019
Edited: 6/27/2019
Python 3.6.0 64-bit (Anaconda 4.3.0)
This file contains the Ttrvna class
which is initialized when someone wants to do an
experiment with the Tektronix TTR506A VNA.
See VNAandPowSup.py if you w... | [
"numpy.fft.ifft",
"csv.writer",
"matplotlib.pyplot.clf",
"time.sleep",
"matplotlib.pyplot.figure",
"visa.ResourceManager",
"matplotlib.pyplot.savefig"
] | [((2778, 2800), 'visa.ResourceManager', 'visa.ResourceManager', ([], {}), '()\n', (2798, 2800), False, 'import visa\n'), ((5718, 5731), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (5728, 5731), False, 'import time\n'), ((10873, 10904), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(20, 10)'})... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the
# Apode Project (https://github.com/mchalela/apode).
# Copyright (c) 2020, <NAME> and <NAME>
# License: MIT
# Full Text: https://github.com/ngrion/apode/blob/master/LICENSE.txt
from apode import ApodeData
from apode import datasets
from apod... | [
"pandas.DataFrame",
"pandas.option_context",
"apode.datasets.make_uniform",
"apode.inequality.InequalityMeasures",
"apode.ApodeData",
"numpy.random.RandomState",
"pytest.raises",
"apode.polarization.PolarizationMeasures",
"apode.concentration.ConcentrationMeasures",
"apode.poverty.PovertyMeasures"... | [((599, 656), 'apode.datasets.make_uniform', 'datasets.make_uniform', ([], {'seed': '(42)', 'size': '(300)', 'mu': '(1)', 'nbin': 'None'}), '(seed=42, size=300, mu=1, nbin=None)\n', (620, 656), False, 'from apode import datasets\n'), ((733, 790), 'apode.datasets.make_uniform', 'datasets.make_uniform', ([], {'seed': '(4... |
import numpy as np
from nltk import wordpunct_tokenize
import nltk
import itertools
import operator
import sklearn
import re, string
import math
SENTENCE_START_TOKEN = "sentence_<PASSWORD>"
SENTENCE_END_TOKEN = "sentence_<PASSWORD>"
UNKNOWN_TOKEN = "<PASSWORD>"
def load_data(loc='./data/'):
trainloc = loc + '20_... | [
"math.log",
"numpy.asarray",
"operator.itemgetter",
"re.fullmatch"
] | [((3283, 3353), 'numpy.asarray', 'np.asarray', (['[[w for w in sentence[:-1]] for sentence in all_sentences]'], {}), '([[w for w in sentence[:-1]] for sentence in all_sentences])\n', (3293, 3353), True, 'import numpy as np\n'), ((3368, 3437), 'numpy.asarray', 'np.asarray', (['[[w for w in sentence[1:]] for sentence in ... |
import numpy as np
import matplotlib.pyplot as plt
plt.xlabel("time")
plt.ylabel("Rms")
plt.yscale("log")
directory = './pyplot/'
colors = ['r', 'g', 'b']
N = ['256', '512', '1024']
for n, col in zip(N, colors):
time, rms = np.loadtxt(directory + 'pde_' + n + '.txt', unpack = True)
plt.plot(time, rms, marker = ... | [
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((55, 73), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""time"""'], {}), "('time')\n", (65, 73), True, 'import matplotlib.pyplot as plt\n'), ((74, 91), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Rms"""'], {}), "('Rms')\n", (84, 91), True, 'import matplotlib.pyplot as plt\n'), ((92, 109), 'matplotlib.pyplot.ysca... |
import numpy as np
import imagezmq
import imutils
import cv2
import time
import threading
# initialize the ImageHub object
imageHub = imagezmq.ImageHub()
thread_imageHub = imagezmq.ImageHub(open_port='tcp://*:5556')
thread_frame = None
def thread_recv():
global rpiName, thread_frame
(rpiName, thread_frame)... | [
"threading.Thread",
"cv2.waitKey",
"imagezmq.ImageHub",
"time.time",
"time.sleep",
"cv2.destroyAllWindows",
"numpy.vstack"
] | [((136, 155), 'imagezmq.ImageHub', 'imagezmq.ImageHub', ([], {}), '()\n', (153, 155), False, 'import imagezmq\n'), ((174, 217), 'imagezmq.ImageHub', 'imagezmq.ImageHub', ([], {'open_port': '"""tcp://*:5556"""'}), "(open_port='tcp://*:5556')\n", (191, 217), False, 'import imagezmq\n'), ((443, 457), 'time.sleep', 'time.s... |
import sys
sys.path.append('../')
sys.path.append('../apex')
import torch
import numpy as np
from nltk.tokenize import word_tokenize
from sklearn.metrics import precision_recall_fscore_support
from tqdm import tqdm
import argparse
from bert_nli import BertNLIModel
from utils.nli_data_reader import NLIDataReader
def... | [
"sys.path.append",
"argparse.ArgumentParser",
"numpy.argmax",
"utils.nli_data_reader.NLIDataReader",
"bert_nli.BertNLIModel",
"torch.no_grad",
"sklearn.metrics.precision_recall_fscore_support"
] | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((34, 60), 'sys.path.append', 'sys.path.append', (['"""../apex"""'], {}), "('../apex')\n", (49, 60), False, 'import sys\n'), ((848, 940), 'sklearn.metrics.precision_recall_fscore_support', 'precision_re... |
import numpy as np
def step_function(x):
return np.array(x > 0, dtype=np.int)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def relu(x):
return np.maximum(0, x)
def cross_entropy_error(y, t):
delta = 1e-7
return -np.sum(t * np.log(y + delta))
def softmax(a):
c = np.max(a)
exp_a = np.ex... | [
"numpy.sum",
"numpy.maximum",
"numpy.log",
"numpy.max",
"numpy.array",
"numpy.exp"
] | [((53, 82), 'numpy.array', 'np.array', (['(x > 0)'], {'dtype': 'np.int'}), '(x > 0, dtype=np.int)\n', (61, 82), True, 'import numpy as np\n'), ((159, 175), 'numpy.maximum', 'np.maximum', (['(0)', 'x'], {}), '(0, x)\n', (169, 175), True, 'import numpy as np\n'), ((293, 302), 'numpy.max', 'np.max', (['a'], {}), '(a)\n', ... |
# !/usr/bin/python
"""Bayesian model-based change detection for input-output sequence data
The Bayesian change-point detection model (BCDM) class implements a recursive
algorithm for partitioning a sequence of real-valued input-output data into
non-overlapping segments. The segment boundaries are chosen under the
ass... | [
"numpy.isnan",
"numpy.shape",
"numpy.arange",
"numpy.exp",
"numpy.linalg.solve",
"numpy.random.randn",
"numpy.ndim",
"numpy.isfinite",
"numpy.transpose",
"numpy.linalg.det",
"numpy.log1p",
"numpy.linalg.cholesky",
"numpy.size",
"numpy.dot",
"numpy.outer",
"numpy.log",
"numpy.isscalar... | [((1442, 1454), 'numpy.shape', 'np.shape', (['mu'], {}), '(mu)\n', (1450, 1454), True, 'import numpy as np\n'), ((3368, 3392), 'numpy.zeros', 'np.zeros', (['[m + n, m + n]'], {}), '([m + n, m + n])\n', (3376, 3392), True, 'import numpy as np\n'), ((3499, 3516), 'numpy.dot', 'np.dot', (['omega', 'mu'], {}), '(omega, mu)... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.figure
from typing import List, Sequence, Dict, Tuple, Union
from biplane_kine.graphing import plot_utils
from .common_graph_utils import make_interactive
from .smoothing_graph_utils import marker_graph_init, marker_graph_add
from .kine_graph_utils im... | [
"numpy.full_like",
"numpy.argmax",
"biplane_kine.graphing.plot_utils.update_ylabel",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.tight_layout"
] | [((4662, 4681), 'matplotlib.pyplot.figure', 'plt.figure', (['fig_num'], {}), '(fig_num)\n', (4672, 4681), True, 'import matplotlib.pyplot as plt\n'), ((5004, 5022), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (5020, 5022), True, 'import matplotlib.pyplot as plt\n'), ((5650, 5669), 'matplotli... |
from numpy import exp, array, random, dot
class NeuralNetworkIA():
def __init__(self):
# self.input = x
# Seed the random number generator, so it generates the same numbers
# every time the program runs.
# random.seed(1)
# We model a single neuron, with 3 input connections... | [
"numpy.random.randint",
"numpy.random.random",
"numpy.array",
"numpy.exp",
"numpy.dot"
] | [((3573, 3587), 'numpy.array', 'array', (['[train]'], {}), '([train])\n', (3578, 3587), False, 'from numpy import exp, array, random, dot\n'), ((2151, 2185), 'numpy.dot', 'dot', (['inputs', 'self.synaptic_weights'], {}), '(inputs, self.synaptic_weights)\n', (2154, 2185), False, 'from numpy import exp, array, random, do... |
import os
import nltk
import spacy
import gensim
import numpy as np
from nltk.stem import WordNetLemmatizer
from nltk.stem.porter import PorterStemmer
from gensim.test.utils import datapath
class TopicModeling:
"""
Topic Modeling Class with a coherence score of 0.52.
As an unsupervised learning approach i... | [
"numpy.random.seed",
"nltk.stem.WordNetLemmatizer",
"gensim.models.LdaMulticore.load",
"os.path.dirname",
"nltk.download",
"spacy.load",
"nltk.stem.porter.PorterStemmer",
"gensim.test.utils.datapath"
] | [((713, 728), 'nltk.stem.porter.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (726, 728), False, 'from nltk.stem.porter import PorterStemmer\n'), ((748, 777), 'spacy.load', 'spacy.load', (['"""pt_core_news_sm"""'], {}), "('pt_core_news_sm')\n", (758, 777), False, 'import spacy\n'), ((1588, 1608), 'numpy.random.see... |
### Adapt from ###
from _util import *
import numpy as np
import tensorflow as tf
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
except RuntimeError as e:
print(e)
import collections
impor... | [
"numpy.random.seed",
"_cartpole.CartPoleEnv",
"numpy.std",
"tensorflow.config.experimental.set_memory_growth",
"numpy.mean",
"numpy.array",
"numpy.squeeze",
"tensorflow.config.experimental.list_physical_devices",
"numpy.atleast_2d"
] | [((89, 140), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (133, 140), True, 'import tensorflow as tf\n'), ((580, 612), '_cartpole.CartPoleEnv', 'cartpole.CartPoleEnv', ([], {'e_max': '(1000)'}), '(e_max=1000)\n', (600, 612), Tr... |
# MIT License
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | [
"fdistance.fl2_distance",
"fdistance.fp_distance_double",
"numpy.empty",
"numpy.zeros",
"fdistance.fmanhattan_distance",
"fdistance.fp_distance_integer",
"numpy.array",
"farad.atomic_arad_l2_distance_all"
] | [((3186, 3212), 'numpy.empty', 'empty', (['(na, nb)'], {'order': '"""F"""'}), "((na, nb), order='F')\n", (3191, 3212), False, 'from numpy import empty\n'), ((3218, 3246), 'fdistance.fmanhattan_distance', 'fmanhattan_distance', (['A', 'B', 'D'], {}), '(A, B, D)\n', (3237, 3246), False, 'from fdistance import fmanhattan_... |
#!/usr/bin/env python3
from numpy import array, append, iinfo, sin, cos, linspace, int16, pi, zeros_like, ones_like, max as npmax
from scipy.io.wavfile import write
from scipy.signal import square, chirp
# import matplotlib.pyplot as plt
max_amplitude = iinfo(int16).max
A5 = 880.
A4 = 440.
A3 = 220.
A2 = 110.
samp... | [
"numpy.append",
"numpy.array",
"numpy.iinfo",
"numpy.linspace"
] | [((357, 411), 'numpy.linspace', 'linspace', (['(0.0)', 'duration_s'], {'num': '(duration_s * samplerate)'}), '(0.0, duration_s, num=duration_s * samplerate)\n', (365, 411), False, 'from numpy import array, append, iinfo, sin, cos, linspace, int16, pi, zeros_like, ones_like, max as npmax\n'), ((257, 269), 'numpy.iinfo',... |
"""Analyze the trained models."""
import sys
import os
import pickle
import warnings
from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import cm
import torch
from torch.utils.tensorboard import SummaryWriter
rootpath = os.path.dirname(os.p... | [
"matplotlib.pyplot.title",
"pickle.dump",
"numpy.abs",
"tools.nicename",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"tools.save_fig",
"numpy.mean",
"tools.get_modeldirs",
"torch.no_grad",
"os.path.join",
"numpy.unique",
"sys.path.append",
"os.path.abspath",
"matplotlib.pyplot... | [((360, 385), 'sys.path.append', 'sys.path.append', (['rootpath'], {}), '(rootpath)\n', (375, 385), False, 'import sys\n'), ((715, 748), 'os.path.join', 'os.path.join', (['rootpath', '"""figures"""'], {}), "(rootpath, 'figures')\n", (727, 748), False, 'import os\n'), ((4097, 4169), 'tools.get_modeldirs', 'tools.get_mod... |
#
# UNIVERSIDADE FEDERAL DE PERNAMBUCO -- UFPE (http://www.ufpe.br)
# CENTRO DE INFORMÁTICA -- CIn (http://www.cin.ufpe.br)
# Av. Jornalista <NAME>, s/n - Cidade Universitária (Campus Recife)
# 50.740-560 - Recife - PE - BRAZIL
#
# Copyright (C) 2018 <NAME> (<EMAIL>)
#
# Created on: 2018-05-26
# @a... | [
"pandas.read_csv",
"numpy.logical_and",
"reader.construct_features"
] | [((2475, 2528), 'pandas.read_csv', 'pd.read_csv', (['"""../test/data/abalone.data"""'], {'header': 'None'}), "('../test/data/abalone.data', header=None)\n", (2486, 2528), True, 'import pandas as pd\n'), ((2671, 2706), 'reader.construct_features', 'construct_features', (['df', '"""rings"""', '(10)'], {}), "(df, 'rings',... |
# Logistic Regression
from matplotlib import use
use('TkAgg')
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
import pandas as pd
from ml import mapFeature, plotData, plotDecisionBoundary
from matplotlib.pyplot import show
from costFunctionReg import costFunctionReg
from gradie... | [
"ml.plotData",
"pandas.DataFrame",
"costFunctionReg.costFunctionReg",
"scipy.optimize.minimize",
"matplotlib.pyplot.show",
"ml.plotDecisionBoundary",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.use",
"predict.predict",
"numpy.loadtxt",
"numpy.linspace",
"numpy.where",
"matplotli... | [((50, 62), 'matplotlib.use', 'use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (53, 62), False, 'from matplotlib import use\n'), ((1045, 1073), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 10)'}), '(figsize=(15, 10))\n', (1055, 1073), True, 'import matplotlib.pyplot as plt\n'), ((1081, 1122), 'numpy.loa... |
import logging
logger = logging.getLogger('SBFC')
from math import floor
import numpy as np
from joblib import Parallel, delayed
from utils.parproc import split_for_parallelism
class SimHashBloomFilter:
def __init__(self, **kwargs):
self.expansion_factor = kwargs['expansion_factor']
self.bloom_f... | [
"sklearn.datasets.load_iris",
"numpy.zeros_like",
"logging.debug",
"numpy.sum",
"logging.basicConfig",
"numpy.invert",
"numpy.unique",
"numpy.zeros",
"numpy.transpose",
"math.floor",
"numpy.min",
"numpy.array",
"numpy.exp",
"numpy.random.normal",
"joblib.Parallel",
"joblib.delayed",
... | [((24, 49), 'logging.getLogger', 'logging.getLogger', (['"""SBFC"""'], {}), "('SBFC')\n", (41, 49), False, 'import logging\n'), ((5590, 5625), 'numpy.zeros_like', 'np.zeros_like', (['projX'], {'dtype': 'np.bool'}), '(projX, dtype=np.bool)\n', (5603, 5625), True, 'import numpy as np\n'), ((5807, 5852), 'numpy.zeros', 'n... |
import numpy as np
from recourse.action_set import _BoundElement as BoundElement
v = np.random.rand(1000)
a = np.sort(v)
lb = np.percentile(v, 40)
# bounds
def test_absolute_bound():
l = -1.0
u = 10.0
b = BoundElement(bound_type = 'absolute', lb = l, ub = u, variable_type=int)
assert b.l... | [
"numpy.random.randn",
"numpy.percentile",
"numpy.sort",
"numpy.min",
"recourse.action_set._BoundElement",
"numpy.max",
"numpy.random.rand"
] | [((89, 109), 'numpy.random.rand', 'np.random.rand', (['(1000)'], {}), '(1000)\n', (103, 109), True, 'import numpy as np\n'), ((115, 125), 'numpy.sort', 'np.sort', (['v'], {}), '(v)\n', (122, 125), True, 'import numpy as np\n'), ((132, 152), 'numpy.percentile', 'np.percentile', (['v', '(40)'], {}), '(v, 40)\n', (145, 15... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 30 00:26:48 2015
@author: willy
"""
import os
import argparse
import numpy as np
import glob
def read_haplotypes(msmc_input):
"""
Returns a tuple (value1, value2, value3)
value1 : The chromossome name
value 2 : a list of tuples, e... | [
"numpy.random.exponential",
"os.path.join",
"argparse.ArgumentParser",
"numpy.trunc"
] | [((4916, 4987), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Add phasing errors to haplotypes"""'}), "(description='Add phasing errors to haplotypes')\n", (4939, 4987), False, 'import argparse\n'), ((3441, 3468), 'numpy.random.exponential', 'np.random.exponential', (['mean'], {}), '(me... |
"""Test for .prep.excel module
"""
# =======
# PRIVATE
# =======
import numpy as np
import pandas as pd
from numpy.testing import assert_equal
from pandas.testing import assert_index_equal, assert_frame_equal
from hidrokit.prep import excel
def test__file_year():
filepath = 'tests/data/excel/2006 HUJAN DISNEY L... | [
"hidrokit.prep.excel._file_single_pivot",
"pandas.testing.assert_frame_equal",
"hidrokit.prep.excel._dataframe_data",
"pandas.read_csv",
"hidrokit.prep.excel._dataframe_table",
"numpy.array",
"numpy.testing.assert_equal",
"hidrokit.prep.excel._file_year",
"pandas.testing.assert_index_equal",
"hidr... | [((340, 366), 'hidrokit.prep.excel._file_year', 'excel._file_year', (['filepath'], {}), '(filepath)\n', (356, 366), False, 'from hidrokit.prep import excel\n'), ((498, 532), 'hidrokit.prep.excel._file_single_pivot', 'excel._file_single_pivot', (['filepath'], {}), '(filepath)\n', (522, 532), False, 'from hidrokit.prep i... |
import pandas as pd
import numpy as np
input_file_path = "datasets/Accelerometer-2011-06-02-17-21-57-liedown_bed-m1.txt"
fields = ['15', '16', '17']
if __name__ == '__main__':
# data = pd.read_csv(input_file_path, skipinitialspace=True, usecols=fields, delim_whitespace=True)
# data.to_csv('uic_dataset.csv', index=F... | [
"numpy.savetxt",
"numpy.loadtxt"
] | [((497, 572), 'numpy.loadtxt', 'np.loadtxt', (['"""datasets/Accelerometer-2011-05-30-10-38-41-liedown_bed-m1.txt"""'], {}), "('datasets/Accelerometer-2011-05-30-10-38-41-liedown_bed-m1.txt')\n", (507, 572), True, 'import numpy as np\n'), ((650, 715), 'numpy.savetxt', 'np.savetxt', (['"""datasets/hmp_dataset1.csv"""', '... |
# coding: utf-8
import numpy as np
import pysptk
from nose.tools import raises
from warnings import warn
from scipy.io import wavfile
from os.path import join, dirname
def test_swipe():
def __test(x, fs, hopsize, otype):
f0 = pysptk.swipe(x, fs, hopsize, otype=otype)
assert np.all(np.isfinite(f... | [
"numpy.random.seed",
"nose.tools.raises",
"os.path.dirname",
"numpy.allclose",
"numpy.isfinite",
"pysptk.rapt",
"numpy.all",
"numpy.random.rand",
"warnings.warn",
"pysptk.swipe",
"pysptk.util.example_audio_file"
] | [((387, 408), 'numpy.random.seed', 'np.random.seed', (['(98765)'], {}), '(98765)\n', (401, 408), True, 'import numpy as np\n'), ((432, 453), 'numpy.random.rand', 'np.random.rand', (['(16000)'], {}), '(16000)\n', (446, 453), True, 'import numpy as np\n'), ((1083, 1104), 'numpy.random.seed', 'np.random.seed', (['(98765)'... |
import sys, os, re, time, platform
import json, csv
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg as LA
import matplotlib
import matplotlib.cm
from mpl_toolkits.mplot3d import Axes3D
DATA_DIR = os.path.join('output', 'cheetah-multi-task', '2021_04_30_parametrized', '2021_04_30_... | [
"os.mkdir",
"csv.reader",
"time.strftime",
"numpy.argsort",
"matplotlib.pyplot.style.use",
"numpy.mean",
"matplotlib.pyplot.figure",
"os.path.join",
"numpy.unique",
"numpy.copy",
"matplotlib.pyplot.close",
"re.findall",
"matplotlib.pyplot.rc",
"scipy.linalg.eigh",
"numpy.cov",
"matplot... | [((236, 364), 'os.path.join', 'os.path.join', (['"""output"""', '"""cheetah-multi-task"""', '"""2021_04_30_parametrized"""', '"""2021_04_30_cheetah_8_task_true_gmm"""', '"""tensorboard"""'], {}), "('output', 'cheetah-multi-task', '2021_04_30_parametrized',\n '2021_04_30_cheetah_8_task_true_gmm', 'tensorboard')\n", (... |
import numpy as np
def get_estimator(scorer_type, save_folder=None):
if scorer_type == 'esim':
# submitted model, glove + fasttext, with attention
from os import path
from athene.rte.deep_models.ESIM_for_ensemble import ESIM
from athene.utils.config import Config
pos_weight... | [
"numpy.asarray",
"os.path.join"
] | [((323, 384), 'numpy.asarray', 'np.asarray', (["Config.esim_hyper_param['pos_weight']", 'np.float32'], {}), "(Config.esim_hyper_param['pos_weight'], np.float32)\n", (333, 384), True, 'import numpy as np\n'), ((1538, 1599), 'numpy.asarray', 'np.asarray', (["Config.esim_hyper_param['pos_weight']", 'np.float32'], {}), "(C... |
# -*- encoding: utf-8 -*-
import codecs
import json
import random
import shutil
from onmt.translate.translator import build_translator
from onmt.utils.parse import ArgumentParser
import os
import datetime
import time
import numpy as np
import kp_evaluate
from onmt.utils import split_corpus
from onmt.utils.logging im... | [
"onmt.opts.translate_opts",
"os.remove",
"onmt.utils.split_corpus",
"random.shuffle",
"os.walk",
"json.dumps",
"kp_evaluate.gather_eval_results",
"numpy.random.randint",
"os.path.join",
"codecs.open",
"onmt.opts.config_opts",
"os.path.exists",
"datetime.datetime.now",
"os.stat",
"time.sl... | [((447, 464), 'os.walk', 'os.walk', (['ckpt_dir'], {}), '(ckpt_dir)\n', (454, 464), False, 'import os\n'), ((697, 741), 'onmt.utils.parse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""run_kp_eval.py"""'}), "(description='run_kp_eval.py')\n", (711, 741), False, 'from onmt.utils.parse import ArgumentParser\... |
import os
import cv2
import json
import time
import numpy as np
from h5_logger import H5Logger
from .config import Config
from .camera import Camera
from .utility import get_user_monitor
from .utility import get_angle_and_body_vector
from .utility import get_max_area_blob
from .blob_finder import BlobFinder
from .homog... | [
"numpy.maximum",
"numpy.ones",
"cv2.fillPoly",
"cv2.absdiff",
"cv2.erode",
"cv2.imshow",
"cv2.line",
"cv2.cvtColor",
"os.path.exists",
"cv2.circle",
"cv2.waitKey",
"cv2.resizeWindow",
"json.load",
"numpy.zeros",
"time.time",
"numpy.array",
"cv2.moveWindow",
"cv2.namedWindow",
"nu... | [((1558, 1592), 'os.path.exists', 'os.path.exists', (["self.files['data']"], {}), "(self.files['data'])\n", (1572, 1592), False, 'import os\n'), ((1954, 1987), 'cv2.namedWindow', 'cv2.namedWindow', (['self.window_name'], {}), '(self.window_name)\n', (1969, 1987), False, 'import cv2\n'), ((1996, 2100), 'cv2.resizeWindow... |
import json
import numpy as np
class SegmentStandardScaler:
def __init__(self, segments=None):
self.feat_mean = np.zeros((1, 1))
self.feat_std = np.ones((1, 1))
self.segments = segments
self._encountered_y_shape = None
def fit(self, y=None, segments=None):
if segment... | [
"json.dump",
"json.load",
"numpy.std",
"numpy.zeros",
"numpy.expand_dims",
"numpy.ones",
"numpy.cumsum",
"numpy.mean",
"numpy.array"
] | [((127, 143), 'numpy.zeros', 'np.zeros', (['(1, 1)'], {}), '((1, 1))\n', (135, 143), True, 'import numpy as np\n'), ((168, 183), 'numpy.ones', 'np.ones', (['(1, 1)'], {}), '((1, 1))\n', (175, 183), True, 'import numpy as np\n'), ((1024, 1056), 'numpy.expand_dims', 'np.expand_dims', (['feat_std'], {'axis': '(0)'}), '(fe... |
from MLlib.models import BernoulliNB
import numpy as np
with open('datasets/bernoulli_naive_bayes_dataset.txt', 'r') as f:
words = [[string.strip('\n')
for string in line.split(',')] for line in f]
for i in range(len(words)):
words[i] = list(map(int, words[i]))
x = np.array([words[i] for i in ra... | [
"MLlib.models.BernoulliNB",
"numpy.where",
"numpy.array"
] | [((350, 369), 'numpy.array', 'np.array', (['words[-1]'], {}), '(words[-1])\n', (358, 369), True, 'import numpy as np\n'), ((378, 428), 'numpy.array', 'np.array', (['[[1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 1]]'], {}), '([[1, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 1]])\n', (386, 428), True, 'import numpy as np\n'), ((459, 480), 'n... |
import os
import uuid
import pandas as pd
import numpy as np
import concurrent.futures as cf
from arize.api import Client
from arize.utils.types import ModelTypes
ITERATIONS = 1
NUM_RECORDS = 2
arize = Client(
organization_key=os.environ.get("ARIZE_ORG_KEY"),
api_key=os.environ.get("ARIZE_API_KEY"),
)
featu... | [
"uuid.uuid4",
"os.environ.get",
"numpy.random.randint",
"numpy.random.random",
"concurrent.futures.as_completed"
] | [((1049, 1071), 'concurrent.futures.as_completed', 'cf.as_completed', (['preds'], {}), '(preds)\n', (1064, 1071), True, 'import concurrent.futures as cf\n'), ((344, 399), 'numpy.random.randint', 'np.random.randint', (['(0)', '(100000000)'], {'size': '(NUM_RECORDS, 12)'}), '(0, 100000000, size=(NUM_RECORDS, 12))\n', (36... |
import math
import torch
import torch.nn as nn
from torch.distributions import Normal
from torch.distributions import VonMises
from torch.distributions import Independent
from torch.distributions import Uniform
from survae.distributions.conditional import ConditionalDistribution
from survae.utils import sum_except_batc... | [
"numpy.full",
"torch.mean",
"numpy.put",
"torch.cat",
"torch.mul",
"torch.cos",
"torch.distributions.VonMises",
"torch.distributions.Normal",
"torch.sin",
"torch.tensor"
] | [((533, 559), 'torch.tensor', 'torch.tensor', (['[[0.0, 0.0]]'], {}), '([[0.0, 0.0]])\n', (545, 559), False, 'import torch\n'), ((1367, 1391), 'torch.cat', 'torch.cat', (['(x, y)'], {'dim': '(1)'}), '((x, y), dim=1)\n', (1376, 1391), False, 'import torch\n'), ((1408, 1439), 'torch.distributions.Normal', 'Normal', ([], ... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import sys
import os
import os.path as osp
import glob
import re
import warnings
from torchreid.data.datasets import ImageDataset
from torchreid.utils import read_image
import cv2
import numpy as np
class Oc... | [
"numpy.abs",
"os.path.join",
"torchreid.utils.read_image",
"cv2.imread",
"os.path.expanduser"
] | [((506, 543), 'os.path.join', 'osp.join', (['self.root', 'self.dataset_dir'], {}), '(self.root, self.dataset_dir)\n', (514, 543), True, 'import os.path as osp\n'), ((731, 780), 'os.path.join', 'osp.join', (['self.dataset_dir', '"""Occluded_REID/train"""'], {}), "(self.dataset_dir, 'Occluded_REID/train')\n", (739, 780),... |
import numpy as np
import tensorly as tl
import tensorflow as tf
from tensorflow.keras import models
import torch
def output_channel_decomposition_conv_layer(
layers,
rank=None,
):
tl.set_backend("tensorflow")
layer = layers[0]
weights = np.asarray(layer.get_weights()[0])
bias... | [
"tensorflow.keras.layers.Conv2D",
"torch.svd",
"torch.sqrt",
"numpy.asarray",
"numpy.transpose",
"tensorly.set_backend",
"tensorly.tensor",
"numpy.diag",
"torch.tensor"
] | [((211, 239), 'tensorly.set_backend', 'tl.set_backend', (['"""tensorflow"""'], {}), "('tensorflow')\n", (225, 239), True, 'import tensorly as tl\n'), ((391, 409), 'tensorly.tensor', 'tl.tensor', (['weights'], {}), '(weights)\n', (400, 409), True, 'import tensorly as tl\n'), ((596, 618), 'numpy.asarray', 'np.asarray', (... |
""" Main sims module to read and parse Cameca (nano)SIMS data files. """
import bz2
import collections
import copy
import datetime
import gzip
import io
import lzma
import numpy as np
import os
import re
import tarfile
import warnings
import xarray
from struct import unpack
# py7zlib is needed for 7z
try:
import ... | [
"sims.transparent.TransparentOpen.__init__",
"numpy.pad",
"copy.deepcopy",
"io.BytesIO",
"sims.utils.format_species",
"numpy.fromfile",
"struct.unpack",
"numpy.dtype",
"re.match",
"os.path.exists",
"datetime.datetime",
"numpy.loadtxt",
"os.path.splitext",
"collections.OrderedDict",
"warn... | [((3070, 3099), 'struct.unpack', 'unpack', (["(self._bo + '3i')", 'snip'], {}), "(self._bo + '3i', snip)\n", (3076, 3099), False, 'from struct import unpack\n'), ((4679, 4694), 'io.BytesIO', 'io.BytesIO', (['hdr'], {}), '(hdr)\n', (4689, 4694), False, 'import io\n'), ((17035, 17054), 'copy.deepcopy', 'copy.deepcopy', (... |
"""
File: xAndes.py
Author: <NAME>
Description: Run dadi 5x on fs from GBS data.
Usage: python xAndes_GBS.py
"""
import os, sys
import numpy
from numpy import array
import dadi
import matplotlib
import matplotlib.pyplot as plt
import demographic_models
for i in range(5):
dir = ("/scratch/mgharvey/SysBio/d... | [
"dadi.Inference.optimal_sfs_scaling",
"dadi.Inference.ll_multinom",
"dadi.Numerics.make_extrap_log_func",
"numpy.array",
"dadi.Misc.perturb_params",
"dadi.Spectrum.from_file",
"os.chdir"
] | [((331, 344), 'os.chdir', 'os.chdir', (['dir'], {}), '(dir)\n', (339, 344), False, 'import os, sys\n'), ((422, 455), 'dadi.Spectrum.from_file', 'dadi.Spectrum.from_file', (['"""GBS.fs"""'], {}), "('GBS.fs')\n", (445, 455), False, 'import dadi\n'), ((552, 580), 'numpy.array', 'array', (['[1, 1, 1, 1, 1, 1, 1]'], {}), '(... |
'''
Data handler that relies on INI logs and `fusi.io`.
<NAME> (Jan, 2019)
'''
import os
import pathlib
from glob import glob
from pprint import pprint
from collections import OrderedDict
import numpy as np
from fusilib import misc, utils as futils
from fusilib.io import righw, spikeglx, phy, logs, sync
from fusilib... | [
"fusilib.handler.matlab_data",
"numpy.sum",
"fusilib.misc.DotDict",
"numpy.allclose",
"fusilib.misc.date_tuple2isoformat",
"fusilib.align.fusiarr2nii",
"fusilib.align.allenccf_main_areas",
"fusilib.io.sync.remove_single_datapoint_onsets",
"numpy.clip",
"numpy.isnan",
"pathlib.Path",
"fusilib.m... | [((490, 535), 'fusilib.extras.readers.hdf_load', 'readers.hdf_load', (['local_path', '*args'], {}), '(local_path, *args, **kwargs)\n', (506, 535), False, 'from fusilib.extras import readers\n'), ((972, 991), 'pathlib.Path', 'pathlib.Path', (['outfl'], {}), '(outfl)\n', (984, 991), False, 'import pathlib\n'), ((2938, 29... |
# coding: utf-8
# # simplified Confident Learning Tutorial
# *Author: <NAME>, <EMAIL>*
#
# In this tutorial, we show how to implement confident learning without using cleanlab (for the most part).
# This tutorial is to confident learning what this tutorial https://pytorch.org/tutorials/beginner/examples_tensor/two_... | [
"numpy.stack",
"sklearn.datasets.load_digits",
"numpy.partition",
"cleanlab.util.print_joint_matrix",
"numpy.random.seed",
"warnings.simplefilter",
"numpy.argmax",
"cleanlab.pruning.keep_at_least_n_per_class",
"numpy.asarray",
"numpy.zeros",
"numpy.all",
"numpy.argsort",
"sklearn.linear_mode... | [((1920, 1951), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (1941, 1951), False, 'import warnings\n'), ((1952, 1971), 'numpy.random.seed', 'np.random.seed', (['(477)'], {}), '(477)\n', (1966, 1971), True, 'import numpy as np\n'), ((2341, 2352), 'numpy.array', 'np.array', ([... |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 20 11:54:56 2021
@author: dof
"""
import math
from colorspacious import cspace_convert
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
from scipy.ndimage import filters
from scipy.signal import savgol_filter
'''
J = lig... | [
"numpy.clip",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.sin",
"matplotlib.colors.ListedColormap",
"numpy.zeros_like",
"numpy.copy",
"matplotlib.pyplot.imshow",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"math.ceil",
"numpy.asarray",
"... | [((1024, 1051), 'numpy.linspace', 'np.linspace', (['(0.1)', '(99)', 'J_RES'], {}), '(0.1, 99, J_RES)\n', (1035, 1051), True, 'import numpy as np\n'), ((1062, 1087), 'numpy.linspace', 'np.linspace', (['(0)', '(50)', 'C_RES'], {}), '(0, 50, C_RES)\n', (1073, 1087), True, 'import numpy as np\n'), ((1213, 1240), 'numpy.zer... |
from exptools2.core import Session
import numpy as np
import pandas as pd
from psychopy import tools, logging
import scipy.stats as ss
from stimuli import FixationCross, MotorStim, MotorMovie
from trial import MotorTrial, InstructionTrial, DummyWaiterTrial, OutroTrial
import os
opj = os.path.join
opd = os.path.dirname
... | [
"trial.OutroTrial",
"stimuli.MotorStim",
"stimuli.MotorMovie",
"numpy.random.exponential",
"stimuli.FixationCross",
"numpy.ones",
"numpy.zeros",
"numpy.random.rand",
"numpy.random.shuffle",
"trial.InstructionTrial"
] | [((2510, 2600), 'stimuli.FixationCross', 'FixationCross', ([], {'win': 'self.win', 'lineWidth': 'self.fixation_width', 'color': 'self.fixation_color'}), '(win=self.win, lineWidth=self.fixation_width, color=self.\n fixation_color)\n', (2523, 2600), False, 'from stimuli import FixationCross, MotorStim, MotorMovie\n'),... |
import csv
from random import sample
from math import sqrt
from numpy import zeros, linspace, zeros_like
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn.metrics import confusion_matrix
from scipy.stats import mode
def assign_closest_centroid(data, centroids):
clusters = []
count = 0
fo... | [
"numpy.zeros_like",
"csv.reader",
"math.sqrt",
"random.sample",
"sklearn.metrics.cluster.adjusted_rand_score",
"sklearn.metrics.confusion_matrix"
] | [((3405, 3426), 'numpy.zeros_like', 'zeros_like', (['predicted'], {}), '(predicted)\n', (3415, 3426), False, 'from numpy import zeros, linspace, zeros_like\n'), ((2580, 2587), 'math.sqrt', 'sqrt', (['d'], {}), '(d)\n', (2584, 2587), False, 'from math import sqrt\n'), ((3765, 3798), 'sklearn.metrics.confusion_matrix', '... |
# -*- coding:utf-8 -*-
# @project: GPT2-NewsTitle
# @filename: train.py
# @author: 刘聪NLP
# @contact: <EMAIL>
# @time: 2020/12/16 16:28
"""
文件说明:
通过新闻正文生成新闻标题的GPT2模型的训练文件
"""
import torch
import os
import random
import numpy as np
import argparse
import logging
from transformers.modeling_gpt2 import GPT2Config
... | [
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.utils.data.RandomSampler",
"data_set.GPT2NewsTitleDataSet",
"torch.no_grad",
"torch.utils.data.DataLoader",
"os.path.exists",
"torch.utils.data.SequentialSampler",
"random.seed",
"tqdm.tqdm",
"torch.manual_seed",
"transformer... | [((741, 884), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=l... |
import importlib
import copy
import io, time
from io import BytesIO
import chardet
import os
import collections
from itertools import combinations, cycle, product
import math
import numpy as np
import pandas as pd
import pickle
import tarfile
import random
import re
import requests
from nltk.corpus import stopwords
fro... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.abs",
"torch.eye",
"sklearn.feature_extraction.text.TfidfVectorizer",
"pandas.read_csv",
"torch.cat",
"numpy.argsort",
"sys.stdout.flush",
"pandas.set_option",
"pandas.DataFrame",
"torch.ones",
"torch.nn.MSELoss",
"torch.nn.BCELoss",
... | [((638, 680), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (651, 680), True, 'import pandas as pd\n'), ((683, 722), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(1000)'], {}), "('display.max_rows', 1000)\n", (696, 722), True,... |
# -*- coding: utf-8 -*-
"""
"""
import tensorflow as tf
import numpy as np
import tflearn
from ddpg.ddpg import build_summaries, ActorNetwork, CriticNetwork, OrnsteinUhlenbeckActionNoise, ReplayBuffer, \
getReward
from src.BallTracker import ballTracker
from src.Pepper import Pepper
from src.Pepper.Pepper import... | [
"src.Pepper.Pepper.init",
"src.BallTracker.ballTracker.BallTrackerThread",
"tensorflow.train.Saver",
"tensorflow.global_variables_initializer",
"src.Pepper.Pepper.move",
"src.Pepper.Pepper.readAngle",
"tensorflow.Session",
"numpy.zeros",
"numpy.amax",
"tensorflow.summary.FileWriter",
"src.Pepper... | [((586, 603), 'ddpg.ddpg.build_summaries', 'build_summaries', ([], {}), '()\n', (601, 603), False, 'from ddpg.ddpg import build_summaries, ActorNetwork, CriticNetwork, OrnsteinUhlenbeckActionNoise, ReplayBuffer, getReward\n'), ((823, 877), 'tensorflow.summary.FileWriter', 'tf.summary.FileWriter', (["args['summary_dir']... |
# Author: <NAME>
# Created: 2021-019-01
# Copyright (C) 2018, <NAME>
# License: MIT
import moderngl
import numpy as np
from PIL import Image
from generativepy.color import Color
def make_3dimage(outfile, draw, width, height, background=Color(0), channels=3):
'''
Create a PNG file using moderngl
:param o... | [
"PIL.Image.fromarray",
"numpy.frombuffer",
"generativepy.color.Color",
"moderngl.create_standalone_context"
] | [((240, 248), 'generativepy.color.Color', 'Color', (['(0)'], {}), '(0)\n', (245, 248), False, 'from generativepy.color import Color\n'), ((726, 748), 'PIL.Image.fromarray', 'Image.fromarray', (['frame'], {}), '(frame)\n', (741, 748), False, 'from PIL import Image\n'), ((838, 846), 'generativepy.color.Color', 'Color', (... |
#!/usr/bin/env python
import argparse
import numpy as np
import mdtraj as md
from LLC_Membranes.llclib import physical, topology, transform, file_rw
import sys
import tqdm
from scipy.sparse import lil_matrix
import pickle
import matplotlib.pyplot as plt
def initialize():
parser = argparse.ArgumentParser(descrip... | [
"argparse.ArgumentParser",
"LLC_Membranes.llclib.file_rw.save_object",
"mdtraj.load",
"scipy.sparse.lil_matrix",
"numpy.random.randint",
"numpy.linalg.norm",
"matplotlib.pyplot.tight_layout",
"LLC_Membranes.llclib.topology.map_atoms",
"LLC_Membranes.llclib.topology.Residue",
"matplotlib.pyplot.sho... | [((289, 357), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Calculate coordination number"""'}), "(description='Calculate coordination number')\n", (312, 357), False, 'import argparse\n'), ((4920, 4943), 'LLC_Membranes.llclib.topology.fix_names', 'topology.fix_names', (['gro'], {}), '(g... |
"""
Utilities for labelling 3D objects from a mask
"""
import os
import xarray as xr
import numpy as np
import cloud_identification
OUT_FILENAME_FORMAT = "{base_name}.objects.{objects_name}.nc"
def make_objects_name(mask_name, splitting_var):
return "{mask_name}.split_on.{splitting_var}".format(**locals())
d... | [
"numpy.zeros_like",
"argparse.ArgumentParser",
"os.path.exists",
"cloud_identification.number_objects",
"xarray.DataArray",
"cloud_identification.remove_intersecting",
"xarray.open_dataarray",
"numpy.all"
] | [((1185, 1263), 'cloud_identification.number_objects', 'cloud_identification.number_objects', (['splitting_scalar.values'], {'mask': 'mask.values'}), '(splitting_scalar.values, mask=mask.values)\n', (1220, 1263), False, 'import cloud_identification\n'), ((1607, 1702), 'xarray.DataArray', 'xr.DataArray', ([], {'data': '... |
import numpy as np
import pytest
import unittest
from desc.equilibrium import Equilibrium, EquilibriaFamily
from desc.profiles import PowerSeriesProfile, SplineProfile
from desc.geometry import (
FourierRZCurve,
FourierRZToroidalSurface,
ZernikeRZToroidalSection,
)
class TestConstructor(unittest.TestCase)... | [
"desc.geometry.FourierRZToroidalSurface",
"desc.equilibrium.Equilibrium",
"desc.profiles.SplineProfile",
"numpy.array",
"numpy.random.random",
"pytest.raises",
"desc.geometry.ZernikeRZToroidalSection",
"numpy.testing.assert_allclose",
"desc.equilibrium.EquilibriaFamily.load",
"desc.geometry.Fourie... | [((365, 378), 'desc.equilibrium.Equilibrium', 'Equilibrium', ([], {}), '()\n', (376, 378), False, 'from desc.equilibrium import Equilibrium, EquilibriaFamily\n'), ((751, 790), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['eq.p_l', '[0]'], {}), '(eq.p_l, [0])\n', (777, 790), True, 'import numpy as np... |
from sklearn.datasets import make_moons
import sys
sys.path.append('./Data_Process')
path_result = "./Latent_representation/"
from Models import *
from Metrics import *
import scipy.io as scio
from Data_Process import *
from sklearn.cluster import KMeans
import numpy as np
import torch
import time
import ... | [
"sys.path.append",
"torch.nn.MSELoss",
"numpy.int_",
"torch.nn.BCELoss",
"warnings.filterwarnings",
"numpy.argmax",
"numpy.std",
"numpy.float",
"time.time",
"numpy.max",
"torch.Tensor",
"numpy.array",
"numpy.mean"
] | [((53, 86), 'sys.path.append', 'sys.path.append', (['"""./Data_Process"""'], {}), "('./Data_Process')\n", (68, 86), False, 'import sys\n'), ((330, 363), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (353, 363), False, 'import warnings\n'), ((2885, 2921), 'torch.nn.MSELoss... |
import random
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers import Dense, Activation,Dropout
from keras.optimizers import Adam
from keras import backend as K
import matplotlib.pyplot as plt
import pygame
import random
#setup/initialize the environment... | [
"numpy.argmax",
"random.sample",
"pygame.event.get",
"pygame.display.update",
"collections.deque",
"pygame.font.SysFont",
"pygame.display.set_mode",
"numpy.reshape",
"pygame.display.set_caption",
"pygame.quit",
"pygame.draw.rect",
"keras.optimizers.Adam",
"pygame.init",
"pygame.time.Clock"... | [((470, 489), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (487, 489), False, 'import pygame\n'), ((2788, 2801), 'pygame.init', 'pygame.init', ([], {}), '()\n', (2799, 2801), False, 'import pygame\n'), ((2812, 2848), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""Arial.ttf"""', '(30)'], {}), "('Aria... |
"""
desi_specs.py
Author: <NAME>
References:
- https://github.com/desihub/desitarget/blob/master/py/desitarget/sv3/data/sv3_targetmask.yaml
- https://desidatamodel.readthedocs.io/en/latest/DESI_SPECTRO_REDUX/SPECPROD/tiles/TILEID/NIGHT/coadd-SPECTRO-TILEID-NIGHT.html
"""
import os
import numpy as np
from astropy.io i... | [
"astropy.io.fits.PrimaryHDU",
"os.path.join",
"astropy.io.fits.ImageHDU",
"astropy.io.fits.BinTableHDU",
"numpy.log10",
"astropy.table.unique",
"os.path.basename",
"easyquery.Query",
"numpy.log2",
"numpy.asarray",
"astropy.table.join",
"easyquery.QueryMaker.equals",
"astropy.io.fits.open",
... | [((4192, 4229), 'easyquery.Query', 'Query', (['"""(OBSCONDITIONS >> 9) % 2 > 0"""'], {}), "('(OBSCONDITIONS >> 9) % 2 > 0')\n", (4197, 4229), False, 'from easyquery import Query, QueryMaker\n'), ((4246, 4273), 'easyquery.Query', 'Query', (['"""SV3_BGS_TARGET > 0"""'], {}), "('SV3_BGS_TARGET > 0')\n", (4251, 4273), Fals... |
import logging
import typing
import numpy
import torch
import torch.nn as nn
import torch.nn.functional as functional
LOGGER = logging.getLogger(__name__)
class ModelAverage(nn.Module):
"""
This class works by averaging the outputs of existing models. The models are expected to have linear outputs (i.e.,
... | [
"torch.mean",
"logging.basicConfig",
"torch.nn.ModuleList",
"torch.randn",
"torch.nn.Linear",
"torch.unsqueeze",
"numpy.nextafter",
"torch.tensor",
"torch.abs",
"logging.getLogger"
] | [((131, 158), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (148, 158), False, 'import logging\n'), ((2078, 2095), 'torch.randn', 'torch.randn', (['(2)', '(3)'], {}), '(2, 3)\n', (2089, 2095), False, 'import torch\n'), ((2412, 2452), 'logging.basicConfig', 'logging.basicConfig', ([], {'l... |
import numpy as np
def softmax(arr):
expL = np.exp(arr) # Broadcasting
sumExpL = sum(expL)
result = []
for i in expL:
result.append(i * 1.0/sumExpL)
return result | [
"numpy.exp"
] | [((49, 60), 'numpy.exp', 'np.exp', (['arr'], {}), '(arr)\n', (55, 60), True, 'import numpy as np\n')] |
import numpy as np
import scipy.sparse as sp
import pickle as pkl
import os
import h5py
import pandas as pd
import pdb
def map_data(data):
"""
Map data to proper indices in case they are not in a continues [0, N) range
Parameters
----------
data : np.int32 arrays
Returns
-------
mapped... | [
"numpy.full",
"h5py.File",
"numpy.random.seed",
"numpy.concatenate",
"numpy.ceil",
"pandas.read_csv",
"numpy.asarray",
"numpy.unique",
"numpy.zeros",
"os.path.exists",
"numpy.hstack",
"scipy.sparse.csc_matrix",
"scipy.sparse.csr_matrix",
"numpy.array",
"numpy.random.shuffle"
] | [((486, 522), 'numpy.array', 'np.array', (['[id_dict[x] for x in data]'], {}), '([id_dict[x] for x in data])\n', (494, 522), True, 'import numpy as np\n'), ((868, 893), 'h5py.File', 'h5py.File', (['path_file', '"""r"""'], {}), "(path_file, 'r')\n", (877, 893), False, 'import h5py\n'), ((1998, 2097), 'pandas.read_csv', ... |
import numpy as np
def perform_thresholding(f,M,type):
"""
Only 3 types of thresholding currently implemented
"""
if type == "largest":
a = np.sort(np.ravel(abs(f)))[::-1] #sort a 1D copy of F in descending order
T = a[M]
y = f*(abs(f) > T)
elif type == "soft":
s... | [
"numpy.sign"
] | [((373, 383), 'numpy.sign', 'np.sign', (['f'], {}), '(f)\n', (380, 383), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# File : test.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 25/01/2018
#
# This file is part of Semantic-Graph-PyTorch.
import json
import os.path as osp
from os.path import join as pjoin
import time
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cu... | [
"jacinle.cli.argument.JacArgumentParser",
"jacinle.utils.meter.GroupMeters",
"jacinle.io.load",
"evaluation.completion.dataset.make_dataloader",
"torch.nn.Embedding",
"torch.load",
"jactorch.utils.meta.as_numpy",
"evaluation.completion.model.CompletionModel",
"torch.cuda.device_count",
"jaclearn.e... | [((1015, 1035), 'jacinle.logging.get_logger', 'get_logger', (['__file__'], {}), '(__file__)\n', (1025, 1035), False, 'from jacinle.logging import get_logger\n'), ((1046, 1101), 'jacinle.cli.argument.JacArgumentParser', 'JacArgumentParser', ([], {'description': '"""Semantic graph testing"""'}), "(description='Semantic g... |
import numpy as np
from bokeh.io import curdoc
from bokeh.plotting import figure
N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = [
"#%02x%02x%02x" % (int(r), int(g), 150) for r, g in zip(50+2*x, 30+2*y)
]
p = figure(tools="", toolbar_... | [
"bokeh.io.curdoc",
"bokeh.plotting.figure",
"numpy.random.random"
] | [((295, 334), 'bokeh.plotting.figure', 'figure', ([], {'tools': '""""""', 'toolbar_location': 'None'}), "(tools='', toolbar_location=None)\n", (301, 334), False, 'from bokeh.plotting import figure\n'), ((96, 120), 'numpy.random.random', 'np.random.random', ([], {'size': 'N'}), '(size=N)\n', (112, 120), True, 'import nu... |
from visibilitygraphs.dubinspath.dubinsCar import DubinsCar
from visibilitygraphs.dubinspath.vanaAirplane import VanaAirplane
from visibilitygraphs.models import AStarVertex
from visibilitygraphs.dubinspath.helpers import dubinsCurve2d, vanaAirplaneCurve
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolk... | [
"matplotlib.pyplot.title",
"visibilitygraphs.dubinspath.dubinsCar.DubinsCar",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axes",
"visibilitygraphs.dubinspath.helpers.dubinsCurve2d",
"visibilitygraphs.dubinspath.helpers.vanaAirplaneCurve",
"numpy.linspace",
"visibilitygraph... | [((383, 394), 'visibilitygraphs.dubinspath.dubinsCar.DubinsCar', 'DubinsCar', ([], {}), '()\n', (392, 394), False, 'from visibilitygraphs.dubinspath.dubinsCar import DubinsCar\n'), ((538, 644), 'visibilitygraphs.dubinspath.helpers.dubinsCurve2d', 'dubinsCurve2d', (['[path.start.x, path.start.y, path.start.psi]', 'path.... |
## Automatically adapted for scipy Oct 07, 2005 by convertcode.py
from scipy.optimize import minpack2
import numpy
import __builtin__
pymin = __builtin__.min
def line_search(f, myfprime, xk, pk, gfk, old_fval, old_old_fval,
args=(), c1=1e-4, c2=0.9, amax=50):
fc = 0
gc = 0
phi0 = old_fva... | [
"scipy.optimize.minpack2.dcsrch",
"numpy.dot",
"numpy.zeros"
] | [((336, 354), 'numpy.dot', 'numpy.dot', (['gfk', 'pk'], {}), '(gfk, pk)\n', (345, 354), False, 'import numpy\n'), ((756, 785), 'numpy.zeros', 'numpy.zeros', (['(2,)', 'numpy.intc'], {}), '((2,), numpy.intc)\n', (767, 785), False, 'import numpy\n'), ((798, 823), 'numpy.zeros', 'numpy.zeros', (['(13,)', 'float'], {}), '(... |
import cv2
import numpy as np
import SimpleITK as sitk
def auto_region_growing(img):
clicks=[]
image=img.copy()
image=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
imgInput = sitk.GetImageFromArray(image)
ret, thresh = cv2.threshold(image, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)
kernel ... | [
"cv2.Canny",
"cv2.cvtColor",
"cv2.morphologyEx",
"cv2.threshold",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.ones",
"SimpleITK.GetArrayFromImage",
"cv2.moments",
"cv2.imread",
"numpy.array",
"SimpleITK.GetImageFromArray",
"cv2.erode",
"cv2.imshow"
] | [((133, 172), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (145, 172), False, 'import cv2\n'), ((190, 219), 'SimpleITK.GetImageFromArray', 'sitk.GetImageFromArray', (['image'], {}), '(image)\n', (212, 219), True, 'import SimpleITK as sitk\n'), ((239, 308), 'cv2... |
import torch as th
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
class STFT(nn.Module):
def __init__(self, fftsize, window_size, stride, win_type="default", trainable=False, online=False):
super(STFT, self).__init__()
self.fftsize = ff... | [
"torch.nn.Parameter",
"torch.nn.Conv1d",
"numpy.zeros",
"torch.cat",
"torch.nn.ConvTranspose1d",
"numpy.sin",
"numpy.cos",
"torch.device",
"numpy.hanning",
"torch.tensor"
] | [((623, 677), 'numpy.zeros', 'np.zeros', (['(self.fftsize // 2 + 1, 1, self.window_size)'], {}), '((self.fftsize // 2 + 1, 1, self.window_size))\n', (631, 677), True, 'import numpy as np\n'), ((694, 748), 'numpy.zeros', 'np.zeros', (['(self.fftsize // 2 + 1, 1, self.window_size)'], {}), '((self.fftsize // 2 + 1, 1, sel... |
import cv2
import numpy as np
import params
METERS_PER_ENCODER_TICK = params.WHEEL_TICK_LENGTH
def draw_steering(bgr, steering, servo, center=(320, 420)):
# make steering wheel, lower center
#servo = 128*(servo - 125)/70.0
servo = steering
# sdeg = steering # just 1:1 i guess?
sdeg = params.STE... | [
"cv2.line",
"cv2.circle",
"cv2.putText",
"numpy.mean",
"cv2.ellipse",
"numpy.sin",
"numpy.cos",
"numpy.all"
] | [((446, 506), 'cv2.circle', 'cv2.circle', (['bgr', 'center', '(30)', '(255, 255, 255)', '(1)', 'cv2.LINE_AA'], {}), '(bgr, center, 30, (255, 255, 255), 1, cv2.LINE_AA)\n', (456, 506), False, 'import cv2\n'), ((722, 817), 'cv2.ellipse', 'cv2.ellipse', (['bgr', 'center', '(30, 30)', '(0)', '(-90)', '(-90 + steering)', '(... |
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
matplotlib.use('Agg')
def threshold_otsu(hist):
"""Return threshold value based on Otsu's method.
hist : array, or 2-tuple of arrays, optional
Histogram from which to determine the threshold, and optionally a
corresponding ... | [
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.close",
"numpy.cumsum",
"matplotlib.use",
"numpy.nanargmax",
"matplotlib.pyplot.savefig"
] | [((70, 91), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (84, 91), False, 'import matplotlib\n'), ((828, 845), 'numpy.cumsum', 'np.cumsum', (['counts'], {}), '(counts)\n', (837, 845), True, 'import numpy as np\n'), ((1382, 1406), 'numpy.nanargmax', 'np.nanargmax', (['variance12'], {}), '(varian... |
import pysam
import os
import re
import numpy as np
import pandas as pd
import time
from pysam import VariantFile
from sklearn.cluster import KMeans
import sklearn.cluster
pd.options.mode.chained_assignment = None
def CallVCF(CandidateDf, VCFFile, refFile, bamFile, CellName):
# transfer candidate format to vcf fo... | [
"pandas.DataFrame",
"numpy.sum",
"pysam.FastaFile",
"numpy.log",
"os.path.basename",
"pysam.AlignmentFile",
"time.ctime",
"numpy.max",
"numpy.array",
"numpy.exp",
"numpy.log10",
"pandas.concat"
] | [((7990, 8024), 'pandas.concat', 'pd.concat', (['[S_DF, L_DF]'], {'sort': '(True)'}), '([S_DF, L_DF], sort=True)\n', (7999, 8024), True, 'import pandas as pd\n'), ((8659, 8715), 'pandas.DataFrame', 'pd.DataFrame', (['""""""'], {'columns': 'data.columns', 'index': 'data.index'}), "('', columns=data.columns, index=data.i... |
#!/usr/bin/env python
# coding: utf-8
#
# Author: <NAME>
# URL: http://kazuto1011.github.io
# Created: 2017-05-26
from __future__ import print_function
from collections import OrderedDict
import cv2
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import... | [
"numpy.uint8",
"torch.autograd.Variable",
"torch.FloatTensor",
"torch.nn.functional.softmax",
"torch.clamp",
"torch.pow",
"collections.OrderedDict",
"torch.nn.AvgPool2d"
] | [((563, 576), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (574, 576), False, 'from collections import OrderedDict\n'), ((602, 615), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (613, 615), False, 'from collections import OrderedDict\n'), ((1061, 1089), 'torch.nn.functional.softmax', 'F.so... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error as MSE
from sklearn import preprocessing
import math
import re
import warnings
warnings.filterwarnings(action="ignore", module="scipy", message="^inter... | [
"pandas.DataFrame",
"matplotlib.pyplot.tight_layout",
"warnings.filterwarnings",
"pandas.read_csv",
"pandas.get_dummies",
"sklearn.preprocessing.MinMaxScaler",
"matplotlib.pyplot.subplots",
"sklearn.linear_model.LinearRegression",
"math.log10",
"pandas.read_pickle",
"numpy.log10",
"re.sub",
... | [((248, 336), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'module': '"""scipy"""', 'message': '"""^internal gelsd"""'}), "(action='ignore', module='scipy', message=\n '^internal gelsd')\n", (271, 336), False, 'import warnings\n'), ((1700, 1727), 're.sub', 're.sub', (['"""[^\... |
import random
from pathlib import Path
from functools import lru_cache
import cv2
import numpy as np
from imutils import paths
import matplotlib.pyplot as plt
from utils import *
def resize_to_fit_downscale(image, down_scale=16):
img_h, img_w = image.shape[:2]
img_h = round_up_dividend(img_h, down_scale)
... | [
"numpy.dstack",
"imutils.paths.list_images",
"imutils.paths.list_files",
"cv2.cvtColor",
"random.shuffle",
"numpy.zeros",
"cv2.imread",
"pathlib.Path",
"numpy.array",
"functools.lru_cache",
"cv2.resize"
] | [((4127, 4142), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (4136, 4142), False, 'from functools import lru_cache\n'), ((378, 411), 'cv2.resize', 'cv2.resize', (['image', '(img_w, img_h)'], {}), '(image, (img_w, img_h))\n', (388, 411), False, 'import cv2\n'), ((721, 760), 'cv2.cvtColor', 'cv2.cvtCol... |
import unittest
from src.point_location import *
from src.structures import *
from src.graph import *
import numpy as np
from numpy import array
from tqdm import tqdm
class TestTrapezoidRep(unittest.TestCase):
def test_three_init(self):
vertices = np.array([[10, 150], [200, 20], [200, 100]])
trap... | [
"numpy.array"
] | [((263, 307), 'numpy.array', 'np.array', (['[[10, 150], [200, 20], [200, 100]]'], {}), '([[10, 150], [200, 20], [200, 100]])\n', (271, 307), True, 'import numpy as np\n'), ((675, 729), 'numpy.array', 'np.array', (['[[10, 10], [200, 20], [200, 100], [10, 300]]'], {}), '([[10, 10], [200, 20], [200, 100], [10, 300]])\n', ... |
import numpy as np
from PIL import Image, ImageColor
from pathlib import Path
import torch
import torch.nn.functional as F
from random import shuffle
from torch import tensor
from torchvision import transforms
from torchvision import datasets
from torch.utils.data import Dataset, DataLoader, TensorDataset, Subset
cl... | [
"numpy.load",
"pathlib.Path",
"numpy.random.randint",
"numpy.arange",
"torch.utils.data.TensorDataset",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torch.load",
"torchvision.transforms.ToPILImage",
"torch.normal",
"torchvision.datasets.MNIST",
"torchvision.transforms.Ra... | [((6007, 6085), 'torch.utils.data.DataLoader', 'DataLoader', (['ds_train'], {'batch_size': 'batch_size', 'shuffle': '(True)', 'num_workers': 'workers'}), '(ds_train, batch_size=batch_size, shuffle=True, num_workers=workers)\n', (6017, 6085), False, 'from torch.utils.data import Dataset, DataLoader, TensorDataset, Subse... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
@s-gupta
Code for estimating unknown transforms by setting up a least square pixel
reprojection error problem using pytorch. See README.md... | [
"numpy.sum",
"torch.sqrt",
"torch.cat",
"numpy.isnan",
"numpy.mean",
"absl.flags.DEFINE_boolean",
"numpy.tile",
"torch.device",
"absl.flags.DEFINE_list",
"os.path.join",
"numpy.unique",
"cv2.line",
"torch.ones",
"os.path.exists",
"numpy.transpose",
"absl.flags.DEFINE_integer",
"absl.... | [((544, 620), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""data_dir"""', 'None', '"""Directory with images and pkl files"""'], {}), "('data_dir', None, 'Directory with images and pkl files')\n", (563, 620), False, 'from absl import app, flags\n'), ((641, 743), 'absl.flags.DEFINE_string', 'flags.DEFINE_strin... |
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
from math import sqrt
parser = argparse.ArgumentParser(description='Code from AKAZE local features matching tutorial.')
parser.add_argument('--input1', help='Path to input image 1.', default='graf1.png')
parser.add_argument('--in... | [
"argparse.ArgumentParser",
"cv2.xfeatures2d.BEBLID_create",
"cv2.drawMatches",
"cv2.waitKey",
"cv2.imwrite",
"numpy.ones",
"cv2.imread",
"cv2.FileStorage",
"cv2.ORB_create",
"cv2.DescriptorMatcher_create",
"numpy.dot",
"cv2.imshow"
] | [((122, 215), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Code from AKAZE local features matching tutorial."""'}), "(description=\n 'Code from AKAZE local features matching tutorial.')\n", (145, 215), False, 'import argparse\n'), ((511, 554), 'cv2.imread', 'cv.imread', (['args.inpu... |
from fdfdpy.derivatives import createDws
from fdfdpy.constants import DEFAULT_MATRIX_FORMAT
import scipy.sparse as sp
import numpy as np
import scipy.sparse.linalg as la
from scipy.sparse.linalg import spsolve as bslash
matrix_format=DEFAULT_MATRIX_FORMAT
matrix_format = 'csc'
def grid_average(center_array, w):
#... | [
"fdfdpy.derivatives.createDws",
"numpy.roll",
"scipy.sparse.bmat",
"scipy.sparse.identity",
"scipy.sparse.linalg.spsolve",
"numpy.real",
"scipy.sparse.linalg.eigs",
"numpy.prod",
"numpy.sqrt"
] | [((399, 435), 'numpy.roll', 'np.roll', (['center_array', '(1)'], {'axis': 'xy[w]'}), '(center_array, 1, axis=xy[w])\n', (406, 435), True, 'import numpy as np\n'), ((996, 1006), 'numpy.prod', 'np.prod', (['N'], {}), '(N)\n', (1003, 1006), True, 'import numpy as np\n'), ((1018, 1073), 'fdfdpy.derivatives.createDws', 'cre... |
import graph_tool.all as gt
import json
import numpy as np
from collections import Counter
from subprocess import Popen, PIPE
from HierarchicalPartitioningTree import PartitionTree, PartitionNode
"""Helpers
This module provides helper functions.
"""
def statistics(G):
"""Provides general graph statistics.
A... | [
"graph_tool.all.kcore_decomposition",
"subprocess.Popen",
"numpy.ones_like",
"graph_tool.all.label_components",
"HierarchicalPartitioningTree.PartitionTree.collect_indices",
"graph_tool.all.vertex_hist",
"numpy.where",
"collections.Counter",
"numpy.unique"
] | [((783, 826), 'graph_tool.all.vertex_hist', 'gt.vertex_hist', (['G', '"""out"""'], {'float_count': '(False)'}), "(G, 'out', float_count=False)\n", (797, 826), True, 'import graph_tool.all as gt\n'), ((976, 998), 'graph_tool.all.label_components', 'gt.label_components', (['G'], {}), '(G)\n', (995, 998), True, 'import gr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 28 17:30:59 2019
@author: vasgaoweithu
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_paths
import os
import sys
import numpy as np
import argparse
import pprint
import ... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.abs",
"numpy.maximum",
"numpy.argmax",
"numpy.greater",
"model.utils.config.cfg_from_file",
"sys.stdout.flush",
"pprint.pprint",
"xml.etree.ElementTree.SubElement",
"os.path.join",
"torch.load",
"xml.etree.ElementTree.Element",
"os.pat... | [((1748, 1769), 'numpy.max', 'np.max', (['im_shape[0:2]'], {}), '(im_shape[0:2])\n', (1754, 1769), True, 'import numpy as np\n'), ((6126, 6144), 'xml.etree.ElementTree.parse', 'ET.parse', (['xml_file'], {}), '(xml_file)\n', (6134, 6144), True, 'from xml.etree import ElementTree as ET\n'), ((6156, 6180), 'xml.etree.Elem... |
import tensorflow as tf
import numpy as np
from tensorflow import keras
# GRADED FUNCTION: house_model
def house_model(y_new):
xs = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], dtype=float)
ys = np.array([1.0, 1.5, 2.0, 2.5, 3.0, 3.5], dtype=float)
# alternate solution
# xs = np.array([1.0, 2.0, 3.0, 4.0... | [
"numpy.array",
"tensorflow.keras.layers.Dense"
] | [((138, 191), 'numpy.array', 'np.array', (['[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]'], {'dtype': 'float'}), '([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], dtype=float)\n', (146, 191), True, 'import numpy as np\n'), ((201, 254), 'numpy.array', 'np.array', (['[1.0, 1.5, 2.0, 2.5, 3.0, 3.5]'], {'dtype': 'float'}), '([1.0, 1.5, 2.0, 2.5, 3.0, 3... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | [
"numpy.divide",
"numpy.abs",
"scipy.signal.windows.get_window",
"numpy.multiply",
"numpy.ceil",
"scipy.signal.lfilter",
"numpy.angle",
"numpy.asarray",
"numpy.fft.fft",
"numpy.transpose",
"numpy.zeros",
"numpy.isnan",
"numpy.imag",
"numpy.arange",
"numpy.real",
"numpy.concatenate"
] | [((881, 914), 'numpy.asarray', 'np.asarray', (['[1, -emphasize_value]'], {}), '([1, -emphasize_value])\n', (891, 914), True, 'import numpy as np\n'), ((941, 972), 'scipy.signal.lfilter', 'lfilter', (['filter_window', '(1)', 'data'], {}), '(filter_window, 1, data)\n', (948, 972), False, 'from scipy.signal import lfilter... |
"""
Module for managing the face_recognition recognition method.
To install this method follow instructions at https://github.com/ageitgey/face_recognition#installation
"""
import face_recognition
import numpy as np
import dlib
class FaceRecognition:
def __init__(self):
pass
def predict(self, image,... | [
"face_recognition.face_encodings",
"numpy.linalg.norm"
] | [((598, 663), 'face_recognition.face_encodings', 'face_recognition.face_encodings', (['image'], {'known_face_locations': '[bb]'}), '(image, known_face_locations=[bb])\n', (629, 663), False, 'import face_recognition\n'), ((752, 779), 'numpy.linalg.norm', 'np.linalg.norm', (['encoding[0]'], {}), '(encoding[0])\n', (766, ... |
"""Human3.6M dataset."""
import copy
import json
import os
import pickle as pk
import numpy as np
import scipy.misc
import torch.utils.data as data
from hybrik.utils.bbox import bbox_clip_xyxy, bbox_xywh_to_xyxy
from hybrik.utils.pose_utils import cam2pixel, pixel2cam, reconstruction_error
from hybrik.utils.presets im... | [
"pickle.dump",
"numpy.sum",
"numpy.abs",
"hybrik.utils.bbox.bbox_xywh_to_xyxy",
"numpy.ones",
"numpy.mean",
"pickle.load",
"numpy.sin",
"os.path.join",
"numpy.zeros_like",
"os.path.exists",
"hybrik.utils.pose_utils.pixel2cam",
"json.dump",
"copy.deepcopy",
"numpy.stack",
"hybrik.utils.... | [((2948, 3027), 'os.path.join', 'os.path.join', (['root', '"""annotations"""', "(ann_file + f'_protocol_{self.protocol}.json')"], {}), "(root, 'annotations', ann_file + f'_protocol_{self.protocol}.json')\n", (2960, 3027), False, 'import os\n'), ((5715, 5747), 'copy.deepcopy', 'copy.deepcopy', (['self._labels[idx]'], {}... |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | [
"numpy.trace",
"numpy.empty",
"numpy.asarray",
"numpy.where",
"numpy.long"
] | [((2784, 2822), 'numpy.asarray', 'np.asarray', (['reorder_vec'], {'dtype': 'np.long'}), '(reorder_vec, dtype=np.long)\n', (2794, 2822), True, 'import numpy as np\n'), ((3971, 4009), 'numpy.asarray', 'np.asarray', (['reorder_vec'], {'dtype': 'np.long'}), '(reorder_vec, dtype=np.long)\n', (3981, 4009), True, 'import nump... |
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.dates as mdates
from datetime import datetime
import matplotlib.patches as patches
from matplotlib.backends.backend_pdf import PdfPages
import math
import operator
def plot(ctx):
"Delegation status over time"
switches = [opts['_switch'] fo... | [
"matplotlib.pyplot.show",
"matplotlib.patches.Rectangle",
"numpy.arange",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.subplots"
] | [((403, 432), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(16, 6)'}), '(figsize=(16, 6))\n', (415, 432), True, 'import matplotlib.pyplot as plt\n'), ((1572, 1582), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1580, 1582), True, 'import matplotlib.pyplot as plt\n'), ((1402, 1415), 'numpy.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.