code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from keras import Model
from keras import models
from keras import optimizers
from keras import Sequential
from keras import layers
from keras import losses
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adam
import keras.backend as K
import keras.applications
from keras import ap... | [
"keras.layers.Conv2D",
"keras.Model",
"numpy.array",
"keras.layers.Input",
"keras.applications.vgg16.preprocess_input",
"cv2.resize",
"cv2.imread",
"keras.applications.VGG16"
] | [((747, 804), 'keras.applications.VGG16', 'applications.VGG16', ([], {'include_top': '(False)', 'weights': '"""imagenet"""'}), "(include_top=False, weights='imagenet')\n", (765, 804), False, 'from keras import applications\n'), ((8568, 8660), 'keras.layers.Input', 'layers.Input', ([], {'shape': '(None, None, number_of_... |
# Licensed under an MIT open source license - see LICENSE
import numpy as np
import pytest
from .. import Dendrogram, periodic_neighbours, Structure
class Test2DimensionalData(object):
def test_dendrogramWithNan(self):
n = np.nan
data = np.array([[n, n, n, n, n, n, n, n],
... | [
"numpy.prod",
"numpy.ones",
"numpy.indices",
"os.path.dirname",
"numpy.array",
"astropy.io.fits.getdata",
"numpy.zeros",
"numpy.testing.assert_array_equal"
] | [((8402, 8463), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0], [1, 1, 0, 1, 1], [0, 0, 0, 0, 0]]'], {}), '([[0, 0, 0, 0, 0], [1, 1, 0, 1, 1], [0, 0, 0, 0, 0]])\n', (8410, 8463), True, 'import numpy as np\n'), ((8629, 8701), 'numpy.array', 'np.array', (['[[-1, -1, -1, -1, -1], [0, 0, -1, 0, 0], [-1, -1, -1, -1, -1]]'],... |
import unittest
import numpy
from templevel import TempLevel
from pymclevel.box import BoundingBox
__author__ = 'Rio'
class TestJavaLevel(unittest.TestCase):
def setUp(self):
self.creativelevel = TempLevel("Dojo_64_64_128.dat")
self.indevlevel = TempLevel("hell.mclevel")
def testCopy(self):
... | [
"pymclevel.box.BoundingBox",
"numpy.array",
"templevel.TempLevel"
] | [((210, 241), 'templevel.TempLevel', 'TempLevel', (['"""Dojo_64_64_128.dat"""'], {}), "('Dojo_64_64_128.dat')\n", (219, 241), False, 'from templevel import TempLevel\n'), ((268, 293), 'templevel.TempLevel', 'TempLevel', (['"""hell.mclevel"""'], {}), "('hell.mclevel')\n", (277, 293), False, 'from templevel import TempLe... |
from torch.optim import Adam, SGD, AdamW
import torch
from torch.optim.lr_scheduler import OneCycleLR
import numpy as np
import os
import time
from torch.utils.data import DataLoader
from dataset.vocab import Vocab
from dataset.add_noise import SynthesizeData
from params import *
from models.seq2seq import Seq2Seq
from... | [
"dataset.vocab.Vocab",
"numpy.mean",
"utils.utils.batch_translate_beam_search",
"os.makedirs",
"torch.device",
"torch.optim.lr_scheduler.OneCycleLR",
"torch.load",
"os.path.split",
"torch.no_grad",
"dataset.add_noise.SynthesizeData",
"utils.metrics.compute_accuracy",
"torch.utils.data.DataLoad... | [((732, 749), 'dataset.vocab.Vocab', 'Vocab', (['alphabets_'], {}), '(alphabets_)\n', (737, 749), False, 'from dataset.vocab import Vocab\n'), ((777, 806), 'dataset.add_noise.SynthesizeData', 'SynthesizeData', ([], {'vocab_path': '""""""'}), "(vocab_path='')\n", (791, 806), False, 'from dataset.add_noise import Synthes... |
"""This script trigger convolution operation. We think it cause more
GPU power consumption then gemm call.
"""
import numpy as np
import theano
import theano.tensor as T
from theano.gpuarray import dnn
from theano.tensor.nnet.abstract_conv import get_conv_output_shape
def burn():
sz = 128
img_shp = [sz, s... | [
"theano.gpuarray.dnn._dnn_conv",
"theano.function",
"theano.printing.debugprint",
"numpy.random.rand",
"theano.tensor.nnet.abstract_conv.get_conv_output_shape",
"theano.compile.get_default_mode",
"theano.tensor.tensor4"
] | [((380, 437), 'theano.tensor.nnet.abstract_conv.get_conv_output_shape', 'get_conv_output_shape', (['img_shp', 'kern_shp', '"""valid"""', '(1, 1)'], {}), "(img_shp, kern_shp, 'valid', (1, 1))\n", (401, 437), False, 'from theano.tensor.nnet.abstract_conv import get_conv_output_shape\n'), ((448, 464), 'theano.tensor.tenso... |
import unittest
import numpy as np
import scipy.sparse as sp
from multimodal.lib.array_utils import normalize_features
from multimodal.evaluation import (evaluate_label_reco,
evaluate_NN_label,
chose_examples)
class TestLabelEvaluation(unittest.T... | [
"multimodal.evaluation.evaluate_label_reco",
"multimodal.lib.array_utils.normalize_features",
"multimodal.evaluation.evaluate_NN_label",
"numpy.allclose",
"scipy.sparse.lil_matrix",
"multimodal.evaluation.chose_examples",
"numpy.random.random",
"scipy.sparse.csr_matrix",
"numpy.array",
"numpy.rand... | [((390, 444), 'numpy.array', 'np.array', (['[[0.1, 0.5, 0.6, 0.1], [0.6, 0.5, 0.2, 0.1]]'], {}), '([[0.1, 0.5, 0.6, 0.1], [0.6, 0.5, 0.2, 0.1]])\n', (398, 444), True, 'import numpy as np\n'), ((477, 510), 'multimodal.evaluation.evaluate_label_reco', 'evaluate_label_reco', (['reco', 'labels'], {}), '(reco, labels)\n', (... |
import numpy as np
class constant:
def __init__(self, rc):
""" rc """
self.rc = rc
def radial(self, r):
return self.rc, 0
class gaussian:
def __init__(self, rc):
""" exp( - r^2 / 2 rc^2 ) """
self.rc = rc
def radial(self, r):
x = -r / self.rc**2
... | [
"numpy.exp",
"numpy.sin",
"numpy.cos"
] | [((331, 348), 'numpy.exp', 'np.exp', (['(x * r / 2)'], {}), '(x * r / 2)\n', (337, 348), True, 'import numpy as np\n'), ((562, 571), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (568, 571), True, 'import numpy as np\n'), ((656, 665), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (662, 665), True, 'import numpy as np\n')... |
import os
import time
import resource
import numpy as np
import torch as th
from . import logger
from mpi4py import MPI
def rcm(start, stop, modulus, mode="[)"):
"""
Interval contains multiple, where 'mode' specifies whether it's
closed or open on either side
This was very tricky to get right
"""... | [
"numpy.mean",
"resource.getrusage",
"torch.cuda.max_memory_allocated",
"numpy.std",
"torch.cuda.is_available",
"torch.save",
"torch.cuda.reset_max_memory_allocated",
"time.time"
] | [((1681, 1692), 'time.time', 'time.time', ([], {}), '()\n', (1690, 1692), False, 'import time\n'), ((4939, 4950), 'time.time', 'time.time', ([], {}), '()\n', (4948, 4950), False, 'import time\n'), ((5457, 5479), 'torch.cuda.is_available', 'th.cuda.is_available', ([], {}), '()\n', (5477, 5479), True, 'import torch as th... |
import os
import cv2
import argparse
import numpy as np
from matplotlib import pyplot as plt
from roipoly import MultiRoi
parser = argparse.ArgumentParser(description='Label stop sign image')
parser.add_argument('-i',
nargs=1,
help='input image path',
dest='i... | [
"matplotlib.pyplot.imshow",
"numpy.savez",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.title",
"argparse.ArgumentParser",
"os.path.splitext",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.figure",
"roipoly.MultiRoi",
"cv2.cvtColor",
"matplotlib.pyplot.axis",
"cv2.imread",
"matplotli... | [((132, 192), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Label stop sign image"""'}), "(description='Label stop sign image')\n", (155, 192), False, 'import argparse\n'), ((422, 442), 'cv2.imread', 'cv2.imread', (['IMG_FILE'], {}), '(IMG_FILE)\n', (432, 442), False, 'import cv2\n'), (... |
import cv2
import os
import csv
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn.model_selection import train_test_split
import tensorflow as tf
from keras.models import Sequential
from keras.layers import Flatten, Dense, Lambda, Cropping2D
from keras.layers import Convolution2D, Conv2D
fr... | [
"keras.layers.Conv2D",
"tensorflow.image.resize_images",
"matplotlib.pyplot.ylabel",
"numpy.array",
"keras.layers.Dense",
"keras.layers.Cropping2D",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"keras.callbacks.EarlyStopping",
"csv.reader",
"matplotlib.pyplot.savefig",
"random.shuffle... | [((3642, 3682), 'sklearn.model_selection.train_test_split', 'train_test_split', (['samples'], {'test_size': '(0.2)'}), '(samples, test_size=0.2)\n', (3658, 3682), False, 'from sklearn.model_selection import train_test_split\n'), ((6101, 6177), 'keras.callbacks.ModelCheckpoint', 'ModelCheckpoint', ([], {'filepath': 'new... |
# Copyright 2020 The TensorFlow Quantum 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... | [
"cirq.ParamResolver",
"tensorflow_quantum.core.ops.batch_util.batch_calculate_expectation",
"cirq.Circuit",
"numpy.array",
"tensorflow_quantum.core.ops.circuit_execution_ops.get_expectation_op",
"tensorflow_quantum.core.ops.batch_util.batch_calculate_sampled_expectation",
"numpy.arange",
"cirq.sim.den... | [((1143, 1180), 'cirq.sim.sparse_simulator.Simulator', 'cirq.sim.sparse_simulator.Simulator', ([], {}), '()\n', (1178, 1180), False, 'import cirq\n'), ((1190, 1248), 'cirq.sim.density_matrix_simulator.DensityMatrixSimulator', 'cirq.sim.density_matrix_simulator.DensityMatrixSimulator', ([], {}), '()\n', (1246, 1248), Fa... |
# -*- coding: utf-8 -*-
import cv2
import sys
import numpy as np
# from matplotlib import pyplot as plt
def watershed(src):
# Change color to gray scale
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
# Use the Otsu's binarization
thresh,bin_img = cv2.threshold(gray,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH... | [
"numpy.uint8",
"cv2.imwrite",
"numpy.ones",
"cv2.threshold",
"cv2.morphologyEx",
"cv2.distanceTransform",
"cv2.connectedComponents",
"cv2.cvtColor",
"cv2.dilate",
"cv2.subtract",
"cv2.imread",
"cv2.watershed"
] | [((169, 206), 'cv2.cvtColor', 'cv2.cvtColor', (['src', 'cv2.COLOR_BGR2GRAY'], {}), '(src, cv2.COLOR_BGR2GRAY)\n', (181, 206), False, 'import cv2\n'), ((263, 331), 'cv2.threshold', 'cv2.threshold', (['gray', '(0)', '(255)', '(cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)'], {}), '(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.TH... |
from dataclasses import dataclass
import numpy as np
import pandas as pd
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder
@dataclass
class Dataset:
"""A container for convenient access to r... | [
"sklearn.preprocessing.OneHotEncoder",
"numpy.array",
"pandas.api.types.is_object_dtype",
"sklearn.impute.SimpleImputer",
"pandas.DataFrame"
] | [((2301, 2356), 'pandas.DataFrame', 'pd.DataFrame', (['X_train_trans'], {'columns': 'self.feature_names'}), '(X_train_trans, columns=self.feature_names)\n', (2313, 2356), True, 'import pandas as pd\n'), ((2379, 2433), 'pandas.DataFrame', 'pd.DataFrame', (['X_test_trans'], {'columns': 'self.feature_names'}), '(X_test_tr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 9 13:22:31 2021
Model Simulation & Grid Interpolation
@authors: <NAME> & <NAME>
"""
import numpy as np
import sys
from scipy.stats import norm
from scipy.stats import uniform
import scipy.special as sc
import mpmath
import scipy.integrate as si
im... | [
"scipy.special.gammaincc",
"numpy.sqrt",
"scipy.special.kv",
"scipy.stats.genextreme.logcdf",
"numpy.log",
"scipy.stats.genextreme.pdf",
"scipy.stats.norm.logsf",
"numpy.invert",
"numpy.ascontiguousarray",
"numpy.array",
"scipy.stats.norm.logpdf",
"sys.exit",
"scipy.stats.genextreme.ppf",
... | [((1065, 1113), 'numpy.ctypeslib.ndpointer', 'np.ctypeslib.ndpointer', ([], {'ndim': '(1)', 'dtype': 'np.float64'}), '(ndim=1, dtype=np.float64)\n', (1087, 1113), True, 'import numpy as np\n'), ((1127, 1175), 'numpy.ctypeslib.ndpointer', 'np.ctypeslib.ndpointer', ([], {'ndim': '(1)', 'dtype': 'np.float64'}), '(ndim=1, ... |
import unittest
import numpy as np
import pandas as pd
from pyalink.alink import *
class TestPinyi(unittest.TestCase):
def test_one_hot(self):
data = np.array([
["assisbragasm", 1],
["assiseduc", 1],
["assist", 1],
["assiseduc", 1],
["assisteb... | [
"pandas.DataFrame",
"numpy.array"
] | [((167, 350), 'numpy.array', 'np.array', (["[['assisbragasm', 1], ['assiseduc', 1], ['assist', 1], ['assiseduc', 1], [\n 'assistebrasil', 1], ['assiseduc', 1], ['assistebrasil', 1], [\n 'assistencialgsamsung', 1]]"], {}), "([['assisbragasm', 1], ['assiseduc', 1], ['assist', 1], [\n 'assiseduc', 1], ['assistebr... |
# Copyright (c) 2021 <NAME>
# This software is distributed under the terms of the MIT license
# which is available at https://opensource.org/licenses/MIT
"""Optuna only functionality."""
import logging
import numpy as np
import optuna
from optuna.pruners import BasePruner
from optuna.study import StudyDirection
from... | [
"logging.getLogger",
"numpy.mean",
"scipy.stats.ttest_ind"
] | [((352, 379), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (369, 379), False, 'import logging\n'), ((2627, 2661), 'numpy.mean', 'np.mean', (['trial_intermediate_values'], {}), '(trial_intermediate_values)\n', (2634, 2661), True, 'import numpy as np\n'), ((2792, 2831), 'numpy.mean', 'np.... |
# https://in-the-sky.org/data/asteroids.php# ###Website to get the data about the asteroid position
import pandas
import numpy as np
import matplotlib.pyplot as plt
## READING THE FILE
data= pandas.read_csv("vesta_data.csv",skiprows=2) #reading the file
print(data["AU"]) #printing a list of only the data posit... | [
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((197, 242), 'pandas.read_csv', 'pandas.read_csv', (['"""vesta_data.csv"""'], {'skiprows': '(2)'}), "('vesta_data.csv', skiprows=2)\n", (212, 242), False, 'import pandas\n'), ((367, 394), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 5)'}), '(figsize=(10, 5))\n', (377, 394), True, 'import matplotlib... |
import numpy as np
from deep_utils.utils.box_utils.boxes import Point
class VideoWriterCV:
def __init__(self, save_path, width, height, fourcc="XVID", fps=30, colorful=True, in_source='Numpy'):
import cv2
point = Point.point2point((width, height), in_source=in_source, to_source=Point.PointSource.C... | [
"deep_utils.utils.box_utils.boxes.Point.point2point",
"cv2.warpAffine",
"cv2.destroyWindow",
"cv2.VideoWriter",
"cv2.imshow",
"numpy.array",
"cv2.VideoWriter_fourcc",
"cv2.getRotationMatrix2D",
"cv2.waitKey"
] | [((996, 1057), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['center_point', 'rotation_degree', 'scale'], {}), '(center_point, rotation_degree, scale)\n', (1019, 1057), False, 'import cv2\n'), ((1346, 1375), 'cv2.warpAffine', 'cv2.warpAffine', (['img', 'm', 'dsize'], {}), '(img, m, dsize)\n', (1360, 1375), Fa... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import math
import json
import threading
import numpy as np
import tensorflow as tf
import h5py
import util
class PluralModel(object):
def __init__(self, config):
self.config = c... | [
"tensorflow.tile",
"tensorflow.shape",
"tensorflow.get_variable",
"tensorflow.nn.bidirectional_dynamic_rnn",
"tensorflow.reduce_sum",
"math.log",
"util.load_char_dict",
"tensorflow.gradients",
"numpy.array",
"tensorflow.nn.dropout",
"tensorflow.nn.softmax",
"tensorflow.PaddingFIFOQueue",
"te... | [((356, 410), 'util.EmbeddingDictionary', 'util.EmbeddingDictionary', (["config['context_embeddings']"], {}), "(config['context_embeddings'])\n", (380, 410), False, 'import util\n'), ((438, 531), 'util.EmbeddingDictionary', 'util.EmbeddingDictionary', (["config['head_embeddings']"], {'maybe_cache': 'self.context_embedd... |
import logging
from typing import Optional, Tuple, Union
import numpy as np
import pandas as pd
import torch
from anndata import AnnData
from scvi import REGISTRY_KEYS
from scvi._compat import Literal
from scvi.data import AnnDataManager
from scvi.data.fields import CategoricalObsField, LayerField, NumericalObsField
... | [
"logging.getLogger",
"scvi.data.fields.CategoricalObsField",
"numpy.arange",
"scvi.external.stereoscope._module.SpatialDeconv",
"numpy.where",
"scvi.data.fields.NumericalObsField",
"scvi.data.fields.LayerField",
"torch.tensor",
"scvi.external.stereoscope._module.RNADeconv",
"scvi.data.AnnDataManag... | [((512, 539), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (529, 539), False, 'import logging\n'), ((1618, 1689), 'scvi.external.stereoscope._module.RNADeconv', 'RNADeconv', ([], {'n_genes': 'self.n_genes', 'n_labels': 'self.n_labels'}), '(n_genes=self.n_genes, n_labels=self.n_labels, *... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from stella.parameter.metal import feh_to_z
fig = plt.figure(figsize=(10,4), dpi=150)
ax1 = fig.add_axes([0.07,0.15,0.40,0.80])
ax2 = fig.add_axes([0.50,0.15,0.40,0.80], projection='3d')
ax3 = fig.add_axes... | [
"stella.parameter.metal.feh_to_z",
"matplotlib.pyplot.figure",
"numpy.meshgrid",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((165, 201), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 4)', 'dpi': '(150)'}), '(figsize=(10, 4), dpi=150)\n', (175, 201), True, 'import matplotlib.pyplot as plt\n'), ((421, 453), 'numpy.arange', 'np.arange', (['fe0', '(fe1 + 1e-06)', 'dfe'], {}), '(fe0, fe1 + 1e-06, dfe)\n', (430, 453), True, 'i... |
# Author: <NAME>
# Module: Siamese LSTM with Fully Connected Layers
# Competition : Quora question pairs
#packages required
import os
import re
import numpy as np
import pandas as pd
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score,f1_score,c... | [
"keras.layers.merge.Concatenate",
"nltk.corpus.stopwords.words",
"nltk.download",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.random.rand",
"keras.layers.normalization.BatchNormalization",
"nltk.tokenize.word_tokenize",
"gensim.models.KeyedVectors.load_word2vec_format",
"... | [((912, 934), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (925, 934), False, 'import nltk\n'), ((936, 962), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (949, 962), False, 'import nltk\n'), ((1059, 1085), 'nltk.corpus.stopwords.words', 'stopwords.words', ([... |
'''_____Standard imports_____'''
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
'''_____Project imports_____'''
from toolbox.fits import gauss
def dB_plot(data1, data2=None, arguments=None):
fig = plt.figure(figsize=(15, 6))
if data2 is None... | [
"matplotlib.pyplot.waitforbuttonpress",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"numpy.log",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.widgets.Button",
"matplotlib.pyplot.axes",
"toolbox.fits.gauss",
"numpy.min",
"matplotlib... | [((271, 298), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 6)'}), '(figsize=(15, 6))\n', (281, 298), True, 'import matplotlib.pyplot as plt\n'), ((1139, 1163), 'matplotlib.pyplot.waitforbuttonpress', 'plt.waitforbuttonpress', ([], {}), '()\n', (1161, 1163), True, 'import matplotlib.pyplot as plt\n')... |
# coding=utf-8
# Copyright 2019 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"tensorflow_datasets.core.test_utils.FeatureExpectationItem",
"tensorflow_datasets.core.features.Video",
"numpy.random.randint",
"tensorflow.compat.v1.enable_eager_execution",
"tensorflow_datasets.core.test_utils.main"
] | [((927, 964), 'tensorflow.compat.v1.enable_eager_execution', 'tf.compat.v1.enable_eager_execution', ([], {}), '()\n', (962, 964), True, 'import tensorflow as tf\n'), ((1680, 1697), 'tensorflow_datasets.core.test_utils.main', 'test_utils.main', ([], {}), '()\n', (1695, 1697), False, 'from tensorflow_datasets.core import... |
#Copyright (C) 2021 Intel Corporation
#SPDX-License-Identifier: BSD-3-Clause
import os
import numpy as np
import tensorflow.keras as keras
import tensorflow.keras.datasets.mnist as mnist
import matplotlib.pyplot as plt
class DatasetUtil:
"""This class is a convenience utility to fetch MNIST data using Keras
... | [
"os.path.exists",
"tensorflow.keras.utils.to_categorical",
"os.makedirs",
"tensorflow.keras.datasets.mnist.load_data",
"os.path.join",
"os.path.realpath",
"numpy.savetxt"
] | [((1078, 1095), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (1093, 1095), True, 'import tensorflow.keras.datasets.mnist as mnist\n'), ((2948, 3024), 'os.path.realpath', 'os.path.realpath', (["(self.dataset_path + '/../' + self.dataset_type + '_images')"], {}), "(self.dataset_path +... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# Description: an implementation of a deep learning recommendation model (DLRM)
# The model input consists of dense and sparse features... | [
"multiprocessing.Process",
"multiprocessing.cpu_count",
"numpy.array",
"copy.deepcopy",
"sys.exit",
"argparse.ArgumentParser",
"numpy.vstack",
"os.getpid",
"numpy.savez_compressed",
"numpy.fromstring",
"argparse.ArgumentTypeError",
"time.time",
"warnings.filterwarnings",
"multiprocessing.c... | [((2924, 2949), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (2947, 2949), False, 'import warnings\n'), ((2953, 3015), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (2976, 3015), False... |
# -*- coding: utf-8 -*-
import os
import pickle
from glob import glob
import pdb
import functools
from multiprocessing import Pool
import xml.etree.ElementTree as ET
import cv2
import numpy as np
from tqdm import tqdm
config = {
"exemplar_size":127,
"instance_size":255,
"context_amount":0.5,
"sample_type":"uniform",
... | [
"os.path.exists",
"cv2.imwrite",
"numpy.ceil",
"numpy.sqrt",
"xml.etree.ElementTree.parse",
"os.makedirs",
"os.path.join",
"numpy.array",
"numpy.zeros",
"numpy.array_equal",
"os.mkdir",
"multiprocessing.Pool",
"functools.partial",
"cv2.resize",
"cv2.imread"
] | [((2821, 2841), 'numpy.sqrt', 'np.sqrt', (['(wc_z * hc_z)'], {}), '(wc_z * hc_z)\n', (2828, 2841), True, 'import numpy as np\n'), ((3712, 3748), 'os.path.join', 'os.path.join', (['output_dir', 'video_name'], {}), '(output_dir, video_name)\n', (3724, 3748), False, 'import os\n'), ((1361, 1420), 'numpy.zeros', 'np.zeros'... |
"""
==============================================
Face completion with a multi-output estimators
==============================================
This example shows the use of multi-output estimator to complete images.
The goal is to predict the lower half of a face given its upper half.
The first column of images sho... | [
"sklearn.linear_model.LinearRegression",
"numpy.hstack",
"sklearn.utils.validation.check_random_state",
"sklearn.ensemble.ExtraTreesRegressor",
"sklearn.neighbors.KNeighborsRegressor",
"sklearn.datasets.fetch_olivetti_faces",
"matplotlib.pyplot.figure",
"sklearn.linear_model.RidgeCV",
"matplotlib.py... | [((893, 930), 'sklearn.datasets.fetch_olivetti_faces', 'fetch_olivetti_faces', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (913, 930), False, 'from sklearn.datasets import fetch_olivetti_faces\n'), ((1064, 1085), 'sklearn.utils.validation.check_random_state', 'check_random_state', (['(4)'], {}), '(4)\n', (10... |
import numpy as np
from sklearn.metrics import confusion_matrix, accuracy_score
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
digits = load_digits()
X = np.round(digits.data / 16.)
y_classed = digits.target
target_arr = digits.target_names
X, X_test, y, y_test = train_t... | [
"numpy.prod",
"numpy.unique",
"sklearn.model_selection.train_test_split",
"numpy.argmax",
"sklearn.datasets.load_digits",
"numpy.sum",
"numpy.zeros",
"sklearn.metrics.accuracy_score",
"numpy.round",
"sklearn.metrics.confusion_matrix"
] | [((184, 197), 'sklearn.datasets.load_digits', 'load_digits', ([], {}), '()\n', (195, 197), False, 'from sklearn.datasets import load_digits\n'), ((202, 230), 'numpy.round', 'np.round', (['(digits.data / 16.0)'], {}), '(digits.data / 16.0)\n', (210, 230), True, 'import numpy as np\n'), ((313, 376), 'sklearn.model_select... |
import os
import tkinter as tk
import tkinter.ttk as ttk
from configparser import ConfigParser
import tkinter.messagebox
import sys
import cv2 as cv
import numpy as np
from PIL import Image, ImageTk
class CalibrateDetection:
webcam_ip = ""
lower_skin = np.array([255, 255, 255])
upper_skin = np.array([0,... | [
"tkinter.ttk.Button",
"configparser.ConfigParser",
"cv2.imshow",
"numpy.array",
"tkinter.Canvas",
"cv2.destroyAllWindows",
"sys.exit",
"cv2.setMouseCallback",
"tkinter.ttk.Entry",
"tkinter.ttk.Frame",
"tkinter.ttk.Label",
"cv2.waitKey",
"PIL.ImageTk.PhotoImage",
"cv2.blur",
"cv2.putText"... | [((265, 290), 'numpy.array', 'np.array', (['[255, 255, 255]'], {}), '([255, 255, 255])\n', (273, 290), True, 'import numpy as np\n'), ((308, 327), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (316, 327), True, 'import numpy as np\n'), ((1014, 1021), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1019, 10... |
#!/usr/bin/env python
# coding: utf-8
# ## TH_EventReader
#
# This code will load TH events using cmlreaders and then find the missing path data using the log files.
import os
import warnings
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from cmlreaders import CMLReader, get_data_index
... | [
"os.path.exists",
"pandas.reset_option",
"numpy.float64",
"warnings.resetwarnings",
"pandas.set_option",
"numpy.isnan",
"cmlreaders.CMLReader",
"os.mkdir",
"pandas.DataFrame",
"cmlreaders.get_data_index",
"warnings.filterwarnings"
] | [((678, 698), 'cmlreaders.get_data_index', 'get_data_index', (['"""r1"""'], {}), "('r1')\n", (692, 698), False, 'from cmlreaders import CMLReader, get_data_index\n'), ((1955, 1977), 'numpy.isnan', 'np.isnan', (['orig_sess_ID'], {}), '(orig_sess_ID)\n', (1963, 1977), True, 'import numpy as np\n'), ((2077, 2149), 'cmlrea... |
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# simplified bsd-3 license
"""Script for basic auditory oddball paradigm with 4:1 ratio of standards to deviants using
designated wav files from HD. Stimulus sequence is psuedorandomized such that d... | [
"numpy.ones",
"paradigm.expyfun.ExperimentController",
"paradigm.expyfun._trigger_controllers.decimals_to_binary",
"os.path.join",
"os.path.dirname",
"numpy.zeros",
"os.path.basename",
"numpy.cumsum",
"paradigm.expyfun.stimuli.read_wav",
"paradigm.expyfun.assert_version",
"numpy.random.RandomSta... | [((806, 831), 'paradigm.expyfun.assert_version', 'assert_version', (['"""8511a4d"""'], {}), "('8511a4d')\n", (820, 831), False, 'from paradigm.expyfun import assert_version\n'), ((942, 969), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (963, 969), True, 'import numpy as np\n'), ((101... |
""" This file defines the BADMM-based GPS algorithm. """
import copy
import logging
import numpy as np
import scipy as sp
import sys
# sys.path.append('/'.join(str.split(__file__, '/')[:-2]))
from gps.algorithm.algorithm import Algorithm
from gps.algorithm.algorithm_utils import PolicyInfo
from gps.algorithm.config ... | [
"logging.getLogger",
"numpy.log",
"gps.algorithm.algorithm_utils.PolicyInfo",
"scipy.linalg.cholesky",
"copy.deepcopy",
"numpy.mean",
"numpy.concatenate",
"numpy.tile",
"numpy.eye",
"gps.sample.sample_list.SampleList",
"gps.algorithm.algorithm.Algorithm._advance_iteration_variables",
"numpy.st... | [((394, 421), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (411, 421), False, 'import logging\n'), ((647, 671), 'copy.deepcopy', 'copy.deepcopy', (['ALG_BADMM'], {}), '(ALG_BADMM)\n', (660, 671), False, 'import copy\n'), ((715, 747), 'gps.algorithm.algorithm.Algorithm.__init__', 'Algori... |
#hpart = 'horizontal partition', vpart = 'vertical partition'
from numpy import hstack, vstack
def merge_2x2(TL, TR, BL, BR, A):
if TL.shape[0] > 0 and TL.shape[1] > 0:
for i in range(TL.shape[0]):
for j in range(TL.shape[1]):
A[i,j] = TL[i,j];
if TR.shape[0] > 0 and TR.sh... | [
"numpy.vstack",
"numpy.hstack"
] | [((2062, 2080), 'numpy.vstack', 'vstack', (['(A02, A12)'], {}), '((A02, A12))\n', (2068, 2080), False, 'from numpy import hstack, vstack\n'), ((2117, 2135), 'numpy.hstack', 'hstack', (['(A20, A21)'], {}), '((A20, A21))\n', (2123, 2135), False, 'from numpy import hstack, vstack\n'), ((1582, 1598), 'numpy.hstack', 'hstac... |
import numpy as np
from info import freq_to_notes
class Note:
def __init__(self, pitch, signal, loudness, timestamp, duration=None, typ=None):
self.pitch = round(pitch, 3)
self.signal = round(signal, 3)
self.loudness = round(loudness, 3)
self.timestamp = timesta... | [
"numpy.abs",
"info.freq_to_notes.keys"
] | [((892, 912), 'info.freq_to_notes.keys', 'freq_to_notes.keys', ([], {}), '()\n', (910, 912), False, 'from info import freq_to_notes\n'), ((934, 957), 'numpy.abs', 'np.abs', (['(pitches - pitch)'], {}), '(pitches - pitch)\n', (940, 957), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
from problem_data_gen import setup_pendulum_system
from experiment import experiment
from plotting import single_system_plot
if __name__ == "__main__":
plt.close('all')
vi_results_all, pi_results_all = [], []
noise_levels = np.array([0.00, 0.1, 1.00])
... | [
"numpy.copy",
"experiment.experiment",
"plotting.single_system_plot",
"matplotlib.pyplot.close",
"numpy.array",
"problem_data_gen.setup_pendulum_system"
] | [((210, 226), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (219, 226), True, 'import matplotlib.pyplot as plt\n'), ((291, 316), 'numpy.array', 'np.array', (['[0.0, 0.1, 1.0]'], {}), '([0.0, 0.1, 1.0])\n', (299, 316), True, 'import numpy as np\n'), ((341, 364), 'problem_data_gen.setup_pendul... |
from traitlets.config import Configurable
from traitlets import (
Int,
List,
Unicode,
)
import numpy as np
import logging
from event.arguments.prepare.event_vocab import TypedEventVocab
from event.arguments.prepare.event_vocab import EmbbedingVocab
from event.arguments.prepare.hash_cloze_data import HashPar... | [
"logging.getLogger",
"os.listdir",
"event.arguments.prepare.event_vocab.EmbbedingVocab",
"event.arguments.prepare.hash_cloze_data.HashParam",
"xml.etree.ElementTree.parse",
"event.arguments.prepare.event_vocab.TypedEventVocab",
"event.arguments.prepare.event_vocab.EmbbedingVocab.with_extras",
"os.path... | [((443, 470), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (460, 470), False, 'import logging\n'), ((6098, 6123), 'os.listdir', 'os.listdir', (['framenet_path'], {}), '(framenet_path)\n', (6108, 6123), False, 'import os\n'), ((7600, 7645), 'logging.info', 'logging.info', (['"""Loaded No... |
import numpy as np
import matplotlib.pyplot as plt
A = plt.imread('images/profile.jpg')
#print(A)
print(np.shape(A))
print(type(A))
print(A.dtype)
plt.imshow(A)
plt.show()
| [
"matplotlib.pyplot.imshow",
"numpy.shape",
"matplotlib.pyplot.imread",
"matplotlib.pyplot.show"
] | [((56, 88), 'matplotlib.pyplot.imread', 'plt.imread', (['"""images/profile.jpg"""'], {}), "('images/profile.jpg')\n", (66, 88), True, 'import matplotlib.pyplot as plt\n'), ((148, 161), 'matplotlib.pyplot.imshow', 'plt.imshow', (['A'], {}), '(A)\n', (158, 161), True, 'import matplotlib.pyplot as plt\n'), ((162, 172), 'm... |
import numpy as np
import taichi as ti
if ti.has_pytorch():
import torch
@ti.torch_test
def test_torch_ad():
n = 32
x = ti.field(ti.f32, shape=n, needs_grad=True)
y = ti.field(ti.f32, shape=n, needs_grad=True)
@ti.kernel
def torch_kernel():
for i in range(n):
# Do whate... | [
"taichi.has_pytorch",
"numpy.ones",
"taichi.field",
"taichi.clear_all_gradients",
"torch.cuda.is_available",
"torch.device"
] | [((44, 60), 'taichi.has_pytorch', 'ti.has_pytorch', ([], {}), '()\n', (58, 60), True, 'import taichi as ti\n'), ((137, 179), 'taichi.field', 'ti.field', (['ti.f32'], {'shape': 'n', 'needs_grad': '(True)'}), '(ti.f32, shape=n, needs_grad=True)\n', (145, 179), True, 'import taichi as ti\n'), ((188, 230), 'taichi.field', ... |
import contextlib
import joblib
from joblib import Parallel, delayed
import numpy as np
import pandas as pd
from sklearn.model_selection import LeaveOneOut, KFold, LeavePOut
from sklearn import linear_model
from tqdm import tqdm
@contextlib.contextmanager
def tqdm_joblib(tqdm_object):
"""Context manager to patch ... | [
"numpy.mean",
"sklearn.model_selection.LeavePOut",
"tqdm.tqdm",
"numpy.argmax",
"joblib.Parallel",
"numpy.zeros",
"numpy.linalg.lstsq",
"numpy.concatenate",
"joblib.delayed"
] | [((1099, 1145), 'numpy.concatenate', 'np.concatenate', (['(intercept_train, train[x])', '(1)'], {}), '((intercept_train, train[x]), 1)\n', (1113, 1145), True, 'import numpy as np\n'), ((1265, 1309), 'numpy.concatenate', 'np.concatenate', (['(intercept_test, test[x])', '(1)'], {}), '((intercept_test, test[x]), 1)\n', (1... |
"""
Cross validation of the hyperparameters
"""
import csv
import numpy as np
import torch
import os
from argparse import ArgumentParser
from itertools import product
from torch.optim import Adam, SGD
from torch.utils.data import DataLoader
from datasets import CrossValidationDataset, CytomineDataset
from evaluate i... | [
"csv.DictWriter",
"torch.cuda.is_available",
"os.walk",
"numpy.mean",
"argparse.ArgumentParser",
"train.validate",
"metrics.DiceCoefficient",
"itertools.product",
"os.path.normpath",
"numpy.random.seed",
"model.NuClick",
"csv.writer",
"numpy.std",
"torch.manual_seed",
"train.train",
"m... | [((762, 832), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Cros validation for the hyperparameters."""'}), "(description='Cros validation for the hyperparameters.')\n", (776, 832), False, 'from argparse import ArgumentParser\n'), ((1471, 1491), 'torch.manual_seed', 'torch.manual_seed', (['(0)']... |
import numpy as np
import scipy.misc
import matplotlib.pyplot as plt
x = np.linspace(0, 5, 100)
y1 = np.power(2, x)
y2 = scipy.misc.factorial(x)
plt.plot(x, y1)
plt.plot(x, y2)
plt.grid(True)
plt.savefig('../../img/question_4_plots/g.png')
| [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"numpy.power",
"matplotlib.pyplot.plot",
"numpy.linspace"
] | [((74, 96), 'numpy.linspace', 'np.linspace', (['(0)', '(5)', '(100)'], {}), '(0, 5, 100)\n', (85, 96), True, 'import numpy as np\n'), ((102, 116), 'numpy.power', 'np.power', (['(2)', 'x'], {}), '(2, x)\n', (110, 116), True, 'import numpy as np\n'), ((147, 162), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y1'], {}), '... |
import torch
from importlib import reload
# import os; os.chdir("/home/wamsterd/local_scratch/git/CauseEffectPairs/")
from torch.autograd import Variable
from torch.optim import SGD
import matplotlib.pyplot as plt
import numpy as np
import train; reload(train)
import model.net as net; reload(net)
torch.manual_seed(12... | [
"torch.manual_seed",
"torch.nn.MSELoss",
"model.net.TwoLayerNet",
"numpy.linspace",
"importlib.reload",
"matplotlib.pyplot.show"
] | [((248, 261), 'importlib.reload', 'reload', (['train'], {}), '(train)\n', (254, 261), False, 'from importlib import reload\n'), ((287, 298), 'importlib.reload', 'reload', (['net'], {}), '(net)\n', (293, 298), False, 'from importlib import reload\n'), ((300, 325), 'torch.manual_seed', 'torch.manual_seed', (['(123456)'],... |
import warnings
import numpy as np
import numpy.testing as npt
import matplotlib
import matplotlib.mlab as mlab
import nitime.timeseries as ts
import nitime.analysis as nta
import platform
# Some tests might require python version 2.5 or above:
if float(platform.python_version()[:3]) < 2.5:
old_python = True
e... | [
"numpy.testing.assert_equal",
"numpy.random.rand",
"nitime.analysis.MTCoherenceAnalyzer",
"numpy.testing.assert_raises",
"numpy.sin",
"numpy.arange",
"nitime.analysis.CoherenceAnalyzer",
"nitime.analysis.SeedCoherenceAnalyzer",
"numpy.testing.assert_almost_equal",
"numpy.vstack",
"warnings.simpl... | [((2952, 2975), 'numpy.testing.dec.skipif', 'npt.dec.skipif', (['old_mpl'], {}), '(old_mpl)\n', (2966, 2975), True, 'import numpy.testing as npt\n'), ((5194, 5220), 'numpy.testing.dec.skipif', 'npt.dec.skipif', (['old_python'], {}), '(old_python)\n', (5208, 5220), True, 'import numpy.testing as npt\n'), ((694, 721), 'w... |
import numpy as np
import pandas as pd
df = pd.read_csv('data/Merged Dataset after smoothing.csv',sep=',')
print("Number of data points: %d \n" % df.shape[0])
print("Number of defaults:")
counts = df.MD_EARN_WNE_P6.value_counts()
print (counts)
# from ggplot import *
# ggplot(df,aes("DEFAULT")) + geom_histogram(bin... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.diff",
"sklearn.metrics.mean_squared_error",
"sklearn.metrics.r2_score",
"sklearn.linear_model.LinearRegression"
] | [((45, 108), 'pandas.read_csv', 'pd.read_csv', (['"""data/Merged Dataset after smoothing.csv"""'], {'sep': '""","""'}), "('data/Merged Dataset after smoothing.csv', sep=',')\n", (56, 108), True, 'import pandas as pd\n'), ((1067, 1126), 'sklearn.model_selection.train_test_split', 'train_test_split', (['df_X', 'df_y'], {... |
from __future__ import print_function
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import argparse
import logging
import numpy as np
from time import time
import utils as U
import codecs
from optimizers import get_optimize... | [
"logging.getLogger",
"utils.mkdir_p",
"keras.backend.learning_phase",
"numpy.argsort",
"numpy.array_split",
"numpy.linalg.norm",
"keras.preprocessing.sequence.pad_sequences",
"argparse.ArgumentParser",
"numpy.sort",
"json.dumps",
"matplotlib.pyplot.plot",
"numpy.random.seed",
"pandas.DataFra... | [((588, 609), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (602, 609), False, 'import matplotlib\n'), ((29012, 29124), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""out.log"""', 'level': 'logging.INFO', 'format': '"""%(asctime)s %(levelname)s %(message)s"""'}), "(filename=... |
import torch
from models.auxiliaries.physics_model_interface import PhysicsModel
from data.base_dataset import BaseDataset
import scipy.io as io
import numpy as np
from torch import from_numpy, empty
from util.util import normalize
class RegCycleGANDataset(BaseDataset):
def initialize(self, opt, phase):
s... | [
"numpy.sqrt",
"util.util.normalize",
"scipy.io.loadmat",
"numpy.array",
"numpy.concatenate",
"torch.empty",
"torch.rand"
] | [((510, 518), 'torch.empty', 'empty', (['(0)'], {}), '(0)\n', (515, 518), False, 'from torch import from_numpy, empty\n'), ((1102, 1126), 'scipy.io.loadmat', 'io.loadmat', (['opt.dataroot'], {}), '(opt.dataroot)\n', (1112, 1126), True, 'import scipy.io as io\n'), ((2459, 2491), 'torch.rand', 'torch.rand', (['(1, self.n... |
import taichi as ti
import numpy as np
A = np.array([
[0, 1, 0],
[1, 0, 1],
[0, 1, 0],
])
def conv(A, B):
m, n = A.shape
s, t = B.shape
C = np.zeros((m + s - 1, n + t - 1), dtype=A.dtype)
for i in range(m):
for j in range(n):
for k in range(s):
for l in range(t):
... | [
"numpy.array",
"numpy.zeros"
] | [((45, 88), 'numpy.array', 'np.array', (['[[0, 1, 0], [1, 0, 1], [0, 1, 0]]'], {}), '([[0, 1, 0], [1, 0, 1], [0, 1, 0]])\n', (53, 88), True, 'import numpy as np\n'), ((156, 203), 'numpy.zeros', 'np.zeros', (['(m + s - 1, n + t - 1)'], {'dtype': 'A.dtype'}), '((m + s - 1, n + t - 1), dtype=A.dtype)\n', (164, 203), True,... |
"""
Questão 2 do laboratorio 7: Interpolação por MMQ pela seria de Fourier(exponencial)
"""
import numpy as np
from math import pi, sin
import matplotlib.pyplot as plt
def sistemaAumentado(x, y, dim):
m = len(x)
A = np.empty((dim, dim))
b = np.empty((dim))
soma = []
for i in range(0, dim + 2):
... | [
"numpy.linalg.solve",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"numpy.append",
"numpy.array",
"numpy.linspace",
"numpy.empty",
"matplotlib.pyplot.tight_layout",
"nump... | [((768, 798), 'numpy.linspace', 'np.linspace', (['(-T / 2)', '(T / 2)', '(30)'], {}), '(-T / 2, T / 2, 30)\n', (779, 798), True, 'import numpy as np\n'), ((799, 811), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (807, 811), True, 'import numpy as np\n'), ((937, 966), 'numpy.arange', 'np.arange', (['x[0]', 'x[-1]'... |
"""
Perceptual decision-making task, loosely based on the random dot motion
discrimination task.
Response of neurons in the lateral intraparietal area during a combined visual
discrimination reaction time task.
<NAME> & <NAME>, JNS 2002.
http://www.jneurosci.org/content/22/21/9475.abstract
Reaction-time vers... | [
"numpy.mean",
"pycog.tasktools.generate_ei",
"numpy.zeros",
"pycog.tasktools.get_epochs_idx",
"numpy.zeros_like"
] | [((666, 690), 'pycog.tasktools.generate_ei', 'tasktools.generate_ei', (['N'], {}), '(N)\n', (687, 690), False, 'from pycog import tasktools\n'), ((927, 946), 'numpy.zeros', 'np.zeros', (['(Nout, N)'], {}), '((Nout, N))\n', (935, 946), True, 'import numpy as np\n'), ((3131, 3167), 'pycog.tasktools.get_epochs_idx', 'task... |
import numpy as np
def differential_evolution(fobj, bounds, mut=0.8, crossprob=0.7, popsize=30, gens=1000, mode='best/1'):
# Gets number of parameters (length of genome vector)
num_params = len(bounds)
# Initializes the population genomes with values drawn from uniform distribution in the range [0,1]
... | [
"numpy.clip",
"numpy.fabs",
"numpy.random.rand",
"numpy.where",
"numpy.random.choice",
"numpy.asarray",
"numpy.any",
"numpy.random.randint",
"numpy.argmin"
] | [((326, 361), 'numpy.random.rand', 'np.random.rand', (['popsize', 'num_params'], {}), '(popsize, num_params)\n', (340, 361), True, 'import numpy as np\n'), ((598, 620), 'numpy.fabs', 'np.fabs', (['(min_b - max_b)'], {}), '(min_b - max_b)\n', (605, 620), True, 'import numpy as np\n'), ((886, 906), 'numpy.argmin', 'np.ar... |
import numpy as np
import pandas as pd
import requests # Coleta de conteúdo em Webpage
from requests.exceptions import HTTPError
from bs4 import BeautifulSoup as bs # Scraping webpages
from time import sleep
import json
import re #biblioteca para trabalhar com regular expressions - regex
import string
import unidecode... | [
"nltk.stem.SnowballStemmer",
"nltk.corpus.stopwords.words",
"numpy.unique",
"re.compile",
"pandas.read_csv",
"time.sleep",
"requests.get",
"bs4.BeautifulSoup",
"operator.itemgetter",
"unidecode.unidecode",
"pandas.DataFrame",
"re.sub"
] | [((608, 634), 're.compile', 're.compile', (['"""<.*?>|&[.*?]"""'], {}), "('<.*?>|&[.*?]')\n", (618, 634), False, 'import re\n'), ((649, 677), 're.sub', 're.sub', (['cleanr', '""""""', 'raw_html'], {}), "(cleanr, '', raw_html)\n", (655, 677), False, 'import re\n'), ((990, 1015), 'unidecode.unidecode', 'unidecode.unideco... |
import numpy as np
from astropy.io import fits
from astropy.table import Table
from specutils import Spectrum1D, SpectrumList
def create_spectrum_hdu(data_len):
# Create a minimal header for the purposes of testing
data = np.random.random((data_len, 3))
table = Table(data=data, names=['WAVELENGTH', 'FLU... | [
"specutils.SpectrumList.read",
"astropy.io.fits.HDUList",
"astropy.table.Table",
"numpy.random.random",
"astropy.io.fits.PrimaryHDU",
"astropy.io.fits.BinTableHDU"
] | [((234, 265), 'numpy.random.random', 'np.random.random', (['(data_len, 3)'], {}), '((data_len, 3))\n', (250, 265), True, 'import numpy as np\n'), ((278, 333), 'astropy.table.Table', 'Table', ([], {'data': 'data', 'names': "['WAVELENGTH', 'FLUX', 'ERROR']"}), "(data=data, names=['WAVELENGTH', 'FLUX', 'ERROR'])\n", (283,... |
import numpy as np
from jina.drivers.helper import extract_docs, array2pb
from jina.proto import jina_pb2
def test_extract_docs():
d = jina_pb2.Document()
contents, docs_pts, bad_doc_ids = extract_docs([d], embedding=True)
assert len(bad_doc_ids) > 0
assert contents is None
vec = np.random.rand... | [
"jina.drivers.helper.extract_docs",
"jina.proto.jina_pb2.Document",
"numpy.testing.assert_equal",
"numpy.random.random",
"jina.drivers.helper.array2pb"
] | [((142, 161), 'jina.proto.jina_pb2.Document', 'jina_pb2.Document', ([], {}), '()\n', (159, 161), False, 'from jina.proto import jina_pb2\n'), ((201, 234), 'jina.drivers.helper.extract_docs', 'extract_docs', (['[d]'], {'embedding': '(True)'}), '([d], embedding=True)\n', (213, 234), False, 'from jina.drivers.helper impor... |
import numpy as np
from pybasicbayes.distributions import AutoRegression, DiagonalRegression, Regression
def get_empirical_ar_params(train_datas, params):
"""
Estimate the parameters of an AR observation model
by fitting a single AR model to the entire dataset.
"""
assert isinstance(train_datas, ... | [
"scipy.stats.multivariate_normal",
"numpy.log",
"numpy.einsum",
"numpy.arange",
"numpy.dot",
"pybasicbayes.util.stats.invwishart_log_partitionfunction",
"scipy.linalg.solve_triangular",
"numpy.eye",
"numpy.linalg.slogdet",
"numpy.outer",
"numpy.linalg.svd",
"numpy.linalg.cholesky",
"numpy.li... | [((761, 789), 'pybasicbayes.distributions.AutoRegression', 'AutoRegression', ([], {}), '(**obs_params)\n', (775, 789), False, 'from pybasicbayes.distributions import AutoRegression, DiagonalRegression, Regression\n'), ((1846, 1871), 'numpy.sum', 'np.sum', (['(E_z[0] * log_pi_0)'], {}), '(E_z[0] * log_pi_0)\n', (1852, 1... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Helper file containing activation functions
"""
import numpy as np
def sigmoid(x):
"""Description: Calculates the sigmoid for each value in the the input array
Params:
x: Array for which sigmoid is to be calculated
Returns:
ndarray: Sigmo... | [
"numpy.greater",
"numpy.ones",
"numpy.max",
"numpy.exp",
"numpy.maximum"
] | [((1261, 1277), 'numpy.maximum', 'np.maximum', (['x', '(0)'], {}), '(x, 0)\n', (1271, 1277), True, 'import numpy as np\n'), ((368, 378), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (374, 378), True, 'import numpy as np\n'), ((991, 1008), 'numpy.max', 'np.max', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (997, 1008)... |
#!/usr/bin/python
"""This file contains code for use with "Think Bayes",
by <NAME>, available from greenteapress.com
Copyright 2013 <NAME>
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
1, Original link -
refer to https://github.com/AllenDowney/ThinkBayes/blob/master/code/redline_data.py
2, As http://devel... | [
"json.loads",
"datetime.datetime.fromtimestamp",
"datetime.time",
"numpy.diff",
"time.sleep",
"datetime.datetime.now",
"redis.StrictRedis",
"sys.exit",
"datetime.timedelta",
"csv.reader",
"urllib.request.urlopen"
] | [((3707, 3721), 'csv.reader', 'csv.reader', (['fp'], {}), '(fp)\n', (3717, 3721), False, 'import csv\n'), ((4195, 4216), 'json.loads', 'json.loads', (['json_text'], {}), '(json_text)\n', (4205, 4216), False, 'import json\n'), ((5096, 5110), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (5108, 5110), False,... |
#!/usr/bin/env python
# coding: utf-8
# demo
"""
Author: <NAME>
Email: <EMAIL>
Create_Date: 2019/05/21
"""
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
torch.backends.cudnn.deterministic = True
torch.manual_seed(123)
import os, argparse, sys
... | [
"matplotlib.pyplot.switch_backend",
"sys.path.append",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"torch.cuda.device",
"numpy.asarray",
"torchvision.transforms.ToTensor",
"DepthNet.DepthNet",
"torchvision.transforms.Normalize",
"warnings.filterwarnings",
"torch.manual_seed",
... | [((271, 293), 'torch.manual_seed', 'torch.manual_seed', (['(123)'], {}), '(123)\n', (288, 293), False, 'import torch\n'), ((383, 408), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (401, 408), True, 'import matplotlib.pyplot as plt\n'), ((425, 458), 'warnings.filterwarnings... |
import os
import numpy as np
import torch
import stanza
import re
from tqdm import tqdm
from pytorch_pretrained_bert import BertModel, BertTokenizer
from text.dependency_relations import deprel_labels_to_id
def read_lexicon(lex_path):
lexicon = {}
with open(lex_path) as f:
for line in f:
t... | [
"re.split",
"pytorch_pretrained_bert.BertTokenizer.from_pretrained",
"pytorch_pretrained_bert.BertModel.from_pretrained",
"torch.mean",
"tqdm.tqdm",
"os.path.join",
"numpy.asarray",
"torch.no_grad",
"stanza.Pipeline"
] | [((1533, 1574), 're.split', 're.split', (['"""([,:;.()\\\\-\\\\?\\\\!\\\\s+])"""', 'text'], {}), "('([,:;.()\\\\-\\\\?\\\\!\\\\s+])', text)\n", (1541, 1574), False, 'import re\n'), ((2441, 2479), 're.split', 're.split', (['"""([,./\\\\-\\\\?\\\\!\\\\s+])"""', 'text'], {}), "('([,./\\\\-\\\\?\\\\!\\\\s+])', text)\n", (2... |
import time
import numpy as np
from typing import List, Dict
from .base import BaseInstrument
from zhinst.toolkit.control.node_tree import Parameter
from zhinst.toolkit.interface import LoggerModule
_logger = LoggerModule(__name__)
MAPPINGS = {
"edge": {1: "rising", 2: "falling", 3: "both"},
"eventcount_mod... | [
"zhinst.toolkit.control.node_tree.Parameter",
"time.sleep",
"zhinst.toolkit.interface.LoggerModule",
"time.time",
"numpy.arange"
] | [((211, 233), 'zhinst.toolkit.interface.LoggerModule', 'LoggerModule', (['__name__'], {}), '(__name__)\n', (223, 233), False, 'from zhinst.toolkit.interface import LoggerModule\n'), ((13252, 13263), 'time.time', 'time.time', ([], {}), '()\n', (13261, 13263), False, 'import time\n'), ((21735, 21755), 'numpy.arange', 'np... |
# Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"tensorflow_probability.python.internal.tensor_util.convert_nonref_to_tensor",
"numpy.log",
"tensorflow.compat.v2.math.exp",
"tensorflow.compat.v2.convert_to_tensor",
"tensorflow_probability.python.internal.prefer_static.concat",
"tensorflow.compat.v2.math.log",
"tensorflow.compat.v2.math.abs",
"tenso... | [((1924, 1947), 'tensorflow.compat.v2.math.log1p', 'tf.math.log1p', (['(x ** 2.0)'], {}), '(x ** 2.0)\n', (1937, 1947), True, 'import tensorflow.compat.v2 as tf\n'), ((7619, 7650), 'tensorflow.compat.v2.constant', 'tf.constant', (['[]'], {'dtype': 'tf.int32'}), '([], dtype=tf.int32)\n', (7630, 7650), True, 'import tens... |
"""
Model inference/embeddings tests.
All of these tests are designed to be run manually via::
pytest tests/intensive/model_tests.py -s -k test_<name>
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import unittest
import numpy as np
import fiftyone as fo
import fiftyone.zoo ... | [
"fiftyone.Dataset",
"fiftyone.zoo.load_zoo_dataset",
"fiftyone.Detection",
"numpy.stack",
"fiftyone.zoo.load_zoo_model",
"fiftyone.Sample",
"unittest.main"
] | [((367, 401), 'fiftyone.zoo.load_zoo_dataset', 'foz.load_zoo_dataset', (['"""quickstart"""'], {}), "('quickstart')\n", (387, 401), True, 'import fiftyone.zoo as foz\n'), ((443, 492), 'fiftyone.zoo.load_zoo_model', 'foz.load_zoo_model', (['"""inception-v3-imagenet-torch"""'], {}), "('inception-v3-imagenet-torch')\n", (4... |
import numpy as np
import cv2
I = cv2.imread('beans.jpg')
G = cv2.cvtColor(I,cv2.COLOR_BGR2GRAY)
ret, T = cv2.threshold(G,127,255,cv2.THRESH_BINARY)
cv2.imshow('Thresholded', T)
cv2.waitKey(0) # press any key to continue...
## erosion
kernel = np.ones((19,19),np.uint8)
T = cv2.erode(T,kernel)
cv2.imshow('After Ero... | [
"numpy.ones",
"cv2.threshold",
"cv2.erode",
"cv2.imshow",
"cv2.putText",
"cv2.connectedComponents",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imread"
] | [((35, 58), 'cv2.imread', 'cv2.imread', (['"""beans.jpg"""'], {}), "('beans.jpg')\n", (45, 58), False, 'import cv2\n'), ((63, 98), 'cv2.cvtColor', 'cv2.cvtColor', (['I', 'cv2.COLOR_BGR2GRAY'], {}), '(I, cv2.COLOR_BGR2GRAY)\n', (75, 98), False, 'import cv2\n'), ((108, 153), 'cv2.threshold', 'cv2.threshold', (['G', '(127... |
r"""
Concentration of the eigenvalues
================================
The eigenvalues of the graph Laplacian concentrates to the same value as the
graph becomes full.
"""
import numpy as np
from matplotlib import pyplot as plt
import pygsp as pg
n_neighbors = [1, 2, 5, 8]
fig, axes = plt.subplots(3, len(n_neighbors... | [
"numpy.identity",
"numpy.abs",
"numpy.mean",
"numpy.real",
"pygsp.graphs.Ring",
"numpy.imag"
] | [((393, 416), 'pygsp.graphs.Ring', 'pg.graphs.Ring', (['(17)'], {'k': 'k'}), '(17, k=k)\n', (407, 416), True, 'import pygsp as pg\n'), ((967, 983), 'numpy.real', 'np.real', (['LambdaM'], {}), '(LambdaM)\n', (974, 983), True, 'import numpy as np\n'), ((1073, 1097), 'numpy.mean', 'np.mean', (['LambdaM'], {'axis': '(0)'})... |
# coding=utf-8
import os
import numpy as np
from collections import OrderedDict
from md_utils.md_common import (InvalidDataError, warning)
# Constants #
MISSING_ATOMS_MSG = "Could not find lines for atoms ({}) in timestep {} in file: {}"
TSTEP_LINE = 'ITEM: TIMESTEP'
NUM_ATOM_LINE = 'ITEM: NUMBER OF ATOMS'
BOX_LINE =... | [
"numpy.copy",
"collections.OrderedDict",
"md_utils.md_common.warning",
"os.path.basename",
"numpy.full"
] | [((810, 823), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (821, 823), False, 'from collections import OrderedDict\n'), ((891, 909), 'numpy.full', 'np.full', (['(3)', 'np.nan'], {}), '(3, np.nan)\n', (898, 909), True, 'import numpy as np\n'), ((963, 989), 'os.path.basename', 'os.path.basename', (['lammps... |
"""
Base classes for representing signals.
"""
import logging
from copy import deepcopy
from functools import partial
import numpy as np
import xarray as xr
from ..models.model import Model
from scipy.signal import butter, detrend, get_window, hilbert
from scipy.signal import resample as scipy_resample
from scipy.sig... | [
"mne.filter.filter_data",
"scipy.signal.detrend",
"numpy.array",
"copy.deepcopy",
"xarray.apply_ufunc",
"logging.error",
"scipy.signal.get_window",
"numpy.arange",
"xarray.testing.assert_allclose",
"numpy.diff",
"scipy.signal.sosfiltfilt",
"numpy.concatenate",
"numpy.abs",
"logging.warning... | [((1864, 1892), 'scipy.signal.sosfiltfilt', 'sosfiltfilt', (['sos', 'x'], {'axis': '(-1)'}), '(sos, x, axis=-1)\n', (1875, 1892), False, 'from scipy.signal import sosfiltfilt\n'), ((2748, 2775), 'xarray.load_dataarray', 'xr.load_dataarray', (['filename'], {}), '(filename)\n', (2765, 2775), True, 'import xarray as xr\n'... |
from __future__ import print_function, division
import numpy as np
from pyscf import lib
def polariz_inter_ave(mf, gto, tddft, comega):
gto.set_common_orig((0.0,0.0,0.0))
ao_dip = gto.intor_symmetric('int1e_r', comp=3)
occidx = np.where(mf.mo_occ==2)[0]
viridx = np.where(mf.mo_occ==0)[0]
mo_coeff = mf.mo_coe... | [
"numpy.where",
"numpy.sqrt",
"numpy.einsum",
"pyscf.lib.direct_sum"
] | [((1388, 1451), 'pyscf.lib.direct_sum', 'lib.direct_sum', (['"""a-i->ai"""', 'mo_energy[viridx]', 'mo_energy[occidx]'], {}), "('a-i->ai', mo_energy[viridx], mo_energy[occidx])\n", (1402, 1451), False, 'from pyscf import lib\n'), ((235, 259), 'numpy.where', 'np.where', (['(mf.mo_occ == 2)'], {}), '(mf.mo_occ == 2)\n', (... |
import glob
import os
import sys
import time
import cv2
import numpy as np
import png
from ip_basic import depth_map_utils
from ip_basic import vis_utils
def main():
"""Depth maps are saved to the 'outputs' folder.
"""
##############################
# Options
##############################
... | [
"ip_basic.depth_map_utils.fill_in_multiscale",
"png.Writer",
"numpy.mean",
"os.path.exists",
"os.listdir",
"numpy.repeat",
"os.path.split",
"sys.stdout.flush",
"cv2.waitKey",
"glob.glob",
"os.path.expanduser",
"ip_basic.vis_utils.cv2_show_image",
"ip_basic.depth_map_utils.fill_in_fast",
"t... | [((359, 450), 'os.path.expanduser', 'os.path.expanduser', (['"""~/Kitti/depth/depth_selection/val_selection_cropped/velodyne_raw"""'], {}), "(\n '~/Kitti/depth/depth_selection/val_selection_cropped/velodyne_raw')\n", (377, 450), False, 'import os\n'), ((1704, 1743), 'os.makedirs', 'os.makedirs', (['outputs_dir'], {'... |
import numpy as np
from itertools import product
class Board(np.ndarray):
def update(self):
neighbours = self.get_neighbours()
self[(self == 0) & (neighbours == 3)] = 1
self[(self == 1) & ((neighbours < 2) | (neighbours > 3))] = 0
def get_neighbours(self):
result = np.zeros(s... | [
"numpy.array",
"numpy.zeros",
"itertools.product",
"numpy.roll"
] | [((310, 341), 'numpy.zeros', 'np.zeros', (['self.shape'], {'dtype': 'int'}), '(self.shape, dtype=int)\n', (318, 341), True, 'import numpy as np\n'), ((366, 395), 'itertools.product', 'product', (['[-1, 0, 1]'], {'repeat': '(2)'}), '([-1, 0, 1], repeat=2)\n', (373, 395), False, 'from itertools import product\n'), ((588,... |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import random as rn
# -------------------------------- Creating sin-data -------------------------------
def true_fun(x):
return np.cos(1.5 * np.pi * x)
np.random.seed(42)
n_samples = 50
x_train = np.sort(np.random.rand(n_samples))
y_tr... | [
"tensorflow.linspace",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"tensorflow.keras.optimizers.Adam",
"tensorflow.keras.layers.Dense",
"numpy.random.seed",
"matplotlib.pyplot.scatter",
"numpy.cos",
"numpy.random.randn",
"matplotlib.py... | [((237, 255), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (251, 255), True, 'import numpy as np\n'), ((895, 925), 'tensorflow.linspace', 'tf.linspace', (['(0.0)', '(1)', 'n_samples'], {}), '(0.0, 1, n_samples)\n', (906, 925), True, 'import tensorflow as tf\n'), ((988, 1055), 'matplotlib.pyplot.scat... |
from i3Deep import utils
import os
from evaluate import evaluate
import numpy as np
from skimage.segmentation.random_walker_segmentation import random_walker
from tqdm import tqdm
import torchio
import torch
def compute_predictions(image_path, mask_path, gt_path, save_path, nr_modalities, class_labels, resize... | [
"numpy.flip",
"numpy.prod",
"numpy.unique",
"os.path.basename",
"skimage.segmentation.random_walker_segmentation.random_walker",
"i3Deep.utils.load_nifty",
"evaluate.evaluate",
"i3Deep.utils.load_filenames",
"i3Deep.utils.interpolate",
"i3Deep.utils.normalize"
] | [((432, 463), 'i3Deep.utils.load_filenames', 'utils.load_filenames', (['mask_path'], {}), '(mask_path)\n', (452, 463), False, 'from i3Deep import utils\n'), ((1785, 1827), 'evaluate.evaluate', 'evaluate', (['gt_path', 'save_path', 'class_labels'], {}), '(gt_path, save_path, class_labels)\n', (1793, 1827), False, 'from ... |
import cv2 as cv
import numpy as np
import utilities
def empty(a):
pass
cv.namedWindow("Trackbars")
cv.resizeWindow("Trackbars", 640, 240)
cv.createTrackbar("Hue Min", "Trackbars", 55, 179,empty)
cv.createTrackbar("Hue Max", "Trackbars", 155, 179,empty)
cv.createTrackbar("Sat Min", "Trackbars", 21, 255,empty)
cv.... | [
"cv2.resizeWindow",
"cv2.inRange",
"cv2.bitwise_and",
"cv2.imshow",
"numpy.array",
"utilities.stackImages",
"cv2.waitKey",
"cv2.getTrackbarPos",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.createTrackbar",
"cv2.namedWindow"
] | [((78, 105), 'cv2.namedWindow', 'cv.namedWindow', (['"""Trackbars"""'], {}), "('Trackbars')\n", (92, 105), True, 'import cv2 as cv\n'), ((106, 144), 'cv2.resizeWindow', 'cv.resizeWindow', (['"""Trackbars"""', '(640)', '(240)'], {}), "('Trackbars', 640, 240)\n", (121, 144), True, 'import cv2 as cv\n'), ((145, 202), 'cv2... |
from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import sys
import warnings
import math
from tqdm import tqdm
from collections import namedtuple
import keras.backend as K
from keras.utils import Sequence
from keras.optimizers import Adam
from keras.callbacks import... | [
"numpy.prod",
"math.floor",
"numpy.array",
"csbdeep.internals.predict.tile_iterator",
"numpy.moveaxis",
"scipy.ndimage.zoom",
"numpy.isscalar",
"numpy.max",
"numpy.take",
"numpy.empty",
"numpy.min",
"keras.backend.epsilon",
"numpy.maximum",
"keras.optimizers.Adam",
"numpy.abs",
"numpy.... | [((2490, 2501), 'keras.backend.epsilon', 'K.epsilon', ([], {}), '()\n', (2499, 2501), True, 'import keras.backend as K\n'), ((2534, 2545), 'keras.backend.epsilon', 'K.epsilon', ([], {}), '()\n', (2543, 2545), True, 'import keras.backend as K\n'), ((10599, 10639), 'csbdeep.utils.axes_check_and_normalize', 'axes_check_an... |
'''
Author: <NAME>
Implementation of Personalized Ranking Adaptation(PRA).
'https://dl.acm.org/citation.cfm?id=3087993.3088031'
Using Popularity Version and mean-std meature.
'''
import random
import numpy as np
def usr_samples(userid, user_items):
'''
sample items of # min(len(items), 10)
'''
pa... | [
"numpy.argsort",
"numpy.abs",
"numpy.mean",
"numpy.std"
] | [((1556, 1578), 'numpy.argsort', 'np.argsort', (['(-full_list)'], {}), '(-full_list)\n', (1566, 1578), True, 'import numpy as np\n'), ((1989, 2014), 'numpy.abs', 'np.abs', (['(rec_score - u_pra)'], {}), '(rec_score - u_pra)\n', (1995, 2014), True, 'import numpy as np\n'), ((1021, 1038), 'numpy.mean', 'np.mean', (['list... |
'''
Created on 19 Mar 2022
@author: ucacsjj
'''
# This grid stores the value function for each state. It's defined to be a
# real number in all cases, so we specialise it here. In addition, it
# automatically creates a policy the policy is a grid the same size as the array.
# The
import random
import numpy as np
... | [
"numpy.zeros",
"numpy.amax"
] | [((945, 995), 'numpy.zeros', 'np.zeros', (['(self._width, self._height, num_actions)'], {}), '((self._width, self._height, num_actions))\n', (953, 995), True, 'import numpy as np\n'), ((1675, 1697), 'numpy.amax', 'np.amax', (['action_values'], {}), '(action_values)\n', (1682, 1697), True, 'import numpy as np\n')] |
from dataclasses import dataclass
from datetime import date, datetime, timedelta
from pathlib import Path
from typing import Dict, List
import matplotlib.pyplot as plt
import numpy as np
from myfitnesspal.exercise import Exercise
from myfitnesspal.meal import Meal
from . import styles
@dataclass
class MaterializedD... | [
"matplotlib.pyplot.savefig",
"pathlib.Path",
"datetime.datetime.strptime",
"datetime.timedelta",
"datetime.datetime.now",
"matplotlib.pyplot.figure",
"numpy.sum",
"datetime.date.today"
] | [((2083, 2119), 'datetime.datetime.strptime', 'datetime.strptime', (['value', '"""%Y-%m-%d"""'], {}), "(value, '%Y-%m-%d')\n", (2100, 2119), False, 'from datetime import date, datetime, timedelta\n'), ((5185, 5215), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5.5, 0.7)'}), '(figsize=(5.5, 0.7))\n', (51... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
to_list = ak._v2.operations.convert.to_list
def test():
def _apply_ufunc(ufunc, method, ... | [
"numpy.array",
"awkward._v2._util.behavior_of",
"pytest.raises",
"awkward._v2.highlevel.Array"
] | [((1309, 1340), 'awkward._v2.highlevel.Array', 'ak._v2.highlevel.Array', (["['HAL']"], {}), "(['HAL'])\n", (1331, 1340), True, 'import awkward as ak\n'), ((1350, 1374), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (1363, 1374), False, 'import pytest\n'), ((1049, 1080), 'numpy.array', 'np.arra... |
from line_profiler import LineProfiler
import numpy as np
from quantumGAN.discriminator import ClassicalDiscriminator
from quantumGAN.performance_testing.performance_qgan import Quantum_GAN
from quantumGAN.quantum_generator import QuantumGenerator
num_qubits: int = 3
# Set number of training epochs
num_epochs = 20
... | [
"quantumGAN.performance_testing.performance_qgan.Quantum_GAN",
"quantumGAN.quantum_generator.QuantumGenerator",
"numpy.array",
"numpy.random.uniform",
"quantumGAN.discriminator.ClassicalDiscriminator",
"line_profiler.LineProfiler"
] | [((631, 695), 'quantumGAN.discriminator.ClassicalDiscriminator', 'ClassicalDiscriminator', ([], {'sizes': '[4, 16, 8, 1]', 'type_loss': '"""minimax"""'}), "(sizes=[4, 16, 8, 1], type_loss='minimax')\n", (653, 695), False, 'from quantumGAN.discriminator import ClassicalDiscriminator\n'), ((830, 931), 'quantumGAN.quantum... |
# Copyright 2018 The Cornac Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"numpy.ones",
"os.makedirs",
"os.path.join",
"inspect.signature",
"numpy.min",
"datetime.datetime.now",
"os.path.isdir",
"copy.deepcopy",
"numpy.greater_equal"
] | [((2266, 2289), 'inspect.signature', 'inspect.signature', (['init'], {}), '(init)\n', (2283, 2289), False, 'import inspect\n'), ((3450, 3483), 'os.path.join', 'os.path.join', (['save_dir', 'self.name'], {}), '(save_dir, self.name)\n', (3462, 3483), False, 'import os\n'), ((3492, 3529), 'os.makedirs', 'os.makedirs', (['... |
import os
from pickle import FALSE
import sys
import numpy as np
from collections import Iterable
import importlib
import open3d as o3d
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from torch.distributions import Categor... | [
"torch.mul",
"numpy.sqrt",
"torch.distributions.Categorical",
"torch.max",
"torch.sqrt",
"numpy.array",
"torch.sum",
"os.path.exists",
"torch.eye",
"torch.matmul",
"torch.zeros_like",
"torch.randn",
"importlib.import_module",
"torch.topk",
"torch.load",
"open3d.geometry.KDTreeSearchPar... | [((382, 407), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (397, 407), False, 'import os\n'), ((447, 489), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""model/classifier"""'], {}), "(ROOT_DIR, 'model/classifier')\n", (459, 489), False, 'import os\n'), ((1624, 1674), 'importlib.import_mo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: 11360
# datetime: 2021/3/11 18:58
import matplotlib.pyplot as plt
import numpy as np
import scipy
from sklearn.datasets import make_moons, make_regression
class LDA:
def __init__(self, k):
"""
:param k: reduced dimension R^d... | [
"numpy.mat",
"matplotlib.pyplot.text",
"sklearn.datasets.make_regression",
"numpy.mean",
"numpy.unique",
"numpy.where",
"matplotlib.pyplot.gca",
"sklearn.datasets.make_moons",
"scipy.linalg.eig",
"numpy.zeros",
"numpy.argsort",
"numpy.array",
"matplotlib.pyplot.scatter",
"numpy.concatenate... | [((1368, 1390), 'numpy.unique', 'np.unique', (['self.Y_data'], {}), '(self.Y_data)\n', (1377, 1390), True, 'import numpy as np\n'), ((1506, 1558), 'numpy.zeros', 'np.zeros', (['[attribute_dimension, attribute_dimension]'], {}), '([attribute_dimension, attribute_dimension])\n', (1514, 1558), True, 'import numpy as np\n'... |
"""Tests for utility functions."""
import pytest
from pytest import approx
import numpy as np
from bdm import BDM
from bdm.utils import get_reduced_shape, get_reduced_idx, slice_dataset
from bdm.utils import make_min_data, make_max_data
@pytest.mark.parametrize('x,shape,shift,size_only,expected', [
(np.ones((50, ... | [
"pytest.approx",
"bdm.utils.get_reduced_idx",
"numpy.ones",
"bdm.utils.slice_dataset",
"bdm.utils.get_reduced_shape",
"pytest.mark.parametrize",
"numpy.zeros",
"numpy.array_equal",
"bdm.utils.make_min_data",
"bdm.utils.make_max_data"
] | [((725, 1046), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""i,shape,expected"""', '[(0, (2, 2, 2), (0, 0, 0)), (1, (2, 2, 2), (0, 0, 1)), (2, (2, 2, 2), (0, 1,\n 0)), (3, (2, 2, 2), (0, 1, 1)), (4, (2, 2, 2), (1, 0, 0)), (5, (2, 2, 2\n ), (1, 0, 1)), (6, (2, 2, 2), (1, 1, 0)), (7, (2, 2, 2), (1, 1,... |
# Importing some useful/necessary packages
import numpy as np
import pandas as pd
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
import cv2
def leaf_image(image_id,target_length=160):
# `image_id` should be the index of the image in the images/ folder
# Return the image of a given id(1~1584)... | [
"matplotlib.pyplot.imshow",
"seaborn.set",
"numpy.ones",
"numpy.where",
"cv2.copyMakeBorder",
"matplotlib.pyplot.imread",
"cv2.putText",
"numpy.append",
"numpy.zeros",
"matplotlib.pyplot.figure",
"cv2.cvtColor",
"matplotlib.pyplot.axis",
"cv2.resize",
"matplotlib.pyplot.show"
] | [((105, 114), 'seaborn.set', 'sns.set', ([], {}), '()\n', (112, 114), True, 'import seaborn as sns\n'), ((429, 463), 'matplotlib.pyplot.imread', 'plt.imread', (["('images/' + image_name)"], {}), "('images/' + image_name)\n", (439, 463), True, 'import matplotlib.pyplot as plt\n'), ((607, 657), 'numpy.zeros', 'np.zeros',... |
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import numpy as np
try:
numeric_types = (int, float, long)
except NameError:
numeric_types = (int, float)
class SimpleVectorPlotter(object):
"""Plots vector data represented a... | [
"matplotlib.path.Path",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.plot",
"numpy.asarray",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.ion",
"matplotlib.pypl... | [((844, 878), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'num': '(1)', 'figsize': 'figsize'}), '(num=1, figsize=figsize)\n', (854, 878), True, 'import matplotlib.pyplot as plt\n'), ((1154, 1171), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (1162, 1171), True, 'import matplotlib.pypl... |
import argparse
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from simulator.network_simulator.bbr import BBR
from simulator.network_simulator.cubic import Cubic
from simulator.trace import Trace
def parse_args():
"""Parse arguments from ... | [
"os.path.exists",
"numpy.mean",
"simulator.network_simulator.bbr.BBR",
"argparse.ArgumentParser",
"os.makedirs",
"matplotlib.use",
"pandas.read_csv",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.ylabel",
"simulator.trace.Trace.load_from_file",
"matplotlib.pyplot.close",
"os.path.dirname",
... | [((44, 65), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (58, 65), False, 'import matplotlib\n'), ((354, 402), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Plot validation curv."""'], {}), "('Plot validation curv.')\n", (377, 402), False, 'import argparse\n'), ((756, 766), 'simul... |
from greenonbrown import green_on_brown
from imutils.video import count_frames, FileVideoStream
import numpy as np
import imutils
import glob
import cv2
import csv
import os
def frame_analysis(exgFile: str, exgsFile: str, hueFile: str, exhuFile: str, HDFile: str):
baseName = os.path.splitext(os.path.basename(exhuF... | [
"glob.iglob",
"numpy.hstack",
"cv2.imshow",
"numpy.mean",
"cv2.Laplacian",
"imutils.video.FileVideoStream",
"numpy.vstack",
"imutils.rotate",
"pandas.DataFrame",
"greenonbrown.green_on_brown",
"cv2.waitKey",
"numpy.round",
"cv2.cvtColor",
"numpy.std",
"imutils.resize",
"numpy.zeros",
... | [((345, 370), 'cv2.VideoCapture', 'cv2.VideoCapture', (['exgFile'], {}), '(exgFile)\n', (361, 370), False, 'import cv2\n'), ((488, 514), 'cv2.VideoCapture', 'cv2.VideoCapture', (['exgsFile'], {}), '(exgsFile)\n', (504, 514), False, 'import cv2\n'), ((634, 659), 'cv2.VideoCapture', 'cv2.VideoCapture', (['hueFile'], {}),... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
# # Simple Linear Regression (sLR) With scikit-learn (Example from lesson ML05)
# Powered by: Dr. <NAME>, DHBW Stuttgart(Germany); July 2020
# Following ideas from:
# "Linear Regression in Python" by <NAME>, 28.4.2020
# (see details: https://realpython.com/linear-... | [
"numpy.array",
"time.strftime",
"sklearn.linear_model.LinearRegression"
] | [((2144, 2178), 'numpy.array', 'np.array', (['[2, 4, 6, 8, 12, 13, 15]'], {}), '([2, 4, 6, 8, 12, 13, 15])\n', (2152, 2178), True, 'import numpy as np\n'), ((2918, 2936), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (2934, 2936), False, 'from sklearn.linear_model import LinearRegressio... |
'''
*****************************************************************************************
*
* ===============================================
* Nirikshak Bot (NB) Theme (eYRC 2020-21)
* ===============================================
*
* This script is to implement Task 1A - Part 1 of... | [
"numpy.sqrt",
"cv2.threshold",
"cv2.arcLength",
"os.getcwd",
"cv2.contourArea",
"cv2.cvtColor",
"cv2.moments",
"cv2.findContours",
"cv2.imread"
] | [((2460, 2508), 'numpy.sqrt', 'np.sqrt', (['((x[3] - x[1]) ** 2 + (x[2] - x[0]) ** 2)'], {}), '((x[3] - x[1]) ** 2 + (x[2] - x[0]) ** 2)\n', (2467, 2508), True, 'import numpy as np\n'), ((2519, 2567), 'numpy.sqrt', 'np.sqrt', (['((x[5] - x[3]) ** 2 + (x[4] - x[2]) ** 2)'], {}), '((x[5] - x[3]) ** 2 + (x[4] - x[2]) ** 2... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import tensorflow as tf
import numpy as np
import gc
import pandas as pd
from datetime import datetime
from sklearn.utils import shuffle
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selectio... | [
"pandas.read_csv",
"sklearn.decomposition.PCA",
"sklearn.utils.shuffle",
"numpy.argmax",
"sklearn.metrics.roc_auc_score",
"sklearn.model_selection.StratifiedKFold",
"numpy.array",
"tensorflow.keras.layers.MaxPool1D",
"sklearn.metrics.roc_curve",
"tensorflow.keras.layers.Dense",
"tensorflow.keras... | [((608, 666), 'pandas.read_csv', 'pd.read_csv', (['"""../Dataset/02-03-2018.csv"""'], {'low_memory': '(False)'}), "('../Dataset/02-03-2018.csv', low_memory=False)\n", (619, 666), True, 'import pandas as pd\n'), ((817, 838), 'numpy.array', 'np.array', (["df['Label']"], {}), "(df['Label'])\n", (825, 838), True, 'import n... |
import logging
import re
from typing import Any, List, Optional, Union
import numpy as np
from skweak.aggregation import HMM as HMM_
from spacy.lang.en import English
from spacy.tokenizer import Tokenizer
from spacy.tokens import Span
from ..basemodel import BaseSeqModel
from ..dataset import BaseSeqDataset
from ..ut... | [
"logging.getLogger",
"re.compile",
"spacy.lang.en.English",
"spacy.tokens.Span",
"numpy.random.randint",
"skweak.aggregation.HMM"
] | [((350, 377), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (367, 377), False, 'import logging\n'), ((2854, 2863), 'spacy.lang.en.English', 'English', ([], {}), '()\n', (2861, 2863), False, 'from spacy.lang.en import English\n'), ((4152, 4243), 'skweak.aggregation.HMM', 'HMM_', (['"""hmm... |
import os
import glob
import cmat
import pickle
import math
import collections
from collections import Counter
import numpy as np
import pandas as pd
import sklearn.model_selection
import src.featurizer
def replace_classes(y, replace_dict):
if replace_dict:
return y.replace(replace_dict)
else:
... | [
"pandas.Series",
"os.path.exists",
"os.listdir",
"pickle.dump",
"pandas.read_csv",
"os.makedirs",
"numpy.asarray",
"os.path.join",
"numpy.argmax",
"numpy.array",
"numpy.zeros",
"numpy.random.seed",
"os.path.basename",
"numpy.random.shuffle"
] | [((3001, 3069), 'pandas.read_csv', 'pd.read_csv', (['file'], {'index_col': '(0)', 'parse_dates': '[0]', 'chunksize': 'chunksize'}), '(file, index_col=0, parse_dates=[0], chunksize=chunksize)\n', (3012, 3069), True, 'import pandas as pd\n'), ((3598, 3634), 'pickle.dump', 'pickle.dump', (['args_cmats', 'filehandler'], {}... |
"""Configuration for MeerKAT observatory."""
from __future__ import division
from __future__ import absolute_import
import ephem
import json
import katpoint
import numpy
import os
from datetime import datetime, timedelta
from .simulate import user_logger, setobserver
from .targets import katpoint_target_string
try:... | [
"ephem.now",
"katpoint.Target",
"numpy.asarray",
"os.path.isfile",
"datetime.datetime.now",
"numpy.deg2rad",
"os.path.isdir",
"katconf.resource_template",
"ephem.hours",
"katpoint.Antenna",
"katconf.resource_exists",
"katconf.ArrayConfig",
"datetime.timedelta",
"katpoint.Catalogue",
"kat... | [((476, 503), 'os.path.isdir', 'os.path.isdir', (['_config_path'], {}), '(_config_path)\n', (489, 503), False, 'import os\n'), ((8248, 8268), 'katpoint.Catalogue', 'katpoint.Catalogue', ([], {}), '()\n', (8266, 8268), False, 'import katpoint\n'), ((8293, 8324), 'katpoint.Antenna', 'katpoint.Antenna', (['_ref_location']... |
# -*- coding: utf-8 -*-
"""
Absolute spectral radiance calibration
"""
# Module importation
import os
import time
import string
import deepdish
import h5py
import numpy as np
import skimage.measure
import matplotlib.pyplot as plt
# Other modules
import source.processing as proccessing
from source.geometric_rolloff im... | [
"numpy.clip",
"numpy.sqrt",
"numpy.array",
"source.processing.FigureFunctions",
"matplotlib.pyplot.style.use",
"numpy.exp",
"numpy.empty",
"matplotlib.pyplot.Circle",
"source.processing.ProcessImage",
"h5py.File",
"source.processing.FlameSpectrometer",
"os.path.dirname",
"numpy.interp",
"s... | [((613, 643), 'numpy.exp', 'np.exp', (['(h * c / (lamb * k * T))'], {}), '(h * c / (lamb * k * T))\n', (619, 643), True, 'import numpy as np\n'), ((1117, 1143), 'source.processing.ProcessImage', 'proccessing.ProcessImage', ([], {}), '()\n', (1141, 1143), True, 'import source.processing as proccessing\n'), ((1188, 1217)... |
# coding: utf-8
import datetime
import glob
import multiprocessing as mp
import os
import queue
import random
import threading
import keras.backend.tensorflow_backend as KTF
import numpy as np
import tensorflow as tf
from keras import backend as K
from keras.applications.resnet50 import preprocess_input
from keras.app... | [
"keras.preprocessing.image.img_to_array",
"multiprocessing.Process",
"keras.applications.resnet50.preprocess_input",
"numpy.array",
"keras.layers.Dense",
"tensorflow.GPUOptions",
"os.path.isdir",
"keras.models.Model",
"keras.callbacks.EarlyStopping",
"keras.layers.GlobalAveragePooling2D",
"tenso... | [((980, 1013), 'os.environ.get', 'os.environ.get', (['"""OMP_NUM_THREADS"""'], {}), "('OMP_NUM_THREADS')\n", (994, 1013), False, 'import os\n'), ((1032, 1091), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'per_process_gpu_memory_fraction': 'gpu_fraction'}), '(per_process_gpu_memory_fraction=gpu_fraction)\n', (1045, ... |
import numpy as np
import warnings
import cv2
import time
def Gamma_correction(low_frequency, alpha=0.5):
"""
Adjust the coefficient of low frequency component using Gamma correction.
:param low_frequency: the low frequency component of the image calculated with Shearlet transformation.
:param alpha: a... | [
"cv2.idft",
"numpy.sqrt",
"cv2.filter2D",
"numpy.equal",
"numpy.array",
"numpy.rot90",
"numpy.mod",
"numpy.arange",
"cv2.dft",
"numpy.asarray",
"numpy.max",
"numpy.stack",
"numpy.linspace",
"numpy.concatenate",
"numpy.min",
"warnings.warn",
"numpy.meshgrid",
"numpy.abs",
"numpy.o... | [((467, 488), 'numpy.max', 'np.max', (['low_frequency'], {}), '(low_frequency)\n', (473, 488), True, 'import numpy as np\n'), ((501, 522), 'numpy.min', 'np.min', (['low_frequency'], {}), '(low_frequency)\n', (507, 522), True, 'import numpy as np\n'), ((1059, 1133), 'cv2.getStructuringElement', 'cv2.getStructuringElemen... |
import numpy as np
from PIL import Image, ImageTk
import PySimpleGUI as sg
def adapta_imagem(img, shape, max_val=1):
'''
Função que adapta a imagem para o range e o tipo correto.
'''
img = (img - img.min())/(img.max() - img.min())
if max_val > 1:
img *= max_val
re... | [
"PIL.Image.fromarray",
"PySimpleGUI.Slider",
"PySimpleGUI.Column",
"PySimpleGUI.Text",
"PySimpleGUI.VSeparator",
"PySimpleGUI.Button",
"PySimpleGUI.theme",
"numpy.random.randint",
"PySimpleGUI.Image",
"numpy.load",
"PySimpleGUI.Window",
"PIL.ImageTk.PhotoImage"
] | [((472, 499), 'numpy.load', 'np.load', (['"""eigenvectors.npy"""'], {}), "('eigenvectors.npy')\n", (479, 499), True, 'import numpy as np\n'), ((508, 527), 'numpy.load', 'np.load', (['"""mean.npy"""'], {}), "('mean.npy')\n", (515, 527), True, 'import numpy as np\n'), ((625, 641), 'PySimpleGUI.theme', 'sg.theme', (['"""D... |
from sklearn.neighbors import KDTree
from os.path import join, exists, dirname, abspath
import numpy as np
import pandas as pd
import os, sys, glob, pickle
import nibabel as nib
from multiprocessing import Process
import concurrent.futures
from tqdm import tqdm
from scipy import ndimage
import argparse
BASE_DIR = dir... | [
"os.path.exists",
"helper_tool.DataProcessing.grid_sub_sampling",
"os.listdir",
"pickle.dump",
"numpy.unique",
"argparse.ArgumentParser",
"os.makedirs",
"nibabel.load",
"os.path.join",
"sklearn.neighbors.KDTree",
"os.path.dirname",
"numpy.array",
"numpy.zeros",
"numpy.empty",
"os.path.ab... | [((355, 372), 'os.path.dirname', 'dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (362, 372), False, 'from os.path import join, exists, dirname, abspath\n'), ((374, 399), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (389, 399), False, 'import os, sys, glob, pickle\n'), ((400, 425), 'sys.path.... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.mean",
"cv2.boxPoints",
"os.path.realpath",
"cv2.minAreaRect",
"numpy.array",
"numpy.argsort",
"subprocess.call",
"math.atan2",
"numpy.linalg.norm",
"numpy.argmin",
"numpy.zeros_like",
"cv2.fillConvexPoly"
] | [((1497, 1523), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1513, 1523), False, 'import os\n'), ((1529, 1570), 'subprocess.call', 'subprocess.call', (["['make', '-C', BASE_DIR]"], {}), "(['make', '-C', BASE_DIR])\n", (1544, 1570), False, 'import subprocess\n'), ((1781, 1802), 'numpy.mea... |
import argparse
import os
import sys
from types import ModuleType
from typing import Dict
from typing import Tuple
from typing import Union
import numpy as np
import pandas as pd
import SimpleITK as sitk
import tensorflow as tf
from tensorflow.keras.models import load_model
import PrognosAIs.Constants
import Progno... | [
"tensorflow.keras.models.load_model",
"PrognosAIs.IO.ConfigLoader.ConfigLoader",
"numpy.asarray",
"PrognosAIs.IO.utils.get_root_name",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.round",
"numpy.eye",
"numpy.argmax",
"PrognosAIs.IO.utils.create_directory",
"SimpleITK.Cast",
"numpy.transpose... | [((959, 1010), 'os.path.join', 'os.path.join', (['output_folder', 'self.EVALUATION_FOLDER'], {}), '(output_folder, self.EVALUATION_FOLDER)\n', (971, 1010), False, 'import os\n'), ((1019, 1064), 'PrognosAIs.IO.utils.create_directory', 'IO_utils.create_directory', (['self.output_folder'], {}), '(self.output_folder)\n', (... |
#!usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
def plot_loss(loss_list):
t = np.arange(len(loss_list))
l = np.array(loss_list)
plt.plot(t, l)
plt.yscale("log")
plt.xlabel("step")
plt.ylabel("loss")
plt.show()
def plot_reward(reward_list):
t = np.arange(len(reward_... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.loadtxt",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.show"
] | [((471, 497), 'numpy.loadtxt', 'np.loadtxt', (['"""loss_log.txt"""'], {}), "('loss_log.txt')\n", (481, 497), True, 'import numpy as np\n'), ((138, 157), 'numpy.array', 'np.array', (['loss_list'], {}), '(loss_list)\n', (146, 157), True, 'import numpy as np\n'), ((162, 176), 'matplotlib.pyplot.plot', 'plt.plot', (['t', '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.