code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from typing import Tuple, Type
import numpy as np
from pyjackson.core import ArgList, Field
from pyjackson.generics import Serializer
from ebonite.core.analyzer.base import CanIsAMustHookMixin, TypeHookMixin
from ebonite.core.analyzer.dataset import DatasetHook
from ebonite.core.objects.dataset_type import DatasetTyp... | [
"numpy.array",
"pyjackson.core.Field",
"ebonite.runtime.interface.typing.SizedTypedListType"
] | [((3677, 3714), 'ebonite.runtime.interface.typing.SizedTypedListType', 'SizedTypedListType', (['shape[0]', 'subtype'], {}), '(shape[0], subtype)\n', (3695, 3714), False, 'from ebonite.runtime.interface.typing import ListTypeWithSpec, SizedTypedListType\n'), ((3870, 3883), 'numpy.array', 'np.array', (['obj'], {}), '(obj... |
# Copyright 2021 <NAME>. 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 law or agreed to... | [
"argparse.ArgumentParser",
"python.input.cifar100_input_pipeline.Cifar100",
"os.path.splitext",
"numpy.array",
"python.input.cifar10_input_pipeline.Cifar10",
"python.input.smallNORB_input_pipeline.smallNORB",
"tensorflow.distribute.MirroredStrategy",
"python.input.MNIST_input_pipeline.MNIST",
"os.wa... | [((1302, 1318), 'os.walk', 'os.walk', (['log_dir'], {}), '(log_dir)\n', (1309, 1318), False, 'import os\n'), ((1817, 1849), 'tensorflow.distribute.MirroredStrategy', 'tf.distribute.MirroredStrategy', ([], {}), '()\n', (1847, 1849), True, 'import tensorflow as tf\n'), ((2845, 2870), 'argparse.ArgumentParser', 'argparse.... |
import torch, math, copy
import scipy.sparse as sp
import numpy as np
from torch.nn.modules.module import Module
import torch.nn as nn
from torch.nn.parameter import Parameter
def normalize(adj, device='cpu'):
if isinstance(adj, torch.Tensor):
adj_ = adj.to(device)
elif isinstance(adj, sp.c... | [
"scipy.sparse.eye",
"torch.eye",
"torch.FloatTensor",
"torch.pow",
"torch.from_numpy",
"torch.mm",
"torch.tensor",
"numpy.stack",
"scipy.sparse.coo_matrix",
"torch.spmm",
"scipy.sparse.diags",
"copy.copy",
"torch.Size",
"numpy.float_power"
] | [((1654, 1676), 'scipy.sparse.coo_matrix', 'sp.coo_matrix', (['adj_def'], {}), '(adj_def)\n', (1667, 1676), True, 'import scipy.sparse as sp\n'), ((1899, 1918), 'scipy.sparse.diags', 'sp.diags', (['norm_unit'], {}), '(norm_unit)\n', (1907, 1918), True, 'import scipy.sparse as sp\n'), ((1942, 1972), 'copy.copy', 'copy.c... |
#*
#* Copyright (C) 2017-2019 Alibaba Group Holding Limited
#*
#* 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 ... | [
"os.path.join",
"os.path.realpath",
"onnx.TensorProto",
"numpy.testing.assert_almost_equal",
"onnx.load",
"onnx.numpy_helper.to_array"
] | [((831, 857), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (847, 857), False, 'import os\n'), ((880, 912), 'os.path.join', 'os.path.join', (['dir_path', '"""test_*"""'], {}), "(dir_path, 'test_*')\n", (892, 912), False, 'import os\n'), ((1054, 1079), 'onnx.load', 'onnx.load', (['model_pat... |
"""
animation.py
This script is used to procduce animations of population behaviour
over a range of changing conditions. For example, if we wanted to
see how a population would change as light was elevated and wind
kept constant, we could produce the animation and watch the
general trend. This was mostly useful for vi... | [
"numpy.radians",
"util.treatment.Treatment",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.clf",
"os.getcwd",
"os.chdir",
"matplotlib.pyplot.subplot",
"numpy.linspace",
"scipy.special.i0",
"numpy.cos",
"matplotlib.pyplot.tight_layout",
"numpy.degrees",
"util.mode... | [((1259, 1277), 'util.models.ReliabilityModel', 'ReliabilityModel', ([], {}), '()\n', (1275, 1277), False, 'from util.models import ReliabilityModel\n'), ((1333, 1355), 'os.chdir', 'os.chdir', (['"""frames/BWS"""'], {}), "('frames/BWS')\n", (1341, 1355), False, 'import os\n'), ((1651, 1668), 'numpy.radians', 'np.radian... |
import os
"""
# If you have multi-gpu, designate the number of GPU to use.
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
"""
import argparse
import logging
from tqdm import tqdm # progress bar
import numpy as np
import matplotlib.pyplot as plt
from keras import optimizers
from... | [
"matplotlib.pyplot.imshow",
"keras.optimizers.Adam",
"os.listdir",
"segmentation_models.utils.set_trainable",
"argparse.ArgumentParser",
"keras.callbacks.ModelCheckpoint",
"keras.callbacks.ReduceLROnPlateau",
"tqdm.tqdm",
"os.path.join",
"logging.info",
"os.path.isdir",
"dataset.DataGenerator"... | [((3351, 3367), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(131)'], {}), '(131)\n', (3362, 3367), True, 'import matplotlib.pyplot as plt\n'), ((3372, 3391), 'matplotlib.pyplot.imshow', 'plt.imshow', (['imgs[0]'], {}), '(imgs[0])\n', (3382, 3391), True, 'import matplotlib.pyplot as plt\n'), ((3396, 3412), 'matplotli... |
## Data Loader: TE-CCA zT Dataset
# <NAME> (<EMAIL>) 2021-03-12
#
from citrination_client import CitrinationClient, PifSystemReturningQuery
from citrination_client import DataQuery, DatasetQuery, Filter
from matminer.featurizers.base import MultipleFeaturizer
from matminer.featurizers import composition as cf
from pyma... | [
"matminer.featurizers.composition.ValenceOrbital",
"pandas.read_csv",
"citrination_client.CitrinationClient",
"sl_utils.setResDir",
"numpy.array",
"pandas.DataFrame",
"matminer.featurizers.composition.IonProperty",
"matminer.featurizers.composition.Stoichiometry",
"pymatgen.Composition",
"pandas.c... | [((764, 775), 'sl_utils.setResDir', 'setResDir', ([], {}), '()\n', (773, 775), False, 'from sl_utils import pifs2df, setResDir\n'), ((940, 962), 'numpy.array', 'np.array', (['[+1, -1, -1]'], {}), '([+1, -1, -1])\n', (948, 962), True, 'import numpy as np\n'), ((678, 692), 'pymatgen.Composition', 'Composition', (['c'], {... |
import os.path
import os
import numpy
from . import common, cgen
"""
References
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/sklearn/covariance/_empirical_covariance.py#L297
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/skl... | [
"numpy.zeros",
"os.path.basename"
] | [((942, 965), 'numpy.zeros', 'numpy.zeros', ([], {'shape': 'size'}), '(shape=size)\n', (953, 965), False, 'import numpy\n'), ((4073, 4095), 'os.path.basename', 'os.path.basename', (['file'], {}), '(file)\n', (4089, 4095), False, 'import os\n')] |
from fuzzy_asteroids.util import Scenario
import numpy as np
# "Simple" Scenarios --------------------------------------------------------------------------------------------------#
# Threat priority tests
threat_test_1 = Scenario(
name="threat_test_1",
asteroid_states=[{"position": (0, 300), "angle": -90.0, ... | [
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.meshgrid",
"fuzzy_asteroids.util.Scenario"
] | [((224, 430), 'fuzzy_asteroids.util.Scenario', 'Scenario', ([], {'name': '"""threat_test_1"""', 'asteroid_states': "[{'position': (0, 300), 'angle': -90.0, 'speed': 40}, {'position': (700, \n 300), 'angle': 0.0, 'speed': 0}]", 'ship_state': "{'position': (600, 300)}", 'seed': '(0)'}), "(name='threat_test_1', asteroi... |
import json
import os
import sys
import time
from os import path as osp
from pathlib import Path
from shutil import copyfile
import numpy as np
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.data import DataLoader
from tqdm import tqdm
from model_temporal import LSTMSeqNetwork, B... | [
"model_temporal.BilinearLSTMSeqNetwork",
"model_temporal.LSTMSeqNetwork",
"utils.MSEAverageMeter",
"numpy.array",
"torch.nn.MSELoss",
"model_temporal.TCNSeqNetwork",
"torch.cuda.is_available",
"numpy.linalg.norm",
"metric.compute_absolute_trajectory_error",
"numpy.arange",
"os.remove",
"os.pat... | [((1238, 1295), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (1280, 1295), False, 'import torch\n'), ((853, 875), 'os.listdir', 'os.listdir', (["(path + '/')"], {}), "(path + '/')\n", (863, 875), False, 'import os\n'), ((32... |
from scipy.misc import imread,imshow
import chaosencrypt as cenc
import numpy as np
from chaosencrypt.discrete_pisarchik import bitexpand,bitreduce
# Read image
print('Loading image...')
im_org = imread('../image.jpg')
# Downsample
im = im_org[::3,::3,:].copy()
# Key
key = {'a':3.8,'n':10,'r':3,'bits':32}
# Encryp... | [
"numpy.abs",
"chaosencrypt.encrypt",
"chaosencrypt.discrete_pisarchik.bitreduce",
"numpy.max",
"scipy.misc.imread",
"numpy.zeros",
"numpy.concatenate",
"numpy.min",
"chaosencrypt.decrypt"
] | [((198, 220), 'scipy.misc.imread', 'imread', (['"""../image.jpg"""'], {}), "('../image.jpg')\n", (204, 220), False, 'from scipy.misc import imread, imshow\n'), ((381, 424), 'chaosencrypt.encrypt', 'cenc.encrypt', (['im', 'key', '"""discrete_pisarchik"""'], {}), "(im, key, 'discrete_pisarchik')\n", (393, 424), True, 'im... |
"""
This script contains the code implementing my version of the Boids artificial
life programme.
"""
# ---------------------------------- Imports ----------------------------------
# Allow imports from parent folder
import sys, os
sys.path.insert(0, os.path.abspath('..'))
# Standard library imports
impor... | [
"boids_core.generate_values.noisy_lattice",
"math.sqrt",
"delauney_triangulation.triangulation_core.triangulation.triangulate",
"numpy.asarray",
"boids_core.generate_values.random",
"boids_core.generate_values.lattice",
"math.atan2",
"delauney_triangulation.triangulation_core.linear_algebra.list_divid... | [((261, 282), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (276, 282), False, 'import sys, os\n'), ((2460, 2501), 'math.sqrt', 'sqrt', (['(self.vel[0] ** 2 + self.vel[1] ** 2)'], {}), '(self.vel[0] ** 2 + self.vel[1] ** 2)\n', (2464, 2501), False, 'from math import atan2, sqrt\n'), ((2546, 2577... |
#!/usr/bin/env python3
import datetime
import os
import warnings
import numpy as np
import scipy.interpolate as si
import matplotlib as mpl
from matplotlib.backends import backend_pdf
import matplotlib.pyplot as plt
from .utils import aia_raster
from .utils import cli
from .utils import eis
from .utils import num
f... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"numpy.nanmean",
"numpy.array",
"numpy.nanmin",
"os.path.exists",
"numpy.savez",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.nanmax",
"numpy.min",
"warnings.warn",
"numpy.meshgrid",
"numpy.abs",
"numpy.nanstd",
"... | [((14319, 14335), 'numpy.max', 'np.max', (['x_margin'], {}), '(x_margin)\n', (14325, 14335), True, 'import numpy as np\n'), ((14351, 14367), 'numpy.max', 'np.max', (['y_margin'], {}), '(y_margin)\n', (14357, 14367), True, 'import numpy as np\n'), ((15480, 15532), 'numpy.sqrt', 'np.sqrt', (['((x_max - x_cen) ** 2 + (y_m... |
#A template for when we actually build the model.
import numpy as np
from sklearn.model_selection import train_test_split
from tensorflow.keras.layers import Dense, LSTM, Dropout
from tensorflow.keras import Sequential
categories = [] #List out category string names here
reproducibility = 7 #Constant seed for reproduci... | [
"sklearn.model_selection.train_test_split",
"tensorflow.keras.Sequential",
"numpy.random.seed"
] | [((327, 358), 'numpy.random.seed', 'np.random.seed', (['reproducibility'], {}), '(reproducibility)\n', (341, 358), True, 'import numpy as np\n'), ((451, 518), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': '(0.2)', 'random_state': 'reproducibility'}), '(x, y, test_size=0.2, r... |
# -*- coding: utf-8 -*-
"""
============================================================================
Authors:
<NAME> and <NAME>*
*Department of Informatics
Universidad Nacional de San Antonio Abad del Cusco (UNSAAC) - Perú
============================================================================
"""
# Python... | [
"numpy.sum",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1903, 1917), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1915, 1917), True, 'import matplotlib.pyplot as plt\n'), ((2959, 2969), 'matplotlib.pyplot.grid', 'plt.grid', ([], {}), '()\n', (2967, 2969), True, 'import matplotlib.pyplot as plt\n'), ((2970, 2980), 'matplotlib.pyplot.show', 'plt.show', ... |
import numpy as np
import deepxde as dde
from deepxde.backend import tf
import variable_to_parameter_transform
def sbinn(data_t, data_y, meal_t, meal_q):
def get_variable(v, var):
low, up = v * 0.2, v * 1.8
l = (up - low) / 2
v1 = l * tf.tanh(var) + l + low
return v1
... | [
"deepxde.backend.tf.math.tanh",
"deepxde.data.PDE",
"deepxde.PointSetBC",
"deepxde.Variable",
"deepxde.Model",
"numpy.hstack",
"deepxde.backend.tf.constant",
"variable_to_parameter_transform.variable_file",
"deepxde.geometry.TimeDomain",
"deepxde.backend.tf.sigmoid",
"numpy.arange",
"deepxde.b... | [((5369, 5457), 'variable_to_parameter_transform.variable_file', 'variable_to_parameter_transform.variable_file', (['(10000)', '(1000)', '(1000000)', '"""variables.csv"""'], {}), "(10000, 1000, 1000000,\n 'variables.csv')\n", (5414, 5457), False, 'import variable_to_parameter_transform\n'), ((329, 346), 'deepxde.Var... |
import os
import json
import pickle
import collections
import numpy as np
from s2and.consts import CONFIG
DATA_DIR = CONFIG["main_data_dir"]
OUTPUT_DIR = os.path.join(DATA_DIR, "s2and_mini")
if not os.path.exists(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
# excluding MEDLINE because it has no clusters
DATASETS = [
"a... | [
"os.path.exists",
"pickle.dump",
"os.path.join",
"pickle.load",
"collections.Counter",
"os.mkdir",
"json.load",
"numpy.all",
"json.dump"
] | [((156, 192), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""s2and_mini"""'], {}), "(DATA_DIR, 's2and_mini')\n", (168, 192), False, 'import os\n'), ((200, 226), 'os.path.exists', 'os.path.exists', (['OUTPUT_DIR'], {}), '(OUTPUT_DIR)\n', (214, 226), False, 'import os\n'), ((232, 252), 'os.mkdir', 'os.mkdir', (['OUTPU... |
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
def Compute_Block(cell_gradient_box):
k=0
hog_vector = np.zeros((bin_size*4*(cell_gradient_box.shape[0] - 1)*(cell_gradient_box.shape[1] - 1)))
for i in range(cell_gradient_box.shape[0] - 1):
for j in range(cell_gradient... | [
"numpy.arange",
"numpy.power",
"cv2.cartToPolar",
"os.getcwd",
"numpy.zeros",
"matplotlib.pyplot.bar",
"numpy.concatenate",
"matplotlib.pyplot.title",
"cv2.resize",
"cv2.imread",
"numpy.float32",
"cv2.Sobel",
"matplotlib.pyplot.show"
] | [((141, 238), 'numpy.zeros', 'np.zeros', (['(bin_size * 4 * (cell_gradient_box.shape[0] - 1) * (cell_gradient_box.shape\n [1] - 1))'], {}), '(bin_size * 4 * (cell_gradient_box.shape[0] - 1) * (\n cell_gradient_box.shape[1] - 1))\n', (149, 238), True, 'import numpy as np\n'), ((1537, 1555), 'numpy.zeros', 'np.zero... |
import numpy as np
import numpy.testing as npt
import noisyopt
def test_minimize():
deltatol = 1e-3
## basic testing without stochasticity
def quadratic(x):
return (x**2).sum()
res = noisyopt.minimize(quadratic, np.asarray([0.5, 1.0]), deltatol=deltatol)
npt.assert_allclose(res.x, [0.0, 0.... | [
"numpy.random.normal",
"numpy.testing.assert_equal",
"numpy.testing.assert_approx_equal",
"numpy.testing.assert_allclose",
"numpy.testing.assert_raises",
"numpy.asarray",
"noisyopt.bisect",
"numpy.array",
"numpy.zeros",
"numpy.testing.run_module_suite",
"numpy.random.randn",
"noisyopt.Averaged... | [((285, 338), 'numpy.testing.assert_allclose', 'npt.assert_allclose', (['res.x', '[0.0, 0.0]'], {'atol': 'deltatol'}), '(res.x, [0.0, 0.0], atol=deltatol)\n', (304, 338), True, 'import numpy.testing as npt\n'), ((343, 385), 'numpy.testing.assert_equal', 'npt.assert_equal', (['res.free', '[False, False]'], {}), '(res.fr... |
# import lib.pbcvt as pbcvt
import cv2
import numpy as np
import sys
from time import time
def distance(o1, o2):
(x1,y1,w1,h1) = o1
(x2,y2,w2,h2) = o2
c1 = (x1+w1/2,y1+h1/2)
c2 = (x2+w2/2,y2+h2/2)
return np.hypot(c1[0]-c2[0],c1[1]-c2[1])
cv2.namedWindow("preview")
cv2.namedWindow("preview2")
cv2.... | [
"cv2.rectangle",
"numpy.sqrt",
"cv2.imshow",
"cv2.ellipse",
"cv2.fitEllipse",
"cv2.CascadeClassifier",
"cv2.calcHist",
"cv2.threshold",
"cv2.contourArea",
"numpy.hypot",
"cv2.waitKey",
"cv2.kmeans",
"cv2.equalizeHist",
"cv2.cvtColor",
"time.time",
"cv2.namedWindow",
"cv2.imwrite",
... | [((261, 287), 'cv2.namedWindow', 'cv2.namedWindow', (['"""preview"""'], {}), "('preview')\n", (276, 287), False, 'import cv2\n'), ((288, 315), 'cv2.namedWindow', 'cv2.namedWindow', (['"""preview2"""'], {}), "('preview2')\n", (303, 315), False, 'import cv2\n'), ((316, 343), 'cv2.namedWindow', 'cv2.namedWindow', (['"""pr... |
import logging
import os
from pathlib import Path
import re
from typing import Dict, List, Optional, Tuple
from calvin_agent.datasets.base_dataset import BaseDataset
from calvin_agent.datasets.utils.episode_utils import (
get_state_info_dict,
process_actions,
process_depth,
process_rgb,
process_sta... | [
"logging.getLogger",
"re.split",
"calvin_agent.datasets.utils.episode_utils.process_state",
"calvin_agent.datasets.utils.episode_utils.process_depth",
"calvin_agent.datasets.utils.episode_utils.process_rgb",
"pathlib.Path",
"calvin_agent.datasets.utils.episode_utils.get_state_info_dict",
"os.scandir",... | [((368, 395), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (385, 395), False, 'import logging\n'), ((1600, 1633), 'os.scandir', 'os.scandir', (['self.abs_datasets_dir'], {}), '(self.abs_datasets_dir)\n', (1610, 1633), False, 'import os\n'), ((1795, 1826), 're.split', 're.split', (['"""\... |
import numpy
from NeuralNetworks.Layers.activations import lambda_from_function
class Dense:
def __init__(self, num_nodes = 1, input_dim = None, activation = 'sigmoid'):
# set number of nodes
self.num_nodes = num_nodes
self.input_dim = input_dim
self.activation = activation
... | [
"numpy.dot",
"numpy.transpose",
"NeuralNetworks.Layers.activations.lambda_from_function"
] | [((424, 456), 'NeuralNetworks.Layers.activations.lambda_from_function', 'lambda_from_function', (['activation'], {}), '(activation)\n', (444, 456), False, 'from NeuralNetworks.Layers.activations import lambda_from_function\n'), ((940, 970), 'numpy.dot', 'numpy.dot', (['self.weights', 'input'], {}), '(self.weights, inpu... |
import collections
import datetime
import logging
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
import scipy as sp
import sklearn as sklear
import core.config as cconfig
import core.data_adapters as cdataa
import core.dataflow.utils as cdu
import core.fina... | [
"logging.getLogger",
"helpers.dbg.dassert_in",
"core.dataflow.nodes.sources.ReadDataFromDf",
"helpers.dbg.dassert_is_not",
"core.dataflow.utils.get_x_and_forward_y_fit_df",
"core.dataflow.utils.merge_dataframes",
"core.data_adapters.transform_to_sklearn",
"core.dataflow.visitors.extract_info",
"help... | [((755, 782), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (772, 782), False, 'import logging\n'), ((2076, 2100), 'core.dataflow.utils.convert_to_list', 'cdu.convert_to_list', (['col'], {}), '(col)\n', (2095, 2100), True, 'import core.dataflow.utils as cdu\n'), ((2191, 2280), 'helpers.d... |
# Data processing imports
import scipy.io as io
import numpy as np
from pyDOE import lhs
# Plotting imports
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy.interpolate import griddata
import matplotlib.gridspec as gridspec
def load_dataset(file):
data = io.loadma... | [
"numpy.reshape",
"numpy.ones",
"numpy.random.choice",
"matplotlib.pyplot.gca",
"scipy.io.loadmat",
"numpy.log",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.random.randn",
"numpy.vstack",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"numpy.std",
"numpy.finfo",
"nump... | [((311, 327), 'scipy.io.loadmat', 'io.loadmat', (['file'], {}), '(file)\n', (321, 327), True, 'import scipy.io as io\n'), ((533, 550), 'numpy.meshgrid', 'np.meshgrid', (['x', 't'], {}), '(x, t)\n', (544, 550), True, 'import numpy as np\n'), ((787, 833), 'numpy.random.choice', 'np.random.choice', (['x.shape[0]', 'N'], {... |
""" Functions for working with tabix dosages in pandas dataframes
"""
import gzip
import numpy as np
import pandas as pd
import pysam
import statsmodels.api as sm
class Dosage(object):
def __init__(self, dosages, annotations, gene_name):
# Match up the annotation dataframe with the dosage dataframe
... | [
"numpy.asarray",
"pysam.Tabixfile",
"pandas.Index",
"statsmodels.api.add_constant",
"statsmodels.api.OLS",
"pandas.concat"
] | [((1215, 1247), 'pysam.Tabixfile', 'pysam.Tabixfile', (['annotation_file'], {}), '(annotation_file)\n', (1230, 1247), False, 'import pysam\n'), ((1870, 1890), 'pandas.concat', 'pd.concat', (['comb_iter'], {}), '(comb_iter)\n', (1879, 1890), True, 'import pandas as pd\n'), ((2765, 2785), 'statsmodels.api.add_constant', ... |
import numpy as np
import scipy.sparse as sp
import Orange.data
from Orange.statistics import distribution, basic_stats
from Orange.util import Reprable
from .transformation import Transformation, Lookup
__all__ = [
"ReplaceUnknowns",
"Average",
"DoNotImpute",
"DropInstances",
"Model",
"AsValu... | [
"Orange.statistics.distribution.get_distribution",
"numpy.ones_like",
"Orange.statistics.basic_stats.BasicStats",
"numpy.asarray",
"numpy.any",
"scipy.sparse.issparse",
"numpy.sum",
"numpy.array",
"numpy.isnan"
] | [((833, 847), 'scipy.sparse.issparse', 'sp.issparse', (['c'], {}), '(c)\n', (844, 847), True, 'import scipy.sparse as sp\n'), ((2250, 2263), 'numpy.isnan', 'np.isnan', (['col'], {}), '(col)\n', (2258, 2263), True, 'import numpy as np\n'), ((4537, 4553), 'numpy.isnan', 'np.isnan', (['column'], {}), '(column)\n', (4545, ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
======================
Laplacian segmentation
======================
This notebook implements the laplacian segmentation method of
`McFee and Ellis, 2014 <http://bmcfee.github.io/papers/ismir2014_spectral.pdf>`_,
with a couple of minor stability improvements.
This impleme... | [
"librosa.feature.spectral_flatness",
"librosa.util.fix_frames",
"librosa.feature.mfcc",
"librosa.estimate_tuning",
"numpy.array",
"numpy.cumsum",
"sys.exit",
"librosa.onset.onset_backtrack",
"librosa.feature.spectral_centroid",
"librosa.feature.spectral_contrast",
"numpy.arange",
"librosa.load... | [((1598, 1686), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'module': '"""scipy"""', 'message': '"""^internal gelsd"""'}), "(action='ignore', module='scipy', message=\n '^internal gelsd')\n", (1621, 1686), False, 'import warnings\n'), ((1963, 2000), 'matplotlib.pyplot.rcPara... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import common_fn as cf
import seaborn as sns
plt.rcParams["svg.hashsalt"]=0
pre_path='EnvEq/All3/'
parm_format='{:.2e}'
parm_name='therapy_abi-Tneg_initratio-Totcell'
parm_name_array=['Tneg_initratio','Totcell']
post_path1='o2-Null_test-HE/'
parm_n... | [
"common_fn.mkdirs",
"common_fn.eq_values",
"common_fn.timeseries",
"numpy.array",
"numpy.append",
"numpy.empty",
"numpy.logspace"
] | [((350, 400), 'common_fn.mkdirs', 'cf.mkdirs', ([], {'pre_path': 'pre_path', 'parm_name': 'parm_name1'}), '(pre_path=pre_path, parm_name=parm_name1)\n', (359, 400), True, 'import common_fn as cf\n'), ((429, 451), 'numpy.logspace', 'np.logspace', (['(-1)', '(-3)', '(5)'], {}), '(-1, -3, 5)\n', (440, 451), True, 'import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
tools module
"""
__author__ = 'Dr. <NAME>, University of Bristol, UK'
__maintainer__ = 'Dr. <NAME>'
__email__ = '<EMAIL>'
__status__ = 'Development'
import sys
import os
import copy
import numpy as np
try:
import opt_einsum as oe
OE_AVAILABLE = True
except Imp... | [
"opt_einsum.contract",
"numpy.abs",
"numpy.asarray",
"os.environ.get",
"numpy.count_nonzero",
"numpy.array",
"numpy.sum",
"os.path.dirname",
"numpy.einsum",
"numpy.nonzero",
"numpy.linalg.eigh",
"pyscf.symm.label_orb_symm",
"numpy.zeros_like"
] | [((5197, 5220), 'numpy.linalg.eigh', 'np.linalg.eigh', (['rdm1_mo'], {}), '(rdm1_mo)\n', (5211, 5220), True, 'import numpy as np\n'), ((4795, 4822), 'numpy.asarray', 'np.asarray', (['((mo_coeff,) * 2)'], {}), '((mo_coeff,) * 2)\n', (4805, 4822), True, 'import numpy as np\n'), ((6408, 6431), 'numpy.zeros_like', 'np.zero... |
import numpy as np
from ._base import FilterAlgorithmBase
class WhiteTophat(FilterAlgorithmBase):
"""
Performs "white top hat" filtering of an image to enhance spots. "White top hat filtering" finds spots that are both
smaller and brighter than their surroundings.
See Also
--------
https://e... | [
"numpy.minimum",
"skimage.morphology.disk",
"scipy.ndimage.filters.maximum_filter",
"scipy.ndimage.filters.minimum_filter"
] | [((1454, 1474), 'skimage.morphology.disk', 'disk', (['self.disk_size'], {}), '(self.disk_size)\n', (1458, 1474), False, 'from skimage.morphology import disk\n'), ((1502, 1554), 'scipy.ndimage.filters.minimum_filter', 'minimum_filter', (['image'], {'footprint': 'structuring_element'}), '(image, footprint=structuring_ele... |
import datetime
import cv2
import numpy as np
from artsci2019.lib.frame_checker import FrameChecker
from artsci2019.lib.util import scale_frame, scale_point, is_in_frame
from artsci2019.lib.face_recog import get_faces
from artsci2019.lib.sound import SoundPlayer
def draw_checked_frame(frame, checked_frame, factor):
... | [
"artsci2019.lib.util.scale_point",
"cv2.transpose",
"artsci2019.lib.sound.SoundPlayer",
"cv2.imshow",
"datetime.timedelta",
"artsci2019.lib.frame_checker.FrameChecker",
"numpy.reshape",
"cv2.line",
"cv2.addWeighted",
"cv2.waitKey",
"cv2.Subdiv2D",
"cv2.namedWindow",
"artsci2019.lib.util.is_i... | [((1334, 1352), 'cv2.Subdiv2D', 'cv2.Subdiv2D', (['rect'], {}), '(rect)\n', (1346, 1352), False, 'import cv2\n'), ((470, 513), 'artsci2019.lib.util.scale_point', 'scale_point', (['checked_frame.left_eye', 'factor'], {}), '(checked_frame.left_eye, factor)\n', (481, 513), False, 'from artsci2019.lib.util import scale_fra... |
import gym
from dqn_tf import DeepQNetwork, Agent
import numpy as np
from gym import wrappers
def preprocess(observation):
return np.mean(observation[30:, :], axis=2).reshape(180, 160, 1)
def stack_frames(stacked_frames, frame, buffer_size):
if stacked_frames is None:
stacked_frames = np.zeros((buff... | [
"numpy.mean",
"numpy.random.choice",
"numpy.zeros",
"dqn_tf.Agent",
"gym.make"
] | [((717, 740), 'gym.make', 'gym.make', (['"""Breakout-v0"""'], {}), "('Breakout-v0')\n", (725, 740), False, 'import gym\n'), ((781, 899), 'dqn_tf.Agent', 'Agent', ([], {'gamma': '(0.99)', 'epsilon': '(1.0)', 'alpha': '(0.00025)', 'input_dims': '(180, 160, 4)', 'n_actions': '(3)', 'mem_size': '(3000)', 'batch_size': '(32... |
"""Data analyzation metrics
Each algorithm works on a set of handwritings. They have to be applied like
this:
>>> import hwrt.data_analyzation_metrics
>>> from hwrt.handwritten_data import HandwrittenData
>>> data_json = '[[{"time": 123, "x": 45, "y": 67}]]'
>>> a = [{'is_in_testset': 0,
... 'formula_id': "31L",
.... | [
"logging.getLogger",
"os.path.exists",
"numpy.mean",
"os.makedirs",
"numpy.average",
"os.path.join",
"collections.defaultdict",
"numpy.std",
"math.hypot",
"time.time"
] | [((1294, 1321), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1311, 1321), False, 'import logging\n'), ((1918, 1951), 'os.path.join', 'os.path.join', (['directory', 'filename'], {}), '(directory, filename)\n', (1930, 1951), False, 'import os\n'), ((3211, 3228), 'collections.defaultdict'... |
from __future__ import print_function
import numpy as np
from kernel_tuner import run_kernel
from .context import skip_if_no_cuda_device, create_plot
from km3net.util import get_kernel_path, generate_correlations_table
def test_degrees_kernel():
skip_if_no_cuda_device()
def in_degrees(correlations):
... | [
"km3net.util.generate_correlations_table",
"km3net.util.get_kernel_path",
"numpy.int32",
"numpy.sum",
"numpy.zeros",
"kernel_tuner.run_kernel"
] | [((754, 767), 'numpy.int32', 'np.int32', (['(400)'], {}), '(400)\n', (762, 767), True, 'import numpy as np\n'), ((795, 808), 'numpy.int32', 'np.int32', (['(150)'], {}), '(150)\n', (803, 808), True, 'import numpy as np\n'), ((924, 989), 'km3net.util.generate_correlations_table', 'generate_correlations_table', (['N', 'sl... |
import numpy as np
import torch
import torch.nn.functional as F
from scipy.sparse import coo_matrix
from sklearn.preprocessing import StandardScaler
from torch.utils.data import Dataset
from torch_geometric.data import InMemoryDataset, Data, Batch
from tqdm.auto import tqdm
from utils.data_utils import window_data_sor... | [
"numpy.clip",
"torch.as_tensor",
"torch.load",
"torch.stack",
"torch.sqrt",
"torch.max",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"torch_geometric.data.Batch.from_data_list",
"torch.save",
"tqdm.auto.tqdm",
"numpy.percentile",
"utils.data_utils.add_age_gender",
"torch.cat"
] | [((622, 657), 'torch.load', 'torch.load', (['self.processed_paths[0]'], {}), '(self.processed_paths[0])\n', (632, 657), False, 'import torch\n'), ((1016, 1045), 'torch.load', 'torch.load', (['self.raw_paths[0]'], {}), '(self.raw_paths[0])\n', (1026, 1045), False, 'import torch\n'), ((1611, 1652), 'numpy.clip', 'np.clip... |
#! /usr/bin/env python
# -*- coding: utf8 -*-
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint # use Runge-Kutta 4
def pend(y, t, b, c): # function definition
"""Gives 2D vector dy/dt as function of y and t, with parameters b and c."""
return np.array([y[1], -b*y[1] - c... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"scipy.integrate.odeint",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.linspace",
"numpy.sin",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((380, 408), 'numpy.array', 'np.array', (['[np.pi - 0.1, 0.0]'], {}), '([np.pi - 0.1, 0.0])\n', (388, 408), True, 'import numpy as np\n'), ((413, 436), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(101)'], {}), '(0, 10, 101)\n', (424, 436), True, 'import numpy as np\n'), ((473, 505), 'scipy.integrate.odeint', 'o... |
"""
@author: <NAME> (University of Sydney)
-------------------------------------------------------------------------
AMICAL: Aperture Masking Interferometry Calibration and Analysis Library
-------------------------------------------------------------------------
Function related to data cleaning (ghost, background c... | [
"matplotlib.pyplot.grid",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"numpy.array",
"astropy.io.fits.open",
"numpy.sin",
"numpy.arange",
"numpy.mean",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"amical.tools.apply_windowing",
"numpy.fft.fft2",
"numpy.max",
"numpy... | [((2288, 2312), 'numpy.array', 'np.array', (['cube_corrected'], {}), '(cube_corrected)\n', (2296, 2312), True, 'import numpy as np\n'), ((3422, 3438), 'numpy.array', 'np.array', (['fluxes'], {}), '(fluxes)\n', (3430, 3438), True, 'import numpy as np\n'), ((3455, 3474), 'numpy.array', 'np.array', (['flag_fram'], {}), '(... |
# Simplified Bres Maker
# Version: 1.0
#Python Version: 2.0
# IMPORTS
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
from numpy import asarray
from numpy import savetxt
import sys
import os
# DEFINITIONS
def find(s, ch):
return [i for i, ltr in enumerate(s) if ltr == ch]
# DATALOAD... | [
"sklearn.cluster.KMeans",
"numpy.insert",
"numpy.column_stack",
"pandas.read_csv"
] | [((616, 759), 'pandas.read_csv', 'pd.read_csv', (['ranking'], {'usecols': "['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P',\n 'S', 'T', 'W', 'Y', 'V']", 'sep': '""","""'}), "(ranking, usecols=['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H',\n 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y... |
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score
import torch
from transformers import TrainingArguments, Trainer
from transformers import BertTokenizer, BertForSequenceClassification
from tran... | [
"sklearn.metrics.f1_score",
"pandas.read_csv",
"transformers.TrainingArguments",
"sklearn.model_selection.train_test_split",
"argparse.ArgumentParser",
"transformers.BertTokenizer.from_pretrained",
"numpy.argmax",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"torch.tensor",
... | [((1036, 1059), 'numpy.argmax', 'np.argmax', (['pred'], {'axis': '(1)'}), '(pred, axis=1)\n', (1045, 1059), True, 'import numpy as np\n'), ((1076, 1118), 'sklearn.metrics.accuracy_score', 'accuracy_score', ([], {'y_true': 'labels', 'y_pred': 'pred'}), '(y_true=labels, y_pred=pred)\n', (1090, 1118), False, 'from sklearn... |
from qft import get_fft_from_counts, loadBackend, qft_framework
from fft import fft_framework
from frontend import frontend, signal, transform
from qiskit.circuit.library import QFT as qiskit_qft
# --- Standard imports
# Importing standard Qiskit libraries and configuring account
from qiskit import QuantumCircuit, e... | [
"frontend.signal",
"qiskit.execute",
"qiskit.compiler.transpile",
"qft.loadBackend",
"qiskit.ignis.mitigation.measurement.complete_meas_cal",
"qiskit.IBMQ.load_account",
"qiskit.circuit.library.QFT",
"frontend.transform",
"numpy.linalg.norm",
"qiskit.QuantumCircuit",
"qft.get_fft_from_counts",
... | [((499, 518), 'qiskit.IBMQ.load_account', 'IBMQ.load_account', ([], {}), '()\n', (516, 518), False, 'from qiskit import QuantumCircuit, execute, Aer, IBMQ\n'), ((997, 1039), 'qiskit.ignis.mitigation.measurement.complete_meas_cal', 'complete_meas_cal', ([], {'qr': 'qr', 'circlabel': '"""mcal"""'}), "(qr=qr, circlabel='m... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 9 10:56:12 2017
@author: tneises
"""
import json
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.lines as mlines
import sys
import os
absFilePath = os.path.abspath(__file__)
fileDir = os.path.dirname(os.path.abspath(__file__))
parentDir = os.pat... | [
"sco2_plots.C_sco2_TS_PH_overlay_plot",
"sco2_plots.C_sco2_TS_PH_plot",
"os.path.join",
"os.path.dirname",
"sco2_cycle_ssc.C_sco2_sim",
"sco2_plots.C_des_stacked_outputs_plot",
"sco2_cycle_ssc.get_one_des_dict_from_par_des_dict",
"os.path.abspath",
"sys.path.append",
"numpy.arange"
] | [((223, 248), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (238, 248), False, 'import os\n'), ((314, 338), 'os.path.dirname', 'os.path.dirname', (['fileDir'], {}), '(fileDir)\n', (329, 338), False, 'import os\n'), ((349, 380), 'os.path.join', 'os.path.join', (['parentDir', '"""core"""'], {}... |
### evaluation
import numpy as np
from sklearn.linear_model import LinearRegression
class Evaluate(object):
def __init__(self, model_names, X_train, y_preds, config,verbose=0):
self.distance_min = config['distance_min']
self.point_min = config['point_min'] #0.05, point_min = 50
self.model_n... | [
"numpy.sqrt",
"numpy.amin",
"numpy.max",
"numpy.vstack",
"numpy.min",
"numpy.argmin",
"sklearn.linear_model.LinearRegression"
] | [((2206, 2300), 'numpy.sqrt', 'np.sqrt', (['((clsuter_a_i[0] - cluster_b[:, 0]) ** 2 + (clsuter_a_i[1] - cluster_b[:, 1\n ]) ** 2)'], {}), '((clsuter_a_i[0] - cluster_b[:, 0]) ** 2 + (clsuter_a_i[1] -\n cluster_b[:, 1]) ** 2)\n', (2213, 2300), True, 'import numpy as np\n'), ((2308, 2330), 'numpy.amin', 'np.amin',... |
"""
orbit.py
"Frankly, a very limited and highly specific implementation of an Orbit class.
If used for applications other than the original usecase, this class will
either need to be bypassed or heavily expanded upon."
@author: <NAME> (https://github.com/Hans-Bananendans/)
"""
from numpy import log
class O... | [
"numpy.log"
] | [((1541, 1552), 'numpy.log', 'log', (['self.h'], {}), '(self.h)\n', (1544, 1552), False, 'from numpy import log\n')] |
"""
Multivariate from independent marginals and copula
==================================================
"""
#%% md
#
# - How to define α bivariate distribution from independent marginals and change its structure based on a copula supported by UQpy
# - How to plot the pdf of the distribution
# - How to modify the p... | [
"UQpy.distributions.JointCopula",
"UQpy.distributions.JointIndependent",
"UQpy.distributions.Normal",
"UQpy.distributions.Gumbel",
"numpy.meshgrid",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1055, 1072), 'UQpy.distributions.Gumbel', 'Gumbel', ([], {'theta': '(3.0)'}), '(theta=3.0)\n', (1061, 1072), False, 'from UQpy.distributions import Gumbel, JointCopula\n'), ((1143, 1170), 'UQpy.distributions.JointIndependent', 'JointIndependent', (['marginals'], {}), '(marginals)\n', (1159, 1170), False, 'from UQpy.... |
from __future__ import absolute_import, division, print_function
import numpy as np
import tensorflow as tf
from IPython.core.debugger import Tracer; debug_here = Tracer();
batch_size = 5
max_it = tf.constant(6)
char_mat_1 = [[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
... | [
"tensorflow.Tensor.get_shape",
"IPython.core.debugger.Tracer",
"tensorflow.initialize_all_variables",
"tensorflow.transpose",
"tensorflow.logical_or",
"tensorflow.ones",
"tensorflow.logical_not",
"tensorflow.Session",
"numpy.array",
"tensorflow.argmax",
"tensorflow.constant",
"tensorflow.great... | [((164, 172), 'IPython.core.debugger.Tracer', 'Tracer', ([], {}), '()\n', (170, 172), False, 'from IPython.core.debugger import Tracer\n'), ((199, 213), 'tensorflow.constant', 'tf.constant', (['(6)'], {}), '(6)\n', (210, 213), True, 'import tensorflow as tf\n'), ((1507, 1525), 'numpy.array', 'np.array', (['char_lst'], ... |
from typing import List, Tuple
import seaborn as sns
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
"""
Plots of tensorboard results with adjusted theming for presentation
"""
label_dict = {0: 'akiec', 1: 'bcc', 2: 'bkl', 3: 'df', 4: 'mel', 5: 'nv... | [
"matplotlib.use",
"seaborn.set_context",
"seaborn.heatmap",
"numpy.sum",
"seaborn.dark_palette",
"seaborn.barplot",
"matplotlib.pyplot.subplots"
] | [((72, 95), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (86, 95), False, 'import matplotlib\n'), ((334, 378), 'seaborn.set_context', 'sns.set_context', ([], {'rc': "{'patch.linewidth': 0.0}"}), "(rc={'patch.linewidth': 0.0})\n", (349, 378), True, 'import seaborn as sns\n'), ((1067, 1117), ... |
"""
A module for a mixture density network layer
(_Mixture Desity Networks_ by Bishop, 1994.)
"""
import sys
import torch
import torch.tensor as ts
import torch.nn as nn
import torch.optim as optim
from torch.distributions import Categorical
import math
# Draw distributions
import numpy as np
import matplotlib.pyplot ... | [
"torch.distributions.Categorical",
"torch.max",
"torch.sqrt",
"torch.exp",
"torch.min",
"numpy.array",
"torch.sum",
"torch.mean",
"torch.prod",
"numpy.linspace",
"numpy.meshgrid",
"torch.sort",
"matplotlib.pyplot.register_cmap",
"matplotlib.patches.Ellipse",
"matplotlib.colors.LinearSegm... | [((4004, 4027), 'torch.prod', 'torch.prod', (['prob'], {'dim': '(2)'}), '(prob, dim=2)\n', (4014, 4027), False, 'import torch\n'), ((4285, 4307), 'torch.sum', 'torch.sum', (['prob'], {'dim': '(1)'}), '(prob, dim=1)\n', (4294, 4307), False, 'import torch\n'), ((4691, 4706), 'torch.mean', 'torch.mean', (['nll'], {}), '(n... |
import numpy as np
import pytest
from opytimizer.math import hypercomplex
def test_norm():
array = np.array([[1, 1]])
norm_array = hypercomplex.norm(array)
assert norm_array > 0
def test_span():
array = np.array([[0.5, 0.75, 0.5, 0.9]])
lb = [0]
ub = [10]
span_array = hypercomplex.... | [
"numpy.array",
"opytimizer.math.hypercomplex.span",
"opytimizer.math.hypercomplex.norm"
] | [((106, 124), 'numpy.array', 'np.array', (['[[1, 1]]'], {}), '([[1, 1]])\n', (114, 124), True, 'import numpy as np\n'), ((143, 167), 'opytimizer.math.hypercomplex.norm', 'hypercomplex.norm', (['array'], {}), '(array)\n', (160, 167), False, 'from opytimizer.math import hypercomplex\n'), ((226, 259), 'numpy.array', 'np.a... |
import torch
from scipy.sparse.linalg import LinearOperator, cg
from typing import Callable, Optional
from torch import Tensor
import numpy as np
import time
class CG(torch.autograd.Function):
@staticmethod
def forward(ctx, z: Tensor, AcquisitionModel, beta: Tensor, y, G: Callable, GH: Callable, GHG: Optional[... | [
"numpy.prod",
"scipy.sparse.linalg.cg",
"time.time",
"torch.from_numpy"
] | [((1002, 1028), 'scipy.sparse.linalg.cg', 'cg', (['H', 'b'], {'tol': '(0.001)', 'x0': 'x0'}), '(H, b, tol=0.001, x0=x0)\n', (1004, 1028), False, 'from scipy.sparse.linalg import LinearOperator, cg\n'), ((1149, 1173), 'torch.from_numpy', 'torch.from_numpy', (['xprime'], {}), '(xprime)\n', (1165, 1173), False, 'import to... |
#! /usr/bin/env python
# Copyright (c) 2018 - 2019 <NAME> <<EMAIL>>
#
# 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... | [
"pythutils.fileutils.get_ext",
"pythutils.mathutils.sort_points",
"numpy.sqrt",
"cv2.getPerspectiveTransform",
"cv2.VideoWriter",
"os.path.isfile",
"numpy.array",
"cv2.warpPerspective",
"numpy.zeros",
"os.path.dirname",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"os.path.isdir",
"cv2.re... | [((2904, 2919), 'pythutils.fileutils.get_ext', 'get_ext', (['filein'], {}), '(filein)\n', (2911, 2919), False, 'from pythutils.fileutils import get_ext\n'), ((3084, 3115), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'mp4v'"], {}), "(*'mp4v')\n", (3106, 3115), False, 'import cv2\n'), ((3129, 3175), 'cv2.Vide... |
import kaldi_io
import numpy as np
import os
def get_parser():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("w2v_dir", help="wav2vec feature and text directory")
parser.add_argument("tar_root", help="output data directory in kaldi's format")
parser.add_argument(... | [
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"kaldi_io.open_or_fd",
"numpy.cumsum",
"kaldi_io.write_mat"
] | [((105, 130), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (128, 130), False, 'import argparse\n'), ((552, 591), 'os.path.join', 'os.path.join', (['args.tar_root', 'args.split'], {}), '(args.tar_root, args.split)\n', (564, 591), False, 'import os\n'), ((597, 632), 'os.makedirs', 'os.makedirs'... |
"""
Plot an all-sky average proper motion map, using statistics downloaded from the Gaia archive with a query similar to the
following:
select
gaia_healpix_index(5, source_id) as healpix_5,
avg(pmra) as avg_pmra,
avg(pmdec) as avg_pmdec
from gaiaedr3.gaia_source
where parallax_over_error>=10
and parallax*paralla... | [
"numpy.median",
"numpy.sqrt",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.pyplot.show",
"numpy.fliplr",
"cartopy.crs.Mollweide",
"matplotlib.pyplot.imread",
"cartopy.crs.PlateCarree",
"matplotlib.patches.ArrowStyle.Fancy",
"matplotlib.pyplot.figure",
"matplotlib.gridspe... | [((1082, 1100), 'cartopy.crs.PlateCarree', 'ccrs.PlateCarree', ([], {}), '()\n', (1098, 1100), True, 'import cartopy.crs as ccrs\n'), ((1116, 1132), 'cartopy.crs.Mollweide', 'ccrs.Mollweide', ([], {}), '()\n', (1130, 1132), True, 'import cartopy.crs as ccrs\n'), ((1147, 1217), 'matplotlib.pyplot.imread', 'plt.imread', ... |
#!/usr/bin/env python
# Copyright (c) 2019, The Personal Robotics Lab, The MuSHR Team, The Contributors of MuSHR
# License: BSD 3-Clause. See LICENSE.md file in root directory.
from threading import Lock
import numpy as np
import rospy
from std_msgs.msg import Float64
from vesc_msgs.msg import VescStateStamped
# Tu... | [
"numpy.random.normal",
"numpy.tan",
"threading.Lock",
"numpy.cos",
"numpy.sin",
"rospy.Subscriber"
] | [((3544, 3617), 'rospy.Subscriber', 'rospy.Subscriber', (['servo_state_topic', 'Float64', 'self.servo_cb'], {'queue_size': '(1)'}), '(servo_state_topic, Float64, self.servo_cb, queue_size=1)\n', (3560, 3617), False, 'import rospy\n'), ((3711, 3798), 'rospy.Subscriber', 'rospy.Subscriber', (['motor_state_topic', 'VescSt... |
from ase import Atoms
from ase.calculators.emt import EMT
from ase.io.trajectory import Trajectory
from ase.io import read
import numpy as np
import pandas as pd
import argparse
import copy
import os
import pdb
import pickle
from model_eval import model_evaluation
from gmp_feature_selection import backward_eliminati... | [
"model_eval.model_evaluation.dataset",
"gmp_feature_selection.backward_elimination.backward_elimination",
"numpy.log10",
"os.path.join",
"model_eval.model_evaluation.get_model_eval_params",
"ase.calculators.emt.EMT",
"numpy.linspace",
"numpy.random.seed",
"numpy.cos",
"numpy.random.uniform",
"nu... | [((419, 470), 'os.path.join', 'os.path.join', (['dir_prefix', '"""pace/parallel_workspace"""'], {}), "(dir_prefix, 'pace/parallel_workspace')\n", (431, 470), False, 'import os\n'), ((488, 522), 'os.path.join', 'os.path.join', (['dir_prefix', '"""output"""'], {}), "(dir_prefix, 'output')\n", (500, 522), False, 'import o... |
#!/usr/bin/python
"""
Run_long_script governs the running of long gazebo_ros_tensorflow simulations.
The core functionality lies in:
1. parsing the correct arguments at different levels (tensorflow dnn, gazebo environment, ros supervision)
2. different crash handling when for instance starting gazebo / tensorfl... | [
"shlex.split",
"yaml.load",
"time.sleep",
"sys.exit",
"numpy.sin",
"geometry_msgs.msg.Pose",
"os.remove",
"os.listdir",
"argparse.ArgumentParser",
"subprocess.Popen",
"rospy.ServiceProxy",
"os.path.isdir",
"subprocess.call",
"numpy.random.seed",
"gazebo_msgs.srv.SetModelStateRequest",
... | [((5271, 5653), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run_simulation_scripts governs the running of long gazebo_ros_tensorflow simulations.\n The core functionality lies in:\n 1. parsing the correct arguments at different levels (tensorflow dnn, gazebo environment,... |
import yfinance as yf
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from arch import arch_model
from volatility.utils import get_percent_chg
start = datetime(2000, 1, 1)
end = datetime(2020, 9, 11)
symbol = 'SPY'
tickerData = yf.Ticker(symbol)
df = tickerData.hist... | [
"datetime.datetime",
"pandas.Series",
"numpy.sqrt",
"arch.arch_model",
"volatility.utils.get_percent_chg",
"yfinance.Ticker",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((205, 225), 'datetime.datetime', 'datetime', (['(2000)', '(1)', '(1)'], {}), '(2000, 1, 1)\n', (213, 225), False, 'from datetime import datetime\n'), ((232, 253), 'datetime.datetime', 'datetime', (['(2020)', '(9)', '(11)'], {}), '(2020, 9, 11)\n', (240, 253), False, 'from datetime import datetime\n'), ((282, 299), 'y... |
import numpy as np
import random
import numexpr as ne
def gen_layer(rin, rout, nsize):
R = 1.0
phi = np.random.uniform(0, 2*np.pi, size=(nsize))
costheta = np.random.uniform(-1, 1, size=(nsize))
u = np.random.uniform(rin**3, rout**3, size=(nsize))
theta = np.arccos( costheta )... | [
"numpy.multiply",
"numpy.arccos",
"numexpr.evaluate",
"numpy.power",
"numpy.linalg.norm",
"numpy.max",
"numpy.square",
"numpy.array",
"numpy.zeros",
"numpy.isnan",
"numpy.true_divide",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin",
"numpy.cbrt",
"numpy.shape",
"py3Dmol.view"
] | [((119, 162), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(2 * np.pi)'], {'size': 'nsize'}), '(0, 2 * np.pi, size=nsize)\n', (136, 162), True, 'import numpy as np\n'), ((182, 218), 'numpy.random.uniform', 'np.random.uniform', (['(-1)', '(1)'], {'size': 'nsize'}), '(-1, 1, size=nsize)\n', (199, 218), True, 'i... |
"""Strategies for selecting actions for value-based policies."""
from abc import ABC, abstractmethod
from typing import List, Optional
from numpy.typing import ArrayLike
import numpy as np
from rl.action_selectors import (
ActionSelector,
DeterministicActionSelector,
UniformDiscreteActionSelector,
Nois... | [
"numpy.sqrt",
"numpy.random.default_rng",
"rl.action_selectors.DeterministicActionSelector",
"numpy.argmax",
"numpy.sum",
"rl.action_selectors.NoisyActionSelector",
"numpy.maximum"
] | [((996, 1031), 'numpy.random.default_rng', 'np.random.default_rng', (['random_state'], {}), '(random_state)\n', (1017, 1031), True, 'import numpy as np\n'), ((1317, 1359), 'rl.action_selectors.DeterministicActionSelector', 'DeterministicActionSelector', (['greedy_action'], {}), '(greedy_action)\n', (1344, 1359), False,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Program to denoise a short speech sample using a pre-trained autoencoder.
PATH_TO_TRAINED_MODEL : path to the pre-trained model (.h5)
PATH_TO_AUDIO : path to the noisy audio file (.wav)
PATH_TO_SAVE : path to save the denoised audio output (.wav)
@author: nk
"""
#%% ... | [
"numpy.reshape",
"librosa.griffinlim",
"soundfile.write",
"numpy.random.randint",
"tensorflow.keras.models.load_model",
"librosa.stft",
"librosa.load"
] | [((3027, 3084), 'soundfile.write', 'soundfile.write', (['PATH_TO_SAVE', 'denoised', 'dnae.SAMPLE_RATE'], {}), '(PATH_TO_SAVE, denoised, dnae.SAMPLE_RATE)\n', (3042, 3084), False, 'import soundfile\n'), ((1162, 1210), 'librosa.load', 'librosa.load', (['path_to_audio'], {'sr': 'self.SAMPLE_RATE'}), '(path_to_audio, sr=se... |
import numpy as np
import pytest
from respy import RespyCls
from respy.python.shared.shared_constants import IS_PARALLELISM_MPI
from respy.python.shared.shared_constants import IS_PARALLELISM_OMP
from respy.tests.codes.auxiliary import compare_est_log
from respy.tests.codes.auxiliary import simulate_observed
from resp... | [
"numpy.testing.assert_equal",
"respy.tests.codes.random_model.generate_random_model",
"respy.tests.codes.auxiliary.compare_est_log",
"numpy.random.randint",
"respy.RespyCls",
"pytest.mark.skipif",
"respy.tests.codes.auxiliary.simulate_observed"
] | [((379, 487), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not IS_PARALLELISM_MPI and not IS_PARALLELISM_OMP)'], {'reason': '"""No PARALLELISM available"""'}), "(not IS_PARALLELISM_MPI and not IS_PARALLELISM_OMP,\n reason='No PARALLELISM available')\n", (397, 487), False, 'import pytest\n'), ((940, 982), 'respy.t... |
import itertools
from typing import Any, Callable, Sequence, Tuple
import dill as pickle
import jax.numpy as np
import numpy as onp
import pandas as pd
from jax import grad, jit, ops, random
from jax.experimental.optimizers import Optimizer, adam
from pzflow import distributions
from pzflow.bijectors import Bijector_... | [
"jax.random.split",
"pzflow.utils.build_bijector_from_info",
"dill.load",
"jax.numpy.repeat",
"jax.random.PRNGKey",
"jax.numpy.hstack",
"jax.numpy.delete",
"jax.experimental.optimizers.adam",
"pandas.DataFrame",
"jax.numpy.nan_to_num",
"jax.numpy.where",
"dill.dump",
"numpy.isnan",
"jax.nu... | [((12923, 12959), 'jax.numpy.nan_to_num', 'np.nan_to_num', (['log_prob'], {'nan': 'np.NINF'}), '(log_prob, nan=np.NINF)\n', (12936, 12959), True, 'import jax.numpy as np\n'), ((34142, 34162), 'jax.random.PRNGKey', 'random.PRNGKey', (['seed'], {}), '(seed)\n', (34156, 34162), False, 'from jax import grad, jit, ops, rand... |
from math import pi
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.optimize import minimize_scalar
__author__ = "<NAME>"
__credits__ = ["<NAME>"]
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__version__ = "0.1"
__license__ = "MIT"
# gravitational acceleration
g = 9.81 # m/s²
#... | [
"numpy.sqrt",
"numpy.append",
"numpy.array",
"matplotlib.pyplot.close",
"numpy.interp",
"pandas.DataFrame",
"numpy.logspace",
"matplotlib.pyplot.subplots",
"pandas.notna"
] | [((1168, 1180), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1176, 1180), True, 'import numpy as np\n'), ((1620, 1801), 'numpy.array', 'np.array', (['[0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.125, 0.15, 0.2, 0.25, 0.3,\n 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, \n 1.8, ... |
from __future__ import division, print_function
import os
import os.path as fs
import numpy as np
import pandas as pd
import re
### PURPOSE: Takes a directory containing N files of the form mXXXXXX.ovf ###
### and imports them to an N x X x Y x Z x 3 numpy array ###
### where X,Y,Z are the number of cells in x,y... | [
"numpy.mean",
"os.listdir",
"pandas.read_csv",
"os.path.join",
"re.match",
"numpy.floor",
"numpy.append",
"numpy.empty"
] | [((1449, 1518), 'numpy.empty', 'np.empty', (['(num_files_to_import, data_dimensions[2])'], {'dtype': '(float, 3)'}), '((num_files_to_import, data_dimensions[2]), dtype=(float, 3))\n', (1457, 1518), True, 'import numpy as np\n'), ((3116, 3204), 'pandas.read_csv', 'pd.read_csv', (['this_filename'], {'header': 'None', 'sk... |
# -*- coding: utf-8 -*-
#
# Implementation of Granger-Geweke causality
#
#
# Builtin/3rd party package imports
import numpy as np
def granger(CSD, Hfunc, Sigma):
"""
Computes the pairwise Granger-Geweke causalities
for all (non-symmetric!) channel combinations
according to Equation 8 in [1]_.
The... | [
"numpy.abs",
"numpy.log",
"numpy.ones"
] | [((1711, 1731), 'numpy.abs', 'np.abs', (['auto_spectra'], {}), '(auto_spectra)\n', (1717, 1731), True, 'import numpy as np\n'), ((2119, 2134), 'numpy.abs', 'np.abs', (['Sigma.T'], {}), '(Sigma.T)\n', (2125, 2134), True, 'import numpy as np\n'), ((2475, 2495), 'numpy.log', 'np.log', (['(Smat / denom)'], {}), '(Smat / de... |
# Matplotlib
# 파이썬 데이터과학 관련 시각화 페키지
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
#%matplotlib inline # 주피터 노트북에서 show() 호출없이도
# 그래프를 그릴수 있게 해 줌
# data = np.arange(10)
# plt.plot(data)
# plt.show()
# 산점도 - 100의 표준정규분포 난수 생성
list = []
for i in range(100): # 0 ... | [
"numpy.random.normal",
"scipy.stats.pearsonr",
"matplotlib.pyplot.plot",
"scipy.stats.ttest_ind",
"matplotlib.rc",
"pandas.read_excel",
"matplotlib.pyplot.show"
] | [((550, 580), 'matplotlib.pyplot.plot', 'plt.plot', (['x_data', 'y_data', '"""ro"""'], {}), "(x_data, y_data, 'ro')\n", (558, 580), True, 'import matplotlib.pyplot as plt\n'), ((582, 592), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (590, 592), True, 'import matplotlib.pyplot as plt\n'), ((617, 654), 'panda... |
# -*- coding: utf-8 -*-
import unittest
import numpy as np
import torch
from comet.metrics import RegressionReport, WMTKendall
class TestMetrics(unittest.TestCase):
def test_regression_report(self):
report = RegressionReport()
a = np.array([0, 0, 0, 1, 1, 1, 1])
b = np.arange(7)
... | [
"comet.metrics.RegressionReport",
"numpy.array",
"torch.tensor",
"comet.metrics.WMTKendall",
"numpy.arange"
] | [((224, 242), 'comet.metrics.RegressionReport', 'RegressionReport', ([], {}), '()\n', (240, 242), False, 'from comet.metrics import RegressionReport, WMTKendall\n'), ((255, 286), 'numpy.array', 'np.array', (['[0, 0, 0, 1, 1, 1, 1]'], {}), '([0, 0, 0, 1, 1, 1, 1])\n', (263, 286), True, 'import numpy as np\n'), ((299, 31... |
#!/usr/bin/env python
from redis import Redis
import uuid
import sys
import os
import subprocess
import shutil
import numpy as np
import itertools as it
import json
from rdkit import Chem
from rdkit.Chem import AllChem, ChemicalForceFields
redis = Redis.from_url("redis://" + os.environ.get("EXECUTOR_C... | [
"rdkit.Chem.MolFromMolBlock",
"itertools.product",
"json.dumps",
"os.environ.get",
"rdkit.Chem.ChemicalForceFields.MMFFGetMoleculeForceField",
"rdkit.Chem.ChemicalForceFields.MMFFGetMoleculeProperties",
"numpy.arange"
] | [((760, 804), 'rdkit.Chem.MolFromMolBlock', 'Chem.MolFromMolBlock', (['sdfstr'], {'removeHs': '(False)'}), '(sdfstr, removeHs=False)\n', (780, 804), False, 'from rdkit import Chem\n'), ((818, 868), 'rdkit.Chem.ChemicalForceFields.MMFFGetMoleculeProperties', 'ChemicalForceFields.MMFFGetMoleculeProperties', (['mol'], {})... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 09:36:07 2015
@author: Ben
"""
from shared_classes import Stock, StockItem, SpecifiedStock
from datamapfunctions import DataMapFunctions, Abstract
import util
import numpy as np
import config as cfg
class SupplyStock(Stock, StockItem):
def __init__(se... | [
"datamapfunctions.DataMapFunctions.__init__",
"numpy.repeat",
"shared_classes.SpecifiedStock.__init__",
"numpy.any",
"util.expand_multi",
"numpy.sum",
"shared_classes.StockItem.__init__",
"util.remove_df_levels",
"datamapfunctions.Abstract.__init__",
"util.unit_convert",
"numpy.nonzero",
"util... | [((458, 590), 'shared_classes.Stock.__init__', 'Stock.__init__', (['self', 'id', 'drivers'], {'sql_id_table': '"""SupplyStock"""', 'sql_data_table': '"""SupplyStockData"""', 'primary_key': '"""node_id"""'}), "(self, id, drivers, sql_id_table='SupplyStock',\n sql_data_table='SupplyStockData', primary_key='node_id', *... |
import numpy as np
import networkx as nx
import argparse
import random
from models.distance import get_dist_func
def get_fitness(solution, initial_node, node_list):
"""
Get fitness of solution encoded by permutation.
Args:
solution (numpy.ndarray): Solution encoded as a permutation
ini... | [
"numpy.ones_like",
"numpy.ceil",
"numpy.mean",
"numpy.random.rand",
"argparse.ArgumentParser",
"numpy.hstack",
"numpy.random.choice",
"numpy.in1d",
"models.distance.get_dist_func",
"numpy.max",
"numpy.sum",
"numpy.empty",
"numpy.min",
"networkx.read_gpickle",
"numpy.zeros_like",
"netwo... | [((601, 636), 'numpy.hstack', 'np.hstack', (['(solution, initial_node)'], {}), '((solution, initial_node))\n', (610, 636), True, 'import numpy as np\n'), ((10915, 11017), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Approximate solution to TSP using ant colony optimization."""'}), "(de... |
'''
Analytic Hierarchy Process, AHP.
Base on Wasserstein distance
'''
from scipy.stats import wasserstein_distance
from sklearn.decomposition import PCA
import scipy
import numpy as np
import pandas as pd
import sys
import argparse
import os
import glob
import datasets_analysis_module as dam
class idx_analysis(obje... | [
"pandas.read_csv",
"numpy.array",
"numpy.arange",
"os.path.exists",
"sklearn.linear_model.RidgeClassifier",
"numpy.reshape",
"argparse.ArgumentParser",
"sklearn.decomposition.PCA",
"numpy.max",
"os.path.split",
"scipy.stats.wasserstein_distance",
"numpy.vstack",
"numpy.round",
"datasets_an... | [((1918, 1936), 'numpy.round', 'np.round', (['w_dis', '(4)'], {}), '(w_dis, 4)\n', (1926, 1936), True, 'import numpy as np\n'), ((4358, 4388), 'sklearn.linear_model.RidgeClassifier', 'linear_model.RidgeClassifier', ([], {}), '()\n', (4386, 4388), False, 'from sklearn import linear_model\n'), ((4600, 4616), 'sklearn.pre... |
import os
import argparse
import json
from datetime import datetime
import numpy as np
from sklearn.utils.class_weight import compute_class_weight
from sklearn.metrics import balanced_accuracy_score
from sklearn.metrics import confusion_matrix
from tensorflow import keras
from tensorflow.keras.callbacks import EarlySto... | [
"sklearn.metrics.balanced_accuracy_score",
"bert.load_bert_weights",
"tensorflow.keras.callbacks.EarlyStopping",
"onecycle.OneCycleScheduler",
"tensorflow.keras.layers.Dense",
"amazon.get_reviews_data",
"os.path.exists",
"tensorflow.keras.layers.Input",
"bert.BertModelLayer.from_params",
"tensorfl... | [((627, 652), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (650, 652), False, 'import argparse\n'), ((3962, 4000), 'os.path.join', 'os.path.join', (['log_dir', 'experiment_name'], {}), '(log_dir, experiment_name)\n', (3974, 4000), False, 'import os\n'), ((4012, 4040), 'os.path.join', 'os.path... |
# -*- coding: utf-8 -*-
import gensim
import numpy as np
from sklearn.cluster import MiniBatchKMeans
def read_data_batches(path, batch_size=50, minlength=5):
"""
Reading batched texts of given min. length
:param path: path to the text file ``one line -- one normalized sentence''
:return: batches i... | [
"gensim.models.Word2Vec.load",
"sklearn.cluster.MiniBatchKMeans",
"numpy.asarray",
"numpy.stack",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.matrix"
] | [((1577, 1610), 'gensim.models.Word2Vec.load', 'gensim.models.Word2Vec.load', (['path'], {}), '(path)\n', (1604, 1610), False, 'import gensim\n'), ((2729, 2793), 'sklearn.cluster.MiniBatchKMeans', 'MiniBatchKMeans', ([], {'n_clusters': 'aspects_count', 'verbose': '(0)', 'n_init': '(100)'}), '(n_clusters=aspects_count, ... |
from __future__ import absolute_import
import os
import errno
import numpy as np
def mkdir_if_missing(dir_path):
try:
os.makedirs(dir_path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
def get_free_gpu():
os.system('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >... | [
"os.system",
"numpy.argmax",
"os.makedirs"
] | [((260, 325), 'os.system', 'os.system', (['"""nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp"""'], {}), "('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp')\n", (269, 325), False, 'import os\n'), ((494, 521), 'numpy.argmax', 'np.argmax', (['memory_available'], {}), '(memory_available)\n', (503, 521), True, '... |
# -*- coding: utf-8 -*-
"""
Low level tool for writing percent difference reports. Typically, this
is called via: :func:`cla.DR_Results.rptpct`.
"""
from io import StringIO
from types import SimpleNamespace
import warnings
import numpy as np
import matplotlib.pyplot as plt
from pyyeti import ytools, locate, writer
from... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.interactive",
"pyyeti.writer.vecwrite",
"numpy.arange",
"numpy.atleast_2d",
"pyyeti.locate.list_intersect",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.close",
"pyyeti.writer.formheader",
"io.StringIO",
"pyyeti.locate.... | [((514, 548), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'legacy': '"""1.13"""'}), "(legacy='1.13')\n", (533, 548), True, 'import numpy as np\n'), ((933, 953), 'numpy.atleast_1d', 'np.atleast_1d', (['value'], {}), '(value)\n', (946, 953), True, 'import numpy as np\n'), ((7410, 7450), 'pyyeti.ytools.histogra... |
import torch.nn as nn
import numpy as np
import torch
import os
from detectron2.config import get_cfg
from detectron2.engine import DefaultTrainer, default_argument_parser, default_setup, launch
from detectron2.evaluation import COCOEvaluator, verify_results
from yolov3 import add_yolov3_config
def load_darknet_wei... | [
"numpy.fromfile",
"yolov3.add_yolov3_config",
"detectron2.config.get_cfg",
"detectron2.engine.DefaultTrainer.build_model",
"os.path.join",
"torch.from_numpy",
"detectron2.engine.launch",
"detectron2.engine.default_setup",
"detectron2.engine.default_argument_parser"
] | [((2929, 2938), 'detectron2.config.get_cfg', 'get_cfg', ([], {}), '()\n', (2936, 2938), False, 'from detectron2.config import get_cfg\n'), ((2943, 2965), 'yolov3.add_yolov3_config', 'add_yolov3_config', (['cfg'], {}), '(cfg)\n', (2960, 2965), False, 'from yolov3 import add_yolov3_config\n'), ((3064, 3088), 'detectron2.... |
import matplotlib.pyplot as plt
import numpy as np
import cv2
from skimage.data import astronaut
from skimage.color import rgb2gray
from skimage.filters import sobel
from skimage.segmentation import felzenszwalb, slic, quickshift, watershed
from skimage.segmentation import mark_boundaries
from skimage.util import img_... | [
"skimage.color.rgb2gray",
"skimage.segmentation.mark_boundaries",
"numpy.unique",
"matplotlib.pyplot.show",
"skimage.segmentation.watershed",
"skimage.segmentation.felzenszwalb",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.tight_layout",
"skimage.segmentation.quickshift",
"skimage.segmentatio... | [((425, 447), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (435, 447), False, 'import cv2\n'), ((507, 559), 'skimage.segmentation.felzenszwalb', 'felzenszwalb', (['img'], {'scale': '(100)', 'sigma': '(0.5)', 'min_size': '(50)'}), '(img, scale=100, sigma=0.5, min_size=50)\n', (519, 559), False, 'f... |
import pytest
from hyperloop.Python.mission import lat_long
import numpy as np
from openmdao.api import Group, Problem
def create_problem(component):
root = Group()
prob = Problem(root)
prob.root.add('comp', component)
return prob
class TestMissionDrag(object):
def test_case1_vs_npss(self):
... | [
"hyperloop.Python.mission.lat_long.LatLong",
"numpy.isclose",
"openmdao.api.Problem",
"openmdao.api.Group"
] | [((162, 169), 'openmdao.api.Group', 'Group', ([], {}), '()\n', (167, 169), False, 'from openmdao.api import Group, Problem\n'), ((181, 194), 'openmdao.api.Problem', 'Problem', (['root'], {}), '(root)\n', (188, 194), False, 'from openmdao.api import Group, Problem\n'), ((338, 356), 'hyperloop.Python.mission.lat_long.Lat... |
from pyqchem.structure import Structure
import numpy as np
# Ethene parallel position
def dimer_ethene(distance, slide_y, slide_z):
coordinates = [[0.0000000, 0.0000000, 0.6660120],
[0.0000000, 0.0000000, -0.6660120],
[0.0000000, 0.9228100, 1.2279200],
... | [
"numpy.array",
"pyqchem.structure.Structure",
"numpy.vstack"
] | [((826, 847), 'numpy.array', 'np.array', (['coordinates'], {}), '(coordinates)\n', (834, 847), True, 'import numpy as np\n'), ((1048, 1109), 'pyqchem.structure.Structure', 'Structure', ([], {'coordinates': 'coordinates', 'symbols': 'symbols', 'charge': '(0)'}), '(coordinates=coordinates, symbols=symbols, charge=0)\n', ... |
#!/usr/bin/env python3
"""
Adaptive Affine Control:
My favorite myopic (not MPC, DP, or RL) control-law when absolutely nothing is known about your system except
that the control is additive and fully-actuated:
```
dx/dt = f(x,t) + u # drift f unknown, state x at time t known, choose control u to make x=r
u = W... | [
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.outer",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1963, 1986), 'numpy.arange', 'np.arange', (['(0.0)', '(3.0)', 'dt'], {}), '(0.0, 3.0, dt)\n', (1972, 1986), True, 'import numpy as np\n'), ((2473, 2488), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {}), '()\n', (2486, 2488), False, 'from matplotlib import pyplot\n'), ((3051, 3064), 'matplotlib.pyplot.show', 'p... |
#!/usr/bin/python3.7
#Author: <NAME>
import sys
import os
import math
import re
import numpy as np
#print('usage: <>.py <file.pdb> \nexecute nsc to generate point-based surface and create tables and if verbose==1 files dotslabel1.xyzrgb dotslabel2.xyzrgb dotslabel3.xyzrgb and dotslabel4.xyzrgb\n')
def pdbsurface(f... | [
"math.sqrt",
"numpy.array",
"numpy.empty",
"numpy.vstack",
"os.system",
"os.remove"
] | [((776, 847), 'numpy.array', 'np.array', (['[[0, 0, 0], [0.9, 0.9, 0.9], [1, 0, 0], [0, 1, 0], [0, 0, 1]]'], {}), '([[0, 0, 0], [0.9, 0.9, 0.9], [1, 0, 0], [0, 1, 0], [0, 0, 1]])\n', (784, 847), True, 'import numpy as np\n'), ((3459, 3473), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (3468, 3473), False, 'impor... |
"""
Test script for utils.py function.
"""
import os
import numpy as np
import pytest
from astropy import units as u
from cwinpy.utils import (
ellipticity_to_q22,
gcd_array,
get_psr_name,
initialise_ephemeris,
int_to_alpha,
is_par_file,
logfactorial,
q22_to_ellipticity,
)
from lalpuls... | [
"cwinpy.utils.int_to_alpha",
"numpy.allclose",
"numpy.isclose",
"numpy.sqrt",
"astropy.units.Unit",
"numpy.log",
"cwinpy.utils.q22_to_ellipticity",
"os.remove",
"numpy.array",
"cwinpy.utils.is_par_file",
"cwinpy.utils.ellipticity_to_q22",
"pytest.raises",
"lalpulsar.PulsarParametersWrapper.P... | [((2618, 2648), 'cwinpy.utils.ellipticity_to_q22', 'ellipticity_to_q22', (['epsilon[0]'], {}), '(epsilon[0])\n', (2636, 2648), False, 'from cwinpy.utils import ellipticity_to_q22, gcd_array, get_psr_name, initialise_ephemeris, int_to_alpha, is_par_file, logfactorial, q22_to_ellipticity\n'), ((2661, 2693), 'numpy.isclos... |
#BSD 3-Clause License
#
#Copyright (c) 2019, The Regents of the University of Minnesota
#
#All rights reserved.
#
#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 must retain the above cop... | [
"create_template.define_templates",
"random.uniform",
"simulated_annealer.simulated_annealer",
"numpy.zeros",
"numpy.savetxt",
"T6_PSI_settings.T6_PSI_settings.load_obj",
"numpy.genfromtxt"
] | [((2165, 2191), 'T6_PSI_settings.T6_PSI_settings.load_obj', 'T6_PSI_settings.load_obj', ([], {}), '()\n', (2189, 2191), False, 'from T6_PSI_settings import T6_PSI_settings\n'), ((3075, 3119), 'create_template.define_templates', 'define_templates', (['settings_obj'], {'generate_g': '(0)'}), '(settings_obj, generate_g=0)... |
import numpy as np
class SequenceTools(object):
dna2gray_ = {'c': (0, 0), 't': (1, 0), 'g': (1, 1), 'a': (0, 1)}
gray2dna_ = {(0, 0): 'c', (1, 0): 't', (1, 1): 'g', (0, 1): 'a'}
codon2protein_ = {'ttt': 'f', 'ttc': 'f', 'tta': 'l', 'ttg': 'l', 'tct': 's', 'tcc': 's', 'tca': 's',
'tc... | [
"numpy.zeros",
"numpy.argmax"
] | [((5834, 5850), 'numpy.zeros', 'np.zeros', (['(N, 4)'], {}), '((N, 4))\n', (5842, 5850), True, 'import numpy as np\n'), ((6192, 6212), 'numpy.zeros', 'np.zeros', (['(2 * N, 2)'], {}), '((2 * N, 2))\n', (6200, 6212), True, 'import numpy as np\n'), ((7051, 7071), 'numpy.zeros', 'np.zeros', (['(2 * N, 2)'], {}), '((2 * N,... |
import subprocess
lib_list = ['numpy','ymmsl','sobol_seq','csv','seaborn','zenodo_get']
for lib_name in lib_list:
try:
import lib_name
except ImportError:
if lib_name == 'csv':
print(lib_name,' Module not installed')
subprocess.run(['pip','install','python-csv'])
else:
print(lib_name,' Module not inst... | [
"ymmsl.load",
"ymmsl.save",
"ymmsl.Configuration",
"subprocess.run",
"os.mkdir",
"numpy.savetxt",
"sobol_seq.i4_sobol_generate"
] | [((3344, 3398), 'sobol_seq.i4_sobol_generate', 'sobol_seq.i4_sobol_generate', (['num_uncer_para', 'NumSample'], {}), '(num_uncer_para, NumSample)\n', (3371, 3398), False, 'import sobol_seq\n'), ((3446, 3468), 'numpy.savetxt', 'np.savetxt', (['"""A.csv"""', 'A'], {}), "('A.csv', A)\n", (3456, 3468), True, 'import numpy ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import numpy as np
from matrixprofile import core
from ma... | [
"matrixprofile.core.is_array_like",
"matrixprofile.io.protobuf.proto_messages_pb2.Location",
"matrixprofile.core.is_pmp_obj",
"numpy.array",
"matrixprofile.io.protobuf.proto_messages_pb2.Motif",
"matrixprofile.core.is_mp_obj",
"matrixprofile.io.protobuf.proto_messages_pb2.MPFOutput"
] | [((1392, 1415), 'matrixprofile.core.is_mp_obj', 'core.is_mp_obj', (['profile'], {}), '(profile)\n', (1406, 1415), False, 'from matrixprofile import core\n'), ((2035, 2042), 'matrixprofile.io.protobuf.proto_messages_pb2.Motif', 'Motif', ([], {}), '()\n', (2040, 2042), False, 'from matrixprofile.io.protobuf.proto_message... |
# Code to transform the driver sensor OGMs to the ego vehicle's OGM frame of reference.
import matplotlib.pyplot as plt
import numpy as np
import math
import copy
from utils.grid_utils import global_grid
import time
from scipy.spatial import cKDTree
import pdb
def mask_in_EgoGrid(global_grid_x, global_grid_y, ref_xy,... | [
"numpy.ones",
"scipy.spatial.cKDTree",
"numpy.where",
"numpy.floor",
"numpy.any",
"numpy.array",
"copy.copy"
] | [((501, 519), 'numpy.where', 'np.where', (['mask_unk'], {}), '(mask_unk)\n', (509, 519), True, 'import numpy as np\n'), ((1460, 1483), 'scipy.spatial.cKDTree', 'cKDTree', (['ref_global_ind'], {}), '(ref_global_ind)\n', (1467, 1483), False, 'from scipy.spatial import cKDTree\n'), ((3095, 3126), 'numpy.any', 'np.any', ([... |
# chapter Matplotlib Plotting
'''
The plot() function is used to draw points (markers) in a diagram.
By default, the plot() function draws a line from point to point.
The function takes parameters for specifying points in the diagram.
Parameter 1 is an array containing the points on the x-axis.
Paramet... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"numpy.array",
"sys.stdout.flush",
"matplotlib.pyplot.show"
] | [((646, 661), 'numpy.array', 'r.array', (['[1, 9]'], {}), '([1, 9])\n', (653, 661), True, 'import numpy as r\n'), ((665, 681), 'numpy.array', 'r.array', (['[4, 10]'], {}), '([4, 10])\n', (672, 681), True, 'import numpy as r\n'), ((684, 698), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (692, 698)... |
# -*- coding: utf-8 -*-
"""
Make figures for MUSim paper
AUTHOR: <NAME>
VERSION DATE: 26 June 2019
"""
import os
from os.path import join
import numpy as np
import pandas as pd
from statsmodels.stats.proportion import proportion_confint
import matplotlib.pyplot as plt
def binom_ci_precision(proporti... | [
"os.listdir",
"numpy.sqrt",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"statsmodels.stats.proportion.proportion_confint",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"os.path.join",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.ylim",
"matplotlib.pypl... | [((480, 539), 'statsmodels.stats.proportion.proportion_confint', 'proportion_confint', (['count', 'nobs'], {'method': 'method', 'alpha': 'alpha'}), '(count, nobs, method=method, alpha=alpha)\n', (498, 539), False, 'from statsmodels.stats.proportion import proportion_confint\n'), ((1754, 1787), 'matplotlib.pyplot.xticks... |
from __future__ import print_function
from argparse import ArgumentParser
from fastai.learner import *
from fastai.column_data import *
import numpy as np
import pandas as pd
def build_parser():
parser = ArgumentParser()
parser.add_argument('--data', type=str, nargs=None, dest='in_path', help='input file pa... | [
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.array",
"pandas.DataFrame",
"pandas.melt"
] | [((211, 227), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (225, 227), False, 'from argparse import ArgumentParser\n'), ((1605, 1694), 'pandas.read_csv', 'pd.read_csv', (['in_path'], {'sep': '""","""', 'low_memory': '(False)', 'index_col': '[0]', 'error_bad_lines': '(False)'}), "(in_path, sep=',', low... |
# %%
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from model.inceptionv4 import inceptionv4
from model.mobilenetv2 import mobilenetv2
from model.resnet import resnet18
from model.shufflenetv2 imp... | [
"sklearn.metrics.accuracy_score",
"s3_dataset.PlantDataSetB",
"numpy.arange",
"torch.load",
"torch.max",
"numpy.array",
"torch.cuda.is_available",
"s3_dataset.PlantDataSet",
"torch.no_grad",
"matplotlib.pyplot.matshow",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.rc",
"matplotlib.pyplot... | [((7200, 7234), 'matplotlib.pyplot.matshow', 'plt.matshow', (['cm'], {'cmap': 'plt.cm.Blues'}), '(cm, cmap=plt.cm.Blues)\n', (7211, 7234), True, 'import matplotlib.pyplot as plt\n'), ((2225, 2249), 's3_dataset.PlantDataSet', 'PlantDataSet', ([], {'flag': '"""val"""'}), "(flag='val')\n", (2237, 2249), False, 'from s3_da... |
import numpy as np
import json
import re
from Utils import *
np.random.seed(4)
def output_process(example):
state = e['state'][-1]
if type(state) == str:
return state
else:
return ' '.join(state)
def polish_notation(steps):
step_mapping = {}
for ix, s in enumerate(steps):
... | [
"re.findall",
"numpy.random.seed",
"numpy.random.shuffle"
] | [((62, 79), 'numpy.random.seed', 'np.random.seed', (['(4)'], {}), '(4)\n', (76, 79), True, 'import numpy as np\n'), ((5577, 5600), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (5594, 5600), True, 'import numpy as np\n'), ((335, 360), 're.findall', 're.findall', (['"""@@\\\\d+@@"""', 's'], {}... |
from cv2 import cv2
import numpy as np
import sys
import os
from base import normalize
# some parameters of training and testing data
train_sub_count = 40
train_img_count = 5
total_face = 200
row = 70
col = 70
def eigenfaces_train(src_path):
img_list = np.empty((row*col, total_face))
count = 0
... | [
"numpy.mat",
"cv2.cv2.imread",
"numpy.argsort",
"numpy.sum",
"numpy.array",
"numpy.empty",
"numpy.linalg.eigh",
"numpy.matrix"
] | [((273, 306), 'numpy.empty', 'np.empty', (['(row * col, total_face)'], {}), '((row * col, total_face))\n', (281, 306), True, 'import numpy as np\n'), ((803, 836), 'numpy.empty', 'np.empty', (['(row * col, total_face)'], {}), '((row * col, total_face))\n', (811, 836), True, 'import numpy as np\n'), ((1048, 1067), 'numpy... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
T = 200
h = 1e-2
t = np.arange(start=0, stop=T + h, step=h)
bet, gam = 0.15, 1 / 50
# todo: zmienic poziej na randoma
# S_pocz = np.random.uniform(0.7, 1)
S_start = 0.8
I_start = 1 - S_start
R_start = 0
N = S_start + I_start + R_sta... | [
"scipy.integrate.odeint",
"numpy.log",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((108, 146), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': '(T + h)', 'step': 'h'}), '(start=0, stop=T + h, step=h)\n', (117, 146), True, 'import numpy as np\n'), ((1261, 1308), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)', 'figsize': '(10, 4)'}), '(nrows=1, ncols=1, ... |
import numpy as np
from skfuzzy import cmeans
from config import NAN, FCMParam
class FCMeansEstimator:
def __init__(self, c, m, data):
self.c = c
self.m = m
self.data = data
self.complete_rows, self.incomplete_rows = self.__extract_rows()
# Extract complete and incomplete row... | [
"numpy.where",
"numpy.array",
"numpy.power",
"numpy.linalg.norm"
] | [((873, 925), 'numpy.array', 'np.array', (['[self.data[x] for x in self.complete_rows]'], {}), '([self.data[x] for x in self.complete_rows])\n', (881, 925), True, 'import numpy as np\n'), ((2284, 2308), 'numpy.array', 'np.array', (['estimated_data'], {}), '(estimated_data)\n', (2292, 2308), True, 'import numpy as np\n'... |
import sim
import utils
import numpy as np
import matplotlib.pyplot as plt
import argparse
def main():
my_parser = argparse.ArgumentParser(description='Parameters for Simulation')
my_parser.add_argument('-N', '--n_cars', type=int, action='store', help='Number of cars', default = 40)
my_parser.add_argumen... | [
"sim.populate_arrays",
"utils.plot_simulation",
"argparse.ArgumentParser",
"utils.estimate_flow",
"sim.run_simulation",
"numpy.zeros",
"matplotlib.pyplot.show"
] | [((122, 186), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parameters for Simulation"""'}), "(description='Parameters for Simulation')\n", (145, 186), False, 'import argparse\n'), ((744, 755), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (752, 755), True, 'import numpy as np\n'), (... |
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from transformers import BertTokenizer, BertForQuestionAnswering, BertConfig
from captum.attr import visualization as viz
from captum.attr import LayerConductance, LayerIntegratedGradients
... | [
"matplotlib.pyplot.ylabel",
"torch.softmax",
"numpy.array",
"torch.cuda.is_available",
"numpy.linalg.norm",
"torch.arange",
"numpy.divide",
"numpy.arange",
"numpy.histogram",
"captum.attr.LayerIntegratedGradients",
"matplotlib.pyplot.xlabel",
"IPython.display.Image",
"captum.attr.visualizati... | [((440, 492), 'transformers.BertForQuestionAnswering.from_pretrained', 'BertForQuestionAnswering.from_pretrained', (['model_path'], {}), '(model_path)\n', (480, 492), False, 'from transformers import BertTokenizer, BertForQuestionAnswering, BertConfig\n'), ((554, 595), 'transformers.BertTokenizer.from_pretrained', 'Ber... |
# -*- coding: UTF-8 -*-
from unittest import TestCase
class TestNumpy(TestCase):
def test_dot(self):
from numpy import array, dot
A = array([[1,2],[3,4]], dtype='int32')
B = array([[5,6],[7,8]], dtype='int32')
R = array([[19,22],[43,50]], dtype='int32')
for val in (dot(A,B... | [
"numpy.array",
"numpy.dot",
"numpy.linalg.inv",
"numpy.linalg.eig"
] | [((157, 195), 'numpy.array', 'array', (['[[1, 2], [3, 4]]'], {'dtype': '"""int32"""'}), "([[1, 2], [3, 4]], dtype='int32')\n", (162, 195), False, 'from numpy import array, dot\n'), ((205, 243), 'numpy.array', 'array', (['[[5, 6], [7, 8]]'], {'dtype': '"""int32"""'}), "([[5, 6], [7, 8]], dtype='int32')\n", (210, 243), F... |
# coding=utf-8
# Copyright 2022 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... | [
"symbolic_functionals.syfes.symbolic.enhancement_factors.f_b97_x2_short.eval",
"numpy.random.rand",
"symbolic_functionals.syfes.symbolic.enhancement_factors.f_cos_wb97mv_short.make_isomorphic_copy",
"symbolic_functionals.syfes.symbolic.enhancement_factors.f_b97_x2_short.get_symbolic_expression",
"symbolic_f... | [((1008, 1049), 'jax.config.update', 'jax.config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (1025, 1049), False, 'import jax\n'), ((6022, 6059), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(False)', '(True)'], {}), '(False, True)\n', (6046, 6059), False,... |
#!/usr/bin/env python
# coding: utf-8
# # Developing an AI application
#
# Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smart phone app. To do this, you'd use a deep learning model trained on hundreds of tho... | [
"numpy.clip",
"torch.nn.ReLU",
"tarfile.open",
"torch.nn.Dropout",
"torch.exp",
"torch.from_numpy",
"numpy.array",
"os.walk",
"seaborn.color_palette",
"torchvision.datasets.ImageFolder",
"subprocess.call",
"torchvision.transforms.ToTensor",
"torchvision.transforms.RandomResizedCrop",
"torc... | [((5005, 5064), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', (['train_dir'], {'transform': 'train_transforms'}), '(train_dir, transform=train_transforms)\n', (5025, 5064), False, 'from torchvision import datasets, transforms, models\n'), ((5077, 5134), 'torchvision.datasets.ImageFolder', 'datasets.ImageF... |
from model import efficientdet
import cv2
import os
import numpy as np
import time
from utils import preprocess_image
from utils.anchors import anchors_for_shape
from utils.draw_boxes import draw_boxes
from utils.post_process_boxes import post_process_boxes
def main():
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
... | [
"utils.preprocess_image",
"utils.anchors.anchors_for_shape",
"numpy.where",
"utils.draw_boxes.draw_boxes",
"utils.post_process_boxes.post_process_boxes",
"cv2.imshow",
"numpy.squeeze",
"cv2.waitKey",
"numpy.random.randint",
"model.efficientdet",
"numpy.expand_dims",
"time.time",
"cv2.namedWi... | [((921, 1036), 'model.efficientdet', 'efficientdet', ([], {'phi': 'phi', 'weighted_bifpn': 'weighted_bifpn', 'num_classes': 'num_classes', 'score_threshold': 'score_threshold'}), '(phi=phi, weighted_bifpn=weighted_bifpn, num_classes=\n num_classes, score_threshold=score_threshold)\n', (933, 1036), False, 'from model... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.