code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import sys
from functools import partial
from typing import Any, Callable, List, Optional, Tuple, cast
import numpy as np
from numpy.core.numerictypes import ScalarType
from sklearn import feature_selection as fs
from . import _utils
def _get_mi_func(discrete: bool) -> Callable:
"""
Get mutual information ... | [
"functools.partial",
"typing.cast",
"numpy.zeros",
"numpy.argsort",
"numpy.sort",
"numpy.delete"
] | [((651, 756), 'functools.partial', 'partial', (['(fs.mutual_info_classif if discrete else fs.mutual_info_regression)'], {'random_state': 'RANDOM_STATE'}), '(fs.mutual_info_classif if discrete else fs.mutual_info_regression,\n random_state=RANDOM_STATE)\n', (658, 756), False, 'from functools import partial\n'), ((408... |
import numpy as np
import autodisc as ad
from autodisc.systems.lenia import LeniaStatistics
from goalrepresent.datasets import LENIADataset
from goalrepresent.helper.randomhelper import set_seed
from goalrepresent.models import PCAModel
EPS = 0.0001
def calc_static_statistics(final_obs):
'''Calculates the final... | [
"numpy.sum",
"goalrepresent.datasets.LENIADataset",
"autodisc.helper.statistics.calc_image_moments",
"numpy.zeros",
"numpy.percentile",
"autodisc.systems.lenia.LeniaStatistics.calc_distance_matrix",
"goalrepresent.helper.randomhelper.set_seed",
"numpy.array",
"numpy.savez",
"goalrepresent.datasets... | [((384, 396), 'numpy.zeros', 'np.zeros', (['(17)'], {}), '(17)\n', (392, 396), True, 'import numpy as np\n'), ((680, 704), 'numpy.array', 'np.array', (['[mid_y, mid_x]'], {}), '([mid_y, mid_x])\n', (688, 704), True, 'import numpy as np\n'), ((1038, 1098), 'autodisc.helper.statistics.calc_image_moments', 'ad.helper.stat... |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 10 11:31:48 2019
@author: <NAME>
"""
import numpy as np
from .stagData import StagData, StagCartesianGeometry, StagYinYangGeometry
from .stagData import SliceData, CartesianSliceData, YinYangSliceData
from .stagData import InterpolatedSliceData
from .stagError import Gr... | [
"numpy.meshgrid",
"scipy.interpolate.griddata",
"time.time",
"numpy.sin",
"numpy.array",
"numpy.cos",
"numpy.linspace"
] | [((1801, 1840), 'numpy.meshgrid', 'np.meshgrid', (['lon', 'lat', 'r'], {'indexing': '"""ij"""'}), "(lon, lat, r, indexing='ij')\n", (1812, 1840), True, 'import numpy as np\n'), ((2853, 2859), 'time.time', 'time', ([], {}), '()\n', (2857, 2859), False, 'from time import time\n'), ((1904, 1915), 'numpy.cos', 'np.cos', ([... |
"""
Created on Mon Mar 14 09:30:44 2016
@author: rmc84
<NAME>
Purpose: calcualtes the GMPE values for a given IM & earthquake
Based on CompareGMPEs_.m (version 1.0 8 March 2010, Brendon Bradley)
All variable and function names have been retained wherever possible
All the redundant parts of the code to plot the GMP... | [
"numpy.max",
"numpy.log",
"geoNet.gmpe.Bradley_2010_Sa.Bradley_2010_Sa"
] | [((3754, 3798), 'numpy.max', 'np.max', (['(0, Rrup ** 2 - faultprop.Ztor ** 2)'], {}), '((0, Rrup ** 2 - faultprop.Ztor ** 2))\n', (3760, 3798), True, 'import numpy as np\n'), ((5427, 5457), 'numpy.log', 'np.log', (['parms.plotGMPE.DistMin'], {}), '(parms.plotGMPE.DistMin)\n', (5433, 5457), True, 'import numpy as np\n'... |
"""
PTC
---
Data handling for turn-by-turn measurement files from the ``PTC`` code, which can be obtained by performing
particle tracking of your machine through the ``MAD-X PTC`` interface. The files are very close in
structure to **TFS** files, with the difference that the data part is split into "segments" relating... | [
"pandas.DataFrame",
"copy.deepcopy",
"datetime.datetime.today",
"numpy.zeros",
"dateutil.tz.tzutc",
"pathlib.Path",
"turn_by_turn.structures.TbtData",
"datetime.datetime.strptime",
"collections.namedtuple",
"logging.getLogger"
] | [((936, 955), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (953, 955), False, 'import logging\n'), ((966, 1040), 'collections.namedtuple', 'namedtuple', (['"""Segment"""', "['number', 'turns', 'particles', 'element', 'name']"], {}), "('Segment', ['number', 'turns', 'particles', 'element', 'name'])\n", (9... |
import torchvision
import skimage
import torch
from torchvision import transforms
import numpy as np
from PIL import Image
IMG_MEAN = (0.4914, 0.4822, 0.4465)
IMG_STD = (0.2023, 0.1994, 0.2010)
NORM = [transforms.ToTensor(),
transforms.Normalize(IMG_MEAN, IMG_STD)]
class MapTransform(object):
def __i... | [
"torchvision.transforms.ColorJitter",
"numpy.random.uniform",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.Resize",
"skimage.util.view_as_windows",
"torchvision.transforms.ToPILImage",
"torch.cat",
"torchvision.transforms.RandomResizedCrop",
"torchvision.transforms.Compose"... | [((206, 227), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (225, 227), False, 'from torchvision import transforms\n'), ((238, 277), 'torchvision.transforms.Normalize', 'transforms.Normalize', (['IMG_MEAN', 'IMG_STD'], {}), '(IMG_MEAN, IMG_STD)\n', (258, 277), False, 'from torchvision impo... |
import logging
import pytest
import uuid
from pygame.math import Vector2
import pygame
import random
import numpy as np
import cv2
import time
from .base_render import BaseRender
from gobigger.utils import Colors, BLACK, YELLOW, GREEN
from gobigger.utils import PLAYER_COLORS, FOOD_COLOR, THORNS_COLOR, SPORE_COLOR
from... | [
"pygame.quit",
"pygame.draw.circle",
"pygame.Surface",
"pygame.font.SysFont",
"cv2.cvtColor",
"numpy.fliplr",
"numpy.rot90",
"pygame.surfarray.array3d"
] | [((1177, 1215), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""Menlo"""', '(12)', '(True)'], {}), "('Menlo', 12, True)\n", (1196, 1215), False, 'import pygame\n'), ((1800, 1832), 'pygame.surfarray.array3d', 'pygame.surfarray.array3d', (['screen'], {}), '(screen)\n', (1824, 1832), False, 'import pygame\n'), ((6726,... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
# A script to produce a finishing ability metric based on the *concept* of post-shot xG based on the phyiscal properties of
# a shot once taken
# see https://www.opengoalapp.com/finishing-ability for full write-up of the method
import pandas as pd
from pandas.io.json... | [
"matplotlib.pyplot.title",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.figure",
"GetMatchDates.GetMatchDates",
"pandas.DataFrame",
"sklearn.metrics.log_loss",
"xgboost.XGBClassifier",
"pandas.concat",
"sklearn.calibration.calibration_curve",
"matplotlib.pyplot.show",
"matplotl... | [((1194, 1231), 'pandas.read_pickle', 'pd.read_pickle', (['"""data\\\\shot_data.pkl"""'], {}), "('data\\\\shot_data.pkl')\n", (1208, 1231), True, 'import pandas as pd\n'), ((1573, 1602), 'pandas.io.json.json_normalize', 'json_normalize', (["shots['shot']"], {}), "(shots['shot'])\n", (1587, 1602), False, 'from pandas.io... |
import numpy as np
from .dt import DecisionTree
from .losses import MSELoss, CrossEntropyLoss
def to_one_hot(labels, n_classes=None):
if labels.ndim > 1:
raise ValueError("labels must have dimension 1, but got {}".format(labels.ndim))
N = labels.size
n_cols = np.max(labels) + 1 if n_classes is N... | [
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"numpy.max",
"numpy.arange"
] | [((353, 374), 'numpy.zeros', 'np.zeros', (['(N, n_cols)'], {}), '((N, n_cols))\n', (361, 374), True, 'import numpy as np\n'), ((4220, 4272), 'numpy.empty', 'np.empty', (['(self.n_iter, self.out_dims)'], {'dtype': 'object'}), '((self.n_iter, self.out_dims), dtype=object)\n', (4228, 4272), True, 'import numpy as np\n'), ... |
# Import modules
import matplotlib.pyplot as plt
import numpy as np
from scripts.dwt_windowed import do_transform
def py_closest(data, value):
return np.argmin(np.abs(data - value))
def py_cumvar_n(data):
return np.cumsum(data**2) / np.sum(data**2)
## RANDOM INPUT
# Generate test signal
sig = np.random.r... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.plot",
"numpy.sum",
"matplotlib.pyplot.legend",
"numpy.zeros",
"scripts.dwt_windowed.do_transform",
"matplotlib.pyplot.text",
"matplotlib.pyplot.figure",
"numpy.random.random",
"num... | [((309, 336), 'numpy.random.random', 'np.random.random', (['[2 ** 16]'], {}), '([2 ** 16])\n', (325, 336), True, 'import numpy as np\n'), ((335, 347), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (345, 347), True, 'import matplotlib.pyplot as plt\n'), ((349, 362), 'matplotlib.pyplot.plot', 'plt.plot', ([... |
# ------------------------------------------------------------------------
# MIT License
#
# Copyright (c) [2021] [<NAME>]
#
# This code is part of the library PyDL <https://github.com/nash911/PyDL>
# This code is licensed under MIT license (see LICENSE.txt for details)
# -----------------------------------------------... | [
"pydl.nn.nn.NN",
"numpy.random.seed",
"pydl.nn.rnn.RNN",
"pydl.training.sgd.SGD",
"numpy.zeros",
"pydl.nn.layers.FC"
] | [((508, 532), 'numpy.random.seed', 'np.random.seed', (['(11421111)'], {}), '(11421111)\n', (522, 532), True, 'import numpy as np\n'), ((677, 711), 'numpy.zeros', 'np.zeros', (['(1, K)'], {'dtype': 'conf.dtype'}), '((1, K), dtype=conf.dtype)\n', (685, 711), True, 'import numpy as np\n'), ((919, 1085), 'pydl.nn.rnn.RNN',... |
"""
FinetuneTransformer
===================
"""
from ..utils.misc import suppress_stdout, get_file_md5
from .base_model import BaseModel
from ..utils.transformers_helpers import mask_tokens, rotate_checkpoints, set_seed, download_vocab_files_for_tokenizer
from torch.utils.data import DataLoader, IterableDataset
from t... | [
"pandas.read_csv",
"logging.getLogger",
"torch.cuda.device_count",
"os.path.isfile",
"numpy.random.randint",
"torch.distributed.get_world_size",
"torch.device",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"os.path.dirname",
"os.path.exists",
"apex.optimizers.FusedAdam",
... | [((812, 839), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (829, 839), False, 'import logging\n'), ((1389, 1435), 'os.path.join', 'os.path.join', (['self.other_path', 'self.model_name'], {}), '(self.other_path, self.model_name)\n', (1401, 1435), False, 'import os\n'), ((4304, 4377), 'tr... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
data_full = [[ 0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100., 110., 120., 130.,
140., 150., 160., 170., 180., 190., 200., 210., 220., 230., 240., 250., 260., 270.,
280., 290., 300., ... | [
"matplotlib.pyplot.show",
"numpy.concatenate",
"matplotlib.pyplot.plot",
"numpy.abs",
"matplotlib.pyplot.legend",
"numpy.expand_dims",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"sklearn.linear_model.Lasso"
] | [((1223, 1242), 'numpy.array', 'np.array', (['data_full'], {}), '(data_full)\n', (1231, 1242), True, 'import numpy as np\n'), ((1290, 1323), 'numpy.expand_dims', 'np.expand_dims', (['arr[0, :]'], {'axis': '(1)'}), '(arr[0, :], axis=1)\n', (1304, 1323), True, 'import numpy as np\n'), ((1371, 1404), 'numpy.expand_dims', ... |
import numpy as np
def im2col(input_data, filter_h, filter_w, stride, pad):
"""
(function) im2col
-----------------
- Convert the shape of the data from image to column
Parameter
---------
- input_data : input data
- filter_h : filter height
- filter_w : filter width
- stride :... | [
"numpy.pad",
"numpy.zeros"
] | [((660, 732), 'numpy.pad', 'np.pad', (['input_data', '[(0, 0), (0, 0), (pad, pad), (pad, pad)]', '"""constant"""'], {}), "(input_data, [(0, 0), (0, 0), (pad, pad), (pad, pad)], 'constant')\n", (666, 732), True, 'import numpy as np\n'), ((743, 793), 'numpy.zeros', 'np.zeros', (['(N, C, filter_h, filter_w, out_h, out_w)'... |
"""
Source: https://github.com/yanxinzju/CSS-VQA/blob/0e2bfa68232f346adc9ad61e90e97ee38ad59f96/language_model.py#L31
"""
import torch
import torch.nn as nn
import numpy as np
from torch.autograd import Variable
from torch.nn.utils.weight_norm import weight_norm
__all__ = ['WordEmbedding', 'QuestionEmbedding', 'FCNet'... | [
"torch.nn.Dropout",
"numpy.load",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Embedding",
"torch.cat",
"torch.nn.Linear"
] | [((615, 668), 'torch.nn.Embedding', 'nn.Embedding', (['(ntoken + 1)', 'emb_dim'], {'padding_idx': 'ntoken'}), '(ntoken + 1, emb_dim, padding_idx=ntoken)\n', (627, 668), True, 'import torch.nn as nn\n'), ((690, 709), 'torch.nn.Dropout', 'nn.Dropout', (['dropout'], {}), '(dropout)\n', (700, 709), True, 'import torch.nn a... |
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : preprocess.py
# Purpose :
# Creation Date : 10-12-2017
# Last Modified : Thu 18 Jan 2018 05:34:42 PM CST
# Created By : <NAME> [jeasinema[at]gmail[dot]com]
import os
import multiprocessing
import numpy as np
from config import cfg
data_dir = 'velodyne'
def... | [
"numpy.random.shuffle",
"numpy.logical_and",
"numpy.floor",
"numpy.zeros",
"numpy.array",
"os.path.splitext",
"numpy.array_split",
"multiprocessing.Process",
"os.path.join",
"os.listdir",
"numpy.unique"
] | [((1029, 1059), 'numpy.random.shuffle', 'np.random.shuffle', (['point_cloud'], {}), '(point_cloud)\n', (1046, 1059), True, 'import numpy as np\n'), ((1281, 1353), 'numpy.logical_and', 'np.logical_and', (['(voxel_index[:, 2] >= 0)', '(voxel_index[:, 2] < grid_size[2])'], {}), '(voxel_index[:, 2] >= 0, voxel_index[:, 2] ... |
from typing import Dict
import numpy as np
import math
import cv2
from nxs_types.model import NxsModel
class AttrDict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
class Config:
search_size = 255
exemplar_size = 127
base_size = 8
stride = 8
score_size = (search_si... | [
"numpy.stack",
"numpy.sum",
"numpy.maximum",
"math.sqrt",
"numpy.argmax",
"numpy.zeros",
"numpy.expand_dims",
"numpy.transpose",
"numpy.amax",
"numpy.max",
"numpy.array",
"numpy.exp",
"numpy.tile",
"numpy.hanning",
"numpy.sqrt"
] | [((712, 760), 'numpy.zeros', 'np.zeros', (['(cfg.num_anchors, 4)'], {'dtype': 'np.float32'}), '((cfg.num_anchors, 4), dtype=np.float32)\n', (720, 760), True, 'import numpy as np\n'), ((1211, 1276), 'numpy.stack', 'np.stack', (['[(x1 + x2) * 0.5, (y1 + y2) * 0.5, x2 - x1, y2 - y1]', '(1)'], {}), '([(x1 + x2) * 0.5, (y1 ... |
from torchfm.dataset.criteo import CriteoDataset
dataset = CriteoDataset()
import json
import numpy as np
n_items = 4096
total_items = 500
input_data = []
for i in range(3):
x = dataset[i][0]
tiled_x = np.tile(x,n_items)
tiled_x = tiled_x.reshape(n_items,-1)
tiled_x[:,-1] = np.random.choice(range(tota... | [
"json.dump",
"numpy.tile",
"torchfm.dataset.criteo.CriteoDataset"
] | [((59, 74), 'torchfm.dataset.criteo.CriteoDataset', 'CriteoDataset', ([], {}), '()\n', (72, 74), False, 'from torchfm.dataset.criteo import CriteoDataset\n'), ((212, 231), 'numpy.tile', 'np.tile', (['x', 'n_items'], {}), '(x, n_items)\n', (219, 231), True, 'import numpy as np\n'), ((543, 566), 'json.dump', 'json.dump',... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
import cv2
import numpy as np
from tqdm import tqdm
import glob
def calculate_mean_std(path):
# folder = os.listdir(path)
folder = glob.glob(path, recursive=False)
mean = []
std = []
R_mean = 0.0
G_mean = 0.0
B_mean = 0.0
# for i... | [
"tqdm.tqdm",
"numpy.power",
"cv2.imread",
"numpy.mean",
"glob.glob"
] | [((196, 228), 'glob.glob', 'glob.glob', (['path'], {'recursive': '(False)'}), '(path, recursive=False)\n', (205, 228), False, 'import glob\n'), ((455, 494), 'tqdm.tqdm', 'tqdm', (['folder'], {'desc': '"""calculate_mean_std"""'}), "(folder, desc='calculate_mean_std')\n", (459, 494), False, 'from tqdm import tqdm\n'), ((... |
import numpy as np
from napari.layers.utils.color_manager_utils import (
guess_continuous,
is_color_mapped,
)
def test_guess_continuous():
continuous_annotation = np.array([1, 2, 3], dtype=np.float32)
assert guess_continuous(continuous_annotation)
categorical_annotation_1 = np.array([True, False... | [
"napari.layers.utils.color_manager_utils.guess_continuous",
"numpy.array",
"napari.layers.utils.color_manager_utils.is_color_mapped"
] | [((178, 215), 'numpy.array', 'np.array', (['[1, 2, 3]'], {'dtype': 'np.float32'}), '([1, 2, 3], dtype=np.float32)\n', (186, 215), True, 'import numpy as np\n'), ((227, 266), 'napari.layers.utils.color_manager_utils.guess_continuous', 'guess_continuous', (['continuous_annotation'], {}), '(continuous_annotation)\n', (243... |
# DIRECTORY: ~/kpyreb/eSims/MSims/integrate.py
#
# Integrates using whfast by default. This can be set by the user as an optional
# keyword. Auto calculates the timestep to be 1/1000 of the shortest orbit
# (Rein & Tamayo 2015). Sympletic corrector can be used if set by the user.
#
# This is the worker of the simulatio... | [
"numpy.arctan2",
"math.sqrt",
"numpy.zeros",
"numpy.array",
"numpy.linspace"
] | [((3395, 3434), 'numpy.linspace', 'np.linspace', (['(0)', 'simlength', '(Noutputs + 1)'], {}), '(0, simlength, Noutputs + 1)\n', (3406, 3434), True, 'import numpy as np\n'), ((24428, 24450), 'numpy.zeros', 'np.zeros', (['(Noutputs + 1)'], {}), '(Noutputs + 1)\n', (24436, 24450), True, 'import numpy as np\n'), ((24468, ... |
from functools import lru_cache
import torch
import numpy as np
from nltk.tokenize import word_tokenize
from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction
class Evaluator:
def __init__(self, corpus, n_ref, sample_params=None,
blue_span=(2, 5), blue_smooth='epsilon'):
... | [
"torch.stack",
"nltk.translate.bleu_score.sentence_bleu",
"numpy.array",
"torch.device",
"nltk.translate.bleu_score.SmoothingFunction",
"functools.lru_cache"
] | [((2420, 2443), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (2429, 2443), False, 'from functools import lru_cache\n'), ((479, 527), 'numpy.array', 'np.array', (['([1 / i] * i + [0] * (blue_span[1] - i))'], {}), '([1 / i] * i + [0] * (blue_span[1] - i))\n', (487, 527), True, 'impor... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 3 21:22:35 2019
@author: Reuben
The persist module helps the user save and load Box instances. It is
able to be extended for use with any handler.
The module instantiates a Manager class and copies its load and save methods
to the module level, for easier usage by cli... | [
"numpy.load",
"json.loads",
"json.dumps",
"numpy.savez_compressed",
"numpy.array",
"zlib.decompress",
"json.JSONEncoder.default"
] | [((5526, 5561), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'obj'], {}), '(self, obj)\n', (5550, 5561), False, 'import json\n'), ((5679, 5727), 'numpy.array', 'np.array', (["dct['__ndarray__']"], {'dtype': "dct['dtype']"}), "(dct['__ndarray__'], dtype=dct['dtype'])\n", (5687, 5727), True, 'import ... |
import torch
from model.base_model import BaseModel
from model.networks import base_function, external_function
import model.networks as network
from util import task, util
import itertools
import data as Dataset
import numpy as np
from itertools import islice
import random
import os
import matplotlib.pyplot as plt
fro... | [
"cv2.VideoWriter_fourcc",
"torch.cat",
"util.util.flow2color",
"model.networks.external_function.PerceptualCorrectness",
"model.networks.base_function._freeze",
"glob.glob",
"torch.nn.MSELoss",
"model.networks.define_g",
"model.networks.base_function._unfreeze",
"model.networks.external_function.A... | [((2812, 2841), 'model.base_model.BaseModel.__init__', 'BaseModel.__init__', (['self', 'opt'], {}), '(self, opt)\n', (2830, 2841), False, 'from model.base_model import BaseModel\n'), ((3570, 3836), 'model.networks.define_g', 'network.define_g', (['opt'], {'image_nc': 'opt.image_nc', 'structure_nc': 'opt.structure_nc', ... |
import numpy as np
import time
import argparse
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
from torch.utils.data.sampler import SubsetRandomSampler
from torchvision import transforms
import csv
from sklearn.me... | [
"torch.nn.Dropout",
"argparse.ArgumentParser",
"utils.set_seed",
"numpy.floor",
"torch.nn.AdaptiveMaxPool1d",
"torch.randn",
"dataset.testset",
"dataset.trainset",
"torch.nn.BCELoss",
"torch.utils.data.DataLoader",
"torch.nn.Conv1d",
"numpy.savetxt",
"torch.nn.Linear",
"torch.nn.AvgPool1d"... | [((7018, 7043), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7041, 7043), False, 'import argparse\n'), ((9163, 9181), 'utils.set_seed', 'set_seed', (['seed_num'], {}), '(seed_num)\n', (9171, 9181), False, 'from utils import set_seed\n'), ((9204, 9245), 'dataset.trainset', 'trainset', (['args... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 12 14:22:31 2016
@author: <NAME>
"""
import collections
import matplotlib.pyplot as plt
import numpy as np
from abc import ABCMeta, abstractmethod
from .. import gui
from .. import helpers as hp
from .. import traces as tc
from ..evaluate import signal as sn
from ..graph... | [
"matplotlib.pyplot.close",
"numpy.any",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.linspace",
"numpy.digitize",
"numpy.round"
] | [((3383, 3405), 'matplotlib.pyplot.close', 'plt.close', (['self.figure'], {}), '(self.figure)\n', (3392, 3405), True, 'import matplotlib.pyplot as plt\n'), ((23139, 23165), 'numpy.min', 'np.min', (['data[:, sorttrace]'], {}), '(data[:, sorttrace])\n', (23145, 23165), True, 'import numpy as np\n'), ((23184, 23210), 'num... |
# example 5-1 Modeling CSV data with multilayer perceptron networks
import tensorflow.python.platform
import tensorflow as tf
import pandas as pd
import numpy as np
import os
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Input, Dense
from matplotlib import pyplot
print(... | [
"matplotlib.pyplot.title",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"tensorflow.math.reduce_std",
"tensorflow.executing_eagerly",
"matplotlib.pyplot.figure",
"tensorflow.divide",
"numpy.arange",
"os.path.join",
"tensorflow.math.log",
"numpy.max",
"matplotlib.pyplot.show",
"matplot... | [((464, 510), 'os.path.join', 'os.path.join', (['"""data"""', '"""classification-simdata"""'], {}), "('data', 'classification-simdata')\n", (476, 510), False, 'import os\n'), ((6927, 6977), 'matplotlib.pyplot.plot', 'pyplot.plot', (["history.history['loss']"], {'label': '"""loss"""'}), "(history.history['loss'], label=... |
"""Doomsday fuel.
"""
def solution(m):
import numpy as np
import fractions
if len(m) == 1:
return [1, 1]
n_states = len(m)
mask = [False if mi == [0] * n_states else True for mi in m]
idx = np.concatenate([np.arange(n_states)[mask], np.arange(n_states)[np.logical_not(mask)]])
M... | [
"numpy.sum",
"numpy.logical_not",
"numpy.lcm.reduce",
"numpy.array",
"numpy.arange",
"numpy.matmul",
"numpy.eye",
"fractions.Fraction"
] | [((323, 334), 'numpy.array', 'np.array', (['m'], {}), '(m)\n', (331, 334), True, 'import numpy as np\n'), ((633, 644), 'numpy.array', 'np.array', (['M'], {}), '(M)\n', (641, 644), True, 'import numpy as np\n'), ((839, 854), 'numpy.matmul', 'np.matmul', (['N', 'R'], {}), '(N, R)\n', (848, 854), True, 'import numpy as np... |
from os import cpu_count
from bfio import BioReader, BioWriter, OmeXml
import argparse, logging
import numpy as np
from pathlib import Path
from cellpose import dynamics, utils
import torch
from concurrent.futures import ThreadPoolExecutor, wait, Future
import typing
""" Plugin Constants """
TILE_SIZE = 2048 # Larg... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"numpy.argmax",
"numpy.empty",
"numpy.dtype",
"logging.getLogger",
"numpy.argwhere",
"bfio.BioReader",
"os.cpu_count",
"cellpose.utils.fill_holes_and_remove_small_masks",
"pathlib.Path",
"torch.cuda.is_available",
"cellpose.dynamics.get_masks... | [((512, 537), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (535, 537), False, 'import torch\n'), ((642, 767), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)-8s - %(levelname)-8s - %(message)s"""', 'datefmt': '"""%d-%b-%y %H:%M:%S"""'}), "(format=\n ... |
import cv2
from numpy import pi, cos, sin
from pprint import pprint
from statistics import median
from sys import exit
def hough_transform(edges, img=None, thresh=110):
"""Get contour lines of the receipt in polar coords(r, t)
using a thresh for the hough accumulator and calculate cartesian coords(x, y).
... | [
"cv2.line",
"statistics.median",
"numpy.sin",
"cv2.HoughLines",
"pprint.pprint",
"numpy.cos",
"sys.exit"
] | [((337, 379), 'cv2.HoughLines', 'cv2.HoughLines', (['edges', '(1)', '(pi / 180)', 'thresh'], {}), '(edges, 1, pi / 180, thresh)\n', (351, 379), False, 'import cv2\n'), ((1266, 1287), 'pprint.pprint', 'pprint', (['intersections'], {}), '(intersections)\n', (1272, 1287), False, 'from pprint import pprint\n'), ((3448, 349... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from sklearn.model_selection import train_test_split
def create_validation_split(X, y, grouplabels, test_size, random_seed=45):
"""
:param X: Features matrix
:param y: label matr... | [
"numpy.concatenate",
"sklearn.model_selection.train_test_split",
"numpy.where",
"numpy.array",
"numpy.unique"
] | [((3235, 3273), 'numpy.concatenate', 'np.concatenate', (['X_train_pieces'], {'axis': '(0)'}), '(X_train_pieces, axis=0)\n', (3249, 3273), True, 'import numpy as np\n'), ((3291, 3328), 'numpy.concatenate', 'np.concatenate', (['X_test_pieces'], {'axis': '(0)'}), '(X_test_pieces, axis=0)\n', (3305, 3328), True, 'import nu... |
#!/usr/bin/env python
# encoding: utf-8
"""An asymmetric SOM. This type of SOM doesn't use a grid, but the nodes are
freely positioned on a plane.
"""
from collections import UserList
from math import exp
import random
from random import choice
from scipy.spatial import Voronoi, voronoi_plot_2d
from .som import SOM, ... | [
"matplotlib.pyplot.title",
"scipy.spatial.voronoi_plot_2d",
"matplotlib.pyplot.xlim",
"math.exp",
"matplotlib.pyplot.show",
"numpy.arctan2",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"numpy.asarray",
"matplotlib.pyplot.axis",
"scipy.spatial.Voronoi",
"random.choice",
"matplotlib.py... | [((1379, 1403), 'scipy.spatial.voronoi_plot_2d', 'voronoi_plot_2d', (['voronoi'], {}), '(voronoi)\n', (1394, 1403), False, 'from scipy.spatial import Voronoi, voronoi_plot_2d\n'), ((1604, 1629), 'matplotlib.pyplot.title', 'plt.title', (['"""Voronoi plot"""'], {}), "('Voronoi plot')\n", (1613, 1629), True, 'import matpl... |
import collections
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.rnn import dynamic_rnn
from tensorflow.contrib.rnn import BasicLSTMCell
from helpers import FileLogger
from ml_utils import create_adam_optimizer
from ml_utils import create_weight_variable
from phased_lstm import PhasedLSTMCell
f... | [
"tensorflow.trainable_variables",
"phased_lstm.PhasedLSTMCell",
"tensorflow.matmul",
"tensorflow.ConfigProto",
"numpy.mean",
"collections.deque",
"tensorflow.get_variable",
"tensorflow.placeholder",
"ml_utils.create_weight_variable",
"ml_utils.create_adam_optimizer",
"tensorflow.global_variables... | [((781, 847), 'helpers.FileLogger', 'FileLogger', (['"""log.tsv"""', "['step', 'training_loss', 'benchmark_loss']"], {}), "('log.tsv', ['step', 'training_loss', 'benchmark_loss'])\n", (791, 847), False, 'from helpers import FileLogger\n'), ((1268, 1335), 'tensorflow.python.ops.rnn.dynamic_rnn', 'dynamic_rnn', (['lstm',... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: token_features
Author : <NAME>
date: 2019/8/20
-------------------------------------------------
"""
__author__ = '<NAME>'
# 获取token features,即每一个字符的向量,可以用cls作为句子向量,也可以用每一个字符的向量
import os
import sys
cu... | [
"sys.path.append",
"h5py.File",
"tensorflow.trainable_variables",
"modeling.BertModel",
"tensorflow.global_variables_initializer",
"tokenization.FullTokenizer",
"os.path.dirname",
"tensorflow.Session",
"numpy.asarray",
"tensorflow.placeholder",
"tensorflow.train.init_from_checkpoint",
"numpy.a... | [((408, 433), 'sys.path.append', 'sys.path.append', (['rootPath'], {}), '(rootPath)\n', (423, 433), False, 'import sys\n'), ((707, 759), 'modeling.BertConfig.from_json_file', 'modeling.BertConfig.from_json_file', (['bert_config_file'], {}), '(bert_config_file)\n', (741, 759), False, 'import modeling\n'), ((1296, 1358),... |
#!/usr/bin/env python
# inst: university of bristol
# auth: <NAME>
# mail: <EMAIL> / <EMAIL>
import sys
import subprocess
import configparser
import getopt
import numpy as np
import pandas as pd
import gdalutils
from lfptools import shapefile
from lfptools import misc_utils
from osgeo import osr
def getwidths_shell... | [
"gdalutils.get_geo",
"lfptools.misc_utils.near_euc",
"getopt.getopt",
"pandas.read_csv",
"lfptools.shapefile.Writer",
"numpy.where",
"configparser.SafeConfigParser",
"sys.exit",
"gdalutils.clip_raster",
"osgeo.osr.SpatialReference"
] | [((1001, 1032), 'configparser.SafeConfigParser', 'configparser.SafeConfigParser', ([], {}), '()\n', (1030, 1032), False, 'import configparser\n'), ((1533, 1566), 'lfptools.shapefile.Writer', 'shapefile.Writer', (['shapefile.POINT'], {}), '(shapefile.POINT)\n', (1549, 1566), False, 'from lfptools import shapefile\n'), (... |
from .experiment import Experiment
import numpy as np
class XenonSimple(Experiment):
detector_name = 'Xe_simple'
target_material = 'Xe'
exposure_tonne_year = 5
energy_threshold_kev = 10
cut_efficiency = 0.8
detection_efficiency = 0.5
interaction_type = 'SI'
location = 'XENON'
def ... | [
"numpy.sqrt"
] | [((1309, 1356), 'numpy.sqrt', 'np.sqrt', (['(0.3 ** 2 + 0.06 ** 2 * energies_in_kev)'], {}), '(0.3 ** 2 + 0.06 ** 2 * energies_in_kev)\n', (1316, 1356), True, 'import numpy as np\n'), ((614, 638), 'numpy.sqrt', 'np.sqrt', (['energies_in_kev'], {}), '(energies_in_kev)\n', (621, 638), True, 'import numpy as np\n'), ((209... |
import os
import unittest
import cv2
import sys
import numpy as np
from src.models.storage.frame import Frame
from src.models.storage.batch import FrameBatch
from src.udfs.depth_estimation.depth_estimator import DepthEstimator
from src.utils.frame_filter_util import FrameFilter
class DepthEstimatorTest(u... | [
"os.path.abspath",
"numpy.array_equal",
"src.utils.frame_filter_util.FrameFilter",
"cv2.cvtColor",
"numpy.random.rand",
"unittest.skip",
"cv2.imread",
"src.udfs.depth_estimation.depth_estimator.DepthEstimator",
"os.path.join",
"src.models.storage.batch.FrameBatch"
] | [((2565, 2626), 'unittest.skip', 'unittest.skip', (['"""need correction in depth mask initialization"""'], {}), "('need correction in depth mask initialization')\n", (2578, 2626), False, 'import unittest\n'), ((1029, 1045), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (1039, 1045), False, 'import cv2\n'), ((... |
from __future__ import print_function, division
import os
import torch
import numpy as np
from torch.utils.data import Dataset, DataLoader
import Options
import cv2
import shutil
config = Options.Config()
def find_classes(dir, config=config):
classes = [str(d) for d in range(config.label_size)]
class_to_idx =... | [
"os.path.join",
"Options.Config",
"os.path.isdir",
"cv2.cvtColor",
"numpy.fromfile",
"numpy.zeros",
"os.path.exists",
"cv2.imread",
"numpy.fliplr",
"numpy.random.randint",
"numpy.arange",
"numpy.mean",
"numpy.loadtxt",
"shutil.rmtree",
"os.path.expanduser",
"os.listdir"
] | [((188, 204), 'Options.Config', 'Options.Config', ([], {}), '()\n', (202, 204), False, 'import Options\n'), ((485, 508), 'os.path.expanduser', 'os.path.expanduser', (['dir'], {}), '(dir)\n', (503, 508), False, 'import os\n'), ((1219, 1235), 'numpy.arange', 'np.arange', (['(2)', '(27)'], {}), '(2, 27)\n', (1228, 1235), ... |
from concurrent import futures
from copy import deepcopy
import nifty.tools as nt
import numpy as np
import torch
from tqdm import tqdm
from ..transform.raw import standardize
def _load_block(input_, offset, block_shape, halo, padding_mode="reflect", with_channels=False):
shape = input_.shape
if with_channe... | [
"numpy.pad",
"copy.deepcopy",
"numpy.zeros",
"nifty.tools.blocking",
"torch.device",
"concurrent.futures.ThreadPoolExecutor",
"torch.no_grad",
"torch.from_numpy"
] | [((3601, 3644), 'nifty.tools.blocking', 'nt.blocking', (['([0] * ndim)', 'shape', 'block_shape'], {}), '([0] * ndim, shape, block_shape)\n', (3612, 3644), True, 'import nifty.tools as nt\n'), ((1621, 1663), 'numpy.pad', 'np.pad', (['data', 'pad_width'], {'mode': 'padding_mode'}), '(data, pad_width, mode=padding_mode)\n... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 1 19:11:52 2017
@author: mariapanteli
"""
import pytest
import numpy as np
import os
import scripts.OPMellin as OPMellin
opm = OPMellin.OPMellin()
TEST_AUDIO_FILE = os.path.join(os.path.dirname(__file__), 'data', 'mel_1_2_1.wav')
def test_load_audiofile():
audi... | [
"os.path.dirname",
"numpy.round",
"scripts.OPMellin.OPMellin"
] | [((181, 200), 'scripts.OPMellin.OPMellin', 'OPMellin.OPMellin', ([], {}), '()\n', (198, 200), True, 'import scripts.OPMellin as OPMellin\n'), ((232, 257), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (247, 257), False, 'import os\n'), ((1222, 1286), 'numpy.round', 'np.round', (['((opm.melsp... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021-2021 the DerivX authors
# All rights reserved.
#
# The project sponsor and lead author is <NAME>.
# E-mail: <EMAIL>, QQ: 277195007, WeChat: xrd_ustc
# See the contributors file for names of other contributors.
#
# Commercial use of this code in source and binary forms is
#... | [
"pandas.DataFrame",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.get_cmap",
"numpy.zeros",
"derivx.Barrier",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.array"
] | [((2501, 2513), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2511, 2513), True, 'import matplotlib.pyplot as plt\n'), ((2523, 2537), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', (['figure'], {}), '(figure)\n', (2529, 2537), False, 'from mpl_toolkits.mplot3d import Axes3D\n'), ((2624, 2657), 'numpy.arange', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import cv_bridge
from jsk_topic_tools import ConnectionBasedTransport
import rospy
from sensor_msgs.msg import Image
class ImageToLabel(ConnectionBasedTransport):
def __init__(self):
super(ImageToLabel, self).__init__()
self._pub =... | [
"cv_bridge.CvBridge",
"rospy.Subscriber",
"numpy.ones",
"rospy.init_node",
"rospy.spin"
] | [((884, 917), 'rospy.init_node', 'rospy.init_node', (['"""image_to_label"""'], {}), "('image_to_label')\n", (899, 917), False, 'import rospy\n'), ((953, 965), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (963, 965), False, 'import rospy\n'), ((414, 462), 'rospy.Subscriber', 'rospy.Subscriber', (['"""~input"""', 'Image... |
import numpy as np
from sgmrfmix import sGMRFmix
def check_model() -> None:
m = sGMRFmix(K=5, rho=0.8)
train = np.genfromtxt('../Examples/Data/train.csv', delimiter=',', skip_header=True)[:, 1:]
test = np.genfromtxt('../Examples/Data/test.csv', delimiter=',', skip_header=True)[:, 1:]
print(m)
# def t... | [
"numpy.allclose",
"numpy.genfromtxt",
"sgmrfmix.sGMRFmix"
] | [((86, 108), 'sgmrfmix.sGMRFmix', 'sGMRFmix', ([], {'K': '(5)', 'rho': '(0.8)'}), '(K=5, rho=0.8)\n', (94, 108), False, 'from sgmrfmix import sGMRFmix\n'), ((121, 197), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../Examples/Data/train.csv"""'], {'delimiter': '""","""', 'skip_header': '(True)'}), "('../Examples/Data/tra... |
# The MIT License (MIT)
#
# Copyright (c) snkas
#
# 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, p... | [
"numpy.zeros"
] | [((7051, 7067), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (7059, 7067), True, 'import numpy as np\n'), ((7251, 7267), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (7259, 7267), True, 'import numpy as np\n'), ((7498, 7514), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (7506, ... |
# Copyright (c) 2017 Sony Corporation. 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.minimum",
"numpy.abs",
"numpy.ones_like",
"numpy.copy",
"numpy.sum",
"numpy.log2",
"numpy.floor",
"numpy.empty",
"numpy.transpose",
"numpy.flatnonzero",
"numpy.random.RandomState",
"numpy.any",
"nbla_test_utils.list_context",
"nbla_test_utils.function_tester",
"numpy.random.randin... | [((718, 743), 'nbla_test_utils.list_context', 'list_context', (['"""INQAffine"""'], {}), "('INQAffine')\n", (730, 743), False, 'from nbla_test_utils import list_context\n'), ((3687, 3734), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ctx, func_name"""', 'ctxs'], {}), "('ctx, func_name', ctxs)\n", (3710, ... |
# Created by <NAME> (<EMAIL>)
from collections.abc import Iterable
import numpy as np
from .cost import Cost
class SumCost(Cost):
def __init__(self, system, costs):
"""
A cost which is the sum of other cost terms. It can be created by combining
other Cost objects with the `+` operator
... | [
"numpy.zeros"
] | [((705, 757), 'numpy.zeros', 'np.zeros', (['(self.system.obs_dim, self.system.obs_dim)'], {}), '((self.system.obs_dim, self.system.obs_dim))\n', (713, 757), True, 'import numpy as np\n'), ((774, 826), 'numpy.zeros', 'np.zeros', (['(self.system.obs_dim, self.system.obs_dim)'], {}), '((self.system.obs_dim, self.system.ob... |
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <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 res... | [
"numpy.stack",
"matplotlib.pyplot.show",
"torch.stack",
"numpy.abs",
"disent.util.lightning.callbacks._helper._get_dataset_and_ae_like",
"torch.norm",
"disent.util.visualize.plot.plt_subplots_imshow",
"numpy.zeros",
"torch.cat",
"numpy.triu_indices",
"torch.distributions.kl_divergence",
"disen... | [((2277, 2304), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2294, 2304), False, 'import logging\n'), ((3102, 3117), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3115, 3117), False, 'import torch\n'), ((3503, 3518), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3516, 351... |
import numpy as np
from analysisdatalink import datalink
from collections import defaultdict
class AnalysisDataLinkExt(datalink.AnalysisDataLink):
def __init__(self, dataset_name, materialization_version=None,
sqlalchemy_database_uri=None, verbose=True,
annotation_endpoint=None)... | [
"collections.defaultdict",
"numpy.array"
] | [((3052, 3069), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3063, 3069), False, 'from collections import defaultdict\n'), ((3098, 3115), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3109, 3115), False, 'from collections import defaultdict\n'), ((6529, 6546), 'collect... |
import cv2
import numpy as np
import imutils
from text_recognition import text_name
import pytesseract
def auto_canny(image, sigma=0.55):
# compute the median of the single channel pixel intensities
v = np.median(image)
# apply automatic Canny edge detection using the computed median
lower = int(max(... | [
"cv2.boundingRect",
"cv2.Canny",
"text_recognition.text_name",
"cv2.medianBlur",
"numpy.median",
"cv2.cvtColor",
"cv2.morphologyEx",
"cv2.arcLength",
"cv2.imshow",
"numpy.ones",
"cv2.adaptiveThreshold",
"cv2.approxPolyDP",
"cv2.VideoCapture",
"cv2.waitKey",
"imutils.grab_contours",
"cv... | [((212, 228), 'numpy.median', 'np.median', (['image'], {}), '(image)\n', (221, 228), True, 'import numpy as np\n'), ((400, 430), 'cv2.Canny', 'cv2.Canny', (['image', 'lower', 'upper'], {}), '(image, lower, upper)\n', (409, 430), False, 'import cv2\n'), ((729, 748), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}),... |
__all__ = ['checkEquivalentApprox']
import copy
import logging
import numpy as np
from LevelSetPy.Utilities import *
logger = logging.getLogger(__name__)
def checkEquivalentApprox(approx1, approx2,bound):
"""
checkEquivalentApprox: Checks two derivative approximations for equivalence.
[ relError, abs... | [
"numpy.nonzero",
"numpy.divide",
"numpy.abs",
"logging.getLogger"
] | [((127, 154), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (144, 154), False, 'import logging\n'), ((1616, 1645), 'numpy.nonzero', 'np.nonzero', (['(magnitude > bound)'], {}), '(magnitude > bound)\n', (1626, 1645), True, 'import numpy as np\n'), ((1664, 1694), 'numpy.nonzero', 'np.nonze... |
import torch
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
import numpy as np
import json
import os
from random import shuffle
import math
PATH = os.path.join(os.getcwd(), "data4.0")
SPACEGROUP_FILE = {
0: "Triclinic.txt",
1: "Monoclin... | [
"torch.utils.data.sampler.SubsetRandomSampler",
"json.load",
"torch.utils.data.DataLoader",
"os.getcwd",
"random.shuffle",
"numpy.array",
"torch.from_numpy"
] | [((231, 242), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (240, 242), False, 'import os\n'), ((2619, 2649), 'torch.utils.data.sampler.SubsetRandomSampler', 'SubsetRandomSampler', (['valid_idx'], {}), '(valid_idx)\n', (2638, 2649), False, 'from torch.utils.data.sampler import SubsetRandomSampler\n'), ((2671, 2701), 'tor... |
import os, sys
import time
import argparse
import shutil
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
# import video_transforms
# import models
# import datasets
import traceback
import logging
from func... | [
"ptq_lapq.image_classifier_ptq_lapq",
"image_classifier.init_classifier_compression_arg_parser",
"image_classifier.create_activation_stats_collectors",
"image_classifier.load_data",
"os.path.dirname",
"os.path.realpath",
"logging.getLogger",
"distiller.model_summary",
"numpy.arange",
"traceback.fo... | [((554, 573), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (571, 573), False, 'import logging\n'), ((1154, 1230), 'image_classifier.load_data', 'classifier.load_data', (['args'], {'load_train': '(False)', 'load_val': '(False)', 'load_test': '(True)'}), '(args, load_train=False, load_val=False, load_test=... |
import policy as policy_module
import env_rna
import torch
import numpy as np
import torch.nn.functional as F
import matplotlib.pyplot as mlp
import arc_diagram
from torch.distributions import Categorical
env = env_rna.EnvRNA()
class Reinforce:
running_reward = 0
MAX_ITER = 1000
exploration_eps = 10
... | [
"numpy.random.uniform",
"torch.distributions.Categorical",
"torch.stack",
"numpy.zeros",
"env_rna.EnvRNA",
"numpy.random.randint",
"policy.Policy",
"arc_diagram.phrantheses_to_pairing_list",
"torch.nn.functional.smooth_l1_loss",
"torch.tensor"
] | [((212, 228), 'env_rna.EnvRNA', 'env_rna.EnvRNA', ([], {}), '()\n', (226, 228), False, 'import env_rna\n'), ((440, 463), 'policy.Policy', 'policy_module.Policy', (['N'], {}), '(N)\n', (460, 463), True, 'import policy as policy_module\n'), ((651, 669), 'torch.distributions.Categorical', 'Categorical', (['probs'], {}), '... |
import numpy as np
from astropy.io import fits
def calc_erro(arquivo_1, arquivo_2, arquivo_3): #Define a funcao que calcula a soma quadratica dos erros dos 3 arquivos
hdul_1 = fits.open(arquivo_1) #Abre o arquivo Header Data Unit List, formado por um header e um data
hdul_2 = fits.open(arquivo_2)
hdul_3 = ... | [
"astropy.io.fits.PrimaryHDU",
"astropy.io.fits.open",
"numpy.sqrt"
] | [((181, 201), 'astropy.io.fits.open', 'fits.open', (['arquivo_1'], {}), '(arquivo_1)\n', (190, 201), False, 'from astropy.io import fits\n'), ((286, 306), 'astropy.io.fits.open', 'fits.open', (['arquivo_2'], {}), '(arquivo_2)\n', (295, 306), False, 'from astropy.io import fits\n'), ((320, 340), 'astropy.io.fits.open', ... |
"""
Trains End 2 End VarNet
"""
import argparse
import os
from pathlib import Path
import random
import numpy as np
import torch
import torch.distributed as dist
from torch.optim import Adam, lr_scheduler
from torch.utils.data import DataLoader, DistributedSampler
from torch.utils import tensorboard
import fastmri
f... | [
"torch.optim.lr_scheduler.StepLR",
"argparse.ArgumentParser",
"fastmri.models.VarNet",
"fastmri.data.transforms.VarNetDataTransform",
"torch.cuda.device_count",
"pathlib.Path",
"numpy.mean",
"fastmri.data.mri_data.SliceDataset",
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.nn.parallel.... | [((576, 631), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train E2E VarNet"""'}), "(description='Train E2E VarNet')\n", (599, 631), False, 'import argparse\n'), ((2888, 2913), 'torch.cuda.device_count', 'torch.cuda.device_count', ([], {}), '()\n', (2911, 2913), False, 'import torch\n'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import numpy as np
import cv2
import unittest
from random import randint
from ocr.classify import Classifier
from tempfile import NamedTemporaryFile
PARENT_DIR = os.path.dirname(__file__)
DATA_DIR = os.path.join(os.path.d... | [
"unittest.main",
"numpy.vsplit",
"ocr.classify.Classifier",
"ocr.classify.Classifier.from_pickle",
"cv2.cvtColor",
"os.path.dirname",
"numpy.hsplit",
"cv2.imread",
"numpy.array",
"numpy.reshape",
"os.path.join"
] | [((261, 286), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (276, 286), False, 'import os\n'), ((311, 338), 'os.path.dirname', 'os.path.dirname', (['PARENT_DIR'], {}), '(PARENT_DIR)\n', (326, 338), False, 'import os\n'), ((530, 566), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""digits.p... |
import numpy as np
import matplotlib.pyplot as plt
def create_gratings(n_spf, n_ori, n_phase, input_shape, x_train_mean, plot=False,
output_path=''):
# create various grating stimuli
grating_all = np.zeros((n_spf * n_ori * n_phase, ) + input_shape[:-1] + (3, ))
for s in range(n_spf):
... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.close",
"numpy.transpose",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.min",
"numpy.cos",
"numpy.max"
] | [((226, 288), 'numpy.zeros', 'np.zeros', (['((n_spf * n_ori * n_phase,) + input_shape[:-1] + (3,))'], {}), '((n_spf * n_ori * n_phase,) + input_shape[:-1] + (3,))\n', (234, 288), True, 'import numpy as np\n'), ((2844, 2887), 'numpy.cos', 'np.cos', (['(k_rot[1] * gx + k_rot[0] * gy + tau)'], {}), '(k_rot[1] * gx + k_rot... |
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import pytest
from motmot._queue import Queue
pytestmark = pytest.mark.order(3)
def test():
self = Queue(10)
assert not self
for i in range(7):
self.append(i)
assert len(self) == 7
assert self
assert np.all(self.queue[:7] == np.ar... | [
"pytest.mark.order",
"motmot._queue.Queue",
"numpy.arange"
] | [((113, 133), 'pytest.mark.order', 'pytest.mark.order', (['(3)'], {}), '(3)\n', (130, 133), False, 'import pytest\n'), ((159, 168), 'motmot._queue.Queue', 'Queue', (['(10)'], {}), '(10)\n', (164, 168), False, 'from motmot._queue import Queue\n'), ((885, 893), 'motmot._queue.Queue', 'Queue', (['(6)'], {}), '(6)\n', (890... |
# -*- coding: utf-8 -*-
#This is from https://github.com/weixsong vocoder implementation, please see LICENSE-weixsong
import librosa
import librosa.filters
import numpy as np
from scipy import signal
from params import hparams
def preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
def sp... | [
"numpy.abs",
"numpy.maximum",
"scipy.signal.lfilter",
"numpy.clip",
"librosa.filters.mel",
"numpy.dot",
"librosa.stft"
] | [((262, 311), 'scipy.signal.lfilter', 'signal.lfilter', (['[1, -hparams.preemphasis]', '[1]', 'x'], {}), '([1, -hparams.preemphasis], [1], x)\n', (276, 311), False, 'from scipy import signal\n'), ((699, 775), 'librosa.stft', 'librosa.stft', ([], {'y': 'y', 'n_fft': 'n_fft', 'hop_length': 'hop_length', 'win_length': 'wi... |
import pandas as pd
import numpy as np
from tqdm import tqdm, trange
data = pd.read_csv("result.csv", encoding="latin1").fillna(method="ffill")
print(data.tail(10))
class SentenceGetter(object):
def __init__(self, data):
self.n_sent = 1
self.data = data
self.empty = False
agg_func ... | [
"seqeval.metrics.accuracy_score",
"torch.utils.data.RandomSampler",
"numpy.argmax",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"joblib.dump",
"torch.cuda.device_count",
"torch.utils.data.TensorDataset",
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.utils.data.Sequent... | [((1670, 1695), 'torch.cuda.device_count', 'torch.cuda.device_count', ([], {}), '()\n', (1693, 1695), False, 'import torch\n'), ((1745, 1814), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-cased"""'], {'do_lower_case': '(False)'}), "('bert-base-cased', do_lower_case=Fals... |
import unittest
import subprocess
import sys
from jaxdax import core
from absl import logging
from absl.testing import absltest, parameterized
from jax._src import test_util as jtu
from jax._src.util import partial
import jax.numpy as jnp
import numpy as np
import jax
import builtins
def f(x, lib=core):
y = li... | [
"unittest.skipIf",
"subprocess.run",
"jax.vmap",
"absl.logging.use_absl_handler",
"jax._src.util.partial",
"jaxdax.core.vmap",
"absl.logging.info",
"numpy.arange",
"jax._src.test_util.JaxTestLoader",
"jax._src.test_util.skip_on_devices",
"absl.logging.set_verbosity"
] | [((871, 938), 'unittest.skipIf', 'unittest.skipIf', (['(not sys.executable)', '"""test requires sys.executable"""'], {}), "(not sys.executable, 'test requires sys.executable')\n", (886, 938), False, 'import unittest\n'), ((942, 975), 'jax._src.test_util.skip_on_devices', 'jtu.skip_on_devices', (['"""gpu"""', '"""tpu"""... |
# -*- coding: utf-8 -*-
"""
#------------------------------------------------------------------------------#
# #
# Project Name : Atmosphere&Ocean #
# ... | [
"os.remove",
"wrf.pvo",
"numpy.ones",
"numpy.shape",
"pyresample.geometry.SwathDefinition",
"glob.glob",
"netCDF4.Dataset",
"numpy.meshgrid",
"wrf.getvar",
"netCDF4.MFDataset",
"datetime.datetime.now",
"numpy.size",
"netCDF4.MFTime",
"datetime.datetime.strptime",
"wrf.interplevel",
"xa... | [((3536, 3578), 'wrf.getvar', 'wrf.getvar', (['nc_ls', 'var_name'], {'method': '"""join"""'}), "(nc_ls, var_name, method='join')\n", (3546, 3578), False, 'import wrf\n'), ((3823, 3860), 'wrf.getvar', 'wrf.getvar', (['nc_ls', '"""U"""'], {'method': '"""join"""'}), "(nc_ls, 'U', method='join')\n", (3833, 3860), False, 'i... |
"""
@author: <NAME>, UvA
Aim: apply Random Forest for classifying segments into given vegetation classes
Input: path of polygon with segment related features + label
Output: accuracy report, feature importance, classified shapefile
Example usage (from command line):
ToDo:
1. automatize feature_list definition
"""... | [
"imblearn.under_sampling.RandomUnderSampler",
"sklearn.cross_validation.train_test_split",
"sklearn.ensemble.RandomForestClassifier",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"argparse.ArgumentParser",
"numpy.concatenate",
"numpy.array2string",
"sklearn.metrics.classification_report",
... | [((1710, 1735), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1733, 1735), False, 'import argparse\n'), ((2015, 2068), 'geopandas.GeoDataFrame.from_file', 'gpd.GeoDataFrame.from_file', (['(args.path + args.segments)'], {}), '(args.path + args.segments)\n', (2041, 2068), True, 'import geopanda... |
import numpy as onp
import scipy.sparse
import scipy.sparse.linalg as spalg
from veros import logger, veros_kernel, veros_routine, distributed, runtime_state as rst
from veros.variables import allocate
from veros.core.operators import update, at, numpy as npx
from veros.core.external.solvers.base import LinearSolver
f... | [
"veros.variables.allocate",
"veros.core.operators.numpy.where",
"veros.distributed.scatter",
"veros.core.external.poisson_matrix.assemble_poisson_matrix",
"numpy.asarray",
"veros.core.operators.numpy.empty_like",
"scipy.sparse.linalg.bicgstab",
"veros.logger.warning",
"scipy.sparse.linalg.LinearOper... | [((430, 588), 'veros.veros_routine', 'veros_routine', ([], {'local_variables': "('hu', 'hv', 'hvr', 'hur', 'dxu', 'dxt', 'dyu', 'dyt', 'cosu', 'cost',\n 'isle_boundary_mask', 'maskT')", 'dist_safe': '(False)'}), "(local_variables=('hu', 'hv', 'hvr', 'hur', 'dxu', 'dxt',\n 'dyu', 'dyt', 'cosu', 'cost', 'isle_bound... |
import glob
import os
import numpy as np
from PIL import Image
import torch
import torch.utils.data as data
from configuration.base_config import BaseConfig, DataMode
class SmartSegmentationLoader(data.Dataset):
def __init__(self, config, img_files, mask_files, transforms):
super().__init__()
s... | [
"torch.randint",
"os.path.join",
"numpy.copy",
"PIL.Image.open"
] | [((1169, 1285), 'numpy.copy', 'np.copy', (['image[rand_row:rand_row + self._config.crop_size[0], rand_col:rand_col +\n self._config.crop_size[1], :]'], {}), '(image[rand_row:rand_row + self._config.crop_size[0], rand_col:\n rand_col + self._config.crop_size[1], :])\n', (1176, 1285), True, 'import numpy as np\n'),... |
import numpy as np
import matplotlib.pyplot as plt
import sys, os
from scipy.special import erf
from scipy.optimize import minimize_scalar
from math import isnan
from math import isinf
from dispsol import Jpole8, Jpole12
from dispsol import ES1d
plt.rc('font', family='serif')
plt.rc('xtick', labelsize=7)
plt.rc('... | [
"matplotlib.pyplot.subplot",
"numpy.sum",
"matplotlib.pyplot.subplots_adjust",
"dispsol.ES1d",
"matplotlib.pyplot.figure",
"numpy.imag",
"numpy.array",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.GridSpec",
"dispsol.Jpole12",
"numpy.linspace",
"numpy.real",
"matplotlib.pyplot.savefig",
"num... | [((252, 282), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (258, 282), True, 'import matplotlib.pyplot as plt\n'), ((283, 311), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick"""'], {'labelsize': '(7)'}), "('xtick', labelsize=7)\n", (289, 311), True, 'import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Code for reading and working with calibration data.
Author <NAME>, 2019
Author <NAME>, 2019
"""
import cv2
import numpy as np
import os
from typing import Tuple, List
from enum import Enum
import yaml
import functools
from libartipy.dataset import Constants, ... | [
"yaml.load",
"numpy.abs",
"numpy.floor",
"cv2.remap",
"os.path.join",
"numpy.zeros_like",
"os.path.exists",
"numpy.transpose",
"numpy.loadtxt",
"libartipy.dataset.Constants",
"functools.wraps",
"cv2.fisheye.stereoRectify",
"cv2.fisheye.initUndistortRectifyMap",
"libartipy.dataset.get_logge... | [((381, 393), 'libartipy.dataset.get_logger', 'get_logger', ([], {}), '()\n', (391, 393), False, 'from libartipy.dataset import Constants, get_logger\n'), ((581, 602), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (596, 602), False, 'import functools\n'), ((2896, 2905), 'numpy.eye', 'np.eye', (['(3)... |
"""
=========================
Fit exotic Hawkes kernels
=========================
This learner assumes Hawkes kernels are linear combinations of a given number
of kernel basis.
Here it is run on a an exotic data set generated with mixtures of two cosinus
functions. We observe that we can correctly retrieve the kernel... | [
"tick.hawkes.HawkesBasisKernels",
"tick.hawkes.SimuHawkes",
"matplotlib.pyplot.show",
"numpy.linspace",
"numpy.cos",
"tick.hawkes.HawkesKernelTimeFunc",
"tick.plot.plot_hawkes_kernels",
"tick.plot.plot_basis_kernels"
] | [((1044, 1068), 'numpy.linspace', 'np.linspace', (['(0)', '(20)', '(1000)'], {}), '(0, 20, 1000)\n', (1055, 1068), True, 'import numpy as np\n'), ((1215, 1276), 'tick.hawkes.SimuHawkes', 'SimuHawkes', ([], {'baseline': '[1e-05, 1e-05]', 'seed': '(1093)', 'verbose': '(False)'}), '(baseline=[1e-05, 1e-05], seed=1093, ver... |
import numpy as np
import scipy
from scipy import interpolate
from scipy.interpolate import interp1d
#configure paremeter
K = 64 # number of OFDM subcarriers
CP = K//4 # length of the cyclic prefix: 25% of the block
P = 8 # number of pilot carriers per OFDM block
pilotValue = 3+3j # The known value each pilot transmi... | [
"numpy.fft.ifft",
"numpy.random.binomial",
"numpy.random.randn",
"numpy.fft.fft",
"numpy.angle",
"numpy.zeros",
"numpy.hstack",
"numpy.append",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.arange",
"numpy.exp",
"numpy.convolve",
"numpy.conjugate",
"numpy.delete",
"numpy.vstack",... | [((338, 350), 'numpy.arange', 'np.arange', (['K'], {}), '(K)\n', (347, 350), True, 'import numpy as np\n'), ((764, 801), 'numpy.delete', 'np.delete', (['allCarriers', 'pilotCarriers'], {}), '(allCarriers, pilotCarriers)\n', (773, 801), True, 'import numpy as np\n'), ((1394, 1422), 'numpy.array', 'np.array', (['[1, 0, 0... |
import functools
import pickle
import torch
import numpy as np
def get_labels_stats(labels):
labels_set = torch.unique(labels).numpy().tolist()
num_labels = len(labels_set)
n_sample_per_label = labels.shape[0] // num_labels
return num_labels, n_sample_per_label
def data_subset(data, labels, n_way, wa... | [
"numpy.stack",
"torch.unique",
"torch.LongTensor",
"torch.load",
"torch.cat",
"pickle.load",
"numpy.array",
"functools.lru_cache",
"numpy.concatenate"
] | [((2656, 2677), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (2675, 2677), False, 'import functools\n'), ((858, 887), 'torch.cat', 'torch.cat', (['subset_data'], {'dim': '(0)'}), '(subset_data, dim=0)\n', (867, 887), False, 'import torch\n'), ((908, 939), 'torch.cat', 'torch.cat', (['subset_labels'],... |
"""Image 3D to vector / scalar conv net"""
import numpy as np
from micro_dl.networks.base_image_to_vector_net import BaseImageToVectorNet
class Image3DToVectorNet(BaseImageToVectorNet):
"""Uses 3D images as input"""
def __init__(self, network_config, predict=False):
"""Init
:param dict netw... | [
"numpy.log2"
] | [((622, 654), 'numpy.log2', 'np.log2', (["network_config['depth']"], {}), "(network_config['depth'])\n", (629, 654), True, 'import numpy as np\n')] |
"""Defines the class for OVR (one-versus-rest) classification."""
import functools
import numpy as np
from .predictors import Classifier
class OVRClassifier(Classifier):
"""Multiclass classification by solving a binary problem for each class.
"OVR" stands for "one-versus-rest", meaning that for each class... | [
"functools.partial",
"numpy.where",
"numpy.argmax"
] | [((1477, 1517), 'functools.partial', 'functools.partial', (['base', '*args'], {}), '(base, *args, **kwargs)\n', (1494, 1517), False, 'import functools\n'), ((3890, 3910), 'numpy.argmax', 'np.argmax', (['p'], {'axis': '(0)'}), '(p, axis=0)\n', (3899, 3910), True, 'import numpy as np\n'), ((3126, 3156), 'numpy.where', 'n... |
"""Tools helping with the TIMIT dataset.
Based on the version from:
https://www.kaggle.com/mfekadu/darpa-timit-acousticphonetic-continuous-speech
"""
import re
from os.path import join, splitext, dirname
from pathlib import Path
import numpy as np
import pandas as pd
import soundfile as sf
from audio_loader.ground_... | [
"numpy.sum",
"numpy.logical_and",
"pandas.read_csv",
"os.path.dirname",
"pandas.unique",
"pandas.notnull",
"pathlib.Path",
"numpy.where",
"os.path.join"
] | [((1131, 1148), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (1138, 1148), False, 'from os.path import join, splitext, dirname\n'), ((3867, 3903), 'pandas.unique', 'pd.unique', (["self.df_all['speaker_id']"], {}), "(self.df_all['speaker_id'])\n", (3876, 3903), True, 'import pandas as pd\n'), ((1202... |
import os
from collections import defaultdict
import sqlite3
import numpy as np
import pandas as pd
import lsst.afw.table as afw_table
import lsst.daf.persistence as dp
import lsst.geom
import desc.sims_ci_pipe as scp
def make_SourceCatalog(df):
bands = 'ugrizy'
schema = afw_table.SourceTable.makeMinimalSchem... | [
"lsst.afw.table.matchRaDec",
"lsst.daf.persistence.Butler",
"numpy.degrees",
"desc.sims_truthcatalog.StellarLightCurveFactory",
"lsst.afw.table.SourceTable.makeMinimalSchema",
"numpy.zeros",
"collections.defaultdict",
"os.path.isfile",
"sqlite3.connect",
"pandas.read_sql",
"pandas.read_pickle",
... | [((282, 323), 'lsst.afw.table.SourceTable.makeMinimalSchema', 'afw_table.SourceTable.makeMinimalSchema', ([], {}), '()\n', (321, 323), True, 'import lsst.afw.table as afw_table\n'), ((440, 471), 'lsst.afw.table.SourceCatalog', 'afw_table.SourceCatalog', (['schema'], {}), '(schema)\n', (463, 471), True, 'import lsst.afw... |
import math
import copy
import cv2
import numpy as np
from .connected_component import ConnectedComponentData
from typing import List
__sw_median_max_ratio = 2
__height_max_ratio = 1.5
__max_chain_height = 150
__max_distance_multiplier = 3
__min_chain_size = 3
__max_average_gray_diff = 3
__gray_variance_coefficient ... | [
"copy.deepcopy",
"numpy.average",
"math.sqrt",
"cv2.rectangle"
] | [((2325, 2412), 'math.sqrt', 'math.sqrt', (['((cc_2.row_max - cc_1.row_max) ** 2 + (cc_2.col_min - cc_1.col_max) ** 2)'], {}), '((cc_2.row_max - cc_1.row_max) ** 2 + (cc_2.col_min - cc_1.col_max\n ) ** 2)\n', (2334, 2412), False, 'import math\n'), ((9658, 9676), 'copy.deepcopy', 'copy.deepcopy', (['img'], {}), '(img... |
import collections
import numpy
__all__ = [
"Output",
]
Output = collections.namedtuple("Output", ["type", "format", "time", "labels", "data"])
def to_output(file_type, file_format, labels_order, headers, times, labels, variables):
"""Create an Output namedtuple."""
outputs = [
Output(
... | [
"numpy.transpose",
"numpy.array",
"collections.namedtuple"
] | [((73, 151), 'collections.namedtuple', 'collections.namedtuple', (['"""Output"""', "['type', 'format', 'time', 'labels', 'data']"], {}), "('Output', ['type', 'format', 'time', 'labels', 'data'])\n", (95, 151), False, 'import collections\n'), ((391, 409), 'numpy.array', 'numpy.array', (['label'], {}), '(label)\n', (402,... |
import numpy as np
x = 1.0
y = 2.0
#exponents and logarithms
print(np.exp(x)) #e^x
print(np.log(x)) #ln x
print(np.log10(x)) #log_10 x
print(np.log2(x)) #log_2 x
#min/max/misc
print(np.fabs(x)) #absolute cal as a float
print(np.fmin(x,y)) #min of x and y
print(np.fmax(x,y)) #max of x and y
#populate arrays
n = 1... | [
"numpy.fmin",
"numpy.fmax",
"numpy.log",
"numpy.log2",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"numpy.fabs",
"numpy.interp",
"numpy.log10"
] | [((327, 352), 'numpy.arange', 'np.arange', (['n'], {'dtype': 'float'}), '(n, dtype=float)\n', (336, 352), True, 'import numpy as np\n'), ((416, 425), 'numpy.sin', 'np.sin', (['z'], {}), '(z)\n', (422, 425), True, 'import numpy as np\n'), ((69, 78), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (75, 78), True, 'import nu... |
# congklak game environment
# version 1.0.0
import numpy as np
import random
class congklak_board:
def __init__(self):
# array to save the score, also function as the big holes' stone counter
self.score = np.full(shape=2, fill_value=0, dtype=np.int)
# array to save the state of th... | [
"numpy.full",
"numpy.savetxt",
"numpy.zeros",
"numpy.append",
"numpy.array",
"numpy.concatenate"
] | [((227, 271), 'numpy.full', 'np.full', ([], {'shape': '(2)', 'fill_value': '(0)', 'dtype': 'np.int'}), '(shape=2, fill_value=0, dtype=np.int)\n', (234, 271), True, 'import numpy as np\n'), ((7282, 7308), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.int'}), '([], dtype=np.int)\n', (7290, 7308), True, 'import numpy ... |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 12 11:56:46 2019
@author: <NAME>
Assignment 1:
- Convert a RAW rgb image to a YUV format then Reconstruct the RGB channels.
- Compute the PSNR between the source rgb image and the Reconstructed RGB using
4:4:4, 4:2:2 and 4:1:1 format.
- You may select to use the averag... | [
"numpy.sum",
"math.sqrt",
"numpy.fromfile",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.shape",
"cv2.imread",
"numpy.array",
"numpy.reshape",
"cv2.merge",
"cv2.imshow"
] | [((1307, 1368), 'numpy.fromfile', 'np.fromfile', (['"""Lena Gray Raw Image.txt"""'], {'dtype': '"""uint8"""', 'sep': '""""""'}), "('Lena Gray Raw Image.txt', dtype='uint8', sep='')\n", (1318, 1368), True, 'import numpy as np\n'), ((1375, 1398), 'numpy.reshape', 'np.reshape', (['img', '(W, H)'], {}), '(img, (W, H))\n', ... |
import math
import numpy as np
import scipy as s
import scipy.integrate as q
import matplotlib.pyplot as plt
#Constants
H0 = 2.19507453e-18 #using 67.74
Wm = 0.279
Wq = 1 - Wm
w = -1
#Basic Functions
def H(a):
return H0*np.sqrt(Wm*a**(-3) + Wq*a**(-3*(1+w)))
def dH(a):
return (H0**2/(2*H(a)))*(-3*Wm*a**(-4) -... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.integrate.quad",
"scipy.integrate.odeint",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplot... | [((1292, 1313), 'numpy.linspace', 'np.linspace', (['a0', '(1)', 'N'], {}), '(a0, 1, N)\n', (1303, 1313), True, 'import numpy as np\n'), ((1319, 1339), 'scipy.integrate.odeint', 'q.odeint', (['z3', 'y30', 'a'], {}), '(z3, y30, a)\n', (1327, 1339), True, 'import scipy.integrate as q\n'), ((1443, 1456), 'matplotlib.pyplot... |
import os
import numpy as np
import pandas as pd
from scipy.io import loadmat, savemat
import matplotlib.pyplot as plt
import seaborn as sns
def match_strings(strings, path, any_or_all='any'):
if any_or_all == 'any':
return any([string in path for string in strings])
elif any_or_all == 'all':
r... | [
"os.remove",
"numpy.abs",
"scipy.io.loadmat",
"numpy.mean",
"numpy.diag",
"os.path.join",
"numpy.unique",
"numpy.atleast_2d",
"pandas.DataFrame",
"seaborn.reset_defaults",
"shutil.copyfile",
"matplotlib.pyplot.subplots",
"numpy.repeat",
"seaborn.scatterplot",
"matplotlib.pyplot.legend",
... | [((3043, 3066), 'numpy.atleast_2d', 'np.atleast_2d', (['data_vec'], {}), '(data_vec)\n', (3056, 3066), True, 'import numpy as np\n'), ((4643, 4686), 'pandas.to_numeric', 'pd.to_numeric', (["df['value']"], {'errors': '"""coerce"""'}), "(df['value'], errors='coerce')\n", (4656, 4686), True, 'import pandas as pd\n'), ((47... |
#!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import os
import json
import argparse
from collections import OrderedDict
import h5py
import ntpath
import cv2
import numpy as np
from xfdnn.rt.xdnn_util import literal_eval
from ext.PyTurboJPEG import imread as ... | [
"argparse.ArgumentParser",
"xfdnn.tools.compile.bin.xfdnn_compiler_caffe.default_compiler_arg_parser",
"os.walk",
"numpy.argsort",
"os.path.isfile",
"os.path.join",
"os.path.abspath",
"os.path.exists",
"numpy.transpose",
"cv2.resize",
"numpy.stack",
"h5py.File",
"numpy.asarray",
"xfdnn.too... | [((1306, 1351), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""pyXDNN"""'}), "(description='pyXDNN')\n", (1329, 1351), False, 'import argparse\n'), ((4937, 4989), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""XDLF_compiled"""'}), "(description='XDLF_compi... |
from PIL import Image
from torchvision import transforms
import torch
from torch.utils import data
import torch.nn.functional as F
import numpy as np
import pandas as pd
import json
import copy
from sklearn import metrics
import sys, getopt
import os
import glob
import random
import collections
import time
from tqdm ... | [
"os.mkdir",
"argparse.ArgumentParser",
"numpy.argmax",
"pandas.read_csv",
"torch.cuda.device_count",
"torch.cuda.current_device",
"torchvision.transforms.Normalize",
"torch.no_grad",
"sys.path.append",
"pandas.DataFrame",
"numpy.copy",
"Data_Generator.Dataset_WSI",
"torch.utils.data.DataLoad... | [((354, 382), 'sys.path.append', 'sys.path.append', (['"""../utils/"""'], {}), "('../utils/')\n", (369, 382), False, 'import sys, getopt\n'), ((568, 628), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""TMA patches extractor"""'}), "(description='TMA patches extractor')\n", (591, 628), Fa... |
from abc import ABC, abstractmethod
import numpy as np
class User(ABC):
"""
User in the typing environment. Can be simulated or a real user.
:param input_dim: (Tuple(int)) The dimensionality of the inputs this users produces.
"""
def __init__(self, input_dim, n_samples, baseline_temp, boltzmann_e... | [
"numpy.squeeze",
"numpy.sum",
"numpy.exp",
"numpy.array"
] | [((1370, 1386), 'numpy.squeeze', 'np.squeeze', (['pred'], {}), '(pred)\n', (1380, 1386), True, 'import numpy as np\n'), ((1924, 1933), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (1930, 1933), True, 'import numpy as np\n'), ((1964, 1984), 'numpy.sum', 'np.sum', (['unnormalized'], {}), '(unnormalized)\n', (1970, 1984),... |
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import random
from keras.utils import np_utils
from keras.datasets import mnist
from keras.models import Model,Sequential
from keras.layers import Input, Flatten, Dense, Dropout, Lambda, concatenate, Add
from keras.optimize... | [
"keras.layers.Dropout",
"keras.backend.epsilon",
"keras.models.Model",
"keras.backend.square",
"keras.optimizers.RMSprop",
"keras.utils.np_utils.to_categorical",
"keras.callbacks.TensorBoard",
"numpy.array",
"numpy.mean",
"keras.layers.Lambda",
"keras.layers.Dense",
"keras.layers.Input",
"nu... | [((7099, 7116), 'numpy.array', 'np.array', (['x_train'], {}), '(x_train)\n', (7107, 7116), True, 'import numpy as np\n'), ((7126, 7142), 'numpy.array', 'np.array', (['x_test'], {}), '(x_test)\n', (7134, 7142), True, 'import numpy as np\n'), ((7248, 7265), 'numpy.array', 'np.array', (['y_train'], {}), '(y_train)\n', (72... |
import gym
import numpy as np
import pygame
from pygame.locals import *
import time
import sys
sys.path.append('../')
ENV_NAME = 'PlaygroundNavigationHuman-v1'
from src.playground_env.reward_function import sample_descriptions_from_state, get_reward_from_state
from src.playground_env.descriptions import generate_all_... | [
"sys.path.append",
"src.playground_env.reward_function.get_reward_from_state",
"gym.make",
"src.playground_env.reward_function.sample_descriptions_from_state",
"pygame.event.get",
"numpy.zeros",
"pygame.init",
"src.playground_env.descriptions.generate_all_descriptions",
"time.sleep",
"numpy.random... | [((96, 118), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (111, 118), False, 'import sys\n'), ((494, 559), 'gym.make', 'gym.make', (['ENV_NAME'], {'reward_screen': '(False)', 'viz_data_collection': '(True)'}), '(ENV_NAME, reward_screen=False, viz_data_collection=True)\n', (502, 559), False, '... |
# -- coding: utf-8 --
import numpy as np
from sklearn.model_selection import train_test_split
def load_data(file_path='/data/u.data'):
"""
加载movielens评分数据
:param file_path: ratings数据存储位置
:return: 评分对(uid, mid, rating)数组,用户数量,电影数量
"""
data = []
for line in open(file_path, 'r'):
arr ... | [
"sklearn.model_selection.train_test_split",
"numpy.max",
"numpy.array",
"numpy.unique"
] | [((467, 481), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (475, 481), True, 'import numpy as np\n'), ((795, 828), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'test_size'], {}), '(data, test_size)\n', (811, 828), False, 'from sklearn.model_selection import train_test_split\n'), (... |
import numpy as np
def get_1d_gauss_kernel(sigma, extent=3):
"""Build a 1-dimensional Gaussian kernel.
Parameters
----------
sigma : int or float
The standard deviation of the Gaussian function.
extent : int, optional
How many times sigma to consider on each side of the mean. 3 x... | [
"numpy.arange",
"numpy.sum",
"numpy.ceil",
"numpy.flip"
] | [((561, 584), 'numpy.ceil', 'np.ceil', (['(sigma * extent)'], {}), '(sigma * extent)\n', (568, 584), True, 'import numpy as np\n'), ((678, 692), 'numpy.sum', 'np.sum', (['kernel'], {}), '(kernel)\n', (684, 692), True, 'import numpy as np\n'), ((1998, 2012), 'numpy.sum', 'np.sum', (['kernel'], {}), '(kernel)\n', (2004, ... |
"""Plotting functions for visualizing distributions."""
from __future__ import division
import numpy as np
from scipy import stats
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import warnings
try:
import statsmodels.nonparametric.api as smnp
_has_statsmodels = True
except Import... | [
"numpy.meshgrid",
"numpy.zeros_like",
"matplotlib.colors.colorConverter.to_rgb",
"numpy.isscalar",
"numpy.asarray",
"scipy.stats.gaussian_kde",
"numpy.ndim",
"statsmodels.nonparametric.api.KDEMultivariate",
"numpy.mean",
"numpy.linspace",
"matplotlib.pyplot.gca",
"warnings.warn",
"statsmodel... | [((662, 675), 'numpy.asarray', 'np.asarray', (['a'], {}), '(a)\n', (672, 675), True, 'import numpy as np\n'), ((7970, 7994), 'statsmodels.nonparametric.api.KDEUnivariate', 'smnp.KDEUnivariate', (['data'], {}), '(data)\n', (7988, 7994), True, 'import statsmodels.nonparametric.api as smnp\n'), ((10549, 10587), 'statsmode... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 29 22:49:48 2020
@author: adwait
"""
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QGridLayout, QLabel,\
QComboBox,QLineEdit, QTextEdit, QCheckBox, QPushButton, QGroupBox
# from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont
import matplotlib
ma... | [
"numpy.random.seed",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QVBoxLayout",
"numpy.random.normal",
"numpy.diag",
"PyQt5.QtWidgets.QLabel",
"matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg",
"PyQt5.QtWidgets.QCheckBox",
"matplotlib.figure.Figure",
"numpy... | [((318, 342), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (332, 342), False, 'import matplotlib\n'), ((919, 936), 'PyQt5.QtWidgets.QVBoxLayout', 'QVBoxLayout', (['self'], {}), '(self)\n', (930, 936), False, 'from PyQt5.QtWidgets import QWidget, QVBoxLayout, QGridLayout, QLabel, QComboBox... |
import numpy as np
import matplotlib.pyplot as plt
def estimate_pi(n, plot=False):
pts = np.random.random((n, 2))
norm = np.linalg.norm(pts, axis=-1)
frac_in_circle = np.average(norm <= 1)
pi_est = frac_in_circle * 4
if plot:
plt.plot(pts[:, 0], pts[:, 1], ',')
... | [
"numpy.average",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axis",
"numpy.random.random",
"numpy.linalg.norm",
"numpy.linspace",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.tight_layout",
"numpy.sqrt"
] | [((98, 122), 'numpy.random.random', 'np.random.random', (['(n, 2)'], {}), '((n, 2))\n', (114, 122), True, 'import numpy as np\n'), ((137, 165), 'numpy.linalg.norm', 'np.linalg.norm', (['pts'], {'axis': '(-1)'}), '(pts, axis=-1)\n', (151, 165), True, 'import numpy as np\n'), ((188, 209), 'numpy.average', 'np.average', (... |
import numpy
from sklearn.feature_extraction import DictVectorizer
from sklearn.pipeline import Pipeline
from newsgac.nlp_tools.transformers import ExtractSentimentFeatures
def test_sentiment_features():
text = 'Dit is een willekeurige tekst waar wat sentiment features uitgehaald worden. Dit is de tweede zin.'
... | [
"newsgac.nlp_tools.transformers.ExtractSentimentFeatures",
"numpy.array",
"sklearn.feature_extraction.DictVectorizer"
] | [((490, 531), 'numpy.array', 'numpy.array', (["['polarity', 'subjectivity']"], {}), "(['polarity', 'subjectivity'])\n", (501, 531), False, 'import numpy\n'), ((383, 409), 'newsgac.nlp_tools.transformers.ExtractSentimentFeatures', 'ExtractSentimentFeatures', ([], {}), '()\n', (407, 409), False, 'from newsgac.nlp_tools.t... |
from . import unittest, numpy
from shapely.geometry import LineString, MultiLineString, asMultiLineString
from shapely.geometry.base import dump_coords
class MultiLineStringTestCase(unittest.TestCase):
def test_multipoint(self):
# From coordinate tuples
geom = MultiLineString((((1.0, 2.0), (3.0,... | [
"shapely.geometry.MultiLineString",
"shapely.geometry.asMultiLineString",
"shapely.geometry.base.dump_coords",
"shapely.geometry.LineString",
"numpy.array"
] | [((285, 329), 'shapely.geometry.MultiLineString', 'MultiLineString', (['(((1.0, 2.0), (3.0, 4.0)),)'], {}), '((((1.0, 2.0), (3.0, 4.0)),))\n', (300, 329), False, 'from shapely.geometry import LineString, MultiLineString, asMultiLineString\n'), ((534, 570), 'shapely.geometry.LineString', 'LineString', (['((1.0, 2.0), (3... |
import sys
import os
import numpy as np
from typing import Union
from PIL import Image, ImageDraw, ImageFont
from weblogo import colorscheme
from weblogo.color import Color
from weblogo.seq import protein_alphabet
try:
import bokeh as bk
from bokeh.plotting import figure, show
from bokeh.core.properties i... | [
"PIL.Image.new",
"bokeh.io.output_notebook",
"numpy.meshgrid",
"bokeh.plotting.figure",
"PIL.ImageFont.load_default",
"weblogo.color.Color.from_string",
"os.path.dirname",
"bokeh.models.Range1d",
"weblogo.colorscheme.SymbolColor",
"PIL.ImageFont.truetype",
"numpy.arange",
"bokeh.plotting.show"... | [((423, 440), 'bokeh.io.output_notebook', 'output_notebook', ([], {}), '()\n', (438, 440), False, 'from bokeh.io import output_notebook\n'), ((7357, 7399), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(width, height)', '"""white"""'], {}), "('RGB', (width, height), 'white')\n", (7366, 7399), False, 'from PIL import Im... |
from math import floor, ceil
import numpy as np
import matplotlib.pyplot as plt
import datetime
import folium
import random
import seaborn as sns
import pandas as pd
import plotly.express as px
import geopandas as gpd
# import movingpandas as mpd
# from statistics import mean
from shapely.geometry import Polygon, Mult... | [
"seaborn.kdeplot",
"matplotlib.pyplot.suptitle",
"plotly.express.scatter_mapbox",
"matplotlib.pyplot.bar",
"geopandas.sjoin",
"pandas.read_csv",
"geopy.distance.great_circle",
"matplotlib.pyplot.figure",
"folium.Map",
"seaborn.pairplot",
"folium.Polygon",
"branca.colormap.linear.YlOrRd_09.scal... | [((1315, 1383), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['points.time.iloc[0]', '"""%Y-%m-%dT%H:%M:%S"""'], {}), "(points.time.iloc[0], '%Y-%m-%dT%H:%M:%S')\n", (1341, 1383), False, 'import datetime\n'), ((1578, 1590), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1588, 1590), True, ... |
import numpy as np
from deepobs.pytorch.runners import StandardRunner
from deepobs.tuner import GridSearch
from torch.optim import SGD
from probprec import Preconditioner
from sorunner import SORunner
optimizer_class = Preconditioner
hyperparams = {"lr": {"type": float},
"est_rank": {"type": int}}
# The d... | [
"numpy.logspace",
"deepobs.tuner.GridSearch"
] | [((542, 620), 'deepobs.tuner.GridSearch', 'GridSearch', (['optimizer_class', 'hyperparams', 'grid'], {'runner': 'SORunner', 'ressources': '(20)'}), '(optimizer_class, hyperparams, grid, runner=SORunner, ressources=20)\n', (552, 620), False, 'from deepobs.tuner import GridSearch\n'), ((374, 396), 'numpy.logspace', 'np.l... |
import logging
import typhon
import netCDF4
import numpy as np
from scipy.interpolate import interp1d
from copy import copy
from konrad import constants
from konrad import utils
from konrad.component import Component
__all__ = [
'Atmosphere',
]
logger = logging.getLogger(__name__)
class Atmosphere(Component):... | [
"numpy.argmax",
"typhon.arts.types.GriddedField4",
"numpy.argmin",
"logging.getLogger",
"scipy.interpolate.interp1d",
"numpy.round",
"netCDF4.Dataset",
"numpy.zeros_like",
"typhon.arts.utils.get_arts_typename",
"numpy.cumsum",
"konrad.utils.standard_atmosphere",
"typhon.arts.xml.load",
"konr... | [((262, 289), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (279, 289), False, 'import logging\n'), ((1261, 1289), 'konrad.utils.plev_from_phlev', 'utils.plev_from_phlev', (['phlev'], {}), '(phlev)\n', (1282, 1289), False, 'from konrad import utils\n'), ((3065, 3094), 'typhon.arts.xml.lo... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: <NAME>, <NAME>, <NAME>
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
from itertools import izip
import numpy as np
from pymor.core.in... | [
"pymor.operators.numpy.NumpyMatrixOperator",
"pymor.la.basic.induced_norm",
"pymor.la.numpyvectorarray.NumpyVectorArray",
"numpy.ones",
"pymor.reductors.basic.reduce_generic_rb",
"numpy.arange",
"itertools.izip",
"numpy.dot"
] | [((2949, 3023), 'pymor.reductors.basic.reduce_generic_rb', 'reduce_generic_rb', (['d', 'RB'], {'disable_caching': 'disable_caching', 'extends': 'extends'}), '(d, RB, disable_caching=disable_caching, extends=extends)\n', (2966, 3023), False, 'from pymor.reductors.basic import reduce_generic_rb\n'), ((5688, 5725), 'pymor... |
import os
import json
import shutil
import cv2
import sys
import math
# import tensorflow as tf
import numpy as np
# import align.detect_face
# import facenet
import requests
import tempfile
import _pickle as pickle
import urllib.request as request
from collections import namedtuple
from google_images_download import g... | [
"os.remove",
"os.makedirs",
"os.stat",
"os.path.exists",
"google_images_download.google_images_download.googleimagesdownload",
"cv2.imread",
"numpy.mean",
"tempfile.mkdtemp",
"collections.namedtuple",
"shutil.move",
"requests.get",
"numpy.array",
"shutil.rmtree",
"urllib.request.urlretriev... | [((616, 667), 'collections.namedtuple', 'namedtuple', (['"""BoundingBox"""', "['x1', 'x2', 'y1', 'y2']"], {}), "('BoundingBox', ['x1', 'x2', 'y1', 'y2'])\n", (626, 667), False, 'from collections import namedtuple\n'), ((420, 452), 'os.path.exists', 'os.path.exists', (['TMP_DOWNLOAD_DIR'], {}), '(TMP_DOWNLOAD_DIR)\n', (... |
import os
import re
import numpy as np
import pandas as pd
import ujson as json
import json as js
import sys
import argparse
class UCIDataset:
def __init__(self, window, source_dataset, output_json, imputing_columns):
self.read_dataset(source_dataset)
self.window = window
self.set_ids()
... | [
"pandas.DataFrame",
"json.dump",
"argparse.ArgumentParser",
"numpy.nan_to_num",
"pandas.read_csv",
"pandas.get_dummies",
"numpy.ones",
"numpy.isnan",
"numpy.array",
"ujson.dumps"
] | [((2823, 2839), 'numpy.array', 'np.array', (['deltas'], {}), '(deltas)\n', (2831, 2839), True, 'import numpy as np\n'), ((4918, 4933), 'ujson.dumps', 'json.dumps', (['rec'], {}), '(rec)\n', (4928, 4933), True, 'import ujson as json\n'), ((5005, 5030), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.