code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np class Perceptron: def __init__(self, number_of_inputs, learning_rate): self.weights = np.random.rand(1, number_of_inputs + 1)[0] self.learning_rate = learning_rate """A step function where non-negative values are returned by a 1 and negative values are returned by a -1""" ...
[ "numpy.array", "numpy.random.rand", "numpy.random.seed" ]
[((1013, 1033), 'numpy.random.seed', 'np.random.seed', (['(1111)'], {}), '(1111)\n', (1027, 1033), True, 'import numpy as np\n'), ((1088, 1134), 'numpy.array', 'np.array', (['[[-1, -1], [-1, 1], [1, -1], [1, 1]]'], {}), '([[-1, -1], [-1, 1], [1, -1], [1, 1]])\n', (1096, 1134), True, 'import numpy as np\n'), ((1152, 118...
# # grid_spline.py # # Code for one-dimensional cubic splines on a # uniform grid, including analytic slope, curvature, # and extremum evaluation. # # Most convenient interface is via GridSpline class, # which encapsulates the low-level routines. # # <NAME>, <NAME>, 2010-2014 # import numpy as n def tri_diag(a, b, c,...
[ "numpy.roll", "numpy.sqrt", "numpy.where", "numpy.int32", "numpy.asarray", "numpy.zeros", "numpy.arange" ]
[((1120, 1137), 'numpy.zeros', 'n.zeros', (['(bign - 1)'], {}), '(bign - 1)\n', (1127, 1137), True, 'import numpy as n\n'), ((1157, 1174), 'numpy.zeros', 'n.zeros', (['(bign - 1)'], {}), '(bign - 1)\n', (1164, 1174), True, 'import numpy as n\n'), ((1371, 1381), 'numpy.int32', 'n.int32', (['x'], {}), '(x)\n', (1378, 138...
# 运行参数: --model_dir=E:\model\official_myDataset --data_dir=E:\data\my_dataset --train_epochs=10 --distribution_strategy=one_device --num_gpus=1 --download # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except...
[ "official.utils.flags.core.define_distribution", "tensorflow.train.Checkpoint", "official.utils.flags.core.define_device", "absl.logging.info", "tensorflow.keras.layers.Dense", "official.utils.flags.core.define_base", "tensorflow.keras.layers.Input", "official.utils.misc.distribution_utils.get_distrib...
[((1583, 1639), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': '(12, 12, 1)', 'name': '"""image12"""'}), "(shape=(12, 12, 1), name='image12')\n", (1604, 1639), True, 'import tensorflow as tf\n'), ((1653, 1706), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': '(6, 6, 1)...
import cv2 import numpy as np import sys import os import peakutils from scipy import signal def detectKanji(img): img_gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) blur = cv2.GaussianBlur(img_gray, (11, 11), 0) ret3, img_thres = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU) height, w...
[ "os.path.exists", "cv2.threshold", "os.path.join", "scipy.signal.savgol_filter", "cv2.imshow", "peakutils.indexes", "numpy.array", "cv2.waitKey", "cv2.destroyAllWindows", "os.mkdir", "cv2.cvtColor", "cv2.GaussianBlur", "cv2.imread", "cv2.namedWindow" ]
[((131, 168), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2GRAY'], {}), '(img, cv2.COLOR_RGB2GRAY)\n', (143, 168), False, 'import cv2\n'), ((180, 219), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['img_gray', '(11, 11)', '(0)'], {}), '(img_gray, (11, 11), 0)\n', (196, 219), False, 'import cv2\n'), ((242, 306), ...
""" Collection of approximation methods Global methods are used on a distribution as a wrapper. Local function are used by the graph-module as part of calculations. Functions --------- pdf Probability density function (local) pdf_full Probability density function (global) ppf Inverse CD...
[ "numpy.mean", "numpy.prod", "numpy.allclose", "numpy.abs", "numpy.ones", "numpy.where", "numpy.ndindex", "numpy.any", "numpy.max", "numpy.asfarray", "numpy.sum", "numpy.zeros", "numpy.array", "numpy.empty", "numpy.cov", "numpy.min", "numpy.all", "numpy.var" ]
[((1346, 1363), 'numpy.asfarray', 'numpy.asfarray', (['x'], {}), '(x)\n', (1360, 1363), False, 'import numpy\n'), ((1433, 1463), 'numpy.where', 'numpy.where', (['(x < mu)', 'eps', '(-eps)'], {}), '(x < mu, eps, -eps)\n', (1444, 1463), False, 'import numpy\n'), ((1502, 1522), 'numpy.empty', 'numpy.empty', (['x.shape'], ...
# ActivitySim # See full license in LICENSE.txt. from builtins import range import logging import numpy as np import pandas as pd from activitysim.core import logit from activitysim.core import config from activitysim.core import inject from activitysim.core import tracing from activitysim.core import chunk from act...
[ "logging.getLogger", "activitysim.core.util.reindex", "activitysim.core.config.config_file_path", "activitysim.core.chunk.log_df", "activitysim.core.tracing.has_trace_targets", "activitysim.core.tracing.extend_trace_label", "numpy.arange", "activitysim.core.logit.make_choices", "numpy.where", "act...
[((588, 615), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (605, 615), False, 'import logging\n'), ((14433, 14446), 'activitysim.core.inject.step', 'inject.step', ([], {}), '()\n', (14444, 14446), False, 'from activitysim.core import inject\n'), ((1374, 1409), 'activitysim.core.util.rei...
import numpy as np from sklearn.naive_bayes import MultinomialNB from sklearn import metrics from sklearn.decomposition import NMF import datetime import matplotlib.pyplot as plt if __name__ == "__main__": startTime = datetime.datetime.now() # Load training data x = np.load('data/train_w2v_data_array.npy'...
[ "matplotlib.pyplot.savefig", "numpy.add", "numpy.amin", "matplotlib.pyplot.ylabel", "sklearn.metrics.average_precision_score", "matplotlib.pyplot.show", "matplotlib.pyplot.xlabel", "numpy.where", "sklearn.metrics.precision_recall_curve", "matplotlib.pyplot.fill_between", "datetime.datetime.now",...
[((223, 246), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (244, 246), False, 'import datetime\n'), ((281, 321), 'numpy.load', 'np.load', (['"""data/train_w2v_data_array.npy"""'], {}), "('data/train_w2v_data_array.npy')\n", (288, 321), True, 'import numpy as np\n'), ((330, 372), 'numpy.load', 'np...
""" Code for the EKF Refactored """ import sympy from sympy import atan, pi, tan from sympy import symbols, Matrix from math import sqrt, tan, cos, sin, atan2 import matplotlib.pyplot as plt import numpy as np from numpy.random import randn from filterpy.kalman import ExtendedKalmanFilter as EKF from numpy import arra...
[ "sympy.sin", "sympy.cos", "filterpy.kalman.ExtendedKalmanFilter.__init__", "math.tan", "sympy.Matrix", "sympy.tan", "sympy.symbols", "numpy.array", "numpy.dot", "math.cos", "math.sin" ]
[((417, 444), 'filterpy.kalman.ExtendedKalmanFilter.__init__', 'EKF.__init__', (['self', '(3)', '(2)', '(2)'], {}), '(self, 3, 2, 2)\n', (429, 444), True, 'from filterpy.kalman import ExtendedKalmanFilter as EKF\n'), ((605, 639), 'sympy.symbols', 'symbols', (['"""a, x, y, v, w, theta, t"""'], {}), "('a, x, y, v, w, the...
import numpy as np import pandas as pd import pyro import pyro.distributions as dist import torch from pyro.nn import PyroModule from scvi import _CONSTANTS from scvi.data._anndata import get_from_registry from scvi.nn import one_hot # class NegativeBinomial(TorchDistributionMixin, ScVINegativeBinomial): # pass c...
[ "pyro.distributions.Exponential", "torch.ones", "scvi.nn.one_hot", "pyro.distributions.GammaPoisson", "numpy.power", "pyro.deterministic", "torch.tensor", "scvi.data._anndata.get_from_registry", "pyro.distributions.Gamma", "numpy.dot", "numpy.arange", "pyro.plate" ]
[((8385, 8448), 'pyro.plate', 'pyro.plate', (['"""obs_plate"""'], {'size': 'self.n_obs', 'dim': '(-2)', 'subsample': 'idx'}), "('obs_plate', size=self.n_obs, dim=-2, subsample=idx)\n", (8395, 8448), False, 'import pyro\n'), ((9542, 9576), 'scvi.nn.one_hot', 'one_hot', (['batch_index', 'self.n_batch'], {}), '(batch_inde...
import numpy as np import pytest import taichi as ti from tests import test_utils def with_data_type(dt): val = ti.field(ti.i32) n = 4 ti.root.dense(ti.i, n).place(val) @ti.kernel def test_numpy(arr: ti.ext_arr()): for i in range(n): arr[i] = arr[i]**2 a = np.array([4,...
[ "taichi.ndrange", "taichi.field", "tests.test_utils.test", "numpy.array", "numpy.zeros", "numpy.empty", "taichi.grouped", "pytest.raises", "taichi.ext_arr", "taichi.root.dense", "taichi.any_arr" ]
[((466, 483), 'tests.test_utils.test', 'test_utils.test', ([], {}), '()\n', (481, 483), False, 'from tests import test_utils\n'), ((540, 584), 'tests.test_utils.test', 'test_utils.test', ([], {'require': 'ti.extension.data64'}), '(require=ti.extension.data64)\n', (555, 584), False, 'from tests import test_utils\n'), ((...
# Python imports from collections.abc import Sequence import numpy as np ''' StateClass.py: Contains the State Class. ''' class State(Sequence): ''' Abstract State class ''' def __init__(self, data=[], is_terminal=False): self.data = data self._is_terminal = is_terminal def features(sel...
[ "numpy.array" ]
[((616, 635), 'numpy.array', 'np.array', (['self.data'], {}), '(self.data)\n', (624, 635), True, 'import numpy as np\n')]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import numpy as np import argparse import random import torch import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.utils.data import torchvision.transforms as transforms from torch.autograd import Variable import utils from util...
[ "numpy.ones", "argparse.ArgumentParser", "torch.Tensor", "numpy.argmax", "ModelNet40Loader.ModelNet40Cls", "numpy.array", "numpy.random.randint", "numpy.zeros", "numpy.sum", "numpy.vstack", "data_utils.PointcloudToTensor", "torch.cuda.is_available", "test_debugged.test.pointnet2_cls_ssg.get_...
[((567, 592), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (590, 592), False, 'import argparse\n'), ((3560, 3656), 'ModelNet40Loader.ModelNet40Cls', 'ModelNet40Loader.ModelNet40Cls', (['opt.pnum'], {'train': '(False)', 'transforms': 'transforms', 'download': '(False)'}), '(opt.pnum, train=Fal...
"""Module for Testing the InVEST Wave Energy module.""" import unittest import tempfile import shutil import os import re import numpy import numpy.testing from osgeo import gdal from osgeo import osr, ogr from shapely.geometry import Polygon from shapely.geometry import Point import pygeoprocessing.tes...
[ "natcap.invest.wave_energy._pixel_size_based_on_coordinate_transform", "shapely.geometry.Point", "numpy.array", "shapely.geometry.Polygon", "natcap.invest.wave_energy._count_pixels_groups", "numpy.arange", "osgeo.osr.CoordinateTransformation", "os.path.exists", "numpy.testing.assert_array_almost_equ...
[((504, 542), 'os.path.join', 'os.path.join', (['REGRESSION_DATA', '"""input"""'], {}), "(REGRESSION_DATA, 'input')\n", (516, 542), False, 'import os\n'), ((413, 438), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (428, 438), False, 'import os\n'), ((1400, 1435), 'os.path.join', 'os.path.joi...
""" Tools for Projected Entangled Pair States Author: <NAME> <<EMAIL>> Date: July 2019 .. Note, peps tensors are stored in order: (5) top | (1) left ___|___ (4) right |\ | \ (2) bottom (3) physical """ from cyclopeps.tools.gen_ten import rand,einsum,eye,ones,sv...
[ "cyclopeps.tools.mps_tools.MPS", "numpy.prod", "cyclopeps.tools.gen_ten.eye", "cyclopeps.tools.gen_ten.ones", "cyclopeps.tools.gen_ten.zeros", "cyclopeps.tools.gen_ten.rand", "numpy.isfinite", "cyclopeps.tools.gen_ten.einsum" ]
[((3961, 3975), 'cyclopeps.tools.mps_tools.MPS', 'MPS', (['bound_mpo'], {}), '(bound_mpo)\n', (3964, 3975), False, 'from cyclopeps.tools.mps_tools import MPS, identity_mps\n'), ((6850, 6868), 'cyclopeps.tools.mps_tools.MPS', 'MPS', (['bound_mpo_new'], {}), '(bound_mpo_new)\n', (6853, 6868), False, 'from cyclopeps.tools...
import numpy as np import ray import ray.rllib.algorithms.ppo as ppo import onnxruntime import os import shutil # Configure our PPO. config = ppo.DEFAULT_CONFIG.copy() config["num_gpus"] = 0 config["num_workers"] = 1 config["framework"] = "tf" outdir = "export_tf" if os.path.exists(outdir): shutil.rmtree(outdir) ...
[ "os.path.exists", "numpy.allclose", "ray.init", "os.path.join", "onnxruntime.InferenceSession", "numpy.random.uniform", "numpy.random.seed", "ray.rllib.algorithms.ppo.PPO", "shutil.rmtree", "ray.rllib.algorithms.ppo.DEFAULT_CONFIG.copy" ]
[((143, 168), 'ray.rllib.algorithms.ppo.DEFAULT_CONFIG.copy', 'ppo.DEFAULT_CONFIG.copy', ([], {}), '()\n', (166, 168), True, 'import ray.rllib.algorithms.ppo as ppo\n'), ((270, 292), 'os.path.exists', 'os.path.exists', (['outdir'], {}), '(outdir)\n', (284, 292), False, 'import os\n'), ((321, 341), 'numpy.random.seed', ...
import math import os import time import numpy as np import pandas as pd import scipy.io as scio import geatpy as ea import warnings class Problem: def __init__(self, name, M, maxormins, Dim, varTypes, lb, ub, lbin, ubin, aimFunc=None, calReferObjV=None): self.name = name self.M = M self....
[ "geatpy.Xovpmx", "numpy.random.rand", "pandas.read_csv", "numpy.hstack", "numpy.array", "geatpy.SoeaAlgorithm.__init__", "geatpy.Mutinv", "os.path.exists", "numpy.where", "numpy.delete", "numpy.vstack", "numpy.concatenate", "warnings.warn", "numpy.isinf", "numpy.abs", "numpy.ones", "...
[((332, 351), 'numpy.array', 'np.array', (['maxormins'], {}), '(maxormins)\n', (340, 351), True, 'import numpy as np\n'), ((399, 417), 'numpy.array', 'np.array', (['varTypes'], {}), '(varTypes)\n', (407, 417), True, 'import numpy as np\n'), ((440, 458), 'numpy.array', 'np.array', (['[lb, ub]'], {}), '([lb, ub])\n', (44...
import unittest import sys sys.path.insert(0,'..') import numpy as np from parampy import Parameters from qubricks import Operator from qubricks.wall import SpinBasis, SimpleBasis class TestBasis(unittest.TestCase): def setUp(self): self.b = SpinBasis(dim=2**3) def test_properties(self): self.assertEqual(sel...
[ "sys.path.insert", "qubricks.wall.SimpleBasis", "numpy.sqrt", "qubricks.wall.SpinBasis", "qubricks.Operator", "parampy.Parameters", "numpy.array" ]
[((27, 51), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (42, 51), False, 'import sys\n'), ((249, 270), 'qubricks.wall.SpinBasis', 'SpinBasis', ([], {'dim': '(2 ** 3)'}), '(dim=2 ** 3)\n', (258, 270), False, 'from qubricks.wall import SpinBasis, SimpleBasis\n'), ((1291, 1303), 'paramp...
import numpy as np from rubin_sim.photUtils import Bandpass __all__ = ["getImsimFluxNorm"] def getImsimFluxNorm(sed, magmatch): """ Calculate the flux normalization of an SED in the imsim bandpass. Parameters ----------- sed is the SED to be normalized magmatch is the desired magnitude in ...
[ "numpy.where", "rubin_sim.photUtils.Bandpass", "numpy.interp", "numpy.power" ]
[((1672, 1697), 'numpy.power', 'np.power', (['(10)', '(-0.4 * dmag)'], {}), '(10, -0.4 * dmag)\n', (1680, 1697), True, 'import numpy as np\n'), ((897, 907), 'rubin_sim.photUtils.Bandpass', 'Bandpass', ([], {}), '()\n', (905, 907), False, 'from rubin_sim.photUtils import Bandpass\n'), ((958, 979), 'numpy.where', 'np.whe...
from abc import ABC from pathlib import Path from collections import defaultdict import random import numpy as np from enum import Enum import torch from torch.utils.data import Dataset, DataLoader import MinkowskiEngine as ME from plyfile import PlyData import lib.transforms as t from lib.dataloader import InfSamp...
[ "lib.transforms.ChromaticTranslation", "lib.transforms.ChromaticJitter", "numpy.hstack", "torch.utils.data.DataLoader", "numpy.array", "lib.transforms.RandomDropout", "lib.transforms.cflt_collate_fn_factory", "lib.voxelizer.Voxelizer", "lib.dataloader.InfSampler", "pathlib.Path", "numpy.vstack",...
[((15582, 15605), 'torch.utils.data.DataLoader', 'DataLoader', ([], {}), '(**data_args)\n', (15592, 15605), False, 'from torch.utils.data import Dataset, DataLoader\n'), ((2008, 2030), 'torch.utils.data.Dataset.__init__', 'Dataset.__init__', (['self'], {}), '(self)\n', (2024, 2030), False, 'from torch.utils.data import...
import glob import os import numpy as np from yt.data_objects.static_output import ParticleDataset from yt.frontends.halo_catalog.data_structures import HaloCatalogFile from yt.funcs import setdefaultattr from yt.geometry.particle_geometry_handler import ParticleIndex from yt.utilities import fortran_utils as fpu fro...
[ "yt.utilities.fortran_utils.read_cattrs", "numpy.fromfile", "numpy.ones", "numpy.array", "numpy.empty", "yt.utilities.cosmology.Cosmology", "yt.funcs.setdefaultattr", "glob.glob" ]
[((1160, 1198), 'numpy.empty', 'np.empty', (['(pcount, 3)'], {'dtype': '"""float64"""'}), "((pcount, 3), dtype='float64')\n", (1168, 1198), True, 'import numpy as np\n'), ((1266, 1318), 'numpy.fromfile', 'np.fromfile', (['f'], {'dtype': 'self.io._halo_dt', 'count': 'pcount'}), '(f, dtype=self.io._halo_dt, count=pcount)...
from typing import List, Tuple, Union, Any import numpy as np from collections import defaultdict import itertools import matplotlib.pyplot as plt T_untokenized = Union[List[str], Tuple[List[str], List[Any]]] def untokenize(raw: str, tokens: List[str], return_mask: bool = False, toke...
[ "numpy.ones_like", "numpy.exp", "numpy.array", "itertools.chain.from_iterable", "collections.defaultdict", "matplotlib.pyplot.get_cmap" ]
[((5128, 5147), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""bwr"""'], {}), "('bwr')\n", (5140, 5147), True, 'import matplotlib.pyplot as plt\n'), ((2877, 2900), 'numpy.array', 'np.array', (['self.as_list_'], {}), '(self.as_list_)\n', (2885, 2900), True, 'import numpy as np\n'), ((4767, 4804), 'numpy.ones_like',...
""" Build an electrophysiological dataset ===================================== In Frites, a dataset is a structure for grouping the electrophysiological data (e.g MEG / EEG / Intracranial) coming from multiple subjects. In addition, some basic operations can also be performed (like slicing, smoothing etc.). In this e...
[ "numpy.random.rand", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.title", "numpy.arange", "matplotlib.pyplot.show" ]
[((1592, 1630), 'matplotlib.pyplot.plot', 'plt.plot', (['dt.times', 'dt.x[0][:, 0, :].T'], {}), '(dt.times, dt.x[0][:, 0, :].T)\n', (1600, 1630), True, 'import matplotlib.pyplot as plt\n'), ((1631, 1650), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Times"""'], {}), "('Times')\n", (1641, 1650), True, 'import matplot...
import os import astropy.constants as const import astropy.units as u import numpy as np from astropy.coordinates import GCRS, ITRS, SkyOffsetFrame, SkyCoord, EarthLocation, Angle, get_sun from astropy.time import Time from sora.config import input_tests __all__ = ['plot_occ_map'] def xy2latlon(x, y, loncen, latce...
[ "astropy.coordinates.EarthLocation", "numpy.sqrt", "astropy.coordinates.GCRS", "astropy.coordinates.get_sun", "sora.config.input_tests.check_kwargs", "numpy.array", "numpy.arctan2", "astropy.constants.R_earth.to", "numpy.sin", "numpy.arange", "os.path.exists", "numpy.repeat", "astropy.coordi...
[((1032, 1077), 'astropy.coordinates.EarthLocation', 'EarthLocation', (['(loncen * u.deg)', '(latcen * u.deg)'], {}), '(loncen * u.deg, latcen * u.deg)\n', (1045, 1077), False, 'from astropy.coordinates import GCRS, ITRS, SkyOffsetFrame, SkyCoord, EarthLocation, Angle, get_sun\n'), ((1187, 1207), 'numpy.array', 'np.arr...
# calculation of time (in seconds) that elapsed between the stimulation is applied and the VAS # score is register import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # set path path = '../data/data_sub.xlsx' dataFrame = pd.read_excel(path, header=2, sheet_name='trials_noTime'...
[ "numpy.mean", "numpy.median", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.figure", "matplotlib.pyplot.yticks", "pandas.read_excel", "pandas.DataFrame", "matplotlib.pyplot.title", "seaborn.swarmplot" ]
[((264, 321), 'pandas.read_excel', 'pd.read_excel', (['path'], {'header': '(2)', 'sheet_name': '"""trials_noTime"""'}), "(path, header=2, sheet_name='trials_noTime')\n", (277, 321), True, 'import pandas as pd\n'), ((10273, 10286), 'matplotlib.pyplot.figure', 'plt.figure', (['(2)'], {}), '(2)\n', (10283, 10286), True, '...
# Copyright 2020 The Magenta Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
[ "model.Model", "tensorflow.compat.v1.disable_v2_behavior", "zipfile.ZipFile", "model.copy_hparams", "tensorflow.compat.v1.get_default_session", "tensorflow.compat.v1.summary.Summary", "tensorflow.compat.v1.global_variables_initializer", "model.get_default_hparams", "tensorflow.compat.v1.logging.set_...
[((857, 898), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (881, 898), True, 'import tensorflow.compat.v1 as tf\n'), ((928, 1211), 'tensorflow.compat.v1.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""data_dir"""', '"""https://...
""" Aggregate tools =============== """ import sys import numpy from .._lib.hashmap import factorize from ..compat import tqdm from ..ds.scaling import linearscaling from .arrays import first, lexsort_uint32_pair, to_structured def igroupby(ids, values, n=None, logging_prefix=None, assume_sorted=False, ...
[ "numpy.unique", "numpy.where", "numpy.asarray", "numpy.warnings.filterwarnings", "numpy.iinfo", "numpy.argsort", "numpy.lexsort", "numpy.warnings.catch_warnings", "numpy.empty_like", "numpy.empty", "numpy.cumsum", "numpy.full", "numpy.bincount" ]
[((2130, 2148), 'numpy.asarray', 'numpy.asarray', (['ids'], {}), '(ids)\n', (2143, 2148), False, 'import numpy\n'), ((2162, 2183), 'numpy.asarray', 'numpy.asarray', (['values'], {}), '(values)\n', (2175, 2183), False, 'import numpy\n'), ((5163, 5187), 'numpy.full', 'numpy.full', (['length', 'init'], {}), '(length, init...
import pyautogui import PySimpleGUI as sg import cv2 import numpy as np """ Demo program that displays a webcam using OpenCV """ def main(): sg.theme('Black') # define the window layout layout = [[sg.Text('OpenCV Demo', size=(40, 1), justification='center', font='Helvetica 20')], [sg.Imag...
[ "cv2.imencode", "pyautogui.screenshot", "PySimpleGUI.Text", "PySimpleGUI.Button", "PySimpleGUI.theme", "cv2.VideoCapture", "PySimpleGUI.Image", "numpy.full", "PySimpleGUI.Window" ]
[((149, 166), 'PySimpleGUI.theme', 'sg.theme', (['"""Black"""'], {}), "('Black')\n", (157, 166), True, 'import PySimpleGUI as sg\n'), ((684, 763), 'PySimpleGUI.Window', 'sg.Window', (['"""Demo Application - OpenCV Integration"""', 'layout'], {'location': '(800, 400)'}), "('Demo Application - OpenCV Integration', layout...
# Copyright (c) 2019 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...
[ "logging.getLogger", "utils.tokenization.FullTokenizer", "numpy.ones_like", "collections.namedtuple", "utils.tokenization.convert_to_unicode", "numpy.where", "dataclasses.dataclass", "os.path.join", "io.open", "numpy.zeros", "io.TextIOWrapper", "numpy.random.seed", "numpy.expand_dims", "js...
[((988, 1015), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1005, 1015), False, 'import logging\n'), ((4158, 4181), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(False)'}), '(frozen=False)\n', (4167, 4181), False, 'from dataclasses import dataclass\n'), ((1060, 1113), 'io.Tex...
import numpy as np import cv2 def softmax(x, axis=-1): numerator = np.exp(x - np.max(x, axis=axis, keepdims=True)) return numerator / np.sum(numerator, axis=axis, keepdims=True) def resize(image, width=None, height=None, inter=cv2.INTER_AREA): # initialize the dimensions of the image to be resized and ...
[ "numpy.mean", "numpy.fabs", "numpy.sqrt", "numpy.minimum", "numpy.hstack", "numpy.where", "numpy.polyfit", "numpy.argmax", "numpy.max", "numpy.exp", "numpy.array", "numpy.sum", "numpy.zeros", "numpy.vstack", "numpy.min", "numpy.maximum", "cv2.resize", "numpy.arange" ]
[((975, 1018), 'cv2.resize', 'cv2.resize', (['image', 'dim'], {'interpolation': 'inter'}), '(image, dim, interpolation=inter)\n', (985, 1018), False, 'import cv2\n'), ((1495, 1519), 'numpy.array', 'np.array', (['[0, 0, 15, 15]'], {}), '([0, 0, 15, 15])\n', (1503, 1519), True, 'import numpy as np\n'), ((1782, 1809), 'nu...
import os import sys sys.path.append(os.getcwd()) #from __future__ import print_function import torch import torch.nn.functional as F from torch.autograd import Variable import torch.nn as nn import torch.optim as optim from workspace.workspace_intent import SENT_WORDID, SENT_LABELID, SENT_WORD_MASK, SENT_ORIGINAL_TXT ...
[ "numpy.mean", "os.path.join", "numpy.argmax", "os.getcwd", "numpy.max", "numpy.array", "torch.no_grad" ]
[((37, 48), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (46, 48), False, 'import os\n'), ((4884, 4902), 'numpy.array', 'numpy.array', (['probs'], {}), '(probs)\n', (4895, 4902), False, 'import numpy\n'), ((4917, 4933), 'numpy.array', 'numpy.array', (['gts'], {}), '(gts)\n', (4928, 4933), False, 'import numpy\n'), ((495...
#! /usr/bin/env python import numpy as np from .order_parameters import potential_M_N, centroid_m def is_discrete_pattern_formed(states, params): K = params['K'] M = params['M'] potential = potential_M_N(K, M, states.values()) velocities = np.array([s.velocity for s in states.values()]) speeds = ...
[ "numpy.linalg.norm" ]
[((320, 354), 'numpy.linalg.norm', 'np.linalg.norm', (['velocities'], {'axis': '(1)'}), '(velocities, axis=1)\n', (334, 354), True, 'import numpy as np\n'), ((646, 680), 'numpy.linalg.norm', 'np.linalg.norm', (['velocities'], {'axis': '(1)'}), '(velocities, axis=1)\n', (660, 680), True, 'import numpy as np\n')]
import os import struct import numpy as np import torch import torch.utils.data from functools import lru_cache def read_longs(f, n): a = np.empty(n, dtype=np.int64) f.readinto(a) return a def write_longs(f, a): f.write(np.array(a, dtype=np.int64)) dtypes = { 1: np.uint8, 2: np.int8, 3...
[ "numpy.frombuffer", "numpy.memmap", "torch.from_numpy", "struct.pack", "numpy.array", "numpy.empty", "functools.lru_cache" ]
[((144, 171), 'numpy.empty', 'np.empty', (['n'], {'dtype': 'np.int64'}), '(n, dtype=np.int64)\n', (152, 171), True, 'import numpy as np\n'), ((4783, 4803), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(8)'}), '(maxsize=8)\n', (4792, 4803), False, 'from functools import lru_cache\n'), ((240, 267), 'numpy.array'...
# *SymmetryFinder*: platform-independent symmetry finder, wrapping Spglib code # *SymmetryHandler*: symmetry inferences for 0D-, 1D-, 2D- and 3D-systems # Author: <NAME> from numpy.linalg import det from ase.atoms import Atoms from ase.geometry import cell_to_cellpar import spglib as spg class SymmetryFinder: ...
[ "numpy.linalg.det", "spglib.refine_cell", "ase.geometry.cell_to_cellpar", "spglib.get_spacegroup" ]
[((588, 700), 'spglib.get_spacegroup', 'spg.get_spacegroup', (["tilde_obj['structures'][-1]"], {'symprec': 'self.accuracy', 'angle_tolerance': 'self.angle_tolerance'}), "(tilde_obj['structures'][-1], symprec=self.accuracy,\n angle_tolerance=self.angle_tolerance)\n", (606, 700), True, 'import spglib as spg\n'), ((124...
#!/usr/bin/env python from __future__ import division from past.utils import old_div import unittest import os.path import sys import numpy import anuga from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross from anuga.shallow_water.shallow_water_domain import Domain from anuga.abstract_2d_fini...
[ "numpy.allclose", "unittest.makeSuite", "anuga.Reflective_boundary", "os.path.join", "anuga.utilities.system_tools.get_pathname_from_package", "os.getcwd", "os.chdir", "os.remove", "numpy.zeros", "past.utils.old_div", "anuga.shallow_water.shallow_water_domain.Domain", "warnings.simplefilter", ...
[((9849, 9896), 'unittest.makeSuite', 'unittest.makeSuite', (['Test_inlet_operator', '"""test"""'], {}), "(Test_inlet_operator, 'test')\n", (9867, 9896), False, 'import unittest\n'), ((9910, 9935), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (9933, 9935), False, 'import unittest\n'), ((1302,...
import random import numpy as np def add_noise_new(data, labels, params): # new refactoring of the noise injection methods # noise_mode sets the pattern of the noise injection # cluster: apply to the samples and features defined by noise_samples and noise_features # conditional : apply to feature...
[ "numpy.random.normal", "random.random", "numpy.random.uniform" ]
[((5437, 5484), 'numpy.random.normal', 'np.random.normal', (['loc', 'scale'], {'size': 'x_data.shape'}), '(loc, scale, size=x_data.shape)\n', (5453, 5484), True, 'import numpy as np\n'), ((3589, 3604), 'random.random', 'random.random', ([], {}), '()\n', (3602, 3604), False, 'import random\n'), ((5895, 5945), 'numpy.ran...
#!/usr/bin/env python __author__ = "<EMAIL>" """ Reporter for junction summary for one or more samples. Recommended to run before scrubbing sample GFFs prior to chaining. Suggested process is: 1. run collapse to get GFF for each sample 2. run this report script on all sample GFFs 3. run scrubber on all sample GFFs 4....
[ "csv.DictWriter", "cupcake.cupcake_logger.info", "pathlib.Path", "typer.Option", "typer.Typer", "numpy.array", "collections.defaultdict", "sys.exit", "cupcake.cupcake_logger.error", "typer.run", "sklearn.cluster.Birch", "typer.Argument" ]
[((742, 814), 'typer.Typer', 'typer.Typer', ([], {'name': '"""cupcake.tofu.counting.summarize_sample_GFF_junctions"""'}), "(name='cupcake.tofu.counting.summarize_sample_GFF_junctions')\n", (753, 814), False, 'import typer\n'), ((4085, 4102), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (4096, 4...
from collections import OrderedDict, namedtuple from typing import Tuple import numpy as np import torch import torch.optim as optim from rlkit.core.loss import LossFunction, LossStatistics from torch import nn as nn import rlkit.torch.pytorch_util as ptu from rlkit.core.eval_util import create_stats_ordered_dict fro...
[ "numpy.prod", "collections.OrderedDict", "collections.namedtuple", "random.sample", "torch.ones", "torch.nn.MSELoss", "gtimer.blank_stamp", "numpy.loadtxt", "rlkit.torch.pytorch_util.get_numpy", "numpy.zeros", "torch.tensor", "torch.zeros", "rlkit.torch.pytorch_util.soft_update_from_to", "...
[((472, 564), 'collections.namedtuple', 'namedtuple', (['"""SACLosses"""', '"""policy_loss qf1_loss qf2_loss alpha_loss state_estimator_loss"""'], {}), "('SACLosses',\n 'policy_loss qf1_loss qf2_loss alpha_loss state_estimator_loss')\n", (482, 564), False, 'from collections import OrderedDict, namedtuple\n'), ((2425...
import numpy as np import torch import ptan def unpack_batch_a2c(batch, net, last_val_gamma, device="cpu"): """ Convert batch into training tensors :param batch: :param net: :return: states variable, actions tensor, reference values variable """ states = [] actions = [] rewards = ...
[ "numpy.array", "ptan.agent.float32_preprocessor", "torch.FloatTensor" ]
[((789, 824), 'numpy.array', 'np.array', (['rewards'], {'dtype': 'np.float32'}), '(rewards, dtype=np.float32)\n', (797, 824), True, 'import numpy as np\n'), ((645, 684), 'ptan.agent.float32_preprocessor', 'ptan.agent.float32_preprocessor', (['states'], {}), '(states)\n', (676, 684), False, 'import ptan\n'), ((712, 738)...
# -*- coding: utf-8 -*- """ Create Synthetic data. """ import numpy.random as rd import numpy as np import time class CreateData(object): def __init__(self, users, arms, dims, seed=int(time.time())): self.users = users self.arms = arms self.dims = dims self.data_rand = rd.RandomSta...
[ "numpy.ones", "time.time", "numpy.array", "numpy.sum", "numpy.linalg.norm", "numpy.random.randn", "numpy.random.RandomState" ]
[((308, 328), 'numpy.random.RandomState', 'rd.RandomState', (['seed'], {}), '(seed)\n', (322, 328), True, 'import numpy.random as rd\n'), ((353, 412), 'numpy.ones', 'np.ones', (['(self.users, self.arms, self.dims)'], {'dtype': 'np.float'}), '((self.users, self.arms, self.dims), dtype=np.float)\n', (360, 412), True, 'im...
#!/usr/bin/env python import rospy import cv2 from std_msgs.msg import String from sensor_msgs.msg import Image, CompressedImage,LaserScan from cv_bridge import CvBridge, CvBridgeError from message_filters import ApproximateTimeSynchronizer, Subscriber from ackermann_msgs.msg import AckermannDriveStamped import imutils...
[ "cv2.imwrite", "os.path.exists", "os.makedirs", "numpy.where", "rospy.init_node", "numpy.asarray", "preprocessing.utils.ImageUtils", "cv_bridge.CvBridge", "os.path.split", "rospy.Time.now", "rospy.myargv", "rospkg.RosPack", "rospy.spin", "message_filters.Subscriber", "message_filters.App...
[((4426, 4463), 'rospy.init_node', 'rospy.init_node', (['"""image_command_sync"""'], {}), "('image_command_sync')\n", (4441, 4463), False, 'import rospy\n'), ((4871, 4883), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (4881, 4883), False, 'import rospy\n'), ((1342, 1377), 'message_filters.Subscriber', 'Subscriber', ([...
# GPU performance tests extracted from py-videocorevi Python library. # Testing for Raspberry Pi 4 Benchmarking and device identification. # TREASURE PROJECT 2021 import time from time import clock_gettime,CLOCK_MONOTONIC from time import monotonic import fcntl import socket import struct import numpy as np from vid...
[ "time.sleep", "bench_helper.BenchHelper", "time.perf_counter_ns", "numpy.arange", "os.popen", "numpy.random.seed", "os.urandom", "time.monotonic", "numpy.random.randn", "numpy.set_printoptions", "numpy.array_equiv", "videocore6.driver.Driver", "socket.socket", "videocore6.pack_unpack", "...
[((563, 593), 'time.clock_gettime', 'clock_gettime', (['CLOCK_MONOTONIC'], {}), '(CLOCK_MONOTONIC)\n', (576, 593), False, 'from time import clock_gettime, CLOCK_MONOTONIC\n'), ((7391, 7413), 'time.perf_counter_ns', 'time.perf_counter_ns', ([], {}), '()\n', (7411, 7413), False, 'import time\n'), ((19278, 19313), 'bench_...
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.animation as anim import math import numpy as np import os import glob import sys import gaussianFit as gF import RL import Accelerated as ac import projections as proj import GMM_sample as GMMs import scipy from scipy.stats import entropy clas...
[ "numpy.random.rand", "GMM_sample.GMM_sample", "numpy.array", "numpy.rot90", "numpy.reshape", "GMM_sample.data_normalized_likelihood", "numpy.max", "Accelerated.AcceleratedMethod", "projections.SimplexProjectionExpSort", "numpy.identity", "numpy.tile", "scipy.stats.entropy", "numpy.add", "n...
[((573, 615), 'numpy.zeros', 'np.zeros', (['(reps, dimension, timeStep, rfs)'], {}), '((reps, dimension, timeStep, rfs))\n', (581, 615), True, 'import numpy as np\n'), ((640, 671), 'numpy.zeros', 'np.zeros', (['(reps, timeStep, rfs)'], {}), '((reps, timeStep, rfs))\n', (648, 671), True, 'import numpy as np\n'), ((872, ...
import numpy as np from collections import Counter from termcolor import colored from pyfiglet import * print(colored("Advent of Code - Day 19", "yellow").center(80, "-")) print(colored(figlet_format("Beacon Scanner",font="small",justify="center"), 'green')) print(colored("Output","yellow").center(80, "-")) r = [] r.ap...
[ "collections.Counter", "numpy.array", "termcolor.colored", "numpy.subtract" ]
[((340, 359), 'numpy.array', 'np.array', (['[x, y, z]'], {}), '([x, y, z])\n', (348, 359), True, 'import numpy as np\n'), ((383, 403), 'numpy.array', 'np.array', (['[x, -z, y]'], {}), '([x, -z, y])\n', (391, 403), True, 'import numpy as np\n'), ((427, 448), 'numpy.array', 'np.array', (['[x, -y, -z]'], {}), '([x, -y, -z...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from keras import backend as K from keras import initializers from keras import regularizers, constraints from keras.engine import Layer, InputSpec if K._BACKEND == 'tensorflow': import tensorflow as tf ...
[ "keras.engine.InputSpec", "keras.backend.shape", "keras.backend.sum", "keras.backend.reshape", "keras.backend.floatx", "keras.backend.squeeze", "keras.layers.Dense", "keras.backend.greater", "keras.backend.max", "theano.tensor.arange", "keras.layers.concatenate", "keras.backend.rnn", "keras....
[((2677, 2700), 'keras.backend.one_hot', 'K.one_hot', (['y', 'n_classes'], {}), '(y, n_classes)\n', (2686, 2700), True, 'from keras import backend as K\n'), ((2737, 2760), 'keras.backend.sum', 'K.sum', (['(x * y_one_hot)', '(2)'], {}), '(x * y_one_hot, 2)\n', (2742, 2760), True, 'from keras import backend as K\n'), ((2...
import pandas as pd import numpy as np import sys sys.path.append('./') from data_layer.phoible import PhoibleInfo from data_layer.parse import read_src_data, get_languages, separate_train, separate_per_language from util import argparser def get_symbols(df, field='IPA'): symbols = set([]) for i, (index, x) ...
[ "numpy.mean", "data_layer.parse.read_src_data", "data_layer.parse.get_languages", "util.argparser.parse_args", "pandas.concat", "data_layer.parse.separate_train", "pandas.DataFrame", "data_layer.phoible.PhoibleInfo", "sys.path.append", "data_layer.parse.separate_per_language" ]
[((51, 72), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (66, 72), False, 'import sys\n'), ((603, 616), 'numpy.mean', 'np.mean', (['lens'], {}), '(lens)\n', (610, 616), True, 'import numpy as np\n'), ((693, 706), 'data_layer.phoible.PhoibleInfo', 'PhoibleInfo', ([], {}), '()\n', (704, 706), Fal...
from numpy import sum from gwlfe.Memoization import memoize def TotLAEU(NumAnimals, AvgAnimalWt): result = 0 aeu3 = (NumAnimals[5] * AvgAnimalWt[5]) / 1000 aeu4 = (NumAnimals[4] * AvgAnimalWt[4]) / 1000 aeu5 = (NumAnimals[6] * AvgAnimalWt[6]) / 1000 aeu6 = (NumAnimals[0] * AvgAnimalWt[0]) / 1000 ...
[ "numpy.sum" ]
[((498, 568), 'numpy.sum', 'sum', (['(NumAnimals[[0, 1, 4, 5, 6]] * AvgAnimalWt[[0, 1, 4, 5, 6]] / 1000)'], {}), '(NumAnimals[[0, 1, 4, 5, 6]] * AvgAnimalWt[[0, 1, 4, 5, 6]] / 1000)\n', (501, 568), False, 'from numpy import sum\n')]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 5 11:34:19 2016 @author: bcolsen """ from wtforms import validators import numpy as np import re class DataLength(): def __init__(self, min=-1, max=-1, message=None): self.min = min self.max = max if not message: ...
[ "numpy.array", "wtforms.validators.ValidationError" ]
[((633, 673), 'wtforms.validators.ValidationError', 'validators.ValidationError', (['self.message'], {}), '(self.message)\n', (659, 673), False, 'from wtforms import validators\n'), ((1175, 1215), 'wtforms.validators.ValidationError', 'validators.ValidationError', (['self.message'], {}), '(self.message)\n', (1201, 1215...
""" 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...
[ "re.compile", "collections.Counter", "numpy.array", "numpy.linalg.norm", "re.sub" ]
[((1158, 1200), 're.compile', 're.compile', (['"""\\\\b(a|an|the)\\\\b"""', 're.UNICODE'], {}), "('\\\\b(a|an|the)\\\\b', re.UNICODE)\n", (1168, 1200), False, 'import re\n'), ((1215, 1239), 're.sub', 're.sub', (['regex', '""" """', 'text'], {}), "(regex, ' ', text)\n", (1221, 1239), False, 'import re\n'), ((6070, 6116)...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Built-in packages # External packages import numpy as np from matplotlib import pyplot as plt # import seaborn as sns # Internal packages from fynance.backtest.dynamic_plot_backtest import DynaPlotBackTest from fynance.neural_networks.roll_multi_neural_networks import ...
[ "numpy.mean", "fynance.neural_networks.roll_multi_neural_networks.RollMultiNeuralNet.__call__", "numpy.ones", "fynance.backtest.dynamic_plot_backtest.DynaPlotBackTest", "matplotlib.pyplot.style.use", "fynance.neural_networks.roll_multi_neural_networks.RollMultiNeuralNet.__init__", "numpy.argmax", "num...
[((357, 381), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (370, 381), True, 'from matplotlib import pyplot as plt\n'), ((2211, 2261), 'fynance.neural_networks.roll_multi_neural_networks.RollMultiNeuralNet.__init__', 'RollMultiNeuralNet.__init__', (['self', '*args'], {}), '(...
""" ckwg +31 Copyright 2016 by Kitware, Inc. 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 ...
[ "vital.types.RGBColor", "vital.types.Covariance", "numpy.testing.assert_almost_equal", "vital.types.Feature", "random.random" ]
[((1866, 1875), 'vital.types.Feature', 'Feature', ([], {}), '()\n', (1873, 1875), False, 'from vital.types import Covariance, EigenArray, Feature, RGBColor\n'), ((1889, 1913), 'vital.types.Feature', 'Feature', (['[1, 1]', '(1)', '(2)', '(1)'], {}), '([1, 1], 1, 2, 1)\n', (1896, 1913), False, 'from vital.types import Co...
# Copyright (c) 2018-2020, NVIDIA CORPORATION. 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 conditi...
[ "numpy.dtype", "infer_util.infer_exact", "unittest.main", "test_util.validate_for_tf_model", "sys.path.append" ]
[((1550, 1578), 'sys.path.append', 'sys.path.append', (['"""../common"""'], {}), "('../common')\n", (1565, 1578), False, 'import sys\n'), ((1753, 1769), 'numpy.dtype', 'np.dtype', (['object'], {}), '(object)\n', (1761, 1769), True, 'import numpy as np\n'), ((5887, 5902), 'unittest.main', 'unittest.main', ([], {}), '()\...
import matplotlib.pyplot as plt import numpy as np import scipy.optimize def plotdata(f1,f2,line=False,killme=False): x1,y1,x2,y2=[],[],[],[] for i in range(m): if y[i]:x1.append(f1[i]),y1.append(f2[i]) else:x2.append(f1[i]),y2.append(f2[i]) plt.plot(x1, y1, 'rx') plt.plot(x2,...
[ "numpy.mean", "numpy.ones", "matplotlib.pyplot.ylabel", "numpy.power", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.log", "numpy.square", "numpy.exp", "matplotlib.pyplot.contour", "numpy.zeros", "numpy.linspace", "numpy.array", "numpy.matrix", "matplotlib.pyplot.legend", ...
[((2474, 2485), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2482, 2485), True, 'import numpy as np\n'), ((280, 302), 'matplotlib.pyplot.plot', 'plt.plot', (['x1', 'y1', '"""rx"""'], {}), "(x1, y1, 'rx')\n", (288, 302), True, 'import matplotlib.pyplot as plt\n'), ((308, 330), 'matplotlib.pyplot.plot', 'plt.plot', ...
import numpy as np from scipy.special import expit from librosa.core import midi_to_hz from omnizart.constants.midi import LOWEST_MIDI_NOTE def inference(feature, model, timestep=128, batch_size=10, feature_num=384): assert len(feature.shape) == 2 # Padding total_samples = len(feature) pad_bottom = (...
[ "numpy.ceil", "numpy.where", "librosa.core.midi_to_hz", "numpy.argmax", "numpy.max", "scipy.special.expit", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.expand_dims", "numpy.pad" ]
[((456, 516), 'numpy.pad', 'np.pad', (['feature', '((pad_len, pad_len), (pad_bottom, pad_top))'], {}), '(feature, ((pad_len, pad_len), (pad_bottom, pad_top)))\n', (462, 516), True, 'import numpy as np\n'), ((560, 590), 'numpy.zeros', 'np.zeros', (['(feature.shape + (2,))'], {}), '(feature.shape + (2,))\n', (568, 590), ...
import scipy.io as sio import os import numpy as np import pickle def readMat(filename, folder, mode): filename = os.path.join(os.getcwd(), os.path.join(folder, filename)) print(filename) f = sio.loadmat(filename) # import h5py # with h5py.File(filename, 'r') as f: # # items = f['data...
[ "numpy.mean", "numpy.eye", "numpy.ones", "scipy.io.loadmat", "pickle.load", "os.path.join", "os.getcwd", "numpy.array", "numpy.sum", "numpy.concatenate", "numpy.linalg.norm", "numpy.transpose" ]
[((207, 228), 'scipy.io.loadmat', 'sio.loadmat', (['filename'], {}), '(filename)\n', (218, 228), True, 'import scipy.io as sio\n'), ((1098, 1123), 'numpy.ones', 'np.ones', (['(x1.shape[0], 1)'], {}), '((x1.shape[0], 1))\n', (1105, 1123), True, 'import numpy as np\n'), ((1190, 1224), 'numpy.concatenate', 'np.concatenate...
import numpy as np from numpy.linalg import norm from joblib import Parallel, delayed import pandas from bcdsugar.utils import Monitor from sparse_ho.ho import grad_search from itertools import product from sparse_ho.criterion import HeldOutSmoothedHinge from sparse_ho.models import SVM from sparse_ho.forward import Fo...
[ "sparse_ho.implicit.Implicit", "sparse_ho.criterion.HeldOutSmoothedHinge", "sparse_ho.implicit_forward.ImplicitForward", "numpy.log", "bcdsugar.utils.Monitor", "sparse_ho.ho.grad_search", "itertools.product", "joblib.Parallel", "numpy.array", "sparse_ho.forward.Forward", "numpy.linalg.norm", "...
[((4952, 4977), 'pandas.DataFrame', 'pandas.DataFrame', (['results'], {}), '(results)\n', (4968, 4977), False, 'import pandas\n'), ((1056, 1088), 'sparse_ho.datasets.real.get_data', 'get_data', (['dataset_name'], {'csr': '(True)'}), '(dataset_name, csr=True)\n', (1064, 1088), False, 'from sparse_ho.datasets.real import...
import pandas as pd import numpy as np import mplfinance as mpf # pip install mplfinance import akshare as ak import talib as ta # 第一步,获取数据并且计算指标 def get_data(item_code): stock_df = ak.stock_zh_a_hist(symbol=item_code, adjust="qfq") stock_df['日期'] = pd.to_datetime(stock_df['日期']) stock_df.rename(columns...
[ "mplfinance.show", "talib.DEMA", "numpy.where", "numpy.round", "mplfinance.figure", "talib.RSI", "mplfinance.plot", "mplfinance.make_addplot", "talib.MACD", "mplfinance.make_mpf_style", "akshare.stock_zh_a_hist", "talib.BBANDS", "talib.MA", "pandas.to_datetime", "mplfinance.make_marketco...
[((1916, 2009), 'mplfinance.make_marketcolors', 'mpf.make_marketcolors', ([], {'up': '"""r"""', 'down': '"""g"""', 'edge': '"""inherit"""', 'wick': '"""inherit"""', 'volume': '"""inherit"""'}), "(up='r', down='g', edge='inherit', wick='inherit',\n volume='inherit')\n", (1937, 2009), True, 'import mplfinance as mpf\n...
"""edges.py - Sobel edge filter Originally part of CellProfiler, code licensed under both GPL and BSD licenses. Website: http://www.cellprofiler.org Copyright (c) 2003-2009 Massachusetts Institute of Technology Copyright (c) 2009-2011 Broad Institute All rights reserved. Original author: <NAME> """ import numpy as np...
[ "scipy.ndimage.binary_erosion", "scipy.ndimage.generate_binary_structure", "numpy.array", "skimage.img_as_float" ]
[((450, 481), 'scipy.ndimage.generate_binary_structure', 'generate_binary_structure', (['(2)', '(2)'], {}), '(2, 2)\n', (475, 481), False, 'from scipy.ndimage import convolve, binary_erosion, generate_binary_structure\n'), ((2510, 2529), 'skimage.img_as_float', 'img_as_float', (['image'], {}), '(image)\n', (2522, 2529)...
""" test_chemistry_hydrogen.py Author: <NAME> Affiliation: University of Colorado at Boulder Created on: Mon Feb 16 12:50:43 MST 2015 Description: """ import ares import numpy as np import matplotlib.pyplot as pl def test(): pf = \ { 'grid_cells': 64, 'include_He': True, 'isothermal': True...
[ "ares.simulations.GasParcel", "matplotlib.pyplot.loglog", "matplotlib.pyplot.close", "matplotlib.pyplot.ylim", "numpy.logspace" ]
[((606, 638), 'ares.simulations.GasParcel', 'ares.simulations.GasParcel', ([], {}), '(**pf)\n', (632, 638), False, 'import ares\n'), ((720, 775), 'matplotlib.pyplot.loglog', 'pl.loglog', (["data['Tk'][0]", "data['h_1'][-1, :]"], {'color': '"""k"""'}), "(data['Tk'][0], data['h_1'][-1, :], color='k')\n", (729, 775), True...
# imports shared throughout the project import sys import importlib import time import numpy as np import pandas as pd import matplotlib.pyplot as plt # CONSTANTS PJ_TO_GWH = 277.7778 # [GWh / PJ] GWH_TO_PJ = 1/PJ_TO_GWH #[PJ/GWH] # HELPER import FLUCCOplus.config as config EM_TO_EXCEL_colnames = { "pow...
[ "matplotlib.pyplot.grid", "numpy.arange", "pathlib.Path", "pandas.DataFrame", "matplotlib.pyplot.ylim", "time.time", "matplotlib.pyplot.subplots", "FLUCCOplus.config.logging.getLogger" ]
[((1010, 1048), 'FLUCCOplus.config.logging.getLogger', 'config.logging.getLogger', (['f.__module__'], {}), '(f.__module__)\n', (1034, 1048), True, 'import FLUCCOplus.config as config\n'), ((1309, 1347), 'FLUCCOplus.config.logging.getLogger', 'config.logging.getLogger', (['f.__module__'], {}), '(f.__module__)\n', (1333,...
import os import pytest import math from astropy.io import fits from astropy.table import Table import numpy as np import stwcs from stwcs import updatewcs from stsci.tools import fileutil from ci_watson.artifactory_helpers import get_bigdata_root from ci_watson.hst_helpers import raw_from_asn, ref_from_image, downl...
[ "ci_watson.artifactory_helpers._is_url", "astropy.io.fits.HDUList", "astropy.io.fits.PrimaryHDU", "astropy.io.fits.ImageHDU", "os.environ.get", "ci_watson.artifactory_helpers.get_bigdata_root", "math.sqrt", "os.getcwd", "stwcs.wcsutil.HSTWCS", "os.path.split", "numpy.zeros", "ci_watson.hst_hel...
[((592, 624), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""_jail"""'], {}), "('_jail')\n", (615, 624), False, 'import pytest\n'), ((4585, 4617), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""_jail"""'], {}), "('_jail')\n", (4608, 4617), False, 'import pytest\n'), ((947, 969), 'os.environ.ge...
# -*- coding: utf-8 -*- """baseline.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1ELj28VKxQe8E1h-VnIbU6HMb9ezVIUaB """ import numpy as np import sklearn from statistics import mean from sklearn import metrics from sklearn import ...
[ "statistics.mean", "sklearn.model_selection.train_test_split", "sklearn.metrics.roc_auc_score", "numpy.count_nonzero", "sklearn.model_selection.KFold" ]
[((1793, 1823), 'numpy.count_nonzero', 'np.count_nonzero', (['(comp == True)'], {}), '(comp == True)\n', (1809, 1823), True, 'import numpy as np\n'), ((2243, 2314), 'sklearn.model_selection.KFold', 'sklearn.model_selection.KFold', ([], {'n_splits': '(4)', 'random_state': '(1)', 'shuffle': '(True)'}), '(n_splits=4, rand...
import numpy as np np.random.seed(10) import tensorflow as tf tf.random.set_seed(10) tf.keras.backend.set_floatx('float64') import matplotlib.pyplot as plt from tensorflow.keras import Model from tensorflow.keras import optimizers, models, regularizers from tensorflow.keras import backend as K from tensorflow.keras.ca...
[ "tensorflow.keras.backend.epsilon", "tensorflow.GradientTape", "CAE_Layers.Encoder_Block", "tensorflow.keras.backend.mean", "CAE_Layers.Decoder_Block", "numpy.random.seed", "tensorflow.keras.backend.square", "tensorflow.Variable", "tensorflow.keras.backend.set_floatx", "CAE_Layers.Latent_Block", ...
[((19, 37), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (33, 37), True, 'import numpy as np\n'), ((62, 84), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(10)'], {}), '(10)\n', (80, 84), True, 'import tensorflow as tf\n'), ((85, 123), 'tensorflow.keras.backend.set_floatx', 'tf.keras.backen...
from py_wake import IEA37SimpleBastankhahGaussian from py_wake.deflection_models import JimenezWakeDeflection from py_wake.examples.data.iea37._iea37 import IEA37Site import numpy as np import matplotlib.pyplot as plt import pytest from py_wake.flow_map import XYGrid from py_wake.deflection_models.fuga_deflection impor...
[ "numpy.reshape", "numpy.arange", "py_wake.examples.data.iea37._iea37.IEA37Site", "matplotlib.pyplot.plot", "py_wake.utils.model_utils.get_models", "matplotlib.pyplot.close", "matplotlib.pyplot.figure", "py_wake.examples.data.hornsrev1.V80", "matplotlib.pyplot.title", "py_wake.deflection_models.fug...
[((1058, 1071), 'py_wake.examples.data.iea37._iea37.IEA37Site', 'IEA37Site', (['(16)'], {}), '(16)\n', (1067, 1071), False, 'from py_wake.examples.data.iea37._iea37 import IEA37Site\n'), ((1111, 1116), 'py_wake.examples.data.hornsrev1.V80', 'V80', ([], {}), '()\n', (1114, 1116), False, 'from py_wake.examples.data.horns...
## imports import os, time import numpy as np from colour import Color import matplotlib.pyplot as plt import skimage.io as io import utilities def localizationErrors( coco_analyze, imgs_info, saveDir ): loc_dir = saveDir + '/localization_errors/keypoints_breakdown' if not os.path.exists(loc_dir): os.m...
[ "matplotlib.pyplot.imshow", "os.path.exists", "matplotlib.pyplot.savefig", "matplotlib.pyplot.title", "os.makedirs", "matplotlib.pyplot.gca", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.array", "numpy.zeros", "matplotlib.pyplot.figure", "skimage.io.imread", "matplotlib.pyplot...
[((460, 471), 'time.time', 'time.time', ([], {}), '()\n', (469, 471), False, 'import os, time\n'), ((1266, 1278), 'numpy.zeros', 'np.zeros', (['(17)'], {}), '(17)\n', (1274, 1278), True, 'import numpy as np\n'), ((1300, 1312), 'numpy.zeros', 'np.zeros', (['(17)'], {}), '(17)\n', (1308, 1312), True, 'import numpy as np\...
import sys import numpy as np import datetime import helper_functions.helper_functions as hf from sklearn.multiclass import OneVsRestClassifier from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.naive_bayes...
[ "sec5b_ml_model_binaryclass_pipeline.MachineLearningNameEthnicityProjectBinaryClass", "sklearn.svm.LinearSVC", "sklearn.linear_model.LogisticRegression", "datetime.datetime.now", "sklearn.naive_bayes.BernoulliNB", "numpy.logspace", "helper_functions.helper_functions.done_alert", "sklearn.svm.SVC" ]
[((8883, 8898), 'helper_functions.helper_functions.done_alert', 'hf.done_alert', ([], {}), '()\n', (8896, 8898), True, 'import helper_functions.helper_functions as hf\n'), ((1395, 1415), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (1413, 1415), False, 'from sklearn.linear_model im...
import os, sys, logging import json import numpy as np import random from collections import defaultdict, Counter import cPickle as pickle import cProfile, pstats import threading import time import multiprocessing import math from sklearn import metrics from sklearn import svm from sklearn.naive_bayes import Gaussia...
[ "src.datasets.data_utils.tokenize_hanzi", "multiprocessing.cpu_count", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score", "numpy.array", "src.datasets.data_utils.WordVectorBuilder.filename_test", "src.datasets.data_utils.syslogger", "threading.Lock", "os.path.isdir", "src.datasets....
[((941, 968), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (966, 968), False, 'import multiprocessing\n'), ((982, 998), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (996, 998), False, 'import threading\n'), ((1025, 1055), 'src.datasets.data_utils.syslogger', 'data_utils.syslogger...
import pcl import numpy as np def run_icp(data): delta_theta_z, delta_x, delta_y, pc_in, pc_out, iter_t, iter_x, iter_y = data # if do_exhaustive_serach: transf_ini = np.eye(4) transf_ini[0, 0] = np.cos(delta_theta_z[iter_t]) transf_ini[0, 1] = -np.sin(delta_theta_z[iter_t]) transf_ini[1, 0] ...
[ "numpy.eye", "numpy.matmul", "numpy.cos", "numpy.sin", "pcl.PointCloud" ]
[((182, 191), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (188, 191), True, 'import numpy as np\n'), ((215, 244), 'numpy.cos', 'np.cos', (['delta_theta_z[iter_t]'], {}), '(delta_theta_z[iter_t])\n', (221, 244), True, 'import numpy as np\n'), ((322, 351), 'numpy.sin', 'np.sin', (['delta_theta_z[iter_t]'], {}), '(delt...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Jun 28 14:33:17 2018 @author: lzw check the box """ import cv2 import numpy as np fo = open("list.txt") lines = fo.readlines() for line in lines: line = line.split() img_path = line[0] bbox = [float(i) for i in line[1:]] boxes = np.arra...
[ "cv2.rectangle", "cv2.imshow", "numpy.array", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.imread" ]
[((371, 391), 'cv2.imread', 'cv2.imread', (['img_path'], {}), '(img_path)\n', (381, 391), False, 'import cv2\n'), ((497, 520), 'cv2.imshow', 'cv2.imshow', (['"""test"""', 'img'], {}), "('test', img)\n", (507, 520), False, 'import cv2\n'), ((422, 492), 'cv2.rectangle', 'cv2.rectangle', (['img', '(box[0], box[1])', '(box...
# © 2019 University of Illinois Board of Trustees. All rights reserved """ Prepare a VCF file from a set of features in the current directory """ import glob import pickle from vcfFromContigs import createVcfRecord from PySamFastaWrapper import PySamFastaWrapper as ReferenceCache from multiprocessing import Pool impor...
[ "os.path.exists", "sys.exit", "os.makedirs", "argparse.ArgumentParser", "os.path.join", "numpy.argmax", "os.path.split", "PySamFastaWrapper.PySamFastaWrapper", "multiprocessing.Pool", "subprocess.call", "shutil.rmtree", "math.log10", "vcfFromContigs.createVcfRecord", "glob.glob", "os.rem...
[((455, 493), 'glob.glob', 'glob.glob', (["('%s/shard[0-9]*.txt' % path)"], {}), "('%s/shard[0-9]*.txt' % path)\n", (464, 493), False, 'import glob\n'), ((3458, 3486), 'PySamFastaWrapper.PySamFastaWrapper', 'ReferenceCache', ([], {'database': 'ref'}), '(database=ref)\n', (3472, 3486), True, 'from PySamFastaWrapper impo...
# Copyright 2020 MONAI Consortium # 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, s...
[ "monai.handlers.ROCAUC", "torch.distributed.destroy_process_group", "numpy.testing.assert_allclose", "torch.distributed.get_rank", "torch.distributed.init_process_group", "torch.device" ]
[((694, 755), 'torch.distributed.init_process_group', 'dist.init_process_group', ([], {'backend': '"""nccl"""', 'init_method': '"""env://"""'}), "(backend='nccl', init_method='env://')\n", (717, 755), True, 'import torch.distributed as dist\n'), ((817, 855), 'monai.handlers.ROCAUC', 'ROCAUC', ([], {'to_onehot_y': '(Tru...
import hashlib import logging from pathlib import Path from urllib import request import numpy as np import pytest from jfibsem_dat.read import HEADER_LENGTH, parse_metadata logger = logging.getLogger(__name__) TEST_DIR = Path(__file__).resolve().parent FIXTURE_DIR = TEST_DIR / "fixtures" BLOCKSIZE = 2**20 EXAMPLE...
[ "logging.getLogger", "numpy.product", "pytest.skip", "hashlib.md5", "numpy.random.default_rng", "pathlib.Path", "jfibsem_dat.read.parse_metadata", "numpy.iinfo", "pytest.fixture", "numpy.dtype", "urllib.request.urlopen", "numpy.random.RandomState" ]
[((186, 213), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (203, 213), False, 'import logging\n'), ((2562, 2593), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (2576, 2593), False, 'import pytest\n'), ((2711, 2742), 'pytest.fixture', 'pytes...
import os import numpy as np from zero2ml.utils.data_transformations import train_test_split from zero2ml.supervised_learning.knn import KNNClassifier def main(): # Construct path to dataset root_directory_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) data_path = os.path.join(root_d...
[ "zero2ml.utils.data_transformations.train_test_split", "os.path.join", "zero2ml.supervised_learning.knn.KNNClassifier", "os.path.dirname", "numpy.genfromtxt" ]
[((301, 377), 'os.path.join', 'os.path.join', (['root_directory_path', '"""tests"""', '"""test_data"""', '"""breast_cancer.csv"""'], {}), "(root_directory_path, 'tests', 'test_data', 'breast_cancer.csv')\n", (313, 377), False, 'import os\n'), ((409, 463), 'numpy.genfromtxt', 'np.genfromtxt', (['data_path'], {'delimiter...
""" Sunrise and Sunset Estimation Module This module contains functions for estimating sunrise and sunset times from an unlabel PV power dataset. """ import numpy as np from solardatatools.signal_decompositions import tl1_l2d2p365 def rise_set_rough(bool_msk): nvals = bool_msk.shape[0] num_meas_per_hour = n...
[ "numpy.ones_like", "numpy.flip", "numpy.argmax", "numpy.isnan", "numpy.arange" ]
[((348, 389), 'numpy.arange', 'np.arange', (['(0)', '(24)', '(1.0 / num_meas_per_hour)'], {}), '(0, 24, 1.0 / num_meas_per_hour)\n', (357, 389), True, 'import numpy as np\n'), ((409, 436), 'numpy.argmax', 'np.argmax', (['bool_msk'], {'axis': '(0)'}), '(bool_msk, axis=0)\n', (418, 436), True, 'import numpy as np\n'), ((...
import numpy as np def most_common(lst): return max(set(lst), key=lst.count) def get_preds(y_pred): y_pred = np.array(y_pred).T.tolist() y_pred = [most_common(y) for y in y_pred] return y_pred def get_score(score, thr, pred): if pred == 0: return 1-score/thr return (score-thr)/(1-thr) def get_...
[ "numpy.mean", "numpy.array" ]
[((696, 706), 'numpy.mean', 'np.mean', (['y'], {}), '(y)\n', (703, 706), True, 'import numpy as np\n'), ((120, 136), 'numpy.array', 'np.array', (['y_pred'], {}), '(y_pred)\n', (128, 136), True, 'import numpy as np\n'), ((653, 671), 'numpy.array', 'np.array', (['y_scores'], {}), '(y_scores)\n', (661, 671), True, 'import...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import os from collections import OrderedDict from torch.autograd import Variable from options.test_options import TestOptions from models.models import create_model from models.mapping_model import Pix2PixHDModel_Mapping import util.util as util...
[ "torchvision.transforms.CenterCrop", "os.path.exists", "os.listdir", "os.makedirs", "torchvision.transforms.Scale", "os.path.join", "torch.zeros_like", "numpy.array", "options.test_options.TestOptions", "torchvision.transforms.Normalize", "torchvision.transforms.ToTensor", "torchvision.utils.s...
[((2567, 2591), 'models.mapping_model.Pix2PixHDModel_Mapping', 'Pix2PixHDModel_Mapping', ([], {}), '()\n', (2589, 2591), False, 'from models.mapping_model import Pix2PixHDModel_Mapping\n'), ((3050, 3076), 'os.listdir', 'os.listdir', (['opt.test_input'], {}), '(opt.test_input)\n', (3060, 3076), False, 'import os\n'), ((...
# Copyright 2019 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...
[ "keras.losses.binary_crossentropy", "keras.testing_infra.test_utils.should_run_eagerly", "keras.testing_infra.test_utils.get_model_from_layers", "numpy.array", "keras.layers.Dense", "keras.Sequential", "tensorflow.compat.v2.executing_eagerly", "keras.Model", "keras.testing_infra.test_combinations.ru...
[((1281, 1320), 'keras.optimizers.optimizer_v2.gradient_descent.SGD', 'optimizer_v2.gradient_descent.SGD', (['(0.05)'], {}), '(0.05)\n', (1314, 1320), False, 'from keras.optimizers import optimizer_v2\n'), ((2708, 2781), 'keras.testing_infra.test_combinations.run_with_all_model_types', 'test_combinations.run_with_all_m...
#!/usr/bin/env python3 import matplotlib import matplotlib.pyplot as plt from collections import defaultdict import numpy as np lengths = defaultdict(list) lib_count = defaultdict(int) lib="good" lengths[lib].append(20) lengths[lib].append(30) lengths[lib].append(100) lengths[lib].append(330) lengths[lib].append(10...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.close", "numpy.array", "collections.defaultdict", "matplotlib.pyplot.title", "matplotlib.pyplot.xscale", "matplotlib.pyplot.show" ]
[((141, 158), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (152, 158), False, 'from collections import defaultdict\n'), ((171, 187), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (182, 187), False, 'from collections import defaultdict\n'), ((1254, 1271), 'matplotlib.pyplot...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from covsirphy.ode.mbase import ModelBase class SIRF(ModelBase): """ SIR-F model. Args: population (int): total population theta (float) kappa (float) rho (float) sigma (float) """ # Model na...
[ "numpy.array", "covsirphy.ode.mbase.ModelBase.N.lower" ]
[((820, 842), 'numpy.array', 'np.array', (['[0, 1, 1, 1]'], {}), '([0, 1, 1, 1])\n', (828, 842), True, 'import numpy as np\n'), ((1041, 1060), 'covsirphy.ode.mbase.ModelBase.N.lower', 'ModelBase.N.lower', ([], {}), '()\n', (1058, 1060), False, 'from covsirphy.ode.mbase import ModelBase\n'), ((2229, 2263), 'numpy.array'...
import numpy as np import sys import logging import pickle import matplotlib.pyplot as plt from pathlib import Path from scipy.optimize import minimize_scalar from itertools import product import ray import pandas as pd import click from neslab.find import distributions as dists from neslab.find import Model logger ...
[ "logging.getLogger", "neslab.find.Model", "logging.StreamHandler", "ray.init", "ray.get", "click.option", "neslab.find.distributions.Geometric.get_scale_range", "click.Path", "scipy.optimize.minimize_scalar", "pandas.DataFrame", "click.command", "numpy.arange" ]
[((322, 348), 'logging.getLogger', 'logging.getLogger', (['"""model"""'], {}), "('model')\n", (339, 348), False, 'import logging\n'), ((861, 876), 'click.command', 'click.command', ([], {}), '()\n', (874, 876), False, 'import click\n'), ((878, 948), 'click.option', 'click.option', (['"""--redis-password"""', '"""-p"""'...
from IMLearn.utils import split_train_test from IMLearn.learners.regressors import LinearRegression from typing import NoReturn import numpy as np import pandas as pd import plotly.graph_objects as go import plotly.express as px import plotly.io as pio pio.templates.default = "simple_white" def load_data(filename: ...
[ "pandas.read_csv", "IMLearn.learners.regressors.LinearRegression", "numpy.array", "IMLearn.utils.split_train_test", "plotly.graph_objects.Scatter", "plotly.graph_objects.Figure", "numpy.random.seed", "numpy.std", "numpy.cov" ]
[((3265, 3282), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (3279, 3282), True, 'import numpy as np\n'), ((3573, 3591), 'IMLearn.learners.regressors.LinearRegression', 'LinearRegression', ([], {}), '()\n', (3589, 3591), False, 'from IMLearn.learners.regressors import LinearRegression\n'), ((3747, 379...
import matplotlib.pyplot as plt import numpy as np y = np.array([3, 22, 50, 351, 159,40 ]) sports = ['Biathlon', 'Bobsleigh', 'Curling','Ice hockey','Skating','Skiing'] plt.pie(y, labels = sports) plt.xlabel("Canada") plt.title("Which Sport had Most Medal", pad="20") plt.show()
[ "matplotlib.pyplot.xlabel", "matplotlib.pyplot.pie", "numpy.array", "matplotlib.pyplot.title", "matplotlib.pyplot.show" ]
[((56, 91), 'numpy.array', 'np.array', (['[3, 22, 50, 351, 159, 40]'], {}), '([3, 22, 50, 351, 159, 40])\n', (64, 91), True, 'import numpy as np\n'), ((171, 196), 'matplotlib.pyplot.pie', 'plt.pie', (['y'], {'labels': 'sports'}), '(y, labels=sports)\n', (178, 196), True, 'import matplotlib.pyplot as plt\n'), ((199, 219...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import io import logging import contextlib import os import datetime import json import numpy as np import cv2 import math import torch from PIL import Image from fvcore.common.timer import Timer from detectron2.structures import BoxMode, Polygon...
[ "numpy.reshape", "numpy.asarray", "os.path.join", "fvcore.common.file_io.PathManager.get_local_path", "torch.sin", "os.path.split", "torch.tensor", "torch.cos", "json.load", "io.StringIO", "json.dump" ]
[((5757, 5795), 'os.path.join', 'os.path.join', (['data_path', '"""labels.json"""'], {}), "(data_path, 'labels.json')\n", (5769, 5795), False, 'import os\n'), ((5812, 5849), 'fvcore.common.file_io.PathManager.get_local_path', 'PathManager.get_local_path', (['json_file'], {}), '(json_file)\n', (5838, 5849), False, 'from...
import os import glob import json import time import pickle import shutil import random import warnings import pandas as pd import numpy as np import matplotlib.pylab as plt from multiprocessing import Process, cpu_count, Array from omsdetector.mof import Helper from omsdetector.mof import MofStructure from omsdetecto...
[ "omsdetector.mof.Helper.get_checksum", "multiprocessing.Process", "multiprocessing.cpu_count", "time.sleep", "omsdetector.mof.Helper.copy_folder", "matplotlib.pylab.show", "sys.exit", "numpy.histogram", "matplotlib.pylab.figure", "numpy.where", "pandas.DataFrame.from_dict", "glob.glob", "oms...
[((2481, 2522), 'omsdetector.mof.Helper.make_folder', 'Helper.make_folder', (['self._analysis_folder'], {}), '(self._analysis_folder)\n', (2499, 2522), False, 'from omsdetector.mof import Helper\n'), ((2893, 2916), 'omsdetector.mof.Helper.make_folder', 'Helper.make_folder', (['orf'], {}), '(orf)\n', (2911, 2916), False...
""" Module varn calculates local densities of the 2D system and plots histogram of these local densities. Files are saved according to the active_particles.naming.varN standard. Environment modes ----------------- COMPUTE : bool Compute local densities. DEFAULT: False CHECK : bool Evaluate difference between the p...
[ "numpy.log10", "numpy.sqrt", "numpy.array", "numpy.mean", "numpy.max", "numpy.linspace", "mpl_toolkits.axes_grid1.make_axes_locatable", "numpy.abs", "matplotlib.rcParams.update", "matplotlib.use", "pickle.load", "numpy.argmax", "active_particles.init.get_env", "active_particles.maths.Histo...
[((3929, 3973), 'active_particles.init.get_env', 'get_env', (['"""SHOW"""'], {'default': '(False)', 'vartype': 'bool'}), "('SHOW', default=False, vartype=bool)\n", (3936, 3973), False, 'from active_particles.init import get_env, slurm_output\n'), ((3977, 3991), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')...
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "numpy.load", "numpy.ones", "numpy.linalg.lstsq" ]
[((703, 749), 'numpy.load', 'np.load', (['"""Data/uv-data/canonical_vertices.npy"""'], {}), "('Data/uv-data/canonical_vertices.npy')\n", (710, 749), True, 'import numpy as np\n'), ((792, 823), 'numpy.ones', 'np.ones', (['[vertices.shape[0], 1]'], {}), '([vertices.shape[0], 1])\n', (799, 823), True, 'import numpy as np\...
''' UFL_AuxFunction.py Auxiliary functions Author: <NAME> Date: 20.02.2015 Version: 1.0 ''' import numpy as np import sys def computeNumericalGradient(func, params, args=()): ''' Computes numerical gradients of a function ''' # Initialize numgrad with zeros numgrad = np.zeros(np.shape(params)); eps = ...
[ "numpy.exp", "numpy.shape", "numpy.resize", "sys.exit" ]
[((1664, 1689), 'numpy.resize', 'np.resize', (['y', 'resizearray'], {}), '(y, resizearray)\n', (1673, 1689), True, 'import numpy as np\n'), ((292, 308), 'numpy.shape', 'np.shape', (['params'], {}), '(params)\n', (300, 308), True, 'import numpy as np\n'), ((1280, 1290), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1288, 1...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import sys import numpy as np import tensorflow as tf from tensorflow.python.platform import flags import math import copy sys.path.append("../") from nmutan...
[ "os.path.exists", "numpy.random.shuffle", "tensorflow.reset_default_graph", "math.ceil", "os.makedirs", "math.floor", "tensorflow.python.platform.flags.DEFINE_string", "tensorflow.train.Saver", "os.path.join", "nmutant_model.model_operation.model_eval", "nmutant_data.data.get_data", "tensorflo...
[((285, 307), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (300, 307), False, 'import sys\n'), ((571, 595), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (593, 595), True, 'import tensorflow as tf\n'), ((635, 653), 'nmutant_data.data.get_data', 'get_data', (['d...
# -*- coding: utf-8 -*- """ Created on Fri May 1 20:05:53 2015 @author: Ziang """ import numpy as np import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn import datasets from sklearn.cross_validation import train_test_split from sklearn.decomposition import Truncated...
[ "GPSVI.core.GPClassifier.GPClassifier", "sklearn.decomposition.TruncatedSVD", "sklearn.datasets.load_digits", "matplotlib.pyplot.figure", "numpy.random.seed", "sklearn.cross_validation.train_test_split" ]
[((374, 391), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (388, 391), True, 'import numpy as np\n'), ((399, 421), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([], {}), '()\n', (419, 421), False, 'from sklearn import datasets\n'), ((443, 498), 'sklearn.cross_validation.train_test_split', '...
import logging import cmath import numpy as np LG = logging.getLogger('pyd.hp') def unit_vectors(thetamax=7.5, ngrid=32): thetamax = np.radians(thetamax) pls = np.linspace(0, 2*np.pi, ngrid) tls = np.linspace(0, thetamax, ngrid) P, T = np.meshgrid(pls, tls) # Raux = np.hypot(P, T - np.pi / 2) ...
[ "logging.getLogger", "numpy.radians", "numpy.sqrt", "numpy.linspace", "numpy.zeros", "numpy.empty", "numpy.cos", "numpy.sin", "numpy.meshgrid" ]
[((54, 81), 'logging.getLogger', 'logging.getLogger', (['"""pyd.hp"""'], {}), "('pyd.hp')\n", (71, 81), False, 'import logging\n'), ((141, 161), 'numpy.radians', 'np.radians', (['thetamax'], {}), '(thetamax)\n', (151, 161), True, 'import numpy as np\n'), ((172, 204), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.p...
# -*- coding: utf-8 -*- from __future__ import print_function import pytest import random import numpy as np import pandas as pd from pandas.compat import lrange from pandas.api.types import CategoricalDtype from pandas import (DataFrame, Series, MultiIndex, Timestamp, date_range, NaT, IntervalIn...
[ "pandas.util.testing.assert_raises_regex", "pandas.MultiIndex.from_tuples", "pandas.date_range", "numpy.arange", "pandas.util.testing.assert_frame_equal", "numpy.repeat", "pandas.Categorical", "pandas.DataFrame", "pandas.util.testing.assert_produces_warning", "pandas.compat.lrange", "numpy.rando...
[((20813, 20855), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""level"""', "['A', 0]"], {}), "('level', ['A', 0])\n", (20836, 20855), False, 'import pytest\n'), ((872, 911), 'pandas.util.testing.assert_frame_equal', 'assert_frame_equal', (['sorted_df', 'expected'], {}), '(sorted_df, expected)\n', (890, 91...
__copyright__ = "Copyright (c) Microsoft Corporation and Mila - Quebec AI Institute" __license__ = "MIT" import unittest import numpy as np from segar.factors import ( Charge, Magnetism, Mass, Floor, Heat, Friction, GaussianNoise, Label, Position, ID, ) from segar.mdps.initiali...
[ "segar.things.Entity", "segar.rules.inspect_signature", "segar.rules.IsEqual", "numpy.array", "segar.sim.Simulator", "unittest.main", "segar.rules.Prior", "segar.rules.IsOn", "segar.factors.Heat", "segar.things.Charger", "segar.things.Magnet", "segar.factors.Magnetism", "segar.factors.Gaussi...
[((706, 717), 'segar.sim.Simulator', 'Simulator', ([], {}), '()\n', (715, 717), False, 'from segar.sim import Simulator\n'), ((911, 954), 'segar.rules.TransitionFunction', 'TransitionFunction', (['_factors_and_parameters'], {}), '(_factors_and_parameters)\n', (929, 954), False, 'from segar.rules import SetFactor, IsEqu...
# Copyright 2018-2020 Xanadu Quantum Technologies Inc. # 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...
[ "pennylane.Rot", "pennylane.qnode", "pennylane.device", "pennylane.PauliZ", "pennylane.RX", "numpy.log2" ]
[((947, 990), 'pennylane.device', 'qml.device', (['"""default.qubit"""'], {'wires': 'n_qubits'}), "('default.qubit', wires=n_qubits)\n", (957, 990), True, 'import pennylane as qml\n'), ((1179, 1214), 'pennylane.qnode', 'qml.qnode', (['dev'], {'interface': 'interface'}), '(dev, interface=interface)\n', (1188, 1214), Tru...
import sys import time import numpy as np from gym.spaces.discrete import Discrete from tianshou.data import Batch from tianshou.env import DummyVectorEnv, RayVectorEnv, ShmemVectorEnv, SubprocVectorEnv if __name__ == '__main__': from env import MyTestEnv, NXEnv else: # pytest from test.base.env import MyTe...
[ "tianshou.env.ShmemVectorEnv", "numpy.allclose", "tianshou.env.DummyVectorEnv", "tianshou.data.Batch.cat", "numpy.where", "test.base.env.MyTestEnv", "tianshou.env.RayVectorEnv", "gym.spaces.discrete.Discrete", "tianshou.data.Batch", "tianshou.env.SubprocVectorEnv", "test.base.env.NXEnv", "time...
[((2060, 2071), 'time.time', 'time.time', ([], {}), '()\n', (2069, 2071), False, 'import time\n'), ((2780, 2792), 'tianshou.data.Batch.cat', 'Batch.cat', (['o'], {}), '(o)\n', (2789, 2792), False, 'from tianshou.data import Batch\n'), ((3732, 3746), 'numpy.arange', 'np.arange', (['num'], {}), '(num)\n', (3741, 3746), T...
# -*- coding: utf-8 -*- import sys sys.path.insert(0,"../../src") sys.path.insert(0,"../credibleinterval") import math import functools import time import torch import numpy as np from scipy.special import gamma import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import pandas as pd import seaborn ...
[ "torch.manual_seed", "sys.path.insert", "torch.load", "numpy.exp", "numpy.random.seed", "pymc3.stats.hpd", "numpy.load" ]
[((35, 66), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../src"""'], {}), "(0, '../../src')\n", (50, 66), False, 'import sys\n'), ((66, 107), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../credibleinterval"""'], {}), "(0, '../credibleinterval')\n", (81, 107), False, 'import sys\n'), ((611, 630), 'numpy...
import pytest import numpy as np from sklearn.datasets import load_iris, load_boston from sklearn.linear_model import LogisticRegression, LinearRegression from sklearn.svm import SVR from alibi.confidence.model_linearity import linearity_measure, LinearityMeasure from alibi.confidence.model_linearity import _linear_sup...
[ "sklearn.datasets.load_iris", "alibi.confidence.model_linearity.LinearityMeasure", "numpy.ones", "sklearn.datasets.load_boston", "alibi.confidence.model_linearity._linear_superposition", "alibi.confidence.model_linearity._sample_knn", "sklearn.linear_model.LogisticRegression", "pytest.mark.parametrize...
[((390, 447), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_shape"""', '((3,), (4, 4, 1))'], {}), "('input_shape', ((3,), (4, 4, 1)))\n", (413, 447), False, 'import pytest\n'), ((449, 497), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nb_instances"""', '(1, 10)'], {}), "('nb_instances...
#copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. # #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 l...
[ "pycocotools.mask.toBbox", "pycocotools.cocoeval.COCOeval", "numpy.array", "copy.deepcopy", "paddlex.utils.logging.debug", "numpy.mean", "pycocotools.coco.COCO", "numpy.max", "math.fabs", "numpy.min", "numpy.maximum", "sys.stdout.flush", "pycocotools.mask.area", "cv2.resize", "time.time"...
[((1475, 1497), 'copy.deepcopy', 'copy.deepcopy', (['coco_gt'], {}), '(coco_gt)\n', (1488, 1497), False, 'import copy\n'), ((3464, 3482), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (3480, 3482), False, 'import sys\n'), ((4086, 4113), 'copy.deepcopy', 'copy.deepcopy', (['xywh_results'], {}), '(xywh_result...
import numpy as np class HMC(): def __init__(self, log_prob, grad_log_prob, invmetric_diag=None): self.log_prob, self.grad_log_prob = log_prob, grad_log_prob self.V = lambda x : self.log_prob(x)*-1. #self.V_g = lambda x : self.grad_log_prob(x)*-1. self.leapcount, self.Vgcoun...
[ "numpy.random.normal", "numpy.prod", "numpy.log10", "sys.exit", "numpy.sqrt", "numpy.ones", "numpy.allclose", "numpy.random.choice", "numpy.where", "numpy.log", "numpy.exp", "numpy.stack", "numpy.zeros", "numpy.linspace", "numpy.isnan", "numpy.random.uniform", "numpy.cumsum", "nump...
[((2043, 2058), 'numpy.exp', 'np.exp', (['(H0 - H1)'], {}), '(H0 - H1)\n', (2049, 2058), True, 'import numpy as np\n'), ((3450, 3464), 'numpy.zeros', 'np.zeros', (['ntry'], {}), '(ntry)\n', (3458, 3464), True, 'import numpy as np\n'), ((3975, 3988), 'numpy.cumsum', 'np.cumsum', (['pp'], {}), '(pp)\n', (3984, 3988), Tru...
import logging import multiprocessing import os import sys import time import cv2 import h5py import numpy as np import caiman from caiman.motion_correction import high_pass_filter_space, motion_correct_iteration_fast, sliding_window, tile_and_correct from caiman.source_extraction.cnmf import online_cnmf, pre_processi...
[ "modules.laser_handler.LaserHandler", "numpy.hstack", "multiprocessing.Process", "modules.video_handler.CV2VideoHandler", "time.sleep", "cv2.imshow", "cv2.destroyAllWindows", "logging.info", "os.path.exists", "caiman.source_extraction.cnmf.initialization.downscale", "numpy.repeat", "modules.fp...
[((2647, 2675), 'modules.fp_detector.model.FpDetector', 'FpDetector', (['fp_detect_method'], {}), '(fp_detect_method)\n', (2657, 2675), False, 'from modules.fp_detector.model import FpDetector\n'), ((3669, 3685), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (3679, 3685), False, 'import time\n'), ((3832, 38...
import numpy as np import cv2 from shapely.geometry import Polygon import pyclipper class MakeShrinkMap(): r''' Making binary mask from detection data with ICDAR format. Typically following the process of class `MakeICDARData`. ''' def __init__(self, min_text_size=8, shrink_ratio=0.4): se...
[ "numpy.clip", "numpy.ones", "numpy.power", "numpy.array", "numpy.zeros", "shapely.geometry.Polygon", "pyclipper.PyclipperOffset" ]
[((828, 862), 'numpy.zeros', 'np.zeros', (['(h, w)'], {'dtype': 'np.float32'}), '((h, w), dtype=np.float32)\n', (836, 862), True, 'import numpy as np\n'), ((878, 911), 'numpy.ones', 'np.ones', (['(h, w)'], {'dtype': 'np.float32'}), '((h, w), dtype=np.float32)\n', (885, 911), True, 'import numpy as np\n'), ((2528, 2560)...
# imports from __future__ import print_function from IPython.display import display, Image from six.moves import cPickle as pickle from six.moves.urllib.request import urlretrieve from sklearn.linear_model import LogisticRegression import imageio import matplotlib.pyplot as plt import numpy as np import os import sys i...
[ "tarfile.open", "file_helper.join_paths", "sys.stdout.write", "file_helper.get_file_name", "numpy.mean", "os.path.exists", "os.listdir", "six.moves.cPickle.load", "six.moves.cPickle.dump", "os.path.isdir", "numpy.random.seed", "sys.stdout.flush", "numpy.random.permutation", "numpy.std", ...
[((502, 528), 'numpy.random.seed', 'np.random.seed', (['NUMPY_SEED'], {}), '(NUMPY_SEED)\n', (516, 528), True, 'import numpy as np\n'), ((1229, 1271), 'os.path.join', 'os.path.join', (['NOT_MNIST_ZIPS_DIR', 'filename'], {}), '(NOT_MNIST_ZIPS_DIR, filename)\n', (1241, 1271), False, 'import os\n'), ((1557, 1579), 'os.sta...