code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
import pytest
import shapely
from shapely import GeometryType
from shapely.testing import assert_geometries_equal
from .common import (
empty_polygon,
geometry_collection,
line_string,
linear_ring,
multi_line_string,
multi_point,
multi_polygon,
point,
polygon,
)
... | [
"shapely.get_x",
"numpy.ones",
"pytest.mark.skipif",
"pytest.mark.parametrize",
"shapely.destroy_prepared",
"numpy.full",
"shapely.points",
"shapely.prepare",
"numpy.random.randn",
"shapely.is_empty",
"pytest.raises",
"numpy.swapaxes",
"shapely.get_type_id",
"shapely.box",
"shapely.empty... | [((1111, 1186), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(shapely.geos_version < (3, 10, 0))'], {'reason': '"""GEOS < 3.10"""'}), "(shapely.geos_version < (3, 10, 0), reason='GEOS < 3.10')\n", (1129, 1186), False, 'import pytest\n'), ((2371, 2409), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dim""... |
# -*- coding: utf-8 -*-
import copy
import numpy as np
try:
from scipy.misc import comb
except:
from scipy.special import comb
from Attribute import Angle, Color, Number, Position, Size, Type, Uniformity
from constraints import rule_constraint
class AoTNode(object):
"""Superclass of AoT.
"""
... | [
"copy.deepcopy",
"Attribute.Color",
"Attribute.Type",
"Attribute.Angle",
"scipy.special.comb",
"Attribute.Position",
"Attribute.Number",
"Attribute.Uniformity",
"constraints.rule_constraint",
"numpy.random.choice",
"Attribute.Size"
] | [((2572, 2603), 'numpy.random.choice', 'np.random.choice', (['self.children'], {}), '(self.children)\n', (2588, 2603), True, 'import numpy as np\n'), ((6359, 6390), 'numpy.random.choice', 'np.random.choice', (['self.children'], {}), '(self.children)\n', (6375, 6390), True, 'import numpy as np\n'), ((7662, 7757), 'Attri... |
# coding=utf-8
# Copyright 2022 The Google Research 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... | [
"covid_epidemiology.src.constants.JHU_CONFIRMED_FEATURE_KEY.replace",
"math.isnan",
"pandas.Timestamp",
"covid_epidemiology.src.constants.NYT_DEATH_FEATURE_KEY.replace",
"covid_epidemiology.src.feature_preprocessing.get_all_valid_dates",
"numpy.ones",
"collections.defaultdict",
"logging.info",
"pand... | [((4412, 4439), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (4429, 4439), False, 'import logging\n'), ((5131, 5181), 'logging.info', 'logging.info', (['"""Splicing data by mapping features."""'], {}), "('Splicing data by mapping features.')\n", (5143, 5181), False, 'import logging\n'),... |
from __future__ import absolute_import, print_function, division
import warnings
import numpy as np
from matplotlib.pyplot import Locator
from . import wcs_util
from . import angle_util as au
from . import scalar_util as su
from . import math_util
from .decorators import auto_refresh
class Ticks(object):
@aut... | [
"numpy.sum",
"numpy.isnan",
"numpy.hstack",
"numpy.shape",
"numpy.mod",
"numpy.min",
"numpy.where",
"numpy.array",
"numpy.max",
"numpy.linspace",
"warnings.warn",
"numpy.unique"
] | [((21228, 21283), 'numpy.hstack', 'np.hstack', (['[x_world_1, x_world_2, x_world_3, x_world_4]'], {}), '([x_world_1, x_world_2, x_world_3, x_world_4])\n', (21237, 21283), True, 'import numpy as np\n'), ((21298, 21353), 'numpy.hstack', 'np.hstack', (['[y_world_1, y_world_2, y_world_3, y_world_4]'], {}), '([y_world_1, y_... |
import numpy as np
from unittest import TestCase
from diffprivlib.models.k_means import KMeans
from diffprivlib.utils import global_seed, PrivacyLeakWarning, DiffprivlibCompatibilityWarning, BudgetError
class TestKMeans(TestCase):
def test_not_none(self):
self.assertIsNotNone(KMeans)
def test_simple... | [
"numpy.median",
"numpy.zeros",
"diffprivlib.accountant.BudgetAccountant",
"diffprivlib.utils.global_seed",
"diffprivlib.models.k_means.KMeans",
"numpy.min",
"numpy.random.random",
"numpy.max",
"numpy.array"
] | [((336, 359), 'diffprivlib.utils.global_seed', 'global_seed', (['(3141592653)'], {}), '(3141592653)\n', (347, 359), False, 'from diffprivlib.utils import global_seed, PrivacyLeakWarning, DiffprivlibCompatibilityWarning, BudgetError\n'), ((374, 410), 'diffprivlib.models.k_means.KMeans', 'KMeans', (['(3)'], {'epsilon': '... |
# -*- coding: utf-8 -*-
# File: coco.py
import numpy as np
import os
from termcolor import colored
from tabulate import tabulate
from tensorpack.utils import logger
from tensorpack.utils.rect import FloatBox
from tensorpack.utils.timer import timed_operation
from tensorpack.utils.argtools import log_once
from pycoco... | [
"os.path.isdir",
"numpy.asarray",
"numpy.zeros",
"IPython.embed",
"termcolor.colored",
"pycocotools.coco.COCO",
"os.path.isfile",
"numpy.arange",
"tabulate.tabulate",
"numpy.where",
"numpy.histogram",
"os.path.join"
] | [((7436, 7446), 'IPython.embed', 'IP.embed', ([], {}), '()\n', (7444, 7446), True, 'import IPython as IP\n'), ((1696, 1723), 'os.path.isdir', 'os.path.isdir', (['self._imgdir'], {}), '(self._imgdir)\n', (1709, 1723), False, 'import os\n'), ((1860, 1891), 'os.path.isfile', 'os.path.isfile', (['annotation_file'], {}), '(... |
from mlxtend.data import loadlocal_mnist
from sklearn.multiclass import OneVsRestClassifier
from sklearn.metrics import roc_curve, auc
from sklearn import svm
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from skle... | [
"differential_privacy.dp_sgd.dp_optimizer.dp_optimizer.DPGradientDescentOptimizer",
"tensorflow.zeros_like",
"sklearn.tree.DecisionTreeClassifier",
"tensorflow.train.AdamOptimizer",
"tensorflow.matmul",
"matplotlib.pyplot.figure",
"tensorflow.ConfigProto",
"numpy.arange",
"sklearn.neural_network.MLP... | [((843, 867), 'sys.path.append', 'sys.path.append', (['baseDir'], {}), '(baseDir)\n', (858, 867), False, 'import sys\n'), ((1977, 2039), 'sklearn.metrics.auc', 'auc', (["false_positive_rate['micro']", "true_positive_rate['micro']"], {}), "(false_positive_rate['micro'], true_positive_rate['micro'])\n", (1980, 2039), Fal... |
from abc import ABCMeta, abstractmethod
from tqdm import tqdm
import numpy as np
import copy
import os
class CardiacModel:
"""Base class for electrophysiological models.
Attributes
----------
u : ndarray (or compatible type)
Action potentital array (mV).
dt : float
Time step.
... | [
"copy.deepcopy",
"numpy.ceil",
"os.makedirs",
"numpy.zeros",
"os.path.exists"
] | [((1455, 1490), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'self.npfloat'}), '(shape, dtype=self.npfloat)\n', (1463, 1490), True, 'import numpy as np\n'), ((3142, 3161), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (3155, 3161), False, 'import copy\n'), ((1246, 1266), 'os.path.exists', 'os.path.e... |
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / np.sum(e_x, axis = 0)
def initialize_adam(parameters):
#Function return keys and values:
#Keys : dW1, db1, ..., dWL, dbL
#Values : zeros matrix c... | [
"numpy.max",
"numpy.sum",
"numpy.exp"
] | [((141, 160), 'numpy.sum', 'np.sum', (['e_x'], {'axis': '(0)'}), '(e_x, axis=0)\n', (147, 160), True, 'import numpy as np\n'), ((59, 69), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (65, 69), True, 'import numpy as np\n'), ((112, 121), 'numpy.max', 'np.max', (['x'], {}), '(x)\n', (118, 121), True, 'import numpy as... |
import numpy as np
def deriv(y, x=None):
"""
==================================================================
NOTE!!!!!! The Numdifftools from PyPI may do this a lot faster and more
accurately!!!!
===================================================================
Perform numerical different... | [
"numpy.asarray",
"numpy.zeros_like",
"numpy.array",
"numpy.roll"
] | [((3706, 3726), 'numpy.zeros_like', 'np.zeros_like', (['field'], {}), '(field)\n', (3719, 3726), True, 'import numpy as np\n'), ((4534, 4556), 'numpy.zeros_like', 'np.zeros_like', (['infield'], {}), '(infield)\n', (4547, 4556), True, 'import numpy as np\n'), ((1739, 1770), 'numpy.asarray', 'np.asarray', (['x'], {'dtype... |
# https://math.stackexchange.com/questions/275529/check-if-line-intersects-with-circles-perimeter
# Two points a = (x_a, y_a), b = (x_b, y_b) form a line
# A circle c = (x_c, y_c, r)
# d_x = x_b - x_a
# d_y = y_b - y_a
# d_r = sqrt(d_x^2 + d_y^2)
# D = (x_a * y_b) - (x_b * y_a)
# r^2 = radius of circle squared
... | [
"numpy.dot",
"numpy.array",
"math.sqrt"
] | [((1007, 1028), 'numpy.array', 'numpy.array', (['[x1, y1]'], {}), '([x1, y1])\n', (1018, 1028), False, 'import numpy\n'), ((1048, 1069), 'numpy.array', 'numpy.array', (['[x2, y2]'], {}), '([x2, y2])\n', (1059, 1069), False, 'import numpy\n'), ((1094, 1123), 'numpy.array', 'numpy.array', (['[self.x, self.y]'], {}), '([s... |
import numpy as np
class Dataset(object):
def __init__(self, X, Y, shuffle=True, seed=1337):
self.X = X
self.Y = Y
self.indices = None
def __load_dataset(self, path):
raise NotImplementedError()
@staticmethod
def compute_indices(num_samples, shuffle=True, seed=0):
... | [
"numpy.random.seed",
"numpy.arange",
"numpy.random.shuffle"
] | [((336, 361), 'numpy.arange', 'np.arange', (['(0)', 'num_samples'], {}), '(0, num_samples)\n', (345, 361), True, 'import numpy as np\n'), ((395, 415), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (409, 415), True, 'import numpy as np\n'), ((428, 454), 'numpy.random.shuffle', 'np.random.shuffle', (... |
import itertools
import numpy as np
from sklearn.metrics import precision_recall_fscore_support, accuracy_score, classification_report
import tensorflow as tf
from tensorflow.contrib.rnn import LayerNormBasicLSTMCell
from .data_utils import minibatches, pad_sequences, get_chunks
from .general_utils import Progbar
fro... | [
"tensorflow.trainable_variables",
"tensorflow.contrib.rnn.LayerNormBasicLSTMCell",
"sklearn.metrics.accuracy_score",
"tensorflow.reshape",
"tensorflow.Variable",
"numpy.mean",
"tensorflow.nn.bidirectional_dynamic_rnn",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.nn.rnn_cell... | [((805, 866), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[None, None]', 'name': '"""word_ids"""'}), "(tf.int32, shape=[None, None], name='word_ids')\n", (819, 866), True, 'import tensorflow as tf\n'), ((955, 1018), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[None]',... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import torch
from torchvision import transforms
from torch.autograd import Variable
import cv2
import matplotlib.pyplot as plt
import rospy
from cv_bridge import CvBridge, CvBridgeError
import sys
from sensor_msgs.msg import Image
import numpy as np
class detector():
... | [
"cv_bridge.CvBridge",
"rospy.Subscriber",
"cv2.waitKey",
"torch.autograd.Variable",
"torch.load",
"cv2.destroyAllWindows",
"numpy.zeros",
"rospy.signal_shutdown",
"rospy.loginfo",
"rospy.init_node",
"cv2.rectangle",
"rospy.spin",
"cv2.imshow",
"torch.no_grad",
"torchvision.transforms.ToT... | [((386, 417), 'rospy.init_node', 'rospy.init_node', (['self.node_name'], {}), '(self.node_name)\n', (401, 417), False, 'import rospy\n'), ((508, 518), 'cv_bridge.CvBridge', 'CvBridge', ([], {}), '()\n', (516, 518), False, 'from cv_bridge import CvBridge, CvBridgeError\n'), ((536, 621), 'rospy.Subscriber', 'rospy.Subscr... |
## Problem Set 2
from random import choices
import math
import numpy as np
import statsmodels.api as stat
from scipy import stats
from matplotlib import pyplot as plt
#! Question 1
N=1000 # number of funds
T=120 #number of months
mkt_excess_ret = np.random.normal(0.05/12, 0.2/math.sqrt(12), size=(T)) #each month... | [
"numpy.average",
"math.sqrt",
"statsmodels.api.OLS",
"random.choices",
"numpy.zeros",
"numpy.ones",
"numpy.percentile",
"numpy.sort",
"statsmodels.api.add_constant"
] | [((442, 452), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (449, 452), True, 'import numpy as np\n'), ((546, 557), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (554, 557), True, 'import numpy as np\n'), ((576, 592), 'numpy.zeros', 'np.zeros', (['(T, N)'], {}), '((T, N))\n', (584, 592), True, 'import numpy as np\n... |
#!/usr/bin/env python3
"""Demonstrate how to run the simulated finger with torque control."""
import time
import numpy as np
from trifinger_simulation import SimFinger
if __name__ == "__main__":
finger = SimFinger(
finger_type="fingerone",
enable_visualization=True,
)
# set the finger to ... | [
"numpy.array",
"trifinger_simulation.SimFinger",
"time.sleep"
] | [((211, 272), 'trifinger_simulation.SimFinger', 'SimFinger', ([], {'finger_type': '"""fingerone"""', 'enable_visualization': '(True)'}), "(finger_type='fingerone', enable_visualization=True)\n", (220, 272), False, 'from trifinger_simulation import SimFinger\n'), ((506, 531), 'numpy.array', 'np.array', (['[0.0, 0.3, 0.3... |
from sklearn import preprocessing
from evolving import EvolvingClustering
from evolving.util import Metrics, Benchmarks, load_dataset
import matplotlib.pyplot as plt
import numpy as np
cmap = plt.cm.get_cmap('rainbow')
#X, y = load_dataset.load_dataset("s2")
#X, y = load_dataset.load_dataset("blobs", n_samples=1000, ... | [
"evolving.EvolvingClustering.EvolvingClustering",
"sklearn.preprocessing.scale",
"sklearn.preprocessing.MinMaxScaler",
"evolving.util.load_dataset.load_dataset",
"numpy.array",
"evolving.util.Benchmarks.prequential_evaluation",
"matplotlib.pyplot.cm.get_cmap"
] | [((193, 219), 'matplotlib.pyplot.cm.get_cmap', 'plt.cm.get_cmap', (['"""rainbow"""'], {}), "('rainbow')\n", (208, 219), True, 'import matplotlib.pyplot as plt\n'), ((342, 379), 'evolving.util.load_dataset.load_dataset', 'load_dataset.load_dataset', (['"""gaussian"""'], {}), "('gaussian')\n", (367, 379), False, 'from ev... |
from __future__ import print_function
import os
import numpy as np
from skimage.io import imread
image_rows = int(256)
image_cols = int(256)
image_depth = 16
def create_train_data(options):
train_data_path = options.outputdir+"/train/"
mask_data_path = options.outputdir+'/masks/'
dirs = os.listdir(train... | [
"numpy.save",
"os.path.join",
"os.path.exists",
"numpy.expand_dims",
"numpy.append",
"numpy.array",
"numpy.squeeze",
"numpy.ndarray",
"os.listdir",
"skimage.io.imread"
] | [((304, 331), 'os.listdir', 'os.listdir', (['train_data_path'], {}), '(train_data_path)\n', (314, 331), False, 'import os\n'), ((376, 448), 'numpy.ndarray', 'np.ndarray', (['(total, image_depth, image_rows, image_cols)'], {'dtype': 'np.uint8'}), '((total, image_depth, image_rows, image_cols), dtype=np.uint8)\n', (386, ... |
import os
import yaml
import glob
import pandas as pd
import numpy as np
from typing import List, Tuple
from pytorch_sound.data.dataset import SpeechDataLoader, SpeechDataset
from pytorch_sound.data.meta import MetaFrame, MetaType
# asset directory
from pytorch_sound.data.meta.commons import split_train_val_frame
fro... | [
"pandas.DataFrame",
"numpy.load",
"pytorch_sound.data.meta.commons.split_train_val_frame",
"numpy.zeros_like",
"numpy.sum",
"numpy.save",
"pytorch_sound.data.dataset.SpeechDataLoader",
"os.path.isdir",
"pytorch_sound.data.dataset.SpeechDataset",
"os.path.basename",
"os.path.dirname",
"os.path.... | [((410, 488), 'os.path.join', 'os.path.join', (['__file__', '""".."""', '""".."""', '""".."""', '""".."""', '"""assets"""', '"""medleydb_metafiles"""'], {}), "(__file__, '..', '..', '..', '..', 'assets', 'medleydb_metafiles')\n", (422, 488), False, 'import os\n'), ((4984, 5004), 'os.listdir', 'os.listdir', (['dir_path'... |
import csv
import json
import logging
import os
import pickle
import sys
import time
import urllib
import shutil
import glob
import cv2
import dlib
import imutils
import keras
import librosa
import librosa.display
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas a... | [
"keras.optimizers.Adadelta",
"os.remove",
"urllib.request.Request",
"pandas.read_csv",
"json.dumps",
"cv2.warpAffine",
"matplotlib.pyplot.figure",
"numpy.linalg.svd",
"numpy.rot90",
"pickle.load",
"librosa.power_to_db",
"matplotlib.pyplot.gca",
"imutils.translate",
"numpy.mean",
"shutil.... | [((232, 253), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (246, 253), False, 'import matplotlib\n'), ((664, 683), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (681, 683), False, 'import logging\n'), ((22058, 22078), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n',... |
# ***************************************************************
# Copyright (c) 2020 Jittor. Authors: <NAME> <<EMAIL>>. All Rights Reserved.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ************************************************... | [
"unittest.main",
"jittor.array",
"numpy.abs",
"jittor.abs",
"jittor.float64",
"numpy.array",
"jittor.grad"
] | [((1864, 1879), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1877, 1879), False, 'import unittest\n'), ((1618, 1629), 'jittor.array', 'jt.array', (['b'], {}), '(b)\n', (1626, 1629), True, 'import jittor as jt\n'), ((1686, 1701), 'jittor.grad', 'jt.grad', (['jb', 'ja'], {}), '(jb, ja)\n', (1693, 1701), True, 'im... |
import random
import math
import time
import numpy as np
import matplotlib.pyplot as plt
import read_data
GA_CHOOSE_RATION = 0.1
MUTATE_RATIO = 0.9
POPULATION_SIZE = 100
MAX_ITERATION = 1000
class tspSolutionByGeneticAlgorithm():
def __init__(self, num_city, population_size=50, iteration=100, dat... | [
"read_data.read_tsp",
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf",
"random.sample",
"numpy.zeros",
"time.time",
"numpy.argsort",
"numpy.random.randint",
"numpy.array",
"pdb.set_trace",
"numpy.random.rand",
"matplotlib.pyplot.subplots",
"numpy.vstack"
] | [((11708, 11743), 'read_data.read_tsp', 'read_data.read_tsp', (['"""data/ch30.tsp"""'], {}), "('data/ch30.tsp')\n", (11726, 11743), False, 'import read_data\n'), ((11756, 11770), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (11764, 11770), True, 'import numpy as np\n'), ((11813, 11824), 'time.time', 'time.tim... |
# usage: python tmp/visual_point_cloud.py --config config_file_path
from mmdet3d.datasets import NuScenesDataset
from mmdet3d.datasets import build_dataset
from mmdet3d.models import builder
from mmdet.datasets import build_dataloader
from mmcv import Config, DictAction
import os.path as osp
import argparse
import num... | [
"mmcv.Config.fromfile",
"mmdet3d.models.builder.build_detector",
"numpy.random.seed",
"argparse.ArgumentParser"
] | [((338, 363), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (361, 363), False, 'import argparse\n'), ((452, 469), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (466, 469), True, 'import numpy as np\n'), ((498, 526), 'mmcv.Config.fromfile', 'Config.fromfile', (['args.config'], ... |
import os
import tensorflow as tf
import math
import numpy as np
import pandas as pd
import glob
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
from waymo_open_dataset.protos.scenario_pb2 import Scenario
import matplotlib.patches as patches
import matplotlib.patheffects as path_effects
def... | [
"pandas.DataFrame",
"tensorflow.data.TFRecordDataset",
"os.path.basename",
"pandas.read_csv",
"tensorflow.data.experimental.ignore_errors",
"numpy.mean",
"glob.glob",
"waymo_open_dataset.protos.scenario_pb2.Scenario",
"pandas.concat"
] | [((1043, 1063), 'numpy.mean', 'np.mean', (['line_id_all'], {}), '(line_id_all)\n', (1050, 1063), True, 'import numpy as np\n'), ((1082, 1102), 'numpy.mean', 'np.mean', (['lane_id_all'], {}), '(lane_id_all)\n', (1089, 1102), True, 'import numpy as np\n'), ((1759, 1799), 'pandas.read_csv', 'pd.read_csv', (['filepath_turn... |
import chainer
import chainer.functions as F
from chainer import testing
import numpy as np
import onnx
import pytest
from onnx_chainer import export
from onnx_chainer.testing import input_generator
from tests.helper import ONNXModelChecker
from tests.helper import ONNXModelTest
@testing.parameterize(
# cast
... | [
"onnx_chainer.export",
"chainer.testing.parameterize",
"onnx_chainer.testing.input_generator.increasing",
"numpy.zeros",
"onnx.defs.onnx_opset_version",
"onnx_chainer.replace_func.as_funcnode",
"chainer.functions.permutate",
"pytest.raises",
"chainer.testing.assert_warns",
"numpy.array",
"chaine... | [((11970, 13278), 'chainer.testing.parameterize', 'testing.parameterize', (["{'ops': 'stack', 'in_shapes': [(3, 4), (3, 4)], 'kwargs': {}, 'name':\n 'stack_default'}", "{'ops': 'stack', 'in_shapes': [(3, 4), (3, 4)], 'kwargs': {'axis': 1},\n 'name': 'stack_axis1'}", "{'ops': 'stack', 'in_shapes': [(3, 4), (3, 4)]... |
# -*- coding: utf-8 -*-
"""
Risk Simulation:
Risk is a popular boardgame where players aim to conqure all territories
by building an army and engaging in battles. A battle consists of the
attacker and the defender and is decided by comparing the dice they
rolled.
In each battle, the attacker can ... | [
"numpy.random.randint",
"random.choices",
"time.time"
] | [((1167, 1178), 'time.time', 'time.time', ([], {}), '()\n', (1176, 1178), False, 'import time\n'), ((2261, 2272), 'time.time', 'time.time', ([], {}), '()\n', (2270, 2272), False, 'import time\n'), ((2652, 2663), 'time.time', 'time.time', ([], {}), '()\n', (2661, 2663), False, 'import time\n'), ((2691, 2749), 'numpy.ran... |
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
# Sigmoid function
def sigmoid(Z):
A = 1 / (1 + np.exp(-Z))
return A, Z
# Hyperbolic function
def tanh(Z):
A = np.tanh(Z)
return A, Z
# Rectified Linear unit
def relu(Z):
A = np.maximum(0, Z)
return A, Z
# Leaky... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.tanh",
"matplotlib.pyplot.plot",
"numpy.maximum",
"matplotlib.pyplot.legend",
"numpy.square",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xla... | [((451, 476), 'numpy.linspace', 'np.linspace', (['(-10)', '(10)', '(100)'], {}), '(-10, 10, 100)\n', (462, 476), True, 'import numpy as np\n'), ((629, 656), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 8)'}), '(figsize=(12, 8))\n', (639, 656), True, 'from matplotlib import pyplot as plt\n'), ((657, ... |
from .recordingextractor import RecordingExtractor
from .extraction_tools import check_get_traces_args, cast_start_end_frame, check_get_ttl_args
import numpy as np
# Encapsulates a sub-dataset
class SubRecordingExtractor(RecordingExtractor):
def __init__(self, parent_recording, *, channel_ids=None, renamed_channe... | [
"numpy.array",
"numpy.round"
] | [((3685, 3716), 'numpy.round', 'np.round', (['(time1 - start_time)', '(6)'], {}), '(time1 - start_time, 6)\n', (3693, 3716), True, 'import numpy as np\n'), ((4207, 4233), 'numpy.array', 'np.array', (['reference_frames'], {}), '(reference_frames)\n', (4215, 4233), True, 'import numpy as np\n')] |
import numpy as np
import pandas as pd
from .utility import *
def is_discrete(data):
return all(map(lambda x: float(x).is_integer(), data))
def discretize(data, bins, force=True, exclude=None):
"""
Binning continuous data array to get discrete data array.
:param data: target numpy array
:return: ... | [
"pandas.DataFrame",
"numpy.transpose",
"numpy.zeros",
"numpy.sort",
"numpy.max",
"numpy.min"
] | [((1205, 1255), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'dv', 'columns': 'data.columns.values'}), '(data=dv, columns=data.columns.values)\n', (1217, 1255), True, 'import pandas as pd\n'), ((437, 450), 'numpy.sort', 'np.sort', (['data'], {}), '(data)\n', (444, 450), True, 'import numpy as np\n'), ((469, 490), ... |
import pytest
import numpy
from gym.spaces import Box
from numpy import array
def _(action):
return numpy.linspace(-1, 1, 2 ** 3)[action]
def test_attributes(three_way_daily_percentage_env):
assert three_way_daily_percentage_env.action_space == Box(low=array([[-1] * 3] * 2).reshape(6),
... | [
"numpy.array",
"numpy.ones",
"numpy.linspace"
] | [((106, 135), 'numpy.linspace', 'numpy.linspace', (['(-1)', '(1)', '(2 ** 3)'], {}), '(-1, 1, 2 ** 3)\n', (120, 135), False, 'import numpy\n'), ((804, 828), 'numpy.ones', 'numpy.ones', ([], {'shape': '(2, 3)'}), '(shape=(2, 3))\n', (814, 828), False, 'import numpy\n'), ((904, 1012), 'numpy.array', 'array', (["[['FCB', ... |
# tests.test_target.test_class_balance
# Tests for the ClassBalance visualizer
#
# Author: <NAME> <<EMAIL>>
# Created: Thu Jul 19 10:21:49 2018 -0400
#
# ID: test_class_balance.py [] <EMAIL> $
"""
Tests for the ClassBalance visualizer
"""
##########################################################################
## ... | [
"pandas.DataFrame",
"numpy.random.uniform",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.make_classification",
"tests.dataset.Dataset",
"pytest.raises",
"numpy.random.randint",
"pytest.mark.skipif",
"pandas.Series",
"tests.dataset.Split"
] | [((1526, 1555), 'sklearn.datasets.make_classification', 'make_classification', ([], {}), '(**kwargs)\n', (1545, 1555), False, 'from sklearn.datasets import make_classification\n'), ((1762, 1775), 'tests.dataset.Dataset', 'Dataset', (['X', 'y'], {}), '(X, y)\n', (1769, 1775), False, 'from tests.dataset import DatasetMix... |
import matplotlib; matplotlib.use('Agg')
import torch
import numpy as np
from spirl.utils.general_utils import AttrDict, ParamDict
from spirl.components.params import get_args
from spirl.utils.debug import register_pdb_hook
register_pdb_hook()
from spirl.utils.pytorch_utils import ar2ten, ten2ar
from spirl.fewshot_tr... | [
"imageio.mimsave",
"gym.make",
"numpy.argmin",
"ruamel.yaml.YAML",
"spirl.components.params.get_args",
"time.time",
"pathlib.Path",
"matplotlib.use",
"numpy.array",
"numpy.arange",
"spirl.utils.pytorch_utils.ar2ten",
"torch.Tensor",
"spirl.utils.debug.register_pdb_hook",
"numpy.concatenate... | [((19, 40), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (33, 40), False, 'import matplotlib\n'), ((225, 244), 'spirl.utils.debug.register_pdb_hook', 'register_pdb_hook', ([], {}), '()\n', (242, 244), False, 'from spirl.utils.debug import register_pdb_hook\n'), ((391, 407), 'ruamel.yaml.YAML', ... |
from decimal import Decimal
from glob import glob
from urllib.parse import urlparse
import abc
import os
import re
import yaml
import numpy as np
import rasterio
from opentopodata import utils
CONFIG_PATH = "config.yaml"
EXAMPLE_CONFIG_PATH = "example-config.yaml"
FILENAME_TILE_REGEX = r"^.*?([NS][\dx]+_?[WE][\dx]+)... | [
"numpy.argmin",
"os.path.isfile",
"yaml.safe_load",
"glob.glob",
"os.path.join",
"urllib.parse.urlparse",
"os.path.abspath",
"rasterio.coords.BoundingBox",
"opentopodata.utils.reproject_latlons",
"os.path.exists",
"re.search",
"os.path.basename",
"numpy.asarray",
"re.match",
"rasterio.op... | [((990, 1019), 'os.environ.get', 'os.environ.get', (['"""CONFIG_PATH"""'], {}), "('CONFIG_PATH')\n", (1004, 1019), False, 'import os\n'), ((1248, 1275), 'os.path.exists', 'os.path.exists', (['CONFIG_PATH'], {}), '(CONFIG_PATH)\n', (1262, 1275), False, 'import os\n'), ((5512, 5559), 'rasterio.coords.BoundingBox', 'raste... |
import pandas as pd
import numpy as np
import math
import pdb
def average(series):
return sum(series) / len(series)
"""
implements the average of a pandas series from scratch
suggested functions:
len(list)
sum(list)
you should get the same result as calling .mean() on your series
https... | [
"numpy.sort",
"math.sqrt"
] | [((739, 774), 'math.sqrt', 'math.sqrt', (['(stdsum / (ser_len - 1.0))'], {}), '(stdsum / (ser_len - 1.0))\n', (748, 774), False, 'import math\n'), ((1272, 1287), 'numpy.sort', 'np.sort', (['series'], {}), '(series)\n', (1279, 1287), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 24 17:48:22 2017
@author: lee
"""
import numpy as np
import scipy.linalg as la
import numpy.linalg as na
import os
import aaweights
import sys
def ROPE(S, rho):
p=S.shape[0]
S=S
try:
LM=na.eigh(S)
except:
LM=la.eigh(S)
L=LM[0]
M=LM... | [
"aaweights.read_msa",
"numpy.save",
"aaweights.cal_large_matrix1",
"numpy.power",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.argsort",
"numpy.linalg.eigh",
"numpy.sort",
"numpy.arange",
"scipy.linalg.eigh",
"numpy.dot"
] | [((452, 470), 'numpy.argsort', 'np.argsort', (['(-lamda)'], {}), '(-lamda)\n', (462, 470), True, 'import numpy as np\n'), ((524, 555), 'numpy.dot', 'np.dot', (['M[:, indexlamda]', 'lamda'], {}), '(M[:, indexlamda], lamda)\n', (530, 555), True, 'import numpy as np\n'), ((692, 719), 'numpy.zeros', 'np.zeros', (['[dim * d... |
from typing import List
from codelets.adl.graph import ArchitectureNode, ComputeNode, StorageNode
from codelets.adl import Codelet
from codelets.adl.backups.operand import Datatype
import numpy as np
from itertools import product
from codelets.compiler.transformations.util import factors
def get_compilation_parameter... | [
"codelets.compiler.transformations.util.factors",
"numpy.prod"
] | [((2752, 2762), 'codelets.compiler.transformations.util.factors', 'factors', (['v'], {}), '(v)\n', (2759, 2762), False, 'from codelets.compiler.transformations.util import factors\n'), ((734, 756), 'numpy.prod', 'np.prod', (['hn.dimensions'], {}), '(hn.dimensions)\n', (741, 756), True, 'import numpy as np\n')] |
import os;
import pickle;
import socket;
import numpy as np;
from _thread import start_new_thread;
from keras.models import load_model;
from keras.preprocessing.text import text_to_word_sequence;
DIR=os.getcwd();maxlen=9;maxlenq=10;
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "0.0.0.0";port ... | [
"keras.models.load_model",
"_thread.start_new_thread",
"os.getcwd",
"socket.socket",
"numpy.zeros",
"pickle.load",
"keras.preprocessing.text.text_to_word_sequence"
] | [((200, 211), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (209, 211), False, 'import os\n'), ((248, 297), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (261, 297), False, 'import socket\n'), ((481, 510), 'keras.models.load_model', 'load_model... |
import numpy as np
from zenquant.ctastrategy import (
CtaTemplate,
StopOrder,
TickData,
BarData,
TradeData,
OrderData,
BarGenerator,
)
from zenquant.trader.constant import (
Status,
Direction,
Offset,
Exchange
)
import lightgbm as lgb
from zenquant.trader.ut... | [
"zenquant.feed.data.BarDataFeed",
"zenquant.ctastrategy.BarGenerator",
"numpy.mean",
"numpy.array",
"zenquant.utils.get_indicators_info.get_bar_level_indicator_info"
] | [((1419, 1444), 'zenquant.ctastrategy.BarGenerator', 'BarGenerator', (['self.on_bar'], {}), '(self.on_bar)\n', (1431, 1444), False, 'from zenquant.ctastrategy import CtaTemplate, StopOrder, TickData, BarData, TradeData, OrderData, BarGenerator\n'), ((1465, 1481), 'zenquant.feed.data.BarDataFeed', 'BarDataFeed', (['(500... |
# Example similar to line.py, but demoing special data
# like masked arrays, nans, and inf
import numpy as np
from bokeh.plotting import figure, output_file, show
x = np.linspace(0, 4*np.pi, 200)
y1 = np.sin(x)
y2 = np.cos(x)
# Set high/low values to inf
y1[y1>+0.9] = +np.inf
y1[y1<-0.9] = -np.inf
# Set high value... | [
"bokeh.plotting.figure",
"bokeh.plotting.output_file",
"numpy.sin",
"bokeh.plotting.show",
"numpy.ma.masked_array",
"numpy.cos",
"numpy.linspace"
] | [((170, 200), 'numpy.linspace', 'np.linspace', (['(0)', '(4 * np.pi)', '(200)'], {}), '(0, 4 * np.pi, 200)\n', (181, 200), True, 'import numpy as np\n'), ((204, 213), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (210, 213), True, 'import numpy as np\n'), ((219, 228), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (225, 2... |
"""
Implements the simple black-box attack from
https://github.com/cg563/simple-blackbox-attack/blob/master/simba_single.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import torch as ch
from attacks.blackbox.black_box_attack impo... | [
"numpy.isinf",
"numpy.ones",
"torch.rand",
"torch.zeros",
"numpy.prod"
] | [((1355, 1374), 'numpy.prod', 'np.prod', (['_shape[1:]'], {}), '(_shape[1:])\n', (1362, 1374), True, 'import numpy as np\n'), ((1896, 1915), 'torch.zeros', 'ch.zeros', (['b_sz', 'dim'], {}), '(b_sz, dim)\n', (1904, 1915), True, 'import torch as ch\n'), ((3560, 3573), 'numpy.ones', 'np.ones', (['b_sz'], {}), '(b_sz)\n',... |
import numpy as np
import cv2
import glob
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
filenames = glob.glob(dir_path + '/../data/fisheye_calibration/*.jpg')
images = []
i = 0
# Checkboard dimensions
CHECKERBOARD = (6,9)
subpix_criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.... | [
"numpy.matrix",
"cv2.findChessboardCorners",
"cv2.cvtColor",
"os.path.realpath",
"cv2.fisheye.calibrate",
"numpy.zeros",
"numpy.savetxt",
"cv2.cornerSubPix",
"cv2.imread",
"glob.glob"
] | [((120, 178), 'glob.glob', 'glob.glob', (["(dir_path + '/../data/fisheye_calibration/*.jpg')"], {}), "(dir_path + '/../data/fisheye_calibration/*.jpg')\n", (129, 178), False, 'import glob\n'), ((448, 511), 'numpy.zeros', 'np.zeros', (['(1, CHECKERBOARD[0] * CHECKERBOARD[1], 3)', 'np.float32'], {}), '((1, CHECKERBOARD[0... |
import cv2
import imageio
import glob
import numpy as np
def read_img(name) :
if name.endswith(".gif"):
gif = imageio.mimread(name)
return cv2.cvtColor(gif[0], cv2.COLOR_RGB2BGR)
else :
return cv2.cvtColor(imageio.imread(name), cv2.COLOR_RGB2BGR)
def image_resize(image, width = None,... | [
"cv2.contourArea",
"cv2.minEnclosingCircle",
"cv2.cvtColor",
"imageio.imread",
"numpy.float32",
"cv2.FlannBasedMatcher",
"imageio.mimread",
"cv2.SIFT_create",
"glob.glob",
"cv2.perspectiveTransform",
"cv2.findHomography",
"cv2.resize"
] | [((1077, 1120), 'cv2.resize', 'cv2.resize', (['image', 'dim'], {'interpolation': 'inter'}), '(image, dim, interpolation=inter)\n', (1087, 1120), False, 'import cv2\n'), ((1219, 1246), 'cv2.minEnclosingCircle', 'cv2.minEnclosingCircle', (['pts'], {}), '(pts)\n', (1241, 1246), False, 'import cv2\n'), ((125, 146), 'imagei... |
# import the necessary packages
import csv
import json
import os
import random
import cv2 as cv
import keras.backend as K
import numpy as np
from keras.applications.inception_resnet_v2 import preprocess_input
from config import best_model
from model import build_model
if __name__ == '__main__':
model = build_mod... | [
"keras.applications.inception_resnet_v2.preprocess_input",
"json.dump",
"csv.reader",
"os.makedirs",
"numpy.argmax",
"random.sample",
"model.build_model",
"cv2.cvtColor",
"os.path.exists",
"numpy.expand_dims",
"cv2.imread",
"numpy.max",
"os.path.join",
"os.listdir",
"keras.backend.clear_... | [((311, 324), 'model.build_model', 'build_model', ([], {}), '()\n', (322, 324), False, 'from model import build_model\n'), ((350, 384), 'os.path.join', 'os.path.join', (['"""models"""', 'best_model'], {}), "('models', best_model)\n", (362, 384), False, 'import os\n'), ((877, 916), 'random.sample', 'random.sample', (['t... |
import os
from rbc import errors
import numpy as np
import pytest
rbc_omnisci = pytest.importorskip('rbc.omniscidb')
available_version, reason = rbc_omnisci.is_available()
# Throw an error on Travis CI if the server is not available
if "TRAVIS" in os.environ and not available_version:
pytest.exit(msg=reason, retu... | [
"numpy.sinh",
"pytest.importorskip",
"pytest.exit",
"pytest.fixture",
"pytest.skip",
"numpy.arcsin",
"os.environ.get",
"rbc.utils.get_version",
"pytest.mark.skipif",
"pytest.raises",
"numpy.logaddexp",
"numpy.trunc",
"os.path.join"
] | [((82, 118), 'pytest.importorskip', 'pytest.importorskip', (['"""rbc.omniscidb"""'], {}), "('rbc.omniscidb')\n", (101, 118), False, 'import pytest\n'), ((343, 399), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not available_version)'], {'reason': 'reason'}), '(not available_version, reason=reason)\n', (361, 399), Fa... |
import pandas as pd
import numpy as np
def analyze_tkpm_results(file_dir, output_dir):
machine_legend = pd.read_excel(file_dir, sheet_name="machine_legend", index_col=0)
machine_legend.columns = ["machine_name"]
total_overtime_results = pd.read_excel(file_dir, sheet_name="A")
total_investment_results ... | [
"pandas.DataFrame",
"pandas.read_excel",
"numpy.where",
"pandas.ExcelWriter",
"pandas.concat"
] | [((110, 175), 'pandas.read_excel', 'pd.read_excel', (['file_dir'], {'sheet_name': '"""machine_legend"""', 'index_col': '(0)'}), "(file_dir, sheet_name='machine_legend', index_col=0)\n", (123, 175), True, 'import pandas as pd\n'), ((251, 290), 'pandas.read_excel', 'pd.read_excel', (['file_dir'], {'sheet_name': '"""A"""'... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import random
fig=plt.figure(figsize=(8,6))
plt.plot(X,np.exp(X))
plt.title('Annotating Exponential Plot using plt.annotate()')
plt.xlabel('x-axis')
plt.ylabel('y-axis')
#changing axes limits
plt.ylim(1,8000)
plt.xlim(0,9)
# removing axes from th... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((88, 114), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 6)'}), '(figsize=(8, 6))\n', (98, 114), True, 'import matplotlib.pyplot as plt\n'), ((138, 199), 'matplotlib.pyplot.title', 'plt.title', (['"""Annotating Exponential Plot using plt.annotate()"""'], {}), "('Annotating Exponential Plot using plt... |
def get_3MF_mesh( meshNode, ns):
"""
Extracts the vertex-triangle properties of an 3MF mesh element
meshNode an ElementTree.Element instance
ns is a string->string callable object that converts a local-tag
name to a namespace-qualified QName
returns a dictionay with entries:
poin... | [
"numpy.array"
] | [((848, 866), 'numpy.array', 'array', (['coordinates'], {}), '(coordinates)\n', (853, 866), False, 'from numpy import array, float_, int_\n'), ((1183, 1197), 'numpy.array', 'array', (['indices'], {}), '(indices)\n', (1188, 1197), False, 'from numpy import array, float_, int_\n')] |
#!/usr/bin/env python
try:
from ml_classifiers.srv import *
except:
import roslib;roslib.load_manifest("ml_classifiers")
from ml_classifiers.srv import *
import rospy
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.exter... | [
"sklearn.ensemble.RandomForestClassifier",
"rospy.logerr",
"rospy.loginfo",
"rospy.get_param",
"numpy.array",
"rospy.init_node",
"sklearn.externals.joblib.load",
"rospy.spin",
"rospy.Service",
"roslib.load_manifest"
] | [((1661, 1710), 'rospy.init_node', 'rospy.init_node', (['"""random_forest_cloth_classifier"""'], {}), "('random_forest_cloth_classifier')\n", (1676, 1710), False, 'import rospy\n'), ((91, 129), 'roslib.load_manifest', 'roslib.load_manifest', (['"""ml_classifiers"""'], {}), "('ml_classifiers')\n", (111, 129), False, 'im... |
import os
import numpy as np
from scipy.io import loadmat
from .datasetloader import DatasetLoader
class ChaLearn2013(DatasetLoader):
"""
ChaLearn Looking at People - Gesture Challenge
https://gesture.chalearn.org/2013-multi-modal-challenge/data-2013-challenge
"""
landmarks = [
"pelvis", ... | [
"numpy.array",
"os.path.join",
"os.listdir",
"scipy.io.loadmat"
] | [((2814, 2858), 'os.path.join', 'os.path.join', (['base_dir', "(subset_long + 'data')"], {}), "(base_dir, subset_long + 'data')\n", (2826, 2858), False, 'import os\n'), ((2881, 2903), 'os.listdir', 'os.listdir', (['subset_dir'], {}), '(subset_dir)\n', (2891, 2903), False, 'import os\n'), ((4682, 4699), 'scipy.io.loadma... |
import sys
import re
import random
import numpy as np
import time
DIM = 4
DICE = 'rifobx ifehey denows utoknd hmsrao lupets acitoa ylgkue qbmjoa \
ehispn vetign baliyt ezavnd ralesc uwilrg pacemd'.split()
ALL_WORDS = []
DATAPATH = 'data/words_alpha.txt'
# DATAPATH = 'data/new_dictionary.txt'
try:
TRIALS = int(sy... | [
"random.uniform",
"random.sample",
"re.finditer",
"time.time",
"numpy.exp",
"re.sub",
"re.compile"
] | [((3308, 3337), 'random.sample', 'random.sample', (['DICE', '(DIM ** 2)'], {}), '(DICE, DIM ** 2)\n', (3321, 3337), False, 'import random\n'), ((3447, 3458), 'time.time', 'time.time', ([], {}), '()\n', (3456, 3458), False, 'import time\n'), ((3474, 3485), 'time.time', 'time.time', ([], {}), '()\n', (3483, 3485), False,... |
import numpy as np
from spektral.data.graph import Graph
n_nodes = 5
n_node_features = 4
n_edge_features = 3
n_out = 2
def _check_graph(x, a, e, y):
g = Graph() # Empty graph
g = Graph(x=x) # Only node features
g = Graph(a=a) # Only adjacency
g = Graph(x=x, a=a, e=e, y=y, extra=1) # Complete gra... | [
"numpy.count_nonzero",
"numpy.ones",
"numpy.all",
"spektral.data.graph.Graph"
] | [((161, 168), 'spektral.data.graph.Graph', 'Graph', ([], {}), '()\n', (166, 168), False, 'from spektral.data.graph import Graph\n'), ((192, 202), 'spektral.data.graph.Graph', 'Graph', ([], {'x': 'x'}), '(x=x)\n', (197, 202), False, 'from spektral.data.graph import Graph\n'), ((233, 243), 'spektral.data.graph.Graph', 'G... |
"""
Mask R-CNN
Copyright (c) 2018 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
Train, Detect and Evaluate on a Tabletop dataset
Adapted by <NAME> (<EMAIL>)
------------------------------------------------------------
Usage: import the module (see Jupyter notebooks for ... | [
"argparse.ArgumentParser",
"cv2.VideoWriter_fourcc",
"random.shuffle",
"numpy.ones",
"numpy.mean",
"samples.humanoids_pouring.configurations.YCBVideoConfigTraining",
"samples.humanoids_pouring.datasets.TabletopDataset",
"cv2.rectangle",
"mrcnn.model.MaskRCNN",
"os.path.join",
"imgaug.augmenters.... | [((1266, 1291), 'os.path.abspath', 'os.path.abspath', (['"""../../"""'], {}), "('../../')\n", (1281, 1291), False, 'import os\n'), ((1292, 1317), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (1307, 1317), False, 'import sys\n'), ((1608, 1651), 'os.path.join', 'os.path.join', (['ROOT_DIR', '... |
import sys, os, time
from datetime import datetime
from timeit import default_timer as timer
try:
from humanfriendly import format_timespan
except ImportError:
def format_timespan(seconds):
return "{:.2f} seconds".format(seconds)
import pandas as pd
import numpy as np
from sklearn.model_selection impor... | [
"sys.path.append",
"os.mkdir",
"os.path.abspath",
"humanfriendly.format_timespan",
"argparse.ArgumentParser",
"util.load_spark_session",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"timeit.default_timer",
"os.path.exists",
"numpy.random.RandomState",
"datetime.datetime.now",... | [((340, 361), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (355, 361), False, 'import sys, os, time\n'), ((406, 495), 'util.load_spark_session', 'load_spark_session', ([], {'appName': '"""spark_get_papers_2_degrees_out"""', 'envfile': '"""../spark.env"""'}), "(appName='spark_get_papers_2_degree... |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | [
"torch.flatten",
"torch.nn.MSELoss",
"numpy.random.seed",
"torch.utils.data.DataLoader",
"torch.nn.Linear",
"torchvision.datasets.MNIST",
"collections.OrderedDict",
"os.path.join",
"torchvision.transforms.ToTensor"
] | [((1602, 1622), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1616, 1622), True, 'import numpy as np\n'), ((1635, 1647), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (1645, 1647), False, 'from torch import nn\n'), ((1910, 2005), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Surface preprocessing workflows.
**sMRIPrep** uses FreeSurfer to reconstruct surfaces from T1w/T2w
structural images.
"""
from nipype.pipeline import engine as pe
from nipype.interfaces.base import Un... | [
"nibabel.funcs.concat_images",
"nipype.interfaces.utility.IdentityInterface",
"niworkflows.interfaces.freesurfer.RefineBrainMask",
"nipype.interfaces.freesurfer.Info",
"niworkflows.interfaces.freesurfer.MakeMidthickness",
"niworkflows.interfaces.surf.NormalizeSurf",
"nipype.interfaces.freesurfer.ApplyVo... | [((5466, 5485), 'niworkflows.engine.workflows.LiterateWorkflow', 'Workflow', ([], {'name': 'name'}), '(name=name)\n', (5474, 5485), True, 'from niworkflows.engine.workflows import LiterateWorkflow as Workflow\n'), ((13647, 13666), 'niworkflows.engine.workflows.LiterateWorkflow', 'Workflow', ([], {'name': 'name'}), '(na... |
from data_generate.activitynet_label import (
arv_train_label,
arv_test_label,
arv_val_label,
activitynet_label_list,
)
import json
from allennlp.commands.elmo import ElmoEmbedder
import numpy as np
elmo = ElmoEmbedder()
with open("wordembed_elmo_d1024.json", "w") as f:
_d = dict()
for label in... | [
"numpy.mean",
"json.dump",
"allennlp.commands.elmo.ElmoEmbedder"
] | [((223, 237), 'allennlp.commands.elmo.ElmoEmbedder', 'ElmoEmbedder', ([], {}), '()\n', (235, 237), False, 'from allennlp.commands.elmo import ElmoEmbedder\n'), ((683, 699), 'json.dump', 'json.dump', (['_d', 'f'], {}), '(_d, f)\n', (692, 699), False, 'import json\n'), ((562, 590), 'numpy.mean', 'np.mean', (['vectors[-1]... |
# The following code implements the NP-complete problem 'Traveling Salesman Problem' .
# With dynamic programming approach, the algorithm is able to complete in reasonable time.
import numpy as np
import math
from itertools import combinations
from tqdm.auto import tqdm
def read_file(name):
"""Given the path/name ... | [
"tqdm.auto.tqdm",
"itertools.combinations",
"math.factorial",
"numpy.sqrt"
] | [((743, 791), 'numpy.sqrt', 'np.sqrt', (['((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)'], {}), '((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)\n', (750, 791), True, 'import numpy as np\n'), ((1106, 1126), 'itertools.combinations', 'combinations', (['arr', 'k'], {}), '(arr, k)\n', (1118, 1126), False, 'from itertools import com... |
"""
Suite of functions to prepare HDF5 for
GSLC, GCOV, GUNW, GOFF, RIFG, ROFF, and RUNW
"""
import os
import h5py
import journal
import numpy as np
from osgeo import osr
import isce3
from nisar.h5 import cp_h5_meta_data
from nisar.products.readers import SLC
def get_products_and_paths(cfg: dict) -> (dict, dict):
... | [
"journal.info",
"os.remove",
"h5py.File",
"numpy.abs",
"os.path.basename",
"nisar.products.readers.SLC",
"os.path.dirname",
"isce3.geometry.make_radar_grid_cubes",
"numpy.issubdtype",
"numpy.array",
"h5py.h5t.py_create",
"numpy.linspace",
"numpy.string_",
"nisar.h5.cp_h5_meta_data",
"os.... | [((2864, 2891), 'journal.info', 'journal.info', (['"""h5_prep.run"""'], {}), "('h5_prep.run')\n", (2876, 2891), False, 'import journal\n'), ((4380, 4404), 'nisar.products.readers.SLC', 'SLC', ([], {'hdf5file': 'input_hdf5'}), '(hdf5file=input_hdf5)\n', (4383, 4404), False, 'from nisar.products.readers import SLC\n'), (... |
import numpy as np
import pytest
import os
from tndm.data import DataManager
from tndm.utils import remove_folder, upsert_empty_folder
@pytest.fixture(scope='module')
def tmp_folder():
dir_name = os.path.join('.', 'test', 'data', 'tmp')
upsert_empty_folder(dir_name)
return dir_name
@pytest.fixture(scop... | [
"numpy.random.randn",
"tndm.utils.upsert_empty_folder",
"pytest.fixture",
"pytest.raises",
"tndm.data.DataManager.split_dataset",
"numpy.testing.assert_equal",
"tndm.data.DataManager.load_dataset",
"os.path.join",
"tndm.data.DataManager.store_dataset",
"tndm.utils.remove_folder"
] | [((139, 169), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (153, 169), False, 'import pytest\n'), ((301, 345), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (315, 345), False, 'import pytest\n')... |
import unittest
import os
import numpy as np
import pandas as pd
from photonai_graph.Controllability.controllability_measures import ControllabilityMeasureTransform
class ControllabilityTransformTests(unittest.TestCase):
def setUp(self):
b = np.random.randint(2, size=(20, 20))
b_symm = (b + b.T)... | [
"os.remove",
"pandas.read_csv",
"photonai_graph.Controllability.controllability_measures.ControllabilityMeasureTransform",
"os.path.dirname",
"numpy.shape",
"numpy.random.randint",
"numpy.random.rand",
"numpy.repeat"
] | [((258, 293), 'numpy.random.randint', 'np.random.randint', (['(2)'], {'size': '(20, 20)'}), '(2, size=(20, 20))\n', (275, 293), True, 'import numpy as np\n'), ((429, 458), 'numpy.repeat', 'np.repeat', (['b_symm', '(10)'], {'axis': '(0)'}), '(b_symm, 10, axis=0)\n', (438, 458), True, 'import numpy as np\n'), ((504, 522)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import nibabel as nb
import numpy as np
import transformations as tf
import Trekker
import vtk
import time
def main():
SHOW_AXES = True
AFFINE_IMG = True
NO_SCALE = True
data_dir = b'C:\Users\deoliv1\OneDrive\data\dti'
stl_path = b'wm_orig... | [
"vtk.vtkNamedColors",
"vtk.vtkPoints",
"numpy.linalg.norm",
"os.path.join",
"vtk.vtkPolyDataNormals",
"vtk.vtkPolyDataMapper",
"transformations.decompose_matrix",
"transformations.compose_matrix",
"numpy.identity",
"vtk.vtkSTLReader",
"vtk.vtkActor",
"vtk.vtkUnsignedCharArray",
"vtk.vtkPolyD... | [((356, 388), 'os.path.join', 'os.path.join', (['data_dir', 'stl_path'], {}), '(data_dir, stl_path)\n', (368, 388), False, 'import os\n'), ((489, 521), 'os.path.join', 'os.path.join', (['data_dir', 'stl_path'], {}), '(data_dir, stl_path)\n', (501, 521), False, 'import os\n'), ((575, 607), 'os.path.join', 'os.path.join'... |
import numpy as np
import Operations
import scipy as sc
from scipy import stats
def SB_CoarseGrain(y, howtocg, numGroups):
'''
Coarse-grains a continuous time series to a discrete alphabet
------ Inputs:
y1 : the continuous time series
howtocg : the method of course-graining
... | [
"numpy.floor",
"numpy.zeros",
"numpy.any",
"numpy.diff",
"numpy.linspace",
"numpy.argwhere"
] | [((3797, 3813), 'numpy.any', 'np.any', (['(yth == 0)'], {}), '(yth == 0)\n', (3803, 3813), True, 'import numpy as np\n'), ((1306, 1316), 'numpy.diff', 'np.diff', (['y'], {}), '(y)\n', (1313, 1316), True, 'import numpy as np\n'), ((2629, 2645), 'numpy.zeros', 'np.zeros', (['[N, 1]'], {}), '([N, 1])\n', (2637, 2645), Tru... |
from typing import Optional, Tuple
import numpy as np
import pytest
import torch
from test_env import DummyEnv
from rainy.net import (
CNNBody,
CNNBodyWithoutFC,
GruBlock,
LstmBlock,
actor_critic,
termination_critic,
)
from rainy.net.init import Initializer, kaiming_normal, kaiming_uniform
fro... | [
"rainy.net.init.kaiming_uniform",
"torch.ones",
"rainy.net.termination_critic.tc_fc_shared",
"torch.randn",
"rainy.net.actor_critic.fc_shared",
"rainy.net.actor_critic.conv_shared",
"rainy.utils.Device",
"test_env.DummyEnv",
"rainy.net.CNNBody",
"torch.Size",
"rainy.net.CNNBodyWithoutFC",
"pyt... | [((3308, 3367), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state_dim"""', '[(2, 64, 64), (100,)]'], {}), "('state_dim', [(2, 64, 64), (100,)])\n", (3331, 3367), False, 'import pytest\n'), ((1276, 1286), 'test_env.DummyEnv', 'DummyEnv', ([], {}), '()\n', (1284, 1286), False, 'from test_env import DummyE... |
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import dataclasses
import datetime
import gc
import random
import unittest
from typing import List
import orjson
import psutil
import pytest
try:
import numpy
except ImportError:
numpy = None
FIXTURE = '{"a":[81891289, 8919812.190129012], "b": false, "c": null,... | [
"psutil.Process",
"random.randint",
"orjson.loads",
"gc.collect",
"pytest.mark.skipif",
"orjson.dumps",
"numpy.random.rand",
"datetime.datetime.now"
] | [((3464, 3530), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(numpy is None)'], {'reason': '"""numpy is not installed"""'}), "(numpy is None, reason='numpy is not installed')\n", (3482, 3530), False, 'import pytest\n'), ((1014, 1030), 'psutil.Process', 'psutil.Process', ([], {}), '()\n', (1028, 1030), False, 'import ... |
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2020 <NAME> <<EMAIL>>
#
# @file mnist_Keras.py
# @date 13 July 2020
# @brief This is Simple Classification Example using Keras
# @see https://github.com/nnstreamer/nntrainer
# @author <NAME> <<EMAIL>>
# @bug No known bugs except for NYI it... | [
"tensorflow.keras.initializers.Zeros",
"numpy.random.seed",
"dataset.load_data",
"tensorflow.keras.losses.CategoricalCrossentropy",
"tensorflow.keras.models.Sequential",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.keras.layers.Flatten",
"tensorflow.nn.softmax",
"numpy.set_printo... | [((965, 1007), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (984, 1007), True, 'import numpy as np\n'), ((1016, 1050), 'tensorflow.compat.v1.reset_default_graph', 'tf.compat.v1.reset_default_graph', ([], {}), '()\n', (1048, 1050), True, 'import tensor... |
import os
import cv2
import numpy as np
import PIL.Image
import shutil
from utils.color_conversion import to_single_rgb, to_single_gray, rb_swap
try: # Python 2
from cStringIO import StringIO as BytesIO
except: # Python 3
from io import BytesIO
# should add code to automatically scale 0-1 to 0-255
def ims... | [
"io.BytesIO",
"cv2.imwrite",
"utils.color_conversion.to_single_rgb",
"numpy.clip",
"cv2.blur",
"utils.color_conversion.rb_swap",
"cv2.imread",
"utils.color_conversion.to_single_gray",
"os.path.splitext",
"numpy.round",
"cv2.resize",
"numpy.sqrt"
] | [((939, 948), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (946, 948), False, 'from io import BytesIO\n'), ((1579, 1621), 'cv2.imread', 'cv2.imread', (['filename', 'cv2.IMREAD_UNCHANGED'], {}), '(filename, cv2.IMREAD_UNCHANGED)\n', (1589, 1621), False, 'import cv2\n'), ((2004, 2030), 'cv2.imwrite', 'cv2.imwrite', (['file... |
"""
The full encoder-decoder model, built on top of the base seq2seq modules.
"""
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
import lexenlem.models.common.seq2seq_constant as constant
from lexenlem.models.common import utils
from lexenlem.models.common.seq2seq_modules import ... | [
"torch.nn.Dropout",
"torch.nn.Embedding",
"torch.cat",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.no_grad",
"lexenlem.models.common.utils.prune_hyp",
"lexenlem.models.common.beam.Beam",
"lexenlem.models.common.seq2seq_modules.LSTMAttention",
"torch.... | [((2075, 2103), 'torch.nn.Dropout', 'nn.Dropout', (['self.emb_dropout'], {}), '(self.emb_dropout)\n', (2085, 2103), False, 'from torch import nn\n'), ((2124, 2148), 'torch.nn.Dropout', 'nn.Dropout', (['self.dropout'], {}), '(self.dropout)\n', (2134, 2148), False, 'from torch import nn\n'), ((2174, 2233), 'torch.nn.Embe... |
import numpy as np
from flex.constants import HE_LR_FP
from flex.api import make_protocol
from test.fed_config_example import fed_conf_guest
def test():
u = np.random.uniform(-1, 1, (32,))
print(u)
federal_info = fed_conf_guest
sec_param = {
"he_algo": 'paillier',
"he_key_length":... | [
"numpy.random.uniform",
"flex.api.make_protocol"
] | [((165, 196), 'numpy.random.uniform', 'np.random.uniform', (['(-1)', '(1)', '(32,)'], {}), '(-1, 1, (32,))\n', (182, 196), True, 'import numpy as np\n'), ((347, 395), 'flex.api.make_protocol', 'make_protocol', (['HE_LR_FP', 'federal_info', 'sec_param'], {}), '(HE_LR_FP, federal_info, sec_param)\n', (360, 395), False, '... |
"""
The Naive Bayes classifier.
"""
import numpy as np
import matplotlib.pyplot as plt
from plot_digits import *
from utils import *
_SMALL_CONSTANT = 1e-10
class NaiveBayesClassifier(object):
"""
A simple naive Bayes classifier implementation for binary classification.
All conditional distributions are... | [
"numpy.empty",
"numpy.zeros",
"numpy.log"
] | [((821, 848), 'numpy.empty', 'np.empty', (['K'], {'dtype': 'np.float'}), '(K, dtype=np.float)\n', (829, 848), True, 'import numpy as np\n'), ((864, 901), 'numpy.empty', 'np.empty', (['(K, n_dims)'], {'dtype': 'np.float'}), '((K, n_dims), dtype=np.float)\n', (872, 901), True, 'import numpy as np\n'), ((916, 953), 'numpy... |
import os
import os.path as path
from abc import abstractmethod
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from annotations import Keypoints
from posture_detection.preprocessing import PreProcessingPipeline, NormalizePointCoordinatesToBoundingBox, \
FilterColumn... | [
"matplotlib.pyplot.show",
"posture_detection.preprocessing.NormalizePointCoordinatesToBoundingBox",
"matplotlib.pyplot.plot",
"tensorflow.keras.layers.Dense",
"matplotlib.pyplot.legend",
"posture_detection.preprocessing.FilterColumns",
"posture_detection.preprocessing.PointsToVectors",
"tensorflow.ker... | [((1316, 1357), 'os.path.join', 'os.path.join', (['self._model_path', '"""weights"""'], {}), "(self._model_path, 'weights')\n", (1328, 1357), False, 'import os\n'), ((2011, 2076), 'tensorflow.keras.callbacks.EarlyStopping', 'tf.keras.callbacks.EarlyStopping', ([], {'monitor': '"""val_loss"""', 'patience': '(20)'}), "(m... |
from .builder import DATASETS
from .coco import CocoDataset
import numpy as np
@DATASETS.register_module()
class BuildingDataset(CocoDataset):
CLASSES = ('building',)
def pre_pipeline(self, results):
super(BuildingDataset, self).pre_pipeline(results)
results['polygon_fields'] = []
def _p... | [
"numpy.zeros",
"numpy.array"
] | [((1861, 1898), 'numpy.array', 'np.array', (['gt_bboxes'], {'dtype': 'np.float32'}), '(gt_bboxes, dtype=np.float32)\n', (1869, 1898), True, 'import numpy as np\n'), ((1923, 1958), 'numpy.array', 'np.array', (['gt_labels'], {'dtype': 'np.int64'}), '(gt_labels, dtype=np.int64)\n', (1931, 1958), True, 'import numpy as np\... |
import csv
import os
import shutil
import matplotlib
matplotlib.use('Agg') # don't use x server backend
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import astin97
import ml
start_year = "2011"
ml.init_retention()
if __name__ == '__main__':
print('Loading IPEDS retention...')
actual_... | [
"matplotlib.pyplot.title",
"astin97.predict_retention",
"numpy.mean",
"csv.DictWriter",
"ml.init_retention",
"matplotlib.pyplot.close",
"os.path.exists",
"astin97.predict_six",
"shutil.copyfile",
"astin97.predict_four",
"matplotlib.pyplot.subplots",
"csv.DictReader",
"ml.predict_retention",
... | [((53, 74), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (67, 74), False, 'import matplotlib\n'), ((225, 244), 'ml.init_retention', 'ml.init_retention', ([], {}), '()\n', (242, 244), False, 'import ml\n'), ((737, 757), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (751, 757), ... |
import torch
import torchaudio
import pandas as pd
from torch.utils.data import Dataset
import numpy as np
"""
Output : Randomly cropped wave with specific length & corresponding f0 (if necessary).
"""
class AudioData(Dataset):
def __init__(
self,
paths,
seed=940513,
waveform_sec=... | [
"pandas.read_csv",
"torchaudio.load",
"numpy.random.RandomState",
"torch.from_numpy"
] | [((498, 525), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (519, 525), True, 'import numpy as np\n'), ((1874, 1911), 'pandas.read_csv', 'pd.read_csv', (['self.csv_paths[file_idx]'], {}), '(self.csv_paths[file_idx])\n', (1885, 1911), True, 'import pandas as pd\n'), ((2561, 2581), 'tor... |
# -*- coding: utf-8 -*-
import gc
import itertools
import os
from time import time_ns
from typing import Callable
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
from typeguard import typechecked
from pyCRGI.pure import get_syn as pure_get_syn
from pyCRGI.jited import get_syn as jited_get_s... | [
"gc.disable",
"pyCRGI.jited.get_syn",
"os.path.join",
"os.path.dirname",
"matplotlib.pyplot.subplots",
"numpy.random.default_rng",
"pyCRGI.array.get_syn",
"numpy.array",
"time.time_ns",
"gc.enable"
] | [((381, 406), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (396, 406), False, 'import os\n'), ((586, 609), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (607, 609), True, 'import numpy as np\n'), ((929, 941), 'gc.disable', 'gc.disable', ([], {}), '()\n', (939, 941),... |
# Exercise: Augmenting the LSTM part-of-speech tagger with character-level features
# https://pytorch.org/tutorials/beginner/nlp/sequence_models_tutorial.html#exercise-augmenting-the-lstm-part-of-speech-tagger-with-character-level-features
import torch
import torch.autograd as autograd
import torch.nn as nn
import to... | [
"torch.stack",
"torch.LongTensor",
"torch.manual_seed",
"torch.autograd.Variable",
"torch.nn.Embedding",
"torch.cat",
"torch.nn.utils.rnn.pack_sequence",
"time.time",
"torch.nn.NLLLoss",
"numpy.argsort",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.functional.log_softmax",
"torch.nn.L... | [((413, 433), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (430, 433), False, 'import torch\n'), ((6435, 6447), 'torch.nn.NLLLoss', 'nn.NLLLoss', ([], {}), '()\n', (6445, 6447), True, 'import torch.nn as nn\n'), ((6799, 6805), 'time.time', 'time', ([], {}), '()\n', (6803, 6805), False, 'from time i... |
import numpy as np
import pandas as pd
from tqdm import tqdm
import datetime as dt
from collections import defaultdict
from dateutil.relativedelta import relativedelta
def collect_dates_for_cohort(df_pop, control_reservoir, control_dates, col_names=None):
'''
Fill 'control_used' dictionary with the dates (... | [
"pandas.DataFrame",
"pandas.notna",
"tqdm.tqdm",
"numpy.random.seed",
"datetime.date",
"collections.defaultdict",
"numpy.arange",
"pandas.isna",
"numpy.random.shuffle"
] | [((2440, 2460), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (2454, 2460), True, 'import numpy as np\n'), ((3462, 3486), 'collections.defaultdict', 'defaultdict', (['(lambda : -1)'], {}), '(lambda : -1)\n', (3473, 3486), False, 'from collections import defaultdict\n'), ((3499, 3526), 'collections.... |
from tqdm import tqdm, trange
from torch.utils.data import DataLoader
from .metrics import (
show_rasa_metrics,
confusion_matrix,
pred_report,
show_entity_metrics,
)
from DIET.decoder import NERDecoder
import torch
import logging
import numpy as np
def show_intent_report(
dataset, pl_module, toke... | [
"tqdm.tqdm",
"DIET.decoder.NERDecoder",
"torch.utils.data.DataLoader",
"numpy.append",
"numpy.array",
"torch.nn.Softmax",
"torch.max"
] | [((441, 453), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (449, 453), True, 'import numpy as np\n'), ((468, 480), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (476, 480), True, 'import numpy as np\n'), ((494, 506), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (502, 506), True, 'import numpy as np\n')... |
'''
Created on Oct 28, 2015
@author: kashefy
'''
from nose.tools import assert_equals, assert_true, assert_raises
import numpy as np
import nideep.blobs.mat_utils as mu
def test_cwh_to_chw_invalid_dims():
assert_raises(AttributeError, mu.cwh_to_chw, np.random.rand(3))
assert_raises(AttributeError, mu.cwh_to_... | [
"nideep.blobs.mat_utils.hwc_to_chw",
"nose.tools.assert_equals",
"numpy.copy",
"numpy.any",
"nideep.blobs.mat_utils.cwh_to_chw",
"numpy.array",
"numpy.random.rand"
] | [((457, 582), 'numpy.array', 'np.array', (['[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17,\n 18]], [[19, 20, 21], [22, 23, 24]]]'], {}), '([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15],\n [16, 17, 18]], [[19, 20, 21], [22, 23, 24]]])\n', (465, 582), True, 'import n... |
import time
import pandas as pd
import numpy as np
from sklearn.model_selection.tests.test_split import train_test_split
from sklearn.cross_decomposition import PLSRegression
from sklearn.metrics import mean_squared_error, mean_absolute_error
import matplotlib.pyplot as plt
# t = ['nFix', 'FFD', 'GPT',
# 'TRT'... | [
"sklearn.model_selection.tests.test_split.train_test_split",
"numpy.ravel",
"pandas.read_csv",
"time.time",
"numpy.array",
"sklearn.cross_decomposition.PLSRegression"
] | [((3130, 3168), 'pandas.read_csv', 'pd.read_csv', (['"""training_pos_tagged.csv"""'], {}), "('training_pos_tagged.csv')\n", (3141, 3168), True, 'import pandas as pd\n'), ((3184, 3219), 'pandas.read_csv', 'pd.read_csv', (['"""trial_pos_tagged.csv"""'], {}), "('trial_pos_tagged.csv')\n", (3195, 3219), True, 'import panda... |
import toast
import toast.todmap
from toast.mpi import MPI
import numpy as np
import matplotlib.pyplot as plt
from toast.tod import hex_pol_angles_radial, hex_pol_angles_qu, hex_layout
def fake_focalplane(
samplerate=20,
epsilon=0,
net=1,
fmin=0,
alpha=1,
fknee=0.05,
fwhm=30,
npix=7,
... | [
"toast.tod.hex_layout",
"toast.todmap.OpPointingHpix",
"numpy.sum",
"toast.todmap.TODSatellite",
"healpy.read_map",
"numpy.empty",
"toast.pipeline_tools.get_analytic_noise",
"toast.todmap.slew_precession_axis",
"toast.todmap.OpMapMaker",
"toast.Data",
"numpy.array",
"toast.tod.hex_pol_angles_q... | [((1426, 1447), 'toast.mpi.get_world', 'toast.mpi.get_world', ([], {}), '()\n', (1445, 1447), False, 'import toast\n'), ((1455, 1479), 'toast.mpi.Comm', 'toast.mpi.Comm', (['mpiworld'], {}), '(mpiworld)\n', (1469, 1479), False, 'import toast\n'), ((2293, 2702), 'toast.todmap.TODSatellite', 'toast.todmap.TODSatellite', ... |
# -*- coding: utf-8 -*-
from __future__ import print_function
"""Main module."""
import numpy as np
from .sensitivity import Pulsar, red_noise_powerlaw, corr_from_psd
from .utils import create_design_matrix
__all__ = ['sim_pta',
]
day_sec = 24*3600
yr_sec = 365.25*24*3600
def sim_pta(timespan, cad, sigma, ... | [
"numpy.random.uniform",
"numpy.floor",
"numpy.ones",
"numpy.amax",
"numpy.linspace",
"numpy.diag"
] | [((2930, 2955), 'numpy.amax', 'np.amax', (["pars['timespan']"], {}), "(pars['timespan'])\n", (2937, 2955), True, 'import numpy as np\n'), ((3441, 3462), 'numpy.diag', 'np.diag', (['(toaerrs ** 2)'], {}), '(toaerrs ** 2)\n', (3448, 3462), True, 'import numpy as np\n'), ((3041, 3074), 'numpy.floor', 'np.floor', (["(tspan... |
import os
from typing import Union, List, Tuple
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.ticker as ticker
from matplotlib import rc
import monai
import torch
import numpy as np
from glob import glob
from monai.data import Dataset, DataLoader
from monai import metrics
from... | [
"matplotlib.pyplot.yscale",
"monai.transforms.AddChanneld",
"src.contrib.sampler.RandomRepeatingSampler",
"monai.transforms.ToNumpyd",
"matplotlib.colors.TABLEAU_COLORS.values",
"monai.utils.set_determinism",
"monai.transforms.AsChannelFirstd",
"numpy.unique",
"os.path.join",
"os.path.abspath",
... | [((1096, 1117), 'os.path.abspath', 'os.path.abspath', (['data'], {}), '(data)\n', (1111, 1117), False, 'import os\n'), ((2025, 2043), 'monai.transforms.Compose', 'Compose', (['transform'], {}), '(transform)\n', (2032, 2043), False, 'from monai.transforms import Compose, LoadNiftid, AddChanneld, ScaleIntensityd, RandCro... |
#!/usr/bin/env python3
# This version version 1.0 (190116) uses 70³ 3-channel SHN shnData as input/src data.
################################################################################
# ----- IMPORT --------------------------------------------------------------- #
#################################################... | [
"numpy.load",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.argmax",
"random.shuffle",
"tensorflow.maximum",
"tensorflow.reshape",
"mrcfile.open",
"tensorflow.train.AdamOptimizer",
"tensorflow.ConfigProto",
"os.path.isfile",
"tensorflow.estimator.Estimator",
"tensorflow.estimator.inputs.num... | [((715, 748), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (738, 748), False, 'import warnings\n'), ((18214, 18273), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""HARUSPEX V2019-01-16"""'}), "(description='HARUSPEX V2019-01-16')\n", (1823... |
import warnings
import glypy
import sys
from SPARQLWrapper import SPARQLWrapper
from bs4 import BeautifulSoup
from glypy import Glycan
from glypy.io import glycoct, iupac
from pathlib import Path
import os
import pandas as pd
import numpy as np
from glypy.io.glycoct import GlycoCTError
from . import json_utility
... | [
"pandas.read_csv",
"os.walk",
"pandas.read_excel",
"os.path.isfile",
"SPARQLWrapper.SPARQLWrapper",
"numpy.array",
"glypy.io.glycoct.loads",
"sys.exc_info",
"bs4.BeautifulSoup",
"warnings.warn",
"os.path.join"
] | [((3765, 3812), 'SPARQLWrapper.SPARQLWrapper', 'SPARQLWrapper', (['"""http://ts.glytoucan.org/sparql"""'], {}), "('http://ts.glytoucan.org/sparql')\n", (3778, 3812), False, 'from SPARQLWrapper import SPARQLWrapper\n'), ((4502, 4537), 'bs4.BeautifulSoup', 'BeautifulSoup', (['xml_data', '"""lxml-xml"""'], {}), "(xml_data... |
import json
import numpy as np
from scipy.special import softmax
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from typing import NoReturn
from sklearn.metrics import precision_recall_curve
from .dataset_builder import NERLabels
class RecallThresholder(object):
def __init__(self, ner_types, ... | [
"argparse.ArgumentParser",
"json.loads",
"numpy.ma.MaskedArray",
"sklearn.metrics.precision_recall_curve",
"numpy.append",
"scipy.special.softmax"
] | [((3043, 3186), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""configuration arguments provided at run time from the CLI"""', 'formatter_class': 'ArgumentDefaultsHelpFormatter'}), "(description=\n 'configuration arguments provided at run time from the CLI',\n formatter_class=ArgumentDefault... |
"""
Module: signal.py
Authors: <NAME>
Institution: Friedrich-Alexander-University Erlangen-Nuremberg, Department of Computer Science, Pattern Recognition Lab
Last Access: 06.02.2021
"""
import cv2
import math
import torch
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ... | [
"numpy.argmax",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"torch.arange",
"matplotlib.pyplot.gca",
"torch.no_grad",
"scipy.ndimage.maximum_filter",
"matplotlib.ticker.ScalarFormatter",
"skimage.filters.threshold_otsu",
"matplotlib.pyplot.close",
"visualization.utils.flip",
"n... | [((326, 347), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (340, 347), False, 'import matplotlib\n'), ((2589, 2621), 'torch.pow', 'torch.pow', (['n_freq_bins', 'exponent'], {}), '(n_freq_bins, exponent)\n', (2598, 2621), False, 'import torch\n'), ((4384, 4454), 'scipy.ndimage.maximum_filter', '... |
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: <EMAIL>
@Software: PyCharm
@File: test_accuracy.py
@Time: 19-6-19 下午5:17
@Overview:
"""
# from __future__ import print_function
import argparse
import pdb
import random
import torch
import torch.nn as nn
import torch.optim as optim
import torch... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"random.shuffle",
"torch.nn.CosineSimilarity",
"numpy.arange",
"Define_Model.model.PairwiseDistance",
"torch.utils.data.DataLoader",
"Define_Model.ResNet.SimpleResNet",
"numpy.save",
"eval_metrics.evaluate_kaldi_eer",
"torch.autograd.Variable",
"... | [((1316, 1349), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1339, 1349), False, 'import warnings\n'), ((1823, 1889), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Speaker Recognition"""'}), "(description='PyTorch Speaker Recogni... |
import argparse # Allows parsing arguments in the command line
import os # os handles directory/workspace changes
from random import random, randint, sample # Handles random operations
from comet_ml import Experiment ... | [
"torch.nn.MSELoss",
"argparse.ArgumentParser",
"random.randint",
"torch.manual_seed",
"torch.argmax",
"torch.cuda.manual_seed",
"torch.cat",
"datetime.datetime.now",
"torch.save",
"comet_ml.Experiment",
"random.random",
"src.flappy_bird.FlappyBird",
"torch.cuda.is_available",
"numpy.array"... | [((1093, 1172), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Implementation of Deep Q Network to play Flappy Bird"""'], {}), "('Implementation of Deep Q Network to play Flappy Bird')\n", (1116, 1172), False, 'import argparse\n'), ((3945, 3970), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {... |
import pandas as pd
import numpy as np
def get_data(filename):
df = pd.read_csv(filename,delim_whitespace=True,names=['word','label'])
beg_indices = list(df[df['word'] == 'BOS'].index)+[df.shape[0]]
sents,labels,intents = [],[],[]
for i in range(len(beg_indices[:-1])):
sents.append(df[beg_indic... | [
"pandas.read_csv",
"numpy.array"
] | [((73, 142), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'delim_whitespace': '(True)', 'names': "['word', 'label']"}), "(filename, delim_whitespace=True, names=['word', 'label'])\n", (84, 142), True, 'import pandas as pd\n'), ((518, 547), 'numpy.array', 'np.array', (['sents'], {'dtype': 'object'}), '(sents, dtype... |
import sys
import numpy as np
import matplotlib.pyplot as plt
import glob
import torch
from path import Path
from imageio import imread
import pykitti # install using pip install pykitti
# from kitti_tools.kitti_raw_loader import read_calib_file, transform_from_rot_trans
import deepFEPE.dsac_tools.utils_misc as utils... | [
"matplotlib.pyplot.title",
"numpy.load",
"torch.eye",
"pykitti.raw",
"matplotlib.pyplot.figure",
"numpy.sin",
"glob.glob",
"torch.inverse",
"numpy.round",
"deepFEPE.dsac_tools.utils_vis.scatter_xy",
"numpy.set_printoptions",
"numpy.copy",
"deepFEPE.dsac_tools.utils_misc.vis_masks_to_inds",
... | [((16201, 16236), 'numpy.matmul', 'np.matmul', (["calibs['Rtl_gt']", 'X_homo'], {}), "(calibs['Rtl_gt'], X_homo)\n", (16210, 16236), True, 'import numpy as np\n'), ((16675, 16771), 'deepFEPE.dsac_tools.utils_misc.within', 'utils_misc.within', (['x1[:, 0]', 'x1[:, 1]', "(calibs['im_shape'][1] - 1)", "(calibs['im_shape']... |
######################
# Authors:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD 3-clause
#
# Implements structured SVM as described in Joachims et. al.
# Cutting-Plane Training of Structural SVMs
import warnings
from time import time
import numpy as np
from sklearn.utils import check_random_state
from py... | [
"sklearn.utils.check_random_state",
"numpy.sum",
"numpy.zeros",
"pystruct.learners.ssvm.BaseSSVM.__init__",
"time.time",
"numpy.arange",
"pystruct.utils.find_constraint",
"warnings.warn"
] | [((4059, 4186), 'pystruct.learners.ssvm.BaseSSVM.__init__', 'BaseSSVM.__init__', (['self', 'model', 'max_iter', 'C'], {'verbose': 'verbose', 'n_jobs': 'n_jobs', 'show_loss_every': 'show_loss_every', 'logger': 'logger'}), '(self, model, max_iter, C, verbose=verbose, n_jobs=n_jobs,\n show_loss_every=show_loss_every, l... |
import numpy as np
"""
Coordinate transformation module. All methods accept arrays as input
with each row as a position.
"""
a = 6378137
b = 6356752.3142
esq = 6.69437999014 * 0.001
e1sq = 6.73949674228 * 0.001
def geodetic2ecef(geodetic):
geodetic = np.array(geodetic)
input_shape = geodetic.shape
geodetic =... | [
"numpy.atleast_2d",
"numpy.arctan2",
"numpy.sin",
"numpy.array",
"numpy.cos",
"numpy.dot",
"numpy.arctan",
"numpy.sqrt"
] | [((258, 276), 'numpy.array', 'np.array', (['geodetic'], {}), '(geodetic)\n', (266, 276), True, 'import numpy as np\n'), ((321, 344), 'numpy.atleast_2d', 'np.atleast_2d', (['geodetic'], {}), '(geodetic)\n', (334, 344), True, 'import numpy as np\n'), ((1606, 1620), 'numpy.array', 'np.array', (['ecef'], {}), '(ecef)\n', (... |
'''
Using given cosmology and transfer function, calculate various analytic parameters using linear
density field vs extended press-schechter formalism.
@author: <NAME> <<EMAIL>>
Units: unless otherwise noted, all quantities are in (combinations of):
mass [log M_sun/h]
distance [kpc/h comoving]
'''
# system ... | [
"numpy.log",
"scipy.integrate.quad",
"numpy.zeros",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"scipy.interpolate.splev",
"numpy.log10",
"scipy.interpolate.splrep"
] | [((15618, 15671), 'numpy.arange', 'np.arange', (['mass_limits[0]', 'mass_limits[1]', 'mass_width'], {}), '(mass_limits[0], mass_limits[1], mass_width)\n', (15627, 15671), True, 'import numpy as np\n'), ((15726, 15751), 'numpy.zeros', 'np.zeros', (['mass_bin_number'], {}), '(mass_bin_number)\n', (15734, 15751), True, 'i... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2019 Data61, CSIRO
#
# 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 applicabl... | [
"numpy.nanmedian",
"numpy.argmax",
"numpy.isscalar",
"numpy.asarray",
"numpy.asanyarray",
"numpy.nanstd",
"numpy.isfinite",
"numpy.ndim",
"numpy.any",
"numpy.reshape",
"numpy.squeeze",
"numpy.nanmean"
] | [((15512, 15546), 'numpy.asarray', 'np.asarray', (['data'], {'dtype': 'self.dtype'}), '(data, dtype=self.dtype)\n', (15522, 15546), True, 'import numpy as np\n'), ((16053, 16087), 'numpy.asarray', 'np.asarray', (['data'], {'dtype': 'self.dtype'}), '(data, dtype=self.dtype)\n', (16063, 16087), True, 'import numpy as np\... |
from osim.env import Arm2DEnv
import math
import numpy as np
from collections import deque
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class Agent(nn.Module):
def __init__(self, env, h_size=16):
super(Agent, self)._... | [
"torch.from_numpy",
"numpy.array",
"math.pow",
"torch.nn.Linear"
] | [((570, 605), 'torch.nn.Linear', 'nn.Linear', (['self.s_size', 'self.h_size'], {}), '(self.s_size, self.h_size)\n', (579, 605), True, 'import torch.nn as nn\n'), ((625, 660), 'torch.nn.Linear', 'nn.Linear', (['self.h_size', 'self.a_size'], {}), '(self.h_size, self.a_size)\n', (634, 660), True, 'import torch.nn as nn\n'... |
import numpy as np
import pickle
from sklearn.metrics import mean_squared_error, precision_score, roc_auc_score
# from sklearn.model_selection import KFold
from sklearn.cross_validation import KFold
import time
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
import ... | [
"numpy.random.seed",
"torch.nn.BCELoss",
"math.sqrt",
"torch.LongTensor",
"torch.manual_seed",
"torch.FloatTensor",
"numpy.shape",
"torch.cuda.manual_seed_all",
"pickle.load",
"random.seed",
"numpy.array",
"torch.nn.init.constant_",
"torch.zeros",
"torch.sum",
"numpy.random.shuffle"
] | [((390, 413), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (407, 413), False, 'import torch\n'), ((418, 450), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), '(seed)\n', (444, 450), False, 'import torch\n'), ((455, 475), 'numpy.random.seed', 'np.random.seed', (['seed... |
"""
"""
import numpy as np
import matplotlib.pyplot as plt
from energy_demand import enduse_func
from energy_demand.technologies import tech_related
from energy_demand.plotting import basic_plot_functions
def run(results_every_year, lookups, path_plot_fig):
"""Plots
Plot peak hour per fueltype over time for
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"energy_demand.enduse_func.get_peak_day_single_fueltype",
"numpy.sum",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.margins",
"matplotlib.pyplot.close",
"numpy.zeros",
"energy_demand.technologies.tech_related.get_fueltype_int",
"numpy.arange",
... | [((685, 734), 'numpy.zeros', 'np.zeros', (["(lookups['fueltypes_nr'], nr_y_to_plot)"], {}), "((lookups['fueltypes_nr'], nr_y_to_plot))\n", (693, 734), True, 'import numpy as np\n'), ((2034, 2096), 'numpy.arange', 'np.arange', (['base_yr', '(years[-1] + major_interval)', 'major_interval'], {}), '(base_yr, years[-1] + ma... |
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import numpy as np
import torch
from mmcv import Config, DictAction, get_logger, print_log
from mmcv.cnn import fuse_conv_bn
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import (get_dist_info, init_dist, l... | [
"mmcv.runner.get_dist_info",
"mmtrack.apis.multi_gpu_test",
"mmcv.get_logger",
"mmdet.datasets.build_dataset",
"argparse.ArgumentParser",
"mmcv.print_log",
"mmcv.runner.init_dist",
"mmcv.runner.wrap_fp16_model",
"mmtrack.apis.single_gpu_test",
"mmtrack.datasets.build_dataloader",
"mmtrack.models... | [((696, 753), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""mmtrack test model"""'}), "(description='mmtrack test model')\n", (719, 753), False, 'import argparse\n'), ((3515, 3543), 'mmcv.Config.fromfile', 'Config.fromfile', (['args.config'], {}), '(args.config)\n', (3530, 3543), False,... |
import sys
import numpy as np
s = set()
f = np.load(sys.argv[1]).item()
for line in f.values():
s.update(line)
d = sorted(list(s))
with open(sys.argv[2], 'w') as f:
print('\n'.join(d), file=f)
| [
"numpy.load"
] | [((47, 67), 'numpy.load', 'np.load', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (54, 67), True, 'import numpy as np\n')] |
import pandas as pd
import numpy as np
class Xhtools:
'''
npproduct:求两个一维数组的笛卡尔积
threesigmod:根据3Sigma法则求异常值
numericoutlier:箱线图法求异常值
cutbin:自定义分箱,woe、iv值计算
'''
def __init__(self):
return None
def npproduct(self,array1,array2):
if len(array1) == len(array2):
... | [
"numpy.quantile",
"numpy.log",
"numpy.std",
"pandas.cut",
"numpy.mean"
] | [((525, 540), 'numpy.mean', 'np.mean', (['array1'], {}), '(array1)\n', (532, 540), True, 'import numpy as np\n'), ((555, 569), 'numpy.std', 'np.std', (['array1'], {}), '(array1)\n', (561, 569), True, 'import numpy as np\n'), ((1873, 1911), 'numpy.log', 'np.log', (["(d3['goodattr'] / d3['badattr'])"], {}), "(d3['goodatt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.