code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# Copyright 2021 Dice Finding 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 applicabl... | [
"numpy.maximum",
"numpy.arctan2",
"numpy.abs",
"numpy.sum",
"cv2.solvePnP",
"collections.defaultdict",
"numpy.linalg.svd",
"numpy.linalg.norm",
"tensorflow.compat.v2.expand_dims",
"DiceConfig.get_local_face_forward",
"tensorflow.compat.v2.math.greater",
"DiceProjection.get_local_dots_facing_ca... | [((7780, 7812), 'tensorflow.compat.v2.ones_like', 'tf.ones_like', (['idx'], {'dtype': 'tf.bool'}), '(idx, dtype=tf.bool)\n', (7792, 7812), True, 'import tensorflow.compat.v2 as tf\n'), ((7879, 7916), 'tensorflow.compat.v2.boolean_mask', 'tf.boolean_mask', (['tensor', 'm'], {'axis': 'axis'}), '(tensor, m, axis=axis)\n',... |
import numpy as np
from scipy import optimize
def circle_fit(coords):
"""
Find the least squares circle fitting a set of 2D points ``(x,y)``.
Parameters
----------
coords : (N, 2) ndarray
Set of ``x`` and ``y`` coordinates.
Returns
-------
centre_i : (2,)
The 2D coord... | [
"numpy.mean",
"numpy.sqrt",
"numpy.sum",
"scipy.optimize.leastsq"
] | [((762, 785), 'numpy.mean', 'np.mean', (['coords'], {'axis': '(0)'}), '(coords, axis=0)\n', (769, 785), True, 'import numpy as np\n'), ((849, 918), 'scipy.optimize.leastsq', 'optimize.leastsq', (['residuals', 'c_est'], {'args': '(coords[:, 0], coords[:, 1])'}), '(residuals, c_est, args=(coords[:, 0], coords[:, 1]))\n',... |
import numpy as np
class KITTICategory(object):
CLASSES = ['Car', 'Pedestrian', 'Cyclist']
CLASS_MEAN_SIZE = {
'Car': np.array([3.88311640418, 1.62856739989, 1.52563191462]),
'Pedestrian': np.array([0.84422524, 0.66068622, 1.76255119]),
'Cyclist': np.array([1.76282397, 0.59706367, 1... | [
"numpy.array",
"numpy.zeros"
] | [((400, 431), 'numpy.zeros', 'np.zeros', (['(NUM_SIZE_CLUSTER, 3)'], {}), '((NUM_SIZE_CLUSTER, 3))\n', (408, 431), True, 'import numpy as np\n'), ((139, 194), 'numpy.array', 'np.array', (['[3.88311640418, 1.62856739989, 1.52563191462]'], {}), '([3.88311640418, 1.62856739989, 1.52563191462])\n', (147, 194), True, 'impor... |
import numpy as np
x = np.ones((2,2))
print("Original array:")
print(x)
print("0 on the border and 1 inside in the array")
x = np.pad(x, pad_width=1, mode='constant', constant_values=0)
print(x) | [
"numpy.pad",
"numpy.ones"
] | [((24, 39), 'numpy.ones', 'np.ones', (['(2, 2)'], {}), '((2, 2))\n', (31, 39), True, 'import numpy as np\n'), ((132, 190), 'numpy.pad', 'np.pad', (['x'], {'pad_width': '(1)', 'mode': '"""constant"""', 'constant_values': '(0)'}), "(x, pad_width=1, mode='constant', constant_values=0)\n", (138, 190), True, 'import numpy a... |
import cv2
import numpy as np
'''
This part is just to see how to capture video from
Webcam and show it to you
cap = cv2.VideoCapture(0)
cap.set(3,640) #width
cap.set(4,480) #height
cap.set(10,100) #brightness
while True:
success, img = cap.read()
cv2.imshow('Video',img)
if cv2.waitKey(1) & 0xFF == o... | [
"cv2.GaussianBlur",
"cv2.Canny",
"cv2.dilate",
"cv2.cvtColor",
"cv2.waitKey",
"numpy.ones",
"cv2.imread",
"cv2.erode",
"cv2.imshow",
"cv2.resize"
] | [((354, 404), 'cv2.imread', 'cv2.imread', (['"""D:\\\\Github\\\\python\\\\emilia_small.jpg"""'], {}), "('D:\\\\Github\\\\python\\\\emilia_small.jpg')\n", (364, 404), False, 'import cv2\n'), ((411, 436), 'numpy.ones', 'np.ones', (['(5, 5)', 'np.uint8'], {}), '((5, 5), np.uint8)\n', (418, 436), True, 'import numpy as np\... |
import numpy as np
from .agent import Agent
class RandMinQlearning(Agent):
def __init__(self, env, thres, discount=0.9, learning_rate=0.01, epsilon=0.1):
super().__init__(env, discount, learning_rate, epsilon)
self.name = "RandMin" + str(thres)
self.q = np.random.uniform(low=-1, high=1, s... | [
"numpy.random.rand",
"numpy.random.uniform",
"numpy.max",
"numpy.argmax"
] | [((285, 356), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-1)', 'high': '(1)', 'size': '(self.n_states, self.n_actions)'}), '(low=-1, high=1, size=(self.n_states, self.n_actions))\n', (302, 356), True, 'import numpy as np\n'), ((383, 454), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-1)'... |
"""
@file: get_circle_point.py
@author: Tatsumi0000
@brief: ブロックサークルと交点サークルを囲むだけで各サークルの座標を取得.
"""
import cv2.cv2 as cv2
import numpy as np
class GetCirclePoint:
def __init__(self, window_name=None):
"""コンストラクタ
"""
self.CROSS_CIRCLE_POINTS = 16 # 交点サークルの個数
self.BLOCK_CIRCLE_POINT... | [
"cv2.cv2.namedWindow",
"cv2.cv2.destroyAllWindows",
"cv2.cv2.circle",
"cv2.cv2.waitKey",
"numpy.copy",
"cv2.cv2.line",
"numpy.empty",
"cv2.cv2.rectangle",
"cv2.cv2.setMouseCallback",
"numpy.zeros",
"cv2.cv2.moveWindow",
"numpy.array",
"cv2.cv2.imread",
"cv2.cv2.imshow"
] | [((8904, 8919), 'cv2.cv2.imread', 'cv2.imread', (['img'], {}), '(img)\n', (8914, 8919), True, 'import cv2.cv2 as cv2\n'), ((8964, 8992), 'cv2.cv2.namedWindow', 'cv2.namedWindow', (['window_name'], {}), '(window_name)\n', (8979, 8992), True, 'import cv2.cv2 as cv2\n'), ((8997, 9112), 'cv2.cv2.setMouseCallback', 'cv2.set... |
"""
Lorenz system
"""
from scipy.integrate import odeint
from scipy.stats import norm
class lorenz_system_63:
def __init__(self, rho = None, sigma = None, beta = None):
self.rho = 28.0
self.sigma = 10.0
self.beta = 8.0 / 3.0
self.N = 3
self.x0 = norm.rvs(size = self.N).res... | [
"matplotlib.pyplot.show",
"scipy.stats.norm.rvs",
"scipy.integrate.odeint",
"matplotlib.pyplot.figure",
"numpy.arange"
] | [((705, 731), 'numpy.arange', 'np.arange', (['(0.0)', '(40.0)', '(0.01)'], {}), '(0.0, 40.0, 0.01)\n', (714, 731), True, 'import numpy as np\n'), ((745, 768), 'scipy.integrate.odeint', 'odeint', (['ls.f', 'state0', 't'], {}), '(ls.f, state0, t)\n', (751, 768), False, 'from scipy.integrate import odeint\n'), ((780, 792)... |
from keras.models import Sequential, Model
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.utils import np_utils
import numpy as np
from collections impor... | [
"PIL.Image.new",
"numpy.set_printoptions",
"numpy.asarray",
"numpy.array",
"keras.layers.Conv2D",
"numpy.swapaxes",
"keras.models.Sequential"
] | [((2812, 3309), 'numpy.array', 'np.array', (['[[[[0.0, 1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0, 9.0], [10.0, 11.0, 12.0,\n 13.0, 14.0], [15.0, 16.0, 17.0, 18.0, 19.0], [20.0, 21.0, 22.0, 23.0, \n 24.0]], [[0.0, 1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0, 9.0], [10.0, \n 11.0, 12.0, 13.0, 14.0], [15.0, 16.0, 17.... |
# Fix paths for imports to work in unit tests ----------------
if __name__ == "__main__":
from _fix_paths import fix_paths
fix_paths()
# ------------------------------------------------------------
# Load libraries ---------------------------------------------
import numpy as np
from ssa_sim_v2.polici... | [
"ssa_sim_v2.policies.policy.Policy.STP.__init__",
"_fix_paths.fix_paths",
"ssa_sim_v2.policies.policy.Policy.learn",
"ssa_sim_v2.policies.policy.Policy.__init__",
"ssa_sim_v2.simulator.attribute.AttrSet",
"ssa_sim_v2.simulator.action.ActionSet",
"ssa_sim_v2.policies.policy.Policy.UDP.__init__",
"ssa_s... | [((137, 148), '_fix_paths.fix_paths', 'fix_paths', ([], {}), '()\n', (146, 148), False, 'from _fix_paths import fix_paths\n'), ((9549, 9569), 'ssa_sim_v2.simulator.attribute.AttrSet', 'AttrSet', (['names', 'vals'], {}), '(names, vals)\n', (9556, 9569), False, 'from ssa_sim_v2.simulator.attribute import AttrSet\n'), ((9... |
#!/usr/bin/env python3
"""A python script to perform watermark embedding/detection
in the wavelet domain."""
# Copyright (C) 2020 by <NAME>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, ... | [
"numpy.sum",
"numpy.ceil",
"numpy.abs",
"pywt.wavedec",
"numpy.floor",
"numpy.zeros",
"scipy.io.wavfile.write",
"scipy.io.wavfile.read",
"pywt.waverec",
"numpy.mean",
"scipy.signal.windows.hann",
"numpy.concatenate",
"numpy.repeat"
] | [((1801, 1831), 'scipy.io.wavfile.read', 'wavfile.read', (['HOST_SIGNAL_FILE'], {}), '(HOST_SIGNAL_FILE)\n', (1813, 1831), False, 'from scipy.io import wavfile\n'), ((2944, 2978), 'numpy.zeros', 'np.zeros', (['(frame_shift * embed_nbit)'], {}), '(frame_shift * embed_nbit)\n', (2952, 2978), True, 'import numpy as np\n')... |
import numpy as np
import torch
from torchvision import models
import torch.nn as nn
from nn_ood.data.cifar10 import Cifar10Data
from nn_ood.posteriors import LocalEnsemble, SCOD, Ensemble, Naive, KFAC, Mahalanobis
from nn_ood.distributions import CategoricalLogit
import matplotlib.pyplot as plt
import matplotlib.anima... | [
"torch.nn.AdaptiveAvgPool2d",
"nn_ood.distributions.CategoricalLogit",
"torch.nn.ReLU",
"torch.nn.Sequential",
"numpy.argmax",
"numpy.clip",
"numpy.array",
"densenet.densenet121",
"seaborn.color_palette",
"torch.cuda.is_available",
"matplotlib.pyplot.subplots",
"torch.nn.Flatten"
] | [((11970, 12010), 'seaborn.color_palette', 'sns.color_palette', (['"""crest"""'], {'as_cmap': '(True)'}), "('crest', as_cmap=True)\n", (11987, 12010), True, 'import seaborn as sns\n'), ((783, 817), 'numpy.array', 'np.array', (['[0.4914, 0.4822, 0.4465]'], {}), '([0.4914, 0.4822, 0.4465])\n', (791, 817), True, 'import n... |
"""The interface defining class for fit modes."""
from abc import ABC, abstractmethod
import numpy as np
from iminuit import Minuit
class AbstractFitPlugin(ABC):
"""Minuit wrapper to standardize usage with different likelihood function
definitions and parameter transformations.
"""
def __init__(
... | [
"numpy.empty",
"numpy.array",
"iminuit.Minuit"
] | [((865, 895), 'iminuit.Minuit', 'Minuit', (['fcn', 'internal_starters'], {}), '(fcn, internal_starters)\n', (871, 895), False, 'from iminuit import Minuit\n'), ((3147, 3164), 'numpy.empty', 'np.empty', (['n_boxes'], {}), '(n_boxes)\n', (3155, 3164), True, 'import numpy as np\n'), ((3277, 3318), 'numpy.empty', 'np.empty... |
from sklearn.datasets import fetch_20newsgroups
import torchvision
from sklearn.feature_extraction.text import TfidfVectorizer
from os.path import join
import numpy as np
import pickle
#TODO: Update mnist examples!!!
def dataset_loader(dataset_path=None, dataset='mnist', seed=1):
"""
Loads a dataset and creat... | [
"numpy.random.seed",
"sklearn.feature_extraction.text.TfidfVectorizer",
"numpy.asarray",
"numpy.float32",
"pickle.load",
"numpy.random.permutation",
"numpy.where",
"torchvision.datasets.MNIST",
"sklearn.datasets.fetch_20newsgroups",
"numpy.squeeze",
"os.path.join",
"numpy.concatenate"
] | [((546, 566), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (560, 566), True, 'import numpy as np\n'), ((3462, 3534), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([], {'root': 'dataset_path', 'download': '(True)', 'train': '(True)'}), '(root=dataset_path, download=True, train=True)\... |
import numpy as np
import pandas as pd
def _to_binary(target):
return (target > target.median()).astype(int)
def generate_test_data(data_size):
df = pd.DataFrame()
np.random.seed(0)
df["A"] = np.random.rand(data_size)
df["B"] = np.random.rand(data_size)
df["C"] = np.random.rand(data_size)
... | [
"pandas.DataFrame",
"numpy.random.rand",
"numpy.random.seed",
"numpy.random.choice"
] | [((161, 175), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (173, 175), True, 'import pandas as pd\n'), ((181, 198), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (195, 198), True, 'import numpy as np\n'), ((213, 238), 'numpy.random.rand', 'np.random.rand', (['data_size'], {}), '(data_size)\n',... |
# -*- coding: utf-8 -*-
"""MedleyDB pitch Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
MedleyDB Pitch is a pitch-tracking subset of the MedleyDB dataset
containing only f0-annotated, monophonic stems.
MedleyDB is a dataset of annotated, royalty-free multitrack recordings.
Medley... | [
"json.load",
"mirdata.core.copy_docs",
"csv.reader",
"mirdata.annotations.F0Data",
"mirdata.jams_utils.jams_converter",
"os.path.exists",
"mirdata.core.docstring_inherit",
"mirdata.core.LargeData",
"numpy.array",
"librosa.load",
"os.path.join"
] | [((1974, 2033), 'mirdata.core.LargeData', 'core.LargeData', (['"""medleydb_pitch_index.json"""', '_load_metadata'], {}), "('medleydb_pitch_index.json', _load_metadata)\n", (1988, 2033), False, 'from mirdata import core\n'), ((5465, 5501), 'mirdata.core.docstring_inherit', 'core.docstring_inherit', (['core.Dataset'], {}... |
from __future__ import division
import torch
import numpy as np
def parse_conv_block(m, weights, offset, initflag):
"""
Initialization of conv layers with batchnorm
Args:
m (Sequential): sequence of layers
weights (numpy.ndarray): pretrained weights data
offset (int): current posi... | [
"numpy.fromfile",
"numpy.zeros",
"numpy.ones",
"numpy.random.normal",
"numpy.sqrt",
"torch.from_numpy"
] | [((3473, 3513), 'numpy.fromfile', 'np.fromfile', (['fp'], {'dtype': 'np.int32', 'count': '(5)'}), '(fp, dtype=np.int32, count=5)\n', (3484, 3513), True, 'import numpy as np\n'), ((3559, 3592), 'numpy.fromfile', 'np.fromfile', (['fp'], {'dtype': 'np.float32'}), '(fp, dtype=np.float32)\n', (3570, 3592), True, 'import num... |
import sklearn.datasets as dt
import matplotlib.pyplot as plt
import numpy as np
seed = 1
# Create dataset
"""
x_data,y_data = dt.make_classification(n_samples=1000,
n_features=2,
n_repeated=0,
class_se... | [
"sklearn.datasets.make_circles",
"matplotlib.pyplot.show",
"numpy.savetxt",
"numpy.array",
"matplotlib.pyplot.savefig"
] | [((458, 511), 'sklearn.datasets.make_circles', 'dt.make_circles', ([], {'n_samples': '(700)', 'noise': '(0.2)', 'factor': '(0.3)'}), '(n_samples=700, noise=0.2, factor=0.3)\n', (473, 511), True, 'import sklearn.datasets as dt\n'), ((866, 889), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""data.png"""'], {}), "('dat... |
# A simple script that plots the time and the speedup
# of the parallel OpenMP program as the number of available
# cores increases.
import matplotlib.pyplot as plt
import sys
import numpy as np
import matplotlib
matplotlib.use('Agg')
t_64 = []
t_1024 = []
t_4096 = []
s_64 = []
s_1024 = []
s_4096 = []
fp = open(sys... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"matplotlib.use",
"numpy.arange",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((214, 235), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (228, 235), False, 'import matplotlib\n'), ((873, 887), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (885, 887), True, 'import matplotlib.pyplot as plt\n'), ((1083, 1137), 'matplotlib.pyplot.plot', 'plt.plot', (['t_64... |
# -*- coding: utf-8 -*-
import numpy as np
def kalman_transit_covariance(S, A, R):
"""
:param S: Current covariance matrix
:param A: Either transition matrix or jacobian matrix
:param R: Current noise covariance matrix
"""
state_size = S.shape[0]
assert S.shape == (state_size, state_size)
... | [
"numpy.dot",
"numpy.abs",
"numpy.eye"
] | [((1093, 1107), 'numpy.dot', 'np.dot', (['S', 'C.T'], {}), '(S, C.T)\n', (1099, 1107), True, 'import numpy as np\n'), ((433, 445), 'numpy.dot', 'np.dot', (['A', 'S'], {}), '(A, S)\n', (439, 445), True, 'import numpy as np\n'), ((1188, 1206), 'numpy.eye', 'np.eye', (['state_size'], {}), '(state_size)\n', (1194, 1206), T... |
# Author: <NAME>
import h5py
import json
import librosa
import numpy as np
import os
import scipy
import time
from pathlib import Path
from PIL import Image
from torchvision.transforms import transforms
from dataloaders.utils import WINDOWS, compute_spectrogram
def run(json_path, hdf5_json_path, audio_path, image_pa... | [
"json.dump",
"h5py.File",
"json.load",
"argparse.ArgumentParser",
"numpy.frombuffer",
"os.path.dirname",
"numpy.dtype",
"os.path.exists",
"time.time",
"dataloaders.utils.compute_spectrogram",
"librosa.load"
] | [((1060, 1086), 'os.path.exists', 'os.path.exists', (['image_path'], {}), '(image_path)\n', (1074, 1086), False, 'import os\n'), ((1310, 1336), 'h5py.File', 'h5py.File', (['image_path', '"""w"""'], {}), "(image_path, 'w')\n", (1319, 1336), False, 'import h5py\n'), ((1463, 1474), 'time.time', 'time.time', ([], {}), '()\... |
from __future__ import print_function
import pandas as pd
import numpy as np
import os
from collections import OrderedDict
from pria_lifechem.function import *
from prospective_screening_model_names import *
from prospective_screening_metric_names import *
def clean_excel():
dataframe = pd.read_excel('../../outp... | [
"pandas.DataFrame",
"numpy.load",
"pandas.read_csv",
"numpy.zeros",
"os.path.exists",
"pandas.read_excel",
"numpy.min",
"numpy.array",
"collections.OrderedDict",
"numpy.vstack"
] | [((295, 365), 'pandas.read_excel', 'pd.read_excel', (['"""../../output/stage_2_predictions/Keck_LC4_backup.xlsx"""'], {}), "('../../output/stage_2_predictions/Keck_LC4_backup.xlsx')\n", (308, 365), True, 'import pandas as pd\n'), ((556, 622), 'pandas.read_csv', 'pd.read_csv', (['"""../../dataset/fixed_dataset/pria_pros... |
# coding=utf-8
# pylint: disable-msg=E1101,W0612
from datetime import datetime, timedelta
import operator
from itertools import product, starmap
from numpy import nan, inf
import numpy as np
import pandas as pd
from pandas import (Index, Series, DataFrame, isnull, bdate_range,
NaT, date_range, ti... | [
"numpy.abs",
"operator.add",
"operator.pow",
"numpy.isnan",
"pandas.DatetimeIndex",
"numpy.arange",
"numpy.float64",
"pandas.bdate_range",
"pandas.DataFrame",
"pandas.offsets.Minute",
"numpy.random.randn",
"pandas.tseries.index.Timestamp",
"pandas.util.testing.rands_array",
"datetime.timed... | [((834, 853), 'numpy.random.randn', 'np.random.randn', (['(10)'], {}), '(10)\n', (849, 853), True, 'import numpy as np\n'), ((870, 889), 'numpy.random.randn', 'np.random.randn', (['(10)'], {}), '(10)\n', (885, 889), True, 'import numpy as np\n'), ((934, 959), 'pandas.core.nanops.nangt', 'nanops.nangt', (['left', 'right... |
import argparse
import multiprocessing
import random
import shutil
from datetime import datetime
from functools import partial
from pathlib import Path
import chainer
import chainer.functions as F
import chainer.links as L
import cupy
import numpy as np
from chainer import iterators, optimizers, serializers
from chain... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"modified_updater.ModifiedUpdater",
"augmentation.flip",
"numpy.mean",
"numpy.random.randint",
"chainer.iterators.SerialIterator",
"augmentation.random_rotate",
"shutil.rmtree",
"resnet.ResNet50",
"chainer.training.extensions.LogReport",
"modifie... | [((1560, 1613), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""training mnist"""'}), "(description='training mnist')\n", (1583, 1613), False, 'import argparse\n'), ((2759, 2773), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2771, 2773), False, 'from datetime import datetim... |
from dataclasses import dataclass
import os
import logging
import json
from functools import lru_cache
import cv2
import numpy as np
import app
from util import cvimage as Image
logger = logging.getLogger(__name__)
net_file = app.cache_path / 'ark_material.onnx'
index_file = app.cache_path / 'index_itemid_relation.... | [
"json.dump",
"json.load",
"os.path.join",
"os.stat",
"app.extra_items_path.joinpath",
"os.path.basename",
"os.path.dirname",
"os.path.exists",
"time.strftime",
"cv2.dnn.readNetFromONNX",
"time.time",
"numpy.array",
"os.path.getmtime",
"requests.get",
"datetime.datetime.fromtimestamp",
... | [((190, 217), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (207, 217), False, 'import logging\n'), ((614, 626), 'functools.lru_cache', 'lru_cache', (['(1)'], {}), '(1)\n', (623, 626), False, 'from functools import lru_cache\n'), ((789, 801), 'functools.lru_cache', 'lru_cache', (['(1)'],... |
import copy
import logging
import time
import numpy as np
import torch
import wandb
from torch import nn
from .utils import transform_list_to_tensor
from ....core.robustness.robust_aggregation import RobustAggregator, is_weight_param
from ....utils.logging import logger
def test(
model,
device,
test_lo... | [
"wandb.log",
"torch.ones_like",
"copy.deepcopy",
"numpy.random.seed",
"torch.where",
"torch.nn.CrossEntropyLoss",
"time.time",
"logging.info",
"torch.max",
"torch.no_grad"
] | [((1748, 1763), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1761, 1763), False, 'import torch\n'), ((6728, 6773), 'logging.info', 'logging.info', (["('add_model. index = %d' % index)"], {}), "('add_model. index = %d' % index)\n", (6740, 6773), False, 'import logging\n'), ((7276, 7287), 'time.time', 'time.time'... |
import numpy as np
import h5py
import pandas as pd
from svhn_io import load_svhn
from keras_uncertainty.utils import classifier_calibration_curve, classifier_calibration_error
EPSILON = 1e-10
def load_hdf5_data(filename):
inp = h5py.File(filename, "r")
preds = inp["preds"][...]
inp.close()
return p... | [
"pandas.DataFrame",
"h5py.File",
"numpy.argmax",
"keras_uncertainty.utils.classifier_calibration_curve",
"numpy.max",
"keras_uncertainty.utils.classifier_calibration_error",
"svhn_io.load_svhn"
] | [((235, 259), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (244, 259), False, 'import h5py\n'), ((741, 752), 'svhn_io.load_svhn', 'load_svhn', ([], {}), '()\n', (750, 752), False, 'from svhn_io import load_svhn\n'), ((873, 896), 'numpy.max', 'np.max', (['y_probs'], {'axis': '(1)'}), '(y... |
import numpy as np
import sys
import gpflow
import VFF
from time import time
from config import *
dim = sys.argv[1]
rep = sys.argv[2]
print('vff: dimension {}, replicate {}'.format(dim, r))
# data
data = np.load('data/data_dim{}_rep{}.npz'.format(dim, 0))
# full_gp
def prodkern(dim):
return gpflow.kernels.Pro... | [
"gpflow.likelihoods.Gaussian",
"numpy.ones",
"time.time",
"numpy.arange",
"gpflow.gpr.GPR",
"gpflow.kernels.Matern32"
] | [((469, 523), 'gpflow.gpr.GPR', 'gpflow.gpr.GPR', (["data['Xtrain']", "data['Ytrain']"], {'kern': 'k'}), "(data['Xtrain'], data['Ytrain'], kern=k)\n", (483, 523), False, 'import gpflow\n'), ((323, 392), 'gpflow.kernels.Matern32', 'gpflow.kernels.Matern32', (['(1)'], {'active_dims': '[i]', 'lengthscales': 'lengthscale'}... |
import torch.utils.data as data
import os
import os.path
from numpy.random import randint
from ops.io import load_proposal_file
from transforms import *
from ops.utils import temporal_iou
class SSNInstance:
def __init__(
self,
start_frame,
end_frame,
video_frame_count,
fps... | [
"ops.io.load_proposal_file",
"numpy.random.randint",
"ops.utils.temporal_iou"
] | [((7277, 7311), 'ops.io.load_proposal_file', 'load_proposal_file', (['self.prop_file'], {}), '(self.prop_file)\n', (7295, 7311), False, 'from ops.io import load_proposal_file\n'), ((1017, 1102), 'ops.utils.temporal_iou', 'temporal_iou', (['(self.start_frame, self.end_frame)', '(gt.start_frame, gt.end_frame)'], {}), '((... |
"""Central data class and associated."""
# --- import --------------------------------------------------------------------------------------
import collections
import operator
import functools
import warnings
import numpy as np
import h5py
import scipy
from scipy.interpolate import griddata, interp1d
from .._gr... | [
"numpy.kaiser",
"numpy.sum",
"numpy.nan_to_num",
"numpy.empty",
"numpy.isnan",
"numpy.around",
"scipy.interpolate.interp1d",
"numpy.prod",
"numpy.nanmean",
"numpy.full",
"numpy.meshgrid",
"numpy.isfinite",
"scipy.ndimage.interpolation.zoom",
"numpy.linspace",
"numpy.trapz",
"numpy.resu... | [((4139, 4165), 'numpy.array', 'np.array', (['value'], {'dtype': '"""S"""'}), "(value, dtype='S')\n", (4147, 4165), True, 'import numpy as np\n'), ((5409, 5451), 'functools.reduce', 'functools.reduce', (['operator.mul', 'self.shape'], {}), '(operator.mul, self.shape)\n', (5425, 5451), False, 'import functools\n'), ((63... |
# Plot polynomial regression on 1d problem
# Based on https://github.com/probml/pmtk3/blob/master/demos/linregPolyVsDegree.m
import numpy as np
import matplotlib.pyplot as plt
from pyprobml_utils import save_fig
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
fr... | [
"pyprobml_utils.save_fig",
"matplotlib.pyplot.show",
"numpy.random.seed",
"numpy.empty",
"sklearn.preprocessing.MinMaxScaler",
"numpy.square",
"sklearn.linear_model.LinearRegression",
"sklearn.preprocessing.PolynomialFeatures",
"numpy.max",
"numpy.arange",
"numpy.array",
"numpy.linspace",
"n... | [((974, 1009), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(-1, 1)'}), '(feature_range=(-1, 1))\n', (986, 1009), False, 'from sklearn.preprocessing import MinMaxScaler\n'), ((1119, 1138), 'numpy.arange', 'np.arange', (['(1)', '(21)', '(1)'], {}), '(1, 21, 1)\n', (1128, 1138), True, 'im... |
import pandas as pd
import numpy as np
import pickle
from keras.preprocessing.text import Tokenizer
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers.embeddings import Embedding
from keras.layers.convolutional import Conv1D
from keras.layers.convolutional import MaxPooling1D... | [
"keras.layers.embeddings.Embedding",
"numpy.random.seed",
"keras.preprocessing.sequence.pad_sequences",
"keras.layers.LSTM",
"keras.layers.Flatten",
"keras.layers.convolutional.MaxPooling1D",
"keras.preprocessing.text.Tokenizer",
"numpy.array",
"numpy.arange",
"keras.callbacks.EarlyStopping",
"k... | [((572, 589), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (586, 589), True, 'import numpy as np\n'), ((605, 662), 'pandas.read_pickle', 'pd.read_pickle', (['"""data/pickles/train_after_preprocess.pkl"""'], {}), "('data/pickles/train_after_preprocess.pkl')\n", (619, 662), True, 'import pandas as pd\n'... |
from numpy.linalg import norm
from numpy import dot
def cosine_sim(vec1, vec2):
"""Calculates the cosine similarity between two vectors
Args:
vec1 (list of float): A vector
vec2 (list of float): A vector
Returns:
The cosine similarity between the two input vectors
... | [
"numpy.dot",
"numpy.linalg.norm"
] | [((338, 353), 'numpy.dot', 'dot', (['vec1', 'vec2'], {}), '(vec1, vec2)\n', (341, 353), False, 'from numpy import dot\n'), ((357, 367), 'numpy.linalg.norm', 'norm', (['vec1'], {}), '(vec1)\n', (361, 367), False, 'from numpy.linalg import norm\n'), ((370, 380), 'numpy.linalg.norm', 'norm', (['vec2'], {}), '(vec2)\n', (3... |
import cv2
import numpy as np
from elements.yolo import OBJ_DETECTION
Object_classes = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
... | [
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"elements.yolo.OBJ_DETECTION",
"cv2.rectangle",
"numpy.random.rand",
"cv2.destroyAllWindows",
"cv2.getWindowProperty",
"cv2.namedWindow"
] | [((1145, 1196), 'elements.yolo.OBJ_DETECTION', 'OBJ_DETECTION', (['"""weights/yolov5s.pt"""', 'Object_classes'], {}), "('weights/yolov5s.pt', Object_classes)\n", (1158, 1196), False, 'from elements.yolo import OBJ_DETECTION\n'), ((2131, 2165), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""1627775013.mp4"""'], {}), "('1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 26 12:25:25 2018
Toy datasets.
@author: jlsuarezdiaz
"""
import numpy as np
import pandas as pd
from six.moves import xrange
from sklearn.preprocessing import LabelEncoder
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.datasets... | [
"sklearn.datasets.load_iris",
"sklearn.datasets.load_digits",
"numpy.isin",
"numpy.abs",
"numpy.random.seed",
"numpy.empty",
"numpy.mean",
"numpy.random.randint",
"numpy.sin",
"numpy.random.randn",
"sklearn.preprocessing.LabelEncoder",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
... | [((393, 422), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(12, 9)'}), '(figsize=(12, 9))\n', (405, 422), True, 'import matplotlib.pyplot as plt\n'), ((431, 448), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (439, 448), True, 'import matplotlib.pyplot as plt\n'), ((453,... |
#!/usr/bin/env python3
"""Entropy and information theory related calculations.
**Author: <NAME>**
"""
######################## Imports ########################
import numpy as np
import stp
######################## Helper functions ########################
def _eps_filter(x):
""" Checks if the value is wi... | [
"numpy.full",
"stp.rand_p",
"numpy.log",
"stp.self_assembly_transition_matrix",
"numpy.zeros",
"stp.get_stationary_distribution",
"numpy.isclose",
"stp.complete_path_space",
"numpy.array",
"numpy.arange",
"numpy.vstack",
"numpy.dot",
"stp.step",
"numpy.unique"
] | [((2633, 2663), 'numpy.log', 'np.log', (['(p_filtered / q[p != 0])'], {}), '(p_filtered / q[p != 0])\n', (2639, 2663), True, 'import numpy as np\n'), ((2676, 2705), 'numpy.dot', 'np.dot', (['p_filtered', 'log_ratio'], {}), '(p_filtered, log_ratio)\n', (2682, 2705), True, 'import numpy as np\n'), ((4922, 4971), 'stp.get... |
import sys
sys.path.append('/usr/users/oliverren/meng/check-worthy')
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.layers import Embedding, LSTM, Bidirectional, Dropout, Dense
from keras import Sequential
from src.data import debates
import numpy as np... | [
"sys.path.append",
"keras.preprocessing.sequence.pad_sequences",
"keras.Sequential",
"numpy.asarray",
"keras.layers.Dropout",
"keras.layers.LSTM",
"sklearn.metrics.recall_score",
"keras.preprocessing.text.Tokenizer",
"src.data.debates.get_for_crossvalidation",
"keras.layers.Dense",
"sklearn.metr... | [((11, 68), 'sys.path.append', 'sys.path.append', (['"""/usr/users/oliverren/meng/check-worthy"""'], {}), "('/usr/users/oliverren/meng/check-worthy')\n", (26, 68), False, 'import sys\n'), ((561, 594), 'src.data.debates.get_for_crossvalidation', 'debates.get_for_crossvalidation', ([], {}), '()\n', (592, 594), False, 'fr... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import copy
import math
from pathlib import Path
import warnings
from typing import Callable, Tuple, Union, List
import decord
from einops.layers.torch import Rearrange
import matplotlib.pyplot as plt
import numpy ... | [
"torch.utils.data.Subset",
"os.path.join",
"torch.manual_seed",
"numpy.zeros",
"matplotlib.pyplot.subplots",
"pathlib.Path",
"torchvision.transforms.Compose",
"numpy.random.randint",
"os.path.normpath",
"warnings.warn",
"einops.layers.torch.Rearrange",
"matplotlib.pyplot.tight_layout",
"os.l... | [((3444, 3457), 'torchvision.transforms.Compose', 'Compose', (['tfms'], {}), '(tfms)\n', (3451, 3457), False, 'from torchvision.transforms import Compose\n'), ((8514, 8535), 'os.listdir', 'os.listdir', (['self.root'], {}), '(self.root)\n', (8524, 8535), False, 'import os\n'), ((17194, 17212), 'matplotlib.pyplot.tight_l... |
from __future__ import print_function
import os
import cv2
import pickle
import argparse
import numpy as np
import pandas as pd
import xml.dom.minidom
import matplotlib.pyplot as plt
from PIL import Image,ImageDraw
root_dir = "./"
#root_dir = "/home/ksuresh/fpn.pytorch-master/data/uavdt/data/VOCdevki... | [
"numpy.array",
"matplotlib.pyplot.show",
"os.listdir",
"matplotlib.pyplot.hist"
] | [((2469, 2479), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2477, 2479), True, 'import matplotlib.pyplot as plt\n'), ((2485, 2526), 'matplotlib.pyplot.hist', 'plt.hist', (['area'], {'bins': '(75)', 'range': '(0, 25000)'}), '(area, bins=75, range=(0, 25000))\n', (2493, 2526), True, 'import matplotlib.pyplot... |
import serial
import time
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from scipy.fft import fft, ifft, fftfreq
from math import pi
from scipy.signal import butter, lfilter
def avg(list):
return sum(list)/len(list)
def butter_bandpass(lowcut, highcut, fs, order=5):
nyq = 0.5 * f... | [
"serial.Serial",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"scipy.signal.welch",
"matplotlib.pyplot.plot",
"scipy.signal.lfilter",
"time.sleep",
"time.time",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.... | [((381, 421), 'scipy.signal.butter', 'butter', (['order', '[low, high]'], {'btype': '"""band"""'}), "(order, [low, high], btype='band')\n", (387, 421), False, 'from scipy.signal import butter, lfilter\n'), ((572, 591), 'scipy.signal.lfilter', 'lfilter', (['b', 'a', 'data'], {}), '(b, a, data)\n', (579, 591), False, 'fr... |
from datetime import datetime
import click
import numpy as np
import pandas
import pyarrow
import pyarrow.parquet as pq
import yaml
from cloudpathlib import AnyPath, CloudPath
from deepdiff import DeepDiff
from simple_term_menu import TerminalMenu
from tqdm import tqdm
import tempfile
TYPE_MAPPINGS = {"numeric": "byt... | [
"yaml.dump",
"click.option",
"pyarrow.Table.from_pandas",
"cloudpathlib.AnyPath",
"pandas.read_sql",
"pandas.set_option",
"tempfile.TemporaryDirectory",
"click.command",
"pyarrow.uint64",
"pyarrow.binary",
"pyarrow.bool_",
"datetime.datetime.now",
"simple_term_menu.TerminalMenu",
"tqdm.tqd... | [((414, 430), 'pyarrow.uint32', 'pyarrow.uint32', ([], {}), '()\n', (428, 430), False, 'import pyarrow\n'), ((10988, 11003), 'click.command', 'click.command', ([], {}), '()\n', (11001, 11003), False, 'import click\n'), ((11005, 11113), 'click.option', 'click.option', (['"""--subgraph-config"""'], {'help': '"""The confi... |
from collections import defaultdict
from tqdm import tqdm
import numpy as np
import gym
import wandb
import trueskill
import torch
from torch import nn
from torch.nn.utils import rnn
from ray import rllib
from pdb import set_trace as TT
import ray.rllib.agents.ppo.ppo as ppo
import ray.rllib.agents.ppo.appo as appo... | [
"trueskill.setup",
"torch.nn.Embedding",
"gym.spaces.Discrete",
"torch.cat",
"collections.defaultdict",
"neural_mmo.forge.ethyr.torch.policy.attention.DotReluBlock",
"torch.nn.ModuleDict",
"numpy.mean",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.arange",
"neural_mmo.forge.blade.io.stimulus... | [((13444, 13532), 'gym.spaces.Box', 'gym.spaces.Box', ([], {'low': '(0)', 'high': 'config.N_AGENT_OBS', 'shape': '(1,)', 'dtype': 'DataType.DISCRETE'}), '(low=0, high=config.N_AGENT_OBS, shape=(1,), dtype=DataType.\n DISCRETE)\n', (13458, 13532), False, 'import gym\n'), ((1606, 1621), 'torch.nn.ModuleDict', 'nn.Modu... |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import sys
import struct
import numpy as np
import tensorflow as tf
def lrn_f32():
para_int = []
para_float = []
# init the input data and parameters
batch = int(np.random.randint(1, high=4, size=1))
in_size_x = int(np.random.randint(16, high=32, size... | [
"numpy.random.uniform",
"numpy.transpose",
"tensorflow.nn.local_response_normalization",
"tensorflow.Session",
"numpy.random.randint",
"numpy.random.normal"
] | [((819, 895), 'numpy.random.normal', 'np.random.normal', (['zero_point', 'std', '(batch, in_size_y, in_size_x, in_channel)'], {}), '(zero_point, std, (batch, in_size_y, in_size_x, in_channel))\n', (835, 895), True, 'import numpy as np\n'), ((953, 1028), 'tensorflow.nn.local_response_normalization', 'tf.nn.local_respons... |
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from lightgbm import LGBMRegressor
pd.options.display.max_columns = 50
pd.options.display.width = 1000
training_data = pd.read_csv('training_da... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.model_selection.cross_val_score",
"numpy.zeros",
"numpy.random.random",
"matplotlib.pyplot.subplots_adjust",
"lightgbm.LGBMRegressor",
"matplotlib.pyplot.subplots"
] | [((296, 363), 'pandas.read_csv', 'pd.read_csv', (['"""training_data/covid19_measure_assessment_dataset.csv"""'], {}), "('training_data/covid19_measure_assessment_dataset.csv')\n", (307, 363), True, 'import pandas as pd\n'), ((622, 689), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'shuf... |
#!/usr/bin/env python3
import h5py
import numpy as np
import pandas as pd
import sys
import os
mtd_prefix = """
{
"data_type": "matrix",
"value_type": "double",
"""
mtd_suffix = """
"format": "csv",
"header": false,
"sep": ","
}
"""
if len(sys.argv) < 3:
print("usage: " + sys.argv[0] +... | [
"pandas.DataFrame",
"h5py.File",
"numpy.moveaxis",
"numpy.mean",
"numpy.array",
"sys.exit"
] | [((810, 836), 'h5py.File', 'h5py.File', (['input_file', '"""r"""'], {}), "(input_file, 'r')\n", (819, 836), False, 'import h5py\n'), ((937, 959), 'numpy.array', 'np.array', (['fid[dataset]'], {}), '(fid[dataset])\n', (945, 959), True, 'import numpy as np\n'), ((1328, 1344), 'pandas.DataFrame', 'pd.DataFrame', (['ds'], ... |
import inspect
from typing import Union, Any, Callable, Iterable, Tuple, Sequence
import torch
import numpy as np
def bifurcate(x: Iterable, lhs: Callable[[Any], bool]) -> Tuple[list, list]:
"""
Split an iterable into two lists depending on a condition.
:param x: An iterable.
:param lhs: A function... | [
"numpy.where",
"torch.empty",
"torch.cat",
"inspect.signature"
] | [((2036, 2059), 'torch.cat', 'torch.cat', (['out', 'cat_dim'], {}), '(out, cat_dim)\n', (2045, 2059), False, 'import torch\n'), ((1807, 1825), 'torch.empty', 'torch.empty', (['shape'], {}), '(shape)\n', (1818, 1825), False, 'import torch\n'), ((2317, 2330), 'numpy.where', 'np.where', (['arr'], {}), '(arr)\n', (2325, 23... |
import copy
import os
import numpy as np
from hexrd.config.root import RootConfig
from hexrd.config.material import MaterialConfig
from hexrd.config.instrument import Instrument as InstrumentConfig
from hexrd.ui.create_hedm_instrument import create_hedm_instrument
from hexrd.ui.hexrd_config import HexrdConfig
from h... | [
"hexrd.ui.create_hedm_instrument.create_hedm_instrument",
"hexrd.config.material.MaterialConfig",
"numpy.degrees",
"os.getcwd",
"hexrd.ui.utils.is_omega_imageseries",
"hexrd.ui.hexrd_config.HexrdConfig",
"hexrd.config.root.RootConfig",
"hexrd.config.instrument.Instrument"
] | [((1227, 1254), 'hexrd.config.root.RootConfig', 'RootConfig', (['indexing_config'], {}), '(indexing_config)\n', (1237, 1254), False, 'from hexrd.config.root import RootConfig\n'), ((1309, 1333), 'hexrd.config.instrument.Instrument', 'InstrumentConfig', (['config'], {}), '(config)\n', (1325, 1333), True, 'from hexrd.con... |
from multiprocessing import Pool
import pandas as pd
from functools import partial
import numpy as np
from tqdm import tqdm
def inductive_pooling(df, embeddings, G, workers, gamma=1000, dict_node=None, average_embedding=True):
if average_embedding:
avg_emb = embeddings.mean().values
else:
... | [
"numpy.array_split",
"functools.partial",
"multiprocessing.Pool"
] | [((384, 397), 'multiprocessing.Pool', 'Pool', (['workers'], {}), '(workers)\n', (388, 397), False, 'from multiprocessing import Pool\n'), ((422, 513), 'functools.partial', 'partial', (['inductive_pooling_chunk'], {'embeddings': 'embeddings', 'G': 'G', 'average_embedding': 'avg_emb'}), '(inductive_pooling_chunk, embeddi... |
import matplotlib.pyplot as plt
import numpy as np
from numpy import pi
import pandas as pd
from scripts.volatility_tree import build_volatility_tree
from scripts.profiler import profiler
i = complex(0, 1)
# option parameters
T = 1
H_original = 90 # limit
K_original = 100.0 # strike
r_premia = 10 # annu... | [
"numpy.fft.ifft",
"scripts.profiler.profiler",
"matplotlib.pyplot.show",
"numpy.log",
"matplotlib.pyplot.plot",
"scripts.volatility_tree.build_volatility_tree",
"matplotlib.pyplot.close",
"numpy.fft.fft",
"numpy.power",
"numpy.fft.fftshift",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"n... | [((819, 845), 'numpy.log', 'np.log', (['(r_premia / 100 + 1)'], {}), '(r_premia / 100 + 1)\n', (825, 845), True, 'import numpy as np\n'), ((906, 965), 'numpy.linspace', 'np.linspace', (['(-M * dx / 2)', '(M * dx / 2)'], {'num': 'M', 'endpoint': '(False)'}), '(-M * dx / 2, M * dx / 2, num=M, endpoint=False)\n', (917, 96... |
import json
import os
import random
from pathlib import Path
from typing import Optional, List, Dict
import cherrypy
import numpy as np
import psutil
import yaml
from app.emotions import predict_topk_emotions, EMOTIONS, get_fonts
from app.features import extract_audio_features
from app.keywords import predict_keyword... | [
"os.remove",
"cherrypy.expose",
"os.getpid",
"cherrypy.engine.start",
"json.dumps",
"cherrypy.config.update",
"cherrypy.engine.block",
"random.randrange",
"numpy.array",
"app.features.extract_audio_features",
"app.emotions.get_fonts",
"os.path.join",
"cherrypy.engine.stop"
] | [((968, 979), 'os.getpid', 'os.getpid', ([], {}), '()\n', (977, 979), False, 'import os\n'), ((1110, 1147), 'cherrypy.expose', 'cherrypy.expose', (['METHOD_NAME_EMOTIONS'], {}), '(METHOD_NAME_EMOTIONS)\n', (1125, 1147), False, 'import cherrypy\n'), ((1622, 1656), 'cherrypy.expose', 'cherrypy.expose', (['METHOD_NAME_FON... |
import matplotlib.pyplot as plt
import pylab
import numpy as N
import scipy.io as sio
import math
from pyfmi import load_fmu
fmu_loc = '/home/shashank/Documents/Gap Year Work/TAMU_ROVm/ROVm/Resources/FMU/'
fmu_sm_name = 'SimplifiedBlueROV2.fmu'
fmu_fm_name = 'InputBasedBlueROV2.fmu'
fmu_full_sm_name = fmu_lo... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.plot",
"scipy.io.loadmat",
"matplotlib.pyplot.legend",
"math.floor",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"pyfmi.load_fmu",
"matplotlib.pyplot.grid",
"numpy.vstack",
"matplotlib.pyplot.xlabel"
] | [((389, 415), 'pyfmi.load_fmu', 'load_fmu', (['fmu_full_sm_name'], {}), '(fmu_full_sm_name)\n', (397, 415), False, 'from pyfmi import load_fmu\n'), ((427, 453), 'pyfmi.load_fmu', 'load_fmu', (['fmu_full_fm_name'], {}), '(fmu_full_fm_name)\n', (435, 453), False, 'from pyfmi import load_fmu\n'), ((936, 961), 'scipy.io.lo... |
import sys
import os
import sklearn
from sklearn.decomposition import TruncatedSVD
# give this a different alias so that it does not conflict with SPACY
from sklearn.externals import joblib as sklearn_joblib
import data_io, params, SIF_embedding
from SIF_embedding import get_weighted_average
# helper for word2vec fo... | [
"past.builtins.xrange",
"SIF_embedding.get_weighted_average",
"numpy.count_nonzero",
"sklearn.decomposition.TruncatedSVD",
"data_io.load_glove_word_map",
"data_io_w2v.load_w2v_word_map",
"data_io.seq2weight",
"numpy.zeros",
"data_io.sentences2idx"
] | [((2442, 2476), 'numpy.zeros', 'np.zeros', (['(n_samples, We.shape[1])'], {}), '((n_samples, We.shape[1]))\n', (2450, 2476), True, 'import numpy as np\n'), ((2490, 2507), 'past.builtins.xrange', 'xrange', (['n_samples'], {}), '(n_samples)\n', (2496, 2507), False, 'from past.builtins import xrange\n'), ((2525, 2550), 'n... |
# coding=utf8
# This code is adapted from the https://github.com/tensorflow/models/tree/master/official/r1/resnet.
# ==========================================================================================
# NAVER’s modifications are Copyright 2020 NAVER corp. All rights reserved.
# ==================================... | [
"numpy.sum",
"tensorflow.logging.info",
"numpy.argmax",
"tensorflow.local_variables_initializer",
"os.path.join",
"tensorflow.estimator.export.TensorServingInputReceiver",
"tensorflow.placeholder",
"tensorflow.map_fn",
"functools.partial",
"numpy.fill_diagonal",
"tensorflow.global_variables_init... | [((1436, 1510), 'tensorflow.data.Dataset.list_files', 'tf.data.Dataset.list_files', (["(flags_obj.data_dir + '/' + flags_obj.val_regex)"], {}), "(flags_obj.data_dir + '/' + flags_obj.val_regex)\n", (1462, 1510), True, 'import tensorflow as tf\n'), ((2116, 2162), 'functions.data_config.get_config', 'data_config.get_conf... |
import cv2 as cv
import numpy as np
# https://docs.opencv.org/4.2.0/d7/dfc/group__highgui.html
def white_balance(img):
result = cv.cvtColor(img, cv.COLOR_BGR2LAB)
avg_a = np.average(result[:, :, 1])
avg_b = np.average(result[:, :, 2])
result[:, :, 1] = result[:, :, 1] - ((avg_a - 128) * (result[:, :, ... | [
"numpy.average",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.merge",
"cv2.imread",
"cv2.namedWindow",
"cv2.split",
"cv2.moveWindow",
"cv2.imshow",
"cv2.resize"
] | [((499, 523), 'cv2.namedWindow', 'cv.namedWindow', (['"""webcam"""'], {}), "('webcam')\n", (513, 523), True, 'import cv2 as cv\n'), ((524, 553), 'cv2.moveWindow', 'cv.moveWindow', (['"""webcam"""', '(0)', '(0)'], {}), "('webcam', 0, 0)\n", (537, 553), True, 'import cv2 as cv\n'), ((555, 574), 'cv2.namedWindow', 'cv.nam... |
import numpy as np
import math
from geofractal import *
#-------------------------------------------------------
# Fractal dimension
#-------------------------------------------------------
df = 1.8
#-------------------------------------------------------
# Fractal prefactor
#--------------------------------------... | [
"math.log",
"numpy.zeros",
"numpy.sqrt"
] | [((829, 840), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (837, 840), True, 'import numpy as np\n'), ((375, 387), 'numpy.sqrt', 'np.sqrt', (['(3.0)'], {}), '(3.0)\n', (382, 387), True, 'import numpy as np\n'), ((788, 802), 'math.log', 'math.log', (['Nmin'], {}), '(Nmin)\n', (796, 802), False, 'import math\n'), ((8... |
"""
A Maximum-Entropy model for backbone torsion angles.
Reference: Rowicka and Otwinowski 2004
"""
import numpy
from csb.statistics.pdf import BaseDensity
class MaxentModel(BaseDensity):
"""
Fourier expansion of a biangular log-probability density
"""
def __init__(self, n, beta=1.):
"""
... | [
"numpy.sum",
"csb.numeric.log",
"numpy.zeros",
"numpy.max",
"numpy.multiply.outer",
"numpy.arange",
"numpy.reshape",
"numpy.array",
"scipy.integrate.dblquad",
"numpy.linspace",
"numpy.dot",
"numpy.random.standard_normal",
"numpy.add.outer",
"os.path.expanduser",
"csb.io.load",
"csb.num... | [((566, 597), 'numpy.zeros', 'numpy.zeros', (['(self._n, self._n)'], {}), '((self._n, self._n))\n', (577, 597), False, 'import numpy\n'), ((617, 648), 'numpy.zeros', 'numpy.zeros', (['(self._n, self._n)'], {}), '((self._n, self._n))\n', (628, 648), False, 'import numpy\n'), ((668, 699), 'numpy.zeros', 'numpy.zeros', ([... |
#!/usr/bin/env python
""" Calculates a lookup table with optimal switching times for an isolated matrix-type DAB three-phase rectifier.
This file calculates a 3D lookup table of relative switching times for an IMDAB3R, which are optimized for minimal
conduction losses. In discontinuous conduction mode (DCM) analytical... | [
"sys.stdout.write",
"numpy.abs",
"csv_io.export_csv",
"argparse.ArgumentParser",
"hw_functions.rms_current_grad",
"numpy.clip",
"hw_functions.dab_io_currents",
"sys.stdout.flush",
"scipy.optimize.fmin_slsqp",
"time.clock",
"numpy.max",
"numpy.linspace",
"hw_functions.rms_current_harm",
"nu... | [((955, 982), 'numpy.clip', 'np.clip', (['shift', '(-0.25)', '(0.25)'], {}), '(shift, -0.25, 0.25)\n', (962, 982), True, 'import numpy as np\n'), ((1012, 1033), 'numpy.clip', 'np.clip', (['d_dc', '(0)', '(0.5)'], {}), '(d_dc, 0, 0.5)\n', (1019, 1033), True, 'import numpy as np\n'), ((1345, 1438), 'numpy.array', 'np.arr... |
import unittest
import numpy
from chainer import cuda
from chainer import testing
from chainer.testing import attr
from chainer import utils
class TestWalkerAlias(unittest.TestCase):
def setUp(self):
self.ps = numpy.array([5, 3, 4, 1, 2], dtype=numpy.int32)
self.sampler = utils.WalkerAlias(self... | [
"chainer.testing.assert_allclose",
"chainer.utils.WalkerAlias",
"chainer.cuda.to_cpu",
"numpy.array",
"chainer.testing.run_module"
] | [((1059, 1097), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (1077, 1097), False, 'from chainer import testing\n'), ((227, 274), 'numpy.array', 'numpy.array', (['[5, 3, 4, 1, 2]'], {'dtype': 'numpy.int32'}), '([5, 3, 4, 1, 2], dtype=numpy.int32)\n', (238,... |
# -*- coding: utf-8 -*-
import os, jinja2
import numpy as np
import scipy.optimize
from ..util import functions as f
from ..util import tools, constants
# see README for terminology, terminolology, lol
class Vertex():
""" point with an index that's used in block and face definition
and can output in OpenFOAM ... | [
"numpy.shape",
"numpy.array",
"numpy.concatenate"
] | [((383, 398), 'numpy.array', 'np.array', (['point'], {}), '(point)\n', (391, 398), True, 'import numpy as np\n'), ((1708, 1724), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (1716, 1724), True, 'import numpy as np\n'), ((1741, 1757), 'numpy.shape', 'np.shape', (['points'], {}), '(points)\n', (1749, 1757),... |
import numpy as np
from matplotlib import image as mimage
from time import time
class Timer(object):
"""A simple timer context-manager, taken from
https://blog.usejournal.com/how-to-create-your-own-timing-context-manager-in-python-a0e944b48cf8
"""
def __init__(self, description):
self.descri... | [
"numpy.dot",
"matplotlib.image.imread",
"numpy.max",
"time.time"
] | [((906, 950), 'numpy.dot', 'np.dot', (['rgb[..., :3]', '[0.2989, 0.587, 0.114]'], {}), '(rgb[..., :3], [0.2989, 0.587, 0.114])\n', (912, 950), True, 'import numpy as np\n'), ((1416, 1439), 'matplotlib.image.imread', 'mimage.imread', (['filename'], {}), '(filename)\n', (1429, 1439), True, 'from matplotlib import image a... |
import numpy as np
import pandas as pd
from scipy import interpolate
from .Constants import *
from .AtomicData import *
from .Conversions import *
##########################
# Taken from: https://stackoverflow.com/questions/779495/python-access-data-in-package-subdirectory
# This imports the file 'PREM500.csv' withi... | [
"pandas.read_csv",
"numpy.asarray",
"scipy.interpolate.interp1d",
"os.path.split",
"os.path.join"
] | [((409, 432), 'os.path.split', 'os.path.split', (['__file__'], {}), '(__file__)\n', (422, 432), False, 'import os\n'), ((580, 621), 'os.path.join', 'os.path.join', (['this_dir', '"""PREM500_Mod.csv"""'], {}), "(this_dir, 'PREM500_Mod.csv')\n", (592, 621), False, 'import os\n'), ((642, 686), 'os.path.join', 'os.path.joi... |
#!/usr/bin/env python
# <examples/doc_nistgauss2.py>
import matplotlib.pyplot as plt
import numpy as np
from lmfit.models import ExponentialModel, GaussianModel
dat = np.loadtxt('NIST_Gauss2.dat')
x = dat[:, 1]
y = dat[:, 0]
exp_mod = ExponentialModel(prefix='exp_')
gauss1 = GaussianModel(prefix='g1_')
gauss2 = Gau... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.where",
"numpy.loadtxt",
"lmfit.models.GaussianModel",
"lmfit.models.ExponentialModel"
] | [((170, 199), 'numpy.loadtxt', 'np.loadtxt', (['"""NIST_Gauss2.dat"""'], {}), "('NIST_Gauss2.dat')\n", (180, 199), True, 'import numpy as np\n'), ((239, 270), 'lmfit.models.ExponentialModel', 'ExponentialModel', ([], {'prefix': '"""exp_"""'}), "(prefix='exp_')\n", (255, 270), False, 'from lmfit.models import Exponentia... |
import librosa
import librosa.display
import matplotlib.pyplot as plt
import numpy as np
import torch
from tqdm import tqdm
from trainer.base_trainer import BaseTrainer
from util.utils import compute_SDR
plt.switch_backend('agg')
class Trainer(BaseTrainer):
def __init__(self, config, resume: boo... | [
"matplotlib.pyplot.switch_backend",
"matplotlib.pyplot.tight_layout",
"tqdm.tqdm",
"numpy.sum",
"librosa.display.waveplot",
"numpy.std",
"torch.split",
"torch.cat",
"numpy.max",
"numpy.mean",
"numpy.min",
"librosa.amplitude_to_db",
"util.utils.compute_SDR",
"torch.no_grad",
"matplotlib.p... | [((218, 243), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (236, 243), True, 'import matplotlib.pyplot as plt\n'), ((2571, 2586), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2584, 2586), False, 'import torch\n'), ((804, 848), 'tqdm.tqdm', 'tqdm', (['self.train_dat... |
'''
Copyright 2015 by <NAME>
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: <NAME>
This example implements the Rosenbrock function into SPOT.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode... | [
"spotpy.parameter.List",
"spotpy.parameter.generate",
"numpy.sin",
"numpy.array",
"spotpy.algorithms.mc",
"spotpy.objectivefunctions.rmse"
] | [((1669, 1701), 'spotpy.algorithms.mc', 'spotpy.algorithms.mc', (['spot_setup'], {}), '(spot_setup)\n', (1689, 1701), False, 'import spotpy\n'), ((778, 816), 'spotpy.parameter.generate', 'spotpy.parameter.generate', (['self.params'], {}), '(self.params)\n', (803, 816), False, 'import spotpy\n'), ((869, 885), 'numpy.arr... |
import Nn
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from utils.tf2_utils import show_graph, get_TensorSpecs, gaussian_clip_rsample, gaussian_likelihood_sum, gaussian_entropy
from Algorithms.tf2algos.base.on_policy import On_Policy
class PPO(On_Policy):
'''
Proximal Policy... | [
"Nn.critic_v",
"tensorflow.reduce_sum",
"tensorflow.clip_by_value",
"tensorflow.maximum",
"numpy.ones",
"Nn.actor_mu",
"tensorflow.nn.log_softmax",
"tensorflow_probability.distributions.Categorical",
"tensorflow.minimum",
"tensorflow.exp",
"utils.tf2_utils.gaussian_entropy",
"tensorflow.reduce... | [((10804, 10847), 'tensorflow.function', 'tf.function', ([], {'experimental_relax_shapes': '(True)'}), '(experimental_relax_shapes=True)\n', (10815, 10847), True, 'import tensorflow as tf\n'), ((13473, 13516), 'tensorflow.function', 'tf.function', ([], {'experimental_relax_shapes': '(True)'}), '(experimental_relax_shap... |
import sys
import os
import numpy as np
from pprint import pprint
from datetime import datetime
from datetime import timedelta
import mysql.connector
import math
import matplotlib.pyplot as plt
from scipy import stats
#database connection
cnx = mysql.connector.connect(user='root', password='<PASSWORD>', host='localhos... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.subplot2grid",
"numpy.isnan",
"datetime.datetime.utcfromtimestamp",
"matplotlib.pyplot.figure",
"numpy.array",
"scipy.stats.linregress",
"matplotlib.pyplot.subplots_adjust",
"os.chdir",
"matplotlib.pyplot.savefig"
] | [((1869, 1886), 'numpy.array', 'np.array', (['Cont_co'], {}), '(Cont_co)\n', (1877, 1886), True, 'import numpy as np\n'), ((1894, 1911), 'numpy.array', 'np.array', (['Cont_bc'], {}), '(Cont_bc)\n', (1902, 1911), True, 'import numpy as np\n'), ((2024, 2064), 'scipy.stats.linregress', 'stats.linregress', (['varx[mask]', ... |
# Lint as: python3
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"tensorflow.test.main",
"pyiree.tf.support.tf_test_utils.compile_tf_module",
"tensorflow.keras.losses.MeanSquaredError",
"pyiree.tf.support.tf_utils.set_random_seed",
"tensorflow.keras.layers.Dense",
"tensorflow.enable_v2_behavior",
"numpy.random.randn",
"tensorflow.keras.optimizers.get",
"numpy.exp... | [((852, 972), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""optimizer_name"""', '"""sgd"""', '"""optimizer name: sgd, rmsprop, nadam, adamax, adam, adagrad, adadelta"""'], {}), "('optimizer_name', 'sgd',\n 'optimizer name: sgd, rmsprop, nadam, adamax, adam, adagrad, adadelta')\n", (871, 972), False, 'from... |
import io
import gc
import traceback
import subprocess
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from fastprogress.fastprogress import master_bar, progress_bar
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
import albumentat... | [
"albumentations.pytorch.ToTensorV2",
"albumentations.NoOp",
"io.BytesIO",
"traceback.print_exc",
"torch.utils.data.DataLoader",
"subprocess.check_output",
"torch.load",
"fastprogress.fastprogress.progress_bar",
"torch.save",
"gc.collect",
"numpy.min",
"numpy.max",
"torch.cuda.empty_cache",
... | [((891, 917), 'torch.save', 'torch.save', (['self', 'filename'], {}), '(self, filename)\n', (901, 917), False, 'import torch\n'), ((2098, 2106), 'albumentations.NoOp', 'A.NoOp', ([], {}), '()\n', (2104, 2106), True, 'import albumentations as A\n'), ((2519, 2527), 'albumentations.NoOp', 'A.NoOp', ([], {}), '()\n', (2525... |
"""
This module is used to display the Density of States (DoS).
"""
from futile.Utils import write as safe_print
AU_eV = 27.21138386
class DiracSuperposition():
"""
Defines as superposition of Dirac deltas which can be used to
plot the density of states
"""
def __init__(self, dos, wgts=[1.0]):
... | [
"numpy.abs",
"numpy.ravel",
"matplotlib.pyplot.axes",
"matplotlib.widgets.Slider",
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.axvline",
"futile.Figures.VertSlider",
"numpy.max",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",... | [((14705, 16163), 'numpy.array', 'np.array', (['[-0.815924953235059, -0.803163374736654, -0.780540200987971, -\n 0.7508806541364, -0.723626807289917, -0.714924448617026, -\n 0.710448085701742, -0.68799028016451, -0.67247569974853, -\n 0.659038909236607, -0.625396293324399, -0.608009041659988, -\n 0.56533791... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import vaex.dataset as dataset
import numpy as np
import unittest
import vaex as vx
import tempfile
import vaex.server.tornado_server
import astropy.io.fits
import astropy.units
import pandas as pd
import vaex.execution
import contextlib
a = vaex.e... | [
"vaex.dataset.select",
"os.remove",
"vaex.dataset.length_original",
"numpy.random.seed",
"numpy.sum",
"vaex.from_scalars",
"vaex.server",
"numpy.ones",
"vaex.set_log_level_exception",
"vaex.dataset.set_current_row",
"numpy.isnan",
"vaex.dataset.DatasetArrays",
"numpy.arange",
"numpy.random... | [((399, 424), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (414, 424), False, 'import os\n'), ((1216, 1244), 'vaex.set_log_level_exception', 'vx.set_log_level_exception', ([], {}), '()\n', (1242, 1244), True, 'import vaex as vx\n'), ((71768, 71783), 'unittest.main', 'unittest.main', ([], {}... |
import numpy as np
import pytest
import torch
from torch.utils.data import TensorDataset
from doppelganger import (ContinuousOutput, DGTorch, DiscreteOutput,
Normalization, Output, OutputType, prepare_data)
@pytest.fixture
def dg_model() -> DGTorch:
attribute_outputs = [
Continu... | [
"doppelganger.DGTorch",
"doppelganger.prepare_data",
"doppelganger.ContinuousOutput",
"pytest.raises",
"doppelganger.DiscreteOutput",
"torch.Tensor",
"numpy.random.randint",
"numpy.random.rand",
"doppelganger.Output"
] | [((918, 972), 'doppelganger.DGTorch', 'DGTorch', (['attribute_outputs', '[]', 'feature_outputs', '(20)', '(5)'], {}), '(attribute_outputs, [], feature_outputs, 20, 5)\n', (925, 972), False, 'from doppelganger import ContinuousOutput, DGTorch, DiscreteOutput, Normalization, Output, OutputType, prepare_data\n'), ((1875, ... |
from flask import render_template, jsonify
from app import app
import random
import io
from flask import Response
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as ti... | [
"os.remove",
"matplotlib.dates.MonthLocator",
"numpy.amin",
"pandas.read_csv",
"os.path.isfile",
"flask.jsonify",
"matplotlib.pyplot.figure",
"random.randint",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"matplotlib.dates.DateFormatter",
"flask.render_template",
"matplotlib.pyplot.subpl... | [((593, 625), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (623, 625), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((883, 905), 'pandas.read_csv', 'pd.read_csv', (['"""DIS.csv"""'], {}), "('DIS.csv')\n", (894, 905), True, 'import panda... |
import h5py
import numpy as np
from sklearn import svm
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.utils import shuffle
rbfSigma = 0.1
def readFile(filename):
with h5py.File(filename, 'r') as f:
a_group... | [
"matplotlib.pyplot.title",
"numpy.absolute",
"sklearn.preprocessing.StandardScaler",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"numpy.mean",
"matplotlib.pyplot.contourf",
"numpy.arange",
"sklearn.svm.SVC",
"numpy.copy",
"numpy.power",
"numpy.append",
"h5py.File",
"matplot... | [((685, 721), 'numpy.zeros', 'np.zeros', (['(X1.shape[0], X2.shape[0])'], {}), '((X1.shape[0], X2.shape[0]))\n', (693, 721), True, 'import numpy as np\n'), ((1002, 1038), 'numpy.zeros', 'np.zeros', (['(X1.shape[0], X2.shape[0])'], {}), '((X1.shape[0], X2.shape[0]))\n', (1010, 1038), True, 'import numpy as np\n'), ((327... |
import torch
import numpy as np
def suit4pytorch(X, Y):
X = np.swapaxes(X, 1, 3)
X_norm = X/255
X_torch = torch.from_numpy(X_norm).float()
Y_torch = torch.from_numpy(Y).long()
return X_torch, Y_torch
| [
"numpy.swapaxes",
"torch.from_numpy"
] | [((66, 86), 'numpy.swapaxes', 'np.swapaxes', (['X', '(1)', '(3)'], {}), '(X, 1, 3)\n', (77, 86), True, 'import numpy as np\n'), ((120, 144), 'torch.from_numpy', 'torch.from_numpy', (['X_norm'], {}), '(X_norm)\n', (136, 144), False, 'import torch\n'), ((167, 186), 'torch.from_numpy', 'torch.from_numpy', (['Y'], {}), '(Y... |
#needs pytorch_transformers version 1.2.0
#!/usr/bin/env python
# coding: utf-8
import argparse
import re
import os
import _pickle as cPickle
import numpy as np
import pandas as pd
import torch
from pytorch_transformers.tokenization_bert import BertTokenizer
def assert_eq(real, expected):
assert real == expected,... | [
"argparse.ArgumentParser",
"pandas.read_csv",
"pytorch_transformers.tokenization_bert.BertTokenizer.from_pretrained",
"numpy.array",
"torch.from_numpy"
] | [((2052, 2077), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2075, 2077), False, 'import argparse\n'), ((3632, 3717), 'pytorch_transformers.tokenization_bert.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['args.bert_model'], {'do_lower_case': 'args.do_lower_case'}), '(arg... |
from compas import PRECISION
class SmoothUnion(object):
"""The smooth union between two volumetric objects.
Parameters
----------
a: volumetric object
First object to add.
b: volumetric object
Second object to add.
r: float
Intensity factor, the higher the number, the ... | [
"compas_vol.primitives.VolSphere",
"matplotlib.pyplot.show",
"numpy.maximum",
"compas.geometry.Point",
"numpy.tanh",
"compas_vol.primitives.VolBox",
"compas.geometry.Frame.worldXY"
] | [((2149, 2161), 'compas_vol.primitives.VolSphere', 'VolSphere', (['s'], {}), '(s)\n', (2158, 2161), False, 'from compas_vol.primitives import VolSphere, VolBox\n'), ((2171, 2185), 'compas_vol.primitives.VolBox', 'VolBox', (['b', '(2.5)'], {}), '(b, 2.5)\n', (2177, 2185), False, 'from compas_vol.primitives import VolSph... |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""
Quantum tomography fitter data formatting.
"""
import logging
import itertools as it
import numpy as np
from scipy impo... | [
"numpy.conj",
"numpy.sum",
"qiskit.QiskitError",
"numpy.zeros",
"numpy.vstack",
"numpy.array",
"scipy.linalg.eigh",
"numpy.kron",
"itertools.product",
"numpy.eye",
"logging.getLogger",
"numpy.sqrt"
] | [((492, 519), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (509, 519), False, 'import logging\n'), ((5869, 5883), 'numpy.sum', 'np.sum', (['counts'], {}), '(counts)\n', (5875, 5883), True, 'import numpy as np\n'), ((6636, 6688), 'numpy.sqrt', 'np.sqrt', (['(shots / (freqs_hedged * (1 - ... |
import unittest
import numpy as np
from texar.torch.run.metric.summary import *
class RegressionMetricTest(unittest.TestCase):
def setUp(self) -> None:
self.n_examples = 100
self.batch_size = 2
self.values = np.random.randn(self.n_examples)
def test_running_average(self):
qu... | [
"numpy.random.randn"
] | [((240, 272), 'numpy.random.randn', 'np.random.randn', (['self.n_examples'], {}), '(self.n_examples)\n', (255, 272), True, 'import numpy as np\n')] |
from logging import getLogger
import numpy as np
from imblearn.over_sampling import SMOTE
from sklearn.base import clone
from ..utils import augmented_rvalue, BaseTransformer
class MOS(BaseTransformer):
"""Perform Minimizing Overlapping Selection under SMOTE (MOSS) or under
No-Sampling (MOSNS) algorithm.
... | [
"numpy.abs",
"numpy.arange",
"imblearn.over_sampling.SMOTE",
"sklearn.base.clone",
"logging.getLogger"
] | [((2738, 2764), 'numpy.arange', 'np.arange', (['(0.01)', '(0.2)', '(0.01)'], {}), '(0.01, 0.2, 0.01)\n', (2747, 2764), True, 'import numpy as np\n'), ((4274, 4291), 'sklearn.base.clone', 'clone', (['self.model'], {}), '(self.model)\n', (4279, 4291), False, 'from sklearn.base import clone\n'), ((5166, 5179), 'numpy.abs'... |
import pylab as p
from flask import Blueprint,render_template,request
from flask_login import login_required, current_user
from . import db
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
import cv2
main=Blueprint('main',__name__)
model=load_model('D:\Shubham\Al... | [
"keras.models.load_model",
"numpy.stack",
"flask.Blueprint",
"numpy.argmax",
"cv2.imread",
"numpy.array",
"keras.preprocessing.image.astype",
"keras.preprocessing.image.reshape",
"flask.render_template",
"cv2.resize"
] | [((259, 286), 'flask.Blueprint', 'Blueprint', (['"""main"""', '__name__'], {}), "('main', __name__)\n", (268, 286), False, 'from flask import Blueprint, render_template, request\n'), ((295, 361), 'keras.models.load_model', 'load_model', (['"""D:\\\\Shubham\\\\Alzhiemer-Prediction\\\\project\\\\model.h5"""'], {}), "('D:... |
# <Copyright 2019, Argo AI, LLC. Released under the MIT license.>
from typing import List, Optional
import numpy as np
from argoverse.utils import mayavi_wrapper
from argoverse.utils.mesh_grid import get_mesh_grid_as_point_cloud
from argoverse.visualization.mayavi_utils import (
Figure,
draw_mayavi_line_segm... | [
"argoverse.utils.mayavi_wrapper.mlab.show",
"argoverse.visualization.mayavi_utils.plot_3d_clipped_bbox_mayavi",
"argoverse.utils.mayavi_wrapper.mlab.view",
"argoverse.utils.mayavi_wrapper.mlab.figure",
"numpy.zeros",
"numpy.cross",
"numpy.argmin",
"numpy.where",
"numpy.array",
"argoverse.visualiza... | [((935, 1002), 'argoverse.utils.mesh_grid.get_mesh_grid_as_point_cloud', 'get_mesh_grid_as_point_cloud', (['(-20)', '(20)', '(0)', '(40)'], {'downsample_factor': '(0.1)'}), '(-20, 20, 0, 40, downsample_factor=0.1)\n', (963, 1002), False, 'from argoverse.utils.mesh_grid import get_mesh_grid_as_point_cloud\n'), ((1027, 1... |
import numpy as np
from pyloras._common import (
check_random_state,
safe_random_state,
)
def test_check_random_state():
rand = np.random.RandomState(12345)
assert isinstance(check_random_state(rand), np.random.Generator)
gen = np.random.default_rng(12345)
assert isinstance(check_random_state... | [
"numpy.random.default_rng",
"pyloras._common.check_random_state",
"numpy.random.RandomState",
"pyloras._common.safe_random_state"
] | [((143, 171), 'numpy.random.RandomState', 'np.random.RandomState', (['(12345)'], {}), '(12345)\n', (164, 171), True, 'import numpy as np\n'), ((251, 279), 'numpy.random.default_rng', 'np.random.default_rng', (['(12345)'], {}), '(12345)\n', (272, 279), True, 'import numpy as np\n'), ((391, 419), 'numpy.random.RandomStat... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['say_hello', 'HelloSayer', 'bubble_scatter']
# Cell
import numpy as np
import matplotlib.pyplot as plt
# Cell
def say_hello(to):
"Say hello to anybody"
return f'Hello {to}!'
# Cell
class HelloSayer:
"Say h... | [
"numpy.random.rand",
"matplotlib.pyplot.scatter",
"numpy.random.seed",
"matplotlib.pyplot.show"
] | [((526, 550), 'numpy.random.seed', 'np.random.seed', (['(19680801)'], {}), '(19680801)\n', (540, 550), True, 'import numpy as np\n'), ((557, 574), 'numpy.random.rand', 'np.random.rand', (['n'], {}), '(n)\n', (571, 574), True, 'import numpy as np\n'), ((581, 598), 'numpy.random.rand', 'np.random.rand', (['n'], {}), '(n)... |
import os
import html
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.linear_model import LogisticRegression
def train_with_reg_cv(trX, trY, vaX, vaY, teX=None, teY=None, penalty='l1',
C=2 ** np.arange(-8, 1).astype(np.float), seed=42):
scores = []
for i, c in... | [
"html.unescape",
"numpy.sum",
"numpy.argmax",
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"numpy.arange",
"os.path.join"
] | [((659, 683), 'numpy.sum', 'np.sum', (['(model.coef_ != 0)'], {}), '(model.coef_ != 0)\n', (665, 683), True, 'import numpy as np\n'), ((898, 915), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (909, 915), True, 'import pandas as pd\n'), ((1771, 1790), 'html.unescape', 'html.unescape', (['text'], {}), '(... |
from __future__ import annotations
import logging
from math import floor, sqrt
import numpy as np
from numpy.linalg import inv, norm
from cctbx.array_family import flex
from dxtbx import flumpy
from scitbx import matrix
from dials.algorithms.profile_model.ellipsoid import chisq_quantile
from dials.algorithms.statis... | [
"cctbx.array_family.flex.sqrt",
"cctbx.array_family.flex.sum",
"cctbx.array_family.flex.abs",
"dials.algorithms.statistics.fast_mcd.FastMCD",
"math.floor",
"dials.algorithms.profile_model.ellipsoid.chisq_quantile",
"cctbx.array_family.flex.vec3_double",
"numpy.linalg.norm",
"numpy.linalg.inv",
"dx... | [((373, 399), 'logging.getLogger', 'logging.getLogger', (['"""dials"""'], {}), "('dials')\n", (390, 399), False, 'import logging\n'), ((711, 719), 'numpy.linalg.norm', 'norm', (['s0'], {}), '(s0)\n', (715, 719), False, 'from numpy.linalg import inv, norm\n'), ((1020, 1033), 'cctbx.array_family.flex.size_t', 'flex.size_... |
#!/usr/bin/env python
import wfdb
import hmm
import numpy as np
import matplotlib.pyplot as plt
import pickle
def preprocess(count = 30):
print("Preprocessing")
sig, fields = wfdb.srdsamp('data/mitdb/100')
ecg = sig[:500000,0]
diff = np.diff(ecg)
emax = np.max(ecg)
emin = np.min(ecg)
co... | [
"matplotlib.pyplot.subplot",
"pickle.dump",
"hmm.probabilities",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.ion",
"numpy.max",
"numpy.diff",
"numpy.min",
"hmm.random_model",
"hmm.synt... | [((186, 216), 'wfdb.srdsamp', 'wfdb.srdsamp', (['"""data/mitdb/100"""'], {}), "('data/mitdb/100')\n", (198, 216), False, 'import wfdb\n'), ((254, 266), 'numpy.diff', 'np.diff', (['ecg'], {}), '(ecg)\n', (261, 266), True, 'import numpy as np\n'), ((279, 290), 'numpy.max', 'np.max', (['ecg'], {}), '(ecg)\n', (285, 290), ... |
##################################################################
# Algorithm module using look-up tables
##################################################################
import math
import numpy as np
import modelicares
from scipy.optimize import minimize
import scipy.interpolate as interpolate
from scipy.optimize... | [
"numpy.isin",
"modelicares.exps.doe.fullfact",
"scipy.optimize.minimize",
"scipy.interpolate.griddata",
"Objective_Function.DelLastTrack",
"numpy.zeros",
"Objective_Function.GetOutputVars",
"math.floor",
"Objective_Function.ChangeDir",
"Objective_Function.GetOptTrack",
"numpy.append",
"numpy.w... | [((3753, 3779), 'numpy.zeros', 'np.zeros', (['[counter + 1, 2]'], {}), '([counter + 1, 2])\n', (3761, 3779), True, 'import numpy as np\n'), ((3850, 3876), 'numpy.zeros', 'np.zeros', (['[2 * counter, 2]'], {}), '([2 * counter, 2])\n', (3858, 3876), True, 'import numpy as np\n'), ((9417, 9457), 'numpy.compress', 'np.comp... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | [
"numpy.zeros_like",
"numpy.log",
"numpy.zeros",
"openquake.hazardlib.gsim.utils.mblg_to_mw_johnston_96",
"openquake.hazardlib.imt.SA",
"openquake.hazardlib.gsim.base.CoeffsTable",
"openquake.hazardlib.imt.PGA",
"openquake.hazardlib.gsim.utils.clip_mean",
"numpy.array",
"scipy.interpolate.RectBivar... | [((6389, 6414), 'numpy.linspace', 'np.linspace', (['(4.4)', '(8.2)', '(20)'], {}), '(4.4, 8.2, 20)\n', (6400, 6414), True, 'import numpy as np\n'), ((6549, 6574), 'numpy.linspace', 'np.linspace', (['(1.0)', '(3.0)', '(21)'], {}), '(1.0, 3.0, 21)\n', (6560, 6574), True, 'import numpy as np\n'), ((6615, 9731), 'numpy.arr... |
import os
import warnings
import itertools
from operator import itemgetter
from nose.tools import assert_equal, with_setup, assert_almost_equal, assert_raises
from random import uniform, seed
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
try:
from pyne.mesh import Mes... | [
"os.remove",
"pyne.r2s.tag_e_bounds",
"numpy.empty",
"pymoab.core.Core",
"numpy.ones",
"pyne.source_sampling.AliasTable",
"warnings.simplefilter",
"os.path.exists",
"pyne.mesh.NativeMeshTag",
"random.seed",
"nose.tools.assert_raises",
"numpy.rollaxis",
"numpy.linalg.det",
"imp.load_module"... | [((845, 887), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'QAWarning'], {}), "('ignore', QAWarning)\n", (866, 887), False, 'import warnings\n'), ((423, 446), 'imp.find_module', 'imp.find_module', (['"""pyne"""'], {}), "('pyne')\n", (438, 446), False, 'import imp\n'), ((462, 497), 'imp.load_modul... |
from abc import ABC, abstractmethod
import numpy as np
from scipy import stats
import torch
class Experiment(ABC):
'''
An Experiment manages the basic train/test loop and logs results.
Args:
writer (:torch.logging.writer:): A Writer object used for logging.
quiet (bool): If False,... | [
"numpy.std",
"numpy.mean",
"scipy.stats.sem"
] | [((1956, 1981), 'numpy.mean', 'np.mean', (['self._returns100'], {}), '(self._returns100)\n', (1963, 1981), True, 'import numpy as np\n'), ((2000, 2024), 'numpy.std', 'np.std', (['self._returns100'], {}), '(self._returns100)\n', (2006, 2024), True, 'import numpy as np\n'), ((2803, 2819), 'numpy.mean', 'np.mean', (['retu... |
import numpy as np
import pandas as pd
from sklearn.covariance import EmpiricalCovariance
from typing import Union
from modules.features.feature import Feature
from modules.filters.dml.map_representation import from_map_representation_to_xy
from modules.features.segment_feature import SegmentFeature
from modules.featu... | [
"numpy.full",
"modules.filters.dml.map_representation.from_map_representation_to_xy",
"numpy.sum",
"numpy.empty",
"numpy.mean",
"numpy.array",
"numpy.random.normal",
"sklearn.covariance.EmpiricalCovariance",
"numpy.vstack"
] | [((2860, 2922), 'numpy.random.normal', 'np.random.normal', (['mean', '(variance ** 0.5)'], {'size': 'self.n_particles'}), '(mean, variance ** 0.5, size=self.n_particles)\n', (2876, 2922), True, 'import numpy as np\n'), ((3108, 3126), 'numpy.vstack', 'np.vstack', (['xy_list'], {}), '(xy_list)\n', (3117, 3126), True, 'im... |
import numpy as np
from .GraphData import *
def intrv_log(min_val, max_val, num):
if min_val <= 0:
min_val = 0.1
return np.geomspace(min_val, max_val, num)
class PlotDict():
__instance = None
__slots__ = ['intrv', 'coll', 'graph']
def __new__(cls):
if PlotDict.__instance is None:... | [
"numpy.geomspace"
] | [((137, 172), 'numpy.geomspace', 'np.geomspace', (['min_val', 'max_val', 'num'], {}), '(min_val, max_val, num)\n', (149, 172), True, 'import numpy as np\n')] |
import numpy as np
import sklearn.linear_model as lr
from sklearn import ensemble
from sklearn import svm
from sklearn.externals import joblib
from steppy.base import BaseTransformer
from steppy.utils import get_logger
logger = get_logger()
class SklearnBaseTransformer(BaseTransformer):
def __init__(self, esti... | [
"numpy.stack",
"sklearn.externals.joblib.dump",
"numpy.vectorize",
"numpy.hstack",
"steppy.utils.get_logger",
"numpy.exp",
"sklearn.externals.joblib.load"
] | [((231, 243), 'steppy.utils.get_logger', 'get_logger', ([], {}), '()\n', (241, 243), False, 'from steppy.utils import get_logger\n'), ((526, 563), 'sklearn.externals.joblib.dump', 'joblib.dump', (['self.estimator', 'filepath'], {}), '(self.estimator, filepath)\n', (537, 563), False, 'from sklearn.externals import jobli... |
from .utilities import format_ft_comp, format_end2end_prompt, split_multi_answer
from .configs import ANSWER_COL, INCORRECT_COL
from datasets import load_metric
import openai
import numpy as np
import pandas as pd
import warnings
from t5.evaluation import metrics
from time import sleep
import logging
logger = logging.... | [
"t5.evaluation.metrics.rouge",
"t5.evaluation.metrics.bleu",
"pandas.isnull",
"logging.getLogger",
"time.sleep",
"datasets.load_metric",
"numpy.exp",
"openai.Completion.create"
] | [((312, 331), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (329, 331), False, 'import logging\n'), ((11906, 11948), 'datasets.load_metric', 'load_metric', (['"""bleurt"""'], {'cache_dir': 'cache_dir'}), "('bleurt', cache_dir=cache_dir)\n", (11917, 11948), False, 'from datasets import load_metric\n'), ((1... |
import copy
from typing import Dict
import numpy as np
from tree.descision_tree import DecisionTree, LeafNode, combine_two_trees
from tree.optimized_train.data_view import NodeTrainDataView
from tree.optimized_train.decision_rule_selection import DecisionRuleSelector, DynamicPruningSelector, \
ScheduledPruningSel... | [
"copy.deepcopy",
"numpy.average",
"tree.optimized_train.value_to_bins.ValuesToBins",
"tree.descision_tree.combine_two_trees",
"copy.copy",
"tree.optimized_train.decision_rule_selection.ScheduledPruningSelector",
"tree.optimized_train.params_for_optimized.print_expected_execution_statistics",
"tree.opt... | [((1123, 1144), 'copy.deepcopy', 'copy.deepcopy', (['params'], {}), '(params)\n', (1136, 1144), False, 'import copy\n'), ((1149, 1175), 'tree.optimized_train.params_for_optimized._set_defaults', '_set_defaults', (['params_copy'], {}), '(params_copy)\n', (1162, 1175), False, 'from tree.optimized_train.params_for_optimiz... |
from pymatting.util.util import (
grid_coordinates,
sparse_conv_matrix,
weights_to_laplacian,
)
import numpy as np
def uniform_laplacian(image, radius=1):
"""This function returns a Laplacian matrix with all weights equal to one.
Parameters
------------
image: numpy.ndarray
Image ... | [
"numpy.ones",
"pymatting.util.util.weights_to_laplacian"
] | [((666, 689), 'pymatting.util.util.weights_to_laplacian', 'weights_to_laplacian', (['W'], {}), '(W)\n', (686, 689), False, 'from pymatting.util.util import grid_coordinates, sparse_conv_matrix, weights_to_laplacian\n'), ((617, 652), 'numpy.ones', 'np.ones', (['(window_size, window_size)'], {}), '((window_size, window_s... |
from copy import deepcopy
from numpy import zeros
from pyNastran.converters.cart3d.cart3d import Cart3D
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.field_writer_16 import print_card_16
class Cart3d_Mesher(Cart3D):
def __init__(self, log=None, debug=False):
Cart3D.__init__(sel... | [
"copy.deepcopy",
"pyNastran.converters.cart3d.cart3d.Cart3D.read_cart3d",
"pyNastran.bdf.field_writer_8.print_card_8",
"numpy.zeros",
"pyNastran.converters.cart3d.cart3d.Cart3D.__init__",
"pyNastran.bdf.field_writer_16.print_card_16"
] | [((301, 344), 'pyNastran.converters.cart3d.cart3d.Cart3D.__init__', 'Cart3D.__init__', (['self'], {'log': 'log', 'debug': 'debug'}), '(self, log=log, debug=debug)\n', (316, 344), False, 'from pyNastran.converters.cart3d.cart3d import Cart3D\n'), ((417, 485), 'pyNastran.converters.cart3d.cart3d.Cart3D.read_cart3d', 'Car... |
"""
This module provides distance helper functions.
"""
import numpy as np
import diversipy
def distance_to_boundary(points, cuboid=None):
"""Calculate the distance of each point to the boundary of some cuboid.
This distance is simply the minimum of all differences between
a point and the lower and uppe... | [
"numpy.minimum",
"numpy.abs",
"diversipy.cube.unitcube",
"numpy.asarray",
"numpy.expand_dims",
"numpy.linalg.norm",
"numpy.all",
"numpy.atleast_2d"
] | [((1091, 1143), 'numpy.minimum', 'np.minimum', (['dists_to_min_bounds', 'dists_to_max_bounds'], {}), '(dists_to_min_bounds, dists_to_max_bounds)\n', (1101, 1143), True, 'import numpy as np\n'), ((1155, 1179), 'numpy.all', 'np.all', (['(distances >= 0.0)'], {}), '(distances >= 0.0)\n', (1161, 1179), True, 'import numpy ... |
import numpy as np
a = np.arange(6)
print(a)
# [0 1 2 3 4 5]
print(a.reshape(2, 3))
# [[0 1 2]
# [3 4 5]]
print(a.reshape(-1, 3))
# [[0 1 2]
# [3 4 5]]
print(a.reshape(2, -1))
# [[0 1 2]
# [3 4 5]]
# print(a.reshape(3, 4))
# ValueError: cannot reshape array of size 6 into shape (3,4)
# print(a.reshape(-1, 4))
... | [
"numpy.array",
"numpy.arange"
] | [((24, 36), 'numpy.arange', 'np.arange', (['(6)'], {}), '(6)\n', (33, 36), True, 'import numpy as np\n'), ((411, 422), 'numpy.array', 'np.array', (['l'], {}), '(l)\n', (419, 422), True, 'import numpy as np\n'), ((480, 491), 'numpy.array', 'np.array', (['l'], {}), '(l)\n', (488, 491), True, 'import numpy as np\n')] |
"""
The interface for data preprocessing.
Authors:
<NAME>
"""
import numpy as np
import pandas as pd
from collections import Counter
class FeatureExtractor(object):
def __init__(self):
self.idf_vec = None
self.mean_vec = None
self.events = None
def df_fit_transform(self, X_se... | [
"pandas.DataFrame",
"numpy.sum",
"numpy.log",
"numpy.tile",
"collections.Counter"
] | [((900, 922), 'pandas.DataFrame', 'pd.DataFrame', (['x_counts'], {}), '(x_counts)\n', (912, 922), True, 'import pandas as pd\n'), ((1085, 1109), 'numpy.sum', 'np.sum', (['(X_df > 0)'], {'axis': '(0)'}), '(X_df > 0, axis=0)\n', (1091, 1109), True, 'import numpy as np\n'), ((1133, 1172), 'numpy.log', 'np.log', (['(num_in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.