code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import popart
import numpy as np
import test_util as tu
import re
@tu.requires_ipu_model
def test_groupHostSync():
builder = popart.Builder()
a = builder.addInputTensor(popart.TensorInfo("FLOAT16", [1]))
w = builder.addInitializedInputTensor(np.one... | [
"popart.Patterns",
"popart.Builder",
"numpy.ones",
"popart.AnchorReturnType",
"test_util.create_test_device",
"numpy.array",
"popart.PyStepIO",
"popart.TensorInfo",
"popart.SessionOptions",
"popart.DataFlow",
"re.search"
] | [((188, 204), 'popart.Builder', 'popart.Builder', ([], {}), '()\n', (202, 204), False, 'import popart\n'), ((551, 584), 'popart.DataFlow', 'popart.DataFlow', (['(1)', 'anchor_config'], {}), '(1, anchor_config)\n', (566, 584), False, 'import popart\n'), ((600, 623), 'popart.SessionOptions', 'popart.SessionOptions', ([],... |
import cPickle
import functools
import os
import fuel
import numpy
from fuel.schemes import (
ConstantScheme, ShuffledExampleScheme, SequentialExampleScheme, IndexScheme)
from fuel.streams import DataStream, AbstractDataStream
from fuel.transformers import (
SortMapping, Padding, ForceFloatX, Batch, Mapping, U... | [
"fuel.transformers.Filter",
"cPickle.load",
"fuel.transformers.Padding",
"numpy.tile",
"os.path.join",
"picklable_itertools.iter_dispatch.iter_",
"numpy.random.RandomState",
"numpy.apply_along_axis",
"fuel.transformers.ForceFloatX",
"fuel.transformers.Merge",
"fuel.schemes.ShuffledExampleScheme"... | [((676, 703), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (693, 703), False, 'import logging\n'), ((3956, 4002), 'numpy.apply_along_axis', 'np.apply_along_axis', (['convert_single', '(1)', 'sample'], {}), '(convert_single, 1, sample)\n', (3975, 4002), True, 'import numpy as np\n'), ((1... |
import sys
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') # in order to import cv2 under python3
import cv2
import glob
import matplotlib.pyplot as plt
import pickle
import numpy as np
import matplotlib.image as mpimg
# """
# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
objp = n... | [
"matplotlib.image.imread",
"sys.path.remove",
"matplotlib.pyplot.show",
"cv2.findChessboardCorners",
"cv2.cvtColor",
"numpy.zeros",
"cv2.imread",
"cv2.calibrateCamera",
"glob.glob",
"cv2.drawChessboardCorners",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"cv2.undistort"
] | [((11, 74), 'sys.path.remove', 'sys.path.remove', (['"""/opt/ros/kinetic/lib/python2.7/dist-packages"""'], {}), "('/opt/ros/kinetic/lib/python2.7/dist-packages')\n", (26, 74), False, 'import sys\n'), ((319, 351), 'numpy.zeros', 'np.zeros', (['(6 * 9, 3)', 'np.float32'], {}), '((6 * 9, 3), np.float32)\n', (327, 351), Tr... |
# I this file will take in the time_data.yml files and plot
import yaml
import matplotlib.pyplot as plt
import sys
import numpy as np
def read_yaml_file(filename):
with open(filename, 'r') as f:
data = yaml.load(f)
return(data)
def array_to_dist(array):
return(np.mean(array), np.std(array))
def ... | [
"numpy.std",
"yaml.load",
"numpy.mean"
] | [((216, 228), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (225, 228), False, 'import yaml\n'), ((284, 298), 'numpy.mean', 'np.mean', (['array'], {}), '(array)\n', (291, 298), True, 'import numpy as np\n'), ((300, 313), 'numpy.std', 'np.std', (['array'], {}), '(array)\n', (306, 313), True, 'import numpy as np\n')] |
from __future__ import division
import torch
import torch.nn as nn
from .base import BaseDetector
from .test_mixins import RPNTestMixin
from .. import builder
from ..registry import DETECTORS
from mmdet.core import (assign_and_sample, bbox2roi, bbox2result, multi_apply,
merge_aug_masks)
impor... | [
"torch.nn.ReLU",
"torch.nn.ModuleList",
"mmdet.core.bbox2roi",
"numpy.float32",
"torch.cat",
"torch.mm",
"torch.transpose",
"torch.nn.Softmax",
"torch.nn.Linear",
"mmdet.core.bbox2result",
"mmdet.core.merge_aug_masks",
"torch.no_grad",
"mmdet.core.multi_apply",
"torch.from_numpy"
] | [((3959, 3974), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (3972, 3974), True, 'import torch.nn as nn\n'), ((4356, 4423), 'torch.nn.Linear', 'nn.Linear', (["(bbox_head[0]['in_channels'] + 1)", 'self.graph_out_channels'], {}), "(bbox_head[0]['in_channels'] + 1, self.graph_out_channels)\n", (4365, 4423), T... |
"""Testing utilities for the MNE BIDS converter."""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD-3-Clause
import os.path as op
# This is here to handle mne-python <0.20
import warnings
from datetime import datetime
from pathlib import Path
import pytest
from nump... | [
"mne_bids.BIDSPath",
"mne_bids.utils._age_on_date",
"mne.io.read_raw_brainvision",
"mne_bids.utils._infer_eeg_placement_scheme",
"mne_bids.path._path_to_str",
"pathlib.Path",
"mne_bids.utils._handle_datatype",
"os.path.join",
"os.path.dirname",
"mne.io.read_raw_bti",
"numpy.random.RandomState",
... | [((971, 1060), 'mne_bids.BIDSPath', 'BIDSPath', ([], {'subject': 'subject_id', 'session': 'session_id', 'run': 'run', 'acquisition': 'acq', 'task': 'task'}), '(subject=subject_id, session=session_id, run=run, acquisition=acq,\n task=task)\n', (979, 1060), False, 'from mne_bids import BIDSPath\n'), ((362, 387), 'warn... |
# This file stores check whether the altitude and control scheduled are being
# stored correctly for every eval_QoI
import os
import numpy as np
import cmath
import chaospy as cp
from pystatreduce.new_stochastic_collocation import StochasticCollocation2
from pystatreduce.stochastic_collocation import StochasticColloca... | [
"numpy.array",
"numpy.diag",
"numpy.zeros",
"pystatreduce.examples.supersonic_interceptor.interceptor_rdo2.DymosInterceptorGlue"
] | [((1362, 1382), 'numpy.zeros', 'np.zeros', (['systemsize'], {}), '(systemsize)\n', (1370, 1382), True, 'import numpy as np\n'), ((1394, 1981), 'numpy.array', 'np.array', (['[0.1659134, 0.1659134, 0.16313925, 0.16080975, 0.14363596, 0.09014088, \n 0.06906912, 0.03601839, 0.0153984, 0.01194864, 0.00705978, 0.0073889, ... |
"""Functions to analyze model performance."""
import pytest
import unittest.mock as mock
import deepchem
import numpy as np
import cytoxnet.models.analyze
import cytoxnet.models.models
def test_pair_predict():
"""Plot of predictions vs true values."""
# set up a mock model to use
model = mock.MagicMock... | [
"unittest.mock.MagicMock",
"unittest.mock.patch",
"pytest.raises",
"numpy.random.random",
"numpy.array"
] | [((306, 358), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {'spec': 'cytoxnet.models.models.ToxModel'}), '(spec=cytoxnet.models.models.ToxModel)\n', (320, 358), True, 'import unittest.mock as mock\n'), ((625, 641), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (639, 641), True, 'import unittest.mo... |
'''
This code is part of QuTIpy.
(c) Copyright <NAME>, 2021
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
Any modifications or derivative works of t... | [
"qutipy.general_functions.eye",
"numpy.sqrt",
"qutipy.general_functions.ket"
] | [((1082, 1088), 'qutipy.general_functions.eye', 'eye', (['d'], {}), '(d)\n', (1085, 1088), False, 'from qutipy.general_functions import dag, ket, eye\n'), ((1394, 1403), 'qutipy.general_functions.ket', 'ket', (['d', 'j'], {}), '(d, j)\n', (1397, 1403), False, 'from qutipy.general_functions import dag, ket, eye\n'), ((1... |
"""
Plot the results from the evaluations on artificial data.
"""
# TODO: Get these from somewhere else?
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as op
import pickle
from collections import OrderedDict
from glob import glob
search_strategies = OrderedDict([
("BayesStepper", dict... | [
"numpy.log",
"numpy.ones",
"numpy.argsort",
"numpy.product",
"pickle.load",
"numpy.array",
"numpy.max",
"matplotlib.pyplot.subplots"
] | [((1338, 1376), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', 'L'], {'figsize': '(4 * L, 4)'}), '(1, L, figsize=(4 * L, 4))\n', (1350, 1376), True, 'import matplotlib.pyplot as plt\n'), ((1183, 1215), 'numpy.array', 'np.array', (['times[search_strategy]'], {}), '(times[search_strategy])\n', (1191, 1215), True,... |
# BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE
"""
Source and Resource for a memory mapped file, which is never multithreaded.
"""
from __future__ import absolute_import
import numpy
import uproot4.source.chunk
import uproot4.source.futures
import uproot4._util
class Memm... | [
"numpy.memmap"
] | [((744, 802), 'numpy.memmap', 'numpy.memmap', (['self._file_path'], {'dtype': 'self._dtype', 'mode': '"""r"""'}), "(self._file_path, dtype=self._dtype, mode='r')\n", (756, 802), False, 'import numpy\n')] |
import math
import random
import os
import numpy as np
import torch
from torch import nn, autograd, optim
from torch.nn import functional as F
from torch.utils import data
import torch.distributed as dist
from torchvision import transforms
from torchvision.utils import save_image
from tqdm import tqdm
from args import... | [
"numpy.random.seed",
"torch.manual_seed",
"torch.load",
"utils.mkdir",
"torch.randn",
"torch.save",
"model.Generator",
"torchvision.utils.save_image",
"args.args.input.strip",
"model.MultiScaleTextureGenerator",
"torch.no_grad",
"os.path.join",
"args.args.load_ckpt.strip",
"utils.deprocess... | [((1039, 1064), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (1053, 1064), True, 'import numpy as np\n'), ((1069, 1097), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (1086, 1097), False, 'import torch\n'), ((505, 520), 'torch.no_grad', 'torch.no_grad', ... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"numpy.sum",
"argparse.ArgumentParser",
"tensorflow.variables_initializer",
"tensorflow.local_variables_initializer",
"tensorflow.ConfigProto",
"tensorflow.matmul",
"tensorflow.nn.rnn_cell.LSTMCell",
"tensorflow.truncated_normal",
"tensorflow.get_variable",
"tensorflow.nn.softmax",
"tensorflow.c... | [((855, 903), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""LSTM model benchmark."""'], {}), "('LSTM model benchmark.')\n", (878, 903), False, 'import argparse\n'), ((2481, 2525), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int64'], {'shape': '[None, None]'}), '(tf.int64, shape=[None, None])\n', (24... |
"""
Methods for constructing point clouds from meshes.
"""
import numpy as np
def from_mesh(vertices, triangles, n=1000):
"""
Randomly sample points by area on a triangle mesh. This function is
extremely fast by using broadcasting/numpy operations in lieu of loops
Inputs
-------
vertic... | [
"numpy.sum",
"numpy.zeros",
"numpy.cross",
"numpy.cumsum",
"numpy.arange",
"numpy.random.rand"
] | [((1025, 1041), 'numpy.cross', 'np.cross', (['V1', 'V2'], {}), '(V1, V2)\n', (1033, 1041), True, 'import numpy as np\n'), ((1611, 1638), 'numpy.zeros', 'np.zeros', (['vertices.shape[0]'], {}), '(vertices.shape[0])\n', (1619, 1638), True, 'import numpy as np\n'), ((1973, 1990), 'numpy.cumsum', 'np.cumsum', (['FAreas'], ... |
import numpy as np
import pydensecrf.densecrf as dcrf
from pydensecrf.utils import unary_from_softmax
def crf_inference(img, probs, t=10, scale_factor=1, labels=21):
h, w = img.shape[:2]
n_labels = labels
d = dcrf.DenseCRF2D(w, h, n_labels)
unary = unary_from_softmax(probs)
unary = np.ascontigu... | [
"numpy.copy",
"numpy.array",
"pydensecrf.utils.unary_from_softmax",
"pydensecrf.densecrf.DenseCRF2D",
"numpy.ascontiguousarray"
] | [((225, 256), 'pydensecrf.densecrf.DenseCRF2D', 'dcrf.DenseCRF2D', (['w', 'h', 'n_labels'], {}), '(w, h, n_labels)\n', (240, 256), True, 'import pydensecrf.densecrf as dcrf\n'), ((270, 295), 'pydensecrf.utils.unary_from_softmax', 'unary_from_softmax', (['probs'], {}), '(probs)\n', (288, 295), False, 'from pydensecrf.ut... |
import numpy as np
import openamundsen.constants as c
import pandas as pd
def day_angle(doy):
"""
Return the day of the year in angular form.
Parameters
----------
doy : int
Day of the year (Jan 1 = 1).
Returns
-------
day_angle : float
Day angle in radians.
"""
... | [
"numpy.deg2rad",
"numpy.sin",
"pandas.to_datetime",
"numpy.cos",
"numpy.arccos"
] | [((2137, 2187), 'numpy.deg2rad', 'np.deg2rad', (['(360 / c.DAYS_PER_YEAR * (doy - 79.346))'], {}), '(360 / c.DAYS_PER_YEAR * (doy - 79.346))\n', (2147, 2187), True, 'import numpy as np\n'), ((2964, 2984), 'pandas.to_datetime', 'pd.to_datetime', (['date'], {}), '(date)\n', (2978, 2984), True, 'import pandas as pd\n'), (... |
'''
This code is part of QuTIpy.
(c) Copyright <NAME>, 2021
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
Any modifications or derivative works of t... | [
"numpy.conjugate"
] | [((933, 948), 'numpy.conjugate', 'np.conjugate', (['k'], {}), '(k)\n', (945, 948), True, 'import numpy as np\n')] |
import sys
import numpy as np
import pandas as pd
import hypercomparison.utils
import hypercomparison.networks
import hypercomparison.correlation_and_greedy_routing
from rpy2.robjects.packages import importr
hydra = importr('hydra')
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
logger = hypercompari... | [
"numpy.array",
"rpy2.robjects.packages.importr",
"pandas.DataFrame"
] | [((217, 233), 'rpy2.robjects.packages.importr', 'importr', (['"""hydra"""'], {}), "('hydra')\n", (224, 233), False, 'from rpy2.robjects.packages import importr\n'), ((888, 906), 'numpy.array', 'np.array', (['temp_pos'], {}), '(temp_pos)\n', (896, 906), True, 'import numpy as np\n'), ((1590, 1817), 'pandas.DataFrame', '... |
import numpy as np
from scipy import linalg
from numpy import matmul
import time
import torch
def LU_solver(A,b):
P,L,U = linalg.lu(A)
y = linalg.solve(L,matmul(P,b))
x = linalg.solve(U,y)
return x
def Simulation_LU_solver(A,b,x):
P,L,U = linalg.lu(A)
y = linalg.solve(L,matmul(P,b))
x = li... | [
"scipy.linalg.solve",
"time.perf_counter",
"scipy.linalg.lu",
"numpy.ones",
"torch.linalg.solve",
"numpy.array",
"numpy.matmul",
"torch.tensor"
] | [((127, 139), 'scipy.linalg.lu', 'linalg.lu', (['A'], {}), '(A)\n', (136, 139), False, 'from scipy import linalg\n'), ((184, 202), 'scipy.linalg.solve', 'linalg.solve', (['U', 'y'], {}), '(U, y)\n', (196, 202), False, 'from scipy import linalg\n'), ((261, 273), 'scipy.linalg.lu', 'linalg.lu', (['A'], {}), '(A)\n', (270... |
import numpy as np
import matplotlib.pyplot as plt
datapath = 'C:\\Users\\arvid\\Documents\\KTH\\Masterkurser\\Deep Learning\\Assignments\\Assignment 1\\'
np.random.seed(137)
def unpickle(file):
import pickle
with open(file, 'rb') as fo:
dict = pickle.load(fo, encoding='bytes')
return dict
def o... | [
"numpy.random.seed",
"numpy.sum",
"numpy.abs",
"numpy.argmax",
"numpy.ones",
"numpy.shape",
"numpy.mean",
"pickle.load",
"numpy.exp",
"numpy.random.normal",
"matplotlib.pyplot.gca",
"numpy.diag",
"numpy.std",
"numpy.size",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"matplo... | [((158, 177), 'numpy.random.seed', 'np.random.seed', (['(137)'], {}), '(137)\n', (172, 177), True, 'import numpy as np\n'), ((3903, 3971), 'matplotlib.pyplot.semilogx', 'plt.semilogx', (['tolerances', 'ratios_w', '"""-o"""', 'tolerances', 'ratios_b', '"""-o"""'], {}), "(tolerances, ratios_w, '-o', tolerances, ratios_b,... |
'''
description: FRBCat functionality for pyAccess
license: APACHE 2.0
author: <NAME>, NLeSC (<EMAIL>)
'''
import pymysql.cursors
import pandas as pd
from pyAccess import dbase as dbase
from pyAccess import utils as utils
import os
import sys
from numpy import append as npappend
from numpy import arr... | [
"pyAccess.utils.dms2decdeg",
"voeventparse.dump",
"voeventparse.set_author",
"pyAccess.dbase.extract_from_db_sql",
"os.path.dirname",
"voeventparse.Group",
"voeventparse.Inference",
"voeventparse.Param",
"numpy.append",
"datetime.datetime.utcnow",
"numpy.where",
"numpy.array",
"voeventparse.... | [((895, 966), 'pyAccess.dbase.extract_from_db_sql', 'dbase.extract_from_db_sql', (['self.cursor', '"""authors"""', '"""id"""', '"""ivorn"""', 'ivorn'], {}), "(self.cursor, 'authors', 'id', 'ivorn', ivorn)\n", (920, 966), False, 'from pyAccess import dbase\n'), ((1471, 1568), 'pyAccess.dbase.extract_from_db_sql', 'dbase... |
from __future__ import division
import numpy as np
from numpy.testing import assert_equal
from pyoperators import (
CompositionOperator, ConstantOperator, Operator, ZeroOperator, flags,
rule_manager, O)
from pyoperators.utils import ndarraywrap
from pyoperators.utils.testing import (
assert_is, assert_is_in... | [
"pyoperators.rule_manager",
"pyoperators.utils.ndarraywrap",
"numpy.concatenate",
"pyoperators.utils.testing.assert_is",
"numpy.empty",
"pyoperators.ZeroOperator",
"numpy.zeros",
"pyoperators.Operator",
"numpy.ones",
"pyoperators.utils.testing.assert_is_none",
"pyoperators.utils.testing.assert_i... | [((434, 444), 'pyoperators.Operator', 'Operator', ([], {}), '()\n', (442, 444), False, 'from pyoperators import CompositionOperator, ConstantOperator, Operator, ZeroOperator, flags, rule_manager, O\n'), ((533, 579), 'pyoperators.ZeroOperator', 'ZeroOperator', ([], {'classout': 'ndarray2', 'attrout': 'attr2'}), '(classo... |
"""Exposes functions to estimate population size given a list of samples."""
from collections import Counter
import numpy as np
def _calculate_error(estimate, num_entities, sample_sizes):
"""Calculates the error of a population estimate given the number of
entities observed and the sizes of samples taken wi... | [
"numpy.ceil",
"numpy.log",
"numpy.array",
"numpy.exp",
"collections.Counter"
] | [((1019, 1035), 'numpy.log', 'np.log', (['estimate'], {}), '(estimate)\n', (1025, 1035), True, 'import numpy as np\n'), ((2683, 2723), 'numpy.ceil', 'np.ceil', (['((lower_bound + upper_bound) / 2)'], {}), '((lower_bound + upper_bound) / 2)\n', (2690, 2723), True, 'import numpy as np\n'), ((9810, 9870), 'collections.Cou... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Arc
from writeout import writeout
plt.rcParams["font.family"] = "serif"
plt.rcParams["mathtext.fontset"] = "cm"
fsize = 20.0
def makeaxes(xmin, xmax, ymin, ymax):
x = np.linspace(xmin, xmax, 2)
y = np.li... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.fill",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.text",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.gca",
"writeout.writeout"
] | [((450, 476), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 6)'}), '(figsize=(8, 6))\n', (460, 476), True, 'import matplotlib.pyplot as plt\n'), ((509, 554), 'matplotlib.pyplot.text', 'plt.text', (['(-0.05)', '(-0.07)', '"""$0$"""'], {'fontsize': 'fsize'}), "(-0.05, -0.07, '$0$', fontsize=fsize)\n", (... |
import numpy as np
def embed_seq(time_series, tau, embedding_dimension):
"""Build a set of embedding sequences from given time series `time_series`
with lag `tau` and embedding dimension `embedding_dimension`.
Let time_series = [x(1), x(2), ... , x(N)], then for each i such that
1 < i < N - (embedding... | [
"numpy.lib.stride_tricks.as_strided"
] | [((1047, 1121), 'numpy.lib.stride_tricks.as_strided', 'np.lib.stride_tricks.as_strided', (['time_series'], {'shape': 'shape', 'strides': 'strides'}), '(time_series, shape=shape, strides=strides)\n', (1078, 1121), True, 'import numpy as np\n')] |
# MIT License
#
# Copyright (c) 2021 GGggg-sp
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | [
"pickle.dump",
"openpyxl.Workbook",
"openpyxl.styles.Alignment",
"numpy.random.choice",
"openpyxl.styles.Border",
"openpyxl.styles.PatternFill",
"openpyxl.styles.Side"
] | [((5618, 5628), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (5626, 5628), False, 'from openpyxl import Workbook\n'), ((6412, 6476), 'openpyxl.styles.Alignment', 'Alignment', ([], {'horizontal': '"""center"""', 'wrapText': '(True)', 'vertical': '"""center"""'}), "(horizontal='center', wrapText=True, vertical='cen... |
import numpy as np
class Parabola:
coefficients: np.ndarray # Python 3.5 doesn't like this
a: float
b: float
c: float
extreme_point: list
vertex_point: list
def __init__(self, p: list, q: list, r: list):
"""Define a parabolic curve from 3 points.
Given points are x1,y1 .... | [
"numpy.linalg.solve",
"numpy.array"
] | [((997, 1061), 'numpy.array', 'np.array', (['[[x1 ** 2, x1, 1], [x2 ** 2, x2, 1], [x3 ** 2, x3, 1]]'], {}), '([[x1 ** 2, x1, 1], [x2 ** 2, x2, 1], [x3 ** 2, x3, 1]])\n', (1005, 1061), True, 'import numpy as np\n'), ((1118, 1140), 'numpy.array', 'np.array', (['[y1, y2, y3]'], {}), '([y1, y2, y3])\n', (1126, 1140), True,... |
from skimage.io import imsave
import numpy as np
from skimage.transform import resize
from model import bce_dice_loss, iou, dice_coef
from read_one_image import read_one_image
from post_process_image import post_processing, colorize_image
from tensorflow.keras.models import load_model
import tensorflow as tf
class pre... | [
"tensorflow.keras.models.load_model",
"read_one_image.read_one_image",
"skimage.io.imsave",
"tensorflow.config.set_visible_devices",
"tensorflow.config.list_physical_devices",
"tensorflow.config.experimental.set_memory_growth",
"numpy.array",
"skimage.transform.resize",
"tensorflow.config.get_visibl... | [((2259, 2325), 'tensorflow.keras.models.load_model', 'load_model', (['"""models/unet"""'], {'custom_objects': "{'dice_coef': dice_coef}"}), "('models/unet', custom_objects={'dice_coef': dice_coef})\n", (2269, 2325), False, 'from tensorflow.keras.models import load_model\n'), ((2354, 2446), 'tensorflow.keras.models.loa... |
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 10})
import json
import os, sys
import numpy as np
if __name__ == "__main__":
fname = sys.argv[1]
data = np.loadtxt(fname)
fig, ax = plt.subplots(1, figsize=(7,2.5))
# output profile and set po... | [
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.rcParams.update",
"numpy.loadtxt",
"matplotlib.pyplot.tight_layout"
] | [((74, 112), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 10}"], {}), "({'font.size': 10})\n", (93, 112), True, 'import matplotlib.pyplot as plt\n'), ((222, 239), 'numpy.loadtxt', 'np.loadtxt', (['fname'], {}), '(fname)\n', (232, 239), True, 'import numpy as np\n'), ((255, 288), 'matplot... |
import librosa
import librosa.display
import numpy as np
from pydub import AudioSegment
import torch
from matplotlib import pyplot as plt
SAMPLE = 44100
TOP = 32767
def load_wave_file_to_numpy(file_path, sample_rate=SAMPLE, *args, **kwargs):
return librosa.load(file_path, sr=sample_rate, *args, **kwargs)
def... | [
"matplotlib.pyplot.title",
"numpy.abs",
"torch.stft",
"matplotlib.pyplot.margins",
"numpy.angle",
"librosa.istft",
"matplotlib.pyplot.figure",
"numpy.sin",
"pydub.AudioSegment.from_file",
"librosa.feature.melspectrogram",
"librosa.feature.mfcc",
"numpy.zeros_like",
"matplotlib.pyplot.close",... | [((258, 314), 'librosa.load', 'librosa.load', (['file_path', '*args'], {'sr': 'sample_rate'}), '(file_path, *args, sr=sample_rate, **kwargs)\n', (270, 314), False, 'import librosa\n'), ((440, 451), 'numpy.angle', 'np.angle', (['D'], {}), '(D)\n', (448, 451), True, 'import numpy as np\n'), ((462, 471), 'numpy.abs', 'np.... |
import random, os
import numpy as np
from torch.utils.data import Dataset
from sentence_transformers import InputExample
import csv
from typing import List, Tuple, Optional, Union
import copy
class IMDB62AvDataset(Dataset):
"""Dataset for Author Verification on the IMDB62 Dataset."""
def __init__(self,
... | [
"numpy.random.uniform",
"copy.deepcopy",
"csv.reader",
"argparse.ArgumentParser",
"csv.writer",
"random.sample",
"sentence_transformers.InputExample",
"random.choice",
"os.path.join"
] | [((7360, 7459), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get args for building train/test splits of IMDB dataset"""'}), "(description=\n 'Get args for building train/test splits of IMDB dataset')\n", (7383, 7459), False, 'import argparse\n'), ((8634, 8662), 'copy.deepcopy', 'cop... |
from abc import abstractmethod, ABC
from py_wake.site._site import Site, LocalWind
from py_wake.wind_turbines import WindTurbines
import numpy as np
from py_wake.flow_map import FlowMap, HorizontalGrid
class WindFarmModel(ABC):
"""Base class for RANS and engineering flow models"""
def __init__(self, site, wi... | [
"numpy.isin",
"numpy.atleast_1d",
"matplotlib.pyplot.show",
"py_wake.flow_map.HorizontalGrid",
"py_wake.flow_map.FlowMap",
"numpy.argwhere",
"matplotlib.pyplot.figure",
"py_wake.site._site.LocalWind",
"py_wake.IEA37SimpleBastankhahGaussian",
"py_wake.examples.data.iea37.IEA37Site",
"py_wake.exam... | [((8723, 8797), 'py_wake.flow_map.FlowMap', 'FlowMap', (['self', 'X', 'Y', 'lw_j', 'WS_eff_jlk', 'TI_eff_jlk', 'wd', 'ws'], {'yaw_ilk': 'yaw_ilk'}), '(self, X, Y, lw_j, WS_eff_jlk, TI_eff_jlk, wd, ws, yaw_ilk=yaw_ilk)\n', (8730, 8797), False, 'from py_wake.flow_map import FlowMap, HorizontalGrid\n'), ((9059, 9072), 'py... |
import pandas as pd
import numpy as np
import scipy
import os, sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pylab
import matplotlib as mpl
import seaborn as sns
import analysis_utils
from multiprocessing import Pool
sys.path.append('../utils/')
from game_utils import *
in_d... | [
"sys.path.append",
"pandas.DataFrame",
"pandas.io.parsers.read_csv",
"analysis_utils.get_while_value",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"seaborn.despine",
"analysis_utils.get_value",
"matplotlib.use",
"numpy.mean",
"pdb.set_trace",
"multiprocessing.Pool",
"matplotlib.py... | [((88, 109), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (102, 109), False, 'import matplotlib\n'), ((261, 289), 'sys.path.append', 'sys.path.append', (['"""../utils/"""'], {}), "('../utils/')\n", (276, 289), False, 'import os, sys\n'), ((9004, 9011), 'multiprocessing.Pool', 'Pool', (['(8)'], ... |
import pickle
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import cassie
import time
from tempfile import TemporaryFile
FILE_PATH = "./hardware_logs/aslip_unified_no_delta_80_TS_only_sim/"
FILE_NAME = "2020-01-27_10:26_logfinal"
logs = pickle.load(open(FILE_PATH + ... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.asarray",
"numpy.zeros",
"numpy.array",
"numpy.savez"
] | [((593, 616), 'numpy.array', 'np.array', (["logs['input']"], {}), "(logs['input'])\n", (601, 616), True, 'import numpy as np\n'), ((767, 791), 'numpy.zeros', 'np.zeros', (['(numStates, 3)'], {}), '((numStates, 3))\n', (775, 791), True, 'import numpy as np\n'), ((808, 832), 'numpy.zeros', 'np.zeros', (['(numStates, 6)']... |
import numpy as np
import os
from PIL import Image
def convert_to_10class(d):
d_mod = np.zeros((len(d), 10), dtype=np.float32)
for num, contents in enumerate(d):
d_mod[num][int(contents)] = 1.0
# debug
# print("d_mod[100] =", d_mod[100])
# print("d_mod[200] =", d_mod[200])
return d_mo... | [
"PIL.Image.fromarray",
"numpy.zeros",
"numpy.tile"
] | [((1018, 1087), 'numpy.zeros', 'np.zeros', (['(28 * sample_num_h, 28 * sample_num_h, 1)'], {'dtype': 'np.float32'}), '((28 * sample_num_h, 28 * sample_num_h, 1), dtype=np.float32)\n', (1026, 1087), True, 'import numpy as np\n'), ((1786, 1813), 'PIL.Image.fromarray', 'Image.fromarray', (['wide_image'], {}), '(wide_image... |
import math
import random
import cv2
import mmcv
import numpy as np
from mmhuman3d.core.conventions.keypoints_mapping import get_flip_pairs
from mmhuman3d.utils.demo_utils import box2cs
from ..builder import PIPELINES
from .transforms import (
_rotate_smpl_pose,
affine_transform,
get_affine_transform,
)
... | [
"numpy.abs",
"numpy.maximum",
"numpy.ones",
"numpy.sin",
"numpy.linalg.norm",
"numpy.random.normal",
"numpy.zeros_like",
"numpy.empty_like",
"mmhuman3d.core.conventions.keypoints_mapping.get_flip_pairs",
"math.sqrt",
"mmcv.imflip",
"numpy.hstack",
"random.random",
"numpy.linalg.inv",
"nu... | [((842, 876), 'numpy.array', 'np.array', (['[xmin, ymin, xmax, ymax]'], {}), '([xmin, ymin, xmax, ymax])\n', (850, 876), True, 'import numpy as np\n'), ((1679, 1700), 'numpy.zeros_like', 'np.zeros_like', (['coords'], {}), '(coords)\n', (1692, 1700), True, 'import numpy as np\n'), ((1818, 1860), 'numpy.array', 'np.array... |
# -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(1, os.path.abspath(os.path.curdir))
import numpy as np
from models import Connect4ActionMaskModel
from config.connect4_config import Connect3Config
from utils.learning_behaviour_utils import LSTM_model,split_train_val,\
minimax_vs_minimax_connect3_singl... | [
"os.path.abspath",
"numpy.load",
"tensorflow.math.reduce_mean",
"tensorflow.math.argmax",
"env.connect4_multiagent_env.Connect4Env",
"numpy.argmax",
"utils.learning_behaviour_utils.LSTM_model",
"numpy.asarray",
"ray.rllib.agents.ppo.PPOTrainer",
"numpy.expand_dims",
"numpy.exp",
"numpy.random.... | [((64, 95), 'os.path.abspath', 'os.path.abspath', (['os.path.curdir'], {}), '(os.path.curdir)\n', (79, 95), False, 'import os\n'), ((1175, 1222), 'os.path.join', 'os.path.join', (['data_dir', '"""lstm_best_weights.npy"""'], {}), "(data_dir, 'lstm_best_weights.npy')\n", (1187, 1222), False, 'import os\n'), ((1241, 1285)... |
import pandas as pd
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
from numpy import genfromtxt
import os
def gaus(feature):
data = genfromtxt('./dataset/modified_weather/'+ feature +'.csv', delimiter=',')
data = data.ravel()
# clear nan values
data = dat... | [
"pandas.DataFrame",
"os.makedirs",
"pandas.read_csv",
"os.path.exists",
"numpy.genfromtxt",
"numpy.isnan"
] | [((182, 257), 'numpy.genfromtxt', 'genfromtxt', (["('./dataset/modified_weather/' + feature + '.csv')"], {'delimiter': '""","""'}), "('./dataset/modified_weather/' + feature + '.csv', delimiter=',')\n", (192, 257), False, 'from numpy import genfromtxt\n'), ((400, 418), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {})... |
# -*- coding: utf-8 -*-
from __future__ import annotations
import warnings
import collections
from typing import Dict, Optional
from dataclasses import dataclass, field
import numpy as np
import pandas as pd # type: ignore
import xarray as xr
from shapely.geometry import LineString # type: ignore
from shapely.geomet... | [
"pandas.DataFrame",
"warnings.filterwarnings",
"xarray.open_dataset",
"dataclasses.field",
"collections.defaultdict",
"geopandas.GeoDataFrame",
"shapely.geometry.LineString",
"warnings.catch_warnings",
"numpy.array",
"numpy.linalg.norm",
"numpy.dot",
"pandas.concat"
] | [((369, 394), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (392, 394), False, 'import warnings\n'), ((400, 462), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (423, 462), False, 'impor... |
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import time
import os
import numpy as np
from nltk.tokenize import word_tokenize
import unicodedata
import re
import pickle
GREEK_STOP = ['αδιακοπα', 'αι', 'ακομα', 'ακομη', 'ακριβως', 'αληθεια', 'αληθινα', 'αλλα', 'αλλαχου', 'αλλες',
'αλλη', ... | [
"unicodedata.normalize",
"os.makedirs",
"unicodedata.category",
"os.path.exists",
"time.sleep",
"numpy.mean",
"requests.get",
"bs4.BeautifulSoup",
"nltk.tokenize.word_tokenize",
"re.compile"
] | [((7697, 7711), 'numpy.mean', 'np.mean', (['proba'], {}), '(proba)\n', (7704, 7711), True, 'import numpy as np\n'), ((7993, 8007), 'numpy.mean', 'np.mean', (['proba'], {}), '(proba)\n', (8000, 8007), True, 'import numpy as np\n'), ((8664, 8686), 'requests.get', 'requests.get', (['seed_url'], {}), '(seed_url)\n', (8676,... |
"""One dimensional dataset,
Gaussian with sinus wave mean, variance increasing in x
Taken from paper: "https://arxiv.org/abs/1906.01620"
"""
import logging
from pathlib import Path
import csv
import numpy as np
import torch.utils.data
import matplotlib.pyplot as plt
class GaussianSinus(torch.utils.data.Dataset):
... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"numpy.random.shuffle",
"csv.reader",
"matplotlib.pyplot.legend",
"numpy.savetxt",
"pathlib.Path",
"numpy.sin",
"numpy.arange",
"numpy.array",
"numpy.exp",
"numpy.column_stack",
"numpy.diag",
"matplotlib.pyplot.subplots",
"logging.getLogg... | [((3117, 3127), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3125, 3127), True, 'import matplotlib.pyplot as plt\n'), ((3221, 3230), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (3227, 3230), True, 'import numpy as np\n'), ((3559, 3588), 'matplotlib.pyplot.legend', 'plt.legend', ([], {'prop': "{'size': 20}"... |
import numpy as np
from pytest import approx, raises
import context # noqa
from src import line_search
from src.least_squares import least_squares
class TestGoldenSection:
def test_correct_1d(self):
""" Check if one dimensional problems which are well specified are
solved correctly.
"""
... | [
"numpy.random.uniform",
"src.least_squares.least_squares",
"src.line_search.goldensection",
"pytest.raises",
"pytest.approx"
] | [((339, 404), 'src.line_search.goldensection', 'line_search.goldensection', ([], {'func': '(lambda x: (x - 4) ** 2)', 'x': '(3)', 'dx': '(2)'}), '(func=lambda x: (x - 4) ** 2, x=3, dx=2)\n', (364, 404), False, 'from src import line_search\n'), ((569, 635), 'src.line_search.goldensection', 'line_search.goldensection', (... |
import numpy as np
# from numpy import linalg as LA
import matplotlib.pyplot as plt
# import networkx as nx
# from scipy import integrate
from dynamic_systems import Dynamics
import reservoir
NODES = 400
TIME_STEP = 0.1
TRAINING_TIME = 260
TRANSIENT_TIME = 200
TEST_TIME = 100
INPUTS = [0]
OUTPUTS = [1, 2]
INITIAL_CO... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"reservoir.split_data",
"reservoir.gen_data",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"reservoir.gen_A"
] | [((667, 743), 'reservoir.gen_data', 'reservoir.gen_data', (['dynamic_system', 'INITIAL_CONDITION', 'total_time', 'TIME_STEP'], {}), '(dynamic_system, INITIAL_CONDITION, total_time, TIME_STEP)\n', (685, 743), False, 'import reservoir\n'), ((797, 886), 'reservoir.split_data', 'reservoir.split_data', (['DATA', 'INPUTS', '... |
# Copyright <NAME> 2017
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | [
"numpy.copy",
"pyopencl.enqueue_copy",
"test.test_common.build_kernel",
"test.test_common.offset_type",
"test.test_common.ll_to_cl",
"pyopencl.LocalMemory"
] | [((1051, 1106), 'test.test_common.ll_to_cl', 'test_common.ll_to_cl', (['ll_code', '"""mykernel"""'], {'num_clmems': '(1)'}), "(ll_code, 'mykernel', num_clmems=1)\n", (1071, 1106), False, 'from test import test_common\n'), ((1192, 1234), 'pyopencl.enqueue_copy', 'cl.enqueue_copy', (['q', 'int_data_gpu', 'int_data'], {})... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import argparse
params = {'axes.labelsize': 14,
'axes.titlesize': 16,
'xtick.labelsize': 12,
'ytick.labelsize': 12,
'legend.fontsize': 14}
plt.rcParams.update(params)
if __name__ == '__main__':
msg = ... | [
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.append",
"matplotlib.pyplot.rcParams.update",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((253, 280), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['params'], {}), '(params)\n', (272, 280), True, 'import matplotlib.pyplot as plt\n'), ((346, 386), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'msg'}), '(description=msg)\n', (369, 386), False, 'import argparse\n'... |
import numpy as np
from PIL import Image
import h5py
from astropy.io import fits
from astropy.table import Table
from astropy.convolution import convolve
from astropy.cosmology import WMAP7 as cosmo
import astropy.units as u
from astropy import wcs
import glob
import pickle
import os
import matplotlib.pyplot as plt
... | [
"matplotlib.pyplot.title",
"astropy.convolution.convolve",
"numpy.sum",
"astropy.io.fits.PrimaryHDU",
"astropy.cosmology.WMAP7.luminosity_distance",
"numpy.isnan",
"matplotlib.pyplot.figure",
"astropy.io.fits.Header",
"numpy.random.randint",
"numpy.rot90",
"pickle.load",
"glob.glob",
"numpy.... | [((1392, 1417), 'numpy.array', 'np.array', (["['i', 'r', 'g']"], {}), "(['i', 'r', 'g'])\n", (1400, 1417), True, 'import numpy as np\n'), ((1470, 1522), 'numpy.array', 'np.array', (["['_00', '_01', '_02', '_03', '_04', '_05']"], {}), "(['_00', '_01', '_02', '_03', '_04', '_05'])\n", (1478, 1522), True, 'import numpy as... |
#! /usr/bin/python
#--------------------------------------------------------------------
# PROGRAM : write_to_nc.py
# CREATED BY : hjkim @IIS.2017-10-17 06:23:16.129216
# MODIFED BY :
#
# USAGE : $ ./write_to_nc.py
#
# DESCRIPTION:
#------------------------------------------------------cf0.2@20120401
import ... | [
"netCDF4.Dataset",
"numpy.ma.masked_equal",
"collections.OrderedDict"
] | [((1405, 1444), 'netCDF4.Dataset', 'Dataset', (['outpath', '"""w"""'], {'format': '"""NETCDF4"""'}), "(outpath, 'w', format='NETCDF4')\n", (1412, 1444), False, 'from netCDF4 import Dataset\n'), ((1534, 1610), 'collections.OrderedDict', 'OrderedDict', (["(('time', None), ('pixel', None), ('lat', None), ('lon', None))"],... |
# Copyright 2022 Meta Platforms authors and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | [
"json.dump",
"numpy.moveaxis",
"transformers.FlavaFeatureExtractor.from_pretrained",
"transformers.utils.is_vision_available",
"transformers.FlavaProcessor",
"transformers.BertTokenizerFast.from_pretrained",
"pytest.raises",
"tempfile.mkdtemp",
"transformers.BertTokenizer.from_pretrained",
"random... | [((1016, 1037), 'transformers.utils.is_vision_available', 'is_vision_available', ([], {}), '()\n', (1035, 1037), False, 'from transformers.utils import FEATURE_EXTRACTOR_NAME, is_vision_available\n'), ((1426, 1444), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1442, 1444), False, 'import tempfile\n'), ((1... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.metrics import (
accuracy_score,
classification_report,
confusion_matrix,
f1_score,
make_scorer,
precision_score,
recall_score,
average_precision_score,
auc
)
def plot_confusi... | [
"numpy.trace",
"numpy.sum",
"seaborn.heatmap",
"numpy.asarray",
"sklearn.metrics.confusion_matrix"
] | [((808, 835), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['tar', 'pred'], {}), '(tar, pred)\n', (824, 835), False, 'from sklearn.metrics import accuracy_score, classification_report, confusion_matrix, f1_score, make_scorer, precision_score, recall_score, average_precision_score, auc\n'), ((1466, 1588), 's... |
"""
Helper functions for image manipulation
"""
from __future__ import absolute_import, division
import numpy as np
from skimage.util import img_as_float
__all__ = ['to_norm', 'un_norm']
def to_norm(arr):
"""
Helper function to normalise/scale an array. This is needed for example
for scikit-image which... | [
"skimage.util.img_as_float",
"numpy.array"
] | [((742, 771), 'numpy.array', 'np.array', (['arr'], {'dtype': '"""double"""'}), "(arr, dtype='double')\n", (750, 771), True, 'import numpy as np\n'), ((782, 816), 'skimage.util.img_as_float', 'img_as_float', (['arr'], {'force_copy': '(True)'}), '(arr, force_copy=True)\n', (794, 816), False, 'from skimage.util import img... |
"""Fourier matrix."""
import numpy as np
def fourier(dim: int) -> np.ndarray:
r"""
Generate the Fourier transform matrix [WikDFT]_.
Generates the `dim`-by-`dim` unitary matrix that implements the quantum
Fourier transform.
The Fourier matrix is defined as:
.. math::
W_N = \frac{1}{N... | [
"numpy.power",
"numpy.arange",
"numpy.exp",
"numpy.sqrt"
] | [((1630, 1660), 'numpy.exp', 'np.exp', (['(2 * 1.0j * np.pi / dim)'], {}), '(2 * 1.0j * np.pi / dim)\n', (1636, 1660), True, 'import numpy as np\n'), ((1714, 1731), 'numpy.arange', 'np.arange', (['(0)', 'dim'], {}), '(0, dim)\n', (1723, 1731), True, 'import numpy as np\n'), ((1673, 1690), 'numpy.arange', 'np.arange', (... |
import librosa
import numpy as np
import pandas as pd
import os
# 512 samples per frame at 44.1kHz is around 86 fps
def build_features(y, sr, n_fft=4096, hop_length=512):
params = {
'n_fft': n_fft,
'hop_length': hop_length
}
S, phase = librosa.magphase(librosa.stft(y, **params))
feature... | [
"librosa.feature.rms",
"numpy.abs",
"pandas.read_csv",
"numpy.empty",
"numpy.asarray",
"numpy.floor",
"numpy.zeros",
"numpy.flipud",
"os.path.exists",
"numpy.ones",
"librosa.cqt",
"librosa.feature.spectral_flatness",
"numpy.linspace",
"librosa.hz_to_octs",
"librosa.stft"
] | [((656, 704), 'librosa.feature.spectral_flatness', 'librosa.feature.spectral_flatness', ([], {'S': 'S'}), '(S=S, **params)\n', (689, 704), False, 'import librosa\n'), ((727, 781), 'librosa.feature.rms', 'librosa.feature.rms', ([], {'S': 'S', 'frame_length': "params['n_fft']"}), "(S=S, frame_length=params['n_fft'])\n", ... |
import numpy as np
import tensorflow as tf
from run_seg_partnet import tf_IoU_per_shape, result_callback, get_probabilities, ComputeGraphSeg
def test_tf_iou_per_shape():
# following logit and label are for one 3D model that belongs in category C1 which has 3 parts
logit = tf.Variable(initial_value=np.array([... | [
"numpy.sum",
"run_seg_partnet.result_callback",
"tensorflow.global_variables_initializer",
"run_seg_partnet.tf_IoU_per_shape",
"tensorflow.Session",
"run_seg_partnet.get_probabilities",
"numpy.array",
"run_seg_partnet.ComputeGraphSeg.set_weights"
] | [((2454, 2479), 'run_seg_partnet.get_probabilities', 'get_probabilities', (['logits'], {}), '(logits)\n', (2471, 2479), False, 'from run_seg_partnet import tf_IoU_per_shape, result_callback, get_probabilities, ComputeGraphSeg\n'), ((2742, 2785), 'run_seg_partnet.ComputeGraphSeg.set_weights', 'ComputeGraphSeg.set_weight... |
"""
@author : <NAME>
@date : 1 - 23 - 2021
The loss functions are really simple. You just need to understand whether it is a classification or regression task.
All losses will be set in the model.finalize() model.
"""
import numpy as np
import warnings
from scipy.special import softmax as sfmx_indiv
warnings.filterwa... | [
"numpy.apply_along_axis",
"numpy.power",
"numpy.log",
"warnings.filterwarnings"
] | [((303, 361), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'RuntimeWarning'}), "('ignore', category=RuntimeWarning)\n", (326, 361), False, 'import warnings\n'), ((1222, 1259), 'numpy.apply_along_axis', 'np.apply_along_axis', (['sfmx_indiv', '(1)', 'x'], {}), '(sfmx_indiv, 1, x)\... |
import numpy as np
import keras.backend.tensorflow_backend as backend
from keras.models import Sequential
from keras.layers import Dense, Dropout, Conv2D, MaxPooling2D, Activation, Flatten
from keras.optimizers import Adam
from keras.callbacks import TensorBoard
import tensorflow as tf
from collections import deque
imp... | [
"numpy.random.seed",
"game.VanilaGame",
"tensorflow.compat.v1.InteractiveSession",
"random.sample",
"keras.models.Sequential",
"tensorflow.executing_eagerly",
"numpy.random.randint",
"collections.deque",
"keras.layers.Flatten",
"numpy.max",
"random.seed",
"keras.layers.MaxPooling2D",
"tensor... | [((432, 454), 'tensorflow.executing_eagerly', 'tf.executing_eagerly', ([], {}), '()\n', (452, 454), True, 'import tensorflow as tf\n'), ((1106, 1130), 'game.VanilaGame', 'VanilaGame', (['(300)', '(300)', '(30)'], {}), '(300, 300, 30)\n', (1116, 1130), False, 'from game import VanilaGame, Snake, Food, Board\n'), ((1193,... |
"""Testing for Linear model module."""
import numpy as np
import pytest
from sklearn.base import is_regressor
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split
from sklearn.exceptions import NotFittedError
from pyrcn.linear_model import IncrementalRegression
from sklearn... | [
"pyrcn.linear_model.IncrementalRegression",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_diabetes",
"numpy.random.RandomState",
"pytest.raises",
"numpy.matmul",
"numpy.linspace",
"numpy.array_split",
"numpy.testing.assert_allclose",
"sklearn.base.is_regressor",
"sklearn.lin... | [((374, 404), 'sklearn.datasets.load_diabetes', 'load_diabetes', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (387, 404), False, 'from sklearn.datasets import load_diabetes\n'), ((479, 504), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (500, 504), True, 'import numpy as np\n'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Model for fitting an absorption profile to spectral data. """
from __future__ import (division, print_function, absolute_import,
unicode_literals)
__all__ = ["ProfileFittingModel"]
import logging
import numpy as np
import scipy.optimize as op... | [
"numpy.nanpercentile",
"numpy.abs",
"numpy.nanmedian",
"numpy.floor",
"numpy.ones",
"numpy.isnan",
"numpy.mean",
"numpy.exp",
"astropy.constants.c.to",
"numpy.polyval",
"numpy.std",
"numpy.isfinite",
"numpy.max",
"numpy.log10",
"numpy.nansum",
"numpy.ones_like",
"scipy.optimize.curve... | [((632, 659), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (649, 659), False, 'import logging\n'), ((1077, 1126), 'numpy.exp', 'np.exp', (['(-(x - position) ** 2 / (2.0 * sigma ** 2))'], {}), '(-(x - position) ** 2 / (2.0 * sigma ** 2))\n', (1083, 1126), True, 'import numpy as np\n'), (... |
import glob
import os
import numpy as np
import pickle
from sklearn.model_selection import train_test_split
#import importlib
#import logisRegresANA
def main():
np.random.seed(1) # shuffle random seed generator
# Ising model parameters
L=40 # linear system size
J=-1.0 # Ising interaction
T=np.linspace(0.... | [
"pickle.dump",
"numpy.random.seed",
"sklearn.model_selection.train_test_split",
"pickle.load",
"numpy.where",
"numpy.linspace",
"numpy.unpackbits",
"os.path.expanduser",
"numpy.concatenate"
] | [((167, 184), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (181, 184), True, 'import numpy as np\n'), ((306, 332), 'numpy.linspace', 'np.linspace', (['(0.25)', '(4.0)', '(16)'], {}), '(0.25, 4.0, 16)\n', (317, 332), True, 'import numpy as np\n'), ((815, 832), 'pickle.load', 'pickle.load', (['file'], {... |
import numpy as np
import pytest
from unittest import TestCase
from unittest.mock import MagicMock
from mvc.controllers.eval import EvalController
from tests.test_utils import DummyNetwork, DummyMetrics
from tests.test_utils import make_input, make_output
class TestEvalController:
def setup_method(self):
... | [
"mvc.controllers.eval.EvalController",
"tests.test_utils.make_output",
"unittest.mock.MagicMock",
"tests.test_utils.DummyMetrics",
"numpy.zeros",
"tests.test_utils.make_input",
"tests.test_utils.DummyNetwork",
"pytest.raises",
"numpy.random.random",
"numpy.random.randint",
"pytest.mark.parametri... | [((524, 571), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""batch"""', '[True, False]'], {}), "('batch', [True, False])\n", (547, 571), False, 'import pytest\n'), ((1231, 1278), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""batch"""', '[True, False]'], {}), "('batch', [True, False])\n", (125... |
# -*- coding: utf-8 -*-
from load_model_from_file import load_model_from_json
import os, sys
from PIL import Image
import numpy as np
def load_img(path):
"""
"""
img = np.array(Image.open(path))[:, :, 0:3]
img = np.expand_dims(img, axis=0)
return img
def main():
"""
"""
hom... | [
"os.path.abspath",
"load_model_from_file.load_model_from_json",
"numpy.expand_dims",
"PIL.Image.open",
"os.path.join"
] | [((235, 262), 'numpy.expand_dims', 'np.expand_dims', (['img'], {'axis': '(0)'}), '(img, axis=0)\n', (249, 262), True, 'import numpy as np\n'), ((391, 448), 'os.path.join', 'os.path.join', (['home', 'sys.argv[1]', 'sys.argv[2]', 'sys.argv[3]'], {}), '(home, sys.argv[1], sys.argv[2], sys.argv[3])\n', (403, 448), False, '... |
# First, and before importing any Enthought packages, set the ETS_TOOLKIT
# environment variable to qt4, to tell Traits that we will use Qt.
from mayavi.core.ui.api import MayaviScene, MlabSceneModel, SceneEditor
from traits.api import HasTraits, Instance, on_trait_change
from traitsui.api import View, Item
from mayav... | [
"traits.api.Instance",
"PyQt4.QtGui.QAction.__init__",
"mayavi.mlab.triangular_mesh",
"traits.api.on_trait_change",
"utils.save_obj",
"mayavi.mlab.clf",
"PyQt4.QtGui.QVBoxLayout",
"numpy.zeros",
"time.time",
"PyQt4.QtGui.QSlider.__init__",
"reshaper.Reshaper",
"mayavi.core.ui.api.SceneEditor",... | [((732, 769), 'PyQt4.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['int', 'int', 'int', 'int'], {}), '(int, int, int, int)\n', (749, 769), False, 'from PyQt4 import QtGui, QtCore\n'), ((1226, 1248), 'PyQt4.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['int'], {}), '(int)\n', (1243, 1248), False, 'from PyQt4 import QtGui, QtC... |
# coding: utf-8
"""
TensorFlow tests.
"""
import os
import cmsml
from cmsml.util import tmp_file, tmp_dir
from . import CMSMLTestCase
class TensorFlowTestCase(CMSMLTestCase):
def __init__(self, *args, **kwargs):
super(TensorFlowTestCase, self).__init__(*args, **kwargs)
os.environ["CUDA_VISIB... | [
"cmsml.tensorflow.load_graph",
"os.path.exists",
"cmsml.tensorflow.save_graph",
"numpy.ones",
"cmsml.tensorflow.import_tf",
"cmsml.tensorflow.write_graph_summary",
"cmsml.util.tmp_file",
"cmsml.util.tmp_dir",
"os.listdir"
] | [((4007, 4035), 'cmsml.tensorflow.import_tf', 'cmsml.tensorflow.import_tf', ([], {}), '()\n', (4033, 4035), False, 'import cmsml\n'), ((582, 610), 'cmsml.tensorflow.import_tf', 'cmsml.tensorflow.import_tf', ([], {}), '()\n', (608, 610), False, 'import cmsml\n'), ((751, 779), 'cmsml.tensorflow.import_tf', 'cmsml.tensorf... |
# This script is part of pyroglancer (https://github.com/SridharJagannathan/pyroglancer).
# Copyright (C) 2020 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either vers... | [
"pandas.DataFrame",
"json.dump",
"os.remove",
"os.makedirs",
"cloudvolume.Skeleton",
"os.path.basename",
"navis.core.NeuronList",
"os.path.exists",
"cloudvolume.datasource.precomputed.sharding.ShardingSpecification",
"pymaid.core.CatmaidNeuronList",
"cloudvolume.CloudVolume",
"numpy.array",
... | [((1968, 2040), 'numpy.array', 'np.array', (["(this_tn[['index', 'parent_ix']].values[1:] - 1)"], {'dtype': '"""uint32"""'}), "(this_tn[['index', 'parent_ix']].values[1:] - 1, dtype='uint32')\n", (1976, 2040), True, 'import numpy as np\n'), ((2057, 2109), 'cloudvolume.Skeleton', 'Skeleton', ([], {'segid': 'x.id', 'vert... |
# -*- coding: utf-8 -*-
from functools import reduce
from operator import mul
import numpy as np
from africanus.util.docs import DocstringTemplate
from africanus.util.numba import jit
@jit(nopython=True, nogil=True, cache=True)
def _nb_feed_rotation(parallactic_angles, feed_type, feed_rotation):
shape = paral... | [
"africanus.util.docs.DocstringTemplate",
"numpy.empty",
"numpy.sin",
"numpy.cos",
"functools.reduce",
"africanus.util.numba.jit"
] | [((191, 233), 'africanus.util.numba.jit', 'jit', ([], {'nopython': '(True)', 'nogil': '(True)', 'cache': '(True)'}), '(nopython=True, nogil=True, cache=True)\n', (194, 233), False, 'from africanus.util.numba import jit\n'), ((2279, 2934), 'africanus.util.docs.DocstringTemplate', 'DocstringTemplate', (['"""\nComputes th... |
# -*- coding: utf-8 -*-
import datetime
import uuid
from collections import abc
from typing import MutableSequence, Any, Optional, Sequence
import typing
import numpy as np
from .array import StateVector, CovarianceMatrix, PrecisionMatrix
from .base import Type
from .numeric import Probability
from .particle import P... | [
"uuid.uuid4",
"numpy.average",
"numpy.sum",
"numpy.argmax",
"numpy.array"
] | [((18291, 18369), 'numpy.average', 'np.average', (['self.particles.state_vector'], {'axis': '(1)', 'weights': 'self.particles.weight'}), '(self.particles.state_vector, axis=1, weights=self.particles.weight)\n', (18301, 18369), True, 'import numpy as np\n'), ((20756, 20784), 'numpy.argmax', 'np.argmax', (['self.state_ve... |
# Copyright Cartopy Contributors
#
# This file is part of Cartopy and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
from __future__ import (absolute_import, division, print_function)
import operator
import warnings
import matplotlib
i... | [
"numpy.arctan2",
"cartopy.mpl.ticker.LongitudeFormatter",
"numpy.isnan",
"numpy.clip",
"cartopy.mpl.ticker.LongitudeLocator",
"numpy.sin",
"numpy.arange",
"numpy.meshgrid",
"matplotlib.transforms.offset_copy",
"numpy.logical_or.reduce",
"shapely.geometry.Polygon",
"matplotlib.ticker.MaxNLocato... | [((732, 794), 'matplotlib.ticker.MaxNLocator', 'mticker.MaxNLocator', ([], {'nbins': '(9)', 'steps': '[1, 1.5, 1.8, 2, 3, 6, 10]'}), '(nbins=9, steps=[1, 1.5, 1.8, 2, 3, 6, 10])\n', (751, 794), True, 'import matplotlib.ticker as mticker\n'), ((813, 841), 'matplotlib.ticker.MaxNLocator', 'mticker.MaxNLocator', ([], {'nb... |
import math
import subprocess
import einops as eo
from loguru import logger
import numpy as np
import pandas as pd
from PIL import Image
from scipy.signal import savgol_filter
import torch
from torch import optim, nn
from collections import Counter
from pytti import (
format_input,
set_t,
print_vram_usag... | [
"pandas.DataFrame",
"subprocess.run",
"scipy.signal.savgol_filter",
"loguru.logger.debug",
"IPython.display.display",
"pytti.rotoscoper.update_rotoscopers",
"pytti.vram_usage_mode",
"pytti.Transforms.animate_2d",
"pytti.Transforms.zoom_3d",
"pytti.format_input",
"numpy.array",
"pytti.freeze_vr... | [((1422, 1476), 'scipy.signal.savgol_filter', 'savgol_filter', (['df[key]', 'window_size', '(2)'], {'mode': '"""nearest"""'}), "(df[key], window_size, 2, mode='nearest')\n", (1435, 1476), False, 'from scipy.signal import savgol_filter\n'), ((17269, 17277), 'pytti.set_t', 'set_t', (['t'], {}), '(t)\n', (17274, 17277), F... |
# encoding: utf-8
"""
@author: sherlock
@contact: <EMAIL>
"""
import logging
import torch
import torch.nn as nn
from ignite.engine import Engine
import pickle
from utils.reid_metric import R1_mAP, R1_mAP_reranking
from torch.autograd import Variable
from torch.nn import functional as F
import numpy as np
worddict_tmp... | [
"utils.reid_metric.R1_mAP_reranking",
"numpy.argmax",
"numpy.empty",
"numpy.zeros",
"torch.cuda.device_count",
"torch.nn.functional.softmax",
"ignite.engine.Engine",
"utils.reid_metric.R1_mAP",
"torch.nn.DataParallel",
"torch.no_grad",
"logging.getLogger",
"torch.from_numpy"
] | [((2872, 2890), 'ignite.engine.Engine', 'Engine', (['_inference'], {}), '(_inference)\n', (2878, 2890), False, 'from ignite.engine import Engine\n'), ((3118, 3162), 'logging.getLogger', 'logging.getLogger', (['"""reid_baseline.inference"""'], {}), "('reid_baseline.inference')\n", (3135, 3162), False, 'import logging\n'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import types
import numpy
import scipy
import warnings
from scipy.signal import savgol_filter
import statsmodels.api as sm
lowess = sm.nonparametric.lowess
import logging
from scipy.signal import savgol_filter
import time
import sys
import copy
from datetime import datetim... | [
"numpy.isnan",
"numpy.argsort",
"numpy.mean",
"numpy.interp",
"multiprocessing.cpu_count",
"numpy.zeros_like",
"numpy.multiply",
"warnings.simplefilter",
"numpy.empty_like",
"warnings.catch_warnings",
"datetime.datetime.now",
"numpy.divide",
"copy.deepcopy",
"numpy.nan_like",
"numpy.medi... | [((2752, 2771), 'copy.deepcopy', 'copy.deepcopy', (['data'], {}), '(data)\n', (2765, 2771), False, 'import copy\n'), ((6424, 6446), 'numpy.empty_like', 'numpy.empty_like', (['data'], {}), '(data)\n', (6440, 6446), False, 'import numpy\n'), ((6455, 6477), 'numpy.empty_like', 'numpy.empty_like', (['data'], {}), '(data)\n... |
"""Parse data in the format:
Age Uncertainty
Sample data assumning a normal distrubtion with mean defined by Age and sigma
defined by Uncertainty
"""
import numpy as np
from scipy.stats import norm
from QuakeRates.dataman.event_dates import EventDate, EventSet
def parse_age_sigma(filename, sigma_level, event_order, ... | [
"QuakeRates.dataman.event_dates.EventDate",
"numpy.flip",
"numpy.genfromtxt",
"scipy.stats.norm.pdf",
"numpy.mean",
"numpy.array",
"numpy.arange",
"QuakeRates.dataman.event_dates.EventSet"
] | [((1036, 1092), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': 'delimiter', 'names': '(True)'}), '(filename, delimiter=delimiter, names=True)\n', (1049, 1092), True, 'import numpy as np\n'), ((3467, 3487), 'QuakeRates.dataman.event_dates.EventSet', 'EventSet', (['event_list'], {}), '(event_list)\n', ... |
# @brief: provides a method to solve the modified Ricatti Equation
import numpy as np
from scipy.linalg import solve_continuous_are
def createLowLevelParams(A, B, Q, R, g, w):
# A, B are control matrices
# Q, R are cost weights
# g = \gamma controls the sensitivity
# w is the magnitude of the noise
# deter... | [
"numpy.linalg.eigvals",
"numpy.linalg.inv",
"numpy.array",
"numpy.eye",
"numpy.linalg.cholesky"
] | [((445, 454), 'numpy.eye', 'np.eye', (['n'], {}), '(n)\n', (451, 454), True, 'import numpy as np\n'), ((941, 950), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (947, 950), True, 'import numpy as np\n'), ((956, 965), 'numpy.eye', 'np.eye', (['(2)'], {}), '(2)\n', (962, 965), True, 'import numpy as np\n'), ((974, 1040)... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import random
import os
print('Welcome to the game!')
input('Press enter to continue: ')
print('')
print('- This is a population simulator for a fictional town.')
print('- The town starts with 20 people. With each year that passes, babies will be ... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"pandas.read_csv",
"os.getcwd",
"random.choice",
"random.random",
"numpy.where",
"pandas.concat"
] | [((1151, 1284), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/MatthiasWinkelmann/firstname-database/master/firstnames.csv"""'], {'delimiter': '""";"""'}), "(\n 'https://raw.githubusercontent.com/MatthiasWinkelmann/firstname-database/master/firstnames.csv'\n , delimiter=';')\n", (1162, ... |
import numpy as np
import cv2
import grpc
from tritonclient.grpc import service_pb2, service_pb2_grpc
import tritonclient.grpc.model_config_pb2 as mc
np.random.seed(123)
palette = np.random.randint(0, 256, (100, 3))
# url = '10.128.61.7:8001'
url = '127.0.0.1:8001'
model_name = 'bisenetv2'
model_version = '1'
... | [
"tritonclient.grpc.service_pb2.ModelInferRequest",
"tritonclient.grpc.service_pb2_grpc.GRPCInferenceServiceStub",
"numpy.random.seed",
"cv2.imwrite",
"numpy.frombuffer",
"grpc.insecure_channel",
"cv2.imread",
"tritonclient.grpc.service_pb2.ModelConfigRequest",
"numpy.random.randint",
"numpy.array"... | [((155, 174), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (169, 174), True, 'import numpy as np\n'), ((185, 220), 'numpy.random.randint', 'np.random.randint', (['(0)', '(256)', '(100, 3)'], {}), '(0, 256, (100, 3))\n', (202, 220), True, 'import numpy as np\n'), ((707, 749), 'grpc.insecure_channel... |
from __future__ import division
import math
import matplotlib as mpl
import numpy as np
from matplotlib.ticker import AutoMinorLocator
from matplotlib.ticker import MultipleLocator
from matplotlib.ticker import FixedLocator
from matplotlib.ticker import LogLocator
from matplotlib.ticker import FormatStrFormatter
fr... | [
"matplotlib.pyplot.clf",
"numpy.mean",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.autoscale",
"matplotlib.pyplot.rc",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"numpy.linalg.eigvalsh",
"matplotlib.pyplot.ylabel",
... | [((1575, 1614), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""', 'size': '(43)'}), "('font', family='serif', size=43)\n", (1581, 1614), True, 'import matplotlib.pyplot as plt\n'), ((1697, 1713), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (1705, 1713), True, 'import numpy as n... |
import sys
import gym
import tensorflow as tf
import numpy as np
import random
import datetime
import os
from collections import deque
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
"""
Hyper Parameters
"""
GAMMA = 0.99 # discount factor for target Q
INITIAL_EPSILON = 0.8 # starting value of epsilon
FINAL_E... | [
"numpy.argmax",
"tensorflow.get_collection",
"random.sample",
"tensorflow.multiply",
"numpy.mean",
"numpy.arange",
"tensorflow.InteractiveSession",
"collections.deque",
"random.randint",
"tensorflow.variable_scope",
"tensorflow.placeholder",
"tensorflow.summary.FileWriter",
"datetime.datetim... | [((1033, 1059), 'collections.deque', 'deque', ([], {'maxlen': 'AVERAGE_OVER'}), '(maxlen=AVERAGE_OVER)\n', (1038, 1059), False, 'from collections import deque\n'), ((3314, 3356), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, state_dim]'], {}), "('float', [None, state_dim])\n", (3328, 3356), True,... |
import numpy as np
from PIL import Image
from deephar.utils.io import WARNING
from deephar.utils.io import FAIL
from deephar.utils.io import printcn
from deephar.utils.pose import pa16j2d
from deephar.utils.pose import pa17j3d
from deephar.utils.pose import pa20j3d
from deephar.utils.colors import hex_colors
try:
... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"deephar.utils.io.printcn",
"numpy.zeros",
"matplotlib.pyplot.axis",
"numpy.ones",
"numpy.apply_along_axis",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.imsave",
"matplotlib.pyplot.gca"
] | [((3314, 3328), 'matplotlib.pyplot.axis', 'plt.axis', (['axis'], {}), '(axis)\n', (3322, 3328), True, 'import matplotlib.pyplot as plt\n'), ((5713, 5738), 'numpy.zeros', 'np.zeros', (['(num_joints, 3)'], {}), '((num_joints, 3))\n', (5721, 5738), True, 'import numpy as np\n'), ((5885, 5956), 'numpy.apply_along_axis', 'n... |
#!/usr/bin/python3
from __future__ import print_function
import tensorflow as tf
import math
from utility.generate_sample import generate_sample
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import argparse
import os
#LSTM runs faster on CPU
os.environ['C... | [
"argparse.ArgumentParser",
"tensorflow.compat.v1.disable_eager_execution",
"tensorflow.matmul",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.pyplot.tight_layout",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.compat.v1.name_scope",
"tensorflow.compat.v1.placeholder",
"m... | [((349, 387), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (385, 387), True, 'import tensorflow as tf\n'), ((388, 409), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (402, 409), False, 'import matplotlib\n'), ((688, 798), 'argparse.Arg... |
import numpy as np
from transformers import AdamW, get_scheduler
from transformers.tokenization_utils_base import BatchEncoding
def forward_wrapper_tuple(model, batch):
input_ids = batch['input_ids'].to(model.first_device)
attention_mask = batch['attention_mask'].to(model.first_device)
labels = batch['lab... | [
"transformers.tokenization_utils_base.BatchEncoding",
"numpy.isclose",
"numpy.linalg.norm",
"transformers.get_scheduler",
"transformers.AdamW"
] | [((1660, 1718), 'transformers.AdamW', 'AdamW', (['optimizer_grouped_parameters'], {'lr': 'args.learning_rate'}), '(optimizer_grouped_parameters, lr=args.learning_rate)\n', (1665, 1718), False, 'from transformers import AdamW, get_scheduler\n'), ((1801, 1954), 'transformers.get_scheduler', 'get_scheduler', ([], {'name':... |
"""Same as 01.py, but reports speed"""
import os
import sys
if not os.path.abspath('../../../') in sys.path:
sys.path.append('../../../')
import swhlab
import matplotlib.pyplot as plt
import numpy as np
import time
if __name__=="__main__":
abfFile=R"X:\Data\DIC1\2013\08-2013\08-16-2013-DP\13816004.abf"
ab... | [
"sys.path.append",
"numpy.fft.ifft",
"swhlab.ABF",
"os.path.abspath",
"numpy.average",
"numpy.std",
"numpy.fft.fft",
"time.clock",
"numpy.array"
] | [((114, 142), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (129, 142), False, 'import sys\n'), ((322, 341), 'swhlab.ABF', 'swhlab.ABF', (['abfFile'], {}), '(abfFile)\n', (332, 341), False, 'import swhlab\n'), ((68, 96), 'os.path.abspath', 'os.path.abspath', (['"""../../../"""'], {... |
import numpy as np
from torch import nn
def num_parameters(self):
return sum(np.prod(p.shape) for p in self.parameters())
nn.Module.num_parameters = property(num_parameters)
from .graph_attention_layer import GraphAttentionNetwork, GraphAttentionLayer
from .utils import get_clones
from .node_transformer import P... | [
"numpy.prod"
] | [((82, 98), 'numpy.prod', 'np.prod', (['p.shape'], {}), '(p.shape)\n', (89, 98), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 4 10:23:34 2019
@author: <NAME>
"""
# This code is used for creating data set for 6DOF robotic arm with use of direct kinematic.
from sympy import symbols, pi, sin, cos, simplify
from sympy.matrices import Matrix
import numpy as np
import random
import ma... | [
"sympy.symbols",
"random.uniform",
"numpy.asarray",
"sympy.cos",
"numpy.zeros",
"sympy.simplify",
"time.time",
"numpy.array",
"sympy.sin",
"math.degrees",
"numpy.concatenate"
] | [((2866, 2877), 'time.time', 'time.time', ([], {}), '()\n', (2875, 2877), False, 'import time\n'), ((3562, 3591), 'numpy.zeros', 'np.zeros', (['[1, 6]'], {'dtype': 'float'}), '([1, 6], dtype=float)\n', (3570, 3591), True, 'import numpy as np\n'), ((3603, 3632), 'numpy.zeros', 'np.zeros', (['[1, 3]'], {'dtype': 'float'}... |
import scipy.io
import scipy.sparse
import argparse
import numpy as np
import os
import json
import re
import pandas
import pdb
def parse_args():
parser = argparse.ArgumentParser(description="Convert data from graphsage format to .mat format.")
parser.add_argument('--prefix', default="example_data/douban/onlin... | [
"re.split",
"os.makedirs",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.zeros",
"os.path.exists",
"numpy.array"
] | [((160, 254), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert data from graphsage format to .mat format."""'}), "(description=\n 'Convert data from graphsage format to .mat format.')\n", (183, 254), False, 'import argparse\n'), ((3086, 3116), 'numpy.zeros', 'np.zeros', (['(n2[0... |
import os
import sys
import cv2
import imutils
import numpy as np
from tqdm import tqdm
from enum import Enum
from math import sqrt
from time import time
# Define a custom ENUM to specify which text-extraction function should be executed
# later on on the last step of the pipeline
class FTYPE(Enum):
ALL = 0
E... | [
"cv2.GaussianBlur",
"os.mkdir",
"cv2.bitwise_and",
"cv2.medianBlur",
"numpy.ones",
"cv2.rectangle",
"cv2.normalize",
"cv2.absdiff",
"cv2.imshow",
"cv2.inRange",
"os.path.join",
"cv2.cvtColor",
"cv2.copyMakeBorder",
"cv2.split",
"cv2.drawContours",
"cv2.boundingRect",
"cv2.resize",
... | [((1883, 1906), 'cv2.imshow', 'cv2.imshow', (['name', 'plate'], {}), '(name, plate)\n', (1893, 1906), False, 'import cv2\n'), ((1915, 1929), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (1926, 1929), False, 'import cv2\n'), ((2836, 2874), 'cv2.cvtColor', 'cv2.cvtColor', (['plate', 'cv2.COLOR_BGR2HSV'], {}), '(... |
import os
import time
import numpy as np
import random
import torch
import math
from behavenet.data.utils import build_data_generator
from behavenet.fitting.eval import export_train_plots
from behavenet.fitting.hyperparam_utils import get_all_params
from behavenet.fitting.hyperparam_utils import get_slurm_params
from ... | [
"numpy.random.uniform",
"behavenet.models.aes.load_pretrained_ae",
"random.randint",
"os.path.join",
"torch.manual_seed",
"behavenet.fitting.training.fit",
"behavenet.fitting.hyperparam_utils.get_all_params",
"behavenet.fitting.eval.export_train_plots",
"torch.get_rng_state",
"behavenet.models.Cus... | [((915, 938), 'behavenet.fitting.utils._print_hparams', '_print_hparams', (['hparams'], {}), '(hparams)\n', (929, 938), False, 'from behavenet.fitting.utils import _print_hparams\n'), ((1345, 1374), 'behavenet.fitting.utils.create_tt_experiment', 'create_tt_experiment', (['hparams'], {}), '(hparams)\n', (1365, 1374), F... |
import numpy as np
import pytest
@pytest.fixture
def simulate():
np.random.seed(0)
l = np.random.normal(size=(100, 3))
f = np.random.normal(size=(3, 200))
eta = l.dot(f)
eta *= 5 / eta.max()
x = np.random.poisson(lam=np.exp(eta))
return x, eta
@pytest.fixture
def simulate_lam_low_rank():
np.random.see... | [
"numpy.exp",
"numpy.random.seed",
"numpy.random.poisson",
"numpy.random.normal"
] | [((68, 85), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (82, 85), True, 'import numpy as np\n'), ((92, 123), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(100, 3)'}), '(size=(100, 3))\n', (108, 123), True, 'import numpy as np\n'), ((130, 161), 'numpy.random.normal', 'np.random.normal', (... |
"""
sklearn extend のテストコード
"""
import os
import numpy as np
import pytest
from lightgbm import LGBMClassifier
from sklearn.linear_model import Ridge, Lasso, LassoCV, RidgeClassifierCV
from sklearn.utils.validation import NotFittedError
from xgboost import XGBClassifier
from vivid.sklearn_extend import UtilityTransfor... | [
"numpy.random.uniform",
"os.path.join",
"pytest.fixture",
"joblib.dump",
"pytest.raises",
"numpy.array",
"numpy.array_equal",
"pytest.mark.parametrize",
"joblib.load",
"vivid.sklearn_extend.PrePostProcessModel",
"vivid.sklearn_extend.UtilityTransform"
] | [((382, 446), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scaling"""', "[None, 'standard', 'minmax']"], {}), "('scaling', [None, 'standard', 'minmax'])\n", (405, 446), False, 'import pytest\n'), ((448, 493), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""log"""', '[True, False]'], {}), "('l... |
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
def gen_color_map(keys):
colors = cm.rainbow(np.linspace(0, 1, len(keys)))
return dict(zip(keys, colors))
def visualize_dataset_2d(x1, x2, ys, alpha=0.5, x1_label='', x2_label='',
loc='upper left', figsize=(... | [
"matplotlib.pyplot.tight_layout",
"matplotlib.rc",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.argmax",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.logical_not",
"matplotlib.rcdefaults",
"matplotlib.pyplot.figure",
"matplotlib.pyplot... | [((1000, 1027), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (1010, 1027), True, 'import matplotlib.pyplot as plt\n'), ((1344, 1364), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['x1_label'], {}), '(x1_label)\n', (1354, 1364), True, 'import matplotlib.pyplot as plt\n'), ... |
from tetris import Tetris
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from gym import spaces
from gym.envs.toy_text import discrete
import numpy as np
class TetrisEnv(discrete.DiscreteEnv):
metadata = {'render.modes': ['human']}
def __init__(self):
self.t = Tetris()
state_n... | [
"tetris.Tetris",
"gym.spaces.Discrete",
"numpy.zeros",
"numpy.array",
"gym.utils.seeding.np_random"
] | [((301, 309), 'tetris.Tetris', 'Tetris', ([], {}), '()\n', (307, 309), False, 'from tetris import Tetris\n'), ((744, 769), 'numpy.array', 'np.array', (['init_state_dist'], {}), '(init_state_dist)\n', (752, 769), True, 'import numpy as np\n'), ((917, 935), 'gym.spaces.Discrete', 'spaces.Discrete', (['(5)'], {}), '(5)\n'... |
import matplotlib.pyplot as plt
import numpy as np
import math
n = np.linspace(2, 7)
plt.plot(n, n**3, label="n**3")
plt.plot(n, n**0.3, label="n**0.3")
plt.plot(n, n, label="n")
plt.plot(n, np.sqrt(n), label="sqrtn")
plt.plot(n, (n ** 2) / np.sqrt(n), label="(n ** 2) / np.sqrt(n)")
plt.plot(n, n ** 2, label="n **2")
... | [
"matplotlib.pyplot.show",
"numpy.log",
"matplotlib.pyplot.plot",
"numpy.log2",
"matplotlib.pyplot.legend",
"numpy.linspace",
"numpy.sqrt"
] | [((68, 85), 'numpy.linspace', 'np.linspace', (['(2)', '(7)'], {}), '(2, 7)\n', (79, 85), True, 'import numpy as np\n'), ((86, 119), 'matplotlib.pyplot.plot', 'plt.plot', (['n', '(n ** 3)'], {'label': '"""n**3"""'}), "(n, n ** 3, label='n**3')\n", (94, 119), True, 'import matplotlib.pyplot as plt\n'), ((118, 155), 'matp... |
import h5py
import pickle
import numpy as np
from torch.utils.data import Dataset
from sklearn.model_selection import train_test_split
class ExpressionDataset(Dataset):
'''
Gene expression dataset capable of using subsets of inputs.
Args:
data: array of inputs with size (samples, dim).
labels... | [
"h5py.File",
"pickle.dump",
"numpy.random.seed",
"sklearn.model_selection.train_test_split",
"numpy.sort",
"pickle.load",
"numpy.arange",
"numpy.random.choice",
"numpy.unique"
] | [((9452, 9511), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data'], {'test_size': 'N_test', 'random_state': 'seed'}), '(data, test_size=N_test, random_state=seed)\n', (9468, 9511), False, 'from sklearn.model_selection import train_test_split\n'), ((9529, 9592), 'sklearn.model_selection.train_test... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torchvision
import torchvision.transforms as transforms
from weights_init import weight_init
import os
import argparse
from datetime import datetime
import matplotlib.pyplot as... | [
"torch.nn.Dropout",
"numpy.sum",
"torch.argmax",
"torch.cat",
"torchvision.transforms.Normalize",
"torch.no_grad",
"numpy.set_printoptions",
"torch.utils.data.DataLoader",
"torch.load",
"torch.set_printoptions",
"torch.Tensor",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.AvgPool2d",
"tor... | [((3061, 3171), 'torchvision.datasets.CIFAR100', 'torchvision.datasets.CIFAR100', ([], {'root': '"""~/projectdata"""', 'train': '(False)', 'download': '(True)', 'transform': 'transform_test'}), "(root='~/projectdata', train=False, download=\n True, transform=transform_test)\n", (3090, 3171), False, 'import torchvisi... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.config.machine_num",
"oneflow.serving.InferenceSession",
"oneflow.typing.Numpy.Placeholder",
"numpy.allclose",
"oneflow.clear_default_session",
"oneflow.config.cpu_device_num",
"oneflow.unittest.skip_unless_1n1d",
"shutil.rmtree",
"unittest.main",
"oneflow.transpose",
"os.path.exists",
... | [((3159, 3191), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (3189, 3191), True, 'import oneflow as flow\n'), ((1221, 1236), 'oneflow.env.init', 'flow.env.init', ([], {}), '()\n', (1234, 1236), True, 'import oneflow as flow\n'), ((1241, 1267), 'oneflow.config.machine_num', 'f... |
#
# This file is part of seirmo (https://github.com/SABS-R3-Epidemiology/seirmo/)
# which is released under the BSD 3-clause license. See accompanying LICENSE.md
# for copyright notice and full license details.
#
import numpy as np
from scipy.integrate import solve_ivp
import seirmo
class DeterministicSEIRModel(sei... | [
"seirmo.SEIROutputCollector",
"seirmo.SEIRParameters",
"numpy.vstack"
] | [((1121, 1182), 'seirmo.SEIROutputCollector', 'seirmo.SEIROutputCollector', (["['S', 'E', 'I', 'R', 'Incidence']"], {}), "(['S', 'E', 'I', 'R', 'Incidence'])\n", (1147, 1182), False, 'import seirmo\n'), ((1223, 1296), 'seirmo.SEIRParameters', 'seirmo.SEIRParameters', (["['S0', 'E0', 'I0', 'R0', 'alpha', 'beta', 'gamma'... |
# Dev Note:
# Log Finished.
# early stop Finished.
# Autosave Finished.
# Learning rate decay
# Warm start
# Parameters regularization
import io
import os
import logging
from datetime import datetime
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
fro... | [
"io.StringIO",
"logging.error",
"os.makedirs",
"logging.basicConfig",
"os.path.join",
"os.path.isdir",
"torch.manual_seed",
"torch.nn.utils.clip_grad_norm",
"torch.nn.functional.cross_entropy",
"torch.save",
"logging.info",
"torch.cuda.is_available",
"numpy.exp",
"torch.device",
"datetim... | [((5015, 5054), 'logging.info', 'logging.info', (['"""Training PyTorch model."""'], {}), "('Training PyTorch model.')\n", (5027, 5054), False, 'import logging\n'), ((1317, 1330), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (1328, 1330), False, 'import io\n'), ((1343, 1515), 'logging.basicConfig', 'logging.basicConf... |
'''
Helper functions to work with matrices
'''
import numpy as np
def random_unique_permutations(num_permutations, permutation_size):
'''Returns a set of randomly chosen unique permutations
Example:
array([[3, 1, 2, 0],
[1, 2, 0, 3],
[2, 0, 3, 1]])
References:
*... | [
"numpy.random.rand"
] | [((468, 518), 'numpy.random.rand', 'np.random.rand', (['num_permutations', 'permutation_size'], {}), '(num_permutations, permutation_size)\n', (482, 518), True, 'import numpy as np\n')] |
import collections
import numpy as np
import pandas as pd
from sklearn.neighbors import KDTree
from sklearn.externals.joblib import Parallel, delayed
train = pd.read_csv('../input/training.txt', header=None, names=['id', 'type'])
test = pd.read_csv('../input/testing.txt', header=None, names=['id'])
type_to_idx = {t:... | [
"sklearn.externals.joblib.Parallel",
"sklearn.externals.joblib.delayed",
"pandas.read_csv",
"numpy.hstack",
"collections.OrderedDict",
"sklearn.neighbors.KDTree",
"pandas.concat"
] | [((160, 231), 'pandas.read_csv', 'pd.read_csv', (['"""../input/training.txt"""'], {'header': 'None', 'names': "['id', 'type']"}), "('../input/training.txt', header=None, names=['id', 'type'])\n", (171, 231), True, 'import pandas as pd\n'), ((239, 301), 'pandas.read_csv', 'pd.read_csv', (['"""../input/testing.txt"""'], ... |
#!/usr/bin/env python
# coding: utf-8
# this kernel was based https://www.kaggle.com/corochann/ashrae-training-lgbm-by-meter-type
import argparse
import gc
import os
from pathlib import Path
import random
import sys
from tqdm import tqdm_notebook as tqdm
import numpy as np
import pandas as pd
import matplotlib.pypl... | [
"utils.timer",
"argparse.ArgumentParser",
"utils.add_lag_feature",
"sklearn.metrics.mean_squared_error",
"numpy.zeros",
"pandas.read_feather",
"utils.add_holiyday",
"utils.reduce_mem_usage",
"gc.collect",
"pathlib.Path",
"numpy.expm1",
"pickle.load",
"seaborn.distplot",
"utils.add_sg",
"... | [((672, 688), 'pathlib.Path', 'Path', (['"""../input"""'], {}), "('../input')\n", (676, 688), False, 'from pathlib import Path\n'), ((700, 720), 'pathlib.Path', 'Path', (['"""../processed"""'], {}), "('../processed')\n", (704, 720), False, 'from pathlib import Path\n'), ((735, 752), 'pathlib.Path', 'Path', (['"""../out... |
# Project: AttractionRepulsionModel
# Filename: arm_exp.py
# Authors: <NAME> (<EMAIL>).
"""
arm_exp: A framework for defining and running experiments for the
Attraction-Repulsion Model.
"""
import argparse
from arm import arm
from itertools import product
import pickle
import math
fr... | [
"pickle.dump",
"argparse.ArgumentParser",
"matplotlib.animation.FuncAnimation",
"numpy.random.default_rng",
"numpy.shape",
"numpy.histogram",
"matplotlib.colors.LogNorm",
"numpy.arange",
"arm.arm",
"matplotlib.pyplot.tight_layout",
"numpy.meshgrid",
"numpy.copy",
"matplotlib.pyplot.close",
... | [((12440, 12466), 'numpy.arange', 'np.arange', (['(0.05)', '(1.01)', '(0.1)'], {}), '(0.05, 1.01, 0.1)\n', (12449, 12466), True, 'import numpy as np\n'), ((15066, 15096), 'numpy.arange', 'np.arange', (['(0.05)', '(2 ** 0.5)', '(0.1)'], {}), '(0.05, 2 ** 0.5, 0.1)\n', (15075, 15096), True, 'import numpy as np\n'), ((169... |
import importlib
from hydroDL import kPath, utils
from hydroDL.app import waterQuality
from hydroDL.master import basins
from hydroDL.data import usgs, gageII, gridMET, ntn
from hydroDL.master import slurm
from hydroDL.post import axplot, figplot
import numpy as np
import matplotlib.pyplot as plt
import os
import panda... | [
"pandas.DataFrame",
"json.load",
"numpy.datetime64",
"pandas.read_csv",
"hydroDL.utils.stat.calErr",
"numpy.isnan",
"hydroDL.master.basins.loadSeq",
"numpy.where",
"numpy.mean",
"os.path.join",
"hydroDL.utils.rmNan",
"hydroDL.app.waterQuality.readSiteTS"
] | [((445, 504), 'os.path.join', 'os.path.join', (['kPath.dirData', '"""USGS"""', '"""inventory"""', '"""siteSel"""'], {}), "(kPath.dirData, 'USGS', 'inventory', 'siteSel')\n", (457, 504), False, 'import os\n'), ((3108, 3165), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'codeLst', 'columns': "['nSite', 'nSample']"}... |
"""
Choosing good features is one of your most important jobs.
"""
import numpy as np
from sklearn.datasets import load_iris
from sklearn import tree
iris = load_iris()
# print(iris.feature_names)
# print(iris.target_names)
# print(iris.data[:10])
# print(iris.target[:10])
# one of each kind of iris
test_indexes =... | [
"sklearn.datasets.load_iris",
"numpy.delete",
"sklearn.tree.DecisionTreeClassifier"
] | [((160, 171), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (169, 171), False, 'from sklearn.datasets import load_iris\n'), ((379, 421), 'numpy.delete', 'np.delete', (['iris.data', 'test_indexes'], {'axis': '(0)'}), '(iris.data, test_indexes, axis=0)\n', (388, 421), True, 'import numpy as np\n'), ((437, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.