code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/python3
import matplotlib.pyplot as plt
import csv
from math import atan2,degrees
import numpy as np
#Label line with line2D label data
def labelLine(line,x,label=None,align=True,**kwargs):
ax = line.axes
xdata = line.get_xdata()
ydata = line.get_ydata()
if (x < xdata[0]) or (x > xdata[-... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"math.atan2",
"csv.DictReader",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((3003, 3019), 'matplotlib.pyplot.figure', 'plt.figure', (['name'], {}), '(name)\n', (3013, 3019), True, 'import matplotlib.pyplot as plt\n'), ((3219, 3240), 'matplotlib.pyplot.title', 'plt.title', (['"""COVID 19"""'], {}), "('COVID 19')\n", (3228, 3240), True, 'import matplotlib.pyplot as plt\n'), ((3250, 3268), 'mat... |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import testing
from chainer.testing import attr
class TestDummyDeviceType(unittest.TestCase):
def test_int(self):
self.assertEqual(int(cuda.DummyDeviceType()), -1)
def test_eq(self):
self.assertEqual(cuda.Dum... | [
"chainer.testing.parameterize",
"chainer.cuda.cupy.testing.assert_array_equal",
"chainer.cuda.Stream",
"chainer.testing.run_module",
"chainer.testing.attr.multi_gpu",
"chainer.cuda.set_max_workspace_size",
"chainer.cuda.cupy.asfortranarray",
"chainer.cuda.to_cpu",
"numpy.int64",
"chainer.cuda.get_... | [((2273, 2342), 'chainer.testing.parameterize', 'testing.parameterize', (["{'c_contiguous': True}", "{'c_contiguous': False}"], {}), "({'c_contiguous': True}, {'c_contiguous': False})\n", (2293, 2342), False, 'from chainer import testing\n'), ((4597, 4666), 'chainer.testing.parameterize', 'testing.parameterize', (["{'c... |
import os
import keras
import random
import numpy as np
from ibex.utilities import dataIO
from ibex.utilities.constants import *
from ibex.cnns.biological.util import AugmentFeature
from ibex.cnns.biological.nodes.train import NodeNetwork, PlotLosses, WriteLogFiles
# node generation function is similar except that... | [
"ibex.cnns.biological.nodes.train.NodeNetwork",
"os.makedirs",
"ibex.cnns.biological.nodes.train.WriteLogFiles",
"keras.callbacks.ModelCheckpoint",
"random.shuffle",
"numpy.zeros",
"ibex.cnns.biological.nodes.train.PlotLosses",
"os.path.exists",
"ibex.cnns.biological.util.AugmentFeature",
"os.list... | [((1003, 1033), 'os.listdir', 'os.listdir', (['positive_directory'], {}), '(positive_directory)\n', (1013, 1033), False, 'import os\n'), ((1402, 1445), 'numpy.concatenate', 'np.concatenate', (['positive_candidates'], {'axis': '(0)'}), '(positive_candidates, axis=0)\n', (1416, 1445), True, 'import numpy as np\n'), ((151... |
import numpy as np
import pandas as pd
import os
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.preprocessing import normalize
from sklearn.decomposition import TruncatedSVD
from sklearn.cluster import KMeans
import joblib
from convokit.transformer import Transformer
class PromptTypes(Transf... | [
"os.mkdir",
"sklearn.decomposition.TruncatedSVD",
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.cluster.KMeans",
"os.path.exists",
"numpy.hstack",
"numpy.array",
"sklearn.preprocessing.normalize",
"os.path.join",
"os.listdir"
] | [((29724, 29849), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'min_df': 'reference__tfidf_min_df', 'max_df': 'reference__tfidf_max_df', 'binary': '(True)', 'token_pattern': '"""(?u)(\\\\S+)"""'}), "(min_df=reference__tfidf_min_df, max_df=\n reference__tfidf_max_df, binary=True, token_... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 14 10:23:53 2013
Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.
@author: <NAME>, <NAME>
@email: <EMAIL>, <EMAIL>
@license: BSD 3-clause.
"""
import os
import unittest
import tempfile
import numpy as np
import scipy as sp
from parsimony.algorit... | [
"unittest.main",
"numpy.save",
"numpy.random.seed",
"tempfile.mkstemp",
"scipy.sparse.linalg.svds",
"parsimony.algorithms.nipals.RankOneSparseSVD",
"numpy.zeros",
"numpy.linalg.svd",
"numpy.linalg.norm",
"numpy.reshape",
"scipy.sparse.csr_matrix",
"numpy.random.random",
"parsimony.algorithms... | [((1283, 1318), 'numpy.zeros', 'np.zeros', (['num_elements'], {'dtype': 'float'}), '(num_elements, dtype=float)\n', (1291, 1318), True, 'import numpy as np\n'), ((1568, 1595), 'numpy.reshape', 'np.reshape', (['zero_vec', 'shape'], {}), '(zero_vec, shape)\n', (1578, 1595), True, 'import numpy as np\n'), ((4912, 4929), '... |
from selsum.utils.posterior_generator import PosteriorGenerator
from shared_lib.utils.helpers.general import flatten
from selsum.utils.constants.model import FEATS, FEATS_MASK
from selsum.utils.helpers.collators import collate_subsampled
from selsum.data.abs_dataset import collate as abs_collate
import numpy as np
from... | [
"selsum.utils.posterior_generator.PosteriorGenerator",
"selsum.data.abs_dataset.collate",
"copy.copy",
"numpy.ones",
"numpy.arange",
"numpy.random.choice",
"selsum.utils.helpers.collators.collate_subsampled"
] | [((3295, 3367), 'selsum.data.abs_dataset.collate', 'abs_collate', (['coll'], {'pad_idx': 'pad_indx', 'eos_idx': 'eos_indx', 'mask_idx': 'mask_idx'}), '(coll, pad_idx=pad_indx, eos_idx=eos_indx, mask_idx=mask_idx)\n', (3306, 3367), True, 'from selsum.data.abs_dataset import collate as abs_collate\n'), ((3414, 3450), 'se... |
import os.path as op
from sklearn.externals import joblib as jl
from sklearn.pipeline import Pipeline
from sklearn.feature_selection import f_classif, SelectPercentile
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import StratifiedKFold
from sklearn.svm import SVC
from sklearn.metrics im... | [
"sklearn.preprocessing.StandardScaler",
"sklearn.svm.SVC",
"skbold.postproc.MvpResults",
"sklearn.feature_selection.SelectPercentile",
"sklearn.model_selection.StratifiedKFold",
"numpy.array",
"sklearn.externals.joblib.load",
"os.path.join",
"numpy.unique"
] | [((581, 618), 'sklearn.externals.joblib.load', 'jl.load', (['"""MVP/mvp_across_subjects.jl"""'], {}), "('MVP/mvp_across_subjects.jl')\n", (588, 618), True, 'from sklearn.externals import joblib as jl\n'), ((633, 659), 'numpy.unique', 'np.unique', (['mvp.directories'], {}), '(mvp.directories)\n', (642, 659), True, 'impo... |
#!/usr/bin/env python3
import sys
import cereal.messaging as messaging
import numpy as np
import matplotlib.pyplot as plt
N = 21
# debug longitudinal MPC by plotting its trajectory. To receive liveLongitudinalMpc packets,
# set on LOG_MPC env variable and run plannerd on a replay
def plot_longitudinal_mpc(addr="127... | [
"cereal.messaging.sub_sock",
"cereal.messaging.recv_sock",
"numpy.zeros",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.exp",
"numpy.array"
] | [((358, 425), 'cereal.messaging.sub_sock', 'messaging.sub_sock', (['"""liveLongitudinalMpc"""'], {'addr': 'addr', 'conflate': '(True)'}), "('liveLongitudinalMpc', addr=addr, conflate=True)\n", (376, 425), True, 'import cereal.messaging as messaging\n'), ((441, 499), 'cereal.messaging.sub_sock', 'messaging.sub_sock', ([... |
from lz import *
from torch.nn import BatchNorm1d, BatchNorm2d, Dropout, \
MaxPool2d, AdaptiveAvgPool2d, Sequential, Module, Parameter
from collections import namedtuple
from config import conf
import functools, logging
from torch import nn
import numpy as np
if conf.use_chkpnt:
BatchNorm2d = functools.partial... | [
"torch.nn.Dropout",
"torch.nn.init.uniform_",
"torch.nn.InstanceNorm2d",
"numpy.sin",
"torch.nn.init.constant_",
"numpy.random.randint",
"modules.bn.InPlaceABNSync",
"models.lpf.Downsample",
"torch.nn.Linear",
"torch.nn.AvgPool2d",
"torch.utils.checkpoint.checkpoint_sequential",
"numpy.stack",... | [((7762, 7816), 'collections.namedtuple', 'namedtuple', (['"""Block"""', "['in_channel', 'depth', 'stride']"], {}), "('Block', ['in_channel', 'depth', 'stride'])\n", (7772, 7816), False, 'from collections import namedtuple\n'), ((26297, 26317), 'numpy.stack', 'np.stack', (['controller'], {}), '(controller)\n', (26305, ... |
import warnings
try:
import matplotlib.pyplot as pl
except ImportError:
warnings.warn("matplotlib could not be loaded!")
pass
from ._labels import labels
from ..utils import format_value, ordinal_str
from ._utils import convert_ordering, convert_color, merge_nodes, get_sort_order, sort_inds, dendrogram_coor... | [
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.xlim",
"numpy.sum",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.yticks",
"numpy.argsort",
"numpy.min",
"numpy.max",
"numpy.array",
"matplotlib.pyplot.gca",
"warnings.warn"... | [((10041, 10049), 'matplotlib.pyplot.gcf', 'pl.gcf', ([], {}), '()\n', (10047, 10049), True, 'import matplotlib.pyplot as pl\n'), ((10059, 10067), 'matplotlib.pyplot.gca', 'pl.gca', ([], {}), '()\n', (10065, 10067), True, 'import matplotlib.pyplot as pl\n'), ((12314, 12344), 'matplotlib.pyplot.xlabel', 'pl.xlabel', (['... |
#!/usr/bin/env python
"""Tests for `lsst_efd_client` package."""
import numpy
import pandas as pd
import json
import pytest
from kafkit.registry.sansio import MockRegistryApi
from astropy.time import Time, TimeDelta
import astropy.units as u
from aioinflux import InfluxDBClient
import pathlib
from lsst_efd_client im... | [
"lsst_efd_client.rendezvous_dataframes",
"lsst_efd_client.EfdClient",
"pandas.read_hdf",
"aioinflux.InfluxDBClient",
"lsst_efd_client.EfdClient.list_efd_names",
"kafkit.registry.sansio.MockRegistryApi",
"astropy.time.Time",
"astropy.time.TimeDelta",
"json.dumps",
"lsst_efd_client.resample",
"num... | [((786, 800), 'lsst_efd_client.NotebookAuth', 'NotebookAuth', ([], {}), '()\n', (798, 800), False, 'from lsst_efd_client import NotebookAuth, EfdClient, resample, rendezvous_dataframes\n'), ((869, 903), 'pandas.read_hdf', 'pd.read_hdf', (["(PATH / 'efd_test.hdf')"], {}), "(PATH / 'efd_test.hdf')\n", (880, 903), True, '... |
from auto_pilot.localization.filter import Filter
from auto_pilot.data.world_map import WorldMap
from auto_pilot.data.senseRet import SensorRet
from auto_pilot.data.motion import Motion
from auto_pilot.data.coordinates import Coordinates
from auto_pilot.common.param import Param
from auto_pilot.common.util import regio... | [
"numpy.zeros",
"auto_pilot.localization.filter.Filter.register",
"auto_pilot.data.coordinates.Coordinates"
] | [((411, 439), 'auto_pilot.localization.filter.Filter.register', 'Filter.register', (['"""histogram"""'], {}), "('histogram')\n", (426, 439), False, 'from auto_pilot.localization.filter import Filter\n'), ((1603, 1627), 'numpy.zeros', 'np.zeros', (['prob_mat.shape'], {}), '(prob_mat.shape)\n', (1611, 1627), True, 'impor... |
from abc import abstractmethod
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
import pyro
import torch
from sbibm.utils.io import get_tensor_from_csv, save_tensor_to_csv
from sbibm.utils.pyro import get_log_prob_fn, get_log_prob_grad_fn
... | [
"pyro.condition",
"numpy.random.seed",
"torch.stack",
"torch.unique",
"sbibm.utils.pyro.get_log_prob_grad_fn",
"pandas.read_csv",
"sbibm.utils.io.get_tensor_from_csv",
"torch.manual_seed",
"torch.cat",
"sbibm.utils.pyro.get_log_prob_fn",
"joblib.Parallel",
"joblib.delayed",
"torch.tensor"
] | [((3638, 3663), 'sbibm.utils.io.get_tensor_from_csv', 'get_tensor_from_csv', (['path'], {}), '(path)\n', (3657, 3663), False, 'from sbibm.utils.io import get_tensor_from_csv, save_tensor_to_csv\n'), ((4016, 4041), 'sbibm.utils.io.get_tensor_from_csv', 'get_tensor_from_csv', (['path'], {}), '(path)\n', (4035, 4041), Fal... |
"""
.. module::
:synopsis: Module doing stuff...
.. moduleauthor:: <NAME>
"""
from .model import BioNeuron
from odynn import utils
from pylab import plt
import random
import numpy as np
import tensorflow as tf
import collections
MIN_TAU = 1.
MAX_TAU = 1000.
MIN_SCALE = 1.
MAX_SCALE = 200.
# Class for our new m... | [
"pylab.plt.ylabel",
"pylab.plt.legend",
"pylab.plt.plot",
"random.uniform",
"pylab.plt.title",
"tensorflow.stack",
"numpy.array",
"pylab.plt.subplot",
"pylab.plt.figure",
"pylab.plt.xlabel"
] | [((956, 983), 'numpy.array', 'np.array', (['[-60.0, 0.0, 1.0]'], {}), '([-60.0, 0.0, 1.0])\n', (964, 983), True, 'import numpy as np\n'), ((3029, 3041), 'pylab.plt.figure', 'plt.figure', ([], {}), '()\n', (3039, 3041), False, 'from pylab import plt\n'), ((3051, 3071), 'pylab.plt.subplot', 'plt.subplot', (['(4)', '(1)',... |
from itertools import groupby
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import linregress
n = np.array([1, 2, 3, 4, 5, 6])
# Strong scaling
s = np.array([
# distr, run, collection, total
[0.5918669700622559, 529.6803040504456, 9.309041976928711, 8.99303198258082],
[1.810841083526... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((122, 150), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6]'], {}), '([1, 2, 3, 4, 5, 6])\n', (130, 150), True, 'import numpy as np\n'), ((172, 693), 'numpy.array', 'np.array', (['[[0.5918669700622559, 529.6803040504456, 9.309041976928711, \n 8.99303198258082], [1.8108410835266113, 270.1959412097931, \n 15.396... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 29 13:40:36 2018
@author: uqhmin
"""
import numpy as np
import cv2
from skimage.measure import label, regionprops
class Preprocess:
def __init__(self, rawim, im, breast_mask, lesion_mask):
self.raw = rawim
self.image = im
self.... | [
"numpy.uint8",
"numpy.percentile",
"numpy.shape",
"skimage.measure.label",
"numpy.uint16",
"skimage.measure.regionprops"
] | [((1861, 1899), 'numpy.percentile', 'np.percentile', (['intensity_in_mask', '(99.8)'], {}), '(intensity_in_mask, 99.8)\n', (1874, 1899), True, 'import numpy as np\n'), ((1937, 1974), 'numpy.percentile', 'np.percentile', (['intensity_in_mask', '(0.2)'], {}), '(intensity_in_mask, 0.2)\n', (1950, 1974), True, 'import nump... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import numpy as np
from repoze.lru import LRUCache
from opensfm import features as ft
logger = logging.getLogger(__name__)
class FeatureLoader(object... | [
"opensfm.features.build_flann_index",
"repoze.lru.LRUCache",
"numpy.array",
"logging.getLogger"
] | [((264, 291), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (281, 291), False, 'import logging\n'), ((375, 389), 'repoze.lru.LRUCache', 'LRUCache', (['(1000)'], {}), '(1000)\n', (383, 389), False, 'from repoze.lru import LRUCache\n'), ((418, 432), 'repoze.lru.LRUCache', 'LRUCache', (['(1... |
import os
import os.path as osp
import pickle
import sys
from collections import defaultdict
import numpy as np
from matplotlib import pyplot as plt
import experiments
import logs as loglib
from source.env.lib.enums import Neon
from source.env.lib.log import InkWell
import seaborn as sns
sns.set()
def plot(x, idxs,... | [
"source.env.lib.log.InkWell.attack",
"os.makedirs",
"source.env.lib.log.InkWell.lifetime",
"source.env.lib.log.InkWell.tick",
"matplotlib.pyplot.close",
"logs.godsword",
"source.env.lib.enums.Neon.color12",
"logs.save",
"os.path.exists",
"source.env.lib.log.InkWell.reward",
"source.env.lib.log.I... | [((291, 300), 'seaborn.set', 'sns.set', ([], {}), '()\n', (298, 300), True, 'import seaborn as sns\n'), ((353, 367), 'source.env.lib.enums.Neon.color12', 'Neon.color12', ([], {}), '()\n', (365, 367), False, 'from source.env.lib.enums import Neon\n'), ((453, 470), 'logs.godsword', 'loglib.godsword', ([], {}), '()\n', (4... |
# coding: utf-8
# # CareerCon 2019 - Help Navigate Robots
# ## Robots are smart… by design !!
#
# 
#
# ---
#
# Robots are smart… by design. To fully understand and properly navigate a task, however, they need input about their environment.
#
# In this compe... | [
"matplotlib.pyplot.title",
"numpy.heaviside",
"seaborn.heatmap",
"matplotlib.style.use",
"seaborn.kdeplot",
"math.atan2",
"pandas.read_csv",
"math.asin",
"numpy.abs",
"numpy.ones",
"numpy.argsort",
"gc.collect",
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.tick_params",
... | [((2822, 2850), 'sklearn.preprocessing.LabelEncoder', 'preprocessing.LabelEncoder', ([], {}), '()\n', (2848, 2850), False, 'from sklearn import preprocessing\n'), ((3678, 3697), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (3687, 3697), True, 'import matplotlib.style as style\n'), ((3715... |
from scipy.sparse import coo_matrix, csr_matrix, diags
from scheduler import PyScheduler
import numpy as np
# A = coo_matrix(np.array([[10, 1, 0, 0, 2],
# [1, 10, 0, 0, 3],
# [0, 0, 10, 0, 4],
# [0, 0, 0, 10, 5],
# [2, ... | [
"scipy.sparse.diags",
"numpy.zeros",
"scipy.sparse.csr_matrix",
"numpy.array",
"scheduler.PyScheduler"
] | [((363, 488), 'numpy.array', 'np.array', (['[(0, 1, 1), (0, 2, 1), (0, 3, 1), (1, 4, 1), (1, 5, 1), (1, 6, 1), (2, 7, 1\n ), (2, 8, 1), (2, 9, 1), (3, 10, 1)]'], {}), '([(0, 1, 1), (0, 2, 1), (0, 3, 1), (1, 4, 1), (1, 5, 1), (1, 6, 1),\n (2, 7, 1), (2, 8, 1), (2, 9, 1), (3, 10, 1)])\n', (371, 488), True, 'import ... |
"""
<NAME>
2016-06-06
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
from skimage.feature import canny
from skimage.segmentation import clear_border
from skimage.morphology import dilation, rectangle
from skimage.measure... | [
"utils.calculate_convexity",
"numpy.ones",
"cv2.adaptiveThreshold",
"cv2.floodFill",
"cv2.erode",
"os.path.join",
"skimage.morphology.dilation",
"skimage.measure.regionprops",
"pandas.DataFrame",
"cv2.dilate",
"cv2.connectedComponents",
"skimage.segmentation.clear_border",
"utils.calculate_c... | [((1904, 1925), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (1914, 1925), False, 'import os\n'), ((10003, 10043), 'cv2.connectedComponents', 'cv.connectedComponents', (['(1 - binary_image)'], {}), '(1 - binary_image)\n', (10025, 10043), True, 'import cv2 as cv\n'), ((10057, 10082), 'skimage.measur... |
import cv2
import numpy as np
class imageTOoMatrix:
def __init__(self, images_name, img_width, img_height):
self.images_name = images_name
self.img_width = img_width
self.img_height = img_height
self.img_size = (img_width * img_height)
def getMatrix(self):
... | [
"cv2.imread",
"numpy.asmatrix",
"numpy.zeros",
"cv2.resize"
] | [((367, 397), 'numpy.zeros', 'np.zeros', (['(self.img_size, col)'], {}), '((self.img_size, col))\n', (375, 397), True, 'import numpy as np\n'), ((474, 493), 'cv2.imread', 'cv2.imread', (['name', '(0)'], {}), '(name, 0)\n', (484, 493), False, 'import cv2\n'), ((514, 565), 'cv2.resize', 'cv2.resize', (['gray', '(self.img... |
# Copyright 2019 DeepMind Technologies Limited
#
# 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... | [
"open_spiel.python.algorithms.adidas_utils.helpers.misc.pt_reduce",
"absl.testing.absltest.main",
"numpy.stack",
"numpy.zeros_like",
"scipy.spatial.distance.cosine",
"numpy.copy",
"numpy.allclose",
"numpy.ones",
"numpy.random.RandomState",
"absl.logging.info",
"numpy.finfo",
"numpy.mean",
"a... | [((1928, 2195), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('PED', (ped, False))", "('ATE_p=1', (ate, 1.0, False))", "('ATE_p=0.5', (ate, 0.5, False))", "('ATE_p=0.1', (ate, 0.1, False))", "('ATE_p=0', (ate, 0.0, False))", "('QRE_t=0.0', (qre, 0.0, False))", "('QRE_t=0.1', (qre,... |
# Copyright (C) 2016 <NAME>
# All rights reserved.
import sys
import json
import base64
import struct
import pdb
import numpy as np
RGB_FORMAT = 6407
RGB_ALPHA_FORMAT = 6408
SRGB_FORMAT = 0x8C40
SRGB_ALPHA_FORMAT = 0x8C42
TEXTURE_2D_TARGET = 3553
UNSIGNED_BYTE_TYPE = 5121
CLAMP_TO_EDGE = 33071
LINEAR_MIPMAP_LIN... | [
"json.dump",
"json.load",
"numpy.identity",
"base64.b64decode",
"numpy.array",
"base64.b64encode",
"numpy.dot",
"sys.stderr.write",
"struct.pack_into",
"sys.exit",
"struct.unpack_from"
] | [((1268, 1282), 'numpy.identity', 'np.identity', (['(4)'], {}), '(4)\n', (1279, 1282), True, 'import numpy as np\n'), ((1056, 1092), 'base64.b64decode', 'base64.b64decode', (["buffer['uri'][23:]"], {}), "(buffer['uri'][23:])\n", (1072, 1092), False, 'import base64\n'), ((1741, 1768), 'numpy.dot', 'np.dot', (['node_mat'... |
import math
import numpy
import pylab
from classes import *
class DimensionSimulation(Simulation):
def __init__(self, width, height):
Simulation.__init__(self, 1, width, height)
self.lastSize = None
self.sizes = []
self.particles = []
def callback(self):
currentSize =... | [
"pylab.semilogy",
"pylab.title",
"pylab.show",
"math.exp",
"numpy.polyfit",
"pylab.ylabel",
"numpy.array",
"pylab.xlabel",
"pylab.semilogx",
"pylab.legend",
"pylab.plot"
] | [((1063, 1085), 'numpy.polyfit', 'numpy.polyfit', (['x', 'y', '(1)'], {}), '(x, y, 1)\n', (1076, 1085), False, 'import numpy\n'), ((1109, 1188), 'pylab.plot', 'pylab.plot', (['sizes', 'particles'], {'linestyle': '""""""', 'marker': '"""."""', 'label': '"""Experiment data"""'}), "(sizes, particles, linestyle='', marker=... |
# Copyright 2015 Google Inc. 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 a... | [
"tensorflow.python.platform.gfile.FastGFile",
"subprocess.Popen",
"tensorflow.python.platform.gfile.GFile",
"tarfile.open",
"tensorflow.logging.fatal",
"shlex.split",
"tensorflow.Session",
"tensorflow.python.platform.gfile.Exists",
"six.moves.urllib.request.urlretrieve",
"sys.stdout.flush",
"ten... | [((2622, 2637), 'shlex.split', 'shlex.split', (['fp'], {}), '(fp)\n', (2633, 2637), False, 'import shlex\n'), ((3394, 3602), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""model_dir"""', '"""/home/lsw/Images/HuWeiSP/"""', '"""Path to classify_image_graph_def.pb, imagenet_synset_to_human_label... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
df = pd.read_csv('transport22.csv', sep=';')
df = df.T
df = df.rename(columns={0: "rok", 1: "jednostka", 2: "wartosc"},
index={"motocykle ogółem": "motocykle",
"motocykle ogółem.1": "motocykle",
... | [
"pandas.read_csv",
"matplotlib.pyplot.legend",
"numpy.array",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((82, 121), 'pandas.read_csv', 'pd.read_csv', (['"""transport22.csv"""'], {'sep': '""";"""'}), "('transport22.csv', sep=';')\n", (93, 121), True, 'import pandas as pd\n'), ((2183, 2231), 'numpy.array', 'np.array', (["['motocykle', 'samochody', 'autobusy']"], {}), "(['motocykle', 'samochody', 'autobusy'])\n", (2191, 22... |
# Copyright (c) 2020 CNES
#
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import pickle
import unittest
import numpy as np
import pyinterp.core as core
class TestGrid4D(unittest.TestCase):
"""Test of the C+++/Python interface of the pyin... | [
"unittest.main",
"numpy.meshgrid",
"pyinterp.core.Bilinear3D",
"pyinterp.core.Axis",
"numpy.arange",
"numpy.exp",
"numpy.all",
"pickle.dumps"
] | [((3343, 3358), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3356, 3358), False, 'import unittest\n'), ((481, 502), 'numpy.arange', 'np.arange', (['(-1)', '(1)', '(0.2)'], {}), '(-1, 1, 0.2)\n', (490, 502), True, 'import numpy as np\n'), ((515, 536), 'numpy.arange', 'np.arange', (['(-1)', '(1)', '(0.2)'], {}), ... |
# -*- coding: utf-8 -*-
"""
"""
#%% Import necessary modules and packages
import numpy as np
from scipy import linalg
from scipy import signal
from matplotlib import pyplot as plt
#%% Load wind velocity and plot
plt.close('all')
t=np.load('ProblemSet5_task2_t.npy')
V=np.load('ProblemSet5_task2_V.npy')
... | [
"matplotlib.pyplot.xlim",
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid"
] | [((217, 233), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (226, 233), True, 'from matplotlib import pyplot as plt\n'), ((237, 271), 'numpy.load', 'np.load', (['"""ProblemSet5_task2_t.npy"""'], {}), "('ProblemSet5_task2_t.npy')\n", (244, 271), True, 'import numpy as np\n'), ((274, 308), 'nu... |
import sys
import os
import warnings
import itertools
import time
import glob
import urllib.request
import argparse
import numpy as np
import torch
files = {
"config.json": "https://huggingface.co/sentence-transformers/paraphrase-distilroberta-base-v1/resolve/main/config.json",
"pytorch_model.bin": "https://h... | [
"sys.stdout.write",
"numpy.load",
"numpy.save",
"argparse.ArgumentParser",
"os.makedirs",
"torch.load",
"os.path.exists",
"time.time",
"sys.stdout.flush",
"numpy.array",
"glob.glob",
"warnings.warn",
"itertools.chain"
] | [((960, 978), 'os.path.exists', 'os.path.exists', (['fn'], {}), '(fn)\n', (974, 978), False, 'import os\n'), ((1512, 1557), 'glob.glob', 'glob.glob', (['f"""./{weights_dir}/*LayerNorm*.npy"""'], {}), "(f'./{weights_dir}/*LayerNorm*.npy')\n", (1521, 1557), False, 'import glob\n'), ((2408, 2437), 'itertools.chain', 'iter... |
#
# Packt Publishing
# Hands-on Tensorflow Lite for Intelligent Mobile Apps
# @author: <NAME>
#
# Section 3: Handwriting recognition
# Video 3-3: Parameter study
#
import tensorflow as tf
import numpy as np
from scipy.io import loadmat
import itertools
# Import E-MNIST data
mydata = loadmat("matlab/emnist-balanced.ma... | [
"tensorflow.contrib.layers.xavier_initializer",
"scipy.io.loadmat",
"tensorflow.keras.initializers.he_uniform",
"tensorflow.reset_default_graph",
"numpy.argmax",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.nn.conv2d",
"tensorflow.get_variable",
"tensorflow.nn.softmax",
"tensorflow.nn.... | [((286, 323), 'scipy.io.loadmat', 'loadmat', (['"""matlab/emnist-balanced.mat"""'], {}), "('matlab/emnist-balanced.mat')\n", (293, 323), False, 'from scipy.io import loadmat\n'), ((2715, 2740), 'numpy.linspace', 'np.linspace', (['(1e-05)', '(1)', '(10)'], {}), '(1e-05, 1, 10)\n', (2726, 2740), True, 'import numpy as np... |
import os
import tensorflow as tf
import numpy as np
from matplotlib import pyplot as plt
import time
import datetime
import tqdm
import numpy as np
from pathlib import Path
import argparse
import cv2
from pyspark.sql.types import *
from pyspark.sql import SparkSession
sess = tf.Session()
graph = tf.get_default_graph(... | [
"numpy.stack",
"argparse.ArgumentParser",
"pyspark.sql.SparkSession.builder.getOrCreate",
"os.path.basename",
"tensorflow.Session",
"time.time",
"cv2.VideoCapture",
"datetime.datetime.strptime",
"datetime.timedelta",
"numpy.row_stack",
"os.path.splitext",
"tensorflow.get_default_graph",
"os.... | [((278, 290), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (288, 290), True, 'import tensorflow as tf\n'), ((299, 321), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (319, 321), True, 'import tensorflow as tf\n'), ((337, 379), 'os.path.join', 'os.path.join', (["os.environ['HOME']", ... |
import torch
import torch.utils.data as data_utils
import logging
import numpy as np
import cv2
from tqdm import tqdm
logger = logging.getLogger(__name__)
class UCF101(data_utils.Dataset):
def __init__(self, video_list, subset='train', transforms=None, length=1, new_width=171, new_height=128):
super(UCF1... | [
"tqdm.tqdm",
"numpy.asarray",
"logging.getLogger",
"torch.tensor",
"cv2.resize"
] | [((128, 155), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (145, 155), False, 'import logging\n'), ((503, 514), 'tqdm.tqdm', 'tqdm', (['lines'], {}), '(lines)\n', (507, 514), False, 'from tqdm import tqdm\n'), ((1946, 1989), 'numpy.asarray', 'np.asarray', (["[info['class']]"], {'dtype':... |
#%%
# Importing libraries
import sys
import json
import csv
import pandas as pd
import multiprocessing as mp
import itertools as it
seed_value = 113
# 1. Set the `PYTHONHASHSEED` environment variable at a fixed value
import os
os.environ['PYTHONHASHSEED'] = str(seed_value)
# 2. Set the `python` built-in pseudo-rand... | [
"tensorflow.random.set_seed",
"numpy.random.seed",
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"numpy.empty",
"random.sample",
"random.shuffle",
"tensorflow.keras.layers.LayerNormalization",
"numpy.isnan",
"numpy.shape",
"tensorflow.keras.layers.Leaky... | [((364, 387), 'random.seed', 'random.seed', (['seed_value'], {}), '(seed_value)\n', (375, 387), False, 'import random\n'), ((470, 496), 'numpy.random.seed', 'np.random.seed', (['seed_value'], {}), '(seed_value)\n', (484, 496), True, 'import numpy as np\n'), ((589, 619), 'tensorflow.random.set_seed', 'tf.random.set_seed... |
import numpy as np
DAYS = 256
# with open("./input.txt", "r") as f:
# raw = f.read()
# fish = np.array([int(x) for x in raw.split(",")])
fish = np.loadtxt("./input.txt", delimiter=",", dtype=np.uint64)
def compact(fish):
rle = np.zeros(9, np.uint64)
rle[:6] = np.array([np.sum(fish == k) for k in range(... | [
"numpy.sum",
"numpy.zeros",
"numpy.loadtxt"
] | [((151, 208), 'numpy.loadtxt', 'np.loadtxt', (['"""./input.txt"""'], {'delimiter': '""","""', 'dtype': 'np.uint64'}), "('./input.txt', delimiter=',', dtype=np.uint64)\n", (161, 208), True, 'import numpy as np\n'), ((240, 262), 'numpy.zeros', 'np.zeros', (['(9)', 'np.uint64'], {}), '(9, np.uint64)\n', (248, 262), True, ... |
import os
import gzip
import struct
import tarfile
import pickle
import shutil
import numpy as np
import tables as tb
from .timerx import timer
def extractall(tar_name, root):
'''
解压 tar 文件并返回路径
root:解压的根目录
'''
with tarfile.open(tar_name) as tar:
tar.extractall(root)
tar_root = t... | [
"gzip.open",
"numpy.asanyarray",
"tables.Filters",
"pickle.load",
"tarfile.open",
"shutil.rmtree",
"tables.open_file",
"os.path.join",
"os.listdir"
] | [((348, 376), 'os.path.join', 'os.path.join', (['root', 'tar_root'], {}), '(root, tar_root)\n', (360, 376), False, 'import os\n'), ((240, 262), 'tarfile.open', 'tarfile.open', (['tar_name'], {}), '(tar_name)\n', (252, 262), False, 'import tarfile\n'), ((1498, 1527), 'os.path.join', 'os.path.join', (['root', 'namespace'... |
"""
Functions for surface visualization.
Only matplotlib is required.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colorbar import make_axes
from matplotlib.cm import ScalarMappable, get_cmap
from matplotlib.colors import Normalize, LinearSegmentedCol... | [
"numpy.isin",
"numpy.abs",
"matplotlib.cm.get_cmap",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"matplotlib.patches.Patch",
"numpy.unique",
"matplotlib.colors.LinearSegmentedColormap.from_list",
"matplotlib.colors.to_rgba",
"matplotlib.colors.Normalize",
"matplot... | [((7736, 7764), 'numpy.ones', 'np.ones', (['(faces.shape[0], 4)'], {}), '((faces.shape[0], 4))\n', (7743, 7764), True, 'import numpy as np\n'), ((8084, 8115), 'numpy.mean', 'np.mean', (['bg_data[faces]'], {'axis': '(1)'}), '(bg_data[faces], axis=1)\n', (8091, 8115), True, 'import numpy as np\n'), ((8324, 8347), 'matplo... |
import lens_control
import numpy
from PyQt4 import QtGui, QtCore, Qt
class controller(QtCore.QThread):
def __init__(self,interface):
QtCore.QThread.__init__(self)
self.interface=interface
self.lens=lens_control.lens(self.interface,False)
self.newinput=False
... | [
"lens_control.lens",
"PyQt4.QtCore.QThread.__init__",
"numpy.zeros"
] | [((154, 183), 'PyQt4.QtCore.QThread.__init__', 'QtCore.QThread.__init__', (['self'], {}), '(self)\n', (177, 183), False, 'from PyQt4 import QtGui, QtCore, Qt\n'), ((247, 287), 'lens_control.lens', 'lens_control.lens', (['self.interface', '(False)'], {}), '(self.interface, False)\n', (264, 287), False, 'import lens_cont... |
import struct, Filter
# check format for the XBox Data
def to_printable(c):
if 33 <= ord(c) <= 125:
return c
return "."
def hexdump(blob):
bytes = map(lambda c : "%02X" % ord(c), blob)
bytes.extend([" "] * 0x10)
line = []
for offset in range(0, len(bytes)/0x10):
s = offset * ... | [
"Filter.apply_filter",
"struct.unpack",
"numpy.average"
] | [((2839, 2881), 'numpy.average', 'np.average', (['abs_wav[i * 480:(i + 1) * 480]'], {}), '(abs_wav[i * 480:(i + 1) * 480])\n', (2849, 2881), True, 'import numpy as np\n'), ((3010, 3074), 'numpy.average', 'np.average', (['abs_wav[(len_idx - i - 1) * 480:(len_idx - i) * 480]'], {}), '(abs_wav[(len_idx - i - 1) * 480:(len... |
## LSDMap_BasicManipulation.py
##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## These functions are tools to deal with rasters
##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## SMM
## 26/07/2014
##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-... | [
"numpy.sum",
"numpy.subtract",
"numpy.ma.masked_values",
"numpy.median",
"numpy.std",
"numpy.asarray",
"numpy.argsort",
"numpy.percentile",
"numpy.mean",
"pyproj.Proj",
"numpy.array",
"pyproj.transform"
] | [((1156, 1178), 'pyproj.Proj', 'Proj', ([], {'init': '"""epsg:4326"""'}), "(init='epsg:4326')\n", (1160, 1178), False, 'from pyproj import Proj, transform\n'), ((1193, 1215), 'pyproj.Proj', 'Proj', ([], {'init': 'EPSG_string'}), '(init=EPSG_string)\n', (1197, 1215), False, 'from pyproj import Proj, transform\n'), ((122... |
# moma.py
# This python script automates MOMA as described in Ishibuchi (2009).
# Author: <NAME>
# i - bin index
# j - item index
# k - algorithm index
# m - solution index
# t - generation index
from __future__ import print_function
import binpacking as bp
import constraints
import ga
import mop
im... | [
"os.mkdir",
"numpy.argmax",
"mop.MOproblem",
"numpy.argmin",
"glob.glob",
"constraints.xycheck",
"ga.mutat",
"outformat.startout",
"numpy.savetxt",
"os.path.exists",
"numpy.equal",
"items.makeitems",
"random.seed",
"ga.xover",
"datetime.datetime.now",
"csv.writer",
"ga.binsel",
"so... | [((577, 599), 'glob.glob', 'glob', (["(folder + '*.out')"], {}), "(folder + '*.out')\n", (581, 599), False, 'from glob import glob\n'), ((819, 864), 'outformat.startout', 'outf.startout', (['filename', 'n', 'end', 'data', '"""MOMA"""'], {}), "(filename, n, end, data, 'MOMA')\n", (832, 864), True, 'import outformat as o... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# <div style='background-image:... | [
"matplotlib.pyplot.title",
"numpy.zeros_like",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.style.use",
"numpy.sin",
"matplotlib.use",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.cos",
"numpy.interp",
"matplotlib.pyplot.ylabel",
... | [((3451, 3474), 'matplotlib.use', 'matplotlib.use', (['"""nbagg"""'], {}), "('nbagg')\n", (3465, 3474), False, 'import matplotlib\n'), ((3579, 3602), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (3592, 3602), True, 'import matplotlib.pyplot as plt\n'), ((3655, 3676), 'numpy.li... |
import numpy as np
from enum import Enum, auto
# Each row represents a single test-case
# The last element in the row is the expected result
input_data_set = np.array(
[[0, 0, 0],
[0, 1, 1],
[1, 0, 1],
[1, 1, 0]]
)
def sigmoid(x, derivative=False):
if derivative:
retur... | [
"numpy.full_like",
"numpy.set_printoptions",
"numpy.vectorize",
"numpy.random.random_sample",
"numpy.sum",
"numpy.empty",
"numpy.square",
"numpy.identity",
"numpy.shape",
"numpy.array",
"numpy.exp",
"enum.auto"
] | [((166, 220), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 0]]'], {}), '([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 0]])\n', (174, 220), True, 'import numpy as np\n'), ((6416, 6448), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)'}), '(precision=3)\n', (6435, 6448), Tru... |
import numpy as np
from scipy import interpolate
# Tool A: Interpolation for velocity points
def interpolation(label_point, t_interval, v_interval=None):
# sort the label points
label_point = np.array(sorted(label_point, key=lambda t_v: t_v[0]))
# ensure the input is int
t0_vec = np.array(t_interval)... | [
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.clip"
] | [((408, 429), 'numpy.array', 'np.array', (['label_point'], {}), '(label_point)\n', (416, 429), True, 'import numpy as np\n'), ((441, 551), 'scipy.interpolate.interp1d', 'interpolate.interp1d', (['peaks_selected[:, 0]', 'peaks_selected[:, 1]'], {'kind': '"""linear"""', 'fill_value': '"""extrapolate"""'}), "(peaks_select... |
# -*- coding: utf-8 -*-
# @Author : <NAME>
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
from keras.models import Sequential, Model
from keras.layers import Convolution2D, MaxPooling2D, Conv3D, MaxPooling3D, ZeroPadding3D
from keras.layers import Activation, Dropout, Flatten, Dense, BatchNo... | [
"sklearn.metrics.confusion_matrix",
"Utils.modelStatsRecord.outputStats_assess",
"Utils.zeroPadding.zeroPadding_3D",
"Utils.ResneXt_IN_Dual_Network.ResneXt_IN",
"numpy.random.seed",
"sklearn.preprocessing.scale",
"scipy.io.loadmat",
"keras.backend.categorical_crossentropy",
"sklearn.metrics.accuracy... | [((2781, 2855), 'scipy.io.loadmat', 'sio.loadmat', (['"""D:/3D-ResNeXt-master/Datasets/IN/Indian_pines_corrected.mat"""'], {}), "('D:/3D-ResNeXt-master/Datasets/IN/Indian_pines_corrected.mat')\n", (2792, 2855), True, 'import scipy.io as sio\n'), ((2910, 2977), 'scipy.io.loadmat', 'sio.loadmat', (['"""D:/3D-ResNeXt-mast... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 29 09:24:09 2016
@author: abhishek
"""
import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
import xgboost as xgb
np.random.seed(44)
train = pd.read_csv('./data/train_processed_handle_na.csv')
test = pd.read_csv('./data/test_pro... | [
"sklearn.cross_validation.train_test_split",
"numpy.random.seed",
"pandas.read_csv",
"xgboost.train",
"xgboost.DMatrix"
] | [((205, 223), 'numpy.random.seed', 'np.random.seed', (['(44)'], {}), '(44)\n', (219, 223), True, 'import numpy as np\n'), ((233, 284), 'pandas.read_csv', 'pd.read_csv', (['"""./data/train_processed_handle_na.csv"""'], {}), "('./data/train_processed_handle_na.csv')\n", (244, 284), True, 'import pandas as pd\n'), ((292, ... |
# Tools to load and save midi files for the rnn-gan-project.
#
# This file has been modified by <NAME> to support
# operations in c-rnn-gan.pytorch project.
#
# Written by <NAME>, http://mogren.one/
#
# This file has been modified by <NAME> to support
# c-rnn-gan.pytorch operations. Original file is available in:
#
#... | [
"os.path.join",
"midi.Track",
"random.shuffle",
"numpy.zeros",
"os.path.exists",
"midi.events.NoteOnEvent",
"numpy.array",
"midi.write_midifile",
"midi.events.SetTempoEvent",
"midi.events.NoteOffEvent",
"numpy.ndarray",
"os.listdir",
"numpy.concatenate"
] | [((23093, 23117), 'numpy.zeros', 'np.zeros', ([], {'shape': '[length]'}), '(shape=[length])\n', (23101, 23117), True, 'import numpy as np\n'), ((5830, 5865), 'random.shuffle', 'random.shuffle', (["self.songs['train']"], {}), "(self.songs['train'])\n", (5844, 5865), False, 'import os, midi, math, random, re, sys\n'), ((... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 3 05:34:07 2018
@author: <NAME>
"""
# In[1]: Import Packages
import numpy as np
import time
import math
# In[2]: Function Implementation
def Gererate_Distance_Matrix(Row,Column,Matrix):
t1 = time.time()
Distance = 0
Distance_Vact = np.zeros((Row,1)) ... | [
"numpy.zeros",
"time.time"
] | [((253, 264), 'time.time', 'time.time', ([], {}), '()\n', (262, 264), False, 'import time\n'), ((302, 320), 'numpy.zeros', 'np.zeros', (['(Row, 1)'], {}), '((Row, 1))\n', (310, 320), True, 'import numpy as np\n'), ((372, 398), 'numpy.zeros', 'np.zeros', (['(Column, Column)'], {}), '((Column, Column))\n', (380, 398), Tr... |
from paddle.fluid import layers
from pytracking.features.featurebase import FeatureBase
from pytracking.libs.paddle_utils import PTensor
import numpy as np
class RGB(FeatureBase):
"""RGB feature normalized to [-0.5, 0.5]."""
def dim(self):
return 3
def stride(self):
return s... | [
"numpy.mean"
] | [((656, 697), 'numpy.mean', 'np.mean', (['(im / 255 - 0.5)', '(1)'], {'keepdims': '(True)'}), '(im / 255 - 0.5, 1, keepdims=True)\n', (663, 697), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
pd.set_option("display.max_rows", 5)
pd.set_option("display.max_columns", 6)
pd.plotting.register_matplotlib_converters()
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
import seaborn as sns
sns.se... | [
"matplotlib.backends.backend_pdf.PdfPages",
"pandas.date_range",
"numpy.random.randn",
"seaborn.load_dataset",
"pandas.plotting.register_matplotlib_converters",
"seaborn.cubehelix_palette",
"matplotlib.pyplot.rcParams.update",
"matplotlib.colors.LogNorm",
"numpy.arange",
"seaborn.relplot",
"pand... | [((86, 122), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(5)'], {}), "('display.max_rows', 5)\n", (99, 122), True, 'import pandas as pd\n'), ((123, 162), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(6)'], {}), "('display.max_columns', 6)\n", (136, 162), True, 'import pan... |
import numpy as np
try:
import rospy
except:
pass
from visual_dynamics.spaces import BoxSpace
from visual_dynamics.policies import Pr2TargetPolicy
from visual_dynamics.pr2 import planning, berkeley_pr2, pr2_trajectories
class Pr2MovingArmTargetPolicy(Pr2TargetPolicy):
def __init__(self, env, frame_id, off... | [
"visual_dynamics.pr2.berkeley_pr2.get_kinect_transform",
"visual_dynamics.spaces.BoxSpace",
"visual_dynamics.pr2.planning.plan_up_trajectory",
"numpy.tan",
"numpy.array",
"numpy.sin",
"visual_dynamics.pr2.pr2_trajectories.follow_body_traj",
"numpy.linalg.norm",
"numpy.cos"
] | [((2560, 2624), 'visual_dynamics.pr2.planning.plan_up_trajectory', 'planning.plan_up_trajectory', (['self.pr2.robot', 'self.lr', 'target_pos'], {}), '(self.pr2.robot, self.lr, target_pos)\n', (2587, 2624), False, 'from visual_dynamics.pr2 import planning, berkeley_pr2, pr2_trajectories\n'), ((2683, 2783), 'visual_dynam... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
def most_common(lst):
"""Returns the most common element in a list."""
return max(set(lst), key=lst.count)
def euc... | [
"matplotlib.pyplot.show",
"numpy.sum",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.fetch_california_housing",
"numpy.mean",
"matplotlib.pyplot.subplots"
] | [((1341, 1376), 'sklearn.datasets.fetch_california_housing', 'datasets.fetch_california_housing', ([], {}), '()\n', (1374, 1376), False, 'from sklearn import datasets\n'), ((1508, 1545), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)'}), '(X, y, test_size=0.2)\n', (152... |
import numpy as np
def solution(m):
lvl0 = []
lvl1 = []
lvl2 = []
lvl3 = []
lvl4 = []
sums = []
odds1 = []
odds2 = []
odds3 = []
odds4 = []
x = 0
while True:
for i in m[x]:
if i != 0:
if x == 0:
... | [
"numpy.lcm.reduce"
] | [((5363, 5383), 'numpy.lcm.reduce', 'np.lcm.reduce', (['denom'], {}), '(denom)\n', (5376, 5383), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
import logging
import os
from pathlib import Path
from shutil import copyfile
import click
import numpy as np
# Libraries for preprocessing
import torch
from dotenv import find_dotenv, load_dotenv
@click.command()
@click.argument("input_filepath", type=click.Path(exists=True))
@click.argument... | [
"torch.mean",
"logging.basicConfig",
"dotenv.find_dotenv",
"click.command",
"pathlib.Path",
"torch.std",
"torch.Tensor",
"numpy.reshape",
"click.Path",
"os.path.join",
"os.listdir",
"logging.getLogger"
] | [((225, 240), 'click.command', 'click.command', ([], {}), '()\n', (238, 240), False, 'import click\n'), ((563, 590), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (580, 590), False, 'import logging\n'), ((835, 861), 'os.listdir', 'os.listdir', (['input_filepath'], {}), '(input_filepath)\... |
"""numpy基礎
ランダムな数値で配列を作成する方法
標準正規分布に従う数値の配列を作成する場合(randn関数)
[説明ページ]
https://tech.nkhn37.net/numpy-ndarray-create-basic/#randn
"""
import numpy as np
data_array = np.random.randn(10)
print(data_array)
print(type(data_array))
print(data_array.dtype)
| [
"numpy.random.randn"
] | [((164, 183), 'numpy.random.randn', 'np.random.randn', (['(10)'], {}), '(10)\n', (179, 183), True, 'import numpy as np\n')] |
import os
import glob
from datetime import datetime, timedelta
import json
import time
import pandas as pd
import numpy as np
import pickle
import lightgbm as lgbm
from google.cloud import bigquery
def load_strava_activity_data_from_bq(users=["TyAndrews"]):
start_time = time.time()
raw_files_dict = {}
... | [
"pandas.read_csv",
"os.getcwd",
"time.process_time",
"google.cloud.bigquery.Client",
"time.time",
"pandas.DatetimeIndex",
"numpy.append",
"pandas.to_datetime",
"numpy.array",
"os.path.join"
] | [((279, 290), 'time.time', 'time.time', ([], {}), '()\n', (288, 290), False, 'import time\n'), ((1789, 1851), 'pandas.to_datetime', 'pd.to_datetime', (["processed_df['start_date_local_raw']"], {'unit': '"""s"""'}), "(processed_df['start_date_local_raw'], unit='s')\n", (1803, 1851), True, 'import pandas as pd\n'), ((310... |
# Copyright 2022 The Scenic Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"scenic.model_lib.base_models.model_utils.weighted_correctly_classified",
"absl.testing.absltest.main",
"numpy.sum",
"scenic.model_lib.base_models.model_utils.weighted_sigmoid_cross_entropy",
"numpy.random.randint",
"numpy.random.normal",
"numpy.testing.assert_array_almost_equal",
"scenic.model_lib.ba... | [((17739, 17754), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (17752, 17754), False, 'from absl.testing import absltest\n'), ((1146, 1196), 'jax.numpy.array', 'jnp.array', (['[[1, 0, 2], [2, 1, 0]]'], {'dtype': 'jnp.int32'}), '([[1, 0, 2], [2, 1, 0]], dtype=jnp.int32)\n', (1155, 1196), True, 'impor... |
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import datetime as dt
import numpy as np
class PlotUtils:
def __init__(self):
pass
# https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes
def plot(x, _xlabel, y, _ylabel):
# handle convergence in first tra... | [
"matplotlib.pyplot.show",
"matplotlib.ticker.MaxNLocator",
"numpy.max",
"numpy.min",
"matplotlib.pyplot.gca"
] | [((479, 488), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (486, 488), True, 'import matplotlib.pyplot as plt\n'), ((913, 923), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (921, 923), True, 'import matplotlib.pyplot as plt\n'), ((575, 600), 'matplotlib.ticker.MaxNLocator', 'MaxNLocator', ([], {'int... |
from typing import NamedTuple
import numpy as np
from numpy import linspace
from numpy.random import RandomState
from numpy.testing import assert_allclose, assert_equal
import pandas as pd
from pandas.testing import assert_frame_equal, assert_series_equal
import pytest
import scipy.stats as stats
from arch.bootstrap ... | [
"numpy.abs",
"numpy.isnan",
"numpy.mean",
"numpy.arange",
"pandas.DataFrame",
"arch.bootstrap.multiple_comparison.SPA",
"arch.bootstrap.multiple_comparison.StepM",
"arch.bootstrap.multiple_comparison.MCS",
"numpy.isfinite",
"numpy.random.RandomState",
"numpy.max",
"pytest.raises",
"numpy.tes... | [((716, 732), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (730, 732), False, 'import pytest\n'), ((759, 777), 'numpy.random.RandomState', 'RandomState', (['(23456)'], {}), '(23456)\n', (770, 777), False, 'from numpy.random import RandomState\n'), ((794, 808), 'scipy.stats.chi2', 'stats.chi2', (['(10)'], {}), ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import os
import time
import tables
from faster_particles.display_utils import display_uresnet
from faster_particles.base_net import basenets
from faster_particles.me... | [
"numpy.count_nonzero",
"os.makedirs",
"faster_particles.demo_ppn.load_weights",
"os.path.isdir",
"faster_particles.demo_ppn.get_data",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"time.time",
"tables.Filters",
"numpy.where",
"numpy.reshape",
"faster_particles.metrics.UResN... | [((977, 996), 'faster_particles.metrics.UResNetMetrics', 'UResNetMetrics', (['cfg'], {}), '(cfg)\n', (991, 996), False, 'from faster_particles.metrics import UResNetMetrics\n'), ((1011, 1138), 'tables.Filters', 'tables.Filters', ([], {'complevel': '(5)', 'complib': '"""zlib"""', 'shuffle': '(True)', 'bitshuffle': '(Fal... |
import numpy as np
import matplotlib.pyplot as plt
from helper import bezier
from mpl_toolkits.mplot3d import Axes3D
# Blended Wing Body has two scenarios about construction
# 1. establishment based on existing normal shape aircraft
# 2. new establishment
# 1 is necessary for completing the value of bottom area
# ba... | [
"helper.bezier",
"numpy.poly1d",
"matplotlib.pyplot.show",
"mpl_toolkits.mplot3d.Axes3D",
"numpy.polyfit",
"matplotlib.pyplot.figure",
"numpy.tan",
"numpy.array",
"numpy.max",
"numpy.linspace",
"numpy.sign",
"numpy.sin",
"numpy.cos",
"numpy.sqrt"
] | [((1942, 1963), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(30)'], {}), '(0, 1, 30)\n', (1953, 1963), True, 'import numpy as np\n'), ((2438, 2469), 'numpy.linspace', 'np.linspace', (['st[1]', '(b * 0.5)', '(30)'], {}), '(st[1], b * 0.5, 30)\n', (2449, 2469), True, 'import numpy as np\n'), ((2936, 2959), 'numpy.a... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... | [
"generation.at_types.tc_arg_info.GlobalArgInfo",
"generation.at_types.tc_arg_info.GlobalResetArgInfo",
"generation.generator_decorators.generation_function",
"numpy.array",
"quantization.symmetric.kernels.rnn.internal_qtype",
"quantization.qtype.QType.Pow2"
] | [((1186, 1294), 'generation.generator_decorators.generation_function', 'generation_function', (['"""globals"""', '(RNNParameters, LSTMParameters, GRUParameters)'], {'qrec_types': '(QREC_MULT8,)'}), "('globals', (RNNParameters, LSTMParameters,\n GRUParameters), qrec_types=(QREC_MULT8,))\n", (1205, 1294), False, 'from... |
import gpytorch
import random
import numpy as np
import torch
from scipy.optimize import minimize
class QLearningAgent:
def __init__(self, id, hp, utility_function, num_actions):
self.alpha = hp.alpha
self.epsilon = hp.epsilon
self.utility = utility_function
self.rand_prob = hp.ra... | [
"numpy.full",
"scipy.optimize.minimize",
"numpy.sum",
"random.uniform",
"numpy.zeros",
"numpy.ones",
"numpy.random.randint",
"numpy.array",
"numpy.random.random",
"torch.from_numpy"
] | [((446, 472), 'numpy.zeros', 'np.zeros', (['(num_actions, 2)'], {}), '((num_actions, 2))\n', (454, 472), True, 'import numpy as np\n'), ((910, 945), 'numpy.random.randint', 'np.random.randint', (['self.num_actions'], {}), '(self.num_actions)\n', (927, 945), True, 'import numpy as np\n'), ((1803, 1862), 'scipy.optimize.... |
# Copyright 2020 NVIDIA. 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 agree... | [
"os.mkdir",
"json.dump",
"argparse.ArgumentParser",
"logging.basicConfig",
"json.loads",
"sklearn.model_selection.train_test_split",
"os.rename",
"os.path.exists",
"numpy.random.RandomState",
"logging.info",
"librosa.load",
"numpy.random.choice",
"tarfile.open",
"librosa.output.write_wav",... | [((2765, 2821), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X'], {'test_size': 'test_size', 'random_state': '(1)'}), '(X, test_size=test_size, random_state=1)\n', (2781, 2821), False, 'from sklearn.model_selection import train_test_split\n'), ((2889, 2954), 'sklearn.model_selection.train_test_spl... |
# coding:utf-8
# Author: 阿财(<EMAIL>)(<EMAIL>)
# Created date: 2020-02-27
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2019 yutiansut/QUANTAXIS
#
# 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 Sof... | [
"pandas.DataFrame",
"GolemQ.portfolio.utils.calc_onhold_returns_v2",
"numpy.full",
"empyrical.annual_return",
"numpy.errstate",
"numpy.min",
"numpy.max",
"numpy.where",
"numpy.mean"
] | [((2924, 3124), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "[AKA.CODE, 'imf_num', 'imf', 'position', FLD.TURNOVER_RATIO, FLD.\n TURNOVER_RATIO_MEAN, 'returns', FLD.TRANSACTION_RETURN_MEAN, FLD.\n ANNUAL_RETURN, FLD.ANNUAL_RETURN_MEAN]"}), "(columns=[AKA.CODE, 'imf_num', 'imf', 'position', FLD.\n TURN... |
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
"nnabla.utils.image_utils.get_backend",
"nnabla.utils.data_iterator.data_iterator_simple",
"image_preprocess.preprocess_image_and_label",
"cv2.imread",
"nnabla.utils.image_utils.set_backend",
"numpy.loadtxt",
"nnabla.utils.image_utils.get_available_backends",
"os.path.join",
"nnabla.utils.image_util... | [((2232, 2274), 'nnabla.utils.image_utils.imread', 'imread', (['fname'], {'return_palette_indices': '(True)'}), '(fname, return_palette_indices=True)\n', (2238, 2274), False, 'from nnabla.utils.image_utils import imread\n'), ((3424, 3521), 'nnabla.utils.data_iterator.data_iterator_simple', 'data_iterator_simple', (['im... |
#!/usr/bin/env python
# coding: utf-8
import math
import numpy as np
# ### Generate the sensor environment
# generate input data streams
def gen_input(mu, mu_c, sigma, tau, L):
'''
Generate observation for one episode from expected mean and
covariance matrix.
Args:
mu : normal mean of the obse... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"numpy.random.multivariate_normal",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.vstack"
] | [((675, 720), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', (['mu', 'sigma', 'tau'], {}), '(mu, sigma, tau)\n', (704, 720), True, 'import numpy as np\n'), ((805, 856), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', (['mu_c', 'sigma', '(L - tau)'], {}), '(mu_c, sigma, L - tau... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# <NAME>
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)
# pylint: disable=C0103
"""
guiqwt.builder
--------------
The `builder` module provides a builder singleton class
used to simplify the creation of plot items.
Examp... | [
"guiqwt.histogram.lut_range_threshold",
"guiqwt.styles.CurveParam",
"guiqwt.image.MaskedImageItem",
"guiqwt.shapes.XRangeSelection",
"guiqwt.label.LabelItem",
"guiqwt.image.RGBImageItem",
"qtpy.py3compat.is_text_string",
"guiqwt.label.RangeComputation",
"guiqwt.styles.HistogramParam",
"numpy.arang... | [((3136, 3153), 'guiqwt.styles.style_generator', 'style_generator', ([], {}), '()\n', (3151, 3153), False, 'from guiqwt.styles import update_style_attr, CurveParam, ErrorBarParam, style_generator, LabelParam, LegendParam, ImageParam, TrImageParam, HistogramParam, Histogram2DParam, RGBImageParam, MaskedImageParam, XYIma... |
import numpy as np
import math
def quantization(sample, sf, ba, QCa, QCb):
"""
Arguments:
sample: the sample to quantize
sf: the scale factor
ba: the bit allocation
QCa: the multiplicative uniform quantization parameter
QCb: the additive uniform quan... | [
"numpy.floor",
"math.pow"
] | [((418, 437), 'math.pow', 'math.pow', (['(2)', '(ba - 1)'], {}), '(2, ba - 1)\n', (426, 437), False, 'import math\n'), ((469, 507), 'numpy.floor', 'np.floor', (['((QCa * scaled + QCb) * power)'], {}), '((QCa * scaled + QCb) * power)\n', (477, 507), True, 'import numpy as np\n')] |
"""AtomNumber module.
An ndarray to store atom densities with string, integer, or slice indexing.
"""
import numpy as np
class AtomNumber(object):
""" AtomNumber module.
An ndarray to store atom densities with string, integer, or slice indexing.
Parameters
----------
mat_to_ind : OrderedDict o... | [
"numpy.zeros",
"numpy.ones"
] | [((1816, 1835), 'numpy.ones', 'np.ones', (['self.n_mat'], {}), '(self.n_mat)\n', (1823, 1835), True, 'import numpy as np\n'), ((2101, 2135), 'numpy.zeros', 'np.zeros', (['(self.n_mat, self.n_nuc)'], {}), '((self.n_mat, self.n_nuc))\n', (2109, 2135), True, 'import numpy as np\n')] |
import logging
import math
import os
import random
from functools import partial
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import scipy
import seaborn as sns
import torch
from scipy.interpolate import griddata
from skorch.dataset import unpack_data
from torchvision.utils imp... | [
"seaborn.kdeplot",
"numpy.abs",
"torch.cat",
"logging.getLogger",
"numpy.argsort",
"npf.utils.predict.SamplePredictor",
"npf.utils.helpers.MultivariateNormalDiag",
"numpy.arange",
"os.path.join",
"torch.dist",
"npf.utils.datasplit.GridCntxtTrgtGetter",
"matplotlib.ticker.FixedLocator",
"matp... | [((918, 945), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (935, 945), False, 'import logging\n'), ((1127, 1141), 'utils.helpers.set_seed', 'set_seed', (['seed'], {}), '(seed)\n', (1135, 1141), False, 'from utils.helpers import mean, set_seed, tuple_cont_to_cont_tuple\n'), ((1347, 1397)... |
from hls4ml.converters.keras_to_hls import keras_to_hls
import pytest
import hls4ml
import numpy as np
from sklearn.metrics import accuracy_score
import tensorflow as tf
from tensorflow.keras.models import model_from_json
import yaml
@pytest.fixture(scope='module')
def data():
X = np.random.rand(100,100,7)
ret... | [
"hls4ml.converters.keras_to_hls.keras_to_hls",
"numpy.argmax",
"pytest.fixture",
"numpy.random.rand",
"pytest.mark.parametrize",
"tensorflow.keras.models.model_from_json"
] | [((236, 266), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (250, 266), False, 'import pytest\n'), ((328, 358), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (342, 358), False, 'import pytest\n'), ((607, 763), 'pytest.mark.paramet... |
"""
.. _dynamictable-howtoguide:
DynamicTable How-To Guide
=========================
This is a user guide to interacting with ``DynamicTable`` objects.
"""
###############################################################################
# Introduction
# ------------
# The :py:class:`~hdmf.common.table.DynamicTable`... | [
"hdmf.common.VectorIndex",
"hdmf.common.VectorData",
"hdmf.common.table.DynamicTableRegion",
"hdmf.backends.hdf5.h5_utils.H5DataIO",
"hdmf.common.DynamicTable.from_dataframe",
"hdmf.common.table.EnumData",
"hdmf.common.DynamicTable",
"numpy.array",
"hdmf.common.table.ElementIdentifiers"
] | [((1242, 1303), 'hdmf.common.DynamicTable', 'DynamicTable', ([], {'name': '"""my_table"""', 'description': '"""an example table"""'}), "(name='my_table', description='an example table')\n", (1254, 1303), False, 'from hdmf.common import DynamicTable\n'), ((2226, 2287), 'hdmf.common.VectorData', 'VectorData', ([], {'name... |
import os
import sys
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import classification_report, confusion_matrix
from torch.nn.utils import clip_grad_norm_
from torch.optim import Adam, lr_scheduler
from torch.utils.data import DataLoader
from t... | [
"args.print_args",
"os.makedirs",
"torch.utils.data.DataLoader",
"utils.AverageMeter",
"torch.nn.BCELoss",
"os.path.exists",
"args.get_args",
"torch.nn.functional.one_hot",
"time.time",
"data.BertEntityPairDataset",
"transformers.AutoTokenizer.from_pretrained",
"transformers.get_linear_schedul... | [((975, 989), 'utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (987, 989), False, 'from utils import AlphaTest, AverageMeter, ModelCheckpoint, Summary, accuracy, set_all_seed\n'), ((1006, 1020), 'utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (1018, 1020), False, 'from utils import AlphaTest, AverageMete... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers.core import Dense,Activation,Dropout
from keras.layers import LSTM
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection ... | [
"sklearn.ensemble.RandomForestClassifier",
"keras.layers.core.Dense",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"keras.layers.LSTM",
"keras.layers.core.Activation",
"sklearn.metrics.accuracy_score",
"numpy.expand_dims",
"keras.callbacks.EarlyStopping",
"numpy.arange",
"seabo... | [((688, 767), 'pandas.read_csv', 'pd.read_csv', (['"""../../../input/ronitf_heart-disease-uci/heart.csv"""'], {'delimiter': '""","""'}), "('../../../input/ronitf_heart-disease-uci/heart.csv', delimiter=',')\n", (699, 767), True, 'import pandas as pd\n'), ((824, 854), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {... |
"""
9. 19. 2020
by <NAME>
This file is used to generate 3D models from input 4-channel images
Run from anaconda console
"""
import torch
import torch.nn.parallel
import examples.recon.datasets as datasets
from examples.recon.utils import AverageMeter, img_cvt
import soft_renderer as sr
import soft_renderer.functiona... | [
"os.makedirs",
"examples.recon.models.Model",
"torch.autograd.Variable",
"torch.load",
"numpy.ascontiguousarray",
"numpy.asanyarray",
"time.time",
"numpy.array",
"soft_renderer.functional.save_obj",
"examples.recon.utils.AverageMeter",
"os.path.join",
"os.listdir"
] | [((1262, 1366), 'examples.recon.models.Model', 'models.Model', (['"""/mnt/zhengwen/model_synthesis/SoftRas/data/obj/sphere/sphere_642.obj"""'], {'args': 'args'}), "(\n '/mnt/zhengwen/model_synthesis/SoftRas/data/obj/sphere/sphere_642.obj',\n args=args)\n", (1274, 1366), True, 'import examples.recon.models as mode... |
"""
Generate colored noise.
Cloned from https://github.com/felixpatzelt/colorednoise on Jan 23 2019.
Author: <NAME>, 2014-2017.
"""
from numpy import concatenate, real, std, abs
from numpy.fft import ifft, fftfreq
from numpy.random import normal
def powerlaw_psd_gaussian(exponent, samples, fmin=0):
"""Gaussian (1... | [
"numpy.std",
"numpy.fft.ifft",
"numpy.fft.fftfreq",
"numpy.concatenate"
] | [((1453, 1469), 'numpy.fft.fftfreq', 'fftfreq', (['samples'], {}), '(samples)\n', (1460, 1469), False, 'from numpy.fft import ifft, fftfreq\n'), ((1642, 1674), 'numpy.concatenate', 'concatenate', (['[f[f < 0], [f[-1]]]'], {}), '([f[f < 0], [f[-1]]])\n', (1653, 1674), False, 'from numpy import concatenate, real, std, ab... |
#%% Importing libraries
import os
import glob
import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib import rc
from mpl_toolkits.mplot3d import Axes3D
from scipy.special import erfc as erfc
from scipy.optimize import curve_fit
#%% Setting a "LaTeX-like" plotting style
plt.st... | [
"matplotlib.rc",
"numpy.amin",
"matplotlib.colors.Normalize",
"matplotlib.cm.get_cmap",
"matplotlib.pyplot.cm.ScalarMappable",
"numpy.amax",
"scipy.optimize.curve_fit",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.max",
"numpy.loadtxt",
"glob.glob",
"matplotlib.pyplot.sa... | [((314, 338), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""default"""'], {}), "('default')\n", (327, 338), True, 'from matplotlib import pyplot as plt\n'), ((339, 408), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'DejaVu Sans', 'serif': ['Computer Modern']})\n", (341, 408), False, 'from... |
import numpy as np
from batch_rl_algorithms.batch_rl_algorithm import BatchRLAlgorithm
class DUIPI(BatchRLAlgorithm):
# Algorithm implemented following 'Uncertainty Propagation for Efficient Exploration in Reinforcement Learning'
# by <NAME> and <NAME>; a small modification has been added see the Master's th... | [
"numpy.minimum",
"numpy.sum",
"numpy.nan_to_num",
"numpy.argmax",
"numpy.zeros",
"numpy.ones",
"numpy.einsum",
"numpy.dot",
"numpy.sqrt"
] | [((3338, 3381), 'numpy.zeros', 'np.zeros', (['[self.nb_states, self.nb_actions]'], {}), '([self.nb_states, self.nb_actions])\n', (3346, 3381), True, 'import numpy as np\n'), ((3876, 3935), 'numpy.zeros', 'np.zeros', (['(self.nb_states, self.nb_actions, self.nb_states)'], {}), '((self.nb_states, self.nb_actions, self.nb... |
import argparse
import ast
import re
import threading
import time
import numpy as np
from pandas import read_table
from deep4cast.forecasters import Forecaster
from deep4cast.metrics import adjust_for_horizon, mape
import os
mutex = threading.Lock()
def load_topology(args):
"""
Loads the network(s) topolo... | [
"threading.Thread",
"ast.literal_eval",
"argparse.ArgumentParser",
"os.path.basename",
"numpy.expand_dims",
"deep4cast.metrics.adjust_for_horizon",
"time.time",
"threading.Lock",
"deep4cast.forecasters.Forecaster",
"re.findall",
"pandas.read_table"
] | [((237, 253), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (251, 253), False, 'import threading\n'), ((1782, 1818), 'pandas.read_table', 'read_table', (['data_file'], {'sep': 'separator'}), '(data_file, sep=separator)\n', (1792, 1818), False, 'from pandas import read_table\n'), ((6759, 6784), 'argparse.Argumen... |
#!/usr/bin/env python
"""
Misfit functions used by the 'default' preprocess class use to quantify
differences between data and synthetics.
All functions defined have four required positional arguments
:type syn: np.array
:param syn: synthetic data array
:type obs: np.array
:param obs: observed data ... | [
"numpy.arctan2",
"numpy.sum",
"numpy.argmax",
"numpy.flipud",
"scipy.signal.hilbert"
] | [((1943, 1959), 'numpy.arctan2', 'np.arctan2', (['i', 'r'], {}), '(i, r)\n', (1953, 1959), True, 'import numpy as np\n'), ((2037, 2053), 'numpy.arctan2', 'np.arctan2', (['i', 'r'], {}), '(i, r)\n', (2047, 2053), True, 'import numpy as np\n'), ((2969, 2983), 'numpy.argmax', 'np.argmax', (['syn'], {}), '(syn)\n', (2978, ... |
# This helper code is adapted from:
# https://github.com/scikit-learn/scikit-learn/pull/16061
# TODO: remove this code from the MOOC when the feature is
# made available in a stable version of scikit-learn itself.
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.utils ... | [
"pandas.DataFrame",
"sklearn.preprocessing.LabelEncoder",
"numpy.linspace",
"sklearn.utils.check_matplotlib_support",
"sklearn.utils._safe_indexing",
"matplotlib.pyplot.subplots"
] | [((4826, 4882), 'sklearn.utils.check_matplotlib_support', 'check_matplotlib_support', (['"""DecisionBoundaryDisplay.plot"""'], {}), "('DecisionBoundaryDisplay.plot')\n", (4850, 4882), False, 'from sklearn.utils import check_matplotlib_support\n'), ((9510, 9568), 'sklearn.utils.check_matplotlib_support', 'check_matplotl... |
""" Tests for example data. """
import os
import pytest
import numpy as np
import rasterio as rio
import geopandas as gpd
from earthpy.io import path_to_example
def test_invalid_datasets_raise_errors():
""" Raise errors when users provide nonexistent datasets. """
with pytest.raises(KeyError):
path_t... | [
"rasterio.open",
"numpy.concatenate",
"pytest.raises",
"earthpy.io.path_to_example",
"os.path.isfile",
"rasterio.crs.CRS.from_epsg"
] | [((652, 680), 'earthpy.io.path_to_example', 'path_to_example', (['"""epsg.json"""'], {}), "('epsg.json')\n", (667, 680), False, 'from earthpy.io import path_to_example\n'), ((692, 717), 'os.path.isfile', 'os.path.isfile', (['epsg_path'], {}), '(epsg_path)\n', (706, 717), False, 'import os\n'), ((281, 304), 'pytest.rais... |
"""
Piecewise-Linear Transformation Function
These functions, as the name suggests, are not entirely linear in the nature.
However, they are linear between certain x-intervals. One of the most commonly
used piecewise-linear transformation functions is contrast stretching.
"""
import cv2
import numpy a... | [
"numpy.vectorize",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"cv2.imshow"
] | [((675, 709), 'cv2.imread', 'cv2.imread', (['"""../images/sample.jpg"""'], {}), "('../images/sample.jpg')\n", (685, 709), False, 'import cv2\n'), ((845, 868), 'numpy.vectorize', 'np.vectorize', (['pixel_val'], {}), '(pixel_val)\n', (857, 868), True, 'import numpy as np\n'), ((955, 994), 'cv2.imshow', 'cv2.imshow', (['"... |
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from scipy.stats import multivariate_normal
class GaussianNaiveBayes(BaseEstimator):
"""
Gaussian Naive-Bayes classifier
"""
def __init__(self):
"""
Instantiate a Gaussian Naive Bayes classifier
... | [
"numpy.diag",
"scipy.stats.multivariate_normal.pdf",
"numpy.zeros",
"numpy.unique"
] | [((1454, 1486), 'numpy.unique', 'np.unique', (['y'], {'return_counts': '(True)'}), '(y, return_counts=True)\n', (1463, 1486), True, 'import numpy as np\n'), ((1629, 1672), 'numpy.zeros', 'np.zeros', (['(num_of_classes, num_of_features)'], {}), '((num_of_classes, num_of_features))\n', (1637, 1672), True, 'import numpy a... |
import numpy as np
import torch.nn.functional as F
from librosa.filters import mel
from librosa.util import pad_center
from scipy.signal import get_window
from torch.autograd import Variable
from .constants import *
class STFT(torch.nn.Module):
"""adapted from <NAME>'s https://github.com/pseeth/pytorch-stft"""
... | [
"librosa.util.pad_center",
"scipy.signal.get_window",
"torch.autograd.Variable",
"librosa.filters.mel",
"numpy.imag",
"numpy.real",
"numpy.eye"
] | [((2785, 2854), 'librosa.filters.mel', 'mel', (['sample_rate', 'filter_length', 'n_mels', 'mel_fmin', 'mel_fmax'], {'htk': '(True)'}), '(sample_rate, filter_length, n_mels, mel_fmin, mel_fmax, htk=True)\n', (2788, 2854), False, 'from librosa.filters import mel\n'), ((729, 755), 'numpy.eye', 'np.eye', (['self.filter_len... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.ops.operations.Cast",
"mindspore.ops.operations.DType",
"numpy.ones",
"mindspore.ops.operations.Fill",
"mindspore.model_zoo.Bert_NEZHA.bert_model.SaturateCast",
"mindspore.ops.operations.Transpose",
"mindspore.ops.operations.Mul",
"mindspore.ops.operations.TensorAdd",
"mindspore.common.in... | [((1765, 1799), 'mindspore.common.initializer.TruncatedNormal', 'TruncatedNormal', (['initializer_range'], {}), '(initializer_range)\n', (1780, 1799), False, 'from mindspore.common.initializer import TruncatedNormal\n'), ((1866, 1879), 'mindspore.ops.operations.Transpose', 'P.Transpose', ([], {}), '()\n', (1877, 1879),... |
# -*- coding: utf-8 -*-
"""Collection of functions for the manipulation of time series."""
from __future__ import absolute_import, division, print_function
import sys
import mando
import numpy as np
import pandas as pd
import typic
from mando.rst_text_formatter import RSTHelpFormatter
from .. import tsutils
def _... | [
"mando.command",
"numpy.array",
"numpy.ones"
] | [((1657, 1728), 'mando.command', 'mando.command', (['"""dtw"""'], {'formatter_class': 'RSTHelpFormatter', 'doctype': '"""numpy"""'}), "('dtw', formatter_class=RSTHelpFormatter, doctype='numpy')\n", (1670, 1728), False, 'import mando\n'), ((964, 978), 'numpy.array', 'np.array', (['ts_a'], {}), '(ts_a)\n', (972, 978), Tr... |
import warnings
warnings.filterwarnings("ignore")
import os
import sys
sys.path.append(os.pardir)
import time
import numpy as np
from cifar_data import load_data
from evaluate.evaluate import evaluate_batch
from utils.optimizers import *
from utils.activations import *
from train import data_generator
from model.Base i... | [
"sys.path.append",
"numpy.random.seed",
"numpy.sum",
"warnings.filterwarnings",
"numpy.random.randn",
"train.data_generator.datainit",
"cifar_data.load_data",
"numpy.zeros",
"numpy.ndim",
"time.time",
"numpy.random.rand",
"numpy.dot",
"numpy.sqrt",
"numpy.unique",
"evaluate.evaluate.eval... | [((16, 49), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (39, 49), False, 'import warnings\n'), ((71, 97), 'sys.path.append', 'sys.path.append', (['os.pardir'], {}), '(os.pardir)\n', (86, 97), False, 'import sys\n'), ((6897, 6915), 'numpy.random.seed', 'np.random.seed', ... |
#!/usr/bin/python
#
## @file
#
# Class for rendering multiple images in taken at different magnifications.
# This is used by the steve software and others for image display.
#
# Hazen 07/13
#
import pickle
import numpy
import os
from PyQt5 import QtCore, QtGui, QtWidgets
## MultifieldView
#
# Handles user interacti... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtGui.QPixmap.fromImage",
"os.path.join",
"PyQt5.QtWidgets.QGraphicsView.keyPressEvent",
"PyQt5.QtGui.QColor",
"os.path.basename",
"PyQt5.QtCore.QSize",
"os.path.dirname",
"PyQt5.QtWidgets.QGraphicsItem.__init__",
"PyQt5.QtGui.QImage",
"pickle.load",
"PyQt5.Qt... | [((546, 570), 'PyQt5.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['float'], {}), '(float)\n', (563, 570), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((766, 812), 'PyQt5.QtWidgets.QGraphicsView.__init__', 'QtWidgets.QGraphicsView.__init__', (['self', 'parent'], {}), '(self, parent)\n', (798, 812), False, 'fro... |
#!/usr/bin/env python3
# ============================ Information =============================
# Project: Texas A&M AutoDrive Challenge - Year 2
# Language: Python 3.5.2
# ROS Package: camera_detection
# Repository: https://github.tamu.edu/kipvasq9/camera_detection
# File Name: camera_detection.py
# Ve... | [
"rospy.Subscriber",
"numpy.arctan2",
"keras_retinanet.utils.visualization.draw_caption",
"tensorflow.ConfigProto",
"matplotlib.pyplot.figure",
"path_planner.msg.ObstacleArray",
"numpy.linalg.pinv",
"path_planner.msg.Obstacle",
"keras_retinanet.utils.image.resize_image",
"keras_retinanet.utils.visu... | [((2037, 2092), 'keras_retinanet.models.load_model', 'models.load_model', (['model_path'], {'backbone_name': '"""resnet50"""'}), "(model_path, backbone_name='resnet50')\n", (2054, 2092), False, 'from keras_retinanet import models\n'), ((1409, 1425), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (1423, 1... |
import os
import json
import random
import argparse
from tqdm import tqdm
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.nn.init as weight_init
from torch.utils.data impo... | [
"torch.nn.Dropout",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.relu",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"numpy.mean",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"numpy.std",
"random.seed",
"torch.nn.Linear",
"json.dump",
"torch.ma... | [((441, 458), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (452, 458), False, 'import random\n'), ((463, 483), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (477, 483), True, 'import numpy as np\n'), ((488, 511), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (50... |
#! /usr/bin/env python
# coding=utf-8
# Copyright © 2016 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
import json
import pandas as pd
import numpy as np
import scipy.sparse as sp
import os.path
import sys
import itertools
from collections import defaultdict
def symmetrize(a):
return a + a.T ... | [
"pandas.DataFrame",
"json.dump",
"pandas.read_csv",
"numpy.zeros",
"numpy.isfinite",
"collections.defaultdict",
"itertools.combinations",
"scipy.sparse.lil_matrix",
"sys.exit"
] | [((5104, 5151), 'scipy.sparse.lil_matrix', 'sp.lil_matrix', (['(max_id, max_id)'], {'dtype': 'np.int32'}), '((max_id, max_id), dtype=np.int32)\n', (5117, 5151), True, 'import scipy.sparse as sp\n'), ((6897, 6939), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'df_business_tags.index'}), '(index=df_business_tags.in... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.random.seed",
"numpy.multiply",
"tensorflow.contrib.learn.python.learn.datasets.base.Datasets",
"numpy.concatenate",
"numpy.zeros",
"pickle.load",
"numpy.arange",
"numpy.array",
"tensorflow.python.framework.random_seed.get_seed",
"numpy.random.shuffle"
] | [((7577, 7637), 'tensorflow.contrib.learn.python.learn.datasets.base.Datasets', 'base.Datasets', ([], {'train': 'train', 'validation': 'validation', 'test': 'test'}), '(train=train, validation=validation, test=test)\n', (7590, 7637), False, 'from tensorflow.contrib.learn.python.learn.datasets import base\n'), ((7862, 7... |
"""
Tests for code generation from SymPy/SymEngine objects.
"""
import pickle
import pytest
import numpy as np
from symengine.lib.symengine_wrapper import LambdaDouble, LLVMDouble
from symengine import zoo
from pycalphad import Model, variables as v
from pycalphad.codegen.callables import build_phase_records
from pyca... | [
"pycalphad.Model",
"pycalphad.codegen.sympydiff_utils.build_constraint_functions",
"numpy.all",
"pycalphad.codegen.sympydiff_utils.build_functions",
"numpy.isclose",
"numpy.array",
"pycalphad.variables.Species",
"pycalphad.tests.fixtures.select_database",
"pycalphad.tests.fixtures.load_database",
... | [((472, 501), 'pycalphad.tests.fixtures.select_database', 'select_database', (['"""alnipt.tdb"""'], {}), "('alnipt.tdb')\n", (487, 501), False, 'from pycalphad.tests.fixtures import select_database, load_database\n'), ((2713, 2742), 'pycalphad.tests.fixtures.select_database', 'select_database', (['"""alnipt.tdb"""'], {... |
import numpy as np
from scipy import ndimage
import mahotas.center_of_mass
np.random.seed(2321)
def _mean_out(img, axis):
if len(img.shape) == 2: return img.mean(1-axis)
if axis == 0:
return _mean_out(img.mean(1), 0)
return _mean_out(img.mean(0), axis - 1)
def slow_center_of_mass(img):
'''
... | [
"scipy.ndimage.center_of_mass",
"numpy.random.seed",
"numpy.abs",
"numpy.zeros",
"numpy.array",
"numpy.arange",
"numpy.random.rand"
] | [((76, 96), 'numpy.random.seed', 'np.random.seed', (['(2321)'], {}), '(2321)\n', (90, 96), True, 'import numpy as np\n'), ((491, 503), 'numpy.array', 'np.array', (['xs'], {}), '(xs)\n', (499, 503), True, 'import numpy as np\n'), ((630, 661), 'numpy.arange', 'np.arange', (['(256)'], {'dtype': 'np.uint16'}), '(256, dtype... |
import numpy as np
import graphlearning as gl
import matplotlib.pyplot as plt
import sklearn.datasets as datasets
from utils import peikonal_depth
import sys
k = 20
frac=0.05
alpha=2
#Plotting
numw = 16
numh = 10
for dataset in ['mnist','fashionmnist']:
f_bdy, axarr_bdy = plt.subplots(numh,numw,gridspec_kw={'w... | [
"graphlearning.weightmatrix.knnsearch",
"matplotlib.pyplot.show",
"utils.peikonal_depth",
"numpy.argmax",
"numpy.zeros",
"graphlearning.datasets.load",
"numpy.transpose",
"numpy.ones",
"numpy.argsort",
"numpy.nonzero",
"numpy.max",
"numpy.reshape",
"sys.exit",
"matplotlib.pyplot.subplots",... | [((4400, 4410), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4408, 4410), True, 'import matplotlib.pyplot as plt\n'), ((282, 350), 'matplotlib.pyplot.subplots', 'plt.subplots', (['numh', 'numw'], {'gridspec_kw': "{'wspace': 0.1, 'hspace': 0.1}"}), "(numh, numw, gridspec_kw={'wspace': 0.1, 'hspace': 0.1})\n"... |
import time
import torch
import numpy as np
from pathlib import Path
from transformers import WEIGHTS_NAME, CONFIG_NAME
def init_seed():
seed_val = 42
np.random.seed(seed_val)
torch.manual_seed(seed_val)
torch.cuda.manual_seed_all(seed_val)
device = torch.device("cuda") if torch.cuda.i... | [
"numpy.random.seed",
"torch.stack",
"numpy.argmax",
"torch.manual_seed",
"torch.argmax",
"torch.cat",
"time.time",
"numpy.equal",
"torch.cuda.manual_seed_all",
"pathlib.Path",
"torch.cuda.is_available",
"torch.device",
"torch.no_grad"
] | [((170, 194), 'numpy.random.seed', 'np.random.seed', (['seed_val'], {}), '(seed_val)\n', (184, 194), True, 'import numpy as np\n'), ((200, 227), 'torch.manual_seed', 'torch.manual_seed', (['seed_val'], {}), '(seed_val)\n', (217, 227), False, 'import torch\n'), ((233, 269), 'torch.cuda.manual_seed_all', 'torch.cuda.manu... |
import cv2
import urllib2
import numpy as np
import sys
host = "192.168.0.220:8080"
if len(sys.argv)>1:
host = sys.argv[1]
hoststr = 'http://' + host + '/video'
print ('Streaming ' + hoststr)
stream=urllib2.urlopen(hoststr)
bytes=''
while True:
bytes+=stream.read(1024)
a = bytes.find('\xff\xd8')
b =... | [
"cv2.waitKey",
"cv2.imshow",
"urllib2.urlopen",
"numpy.fromstring"
] | [((206, 230), 'urllib2.urlopen', 'urllib2.urlopen', (['hoststr'], {}), '(hoststr)\n', (221, 230), False, 'import urllib2\n'), ((515, 537), 'cv2.imshow', 'cv2.imshow', (['hoststr', 'i'], {}), '(hoststr, i)\n', (525, 537), False, 'import cv2\n'), ((447, 481), 'numpy.fromstring', 'np.fromstring', (['jpg'], {'dtype': 'np.u... |
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
class WindowGenerator:
def __init__(
self,
input_width,
label_width,
shift,
train_df,
validation_df,
test_df,
stride=10,
label_columns=None,
):
""""""
... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"tensorflow.stack",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"tensorflow.keras.preprocessing.timeseries_datase... | [((2514, 2566), 'numpy.array', 'np.array', (['data[self.label_columns]'], {'dtype': 'np.float32'}), '(data[self.label_columns], dtype=np.float32)\n', (2522, 2566), True, 'import numpy as np\n'), ((2585, 2778), 'tensorflow.keras.preprocessing.timeseries_dataset_from_array', 'tf.keras.preprocessing.timeseries_dataset_fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.