code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
from metod_alg import objective_functions as mt_obj
def test_1():
"""Computational test for mt_obj.shekel_function() with d=2."""
p = 3
matrix_test = np.array([[[1, 0],
[0, 1]],
[[1, 0],
[0, 1]],
... | [
"numpy.array",
"metod_alg.objective_functions.shekel_function",
"numpy.round"
] | [((184, 248), 'numpy.array', 'np.array', (['[[[1, 0], [0, 1]], [[1, 0], [0, 1]], [[1, 0], [0, 1]]]'], {}), '([[[1, 0], [0, 1]], [[1, 0], [0, 1]], [[1, 0], [0, 1]]])\n', (192, 248), True, 'import numpy as np\n'), ((397, 433), 'numpy.array', 'np.array', (['[[10, 3, 0.5], [11, 5, 1]]'], {}), '([[10, 3, 0.5], [11, 5, 1]])\... |
import numpy as np
import tensorflow as tf
__author__ = '<NAME>'
def print_metrics_dict(metrics):
for name, val in metrics.items():
print('--------------', name, '--------------')
if isinstance(val, tf.Tensor):
val = val.numpy()
if name == 'confusion':
print(np.arr... | [
"numpy.array2string"
] | [((314, 363), 'numpy.array2string', 'np.array2string', (['val'], {'separator': '""", """', 'precision': '(2)'}), "(val, separator=', ', precision=2)\n", (329, 363), True, 'import numpy as np\n')] |
import matplotlib as mpl
import matplotlib.pyplot as plt
import datetime
import numpy as np
import pandas as pd
import seaborn as sns
import yaml
import math
import os
from skopt.plots import plot_objective
from fbprophet.plot import add_changepoints_to_plot
# Set some matplotlib parameters
mpl.rcParams['figure.figsiz... | [
"fbprophet.plot.add_changepoints_to_plot",
"pandas.read_csv",
"math.sqrt",
"seaborn.violinplot",
"pandas.notnull",
"skopt.plots.plot_objective",
"numpy.round",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gcf",
"seaborn.diverging_palette",
"seaborn.heatmap",
"numpy.ones_like",
"pandas.isn... | [((1068, 1081), 'matplotlib.pyplot.subplot', 'plt.subplot', ([], {}), '()\n', (1079, 1081), True, 'import matplotlib.pyplot as plt\n'), ((2322, 2349), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (2332, 2349), True, 'import matplotlib.pyplot as plt\n'), ((5033, 5077), '... |
# 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... | [
"numpy.zeros",
"numpy.rot90",
"numpy.max"
] | [((2051, 2104), 'numpy.zeros', 'np.zeros', (['(batch, out_channel, out_height, out_width)'], {}), '((batch, out_channel, out_height, out_width))\n', (2059, 2104), True, 'import numpy as np\n'), ((5037, 5090), 'numpy.zeros', 'np.zeros', (['(batch, out_height, out_width, out_channel)'], {}), '((batch, out_height, out_wid... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to implement the network in Google Colab for access to hardware
accelerator i.e. GPUs. With GPUs, the training is accelerated manifold.
@author: rpm1412
"""
#%% Cell 1: Import libraries
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axe... | [
"tensorflow.keras.backend.epsilon",
"tensorflow.keras.layers.Multiply",
"google.colab.drive.mount",
"tensorflow.keras.backend.flatten",
"tensorflow.keras.layers.BatchNormalization",
"numpy.arange",
"tensorflow.keras.layers.Input",
"numpy.reshape",
"tensorflow.keras.layers.Conv2D",
"tensorflow.kera... | [((1858, 1893), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(rows, cols, channels)'}), '(shape=(rows, cols, channels))\n', (1863, 1893), False, 'from tensorflow.keras.layers import Input, Conv2D, Reshape, Multiply, Lambda, BatchNormalization\n'), ((2899, 2939), 'tensorflow.keras.models.Model', 'Model', ([... |
'''
Various types of "assist", i.e. different methods for shared control
between neural control and machine control. Only applies in cases where
some knowledge of the task goals is available.
'''
import numpy as np
from riglib.stereo_opengl import ik
from riglib.bmi import feedback_controllers
import pickle
from ut... | [
"numpy.array",
"riglib.bmi.feedback_controllers.LQRController"
] | [((3812, 3840), 'numpy.array', 'np.array', (['[0, 1, 2, 7, 8, 9]'], {}), '([0, 1, 2, 7, 8, 9])\n', (3820, 3840), True, 'import numpy as np\n'), ((3894, 3932), 'numpy.array', 'np.array', (['[3, 4, 5, 6, 10, 11, 12, 13]'], {}), '([3, 4, 5, 6, 10, 11, 12, 13])\n', (3902, 3932), True, 'import numpy as np\n'), ((5627, 5673)... |
import os
import numpy as np
from typing import List
from paddle.io import Dataset
# The input data bigin with '[CLS]', using '[SEP]' split conversation content(
# Previous part, current part, following part, etc.). If there are multiple
# conversation in split part, using 'INNER_SEP' to further split.
INNER_SEP = '... | [
"numpy.array",
"os.path.join"
] | [((10047, 10082), 'numpy.array', 'np.array', (['label_list'], {'dtype': '"""int64"""'}), "(label_list, dtype='int64')\n", (10055, 10082), True, 'import numpy as np\n'), ((13277, 13312), 'os.path.join', 'os.path.join', (['data_dir', '"""train.txt"""'], {}), "(data_dir, 'train.txt')\n", (13289, 13312), False, 'import os\... |
from IPython.terminal.embed import embed
from numpy.lib.function_base import _angle_dispatcher
import torch
import numpy as np
class AverageValueMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0.0
... | [
"torch.mean",
"numpy.zeros",
"torch.cuda.device_count"
] | [((1419, 1448), 'torch.mean', 'torch.mean', (['((d_fake - 1) ** 2)'], {}), '((d_fake - 1) ** 2)\n', (1429, 1448), False, 'import torch\n'), ((1797, 1820), 'torch.mean', 'torch.mean', (['(d_fake ** 2)'], {}), '(d_fake ** 2)\n', (1807, 1820), False, 'import torch\n'), ((1839, 1868), 'torch.mean', 'torch.mean', (['((d_rea... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 modif... | [
"numpy.sin",
"numpy.exp",
"numpy.cos"
] | [((1331, 1351), 'numpy.cos', 'numpy.cos', (['(theta / 2)'], {}), '(theta / 2)\n', (1340, 1351), False, 'import numpy\n'), ((1392, 1412), 'numpy.sin', 'numpy.sin', (['(theta / 2)'], {}), '(theta / 2)\n', (1401, 1412), False, 'import numpy\n'), ((1460, 1481), 'numpy.exp', 'numpy.exp', (['(1.0j * phi)'], {}), '(1.0j * phi... |
from numbers import Real
from typing import Optional
import numpy as np
import mygrad._utils.graph_tracking as _tracking
from mygrad.operation_base import Operation
from mygrad.tensor_base import Tensor, asarray
from mygrad.typing import ArrayLike
class MarginRanking(Operation):
def __call__(self, x1, x2, y, ma... | [
"numpy.ones_like",
"mygrad.tensor_base.asarray",
"numpy.mean",
"mygrad.tensor_base.Tensor._op",
"numpy.issubdtype"
] | [((2831, 2841), 'mygrad.tensor_base.asarray', 'asarray', (['y'], {}), '(y)\n', (2838, 2841), False, 'from mygrad.tensor_base import Tensor, asarray\n'), ((3125, 3198), 'mygrad.tensor_base.Tensor._op', 'Tensor._op', (['MarginRanking', 'x1', 'x2'], {'op_args': '(y, margin)', 'constant': 'constant'}), '(MarginRanking, x1,... |
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
import numpy as np
import pickle
from prepare_lyft_data_v2 import class2angle, class2size
from model_util import NUM_HEADING_BIN, NUM_SIZE_CLUSTER
from prepare_lyft_data import get_sensor_to_world_transform_matrix_from_sample_data_token, \
convert_box_... | [
"tensorflow.data.TFRecordDataset",
"numpy.copy",
"lyft_dataset_sdk.utils.data_classes.Box",
"lyft_dataset_sdk.utils.data_classes.Quaternion",
"numpy.ones",
"prepare_lyft_data_v2.parse_inference_record",
"pickle.load",
"prepare_lyft_data_v2.class2angle",
"numpy.array",
"prepare_lyft_data.get_sensor... | [((25, 62), 'tensorflow.compat.v1.enable_eager_execution', 'tf.compat.v1.enable_eager_execution', ([], {}), '()\n', (60, 62), True, 'import tensorflow as tf\n'), ((845, 856), 'numpy.copy', 'np.copy', (['pc'], {}), '(pc)\n', (852, 856), True, 'import numpy as np\n'), ((870, 887), 'numpy.cos', 'np.cos', (['rot_angle'], {... |
__author__ = 'sibirrer'
import pytest
import lenstronomy.Util.simulation_util as sim_util
from lenstronomy.ImSim.image_model import ImageModel
import lenstronomy.Util.param_util as param_util
from lenstronomy.PointSource.point_source import PointSource
from lenstronomy.LensModel.lens_model import LensModel
from lenstr... | [
"matplotlib.use",
"numpy.random.random",
"lenstronomy.Plots.chain_plot.plot_mcmc_behaviour",
"lenstronomy.Plots.chain_plot.psf_iteration_compare",
"lenstronomy.Data.psf.PSF",
"matplotlib.pyplot.close",
"pytest.main",
"lenstronomy.Plots.chain_plot.plot_chain",
"lenstronomy.Plots.chain_plot.plot_chain... | [((636, 657), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (650, 657), False, 'import matplotlib\n'), ((3252, 3265), 'pytest.main', 'pytest.main', ([], {}), '()\n', (3263, 3265), False, 'import pytest\n'), ((1094, 1120), 'lenstronomy.Data.psf.PSF', 'PSF', ([], {}), '(**kwargs_psf_gaussian)\n', ... |
from numpy.random.mtrand import RandomState
import numpy as np
from .abstract import Agent
epsilon_greedy_args = {
'epsilon': 0.01,
'random_seed': np.random.randint(2 ** 31 - 1),
# Select an Action that is ABSOLUTELY different to the Action
# that would have been selected in case when Epsilon-Greedy ... | [
"numpy.sum",
"numpy.random.randint",
"numpy.random.mtrand.RandomState",
"numpy.ones"
] | [((157, 187), 'numpy.random.randint', 'np.random.randint', (['(2 ** 31 - 1)'], {}), '(2 ** 31 - 1)\n', (174, 187), True, 'import numpy as np\n'), ((652, 688), 'numpy.random.mtrand.RandomState', 'RandomState', (['self.config.random_seed'], {}), '(self.config.random_seed)\n', (663, 688), False, 'from numpy.random.mtrand ... |
#!/usr/bin/env python3
"""
Compares pairwise performance through independent t-test
of SVM models with different hyperparameters C.
Saves results into `svm_params_ttest.csv` and `svm_params_values.csv`
"""
import argparse
import itertools
from pathlib import Path
import numpy as np
import pandas as pd
from joblib impo... | [
"numpy.mean",
"argparse.ArgumentParser",
"pathlib.Path.cwd",
"utils.ttest_ind_corrected",
"joblib.load",
"numpy.array",
"numpy.std",
"pandas.DataFrame"
] | [((383, 393), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (391, 393), False, 'from pathlib import Path\n'), ((404, 429), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (427, 429), False, 'import argparse\n'), ((1333, 1356), 'numpy.array', 'np.array', (['scores_params'], {}), '(scores_para... |
import gym
from gym import error, spaces, utils
from gym.utils import seeding
import cpufreq
import pyRAPL
import time
import numpy as np
from math import ceil
class FinalEnv02(gym.Env):
### DEFAULT PERSONAL VALUES
DEF_POWER = 65.0
DEF_SOCKET = 0
DEF_CORES = [0,1,2,3,4,5,6,7]
DEF_MAXSTEPS = 20
... | [
"numpy.searchsorted",
"pyRAPL.setup",
"gym.spaces.Discrete",
"time.sleep",
"cpufreq.cpuFreq",
"pyRAPL.Measurement",
"gym.utils.seeding.np_random"
] | [((2521, 2538), 'cpufreq.cpuFreq', 'cpufreq.cpuFreq', ([], {}), '()\n', (2536, 2538), False, 'import cpufreq\n'), ((2811, 2878), 'pyRAPL.setup', 'pyRAPL.setup', ([], {'devices': '[pyRAPL.Device.PKG]', 'socket_ids': '[self.SOCKET]'}), '(devices=[pyRAPL.Device.PKG], socket_ids=[self.SOCKET])\n', (2823, 2878), False, 'imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/1/29 16:03
# @Author : zhuzhaowen
# @email : <EMAIL>
# @File : gen_gif_andvideo.py
# @Software: PyCharm
# @desc : "在当前目录下根据图片自动生成gif 图片与视频"
from PIL import Image
import numpy as np
import imageio
import os
def imgs2mp4(imgs, filename, w, h, fp... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"os.walk",
"os.path.join",
"numpy.array",
"imageio.mimsave",
"pyautogui.confirm",
"imageio.get_writer"
] | [((880, 922), 'imageio.mimsave', 'imageio.mimsave', (['filename_', 'imgs_'], {'fps': 'fps'}), '(filename_, imgs_, fps=fps)\n', (895, 922), False, 'import imageio\n'), ((1000, 1050), 'pyautogui.confirm', 'pyautogui.confirm', (['"""组合当前目录下的jpg 与 png 文件形成gif与mp4"""'], {}), "('组合当前目录下的jpg 与 png 文件形成gif与mp4')\n", (1017, 105... |
import numpy as np
'''
Class that generates potential field given obstacle map.
'''
class PotentialField:
'''
map: Numpy array, 2d or 3d map of obstacles. 1 means obstacle, otherwise, free space.
limits: Dictionary of tuples {xlim: (min, max), ylim: (c, d), zlim: (e, f)}
params: Dictionary of potential... | [
"numpy.fabs",
"numpy.sqrt",
"numpy.array",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.full"
] | [((1700, 1734), 'numpy.full', 'np.full', (['(h, w)', 'UNINITIALIZED_VAL'], {}), '((h, w), UNINITIALIZED_VAL)\n', (1707, 1734), True, 'import numpy as np\n'), ((3647, 3685), 'numpy.zeros', 'np.zeros', (['self.obstacle_dist_map.shape'], {}), '(self.obstacle_dist_map.shape)\n', (3655, 3685), True, 'import numpy as np\n'),... |
###
# Introspective Autoencoder Main training Function
# <NAME>, 2016
import argparse
import imp
import time
import logging
# import sys
# sys.path.insert(0, 'C:\Users\Andy\Generative-and-Discriminative-Voxel-Modeling')
import numpy as np
from path import Path
import theano
import theano.tensor as T
import lasagne
... | [
"theano.tensor.exp",
"theano.tensor.iscalar",
"imp.load_source",
"numpy.array",
"theano.tensor.nnet.softmax",
"theano.tensor.argmax",
"utils.metrics_logging.MetricsLogger",
"theano.tensor.TensorType",
"lasagne.objectives.squared_error",
"logging.info",
"numpy.random.binomial",
"lasagne.layers.... | [((430, 451), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (444, 451), False, 'import matplotlib\n'), ((1069, 1115), 'lasagne.utils.shared_empty', 'lasagne.utils.shared_empty', (['(5)'], {'dtype': '"""float32"""'}), "(5, dtype='float32')\n", (1095, 1115), False, 'import lasagne\n'), ((1175, 122... |
import os
import math
import numpy as np
#import itertools
#import open3d as o3d
# import pandas as pd
# from tqdm import tqdm
# import joblib
# import time
import rosbag
import sensor_msgs.point_cloud2 as pc2
import torch
import yaml
'''
-
name: "x"
offset: 0
datatype: 7
count: 1
-
name: "y"
offset: 4
... | [
"yaml.dump",
"math.asin",
"rosbag.Bag",
"math.cos",
"torch.tensor",
"numpy.array",
"math.atan2",
"math.sin",
"sensor_msgs.point_cloud2.read_points",
"torch.device"
] | [((1089, 1108), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (1101, 1108), False, 'import torch\n'), ((1127, 1187), 'torch.tensor', 'torch.tensor', (['pointcloud'], {'dtype': 'torch.float32', 'device': 'device'}), '(pointcloud, dtype=torch.float32, device=device)\n', (1139, 1187), False, 'import to... |
import copy
import math
import numpy as np
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from paddlenlp.transformers import PretrainedModel, register_base_model
__all__ = [
'NeZhaModel',
"NeZhaPretrainedModel",
'NeZhaForPretraining',
'NeZhaForSequenceClassifica... | [
"paddle.pow",
"paddle.matmul",
"paddle.nn.Tanh",
"paddle.nn.LayerNorm",
"paddle.nn.CrossEntropyLoss",
"math.sqrt",
"paddle.arange",
"paddle.nn.Embedding",
"copy.deepcopy",
"paddle.ones_like",
"paddle.transpose",
"paddle.tile",
"paddle.to_tensor",
"paddle.tensor.matmul",
"paddle.nn.functi... | [((854, 866), 'paddle.nn.functional.sigmoid', 'F.sigmoid', (['x'], {}), '(x)\n', (863, 866), True, 'import paddle.nn.functional as F\n'), ((2227, 2269), 'paddle.nn.Linear', 'nn.Linear', (['hidden_size', 'self.all_head_size'], {}), '(hidden_size, self.all_head_size)\n', (2236, 2269), True, 'import paddle.nn as nn\n'), (... |
# Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2013-2015 SCoT Development Team
import unittest
from importlib import import_module
import numpy as np
from numpy.testing import assert_allclose
import scot
from scot import varica, datatools
from scot.var import VAR
class ... | [
"numpy.random.normal",
"numpy.repeat",
"numpy.arange",
"scot.varica.cspvarica",
"numpy.testing.assert_allclose",
"numpy.array",
"numpy.zeros",
"numpy.var",
"numpy.sum",
"numpy.vstack",
"numpy.random.seed",
"scot.backend.items",
"numpy.transpose",
"scot.varica.mvarica",
"scot.var.VAR"
] | [((904, 922), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (918, 922), True, 'import numpy as np\n'), ((976, 1004), 'numpy.array', 'np.array', (['[[0.0, 0], [0, 0]]'], {}), '([[0.0, 0], [0, 0]])\n', (984, 1004), True, 'import numpy as np\n'), ((1019, 1053), 'numpy.array', 'np.array', (['[[0.5, 0.3],... |
#================================LabFuncs.py===================================#
# Created by <NAME> 2019
# Description:
# Contains an assortment of functions that are all related to the 'Lab' somehow
# e.g. the nuclear form factor, lab velocity etc.
# Contains:
#####
# FormFactorHelm: Only Form factor being used a... | [
"numpy.trapz",
"numpy.sqrt",
"numpy.arccos",
"numpy.size",
"numpy.floor",
"numpy.exp",
"numpy.array",
"numpy.cos",
"numpy.sin",
"numpy.shape"
] | [((3541, 3565), 'numpy.array', 'array', (['[11.1, 12.2, 7.3]'], {}), '([11.1, 12.2, 7.3])\n', (3546, 3565), False, 'from numpy import array, trapz\n'), ((3701, 3736), 'numpy.array', 'np.array', (['[-5.5303, 59.575, 29.812]'], {}), '([-5.5303, 59.575, 29.812])\n', (3709, 3736), True, 'import numpy as np\n'), ((3750, 378... |
#!/usr/bin/python
#-*- coding: utf-8 -*
# SAMPLE FOR SIMPLE CONTROL LOOP TO IMPLEMENT BAXTER_CONTROL MPC ALGORITHMS
"""
MPC sample tracking for Baxter's right limb with specific references.
Authors: <NAME> and <NAME>.
"""
# Built-int imports
import time
import random
# Own imports
import baxter_essentials.baxter_cl... | [
"random.uniform",
"baxter_control.mpc_controller.MpcController",
"numpy.hstack",
"baxter_essentials.transformation.Transformation",
"numpy.array",
"numpy.zeros",
"numpy.concatenate",
"numpy.sin",
"numpy.matrix",
"baxter_essentials.baxter_class.BaxterClass",
"time.time",
"matplotlib.pyplot.subp... | [((787, 821), 'matplotlib.pyplot.subplots', 'plt.subplots', (['x_matrix.shape[0]', '(1)'], {}), '(x_matrix.shape[0], 1)\n', (799, 821), True, 'import matplotlib.pyplot as plt\n'), ((3166, 3229), 'numpy.matrix', 'np.matrix', (['[[0.1], [0.15], [0.2], [0.25], [0.3], [0.35], [0.4]]'], {}), '([[0.1], [0.15], [0.2], [0.25],... |
from __future__ import print_function
import time
import numpy as np
import numpy.random as rnd
from pymanopt import Problem
from pymanopt.solvers.steepest_descent import SteepestDescent
from pymanopt.solvers.solver import Solver
def compute_centroid(man, x):
"""
Compute the centroid as Karcher mean of poi... | [
"pymanopt.Problem",
"pymanopt.solvers.steepest_descent.SteepestDescent",
"numpy.argsort",
"time.time",
"numpy.arange"
] | [((1118, 1145), 'pymanopt.solvers.steepest_descent.SteepestDescent', 'SteepestDescent', ([], {'maxiter': '(15)'}), '(maxiter=15)\n', (1133, 1145), False, 'from pymanopt.solvers.steepest_descent import SteepestDescent\n'), ((1160, 1216), 'pymanopt.Problem', 'Problem', (['man'], {'cost': 'objective', 'grad': 'gradient', ... |
# -*- coding: utf-8 -*-
from ctypes import addressof
import cv2
import numpy as np
import pickle
import requests
import json
import urllib
import hashlib
import urllib.parse
from hashlib import md5
import sys
from xlrd import open_workbook # xlrd用于读取xld
import xlwt # 用于写入xls
import PIL
from PIL import ImageFile
Imag... | [
"matplotlib.pyplot.imshow",
"json.loads",
"pickle.dump",
"xlrd.open_workbook",
"matplotlib.pyplot.imread",
"scipy.interpolate.griddata",
"pickle.load",
"requests.get",
"numpy.array",
"cv2.cvtColor",
"matplotlib.pyplot.pause",
"numpy.zeros_like",
"numpy.round",
"cv2.imread"
] | [((587, 602), 'cv2.imread', 'cv2.imread', (['dir'], {}), '(dir)\n', (597, 602), False, 'import cv2\n'), ((616, 655), 'cv2.cvtColor', 'cv2.cvtColor', (['BJ_map', 'cv2.COLOR_BGR2RGB'], {}), '(BJ_map, cv2.COLOR_BGR2RGB)\n', (628, 655), False, 'import cv2\n'), ((885, 917), 'numpy.zeros_like', 'np.zeros_like', (['a'], {'dty... |
import numpy as np
from hamiltonian import SingleParticle, DiscreteSpace
def test_solver():
import time
# define test parameters
n_eigs = 10
support = (-10, 10)
dtype = np.float64
potential_1d = lambda x: 1 / 2 * x ** 2
opotential_2d = lambda x, y: 1 / 2 * np.add.outer(x ** 2, y ** 2)
... | [
"hamiltonian.DiscreteSpace",
"numpy.add.outer",
"time.time",
"hamiltonian.SingleParticle"
] | [((1080, 1120), 'hamiltonian.DiscreteSpace', 'DiscreteSpace', (['dim', 'support', 'grid', 'dtype'], {}), '(dim, support, grid, dtype)\n', (1093, 1120), False, 'from hamiltonian import SingleParticle, DiscreteSpace\n'), ((1135, 1174), 'hamiltonian.SingleParticle', 'SingleParticle', (['space', 'v'], {'solver': 'solver'})... |
import gfa_reduce.common as common
import numpy as np
import gfa_reduce.analysis.util as util
def adu_to_surface_brightness(sky_adu_1pixel, acttime, extname):
"""
convert from ADU (per pixel) to mag per square asec (AB)
note that this is meant to be applied to an average sky value across
an entire GFA... | [
"gfa_reduce.common.gfa_camera_gain",
"gfa_reduce.common.gfa_misc_params",
"numpy.log10",
"gfa_reduce.analysis.util.nominal_pixel_area_sq_asec"
] | [((502, 526), 'gfa_reduce.common.gfa_misc_params', 'common.gfa_misc_params', ([], {}), '()\n', (524, 526), True, 'import gfa_reduce.common as common\n'), ((553, 593), 'gfa_reduce.analysis.util.nominal_pixel_area_sq_asec', 'util.nominal_pixel_area_sq_asec', (['extname'], {}), '(extname)\n', (584, 593), True, 'import gfa... |
from CNN_architecture import *
from LSTM_NN_architecture import *
import numpy as np
from keras.models import Sequential
from matplotlib import pyplot as plt
from testsets import *
from math import *
import sys
sys.path.insert(0, "../")
class CNN_LSTM_Ensemble():
def __init__(self, cnn_model_weights_file, lstm_model_... | [
"numpy.dstack",
"sys.path.insert",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.argmax",
"keras.models.Sequential",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((211, 236), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (226, 236), False, 'import sys\n'), ((815, 827), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (825, 827), False, 'from keras.models import Sequential\n'), ((1629, 1663), 'numpy.dstack', 'np.dstack', (['(cnn_Y_h... |
"""
Test core functionality of normaliser objects
"""
import numpy
import sys
import unittest
sys.path.append("..")
from nPYc.utilities.normalisation._nullNormaliser import NullNormaliser
from nPYc.utilities.normalisation._totalAreaNormaliser import TotalAreaNormaliser
from nPYc.utilities.normalisation._probabilisti... | [
"nPYc.utilities.normalisation._totalAreaNormaliser.TotalAreaNormaliser",
"numpy.copy",
"numpy.testing.assert_array_almost_equal",
"numpy.median",
"numpy.nanmedian",
"nPYc.utilities.normalisation._nullNormaliser.NullNormaliser",
"numpy.array",
"numpy.random.randint",
"numpy.isfinite",
"unittest.mai... | [((96, 117), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (111, 117), False, 'import sys\n'), ((7176, 7191), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7189, 7191), False, 'import unittest\n'), ((684, 727), 'numpy.random.randint', 'numpy.random.randint', (['(5)'], {'high': '(50)', 'si... |
# -*- coding: utf-8 -*-
"""
Provides common utility functions.
"""
from __future__ import division, print_function
from __future__ import absolute_import, unicode_literals
import inspect
from functools import wraps
import numpy as np
def all_parameters_as_numpy_arrays(fn):
"""Converts all of a function's argument... | [
"numpy.array",
"functools.wraps",
"inspect.getargspec"
] | [((522, 531), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (527, 531), False, 'from functools import wraps\n'), ((1428, 1437), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (1433, 1437), False, 'from functools import wraps\n'), ((1563, 1585), 'inspect.getargspec', 'inspect.getargspec', (['fn'], {}), '(fn)\... |
""" Helper class and functions for loading KITTI objects
Author: <NAME>
Date: September 2017
"""
import os
import sys
import numpy as np
import cv2
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, "mayavi"))
import kitti_util as utils
i... | [
"kitti_util.read_label",
"numpy.hstack",
"kitti_util.load_velo_scan",
"viz_util.draw_lidar",
"os.path.exists",
"kitti_util.load_image",
"os.listdir",
"kitti_util.compute_orientation_3d",
"viz_util.draw_gt_boxes3d",
"numpy.ones",
"os.path.dirname",
"os.path.abspath",
"numpy.copy",
"kitti_ut... | [((216, 241), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (231, 241), False, 'import os\n'), ((178, 203), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (193, 203), False, 'import os\n'), ((258, 290), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mayavi"""'],... |
#!/usr/bin/python3
import os
import sys
import numpy as np
import rospy
import ros_numpy
import tf2_ros
from shapely.geometry import Point
from geometry_msgs.msg import PoseWithCovarianceStamped
from sensor_msgs.msg import PointCloud2
from nav_msgs.msg import Odometry
from darknet_ros_msgs.msg import B... | [
"rospy.logwarn",
"rospy.init_node",
"tf2_ros.StaticTransformBroadcaster",
"numpy.array",
"rospy.Rate",
"numpy.linalg.norm",
"mapless_mcl.hlmap.HLMap",
"helpers.convert.tf_from_arrays",
"nav_msgs.msg.Odometry",
"ros_numpy.numpy_msg",
"rospy.Subscriber",
"rospy.get_param",
"tf2_ros.TransformBr... | [((567, 581), 'rospy.Rate', 'rospy.Rate', (['(10)'], {}), '(10)\n', (577, 581), False, 'import rospy\n'), ((802, 843), 'rospy.init_node', 'rospy.init_node', (['"""mapless_mcl_ros_runner"""'], {}), "('mapless_mcl_ros_runner')\n", (817, 843), False, 'import rospy\n'), ((992, 1021), 'rospy.get_param', 'rospy.get_param', (... |
import numpy as np
#python 3 自动继承object
class GaussianFeatures(object):
"""
Gaussian Features
Parameters
----------
mean: (n_features, ndim) or (n_features,) ndarray
places to locate gaussian function at
var: float
variance of the gaussian function
"""
# python 中 __init__... | [
"numpy.size",
"numpy.asarray",
"numpy.square"
] | [((1528, 1546), 'numpy.size', 'np.size', (['x'], {'axis': '(1)'}), '(x, axis=1)\n', (1535, 1546), True, 'import numpy as np\n'), ((1552, 1580), 'numpy.size', 'np.size', (['self.__mean'], {'axis': '(1)'}), '(self.__mean, axis=1)\n', (1559, 1580), True, 'import numpy as np\n'), ((1717, 1734), 'numpy.asarray', 'np.asarray... |
from mnist import MNIST
import numpy as np
import math
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.metrics import accuracy_score
from collections import Counter
import matplotlib.pyplot as plt
import time
# --------------------------------------------------------
# Global Variables
training... | [
"mnist.MNIST",
"matplotlib.pyplot.savefig",
"time.clock",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"math.sqrt",
"collections.Counter",
"numpy.array",
"numpy.sum",
"numpy.dot",
"numpy.linalg.norm",
... | [((1616, 1659), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Validation Error"""'], {'fontsize': '(14)'}), "('Validation Error', fontsize=14)\n", (1626, 1659), True, 'import matplotlib.pyplot as plt\n'), ((1664, 1692), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""K"""'], {'fontsize': '(14)'}), "('K', fontsize=14)... |
import torch
import os
import argparse
from glob import glob
import soundfile as sf
from torchaudio.compliance.kaldi import mfcc
from osdc.utils.oladd import overlap_add
import numpy as np
from osdc.features.ola_feats import compute_feats_windowed
import yaml
from train import OSDC_AMI
parser = argparse.ArgumentParser... | [
"argparse.ArgumentParser",
"osdc.features.ola_feats.compute_feats_windowed",
"os.makedirs",
"os.path.join",
"yaml.load",
"train.OSDC_AMI",
"torch.from_numpy",
"soundfile.read",
"numpy.save",
"osdc.utils.oladd.overlap_add"
] | [((297, 364), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Single-Channel inference, average logits"""'], {}), "('Single-Channel inference, average logits')\n", (320, 364), False, 'import argparse\n'), ((2214, 2229), 'train.OSDC_AMI', 'OSDC_AMI', (['confs'], {}), '(confs)\n', (2222, 2229), False, 'from t... |
import argparse
import os
import cv2
import csv
import sys
import operator
import numpy as np
import config as cf
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision
from torchvision import datasets, models, transforms
from networks import *
from torch.autograd import Variable
f... | [
"csv.DictWriter",
"cv2.rectangle",
"torch.cuda.is_available",
"sys.exit",
"operator.itemgetter",
"os.path.exists",
"argparse.ArgumentParser",
"cv2.contourArea",
"numpy.exp",
"os.path.isdir",
"torchvision.transforms.ToTensor",
"torch.autograd.Variable",
"csv.reader",
"numpy.ones",
"torchv... | [((361, 446), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Pytorch Cell Classification weight upload"""'}), "(description='Pytorch Cell Classification weight upload'\n )\n", (384, 446), False, 'import argparse\n'), ((1902, 1927), 'torch.cuda.is_available', 'torch.cuda.is_available',... |
import tensorflow as tf
import numpy as np
from nascd.xorandor.load_data import load_data
(x, y), _ = load_data()
class MyModel(tf.keras.Model):
def __init__(self):
super(MyModel, self).__init__()
self.dense1 = tf.keras.layers.Dense(10, activation=tf.nn.relu)
self.dense11 = tf.keras.layer... | [
"numpy.exp",
"numpy.array",
"nascd.xorandor.load_data.load_data",
"tensorflow.keras.layers.Dense"
] | [((103, 114), 'nascd.xorandor.load_data.load_data', 'load_data', ([], {}), '()\n', (112, 114), False, 'from nascd.xorandor.load_data import load_data\n'), ((1183, 1210), 'numpy.array', 'np.array', (['y'], {'dtype': 'np.int32'}), '(y, dtype=np.int32)\n', (1191, 1210), True, 'import numpy as np\n'), ((234, 282), 'tensorf... |
from sklearn.base import BaseEstimator
from sklearn.pipeline import Pipeline
import logging
import numpy as np
def build(bins=10, density=None):
pipeline = Pipeline([('transformer',
SentiWSPolarityDistribution(bins=bins, density=density)),
])
return ('polarit... | [
"logging.getLogger",
"numpy.histogram"
] | [((818, 837), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (835, 837), False, 'import logging\n'), ((1033, 1104), 'numpy.histogram', 'np.histogram', (['all_polarity_values'], {'bins': 'self.bins', 'density': 'self.density'}), '(all_polarity_values, bins=self.bins, density=self.density)\n', (1045, 1104), ... |
import numpy as np
import scipy
from ._simsig_tools import _check_list,_rand_uniform
from ._generator_base import generator_base
#------------------------------------------------------------------------------------
__all__=['harmonics','Harmonics']
#------------------------------------------------------------------... | [
"numpy.asarray",
"numpy.arange",
"numpy.square"
] | [((19060, 19093), 'numpy.asarray', 'np.asarray', (['sig'], {'dtype': 'np.complex'}), '(sig, dtype=np.complex)\n', (19070, 19093), True, 'import numpy as np\n'), ((18916, 18928), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (18925, 18928), True, 'import numpy as np\n'), ((19005, 19017), 'numpy.square', 'np.square'... |
from ...main.CV import BPtCV, CVStrategy
import numpy as np
def test_basic():
try:
from ..BPtLGBM import BPtLGBMClassifier, BPtLGBMRegressor
except:
return
X = np.ones((20, 20))
y = np.ones((20))
y[:10] = 0
# Just shouldn't fail
regr = BPtLGBMRegressor()
regr.fit(X, ... | [
"numpy.ones",
"numpy.arange"
] | [((192, 209), 'numpy.ones', 'np.ones', (['(20, 20)'], {}), '((20, 20))\n', (199, 209), True, 'import numpy as np\n'), ((218, 229), 'numpy.ones', 'np.ones', (['(20)'], {}), '(20)\n', (225, 229), True, 'import numpy as np\n'), ((654, 671), 'numpy.ones', 'np.ones', (['(20, 20)'], {}), '((20, 20))\n', (661, 671), True, 'im... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
# %matplotlib i... | [
"numpy.log10",
"context.plotter.retrieve_G",
"context.network.OutputLayer",
"numpy.log",
"context.network.reset",
"scipy.interpolate.interp1d",
"context.plotter.plot_attributes",
"numpy.sin",
"numpy.arange",
"context.plotter.visualize_network",
"context.network.HiddenLayer",
"context.network.I... | [((1626, 1664), 'context.network.InputLayer', 'nw.InputLayer', ([], {'input_channels': 'channels'}), '(input_channels=channels)\n', (1639, 1664), True, 'from context import network as nw\n'), ((1700, 1799), 'context.network.HiddenLayer', 'nw.HiddenLayer', ([], {'N': '(1)', 'output_channel': '"""blue"""', 'excitation_ch... |
"""
File: figureS01.py
Purpose: Generates figure S01.
Figure S01 analyzes heterogeneous (2 state), uncensored,
single lineages (no more than one lineage per population).
"""
import numpy as np
from .figureCommon import (
getSetup,
subplotLabel,
commonAnalyze,
figureMaker,
pi,
T,
E,
max_... | [
"numpy.linspace"
] | [((485, 559), 'numpy.linspace', 'np.linspace', (['min_desired_num_cells', 'max_desired_num_cells', 'num_data_points'], {}), '(min_desired_num_cells, max_desired_num_cells, num_data_points)\n', (496, 559), True, 'import numpy as np\n')] |
import numpy as np
import torch
import logging
import time
import os
import ujson as json
from config import config
from scripts.config_args import parse_args
from common.dataset.lc_quad import LC_QuAD
from common.dataset.qald_7_ml import Qald_7_ml
from common.model.runner import Runner
np.random.seed(6)
torch.manual... | [
"logging.getLogger",
"torch.manual_seed",
"common.model.runner.Runner",
"scripts.config_args.parse_args",
"logging.StreamHandler",
"common.dataset.lc_quad.LC_QuAD",
"common.dataset.qald_7_ml.Qald_7_ml",
"logging.Formatter",
"ujson.dump",
"os.path.join",
"numpy.random.seed",
"time.time"
] | [((290, 307), 'numpy.random.seed', 'np.random.seed', (['(6)'], {}), '(6)\n', (304, 307), True, 'import numpy as np\n'), ((308, 328), 'torch.manual_seed', 'torch.manual_seed', (['(6)'], {}), '(6)\n', (325, 328), False, 'import torch\n'), ((411, 422), 'time.time', 'time.time', ([], {}), '()\n', (420, 422), False, 'import... |
#!/usr/bin/env python3
# JM: 05 Sep 2018
# plot the eke variable in log scale
# (designed for the GEOMETRIC depth-integrated eddy energy but ok for NEMO
# generated too probably)
# styling is default and this script is intended to be used for quick and dirty
# visualisations
import matplotlib as mpl
mpl.use('agg')... | [
"numpy.log10",
"matplotlib.ticker.FixedLocator",
"argparse.ArgumentParser",
"matplotlib.use",
"netCDF4.Dataset",
"iris.coords.AuxCoord",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.close",
"numpy.sum",
"matplotlib.pyplot.figure",
"sys.exit",
"iris.analysis.cartography.project",
"iris.cu... | [((306, 320), 'matplotlib.use', 'mpl.use', (['"""agg"""'], {}), "('agg')\n", (313, 320), True, 'import matplotlib as mpl\n'), ((1021, 1220), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot the eke variable in log scale with Plate Carree projection\n ... |
from pandas_datareader import DataReader
import numpy as np
import pandas as pd
import datetime
# Grab time series data for 5-year history for the stock (here AAPL)
# and for S&P-500 Index
start_date = datetime.datetime.now() - datetime.timedelta(days=1826)
end_date = datetime.date.today()
stock = 'MSFT'
i... | [
"numpy.mean",
"numpy.sqrt",
"numpy.power",
"pandas_datareader.DataReader",
"datetime.timedelta",
"datetime.datetime.now",
"numpy.cov",
"pandas.DataFrame",
"datetime.date.today"
] | [((278, 299), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (297, 299), False, 'import datetime\n'), ((427, 475), 'pandas_datareader.DataReader', 'DataReader', (['stock', '"""yahoo"""', 'start_date', 'end_date'], {}), "(stock, 'yahoo', start_date, end_date)\n", (437, 475), False, 'from pandas_dataread... |
#!/usr/bin/env python
# mirto_code_main.py
import numpy as np
from scipy.linalg import lu , solve
import cProfile, pstats
import mirto_code_configuration
import mirto_code_compute_F
import sys
import ctypes
# Empty class to store result
class mirto_state:
pass
class mirto_residuals:
pass
class mirto_history:
d... | [
"mirto_code_configuration.mirto_config",
"time.clock",
"numpy.log",
"pylab.xlabel",
"sys.exit",
"mirto_code_configuration.mirto_obsErr",
"sys.path.append",
"StringIO.StringIO",
"ctypes.cdll.LoadLibrary",
"pylab.plot",
"numpy.exp",
"numpy.dot",
"ctypes.c_int",
"cProfile.Profile",
"io.Stri... | [((6345, 6394), 'sys.path.append', 'sys.path.append', (['"""/home/ggiuliani/pythoncode/oss"""'], {}), "('/home/ggiuliani/pythoncode/oss')\n", (6360, 6394), False, 'import sys\n'), ((6860, 6872), 'time.clock', 'time.clock', ([], {}), '()\n', (6870, 6872), False, 'import time\n'), ((586, 638), 'mirto_code_configuration.m... |
import time
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch import nn
from torch.utils.data import TensorDataset, DataLoader
from torchvision.utils import save_image
class Generator(nn.Module):
def __init__(self, n_noise=62, n_disc=10, n_cont=2):
super().__init__()
... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"matplotlib.pyplot.ylabel",
"torch.nn.Sequential",
"torch.max",
"torch.nn.BatchNorm1d",
"torch.cuda.is_available",
"torch.nn.BatchNorm2d",
"torch.nn.Sigmoid",
"torch.unsqueeze",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"torch.eye",
... | [((4852, 4917), 'torch.load', 'torch.load', (['"""E:\\\\研究生文件\\\\Code\\\\GAN\\\\MNIST\\\\processed\\\\training.pt"""'], {}), "('E:\\\\研究生文件\\\\Code\\\\GAN\\\\MNIST\\\\processed\\\\training.pt')\n", (4862, 4917), False, 'import torch\n'), ((4929, 4958), 'torch.unsqueeze', 'torch.unsqueeze', (['source[0]', '(1)'], {}), '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 11 12:50:49 2018
@author: ead2019
"""
def read_txt_file(txtfile):
import numpy as np
lines = []
with open(txtfile, "r") as f:
for line in f:
line = line.strip()
lines.append(line)
... | [
"matplotlib.pyplot.xticks",
"numpy.hstack",
"argparse.ArgumentParser",
"numpy.array",
"matplotlib.pyplot.bar",
"numpy.sum",
"glob.glob",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((327, 342), 'numpy.array', 'np.array', (['lines'], {}), '(lines)\n', (335, 342), True, 'import numpy as np\n'), ((633, 648), 'numpy.array', 'np.array', (['lines'], {}), '(lines)\n', (641, 648), True, 'import numpy as np\n'), ((871, 892), 'numpy.hstack', 'np.hstack', (['classnames'], {}), '(classnames)\n', (880, 892),... |
import os
import cv2
import sys
import pdb
import six
import glob
import time
import torch
import random
import pandas
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
# import pyarrow as pa
from PIL import Image
import torch.utils.data as data
import matplotlib.pyplot... | [
"torch.LongTensor",
"utils.video_augmentation.RandomCrop",
"utils.video_augmentation.TemporalRescale",
"sys.path.append",
"utils.video_augmentation.CenterCrop",
"warnings.simplefilter",
"glob.glob",
"utils.video_augmentation.ToTensor",
"numpy.ceil",
"time.time",
"cv2.imread",
"PIL.Image.open",... | [((136, 198), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (157, 198), False, 'import warnings\n'), ((411, 432), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (426, 432), False, 'im... |
from pyiron_atomistics import Project as PyironProject
import numpy as np
from collections import defaultdict
from spin_space_averaging.sqs import SQSInteractive
from pyiron_contrib.atomistics.atomistics.master.qha import QuasiHarmonicApproximation
def get_bfgs(s, y, H):
dH = np.einsum('...i,...j,...->...ij', *2 ... | [
"numpy.mean",
"numpy.eye",
"numpy.delete",
"numpy.diff",
"numpy.append",
"numpy.sum",
"numpy.array",
"numpy.linalg.inv",
"collections.defaultdict",
"numpy.sign",
"spin_space_averaging.sqs.SQSInteractive",
"numpy.einsum"
] | [((3527, 3723), 'spin_space_averaging.sqs.SQSInteractive', 'SQSInteractive', ([], {'structure': 'self.structure[indices]', 'concentration': '(0.5)', 'cutoff': 'cutoff', 'n_copy': 'n_copy', 'sigma': 'sigma', 'max_sigma': 'max_sigma', 'n_points': 'n_points', 'min_sample_value': 'min_sample_value'}), '(structure=self.stru... |
import numpy as np
import json
from mlflow.models.evaluation import evaluate
from mlflow.models.evaluation.default_evaluator import (
_get_classifier_global_metrics,
_infer_model_type_by_labels,
_extract_raw_model_and_predict_fn,
_get_regressor_metrics,
_get_binary_sum_up_label_pred_prob,
_get... | [
"mlflow.models.evaluation.default_evaluator._get_classifier_per_class_metrics",
"json.loads",
"numpy.allclose",
"numpy.isclose",
"mlflow.models.evaluation.default_evaluator._gen_classifier_curve",
"tests.models.test_evaluation.get_run_data",
"mlflow.models.evaluation.default_evaluator._infer_model_type_... | [((1453, 1482), 'tests.models.test_evaluation.get_run_data', 'get_run_data', (['run.info.run_id'], {}), '(run.info.run_id)\n', (1465, 1482), False, 'from tests.models.test_evaluation import get_run_data, linear_regressor_model_uri, diabetes_dataset, multiclass_logistic_regressor_model_uri, iris_dataset, binary_logistic... |
import skimage.io
import numpy as np
import matplotlib.pyplot as plt
from skimage.segmentation import active_contour
from skimage.filters import gaussian
import load_images
prefix = '../Curated Images/'
images = load_images.images
movie = skimage.io.imread(''.join([prefix,images[0]['filename']]))
img=movie[1,1,:,:]
... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.linspace",
"skimage.segmentation.active_contour",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.show"
] | [((342, 362), 'numpy.array', 'np.array', (['[250, 250]'], {}), '([250, 250])\n', (350, 362), True, 'import numpy as np\n'), ((376, 405), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(50)'], {}), '(0, 2 * np.pi, 50)\n', (387, 405), True, 'import numpy as np\n'), ((477, 576), 'skimage.segmentation.active_con... |
import tensorflow as tf
import numpy as np
import random
from IPython.display import clear_output
import progressbar
import os
from mujoco_py import GlfwContext
class DataCollector:
def __init__(self, id, clientWrapper, agent, environment, action_space_policy, state_policy, reward_policy, path = "/data", cluster ... | [
"os.path.expanduser",
"os.path.exists",
"progressbar.Bar",
"numpy.random.rand",
"os.makedirs",
"numpy.float64",
"os.path.join",
"os.path.realpath",
"numpy.array",
"mujoco_py.GlfwContext",
"progressbar.Percentage",
"numpy.concatenate",
"numpy.load",
"numpy.save"
] | [((1614, 1627), 'numpy.load', 'np.load', (['path'], {}), '(path)\n', (1621, 1627), True, 'import numpy as np\n'), ((1720, 1743), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (1738, 1743), False, 'import os\n'), ((1866, 1894), 'os.path.join', 'os.path.join', (['dir_path', 'path'], {}), '(dir... |
from utils import *
from utils import DatasetFolderV12 as DatasetFolder
import numpy as np
from fastprogress import master_bar,progress_bar
import time
import h5py
import os
import argparse
def write_data(data, filename):
f = h5py.File(filename, 'w', libver='latest')
dset = f.create_dataset('array', shape=(... | [
"os.makedirs",
"argparse.ArgumentParser",
"utils.DatasetFolderV12",
"h5py.File",
"numpy.concatenate",
"numpy.load"
] | [((234, 275), 'h5py.File', 'h5py.File', (['filename', '"""w"""'], {'libver': '"""latest"""'}), "(filename, 'w', libver='latest')\n", (243, 275), False, 'import h5py\n'), ((429, 454), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (452, 454), False, 'import argparse\n'), ((1782, 1884), 'utils.Da... |
import numpy as np
from hypothesis import given, settings, strategies as st
from metod_alg import objective_functions as mt_obj
from metod_alg import metod_algorithm_functions as mt_alg
from metod_alg import check_metod_class as prev_mt_alg
def calc_minimizer_sev_quad(point, p, store_x0, matrix_test):
"""
Fi... | [
"hypothesis.strategies.integers",
"numpy.diag",
"numpy.array",
"numpy.zeros",
"metod_alg.check_metod_class.check_if_new_minimizer",
"hypothesis.settings",
"numpy.random.uniform",
"numpy.argmin",
"numpy.transpose",
"metod_alg.objective_functions.calculate_rotation_matrix"
] | [((1253, 1293), 'hypothesis.settings', 'settings', ([], {'max_examples': '(10)', 'deadline': 'None'}), '(max_examples=10, deadline=None)\n', (1261, 1293), False, 'from hypothesis import given, settings, strategies as st\n'), ((3287, 3327), 'hypothesis.settings', 'settings', ([], {'max_examples': '(10)', 'deadline': 'No... |
import time
import numpy
from mt2 import mt2, mt2_lally
def main():
n1 = 400
n2 = 400
# Make mass_1 vary over the first axis, and mass_2 vary over the second axis
mass_1 = numpy.linspace(1, 200, n1).reshape((-1, 1))
mass_2 = numpy.linspace(1, 200, n2).reshape((1, -1))
# Pre-allocate output... | [
"numpy.testing.assert_array_almost_equal",
"numpy.zeros",
"mt2.mt2",
"numpy.linspace",
"mt2.mt2_lally",
"time.time"
] | [((668, 689), 'numpy.zeros', 'numpy.zeros', (['(n1, n2)'], {}), '((n1, n2))\n', (679, 689), False, 'import numpy\n'), ((706, 727), 'numpy.zeros', 'numpy.zeros', (['(n1, n2)'], {}), '((n1, n2))\n', (717, 727), False, 'import numpy\n'), ((821, 832), 'time.time', 'time.time', ([], {}), '()\n', (830, 832), False, 'import t... |
import unittest
from unittest.mock import Mock, MagicMock, patch, call
import numpy as np
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Molecule, Structure
from pymatgen.core.operations import SymmOp
from bsym.interface.pymatgen import ( unique_symmetry_operations_as_vectors_from_structu... | [
"pymatgen.core.lattice.Lattice.from_parameters",
"bsym.interface.pymatgen.parse_site_distribution",
"unittest.mock.Mock",
"pymatgen.core.structure.Structure",
"bsym.interface.pymatgen.structure_cartesian_coordinates_mapping",
"pymatgen.core.structure.Molecule",
"bsym.interface.pymatgen.new_structure_fro... | [((4590, 4605), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4603, 4605), False, 'import unittest\n'), ((1328, 1406), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0], [0.5, 0.5, 0.0], [0.0, 0.5, 0.5], [0.5, 0.0, 0.5]]'], {}), '([[0.0, 0.0, 0.0], [0.5, 0.5, 0.0], [0.0, 0.5, 0.5], [0.5, 0.0, 0.5]])\n', (1336, 1406... |
import sys
import argparse
import numpy as np
import time
stats_file = 'stats_old.log'
with open(stats_file, 'a') as f_out:
f_out.write(str(sys.argv) + '\n')
time.sleep(0)
runtime = 0
try:
parser = argparse.ArgumentParser()
parser.add_argument('instance',
help='The name of... | [
"numpy.random.normal",
"argparse.ArgumentParser",
"numpy.random.exponential",
"time.sleep",
"numpy.random.seed"
] | [((165, 178), 'time.sleep', 'time.sleep', (['(0)'], {}), '(0)\n', (175, 178), False, 'import time\n'), ((211, 236), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (234, 236), False, 'import argparse\n'), ((2791, 2820), 'numpy.random.seed', 'np.random.seed', (['instance_seed'], {}), '(instance_s... |
import numpy as np
import matplotlib.pyplot as plt
from prefig import Prefig
x = np.linspace(8,10,50)+ np.random.normal(0,0.5, 50)
m, c = 1.5, -3
y = m*x + c + np.random.normal(0,0.5,50)
yerr = np.random.normal(0,0.1,50)
Prefig()
plt.errorbar(x,y, yerr, xerr=None, fmt=' ', marker='D')
plt.plot(x, (m*x+c))
plt.xlabel(... | [
"numpy.random.normal",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"prefig.Prefig",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.errorbar"
] | [((195, 223), 'numpy.random.normal', 'np.random.normal', (['(0)', '(0.1)', '(50)'], {}), '(0, 0.1, 50)\n', (211, 223), True, 'import numpy as np\n'), ((223, 231), 'prefig.Prefig', 'Prefig', ([], {}), '()\n', (229, 231), False, 'from prefig import Prefig\n'), ((232, 288), 'matplotlib.pyplot.errorbar', 'plt.errorbar', ([... |
import pandas as pd
import numpy as np
import gpxpy
import math
import urllib.error
from sharingMobilityAPI import sharingMobilityAroundLocation
from stadtRadApi import amountStadtRadAvailable
class HVVCoordinateMapper:
def __init__(self):
self.df = None
self.stop_to_index = {}
self.lat_lo... | [
"stadtRadApi.amountStadtRadAvailable",
"pandas.read_csv",
"math.isnan",
"numpy.array",
"numpy.linalg.norm",
"sharingMobilityAPI.sharingMobilityAroundLocation",
"gpxpy.parse"
] | [((606, 651), 'pandas.read_csv', 'pd.read_csv', ([], {'filepath_or_buffer': 'file', 'sep': '""","""'}), "(filepath_or_buffer=file, sep=',')\n", (617, 651), True, 'import pandas as pd\n'), ((1940, 1962), 'numpy.array', 'np.array', (['[lat1, lon1]'], {}), '([lat1, lon1])\n', (1948, 1962), True, 'import numpy as np\n'), (... |
'''
20160112 <NAME>
Plot the original Snobal vs pySnobal
'''
import numpy as np
import pandas as pd
# from mpl_toolkits.axes_grid1 import host_subplot
import matplotlib.pyplot as plt
import os
#------------------------------------------------------------------------------
# read the input and output files
output... | [
"numpy.array",
"matplotlib.pyplot.subplots",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((329, 569), 'numpy.array', 'np.array', (["['time_s', 'R_n', 'H', 'L_v_E', 'G', 'M', 'delta_Q', 'G_0', 'delta_Q_0',\n 'cc_s_0', 'cc_s_l', 'cc_s', 'E_s', 'melt', 'ro_predict', 'z_s_0',\n 'z_s_l', 'z_s', 'rho', 'm_s_0', 'm_s_l', 'm_s', 'h2o', 'T_s_0', 'T_s_l',\n 'T_s']"], {}), "(['time_s', 'R_n', 'H', 'L_v_E', ... |
import pandas as pd
import numpy as np
# Loads embeddings stored in Glove-vector text format
def loadEmbeddings(fileName, sep='\t'):
dtFrame = pd.read_csv(fileName, sep=sep, header=None)
words = dtFrame[0].values
dtFrame.drop(0, axis=1, inplace=True)
return words, dtFrame.values.astype(np.float32)
d... | [
"numpy.sum",
"pandas.read_csv"
] | [((149, 192), 'pandas.read_csv', 'pd.read_csv', (['fileName'], {'sep': 'sep', 'header': 'None'}), '(fileName, sep=sep, header=None)\n', (160, 192), True, 'import pandas as pd\n'), ((552, 565), 'numpy.sum', 'np.sum', (['(x * x)'], {}), '(x * x)\n', (558, 565), True, 'import numpy as np\n'), ((586, 599), 'numpy.sum', 'np... |
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import *
from tensorflow.keras.preprocessing import sequence
from tf2bert.layers import MaskedGlobalMaxPooling1D
from tf2bert.text.tokenizers import Tokenizer
from tf2bert.models import build_transformer
im... | [
"tf2bert.layers.MaskedGlobalMaxPooling1D",
"tensorflow.keras.utils.to_categorical",
"tf2bert.text.tokenizers.Tokenizer",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"tf2bert.models.build_transformer",
"tensorflow.keras.optimizers.Adam",
"numpy.random.RandomState",
"tensorflow.keras.models... | [((2917, 2937), 'dataset.load_lcqmc', 'dataset.load_lcqmc', ([], {}), '()\n', (2935, 2937), False, 'import dataset\n'), ((3011, 3058), 'tf2bert.text.tokenizers.Tokenizer', 'Tokenizer', (['token_dict_path'], {'use_lower_case': '(True)'}), '(token_dict_path, use_lower_case=True)\n', (3020, 3058), False, 'from tf2bert.tex... |
from tslearn.utils import to_time_series_dataset
from tslearn.clustering import silhouette_score
import tslearn.clustering as clust
from scipy import signal
import itertools
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from gippy import GeoImage
import gippy.algorithms as alg
import re
from os... | [
"tslearn.clustering.GlobalAlignmentKernelKMeans",
"scipy.signal.savgol_filter",
"numpy.arange",
"pandas.to_datetime",
"os.walk",
"re.search",
"os.listdir",
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.random.seed",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"tslearn.clustering.silh... | [((2237, 2305), 'scipy.signal.savgol_filter', 'signal.savgol_filter', (['x[value]'], {'window_length': 'window', 'polyorder': 'poly'}), '(x[value], window_length=window, polyorder=poly)\n', (2257, 2305), False, 'from scipy import signal\n'), ((5226, 5241), 'pandas.DataFrame', 'pd.DataFrame', (['d'], {}), '(d)\n', (5238... |
import numpy as np
import sys
import time
from sklearn.model_selection import RepeatedKFold
from sklearn.model_selection import GroupKFold
from sklearn.base import BaseEstimator
from scipy.linalg import cholesky, solve_triangular
from sklearn.metrics.pairwise import euclidean_distances
from sklearn.decomposition import... | [
"numpy.argsort",
"numpy.array",
"scipy.linalg.cholesky",
"ml_dft.kernel_functions.RBFKernel",
"numpy.arange",
"numpy.save",
"numpy.mean",
"os.path.exists",
"numpy.repeat",
"sklearn.decomposition.PCA",
"numpy.ix_",
"numpy.dot",
"sklearn.model_selection.GroupKFold",
"numpy.empty",
"scipy.l... | [((559, 582), 'numpy.repeat', 'np.repeat', (['alpha_add', '(2)'], {}), '(alpha_add, 2)\n', (568, 582), True, 'import numpy as np\n'), ((2185, 2216), 'numpy.mean', 'np.mean', (['((y_true - y_pred) ** 2)'], {}), '((y_true - y_pred) ** 2)\n', (2192, 2216), True, 'import numpy as np\n'), ((2353, 2364), 'time.time', 'time.t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
RGB Colourspace Derivation
==========================
Defines objects related to *RGB* colourspace derivation, essentially
calculating the normalised primary matrix for given *RGB* colourspace primaries
and whitepoint.
See Also
--------
`RGB Colourspaces IPython Note... | [
"numpy.dot",
"numpy.linalg.inv",
"numpy.ravel",
"numpy.diagflat",
"numpy.transpose"
] | [((3348, 3371), 'numpy.transpose', 'np.transpose', (['primaries'], {}), '(primaries)\n', (3360, 3371), True, 'import numpy as np\n'), ((3597, 3622), 'numpy.diagflat', 'np.diagflat', (['coefficients'], {}), '(coefficients)\n', (3608, 3622), True, 'import numpy as np\n'), ((3634, 3665), 'numpy.dot', 'np.dot', (['primarie... |
import argparse
import numpy as np
import pandas as pd
import os
import pickle
import langdetect as lang
import time
from datetime import datetime
import json
directory = 'data/twitter'
outfile = 'output.csv'
verbose = False
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('direct... | [
"os.listdir",
"datetime.datetime.fromtimestamp",
"pandas.read_csv",
"argparse.ArgumentParser",
"os.path.join",
"os.path.splitext",
"os.path.split",
"langdetect.detect",
"numpy.array",
"pandas.concat",
"numpy.concatenate",
"json.load",
"time.time"
] | [((263, 288), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (286, 288), False, 'import argparse\n'), ((5899, 5910), 'time.time', 'time.time', ([], {}), '()\n', (5908, 5910), False, 'import time\n'), ((6971, 6992), 'os.path.split', 'os.path.split', (['saveAs'], {}), '(saveAs)\n', (6984, 6992), ... |
import subprocess
import pandas as pd
import io
import random
from multiprocessing import Pool, Value, cpu_count
import time
import os
import json
import numpy as np
PARAM_DIR = "./params"
GENERATION_SIZE = 4*12
MUTATION_SCALE = .5
N_ELITE = 2
POTTS_SEED = 1
CHANGE_POTTS_SEED_PER_GEN = True
GENERATION_NO = 1
np.random... | [
"numpy.mean",
"json.loads",
"numpy.median",
"os.makedirs",
"numpy.random.choice",
"subprocess.Popen",
"numpy.std",
"json.dumps",
"numpy.min",
"multiprocessing.cpu_count",
"numpy.max",
"numpy.random.standard_cauchy",
"numpy.array",
"numpy.random.uniform",
"numpy.random.seed",
"multiproc... | [((311, 337), 'numpy.random.seed', 'np.random.seed', (['POTTS_SEED'], {}), '(POTTS_SEED)\n', (325, 337), True, 'import numpy as np\n'), ((993, 1026), 'numpy.linalg.norm', 'np.linalg.norm', (['(endpos - startpos)'], {}), '(endpos - startpos)\n', (1007, 1026), True, 'import numpy as np\n'), ((1611, 1668), 'subprocess.Pop... |
"""
Implementation of data fuzzification
Author: <NAME> (www.kaizhang.us)
https://github.com/taokz
"""
import numpy as np
from fuzzyset import FuzzySet
from gaussian_mf import gaussmf
import math
class FuzzyData(object):
_data = None
_fuzzydata = None
_epistemic_values = None
_target = None
def __init__(se... | [
"numpy.log",
"fuzzyset.FuzzySet"
] | [((1098, 1176), 'fuzzyset.FuzzySet', 'FuzzySet', ([], {'elements': 'self._data.iloc[j, i]', 'md': 'self._epistemic_values.iloc[j, i]'}), '(elements=self._data.iloc[j, i], md=self._epistemic_values.iloc[j, i])\n', (1106, 1176), False, 'from fuzzyset import FuzzySet\n'), ((781, 790), 'numpy.log', 'np.log', (['(2)'], {}),... |
#!/usr/bin/python3
#log_graph.py
import numpy as np
import matplotlib.pyplot as plt
filename = "data.log"
OFFSET=2
with open(filename) as f:
header = f.readline().split('\t')
data = np.genfromtxt(filename, delimiter='\t', skip_header=1,
names=['sample', 'date', 'DATA0',
... | [
"matplotlib.pyplot.figure",
"numpy.genfromtxt",
"matplotlib.pyplot.show"
] | [((202, 322), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': '"""\t"""', 'skip_header': '(1)', 'names': "['sample', 'date', 'DATA0', 'DATA1', 'DATA2', 'DATA3']"}), "(filename, delimiter='\\t', skip_header=1, names=['sample',\n 'date', 'DATA0', 'DATA1', 'DATA2', 'DATA3'])\n", (215, 322), True, 'imp... |
import numpy as np
import matplotlib.pyplot as plt
from hpe3d.filter import filter_variable
def test_filter_variable():
# Test constant position filtering mode
x1 = np.ones((100, 1), dtype=float)
x1_filt = filter_variable(x1, mode='c')
np.testing.assert_allclose(x1, x1_filt)
# Test constant velo... | [
"numpy.ones",
"numpy.testing.assert_allclose",
"numpy.random.randint",
"hpe3d.filter.filter_variable",
"numpy.arange"
] | [((176, 206), 'numpy.ones', 'np.ones', (['(100, 1)'], {'dtype': 'float'}), '((100, 1), dtype=float)\n', (183, 206), True, 'import numpy as np\n'), ((221, 250), 'hpe3d.filter.filter_variable', 'filter_variable', (['x1'], {'mode': '"""c"""'}), "(x1, mode='c')\n", (236, 250), False, 'from hpe3d.filter import filter_variab... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
from glmatrix import *
import numpy as np
print("#########################################")
#np.set_printoptions(precision=3)
np.set_printoptions(formatter={'float': '{: 8.3f}'.format})
#np.set_printoptions(suppress=True)
location_v = vec3_create([5.0, 6... | [
"numpy.array",
"numpy.set_printoptions"
] | [((191, 250), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'formatter': "{'float': '{: 8.3f}'.format}"}), "(formatter={'float': '{: 8.3f}'.format})\n", (210, 250), True, 'import numpy as np\n'), ((455, 487), 'numpy.array', 'np.array', (['location_m', 'np.float32'], {}), '(location_m, np.float32)\n', (463, 487... |
# ############ Curves, Knots,, Chord Diagrams, Graphs, Polynomials ############
"""
This subsubmodule contains functions dealing with :
Chord diagrams of loops in the plane (for instance coming from knot diagrams)
Interlace graphs of chord diagrams (with orientations and signs)
Graph labeled tree factoris... | [
"numpy.rank"
] | [((3513, 3531), 'numpy.rank', 'np.rank', (['adj_mod_2'], {}), '(adj_mod_2)\n', (3520, 3531), True, 'import numpy as np\n')] |
import numpy as np
import tensorflow as tf
from collections import deque, namedtuple
from typing import Tuple
import random
Transition = namedtuple('Transition',
('actions', 'rewards', 'gradients', 'data', 'targets'))
logs_path = '/tmp/tensorflow_logs/example/'
class ReplayMemory(object):
... | [
"numpy.hstack",
"numpy.array",
"collections.deque",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.concat",
"numpy.vstack",
"tensorflow.layers.dropout",
"tensorflow.matmul",
"tensorflow.get_default_graph",
"numpy.random.normal",
"random.sample",
"collections.namedtuple",
"nump... | [((138, 223), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', "('actions', 'rewards', 'gradients', 'data', 'targets')"], {}), "('Transition', ('actions', 'rewards', 'gradients', 'data', 'targets')\n )\n", (148, 223), False, 'from collections import deque, namedtuple\n'), ((8596, 8647), 'numpy.random.mu... |
from __future__ import annotations
import math
from typing import List, Tuple
import numpy as np
class last_touch:
def __init__(self):
self.location = Vector()
self.normal = Vector()
self.time = -1
self.car = None
def update(self, packet: GameTickPacket):
touch =... | [
"numpy.cross",
"math.cos",
"numpy.array",
"numpy.dot",
"numpy.around",
"numpy.linalg.norm",
"math.sin"
] | [((1354, 1369), 'math.cos', 'math.cos', (['pitch'], {}), '(pitch)\n', (1362, 1369), False, 'import math\n'), ((1383, 1398), 'math.sin', 'math.sin', (['pitch'], {}), '(pitch)\n', (1391, 1398), False, 'import math\n'), ((1412, 1425), 'math.cos', 'math.cos', (['yaw'], {}), '(yaw)\n', (1420, 1425), False, 'import math\n'),... |
import logging
import math
from copy import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import _calculate_fan_in_and_fan_out
def extract_top_level_dict(current_dict):
"""
Builds a graph dictionary from the passed depth_keys, value pair. Useful... | [
"torch.nn.functional.conv2d",
"numpy.prod",
"logging.debug",
"torch.nn.functional.conv1d",
"math.sqrt",
"torch.nn.functional.sigmoid",
"numpy.array",
"torch.sum",
"copy.copy",
"torch.nn.functional.linear",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.nn.init.xavier_uniform_",
"torch.uns... | [((2964, 3000), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['self.weight'], {}), '(self.weight)\n', (2987, 3000), True, 'import torch.nn as nn\n'), ((4068, 4207), 'torch.nn.functional.conv1d', 'F.conv1d', ([], {'input': 'x', 'weight': 'weight', 'bias': 'bias', 'stride': 'self.stride', 'padding': 'self... |
try:
import OpenGL.GL as gl
except:
from galry import log_warn
log_warn(("PyOpenGL is not available and Galry won't be"
" able to render plots."))
class _gl(object):
def mock(*args, **kwargs):
return None
def __getattr__(self, name):
return self.mock
g... | [
"OpenGL.GL.glGetProgramiv",
"numpy.hstack",
"OpenGL.GL.glDeleteProgram",
"OpenGL.GL.glGetString",
"numpy.int32",
"numpy.array",
"OpenGL.GL.glCreateShader",
"OpenGL.GL.glAttachShader",
"OpenGL.GL.glEnableClientState",
"OpenGL.GL.glDepthRange",
"OpenGL.GL.glTexImage2D",
"OpenGL.GL.glViewport",
... | [((75, 153), 'galry.log_warn', 'log_warn', (['"""PyOpenGL is not available and Galry won\'t be able to render plots."""'], {}), '("PyOpenGL is not available and Galry won\'t be able to render plots.")\n', (83, 153), False, 'from galry import log_warn\n'), ((2014, 2032), 'OpenGL.GL.glGenBuffers', 'gl.glGenBuffers', (['(... |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# r... | [
"logging.getLogger",
"art.attacks.evasion.projected_gradient_descent.projected_gradient_descent_numpy.ProjectedGradientDescentNumpy",
"art.attacks.evasion.projected_gradient_descent.projected_gradient_descent_pytorch.ProjectedGradientDescentPyTorch",
"art.attacks.evasion.projected_gradient_descent.projected_g... | [((2413, 2440), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2430, 2440), False, 'import logging\n'), ((5713, 5934), 'art.attacks.evasion.projected_gradient_descent.projected_gradient_descent_pytorch.ProjectedGradientDescentPyTorch', 'ProjectedGradientDescentPyTorch', ([], {'estimator'... |
import matplotlib.pyplot as plt
import os.path
import sys
import logging
import numpy as np
from matplotlib.colors import hsv_to_rgb
from math import ceil
from msemu.cmd import get_parser
from msemu.ila import IlaData
from msemu.verilog import VerilogPackage
from msemu.resources import ResourceCSV, ResourceAllocation,... | [
"logging.basicConfig",
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"math.ceil",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"msemu.resources.Utilization",
"numpy.zeros",
"msemu.cmd.get_parser",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.show"... | [((376, 435), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stderr', 'level': 'logging.DEBUG'}), '(stream=sys.stderr, level=logging.DEBUG)\n', (395, 435), False, 'import logging\n'), ((450, 462), 'msemu.cmd.get_parser', 'get_parser', ([], {}), '()\n', (460, 462), False, 'from msemu.cmd import get_p... |
from typing import Optional, Iterable
import numpy as np
from htm_rl.common.sdr_encoders import SdrConcatenator
from htm_rl.envs.biogwlab.env_shape_params import EnvShapeParams
from htm_rl.envs.biogwlab.module import Entity, EntityType
from htm_rl.envs.biogwlab.view_clipper import ViewClipper, ViewClip
class Render... | [
"numpy.flip",
"numpy.divmod",
"numpy.flatnonzero",
"numpy.array",
"numpy.zeros",
"numpy.empty",
"htm_rl.envs.biogwlab.env_shape_params.EnvShapeParams"
] | [((521, 561), 'htm_rl.envs.biogwlab.env_shape_params.EnvShapeParams', 'EnvShapeParams', (['shape_xy', 'view_rectangle'], {}), '(shape_xy, view_rectangle)\n', (535, 561), False, 'from htm_rl.envs.biogwlab.env_shape_params import EnvShapeParams\n'), ((1853, 1876), 'numpy.array', 'np.array', (['[255, 3, 209]'], {}), '([25... |
# License - for Non-Commercial Research and Educational Use Only
#
# Copyright (c) 2019, Idiap research institute
#
# All rights reserved.
#
# Run, copy, study, change, improve and redistribute source and binary forms, with or without modification, are permitted for non-commercial research and educational use only p... | [
"os.path.exists",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"os.makedirs",
"pyqtgraph.ImageItem",
"numpy.max",
"pyqtgraph.Qt.QtGui.QApplication",
"numpy.dot",
"numpy.zeros",
"numpy.min",
"tifffile.imsave",
"pyqtgraph.GraphicsWindow",
"pyqtgraph.RectROI",
"numpy.arange"
] | [((1974, 1996), 'pyqtgraph.Qt.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (1992, 1996), False, 'from pyqtgraph.Qt import QtGui\n'), ((2117, 2130), 'numpy.min', 'np.min', (['image'], {}), '(image)\n', (2123, 2130), True, 'import numpy as np\n'), ((2240, 2253), 'numpy.max', 'np.max', (['image'], {}... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 17 16:39:49 2019
@Title: FrontierLab exchange program - Metropolis-Hastings source code (for Bayesian Logistic Regression)
@Author: <NAME>
"""
import numpy as np
import copy
import time
from scipy.stats import norm
def expit(z):
return np.exp(z) / (1 + np.exp(z))
cl... | [
"numpy.random.normal",
"numpy.where",
"numpy.log",
"numpy.exp",
"numpy.array",
"numpy.random.uniform",
"scipy.stats.norm.pdf",
"copy.deepcopy",
"time.time"
] | [((289, 298), 'numpy.exp', 'np.exp', (['z'], {}), '(z)\n', (295, 298), True, 'import numpy as np\n'), ((713, 738), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(2)'], {}), '(0, 1, 2)\n', (729, 738), True, 'import numpy as np\n'), ((2174, 2200), 'numpy.array', 'np.array', (['self.all_samples'], {}), '(sel... |
import json
import numpy as np
class Turn:
def __init__(self, turn_id, transcript, turn_label, belief_state, system_acts, system_transcript, asr=None, num=None):
self.id = turn_id
self.transcript = transcript
self.turn_label = turn_label
self.belief_state = belief_state
self... | [
"numpy.mean"
] | [((3147, 3162), 'numpy.mean', 'np.mean', (['inform'], {}), '(inform)\n', (3154, 3162), True, 'import numpy as np\n'), ((3180, 3196), 'numpy.mean', 'np.mean', (['request'], {}), '(request)\n', (3187, 3196), True, 'import numpy as np\n'), ((3212, 3231), 'numpy.mean', 'np.mean', (['joint_goal'], {}), '(joint_goal)\n', (32... |
import argparse
import contextlib
import math
import os
import random
import shutil
import uuid
from pathlib import Path
from typing import Tuple
import cv2
import imageio
import joblib
import numpy as np
from matplotlib import pyplot as plt
from numba import njit, prange
from tqdm import tqdm
# Parameters
brightness... | [
"numpy.clip",
"math.sqrt",
"numba.prange",
"numpy.save",
"os.remove",
"matplotlib.pyplot.imshow",
"argparse.ArgumentParser",
"pathlib.Path",
"matplotlib.pyplot.close",
"shutil.disk_usage",
"numpy.empty",
"random.sample",
"numba.njit",
"uuid.uuid4",
"imageio.imread",
"cv2.resize",
"im... | [((1622, 1641), 'numba.njit', 'njit', ([], {'parallel': '(True)'}), '(parallel=True)\n', (1626, 1641), False, 'from numba import njit, prange\n'), ((3842, 3867), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3865, 3867), False, 'import argparse\n'), ((4132, 4156), 'pathlib.Path', 'Path', (['a... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
# In[8]:
dataset = pd.read_csv("/home/karan/dataset.csv",encoding="ISO-8859-1")
# In[20]:
import nltk
import string
import re
nltk.download('stopwords')
# In[22]:
#REMOVING STOPWORDS AND CONVERTING IN LOWERCASE
def remove_stopwords(row):... | [
"nltk.corpus.stopwords.words",
"pandas.read_csv",
"nltk.download",
"sklearn.feature_extraction.text.CountVectorizer",
"nltk.stem.PorterStemmer",
"gensim.models.Word2Vec",
"sklearn.feature_extraction.text.TfidfVectorizer",
"numpy.array",
"re.sub"
] | [((93, 154), 'pandas.read_csv', 'pd.read_csv', (['"""/home/karan/dataset.csv"""'], {'encoding': '"""ISO-8859-1"""'}), "('/home/karan/dataset.csv', encoding='ISO-8859-1')\n", (104, 154), True, 'import pandas as pd\n'), ((205, 231), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (218, 231... |
#!/usr/bin/env python
from __future__ import division
from numpy import mean, shape, argsort, sort, sum as nsum, delete
from scipy.stats import ttest_1samp
from time import strftime, strptime, struct_time
__author__ = "<NAME>"
__copyright__ = "Copyright 2013, The American Gut Project"
__credits__ = ["<NAME>"]
__licen... | [
"numpy.mean",
"time.strptime",
"numpy.delete",
"numpy.sort",
"time.strftime",
"numpy.argsort",
"numpy.sum",
"scipy.stats.ttest_1samp",
"numpy.shape",
"time.struct_time"
] | [((3147, 3164), 'numpy.shape', 'shape', (['population'], {}), '(population)\n', (3152, 3164), False, 'from numpy import mean, shape, argsort, sort, sum as nsum, delete\n'), ((3497, 3525), 'numpy.sum', 'nsum', (['(population > 0)'], {'axis': '(1)'}), '(population > 0, axis=1)\n', (3501, 3525), True, 'from numpy import m... |
import math
import numpy as np
def absolute(column):
i = 0
column= convert_num_col(column)
result = list()
while i < len(column):
result.insert(i+1,abs(column[i]))
i+=1
return result
def cbrt(column):
i = 0
column= convert_num_col(column)
result = list()
whi... | [
"math.ceil",
"math.floor",
"math.factorial",
"math.gcd",
"math.pow",
"math.degrees",
"math.sqrt",
"math.log",
"math.radians",
"math.trunc",
"numpy.sign",
"math.exp"
] | [((3256, 3271), 'numpy.sign', 'np.sign', (['column'], {}), '(column)\n', (3263, 3271), True, 'import numpy as np\n'), ((4454, 4472), 'math.trunc', 'math.trunc', (['number'], {}), '(number)\n', (4464, 4472), False, 'import math\n'), ((4515, 4542), 'math.trunc', 'math.trunc', (['(number * factor)'], {}), '(number * facto... |
"""Misc functions."""
# Completely based on ClearGrasp utils:
# https://github.com/Shreeyak/cleargrasp/
import cv2
import numpy as np
def _normalize_depth_img(depth_img, dtype=np.uint8, min_depth=0.0,
max_depth=1.0):
"""Convert a floating point depth image to uint8 or uint16 image.
... | [
"cv2.applyColorMap",
"numpy.iinfo",
"numpy.ma.filled",
"numpy.ma.clip",
"cv2.cvtColor",
"numpy.ma.masked_array"
] | [((1139, 1191), 'numpy.ma.masked_array', 'np.ma.masked_array', (['depth_img'], {'mask': '(depth_img == 0.0)'}), '(depth_img, mask=depth_img == 0.0)\n', (1157, 1191), True, 'import numpy as np\n'), ((1210, 1253), 'numpy.ma.clip', 'np.ma.clip', (['depth_img', 'min_depth', 'max_depth'], {}), '(depth_img, min_depth, max_de... |
from __future__ import unicode_literals
import codecs
import numpy
import os
import transaction
from base64 import b64decode
from hashlib import sha1
import itertools
from pyramid_addons.helpers import (http_created, http_gone, http_ok)
from pyramid_addons.validation import (EmailAddress, Enum, List, Or, String,
... | [
"pyramid.view.forbidden_view_config",
"pyramid.httpexceptions.HTTPBadRequest",
"pyramid.httpexceptions.HTTPNotFound",
"zipfile.ZipFile",
"pyramid.view.notfound_view_config",
"pyramid_addons.validation.TextNumber",
"pyramid.httpexceptions.HTTPConflict",
"hashlib.sha1",
"numpy.mean",
"numpy.histogra... | [((2140, 2189), 'pyramid_addons.validation.Enum', 'Enum', (['"""output_source"""', '"""stdout"""', '"""stderr"""', '"""file"""'], {}), "('output_source', 'stdout', 'stderr', 'file')\n", (2144, 2189), False, 'from pyramid_addons.validation import EmailAddress, Enum, List, Or, String, RegexString, TextNumber, WhiteSpaceS... |
import numpy as np
import pytest
from cgn import Parameter
from cgn.regop import MatrixOperator, DiagonalOperator
@pytest.fixture
def x_parameter():
n = 12
beta = 42
mean = np.arange(n)
regop = DiagonalOperator(dim=n, s=np.arange(1, n+1)**2)
x = Parameter(start=np.zeros(n), name="x")
x.beta ... | [
"numpy.eye",
"numpy.ones",
"cgn.regop.MatrixOperator",
"numpy.zeros",
"numpy.arange"
] | [((189, 201), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (198, 201), True, 'import numpy as np\n'), ((515, 526), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (523, 526), True, 'import numpy as np\n'), ((612, 622), 'numpy.ones', 'np.ones', (['n'], {}), '(n)\n', (619, 622), True, 'import numpy as np\n'), ((... |
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
from datetime import datetime
from keras.callbacks import ModelCheckpoint
from auxiliary.data_functions import *
from keras.optimizers import *
from work.stem_classifier.dl_classifier import class_model
# from tqdm import tqdm # this causes p... | [
"logging.getLogger",
"work.stem_classifier.dl_classifier.class_model",
"numpy.reshape",
"keras.callbacks.ModelCheckpoint",
"numpy.argmax",
"keras.preprocessing.image.ImageDataGenerator",
"datetime.datetime.now",
"auxiliary.decorators.Logger_decorator"
] | [((423, 450), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (440, 450), False, 'import logging\n'), ((470, 505), 'auxiliary.decorators.Logger_decorator', 'decorators.Logger_decorator', (['logger'], {}), '(logger)\n', (497, 505), False, 'from auxiliary import decorators\n'), ((3365, 3395)... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 12 10:21:22 2019
@author: GNOS
"""
import numpy as np
def inv_dist_weight(distances, b):
"""Inverse distance weight
Parameters
----------
distances : numpy.array of floats
Distances to point of interest
b : float
The ... | [
"numpy.sum"
] | [((580, 606), 'numpy.sum', 'np.sum', (['(1 / distances ** b)'], {}), '(1 / distances ** b)\n', (586, 606), True, 'import numpy as np\n')] |
import numpy as np
import os
import warnings
# import xml.etree.ElementTree as ET
import glob
import chainer
from chainercv.datasets.voc import voc_utils
from chainercv.utils import read_image
class PTI01BboxDataset(chainer.dataset.DatasetMixin):
def __init__(self, imagespath, labelspath, limit=None):
s... | [
"os.path.join",
"numpy.stack",
"numpy.ndarray",
"chainercv.utils.read_image",
"chainercv.datasets.voc.voc_utils.voc_bbox_label_names.index"
] | [((1821, 1851), 'chainercv.utils.read_image', 'read_image', (['image_'], {'color': '(True)'}), '(image_, color=True)\n', (1831, 1851), False, 'from chainercv.utils import read_image\n'), ((595, 636), 'os.path.join', 'os.path.join', (['self.imagespath', '"""**/*.jpg"""'], {}), "(self.imagespath, '**/*.jpg')\n", (607, 63... |
#!/usr/bin/env python3
import numpy as np
import kaldi
wspecifier = 'ark,scp:/tmp/feats.ark,/tmp/feats.scp'
with kaldi.MatrixWriter(wspecifier) as writer:
m = np.arange(6).reshape(2, 3).astype(np.float32)
writer.Write(key='foo', value=m)
g = kaldi.FloatMatrix(2, 2)
g[0, 0] = 10
g[1, 1] = 20
... | [
"kaldi.FloatMatrix",
"numpy.arange",
"kaldi.MatrixWriter",
"kaldi.SequentialMatrixReader",
"kaldi.RandomAccessMatrixReader"
] | [((116, 146), 'kaldi.MatrixWriter', 'kaldi.MatrixWriter', (['wspecifier'], {}), '(wspecifier)\n', (134, 146), False, 'import kaldi\n'), ((258, 281), 'kaldi.FloatMatrix', 'kaldi.FloatMatrix', (['(2)', '(2)'], {}), '(2, 2)\n', (275, 281), False, 'import kaldi\n'), ((383, 423), 'kaldi.SequentialMatrixReader', 'kaldi.Seque... |
import csv
import numpy as np
from typing import Dict, List
from PyQt5.QtGui import QImage, QColor
import src.core.config as config
def parse(path: str, num_classes: int) -> Dict[int, List[np.ndarray]]:
with open(path, newline='\n') as csv_file:
data_set = prepare_data_set_dict(num_classes)
data_... | [
"numpy.reshape",
"PyQt5.QtGui.QColor",
"numpy.asarray",
"PyQt5.QtGui.QImage",
"csv.reader"
] | [((975, 1010), 'PyQt5.QtGui.QImage', 'QImage', (['(28)', '(28)', 'QImage.Format_RGB32'], {}), '(28, 28, QImage.Format_RGB32)\n', (981, 1010), False, 'from PyQt5.QtGui import QImage, QColor\n'), ((329, 364), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""","""'}), "(csv_file, delimiter=',')\n", (339, 364), ... |
# Get Python six functionality:
from __future__ import absolute_import, division, print_function, unicode_literals
import keras.layers
import keras.models
import numpy as np
import pytest
import innvestigate.tools.perturbate
import innvestigate.utils as iutils
########################################################... | [
"numpy.isclose",
"numpy.array",
"numpy.zeros",
"numpy.moveaxis",
"numpy.arange"
] | [((1506, 1536), 'numpy.array', 'np.array', (['[[1240.0], [3160.0]]'], {}), '([[1240.0], [3160.0]])\n', (1514, 1536), True, 'import numpy as np\n'), ((2209, 2260), 'numpy.array', 'np.array', (['[5761600.0, 1654564.0, 182672.0, 21284.0]'], {}), '([5761600.0, 1654564.0, 182672.0, 21284.0])\n', (2217, 2260), True, 'import ... |
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from collections import deque
import random
import time
import sys
from Models.Networks.SimpleNetwork import Network
from utils.tool import read_config, read_seed
np.random.seed(read_seed())
config = read_config("./Configs/configDQN.ym... | [
"collections.deque",
"utils.tool.read_config",
"numpy.random.choice",
"torch.argmax",
"torch.tensor",
"utils.tool.read_seed",
"numpy.array",
"torch.cuda.is_available",
"numpy.random.uniform",
"Models.Networks.SimpleNetwork.Network"
] | [((285, 323), 'utils.tool.read_config', 'read_config', (['"""./Configs/configDQN.yml"""'], {}), "('./Configs/configDQN.yml')\n", (296, 323), False, 'from utils.tool import read_config, read_seed\n'), ((262, 273), 'utils.tool.read_seed', 'read_seed', ([], {}), '()\n', (271, 273), False, 'from utils.tool import read_conf... |
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=False)
xs = mnist.test.images
ys = mnist.test.labels
np.save('orig_images.npy', xs)
np.save('orig_labels.npy', ys)
| [
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"numpy.save"
] | [((87, 141), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data"""'], {'one_hot': '(False)'}), "('MNIST_data', one_hot=False)\n", (112, 141), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((189, 219), 'numpy.save', 'np.save', (['"""or... |
#Create various plots of chem evo models against data
import numpy as np
import pandas as pd
import math
from astropy.io import fits
from astropy.table import Table
import matplotlib.pyplot as plt
from matplotlib.colors import PowerNorm
import matplotlib.colors as colors
import sys
sys.path.append('./scripts/')
from ch... | [
"numpy.random.normal",
"astropy.table.Table",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.sca",
"matplotlib.pyplot.scatter",
"astropy.io.fits.open",
"matplotlib.colors.LogNorm",
"matplotlib.pyplot.title",
"pandas.isna",
"sys.path.append",
"matplotlib.pyplot.subpl... | [((283, 312), 'sys.path.append', 'sys.path.append', (['"""./scripts/"""'], {}), "('./scripts/')\n", (298, 312), False, 'import sys\n'), ((567, 602), 'astropy.io.fits.open', 'fits.open', (['data_file_1'], {'memmap': '(True)'}), '(data_file_1, memmap=True)\n', (576, 602), False, 'from astropy.io import fits\n'), ((617, 6... |
import numpy as np
from scipy.stats import rankdata
import scipy
from typing import Tuple
def llr_to_p(llr, prior=0.5):
"""
Convert log-likelihood ratios log(p(x|a)/p(x|~a)) to posterior
probabilty p(a|x) given a prior p(a). For unbiased prediction,
leave prior at 0.5
"""
return 1 / (1 + np.e... | [
"numpy.abs",
"scipy.stats.gmean",
"scipy.stats.rankdata",
"numpy.log",
"numpy.exp",
"numpy.array",
"numpy.nanmean",
"numpy.isnan",
"scipy.stats.mannwhitneyu"
] | [((957, 973), 'scipy.stats.rankdata', 'rankdata', (['p_vals'], {}), '(p_vals)\n', (965, 973), False, 'from scipy.stats import rankdata\n'), ((1999, 2019), 'scipy.stats.gmean', 'scipy.stats.gmean', (['x'], {}), '(x)\n', (2016, 2019), False, 'import scipy\n'), ((2824, 2890), 'scipy.stats.mannwhitneyu', 'scipy.stats.mannw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.