code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
In this file we run ours models one by one
"""
# Imports
import random
from random import shuffle
import numpy as np
import os
import scipy.sparse as sp
import torch
from tqdm import tqdm
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data im... | [
"logging.getLogger",
"numpy.uint8",
"torch.max",
"torch.nn.functional.sigmoid",
"numpy.array",
"torch.cuda.is_available",
"os.path.exists",
"numpy.mean",
"models.PretrainedDensenetRELU",
"torch.mean",
"numpy.random.seed",
"dataloader.get_study_level_data",
"torch.save",
"torch.nn.functiona... | [((1081, 1098), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1092, 1098), False, 'import random\n'), ((1100, 1120), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1114, 1120), True, 'import numpy as np\n'), ((1122, 1145), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see... |
'''
Authors: <NAME>
Contact: <EMAIL>
'''
import logging, time
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from py4j.java_gateway import (JavaGateway, GatewayParameters)
from subprocess import call, Popen, PIPE
import random
from py4j.tests.java_gateway_test import ... | [
"logging.getLogger",
"numpy.ones_like",
"py4j.tests.java_gateway_test.gateway.new_array",
"py4j.java_gateway.GatewayParameters",
"numpy.abs",
"numpy.ones",
"numpy.asarray",
"gym.spaces.Discrete",
"time.sleep",
"gym.spaces.Box",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"numpy.f... | [((367, 394), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (384, 394), False, 'import logging, time\n'), ((1818, 1870), 'numpy.frombuffer', 'np.frombuffer', (['javaByte1DAry'], {'dtype': 'np.intc', 'count': '(2)'}), '(javaByte1DAry, dtype=np.intc, count=2)\n', (1831, 1870), True, 'impor... |
import sys
sys.path.append('./util')
sys.path.append('./model')
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.nn.functional as F
from torchvision import transforms
import numpy as np
import argparse
import os
import time
import gc
import tensorflow as t... | [
"tensorflow.Summary.Value",
"loss.NSS",
"sys.path.append",
"numpy.mean",
"evaluation.cal_auc_score",
"argparse.ArgumentParser",
"loss.KLD",
"sam.SAM",
"numpy.random.seed",
"evaluation.add_center_bias",
"evaluation.cal_cc_score",
"torchvision.transforms.ToTensor",
"numpy.maximum",
"evaluati... | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""./util"""'], {}), "('./util')\n", (26, 36), False, 'import sys\n'), ((37, 63), 'sys.path.append', 'sys.path.append', (['"""./model"""'], {}), "('./model')\n", (52, 63), False, 'import sys\n'), ((573, 642), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([],... |
import pickle
import pytest
import numpy as np
import scipy.sparse as sp
import joblib
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import assert_array_almost_equal
from sklearn.utils._testing import assert_raises_regexp
from ... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"sklearn.preprocessing.LabelEncoder",
"sklearn.linear_model._sgd_fast.Huber",
"sklearn.linear_model.SGDRegressor",
"pickle.dumps",
"sklearn.utils.fixes.parse_version",
"sklearn.utils._testing.assert_array_equal",
"numpy.log",
"numpy.argsort",
"nump... | [((2703, 2767), 'numpy.array', 'np.array', (['[[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]]'], {}), '([[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]])\n', (2711, 2767), True, 'import numpy as np\n'), ((2795, 2831), 'numpy.array', 'np.array', (['[[-1, -1], [2, 2], [3, 2]]'], {}), '([[-1, -1], [2, 2], [3,... |
import inspect
import os
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
from Config import Config
from NIM import benchmarks
from PIL import Image
classes = inspect.getmembers(benchmarks, inspect.isclass)
step = 0
ignore_benchmarks_name = ["Benchmark", "Eggholder", "Griewank", "Schwefel"]
u... | [
"numpy.dstack",
"PIL.Image.open",
"inspect.getmembers",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gca",
"tqdm.tqdm",
"matplotlib.pyplot.clf",
"numpy.log",
"os.path.join",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.apply_along_axis",
"numpy.meshgrid",
"numpy.arange",... | [((186, 233), 'inspect.getmembers', 'inspect.getmembers', (['benchmarks', 'inspect.isclass'], {}), '(benchmarks, inspect.isclass)\n', (204, 233), False, 'import inspect\n'), ((491, 504), 'tqdm.tqdm', 'tqdm', (['classes'], {}), '(classes)\n', (495, 504), False, 'from tqdm import tqdm\n'), ((928, 969), 'numpy.arange', 'n... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 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 modifications or derivative wo... | [
"qiskit.pulse.GaussianSquare",
"numpy.isclose",
"numpy.sqrt",
"numpy.floor",
"qiskit.exceptions.QiskitError",
"qiskit_experiments.library.characterization.analysis.CrossResonanceHamiltonianAnalysis",
"qiskit.pulse.ControlChannel",
"qiskit.pulse.build",
"qiskit.pulse.DriveChannel",
"qiskit.QuantumC... | [((10037, 10054), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(2)'], {}), '(2)\n', (10051, 10054), False, 'from qiskit import pulse, circuit, QuantumCircuit\n'), ((16319, 16336), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(2)'], {}), '(2)\n', (16333, 16336), False, 'from qiskit import pulse, circuit, QuantumCircui... |
#
# Copyright (c) 2018 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... | [
"logging.getLogger",
"distiller.group_threshold_mask",
"torch.topk",
"distiller.volume",
"distiller.sparsity",
"distiller.find_module_by_fq_name",
"distiller.sparsity_3D",
"numpy.argsort",
"distiller.sparsity_ch",
"functools.partial",
"distiller.sparsity_blocks",
"torch.zeros",
"numpy.random... | [((734, 753), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (751, 753), False, 'import logging\n'), ((3289, 3313), 'functools.partial', 'partial', (['torch.norm'], {'p': '(1)'}), '(torch.norm, p=1)\n', (3296, 3313), False, 'from functools import partial\n'), ((3329, 3353), 'functools.partial', 'partial', ... |
import torch
import numpy as np
from typing import Union, Optional
from ..base import Flow
from .ic_helper import (
dist_deriv,
angle_deriv,
torsion_deriv,
det3x3,
init_xyz2ics,
init_ics2xyz,
ic2xyz_deriv,
)
from .pca import WhitenFlow
__all__ = [
"RelativeInternalCoordinateTransforma... | [
"numpy.union1d",
"numpy.sort",
"numpy.log",
"torch.stack",
"numpy.isin",
"numpy.any",
"numpy.argsort",
"numpy.sum",
"numpy.array",
"numpy.concatenate",
"torch.empty",
"torch.cat"
] | [((1966, 1980), 'numpy.sort', 'np.sort', (['fixed'], {}), '(fixed)\n', (1973, 1980), True, 'import numpy as np\n'), ((3117, 3138), 'numpy.concatenate', 'np.concatenate', (['atoms'], {}), '(atoms)\n', (3131, 3138), True, 'import numpy as np\n'), ((3156, 3178), 'numpy.argsort', 'np.argsort', (['index2atom'], {}), '(index... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
from fairseq.data import data_utils
from . import BaseWrapperDataset
class TruncateDataset(BaseWrapperDataset... | [
"fairseq.data.data_utils.numpy_seed",
"numpy.minimum",
"numpy.random.randint"
] | [((907, 961), 'numpy.minimum', 'np.minimum', (['self.dataset.sizes', 'self.truncation_length'], {}), '(self.dataset.sizes, self.truncation_length)\n', (917, 961), True, 'import numpy as np\n'), ((1486, 1537), 'fairseq.data.data_utils.numpy_seed', 'data_utils.numpy_seed', (['self.seed', 'self.epoch', 'index'], {}), '(se... |
# coding=utf-8
# Copyright 2019 The Mesh TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"mesh_tensorflow.experimental.unet.PostProcessor",
"numpy.prod",
"mesh_tensorflow.anonymize",
"mesh_tensorflow.utils.outside_all_rewrites",
"mesh_tensorflow.experimental.unet.get_input_mtf_shapes",
"mesh_tensorflow.Mesh",
"tensorflow.compat.v1.train.Scaffold.default_local_init_op",
"numpy.array",
"t... | [((1462, 1518), 'tensorflow.python.platform.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""use_tpu"""', '(True)', '"""Use TPU or GPU."""'], {}), "('use_tpu', True, 'Use TPU or GPU.')\n", (1482, 1518), False, 'from tensorflow.python.platform import flags\n'), ((1519, 1568), 'tensorflow.python.platform.flags.DEFINE... |
import tensorflow as tf
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
import math
import numpy as np
class DataGenerator:
def __init__(self, config, features, labels):
self.config = config
self.features_train, self.features_test, self.labels_tr... | [
"sklearn.model_selection.train_test_split",
"numpy.array",
"sklearn.preprocessing.MinMaxScaler"
] | [((344, 431), 'sklearn.model_selection.train_test_split', 'train_test_split', (['features', 'labels'], {'test_size': 'self.config.test_size', 'shuffle': '(False)'}), '(features, labels, test_size=self.config.test_size, shuffle\n =False)\n', (360, 431), False, 'from sklearn.model_selection import train_test_split\n')... |
import numpy as np
from src.maths import rotationMatrix
R = rotationMatrix(0, 0, 0)
R1 = rotationMatrix(0, 0, np.pi / 2)
R2 = rotationMatrix(0, 0, np.pi)
R3 = rotationMatrix(0, 0, 3 * np.pi / 2)
R4 = rotationMatrix(0, 0, 2 * np.pi)
R5 = rotationMatrix(0, np.pi / 2, 0)
R6 = rotationMatrix(0, np.pi, 0)
R7 = rotationM... | [
"src.maths.rotationMatrix",
"numpy.eye",
"numpy.abs",
"numpy.linalg.det",
"numpy.array",
"numpy.linalg.inv"
] | [((62, 85), 'src.maths.rotationMatrix', 'rotationMatrix', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (76, 85), False, 'from src.maths import rotationMatrix\n'), ((92, 123), 'src.maths.rotationMatrix', 'rotationMatrix', (['(0)', '(0)', '(np.pi / 2)'], {}), '(0, 0, np.pi / 2)\n', (106, 123), False, 'from src.maths impor... |
#################################################################################
#Script to calculate an input percentile for precipitation totals as a function of
#space, smooth window-to-window variability in percentile threshold via Fourier
#harmonics, and saves the result in netCDF4 format. Loads .npy files saved ... | [
"numpy.nanpercentile",
"numpy.array",
"numpy.sin",
"datetime.datetime.today",
"numpy.nanmin",
"datetime.timedelta",
"numpy.arange",
"datetime.datetime",
"numpy.mean",
"argparse.ArgumentParser",
"numpy.where",
"netCDF4.Dataset",
"numpy.diff",
"numpy.nanmax",
"netCDF4.date2num",
"numpy.i... | [((8394, 8419), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (8417, 8419), False, 'import argparse\n'), ((8801, 8845), 'datetime.datetime', 'datetime.datetime', ([], {'month': '(1)', 'day': '(1)', 'year': '(1915)'}), '(month=1, day=1, year=1915)\n', (8818, 8845), False, 'import datetime\n'), ... |
import sys
import os
import yaml
import argparse
import numpy as np
import pandas as pd
import csv
import random
import stat
import glob
import subprocess
from statistics import mean
from pprint import pprint, pformat
import geopandas
from shapely.geometry import Point
from math import sin, cos, atan2, sqrt, pi
from ... | [
"pandas.read_csv",
"numpy.hstack",
"math.sqrt",
"numpy.column_stack",
"math.cos",
"numpy.array",
"sys.exit",
"pymoo.factory.get_crossover",
"pymoo.factory.get_reference_directions",
"datetime.timedelta",
"os.path.exists",
"qcg.pilotjob.api.manager.LocalManager",
"argparse.ArgumentParser",
... | [((866, 891), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (881, 891), False, 'import os\n'), ((22500, 22516), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (22514, 22516), False, 'import time\n'), ((22584, 22609), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 20:10:00 2020
@author: thorius
"""
import os
import sys
from queue import Queue
import numpy as np
import logging
import pyaudio
import time
from tflite_runtime.interpreter import Interpreter
import collections
from scipy import signal
class S... | [
"logging.getLogger",
"tflite_runtime.interpreter.Interpreter",
"os.path.join",
"numpy.argmax",
"logging.info",
"time.sleep",
"numpy.append",
"numpy.array",
"numpy.zeros",
"scipy.signal.resample",
"collections.Counter",
"numpy.expand_dims",
"numpy.frombuffer",
"queue.Queue",
"pyaudio.PyAu... | [((739, 758), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (756, 758), False, 'import logging\n'), ((1966, 1973), 'queue.Queue', 'Queue', ([], {}), '()\n', (1971, 1973), False, 'from queue import Queue\n'), ((2056, 2098), 'numpy.zeros', 'np.zeros', (['self.feed_samples'], {'dtype': '"""int16"""'}), "(sel... |
import cv2
import numpy as np
from numpy.linalg import norm
import sys
import os
import json
SZ = 20 #训练图片长宽
MAX_WIDTH = 1000 #原始图片最大宽度
Min_Area = 2000 #车牌区域允许最大面积
PROVINCE_START = 1000
#读取图片文件
def imreadex(filename):
return cv2.imdecode(np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_COLOR)
def point_l... | [
"numpy.fromfile",
"numpy.sqrt",
"numpy.hstack",
"numpy.int32",
"numpy.array",
"numpy.linalg.norm",
"os.walk",
"os.path.exists",
"numpy.mean",
"cv2.threshold",
"cv2.contourArea",
"cv2.minAreaRect",
"cv2.addWeighted",
"numpy.min",
"cv2.warpAffine",
"numpy.ones",
"cv2.boxPoints",
"cv2... | [((1113, 1129), 'cv2.moments', 'cv2.moments', (['img'], {}), '(img)\n', (1124, 1129), False, 'import cv2\n'), ((1210, 1262), 'numpy.float32', 'np.float32', (['[[1, skew, -0.5 * SZ * skew], [0, 1, 0]]'], {}), '([[1, skew, -0.5 * SZ * skew], [0, 1, 0]])\n', (1220, 1262), True, 'import numpy as np\n'), ((1266, 1345), 'cv2... |
# -*- coding: utf-8 -*-
"""
Tests of the neo.core.irregularlysampledsignal.IrregularySampledSignal class
"""
import unittest
import os
import pickle
import warnings
from copy import deepcopy
import numpy as np
import quantities as pq
from numpy.testing import assert_array_equal
from neo.core.dataobject import Array... | [
"neo.test.tools.assert_same_array_annotations",
"neo.test.tools.assert_neo_object_is_compliant",
"neo.core.irregularlysampledsignal.IrregularlySampledSignal",
"neo.test.tools.assert_same_sub_schema",
"numpy.array",
"copy.deepcopy",
"unittest.main",
"numpy.arange",
"os.remove",
"neo.test.generate_d... | [((43190, 43243), 'unittest.skipUnless', 'unittest.skipUnless', (['HAVE_IPYTHON', '"""requires IPython"""'], {}), "(HAVE_IPYTHON, 'requires IPython')\n", (43209, 43243), False, 'import unittest\n'), ((47527, 47542), 'unittest.main', 'unittest.main', ([], {}), '()\n', (47540, 47542), False, 'import unittest\n'), ((1129,... |
# Copyright 2019 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 agre... | [
"strawberryfields.Program",
"numpy.allclose",
"strawberryfields.ops.MeasureFock",
"strawberryfields.ops.GraphEmbed",
"strawberryfields.ops.LossChannel",
"numpy.random.seed",
"strawberryfields.ops.MeasureThreshold",
"strawberryfields.LocalEngine"
] | [((5616, 5633), 'strawberryfields.Program', 'sf.Program', (['nodes'], {}), '(nodes)\n', (5626, 5633), True, 'import strawberryfields as sf\n'), ((5644, 5678), 'strawberryfields.LocalEngine', 'sf.LocalEngine', ([], {'backend': '"""gaussian"""'}), "(backend='gaussian')\n", (5658, 5678), True, 'import strawberryfields as ... |
from __future__ import division
import json
import tempfile
import unittest
import tttrlib
import numpy as np
print("Test: ", __file__)
settings = json.load(open(file="./test/settings.json"))
test_files = settings["test_files"]
class Tests(unittest.TestCase):
@unittest.expectedFailure
def test_reading(sel... | [
"tttrlib.TTTR",
"tempfile.mkstemp",
"numpy.allclose",
"tttrlib.TTTRHeader"
] | [((436, 454), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (452, 454), False, 'import tempfile\n'), ((964, 995), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'suffix': '""".spc"""'}), "(suffix='.spc')\n", (980, 995), False, 'import tempfile\n'), ((1060, 1093), 'tttrlib.TTTR', 'tttrlib.TTTR', (['filename',... |
#!/usr/bin/python
"""
vehicleDetection.py: version 0.1.0
History:
2017/01/29: coding style phase1:
reformat to python-guide.org code style
http://docs.python-guide.org/en/latest/writing/style/
which uses PEP 8 as a base: http://pep8.org/.
2017/01/23: Initial version converted to a class
"""
import matplot... | [
"os.path.exists",
"numpy.histogram",
"numpy.copy",
"matplotlib.pyplot.savefig",
"cv2.resize",
"os.makedirs",
"sklearn.externals.joblib.load",
"matplotlib.pyplot.Subplot",
"numpy.concatenate",
"cv2.cvtColor",
"p5lib.roadGrid.RoadGrid",
"skimage.feature.hog",
"time.gmtime",
"numpy.poly1d",
... | [((2488, 2544), 'numpy.histogram', 'np.histogram', (['img[:, :, 0]'], {'bins': 'nbins', 'range': 'bins_range'}), '(img[:, :, 0], bins=nbins, range=bins_range)\n', (2500, 2544), True, 'import numpy as np\n'), ((2582, 2638), 'numpy.histogram', 'np.histogram', (['img[:, :, 1]'], {'bins': 'nbins', 'range': 'bins_range'}), ... |
import sys
import copy
import numpy as np
from pyrigidbody3d import geometry
from pyrigidbody3d import rigidbody
from pyrigidbody3d import world
# real-time updates are a bit choppy
import meshcat
import meshcat.geometry as g
import meshcat.transformations as tf
import math
import time
import numpy as np
SIMULATI... | [
"meshcat.geometry.MeshLambertMaterial",
"meshcat.Visualizer",
"pyrigidbody3d.geometry.Sphere",
"meshcat.animation.Animation",
"meshcat.geometry.Sphere",
"numpy.array",
"meshcat.transformations.rotation_matrix",
"meshcat.geometry.MeshPhongMaterial",
"pyrigidbody3d.geometry.Plane",
"pyrigidbody3d.wo... | [((404, 438), 'pyrigidbody3d.world.World', 'world.World', (['NUM_SOLVER_ITERATIONS'], {}), '(NUM_SOLVER_ITERATIONS)\n', (415, 438), False, 'from pyrigidbody3d import world\n'), ((463, 490), 'numpy.array', 'np.array', (['[0.0, -2.0, -9.8]'], {}), '([0.0, -2.0, -9.8])\n', (471, 490), True, 'import numpy as np\n'), ((549,... |
# Copyright 2017 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... | [
"numpy.isscalar",
"numpy.logical_and",
"numpy.size",
"numpy.logical_not",
"numpy.max",
"numpy.array",
"numpy.zeros",
"tensorboard.utils.command_parser._parse_slices",
"tensorboard.build_with_tf.use_tf",
"numpy.isnan",
"binascii.b2a_qp",
"numpy.min",
"tensorboard.util.encode_png",
"numpy.ex... | [((943, 965), 'tensorboard.build_with_tf.use_tf', 'build_with_tf.use_tf', ([], {}), '()\n', (963, 965), False, 'from tensorboard import build_with_tf, util\n'), ((1713, 1744), 'tensorboard.utils.command_parser._parse_slices', 'command_parser._parse_slices', (['s'], {}), '(s)\n', (1741, 1744), False, 'from tensorboard.u... |
"""Sarsa"""
import numpy as np
from RL_brain import SarsaLambda
from environment import TestEnv
np.set_printoptions(precision=2, suppress=True)
env = TestEnv(10)
print("Observation_space{}\nAction_space{}".
format(env.observation_space, env.action_space))
RL = SarsaLambda(range(env.action_space.n), reward_deca... | [
"environment.TestEnv",
"numpy.set_printoptions"
] | [((97, 144), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)', 'suppress': '(True)'}), '(precision=2, suppress=True)\n', (116, 144), True, 'import numpy as np\n'), ((152, 163), 'environment.TestEnv', 'TestEnv', (['(10)'], {}), '(10)\n', (159, 163), False, 'from environment import TestEnv\n')] |
from sklearn.decomposition import NMF, LatentDirichletAllocation
import numpy as np
import os
def write_lines(string, saveFile):
open("%s" %saveFile, "a").write(string+"\n")
###
def save_topics(model, feature_names, saveFile, topic_nums, top_words_nums):
# saveFile= "%s/LDA_TopWords_Topic%s.txt" %(saveFileDi... | [
"os.path.exists",
"numpy.argmax",
"numpy.savetxt",
"sklearn.decomposition.LatentDirichletAllocation",
"os.remove"
] | [((1269, 1293), 'os.path.exists', 'os.path.exists', (['saveFile'], {}), '(saveFile)\n', (1283, 1293), False, 'import os\n'), ((1474, 1563), 'numpy.savetxt', 'np.savetxt', (["('%s_Topic_Words_matrix.txt' % saveFileHeader)", 'lda.components_'], {'fmt': '"""%.6f"""'}), "('%s_Topic_Words_matrix.txt' % saveFileHeader, lda.c... |
import sys
import numpy
from PyQt5.QtWidgets import QApplication, QMessageBox, QSizePolicy
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui, congruence
from oasys.widgets.exchange import DataExchangeObject
from orangecontrib.xoppy.util.xoppy_xraylib_util ... | [
"oasys.widgets.gui.widgetBox",
"oasys.widgets.congruence.checkStrictlyPositiveNumber",
"numpy.array",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QSizePolicy",
"orangewidget.settings.Setting",
"oasys.widgets.congruence.checkFile",
"oasys.widgets.congruence.checkPositiveNumber",
"orangecontrib.x... | [((881, 891), 'orangewidget.settings.Setting', 'Setting', (['(2)'], {}), '(2)\n', (888, 891), False, 'from orangewidget.settings import Setting\n'), ((915, 930), 'orangewidget.settings.Setting', 'Setting', (['(0.0001)'], {}), '(0.0001)\n', (922, 930), False, 'from orangewidget.settings import Setting\n'), ((947, 958), ... |
'''
Test Vid4 (SR) and REDS4 (SR-clean, SR-blur, deblur-clean, deblur-compression) datasets
'''
import os
import os.path as osp
import glob
import logging
import numpy as np
import cv2
import torch
import utils.util as util
import data.util as data_util
import models.archs.EDVR_arch as EDVR_arch
def main():
###... | [
"logging.getLogger",
"utils.util.setup_logger",
"numpy.copy",
"models.archs.EDVR_arch.EDVR",
"data.util.read_img",
"torch.LongTensor",
"torch.load",
"os.path.join",
"utils.util.single_forward",
"data.util.read_img_seq",
"data.util.index_generation",
"utils.util.calculate_psnr",
"os.path.base... | [((391, 411), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (403, 411), False, 'import torch\n'), ((2495, 2570), 'models.archs.EDVR_arch.EDVR', 'EDVR_arch.EDVR', (['(128)', 'N_in', '(8)', '(5)', 'back_RBs'], {'predeblur': 'predeblur', 'HR_in': 'HR_in'}), '(128, N_in, 8, 5, back_RBs, predeblur=pred... |
"""
qgs tensor module
=================
This module computes and holds the tensor representing the tendencies of the model's equations.
Notes
-----
These are computed using the analytical expressions from:
* <NAME>., <NAME>. and <NAME>.: *The Modular Arbitrary-Order Ocean-Atmosphere Mode... | [
"params.params.QgParams",
"sparse.zeros",
"numpy.array",
"numpy.zeros",
"inner_products.analytic.OceanicInnerProducts",
"inner_products.analytic.AtmosphericInnerProducts",
"numpy.tril",
"numpy.triu"
] | [((14107, 14117), 'params.params.QgParams', 'QgParams', ([], {}), '()\n', (14115, 14117), False, 'from params.params import QgParams\n'), ((14202, 14234), 'inner_products.analytic.AtmosphericInnerProducts', 'AtmosphericInnerProducts', (['params'], {}), '(params)\n', (14226, 14234), False, 'from inner_products.analytic ... |
import logging
import numpy as np
from ctapipe.calib.camera import CameraCalibrator
from ctapipe.io import (
EventSource,
read_table,
)
from numba import njit
from scipy.interpolate import interp1d
from traitlets.config import Config
from lstchain.io import standard_config
from lstchain.io.config import read... | [
"logging.getLogger",
"numpy.random.default_rng",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.arange",
"numpy.mean",
"numpy.histogram",
"numpy.random.poisson",
"numpy.where",
"numpy.random.multinomial",
"numpy.linspace",
"numpy.random.seed",
"numpy.concatenate",
"lstchain.io.config.... | [((540, 567), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (557, 567), False, 'import logging\n'), ((690, 739), 'numpy.full', 'np.full', (['N_PIXEL_NEIGHBORS', '(1 / N_PIXEL_NEIGHBORS)'], {}), '(N_PIXEL_NEIGHBORS, 1 / N_PIXEL_NEIGHBORS)\n', (697, 739), True, 'import numpy as np\n'), ((2... |
import base64
import datetime
import io
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from xlrd.xldate import xldate_as_datetime
from yattag import Doc
plt.rcParams.update({"figure.autolayout": True})
import matplotlib.gridspec as gridspec
import pandas as pd
import scipy.stats... | [
"logging.getLogger",
"matplotlib.pyplot.hist",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.less_equal",
"matplotlib.colorbar.ColorbarBase",
"io.BytesIO",
"numpy.equal",
"tensorflow.keras.callbacks.EarlyStopping",
"numpy.array",
"matplotlib.colors.BoundaryNorm",
"tensorflow.keras.laye... | [((194, 242), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'figure.autolayout': True}"], {}), "({'figure.autolayout': True})\n", (213, 242), True, 'import matplotlib.pyplot as plt\n'), ((1164, 1199), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(-1, 1)'}), '(feature_r... |
import pylab
import numpy
class GeneralRandom:
"""This class enables us to generate random numbers with an arbitrary
distribution."""
def __init__(self, x = pylab.arange(-1.0, 1.0, .01), p = None, Nrl = 1000):
"""Initialize the lookup table (with default values if necessary)
Inputs:
x = random nu... | [
"pylab.zeros",
"pylab.subplot",
"pylab.arange",
"pylab.plot",
"pylab.array",
"pylab.figure",
"pylab.diff",
"numpy.random.uniform",
"pylab.exp"
] | [((168, 197), 'pylab.arange', 'pylab.arange', (['(-1.0)', '(1.0)', '(0.01)'], {}), '(-1.0, 1.0, 0.01)\n', (180, 197), False, 'import pylab\n'), ((987, 1003), 'pylab.zeros', 'pylab.zeros', (['Nrl'], {}), '(Nrl)\n', (998, 1003), False, 'import pylab\n'), ((1585, 1632), 'numpy.random.uniform', 'numpy.random.uniform', ([],... |
import matplotlib.pyplot as plt
import numpy as np
while True:
try:
print('-'*111) # for decoration purpose
x = input('<< TO CONTINUE PRESS "ENTER" OR TO KILL THE APPLICATION PRESS "0" >> ')
if x == '':
print()
print('<< THIS APPLICATION CALCULATES ROOTS FOR A GIV... | [
"numpy.linspace",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((1838, 1877), 'numpy.linspace', 'np.linspace', (['(-10 ** 2)', '(10 ** 2)', '(10 ** 2)'], {}), '(-10 ** 2, 10 ** 2, 10 ** 2)\n', (1849, 1877), True, 'import numpy as np\n'), ((1894, 1933), 'numpy.linspace', 'np.linspace', (['(-10 ** 2)', '(10 ** 2)', '(10 ** 2)'], {}), '(-10 ** 2, 10 ** 2, 10 ** 2)\n', (1905, 1933), ... |
from typing import List
import numpy as np
class BenchmarkResult:
def __init__(self, loop_names: List[str], n_repeats: int, metric_names: List[str]):
"""
:param loop_names: List of loop names
:param n_repeats: Number of random restarts in benchmarking
:param metric_names: List of... | [
"numpy.array"
] | [((1664, 1711), 'numpy.array', 'np.array', (['self._results[loop_name][metric_name]'], {}), '(self._results[loop_name][metric_name])\n', (1672, 1711), True, 'import numpy as np\n')] |
import matplotlib.pyplot as plt
import numpy as np
strategies = np.array([
[
#gamma = 0.5
[-9.563336572173805, -8.193748914742143, -10.270220524396596, -3.0000000000000004, -7.553846153846153, -7.904142011834319, -3.0, -3.0, -3.0, -3.0],
[-7.378487640724603, -3.3197512739857147, -7.49614268... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.asarray",
"numpy.array",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((65, 6140), 'numpy.array', 'np.array', (['[[[-9.563336572173805, -8.193748914742143, -10.270220524396596, -\n 3.0000000000000004, -7.553846153846153, -7.904142011834319, -3.0, -3.0,\n -3.0, -3.0], [-7.378487640724603, -3.3197512739857147, -\n 7.496142688168831, -3.0000000000000004, -3.0, -3.0, -3.0, -3.0, -3... |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
get_ipython().system('pip install dask')
from dask import dataframe
import pandas as pd
import yfinance as yf
import os
import logging
import numpy as np
from scipy.cluster.hierarchy import dendrogram, linkage, leaves_list
import seaborn as sns
import matplotlib.pypl... | [
"scipy.cluster.hierarchy.leaves_list",
"os.listdir",
"numpy.ones",
"numpy.asarray",
"os.path.join",
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.linalg.inv",
"numpy.array",
"scipy.cluster.hierarchy.linkage",
"pandas.DataFrame",
"matplotlib.pyplot.show"
] | [((1396, 1414), 'numpy.linalg.inv', 'np.linalg.inv', (['cov'], {}), '(cov)\n', (1409, 1414), True, 'import numpy as np\n'), ((4661, 4712), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'stocks_universe', 'columns': "['mu']"}), "(index=stocks_universe, columns=['mu'])\n", (4673, 4712), True, 'import pandas as pd\n'... |
"""
The idea of late parallelization is that we don't have to
slice our tensor network in the beginning of the contraction.
"""
import psutil
import numpy as np
from functools import partial
from loguru import logger as log
import qtree
import qtensor as qtn
from qtensor.optimisation import Optimizer, RGreedyOptimize... | [
"qtensor.toolbox.get_ordering_algo",
"qtree.graph_model.get_equivalent_peo",
"loguru.logger.info",
"loguru.logger.debug",
"qtree.graph_model.make_clique_on",
"qtree.graph_model.get_treewidth_from_peo",
"qtensor.utils.n_neighbors",
"loguru.logger.warning",
"psutil.virtual_memory",
"functools.partia... | [((479, 523), 'qtensor.toolbox.get_ordering_algo', 'qtn.toolbox.get_ordering_algo', (['ordering_algo'], {}), '(ordering_algo)\n', (508, 523), True, 'import qtensor as qtn\n'), ((539, 559), 'qtensor.optimisation.GreedyParvars', 'GreedyParvars', (['graph'], {}), '(graph)\n', (552, 559), False, 'from qtensor.optimisation ... |
'''
Created on 31 Oct 2014
@author: <NAME> (<EMAIL>)
@copyright: (c) 2014 <NAME>
@license: MIT
'''
# standard library
import unittest
# external libraries
import numpy as np
import nose
# local libraries
from zignal import Audio
class Test_single_channel(unittest.TestCase):
def setUp(self):
self.y = np... | [
"zignal.Audio",
"numpy.zeros",
"nose.run"
] | [((2514, 2537), 'nose.run', 'nose.run', ([], {'argv': 'noseargs'}), '(argv=noseargs)\n', (2522, 2537), False, 'import nose\n'), ((318, 329), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (326, 329), True, 'import numpy as np\n'), ((399, 431), 'zignal.Audio', 'Audio', ([], {'fs': '(10)', 'initialdata': 'values'}), ... |
import numpy as np
from scipy.spatial.distance import pdist, squareform
from itertools import permutations
import matplotlib.pyplot as plt
def generate_points(num = 7):
return np.random.rand(num, 2) #technically this is [0,1) rather than (0,1)
def calculate_distance_matrix(point_array):
return squareform(#Not str... | [
"numpy.random.rand",
"scipy.spatial.distance.pdist",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.show"
] | [((179, 201), 'numpy.random.rand', 'np.random.rand', (['num', '(2)'], {}), '(num, 2)\n', (193, 201), True, 'import numpy as np\n'), ((1037, 1096), 'matplotlib.pyplot.plot', 'plt.plot', (['ordered_points[:, 0]', 'ordered_points[:, 1]'], {'c': '"""r"""'}), "(ordered_points[:, 0], ordered_points[:, 1], c='r')\n", (1045, 1... |
"""
Process an input dataset into a format suitable for machine learning.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import gzip
import pandas as pd
import numpy as np
import csv
import numbers
import tempfile
from rdkit.Chem import rdmolf... | [
"os.dup2",
"numpy.ones",
"rdkit.Chem.rdmolops.RenumberAtoms",
"rdkit.Chem.MolFromSmiles",
"numpy.zeros_like",
"rdkit.Chem.rdmolfiles.CanonicalRankAtoms",
"os.dup",
"numpy.squeeze",
"numpy.array",
"numpy.concatenate",
"dcCustom.feat.Protein",
"deepchem.utils.save.log",
"sys.stderr.fileno",
... | [((908, 919), 'time.time', 'time.time', ([], {}), '()\n', (917, 919), False, 'import time\n'), ((1028, 1039), 'time.time', 'time.time', ([], {}), '()\n', (1037, 1039), False, 'import time\n'), ((1047, 1076), 'numpy.ones', 'np.ones', (['(n_samples, n_tasks)'], {}), '((n_samples, n_tasks))\n', (1054, 1076), True, 'import... |
"""Columbia Uncompressed Image Splicing Detection Evaluation Dataset
- https://www.ee.columbia.edu/ln/dvmm/downloads/authsplcuncmp/
- Detecting Image Splicing Using Geometry Invariants And Camera Characteristics Consistency, <NAME>, <NAME>
"""
import tarfile
from pathlib import Path
from typing import Any, Dict
impor... | [
"tarfile.open",
"pathlib.Path",
"torch.from_numpy",
"numpy.array",
"numpy.zeros",
"toml.load",
"src.datasets.utils.download_raw_dataset"
] | [((480, 519), 'pathlib.Path', 'Path', (['"""data/raw/columbia/metadata.toml"""'], {}), "('data/raw/columbia/metadata.toml')\n", (484, 519), False, 'from pathlib import Path\n'), ((538, 570), 'pathlib.Path', 'Path', (['"""data/downloaded/columbia"""'], {}), "('data/downloaded/columbia')\n", (542, 570), False, 'from path... |
# 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... | [
"mxnet.nd.random.uniform",
"common.with_seed",
"mxnet.nd.contrib.multi_adamw_update",
"mxnet.nd.zeros",
"mxnet.nd.square",
"mxnet.nd.clip",
"itertools.product",
"mxnet.nd.sqrt",
"mxnet.nd.contrib.mp_adamw_update",
"nose.runmodule",
"mxnet.nd.contrib.adamw_update",
"mxnet.nd.contrib.multi_mp_ad... | [((3318, 3329), 'common.with_seed', 'with_seed', ([], {}), '()\n', (3327, 3329), False, 'from common import with_seed\n'), ((2170, 2187), 'mxnet.random.seed', 'mx.random.seed', (['(0)'], {}), '(0)\n', (2184, 2187), True, 'import mxnet as mx\n'), ((9810, 9826), 'nose.runmodule', 'nose.runmodule', ([], {}), '()\n', (9824... |
import os
import sys
import math
import fire
import json
from tqdm import tqdm
from math import floor, log2
from random import random
from shutil import rmtree
from functools import partial
import multiprocessing
from contextlib import contextmanager, ExitStack
import numpy as np
import torch
from torch import nn, e... | [
"apex.amp.scale_loss",
"torchvision.transforms.ToPILImage",
"kornia.filters.filter2D",
"math.log2",
"torch.cuda.is_available",
"torch.flip",
"numpy.arange",
"torch.nn.ModuleList",
"torch.linspace",
"torchvision.transforms.Resize",
"torch.index_select",
"torch.optim.Adam",
"contrastive_learne... | [((1029, 1054), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1052, 1054), False, 'import torch\n'), ((1137, 1164), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1162, 1164), False, 'import multiprocessing\n'), ((5726, 5740), 'torch.isnan', 'torch.isnan', (['t']... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.ops.array_ops.placeholder",
"tensorflow.python.data.ops.dataset_ops.Dataset.from_tensors",
"math.ceil",
"tensorflow.python.ops.string_ops.as_string",
"tensorflow.python.framework.constant_op.constant",
"numpy.max",
"numpy.array",
"numpy.random.randint",
"tensorflow.python.framewor... | [((10147, 10158), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (10156, 10158), False, 'from tensorflow.python.platform import test\n'), ((1791, 1836), 'tensorflow.python.ops.array_ops.placeholder', 'array_ops.placeholder', (['dtypes.int64'], {'shape': '[]'}), '(dtypes.int64, shape=[])\n', (181... |
import theano.tensor as T
import numpy as np
from ..utils.utils_functions import ITLFunctions
__all__ = [
'dummy_score',
'get_accuracy',
'score_accuracy',
'score_ensemble_ambiguity',
'score_rms',
'score_silverman',
'mutual_information_cs',
'mutual_information_ed',
'mutual_informatio... | [
"numpy.sum",
"theano.tensor.mean",
"theano.tensor.zeros",
"theano.tensor.power"
] | [((869, 891), 'theano.tensor.zeros', 'T.zeros', (['_target.shape'], {}), '(_target.shape)\n', (876, 891), True, 'import theano.tensor as T\n'), ((1575, 1600), 'theano.tensor.mean', 'T.mean', (['(_target * _output)'], {}), '(_target * _output)\n', (1581, 1600), True, 'import theano.tensor as T\n'), ((3240, 3271), 'thean... |
#!/usr/bin/env python
# wujian@2018
"""
Do WPE Dereverbration Algorithm
"""
import argparse
from distutils.util import strtobool
import numpy as np
from libs.data_handler import SpectrogramReader, WaveWriter
from libs.opts import StftParser
from libs.utils import get_logger, inverse_stft
from libs.wpe import wpe
lo... | [
"libs.utils.inverse_stft",
"argparse.ArgumentParser",
"libs.wpe.wpe",
"libs.utils.get_logger",
"libs.data_handler.SpectrogramReader",
"nara_wpe.wpe.wpe_v8",
"numpy.transpose",
"libs.data_handler.WaveWriter"
] | [((327, 347), 'libs.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (337, 347), False, 'from libs.utils import get_logger, inverse_stft\n'), ((621, 715), 'libs.data_handler.SpectrogramReader', 'SpectrogramReader', (['args.wav_scp'], {'round_power_of_two': 'args.round_power_of_two'}), '(args.wav_scp... |
from pathlib import Path
from tqdm import tqdm
import numpy as np
import zarr
import pandas as pd
import joblib
from sklearn.neighbors import NearestNeighbors
from model_repair.override_for_release import get_interface
from model_repair.cache42.cached_42 import cache_42
# @cache_42(ignore_args=["gcfg"], force_recom... | [
"numpy.random.choice",
"numpy.array",
"model_repair.override_for_release.get_interface",
"sklearn.neighbors.NearestNeighbors",
"model_repair.cache42.cached_42.cache_42"
] | [((332, 362), 'model_repair.cache42.cached_42.cache_42', 'cache_42', ([], {'ignore_args': "['gcfg']"}), "(ignore_args=['gcfg'])\n", (340, 362), False, 'from model_repair.cache42.cached_42 import cache_42\n'), ((774, 812), 'numpy.array', 'np.array', (["z_file_embeds['embedded_nd']"], {}), "(z_file_embeds['embedded_nd'])... |
from __future__ import (absolute_import, division, print_function)
from collections import OrderedDict
import numpy as np
from .util import extract_vars, get_id, get_iterable, is_mapping, to_np
from .py3compat import viewkeys
from .latlonutils import _lat_varname, _lon_varname, _ll_to_xy, _xy_to_ll
from .metadecorat... | [
"collections.OrderedDict",
"numpy.empty",
"xarray.DataArray"
] | [((10697, 10733), 'numpy.empty', 'np.empty', (['outdims', 'first_array.dtype'], {}), '(outdims, first_array.dtype)\n', (10705, 10733), True, 'import numpy as np\n'), ((11629, 11660), 'collections.OrderedDict', 'OrderedDict', (['first_array.coords'], {}), '(first_array.coords)\n', (11640, 11660), False, 'from collection... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Generate a correlation matrix plot"""
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_func... | [
"matplotlib.collections.LineCollection",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.Normalize",
"numpy.asarray",
"numpy.ma.masked_where",
"matplotlib.colors.ListedColormap",
"numpy.linspace",
"matplotlib.cm.ScalarMappable",
"scipy.cluster.hierarchy.linkage",
"mpl_toolkits.axes_grid1.Image... | [((13743, 13753), 'matplotlib.pyplot.draw', 'plt.draw', ([], {}), '()\n', (13751, 13753), True, 'import matplotlib.pyplot as plt\n'), ((7952, 7987), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'correlation_data'}), '(data=correlation_data)\n', (7964, 7987), True, 'import pandas as pd\n'), ((8665, 8726), 'scipy.cl... |
import numpy as np
def test_list_indexing(todo_list):
try:
assert(todo_list[2] == 'REPLACED')
except AssertionError as e:
print("The element 'TO_REPLACE_1' is not correctly replaced!")
raise(e)
try:
assert(todo_list[-1][-1][-1] == 'REPLACED')
except AssertionError... | [
"numpy.random.normal",
"numpy.testing.assert_array_almost_equal",
"numpy.sqrt",
"numpy.testing.assert_array_equal",
"numpy.array",
"numpy.zeros",
"numpy.testing.assert_almost_equal",
"numpy.random.seed",
"numpy.all",
"numpy.arange"
] | [((1025, 1050), 'numpy.zeros', 'np.zeros', (['(2, 3, 5, 3, 7)'], {}), '((2, 3, 5, 3, 7))\n', (1033, 1050), True, 'import numpy as np\n'), ((1867, 1883), 'numpy.arange', 'np.arange', (['(3)', '(25)'], {}), '(3, 25)\n', (1876, 1883), True, 'import numpy as np\n'), ((2229, 2245), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}... |
import numpy as np
from numpy import pi, exp
from scipy.special import gamma as gamma_func
from scipy.spatial import distance
class Distribution:
_parameter_names = ''
multi = False
"""Base probability distribution class"""
def __init__(self, **kwargs):
pass
@property
def rvs(self):
... | [
"numpy.sqrt",
"numpy.random.default_rng",
"numpy.log",
"numpy.linalg.det",
"numpy.exp",
"numpy.array",
"numpy.linalg.inv",
"scipy.special.gamma",
"numpy.matrix",
"scipy.spatial.distance.mahalanobis"
] | [((2130, 2159), 'numpy.sqrt', 'np.sqrt', (['(self.var + other.var)'], {}), '(self.var + other.var)\n', (2137, 2159), True, 'import numpy as np\n'), ((2358, 2385), 'numpy.random.default_rng', 'np.random.default_rng', (['seed'], {}), '(seed)\n', (2379, 2385), True, 'import numpy as np\n'), ((2828, 2855), 'numpy.random.de... |
from __future__ import absolute_import
from __future__ import division
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
class Conv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, relu=True, same_padding=False, bn=False):
super(Con... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"numpy.asarray",
"torch.from_numpy",
"torch.nn.Conv2d",
"h5py.File",
"torch.nn.Linear",
"torch.no_grad"
] | [((1274, 1300), 'h5py.File', 'h5py.File', (['fname'], {'mode': '"""w"""'}), "(fname, mode='w')\n", (1283, 1300), False, 'import h5py\n'), ((1449, 1475), 'h5py.File', 'h5py.File', (['fname'], {'mode': '"""r"""'}), "(fname, mode='r')\n", (1458, 1475), False, 'import h5py\n'), ((430, 504), 'torch.nn.Conv2d', 'nn.Conv2d', ... |
import matplotlib.pyplot as plt
import numpy as np
from DREAM.Settings.Equations.EquationException import EquationException
from DREAM.Settings.Equations.IonSpecies import IonSpecies, IONS_PRESCRIBED, IONIZATION_MODE_FLUID, IONIZATION_MODE_KINETIC, IONIZATION_MODE_KINETIC_APPROX_JAC, ION_OPACITY_MODE_TRANSPARENT
from ... | [
"DREAM.Settings.Equations.IonSpecies.IonSpecies",
"DREAM.Settings.Equations.EquationException.EquationException",
"numpy.any",
"numpy.sum",
"numpy.zeros"
] | [((2623, 2855), 'DREAM.Settings.Equations.IonSpecies.IonSpecies', 'IonSpecies', ([], {'settings': 'self.settings', 'name': 'name', 'Z': 'Z', 'ttype': 'iontype', 'Z0': 'Z0', 'isotope': 'isotope', 'SPIMolarFraction': 'SPIMolarFraction', 'opacity_mode': 'opacity_mode', 'T': 'T', 'n': 'n', 'r': 'r', 't': 't', 'interpr': 's... |
#!/usr/bin/python
# This script prints the predicted and real body part in the validation dataset (images/test)
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
from keras import optimizers
from keras.models import load_model
from keras.preprocessin... | [
"tensorflow.unstack",
"keras.preprocessing.image.img_to_array",
"os.listdir",
"keras.models.load_model",
"argparse.ArgumentParser",
"csv.writer",
"numpy.vstack",
"numpy.expand_dims",
"keras.optimizers.RMSprop",
"keras.preprocessing.image.load_img"
] | [((407, 482), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get prediction on validation dataset"""'}), "(description='Get prediction on validation dataset')\n", (430, 482), False, 'import argparse\n'), ((626, 645), 'csv.writer', 'csv.writer', (['csvFile'], {}), '(csvFile)\n', (636, 645... |
from ast import literal_eval
import copy
import yaml
import numpy as np
import os
import argparse
class AttrDict(dict):
def __getattr__(self, name):
if name in self.__dict__:
return self.__dict__[name]
elif name in self:
return self[name]
else:
raise Att... | [
"argparse.ArgumentParser",
"yaml.load",
"ast.literal_eval",
"numpy.array",
"os.path.basename",
"copy.deepcopy"
] | [((4642, 4667), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4665, 4667), False, 'import argparse\n'), ((5148, 5160), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (5157, 5160), False, 'import yaml\n'), ((6805, 6822), 'copy.deepcopy', 'copy.deepcopy', (['v_'], {}), '(v_)\n', (6818, 6822), ... |
import unittest
import numpy as np
import pickle
from syft.nn.linear import LinearClassifier
from syft.he.paillier import KeyPair, PaillierTensor
class PySonarNotebooks(unittest.TestCase):
def modelTrainingDemoNotebook(self):
"""If this test fails, you probably broke the demo notebook located at
... | [
"numpy.ones",
"syft.nn.linear.LinearClassifier",
"pickle.dumps",
"numpy.array",
"syft.he.paillier.KeyPair",
"pickle.loads"
] | [((497, 565), 'syft.nn.linear.LinearClassifier', 'LinearClassifier', ([], {'desc': '"""DiabetesClassifier"""', 'n_inputs': '(10)', 'n_labels': '(1)'}), "(desc='DiabetesClassifier', n_inputs=10, n_labels=1)\n", (513, 565), False, 'from syft.nn.linear import LinearClassifier\n'), ((1829, 1844), 'pickle.dumps', 'pickle.du... |
# --------------------------------------------------------
# Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> and <NAME>
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import pri... | [
"numpy.unique",
"numpy.hstack",
"numpy.where",
"model.bbox_transform.clip_boxes",
"numpy.zeros",
"model.bbox_transform.bbox_transform_inv"
] | [((1137, 1179), 'model.bbox_transform.bbox_transform_inv', 'bbox_transform_inv', (['anchors', 'rpn_bbox_pred'], {}), '(anchors, rpn_bbox_pred)\n', (1155, 1179), False, 'from model.bbox_transform import bbox_transform_inv, clip_boxes\n'), ((1194, 1228), 'model.bbox_transform.clip_boxes', 'clip_boxes', (['proposals', 'im... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.random.rand",
"mindspore.context.set_context",
"mindspore.ops.operations.BroadcastTo",
"mindspore.common.tensor.Tensor",
"pytest.raises",
"numpy.broadcast_to"
] | [((935, 1000), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target': '"""GPU"""'}), "(mode=context.GRAPH_MODE, device_target='GPU')\n", (954, 1000), True, 'import mindspore.context as context\n'), ((1145, 1173), 'numpy.broadcast_to', 'np.broadcast_to', (['x_np', 's... |
"""
Tests for simulation smoothing
Author: <NAME>
License: Simplified-BSD
"""
import os
import numpy as np
from numpy.testing import assert_allclose, assert_equal
import pandas as pd
from statsmodels import datasets
from statsmodels.tsa.statespace import mlemodel, sarimax, structural
from statsmodels.tsa.statespace.... | [
"numpy.testing.assert_equal",
"pandas.read_csv",
"numpy.log",
"numpy.array",
"numpy.arange",
"pandas.date_range",
"numpy.testing.assert_allclose",
"numpy.dot",
"numpy.random.seed",
"numpy.random.normal",
"numpy.eye",
"numpy.ones",
"statsmodels.datasets.macrodata.load_pandas",
"numpy.linalg... | [((443, 468), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (458, 468), False, 'import os\n'), ((24681, 24742), 'pandas.date_range', 'pd.date_range', ([], {'start': '"""1959-01-01"""', 'end': '"""2009-7-01"""', 'freq': '"""QS"""'}), "(start='1959-01-01', end='2009-7-01', freq='QS')\n", (2469... |
import os
import numpy as np
import pytest
from napari import Viewer, layers
from napari._tests.utils import (
add_layer_by_type,
check_view_transform_consistency,
check_viewer_functioning,
layer_test_data,
)
from napari.utils._tests.test_naming import eval_with_filename
def test_viewer(make_test_vi... | [
"napari.utils._tests.test_naming.eval_with_filename",
"napari.Viewer",
"numpy.random.rand",
"os.getenv",
"pytest.mark.run",
"numpy.random.random",
"napari._tests.utils.check_view_transform_consistency",
"napari._tests.utils.check_viewer_functioning",
"numpy.count_nonzero",
"pytest.mark.parametrize... | [((1213, 1237), 'pytest.mark.run', 'pytest.mark.run', ([], {'order': '(1)'}), '(order=1)\n', (1228, 1237), False, 'import pytest\n'), ((1747, 1814), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""layer_class, data, ndim"""', 'layer_test_data'], {}), "('layer_class, data, ndim', layer_test_data)\n", (1770, ... |
'''Module to manage and advanced game state'''
from collections import defaultdict
import numpy as np
from . import constants
from . import characters
from . import utility
class ForwardModel(object):
"""Class for helping with the [forward] modeling of the game state."""
def run(self,
num_times... | [
"numpy.where",
"numpy.zeros_like",
"collections.defaultdict",
"numpy.zeros"
] | [((10750, 10766), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (10761, 10766), False, 'from collections import defaultdict\n'), ((10792, 10808), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (10803, 10808), False, 'from collections import defaultdict\n'), ((20273, 20298), 'n... |
"""
==================================
Faster rendering by using blitting
==================================
*Blitting* is a `standard technique
<https://en.wikipedia.org/wiki/Bit_blit>`__ in raster graphics that,
in the context of Matplotlib, can be used to (drastically) improve
performance of interactive figures. Fo... | [
"numpy.sin",
"numpy.linspace",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1984, 2014), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(100)'], {}), '(0, 2 * np.pi, 100)\n', (1995, 2014), True, 'import numpy as np\n'), ((2026, 2040), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2038, 2040), True, 'import matplotlib.pyplot as plt\n'), ((2238, 2259), 'matplotli... |
import numpy as np
def create_label_map(num_classes=19):
name_label_mapping = {
'unlabeled': 0, 'outlier': 1, 'car': 10, 'bicycle': 11,
'bus': 13, 'motorcycle': 15, 'on-rails': 16, 'truck': 18,
'other-vehicle': 20, 'person': 30, 'bicyclist': 31,
'motorcyclist': 32, 'road': 40, 'par... | [
"numpy.zeros"
] | [((1284, 1297), 'numpy.zeros', 'np.zeros', (['(260)'], {}), '(260)\n', (1292, 1297), True, 'import numpy as np\n')] |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... | [
"tensorflow_datasets.public_api.features.Image",
"numpy.frombuffer",
"collections.namedtuple",
"tensorflow_datasets.public_api.features.Text",
"os.path.join",
"tensorflow_datasets.public_api.features.ClassLabel",
"tensorflow_datasets.public_api.core.Version",
"tensorflow.compat.v2.io.gfile.GFile"
] | [((6490, 6615), 'collections.namedtuple', 'collections.namedtuple', (['"""_CifarInfo"""', "['name', 'url', 'prefix', 'train_files', 'test_files', 'label_files',\n 'label_keys']"], {}), "('_CifarInfo', ['name', 'url', 'prefix',\n 'train_files', 'test_files', 'label_files', 'label_keys'])\n", (6512, 6615), False, '... |
# %%
from core.dqn_agent import DQNAgent
from cartpole.cartpole_neural_network import CartPoleNeuralNetwork
from cartpole.cartpole_wrapper import CartPoleWrapper
import gym
import numpy as np
from tqdm import tqdm
import numpy as np
import shutil
from pathlib import Path
import shutil
from utils import *
import plotly.... | [
"numpy.mean",
"pathlib.Path",
"numpy.std",
"cartpole.cartpole_neural_network.CartPoleNeuralNetwork",
"numpy.random.seed",
"shutil.rmtree",
"gym.wrappers.Monitor",
"gym.make"
] | [((431, 451), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (445, 451), True, 'import numpy as np\n'), ((2030, 2158), 'gym.wrappers.Monitor', 'gym.wrappers.Monitor', (['agent.env', '"""results/cartpole/recording/tmp-videos"""'], {'force': '(True)', 'video_callable': '(lambda episode_id: True)'}), "... |
# -*- coding: utf-8 -*-
"""Some matrix specialization."""
import time
from pygimli.core import _pygimli_ as pg
import numpy as np
# make core matrices (now in pg, later pg.core) known here for tab-completion
# BlockMatrix = pg.BlockMatrix
# IdentityMatrix = pg.IdentityMatrix
class MultLeftMatrix(pg.MatrixBase):
... | [
"scipy.linalg.eigh",
"numpy.transpose",
"numpy.sqrt",
"time.time"
] | [((5643, 5654), 'time.time', 'time.time', ([], {}), '()\n', (5652, 5654), False, 'import time\n'), ((5682, 5689), 'scipy.linalg.eigh', 'eigh', (['A'], {}), '(A)\n', (5686, 5689), False, 'from scipy.linalg import eigh\n'), ((5709, 5731), 'numpy.sqrt', 'np.sqrt', (['(1.0 / self.ew)'], {}), '(1.0 / self.ew)\n', (5716, 573... |
# Copyright 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 agre... | [
"qsimcirq.QSimhSimulator",
"pennylane.QubitDevice.expval",
"qsimcirq.QSimSimulator",
"cirq.Circuit",
"numpy.array",
"numpy.sum",
"cirq.IdentityGate"
] | [((2383, 2438), 'qsimcirq.QSimSimulator', 'qsimcirq.QSimSimulator', ([], {'qsim_options': '(qsim_options or {})'}), '(qsim_options=qsim_options or {})\n', (2405, 2438), False, 'import qsimcirq\n'), ((4844, 4882), 'qsimcirq.QSimhSimulator', 'qsimcirq.QSimhSimulator', (['qsimh_options'], {}), '(qsimh_options)\n', (4867, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2020 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-... | [
"numpy.prod",
"numpy.dtype",
"numpy.random.RandomState"
] | [((1326, 1341), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (1334, 1341), True, 'import numpy as np\n'), ((2180, 2210), 'numpy.random.RandomState', 'np.random.RandomState', (['op.seed'], {}), '(op.seed)\n', (2201, 2210), True, 'import numpy as np\n'), ((2444, 2464), 'numpy.prod', 'np.prod', (['chunk.shape'... |
"""
plasmapy.classes.plasma
=======================
Defines the core Plasma class used by PlasmaPy to represent plasma properties.
"""
import numpy as np
import astropy.units as u
from astropy.utils.console import ProgressBar
from .simulation import MHDSimulation, dot
from ..constants import mu0
class Plasma:
"... | [
"numpy.sqrt",
"astropy.utils.console.ProgressBar",
"numpy.squeeze",
"numpy.zeros",
"numpy.meshgrid",
"numpy.isinf",
"astropy.units.quantity_input"
] | [((1874, 1932), 'astropy.units.quantity_input', 'u.quantity_input', ([], {'domain_x': 'u.m', 'domain_y': 'u.m', 'domain_z': 'u.m'}), '(domain_x=u.m, domain_y=u.m, domain_z=u.m)\n', (1890, 1932), True, 'import astropy.units as u\n'), ((9229, 9259), 'astropy.units.quantity_input', 'u.quantity_input', ([], {'max_time': 'u... |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import numpy as np
import torch
from torch import tensor
from sklearn.metrics import roc_curve, auc, accuracy_score, confusion_matrix, classification_report
from .models import RatioModel
import matplotlib.pyplot as plt
... | [
"logging.getLogger",
"sklearn.metrics.confusion_matrix",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"sklearn.metrics.classification_report",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"torch.sigmoid",
"matplotlib.pyplot.axis",
"torch.no_grad",
"matplotlib.pyplot.figure",
"torch.cud... | [((330, 357), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (347, 357), False, 'import logging\n'), ((575, 620), 'torch.device', 'torch.device', (["('cuda' if run_on_gpu else 'cpu')"], {}), "('cuda' if run_on_gpu else 'cpu')\n", (587, 620), False, 'import torch\n'), ((1724, 1769), 'torch... |
#!/usr/bin/env python
import numpy
def abserror(a, b):
return numpy.abs(a - b)
def relerror(a, b):
return abserror(a, b) / max(numpy.abs(a), numpy.abs(b))
def eq(a, b, e):
if type(a) == numpy.ndarray:
return all(abserror(a, b) < e)
return abserror(a, b) < e
if __name__ == '__main__':
... | [
"numpy.abs"
] | [((69, 85), 'numpy.abs', 'numpy.abs', (['(a - b)'], {}), '(a - b)\n', (78, 85), False, 'import numpy\n'), ((140, 152), 'numpy.abs', 'numpy.abs', (['a'], {}), '(a)\n', (149, 152), False, 'import numpy\n'), ((154, 166), 'numpy.abs', 'numpy.abs', (['b'], {}), '(b)\n', (163, 166), False, 'import numpy\n')] |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
import windtools.util as util
class Weibull(object):
def __init__(self, data, ws_field='ws', wd_field='wd', wd_bin_size=30, ws_bin_size=1, prepare_data=True):
self.data = pd.DataFrame(data)
self.dat... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"pandas.notnull",
"numpy.arange",
"numpy.mean",
"pandas.pivot_table",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"pandas.DataFrame",
"scipy.stats.weibull_min.fit",
"numpy.ceil",
"matplotlib.pyplot.savefig",
"os.path.dirname",
"matplotlib... | [((3520, 3543), 'numpy.ceil', 'np.ceil', (['(sp_n / sp_rows)'], {}), '(sp_n / sp_rows)\n', (3527, 3543), True, 'import numpy as np\n'), ((285, 303), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (297, 303), True, 'import pandas as pd\n'), ((663, 763), 'windtools.util.load_data', 'util.load_data', ([],... |
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
from smoothing_actions import *
N_simul = 150
def complete_ss(beta, b0, x0, A, C, S_y, T=12):
"""
Computes the path of consumption and debt for the previously described
complete markets model where exogenous income follows a linear
... | [
"numpy.eye",
"numpy.ones",
"seaborn.color_palette",
"numpy.squeeze",
"numpy.array",
"numpy.random.randint",
"numpy.random.seed",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1195, 1244), 'numpy.squeeze', 'np.squeeze', (['(S_y @ rm @ x_hist - cbar / (1 - beta))'], {}), '(S_y @ rm @ x_hist - cbar / (1 - beta))\n', (1205, 1244), True, 'import numpy as np\n'), ((1454, 1519), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0], [alpha, rho1, rho2], [0.0, 1.0, 0.0]]'], {}), '([[1.0, 0.0, 0.0], [al... |
from __future__ import print_function
import sys
from coffea import lookup_tools
import uproot
from coffea.util import awkward
from coffea.util import numpy as np
import pytest
from dummy_distributions import dummy_jagged_eta_pt, dummy_four_momenta
def jetmet_evaluator():
from coffea.lookup_tools import extrac... | [
"coffea.jetmet_tools.JetResolution",
"numpy.random.exponential",
"numpy.sin",
"numpy.full_like",
"dummy_distributions.dummy_four_momenta",
"numpy.empty",
"coffea.util.awkward.JaggedArray",
"numpy.abs",
"coffea.jetmet_tools.FactorizedJetCorrector",
"dummy_distributions.dummy_jagged_eta_pt",
"coff... | [((338, 349), 'coffea.lookup_tools.extractor', 'extractor', ([], {}), '()\n', (347, 349), False, 'from coffea.lookup_tools import extractor\n'), ((1755, 1776), 'dummy_distributions.dummy_jagged_eta_pt', 'dummy_jagged_eta_pt', ([], {}), '()\n', (1774, 1776), False, 'from dummy_distributions import dummy_jagged_eta_pt, d... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from gym import spaces
from habi... | [
"habitat_baselines.common.utils.Flatten",
"torch.nn.GroupNorm",
"torch.nn.ReLU",
"numpy.prod",
"torch.nn.Embedding",
"habitat_baselines.common.utils.ResizeCenterCropper",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"habitat_baselines.rl.models.rnn_state_encoder.RNNStateEncoder",
"torch.sin",... | [((1278, 1314), 'habitat_baselines.common.utils.ResizeCenterCropper', 'ResizeCenterCropper', ([], {'size': '(256, 256)'}), '(size=(256, 256))\n', (1297, 1314), False, 'from habitat_baselines.common.utils import Flatten, ResizeCenterCropper\n'), ((2202, 2238), 'habitat_baselines.common.utils.ResizeCenterCropper', 'Resiz... |
"""
inheritance-diagram:: dfo.optimizer.direct
:parts: 1
"""
from misc.debug import DbgMsgOut, DbgMsg
from .base import BoxConstrainedOptimizer
from numpy import max, min, abs, array
import numpy as np
import heapq
__all__ = ['Cube', 'DIRECT']
class Cube(object):
def __init__(self, x, f, depth):
se... | [
"numpy.ones",
"numpy.array",
"heapq.heappop",
"numpy.min",
"heapq.heappush",
"misc.debug.DbgMsgOut"
] | [((327, 335), 'numpy.array', 'array', (['x'], {}), '(x)\n', (332, 335), False, 'from numpy import max, min, abs, array\n'), ((1727, 1766), 'misc.debug.DbgMsgOut', 'DbgMsgOut', (['"""DIRECT"""', '"""Resetting DIRECT"""'], {}), "('DIRECT', 'Resetting DIRECT')\n", (1736, 1766), False, 'from misc.debug import DbgMsgOut, Db... |
"""
---------------------------------------------------------------------
-- Author: <NAME>
---------------------------------------------------------------------
Main file to execute the model on the MNIST dataset
"""
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import argparse
import rando... | [
"torch.utils.data.sampler.SubsetRandomSampler",
"torch.manual_seed",
"argparse.ArgumentParser",
"matplotlib.use",
"random.seed",
"numpy.random.seed",
"torch.utils.data.DataLoader",
"torch.cuda.manual_seed",
"torchvision.transforms.ToTensor",
"numpy.random.permutation"
] | [((238, 259), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (252, 259), False, 'import matplotlib\n'), ((662, 741), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Implementation of DGM Clustering"""'}), "(description='PyTorch Implementation of DGM Clusteri... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from Bio import BiopythonWarning
import os
import uuid
import io
import subprocess
import logging
import sys
import csv
import time
import re
import shutil
import platform
import distro
i... | [
"Bio.SeqIO.FastaIO.SimpleFastaParser",
"tarfile.open",
"io.open",
"seaborn.set_style",
"itertools.izip",
"sys.exit",
"operator.itemgetter",
"subprocess.Popen",
"matplotlib.pyplot.xlabel",
"logging.FileHandler",
"subprocess.call",
"pkg_resources.get_distribution",
"matplotlib.pyplot.xticks",
... | [((909, 958), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'BiopythonWarning'], {}), "('ignore', BiopythonWarning)\n", (930, 958), False, 'import warnings\n'), ((1137, 1199), 'os.path.join', 'os.path.join', (['parentdir', '"""aux_scripts"""', '"""genemark_gtf2gff3.pl"""'], {}), "(parentdir, 'aux_... |
import time
import cv2
import numpy as np
from PIL import ImageGrab
import win32gui
import win32con
import win32api
import win32com, win32com.client
import re
from playsound import playsound
import jstyleson as json
from os import path
import sys
from collections import deque
import builtins as __builtin__
from datetim... | [
"win32gui.GetWindowRect",
"PIL.ImageGrab.grab",
"playsound.playsound",
"time.sleep",
"sys.exit",
"win32api.SendMessage",
"win32gui.SetForegroundWindow",
"collections.deque",
"numpy.asarray",
"win32gui.ShowWindow",
"re.finditer",
"win32com.client.Dispatch",
"numpy.ones",
"win32gui.GetWindow... | [((663, 680), 'collections.deque', 'deque', ([], {'maxlen': '(100)'}), '(maxlen=100)\n', (668, 680), False, 'from collections import deque\n'), ((384, 398), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (396, 398), False, 'from datetime import datetime\n'), ((535, 590), 'builtins.print', '__builtin__.print... |
import numpy as np
def R2_nom_denom(y, yhat):
""" Calculates the nominator and denomitor for calculating R-squared
Args:
y (array): data
yhat (array): predicted data data
Returns:
nominator (float or array), denominator (float or array)
"""
y, yhat = np.array(y), np.array... | [
"numpy.sum",
"numpy.array",
"numpy.errstate"
] | [((299, 310), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (307, 310), True, 'import numpy as np\n'), ((312, 326), 'numpy.array', 'np.array', (['yhat'], {}), '(yhat)\n', (320, 326), True, 'import numpy as np\n'), ((336, 382), 'numpy.errstate', 'np.errstate', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'... |
import sys
import cv2
import numpy as np
from line_boundary_check import *
# ----------------------------------------------------------------------------
g_mouse_pos = [0 ,0]
# Mouse event handler
def onMouse(event, x, y, flags, param):
global g_mouse_pos
g_mouse_pos = [x, y]
# ----------------------... | [
"cv2.setMouseCallback",
"cv2.polylines",
"cv2.line",
"cv2.imshow",
"numpy.array",
"numpy.zeros",
"cv2.waitKey",
"cv2.namedWindow",
"cv2.drawMarker"
] | [((824, 889), 'cv2.line', 'cv2.line', (['img', '(x1, y1)', '(x2, y2)', 'line.color', 'line.lineThinkness'], {}), '(img, (x1, y1), (x2, y2), line.color, line.lineThinkness)\n', (832, 889), False, 'import cv2\n'), ((1142, 1214), 'cv2.drawMarker', 'cv2.drawMarker', (['img', '(x1, y1)', 'line.color', 'cv2.MARKER_TRIANGLE_U... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... | [
"numpy.abs",
"numpy.random.rand",
"numpy.ones",
"openfermion.utils._sparse_tools.get_linear_qubit_operator_diagonal",
"numpy.hstack",
"scipy.linalg.orth",
"numpy.real",
"numpy.dot",
"numpy.stack",
"numpy.linalg.norm",
"numpy.linalg.eigh",
"warnings.warn",
"openfermion.utils._linear_qubit_ope... | [((16137, 16164), 'numpy.random.rand', 'numpy.random.rand', (['row', 'col'], {}), '(row, col)\n', (16154, 16164), False, 'import numpy\n'), ((16285, 16318), 'scipy.linalg.orth', 'scipy.linalg.orth', (['random_vectors'], {}), '(random_vectors)\n', (16302, 16318), False, 'import scipy\n'), ((6328, 6360), 'scipy.linalg.or... |
# coding=utf-8
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import warnings
import numpy as np
from deslib.base import BaseDS
from deslib.util.aggregation import majority_voting_rule
from deslib.util.diversity import Q_statistic, ratio_errors, \
negative_double_fault, compute_pairwise_diversity
from sklea... | [
"sklearn.cluster.KMeans",
"numpy.mean",
"numpy.ceil",
"numpy.where",
"deslib.util.diversity.compute_pairwise_diversity",
"numpy.argsort",
"numpy.zeros",
"numpy.apply_along_axis",
"warnings.warn",
"deslib.util.aggregation.majority_voting_rule",
"numpy.arange"
] | [((6885, 6945), 'numpy.zeros', 'np.zeros', (['(self.clustering_.n_clusters, self.n_classifiers_)'], {}), '((self.clustering_.n_clusters, self.n_classifiers_))\n', (6893, 6945), True, 'import numpy as np\n'), ((6993, 7053), 'numpy.zeros', 'np.zeros', (['(self.clustering_.n_clusters, self.n_classifiers_)'], {}), '((self.... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import numpy as np
import tensorflow as tf
import model
from data_reader import load_data, DataReader
flags = tf.flags
# data
flags.DEFINE_string('data_dir', 'data', 'data directo... | [
"model.model_size",
"tensorflow.Summary.Value",
"tensorflow.set_random_seed",
"tensorflow.app.run",
"os.path.exists",
"tensorflow.Graph",
"data_reader.load_data",
"tensorflow.Session",
"numpy.exp",
"tensorflow.assign",
"os.mkdir",
"numpy.random.seed",
"model.training_graph",
"tensorflow.va... | [((3284, 3347), 'data_reader.load_data', 'load_data', (['FLAGS.data_dir', 'FLAGS.max_word_length'], {'eos': 'FLAGS.EOS'}), '(FLAGS.data_dir, FLAGS.max_word_length, eos=FLAGS.EOS)\n', (3293, 3347), False, 'from data_reader import load_data, DataReader\n'), ((3368, 3470), 'data_reader.DataReader', 'DataReader', (["word_t... |
#!/usr/bin/env python
"""
Code to load an expert policy and generate roll-out data for behavioral cloning.
Example usage:
python run_expert_pytorch.py experts/Humanoid-v1.pkl Humanoid-v2 --render \
--num_rollouts 20
Author of this script and included expert policies: <NAME> (<EMAIL>)
"""
import pickl... | [
"numpy.mean",
"numpy.reshape",
"random.shuffle",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"tensorflow.Session",
"load_policy.load_policy",
"tf_util.initialize",
"torch.FloatTensor",
"torch.max",
"torch.nn.MSELoss",
"matplo... | [((782, 825), 'load_policy.load_policy', 'load_policy.load_policy', (['expert_policy_file'], {}), '(expert_policy_file)\n', (805, 825), False, 'import load_policy\n'), ((2125, 2153), 'numpy.reshape', 'np.reshape', (['pair[0]', '(1, -1)'], {}), '(pair[0], (1, -1))\n', (2135, 2153), True, 'import numpy as np\n'), ((2165,... |
import re
import copy
import pickle
import numpy as np
from collections import OrderedDict
import torch
from torch.autograd import Variable
import global_variables as g
def save_checkpoint(state, filename='./checkpoints/checkpoint.pth.tar'):
print('save model!', filename)
torch.save(state, filename)
def sav... | [
"collections.OrderedDict",
"pickle.dump",
"torch.LongTensor",
"torch.stack",
"pickle.load",
"torch.from_numpy",
"numpy.zeros",
"torch.cuda.is_available",
"torch.save",
"copy.deepcopy",
"re.sub",
"torch.autograd.Variable",
"torch.FloatTensor"
] | [((283, 310), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (293, 310), False, 'import torch\n'), ((594, 673), 'collections.OrderedDict', 'OrderedDict', (["{'R_cuisine': [], 'R_location': [], 'R_price': [], 'R_number': []}"], {}), "({'R_cuisine': [], 'R_location': [], 'R_price': [], 'R... |
"""
Copyright 2019 Samsung SDS
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 applic... | [
"numpy.mean",
"pandas.isnull",
"numpy.median",
"numpy.unique",
"numpy.std",
"numpy.max",
"numpy.count_nonzero",
"numpy.sum",
"numpy.array",
"numpy.min",
"numpy.percentile",
"numpy.var"
] | [((768, 777), 'numpy.max', 'np.max', (['a'], {}), '(a)\n', (774, 777), True, 'import numpy as np\n'), ((802, 811), 'numpy.min', 'np.min', (['a'], {}), '(a)\n', (808, 811), True, 'import numpy as np\n'), ((884, 893), 'numpy.sum', 'np.sum', (['a'], {}), '(a)\n', (890, 893), True, 'import numpy as np\n'), ((919, 929), 'nu... |
"""
Analyze spike shapes - pulled out of IVCurve 2/6/2016 pbm.
Allows routine to be used to analyze spike trains independent of acq4's data models.
Create instance, then call setup to define the "Clamps" object and the spike threshold.
The Clamps object must have the following variables defined:
commandLevels (cu... | [
"numpy.mean",
"collections.OrderedDict",
"numpy.abs",
"numpy.fabs",
"numpy.where",
"numpy.sort",
"numpy.std",
"numpy.diff",
"numpy.argmax",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.argwhere",
"pprint.PrettyPrinter",
"numpy.min",
"numpy.argmin",
"numpy.gradient"
] | [((6089, 6102), 'numpy.zeros', 'np.zeros', (['ntr'], {}), '(ntr)\n', (6097, 6102), True, 'import numpy as np\n'), ((6122, 6135), 'numpy.zeros', 'np.zeros', (['ntr'], {}), '(ntr)\n', (6130, 6135), True, 'import numpy as np\n'), ((6156, 6169), 'numpy.zeros', 'np.zeros', (['ntr'], {}), '(ntr)\n', (6164, 6169), True, 'impo... |
from pathlib import Path
import PIL.Image as PImage
import tensorflow as tf
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing.image import img_to_array
from collections import Counter
class CNN_Model:
def __init__(self):
self.configSet = False
def cre... | [
"keras.preprocessing.image.img_to_array",
"tensorflow.keras.layers.Conv2D",
"pathlib.Path",
"numpy.argmax",
"keras.preprocessing.image.ImageDataGenerator",
"numpy.max",
"collections.Counter",
"tensorflow.keras.layers.Dense",
"numpy.expand_dims",
"tensorflow.keras.layers.Flatten",
"tensorflow.ker... | [((370, 487), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1.0 / 255)', 'shear_range': '(0.2)', 'zoom_range': '(0.2)', 'vertical_flip': '(False)', 'horizontal_flip': '(True)'}), '(rescale=1.0 / 255, shear_range=0.2, zoom_range=0.2,\n vertical_flip=False, horizontal_flip=Tr... |
"""
Mask R-CNN
Train on the nuclei segmentation dataset from the
Kaggle 2018 Data Science Bowl
https://www.kaggle.com/c/data-science-bowl-2018/
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
------------------------------------------------------------
Usage: import the module (see Jupyter... | [
"mrcnn.model.MaskRCNN",
"numpy.sqrt",
"mrcnn.utils.download_trained_weights",
"imgaug.augmenters.GaussianBlur",
"mrcnn.model.compute_backbone_shapes",
"mrcnn.model.parse_image_meta",
"numpy.argsort",
"numpy.array",
"mrcnn.visualize.display_instances",
"mrcnn.model.log",
"imgaug.augmenters.Fliplr... | [((1591, 1602), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1600, 1602), False, 'import os\n'), ((1846, 1871), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (1861, 1871), False, 'import sys\n'), ((2155, 2198), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mask_rcnn_coco.h5"""'], {}), "(... |
import matplotlib as mpl
mpl.use('Agg')
# import matplotlib.pyplot as plt
import numpy as np
import math
import pylab as plt
from matplotlib.ticker import ScalarFormatter
# path = '/home/zgy_ucla_cs/data/dropSeq/'
path = '/home/zgy_ucla_cs/Research/DropSeq/data/reads_barcode/'
read_cluster_size = []
# with open(path... | [
"matplotlib.use",
"numpy.load",
"numpy.where"
] | [((25, 39), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), True, 'import matplotlib as mpl\n'), ((825, 871), 'numpy.load', 'np.load', (["(path + 'E31_REP3_cell_group_size.npy')"], {}), "(path + 'E31_REP3_cell_group_size.npy')\n", (832, 871), True, 'import numpy as np\n'), ((910, 943), 'numpy.w... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"numpy.copy",
"paddle.fluid.framework._test_eager_guard",
"numpy.random.random",
"paddle.CUDAPlace",
"paddle.enable_static",
"paddle.distributed.models.moe.utils._random_routing",
"paddle.disable_static",
"paddle.to_tensor",
"numpy.random.randint",
"unittest.main",
"paddle.fluid.core.is_compiled... | [((2798, 2820), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (2818, 2820), False, 'import paddle\n'), ((2825, 2840), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2838, 2840), False, 'import unittest\n'), ((1123, 1140), 'numpy.copy', 'np.copy', (['topk_idx'], {}), '(topk_idx)\n', (1130, 1140... |
__author__ = '<NAME>'
import logging
import cv2
import numpy
import sys
from combining_classifications import combine_majority_vote, combine_mean_rule, combine_minimum_rule
from loading_images import load_face_vectors_from_disk, extract_color_channels
from pca import PCA
from plotting import plot_results
def main(... | [
"logging.basicConfig",
"logging.debug",
"loading_images.load_face_vectors_from_disk",
"numpy.random.permutation",
"pca.PCA",
"numpy.equal",
"loading_images.extract_color_channels",
"numpy.count_nonzero",
"numpy.empty",
"plotting.plot_results",
"sys.stdout.flush",
"cv2.waitKey",
"sys.stdout.w... | [((327, 404), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)7s: %(message)s"""', 'level': 'logging.INFO'}), "(format='%(levelname)7s: %(message)s', level=logging.INFO)\n", (346, 404), False, 'import logging\n'), ((857, 945), 'loading_images.load_face_vectors_from_disk', 'load_face_vector... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 22 18:46:12 2021
@author: nkele
"""
import cv2
import numpy as np
import imutils
cap =cv2.VideoCapture("lane_red3.mp4")
cap.set(3,640)
cap.set(4,480)
while(True):
try:
ret, frame= cap.read()
cv2.imshow("origin... | [
"cv2.drawContours",
"numpy.ones",
"cv2.inRange",
"cv2.imshow",
"cv2.contourArea",
"numpy.array",
"cv2.circle",
"imutils.grab_contours",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.moments",
"cv2.findContours",
"cv2.dilate",
"cv2.waitKey"
] | [((147, 180), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""lane_red3.mp4"""'], {}), "('lane_red3.mp4')\n", (163, 180), False, 'import cv2\n'), ((2595, 2618), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (2616, 2618), False, 'import cv2\n'), ((302, 331), 'cv2.imshow', 'cv2.imshow', (['"""original... |
#/usr/bin/env python3
import h5py
import numpy as np
import pybind_isce3 as isce
from iscetest import data as test_data_dir
from pathlib import Path
import json
from ...focus.backproject import load_h5
from pybind_nisar.workflows.point_target_info import (analyze_point_target,
... | [
"pybind_nisar.workflows.point_target_info.analyze_point_target",
"pybind_isce3.container.RadarGeometry",
"pathlib.Path",
"json.dumps",
"numpy.exp",
"numpy.array",
"numpy.empty",
"numpy.linalg.norm",
"pybind_isce3.product.RadarGridParameters",
"pybind_isce3.core.KnabKernel",
"pybind_isce3.cuda.fo... | [((1222, 1272), 'pybind_isce3.core.KnabKernel', 'isce.core.KnabKernel', (['(9.0)', '(B / range_sampling_rate)'], {}), '(9.0, B / range_sampling_rate)\n', (1242, 1272), True, 'import pybind_isce3 as isce\n'), ((1285, 1327), 'pybind_isce3.core.TabulatedKernelF32', 'isce.core.TabulatedKernelF32', (['kernel', '(2048)'], {}... |
"""
This script reproduces Fig. 1 of Izhikevich (2004).
Original implementation references:
Izhikevich E.M. (2004) Which Model to Use for Cortical Spiking Neurons?
IEEE Transactions on Neural Networks, 15:1063-1070 (special issue on temporal coding)
Izhikevich E.M. (2003) Simple Model... | [
"matplotlib.pyplot.show",
"numpy.hstack",
"matplotlib.use",
"pyNN.utility.normalized_filename",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.array",
"numpy.empty",
"numpy.empty_like",
"os.path.dirname",
"pyNN.utility.get_simulator",
... | [((1351, 1372), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1365, 1372), False, 'import matplotlib\n'), ((1539, 1679), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'lines.linewidth': 0.5, 'legend.fontsize': 'small', 'axes.titlesize':\n 'small', 'font.size': 6, 'savefig.d... |
import requests
import re
import time
import datetime
import numpy as np
"""
Prerequisite: Create access tokens
You need private access token to have full access to Github search
API.
Generate your access token in [here](https://github.com/settings/tokens)
you don't need to tick on any access permission because you ar... | [
"numpy.random.choice",
"time.sleep",
"requests.get",
"datetime.timedelta",
"datetime.date",
"datetime.date.today"
] | [((1038, 1068), 'datetime.date', 'datetime.date', (['from_year', '(1)', '(1)'], {}), '(from_year, 1, 1)\n', (1051, 1068), False, 'import datetime\n'), ((641, 668), 'requests.get', 'requests.get', (['*args'], {}), '(*args, **argv)\n', (653, 668), False, 'import requests\n'), ((813, 829), 'time.sleep', 'time.sleep', (['w... |
# The following parts are originally part of scikit-bio, with copyright notice
# as reproduced below. The original COPYING.txt file can be found under
# licenses/scikit-bio.txt.
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distr... | [
"numpy.identity",
"numpy.sqrt",
"composition_stats.ilr_inv",
"composition_stats.alr_inv",
"numpy.testing.assert_allclose",
"numpy.log",
"numpy.column_stack",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"composition_stats._gram_schmidt_basis",
"numpy.sum",
"composition_stats.ilr",
"compositi... | [((1010, 1042), 'numpy.array', 'np.array', (['[[2, 2, 6], [4, 4, 2]]'], {}), '([[2, 2, 6], [4, 4, 2]])\n', (1018, 1042), True, 'import numpy as np\n'), ((1097, 1116), 'numpy.array', 'np.array', (['[2, 2, 6]'], {}), '([2, 2, 6])\n', (1105, 1116), True, 'import numpy as np\n'), ((1140, 1201), 'numpy.array', 'np.array', (... |
import sys, os, fnmatch, csv
import numpy as np
import pandas as pd
from joblib import dump, load
from sklearn.model_selection import train_test_split
from sklearn_rvm import EMRVR
from sklearn.model_selection import RandomizedSearchCV
from scipy.stats import uniform
from sklearn.pipeline import make_pipeline
from sk... | [
"os.listdir",
"sklearn.model_selection.train_test_split",
"sklearn.utils.shuffle",
"sklearn_rvm.EMRVR.fit",
"joblib.dump",
"os.path.join",
"os.getcwd",
"sklearn.preprocessing.StandardScaler",
"numpy.array_split",
"fnmatch.filter",
"sklearn_rvm.EMRVR",
"pandas.concat",
"pandas.read_hdf"
] | [((660, 694), 'os.listdir', 'os.listdir', (['PATH_DATA_PROCESSED_ML'], {}), '(PATH_DATA_PROCESSED_ML)\n', (670, 694), False, 'import sys, os, fnmatch, csv\n'), ((1344, 1361), 'pandas.concat', 'pd.concat', (['frames'], {}), '(frames)\n', (1353, 1361), True, 'import pandas as pd\n'), ((1482, 1543), 'sklearn.model_selecti... |
import sys
import numpy
from PyQt5.QtWidgets import QApplication, QMessageBox
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui, congruence
from oasys.widgets.exchange import DataExchangeObject
from orangecontrib.xoppy.util.xoppy_xraylib_util import cross... | [
"oasys.widgets.gui.widgetBox",
"numpy.log10",
"oasys.widgets.congruence.checkEmptyString",
"orangecontrib.xoppy.util.xoppy_xraylib_util.cross_calc_mix",
"orangecontrib.xoppy.util.xoppy_xraylib_util.cross_calc_nist",
"orangecontrib.xoppy.util.xoppy_xraylib_util.density_element",
"oasys.widgets.congruence... | [((828, 838), 'orangewidget.settings.Setting', 'Setting', (['(2)'], {}), '(2)\n', (835, 838), False, 'from orangewidget.settings import Setting\n'), ((856, 869), 'orangewidget.settings.Setting', 'Setting', (['"""Si"""'], {}), "('Si')\n", (863, 869), False, 'from orangewidget.settings import Setting\n'), ((885, 897), 'o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: hanshengjiang
"""
import numpy as np
#--------------
# auxiliary function
def KLD(p,q):
p = p.ravel()
q = q.ravel()
n = len(p)
s = 0
for i in range(n):
s = s + p[i]*np.log(p[i]/q[i])
return s
#-------------- | [
"numpy.log"
] | [((254, 273), 'numpy.log', 'np.log', (['(p[i] / q[i])'], {}), '(p[i] / q[i])\n', (260, 273), True, 'import numpy as np\n')] |
import mmcv
import numpy as np
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from .recall import eval_recalls
def coco_eval(result_files, result_types, coco, max_dets=(100, 300, 1000)):
for res_type in result_types:
assert res_type in [
'proposal', 'pr... | [
"mmcv.is_str",
"pycocotools.cocoeval.COCOeval",
"pycocotools.coco.COCO",
"mmcv.dump",
"numpy.array",
"numpy.zeros",
"mmcv.load",
"numpy.arange"
] | [((383, 400), 'mmcv.is_str', 'mmcv.is_str', (['coco'], {}), '(coco)\n', (394, 400), False, 'import mmcv\n'), ((1639, 1665), 'numpy.arange', 'np.arange', (['(0.5)', '(0.96)', '(0.05)'], {}), '(0.5, 0.96, 0.05)\n', (1648, 1665), True, 'import numpy as np\n'), ((1676, 1696), 'mmcv.is_str', 'mmcv.is_str', (['results'], {})... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.