code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import print_function
from datetime import datetime
from numpy import random
import numpy as np
from pandas.compat import lrange, lzip, u
from pandas import (compat, DataFrame, Series, Index, MultiIndex,
date_range, isnull)
import pandas as pd
from pandas... | [
"numpy.random.rand",
"pandas.Index",
"pandas.util.testing.assertRaisesRegexp",
"pandas.MultiIndex.from_tuples",
"numpy.arange",
"pandas.date_range",
"pandas.to_datetime",
"pandas.util.testing.assert_frame_equal",
"datetime.datetime",
"pandas.DataFrame",
"pandas.util.testing.assert_produces_warni... | [((842, 939), 'pandas.DataFrame', 'DataFrame', (['[[1, 2, 3], [3, 4, 5], [5, 6, 7]]'], {'index': "['a', 'b', 'c']", 'columns': "['d', 'e', 'f']"}), "([[1, 2, 3], [3, 4, 5], [5, 6, 7]], index=['a', 'b', 'c'], columns\n =['d', 'e', 'f'])\n", (851, 939), False, 'from pandas import compat, DataFrame, Series, Index, Mult... |
import numpy as np
import albumentations as A
import cv2
# overlayed white mask over image
def mask_overlay(image, mask, color=(0, 0, 255), resize=(320, 320)):
"""
Helper function to visualize mask on the top of the car
"""
if resize:
resizer = A.Resize(*resize)
image = resizer(image=image... | [
"numpy.dstack",
"cv2.addWeighted",
"numpy.array",
"albumentations.Resize"
] | [((442, 485), 'cv2.addWeighted', 'cv2.addWeighted', (['mask', '(0.5)', 'image', '(0.5)', '(0.0)'], {}), '(mask, 0.5, image, 0.5, 0.0)\n', (457, 485), False, 'import cv2\n'), ((269, 286), 'albumentations.Resize', 'A.Resize', (['*resize'], {}), '(*resize)\n', (277, 286), True, 'import albumentations as A\n'), ((342, 371)... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 07 11:51:55 2015
@author: agirard
"""
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# Embed font type in PDF
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
##############################################... | [
"numpy.copy",
"matplotlib.pyplot.grid",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.tight_layout",
"numpy.meshgrid"
] | [((976, 998), 'numpy.copy', 'np.copy', (['self.cds.xbar'], {}), '(self.cds.xbar)\n', (983, 998), True, 'import numpy as np\n'), ((1038, 1060), 'numpy.copy', 'np.copy', (['self.cds.ubar'], {}), '(self.cds.ubar)\n', (1045, 1060), True, 'import numpy as np\n'), ((2020, 2080), 'numpy.linspace', 'np.linspace', (['self.x_axi... |
#!/usr/bin/env python
# esice_goffgratch.m
import numpy as num
def esice_goffgratch(T):
"""svp = esice_goffgratch(T)
Compute water vapor saturation pressure over ice
using Goff-Gratch formulation. Adopted from PvD's
svp_ice.pro.
Inputs:
T temperature [Kelvin]
Output:
svp saturation pressure [mba... | [
"numpy.array",
"numpy.log10"
] | [((888, 1219), 'numpy.array', 'num.array', (['(24.54, 23.16, 21.67, 20.23, 18.86, 17.49, 16.1, 14.69, 13.22, 11.52, 9.53,\n 7.24, 4.8, 2.34, 0.04, -2.29, -4.84, -7.64, -10.66, -13.95, -17.54, -\n 21.45, -25.58, -29.9, -34.33, -38.94, -43.78, -48.8, -53.94, -58.79, -\n 63.27, -67.32, -70.74, -73.62, -75.74, -77... |
import sys
import os
import numpy as np
import cv2
import torch
from model import *
from scipy.ndimage.filters import gaussian_filter
from loss import kldiv, cc, nss
import argparse
from torch.utils.data import DataLoader
from dataloader import DHF1KDataset
from utils import *
import time
from tqdm import tqdm
from to... | [
"numpy.hanning",
"torchaudio.load",
"torch.cuda.is_available",
"torch.flip",
"os.path.exists",
"argparse.ArgumentParser",
"sys.stdout.flush",
"torchvision.transforms.ToTensor",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"cv2.resize",
"cv2.GaussianBlur",
"torch.load"... | [((2242, 2271), 'torch.zeros', 'torch.zeros', (['(1)', 'max_audio_win'], {}), '(1, max_audio_win)\n', (2253, 2271), False, 'import torch\n'), ((6140, 6182), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['img', '(k_size, k_size)', '(0)'], {}), '(img, (k_size, k_size), 0)\n', (6156, 6182), False, 'import cv2\n'), ((6188, 620... |
import PyKinectV2
from PyKinectV2 import *
import ctypes
import _ctypes
from _ctypes import COMError
import comtypes
import sys
import numpy
import time, pdb
import importlib
if sys.hexversion >= 0x03000000:
import _thread as thread
else:
import thread
KINECT_MAX_BODY_COUNT = 6
class PyKinectRuntime(obj... | [
"numpy.copy",
"ctypes.byref",
"ctypes.POINTER",
"time.clock",
"ctypes.windll.kernel32.SetEvent",
"ctypes.c_uint",
"numpy.ctypeslib.as_array",
"thread.allocate",
"numpy.ndarray",
"ctypes.c_void_p",
"ctypes.windll.kernel32.WaitForMultipleObjects",
"thread.start_new_thread",
"ctypes.windll.kern... | [((1501, 1562), 'ctypes.windll.kernel32.CreateEventW', 'ctypes.windll.kernel32.CreateEventW', (['None', '(False)', '(False)', 'None'], {}), '(None, False, False, None)\n', (1536, 1562), False, 'import ctypes\n'), ((1932, 1949), 'thread.allocate', 'thread.allocate', ([], {}), '()\n', (1947, 1949), False, 'import thread\... |
import tensorflow as tf
import time
import os
import numpy as np
import matplotlib.pyplot as plt
class Gan(object):
def __init__(self):
super(Gan, self).__init__()
# Data constants
self.size = 32
self.channels = 1
self.latent_size = 128
self.depth = 32
self... | [
"tensorflow.train.Checkpoint",
"tensorflow.shape",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.GradientTape",
"tensorflow.keras.layers.Dense",
"tensorflow.ones_like",
"tensorflow.random_normal",
"tensorflow.keras.layers.Conv2D",
"tensorflow.zeros_like",
"tensorflow.convert_to_tensor"... | [((333, 361), 'os.path.join', 'os.path.join', (['"""train"""', '"""gan"""'], {}), "('train', 'gan')\n", (345, 361), False, 'import os\n'), ((539, 598), 'tensorflow.random_normal', 'tf.random_normal', (['[self.num_samples ** 2, self.latent_size]'], {}), '([self.num_samples ** 2, self.latent_size])\n', (555, 598), True, ... |
import numpy as np
import theano
import theano.tensor as T
import time
import argparse
import lasagne
import os
from lasagne import layers, regularization, nonlinearities
from load_dataset import DataLoader
from sklearn.metrics import confusion_matrix
from utils import *
import sys
IMAGE_SIZE = 256
BATCH_SIZE = 32
MO... | [
"theano.tensor.gt",
"theano.tensor.iscalar",
"lasagne.updates.nesterov_momentum",
"lasagne.utils.floatX",
"numpy.array",
"load_dataset.DataLoader",
"numpy.save",
"lasagne.layers.get_all_params",
"numpy.mean",
"lasagne.objectives.Objective",
"argparse.ArgumentParser",
"theano.function",
"thea... | [((740, 765), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (763, 765), False, 'import argparse\n'), ((1394, 1504), 'load_dataset.DataLoader', 'DataLoader', ([], {'image_size': 'IMAGE_SIZE', 'batch_size': 'BATCH_SIZE', 'random_state': '(1106)', 'train_path': '"""train/trimmed256"""'}), "(image... |
#!/usr/bin/env python
import tempfile
import numpy as np
import geometric
import geometric.molecule
Bohr = 0.52917721
def model(coords):
'''model Hamiltonian = sum_{AB} w_{AB} * (|r_A - r_B| - b_{AB})^2.
All quantiles are in atomic unit
'''
dr = coords[:,None,:] - coords
dist = np.linalg.norm(dr,... | [
"geometric.optimize.run_optimizer",
"tempfile.mktemp",
"numpy.array",
"geometric.molecule.Molecule",
"numpy.einsum",
"numpy.linalg.norm"
] | [((302, 328), 'numpy.linalg.norm', 'np.linalg.norm', (['dr'], {'axis': '(2)'}), '(dr, axis=2)\n', (316, 328), True, 'import numpy as np\n'), ((337, 398), 'numpy.array', 'np.array', (['[[0.0, 1.8, 1.8], [1.8, 0.0, 2.8], [1.8, 2.8, 0.0]]'], {}), '([[0.0, 1.8, 1.8], [1.8, 0.0, 2.8], [1.8, 2.8, 0.0]])\n', (345, 398), True,... |
import numpy as np
import pandas as pd
import optuna
import sklearn.ensemble as ensemble
import sklearn.metrics as metrics
from sklearn.model_selection import train_test_split
from itertools import chain
int_dtype_list = ['int8', 'int16', 'int32',
'int64', 'uint8', 'uint16', 'uint32', 'uint64']
float... | [
"pandas.Series",
"pandas.isnull",
"sklearn.ensemble.RandomForestRegressor",
"sklearn.model_selection.train_test_split",
"sklearn.ensemble.RandomForestClassifier",
"pandas.get_dummies",
"itertools.chain.from_iterable",
"numpy.isnan",
"pandas.DataFrame",
"sklearn.metrics.r2_score",
"pandas.concat"... | [((437, 467), 'pandas.concat', 'pd.concat', (['[train_df, test_df]'], {}), '([train_df, test_df])\n', (446, 467), True, 'import pandas as pd\n'), ((788, 822), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'column_names'}), '(columns=column_names)\n', (800, 822), True, 'import pandas as pd\n'), ((2299, 2337), 'pa... |
r"""Create data for kernel tests. Kernel tests are just securing status quo."""
import numpy as np
from copy import deepcopy
from scipy.constants import mu_0, epsilon_0
from empymod import kernel, filters
# All possible (ab, msrc, mrec) combinations
pab = (np.arange(1, 7)[None, :] + np.array([10, 20, 30])[:, None]).ra... | [
"numpy.sqrt",
"empymod.kernel.angle_factor",
"numpy.array",
"numpy.outer",
"empymod.kernel.greenfct",
"empymod.filters.key_51_2012",
"copy.deepcopy",
"empymod.kernel.wavenumber",
"numpy.savez_compressed",
"empymod.kernel.fields",
"empymod.kernel.reflections",
"numpy.arange"
] | [((627, 657), 'numpy.array', 'np.array', (['[1.0, 2.0, 4.0, 5.0]'], {}), '([1.0, 2.0, 4.0, 5.0])\n', (635, 657), True, 'import numpy as np\n'), ((955, 988), 'numpy.array', 'np.array', (['[0.003, 2.5, 1000000.0]'], {}), '([0.003, 2.5, 1000000.0])\n', (963, 988), True, 'import numpy as np\n'), ((989, 1020), 'numpy.array'... |
# External imports
import numpy as np
import os
import argparse
import importlib
# Local imports
from .helpers import data as avdata
from .helpers import util as util
from .helpers import combine as combine
def train(args):
repo = args.datarepo
network = args.NETWORK
epoch = args.epoch
rc = args.r... | [
"os.path.isfile",
"numpy.arange"
] | [((1311, 1337), 'numpy.arange', 'np.arange', (['(0.0)', '(0.21)', '(0.01)'], {}), '(0.0, 0.21, 0.01)\n', (1320, 1337), True, 'import numpy as np\n'), ((1358, 1384), 'numpy.arange', 'np.arange', (['(0.0)', '(0.11)', '(0.01)'], {}), '(0.0, 0.11, 0.01)\n', (1367, 1384), True, 'import numpy as np\n'), ((2006, 2033), 'numpy... |
import glob
import os
import sys
from setuptools import find_packages, setup
from setuptools.command.build_ext import build_ext as _build_ext
from setuptools.command.sdist import sdist as _sdist
from setuptools.extension import Extension
from setupext import check_for_openmp
def get_version(filename):
"""
G... | [
"os.path.exists",
"setupext.check_for_openmp",
"Cython.Build.cythonize",
"setuptools.find_packages",
"setuptools.extension.Extension",
"setuptools.command.sdist.sdist.run",
"os.path.join",
"numpy.get_include",
"sys.exit",
"setuptools.command.build_ext.build_ext.finalize_options",
"glob.glob",
... | [((699, 725), 'os.path.exists', 'os.path.exists', (['"""MANIFEST"""'], {}), "('MANIFEST')\n", (713, 725), False, 'import os\n'), ((1863, 1893), 'os.path.exists', 'os.path.exists', (['"""rockstar.cfg"""'], {}), "('rockstar.cfg')\n", (1877, 1893), False, 'import os\n'), ((731, 752), 'os.remove', 'os.remove', (['"""MANIFE... |
from typing import List, Union
import shutil
from pathlib import Path
import numpy as np
from .baserecording import BaseRecording, BaseRecordingSegment
from .core_tools import read_binary_recording, write_binary_recording
from .job_tools import _shared_job_kwargs_doc
class BinaryRecordingExtractor(BaseRecording):
... | [
"numpy.dtype",
"pathlib.Path"
] | [((2238, 2253), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (2246, 2253), True, 'import numpy as np\n'), ((2110, 2117), 'pathlib.Path', 'Path', (['p'], {}), '(p)\n', (2114, 2117), False, 'from pathlib import Path\n'), ((2203, 2219), 'pathlib.Path', 'Path', (['file_paths'], {}), '(file_paths)\n', (2207, 221... |
import pickle
import numpy as np
from profile import Profile
from pathlib import Path as _Path
import os as _os
_path = _Path(_os.path.dirname(_os.path.abspath(__file__)))
class Database:
def __init__(self, file):
self.file = file
try:
self.profiles = self.getDatabase()
pr... | [
"pickle.dump",
"profile.Profile",
"pickle.load",
"numpy.linalg.norm",
"numpy.array",
"numpy.argmin",
"numpy.min",
"os.path.abspath"
] | [((144, 170), 'os.path.abspath', '_os.path.abspath', (['__file__'], {}), '(__file__)\n', (160, 170), True, 'import os as _os\n'), ((1971, 1990), 'numpy.array', 'np.array', (['distances'], {}), '(distances)\n', (1979, 1990), True, 'import numpy as np\n'), ((989, 1018), 'pickle.dump', 'pickle.dump', (['self.profiles', 'f... |
"""Rational quadratic kernel."""
from typing import Optional
import numpy as np
import probnum.utils as _utils
from probnum.typing import IntArgType, ScalarArgType
from ._kernel import IsotropicMixin, Kernel
class RatQuad(Kernel, IsotropicMixin):
r"""Rational quadratic kernel.
Covariance function defined... | [
"numpy.ones_like",
"probnum.utils.as_numpy_scalar"
] | [((1747, 1782), 'probnum.utils.as_numpy_scalar', '_utils.as_numpy_scalar', (['lengthscale'], {}), '(lengthscale)\n', (1769, 1782), True, 'import probnum.utils as _utils\n'), ((1804, 1833), 'probnum.utils.as_numpy_scalar', '_utils.as_numpy_scalar', (['alpha'], {}), '(alpha)\n', (1826, 1833), True, 'import probnum.utils ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import numpy as np
import logging
from constant import *
import utility
from synset2vec_hier import get_synset_encoder
logger = logging.getLogger(__file__)
logging.basicConfig(
format... | [
"logging.getLogger",
"utility.makedirsforfile",
"logging.basicConfig",
"os.path.exists",
"os.path.join",
"optparse.OptionParser",
"os.path.realpath",
"numpy.array",
"synset2vec_hier.get_synset_encoder"
] | [((261, 288), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (278, 288), False, 'import logging\n'), ((289, 411), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(asctime)s - %(filename)s:line %(lineno)s] %(message)s"""', 'datefmt': '"""%d %b %H:%M:%S"""'}), "(format=\... |
"""GaussianCNNModel."""
import numpy as np
import tensorflow as tf
from garage.tf.distributions import DiagonalGaussian
from garage.tf.models.cnn import cnn
from garage.tf.models.mlp import mlp
from garage.tf.models.model import Model
from garage.tf.models.parameter import parameter
class GaussianCNNModel... | [
"tensorflow.compat.v1.variable_scope",
"tensorflow.maximum",
"numpy.full",
"tensorflow.initializers.glorot_uniform",
"numpy.log",
"garage.tf.models.cnn.cnn",
"garage.tf.models.mlp.mlp",
"numpy.exp",
"tensorflow.exp",
"numpy.zeros",
"tensorflow.constant_initializer",
"tensorflow.zeros_initializ... | [((5617, 5649), 'tensorflow.initializers.glorot_uniform', 'tf.initializers.glorot_uniform', ([], {}), '()\n', (5647, 5649), True, 'import tensorflow as tf\n'), ((5683, 5705), 'tensorflow.zeros_initializer', 'tf.zeros_initializer', ([], {}), '()\n', (5703, 5705), True, 'import tensorflow as tf\n'), ((5783, 5815), 'tenso... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 2 15:15:03 2020
@author: <NAME>
Plot to vizualise the effect of background normalization
"""
# Import library
import seaborn as sns; sns.set(color_codes=True)
import matplotlib.pyplot as plt
import numpy as np
# Function
def raw_vs_normalized_plot (adata, out_dir, log=... | [
"seaborn.set",
"matplotlib.pyplot.savefig",
"seaborn.distplot",
"matplotlib.pyplot.clf",
"seaborn.set_style",
"numpy.array",
"numpy.log1p"
] | [((182, 207), 'seaborn.set', 'sns.set', ([], {'color_codes': '(True)'}), '(color_codes=True)\n', (189, 207), True, 'import seaborn as sns\n'), ((1114, 1136), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (1127, 1136), True, 'import seaborn as sns\n'), ((1555, 1599), 'matplotlib.pyplot.save... |
import numpy as np
from logbook import Logger
from catalyst.constants import LOG_LEVEL
from catalyst.protocol import Portfolio, Positions, Position
log = Logger('ExchangePortfolio', level=LOG_LEVEL)
class ExchangePortfolio(Portfolio):
"""
Since the goal is to support multiple exchanges, it makes sense to
... | [
"catalyst.protocol.Positions",
"logbook.Logger",
"catalyst.protocol.Position",
"numpy.average"
] | [((156, 200), 'logbook.Logger', 'Logger', (['"""ExchangePortfolio"""'], {'level': 'LOG_LEVEL'}), "('ExchangePortfolio', level=LOG_LEVEL)\n", (162, 200), False, 'from logbook import Logger\n'), ((928, 939), 'catalyst.protocol.Positions', 'Positions', ([], {}), '()\n', (937, 939), False, 'from catalyst.protocol import Po... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Some code is from https://github.com/princeton-vl/pose-ae-train/blob/454d4ba113bbb9775d4dc259ef5e6c07c2ceed54/utils/group.py
# Written by <NAME> (<EMAIL>)
# Modified by <NAME> (... | [
"numpy.mean",
"numpy.copy",
"numpy.tile",
"torch.stack",
"numpy.argmax",
"torch.eq",
"numpy.array",
"numpy.zeros",
"torch.nn.MaxPool2d",
"munkres.Munkres",
"numpy.concatenate",
"numpy.linalg.norm",
"torch.gather",
"numpy.round"
] | [((617, 626), 'munkres.Munkres', 'Munkres', ([], {}), '()\n', (624, 626), False, 'from munkres import Munkres\n'), ((863, 912), 'numpy.zeros', 'np.zeros', (['(params.num_joints, 3 + tag_k.shape[2])'], {}), '((params.num_joints, 3 + tag_k.shape[2]))\n', (871, 912), True, 'import numpy as np\n'), ((1071, 1129), 'numpy.co... |
import numpy as np
import matplotlib.pyplot as plt
from FEM.PlaneStress import PlaneStress
from FEM.Mesh.Geometry import Geometry
# 11.7.1 Ed 3
b = 120
h = 160
t = 0.036
E = 30*10**(6)
v = 0.25
gdls = [[0, 0], [b, 0], [0, h], [b, h]]
elemento1 = [0, 1, 3]
elemento2 = [0, 3, 2]
dicc = [elemento1, elemento2]
tipos = ['T... | [
"numpy.array",
"FEM.PlaneStress.PlaneStress",
"matplotlib.pyplot.show",
"FEM.Mesh.Geometry.Geometry"
] | [((389, 443), 'FEM.Mesh.Geometry.Geometry', 'Geometry', (['dicc', 'gdls', 'tipos'], {'nvn': '(2)', 'segments': 'segmentos'}), '(dicc, gdls, tipos, nvn=2, segments=segmentos)\n', (397, 443), False, 'from FEM.Mesh.Geometry import Geometry\n'), ((620, 630), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (628, 630... |
# load libraries
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
# Create feature matrix with categorical feature
x = np.array([[0, 2.10, 1.45],
[1, 1.18, 1.33],
[0, 1.22, 1.27],
[1, -0.21, -1.19]])
# Create feature matrix with missing values in the cate... | [
"numpy.array",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.vstack"
] | [((141, 220), 'numpy.array', 'np.array', (['[[0, 2.1, 1.45], [1, 1.18, 1.33], [0, 1.22, 1.27], [1, -0.21, -1.19]]'], {}), '([[0, 2.1, 1.45], [1, 1.18, 1.33], [0, 1.22, 1.27], [1, -0.21, -1.19]])\n', (149, 220), True, 'import numpy as np\n'), ((349, 405), 'numpy.array', 'np.array', (['[[np.nan, 0.87, 1.31], [np.nan, -0.... |
import config
import models
import tensorflow as tf
import numpy as np
import sys
#Dataset to run on
dataset = sys.argv[1].upper()
#Train TransR based on pretrained TransE results.
#++++++++++++++TransE++++++++++++++++++++
con = config.Config()
con.set_in_path("./benchmarks/{}/".format(dataset))
con.set_work_threads(... | [
"numpy.identity",
"config.Config"
] | [((231, 246), 'config.Config', 'config.Config', ([], {}), '()\n', (244, 246), False, 'import config\n'), ((665, 680), 'config.Config', 'config.Config', ([], {}), '()\n', (678, 680), False, 'import config\n'), ((1555, 1571), 'numpy.identity', 'np.identity', (['(100)'], {}), '(100)\n', (1566, 1571), True, 'import numpy a... |
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... | [
"matplotlib.pyplot.ylabel",
"cirq.GridQubit",
"tensorflow_quantum.convert_to_tensor",
"cirq.Circuit",
"numpy.array",
"cirq.H.on_each",
"tensorflow.keras.layers.Dense",
"cirq.YY",
"cirq.CNOT",
"cirq.ZZ",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"cirq.XX",
"cirq.rx",
"matplotl... | [((775, 798), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (789, 798), False, 'import matplotlib\n'), ((881, 901), 'cirq.GridQubit', 'cirq.GridQubit', (['(0)', '(0)'], {}), '(0, 0)\n', (895, 901), False, 'import cirq\n'), ((1052, 1095), 'tensorflow_quantum.convert_to_tensor', 'tfq.convert_t... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import logging
import itertools
import numpy as np
from allel.util import asarray_ndim, check_dim0_aligned, ensure_dim1_aligned
from allel.model.ndarray import GenotypeArray
from allel.stats.window import windowed_statistic, ... | [
"logging.getLogger",
"itertools.chain",
"numpy.column_stack",
"allel.stats.admixture.h_hat",
"allel.stats.diversity.mean_pairwise_difference",
"allel.stats.diversity.mean_pairwise_difference_between",
"allel.chunked.get_blen_array",
"numpy.mean",
"allel.util.check_dim0_aligned",
"allel.stats.windo... | [((527, 554), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (544, 554), False, 'import logging\n'), ((4899, 4927), 'allel.model.ndarray.GenotypeArray', 'GenotypeArray', (['g'], {'copy': '(False)'}), '(g, copy=False)\n', (4912, 4927), False, 'from allel.model.ndarray import GenotypeArray\... |
from numpy import ones
from eliot import log_call, to_file
to_file(open('eliot.log', 'w'))
@log_call
def palavras(split=False):
with open('br-utf8.txt') as file:
if split:
text = file.read().split('\n')
else:
text = file.readlines()[:50]
return text
@log_call
def num... | [
"numpy.ones"
] | [((340, 361), 'numpy.ones', 'ones', (['(100, 100, 100)'], {}), '((100, 100, 100))\n', (344, 361), False, 'from numpy import ones\n')] |
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch.nn as nn
from mmcv.cnn import build_conv_layer, constant_init, kaiming_init
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmpose.core import (WeightNormClipHook, compute_similarity_transform,
fliplr_regres... | [
"numpy.insert",
"numpy.ones_like",
"mmcv.cnn.kaiming_init",
"mmpose.models.builder.build_loss",
"numpy.full",
"mmpose.models.builder.HEADS.register_module",
"mmpose.core.WeightNormClipHook",
"numpy.stack",
"numpy.linalg.norm",
"mmcv.cnn.constant_init",
"mmpose.core.compute_similarity_transform",... | [((381, 404), 'mmpose.models.builder.HEADS.register_module', 'HEADS.register_module', ([], {}), '()\n', (402, 404), False, 'from mmpose.models.builder import HEADS, build_loss\n'), ((1605, 1630), 'mmpose.models.builder.build_loss', 'build_loss', (['loss_keypoint'], {}), '(loss_keypoint)\n', (1615, 1630), False, 'from m... |
# ******************************************************************************
# Copyright (c) 2020, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code mus... | [
"numpy.random.random",
"pytest.param",
"pytest.mark.parametrize",
"numpy.random.randint",
"numpy.array",
"skipp.transform.AffineTransform"
] | [((4642, 4731), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""function"""', '[erosion, dilation]'], {'ids': "['erosion', 'dilation']"}), "('function', [erosion, dilation], ids=['erosion',\n 'dilation'])\n", (4665, 4731), False, 'import pytest\n'), ((4984, 5033), 'pytest.mark.parametrize', 'pytest.mark.... |
# Copyright 2019 Uber Technologies, Inc. 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... | [
"math.floor",
"horovod.tensorflow.keras.size",
"numpy.array",
"tensorflow.keras.layers.Dense",
"horovod.tensorflow.keras.init",
"horovod.tensorflow.keras.rank",
"numpy.random.random",
"warnings.simplefilter",
"tensorflow.keras.models.Sequential",
"tensorflow.Variable",
"horovod.tensorflow.keras.... | [((1029, 1057), 'distutils.version.LooseVersion', 'LooseVersion', (['tf.__version__'], {}), '(tf.__version__)\n', (1041, 1057), False, 'from distutils.version import LooseVersion\n'), ((1060, 1081), 'distutils.version.LooseVersion', 'LooseVersion', (['"""2.4.0"""'], {}), "('2.4.0')\n", (1072, 1081), False, 'from distut... |
import os
import numpy as np
import scipy.io as io
def load_data_mat(filename, max_samples, seed=42):
raw = io.loadmat(filename)
X = raw['X'] # Array of [32, 32, 3, n_samples]
y = raw['y'] # Array of [n_samples, 1]
X = np.moveaxis(X, [3], [0])
y = y.flatten()
# Fix up class 0 to be 0
y... | [
"scipy.io.loadmat",
"os.path.join",
"numpy.random.seed",
"numpy.moveaxis",
"numpy.arange",
"numpy.random.shuffle"
] | [((116, 136), 'scipy.io.loadmat', 'io.loadmat', (['filename'], {}), '(filename)\n', (126, 136), True, 'import scipy.io as io\n'), ((241, 265), 'numpy.moveaxis', 'np.moveaxis', (['X', '[3]', '[0]'], {}), '(X, [3], [0])\n', (252, 265), True, 'import numpy as np\n'), ((343, 363), 'numpy.random.seed', 'np.random.seed', (['... |
# Copyright 2018 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.local_variables_initializer",
"numpy.prod",
"numpy.int32",
"tensorflow.gfile.MakeDirs",
"absl.flags.DEFINE_float",
"numpy.arange",
"absl.flags.DEFINE_list",
"tensorflow.app.run",
"numpy.mean",
"tensorflow.Graph",
"tensorflow.gfile.Exists",
"tensorflow.keras.Sequential",
"tensorfl... | [((928, 949), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (942, 949), False, 'import matplotlib\n'), ((1473, 1558), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""learning_rate"""'], {'default': '(0.01)', 'help': '"""Initial learning rate."""'}), "('learning_rate', default=0.01, help='... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas
from compas.datastructures import Mesh
from compas.utilities import flatten
from numpy import array
mesh = Mesh.from_obj(compas.get('faces.obj'))
xyz = mesh.get_vertices_attributes('xyz')
# ... | [
"compas.get",
"numpy.array",
"compas.utilities.flatten"
] | [((248, 271), 'compas.get', 'compas.get', (['"""faces.obj"""'], {}), "('faces.obj')\n", (258, 271), False, 'import compas\n'), ((651, 663), 'compas.utilities.flatten', 'flatten', (['xyz'], {}), '(xyz)\n', (658, 663), False, 'from compas.utilities import flatten\n'), ((1165, 1175), 'numpy.array', 'array', (['xyz'], {}),... |
from argparse import ArgumentParser
from typing import Dict, List
from unittest import mock
from unittest.mock import call, patch
import networkx as nx
import numpy as np
import torch
from cogdl.data import Graph
from cogdl.models.emb.deepwalk import DeepWalk
class Word2VecFake:
def __init__(self, data: Dict[str... | [
"argparse.ArgumentParser",
"torch.LongTensor",
"unittest.mock.call",
"cogdl.models.emb.deepwalk.DeepWalk.build_model_from_args",
"cogdl.models.emb.deepwalk.DeepWalk.add_args",
"unittest.mock.patch.object",
"numpy.testing.assert_array_equal"
] | [((1164, 1180), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1178, 1180), False, 'from argparse import ArgumentParser\n'), ((1419, 1455), 'cogdl.models.emb.deepwalk.DeepWalk.build_model_from_args', 'DeepWalk.build_model_from_args', (['args'], {}), '(args)\n', (1449, 1455), False, 'from cogdl.models.e... |
'''
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
'''
import torch
from torch.nn import functional as F
import os
import sys
import copy
import argparse
from tqdm import tqdm
imp... | [
"torch.mul",
"torch.nn.CrossEntropyLoss",
"torch.cuda.is_available",
"torch.nn.functional.softmax",
"os.path.exists",
"argparse.ArgumentParser",
"numpy.random.seed",
"os.mkdir",
"sys.stdout.flush",
"random.shuffle",
"torch.cat",
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"torch.loa... | [((441, 513), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""BERT Frozen Probing Model for WSD"""'}), "(description='BERT Frozen Probing Model for WSD')\n", (464, 513), False, 'import argparse\n'), ((3006, 3021), 'tqdm.tqdm', 'tqdm', (['text_data'], {}), '(text_data)\n', (3010, 3021), Fa... |
'''@file alignment_decoder.py
contains the AlignmentDecoder'''
import os
import struct
import numpy as np
import tensorflow as tf
import decoder
class AlignmentDecoder(decoder.Decoder):
'''feature Decoder'''
def __call__(self, inputs, input_seq_length):
'''decode a batch of data
Args:
... | [
"numpy.log",
"os.path.join",
"struct.pack",
"tensorflow.name_scope",
"numpy.load"
] | [((2903, 2944), 'struct.pack', 'struct.pack', (['"""<xcccc"""', '"""B"""', '"""F"""', '"""M"""', '""" """'], {}), "('<xcccc', 'B', 'F', 'M', ' ')\n", (2914, 2944), False, 'import struct\n'), ((2964, 2991), 'struct.pack', 'struct.pack', (['"""<bi"""', '(4)', 'rows'], {}), "('<bi', 4, rows)\n", (2975, 2991), False, 'impo... |
import sys
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.preprocessing import LabelEncoder
def process_data_orig(test_size, n_splits, label, save_label):
'''
process_data_orig will create train, te... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.array"
] | [((1276, 1371), 'pandas.read_csv', 'pd.read_csv', (['"""/home/darmofam/morris/classifier/feature_table_all_cases_sigs.tsv"""'], {'sep': '"""\t"""'}), "('/home/darmofam/morris/classifier/feature_table_all_cases_sigs.tsv'\n , sep='\\t')\n", (1287, 1371), True, 'import pandas as pd\n'), ((1926, 1999), 'sklearn.model_se... |
# Copyright (c) <NAME>.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory.
# See https://github.com/dietmarwo/fast-cma-es/blob/master/tutorials/Scheduling.adoc for a detailed description.
import math
import pandas as pd
import numpy as np
import sys, math, time
f... | [
"numpy.amin",
"pandas.read_csv",
"numba.njit",
"time.perf_counter",
"multiprocessing.RawValue",
"fcmaes.optimizer.dtime",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"math.sqrt",
"scipy.optimize.Bounds",
"fcmaes.optimizer.logger",
"numpy.amax"
] | [((1098, 1117), 'numba.njit', 'njit', ([], {'fastmath': '(True)'}), '(fastmath=True)\n', (1102, 1117), False, 'from numba import njit, numba\n'), ((11541, 11560), 'numba.njit', 'njit', ([], {'fastmath': '(True)'}), '(fastmath=True)\n', (11545, 11560), False, 'from numba import njit, numba\n'), ((11671, 11690), 'numba.n... |
from typing import Optional
import numpy as np
import scipy.special as sp
from arch.univariate.distribution import GeneralizedError as GE
from scipy.stats import gamma
from ._base import DistributionMixin, _format_simulator
class GeneralizedError(GE, DistributionMixin):
def __init__(self, random_state=None):
... | [
"arch.univariate.distribution.GeneralizedError.__init__",
"numpy.asarray",
"scipy.special.gamma",
"scipy.stats.gamma.ppf"
] | [((367, 398), 'arch.univariate.distribution.GeneralizedError.__init__', 'GE.__init__', (['self', 'random_state'], {}), '(self, random_state)\n', (378, 398), True, 'from arch.univariate.distribution import GeneralizedError as GE\n'), ((1039, 1081), 'scipy.stats.gamma.ppf', 'gamma.ppf', (['self.custom_dist[:size]', '(1 /... |
# encording: utf-8
import os
import argparse
import pathlib
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
"""
Note that the modules (numpy, maplotlib, wave, scipy) are properly installed on your environment.
Plot wave, spectrum, save ... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"argparse.ArgumentParser",
"matplotlib.use",
"pathlib.Path",
"pathlib.Path.joinpath",
"numpy.array",
"matplotlib.pyplot.figure"
] | [((130, 151), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (144, 151), False, 'import matplotlib\n'), ((967, 1066), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This script plots graph from a csv file with 3 columns."""'}), "(description=\n 'This script plot... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"os.listdir",
"PIL.Image.open",
"os.path.join",
"numpy.array",
"os.path.isdir"
] | [((1067, 1115), 'os.path.join', 'os.path.join', (['data_path', '"""exp/train_id_demo.txt"""'], {}), "(data_path, 'exp/train_id_demo.txt')\n", (1079, 1115), False, 'import os\n'), ((2657, 2714), 'os.path.join', 'os.path.join', (['data_path', '"""demo_train_rgb_resized_img.npy"""'], {}), "(data_path, 'demo_train_rgb_resi... |
import os
import tensorflow as tf
from tensorflow.keras.datasets import mnist
from PIL import Image, ImageOps
import numpy as np
from tqdm import tqdm
import argparse
import shutil
# input path
input_path = '/home/tomohiro/code/tcav/tcav/dataset/for_tcav/-mnist-'
# define color list
color_lst = {}
color_lst['blue'] =... | [
"numpy.where",
"PIL.ImageOps.colorize",
"numpy.random.normal"
] | [((993, 1023), 'numpy.where', 'np.where', (['(rgb <= 255)', 'rgb', '(255)'], {}), '(rgb <= 255, rgb, 255)\n', (1001, 1023), True, 'import numpy as np\n'), ((1038, 1064), 'numpy.where', 'np.where', (['(rgb >= 0)', 'rgb', '(0)'], {}), '(rgb >= 0, rgb, 0)\n', (1046, 1064), True, 'import numpy as np\n'), ((1085, 1135), 'PI... |
from scvelo.plotting.docs import doc_scatter, doc_params
from scvelo.plotting.utils import *
from inspect import signature
import matplotlib.pyplot as pl
import numpy as np
import pandas as pd
@doc_params(scatter=doc_scatter)
def scatter(
adata=None,
basis=None,
x=None,
y=None,
vkey=None,
col... | [
"inspect.signature",
"numpy.argsort",
"matplotlib.pyplot.GridSpec",
"numpy.array",
"numpy.nanmin",
"scvelo.plotting.docs.doc_params",
"numpy.where",
"numpy.zeros_like",
"numpy.max",
"numpy.stack",
"numpy.random.seed",
"numpy.nanmax",
"numpy.min",
"numpy.abs",
"numpy.ones",
"numpy.any",... | [((197, 228), 'scvelo.plotting.docs.doc_params', 'doc_params', ([], {'scatter': 'doc_scatter'}), '(scatter=doc_scatter)\n', (207, 228), False, 'from scvelo.plotting.docs import doc_scatter, doc_params\n'), ((32111, 32142), 'scvelo.plotting.docs.doc_params', 'doc_params', ([], {'scatter': 'doc_scatter'}), '(scatter=doc_... |
import pandas as pd
import numpy as np
import random
myColumns = ['Eleanor','Chidi', 'Tahani', 'Jason']
myData = np.random.randint(low=0, high=101, size=(4,4))
myDataFrame = pd.DataFrame(data=myData, columns=myColumns)
print(myDataFrame)
print(myDataFrame['Eleanor'][1])
myDataFrame['Janet'] = myDataFrame['Jason'] + my... | [
"pandas.DataFrame",
"numpy.random.randint"
] | [((114, 161), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(0)', 'high': '(101)', 'size': '(4, 4)'}), '(low=0, high=101, size=(4, 4))\n', (131, 161), True, 'import numpy as np\n'), ((175, 219), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'myData', 'columns': 'myColumns'}), '(data=myData, columns=myC... |
import os
import pandas as pd
import numpy as np
import flask
import pickle
import joblib
from flask import Flask, render_template, request
import requests
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def home():
return render_template('index.html')
@app.route("/predict",methods = ["GET","POST"]... | [
"flask.render_template",
"flask.Flask",
"flask.request.form.get",
"numpy.array",
"joblib.load"
] | [((165, 180), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'from flask import Flask, render_template, request\n'), ((243, 272), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (258, 272), False, 'from flask import Flask, render_template, requ... |
import numpy as np
import math
try:
import Image
except ImportError:
from PIL import Image as Image
import sys
from scipy import interpolate
import geopy.distance
try:
from pylab import figure, cm
except ImportError:
from matplotlib.pylab import figure, cm
from matplotlib import pyplot as plt
from matplotlib.colors... | [
"matplotlib.pyplot.imshow",
"numpy.radians",
"numpy.sqrt",
"numpy.arcsin",
"math.cos",
"numpy.zeros",
"math.sin",
"scipy.interpolate.Rbf",
"matplotlib.pyplot.show"
] | [((1007, 1065), 'scipy.interpolate.Rbf', 'interpolate.Rbf', (['xs', 'ys', 'zs', 'counts'], {'function': '"""thin_plate"""'}), "(xs, ys, zs, counts, function='thin_plate')\n", (1022, 1065), False, 'from scipy import interpolate\n'), ((1077, 1097), 'numpy.zeros', 'np.zeros', (['(180, 360)'], {}), '((180, 360))\n', (1085,... |
#-*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import tensorflow as tf
import sonnet as snt
from model.DAM_test import dam
from model.DNC import dnc
from loader import BAbITestBatchGenerator, BAbIData
F... | [
"numpy.prod",
"tensorflow.shape",
"loader.BAbITestBatchGenerator",
"tensorflow.logging.set_verbosity",
"numpy.array",
"tensorflow.nn.softmax",
"model.DAM_test.dam.DAM",
"tensorflow.app.run",
"model.DNC.dnc.DNC",
"tensorflow.flags.DEFINE_string",
"numpy.mean",
"os.listdir",
"tensorflow.flags.... | [((362, 429), 'tensorflow.flags.DEFINE_integer', 'tf.flags.DEFINE_integer', (['"""embedding_size"""', '(64)', '"""Size of embedding."""'], {}), "('embedding_size', 64, 'Size of embedding.')\n", (385, 429), True, 'import tensorflow as tf\n'), ((430, 503), 'tensorflow.flags.DEFINE_integer', 'tf.flags.DEFINE_integer', (['... |
""" Defines ArrayPlotData.
"""
import six
import six.moves as sm
from numpy import array, ndarray
# Enthought library imports
from traits.api import Dict
# Local, relative imports
from .abstract_plot_data import AbstractPlotData
from .abstract_data_source import AbstractDataSource
class ArrayPlotData(AbstractPlotDa... | [
"numpy.array"
] | [((7048, 7060), 'numpy.array', 'array', (['value'], {}), '(value)\n', (7053, 7060), False, 'from numpy import array, ndarray\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"numpy.histogram",
"ctypes.POINTER",
"numpy.max",
"ctypes.cast",
"numpy.min"
] | [((1406, 1417), 'numpy.min', 'np.min', (['arr'], {}), '(arr)\n', (1412, 1417), True, 'import numpy as np\n'), ((1432, 1443), 'numpy.max', 'np.max', (['arr'], {}), '(arr)\n', (1438, 1443), True, 'import numpy as np\n'), ((1851, 1906), 'numpy.histogram', 'np.histogram', (['arr'], {'bins': 'num_bins', 'range': '(-thres, t... |
#!/usr/bin/env python3
from enum import Enum
from typing import Any, Tuple, Union
import numpy as np
import torch
from torch import Tensor
from captum.log import log_usage
from ..._utils.common import (
ExpansionTypes,
_expand_additional_forward_args,
_expand_target,
_format_additional_forward_args,
... | [
"torch.mean",
"numpy.random.choice",
"captum.log.log_usage",
"torch.tensor",
"torch.normal"
] | [((2433, 2444), 'captum.log.log_usage', 'log_usage', ([], {}), '()\n', (2442, 2444), False, 'from captum.log import log_usage\n'), ((8839, 8870), 'torch.normal', 'torch.normal', (['(0)', 'stdev_expanded'], {}), '(0, stdev_expanded)\n', (8851, 8870), False, 'import torch\n'), ((11995, 12045), 'torch.mean', 'torch.mean',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from numpy import int64
# Logger
from logging import getLogger
logger = getLogger(__name__)
# Dictionary for pol labels and their IDs in UVFITS
polid2name = {
"+1": "I",
"+2": "Q",
"+3": "U",
"+4": "V",
"-1": "RR",
"-2": "LL",
"-3": "RL",
... | [
"logging.getLogger",
"numpy.array",
"astropy.io.fits.open",
"numpy.arange",
"numpy.int64",
"numpy.isscalar",
"numpy.float64",
"netCDF4.Dataset",
"numpy.isinf",
"numpy.abs",
"numpy.ones",
"numpy.isnan",
"numpy.sign",
"zarr.open",
"numpy.finfo",
"numpy.modf",
"numpy.unique",
"os.path... | [((119, 138), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (128, 138), False, 'from logging import getLogger\n'), ((478, 488), 'numpy.int64', 'int64', (['key'], {}), '(key)\n', (483, 488), False, 'from numpy import float64, int32, int64, zeros, where, power\n'), ((6607, 6619), 'numpy.zeros', 'z... |
"""Example of Neural Network Analysis"""
# Dependencies
from sklearn.neural_network import MLPRegressor
import numpy as np
# Questionaire data (WEEK, YEARS, BOOKS, PROJECTS, EARN, RATING)
X = np.array(
[[20, 11, 20, 30, 4000, 3000],
[12, 4, 0, 0, 1000, 1500],
[2, 0, 1, 10, 0, 1400],
[35, 5, 10, 70,... | [
"numpy.array",
"sklearn.neural_network.MLPRegressor"
] | [((194, 697), 'numpy.array', 'np.array', (['[[20, 11, 20, 30, 4000, 3000], [12, 4, 0, 0, 1000, 1500], [2, 0, 1, 10, 0, \n 1400], [35, 5, 10, 70, 6000, 3800], [30, 1, 4, 65, 0, 3900], [35, 1, 0,\n 0, 0, 100], [15, 1, 2, 25, 0, 3700], [40, 3, -1, 60, 1000, 2000], [40, \n 1, 2, 95, 0, 1000], [10, 0, 0, 0, 0, 1400... |
import numpy as np
import random
class rps_game():
def __init__(self):
self.number_of_players = 2
#self.state = np.zeros(2)
self.reward = np.zeros(2)
self.done = False
def step(self, action):
#self.state = action#np.array((action[0]*action[1],action[0]*action[1]))
... | [
"numpy.array",
"numpy.zeros",
"numpy.random.randint"
] | [((166, 177), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (174, 177), True, 'import numpy as np\n'), ((895, 922), 'numpy.array', 'np.array', (['(-reward, reward)'], {}), '((-reward, reward))\n', (903, 922), True, 'import numpy as np\n'), ((1079, 1090), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (1087, 10... |
import numpy as np
from collections import defaultdict
import random
import os
'''
code book:
circle: 0
rect: 1
tri: 2
ellipse: 3
star: 4
loop: 5
red: 6
green: 7
blue: 8
yellow: 9
cyan: 10
magenta: 11
large: 12
small: 13
upper_left: 14
upper_right: 15
lower_left: 16
lower_right: 17
'''
def get_combination(samples, ... | [
"os.path.exists",
"numpy.random.random",
"numpy.random.choice",
"numpy.where",
"os.path.join",
"numpy.array",
"numpy.random.randint",
"numpy.sum",
"collections.defaultdict",
"numpy.zeros",
"numpy.concatenate",
"numpy.load",
"numpy.save"
] | [((1111, 1148), 'numpy.load', 'np.load', (['self.dataset_attributes_path'], {}), '(self.dataset_attributes_path)\n', (1118, 1148), True, 'import numpy as np\n'), ((3474, 3538), 'numpy.random.randint', 'np.random.randint', (['(0)', 'self.data_count'], {'size': 'self.num_distractors'}), '(0, self.data_count, size=self.nu... |
#
#
#
import numpy as np
# from src.utilities.plotting_cpp import Plot
#
# import numpy
import matplotlib.pyplot as plt
import scipy.interpolate as si
#
# points = [[0, 0], [0, 2], [2, 3], [4, 0], [6, 3], [8, 2], [8, 0]];
# points = np.array(points)
# x = points[:,0]
# y = points[:,1]
#
# t = range(len(points))
# ipl_t... | [
"numpy.random.normal",
"numpy.transpose",
"numpy.sqrt",
"numpy.linalg.eig",
"numpy.diag",
"numpy.sum",
"numpy.zeros",
"matplotlib.pyplot.scatter",
"numpy.random.uniform",
"numpy.load",
"matplotlib.pyplot.show"
] | [((4578, 4596), 'numpy.diag', 'np.diag', (['(7, 4, 4)'], {}), '((7, 4, 4))\n', (4585, 4596), True, 'import numpy as np\n'), ((4730, 4777), 'matplotlib.pyplot.scatter', 'plt.scatter', (['pnts[:, 0]', 'pnts[:, 1]', 'pnts[:, 2]'], {}), '(pnts[:, 0], pnts[:, 1], pnts[:, 2])\n', (4741, 4777), True, 'import matplotlib.pyplot... |
import numpy as np
import random
import path as path_lib
import sys
def mag(a):
return np.sqrt(a.dot(a))
def convert(feet):
return feet/345876.
BASE_LIFTS = 3
# Organisms will probably be treated as graphs with points representing the entry and exit points
class Resort_Map():
def __init__(self, chair_set=No... | [
"numpy.square",
"numpy.array",
"numpy.linspace",
"numpy.sum",
"numpy.all"
] | [((603, 643), 'numpy.linspace', 'np.linspace', (['chair[1, 0]', 'chair[0, 0]', '(5)'], {}), '(chair[1, 0], chair[0, 0], 5)\n', (614, 643), True, 'import numpy as np\n'), ((652, 692), 'numpy.linspace', 'np.linspace', (['chair[1, 1]', 'chair[0, 1]', '(5)'], {}), '(chair[1, 1], chair[0, 1], 5)\n', (663, 692), True, 'impor... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 9 21:12:33 2019
@author: tungo
"""
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import cv2
def process_prediction(x, dims, anchors, num_classes):
num_an... | [
"torch.sort",
"torch.unique",
"torch.sigmoid",
"torch.max",
"torch.exp",
"torch.min",
"torch.clamp",
"torch.nonzero",
"torch.cat",
"torch.clone",
"numpy.meshgrid",
"torch.FloatTensor",
"numpy.arange"
] | [((810, 835), 'torch.sigmoid', 'torch.sigmoid', (['x[:, :, 0]'], {}), '(x[:, :, 0])\n', (823, 835), False, 'import torch\n'), ((849, 874), 'torch.sigmoid', 'torch.sigmoid', (['x[:, :, 1]'], {}), '(x[:, :, 1])\n', (862, 874), False, 'import torch\n'), ((888, 913), 'torch.sigmoid', 'torch.sigmoid', (['x[:, :, 4]'], {}), ... |
import errno
import os
import numpy as np
from numpy.testing import assert_equal
import pytest
import nengo
from nengo.cache import (
DecoderCache, Fingerprint, get_fragment_size, NoDecoderCache)
from nengo.utils.compat import int_types
from nengo.utils.testing import Timer
class SolverMock(object):
n_calls... | [
"numpy.testing.assert_equal",
"numpy.random.rand",
"numpy.array",
"numpy.random.RandomState",
"nengo.cache.get_fragment_size",
"nengo.cache.Fingerprint",
"os.listdir",
"nengo.Ensemble",
"nengo.cache.DecoderCache",
"numpy.eye",
"numpy.ones",
"numpy.any",
"nengo.utils.testing.Timer",
"pytest... | [((1299, 1332), 'nengo.cache.DecoderCache', 'DecoderCache', ([], {'cache_dir': 'cache_dir'}), '(cache_dir=cache_dir)\n', (1311, 1332), False, 'from nengo.cache import DecoderCache, Fingerprint, get_fragment_size, NoDecoderCache\n'), ((1683, 1717), 'numpy.testing.assert_equal', 'assert_equal', (['decoders1', 'decoders2'... |
from dataclasses import dataclass, replace
from typing import Type
import numpy as np
from numpy import ndarray
from ..element import Element, ElementLineP1
from .mesh import Mesh
from .mesh_quad_1 import MeshQuad1
from .mesh_simplex import MeshSimplex
@dataclass(repr=False)
class MeshLine1(MeshSimplex, Mesh):
... | [
"numpy.abs",
"numpy.digitize",
"dataclasses.dataclass",
"numpy.argmax",
"numpy.max",
"numpy.argsort",
"numpy.array",
"numpy.empty",
"numpy.vstack",
"dataclasses.replace",
"numpy.arange"
] | [((258, 279), 'dataclasses.dataclass', 'dataclass', ([], {'repr': '(False)'}), '(repr=False)\n', (267, 279), False, 'from dataclasses import dataclass, replace\n'), ((374, 414), 'numpy.array', 'np.array', (['[[0.0, 1.0]]'], {'dtype': 'np.float64'}), '([[0.0, 1.0]], dtype=np.float64)\n', (382, 414), True, 'import numpy ... |
from __future__ import print_function
from scipy.interpolate import interp1d
import numpy as np
import math
from aeropy.airfoil_module import CST
def taper_function(eta, shape = 'linear', points = {'eta':[0,1], 'chord':[1,.7]}):
"""Calculate chord along span of the wing.
- If linear, taper function... | [
"aeropy.airfoil_module.CST",
"math.factorial",
"scipy.interpolate.interp1d",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.show"
] | [((645, 685), 'scipy.interpolate.interp1d', 'interp1d', (["points['eta']", "points['chord']"], {}), "(points['eta'], points['chord'])\n", (653, 685), False, 'from scipy.interpolate import interp1d\n'), ((1211, 1257), 'scipy.interpolate.interp1d', 'interp1d', (["points['eta']", "points['delta_twist']"], {}), "(points['e... |
# Copyright 2021 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distri... | [
"pandas.read_pickle",
"numpy.abs",
"numpy.ceil",
"matplotlib.pyplot.savefig",
"numpy.array",
"numpy.min",
"pandas.DataFrame",
"matplotlib.pyplot.subplots",
"numpy.round",
"matplotlib.pyplot.show"
] | [((1114, 1166), 'pandas.read_pickle', 'pd.read_pickle', (['"""../sowfa_data_set/sowfa_data_set.p"""'], {}), "('../sowfa_data_set/sowfa_data_set.p')\n", (1128, 1166), True, 'import pandas as pd\n'), ((2576, 2598), 'numpy.min', 'np.min', (['[4, num_cases]'], {}), '([4, num_cases])\n', (2582, 2598), True, 'import numpy as... |
from typing import Optional, Tuple, Union
import numpy as np
from numpy import array
import gdsfactory as gf
from gdsfactory.components.text import text
from gdsfactory.types import Anchor, Layer
Coordinate = Union[Tuple[float, float], array]
@gf.cell_without_validator
def die_bbox_frame(
bbox: Tuple[Coordinat... | [
"gdsfactory.components.text.text",
"gdsfactory.Component",
"numpy.array",
"gdsfactory.components.array"
] | [((1230, 1244), 'gdsfactory.Component', 'gf.Component', ([], {}), '()\n', (1242, 1244), True, 'import gdsfactory as gf\n'), ((1525, 1625), 'numpy.array', 'np.array', (['[sx, sx, sx - street_width, sx - street_width, sx - street_length, sx -\n street_length]'], {}), '([sx, sx, sx - street_width, sx - street_width, sx... |
import tensorflow as tf
import numpy as np
import random
import matplotlib.pyplot as plt
from zipfile import ZipFile
random.seed(1337)
np.random.seed(1337)
tf.random.set_seed(1337)
with ZipFile("archive.zip","r") as zip:
zip.extractall()
BATCH_SIZE = 32
IMG_SIZE = (160,160)
train_ds = tf.keras.preprocessing.image... | [
"tensorflow.data.experimental.cardinality",
"zipfile.ZipFile",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"tensorflow.keras.layers.GlobalAveragePooling2D",
"tensorflow.keras.preprocessing.image_dataset_from_directory",
"numpy.random.seed",
"matplotlib.pyplot.axis",
"tenso... | [((118, 135), 'random.seed', 'random.seed', (['(1337)'], {}), '(1337)\n', (129, 135), False, 'import random\n'), ((136, 156), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (150, 156), True, 'import numpy as np\n'), ((157, 181), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(1337)'], {}),... |
"""
Classes to play sounds and tones on pygame
class SoundPlayer : manage a FIFO queue to play sounds from ogg files in a dedicated channel.
- load(name, filename): method that loads an ogg file 'filename' and associates the name 'name' to that sound
- play(name=... | [
"logging.getLogger",
"logging.StreamHandler",
"pygame.mixer.Channel",
"logging.Formatter",
"pygame.mixer.Sound",
"time.sleep",
"pygame.sndarray.make_sound",
"numpy.sin",
"pygame.mixer.init",
"random.randint"
] | [((663, 695), 'logging.getLogger', 'logging.getLogger', (['"""PygameAudio"""'], {}), "('PygameAudio')\n", (680, 695), False, 'import logging\n'), ((1430, 1468), 'pygame.mixer.Channel', 'pygame.mixer.Channel', (['self._channel_id'], {}), '(self._channel_id)\n', (1450, 1468), False, 'import pygame\n'), ((1776, 1804), 'py... |
# -*- coding: utf-8 -*-
# Copyright (C) 2012, <NAME>
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
import numpy as np
from visvis.wobjects.polygonalModeling import BaseMesh
def combineMeshes(meshes):
""" combineMeshes(meshes)
Given a... | [
"visvis.wobjects.polygonalModeling.BaseMesh",
"numpy.concatenate"
] | [((1288, 1333), 'numpy.concatenate', 'np.concatenate', (['[m._vertices for m in meshes]'], {}), '([m._vertices for m in meshes])\n', (1302, 1333), True, 'import numpy as np\n'), ((1914, 1961), 'visvis.wobjects.polygonalModeling.BaseMesh', 'BaseMesh', (['vertices', 'faces', 'normals', 'values', 'vpf'], {}), '(vertices, ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
from ftl.experiment import run_exp
import argparse
import os
import numpy as np
import json
from numpyencoder import NumpyEncoder
import pickle
def _parse_args():
parser = argparse.ArgumentParser(description='driver.py')
# Client Opt Par... | [
"os.path.exists",
"pickle.dump",
"os.makedirs",
"argparse.ArgumentParser",
"json.dumps",
"ftl.experiment.run_exp",
"numpy.arange"
] | [((250, 298), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""driver.py"""'}), "(description='driver.py')\n", (273, 298), False, 'import argparse\n'), ((1574, 1605), 'numpy.arange', 'np.arange', (['(1)', '(args.n_repeat + 1)'], {}), '(1, args.n_repeat + 1)\n', (1583, 1605), True, 'import ... |
# ===============================================================================
# Copyright 2014 <NAME>
#
# 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/... | [
"numpy.abs",
"scipy.stats.norm",
"numpy.column_stack",
"numpy.zeros",
"numpy.random.seed",
"numpy.percentile"
] | [((1559, 1565), 'scipy.stats.norm', 'norm', ([], {}), '()\n', (1563, 1565), False, 'from scipy.stats import norm\n'), ((1648, 1670), 'numpy.zeros', 'zeros', (['(ntrials, npts)'], {}), '((ntrials, npts))\n', (1653, 1670), False, 'from numpy import zeros, percentile, array, random, abs as nabs, column_stack\n'), ((1404, ... |
import numpy as np
import h5py
import pybel
import tfbio.net
import tfbio.data
from skimage.segmentation import clear_border
from skimage.measure import label
from skimage.morphology import closing
from keras.layers import Input, Convolution3D, MaxPooling3D, UpSampling3D, concatenate
from keras.models import Model
... | [
"keras.backend.sum",
"keras.backend.flatten",
"numpy.array",
"keras.layers.UpSampling3D",
"numpy.where",
"keras.backend.max",
"numpy.concatenate",
"skimage.measure.label",
"keras.backend.concatenate",
"skimage.segmentation.clear_border",
"h5py.File",
"keras.regularizers.l2",
"keras.layers.Co... | [((715, 732), 'keras.backend.flatten', 'K.flatten', (['y_true'], {}), '(y_true)\n', (724, 732), True, 'from keras import backend as K\n'), ((748, 765), 'keras.backend.flatten', 'K.flatten', (['y_pred'], {}), '(y_pred)\n', (757, 765), True, 'from keras import backend as K\n'), ((785, 811), 'keras.backend.sum', 'K.sum', ... |
"""The implementation of classifier wrappers
"""
# Author: <NAME> <<EMAIL>>
from sklearn.model_selection import KFold
from sklearn.preprocessing import OneHotEncoder, LabelEncoder
import numpy as np
from model_wrapper import ModelWrapper
from pred_results import BinaryPredResults
class KfoldBinaryClassifierWrapper(... | [
"sklearn.preprocessing.LabelEncoder",
"sklearn.preprocessing.OneHotEncoder",
"numpy.vstack",
"sklearn.model_selection.KFold",
"model_wrapper.ModelWrapper.__init__"
] | [((697, 794), 'model_wrapper.ModelWrapper.__init__', 'ModelWrapper.__init__', (['self', 'data_frame', 'label_name', 'feature_names', 'categorical_feature_names'], {}), '(self, data_frame, label_name, feature_names,\n categorical_feature_names)\n', (718, 794), False, 'from model_wrapper import ModelWrapper\n'), ((105... |
from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm
from pandas.core.indexes.timedeltas import timedelta_range
def test_asfreq_bug():
df = DataFrame(data=[1, 3], index=[timedelta(), time... | [
"pandas.Series",
"numpy.random.normal",
"pandas.to_timedelta",
"pandas._testing.assert_series_equal",
"pandas.core.indexes.timedeltas.timedelta_range",
"pandas.Timedelta",
"datetime.timedelta",
"pandas._testing.assert_index_equal",
"pytest.mark.parametrize",
"numpy.isnan",
"pandas.date_range",
... | [((4289, 4586), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""start, end, freq, resample_freq"""', "[('8H', '21h59min50s', '10S', '3H'), ('3H', '22H', '1H', '5H'), ('527D',\n '5006D', '3D', '10D'), ('1D', '10D', '1D', '2D'), ('8H', '21h59min50s',\n '10S', '2H'), ('0H', '21h59min50s', '10S', '3H'), (... |
"""
This class contains the code to encode/decode data using BB-ANS with a VAE
"""
from ans import ANSCoder
import numpy as np
import distributions
def BBANS_append(posterior_pop, likelihood_append, prior_append):
"""
Given functions to pop a posterior, append a likelihood and append the prior,
return a f... | [
"numpy.prod",
"distributions.gaussian_latent_ppf",
"numpy.atleast_2d",
"numpy.reshape",
"distributions.uniforms_append",
"distributions.standard_gaussian_centers",
"distributions.distr_pop",
"numpy.ravel",
"distributions.distr_append",
"distributions.gaussian_latent_cdf"
] | [((2296, 2342), 'distributions.uniforms_append', 'distributions.uniforms_append', (['prior_precision'], {}), '(prior_precision)\n', (2325, 2342), False, 'import distributions\n'), ((1385, 1409), 'numpy.ravel', 'np.ravel', (['posterior_mean'], {}), '(posterior_mean)\n', (1393, 1409), True, 'import numpy as np\n'), ((143... |
# Copyright (c) 2021 PaddlePaddle 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 appli... | [
"numpy.load",
"milvus_util.VecToMilvus",
"numpy.arange"
] | [((753, 771), 'numpy.load', 'np.load', (['file_path'], {}), '(file_path)\n', (760, 771), True, 'import numpy as np\n'), ((903, 916), 'milvus_util.VecToMilvus', 'VecToMilvus', ([], {}), '()\n', (914, 916), False, 'from milvus_util import VecToMilvus\n'), ((1228, 1249), 'numpy.arange', 'np.arange', (['i', 'cur_end'], {})... |
"""
=======================================
Receiver Operating Characteristic Curve
=======================================
Example of plotting the ROC curve for a classification task.
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import load_breast_cancer
from sklearn... | [
"sklearn.datasets.load_breast_cancer",
"sklearn.metrics.roc_auc_score",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"sklearn.metrics.roc_curve",
"matplotlib.rc",
"matplotlib.pyplot.subplots"
] | [((454, 495), 'matplotlib.rc', 'matplotlib.rc', (['"""xtick"""'], {'labelsize': '"""small"""'}), "('xtick', labelsize='small')\n", (467, 495), False, 'import matplotlib\n'), ((496, 537), 'matplotlib.rc', 'matplotlib.rc', (['"""ytick"""'], {'labelsize': '"""small"""'}), "('ytick', labelsize='small')\n", (509, 537), Fals... |
'''
This is the net model of Environmental features recognition for lower limb prostheses toward predictive walking.
If you think this code is useful, please cite:
[1] <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>,
“Environmental features recognition for lower limb prostheses toward predictive walking,”
... | [
"keras.layers.Conv2D",
"zipfile.ZipFile",
"keras.utils.to_categorical",
"keras.layers.Dense",
"tensorflow.profiler.ProfileOptionBuilder.trainable_variables_parameter",
"keras.backend.image_data_format",
"numpy.reshape",
"glob.glob",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"keras.layers.... | [((3292, 3304), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (3302, 3304), False, 'from keras.models import Sequential\n'), ((4009, 4105), 'keras.callbacks.ModelCheckpoint', 'ModelCheckpoint', (['model_path'], {'verbose': '(1)', 'monitor': '"""val_acc"""', 'save_best_only': '(True)', 'mode': '"""auto"""'}... |
import sys
import h5py
import torch
from torch import nn
from torch import cuda
import string
import re
from collections import Counter
import numpy as np
def to_device(x, gpuid):
if gpuid == -1:
return x.cpu()
if x.device != gpuid:
return x.cuda(gpuid)
return x
def has_nan(t):
return torch.isnan(t).sum() == ... | [
"torch.nn.LSTM",
"numpy.argmax",
"h5py.File",
"torch.isnan",
"torch.rand",
"torch.nn.GRU"
] | [((434, 457), 'numpy.argmax', 'np.argmax', (['dist'], {'axis': '(1)'}), '(dist, axis=1)\n', (443, 457), True, 'import numpy as np\n'), ((678, 698), 'h5py.File', 'h5py.File', (['path', '"""r"""'], {}), "(path, 'r')\n", (687, 698), False, 'import h5py\n'), ((758, 778), 'h5py.File', 'h5py.File', (['path', '"""w"""'], {}),... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.grid",
"numpy.squeeze",
"numpy.array",
"tensorflow_graphics.notebooks.mesh_viewer.Viewer",
"numpy.concatenate",
"matplotlib.pyplot.axis"
] | [((1425, 1449), 'tensorflow_graphics.notebooks.mesh_viewer.Viewer', 'threejs_viz.Viewer', (['mesh'], {}), '(mesh)\n', (1443, 1449), True, 'from tensorflow_graphics.notebooks import mesh_viewer as threejs_viz\n'), ((1511, 1525), 'numpy.squeeze', 'np.squeeze', (['im'], {}), '(im)\n', (1521, 1525), True, 'import numpy as ... |
import numpy as np
import pyximport
pyximport.install()
from .cython_nms.cpu_nms import greedy_nms, soft_nms
def cython_soft_nms_wrapper(thresh, sigma=0.5, score_thresh=0.001, method='linear'):
methods = {'hard': 0, 'linear': 1, 'gaussian': 2}
assert method in methods, 'Unknown soft_nms method: {}'.format(met... | [
"numpy.uint8",
"numpy.minimum",
"numpy.where",
"numpy.ascontiguousarray",
"numpy.array",
"pyximport.install",
"numpy.sum",
"numpy.maximum",
"numpy.float32"
] | [((36, 55), 'pyximport.install', 'pyximport.install', ([], {}), '()\n', (53, 55), False, 'import pyximport\n'), ((3521, 3535), 'numpy.array', 'np.array', (['keep'], {}), '(keep)\n', (3529, 3535), True, 'import numpy as np\n'), ((1550, 1582), 'numpy.maximum', 'np.maximum', (['x1[i]', 'x1[order[1:]]'], {}), '(x1[i], x1[o... |
#!/usr/bin/env python
import numpy as np
import time
if "flush" in dir(np):
np.flush()
begin = time.time()
#a = np.sum(((np.ones(100)+1.0)*2.0)/2.0)
a = np.sum(np.random.random(50000000))
#a = np.multiply.accumulate(np.ones((8,8), dtype=np.float32))
print(a)
if "flush" in dir(np):
np.flush()
end = time.time... | [
"numpy.random.random",
"numpy.flush",
"time.time"
] | [((100, 111), 'time.time', 'time.time', ([], {}), '()\n', (109, 111), False, 'import time\n'), ((81, 91), 'numpy.flush', 'np.flush', ([], {}), '()\n', (89, 91), True, 'import numpy as np\n'), ((166, 192), 'numpy.random.random', 'np.random.random', (['(50000000)'], {}), '(50000000)\n', (182, 192), True, 'import numpy as... |
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(ROOT_DIR)
import numpy as np
from embedding_net.models import EmbeddingNet, TripletNet, SiameseNet
from tensorflow.keras.callbacks import TensorBoard, LearningRateScheduler
from tensorflow.k... | [
"embedding_net.models.TripletNet",
"embedding_net.backbones.pretrain_backbone_softmax",
"wandb.init",
"tensorflow.keras.callbacks.EarlyStopping",
"sys.path.append",
"argparse.ArgumentParser",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"embedding_net.losses_and_accuracies.triplet_loss",
"wandb.k... | [((87, 112), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (102, 112), False, 'import os\n'), ((113, 138), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (128, 138), False, 'import sys\n'), ((49, 74), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__fi... |
"""
Load datasets
"""
import PIL.Image
import glob
import numpy as np
import pandas as pd
import os.path
import torch.utils.data as TD
from sklearn.model_selection import train_test_split
class GlobImageDir(TD.Dataset):
"""Load a dataset of files using a glob expression and Python Pillow
library (PIL), and ru... | [
"numpy.array",
"pandas.read_csv",
"glob.glob",
"numpy.arange"
] | [((654, 690), 'glob.glob', 'glob.glob', (['glob_expr'], {'recursive': '(True)'}), '(glob_expr, recursive=True)\n', (663, 690), False, 'import glob\n'), ((3204, 3216), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (3213, 3216), True, 'import numpy as np\n'), ((4361, 4381), 'numpy.array', 'np.array', (["z['image']"]... |
import time
import numpy as np
import image_data_pipeline
import ni
##import thorlabs
from pco import pco_edge_camera_child_process
import pickle
def main():
# This incantation is forced on us so the IDP won't print everything twice:
import logging
import multiprocessing as mp
logger = ... | [
"numpy.tile",
"multiprocessing.log_to_stderr",
"numpy.ceil",
"pickle.dump",
"numpy.array",
"numpy.zeros",
"image_data_pipeline.Image_Data_Pipeline",
"ni.PCI_6733"
] | [((320, 338), 'multiprocessing.log_to_stderr', 'mp.log_to_stderr', ([], {}), '()\n', (336, 338), True, 'import multiprocessing as mp\n'), ((2014, 2034), 'numpy.array', 'np.array', (['[-2, 0, 2]'], {}), '([-2, 0, 2])\n', (2022, 2034), True, 'import numpy as np\n'), ((3690, 3889), 'image_data_pipeline.Image_Data_Pipeline... |
import torch
from torchvision import transforms
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from utils.utils import *
import json
import cv2
import copy
import numpy as np
import os
from tool.darknet2pytorch import *
from tqdm import tqdm
from skimage import measure
from argparse import ArgumentPa... | [
"numpy.clip",
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"numpy.asarray",
"torch.sign",
"numpy.array",
"torch.norm",
"numpy.zeros",
"numpy.stack",
"cv2.cvtColor",
"copy.deepcopy",
"torchvision.transforms.Resize",
"cv2.resize",
"cv2.imread"
] | [((6118, 6140), 'copy.deepcopy', 'copy.deepcopy', (['img_PIL'], {}), '(img_PIL)\n', (6131, 6140), False, 'import copy\n'), ((7085, 7101), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (7099, 7101), False, 'from argparse import ArgumentParser\n'), ((1731, 1759), 'os.path.join', 'os.path.join', (['root_p... |
# *******************************************************************************
# Copyright 2014-2020 Intel Corporation
# All Rights Reserved.
#
# This software is licensed under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the L... | [
"sklearn.utils.validation.check_is_fitted",
"numpy.copy",
"sklearn.utils.validation.check_array",
"sklearn.utils.multiclass.check_classification_targets",
"numpy.reshape",
"numpy.unique",
"numpy.asarray",
"scipy.sparse.issparse",
"sklearn.utils.validation.check_consistent_length",
"numpy.zeros",
... | [((4984, 5045), 'sklearn.utils.validation.check_is_fitted', 'check_is_fitted', (['self', "['daal_model_', '_cached_tree_state_']"], {}), "(self, ['daal_model_', '_cached_tree_state_'])\n", (4999, 5045), False, 'from sklearn.utils.validation import check_X_y, check_array, check_is_fitted, check_consistent_length\n'), ((... |
# Generate static graphs
import os
import sys
import json
import csv
import plotly.graph_objects as go
import plotly.express as px
import numpy as np
from plotly.subplots import make_subplots
from datetime import *
from utils import *
# Generate a graph (cases) for Maryland Zip Code
# Here we pass all the data
def... | [
"plotly.graph_objects.Bar",
"numpy.mean",
"csv.DictReader",
"plotly.subplots.make_subplots",
"numpy.max",
"plotly.graph_objects.Figure",
"plotly.graph_objects.Scatter",
"json.load"
] | [((3526, 3550), 'json.load', 'json.load', (['cur_json_file'], {}), '(cur_json_file)\n', (3535, 3550), False, 'import json\n'), ((4274, 4320), 'plotly.subplots.make_subplots', 'make_subplots', ([], {'specs': "[[{'secondary_y': True}]]"}), "(specs=[[{'secondary_y': True}]])\n", (4287, 4320), False, 'from plotly.subplots ... |
import requests
import numpy as np
import pandas as pd
from src.scraping.InCroatia import *
# df = pd.DataFrame(columns=['latitude', 'longitude'])
# df.to_csv('../../data/external/valid_lat_long.csv', index=False)
GOOGLE_API_KEY = ""
SAVE_PATH = '../../data/external/valid_lat_long.csv'
df = pd.read_csv(SAVE_PATH)
d... | [
"requests.get",
"pandas.read_csv",
"numpy.random.uniform"
] | [((296, 318), 'pandas.read_csv', 'pd.read_csv', (['SAVE_PATH'], {}), '(SAVE_PATH)\n', (307, 318), True, 'import pandas as pd\n'), ((636, 687), 'numpy.random.uniform', 'np.random.uniform', (['bounding_box[1]', 'bounding_box[3]'], {}), '(bounding_box[1], bounding_box[3])\n', (653, 687), True, 'import numpy as np\n'), ((7... |
''' Functions relating to HDR mode '''
import numpy as np
import astropy.units as u
import astropy.constants as cr
from astropy.modeling.blackbody import FLAM
from astropy.convolution import convolve_fft, Gaussian2DKernel
# Set telescope details
epd = 75 * u.cm
area = np.pi * (0.5*epd)**2
reflectivity = 0.9
mirrors = ... | [
"numpy.random.normal",
"numpy.sqrt",
"numpy.ones",
"numpy.random.poisson",
"numpy.floor",
"astropy.units.spectral_density",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"astropy.convolution.convolve_fft",
"astropy.convolution.Gaussian2DKernel",
"numpy.arange"
] | [((5544, 5562), 'numpy.array', 'np.array', (['snr_list'], {}), '(snr_list)\n', (5552, 5562), True, 'import numpy as np\n'), ((6270, 6292), 'numpy.argsort', 'np.argsort', (['(-exp_times)'], {}), '(-exp_times)\n', (6280, 6292), True, 'import numpy as np\n'), ((6309, 6334), 'numpy.zeros', 'np.zeros', (['pixels.shape[1]'],... |
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.preprocessing import image
from tensorflow.keras.optimizers import RMSprop
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import cv2
import os
def covidTest(filePath):
train = ImageDataGenerator(r... | [
"matplotlib.pyplot.ylabel",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"tensorflow.keras.layers.Dense",
"matplotlib.pyplot.imshow",
"os.listdir",
"tensorflow.keras.layers.Conv2D",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.vstack",
"tensorflow.keras.preprocessing.... | [((300, 335), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1 / 255)'}), '(rescale=1 / 255)\n', (318, 335), False, 'from tensorflow.keras.preprocessing.image import ImageDataGenerator\n'), ((352, 387), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'Imag... |
#!/bin/python3
import sys
from collections import defaultdict
from skimage import io, util
import numpy as np
import math
import random
def distance(pixel1, pixel2):
return math.sqrt((float(pixel1[0]) - float(pixel2[0]))**2 +
(float(pixel1[1]) - float(pixel2[1]))**2 +
(f... | [
"random.seed",
"numpy.array",
"skimage.io.imread",
"collections.defaultdict",
"skimage.io.imsave",
"sys.exit",
"random.random"
] | [((547, 562), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (555, 562), True, 'import numpy as np\n'), ((585, 602), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (596, 602), False, 'from collections import defaultdict\n'), ((1654, 1667), 'random.seed', 'random.seed', ([], {}), '()\n',... |
from __future__ import print_function
import numpy as np
import itertools
from numpy.testing import (assert_equal,
assert_almost_equal,
assert_array_equal,
assert_array_almost_equal,
suppress_warnings)
import pyt... | [
"numpy.clip",
"numpy.testing.suppress_warnings",
"numpy.sqrt",
"numpy.testing.assert_equal",
"scipy.spatial._spherical_voronoi.SphericalVoronoi",
"numpy.array",
"numpy.einsum",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.sin",
"numpy.random.RandomState",
"numpy.testing.assert_array_almost_equ... | [((7800, 7841), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n"""', '[8, 15, 21]'], {}), "('n', [8, 15, 21])\n", (7823, 7841), False, 'import pytest\n'), ((7847, 7893), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""radius"""', '[0.5, 1, 2]'], {}), "('radius', [0.5, 1, 2])\n", (7870, 7893), ... |
"""Calculate elasticity coefficients.
Functions to calculate elasticity coefficients for various community
quantities.
"""
from functools import partial
import pandas as pd
import numpy as np
from cobra.util import get_context
from micom.util import reset_min_community_growth
from micom.problems import regularize_l2_... | [
"pandas.Series",
"cobra.util.get_context",
"micom.problems.regularize_l2_norm",
"numpy.abs",
"numpy.exp",
"functools.partial",
"numpy.sign",
"micom.solution.optimize_with_fraction",
"pandas.concat",
"rich.progress.track"
] | [((620, 637), 'pandas.Series', 'pd.Series', (['fluxes'], {}), '(fluxes)\n', (629, 637), True, 'import pandas as pd\n'), ((735, 750), 'numpy.sign', 'np.sign', (['before'], {}), '(before)\n', (742, 750), True, 'import numpy as np\n'), ((769, 783), 'numpy.sign', 'np.sign', (['after'], {}), '(after)\n', (776, 783), True, '... |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'dtype': numpy.float16},
{'dtype': numpy.float32},
{'dtype': numpy.float64},... | [
"chainer.testing.parameterize",
"chainer.Variable",
"chainer.testing.run_module",
"numpy.exp",
"chainer.functions.logsumexp",
"numpy.random.uniform",
"chainer.testing.assert_allclose",
"chainer.backends.cuda.to_gpu"
] | [((209, 312), 'chainer.testing.parameterize', 'testing.parameterize', (["{'dtype': numpy.float16}", "{'dtype': numpy.float32}", "{'dtype': numpy.float64}"], {}), "({'dtype': numpy.float16}, {'dtype': numpy.float32}, {\n 'dtype': numpy.float64})\n", (229, 312), False, 'from chainer import testing\n'), ((9794, 9832), ... |
"""
Copyright (c) 2020 CRISP
The abstract parent class for Convolutional Sparse Coder
:author: <NAME>
"""
from abc import ABCMeta, abstractmethod
import numpy as np
import sys
import os
PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..")
sys.path.append(PATH)
from src.help... | [
"dask.delayed",
"src.helpers.convolution.code_sparse",
"dask.compute",
"numpy.zeros",
"numpy.linalg.norm",
"os.path.abspath",
"numpy.shape",
"sys.path.append",
"numpy.arange"
] | [((282, 303), 'sys.path.append', 'sys.path.append', (['PATH'], {}), '(PATH)\n', (297, 303), False, 'import sys\n'), ((241, 266), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (256, 266), False, 'import os\n'), ((1050, 1064), 'numpy.zeros', 'np.zeros', (['clen'], {}), '(clen)\n', (1058, 1064)... |
# Copyright (C) 2019-2022, <NAME>.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
"""
Transformation for semantic segmentation
"""
import random
import numpy as np
import torch
from torchvision.transfo... | [
"torchvision.transforms.functional.hflip",
"torchvision.transforms.functional.crop",
"torchvision.transforms.transforms.RandomCrop.get_params",
"torchvision.transforms.functional.pad",
"numpy.array",
"torchvision.transforms.functional.resize",
"random.random",
"random.randint"
] | [((670, 711), 'torchvision.transforms.functional.pad', 'F.pad', (['img', '(0, 0, padw, padh)'], {'fill': 'fill'}), '(img, (0, 0, padw, padh), fill=fill)\n', (675, 711), True, 'from torchvision.transforms import functional as F\n'), ((1239, 1306), 'torchvision.transforms.functional.resize', 'F.resize', (['image', 'self.... |
import pandas as pd, numpy as np, tensorflow as tf, re, time, sys, contractions, _pickle as pickle, os, nltk, random, string, warnings, os, sys
from numpy import newaxis
from tensorflow.python.ops.rnn_cell_impl import _zero_state_tensors
from nltk.stem.wordnet import WordNetLemmatizer
from tensorflow.python.layers.core... | [
"_pickle.dump",
"numpy.array",
"tensorflow.contrib.rnn.LSTMCell",
"numpy.arange",
"tensorflow.nn.embedding_lookup",
"nltk.translate.bleu_score.SmoothingFunction",
"numpy.mean",
"nltk.corpus.stopwords.words",
"tensorflow.placeholder",
"tensorflow.concat",
"pandas.DataFrame",
"tensorflow.ConfigP... | [((822, 855), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (845, 855), False, 'import pandas as pd, numpy as np, tensorflow as tf, re, time, sys, contractions, _pickle as pickle, os, nltk, random, string, warnings, os, sys\n'), ((2734, 2753), 'nltk.stem.wordnet.WordNetLe... |
from reactopya import Component
import numpy as np
class InteractivePlotly(Component):
def __init__(self):
super().__init__()
def javascript_state_changed(self, prev_state, state):
noise_level = state.get('noise_level', 0)
num_points = state.get('num_points', 10)
times0 = np.li... | [
"numpy.random.normal",
"numpy.linspace"
] | [((315, 346), 'numpy.linspace', 'np.linspace', (['(0)', '(100)', 'num_points'], {}), '(0, 100, num_points)\n', (326, 346), True, 'import numpy as np\n'), ((378, 414), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', 'times0.shape'], {}), '(0, 1, times0.shape)\n', (394, 414), True, 'import numpy as np\n')] |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | [
"numpy.array",
"gym.spaces.Dict"
] | [((3727, 3754), 'gym.spaces.Dict', 'spaces.Dict', (['gym_space_dict'], {}), '(gym_space_dict)\n', (3738, 3754), False, 'from gym import spaces\n'), ((2764, 2785), 'numpy.array', 'np.array', (['lower_bound'], {}), '(lower_bound)\n', (2772, 2785), True, 'import numpy as np\n'), ((2820, 2841), 'numpy.array', 'np.array', (... |
import asyncio
import numpy as np
import json
import logging
import datetime
import math
from fifo import Fifo
from run_task import run_task
import location_mapper
ACCEL_FIFO_CAPACITY = 6000 # number of samples in Acceleration Data Fifo ~1 minute
ACCEL_NOMINAL_SAMPLE_PERIOD = 0.01 # sample rate we except the sample... | [
"logging.getLogger",
"json.loads",
"fifo.Fifo",
"asyncio.Queue",
"numpy.diff",
"location_mapper.find_last_unused_location_entry",
"location_mapper.map_timestamp_to_location",
"datetime.datetime.now",
"run_task.run_task",
"numpy.array",
"numpy.ndarray",
"asyncio.sleep"
] | [((586, 613), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (603, 613), False, 'import logging\n'), ((917, 947), 'fifo.Fifo', 'Fifo', (['(ACCEL_FIFO_CAPACITY, 2)'], {}), '((ACCEL_FIFO_CAPACITY, 2))\n', (921, 947), False, 'from fifo import Fifo\n'), ((972, 987), 'asyncio.Queue', 'asyncio.... |
import tvm
import numpy as np
dtype = "float32"
A = tvm.te.placeholder([4, 4], dtype=dtype, name="A")
B = tvm.te.compute([4, 4], lambda i, j: A[i, j] + 1, name="B")
C = tvm.te.compute([4, 4], lambda i, j: A[i, j] * 2, name="C")
target = "llvm"
s1 = tvm.te.create_schedule(B.op)
s2 = tvm.te.create_schedule(C.op)
... | [
"tvm.nd.array",
"tvm.te.create_schedule",
"tvm.te.placeholder",
"tvm.build",
"tvm.context",
"numpy.zeros",
"tvm.te.compute",
"numpy.random.uniform"
] | [((55, 104), 'tvm.te.placeholder', 'tvm.te.placeholder', (['[4, 4]'], {'dtype': 'dtype', 'name': '"""A"""'}), "([4, 4], dtype=dtype, name='A')\n", (73, 104), False, 'import tvm\n'), ((110, 168), 'tvm.te.compute', 'tvm.te.compute', (['[4, 4]', '(lambda i, j: A[i, j] + 1)'], {'name': '"""B"""'}), "([4, 4], lambda i, j: A... |
import resnet2 as net
import numpy as np
import cv2
import scipy.io as sio
import os
from os import listdir
import random
def Average(inp):
a = inp/np.linalg.norm(inp, axis=1, keepdims=True)
a = np.sum(a, axis=0)
a = a/np.linalg.norm(a)
return a
path = r'O:\[FY2017]\MS-Challenges\code\evaluation_a... | [
"cv2.warpAffine",
"scipy.io.savemat",
"random.randint",
"cv2.flip",
"numpy.sum",
"numpy.array",
"resnet2.eval",
"numpy.linalg.norm",
"cv2.resize",
"cv2.imread",
"numpy.float32"
] | [((1570, 1622), 'scipy.io.savemat', 'sio.savemat', (['save_path', "{'data': res, 'label': labs}"], {}), "(save_path, {'data': res, 'label': labs})\n", (1581, 1622), True, 'import scipy.io as sio\n'), ((210, 227), 'numpy.sum', 'np.sum', (['a'], {'axis': '(0)'}), '(a, axis=0)\n', (216, 227), True, 'import numpy as np\n')... |
# %%
# Third party libraries
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
# Import local module
from multyscale import utils, filterbank
# %% Load example stimulus
stimulus = np.asarray(Image.open("example_stimulus.png").convert("L"))
# %% Parameters of image
shape = stimulus.shape # fil... | [
"matplotlib.pyplot.imshow",
"PIL.Image.open",
"multyscale.filterbank.ODOGBank",
"multyscale.utils.octave_intervals",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.pyplot.subplot",
"numpy.arange"
] | [((460, 509), 'numpy.linspace', 'np.linspace', (['visextent[0]', 'visextent[1]', 'shape[0]'], {}), '(visextent[0], visextent[1], shape[0])\n', (471, 509), True, 'import numpy as np\n'), ((518, 567), 'numpy.linspace', 'np.linspace', (['visextent[2]', 'visextent[3]', 'shape[1]'], {}), '(visextent[2], visextent[3], shape[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.