code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import cv2
import numpy as np
from keras.models import model_from_json
from keras.preprocessing.image import img_to_array
#load model
model = model_from_json(open("fer.json", "r").read()) #change the path accoring to files
#load weights
model.load_weights('fer.h5') #change the path accor... | [
"cv2.rectangle",
"keras.preprocessing.image.img_to_array",
"cv2.imshow",
"cv2.putText",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"numpy.expand_dims",
"cv2.CascadeClassifier",
"cv2.resize",
"cv2.waitKey"
] | [((472, 515), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['detection_model_path'], {}), '(detection_model_path)\n', (493, 515), False, 'import cv2\n'), ((564, 583), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (580, 583), False, 'import cv2\n'), ((1747, 1770), 'cv2.destroyAllWindows', 'cv2.de... |
# copyright (c) 2018 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 app... | [
"numpy.product",
"paddle.fluid.DataFeeder",
"paddle.nn.layer.ReLU",
"paddle.fluid.dygraph.guard",
"paddle.fluid.dygraph.to_variable",
"paddle.static.InputSpec",
"paddle.fluid.layers.cross_entropy",
"paddle.fluid.layers.data",
"numpy.array",
"paddle.fluid.Executor",
"paddle.fluid.log_helper.get_l... | [((1541, 1563), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (1561, 1563), False, 'import paddle\n'), ((1596, 1624), 'paddle.fluid.core.is_compiled_with_cuda', 'core.is_compiled_with_cuda', ([], {}), '()\n', (1622, 1624), False, 'from paddle.fluid import core\n'), ((1694, 1779), 'paddle.fluid.log_h... |
import os
import glob
import shutil
import yaml
from IPython import embed
import pytest
import numpy as np
from pypeit.par.util import parse_pypeit_file
from pypeit.pypeitsetup import PypeItSetup
from pypeit.tests.tstutils import dev_suite_required, data_path
from pypeit.metadata import PypeItMetaData
from pypeit.s... | [
"pypeit.scripts.setup.Setup.main",
"numpy.where",
"os.path.join",
"yaml.load",
"pypeit.par.util.parse_pypeit_file",
"os.path.isfile",
"pypeit.tests.tstutils.data_path",
"os.path.isdir",
"pypeit.metadata.PypeItMetaData",
"shutil.rmtree",
"numpy.all",
"pypeit.spectrographs.util.load_spectrograph... | [((547, 571), 'pypeit.tests.tstutils.data_path', 'data_path', (['"""setup_files"""'], {}), "('setup_files')\n", (556, 571), False, 'from pypeit.tests.tstutils import dev_suite_required, data_path\n'), ((579, 603), 'os.path.isdir', 'os.path.isdir', (['setup_dir'], {}), '(setup_dir)\n', (592, 603), False, 'import os\n'),... |
import numpy as np
import pickle
import os
def GenerateFeature_alpha(ligand_name, working_dir):
Cut = 12.0
LIGELE = ['C','N','O','S','CN','CO','CS','NO','NS','OS','CCl','CBr','CP','CF','CNO','CNS','COS','NOS','CNOS','CNOSPFClBrI','H','CH','NH','OH','SH','CNH','COH','CSH','NOH','NSH','OSH','CNOH','CNSH','COSH'... | [
"os.path.exists",
"numpy.mean",
"numpy.asarray",
"pickle.load",
"numpy.min",
"numpy.max",
"numpy.argmax",
"numpy.sum",
"numpy.std",
"numpy.save"
] | [((500, 519), 'pickle.load', 'pickle.load', (['InFile'], {}), '(InFile)\n', (511, 519), False, 'import pickle\n'), ((4686, 4714), 'numpy.asarray', 'np.asarray', (['Feature_i', 'float'], {}), '(Feature_i, float)\n', (4696, 4714), True, 'import numpy as np\n'), ((4806, 4833), 'numpy.save', 'np.save', (['outfile', 'Featur... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"tensorflow.contrib.framework.python.ops.variables.local_variable",
"tensorflow.python.ops.array_ops.placeholder",
"tensorflow.contrib.framework.python.framework.tensor_util.reduce_sum_n",
"numpy.ones",
"re.compile",
"tensorflow.python.ops.variables.local_variables_initializer",
"tensorflow.python.ops.v... | [((16270, 16281), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (16279, 16281), False, 'from tensorflow.python.platform import test\n'), ((2684, 2716), 'tensorflow.contrib.framework.python.framework.tensor_util.assert_scalar_int', 'tensor_util.assert_scalar_int', (['(3)'], {}), '(3)\n', (2713, ... |
""" Code for wrapping the motion primitive action in an object. """
from __future__ import division
from __future__ import absolute_import
import attr
import numpy as np
from bc_gym_planning_env.utilities.serialize import Serializable
@attr.s(cmp=False)
class Action(Serializable):
""" Object representing an 'ac... | [
"numpy.array",
"attr.s",
"attr.ib"
] | [((240, 257), 'attr.s', 'attr.s', ([], {'cmp': '(False)'}), '(cmp=False)\n', (246, 257), False, 'import attr\n'), ((411, 435), 'attr.ib', 'attr.ib', ([], {'type': 'np.ndarray'}), '(type=np.ndarray)\n', (418, 435), False, 'import attr\n'), ((567, 639), 'numpy.array', 'np.array', (['[wanted_linear_velocity_of_baselink, w... |
#!/usr/bin/env python3
from collections import defaultdict
import numpy as np
from pgmpy.base import UndirectedGraph
from pgmpy.factors import factor_product
class ClusterGraph(UndirectedGraph):
r"""
Base class for representing Cluster Graph.
Cluster graph is an undirected graph which is associated wi... | [
"numpy.sum",
"collections.defaultdict"
] | [((8516, 8532), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (8527, 8532), False, 'from collections import defaultdict\n'), ((9995, 10016), 'numpy.sum', 'np.sum', (['factor.values'], {}), '(factor.values)\n', (10001, 10016), True, 'import numpy as np\n')] |
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
os.sys.path.insert(0,parentdir)
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
import time
import pybullet... | [
"pybullet_data.getDataPath",
"os.sys.path.insert",
"pybullet.setTimeStep",
"pybullet.setGravity",
"numpy.array",
"pybullet.setPhysicsEngineParameter",
"pybullet.disconnect",
"time.sleep",
"gym.utils.seeding.np_random",
"numpy.reshape",
"pybullet.connect",
"pybullet.getCameraImage",
"pybullet... | [((164, 196), 'os.sys.path.insert', 'os.sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (182, 196), False, 'import os, inspect\n'), ((135, 162), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (150, 162), False, 'import os, inspect\n'), ((656, 683), 'pybullet_data.getData... |
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# -------------------------------------------------------------------... | [
"numpy.array",
"numpy.meshgrid",
"numpy.full",
"numpy.pad",
"numpy.arange"
] | [((2038, 2074), 'numpy.pad', 'np.pad', (['array', 'padding'], {}), '(array, padding, **pad_kwargs)\n', (2044, 2074), True, 'import numpy as np\n'), ((5985, 6018), 'numpy.full', 'np.full', (['output_shape', 'fill_value'], {}), '(output_shape, fill_value)\n', (5992, 6018), True, 'import numpy as np\n'), ((6033, 6059), 'n... |
from math import pi
from numpy import array, ndarray, divide, sqrt, argsort, sort, diag, trace
from numpy.linalg import eig, norm
class HartreeFock():
zeta = array([38.474970, 5.782948, 1.242567, 0.298073])
num_aos = len(zeta)
num_mos = 0
energy_tolerance = 0.0001; density_tolerance = 0.001
... | [
"numpy.trace",
"numpy.sqrt",
"numpy.linalg.eig",
"numpy.sort",
"numpy.argsort",
"numpy.array",
"numpy.ndarray",
"numpy.linalg.norm"
] | [((170, 217), 'numpy.array', 'array', (['[38.47497, 5.782948, 1.242567, 0.298073]'], {}), '([38.47497, 5.782948, 1.242567, 0.298073])\n', (175, 217), False, 'from numpy import array, ndarray, divide, sqrt, argsort, sort, diag, trace\n'), ((1103, 1170), 'numpy.ndarray', 'ndarray', ([], {'shape': '(self.num_aos, self.num... |
import os
import numpy as np
from skimage.io import imread
def get_file_count(paths, image_format='.tif'):
total_count = 0
for path in paths:
try:
path_list = [_ for _ in os.listdir(path) if _.endswith(image_format)]
total_count += len(path_list)
except OSError:
... | [
"skimage.io.imread",
"os.listdir",
"os.path.join",
"numpy.expand_dims"
] | [((491, 507), 'skimage.io.imread', 'imread', (['img_path'], {}), '(img_path)\n', (497, 507), False, 'from skimage.io import imread\n'), ((705, 722), 'skimage.io.imread', 'imread', (['mask_path'], {}), '(mask_path)\n', (711, 722), False, 'from skimage.io import imread\n'), ((820, 866), 'os.path.join', 'os.path.join', ([... |
# -*- encoding: utf8 -*-
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from lvq import SilvqModel
from lvq.utils import plot2d
def main():
# Load dataset
dataset = np.loadtxt('data/artificial_dataset1.csv', delimiter=',')
x = dataset[:... | [
"sklearn.metrics.accuracy_score",
"sklearn.model_selection.train_test_split",
"lvq.SilvqModel",
"numpy.loadtxt",
"lvq.utils.plot2d"
] | [((245, 302), 'numpy.loadtxt', 'np.loadtxt', (['"""data/artificial_dataset1.csv"""'], {'delimiter': '""","""'}), "('data/artificial_dataset1.csv', delimiter=',')\n", (255, 302), True, 'import numpy as np\n'), ((474, 553), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': '(0.2)'... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
#Importing all required libraries
# In[ ]:
from __future__ import absolute_import, division, print_function, unicode_literals
# In[ ]:
#Checking for correct cuda and tf versions
from tensorflow.python.platform import build_info as tf_build_info
print(tf_build_in... | [
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"tensorflow.keras.applications.ResNet50",
"tensorflow.keras.layers.GlobalAveragePooling2D",
"os.listdir",
"pathlib.Path",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.p... | [((1111, 1139), 'pathlib.Path', 'pathlib.Path', (['train_data_dir'], {}), '(train_data_dir)\n', (1123, 1139), False, 'import pathlib\n'), ((1156, 1183), 'pathlib.Path', 'pathlib.Path', (['test_data_dir'], {}), '(test_data_dir)\n', (1168, 1183), False, 'import pathlib\n'), ((1680, 1713), 'numpy.ceil', 'np.ceil', (['(ima... |
import torch.utils.data as data
import numpy as np
from imageio import imread
from path import Path
import pdb
def crawl_folders(folders_list):
imgs = []
depth = []
for folder in folders_list:
current_imgs = sorted(folder.files('*.jpg'))
current_depth = []
fo... | [
"imageio.imread",
"path.Path",
"numpy.load"
] | [((1183, 1193), 'path.Path', 'Path', (['root'], {}), '(root)\n', (1187, 1193), False, 'from path import Path\n'), ((654, 666), 'imageio.imread', 'imread', (['path'], {}), '(path)\n', (660, 666), False, 'from imageio import imread\n'), ((1513, 1539), 'numpy.load', 'np.load', (['self.depth[index]'], {}), '(self.depth[ind... |
from DD.utils import PoolByteArray2NumpyArray, NumpyArray2PoolByteArray
from DD.Entity import Entity
import numpy as np
class Terrain(Entity):
def __init__(self, json, width, height, scale=4, terrain_types=4):
super(Terrain, self).__init__(json)
self._scale = scale
self.terrain_types = terr... | [
"numpy.prod",
"numpy.flipud",
"numpy.fliplr",
"DD.utils.PoolByteArray2NumpyArray",
"numpy.pad"
] | [((720, 852), 'numpy.pad', 'np.pad', (['self.splat', '((top * self._scale, bottom * self._scale), (left * self._scale, right *\n self._scale), (0, 0))'], {'mode': '"""edge"""'}), "(self.splat, ((top * self._scale, bottom * self._scale), (left * self\n ._scale, right * self._scale), (0, 0)), mode='edge')\n", (726,... |
from __future__ import print_function
import numpy as np
import os,sys,time
"""
Copied from orphics.mpi
"""
try:
disable_mpi_env = os.environ['DISABLE_MPI']
disable_mpi = True if disable_mpi_env.lower().strip() == "true" else False
except:
disable_mpi = False
"""
Use the below cleanup stuff only for inte... | [
"numpy.array",
"numpy.cumsum"
] | [((1658, 1692), 'numpy.array', 'np.array', (['([min_each] * avail_cores)'], {}), '([min_each] * avail_cores)\n', (1666, 1692), True, 'import numpy as np\n'), ((1917, 1936), 'numpy.cumsum', 'np.cumsum', (['num_each'], {}), '(num_each)\n', (1926, 1936), True, 'import numpy as np\n')] |
# Copyright (c) 2018 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 app... | [
"math.ceil",
"math.floor",
"numpy.random.random_integers",
"numpy.random.random",
"numpy.array",
"numpy.zeros",
"paddle.compat.round",
"unittest.main"
] | [((5305, 5320), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5318, 5320), False, 'import unittest\n'), ((1679, 1758), 'numpy.zeros', 'np.zeros', (['(self.rois_num, self.channels, self.pooled_height, self.pooled_width)'], {}), '((self.rois_num, self.channels, self.pooled_height, self.pooled_width))\n', (1687, 17... |
import random
import numpy as np
import math
from skimage.draw import line, line_aa, circle, set_color, circle_perimeter_aa
from skimage.io import imsave
from skimage.util import random_noise
maxSlope = 10 # restrict the maximum slope of generated lines for stability
minLength = 20 # restrict the minimum length of li... | [
"skimage.draw.circle",
"skimage.draw.circle_perimeter_aa",
"skimage.draw.set_color",
"numpy.zeros",
"skimage.util.random_noise",
"skimage.draw.line"
] | [((1439, 1469), 'skimage.draw.circle_perimeter_aa', 'circle_perimeter_aa', (['cY', 'cX', 'r'], {}), '(cY, cX, r)\n', (1458, 1469), False, 'from skimage.draw import line, line_aa, circle, set_color, circle_perimeter_aa\n'), ((1472, 1507), 'skimage.draw.set_color', 'set_color', (['data', '(rr, cc)', 'clr', 'val'], {}), '... |
import numpy as np
import copy
import combo.misc
import cPickle as pickle
from results import history
from .. import utility
from ...variable import variable
from ..call_simulator import call_simulator
from ... import predictor
from ...gp import predictor as gp_predictor
from ...blm import predictor as blm_predictor
im... | [
"numpy.mean",
"results.history",
"numpy.delete",
"numpy.argmax",
"numpy.zeros",
"numpy.random.seed",
"copy.deepcopy",
"cPickle.load",
"numpy.arange"
] | [((559, 593), 'numpy.arange', 'np.arange', (['(0)', 'self.test.X.shape[0]'], {}), '(0, self.test.X.shape[0])\n', (568, 593), True, 'import numpy as np\n'), ((617, 626), 'results.history', 'history', ([], {}), '()\n', (624, 626), False, 'from results import history\n'), ((738, 763), 'numpy.random.seed', 'np.random.seed'... |
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
import numpy as np
font_location = './wordcloud_file/malgun.ttf' # For Windows
font_name = fm.FontProperties(fname=font_location).get_name()
plt.rc('font', family=font_name)
def percent_graph2(movie_review) :
b = movie_review
labelss = sorte... | [
"matplotlib.pyplot.savefig",
"matplotlib.font_manager.FontProperties",
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.rc"
] | [((211, 243), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': 'font_name'}), "('font', family=font_name)\n", (217, 243), True, 'import matplotlib.pyplot as plt\n'), ((461, 487), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (471, 487), True, 'import matplotli... |
import numpy as np
import pickle
from os.path import exists, realpath
import sys
import math
from topple_data_loader import ToppleData, ToppleDataLoader
import transforms3d
class ToppleNormalizationInfo():
'''
Structure to hold all the normalization information for a dataset.
'''
def __init__(self... | [
"numpy.random.normal",
"numpy.copy",
"numpy.radians",
"os.path.exists",
"numpy.reshape",
"pickle.dump",
"numpy.random.shuffle",
"transforms3d.euler.euler2mat",
"numpy.random.choice",
"pickle.load",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.random.randint",
"numpy.linalg.norm",
... | [((3728, 3766), 'numpy.zeros', 'np.zeros', (['(self.size, self.num_pts, 3)'], {}), '((self.size, self.num_pts, 3))\n', (3736, 3766), True, 'import numpy as np\n'), ((3790, 3830), 'numpy.zeros', 'np.zeros', (['(self.size, self.num_steps, 3)'], {}), '((self.size, self.num_steps, 3))\n', (3798, 3830), True, 'import numpy ... |
import numpy as np
from operator import truediv
def AA_andEachClassAccuracy(confusion_matrix):
counter = confusion_matrix.shape[0]
list_diag = np.diag(confusion_matrix)
list_raw_sum = np.sum(confusion_matrix, axis=1)
each_acc = np.nan_to_num(truediv(list_diag, list_raw_sum))
average_acc = n... | [
"operator.truediv",
"numpy.sum",
"numpy.mean",
"numpy.diag"
] | [((157, 182), 'numpy.diag', 'np.diag', (['confusion_matrix'], {}), '(confusion_matrix)\n', (164, 182), True, 'import numpy as np\n'), ((203, 235), 'numpy.sum', 'np.sum', (['confusion_matrix'], {'axis': '(1)'}), '(confusion_matrix, axis=1)\n', (209, 235), True, 'import numpy as np\n'), ((319, 336), 'numpy.mean', 'np.mea... |
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import sys
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.colors import BoundaryNorm
def plot_images(
num_sample_perclass=10, x=None, y=None, labels=None, title=None, cmap=None
):
grid_x = num_samp... | [
"matplotlib.pyplot.ylabel",
"numpy.array",
"sys.exit",
"numpy.arange",
"matplotlib.pyplot.imshow",
"numpy.searchsorted",
"matplotlib.pyplot.xlabel",
"numpy.max",
"matplotlib.gridspec.GridSpec",
"numpy.linspace",
"numpy.random.seed",
"numpy.min",
"matplotlib.pyplot.axis",
"numpy.abs",
"ma... | [((366, 402), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(grid_y, grid_x)'}), '(figsize=(grid_y, grid_x))\n', (376, 402), True, 'import matplotlib.pyplot as plt\n'), ((413, 446), 'matplotlib.gridspec.GridSpec', 'gridspec.GridSpec', (['grid_y', 'grid_x'], {}), '(grid_y, grid_x)\n', (430, 446), True, 'im... |
from data.data_reader import BIZCARD_LABEL_MAP, BizcardDataParser
import argparse
from pathlib import Path
import os
import json
import cv2
import numpy as np
def convert_bizcard_to_coco_format(image_dir, json_dir, id_list, out_dir, out_name):
coco_json = {}
images = []
annotations = []
categories = [... | [
"data.data_reader.BIZCARD_LABEL_MAP.keys",
"numpy.reshape",
"argparse.ArgumentParser",
"pathlib.Path",
"json.dump"
] | [((2152, 2177), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2175, 2177), False, 'import argparse\n'), ((351, 375), 'data.data_reader.BIZCARD_LABEL_MAP.keys', 'BIZCARD_LABEL_MAP.keys', ([], {}), '()\n', (373, 375), False, 'from data.data_reader import BIZCARD_LABEL_MAP, BizcardDataParser\n')... |
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD.
# See https://nomad-lab.eu for further info.
#
# 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/lic... | [
"numpy.product",
"nomad.datamodel.metainfo.simulation.method.Scf",
"re.compile",
"numpy.array",
"nomad.parsing.file_parser.XMLParser",
"nomad.parsing.file_parser.TextParser",
"re.search",
"os.listdir",
"numpy.reshape",
"nomad.datamodel.metainfo.simulation.method.Functional",
"numpy.where",
"no... | [((22188, 22215), 're.compile', 're.compile', (['"""([A-Z][a-z]?)"""'], {}), "('([A-Z][a-z]?)')\n", (22198, 22215), False, 'import re\n'), ((39102, 39121), 'numpy.array', 'np.array', (['positions'], {}), '(positions)\n', (39110, 39121), True, 'import numpy as np\n'), ((42197, 42213), 'nomad.parsing.file_parser.DataText... |
"""
Plot up surface or bottom (or any fixed level) errors from a profile object
with no z_dim (vertical dimension). Provide an array of netcdf files and
mess with the options to get a figure you like.
You can define how many rows and columns the plot will have. This script will
plot the provided list of netcdf datase... | [
"coast.plot_util.determine_colorbar_extension",
"coast.plot_util.create_geo_subplots",
"numpy.unravel_index",
"matplotlib.pyplot.cm.get_cmap",
"xarray.open_dataset",
"sys.path.append"
] | [((497, 540), 'sys.path.append', 'sys.path.append', (['"""/Users/dbyrne/code/COAsT"""'], {}), "('/Users/dbyrne/code/COAsT')\n", (512, 540), False, 'import sys\n'), ((2685, 2774), 'coast.plot_util.create_geo_subplots', 'coast.plot_util.create_geo_subplots', (['lonbounds', 'latbounds', 'n_r', 'n_c'], {'figsize': 'figsize... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import tqdm
import torch
import pickle
import resource
import numpy as np
import matplotlib.pyplot as plt
from args import parse_args
from modelSummary import model_dict
from pytorchtools import load_from_file
from torch.utils.data import DataLoader
... | [
"modelSummary.model_dict.keys",
"torch.cuda.device_count",
"utils.get_predictions",
"numpy.nanmean",
"utils.unnormPts",
"numpy.mean",
"helperfunctions.mypause",
"numpy.stack",
"resource.setrlimit",
"helperfunctions.stackall_Dict",
"numpy.nanstd",
"pickle.load",
"utils.get_nparams",
"matplo... | [((615, 657), 'resource.getrlimit', 'resource.getrlimit', (['resource.RLIMIT_NOFILE'], {}), '(resource.RLIMIT_NOFILE)\n', (633, 657), False, 'import resource\n'), ((658, 724), 'resource.setrlimit', 'resource.setrlimit', (['resource.RLIMIT_NOFILE', '(2048 * 10, rlimit[1])'], {}), '(resource.RLIMIT_NOFILE, (2048 * 10, rl... |
import torch
import lib.modeling.resnet as resnet
import lib.modeling.semseg_heads as snet
import torch.nn as nn
import torch.optim as optim
import utils.resnet_weights_helper as resnet_utils
from torch.autograd import Variable
from roi_data.loader import RoiDataLoader, MinibatchSampler, collate_minibatch, collate_mini... | [
"core.config.cfg_from_file",
"numpy.random.randint",
"torch.chunk",
"torch.nn.NLLLoss",
"modeling.model_builder_PSP3D.DispSeg",
"torch.nn.functional.interpolate",
"torch.nn.functional.log_softmax",
"utils.resnet_weights_helper.load_pretrained_imagenet_weights",
"torch.arange",
"lib.modeling.semseg... | [((2264, 2287), 'core.config.cfg_from_file', 'cfg_from_file', (['cfg_file'], {}), '(cfg_file)\n', (2277, 2287), False, 'from core.config import cfg, cfg_from_file, cfg_from_list, assert_and_infer_cfg\n'), ((2788, 2816), 'torch.nn.NLLLoss', 'nn.NLLLoss', ([], {'ignore_index': '(255)'}), '(ignore_index=255)\n', (2798, 28... |
from abc import ABC, abstractmethod
from typing import Optional
from xml import dom
import numpy as np
import pandas as pd
from .utils import get_factors_rev
def calc_plot_size(domain_x, domain_y, plot_goal, house_goal):
f1 = sorted(get_factors_rev(domain_x))
f2 = sorted(get_factors_rev(domain_y))
plot_... | [
"numpy.tile",
"numpy.ceil",
"numpy.where",
"numpy.floor",
"numpy.zeros",
"numpy.savetxt",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.full",
"numpy.pad"
] | [((1874, 1945), 'pandas.DataFrame', 'pd.DataFrame', (['plots'], {'columns': "['px', 'py', 'domx', 'domy', 'trimmed_dy']"}), "(plots, columns=['px', 'py', 'domx', 'domy', 'trimmed_dy'])\n", (1886, 1945), True, 'import pandas as pd\n'), ((4922, 4965), 'numpy.savetxt', 'np.savetxt', (['filename', 'matrix'], {'delimiter': ... |
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code mus... | [
"pyrado.tasks.sequential.SequentialTasks",
"numpy.array",
"pyrado.tasks.final_reward.FinalRewMode",
"numpy.add.at",
"pyrado.tasks.condition_only.ConditionOnlyTask",
"numpy.empty",
"numpy.concatenate",
"pyrado.ValueErr",
"pyrado.tasks.masked.MaskedTask",
"pyrado.spaces.box.BoxSpace",
"pyrado.spac... | [((6388, 6439), 'os.path.join', 'osp.join', (['pyrado.MUJOCO_ASSETS_DIR', 'graph_file_name'], {}), '(pyrado.MUJOCO_ASSETS_DIR, graph_file_name)\n', (6396, 6439), True, 'import os.path as osp\n'), ((7273, 7351), 'numpy.concatenate', 'np.concatenate', (['[self.init_qpos, self.init_qvel, init_ball_pos, init_cup_goal]'], {... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.linear_model import ARDRegression, LinearRegression
# Parameters of the example
np.random.seed(0)
n_samples, n_features = 100, 100
# Create Gaussian data
X = np.random.randn(n_samples, n_features)
# Create weights with a precision... | [
"numpy.sqrt",
"sds.distributions.lingauss.SingleOutputLinearGaussianWithKnownPrecision",
"matplotlib.pyplot.ylabel",
"sklearn.linear_model.ARDRegression",
"copy.deepcopy",
"numpy.atleast_2d",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sds.distributions.gaussian.GaussianWithKnownMeanAndDi... | [((170, 187), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (184, 187), True, 'import numpy as np\n'), ((248, 286), 'numpy.random.randn', 'np.random.randn', (['n_samples', 'n_features'], {}), '(n_samples, n_features)\n', (263, 286), True, 'import numpy as np\n'), ((352, 372), 'numpy.zeros', 'np.zeros',... |
import numpy as np
import pybullet as p
import itertools
from robot import Robot
class World():
def __init__(self):
# create the physics simulator
self.physicsClient = p.connect(p.GUI)
p.setGravity(0,0,-9.81)
self.max_communication_distance = 2.0
# We will int... | [
"pybullet.resetDebugVisualizerCamera",
"robot.Robot",
"pybullet.loadSDF",
"pybullet.connect",
"pybullet.setGravity",
"pybullet.setPhysicsEngineParameter",
"pybullet.changeDynamics",
"numpy.linalg.norm",
"pybullet.stepSimulation",
"pybullet.resetBasePositionAndOrientation",
"pybullet.loadURDF"
] | [((194, 210), 'pybullet.connect', 'p.connect', (['p.GUI'], {}), '(p.GUI)\n', (203, 210), True, 'import pybullet as p\n'), ((219, 244), 'pybullet.setGravity', 'p.setGravity', (['(0)', '(0)', '(-9.81)'], {}), '(0, 0, -9.81)\n', (231, 244), True, 'import pybullet as p\n'), ((386, 437), 'pybullet.setPhysicsEngineParameter'... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.tools.quantization.quantize_graph.set_attr_dtype",
"tensorflow.python.framework.importer.import_graph_def",
"numpy.array",
"tensorflow.tools.quantization.quantize_graph.quantize_weight_eightbit",
"tensorflow.core.framework.graph_pb2.GraphDef",
"numpy.reshape",
"tensorflow.tools.quantization.... | [((1481, 1496), 'tensorflow.python.framework.ops.Graph', 'ops_lib.Graph', ([], {}), '()\n', (1494, 1496), True, 'from tensorflow.python.framework import ops as ops_lib\n'), ((1888, 1908), 'tensorflow.core.framework.graph_pb2.GraphDef', 'graph_pb2.GraphDef', ([], {}), '()\n', (1906, 1908), False, 'from tensorflow.core.f... |
import numpy as np
class Board:
"""
0 - black
1 - white
"""
def __init__(self):
board = [
[0, 1] * 4,
[1, 0] * 4
] * 4
players_board = [
[0, 1] * 4, # player 1
[1, 0] * 4
] + [[0] * 8] * 4 + [ # 4 rows of nothing
[0, 2] * 4, # player 2
[2, 0] * 4
]
se... | [
"numpy.array"
] | [((331, 346), 'numpy.array', 'np.array', (['board'], {}), '(board)\n', (339, 346), True, 'import numpy as np\n'), ((372, 395), 'numpy.array', 'np.array', (['players_board'], {}), '(players_board)\n', (380, 395), True, 'import numpy as np\n')] |
import numpy as np
from pysz import compress, decompress
def test_compress_decompress():
a = np.linspace(0, 100, num=1000000).reshape((100, 100, 100)).astype(np.float32)
tolerance = 0.0001
compressed = compress(a, tolerance=tolerance)
recovered = decompress(compressed, a.shape, a.dtype)
asse... | [
"pysz.decompress",
"numpy.linspace",
"pysz.compress",
"numpy.allclose"
] | [((216, 248), 'pysz.compress', 'compress', (['a'], {'tolerance': 'tolerance'}), '(a, tolerance=tolerance)\n', (224, 248), False, 'from pysz import compress, decompress\n'), ((266, 306), 'pysz.decompress', 'decompress', (['compressed', 'a.shape', 'a.dtype'], {}), '(compressed, a.shape, a.dtype)\n', (276, 306), False, 'f... |
import subprocess
from .Genome_fasta import get_fasta
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
import pysam
def run(parser):
args = parser.parse_args()
bases,chrs = get_fasta(args.genome)
l={}
for c in chrs:
l[c]=len(bases[c])
chrs = se... | [
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.use",
"matplotlib.pyplot.pie",
"pysam.AlignmentFile",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot",
"numpy.arange"
] | [((72, 93), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (86, 93), False, 'import matplotlib\n'), ((1984, 1996), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1994, 1996), True, 'from matplotlib import pyplot as plt\n'), ((2001, 2017), 'matplotlib.pyplot.subplot', 'plt.subplot', ... |
import numpy as np
from unittest import TestCase
import numpy.testing as npt
from distancematrix.util import diag_indices_of
from distancematrix.consumer.distance_matrix import DistanceMatrix
class TestContextualMatrixProfile(TestCase):
def setUp(self):
self.dist_matrix = np.array([
[8.67, 1... | [
"numpy.atleast_2d",
"numpy.testing.assert_equal",
"numpy.full_like",
"distancematrix.util.diag_indices_of",
"numpy.array",
"distancematrix.consumer.distance_matrix.DistanceMatrix",
"numpy.full"
] | [((289, 1251), 'numpy.array', 'np.array', (['[[8.67, 1.1, 1.77, 1.26, 1.91, 4.29, 6.32, 4.24, 4.64, 5.06, 6.41, 4.07, \n 4.67, 9.32, 5.09], [4.33, 4.99, 0.14, 2.79, 2.1, 6.26, 9.4, 4.14, 5.53,\n 4.26, 8.21, 5.91, 6.83, 9.26, 6.19], [0.16, 9.05, 1.35, 4.78, 7.01, \n 4.36, 5.24, 8.81, 7.9, 5.84, 8.9, 7.88, 3.37,... |
from unittest import TestCase
import numpy as np
from robustnessgym.cachedops.spacy import Spacy
from robustnessgym.slicebuilders.subpopulations.length import LengthSubpopulation
from tests.testbeds import MockTestBedv0
class TestLengthSubpopulation(TestCase):
def setUp(self):
self.testbed = MockTestBed... | [
"tests.testbeds.MockTestBedv0",
"robustnessgym.cachedops.spacy.Spacy",
"numpy.array",
"robustnessgym.cachedops.spacy.Spacy.retrieve",
"robustnessgym.slicebuilders.subpopulations.length.LengthSubpopulation"
] | [((309, 324), 'tests.testbeds.MockTestBedv0', 'MockTestBedv0', ([], {}), '()\n', (322, 324), False, 'from tests.testbeds import MockTestBedv0\n'), ((490, 537), 'robustnessgym.slicebuilders.subpopulations.length.LengthSubpopulation', 'LengthSubpopulation', ([], {'intervals': '[(1, 3), (4, 5)]'}), '(intervals=[(1, 3), (4... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 30 17:15:27 2014
@author: Parke
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib as mplot
import matplotlib.pyplot as plt
import mypy.my_numpy as mnp
dpi = 100
fullwidth = 10.0
halfwidth = 5.0
# use these with li... | [
"numpy.log10",
"numpy.sqrt",
"numpy.array",
"numpy.sin",
"mypy.my_numpy.inranges",
"mayavi.mlab.view",
"numpy.isscalar",
"numpy.asarray",
"numpy.diff",
"numpy.max",
"numpy.issubdtype",
"numpy.linspace",
"mayavi.mlab.quiver3d",
"matplotlib.pyplot.axis",
"numpy.abs",
"numpy.allclose",
... | [((1184, 1196), 'numpy.array', 'np.array', (['xy'], {}), '(xy)\n', (1192, 1196), True, 'import numpy as np\n'), ((1998, 2009), 'numpy.log10', 'np.log10', (['x'], {}), '(x)\n', (2006, 2009), True, 'import numpy as np\n'), ((2378, 2395), 'numpy.asarray', 'np.asarray', (['edges'], {}), '(edges)\n', (2388, 2395), True, 'im... |
#!/usr/bin/env python3
"""
script for calculating gc skew
<NAME>
<EMAIL>
"""
# python modules
import os
import sys
import argparse
import numpy as np
from scipy import signal
from itertools import cycle, product
# plotting modules
from matplotlib import use as mplUse
mplUse('Agg')
import matplotlib.pyplot as plt
fr... | [
"ctbBio.fasta.iterate_fasta",
"itertools.cycle",
"numpy.ones",
"argparse.ArgumentParser",
"matplotlib.use",
"itertools.product",
"numpy.asarray",
"scipy.signal.fftconvolve",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.close",
"matplotlib.rc",
"matplotlib.pyplot.title",
"matplotlib.pyplo... | [((272, 285), 'matplotlib.use', 'mplUse', (['"""Agg"""'], {}), "('Agg')\n", (278, 285), True, 'from matplotlib import use as mplUse\n'), ((431, 498), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (433, 498), False, 'from matplotlib import rc\n'), ((8... |
# <NAME> (<EMAIL>)
# April 2018
import os, sys
BASE_DIR = os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.join(BASE_DIR, '..'))
from datasets import *
from generate_outputs import *
from scipy.optimize import linear_sum_assignment
#import matplotlib.pyplot a... | [
"os.path.exists",
"scipy.optimize.linear_sum_assignment",
"os.makedirs",
"os.path.join",
"numpy.argmax",
"numpy.linalg.norm",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.expand_dims",
"numpy.argmin",
"os.path.abspath",
"numpy.save"
] | [((159, 187), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".."""'], {}), "(BASE_DIR, '..')\n", (171, 187), False, 'import os, sys\n'), ((758, 778), 'numpy.argmax', 'np.argmax', (['A'], {'axis': '(1)'}), '(A, axis=1)\n', (767, 778), True, 'import numpy as np\n'), ((1732, 1752), 'numpy.array', 'np.array', (['dists_i... |
from aux_sys_err_prediction_module.additive.R_runmed_spline.my_R_runmed_spline_fit import R_runmed_smooth_spline
from numpy import random, array, median, zeros, arange, hstack
from win32com.client import Dispatch
import math
myName = 'R_runmed_spline'
useMAD = True # use median absolute deviations instead of ... | [
"numpy.random.normal",
"pylab.ylim",
"win32com.client.Dispatch",
"time.clock",
"pylab.subplot",
"math.floor",
"pylab.plot",
"pylab.show",
"numpy.hstack",
"aux_sys_err_prediction_module.additive.R_runmed_spline.my_R_runmed_spline_fit.R_runmed_smooth_spline",
"numpy.array",
"numpy.linspace",
"... | [((619, 661), 'win32com.client.Dispatch', 'Dispatch', (['"""StatConnectorSrv.StatConnector"""'], {}), "('StatConnectorSrv.StatConnector')\n", (627, 661), False, 'from win32com.client import Dispatch\n'), ((2552, 2596), 'numpy.arange', 'arange', (['sparRange[0]', 'sparRange[1]', 'sparStep'], {}), '(sparRange[0], sparRan... |
# -*- coding: utf-8 -*-
import pickle
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem,DataStructs
def get_classes(path):
f = open(path, 'rb')
dict_ = pickle.load(f)
f.close()
classes = sorted(dict_.items(), key=lambda d: d[1],reverse=True)
classes = [(x,y) fo... | [
"pickle.load",
"rdkit.Chem.MolFromSmiles",
"rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect",
"rdkit.Chem.DataStructs.ConvertToNumpyArray",
"numpy.empty",
"numpy.concatenate"
] | [((196, 210), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (207, 210), False, 'import pickle\n'), ((1698, 1727), 'numpy.concatenate', 'np.concatenate', (['(pfp, rxn_fp)'], {}), '((pfp, rxn_fp))\n', (1712, 1727), True, 'import numpy as np\n'), ((694, 718), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['rsmi... |
"""Core experiments for the dependency label prediction task."""
import collections
import copy
import logging
from typing import (Any, Dict, Iterator, Optional, Sequence, Set, Tuple, Type,
Union)
from ldp import datasets, learning
from ldp.models import probes, projections
from ldp.parse import pt... | [
"logging.getLogger",
"wandb.log",
"torch.stack",
"ldp.learning.EarlyStopping",
"numpy.sum",
"collections.defaultdict",
"copy.deepcopy",
"ldp.models.projections.Projection",
"logging.info",
"ldp.learning.test"
] | [((11285, 11312), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (11302, 11312), False, 'import logging\n'), ((12378, 12427), 'ldp.learning.test', 'learning.test', (['probe', 'test_dataset'], {'device': 'device'}), '(probe, test_dataset, device=device)\n', (12391, 12427), False, 'from ldp... |
from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
try:
import scipy.stats as stats
except ImportError:
pass
from .common import Benchmark
class Anderson_KSamp(Benchmark):
def setup(self, *args):
self.rand = [np.random.normal(loc=i, size=1000) fo... | [
"scipy.stats.beta.rvs",
"scipy.stats.gamma.rvs",
"numpy.random.rand",
"scipy.stats.norm.rvs",
"scipy.stats.ttest_ind",
"scipy.stats.gamma.pdf",
"scipy.stats.cauchy.fit",
"numpy.random.seed",
"scipy.stats.beta.fit",
"warnings.simplefilter",
"numpy.random.normal",
"scipy.stats.gamma.cdf",
"sci... | [((813, 864), 'scipy.stats.fisher_exact', 'stats.fisher_exact', (['self.a'], {'alternative': 'alternative'}), '(self.a, alternative=alternative)\n', (831, 864), True, 'import scipy.stats as stats\n'), ((931, 955), 'numpy.random.seed', 'np.random.seed', (['(12345678)'], {}), '(12345678)\n', (945, 955), True, 'import num... |
# Copyright (c) 2020, Xilinx
# 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 copyright notice, this
# list of conditions and the follow... | [
"numpy.prod",
"finn.util.data_packing.rtlsim_output_to_npy",
"math.ceil",
"os.makedirs",
"subprocess.Popen",
"os.path.join",
"numpy.asarray",
"math.log",
"shutil.copy",
"warnings.warn",
"numpy.load",
"numpy.random.randn"
] | [((4864, 4888), 'os.makedirs', 'os.makedirs', (['verilog_dir'], {}), '(verilog_dir)\n', (4875, 4888), False, 'import os\n'), ((5036, 5074), 'os.path.join', 'os.path.join', (['memstream_dir', '"""Q_srl.v"""'], {}), "(memstream_dir, 'Q_srl.v')\n", (5048, 5074), False, 'import os\n'), ((5083, 5108), 'shutil.copy', 'copy',... |
"""
Copyright (c) 2018-2022 Intel Corporation
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 wri... | [
"numpy.ones_like",
"collections.OrderedDict",
"numpy.repeat",
"numpy.ones",
"numpy.logical_and",
"cv2.resize",
"numpy.where",
"numpy.fix",
"numpy.sort",
"numpy.array",
"numpy.zeros",
"numpy.expand_dims",
"numpy.maximum"
] | [((4091, 4106), 'numpy.ones', 'np.ones', (['numbox'], {}), '(numbox)\n', (4098, 4106), True, 'import numpy as np\n'), ((4116, 4131), 'numpy.ones', 'np.ones', (['numbox'], {}), '(numbox)\n', (4123, 4131), True, 'import numpy as np\n'), ((4893, 4913), 'numpy.maximum', 'np.maximum', (['(0)', '(y - 1)'], {}), '(0, y - 1)\n... |
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import learning_curve
# Plot learning curve
def plot_learning_curve(estimator, title, X, y, ylim=None, cv=None,
n_jobs=1, train_sizes=np.linspace(.1, 1.0, 5)):
plt.figu... | [
"numpy.mean",
"matplotlib.pyplot.grid",
"sklearn.model_selection.learning_curve",
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.fill_between",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.std",
"matplotl... | [((282, 306), 'numpy.linspace', 'np.linspace', (['(0.1)', '(1.0)', '(5)'], {}), '(0.1, 1.0, 5)\n', (293, 306), True, 'import numpy as np\n'), ((312, 324), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (322, 324), True, 'import matplotlib.pyplot as plt\n'), ((329, 345), 'matplotlib.pyplot.title', 'plt.titl... |
import os.path as op
import numpy as np
import pandas as pd
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import RidgeCV
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import KFold, cross_val_score
import mne
from pyriemann.tangentspace import TangentSpace
import ... | [
"numpy.linalg.eigh",
"numpy.eye",
"pyriemann.tangentspace.TangentSpace",
"mne.pick_types",
"os.path.join",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"numpy.zeros",
"mne.externals.h5io.read_hdf5",
"sklearn.model_selection.KFold",
"numpy.logspace",
"sklearn.model_selection.cross_val... | [((414, 469), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'n_jobs', 'shuffle': '(True)', 'random_state': 'seed'}), '(n_splits=n_jobs, shuffle=True, random_state=seed)\n', (419, 469), False, 'from sklearn.model_selection import KFold, cross_val_score\n'), ((1494, 1548), 'os.path.join', 'op.join', (['cfg.... |
import numpy as np
import cv2
import os.path as osp
import json
from human_body_prior.tools.model_loader import load_vposer
import torch
vposer_ckpt = '/Vol1/dbstore/datasets/a.vakhitov/projects/pykinect_fresh/smplify-x/smplify-x-data/vposer_v1_0/'
def load_avakhitov_fits_vposer(vposer, part_path, dev_lbl):
po... | [
"torch.bmm",
"torch.split",
"human_body_prior.tools.model_loader.load_vposer",
"torch.eye",
"torch.sin",
"os.path.join",
"numpy.argsort",
"torch.tensor",
"torch.norm",
"numpy.array",
"torch.cos",
"numpy.zeros",
"cv2.Rodrigues",
"json.load",
"numpy.load",
"torch.zeros",
"torch.cat"
] | [((451, 484), 'numpy.load', 'np.load', (["(part_path + '/betas.npy')"], {}), "(part_path + '/betas.npy')\n", (458, 484), True, 'import numpy as np\n'), ((499, 534), 'numpy.load', 'np.load', (["(part_path + '/fid_lst.npy')"], {}), "(part_path + '/fid_lst.npy')\n", (506, 534), True, 'import numpy as np\n'), ((5335, 5384)... |
import numpy as np
def smooth(a, WSZ):
# a: NumPy 1-D array containing the data to be smoothed
# WSZ: smoothing window size needs, which must be odd number,
# as in the original MATLAB implementation
if WSZ % 2 == 0:
WSZ = WSZ - 1
out0 = np.convolve(a, np.ones(WSZ, dtype=int), 'valid') / W... | [
"numpy.concatenate",
"numpy.cumsum",
"numpy.ones",
"numpy.arange"
] | [((331, 355), 'numpy.arange', 'np.arange', (['(1)', '(WSZ - 1)', '(2)'], {}), '(1, WSZ - 1, 2)\n', (340, 355), True, 'import numpy as np\n'), ((462, 497), 'numpy.concatenate', 'np.concatenate', (['(start, out0, stop)'], {}), '((start, out0, stop))\n', (476, 497), True, 'import numpy as np\n'), ((283, 306), 'numpy.ones'... |
# Copyright 2016 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"tensorflow.unstack",
"tensorflow.pad",
"tensorflow.transpose",
"tensorflow.contrib.slim.arg_scope",
"spatial_transformer.transformer",
"tensorflow.reduce_sum",
"tensorflow.split",
"numpy.array",
"tensorflow.control_dependencies",
"tensorflow.contrib.slim.layers.conv2d",
"tensorflow.reduce_mean"... | [((14752, 14879), 'tensorflow.contrib.slim.layers.fully_connected', 'slim.layers.fully_connected', (['cdna_input', '(DNA_KERN_SIZE * DNA_KERN_SIZE * num_masks)'], {'scope': '"""cdna_params"""', 'activation_fn': 'None'}), "(cdna_input, DNA_KERN_SIZE * DNA_KERN_SIZE *\n num_masks, scope='cdna_params', activation_fn=No... |
# noqa: D100
from typing import Optional
import numpy as np
import xarray
from xclim.core.units import (
convert_units_to,
declare_units,
pint_multiply,
rate2amount,
units,
units2pint,
)
from xclim.core.utils import ensure_chunk_size
from ._multivariate import (
daily_temperature_range,
... | [
"xclim.core.units.units",
"numpy.ceil",
"xclim.core.units.units2pint",
"xclim.core.units.convert_units_to",
"xarray.Dataset",
"xclim.core.units.rate2amount",
"xclim.core.utils.ensure_chunk_size",
"xclim.core.units.declare_units",
"xarray.set_options"
] | [((1421, 1482), 'xclim.core.units.declare_units', 'declare_units', ([], {'tasmin': '"""[temperature]"""', 'tasmax': '"""[temperature]"""'}), "(tasmin='[temperature]', tasmax='[temperature]')\n", (1434, 1482), False, 'from xclim.core.units import convert_units_to, declare_units, pint_multiply, rate2amount, units, units2... |
import os,sys
import webbrowser
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.cm as cm
import matplotlib.pylab as plt
from matplotlib import ticker
plt.rcParams['font.family'] = 'monospace'
fig = plt.figure()
rect = fig.add_subplot(111, aspect='equal')
data0 = np.loadtxt('data0.dat', del... | [
"matplotlib.pylab.xlim",
"matplotlib.pylab.grid",
"matplotlib.pylab.figure",
"matplotlib.use",
"matplotlib.pylab.contour",
"matplotlib.pylab.ylim",
"matplotlib.ticker.LinearLocator",
"matplotlib.pylab.xlabel",
"matplotlib.pylab.colorbar",
"os.remove",
"numpy.meshgrid",
"numpy.loadtxt",
"nump... | [((69, 90), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (83, 90), False, 'import matplotlib\n'), ((228, 240), 'matplotlib.pylab.figure', 'plt.figure', ([], {}), '()\n', (238, 240), True, 'import matplotlib.pylab as plt\n'), ((293, 331), 'numpy.loadtxt', 'np.loadtxt', (['"""data0.dat"""'], {'de... |
import os
import itertools
import importlib
import numpy as np
import random
STRATEGY_FOLDER = "exampleStrats"
RESULTS_FILE = "results.txt"
pointsArray = [[1,5],[0,3]] # The i-j-th element of this array is how many points you receive if you do play i, and your opponent does play j.
moveLabels = ["D","C"]
#... | [
"numpy.flip",
"os.listdir",
"importlib.import_module",
"itertools.combinations",
"numpy.argsort",
"numpy.zeros",
"random.random"
] | [((1069, 1125), 'importlib.import_module', 'importlib.import_module', (["(STRATEGY_FOLDER + '.' + pair[0])"], {}), "(STRATEGY_FOLDER + '.' + pair[0])\n", (1092, 1125), False, 'import importlib\n'), ((1137, 1193), 'importlib.import_module', 'importlib.import_module', (["(STRATEGY_FOLDER + '.' + pair[1])"], {}), "(STRATE... |
from polymath import UNSET_SHAPE, DEFAULT_SHAPES
import builtins
import operator
from collections import OrderedDict, Mapping, Sequence, deque
import functools
from numbers import Integral, Rational, Real
import contextlib
import traceback
import uuid
import numpy as np
import importlib
from .graph import Graph
from .... | [
"numpy.product",
"numpy.prod",
"collections.OrderedDict",
"collections.deque",
"traceback.extract_stack",
"numpy.ravel_multi_index",
"numpy.asarray",
"functools.wraps",
"uuid.uuid4",
"numpy.squeeze",
"functools.partial",
"numpy.expand_dims",
"numpy.int"
] | [((1238, 1251), 'collections.deque', 'deque', (['[None]'], {}), '([None])\n', (1243, 1251), False, 'from collections import OrderedDict, Mapping, Sequence, deque\n'), ((46542, 46565), 'functools.wraps', 'functools.wraps', (['target'], {}), '(target)\n', (46557, 46565), False, 'import functools\n'), ((1981, 1994), 'coll... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import itertools
import logging
import numpy as np
import scipy as sp
import torch
from ml.rl.evaluation.cpe import CpeEstimate
from ml.rl.evaluation.evaluation_data_page import EvaluationDataPage
logger = logging.getLogg... | [
"logging.getLogger",
"scipy.stats.t._ppf",
"numpy.hstack",
"numpy.array",
"numpy.nanmean",
"scipy.stats.sem",
"numpy.cov",
"numpy.arange",
"numpy.mean",
"numpy.multiply",
"numpy.where",
"numpy.dot",
"ml.rl.evaluation.cpe.CpeEstimate",
"numpy.logspace",
"numpy.ones",
"numpy.random.choic... | [((305, 332), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (322, 332), False, 'import logging\n'), ((2219, 2257), 'numpy.cumprod', 'np.cumprod', (['importance_weights'], {'axis': '(1)'}), '(importance_weights, axis=1)\n', (2229, 2257), True, 'import numpy as np\n'), ((2604, 2675), 'nump... |
import numpy as np
import sklearn
import pandas as pd
import scipy.spatial.distance as ssd
from scipy.cluster import hierarchy
from scipy.stats import chi2_contingency
from sklearn.base import BaseEstimator
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_extraction.text import CountVectorizer
f... | [
"pandas.Series",
"sklearn.utils.validation.check_is_fitted",
"scipy.spatial.distance.squareform",
"numpy.sqrt",
"scipy.stats.chi2_contingency",
"sklearn.feature_extraction.text.CountVectorizer",
"pandas.crosstab",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.feature_selection.SelectKBest",
... | [((1112, 1129), 'pandas.crosstab', 'pd.crosstab', (['x', 'y'], {}), '(x, y)\n', (1123, 1129), True, 'import pandas as pd\n'), ((1239, 1256), 'numpy.sqrt', 'np.sqrt', (['(chi2 / n)'], {}), '(chi2 / n)\n', (1246, 1256), True, 'import numpy as np\n'), ((1453, 1489), 'pandas.DataFrame.sparse.from_spmatrix', 'pd.DataFrame.s... |
# Copyright (c) Facebook, Inc. and its affiliates.
from typing import List, Optional, cast
# Skipping analyzing 'numpy': found module but no type hints or library stubs
import numpy as np # type: ignore
import numpy.ma as ma # type: ignore
# Skipping analyzing 'pandas': found module but no type hints or library stu... | [
"torcharrow.dtypes.is_string",
"pyarrow.types.is_float32",
"torcharrow.dtypes.Map",
"torcharrow.dtypes.Int8",
"torcharrow.dtypes.is_boolean_or_numerical",
"torcharrow.dtypes.String",
"pyarrow.types.is_float64",
"pyarrow.types.is_map",
"torcharrow.dtypes.is_struct",
"pyarrow.types.is_boolean",
"p... | [((5363, 5396), 'torcharrow.dtypes.is_boolean_or_numerical', 'dt.is_boolean_or_numerical', (['dtype'], {}), '(dtype)\n', (5389, 5396), True, 'import torcharrow.dtypes as dt\n'), ((6246, 6279), 'torcharrow.dtypes.is_boolean_or_numerical', 'dt.is_boolean_or_numerical', (['dtype'], {}), '(dtype)\n', (6272, 6279), True, 'i... |
import argparse
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
parser = argparse.ArgumentParser(description='PyTorch MNIST Example')
parser.add_argument('--mnist', action='store_true', default=False,
help='open mnist result')
args = parser.parse_a... | [
"numpy.mean",
"matplotlib.pyplot.grid",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"pickle.load",
"matplotlib.pyplot.style.use",
"os.path.join",
"matplotlib.pyplot.fill_between",
"numpy... | [((91, 114), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (104, 114), True, 'import matplotlib.pyplot as plt\n'), ((125, 185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n",... |
import numpy as np
from sklearn.model_selection import RandomizedSearchCV, GridSearchCV
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import KFold
import scipy.stats as sts
import xgboost as xgb
from xiter import *
import pandas as pd
import a... | [
"scipy.stats.randint",
"argparse.ArgumentParser",
"scipy.stats.uniform",
"numpy.array",
"datetime.datetime.now",
"pandas.DataFrame",
"sklearn.model_selection.KFold",
"xgboost.XGBClassifier"
] | [((727, 752), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (750, 752), False, 'import argparse\n'), ((2254, 2324), 'xgboost.XGBClassifier', 'xgb.XGBClassifier', ([], {'objective': '"""binary:logistic"""', 'tree_method': '"""gpu_hist"""'}), "(objective='binary:logistic', tree_method='gpu_hist'... |
import random
import json
import gym
from gym import spaces
import pandas as pd
import numpy as np
MAX_ACCOUNT_BALANCE = 2147483647
MAX_NUM_SHARES = 2147483647
MAX_SHARE_PRICE = 5000
MAX_VOLUME = 1000e8
MAX_AMOUNT = 3e10
MAX_OPEN_POSITIONS = 5
MAX_STEPS = 20000
MAX_DAY_CHANGE = 1
INITIAL_ACCOUNT_BALANCE = 10000
DATA... | [
"numpy.append",
"numpy.array",
"gym.spaces.Box"
] | [((1340, 1415), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(0)', 'high': '(1)', 'shape': '(DATA_HIS_PERIOD + 1, 6)', 'dtype': 'np.float16'}), '(low=0, high=1, shape=(DATA_HIS_PERIOD + 1, 6), dtype=np.float16)\n', (1350, 1415), False, 'from gym import spaces\n'), ((1501, 2047), 'numpy.array', 'np.array', (["[self.df.... |
from PIL import Image
import os, glob
import numpy as np
from sklearn import model_selection
classes = ["car", "bycycle", "motorcycle", "pedestrian"]
num_class = len(classes)
image_size = 50
# 画像の読み込み
X = []
Y = []
for index, classlabel in enumerate(classes):
photos_dir = "./" + classlabel
files = glob.glob... | [
"PIL.Image.open",
"sklearn.model_selection.train_test_split",
"numpy.asarray",
"numpy.array",
"numpy.save",
"glob.glob"
] | [((623, 634), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (631, 634), True, 'import numpy as np\n'), ((639, 650), 'numpy.array', 'np.array', (['Y'], {}), '(Y)\n', (647, 650), True, 'import numpy as np\n'), ((687, 725), 'sklearn.model_selection.train_test_split', 'model_selection.train_test_split', (['X', 'Y'], {})... |
from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object, map, zip)
__author__ = "<NAME>"
import numpy as np
from astropy import wcs
from bokeh.layouts import row, widgetbox,gridplot
from bokeh... | [
"bokeh.models.ColorBar",
"bokeh.layouts.row",
"bokeh.plotting.figure",
"bokeh.layouts.widgetbox",
"bokeh.embed.components",
"bokeh.models.LinearColorMapper",
"numpy.column_stack",
"bokeh.layouts.gridplot",
"builtins.zip",
"numpy.isnan",
"bokeh.models.Slider",
"bokeh.models.LabelSet",
"astrop... | [((1396, 1547), 'bokeh.plotting.figure', 'figure', ([], {'plot_width': 'w', 'plot_height': 'h', 'x_range': '(0, c * 0.5)', 'y_range': '(0, r * 0.5)', 'tools': "['pan,box_zoom,box_select,wheel_zoom,reset,save,crosshair']"}), "(plot_width=w, plot_height=h, x_range=(0, c * 0.5), y_range=(0, r * \n 0.5), tools=['pan,box... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Filename: DensityPeaks.py
# @Author: <NAME>
# @Time: 5/3/22 09:55
# @Version: 4.0
import math
from collections import defaultdict
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier, NearestNeighbors
from sklearn.... | [
"sklearn.semi_supervised.SelfTrainingClassifier",
"scipy.spatial.distance.squareform",
"sklearn.preprocessing.LabelEncoder",
"numpy.triu_indices",
"pandas.DataFrame",
"scipy.spatial.distance.pdist",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.max",
"numpy.argsort",
"numpy.array",
"collectio... | [((2864, 2909), 'scipy.spatial.distance.pdist', 'pdist', (['self.data'], {'metric': 'self.distance_metric'}), '(self.data, metric=self.distance_metric)\n', (2869, 2909), False, 'from scipy.spatial.distance import pdist, squareform\n'), ((2936, 2963), 'scipy.spatial.distance.squareform', 'squareform', (['distance_matrix... |
import os
import numpy as np
import pytest
import easyidp
from easyidp.core.objects import ReconsProject, Points
from easyidp.io import metashape
module_path = os.path.join(easyidp.__path__[0], "io/tests")
def test_init_reconsproject():
attempt1 = ReconsProject("agisoft")
assert attempt1.software == "metash... | [
"easyidp.test_full_path",
"numpy.testing.assert_array_almost_equal",
"easyidp.core.objects.Points",
"easyidp.core.objects.ReconsProject",
"numpy.asarray",
"os.path.join",
"easyidp.io.metashape.open_project",
"pytest.raises"
] | [((162, 207), 'os.path.join', 'os.path.join', (['easyidp.__path__[0]', '"""io/tests"""'], {}), "(easyidp.__path__[0], 'io/tests')\n", (174, 207), False, 'import os\n'), ((256, 280), 'easyidp.core.objects.ReconsProject', 'ReconsProject', (['"""agisoft"""'], {}), "('agisoft')\n", (269, 280), False, 'from easyidp.core.obj... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from config import CONFIG
import json
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt # pylint: disable=g-import-not-at-top
import io
import math
import os
import time
from absl i... | [
"tensorflow.unstack",
"tensorflow.train.Checkpoint",
"tensorflow.tile",
"tensorflow.split",
"io.BytesIO",
"absl.logging.info",
"time.sleep",
"tensorflow.config.experimental.list_logical_devices",
"numpy.array",
"tensorflow.config.experimental.set_visible_devices",
"config.CONFIG.items",
"tenso... | [((406, 427), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (420, 427), False, 'import matplotlib\n'), ((591, 632), 'tensorflow.unstack', 'tf.unstack', (['frames'], {'num': 'num_steps', 'axis': '(1)'}), '(frames, num=num_steps, axis=1)\n', (601, 632), True, 'import tensorflow as tf\n'), ((656, 6... |
import copy
import time
from collections import defaultdict
import cloudpickle
import numpy as np
import pandas as pd
import woodwork as ww
from sklearn.model_selection import BaseCrossValidator
from .pipeline_search_plots import PipelineSearchPlots
from evalml.automl.automl_algorithm import IterativeAlgorithm
from ... | [
"evalml.pipelines.ModeBaselineMulticlassPipeline",
"pandas.option_context",
"evalml.exceptions.PipelineNotFoundError",
"copy.deepcopy",
"evalml.pipelines.utils.make_pipeline",
"evalml.objectives.get_non_core_objectives",
"evalml.utils.logger.get_logger",
"numpy.arange",
"evalml.utils.logger.log_subt... | [((1498, 1518), 'evalml.utils.logger.get_logger', 'get_logger', (['__file__'], {}), '(__file__)\n', (1508, 1518), False, 'from evalml.utils.logger import get_logger, log_subtitle, log_title, time_elapsed, update_pipeline\n'), ((9426, 9473), 'evalml.objectives.get_objective', 'get_objective', (['objective'], {'return_in... |
"""Mobjects representing vector fields."""
__all__ = [
"VectorField",
"ArrowVectorField",
"StreamLines",
]
import itertools as it
import random
from math import ceil, floor
from typing import Callable, Iterable, Optional, Sequence, Tuple, Type
import numpy as np
from colour import Color
from PIL import I... | [
"numpy.clip",
"math.ceil",
"random.shuffle",
"math.floor",
"numpy.random.random",
"itertools.product",
"numpy.array",
"numpy.zeros",
"numpy.apply_along_axis",
"numpy.linspace",
"numpy.random.seed",
"numpy.linalg.norm",
"random.random",
"numpy.arange"
] | [((13292, 13313), 'numpy.zeros', 'np.zeros', (['(ph, pw, 3)'], {}), '((ph, pw, 3))\n', (13300, 13313), True, 'import numpy as np\n'), ((13332, 13364), 'numpy.linspace', 'np.linspace', (['(-fw / 2)', '(fw / 2)', 'pw'], {}), '(-fw / 2, fw / 2, pw)\n', (13343, 13364), True, 'import numpy as np\n'), ((13383, 13415), 'numpy... |
import sys
import typing
import numpy as np
def solve(
n: int,
g: np.array,
) -> typing.NoReturn:
indeg = np.zeros(
n,
dtype=np.int64,
)
for v in g[:, 1]:
indeg[v] += 1
g = g[g[:, 0].argsort()]
i = np.searchsorted(
g[:, 0],
np.arange(n + 1)
)
q = [
v for v in range(n)
if... | [
"numba.pycc.CC",
"numpy.zeros",
"my_module.solve",
"sys.stdin.read",
"numpy.arange"
] | [((115, 142), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'np.int64'}), '(n, dtype=np.int64)\n', (123, 142), True, 'import numpy as np\n'), ((347, 374), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'np.int64'}), '(n, dtype=np.int64)\n', (355, 374), True, 'import numpy as np\n'), ((791, 802), 'my_module.solve', 'solve'... |
'''
Unit tests table.py.
:see: http://docs.python.org/lib/minimal-example.html for an intro to unittest
:see: http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html
:see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292
'''
from __future__ import absolute_import
from statsmodel... | [
"numpy.testing.assert_equal",
"statsmodels.iolib.table.Cell",
"statsmodels.iolib.table.default_latex_fmt.copy",
"statsmodels.iolib.table.default_html_fmt.copy",
"statsmodels.compat.python.zip",
"statsmodels.iolib.table.SimpleTable"
] | [((619, 643), 'statsmodels.iolib.table.default_latex_fmt.copy', 'default_latex_fmt.copy', ([], {}), '()\n', (641, 643), False, 'from statsmodels.iolib.table import default_latex_fmt\n'), ((656, 679), 'statsmodels.iolib.table.default_html_fmt.copy', 'default_html_fmt.copy', ([], {}), '()\n', (677, 679), False, 'from sta... |
from matplotlib import colors
import numpy as np
class SaveOutput:
def __init__(self):
self.outputs = []
def __call__(self, module, module_in, module_out):
self.outputs.append(module_out)
def clear(self):
self.outputs = []
class MidpointNormalize(colors.Normalize):
def __init... | [
"matplotlib.colors.Normalize.__init__",
"numpy.interp"
] | [((417, 466), 'matplotlib.colors.Normalize.__init__', 'colors.Normalize.__init__', (['self', 'vmin', 'vmax', 'clip'], {}), '(self, vmin, vmax, clip)\n', (442, 466), False, 'from matplotlib import colors\n'), ((737, 759), 'numpy.interp', 'np.interp', (['value', 'x', 'y'], {}), '(value, x, y)\n', (746, 759), True, 'impor... |
from typing import Tuple
import torch
from torch.autograd import Function
import torch.nn as nn
from metrics.pointops import pointops_cuda
import numpy as np
class FurthestSampling(Function):
@staticmethod
def forward(ctx, xyz, m):
"""
input: xyz: (b, n, 3) and n > m, m: int32
outpu... | [
"metrics.pointops.pointops_cuda.gathering_backward_cuda",
"torch.cuda.LongTensor",
"metrics.pointops.pointops_cuda.featuregather_forward_cuda",
"metrics.pointops.pointops_cuda.nearestneighbor_cuda",
"metrics.pointops.pointops_cuda.gathering_forward_cuda",
"torch.sqrt",
"metrics.pointops.pointops_cuda.la... | [((12487, 12517), 'torch.clamp', 'torch.clamp', (['dist', '(0.0)', 'np.inf'], {}), '(dist, 0.0, np.inf)\n', (12498, 12517), False, 'import torch\n'), ((425, 451), 'torch.cuda.IntTensor', 'torch.cuda.IntTensor', (['b', 'm'], {}), '(b, m)\n', (445, 451), False, 'import torch\n'), ((516, 576), 'metrics.pointops.pointops_c... |
import csv
import math
import numpy as np
import pandas
import scipy.optimize
import sys
import argparse
def ineq_constraint_1(v):
return np.array([vi for vi in v])
def ineq_constraint_2(v):
return np.array([-vi + 30 for vi in v])
class WeightAverage:
def __init__(self, mean, csv):
self.df = ... | [
"math.ceil",
"argparse.ArgumentParser",
"math.floor",
"pandas.read_csv",
"numpy.array"
] | [((144, 170), 'numpy.array', 'np.array', (['[vi for vi in v]'], {}), '([vi for vi in v])\n', (152, 170), True, 'import numpy as np\n'), ((210, 244), 'numpy.array', 'np.array', (['[(-vi + 30) for vi in v]'], {}), '([(-vi + 30) for vi in v])\n', (218, 244), True, 'import numpy as np\n'), ((2690, 2744), 'argparse.Argument... |
# pylint: disable=no-self-use,invalid-name
import numpy as np
from numpy.testing import assert_almost_equal
import torch
from allennlp.common import Params
from allennlp.data import Vocabulary
from allennlp.modules.token_embedders import BagOfWordCountsTokenEmbedder
from allennlp.common.testing import AllenNlpTestCase
... | [
"allennlp.common.Params",
"allennlp.data.Vocabulary",
"torch.from_numpy",
"numpy.array",
"allennlp.modules.token_embedders.BagOfWordCountsTokenEmbedder.from_params"
] | [((484, 496), 'allennlp.data.Vocabulary', 'Vocabulary', ([], {}), '()\n', (494, 496), False, 'from allennlp.data import Vocabulary\n'), ((755, 765), 'allennlp.common.Params', 'Params', (['{}'], {}), '({})\n', (761, 765), False, 'from allennlp.common import Params\n'), ((785, 852), 'allennlp.modules.token_embedders.BagO... |
#!/home/a.ghaderi/.conda/envs/envjm/bin/python
# Model 2
import pystan
import pandas as pd
import numpy as np
import sys
sys.path.append('../../')
import utils
parts = 1
data = utils.get_data() #loading dateset
data = data[data['participant']==parts]
mis = np.where((data['n200lat']<.101)|(data['n200lat']>.... | [
"numpy.where",
"utils.get_data",
"numpy.concatenate",
"numpy.random.uniform",
"sys.path.append",
"pystan.StanModel"
] | [((122, 147), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (137, 147), False, 'import sys\n'), ((180, 196), 'utils.get_data', 'utils.get_data', ([], {}), '()\n', (194, 196), False, 'import utils\n'), ((683, 724), 'pystan.StanModel', 'pystan.StanModel', ([], {'model_code': 'model_wiener'... |
from dataclasses import dataclass
import numpy as np
import xarray as xr
from power_perceiver.load_prepared_batches.data_sources import PV
from power_perceiver.load_prepared_batches.data_sources.prepared_data_source import XarrayBatch
@dataclass
class ReduceNumPVSystems:
"""Reduce the number of PV systems per e... | [
"numpy.nonzero",
"numpy.zeros",
"numpy.random.default_rng",
"xarray.DataArray"
] | [((713, 736), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (734, 736), True, 'import numpy as np\n'), ((942, 1019), 'numpy.zeros', 'np.zeros', ([], {'shape': '(num_examples, self.requested_num_pv_systems)', 'dtype': 'np.int32'}), '(shape=(num_examples, self.requested_num_pv_systems), dtype=np.... |
import numpy as np
def random_augmentation(img, mask):
#you can add any augmentations you need
return img, mask
def batch_generator(image, mask,
batch_size=1,
crop_size=0,
patch_size=256,
bbox= None,
augment... | [
"numpy.ndim",
"numpy.max",
"numpy.array",
"numpy.random.randint",
"numpy.expand_dims",
"numpy.moveaxis"
] | [((1181, 1194), 'numpy.max', 'np.max', (['image'], {}), '(image)\n', (1187, 1194), True, 'import numpy as np\n'), ((950, 963), 'numpy.ndim', 'np.ndim', (['mask'], {}), '(mask)\n', (957, 963), True, 'import numpy as np\n'), ((972, 986), 'numpy.ndim', 'np.ndim', (['image'], {}), '(image)\n', (979, 986), True, 'import num... |
import numpy as np
import pickle
from collections import defaultdict
from parsing import parser
from analysis import training
def main():
parse = parser.Parser();
train_digits = parse.parse_file('data/pendigits-train');
test_digits = parse.parse_file('data/pendigits-test')
centroids = training.get_d... | [
"pickle.dump",
"parsing.parser.Parser",
"analysis.training.get_digit_kmeans_centroids",
"numpy.ndarray",
"collections.defaultdict",
"analysis.training.set_digit_observations"
] | [((152, 167), 'parsing.parser.Parser', 'parser.Parser', ([], {}), '()\n', (165, 167), False, 'from parsing import parser\n'), ((306, 364), 'analysis.training.get_digit_kmeans_centroids', 'training.get_digit_kmeans_centroids', (['train_digits', '(256 - 3)'], {}), '(train_digits, 256 - 3)\n', (341, 364), False, 'from ana... |
#pylint: disable=invalid-name
#pylint: disable=too-many-instance-attributes
#pylint: disable=too-many-return-statements
#pylint: disable=too-many-statements
"""
Class structure and methods for an oscilloscope channel.
The idea is to collect all the relevant information from all the Rigol
scope waveforms into a single ... | [
"numpy.array",
"numpy.frombuffer",
"numpy.linspace"
] | [((2293, 2334), 'numpy.frombuffer', 'np.frombuffer', (['w.data.raw'], {'dtype': 'np.uint8'}), '(w.data.raw, dtype=np.uint8)\n', (2306, 2334), True, 'import numpy as np\n'), ((6716, 6747), 'numpy.linspace', 'np.linspace', (['(-h)', 'h', 'self.points'], {}), '(-h, h, self.points)\n', (6727, 6747), True, 'import numpy as ... |
import os
import numpy as np
import tensorflow as tf
from models_gqa.model import Model
from models_gqa.config import build_cfg_from_argparse
from util.gqa_train.data_reader import DataReader
import json
# Load config
cfg = build_cfg_from_argparse()
# Start session
os.environ["CUDA_VISIBLE_DEVICES"] = str(cfg.GPU_ID... | [
"os.makedirs",
"models_gqa.config.build_cfg_from_argparse",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"os.path.join",
"numpy.argmax",
"tensorflow.global_variables",
"numpy.sum",
"util.gqa_train.data_reader.DataReader",
"tensorflow.train.ExponentialMovingAverage",
"tensorflow.GPUOptions... | [((226, 251), 'models_gqa.config.build_cfg_from_argparse', 'build_cfg_from_argparse', ([], {}), '()\n', (249, 251), False, 'from models_gqa.config import build_cfg_from_argparse\n'), ((615, 1173), 'util.gqa_train.data_reader.DataReader', 'DataReader', (['imdb_file'], {'shuffle': '(False)', 'one_pass': '(True)', 'batch_... |
# In[42]:
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
# In[43]:
# describe the model
def deriv(y, t, N, beta, gamma, delta):
S, E, I, R = y
dSdt = -beta * S * I / N # S(t) – susceptible (de som är mottagliga för infektion).
dEdt = beta * S * I / N - gamma * ... | [
"matplotlib.pyplot.savefig",
"scipy.integrate.odeint",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1045, 1068), 'numpy.linspace', 'np.linspace', (['(0)', '(99)', '(100)'], {}), '(0, 99, 100)\n', (1056, 1068), True, 'import numpy as np\n'), ((1210, 1260), 'scipy.integrate.odeint', 'odeint', (['deriv', 'y0', 't'], {'args': '(N, beta, gamma, delta)'}), '(deriv, y0, t, args=(N, beta, gamma, delta))\n', (1216, 1260), ... |
"""
This script is where the preprocessed data is used to train the SVM model to
perform the classification. I am using Stratified K-Fold Cross Validation to
prevent bias and/or any imbalance that could affect the model's accuracy.
REFERENCE: https://medium.com/@bedigunjit/simple-guide-to-text-classification-nlp-usin... | [
"numpy.mean",
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.std",
"numpy.max",
"sklearn.model_selection.StratifiedKFold",
"sklearn.feature_extraction.text.TfidfVectorizer",
"numpy.min",
"sklearn.svm.SVC"
] | [((686, 730), 'pandas.read_csv', 'pd.read_csv', (['"""preprocessed.csv"""'], {'index_col': '(0)'}), "('preprocessed.csv', index_col=0)\n", (697, 730), True, 'import pandas as pd\n'), ((857, 944), 'sklearn.model_selection.train_test_split', 'model_selection.train_test_split', (["df['Text']", "df['PublicationTitle']"], {... |
#!/usr/bin/env python
import numpy as np, os, sys
from get_sepsis_score import load_sepsis_model, get_sepsis_score
def load_challenge_data(file):
with open(file, 'r') as f:
header = f.readline().strip()
column_names = header.split('|')
data = np.loadtxt(f, delimiter='|')
# Ignore Seps... | [
"get_sepsis_score.load_sepsis_model",
"os.listdir",
"os.path.join",
"numpy.zeros",
"os.path.isdir",
"os.mkdir",
"get_sepsis_score.get_sepsis_score",
"numpy.loadtxt"
] | [((1015, 1042), 'os.listdir', 'os.listdir', (['input_directory'], {}), '(input_directory)\n', (1025, 1042), False, 'import numpy as np, os, sys\n'), ((1308, 1327), 'get_sepsis_score.load_sepsis_model', 'load_sepsis_model', ([], {}), '()\n', (1325, 1327), False, 'from get_sepsis_score import load_sepsis_model, get_sepsi... |
import numpy as np
import scipy
import warnings
try:
import matplotlib.pyplot as pl
import matplotlib
except ImportError:
warnings.warn("matplotlib could not be loaded!")
pass
from . import labels
from . import colors
def truncate_text(text, max_len):
if len(text) > max_len:
return text[:i... | [
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.figure",
"scipy.stats.ttest_ind",
"matplotlib.pyplot.scatter",
"numpy.min",
"warnings.warn",
"numpy.argmin",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.show"
] | [((1417, 1443), 'matplotlib.pyplot.figure', 'pl.figure', ([], {'figsize': '(10, 3)'}), '(figsize=(10, 3))\n', (1426, 1443), True, 'import matplotlib.pyplot as pl\n'), ((1792, 1805), 'numpy.min', 'np.min', (['pvals'], {}), '(pvals)\n', (1798, 1805), True, 'import numpy as np\n'), ((1998, 2064), 'matplotlib.pyplot.scatte... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 14:57:32 2020
@author: Nicolai
"""
import sys
import os
importpath = os.path.dirname(os.path.realpath(__file__)) + "/../"
sys.path.append(importpath)
from FemPdeBase import FemPdeBase
import numpy as np
# import from ngsolve
import ngsolve as ngs
from netgen.geom2d i... | [
"psutil.Process",
"netgen.geom2d.unit_square.GenerateMesh",
"time.sleep",
"numpy.array",
"ngsolve.Preconditioner",
"sys.path.append",
"numpy.arange",
"gc.enable",
"gc.disable",
"gc.isenabled",
"ngsolve.GridFunction",
"numpy.meshgrid",
"ngsolve.LinearForm",
"ngsolve.HDiv",
"gc.collect",
... | [((174, 201), 'sys.path.append', 'sys.path.append', (['importpath'], {}), '(importpath)\n', (189, 201), False, 'import sys\n'), ((6776, 6788), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (6786, 6788), True, 'import matplotlib.pyplot as plt\n'), ((6848, 6872), 'numpy.arange', 'np.arange', (['(0)', '(1.01... |
"""Hyper-distributions."""
from libqif.core.secrets import Secrets
from libqif.core.channel import Channel
from numpy import array, arange, zeros
from numpy import delete as npdelete
class Hyper:
def __init__(self, channel):
"""Hyper-distribution. To create an instance of this class it is
class i... | [
"numpy.delete",
"numpy.array",
"libqif.core.secrets.Secrets",
"numpy.arange"
] | [((2486, 2518), 'numpy.arange', 'arange', (['self.channel.num_outputs'], {}), '(self.channel.num_outputs)\n', (2492, 2518), False, 'from numpy import array, arange, zeros\n'), ((2742, 2774), 'numpy.arange', 'arange', (['self.channel.num_outputs'], {}), '(self.channel.num_outputs)\n', (2748, 2774), False, 'from numpy im... |
import sys
import pytz
#import xml.utils.iso8601
import time
import numpy
from datetime import date, datetime, timedelta
from matplotlib import pyplot as plt
from exchange import cb_exchange as cb_exchange
from exchange import CoinbaseExchangeAuth
from abc import ABCMeta, abstractmethod
class strategy(object):
"""... | [
"sys.stdout.write",
"numpy.array",
"sys.stdout.flush",
"numpy.average"
] | [((5274, 5296), 'numpy.array', 'numpy.array', (['fltprices'], {}), '(fltprices)\n', (5285, 5296), False, 'import numpy\n'), ((5327, 5350), 'numpy.array', 'numpy.array', (['fltvolumes'], {}), '(fltvolumes)\n', (5338, 5350), False, 'import numpy\n'), ((5374, 5436), 'numpy.average', 'numpy.average', (['np_discrete_prices'... |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'shape': [(3, 4), ()],
'dtype': [numpy.float16, numpy.float32, numpy.flo... | [
"numpy.prod",
"chainer.Variable",
"chainer.testing.run_module",
"chainer.testing.product",
"chainer.functions.Flatten",
"chainer.functions.flatten",
"numpy.random.uniform",
"chainer.cuda.to_gpu"
] | [((1406, 1444), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (1424, 1444), False, 'from chainer import testing\n'), ((678, 702), 'chainer.Variable', 'chainer.Variable', (['x_data'], {}), '(x_data)\n', (694, 702), False, 'import chainer\n'), ((715, 735), '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Brno University of Technology FIT
# Author: <NAME> <<EMAIL>>
# All Rights Reserved
import os
import logging
import pickle
import multiprocessing
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from vbdiar.features.segments... | [
"logging.getLogger",
"numpy.mean",
"pickle.dump",
"sklearn.metrics.pairwise.cosine_similarity",
"vbdiar.embeddings.embedding.extract_embeddings",
"numpy.std",
"os.path.join",
"pickle.load",
"os.path.isfile",
"numpy.array",
"os.path.dirname",
"multiprocessing.Pool",
"numpy.concatenate",
"vb... | [((488, 515), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (505, 515), False, 'import logging\n'), ((1308, 1336), 'multiprocessing.Pool', 'multiprocessing.Pool', (['n_jobs'], {}), '(n_jobs)\n', (1328, 1336), False, 'import multiprocessing\n'), ((3560, 3623), 'vbdiar.embeddings.embedding... |
import numpy as np
import os
import logging
from sklearn.model_selection import train_test_split
DATASET_ROOT_FOLDER = os.path.abspath('datasets')
class DataLoader:
train = None
validation = None
test = None
mode = None
partial_dataset = None
@staticmethod
def load(train_path=None, valid... | [
"numpy.reshape",
"os.path.join",
"os.path.abspath",
"numpy.loadtxt",
"numpy.random.permutation"
] | [((120, 147), 'os.path.abspath', 'os.path.abspath', (['"""datasets"""'], {}), "('datasets')\n", (135, 147), False, 'import os\n'), ((3261, 3277), 'numpy.loadtxt', 'np.loadtxt', (['path'], {}), '(path)\n', (3271, 3277), True, 'import numpy as np\n'), ((3810, 3877), 'numpy.reshape', 'np.reshape', (['images', '[images.sha... |
# -*- coding:utf-8 -*-
# Author: RubanSeven
# import cv2
import numpy as np
# from transform import get_perspective_transform, warp_perspective
from warp_mls import WarpMLS
def distort(src, segment):
img_h, img_w = src.shape[:2]
cut = img_w // segment
thresh = cut // 3
# thresh = img_h... | [
"warp_mls.WarpMLS",
"numpy.random.randint",
"numpy.arange"
] | [((934, 958), 'numpy.arange', 'np.arange', (['(1)', 'segment', '(1)'], {}), '(1, segment, 1)\n', (943, 958), True, 'import numpy as np\n'), ((1373, 1417), 'warp_mls.WarpMLS', 'WarpMLS', (['src', 'src_pts', 'dst_pts', 'img_w', 'img_h'], {}), '(src, src_pts, dst_pts, img_w, img_h)\n', (1380, 1417), False, 'from warp_mls ... |
import logging
from typing import Dict, List, Optional
import numpy as np
import qiskit
from qiskit.circuit import Barrier, Delay, Reset
from qiskit.circuit.library import (CRXGate, CRYGate, CRZGate, CZGate,
PhaseGate, RXGate, RYGate, RZGate, U1Gate,
... | [
"logging.getLogger",
"qiskit.circuit.quantumcircuit.QuantumCircuit",
"qiskit.circuit.Delay",
"numpy.abs",
"logging.info",
"qiskit.dagcircuit.DAGCircuit",
"qiskit.converters.circuit_to_dag.circuit_to_dag",
"numpy.mod"
] | [((785, 812), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (802, 812), False, 'import logging\n'), ((5004, 5021), 'qiskit.circuit.quantumcircuit.QuantumCircuit', 'QuantumCircuit', (['(1)'], {}), '(1)\n', (5018, 5021), False, 'from qiskit.circuit.quantumcircuit import QuantumCircuit\n'),... |
def help():
return '''
Isotropic-Anisotropic Filtering Norm Nesterov Algorithm
Solves the filtering norm minimization + quadratic term problem
Nesterov algorithm, with continuation:
argmin_x || iaFN(x) ||_1/2 subjected to ||b - Ax||_2^2 < delta
If no filter is provided, solves the L1.
Continuation is perf... | [
"IAFNNesterov.IAFNNesterov",
"fil2mat.fil2mat",
"numpy.power",
"scipy.sparse.issparse",
"numpy.array",
"numpy.matmul",
"numpy.vstack",
"numpy.transpose"
] | [((4800, 4835), 'numpy.power', 'np.power', (['(muf / mu0)', '(1 / MaxIntIter)'], {}), '(muf / mu0, 1 / MaxIntIter)\n', (4808, 4835), True, 'import numpy as np\n'), ((4856, 4894), 'numpy.power', 'np.power', (['(TolVar / 0.1)', '(1 / MaxIntIter)'], {}), '(TolVar / 0.1, 1 / MaxIntIter)\n', (4864, 4894), True, 'import nump... |
import BboxToolkit as bt
import pickle
import copy
import numpy as np
path1="/home/hnu1/GGM/OBBDetection/work_dir/oriented_obb_contrast_catbalance/dets.pkl"
path2="/home/hnu1/GGM/OBBDetection/data/FaIR1M/test/annfiles/ori_annfile.pkl"#
with open(path2,'rb') as f: #/home/disk/FAIR1M_1000_split/val/annfiles/ori_... | [
"numpy.append",
"BboxToolkit.obb2poly",
"pickle.load",
"copy.deepcopy"
] | [((344, 358), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (355, 358), False, 'import pickle\n'), ((402, 416), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (413, 416), False, 'import pickle\n'), ((430, 452), 'copy.deepcopy', 'copy.deepcopy', (['obbdets'], {}), '(obbdets)\n', (443, 452), False, 'import cop... |
import matplotlib
matplotlib.use('Agg')
import numpy as np
from astropy.tests.helper import pytest
from .. import FITSFigure
def test_grid_addremove():
data = np.zeros((16, 16))
f = FITSFigure(data)
f.add_grid()
f.remove_grid()
f.add_grid()
f.close()
def test_grid_showhide():
data = np... | [
"matplotlib.use",
"numpy.zeros",
"astropy.tests.helper.pytest.raises"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((167, 185), 'numpy.zeros', 'np.zeros', (['(16, 16)'], {}), '((16, 16))\n', (175, 185), True, 'import numpy as np\n'), ((318, 336), 'numpy.zeros', 'np.zeros', (['(16, 16)'], {}), '((16, 16))\n', (3... |
# microsig
"""
Author: <NAME>
More detail about the MicroSIG can be found at:
Website:
https://gitlab.com/defocustracking/microsig-python
Publication:
Rossi M, Synthetic image generator for defocusing and astigmatic PIV/PTV, Meas. Sci. Technol., 31, 017003 (2020)
DOI:10.1088/1361-6501/ab42bb.
"""
import n... | [
"numpy.uint8",
"tkinter.filedialog.askdirectory",
"numpy.arccos",
"numpy.sqrt",
"numpy.hstack",
"numpy.array",
"sys.exit",
"numpy.sin",
"numpy.genfromtxt",
"numpy.arange",
"numpy.cross",
"numpy.sort",
"os.path.split",
"numpy.max",
"tkinter.filedialog.askopenfilenames",
"numpy.vstack",
... | [((4177, 4184), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (4182, 4184), True, 'import tkinter as tk\n'), ((4263, 4395), 'tkinter.filedialog.askopenfilenames', 'filedialog.askopenfilenames', ([], {'title': '"""Select settings file"""', 'parent': 'root', 'filetypes': "(('txt files', '*.txt'), ('all files', '*.*'))"}), "(t... |
from matplotlib.colors import LinearSegmentedColormap
from numpy import nan, inf
# Used to reconstruct the colormap in viscm
parameters = {'xp': [-5.4895292543686764, 14.790571669586654, 82.5546687431056, 29.15531114139253, -4.1316769886951761, -13.002076438907238],
'yp': [-35.948168839230306, -42.27337... | [
"viscm.viscm",
"numpy.linspace",
"matplotlib.colors.LinearSegmentedColormap.from_list",
"matplotlib.pyplot.show"
] | [((16621, 16673), 'matplotlib.colors.LinearSegmentedColormap.from_list', 'LinearSegmentedColormap.from_list', (['__file__', 'cm_data'], {}), '(__file__, cm_data)\n', (16654, 16673), False, 'from matplotlib.colors import LinearSegmentedColormap\n'), ((17022, 17032), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n'... |
"""
Author: <NAME>
"""
import numpy as np
import pandas as pd
from sklearn.neighbors import NearestNeighbors
def affinity_graph(X):
'''
This function returns a numpy array.
'''
ni, nd = X.shape
A = np.zeros((ni, ni))
for i in range(ni):
for j in range(i+1, ni):
dist = ((X[i] - X[j])**2).sum() # compute ... | [
"numpy.exp",
"numpy.zeros",
"sklearn.neighbors.NearestNeighbors"
] | [((208, 226), 'numpy.zeros', 'np.zeros', (['(ni, ni)'], {}), '((ni, ni))\n', (216, 226), True, 'import numpy as np\n'), ((606, 624), 'numpy.zeros', 'np.zeros', (['(ni, ni)'], {}), '((ni, ni))\n', (614, 624), True, 'import numpy as np\n'), ((896, 914), 'numpy.zeros', 'np.zeros', (['(ni, ni)'], {}), '((ni, ni))\n', (904,... |
import numpy as np
import pytest
from pytest import approx
from pymt.component.grid import GridMixIn
class Port:
def __init__(self, name, uses=None, provides=None):
self._name = name
self._uses = uses or []
self._provides = provides or []
def get_component_name(self):
return ... | [
"numpy.array",
"pytest.raises"
] | [((7100, 7125), 'pytest.raises', 'pytest.raises', (['IndexError'], {}), '(IndexError)\n', (7113, 7125), False, 'import pytest\n'), ((1613, 1638), 'numpy.array', 'np.array', (['[3.0, 5.0, 7.0]'], {}), '([3.0, 5.0, 7.0])\n', (1621, 1638), True, 'import numpy as np\n'), ((2214, 2258), 'numpy.array', 'np.array', (['[[0.0, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.