code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# # Copyright (c) 2021 The GPflux Contributors. # # 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 agr...
[ "numpy.testing.assert_equal", "tensorflow_probability.distributions.MultivariateNormalDiag", "tensorflow_probability.distributions.MultivariateNormalTriL", "numpy.testing.assert_allclose", "numpy.concatenate", "numpy.testing.assert_array_equal", "numpy.eye", "numpy.allclose", "gpflux.encoders.Direct...
[((897, 935), 'tensorflow.keras.backend.set_floatx', 'tf.keras.backend.set_floatx', (['"""float64"""'], {}), "('float64')\n", (924, 935), True, 'import tensorflow as tf\n'), ((2330, 2370), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""w_dim"""', '[1, 5]'], {}), "('w_dim', [1, 5])\n", (2353, 2370), False, ...
""" This script will modulate the blinky lights using the following algorithm: 1) uses user-provided location to obtain row of pixel data from bathy image 2) samples a 'number of LEDs' number of pixels from that row 3) shifts the sampled row data to center it at the location specified by user 4) displays resulting pix...
[ "PIL.Image.open", "numpy.roll", "numpy.asarray", "optparse.OptionParser", "time.sleep", "numpy.take", "blinkytape.BlinkyTape", "sys.exit", "json.load" ]
[((1945, 1968), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (1966, 1968), False, 'import optparse\n'), ((3304, 3328), 'blinkytape.BlinkyTape', 'BlinkyTape', (['port', 'n_leds'], {}), '(port, n_leds)\n', (3314, 3328), False, 'from blinkytape import BlinkyTape\n'), ((3366, 3374), 'time.sleep', 'sl...
""" Basic usage =========== This example presents the basic usage of brokenaxes """ import matplotlib.pyplot as plt from brokenaxes import brokenaxes import numpy as np fig = plt.figure(figsize=(5,2)) bax = brokenaxes(xlims=((0, .1), (.4, .7)), ylims=((-1, .7), (.79, 1)), hspace=.05) x = np.linspace(0, 1, 100) bax...
[ "matplotlib.pyplot.figure", "brokenaxes.brokenaxes", "numpy.linspace", "numpy.cos", "numpy.sin" ]
[((180, 206), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 2)'}), '(figsize=(5, 2))\n', (190, 206), True, 'import matplotlib.pyplot as plt\n'), ((212, 299), 'brokenaxes.brokenaxes', 'brokenaxes', ([], {'xlims': '((0, 0.1), (0.4, 0.7))', 'ylims': '((-1, 0.7), (0.79, 1))', 'hspace': '(0.05)'}), '(xlims...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
[ "qiskit_metal.draw.union", "math.cos", "qiskit_metal.Dict", "numpy.array", "qiskit_metal.draw.rectangle", "qiskit_metal.draw.translate", "qiskit_metal.draw.rotate", "math.sin" ]
[((4010, 4566), 'qiskit_metal.Dict', 'Dict', ([], {'pad_width': '"""1000um"""', 'pad_height': '"""300um"""', 'finger_width': '"""50um"""', 'finger_height': '"""100um"""', 'finger_space': '"""50um"""', 'pad_pos_x': '"""0um"""', 'pad_pos_y': '"""0um"""', 'comb_width': '"""50um"""', 'comb_space_vert': '"""50um"""', 'comb_...
import inspect import numpy as np from pandas._libs import reduction as libreduction from pandas.util._decorators import cache_readonly from pandas.core.dtypes.common import ( is_dict_like, is_extension_array_dtype, is_list_like, is_sequence, ) from pandas.core.dtypes.generic import ABCSeries def f...
[ "pandas.core.dtypes.common.is_list_like", "pandas._libs.reduction.compute_reduction", "pandas.Series", "pandas.core.dtypes.common.is_sequence", "numpy.asarray", "inspect.getfullargspec", "numpy.errstate", "numpy.apply_along_axis", "numpy.empty_like", "pandas.core.dtypes.common.is_dict_like" ]
[((5381, 5409), 'numpy.empty_like', 'np.empty_like', (['target.values'], {}), '(target.values)\n', (5394, 5409), True, 'import numpy as np\n'), ((2193, 2213), 'pandas.core.dtypes.common.is_list_like', 'is_list_like', (['self.f'], {}), '(self.f)\n', (2205, 2213), False, 'from pandas.core.dtypes.common import is_dict_lik...
# Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ Test for the piezo tensor class """ __author__ = "<NAME>" __version__ = "0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Development" __date__ = "4/1/16" import os import unittest import numpy as np ...
[ "pymatgen.analysis.piezo.PiezoTensor.from_vasp_voigt", "pymatgen.analysis.piezo.PiezoTensor", "numpy.array", "numpy.zeros", "pymatgen.analysis.piezo.PiezoTensor.from_voigt", "unittest.main" ]
[((2195, 2210), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2208, 2210), False, 'import unittest\n'), ((554, 684), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0, 0.0, 0.03839, 0.0], [0.0, 0.0, 0.0, 0.03839, 0.0, 0.0], [\n 6.89822, 6.89822, 27.4628, 0.0, 0.0, 0.0]]'], {}), '([[0.0, 0.0, 0.0, 0.0, 0.03839, 0....
import argparse import json import numpy as np import pandas as pd import os from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report,f1_score from keras.models import Sequential from keras.layers import Dense, Dropout fro...
[ "pandas.read_csv", "sklearn.metrics.classification_report", "keras.utils.vis_utils.plot_model", "numpy.column_stack", "keras.layers.Dense", "numpy.mean", "argparse.ArgumentParser", "keras.backend.clip", "numpy.asarray", "numpy.concatenate", "keras.backend.epsilon", "json.loads", "sklearn.mod...
[((2973, 2997), 'pandas.read_csv', 'pd.read_csv', (['dataset_csv'], {}), '(dataset_csv)\n', (2984, 2997), True, 'import pandas as pd\n'), ((4112, 4136), 'numpy.asarray', 'np.asarray', (['sentence_emb'], {}), '(sentence_emb)\n', (4122, 4136), True, 'import numpy as np\n'), ((4182, 4203), 'numpy.asarray', 'np.asarray', (...
''' ------------------------------------------------------------------------------------------------- This code accompanies the paper titled "Human injury-based safety decision of automated vehicles" Author: <NAME>, <NAME>, <NAME>, <NAME> Corresponding author: <NAME> (<EMAIL>) ------------------------------------------...
[ "numpy.abs", "numpy.sqrt", "numpy.cos", "numpy.sin", "numpy.arctan" ]
[((723, 742), 'numpy.cos', 'np.cos', (['delta_angle'], {}), '(delta_angle)\n', (729, 742), True, 'import numpy as np\n'), ((1050, 1084), 'numpy.arctan', 'np.arctan', (['(veh_cgf[0] / veh_cgs[0])'], {}), '(veh_cgf[0] / veh_cgs[0])\n', (1059, 1084), True, 'import numpy as np\n'), ((1106, 1142), 'numpy.abs', 'np.abs', (['...
"""Test the search module""" from collections.abc import Iterable, Sized from io import StringIO from itertools import chain, product from functools import partial import pickle import sys from types import GeneratorType import re import numpy as np import scipy.sparse as sp import pytest from sklearn.utils.fixes im...
[ "sklearn.utils._testing.assert_warns_message", "sklearn.model_selection.GridSearchCV", "sklearn.model_selection.StratifiedShuffleSplit", "sklearn.utils._testing.assert_raises", "sklearn.tree.DecisionTreeRegressor", "pickle.dumps", "sklearn.utils._testing.assert_array_equal", "sklearn.neighbors.KNeighb...
[((4079, 4125), 'numpy.array', 'np.array', (['[[-1, -1], [-2, -1], [1, 1], [2, 1]]'], {}), '([[-1, -1], [-2, -1], [1, 1], [2, 1]])\n', (4087, 4125), True, 'import numpy as np\n'), ((4130, 4152), 'numpy.array', 'np.array', (['[1, 1, 2, 2]'], {}), '([1, 1, 2, 2])\n', (4138, 4152), True, 'import numpy as np\n'), ((4385, 4...
# -*- encoding:utf-8 -*- # @Time : 2021/1/3 15:15 # @Author : gfjiang import os.path as osp import mmcv import numpy as np import cvtools import matplotlib.pyplot as plt import cv2.cv2 as cv from functools import partial import torch import math from cvtools.utils.path import add_prefix_filename_suffix from mmdet....
[ "math.sqrt", "cvtools.imwrite", "mmdet.ops.nms", "matplotlib.pyplot.imshow", "os.path.exists", "cvtools.utils.path.add_prefix_filename_suffix", "cvtools.draw_boxes_texts", "numpy.where", "mmdet.apis.init_detector", "numpy.max", "matplotlib.pyplot.close", "numpy.vstack", "numpy.concatenate", ...
[((643, 671), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(32, 32)'}), '(figsize=(32, 32))\n', (653, 671), True, 'import matplotlib.pyplot as plt\n'), ((1399, 1410), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (1408, 1410), True, 'import matplotlib.pyplot as plt\n'), ((1815, 1837), 'os.pat...
# coding=utf-8 # Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved. # Copyright 2018 The Google AI Language Team 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...
[ "utils.utils.setup_xla_flags", "horovod.tensorflow.init", "tensorflow.reduce_sum", "tensorflow.estimator.EstimatorSpec", "tensorflow.truncated_normal_initializer", "tensorflow.metrics.mean", "tensorflow.python.compiler.tensorrt.trt_convert.TrtGraphConverter", "tensorflow.io.FixedLenFeature", "tensor...
[((6344, 6560), 'modeling.BertModel', 'modeling.BertModel', ([], {'config': 'bert_config', 'is_training': 'is_training', 'input_ids': 'input_ids', 'input_mask': 'input_mask', 'token_type_ids': 'segment_ids', 'use_one_hot_embeddings': 'use_one_hot_embeddings', 'compute_type': 'tf.float32'}), '(config=bert_config, is_tra...
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # Copyright 2018 The HuggingFace Inc. team. # # 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/licen...
[ "paddlenlp.data.Pad", "paddlenlp.metrics.squad.compute_prediction", "paddle.nn.functional.cross_entropy", "paddle.seed", "os.path.exists", "paddle.no_grad", "json.dumps", "paddle.distributed.init_parallel_env", "numpy.random.seed", "paddle.io.DataLoader", "paddle.set_device", "paddle.io.BatchS...
[((1787, 1803), 'paddle.no_grad', 'paddle.no_grad', ([], {}), '()\n', (1801, 1803), False, 'import paddle\n'), ((1704, 1726), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (1715, 1726), False, 'import random\n'), ((1731, 1756), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.see...
# Credit to https://medium.com/emergent-future/simple-reinforcement-learning-with-tensorflow-part-0-q-learning-with-tables-and-neural-networks-d195264329d0 import gym import tensorflow as tf import numpy as np import matplotlib.pyplot as plt env = gym.make('FrozenLake-v0') # NEURAL NETWORK IMPLEMENTATION tf.reset_d...
[ "numpy.identity", "tensorflow.reset_default_graph", "numpy.random.rand", "tensorflow.placeholder", "matplotlib.pyplot.plot", "tensorflow.Session", "numpy.max", "tensorflow.train.GradientDescentOptimizer", "tensorflow.global_variables_initializer", "tensorflow.argmax", "matplotlib.pyplot.figure",...
[((251, 276), 'gym.make', 'gym.make', (['"""FrozenLake-v0"""'], {}), "('FrozenLake-v0')\n", (259, 276), False, 'import gym\n'), ((310, 334), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (332, 334), True, 'import tensorflow as tf\n'), ((395, 463), 'tensorflow.placeholder', 'tf.placeholde...
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "torch.manual_seed", "torch.max", "torch.Tensor", "numpy.logaddexp", "numpy.exp", "torch.tensor", "numpy.zeros", "torch.nn.functional.log_softmax", "numpy.zeros_like", "torch.randn" ]
[((2794, 2812), 'torch.max', 'torch.max', (['lengths'], {}), '(lengths)\n', (2803, 2812), False, 'import torch\n'), ((2825, 2849), 'torch.max', 'torch.max', (['label_lengths'], {}), '(label_lengths)\n', (2834, 2849), False, 'import torch\n'), ((3774, 3801), 'numpy.zeros', 'np.zeros', (['(T, U)'], {'dtype': '"""f"""'}),...
import numpy as np from sklearn.linear_model import LogisticRegression from .models import User from .twitter import vectorize_tweet def predict_user(user1_name, user2_name, tweet_text): """ Determine and return which user is more likely to say a given Tweet. Example: predict_user('ausen', 'elonmusk'...
[ "numpy.array", "numpy.vstack", "sklearn.linear_model.LogisticRegression" ]
[((561, 609), 'numpy.array', 'np.array', (['[tweet.vect for tweet in user1.tweets]'], {}), '([tweet.vect for tweet in user1.tweets])\n', (569, 609), True, 'import numpy as np\n'), ((627, 675), 'numpy.array', 'np.array', (['[tweet.vect for tweet in user2.tweets]'], {}), '([tweet.vect for tweet in user2.tweets])\n', (635...
# sys import os import sys import numpy as np import random import pickle import json # torch import torch import torch.nn as nn from torchvision import datasets, transforms # operation from . import tools class Feeder_UCF(torch.utils.data.Dataset): """ Feeder for skeleton-based action recognition in kinetics-sk...
[ "os.listdir", "os.path.join", "numpy.array", "numpy.zeros", "json.load" ]
[((2055, 2081), 'os.listdir', 'os.listdir', (['self.data_path'], {}), '(self.data_path)\n', (2065, 2081), False, 'import os\n'), ((2393, 2454), 'numpy.array', 'np.array', (["[label_info[id]['label_index'] for id in sample_id]"], {}), "([label_info[id]['label_index'] for id in sample_id])\n", (2401, 2454), True, 'import...
# pvtrace is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # pvtrace is distributed in the hope that it will be useful, # but WITHOUT...
[ "Geometry.Cylinder", "external.transformations.translation_matrix", "numpy.sqrt", "numpy.tan", "Geometry.FinitePlane", "numpy.sin", "Geometry.transform_direction", "numpy.array", "numpy.random.randint", "Geometry.transform_point", "external.transformations.rotation_matrix", "numpy.cos", "num...
[((1353, 1372), 'numpy.array', 'np.array', (['[x, y, z]'], {}), '([x, y, z])\n', (1361, 1372), True, 'import numpy as np\n'), ((1299, 1313), 'numpy.sqrt', 'np.sqrt', (['(1 - s)'], {}), '(1 - s)\n', (1306, 1313), True, 'import numpy as np\n'), ((1971, 1979), 'Trace.Photon', 'Photon', ([], {}), '()\n', (1977, 1979), Fals...
import numpy as np import sys ## ROCKSTAR ## halostruct1 = np.dtype([('id',np.int64), ('pos',np.float32,(6,)), ('corevel',np.float32,(3,)), ('bulkvel',np.float32,(3,)), ('m',np.float32), ('r',np.floa...
[ "numpy.dtype", "sys.exit" ]
[((60, 1145), 'numpy.dtype', 'np.dtype', (["[('id', np.int64), ('pos', np.float32, (6,)), ('corevel', np.float32, (3,)),\n ('bulkvel', np.float32, (3,)), ('m', np.float32), ('r', np.float32), (\n 'child_r', np.float32), ('vmax_r', np.float32), ('mgrav', np.float32),\n ('vmax', np.float32), ('rvmax', np.float32...
# -*- coding: utf-8 -*- # Copyright (c) 2013 <NAME> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merg...
[ "nearpy.hashes.RandomBinaryProjections", "nearpy.hashes.HashPermutationMapper", "numpy.zeros", "nearpy.distances.CosineDistance", "time.time", "numpy.random.randn", "nearpy.hashes.HashPermutations" ]
[((1613, 1624), 'time.time', 'time.time', ([], {}), '()\n', (1622, 1624), False, 'import time\n'), ((1681, 1707), 'nearpy.hashes.HashPermutations', 'HashPermutations', (['"""permut"""'], {}), "('permut')\n", (1697, 1707), False, 'from nearpy.hashes import RandomBinaryProjections, HashPermutations, HashPermutationMapper...
import matplotlib.pyplot as plt import numpy as np from fears.utils import results_manager, plotter, dir_manager import os suffix = '07212021_0001' data_folder = 'results_' + suffix exp_info_file = 'experiment_info_' + suffix + '.p' exp_folders,exp_info = results_manager.get_experiment_results(data_folder, ...
[ "numpy.flip", "fears.utils.results_manager.get_data", "os.listdir", "fears.utils.results_manager.get_experiment_results", "numpy.max", "fears.utils.plotter.plot_timecourse_to_axes", "numpy.argwhere", "matplotlib.pyplot.subplots" ]
[((258, 324), 'fears.utils.results_manager.get_experiment_results', 'results_manager.get_experiment_results', (['data_folder', 'exp_info_file'], {}), '(data_folder, exp_info_file)\n', (296, 324), False, 'from fears.utils import results_manager, plotter, dir_manager\n'), ((512, 526), 'numpy.flip', 'np.flip', (['k_abs'],...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import ray from ray.rllib.ddpg2.models import DDPGModel from ray.rllib.models.catalog import ModelCatalog from ray.rllib.optimizers import PolicyEvaluator from ray.rllib.utils.filter import ...
[ "numpy.ones_like", "ray.remote", "ray.rllib.utils.filter.NoFilter", "ray.rllib.ddpg2.models.DDPGModel" ]
[((2374, 2399), 'ray.remote', 'ray.remote', (['DDPGEvaluator'], {}), '(DDPGEvaluator)\n', (2384, 2399), False, 'import ray\n'), ((712, 749), 'ray.rllib.ddpg2.models.DDPGModel', 'DDPGModel', (['registry', 'self.env', 'config'], {}), '(registry, self.env, config)\n', (721, 749), False, 'from ray.rllib.ddpg2.models import...
import numpy as np from defdap.quat import Quat hex_syms = Quat.symEqv("hexagonal") # subset of hexagonal symmetries that give unique orientations when the # Burgers transformation is applied unq_hex_syms = [ hex_syms[0], hex_syms[5], hex_syms[4], hex_syms[2], hex_syms[10], hex_syms[11] ] cubi...
[ "numpy.array", "defdap.quat.Quat.symEqv", "defdap.quat.Quat.fromEulerAngles" ]
[((60, 84), 'defdap.quat.Quat.symEqv', 'Quat.symEqv', (['"""hexagonal"""'], {}), "('hexagonal')\n", (71, 84), False, 'from defdap.quat import Quat\n'), ((329, 349), 'defdap.quat.Quat.symEqv', 'Quat.symEqv', (['"""cubic"""'], {}), "('cubic')\n", (340, 349), False, 'from defdap.quat import Quat\n'), ((789, 823), 'defdap....
import pandas as pd import numpy as np import matplotlib.pyplot as plt import os import matplotlib.pyplot as plt import CurveFit import shutil #find all DIRECTORIES containing non-hidden files ending in FILENAME def getDataDirectories(DIRECTORY, FILENAME="valLoss.txt"): directories=[] for directory in os.scand...
[ "os.path.exists", "os.makedirs", "pandas.read_csv", "os.scandir", "numpy.array" ]
[((312, 333), 'os.scandir', 'os.scandir', (['DIRECTORY'], {}), '(DIRECTORY)\n', (322, 333), False, 'import os\n'), ((668, 689), 'os.scandir', 'os.scandir', (['DIRECTORY'], {}), '(DIRECTORY)\n', (678, 689), False, 'import os\n'), ((1388, 1409), 'os.scandir', 'os.scandir', (['SEARCHDIR'], {}), '(SEARCHDIR)\n', (1398, 140...
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[ "numpy.fromfile", "argparse.ArgumentParser", "mindspore.context.set_context", "os.path.join", "numpy.max", "numpy.exp", "numpy.sum", "numpy.array", "mindspore.load_checkpoint", "numpy.concatenate", "src.ms_utils.calculate_auc" ]
[((876, 908), 'numpy.max', 'np.max', (['x'], {'axis': '(1)', 'keepdims': '(True)'}), '(x, axis=1, keepdims=True)\n', (882, 908), True, 'import numpy as np\n'), ((967, 984), 'numpy.exp', 'np.exp', (['(x - t_max)'], {}), '(x - t_max)\n', (973, 984), True, 'import numpy as np\n'), ((1039, 1073), 'numpy.sum', 'np.sum', (['...
# This file is part of postcipes # (c) <NAME> # The code is released under the MIT Licence. # See LICENCE.txt and the Legal section in the README for more information from __future__ import absolute_import from __future__ import division from __future__ import print_function from .postcipe import Postcipe import turbu...
[ "turbulucid.Case", "turbulucid.edge_lengths", "numpy.sqrt", "turbulucid.isoline" ]
[((548, 562), 'turbulucid.Case', 'tbl.Case', (['path'], {}), '(path)\n', (556, 562), True, 'import turbulucid as tbl\n'), ((803, 839), 'turbulucid.edge_lengths', 'tbl.edge_lengths', (['self.case', '"""inlet"""'], {}), "(self.case, 'inlet')\n", (819, 839), True, 'import turbulucid as tbl\n'), ((1069, 1115), 'turbulucid....
# pylint: disable=protected-access """ Test the wrappers for the C API. """ import os from contextlib import contextmanager import numpy as np import numpy.testing as npt import pandas as pd import pytest import xarray as xr from packaging.version import Version from pygmt import Figure, clib from pygmt.clib.conversio...
[ "pygmt.clib.Session", "numpy.array", "pygmt.Figure", "numpy.arange", "os.path.exists", "numpy.flip", "pygmt.helpers.GMTTempFile", "numpy.testing.assert_allclose", "pygmt.clib.conversion.dataarray_to_matrix", "numpy.linspace", "numpy.logspace", "numpy.ones", "numpy.flipud", "numpy.fliplr", ...
[((14171, 14218), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dtype"""', '[str, object]'], {}), "('dtype', [str, object])\n", (14194, 14218), False, 'import pytest\n'), ((14965, 15012), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dtype"""', '[str, object]'], {}), "('dtype', [str, object]...
from __future__ import annotations from datetime import timedelta import operator from sys import getsizeof from typing import ( TYPE_CHECKING, Any, Callable, Hashable, List, cast, ) import warnings import numpy as np from pandas._libs import index as libindex from pandas._libs.lib import no_...
[ "pandas.core.construction.extract_array", "pandas.compat.numpy.function.validate_argsort", "pandas.core.dtypes.common.is_scalar", "numpy.arange", "pandas.compat.numpy.function.validate_min", "pandas.core.indexes.numeric.Int64Index", "pandas.core.common.any_not_none", "sys.getsizeof", "numpy.asarray"...
[((10265, 10288), 'pandas.util._decorators.doc', 'doc', (['Int64Index.get_loc'], {}), '(Int64Index.get_loc)\n', (10268, 10288), False, 'from pandas.util._decorators import cache_readonly, doc\n'), ((12844, 12868), 'pandas.util._decorators.doc', 'doc', (['Int64Index.__iter__'], {}), '(Int64Index.__iter__)\n', (12847, 12...
import cv2, time import numpy as np import Tkinter """ Wraps up some interfaces to opencv user interface methods (displaying image frames, event handling, etc). If desired, an alternative UI could be built and imported into get_pulse.py instead. Opencv is used to perform much of the data analysis, but there is no re...
[ "Tkinter.Label", "cv2.merge", "cv2.destroyWindow", "numpy.argmax", "numpy.array", "numpy.zeros", "cv2.cvtColor", "cv2.resize", "cv2.waitKey" ]
[((468, 495), 'cv2.resize', 'cv2.resize', (['*args'], {}), '(*args, **kwargs)\n', (478, 495), False, 'import cv2, time\n'), ((583, 628), 'cv2.cvtColor', 'cv2.cvtColor', (['output_frame', 'cv2.COLOR_BGR2RGB'], {}), '(output_frame, cv2.COLOR_BGR2RGB)\n', (595, 628), False, 'import cv2, time\n'), ((845, 879), 'cv2.destroy...
import json import logging import sys import numpy as np import torch from task_config import SuperGLUE_LABEL_MAPPING from snorkel.mtl.data import MultitaskDataset sys.path.append("..") # Adds higher directory to python modules path. logger = logging.getLogger(__name__) TASK_NAME = "WSC" def get_char_index(tex...
[ "logging.getLogger", "json.loads", "snorkel.mtl.data.MultitaskDataset", "torch.LongTensor", "numpy.array", "sys.path.append" ]
[((167, 188), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (182, 188), False, 'import sys\n'), ((249, 276), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (266, 276), False, 'import logging\n'), ((7278, 7658), 'snorkel.mtl.data.MultitaskDataset', 'MultitaskDataset...
__all__ = ['imread', 'imsave'] import numpy as np from PIL import Image from ...util import img_as_ubyte, img_as_uint def imread(fname, dtype=None, img_num=None, **kwargs): """Load an image from file. Parameters ---------- fname : str or file File name or file-like-object. dtype : numpy ...
[ "PIL.Image.open", "PIL.Image.new", "numpy.diff", "numpy.asanyarray", "numpy.array", "PIL.Image.fromstring", "PIL.Image.frombytes" ]
[((7329, 7347), 'numpy.asanyarray', 'np.asanyarray', (['arr'], {}), '(arr)\n', (7342, 7347), True, 'import numpy as np\n'), ((1049, 1066), 'PIL.Image.open', 'Image.open', (['fname'], {}), '(fname)\n', (1059, 1066), False, 'from PIL import Image\n'), ((3457, 3473), 'numpy.array', 'np.array', (['frames'], {}), '(frames)\...
# This version of the bitcoin experiment imports data preprocessed in Matlab, and uses the GCN baseline # The point of this script is to do link prediction # Imports and aliases import pickle import torch as t import torch.nn as nn import torch.nn.functional as F import torchvision import torchvision.datasets as datas...
[ "embedding_help_functions.load_data", "embedding_help_functions.split_data", "embedding_help_functions.compute_f1", "embedding_help_functions.compute_MAP_MRR", "torch.nn.CrossEntropyLoss", "embedding_help_functions.create_node_features", "torch.argmax", "torch.tensor", "numpy.zeros", "embedding_he...
[((1080, 1158), 'embedding_help_functions.load_data', 'ehf.load_data', (['data_loc', 'mat_f_name', 'S_train', 'S_val', 'S_test'], {'transformed': '(False)'}), '(data_loc, mat_f_name, S_train, S_val, S_test, transformed=False)\n', (1093, 1158), True, 'import embedding_help_functions as ehf\n'), ((1217, 1291), 'embedding...
from __future__ import division from timeit import default_timer as timer import csv import numpy as np import itertools from munkres import Munkres, print_matrix, make_cost_matrix import sys from classes import * from functions import * from math import sqrt import Tkinter as tk import tkFileDialog as filedialog root...
[ "numpy.reshape", "numpy.amax", "timeit.default_timer", "Tkinter.Tk", "numpy.asarray", "numpy.array", "munkres.Munkres", "tkFileDialog.askopenfilename", "numpy.savetxt", "numpy.transpose", "csv.reader" ]
[((323, 330), 'Tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (328, 330), True, 'import Tkinter as tk\n'), ((356, 422), 'tkFileDialog.askopenfilename', 'filedialog.askopenfilename', ([], {'title': '"""Please select the posting file"""'}), "(title='Please select the posting file')\n", (382, 422), True, 'import tkFileDialog as ...
import logging import numpy from ..Fragments import Fragments from ..typing import SpectrumType logger = logging.getLogger("matchms") def add_losses(spectrum_in: SpectrumType, loss_mz_from=0.0, loss_mz_to=1000.0) -> SpectrumType: """Derive losses based on precursor mass. Parameters ---------- spect...
[ "logging.getLogger", "numpy.where" ]
[((107, 135), 'logging.getLogger', 'logging.getLogger', (['"""matchms"""'], {}), "('matchms')\n", (124, 135), False, 'import logging\n'), ((1156, 1224), 'numpy.where', 'numpy.where', (['((losses_mz >= loss_mz_from) & (losses_mz <= loss_mz_to))'], {}), '((losses_mz >= loss_mz_from) & (losses_mz <= loss_mz_to))\n', (1167...
import argparse import glob import os import pickle from pathlib import Path import numpy as np from PIL import Image from tqdm import tqdm from src.align.align_trans import get_reference_facial_points, warp_and_crop_face # sys.path.append("../../") from src.align.detector import detect_faces if __name__ == "__main...
[ "PIL.Image.fromarray", "PIL.Image.open", "pickle.dump", "argparse.ArgumentParser", "src.align.align_trans.get_reference_facial_points", "pathlib.Path", "src.align.detector.detect_faces", "tqdm.tqdm", "os.getcwd", "os.chdir", "numpy.array", "os.system", "glob.glob" ]
[((338, 391), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""face alignment"""'}), "(description='face alignment')\n", (361, 391), False, 'import argparse\n'), ((1351, 1362), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1360, 1362), False, 'import os\n'), ((1416, 1437), 'os.chdir', 'os.c...
import numpy as np from keras.applications.inception_v3 import InceptionV3 from keras.initializers import RandomNormal from keras.layers import (BatchNormalization, Conv2D, Conv2DTranspose, Conv3D, Cropping2D, Dense, Flatten, GlobalAveragePooling2D, Input, Lambda, Max...
[ "keras.layers.Conv2D", "numpy.max", "keras.layers.Dense", "keras.layers.Input", "keras.models.Model", "keras.applications.inception_v3.InceptionV3", "keras.layers.GlobalAveragePooling2D", "keras.layers.BatchNormalization", "numpy.arange" ]
[((1786, 1810), 'numpy.max', 'np.max', (['input_shape[0:2]'], {}), '(input_shape[0:2])\n', (1792, 1810), True, 'import numpy as np\n'), ((2022, 2066), 'keras.layers.Input', 'Input', ([], {'shape': 'input_shape', 'name': '"""input_layer"""'}), "(shape=input_shape, name='input_layer')\n", (2027, 2066), False, 'from keras...
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm import numpy as np import os import contorno from constantes import INTERVALOS, PASSOS, TAMANHO_BARRA, DELTA_T, DELTA_X z_temp = contorno.p_3 TAMANHO_BARRA = 2 x = np.linspace(0.0, TAMANHO_BARRA, INTERVALOS+1) y = np.lin...
[ "numpy.copy", "numpy.asarray", "numpy.linspace", "matplotlib.pyplot.figure", "numpy.meshgrid", "matplotlib.pyplot.show" ]
[((264, 311), 'numpy.linspace', 'np.linspace', (['(0.0)', 'TAMANHO_BARRA', '(INTERVALOS + 1)'], {}), '(0.0, TAMANHO_BARRA, INTERVALOS + 1)\n', (275, 311), True, 'import numpy as np\n'), ((314, 351), 'numpy.linspace', 'np.linspace', (['(0.0)', 'DELTA_T', '(PASSOS + 1)'], {}), '(0.0, DELTA_T, PASSOS + 1)\n', (325, 351), ...
import numpy as np import pytest import theano import theano.tensor as tt # Don't import test classes otherwise they get tested as part of the file from tests import unittest_tools as utt from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name from tests.tensor.test_basic import ( TestAll...
[ "tests.unittest_tools.seed_rng", "theano.tensor.iscalar", "theano.tensor.lscalar", "numpy.random.rand", "tests.gpuarray.config.mode_with_gpu.excluding", "numpy.int32", "theano.tensor.zeros_like", "numpy.array", "theano.gpuarray.type.gpuarray_shared_constructor", "tests.unittest_tools.fetch_seed", ...
[((987, 1015), 'pytest.importorskip', 'pytest.importorskip', (['"""pygpu"""'], {}), "('pygpu')\n", (1006, 1015), False, 'import pytest\n'), ((1043, 1057), 'tests.unittest_tools.seed_rng', 'utt.seed_rng', ([], {}), '()\n', (1055, 1057), True, 'from tests import unittest_tools as utt\n'), ((1309, 1470), 'theano.function'...
import gym import numpy as np from itertools import product import matplotlib.pyplot as plt def print_policy(Q, env): """ This is a helper function to print a nice policy from the Q function""" moves = [u'←', u'↓',u'→', u'↑'] if not hasattr(env, 'desc'): env = env.env dims = env.desc.shape ...
[ "matplotlib.pyplot.imshow", "numpy.random.rand", "matplotlib.pyplot.xticks", "numpy.argmax", "numpy.max", "numpy.array", "numpy.zeros", "matplotlib.pyplot.figure", "matplotlib.pyplot.yticks", "numpy.unravel_index", "matplotlib.colors.Normalize", "numpy.chararray", "numpy.random.uniform", "...
[((4710, 4735), 'gym.make', 'gym.make', (['"""FrozenLake-v0"""'], {}), "('FrozenLake-v0')\n", (4718, 4735), False, 'import gym\n'), ((4926, 4936), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4934, 4936), True, 'import matplotlib.pyplot as plt\n'), ((5035, 5045), 'matplotlib.pyplot.show', 'plt.show', ([], {...
from sklearn.metrics import f1_score,accuracy_score import numpy as np from utilities.tools import load_model import pandas as pd def predict_MSRP_test_data(n_models,nb_words,nlp_f,test_data_1,test_data_2,test_labels): models=[] n_h_features=nlp_f.shape[1] print('loading the models...') for i in range...
[ "numpy.mean", "sklearn.metrics.f1_score", "numpy.asarray", "utilities.tools.load_model", "pandas.DataFrame", "sklearn.metrics.accuracy_score" ]
[((624, 641), 'numpy.asarray', 'np.asarray', (['preds'], {}), '(preds)\n', (634, 641), True, 'import numpy as np\n'), ((1052, 1091), 'pandas.DataFrame', 'pd.DataFrame', (["{'Quality': final_labels}"], {}), "({'Quality': final_labels})\n", (1064, 1091), True, 'import pandas as pd\n'), ((1657, 1674), 'numpy.asarray', 'np...
# coding=utf-8 import logging import traceback from os import makedirs from os.path import exists, join from textwrap import fill import matplotlib.patheffects as PathEffects import matplotlib.pyplot as plt import numpy as np import seaborn as sns from koino.plot import big_square, default_alpha from matplotlib import...
[ "matplotlib.patheffects.Normal", "textwrap.fill", "numpy.isfinite", "numpy.arange", "numpy.atleast_2d", "os.path.exists", "seaborn.color_palette", "numpy.sort", "matplotlib.pyplot.close", "matplotlib.pyplot.savefig", "seaborn.heatmap", "matplotlib.pyplot.suptitle", "traceback.format_exc", ...
[((534, 570), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(26, 10)'}), '(1, 2, figsize=(26, 10))\n', (546, 570), True, 'import matplotlib.pyplot as plt\n'), ((2652, 2768), 'matplotlib.pyplot.suptitle', 'plt.suptitle', (["('Silhouette analysis for KMeans with n_clusters = %d' % n_clusters...
"""Bindings for the Barnes Hut TSNE algorithm with fast nearest neighbors Refs: References [1] <NAME>, L.J.P.; Hinton, G.E. Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research 9:2579-2605, 2008. [2] <NAME>, L.J.P. t-Distributed Stochastic Neighbor Embedding http://homepage.tudelft.nl/19...
[ "ctypes.POINTER", "numpy.require", "pkg_resources.resource_filename", "numpy.array", "numpy.zeros", "numpy.ctypeslib.ndpointer", "ctypes.c_bool", "ctypes.c_int", "numpy.ctypeslib.load_library", "ctypes.c_float" ]
[((3861, 3908), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""tsnecuda"""', '""""""'], {}), "('tsnecuda', '')\n", (3892, 3908), False, 'import pkg_resources\n'), ((4169, 4220), 'numpy.ctypeslib.load_library', 'N.ctypeslib.load_library', (['"""libtsnecuda"""', 'self._path'], {}), "('libtsne...
import torch import torchvision import matplotlib import matplotlib.pyplot as plt from PIL import Image from captum.attr import GuidedGradCam, GuidedBackprop from captum.attr import LayerActivation, LayerConductance, LayerGradCam from data_utils import * from image_utils import * from captum_utils import * import nump...
[ "torch.LongTensor", "torch.from_numpy", "matplotlib.cm.jet", "visualizers.GradCam", "matplotlib.pyplot.imshow", "numpy.max", "matplotlib.pyplot.axis", "captum.attr.GuidedGradCam", "matplotlib.pyplot.savefig", "matplotlib.pyplot.gcf", "matplotlib.pyplot.title", "captum.attr.LayerAttribution.int...
[((699, 748), 'torchvision.models.squeezenet1_1', 'torchvision.models.squeezenet1_1', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (731, 748), False, 'import torchvision\n'), ((754, 763), 'visualizers.GradCam', 'GradCam', ([], {}), '()\n', (761, 763), False, 'from visualizers import GradCam\n'), ((870, 889), ...
from itertools import product import numpy as np import pytest from alibi_detect.utils.discretizer import Discretizer x = np.random.rand(10, 4) n_features = x.shape[1] feature_names = [str(_) for _ in range(n_features)] categorical_features = [[], [1, 3]] percentiles = [list(np.arange(25, 100, 25)), list(np.arange(10...
[ "alibi_detect.utils.discretizer.Discretizer", "itertools.product", "numpy.random.rand", "numpy.arange" ]
[((123, 144), 'numpy.random.rand', 'np.random.rand', (['(10)', '(4)'], {}), '(10, 4)\n', (137, 144), True, 'import numpy as np\n'), ((346, 388), 'itertools.product', 'product', (['categorical_features', 'percentiles'], {}), '(categorical_features, percentiles)\n', (353, 388), False, 'from itertools import product\n'), ...
# Created by <NAME> on 8/28/19 import gym import numpy as np import torch from interpretable_ddts.agents.ddt_agent import DDTAgent from interpretable_ddts.agents.mlp_agent import MLPAgent from interpretable_ddts.opt_helpers.replay_buffer import discount_reward import torch.multiprocessing as mp import argparse import c...
[ "torch.manual_seed", "argparse.ArgumentParser", "interpretable_ddts.agents.mlp_agent.MLPAgent", "interpretable_ddts.opt_helpers.replay_buffer.discount_reward", "random.seed", "numpy.sum", "numpy.random.seed", "interpretable_ddts.agents.ddt_agent.DDTAgent", "torch.multiprocessing.set_sharing_strategy...
[((645, 668), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (662, 668), False, 'import torch\n'), ((692, 712), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (706, 712), True, 'import numpy as np\n'), ((749, 766), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (760...
""" YTArray class. """ from __future__ import print_function #----------------------------------------------------------------------------- # Copyright (c) 2013, yt Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this so...
[ "numpy.bitwise_or", "numpy.union1d", "yt.units.dimensions.em_dimensions.get", "numpy.hstack", "yt.units.unit_object.UnitParseError", "yt.units.unit_lookup_table.default_unit_symbol_lut.copy", "yt.utilities.exceptions.YTInvalidUnitEquivalence", "numpy.array", "numpy.linalg.norm", "copy.deepcopy", ...
[((2243, 2249), 'yt.units.unit_object.Unit', 'Unit', ([], {}), '()\n', (2247, 2249), False, 'from yt.units.unit_object import Unit, UnitParseError\n'), ((2777, 2812), 'yt.utilities.lru_cache.lru_cache', 'lru_cache', ([], {'maxsize': '(128)', 'typed': '(False)'}), '(maxsize=128, typed=False)\n', (2786, 2812), False, 'fr...
import numpy as np import argparse import composition import os import json import torch from spinup.algos.pytorch.ppo.core import MLPActorCritic from spinup.algos.pytorch.ppo.ppo import ppo from spinup.utils.run_utils import setup_logger_kwargs from spinup.utils.mpi_tools import proc_id, num_procs def parse_args()...
[ "argparse.ArgumentParser", "spinup.utils.run_utils.setup_logger_kwargs", "spinup.utils.mpi_tools.num_procs", "os.path.join", "torch.set_num_threads", "numpy.random.seed", "composition.make", "spinup.utils.mpi_tools.proc_id", "json.dump" ]
[((335, 360), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (358, 360), False, 'import argparse\n'), ((1997, 2022), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (2011, 2022), True, 'import numpy as np\n'), ((2998, 3022), 'torch.set_num_threads', 'torch.set_num_t...
from __future__ import division from math import sqrt as sqrt from itertools import product as product import torch import numpy as np import cv2 from lib.utils.visualize_utils import TBWriter def vis(func): """tensorboard visualization if has writer as input""" def wrapper(*args, **kw): return func...
[ "cv2.rectangle", "numpy.ones", "numpy.hstack", "torch.Tensor", "math.sqrt", "numpy.array", "cv2.circle", "copy.deepcopy", "cv2.resize", "cv2.imread" ]
[((5886, 5904), 'copy.deepcopy', 'copy.deepcopy', (['cfg'], {}), '(cfg)\n', (5899, 5904), False, 'import copy\n'), ((6247, 6265), 'copy.deepcopy', 'copy.deepcopy', (['cfg'], {}), '(cfg)\n', (6260, 6265), False, 'import copy\n'), ((6845, 6863), 'copy.deepcopy', 'copy.deepcopy', (['cfg'], {}), '(cfg)\n', (6858, 6863), Fa...
""" Scatter plot with panning and zooming Shows a scatter plot of a set of random points, with basic Chaco panning and zooming. Interacting with the plot: - Left-mouse-drag pans the plot. - Mouse wheel up and down zooms the plot in and out. - Pressing "z" brings up the Zoom Box, and you can click-drag a recta...
[ "traits.api.Instance", "chaco.api.ArrayPlotData", "chaco.tools.api.PanTool", "chaco.tools.api.ZoomTool", "numpy.random.random", "chaco.api.Plot", "enable.api.ComponentEditor" ]
[((1150, 1164), 'numpy.random.random', 'random', (['numpts'], {}), '(numpts)\n', (1156, 1164), False, 'from numpy.random import random\n'), ((1228, 1243), 'chaco.api.ArrayPlotData', 'ArrayPlotData', ([], {}), '()\n', (1241, 1243), False, 'from chaco.api import ArrayPlotData, Plot\n'), ((1334, 1342), 'chaco.api.Plot', '...
from abc import ABCMeta, abstractmethod import os from vmaf.tools.misc import make_absolute_path, run_process from vmaf.tools.stats import ListStats __copyright__ = "Copyright 2016-2018, Netflix, Inc." __license__ = "Apache, Version 2.0" import re import numpy as np import ast from vmaf import ExternalProgramCaller,...
[ "vmaf.ExternalProgramCaller.call_vmaf_feature", "vmaf.core.result.Result", "vmaf.ExternalProgramCaller.call_ssim", "numpy.hstack", "re.match", "ast.literal_eval", "numpy.array", "vmaf.ExternalProgramCaller.call_psnr", "numpy.isnan", "numpy.vstack", "vmaf.ExternalProgramCaller.call_ms_ssim", "n...
[((1573, 1607), 'vmaf.core.result.Result', 'Result', (['asset', 'executor_id', 'result'], {}), '(asset, executor_id, result)\n', (1579, 1607), False, 'from vmaf.core.result import Result\n'), ((6044, 6146), 'vmaf.ExternalProgramCaller.call_vmaf_feature', 'ExternalProgramCaller.call_vmaf_feature', (['yuv_type', 'ref_pat...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import json from pathlib import Path import numpy as np import torch from PIL import Image from panopticapi.utils import rgb2id # from util.box_ops import masks_to_boxes from .construction import make_construction_transforms import logging def...
[ "torch.as_tensor", "PIL.Image.open", "pathlib.Path", "torch.stack", "panopticapi.utils.rgb2id", "torch.tensor", "numpy.array", "json.load", "logging.error" ]
[((422, 444), 'torch.stack', 'torch.stack', (['b'], {'dim': '(-1)'}), '(b, dim=-1)\n', (433, 444), False, 'import torch\n'), ((1007, 1045), 'torch.tensor', 'torch.tensor', (['boxes'], {'dtype': 'torch.int64'}), '(boxes, dtype=torch.int64)\n', (1019, 1045), False, 'import torch\n'), ((1059, 1098), 'torch.tensor', 'torch...
import copy import functools import itertools import numbers import warnings from collections import defaultdict from datetime import timedelta from distutils.version import LooseVersion from typing import ( Any, Dict, Hashable, Mapping, Optional, Sequence, Tuple, TypeVar, Union, ) ...
[ "numpy.prod", "numpy.ma.getmaskarray", "numpy.logical_not", "numpy.asanyarray", "copy.deepcopy", "copy.copy", "numpy.asarray", "functools.wraps", "numpy.concatenate", "numpy.datetime64", "warnings.warn", "dask.array.from_array", "numpy.isnan", "numpy.nonzero", "numpy.timedelta64", "war...
[((1294, 1335), 'typing.TypeVar', 'TypeVar', (['"""VariableType"""'], {'bound': '"""Variable"""'}), "('VariableType', bound='Variable')\n", (1301, 1335), False, 'from typing import Any, Dict, Hashable, Mapping, Optional, Sequence, Tuple, TypeVar, Union\n'), ((7749, 7765), 'numpy.asarray', 'np.asarray', (['data'], {}), ...
''' <NAME> set up :2020-1-9 intergrate img and label into one file -- fiducial1024_v1 ''' import argparse import sys, os import pickle import random import collections import json import numpy as np import scipy.io as io import scipy.misc as m import matplotlib.pyplot as plt import glob import math import time impo...
[ "pickle.dumps", "numpy.array", "numpy.linalg.norm", "os.path.exists", "os.listdir", "numpy.full_like", "argparse.ArgumentParser", "numpy.linspace", "numpy.dot", "numpy.concatenate", "numpy.meshgrid", "random.randint", "numpy.random.normal", "numpy.abs", "random.choice", "numpy.ones", ...
[((595, 610), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (605, 610), False, 'import sys, os\n'), ((44019, 44132), 'threading.Thread', 'threading.Thread', ([], {'target': 'saveFold.save_img', 'args': "(m, n, 'fold', repeat_time, 'relativeShift_v2')", 'name': '"""fold"""'}), "(target=saveFold.save_img, args=(m...
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt class TwoLayerNet(object): """ A two-layer fully-connected neural network. The net has an input dimension of N, a hidden layer dimension of H, and performs classification over C classes. We train the network...
[ "numpy.random.choice", "numpy.max", "numpy.exp", "numpy.sum", "numpy.zeros", "numpy.maximum", "numpy.random.randn", "numpy.arange" ]
[((1558, 1579), 'numpy.zeros', 'np.zeros', (['hidden_size'], {}), '(hidden_size)\n', (1566, 1579), True, 'import numpy as np\n'), ((1684, 1705), 'numpy.zeros', 'np.zeros', (['output_size'], {}), '(output_size)\n', (1692, 1705), True, 'import numpy as np\n'), ((3464, 3486), 'numpy.maximum', 'np.maximum', (['(0)', 'score...
import numpy as np from scipy import ndimage def erode_value_blobs(array, steps=1, values_to_ignore=tuple(), new_value=0): unique_values = list(np.unique(array)) all_entries_to_keep = np.zeros(shape=array.shape, dtype=np.bool) for unique_value in unique_values: entries_of_this_value = array == uni...
[ "numpy.unique", "scipy.ndimage.binary_erosion", "numpy.logical_not", "numpy.logical_or", "numpy.zeros" ]
[((194, 236), 'numpy.zeros', 'np.zeros', ([], {'shape': 'array.shape', 'dtype': 'np.bool'}), '(shape=array.shape, dtype=np.bool)\n', (202, 236), True, 'import numpy as np\n'), ((150, 166), 'numpy.unique', 'np.unique', (['array'], {}), '(array)\n', (159, 166), True, 'import numpy as np\n'), ((766, 801), 'numpy.logical_n...
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test the Logarithmic Units and Quantities """ from __future__ import (absolute_import, unicode_literals, division, print_function) from ...extern import six from ...extern.six.moves import zip import pickle...
[ "numpy.abs", "numpy.power", "pickle.dumps", "itertools.product", "numpy.square", "pytest.mark.parametrize", "numpy.linspace", "numpy.array", "pytest.raises", "numpy.testing.utils.assert_allclose", "pickle.loads", "numpy.all", "numpy.arange" ]
[((1241, 1285), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lu_unit"""', 'lu_units'], {}), "('lu_unit', lu_units)\n", (1264, 1285), False, 'import pytest\n'), ((6355, 6399), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lu_unit"""', 'lu_units'], {}), "('lu_unit', lu_units)\n", (6378, 6399)...
""" Collection of tests asserting things that should be true for any index subclass. Makes use of the `indices` fixture defined in pandas/tests/indexes/conftest.py. """ import re import numpy as np import pytest from pandas._libs.tslibs import iNaT from pandas.core.dtypes.common import is_period_dtype, needs_i8_conv...
[ "pandas.Series", "pytest.mark.filterwarnings", "numpy.sort", "pandas._testing.round_trip_pickle", "pandas._testing.assert_index_equal", "pytest.mark.parametrize", "pandas._testing.assert_equal", "pandas.core.dtypes.common.needs_i8_conversion", "pytest.raises", "numpy.concatenate", "pandas._testi...
[((18137, 18193), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""na_position"""', "[None, 'middle']"], {}), "('na_position', [None, 'middle'])\n", (18160, 18193), False, 'import pytest\n'), ((19004, 19061), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""na_position"""', "['first', 'last']"], {...
from numpy import genfromtxt import matplotlib.pyplot as plt import mpl_finance import numpy as np import uuid import matplotlib # Input your csv file here with historical data ad = genfromtxt(f"../financial_data/SM.csv", delimiter=",", dtype=str) def convolve_sma(array, period): return np.convolve(array, np.on...
[ "mpl_finance.candlestick2_ochl", "numpy.ones", "matplotlib.pyplot.clf", "uuid.uuid4", "matplotlib.pyplot.figure", "matplotlib.pyplot.autoscale", "matplotlib.pyplot.axis", "matplotlib.pyplot.cla", "numpy.genfromtxt" ]
[((184, 249), 'numpy.genfromtxt', 'genfromtxt', (['f"""../financial_data/SM.csv"""'], {'delimiter': '""","""', 'dtype': 'str'}), "(f'../financial_data/SM.csv', delimiter=',', dtype=str)\n", (194, 249), False, 'from numpy import genfromtxt\n'), ((1909, 1980), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'num': '(1)',...
import hashlib from io import BytesIO import logging import os from typing import Any, cast, Dict, List, Optional, Sequence, Type, TYPE_CHECKING, Union from pkg_resources import parse_version import wandb from wandb import util from ._private import MEDIA_TMP from .base_types.media import BatchableMedia, Media from ....
[ "wandb.util.get_full_typename", "numpy.ptp", "wandb.util.generate_id", "os.path.join", "io.BytesIO", "logging.warning", "wandb.util.get_module", "numpy.max", "os.path.splitext", "pkg_resources.parse_version", "wandb.util._get_max_cli_version", "wandb.termwarn", "wandb.util.ensure_matplotlib_...
[((1238, 1265), 'wandb.util._get_max_cli_version', 'util._get_max_cli_version', ([], {}), '()\n', (1263, 1265), False, 'from wandb import util\n'), ((1330, 1354), 'pkg_resources.parse_version', 'parse_version', (['"""0.12.10"""'], {}), "('0.12.10')\n", (1343, 1354), False, 'from pkg_resources import parse_version\n'), ...
import sys import numpy as np from matplotlib import pyplot as pl from rw import WriteGTiff fn = '../pozo-steep-vegetated-pcl.npy' pts = np.load(fn) x, y, z, c = pts[:, 0], pts[:, 1], pts[:, 2], pts[:, 5] ix = (0.2 * (x - x.min())).astype('int') iy = (0.2 * (y - y.min())).astype('int') shape = (100, 100) xb = np.aran...
[ "matplotlib.pyplot.savefig", "numpy.zeros", "numpy.save", "numpy.ma.masked_invalid", "numpy.load", "matplotlib.pyplot.subplots", "numpy.arange" ]
[((138, 149), 'numpy.load', 'np.load', (['fn'], {}), '(fn)\n', (145, 149), True, 'import numpy as np\n'), ((313, 336), 'numpy.arange', 'np.arange', (['(shape[1] + 1)'], {}), '(shape[1] + 1)\n', (322, 336), True, 'import numpy as np\n'), ((340, 363), 'numpy.arange', 'np.arange', (['(shape[0] + 1)'], {}), '(shape[0] + 1)...
import os import random from typing import Any, Dict, List, Union import numpy as np import torch from colorama import Fore, Style from sklearn.metrics import f1_score from sklearn.metrics import precision_recall_fscore_support as score from sklearn.metrics import precision_score, recall_score def highlight(input_: ...
[ "torch.cuda.manual_seed_all", "torch.manual_seed", "numpy.multiply", "sklearn.metrics.f1_score", "sklearn.metrics.precision_recall_fscore_support", "os.path.join", "random.seed", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score", "numpy.array", "torch.cuda.is_available", "numpy...
[((1110, 1127), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1121, 1127), False, 'import random\n'), ((1132, 1152), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1146, 1152), True, 'import numpy as np\n'), ((1157, 1180), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see...
############################################################################### # @todo add Pilot2-splash-app disclaimer ############################################################################### """ Get's KRAS states """ import MDAnalysis as mda from MDAnalysis.analysis import align from MDAnalysis.lib.mdamath ...
[ "logging.getLogger", "MDAnalysis.analysis.align.rotation_matrix", "mummi_core.utils.Naming.dir_res", "numpy.arccos", "numpy.cross", "numpy.asarray", "os.path.join", "numpy.array", "numpy.dot", "mummi_core.init", "numpy.concatenate" ]
[((621, 640), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (630, 640), False, 'from logging import getLogger\n'), ((840, 857), 'mummi_core.init', 'mummi_core.init', ([], {}), '()\n', (855, 857), False, 'import mummi_core\n'), ((875, 899), 'mummi_core.utils.Naming.dir_res', 'Naming.dir_res', (['...
""" Binary serialization NPY format ========== A simple format for saving numpy arrays to disk with the full information about them. The ``.npy`` format is the standard binary file format in NumPy for persisting a *single* arbitrary NumPy array on disk. The format stores all of the shape and dtype information necess...
[ "struct.calcsize", "numpy.compat.pickle.dump", "numpy.fromfile", "tokenize.untokenize", "numpy.frombuffer", "numpy.multiply.reduce", "numpy.compat.isfileobj", "numpy.nditer", "numpy.memmap", "io.StringIO", "struct.pack", "struct.unpack", "numpy.ndarray", "numpy.compat.os_fspath", "warnin...
[((11608, 11719), 'numpy.dtype', 'numpy.dtype', (["{'names': names, 'formats': formats, 'titles': titles, 'offsets': offsets,\n 'itemsize': offset}"], {}), "({'names': names, 'formats': formats, 'titles': titles,\n 'offsets': offsets, 'itemsize': offset})\n", (11619, 11719), False, 'import numpy\n'), ((14171, 142...
# ________ # / # \ / # \ / # \/ import random import textwrap import emd_mean import AdvEMDpy import emd_basis import emd_utils import numpy as np import pandas as pd import cvxpy as cvx import seaborn as sns import matplotlib.pyplot as plt from scipy.integrate import odeint from ...
[ "pandas.read_csv", "numpy.hstack", "emd_utils.Utility", "matplotlib.pyplot.ylabel", "numpy.array", "textwrap.fill", "scipy.ndimage.gaussian_filter", "numpy.sin", "numpy.arange", "numpy.mean", "seaborn.set", "emd_hilbert.hilbert_spectrum", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot...
[((670, 695), 'seaborn.set', 'sns.set', ([], {'style': '"""darkgrid"""'}), "(style='darkgrid')\n", (677, 695), True, 'import seaborn as sns\n'), ((715, 746), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(1001)'], {}), '(0, 2 * np.pi, 1001)\n', (726, 746), True, 'import numpy as np\n'), ((841, 906), 'emd_ut...
#!/usr/bin/env python # encoding: utf-8 -*- """ This module contains unit tests of the rmgpy.reaction module. """ import numpy import unittest from external.wip import work_in_progress from rmgpy.species import Species, TransitionState from rmgpy.reaction import Reaction from rmgpy.statmech.translation import Transl...
[ "rmgpy.statmech.torsion.HinderedRotor", "rmgpy.kinetics.Arrhenius", "numpy.array", "rmgpy.thermo.Wilhoit", "rmgpy.reaction.Reaction", "rmgpy.kinetics.Troe", "rmgpy.kinetics.ThirdBody", "unittest.TextTestRunner", "rmgpy.species.Species", "numpy.arange", "rmgpy.statmech.translation.IdealGasTransla...
[((1776, 1824), 'rmgpy.reaction.Reaction', 'Reaction', ([], {'reactants': 'reactants', 'products': 'products'}), '(reactants=reactants, products=products)\n', (1784, 1824), False, 'from rmgpy.reaction import Reaction\n'), ((13183, 13232), 'numpy.arange', 'numpy.arange', (['(200.0)', '(2001.0)', '(200.0)', 'numpy.float6...
import rinobot_plugin as bot import numpy as np def main(): # lets get our parameters and data filepath = bot.filepath() data = bot.loadfile(filepath) # now comes the custom plugin logic shift = bot.get_arg('shift', type=float, required=True) index = bot.index_from_args(data) data[index] =...
[ "rinobot_plugin.loadfile", "rinobot_plugin.filepath", "rinobot_plugin.no_extension", "rinobot_plugin.index_from_args", "numpy.savetxt", "rinobot_plugin.get_arg", "rinobot_plugin.output_filepath" ]
[((115, 129), 'rinobot_plugin.filepath', 'bot.filepath', ([], {}), '()\n', (127, 129), True, 'import rinobot_plugin as bot\n'), ((141, 163), 'rinobot_plugin.loadfile', 'bot.loadfile', (['filepath'], {}), '(filepath)\n', (153, 163), True, 'import rinobot_plugin as bot\n'), ((217, 264), 'rinobot_plugin.get_arg', 'bot.get...
#!/usr/bin/env python # encoding: utf-8 import numbers import os import re import sys from itertools import chain import numpy as np import scipy.sparse as sp import six import pickle from .model import get_convo_nn2 from .stop_words import THAI_STOP_WORDS from .utils import CHAR_TYPES_MAP, CHARS_MAP, create_feature_...
[ "scipy.sparse.isspmatrix_csr", "scipy.sparse.csc_matrix", "pickle.dump", "numpy.where", "os.path.join", "os.path.dirname", "itertools.chain.from_iterable", "numpy.cumsum", "numpy.dtype", "numpy.bincount", "re.search" ]
[((341, 366), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (356, 366), False, 'import os\n'), ((381, 440), 'os.path.join', 'os.path.join', (['MODULE_PATH', '"""weight"""', '"""cnn_without_ne_ab.h5"""'], {}), "(MODULE_PATH, 'weight', 'cnn_without_ne_ab.h5')\n", (393, 440), False, 'import os\...
# Copyright 2021 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
[ "numpy.zeros", "cumm.tensorview.from_numpy", "spconv.core_cc.csrc.utils.boxops.BoxOps.has_boost" ]
[((2449, 2490), 'numpy.zeros', 'np.zeros', (['(N, K)'], {'dtype': 'box_corners.dtype'}), '((N, K), dtype=box_corners.dtype)\n', (2457, 2490), True, 'import numpy as np\n'), ((3105, 3146), 'numpy.zeros', 'np.zeros', (['(N, K)'], {'dtype': 'box_corners.dtype'}), '((N, K), dtype=box_corners.dtype)\n', (3113, 3146), True, ...
""" This code is used to scrape ScienceDirect of publication urls and write them to a text file in the current directory for later use. """ import selenium from selenium import webdriver import numpy as np import pandas as pd import bs4 from bs4 import BeautifulSoup import time from sklearn.utils import shuffle def s...
[ "sklearn.utils.shuffle", "selenium.webdriver.Chrome", "time.sleep", "pandas.read_excel", "numpy.arange" ]
[((4232, 4270), 'pandas.read_excel', 'pd.read_excel', (['"""elsevier_journals.xls"""'], {}), "('elsevier_journals.xls')\n", (4245, 4270), True, 'import pandas as pd\n'), ((4437, 4465), 'sklearn.utils.shuffle', 'shuffle', (['df'], {'random_state': '(42)'}), '(df, random_state=42)\n', (4444, 4465), False, 'from sklearn.u...
""" Greedy Word Swap with Word Importance Ranking =================================================== When WIR method is set to ``unk``, this is a reimplementation of the search method from the paper: Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment by Jin et...
[ "torch.Tensor", "numpy.max", "numpy.array", "textattack.shared.validators.transformation_consists_of_word_swaps_and_deletions", "numpy.arange", "numpy.random.shuffle" ]
[((6129, 6196), 'textattack.shared.validators.transformation_consists_of_word_swaps_and_deletions', 'transformation_consists_of_word_swaps_and_deletions', (['transformation'], {}), '(transformation)\n', (6180, 6196), False, 'from textattack.shared.validators import transformation_consists_of_word_swaps_and_deletions\n'...
from gtrain import Model import numpy as np import tensorflow as tf class NetForHypinv(Model): """ Implementaion of the crutial function for the HypINV algorithm. Warning: Do not use this class but implement its subclass, for example see FCNetForHypinv """ def __init__(self, weights): self...
[ "tensorflow.boolean_mask", "tensorflow.Session", "tensorflow.placeholder", "tensorflow.nn.xw_plus_b", "tensorflow.nn.l2_loss", "tensorflow.global_variables_initializer", "tensorflow.gradients", "numpy.zeros", "tensorflow.name_scope", "tensorflow.nn.softmax", "numpy.linalg.norm", "tensorflow.st...
[((5555, 5589), 'numpy.zeros', 'np.zeros', (['[1, self.layer_sizes[0]]'], {}), '([1, self.layer_sizes[0]])\n', (5563, 5589), True, 'import numpy as np\n'), ((12110, 12144), 'numpy.zeros', 'np.zeros', (['[1, self.layer_sizes[0]]'], {}), '([1, self.layer_sizes[0]])\n', (12118, 12144), True, 'import numpy as np\n'), ((153...
import numpy from keras.preprocessing import sequence from keras.preprocessing.text import Tokenizer from src.support import support class PhraseManager: def __init__(self, configuration): self.train_phrases, self.train_labels = self._read_train_phrases() self.test_phrases, self.test_labels = se...
[ "keras.preprocessing.text.Tokenizer", "numpy.asarray", "numpy.array", "numpy.zeros", "keras.preprocessing.sequence.pad_sequences" ]
[((1055, 1118), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'num_words': 'self.configuration[support.QUANTITY_WORDS]'}), '(num_words=self.configuration[support.QUANTITY_WORDS])\n', (1064, 1118), False, 'from keras.preprocessing.text import Tokenizer\n'), ((1338, 1442), 'keras.preprocessing.sequence.pad_seq...
import gym import gym.spaces as spaces import sys import socket from _thread import * import os import numpy as np import pandas as pd import math as m import time import random class NetEnv(gym.Env): def __init__(self): # Robot State values that will be bounced with client self.robot_state = None self.p...
[ "numpy.array", "socket.socket" ]
[((347, 380), 'numpy.array', 'np.array', (['(12345)'], {'dtype': 'np.float32'}), '(12345, dtype=np.float32)\n', (355, 380), True, 'import numpy as np\n'), ((621, 670), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (634, 670), False, 'import s...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ "logging.getLogger", "superset.viz.DistributionBarViz", "superset.viz.BaseViz", "superset.viz.DeckScatterViz", "unittest.mock.patch", "superset.viz.TableViz", "pandas.to_datetime", "datetime.datetime", "superset.viz.PartitionViz", "pandas.DataFrame", "superset.viz.DeckGeoJson", "unittest.mock....
[((1253, 1280), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1270, 1280), False, 'import logging\n'), ((13055, 13094), 'unittest.mock.patch', 'patch', (['"""superset.viz.BaseViz.query_obj"""'], {}), "('superset.viz.BaseViz.query_obj')\n", (13060, 13094), False, 'from unittest.mock impo...
import sys import typing import numpy as np def solve(a: np.ndarray, k: int) -> typing.NoReturn: n = len(a) def compute_dp(a: np.ndarray) -> np.ndarray: dp = np.zeros((n + 1, k), np.bool8) dp[0, 0] = True for i in range(n): dp[i + 1] = dp[i].copy() ...
[ "sys.stdin.readline", "numpy.zeros", "numpy.flatnonzero" ]
[((188, 218), 'numpy.zeros', 'np.zeros', (['(n + 1, k)', 'np.bool8'], {}), '((n + 1, k), np.bool8)\n', (196, 218), True, 'import numpy as np\n'), ((605, 622), 'numpy.flatnonzero', 'np.flatnonzero', (['l'], {}), '(l)\n', (619, 622), True, 'import numpy as np\n'), ((968, 988), 'sys.stdin.readline', 'sys.stdin.readline', ...
import numpy as np from typing import Tuple, Union, Optional from autoarray.structures.arrays.two_d import array_2d_util from autoarray.geometry import geometry_util from autoarray import numba_util from autoarray.mask import mask_2d_util @numba_util.jit() def grid_2d_centre_from(grid_2d_slim: np.ndarray) ...
[ "autoarray.geometry.geometry_util.central_scaled_coordinate_2d_from", "numpy.mean", "autoarray.structures.arrays.two_d.array_2d_util.array_2d_native_from", "numpy.roll", "numpy.asarray", "autoarray.numba_util.jit", "numpy.max", "numpy.subtract", "numpy.stack", "numpy.zeros", "numpy.square", "a...
[((252, 268), 'autoarray.numba_util.jit', 'numba_util.jit', ([], {}), '()\n', (266, 268), False, 'from autoarray import numba_util\n'), ((824, 840), 'autoarray.numba_util.jit', 'numba_util.jit', ([], {}), '()\n', (838, 840), False, 'from autoarray import numba_util\n'), ((11036, 11052), 'autoarray.numba_util.jit', 'num...
import logging import george import numpy as np from robo.priors.default_priors import DefaultPrior from robo.models.gaussian_process import GaussianProcess from robo.models.gaussian_process_mcmc import GaussianProcessMCMC from robo.maximizers.random_sampling import RandomSampling from robo.maximizers.scipy_optimizer ...
[ "logging.getLogger", "george.kernels.Matern52Kernel", "numpy.ones", "robo.maximizers.random_sampling.RandomSampling", "robo.models.gaussian_process_mcmc.GaussianProcessMCMC", "robo.maximizers.differential_evolution.DifferentialEvolution", "robo.acquisition_functions.information_gain.InformationGain", ...
[((748, 775), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (765, 775), False, 'import logging\n'), ((2351, 2372), 'numpy.all', 'np.all', (['(lower < upper)'], {}), '(lower < upper)\n', (2357, 2372), True, 'import numpy as np\n'), ((2665, 2682), 'numpy.ones', 'np.ones', (['[n_dims]'], {}...
""" Functions for loading input data. Author: <NAME> <<EMAIL>> """ import os import numpy as np def load_img(path: str, img_nums: list, shape: tuple) -> np.array: """ Loads a image in the human-readable format. Args: path: The path to the to the folder with mnist images. i...
[ "numpy.array", "numpy.prod", "numpy.zeros" ]
[((2132, 2163), 'numpy.zeros', 'np.zeros', (['num_images'], {'dtype': 'int'}), '(num_images, dtype=int)\n', (2140, 2163), True, 'import numpy as np\n'), ((2071, 2091), 'numpy.prod', 'np.prod', (['image_shape'], {}), '(image_shape)\n', (2078, 2091), True, 'import numpy as np\n'), ((821, 835), 'numpy.array', 'np.array', ...
import numpy as np from stumpff import C, S from CelestialBody import BODIES from numerical import newton, laguerre from lagrange import calc_f, calc_fd, calc_g, calc_gd def kepler_chi(chi, alpha, r0, vr0, mu, dt): ''' Kepler's Equation of the universal anomaly, modified for use in numerical solvers. ''' ...
[ "numpy.abs", "numpy.allclose", "numpy.sqrt", "lagrange.calc_f", "numerical.laguerre", "lagrange.calc_g", "numpy.array", "numpy.dot", "numerical.newton", "lagrange.calc_fd", "lagrange.calc_gd", "numpy.cos", "numpy.linalg.norm", "numpy.sin", "stumpff.S", "stumpff.C" ]
[((953, 957), 'stumpff.S', 'S', (['z'], {}), '(z)\n', (954, 957), False, 'from stumpff import C, S\n'), ((2171, 2190), 'numpy.linalg.norm', 'np.linalg.norm', (['r_0'], {}), '(r_0)\n', (2185, 2190), True, 'import numpy as np\n'), ((2235, 2254), 'numpy.linalg.norm', 'np.linalg.norm', (['v_0'], {}), '(v_0)\n', (2249, 2254...
import io import logging import json import numpy import torch import numpy as np from tqdm import tqdm from clie.inputters import constant from clie.objects import Sentence from torch.utils.data import Dataset from torch.utils.data.sampler import Sampler logger = logging.getLogger(__name__) def load_word_embeddings...
[ "logging.getLogger", "numpy.random.random", "torch.LongTensor", "clie.objects.Sentence", "io.open", "numpy.argsort", "numpy.array", "json.load", "numpy.random.shuffle" ]
[((266, 293), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (283, 293), False, 'import logging\n'), ((364, 431), 'io.open', 'io.open', (['file', '"""r"""'], {'encoding': '"""utf-8"""', 'newline': '"""\n"""', 'errors': '"""ignore"""'}), "(file, 'r', encoding='utf-8', newline='\\n', errors...
# coding: UTF-8 import time import torch import numpy as np from train_eval import train, init_network from importlib import import_module import argparse parser = argparse.ArgumentParser(description='Chinese Text Classification') parser.add_argument('--model', type=str, required=True, help='choose a model: TextCNN') ...
[ "torch.cuda.manual_seed_all", "torch.manual_seed", "utils.get_time_dif", "importlib.import_module", "argparse.ArgumentParser", "config.Config", "train_eval.init_network", "train_eval.train", "utils.build_iterator", "utils.build_dataset", "numpy.random.seed", "time.time" ]
[((165, 231), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Chinese Text Classification"""'}), "(description='Chinese Text Classification')\n", (188, 231), False, 'import argparse\n'), ((820, 857), 'importlib.import_module', 'import_module', (["('models.' + model_name)"], {}), "('models...
"""Python interfaces to DGL farthest point sampler.""" from dgl._ffi.base import DGLError import numpy as np from .._ffi.function import _init_api from .. import backend as F from .. import ndarray as nd def _farthest_point_sampler(data, batch_size, sample_points, dist, start_idx, result): r"""Farthest Point Samp...
[ "dgl._ffi.base.DGLError", "numpy.unique" ]
[((3538, 3569), 'dgl._ffi.base.DGLError', 'DGLError', (['"""Find unmatched node"""'], {}), "('Find unmatched node')\n", (3546, 3569), False, 'from dgl._ffi.base import DGLError\n'), ((3813, 3858), 'numpy.unique', 'np.unique', (['node_label_np'], {'return_inverse': '(True)'}), '(node_label_np, return_inverse=True)\n', (...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2021 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
[ "numpy.ones", "improver.synthetic_data.set_up_test_cubes.set_up_probability_cube", "pytest.raises", "improver.precipitation_type.utilities.make_shower_condition_cube", "numpy.arange" ]
[((2118, 2141), 'numpy.arange', 'np.arange', (['n_thresholds'], {}), '(n_thresholds)\n', (2127, 2141), True, 'import numpy as np\n'), ((2238, 2271), 'numpy.ones', 'np.ones', (['shape'], {'dtype': 'FLOAT_DTYPE'}), '(shape, dtype=FLOAT_DTYPE)\n', (2245, 2271), True, 'import numpy as np\n'), ((2283, 2427), 'improver.synth...
import cv2 import torch import yaml import imageio import throttle import numpy as np import matplotlib.pyplot as plt from argparse import ArgumentParser from skimage.transform import resize from scipy.spatial import ConvexHull from modules.generator import OcclusionAwareGenerator from modules.keypoint_detector import...
[ "sync_batchnorm.DataParallelWithCallback", "numpy.sqrt", "modules.generator.OcclusionAwareGenerator", "argparse.ArgumentParser", "torch.load", "modules.keypoint_detector.KPDetector", "throttle.wrap", "yaml.load", "cv2.imshow", "numpy.array", "cv2.destroyAllWindows", "cv2.VideoCapture", "torc...
[((2735, 2754), 'throttle.wrap', 'throttle.wrap', (['(1)', '(2)'], {}), '(1, 2)\n', (2748, 2754), False, 'import throttle\n'), ((1863, 1980), 'modules.generator.OcclusionAwareGenerator', 'OcclusionAwareGenerator', ([], {}), "(**config['model_params']['generator_params'], **\n config['model_params']['common_params'])...
import numpy as np from albumentations import (Compose, HorizontalFlip, VerticalFlip, Rotate, RandomRotate90, ShiftScaleRotate, ElasticTransform, GridDistortion, RandomSizedCrop, RandomCrop, CenterCrop, RandomBrightnessContrast, HueSatu...
[ "albumentations.ShiftScaleRotate", "albumentations.pytorch.ToTensorV2", "albumentations.RandomBrightnessContrast", "albumentations.GaussianBlur", "albumentations.CoarseDropout", "albumentations.GaussNoise", "albumentations.HueSaturationValue", "numpy.array", "albumentations.Normalize", "get_config...
[((737, 749), 'get_config.get_config', 'get_config', ([], {}), '()\n', (747, 749), False, 'from get_config import get_config\n'), ((758, 789), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (766, 789), True, 'import numpy as np\n'), ((797, 828), 'numpy.array', 'np.array', (['[0...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Defines coordinate frames and ties them to data axes. """ from __future__ import absolute_import, division, unicode_literals, print_function import numpy as np from astropy import units as u from astropy import utils as astutil from astropy import coo...
[ "numpy.unique", "numpy.isscalar", "astropy.units.Unit", "astropy.coordinates.SkyCoord", "astropy.utils.isiterable" ]
[((8880, 8897), 'numpy.isscalar', 'np.isscalar', (['args'], {}), '(args)\n', (8891, 8897), True, 'import numpy as np\n'), ((2050, 2074), 'astropy.utils.isiterable', 'astutil.isiterable', (['unit'], {}), '(unit)\n', (2068, 2074), True, 'from astropy import utils as astutil\n'), ((7717, 7783), 'astropy.coordinates.SkyCoo...
'''ResNet using PSG in PyTorch. For Pre-activation ResNet, see 'preact_resnet.py'. Reference: [1] <NAME>, <NAME>, <NAME>, <NAME> Deep Residual Learning for Image Recognition. arXiv:1512.03385 ''' from numpy.lib.arraysetops import isin import torch import torch.nn as nn import torch.nn.functional as F import math ...
[ "torch.nn.BatchNorm2d", "torch.ones_like", "torch.nn.Sequential", "torch.nn.init._calculate_correct_fan", "math.sqrt", "models.masked_psg_seed_conv.PredictiveSeedConv2d", "torch.nn.init.kaiming_normal_", "torch.nn.init.kaiming_uniform_", "torch.nn.init.xavier_normal_", "torch.nn.init._calculate_fa...
[((952, 1468), 'models.masked_psg_seed_conv.PredictiveSeedConv2d', 'PredictiveSeedConv2d', (['in_planes', 'out_planes'], {'kernel_size': '(1)', 'stride': 'stride', 'padding': '(0)', 'bias': '(False)', 'num_bits': 'NUM_BITS', 'num_bits_weight': 'NUM_BITS_WEIGHT', 'num_bits_grad': 'NUM_BITS_GRAD', 'biprecision': 'BIPRECI...
#!/usr/bin/env python3 import tensorflow as tf physical_devices = tf.config.list_physical_devices('GPU') try: tf.config.experimental.set_memory_growth(physical_devices[0], True) except: # Invalid device or cannot modify virtual devices once initialized. pass import numpy as np import os, time, csv import ...
[ "tensorflow.train.Checkpoint", "tensorflow.config.list_physical_devices", "tensorflow.nn.softmax", "umap.UMAP", "net.FeatureBlock", "matplotlib.pyplot.close", "net.FontData", "net.SimpleDecoderBlock", "numpy.concatenate", "tensorflow.train.CheckpointManager", "matplotlib.use", "numpy.argmax", ...
[((67, 105), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (98, 105), True, 'import tensorflow as tf\n'), ((355, 376), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (369, 376), False, 'import matplotlib\n'), ((115, 182), 'tensorfl...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2018 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
[ "tiledb.SparseArray", "tiledb.DenseArray", "numpy.empty", "numpy.ascontiguousarray" ]
[((1186, 1231), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['ctx[chunk.op.input.key]'], {}), '(ctx[chunk.op.input.key])\n', (1206, 1231), True, 'import numpy as np\n'), ((1650, 1696), 'numpy.empty', 'np.empty', (['((0,) * chunk.ndim)'], {'dtype': 'chunk.dtype'}), '((0,) * chunk.ndim, dtype=chunk.dtype)\n', (16...
"""Routines for numerical differentiation.""" from __future__ import division import numpy as np from numpy.linalg import norm from scipy.sparse.linalg import LinearOperator from ..sparse import issparse, csc_matrix, csr_matrix, coo_matrix, find from ._group_columns import group_dense, group_sparse EPS = np.finfo(n...
[ "scipy.sparse.linalg.LinearOperator", "numpy.hstack", "numpy.equal", "numpy.linalg.norm", "numpy.random.RandomState", "numpy.atleast_2d", "numpy.isscalar", "numpy.asarray", "numpy.max", "numpy.resize", "numpy.empty", "numpy.maximum", "numpy.isinf", "numpy.abs", "numpy.any", "numpy.nonz...
[((310, 330), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (318, 330), True, 'import numpy as np\n'), ((1858, 1898), 'numpy.all', 'np.all', (['((lb == -np.inf) & (ub == np.inf))'], {}), '((lb == -np.inf) & (ub == np.inf))\n', (1864, 1898), True, 'import numpy as np\n'), ((13340, 13357), 'numpy.atl...
"""The present code is the Version 1.0 of the RCNN approach to perform MPS in 3D for categorical variables. It has been developed by <NAME> and <NAME> in the Geometallurygical Group at Queen's University as part of a PhD program. The code is not free of bugs but running end-to-end. Any comments and further improv...
[ "External_Functions_3D.Grid", "numpy.around", "gc.collect", "External_Functions_3D.CreateGraph_4ConvNets_4HL_NFeaConv_wdnhxwdnh_BN_3D", "time.time" ]
[((926, 937), 'time.time', 'time.time', ([], {}), '()\n', (935, 937), False, 'import time\n'), ((3406, 3510), 'External_Functions_3D.CreateGraph_4ConvNets_4HL_NFeaConv_wdnhxwdnh_BN_3D', 'fns_nested.CreateGraph_4ConvNets_4HL_NFeaConv_wdnhxwdnh_BN_3D', ([], {'HyperPar': 'HyperPar', 'LocModel': 'LocModel'}), '(HyperPar=\n...
"""This file contains functions for loading and preprocessing pianoroll data. """ import logging import numpy as np import tensorflow.compat.v1 as tf from musegan.config import SHUFFLE_BUFFER_SIZE, PREFETCH_SIZE LOGGER = logging.getLogger(__name__) # --- Data loader ----------------------------------------------------...
[ "logging.getLogger", "numpy.issubdtype", "numpy.random.randint", "numpy.zeros", "tensorflow.compat.v1.py_func", "SharedArray.attach", "numpy.load" ]
[((221, 248), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (238, 248), False, 'import logging\n'), ((437, 454), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (444, 454), True, 'import numpy as np\n'), ((1379, 1403), 'numpy.random.randint', 'np.random.randint', (['(-5)', '...
""" CTC-like decoder utilitis. """ from itertools import groupby import numpy as np def ctc_best_path_decode(probs_seq, vocabulary): """ Best path decoding, also called argmax decoding or greedy decoding. Path consisting of the most probable tokens are further post-processed to remove consecutive...
[ "numpy.array", "itertools.groupby" ]
[((1104, 1127), 'itertools.groupby', 'groupby', (['max_index_list'], {}), '(max_index_list)\n', (1111, 1127), False, 'from itertools import groupby\n'), ((973, 992), 'numpy.array', 'np.array', (['probs_seq'], {}), '(probs_seq)\n', (981, 992), True, 'import numpy as np\n')]
import os import string from collections import Counter from datetime import datetime from functools import partial from pathlib import Path from typing import Optional import numpy as np import pandas as pd from scipy.stats.stats import chisquare from tangled_up_in_unicode import block, block_abbr, categor...
[ "pandas_profiling.model.summary_helpers_image.open_image", "numpy.mean", "numpy.histogram", "tangled_up_in_unicode.category_long", "os.path.splitdrive", "tangled_up_in_unicode.category", "numpy.max", "numpy.min", "tangled_up_in_unicode.block", "tangled_up_in_unicode.script", "scipy.stats.stats.c...
[((5143, 5159), 'pandas_profiling.model.summary_helpers_image.open_image', 'open_image', (['path'], {}), '(path)\n', (5153, 5159), False, 'from pandas_profiling.model.summary_helpers_image import extract_exif, hash_image, is_image_truncated, open_image\n'), ((7511, 7541), 'pandas.Series', 'pd.Series', (['counts'], {'in...
import torch import numpy as np import pickle torch.manual_seed(17) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False np.random.seed(17) import argparse import torch.nn as nn import torch.nn.functional as F import matplotlib import os from rational.torch import Rational, RecurrentRationa...
[ "torch.manual_seed", "argparse.ArgumentParser", "torch.nn.functional.nll_loss", "os.path.join", "torch.cuda.is_available", "torch.set_anomaly_enabled", "matplotlib.rc", "numpy.random.seed", "torchvision.transforms.Resize", "torch.no_grad", "torchvision.transforms.ToTensor", "torchvision.transf...
[((47, 68), 'torch.manual_seed', 'torch.manual_seed', (['(17)'], {}), '(17)\n', (64, 68), False, 'import torch\n'), ((150, 168), 'numpy.random.seed', 'np.random.seed', (['(17)'], {}), '(17)\n', (164, 168), True, 'import numpy as np\n'), ((592, 621), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **fo...
from data.data_loader_dad import ( NASA_Anomaly, WADI ) from exp.exp_basic import Exp_Basic from models.model import Informer from utils.tools import EarlyStopping, adjust_learning_rate from utils.metrics import metric from sklearn.metrics import classification_report import numpy as np import torch import t...
[ "os.path.exists", "os.makedirs", "numpy.average", "torch.load", "torch.nn.MSELoss", "utils.tools.EarlyStopping", "numpy.array", "utils.tools.adjust_learning_rate", "torch.cat", "torch.utils.data.DataLoader", "utils.metrics.metric", "torch.no_grad", "torch.zeros_like", "time.time", "warni...
[((438, 471), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (461, 471), False, 'import warnings\n'), ((2215, 2335), 'torch.utils.data.DataLoader', 'DataLoader', (['data_set'], {'batch_size': 'batch_size', 'shuffle': 'shuffle_flag', 'num_workers': 'args.num_workers', 'drop...
import os import numpy as np import pandas as pd from keras.utils import to_categorical from sklearn.model_selection import KFold, train_test_split def load_data(path): train = pd.read_json(os.path.join(path, "./train.json")) test = pd.read_json(os.path.join(path, "./test.json")) return (train, test) ...
[ "sklearn.model_selection.train_test_split", "os.path.join", "numpy.array", "numpy.cos", "numpy.concatenate", "numpy.full", "sklearn.model_selection.KFold" ]
[((1090, 1209), 'numpy.concatenate', 'np.concatenate', (['[X_band_1[:, :, :, np.newaxis], X_band_2[:, :, :, np.newaxis], angl[:, :, :,\n np.newaxis]]'], {'axis': '(-1)'}), '([X_band_1[:, :, :, np.newaxis], X_band_2[:, :, :, np.newaxis\n ], angl[:, :, :, np.newaxis]], axis=-1)\n', (1104, 1209), True, 'import numpy...
import numpy as np import tensorflow as tf H = 2 N = 2 M = 3 BS = 10 def my_softmax(arr): max_elements = np.reshape(np.max(arr, axis = 2), (BS, N, 1)) arr = arr - max_elements exp_array = np.exp(arr) print (exp_array) sum_array = np.reshape(np.sum(exp_array, axis=2), (BS, N, 1)) return exp_arra...
[ "tensorflow.tile", "tensorflow.shape", "tensorflow.get_variable", "tensorflow.transpose", "numpy.array", "tensorflow.nn.softmax", "tensorflow.cast", "tensorflow.Session", "numpy.max", "numpy.exp", "tensorflow.concat", "tensorflow.matmul", "numpy.tile", "tensorflow.add", "tensorflow.resha...
[((201, 212), 'numpy.exp', 'np.exp', (['arr'], {}), '(arr)\n', (207, 212), True, 'import numpy as np\n'), ((1260, 1284), 'tensorflow.add', 'tf.add', (['logits', 'exp_mask'], {}), '(logits, exp_mask)\n', (1266, 1284), True, 'import tensorflow as tf\n'), ((1347, 1380), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['masked_...
import numpy as np import pytest from astropy import convolution from scipy.signal import medfilt import astropy.units as u from ..spectra.spectrum1d import Spectrum1D from ..tests.spectral_examples import simulated_spectra from ..manipulation.smoothing import (convolution_smooth, box_smooth, ...
[ "numpy.allclose", "astropy.convolution.CustomKernel", "pytest.mark.parametrize", "numpy.array", "astropy.convolution.convolve", "astropy.convolution.Gaussian1DKernel", "astropy.convolution.Box1DKernel", "scipy.signal.medfilt", "numpy.sum", "pytest.raises", "astropy.convolution.Trapezoid1DKernel"...
[((2105, 2147), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""width"""', '[1, 2.3]'], {}), "('width', [1, 2.3])\n", (2128, 2147), False, 'import pytest\n'), ((2941, 2987), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""width"""', "[-1, 0, 'a']"], {}), "('width', [-1, 0, 'a'])\n", (2964, 2987)...
import os import numpy as np import pandas as pd import tensorflow as tf from keras.preprocessing.image import ImageDataGenerator from keras.preprocessing.image import img_to_array, load_img from keras.utils.np_utils import to_categorical from sklearn.model_selection import StratifiedShuffleSplit from sklearn.preproces...
[ "sklearn.model_selection.StratifiedShuffleSplit", "os.path.exists", "keras.preprocessing.image.img_to_array", "sklearn.preprocessing.LabelEncoder", "pandas.read_csv", "numpy.argmax", "keras.preprocessing.image.ImageDataGenerator", "tensorflow.train.BytesList", "tensorflow.train.Int64List", "sklear...
[((419, 446), 'pandas.read_csv', 'pd.read_csv', (['"""../train.csv"""'], {}), "('../train.csv')\n", (430, 446), True, 'import pandas as pd\n'), ((706, 732), 'pandas.read_csv', 'pd.read_csv', (['"""../test.csv"""'], {}), "('../test.csv')\n", (717, 732), True, 'import pandas as pd\n'), ((920, 939), 'numpy.argmax', 'np.ar...
import numpy as np from skimage.transform import resize from skimage import measure from skimage.measure import regionprops class OCROnObjects(): def __init__(self, license_plate): character_objects = self.identify_boundary_objects(license_plate) self.get_regions(character_objects, license_pla...
[ "skimage.measure.regionprops", "numpy.array", "numpy.concatenate", "skimage.transform.resize", "skimage.measure.label" ]
[((412, 442), 'skimage.measure.label', 'measure.label', (['a_license_plate'], {}), '(a_license_plate)\n', (425, 442), False, 'from skimage import measure\n'), ((692, 715), 'skimage.measure.regionprops', 'regionprops', (['labelImage'], {}), '(labelImage)\n', (703, 715), False, 'from skimage.measure import regionprops\n'...