code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2017, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | [
"numpy.prod",
"numpy.arange",
"htmresearch.algorithms.location_modules.SensorToBodyModule2D",
"numpy.append",
"numpy.array",
"collections.defaultdict",
"random.randint",
"htmresearch.algorithms.location_modules.BodyToSpecificObjectModule2D"
] | [((2479, 2507), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""uint32"""'}), "([], dtype='uint32')\n", (2487, 2507), True, 'import numpy as np\n'), ((13192, 13220), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (13215, 13220), False, 'import collections\n'), ((2606, 2665), 'numpy.ap... |
import os
import tempfile
import subprocess
import logging
import uuid
import time
import socket
import numpy as np
import cclib
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import PeriodicTable
from rdkit.Chem.rdMolTransforms import GetBondLength
logging.getLogger("cclib").setL... | [
"logging.getLogger",
"numpy.clip",
"rdkit.Chem.AllChem.CalcNumRotatableBonds",
"cclib.io.ccread",
"subprocess.run",
"rdkit.Chem.AllChem.MMFFGetMoleculeProperties",
"socket.gethostname",
"rdkit.Chem.AllChem.AddHs",
"rdkit.Chem.GetPeriodicTable",
"rdkit.Chem.PeriodicTable.GetRcovalent",
"rdkit.Che... | [((289, 315), 'logging.getLogger', 'logging.getLogger', (['"""cclib"""'], {}), "('cclib')\n", (306, 315), False, 'import logging\n'), ((2400, 2431), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['self.smiles'], {}), '(self.smiles)\n', (2418, 2431), False, 'from rdkit import Chem\n'), ((2446, 2470), 'rdkit.Chem.rd... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... | [
"numpy.zeros",
"copy.copy"
] | [((4311, 4350), 'numpy.zeros', 'np.zeros', (['param.shape'], {'dtype': 'np.float32'}), '(param.shape, dtype=np.float32)\n', (4319, 4350), True, 'import numpy as np\n'), ((6995, 7008), 'copy.copy', 'copy.copy', (['st'], {}), '(st)\n', (7004, 7008), False, 'import copy\n')] |
#!/usr/bin/env python
__author__ = '<NAME>'
#========================================================================
import os, sys
import copy
import time
import uuid
import pickle
import subprocess
import numpy as np
import tensorflow as tf
from gryffin.utilities import Logger
from gryffin.uti... | [
"numpy.abs",
"os.path.getsize",
"pickle.dump",
"numpy.where",
"pickle.load",
"time.sleep",
"uuid.uuid4",
"os.path.isfile",
"numpy.array",
"numpy.empty",
"subprocess.call",
"copy.deepcopy",
"time.time",
"os.remove"
] | [((1834, 1909), 'subprocess.call', 'subprocess.call', (["('python %s %s' % (self.exec_name, config_name))"], {'shell': '(True)'}), "('python %s %s' % (self.exec_name, config_name), shell=True)\n", (1849, 1909), False, 'import subprocess\n'), ((2320, 2335), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (2330, ... |
import sys
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
sys.path.append('..')
from datasets import dataloaders
from tqdm import tqdm
def get_score(acc_list):
mean = np.mean(acc_list)
interval = 1.96*np.sqrt(np.var(acc_list)/len(acc_list))
return mean,interval
d... | [
"numpy.mean",
"torch.eq",
"numpy.array",
"datasets.dataloaders.meta_test_dataloader",
"sys.path.append",
"numpy.var"
] | [((97, 118), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (112, 118), False, 'import sys\n'), ((213, 230), 'numpy.mean', 'np.mean', (['acc_list'], {}), '(acc_list)\n', (220, 230), True, 'import numpy as np\n'), ((442, 595), 'datasets.dataloaders.meta_test_dataloader', 'dataloaders.meta_test_dat... |
from RoboPy import *
import RoboPy as rp
import numpy as np
from numpy import pi
from john_radlab.Jacobian_Orthogonality.source import AIM, findY
# dh = [[0, 0, 2, 0], [0, 0, 1, 0], [0, 0, 0.3, 0], [0, 0, 1, 0]]
# dh = [[0, 0, 2.41497930, 0], [0, 0, 1.71892394e+00, 0], [0, 0, 1.38712293e-03, 0], [0, 0, 3.89431195e-01,... | [
"john_radlab.Jacobian_Orthogonality.source.AIM",
"john_radlab.Jacobian_Orthogonality.source.findY",
"numpy.random.random_sample",
"numpy.array",
"numpy.set_printoptions"
] | [((394, 425), 'numpy.random.random_sample', 'np.random.random_sample', (['(4, 4)'], {}), '((4, 4))\n', (417, 425), True, 'import numpy as np\n'), ((500, 537), 'numpy.array', 'np.array', (['[0, pi / 2, pi / 2, pi / 2]'], {}), '([0, pi / 2, pi / 2, pi / 2])\n', (508, 537), True, 'import numpy as np\n'), ((554, 562), 'joh... |
import numpy as np
from landlab import Component
_VALID_METHODS = set(["Grid"])
def _assert_method_is_valid(method):
if method not in _VALID_METHODS:
raise ValueError("%s: Invalid method name" % method)
class Radiation(Component):
"""Compute 1D and 2D total incident shortwave radiation.
Land... | [
"numpy.radians",
"numpy.tan",
"numpy.floor",
"numpy.cos",
"numpy.sin",
"numpy.arctan"
] | [((6172, 6198), 'numpy.radians', 'np.radians', (['self._latitude'], {}), '(self._latitude)\n', (6182, 6198), True, 'import numpy as np\n'), ((6277, 6323), 'numpy.cos', 'np.cos', (['(2 * np.pi / 365 * (172 - self._julian))'], {}), '(2 * np.pi / 365 * (172 - self._julian))\n', (6283, 6323), True, 'import numpy as np\n'),... |
from mltoolkit.mldp.steps.transformers import BaseTransformer
import numpy as np
from logging import getLogger
import os
logger_name = os.path.basename(__file__)
logger = getLogger(logger_name)
class RatingProp(BaseTransformer):
"""Computes the rating deviation property for reviews. And
that each batch conta... | [
"logging.getLogger",
"numpy.mean",
"os.path.basename"
] | [((136, 162), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (152, 162), False, 'import os\n'), ((172, 194), 'logging.getLogger', 'getLogger', (['logger_name'], {}), '(logger_name)\n', (181, 194), False, 'from logging import getLogger\n'), ((1031, 1051), 'numpy.mean', 'np.mean', (['refs_rat... |
# Copyright 2017 reinforce.io. 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... | [
"inspect.currentframe",
"numpy.asarray",
"tensorforce.util.get_object",
"copy.deepcopy",
"tensorforce.TensorforceError"
] | [((2501, 2522), 'copy.deepcopy', 'deepcopy', (['states_spec'], {}), '(states_spec)\n', (2509, 2522), False, 'from copy import deepcopy\n'), ((3075, 3097), 'copy.deepcopy', 'deepcopy', (['actions_spec'], {}), '(actions_spec)\n', (3083, 3097), False, 'from copy import deepcopy\n'), ((11654, 11744), 'tensorforce.util.get_... |
import os
from PIL import Image
import numpy as np
import json
import logging
import torch
import torchvision
#from .coco import coco
#from maskrcnn_benchmark.data.datasets.coco import COCODataset #as coco
from maskrcnn_benchmark.structures.bounding_box import BoxList
#from maskrcnn_benchmark.structures.segmentation_m... | [
"logging.getLogger",
"os.listdir",
"PIL.Image.open",
"os.path.join",
"numpy.array"
] | [((1181, 1208), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1198, 1208), False, 'import logging\n'), ((3513, 3533), 'numpy.array', 'np.array', (['i.shape[1]'], {}), '(i.shape[1])\n', (3521, 3533), True, 'import numpy as np\n'), ((3575, 3595), 'numpy.array', 'np.array', (['i.shape[0]']... |
"""
Hawkes process with exponential kernel.
"""
import numpy as np
def hawkes1(n_samples):
"""Hawkes1 model from Omi et al. 2019."""
mu = 0.2
alpha = [0.8, 0.0]
beta = [1.0, 20.0]
arrival_times, loglike = _sample_and_nll(n_samples, mu, alpha, beta)
nll = -loglike.mean()
return arrival_time... | [
"numpy.random.rand",
"numpy.log",
"numpy.random.exponential",
"numpy.exp",
"numpy.array"
] | [((1205, 1228), 'numpy.exp', 'np.exp', (['(-beta[0] * step)'], {}), '(-beta[0] * step)\n', (1211, 1228), True, 'import numpy as np\n'), ((1245, 1268), 'numpy.exp', 'np.exp', (['(-beta[1] * step)'], {}), '(-beta[1] * step)\n', (1251, 1268), True, 'import numpy as np\n'), ((1702, 1713), 'numpy.array', 'np.array', (['T'],... |
from typing import Dict
import numpy as np
class ZDataProcessor:
def __init__(self):
self.source_to_index = {
'acoustic': 0,
'electronic': 1,
'synthetic': 2
}
self.quality_to_index = {
'bright': 0,
'dark': 1,
'distort... | [
"numpy.zeros",
"numpy.expand_dims"
] | [((1307, 1324), 'numpy.zeros', 'np.zeros', (['(1, 10)'], {}), '((1, 10))\n', (1315, 1324), True, 'import numpy as np\n'), ((970, 1012), 'numpy.expand_dims', 'np.expand_dims', (['[velocity / 127.0]'], {'axis': '(0)'}), '([velocity / 127.0], axis=0)\n', (984, 1012), True, 'import numpy as np\n'), ((1046, 1085), 'numpy.ex... |
import time
import torch
import onnx
import os
import numpy as np
from mmcv.tensorrt import (TRTWrapper, onnx2trt, save_trt_engine,
is_tensorrt_plugin_loaded)
assert is_tensorrt_plugin_loaded(), 'Requires to complie TensorRT plugins in mmcv'
def gen_trt(onnx_file='sample.onnx', tr... | [
"numpy.mean",
"mmcv.tensorrt.TRTWrapper",
"mmcv.tensorrt.save_trt_engine",
"mmcv.tensorrt.is_tensorrt_plugin_loaded",
"os.path.join",
"torch.cuda.synchronize",
"mmcv.tensorrt.onnx2trt",
"onnx.load",
"time.time",
"torch.rand"
] | [((204, 231), 'mmcv.tensorrt.is_tensorrt_plugin_loaded', 'is_tensorrt_plugin_loaded', ([], {}), '()\n', (229, 231), False, 'from mmcv.tensorrt import TRTWrapper, onnx2trt, save_trt_engine, is_tensorrt_plugin_loaded\n'), ((359, 379), 'onnx.load', 'onnx.load', (['onnx_file'], {}), '(onnx_file)\n', (368, 379), False, 'imp... |
import copy
import matplotlib.pyplot as plt
import numpy
import pdb
import accelerated_functions as af
import constants as c
from Boundaries.inner_1D_rectangular import Inner_1D_Rectangular
from solver import location_indexes_inv
from Species.species import Species
from timing import Timing
#Inner_1D_HET (Inherits f... | [
"numpy.ones_like",
"numpy.repeat",
"numpy.asarray",
"numpy.isin",
"numpy.append",
"numpy.shape",
"numpy.zeros_like"
] | [((1933, 1978), 'numpy.ones_like', 'numpy.ones_like', (['pos[:, 0]'], {'dtype': 'numpy.bool_'}), '(pos[:, 0], dtype=numpy.bool_)\n', (1948, 1978), False, 'import numpy\n'), ((2373, 2419), 'numpy.isin', 'numpy.isin', (['self.location', 'self.exit_pot_nodes'], {}), '(self.location, self.exit_pot_nodes)\n', (2383, 2419), ... |
# Copyright 2019 The Dreamer Authors. Copyright 2020 Plan2Explore 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... | [
"tensorflow.gfile.Exists",
"os.path.join",
"tensorflow.gfile.Glob",
"numpy.array",
"tensorflow.py_func",
"os.path.expanduser"
] | [((854, 883), 'os.path.expanduser', 'os.path.expanduser', (['directory'], {}), '(directory)\n', (872, 883), False, 'import os\n'), ((1037, 1069), 'os.path.join', 'os.path.join', (['directory', '"""*.npz"""'], {}), "(directory, '*.npz')\n", (1049, 1069), False, 'import os\n'), ((1232, 1262), 'tensorflow.py_func', 'tf.py... |
import numpy as np
import numpy.random as npr
from .base import Environment, Feedback, Spec
class ContextualEnv(Environment):
def __init__(self, arms, sd):
super().__init__()
self.arms = arms
self.sd = sd
self.max_rew = None
self.mean_rews = None
@property
def ... | [
"numpy.multiply",
"numpy.random.randn",
"numpy.max"
] | [((554, 571), 'numpy.random.randn', 'npr.randn', (['self.d'], {}), '(self.d)\n', (563, 571), True, 'import numpy.random as npr\n'), ((819, 841), 'numpy.max', 'np.max', (['self.mean_rews'], {}), '(self.mean_rews)\n', (825, 841), True, 'import numpy as np\n'), ((737, 779), 'numpy.multiply', 'np.multiply', (['self.arms', ... |
# ------------------------------------------------------------------------------
# Hippocampus segmentation published by Dryad
# (https://datadryad.org/stash/dataset/doi:10.5061/dryad.gc72v)
# ------------------------------------------------------------------------------
import os
import SimpleITK as sitk
import mp.... | [
"os.listdir",
"SimpleITK.GetImageFromArray",
"mp.data.datasets.dataset_utils.get_original_data_path",
"numpy.where",
"os.path.join",
"SimpleITK.GetArrayFromImage",
"numpy.any",
"re.match",
"os.path.isdir",
"mp.utils.load_restore.join_path",
"SimpleITK.ReadImage",
"mp.data.datasets.dataset_util... | [((1584, 1624), 'mp.data.datasets.dataset_utils.get_dataset_name', 'du.get_dataset_name', (['global_name', 'subset'], {}), '(global_name, subset)\n', (1603, 1624), True, 'import mp.data.datasets.dataset_utils as du\n'), ((1990, 2028), 'mp.data.datasets.dataset_utils.get_original_data_path', 'du.get_original_data_path',... |
'''
Provider for duck dataset from <NAME>
'''
import os
import os.path
import json
import numpy as np
import sys
import pickle
import glob
class Dataset():
def __init__(self, \
root='/scr1/mengyuan/ICCV-data/MSR_processed', \
num_points = 8192, \
num_frames=2, skip_frames=1... | [
"os.listdir",
"numpy.random.choice",
"os.path.join",
"numpy.array",
"numpy.random.uniform",
"time.time",
"numpy.arange",
"numpy.random.shuffle"
] | [((2756, 2767), 'time.time', 'time.time', ([], {}), '()\n', (2765, 2767), False, 'import time\n'), ((593, 614), 'os.listdir', 'os.listdir', (['self.root'], {}), '(self.root)\n', (603, 614), False, 'import os\n'), ((2351, 2367), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (2359, 2367), True, 'import numpy... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import traceback
# import sys
import os.path
def get_skelet3d_lib():
import ctypes
import ctypes.util
# import os
# ThinningCxxShared is C++, ThinningShared is C
# libpath = os.path.abspath(os.path.dirname(os.path.realpath(__file__)... | [
"ctypes.util.find_library",
"traceback.format_exc",
"numpy.zeros",
"ctypes.CDLL",
"numpy.frombuffer",
"ctypes.c_char_p"
] | [((575, 608), 'ctypes.util.find_library', 'ctypes.util.find_library', (['libname'], {}), '(libname)\n', (599, 608), False, 'import ctypes\n'), ((2108, 2143), 'numpy.frombuffer', 'np.frombuffer', (['sdata'], {'dtype': '"""uint8"""'}), "(sdata, dtype='uint8')\n", (2121, 2143), True, 'import numpy as np\n'), ((2212, 2246)... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"tensorflow.compat.v1.compat.as_text",
"numpy.split"
] | [((1468, 1555), 'numpy.split', 'np.split', (["example['short_answers/values']", "example['short_answers/row_starts'][1:]"], {}), "(example['short_answers/values'], example[\n 'short_answers/row_starts'][1:])\n", (1476, 1555), True, 'import numpy as np\n'), ((2259, 2281), 'tensorflow.compat.v1.compat.as_text', 'tf.co... |
from sklearn.cluster import KMeans
import numpy as np
from cv2 import cv2
from collections import Counter
from skimage.color import rgb2lab, deltaE_cie76
def RGB2HEX(color):
return "#{:02x}{:02x}{:02x}".format(int(color[0]), int(color[1]), int(color[2]))
def get_image(image):
image = cv2.cvtColor(image, cv... | [
"sklearn.cluster.KMeans",
"PIL.Image.open",
"skimage.color.deltaE_cie76",
"numpy.asarray",
"collections.Counter",
"numpy.array",
"cv2.cv2.resize",
"cv2.cv2.cvtColor"
] | [((298, 336), 'cv2.cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2RGB'], {}), '(image, cv2.COLOR_BGR2RGB)\n', (310, 336), False, 'from cv2 import cv2\n'), ((418, 477), 'cv2.cv2.resize', 'cv2.resize', (['image', '(600, 400)'], {'interpolation': 'cv2.INTER_AREA'}), '(image, (600, 400), interpolation=cv2.INTER_A... |
import torch
import torch.utils.data as data
import torch.nn as nn
import torch.optim as optim
import os
import numpy as np
import pandas as pd
import glob
import cv2
from tqdm import tqdm, trange
import matplotlib.pyplot as plt
img_size = 256
# raw data directories
X_img_path = "D:/AI in Urban Design/DL... | [
"torch.nn.ReLU",
"matplotlib.pyplot.ylabel",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.Sigmoid",
"torch.nn.BatchNorm2d",
"os.listdir",
"numpy.mean",
"torch.unsqueeze",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"torch.optim.lr_scheduler... | [((2538, 2589), 'torch.utils.data.random_split', 'data.random_split', (['dataset', '[train_size, test_size]'], {}), '(dataset, [train_size, test_size])\n', (2555, 2589), True, 'import torch.utils.data as data\n'), ((2744, 2803), 'torch.utils.data.random_split', 'data.random_split', (['train_dataset', '[training_size, v... |
import socket
import sys
import requests
#import requests_oauthlib
import prepro
import json
import time
import pandas as pd
from copulae import NormalCopula
import numpy as np
#sudo apt-get install -y python3-oauth python3-oauth2client python3-oauthlib python3-requests-oauthlib
def send_data_to_spark(data, tcp_conn... | [
"prepro.read_headers",
"socket.socket",
"pandas.read_csv",
"numpy.where",
"time.sleep",
"sys.exc_info",
"pandas.DataFrame",
"numpy.random.randn"
] | [((1351, 1451), 'pandas.read_csv', 'pd.read_csv', (['"""../nasa/event/event_wind_summary/event_wind_summary.tab"""'], {'sep': '"""\\\\s+"""', 'header': 'None'}), "('../nasa/event/event_wind_summary/event_wind_summary.tab', sep=\n '\\\\s+', header=None)\n", (1362, 1451), True, 'import pandas as pd\n'), ((1497, 1584),... |
#############################################################
# MIT License, Copyright © 2020, ETH Zurich, <NAME>
#############################################################
import numpy as np
import tensorflow as tf
import os
from tqdm import trange
from config import get_config
from util import *
from styler_2p imp... | [
"os.path.join",
"config.get_config",
"numpy.zeros",
"numpy.stack",
"tensorflow.compat.v1.set_random_seed",
"partio.read",
"partio.write",
"os.path.basename",
"partio.create",
"styler_2p.Styler",
"sys.path.append",
"tqdm.trange",
"numpy.random.RandomState"
] | [((342, 387), 'sys.path.append', 'sys.path.append', (['"""E:/partio/build/py/Release"""'], {}), "('E:/partio/build/py/Release')\n", (357, 387), False, 'import sys\n'), ((619, 660), 'tensorflow.compat.v1.set_random_seed', 'tf.compat.v1.set_random_seed', (['config.seed'], {}), '(config.seed)\n', (647, 660), True, 'import... |
"""
This module focuses on scraping and saving Game of Thrones scripts. These scripts were found through the
``genius.com/albums/Game-of-thrones`` website. All scripts are saved to the ``./scripts/`` directory (which is created
if it does not exist already).
Author: <NAME>
"""
import os
import re
from typing import ... | [
"os.path.exists",
"os.makedirs",
"re.compile",
"html2text.HTML2Text",
"requests.get",
"re.sub",
"numpy.arange",
"os.remove"
] | [((1029, 1050), 'html2text.HTML2Text', 'html2text.HTML2Text', ([], {}), '()\n', (1048, 1050), False, 'import html2text\n'), ((1215, 1232), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1227, 1232), False, 'import requests\n'), ((4482, 4497), 'numpy.arange', 'np.arange', (['(8)', '(9)'], {}), '(8, 9)\n', (4... |
import numpy as np
from scipy.spatial.distance import cdist
dat=np.array([[1,1],[1.1,1],[1.3,1],[1.5,1],[1.6,1]])
dat=np.transpose(dat)
dist_thres=0.15
num_points = dat.shape[1]
is_key_point=[False for i in range(num_points)]
print("Before filter, total {} points".format(num_points))
dat_t = np.transpose(dat)
dist = c... | [
"scipy.spatial.distance.cdist",
"numpy.array",
"numpy.transpose",
"numpy.where"
] | [((65, 123), 'numpy.array', 'np.array', (['[[1, 1], [1.1, 1], [1.3, 1], [1.5, 1], [1.6, 1]]'], {}), '([[1, 1], [1.1, 1], [1.3, 1], [1.5, 1], [1.6, 1]])\n', (73, 123), True, 'import numpy as np\n'), ((119, 136), 'numpy.transpose', 'np.transpose', (['dat'], {}), '(dat)\n', (131, 136), True, 'import numpy as np\n'), ((294... |
import os
import mmcv
import numpy as np
import matplotlib.pyplot as plt
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from mmcv import Config
from mmdet.datasets import build_dataset
MODEL = "smoking"
MODEL_NAME = "mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_smoking"
CONFIG_FILE = f"confi... | [
"mmdet.datasets.build_dataset",
"matplotlib.pyplot.grid",
"pycocotools.cocoeval.COCOeval",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"pycocotools.coco.COCO",
"mmcv.Config.fromfile",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.x... | [((781, 809), 'mmcv.Config.fromfile', 'Config.fromfile', (['config_file'], {}), '(config_file)\n', (796, 809), False, 'from mmcv import Config\n'), ((1074, 1102), 'mmdet.datasets.build_dataset', 'build_dataset', (['cfg.data.test'], {}), '(cfg.data.test)\n', (1087, 1102), False, 'from mmdet.datasets import build_dataset... |
import json
import os
from enum import Enum
from typing import List
import numpy as np
import pandas
from keras.models import Sequential
from keras.layers import LSTM, Dense, RepeatVector, TimeDistributed, Activation
from matplotlib import gridspec as grid
from matplotlib import pylab as plt
from sklearn.metrics impor... | [
"numpy.convolve",
"numpy.random.rand",
"pandas.read_csv",
"numpy.array",
"matplotlib.pylab.show",
"keras.layers.Activation",
"keras.layers.Dense",
"numpy.arange",
"numpy.atleast_2d",
"matplotlib.pylab.figure",
"matplotlib.pylab.legend",
"numpy.exp",
"keras.layers.LSTM",
"numpy.linspace",
... | [((1093, 1113), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (1102, 1113), False, 'import json\n'), ((3962, 3974), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (3972, 3974), False, 'from keras.models import Sequential\n'), ((4789, 4837), 'matplotlib.pylab.plot', 'plt.plot', (["history.h... |
import pylab as plt
import matplotlib
import numpy as np
import pylab as plt
import matplotlib
from itertools import product
import numpy as np
import pandas as pd
import os
from sklearn.metrics.pairwise import pairwise_distances
from matplotlib.ticker import ScalarFormatter, FuncFormatter
matplotlib.style.use('bmh')... | [
"numpy.log10",
"numpy.log",
"sklearn.metrics.pairwise.pairwise_distances",
"numpy.array",
"matplotlib.style.use",
"matplotlib.ticker.ScalarFormatter",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.arange",
"matplotlib.ticker.FuncFormatter",
"itertools.product",
"numpy.max",
"numpy.linspace",
... | [((293, 320), 'matplotlib.style.use', 'matplotlib.style.use', (['"""bmh"""'], {}), "('bmh')\n", (313, 320), False, 'import matplotlib\n'), ((15378, 15401), 'pylab.tight_layout', 'plt.tight_layout', ([], {'pad': '(0)'}), '(pad=0)\n', (15394, 15401), True, 'import pylab as plt\n'), ((15679, 15706), 'numpy.zeros', 'np.zer... |
import time
import copy
import numpy as np
from functools import reduce
from operator import indexOf, iconcat
from sysidentpy.utils.display_results import results
from sysidentpy.model_structure_selection import FROLS
def narmax_state_space(nx_model:FROLS, X_train, X_test, states_names):
xlag = nx_model.xlag if ... | [
"operator.indexOf",
"sysidentpy.utils.display_results.results",
"numpy.hstack",
"functools.reduce",
"numpy.delete",
"numpy.sort",
"numpy.zeros",
"numpy.vstack",
"copy.deepcopy",
"time.time"
] | [((1651, 1668), 'numpy.vstack', 'np.vstack', (['coeffs'], {}), '(coeffs)\n', (1660, 1668), True, 'import numpy as np\n'), ((1718, 1732), 'numpy.hstack', 'np.hstack', (['sim'], {}), '(sim)\n', (1727, 1732), True, 'import numpy as np\n'), ((581, 604), 'copy.deepcopy', 'copy.deepcopy', (['nx_model'], {}), '(nx_model)\n', ... |
# -*- coding: utf-8 -*-
"""AG module containing portfolio class
Todo:
* Improve portfolio analysis tools
"""
# Standard imports
from __future__ import annotations
from datetime import datetime
from numbers import Number
from copy import copy, deepcopy
from datetime import timedelta
import math
# Third party imp... | [
"math.floor",
"pandas.DatetimeIndex",
"numpy.array",
"copy.deepcopy",
"copy.copy",
"typing.TypeVar"
] | [((672, 719), 'typing.TypeVar', 'TypeVar', (['"""Asset_T"""'], {'bound': 'Asset', 'covariant': '(True)'}), "('Asset_T', bound=Asset, covariant=True)\n", (679, 719), False, 'from typing import TYPE_CHECKING, Any, TypeVar, Union, Optional, Literal, Generic, Iterable\n'), ((3652, 3666), 'copy.deepcopy', 'deepcopy', (['sel... |
import pytest
import gym
from gym import spaces
import numpy as np
from stable_baselines.common.env_checker import check_env
from stable_baselines.common.bit_flipping_env import BitFlippingEnv
from stable_baselines.common.identity_env import IdentityEnv, IdentityEnvBox
@pytest.mark.parametrize("env_id", ['CartPole-v... | [
"numpy.ones",
"stable_baselines.common.env_checker.check_env",
"gym.spaces.Discrete",
"gym.spaces.Box",
"pytest.mark.parametrize",
"pytest.raises",
"stable_baselines.common.identity_env.IdentityEnvBox",
"gym.make",
"pytest.warns"
] | [((274, 369), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""env_id"""', "['CartPole-v0', 'Pendulum-v0', 'BreakoutNoFrameskip-v4']"], {}), "('env_id', ['CartPole-v0', 'Pendulum-v0',\n 'BreakoutNoFrameskip-v4'])\n", (297, 369), False, 'import pytest\n'), ((851, 938), 'pytest.mark.parametrize', 'pytest.ma... |
import numpy as np
import tvm
from tvm.contrib import graph_runtime
import topi
import nnvm.symbol as sym
import nnvm.compiler
from nnvm.testing.config import ctx_list
def helper(symbol, inputs, dtype,
np_forward, np_backward=None, need_input=True, need_head_grads=True):
ishapes = {}
input_syms = [... | [
"numpy.clip",
"nnvm.symbol.full",
"numpy.less_equal",
"nnvm.symbol.reshape",
"numpy.greater_equal",
"numpy.flip",
"numpy.greater",
"nnvm.symbol.ones",
"numpy.reshape",
"numpy.less",
"tvm.contrib.graph_runtime.create",
"nnvm.symbol.zeros",
"nnvm.testing.config.ctx_list",
"nnvm.symbol.greate... | [((546, 556), 'nnvm.testing.config.ctx_list', 'ctx_list', ([], {}), '()\n', (554, 556), False, 'from nnvm.testing.config import ctx_list\n'), ((1986, 2003), 'nnvm.symbol.Variable', 'sym.Variable', (['"""x"""'], {}), "('x')\n", (1998, 2003), True, 'import nnvm.symbol as sym\n'), ((2155, 2165), 'nnvm.testing.config.ctx_l... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Miscellaneous utility functions
"""
from __future__ import print_function, unicode_literals, division, absolute_import
from future import standard_library
standard_library.install... | [
"re.split",
"nipy.algorithms.registration.aff2euler",
"builtins.next",
"nipy.algorithms.registration.to_matrix44",
"numpy.asarray",
"builtins.str",
"future.standard_library.install_aliases",
"numpy.zeros",
"numpy.ravel"
] | [((296, 330), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (328, 330), False, 'from future import standard_library\n'), ((3432, 3441), 'builtins.str', 'str', (['cont'], {}), '(cont)\n', (3435, 3441), False, 'from builtins import next, str\n'), ((1019, 1042), 'builtins... |
''' one_line_description
DESCRIPTION:
Insert a paragraph-long description of the module here.
FUNCTIONS:
This module contains the following (main) functions:
* fun_name : one_line_description
(only add user-facing ones)
'''
import numpy as np
import matplotlib as mpl
import matplotlib.colors
imp... | [
"numpy.unique",
"matplotlib.collections.PolyCollection",
"numpy.where",
"matplotlib.pyplot.colorbar",
"numpy.max",
"matplotlib.ticker.MaxNLocator",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"numpy.min"
] | [((1189, 1236), 'matplotlib.collections.PolyCollection', 'mpl.collections.PolyCollection', (['verts'], {}), '(verts, **kwargs)\n', (1219, 1236), True, 'import matplotlib as mpl\n'), ((4019, 4042), 'mpl_toolkits.axes_grid1.make_axes_locatable', 'make_axes_locatable', (['ax'], {}), '(ax)\n', (4038, 4042), False, 'from mp... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import absolute_import, division, unicode_literals
import argparse
import logging
import os
import os.path as ... | [
"logging.basicConfig",
"os.getpgid",
"sys.path.insert",
"senteval.engine.SE",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.join",
"numpy.array",
"threading.Thread",
"queue.Queue"
] | [((510, 532), 'os.path.join', 'osp.join', (['""".."""', '"""data"""'], {}), "('..', 'data')\n", (518, 532), True, 'import os.path as osp\n'), ((559, 595), 'sys.path.insert', 'sys.path.insert', (['(0)', 'PATH_TO_SENTEVAL'], {}), '(0, PATH_TO_SENTEVAL)\n', (574, 595), False, 'import sys\n'), ((642, 655), 'queue.Queue', '... |
"""Data Preprocessors."""
import numpy as np
from typing import Optional
class Normalization(object):
"""Rescale the data via a normalization.
Produce:
- Bring all values into the range [0, 1]
"""
def __call__(self, X, axis: int = 0):
min_x = np.amin(X, axis=axis)
max_x = np.am... | [
"numpy.mean",
"numpy.ones_like",
"numpy.amin",
"numpy.any",
"numpy.std",
"numpy.amax",
"numpy.divide"
] | [((277, 298), 'numpy.amin', 'np.amin', (['X'], {'axis': 'axis'}), '(X, axis=axis)\n', (284, 298), True, 'import numpy as np\n'), ((315, 336), 'numpy.amax', 'np.amax', (['X'], {'axis': 'axis'}), '(X, axis=axis)\n', (322, 336), True, 'import numpy as np\n'), ((963, 997), 'numpy.divide', 'np.divide', (['(X - self.mu)', 's... |
import cv2
import numpy as np
from basic import imshow, rescale
def circular(img):
if img.shape[2] < 4:
img = np.concatenate(
[
img,
np.ones((img.shape[0], img.shape[1], 1), dtype = img.dtype) * 255
],
axis = 2,
... | [
"numpy.zeros_like",
"numpy.ones"
] | [((340, 367), 'numpy.zeros_like', 'np.zeros_like', (['img[:, :, 3]'], {}), '(img[:, :, 3])\n', (353, 367), True, 'import numpy as np\n'), ((204, 261), 'numpy.ones', 'np.ones', (['(img.shape[0], img.shape[1], 1)'], {'dtype': 'img.dtype'}), '((img.shape[0], img.shape[1], 1), dtype=img.dtype)\n', (211, 261), True, 'import... |
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from getdist import plots
mpl.use("Agg")
roots = ["mcmc"]
params = ["beta", "alpha100", "alpha143", "alpha217", "alpha353"]
g = plots.get_subplot_plotter(
chain_dir=os.path.join(os.getcwd(), "chains"),
analysis_settings={... | [
"matplotlib.pyplot.savefig",
"matplotlib.rc_context",
"matplotlib.use",
"os.getcwd",
"numpy.max",
"numpy.linspace",
"scipy.stats.norm.pdf"
] | [((114, 128), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (121, 128), True, 'import matplotlib as mpl\n'), ((2002, 2042), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""EB_plot_chain_results.png"""'], {}), "('EB_plot_chain_results.png')\n", (2013, 2042), True, 'import matplotlib.pyplot as plt\n'),... |
import numpy as np
f_src=open('nodes_list.txt','r')
# imported node information
nodes=[] # info: [{'node':'x', 'x':pos_x, 'z':pos_z}]
len_nodes=0 # amount
while(True):
linetmp=f_src.readline()
if(not linetmp):
break
line=linetmp.split('\t')
if(len(line)!=3):
break
nodes.append({'node':line[0],'x':i... | [
"numpy.full"
] | [((490, 536), 'numpy.full', 'np.full', (['(len_nodes, len_nodes)', '(-1)'], {'dtype': 'int'}), '((len_nodes, len_nodes), -1, dtype=int)\n', (497, 536), True, 'import numpy as np\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.autograd import Variable
from rl_agent.film_utils import ResidualBlock, FiLMedResBlock
from .gpu_utils import FloatTensor
class DRQNText(nn.Module):
def __init__(self, config, n_actions, state_dim, is_multi_objec... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.bmm",
"torch.nn.functional.softmax",
"numpy.random.random",
"torch.nn.ModuleList",
"torch.nn.LSTM",
"rl_agent.film_utils.ResidualBlock",
"torch.optim.RMSprop",
"torch.nn.Embedding",
"torch.optim.SGD",
"torch.nn.functional.max_pool2d",
"torch.cat... | [((14602, 14634), 'numpy.random.random', 'np.random.random', (['(1, 3, 28, 28)'], {}), '((1, 3, 28, 28))\n', (14618, 14634), True, 'import numpy as np\n'), ((14642, 14675), 'numpy.random.random', 'np.random.random', (['(1, 15, 28, 28)'], {}), '((1, 15, 28, 28))\n', (14658, 14675), True, 'import numpy as np\n'), ((2231,... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 12 13:33:45 2018
@author: tghosh
"""
import config
from dataloader.loader import Loader
from preprocessing.utils import Preprocess, remove_empty_docs
from dataloader.embeddings import GloVe
from model.cnn_document_model import DocumentModel, TrainingParameters
from keras... | [
"keras.optimizers.Adam",
"model.cnn_document_model.TrainingParameters",
"preprocessing.utils.remove_empty_docs",
"preprocessing.utils.Preprocess",
"model.cnn_document_model.DocumentModel.load_model",
"pandas.read_csv",
"keras.callbacks.ModelCheckpoint",
"numpy.array",
"sklearn.feature_extraction.tex... | [((515, 835), 'model.cnn_document_model.TrainingParameters', 'TrainingParameters', (['"""imdb_transfer_tanh_activation"""'], {'model_file_path': "(config.MODEL_DIR + '/imdb/transfer_model_10.hdf5')", 'model_hyper_parameters': "(config.MODEL_DIR + '/imdb/transfer_model_10.json')", 'model_train_parameters': "(config.MODE... |
"""
Multi-device matrix multiplication using parla with cupy as the kernel engine.
"""
import sys
import time
import numpy as np
import cupy as cp
from parla import Parla, get_all_devices
from parla.array import copy, clone_here
from parla.cpu import cpu
from parla.cuda import gpu
from parla.function_decorators impo... | [
"cupy.cuda.Device",
"parla.cuda.gpu",
"numpy.random.rand",
"parla.tasks.TaskSpace",
"time.perf_counter",
"cupy.cuda.runtime.getDevice",
"numpy.array",
"parla.Parla",
"numpy.random.seed",
"numpy.empty",
"parla.tasks.spawn",
"cupy.cuda.runtime.getDeviceCount",
"cupy.cuda.stream.get_current_str... | [((530, 550), 'parla.tasks.spawn', 'spawn', ([], {'placement': 'cpu'}), '(placement=cpu)\n', (535, 550), False, 'from parla.tasks import spawn, TaskSpace, CompletedTaskSpace, reserve_persistent_memory\n'), ((594, 626), 'cupy.cuda.runtime.getDeviceCount', 'cp.cuda.runtime.getDeviceCount', ([], {}), '()\n', (624, 626), T... |
# core/operators/_affine.py
"""Classes for operators that depend affinely on external parameters, i.e.,
A(µ) = sum_{i=1}^{nterms} θ_{i}(µ) * A_{i}.
"""
__all__ = [
"AffineConstantOperator",
"AffineLinearOperator",
"AffineQuadraticOperator",
# AffineCrossQuadraticOperator",
"AffineCubicOperator... | [
"numpy.all"
] | [((4884, 4905), 'numpy.all', 'np.all', (['(left == right)'], {}), '(left == right)\n', (4890, 4905), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
import tensorflow as tf
import numpy as np
import os
import time
import random
import sys
model_name = sys.argv[2]
textfile = sys.argv[1]
if model_name == None:
model_name = "shakespeare"
if textfile == None:
sys.exit('No data text file specified in command line args')
text = open(text... | [
"sys.exit",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.random.categorical",
"os.path.join",
"tensorflow.keras.layers.Embedding",
"numpy.array",
"tensorflow.keras.losses.sparse_categorical_crossentropy",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.callbacks.ModelCheckpoint",
"... | [((458, 473), 'numpy.array', 'np.array', (['vocab'], {}), '(vocab)\n', (466, 473), True, 'import numpy as np\n'), ((489, 531), 'numpy.array', 'np.array', (['[char_to_index[c] for c in text]'], {}), '([char_to_index[c] for c in text])\n', (497, 531), True, 'import numpy as np\n'), ((603, 650), 'tensorflow.data.Dataset.f... |
import numpy as np
from typing import Tuple
def similarity_transform(
X: np.ndarray, Y: np.ndarray, dim: int = 3
) -> Tuple[np.ndarray, float, np.ndarray]:
"""Calculate the similarity transform between two (matching) point sets.
Parameters
----------
X: np.ndarray
Points of first trajecto... | [
"numpy.identity",
"numpy.mean",
"numpy.eye",
"numpy.copy",
"numpy.linalg.matrix_rank",
"numpy.ones",
"numpy.trace",
"numpy.diag",
"numpy.linalg.det",
"numpy.sum",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.svd"
] | [((1453, 1471), 'numpy.mean', 'np.mean', (['X'], {'axis': '(1)'}), '(X, axis=1)\n', (1460, 1471), True, 'import numpy as np\n'), ((1483, 1501), 'numpy.mean', 'np.mean', (['Y'], {'axis': '(1)'}), '(Y, axis=1)\n', (1490, 1501), True, 'import numpy as np\n'), ((1676, 1699), 'numpy.linalg.svd', 'np.linalg.svd', (['Sigma_xy... |
import os
import numpy as np
from .filewrappers import *
from .from_binary import bioptigen_binary_reader as bioptigen
from .from_binary import heidelberg_binary_reader as heidelberg
from .from_binary import bioptigen_scan_type_map
from ..utilities import get_lut
from ..exceptions import FileLoadError
import matplotlib... | [
"numpy.fromfile",
"matplotlib.use",
"numpy.asarray",
"numpy.max",
"numpy.rot90",
"os.path.abspath",
"numpy.float_power"
] | [((328, 345), 'matplotlib.use', 'mpl.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (335, 345), True, 'import matplotlib as mpl\n'), ((549, 598), 'numpy.fromfile', 'np.fromfile', (['f'], {'dtype': 'np.uint16', 'count': 'self.count'}), '(f, dtype=np.uint16, count=self.count)\n', (560, 598), True, 'import numpy as np\n'),... |
# -*- coding: utf-8 -*-
"""
Functions for generating spatial permutations
"""
import warnings
import numpy as np
from scipy import optimize, spatial
def _gen_rotation(seed=None):
"""
Generates random matrix for rotating spherical coordinates
Parameters
----------
seed : {int, np.random.RandomSt... | [
"numpy.random.default_rng",
"numpy.unique",
"scipy.optimize.linear_sum_assignment",
"scipy.spatial.cKDTree",
"scipy.spatial.distance_matrix",
"numpy.linalg.det",
"numpy.asanyarray",
"numpy.array",
"numpy.max",
"numpy.diag",
"numpy.min",
"warnings.warn",
"numpy.all"
] | [((549, 576), 'numpy.random.default_rng', 'np.random.default_rng', (['seed'], {}), '(seed)\n', (570, 576), True, 'import numpy as np\n'), ((630, 674), 'numpy.array', 'np.array', (['[[-1, 0, 0], [0, 1, 0], [0, 0, 1]]'], {}), '([[-1, 0, 0], [0, 1, 0], [0, 0, 1]])\n', (638, 674), True, 'import numpy as np\n'), ((7397, 742... |
import numpy as np
import struct
class IdxFile:
TYPE_MAPPING = {b"\x08": "unsigned byte", b"\x09": "signed byte", b"\x0B": "short (2 bytes)",
b"\x0C": "int (4 bytes)", b"\x0D": "float (4 bytes)", b"\x0E": "double (8 bytes)"}
BYTE_MAPPING = {b"\x08": 1, b"\x09": 1, b"\x0B": 2, b"\x0C": 4, b... | [
"numpy.prod",
"numpy.ndarray"
] | [((910, 944), 'numpy.ndarray', 'np.ndarray', (['shape', '"""B"""', 'data_bytes'], {}), "(shape, 'B', data_bytes)\n", (920, 944), True, 'import numpy as np\n'), ((862, 876), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n', (869, 876), True, 'import numpy as np\n')] |
from __future__ import division, absolute_import, print_function
import numpy as np
"""
A sript to generate van der Waals surface of molecules.
"""
# Van der Waals radii (in angstrom) are taken from GAMESS.
vdw_r = {'H': 1.20, 'HE': 1.20,
'LI': 1.37, 'BE': 1.45, 'B': 1.45, 'C': 1.50,
'N': 1.50, 'O... | [
"numpy.sqrt",
"numpy.power",
"numpy.array",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin"
] | [((1273, 1284), 'numpy.array', 'np.array', (['u'], {}), '(u)\n', (1281, 1284), True, 'import numpy as np\n'), ((795, 813), 'numpy.sqrt', 'np.sqrt', (['(np.pi * n)'], {}), '(np.pi * n)\n', (802, 813), True, 'import numpy as np\n'), ((918, 928), 'numpy.cos', 'np.cos', (['fi'], {}), '(fi)\n', (924, 928), True, 'import num... |
# -*- coding: utf-8 -*-
"""
Library for computing features that describe the local boundary curvature
This module provides functions that one can use to obtain, visualise and describe local curvature of a given object.
Available Functions:
-circumradius:Finds the radius of a circumcircle
-local_radius_curvature: Com... | [
"math.sqrt",
"numpy.column_stack",
"numpy.array",
"numpy.arctan2",
"numpy.divide",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.where",
"skimage.morphology.erosion",
"numpy.max",
"numpy.vstack",
"scipy.signal.find_peaks",
"pandas.DataFrame",
"numpy.abs",
"numpy.floor",
"numpy.sign"... | [((3099, 3158), 'numpy.pad', 'np.pad', (['bw'], {'pad_width': '(5)', 'mode': '"""constant"""', 'constant_values': '(0)'}), "(bw, pad_width=5, mode='constant', constant_values=0)\n", (3105, 3158), True, 'import numpy as np\n'), ((3577, 3618), 'numpy.column_stack', 'np.column_stack', (['(boundary_x, boundary_y)'], {}), '... |
'''
TIEGCM Kamodo reader, adapted to new structure for satellite flythrough software
Initial version - <NAME> (?)
Initial version of model_varnames contributed by <NAME>
New code: <NAME> (June 2021 and on)
NOTE: The current logic for variables that depend on imlev slices off self._imlev coordinate
This only works ... | [
"datetime.datetime.utcfromtimestamp",
"numpy.array",
"numpy.sin",
"numpy.mean",
"numpy.where",
"netCDF4.Dataset",
"time.perf_counter",
"numpy.diff",
"glob.glob",
"numpy.abs",
"kamodo.readers.reader_utilities.regdef_4D_interpolators",
"kamodo.readers.reader_utilities.regdef_3D_interpolators",
... | [((9885, 9927), 'datetime.datetime.strptime', 'datetime.strptime', (['date_string', '"""%Y-%m-%d"""'], {}), "(date_string, '%Y-%m-%d')\n", (9902, 9927), False, 'from datetime import datetime, timezone, timedelta\n'), ((11507, 11521), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (11519, 11521), False, 'from ti... |
"""
Script for calculating the IPO index in each ensemble member
Author : <NAME>
Date : 17 September 2021
Version : 12
"""
### Import packages
import sys
import math
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats as stats
from mpl_toolkits.basemap im... | [
"matplotlib.pyplot.ylabel",
"calc_dataFunctions.getRegion",
"numpy.nanmean",
"scipy.stats.pearsonr",
"numpy.nanmin",
"numpy.genfromtxt",
"numpy.arange",
"numpy.mean",
"numpy.where",
"calc_Utilities.calc_weightedAve",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"calc_Stats.remove_en... | [((782, 809), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (788, 809), True, 'import matplotlib.pyplot as plt\n'), ((809, 882), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Avant Garde']})\n", (815, 8... |
import argparse
import logging
import os
import shutil
import sys
import tensorboardX as tb
import numpy as np
import torch
import yaml
from configs import *
from runners import *
def parse_args_and_config():
parser = argparse.ArgumentParser(description=globals()['__doc__'])
parser.add_argument('--config',... | [
"logging.getLogger",
"torch.manual_seed",
"torch.cuda.manual_seed_all",
"logging.StreamHandler",
"os.path.exists",
"tensorboardX.SummaryWriter",
"os.makedirs",
"yaml.dump",
"sys.exit",
"logging.Formatter",
"os.path.join",
"torch.cuda.is_available",
"numpy.random.seed",
"shutil.rmtree",
"... | [((4556, 4596), 'os.path.join', 'os.path.join', (['args.exp', '"""logs"""', 'args.doc'], {}), "(args.exp, 'logs', args.doc)\n", (4568, 4596), False, 'import os\n'), ((4821, 4864), 'os.makedirs', 'os.makedirs', (['args.fid_folder'], {'exist_ok': '(True)'}), '(args.fid_folder, exist_ok=True)\n', (4832, 4864), False, 'imp... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @file
# @author <NAME>
import numpy as np
import pytest
import scipp as sc
def test_shape():
a = sc.Variable(value=1)
d = sc.Dataset(data={'a': a})
assert d.shape == []
a = sc.Variable(['x'], ... | [
"numpy.random.rand",
"scipp.DataArray",
"numpy.array",
"copy.deepcopy",
"copy.copy",
"numpy.arange",
"numpy.int64",
"scipp.mean",
"numpy.float64",
"scipp.merge",
"scipp.sum",
"scipp.concatenate",
"numpy.random.seed",
"numpy.testing.assert_array_equal",
"scipp.Dataset",
"scipp.rebin",
... | [((213, 233), 'scipp.Variable', 'sc.Variable', ([], {'value': '(1)'}), '(value=1)\n', (224, 233), True, 'import scipp as sc\n'), ((242, 267), 'scipp.Dataset', 'sc.Dataset', ([], {'data': "{'a': a}"}), "(data={'a': a})\n", (252, 267), True, 'import scipp as sc\n'), ((301, 330), 'scipp.Variable', 'sc.Variable', (["['x']"... |
import numpy as np
try:
import PyQt4.QtGui as QtGui
import PyQt4.QtCore as QtCore
except:
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
class SetFittingVariablesHandler(object):
colorscale_nbr_row = 15
colorscale_cell_size = {'width': 75,
'height':... | [
"numpy.mean",
"PyQt5.QtGui.QTableWidgetItem",
"PyQt5.QtGui.QColor",
"PyQt5.QtGui.QBrush",
"PyQt5.QtGui.QRadialGradient",
"numpy.zeros",
"numpy.isnan",
"numpy.nanmax",
"numpy.nanmin",
"numpy.shape",
"numpy.int",
"numpy.arange"
] | [((1834, 1859), 'numpy.shape', 'np.shape', (['array_2d_values'], {}), '(array_2d_values)\n', (1842, 1859), True, 'import numpy as np\n'), ((1880, 1898), 'numpy.arange', 'np.arange', (['nbr_row'], {}), '(nbr_row)\n', (1889, 1898), True, 'import numpy as np\n'), ((4770, 4788), 'numpy.arange', 'np.arange', (['nbr_row'], {... |
"""
Utility functions for dealing with Human3.6M dataset.
Some functions are adapted from https://github.com/una-dinosauria/3d-pose-baseline
"""
import os
import numpy as np
import copy
import logging
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import libs.dataset.h36m.cameras as cameras
... | [
"numpy.hstack",
"numpy.array",
"copy.deepcopy",
"numpy.divide",
"numpy.mean",
"numpy.multiply",
"numpy.repeat",
"scipy.spatial.transform.Rotation.from_euler",
"numpy.reshape",
"numpy.delete",
"libs.dataset.h36m.pth_dataset.PoseDataset",
"numpy.random.choice",
"numpy.std",
"matplotlib.pyplo... | [((1093, 1160), 'numpy.array', 'np.array', (['[0, 1, 2, 0, 6, 7, 0, 12, 13, 14, 13, 17, 18, 13, 25, 26]'], {}), '([0, 1, 2, 0, 6, 7, 0, 12, 13, 14, 13, 17, 18, 13, 25, 26])\n', (1101, 1160), True, 'import numpy as np\n'), ((1180, 1248), 'numpy.array', 'np.array', (['[1, 2, 3, 6, 7, 8, 12, 13, 14, 15, 17, 18, 19, 25, 26... |
# This file is part of PyTMM.
#
# PyTMM 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 version 3 of the License, or
# (at your option) any later version.
#
# PyTMM is distributed in t... | [
"numpy.identity",
"numpy.multiply",
"numpy.linalg.solve",
"numpy.hstack",
"numpy.conj",
"numpy.array",
"numpy.dot",
"numpy.linalg.inv",
"numpy.real",
"numpy.cos",
"numpy.zeros",
"numpy.sin",
"numpy.imag"
] | [((4361, 4448), 'numpy.array', 'numpy.array', (['[[transferMatrix.matrix[0, 1], -1], [transferMatrix.matrix[1, 1], 0]]'], {}), '([[transferMatrix.matrix[0, 1], -1], [transferMatrix.matrix[1, 1\n ], 0]])\n', (4372, 4448), False, 'import numpy\n'), ((4477, 4550), 'numpy.array', 'numpy.array', (['[-transferMatrix.matri... |
"""
Various utilities used in the main code.
NOTE: there should be no autograd functions here, only plain numpy/scipy
"""
import numpy as np
from scipy.linalg import toeplitz
from scipy.optimize import brentq
def ftinv(ft_coeff, gvec, xgrid, ygrid):
"""
Returns the discrete inverse Fourier transform over a ... | [
"numpy.abs",
"numpy.triu",
"numpy.unique",
"scipy.optimize.brentq",
"numpy.ones",
"numpy.max",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"scipy.linalg.toeplitz",
"numpy.sum",
"numpy.meshgrid",
"numpy.int_",
"numpy.arange"
] | [((658, 683), 'numpy.meshgrid', 'np.meshgrid', (['xgrid', 'ygrid'], {}), '(xgrid, ygrid)\n', (669, 683), True, 'import numpy as np\n'), ((696, 738), 'numpy.zeros', 'np.zeros', (['xmesh.shape'], {'dtype': 'np.complex128'}), '(xmesh.shape, dtype=np.complex128)\n', (704, 738), True, 'import numpy as np\n'), ((807, 849), '... |
import numpy as np
from nltk.tokenize import word_tokenize
class Dataset(object):
def __init__(self, text_file, context_size, vocab_min_count):
self.text_file = text_file
self.context_size = context_size
self.vocab_min_count = vocab_min_count
self.vocab = []
self.comat = N... | [
"numpy.zeros",
"numpy.unique",
"numpy.nonzero",
"nltk.tokenize.word_tokenize"
] | [((587, 606), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['text'], {}), '(text)\n', (600, 606), False, 'from nltk.tokenize import word_tokenize\n'), ((698, 738), 'numpy.unique', 'np.unique', (['word_list'], {'return_counts': '(True)'}), '(word_list, return_counts=True)\n', (707, 738), True, 'import numpy as np\n'... |
# Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"numpy.sqrt",
"scipy.special.factorial",
"numpy.sinh",
"numpy.array",
"numpy.sin",
"pytest.mark.backends",
"numpy.arange",
"numpy.exp",
"pytest.skip",
"numpy.abs",
"numpy.tile",
"numpy.allclose",
"numpy.conj",
"strawberryfields.utils.squeezed_state",
"pytest.raises",
"numpy.cos",
"nu... | [((6225, 6271), 'pytest.mark.backends', 'pytest.mark.backends', (['"""fock"""', '"""tf"""', '"""gaussian"""'], {}), "('fock', 'tf', 'gaussian')\n", (6245, 6271), False, 'import pytest\n'), ((8725, 8757), 'pytest.mark.backends', 'pytest.mark.backends', (['"""gaussian"""'], {}), "('gaussian')\n", (8745, 8757), False, 'im... |
import numpy as np
import requests
from io import BytesIO
from pathlib import Path
from PIL import Image
from urllib.parse import urlparse
# Use a Chrome-based user agent to avoid getting needlessly blocked.
USER_AGENT = (
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/51.0... | [
"PIL.Image.open",
"urllib.parse.urlparse",
"pathlib.Path",
"io.BytesIO",
"requests.get",
"numpy.stack"
] | [((1046, 1061), 'PIL.Image.open', 'Image.open', (['uri'], {}), '(uri)\n', (1056, 1061), False, 'from PIL import Image\n'), ((1437, 1467), 'numpy.stack', 'np.stack', (['([image] * 3)'], {'axis': '(-1)'}), '([image] * 3, axis=-1)\n', (1445, 1467), True, 'import numpy as np\n'), ((1071, 1084), 'urllib.parse.urlparse', 'ur... |
import qctests.Argo_global_range_check
import util.testingProfile
import numpy
from util import obs_utils
##### Argo_global_range_check ---------------------------------------------------
def test_Argo_global_range_check_temperature():
'''
Make sure AGRC is flagging temperature excursions
'''
# shoul... | [
"numpy.zeros",
"numpy.array_equal",
"util.obs_utils.pressure_to_depth"
] | [((489, 515), 'numpy.zeros', 'numpy.zeros', (['(1)'], {'dtype': 'bool'}), '(1, dtype=bool)\n', (500, 515), False, 'import numpy\n'), ((547, 575), 'numpy.array_equal', 'numpy.array_equal', (['qc', 'truth'], {}), '(qc, truth)\n', (564, 575), False, 'import numpy\n'), ((786, 812), 'numpy.zeros', 'numpy.zeros', (['(1)'], {... |
#!/usr/bin/env python
# coding: utf-8
# # Generate website content
import pinklib.website as web
import os
from astropy.stats import median_absolute_deviation
import numpy as np
import importlib
import pandas as pd
# INPUT PARAMETERS
# Name of the binary file
cutouts_bin_name = 'cutouts_preprocessed'
# SOM para... | [
"pinklib.website.unpack_trained_som",
"numpy.argsort",
"pinklib.website.SOM",
"pinklib.website.plot_som",
"pandas.read_pickle",
"os.path.exists",
"pinklib.website.plot_distance_to_bmu_histogram",
"numpy.mean",
"pinklib.website.plot_som_bmu_heatmap",
"os.mkdir",
"numpy.min",
"numpy.argmin",
"... | [((660, 722), 'os.path.join', 'os.path.join', (['"""SOM_directory"""', '"""catalogue_LOTSS_DR1_final.pkl"""'], {}), "('SOM_directory', 'catalogue_LOTSS_DR1_final.pkl')\n", (672, 722), False, 'import os\n'), ((735, 787), 'os.path.join', 'os.path.join', (['"""SOM_directory"""', '"""LOTSS_DR1_final.bin"""'], {}), "('SOM_d... |
from matplotlib import pyplot
from math import cos, sin, atan
import numpy as np
import time
import seaborn
from matplotlib.animation import FuncAnimation
import sys
import json
class Neuron():
def __init__(self, x, y):
self.x = x
self.y = y
def draw(self, neuron_radius):
circle = pyp... | [
"matplotlib.pyplot.text",
"matplotlib.pyplot.Circle",
"matplotlib.pyplot.title",
"matplotlib.pyplot.gca",
"math.cos",
"matplotlib.pyplot.figure",
"json.load",
"matplotlib.pyplot.axis",
"math.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((317, 382), 'matplotlib.pyplot.Circle', 'pyplot.Circle', (['(self.x, self.y)'], {'radius': 'neuron_radius', 'fill': '(False)'}), '((self.x, self.y), radius=neuron_radius, fill=False)\n', (330, 382), False, 'from matplotlib import pyplot\n'), ((4552, 4573), 'matplotlib.pyplot.axis', 'pyplot.axis', (['"""scaled"""'], {... |
# -*- coding: ascii -*-
# $Id: CNCCanvas.py,v 1.7 2014/10/15 15:04:06 bnv Exp $
#
# Author: <EMAIL>
# Date: 24-Aug-2014
import math
import time
import bmath
try:
from Tkinter import *
import Tkinter
except ImportError:
from tkinter import *
import tkinter as Tkinter
from CNC import Tab, CNC
import Utils
imp... | [
"math.floor",
"PIL.Image.new",
"math.sqrt",
"Utils.setInt",
"math.cos",
"CNC.CNC.isMarginValid",
"math.log10",
"Utils.getStr",
"Camera.Camera",
"CNC.CNC.isAllMarginValid",
"CNC.CNC.compileLine",
"PIL.ImageTk.PhotoImage",
"tkExtra.Combobox",
"bmath.frange",
"numpy.floor",
"math.radians"... | [((2049, 2065), 'math.radians', 'math.radians', (['(60)'], {}), '(60)\n', (2061, 2065), False, 'import math\n'), ((2082, 2098), 'math.radians', 'math.radians', (['(60)'], {}), '(60)\n', (2094, 2098), False, 'import math\n'), ((6467, 6492), 'Camera.Camera', 'Camera.Camera', (['"""aligncam"""'], {}), "('aligncam')\n", (6... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 4 17:44:53 2021
@author: mlampert
"""
import os
import copy
#FLAP imports and settings
import flap
import flap_nstx
import flap_mdsplus
flap_nstx.register('NSTX_GPI')
flap_nstx.register('NSTX_THOMSON')
flap_mdsplus.register('NSTX_MDSPlus')
thi... | [
"flap_mdsplus.register",
"numpy.abs",
"flap.config.read",
"flap_nstx.register",
"os.path.join",
"flap.Unit",
"os.path.realpath",
"flap.DataObject",
"flap.add_data_object",
"flap.get_data",
"numpy.interp",
"flap.CoordinateMode"
] | [((211, 241), 'flap_nstx.register', 'flap_nstx.register', (['"""NSTX_GPI"""'], {}), "('NSTX_GPI')\n", (229, 241), False, 'import flap_nstx\n'), ((242, 276), 'flap_nstx.register', 'flap_nstx.register', (['"""NSTX_THOMSON"""'], {}), "('NSTX_THOMSON')\n", (260, 276), False, 'import flap_nstx\n'), ((278, 315), 'flap_mdsplu... |
import os
import mlflow
import numpy as np
import pandas as pd
import pytest
from matplotlib import pyplot as plt
from plotly import graph_objects as go
from mlflow_extend import logging as lg
from mlflow_extend.testing.utils import (
_get_default_args,
_read_data,
assert_file_exists_in_artifacts,
ass... | [
"mlflow_extend.logging.log_metrics_flatten",
"numpy.array",
"pandas.testing.assert_frame_equal",
"mlflow_extend.testing.utils._get_default_args",
"mlflow_extend.logging.log_pr_curve",
"plotly.graph_objects.Bar",
"mlflow_extend.logging.log_feature_importance",
"mlflow_extend.logging.log_roc_curve",
"... | [((472, 557), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""path"""', "['test.txt', 'dir/test.txt', 'dir/dir/test.txt']"], {}), "('path', ['test.txt', 'dir/test.txt',\n 'dir/dir/test.txt'])\n", (495, 557), False, 'import pytest\n'), ((3012, 3083), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 13:20:48 2019
@author: asabater
"""
from PIL import Image
import numpy as np
from yolo3.model import preprocess_true_boxes
def rand(a=0, b=1):
return np.random.rand()*(b-a) + a
import cv2
# Perform data augmentation over an annotation lin... | [
"numpy.clip",
"PIL.Image.fromarray",
"numpy.random.rand",
"numpy.logical_and",
"numpy.random.choice",
"PIL.Image.new",
"yolo3.model.preprocess_true_boxes",
"numpy.asarray",
"numpy.stack",
"numpy.zeros",
"numpy.array",
"cv2.cvtColor",
"cv2.resize",
"cv2.imread",
"numpy.arange",
"numpy.r... | [((3564, 3588), 'numpy.zeros', 'np.zeros', (['(max_boxes, 5)'], {}), '((max_boxes, 5))\n', (3572, 3588), True, 'import numpy as np\n'), ((4394, 4421), 'numpy.arange', 'np.arange', (['(320)', '(608 + 1)', '(32)'], {}), '(320, 608 + 1, 32)\n', (4403, 4421), True, 'import numpy as np\n'), ((705, 718), 'cv2.imread', 'cv2.i... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.calibration import calibration_curve
import pickle
def reliability(y, y_prob):
nbin = 10
# class0
y_true = y.copy()
y_true[y_true == 0] = 4
y_true[y_true != 4] = 0
y_true[y_true == 4] = 1
select = y_prob[:,... | [
"pandas.read_csv",
"matplotlib.pyplot.plot",
"numpy.exp",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.figure",
"sklearn.calibration.calibration_curve",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((355, 401), 'sklearn.calibration.calibration_curve', 'calibration_curve', (['y_true', 'select'], {'n_bins': 'nbin'}), '(y_true, select, n_bins=nbin)\n', (372, 401), False, 'from sklearn.calibration import calibration_curve\n'), ((505, 551), 'sklearn.calibration.calibration_curve', 'calibration_curve', (['y_true', 'se... |
import numpy as np
import ac_core
import matplotlib.pyplot as plt
def primaris_smite(bonus = 0, wc = 5):
damage = 0
test = ac_core.d6() + ac_core.d6() + bonus
if test > 10:
damage = ac_core.d6()
elif test > wc:
damage = ac_core.d3()
return damage
def wyrdvane_smite(bonus = ... | [
"ac_core.d6",
"numpy.mean",
"matplotlib.pyplot.grid",
"ac_core.d3",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1621, 1635), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1633, 1635), True, 'import matplotlib.pyplot as plt\n'), ((1721, 1731), 'matplotlib.pyplot.grid', 'plt.grid', ([], {}), '()\n', (1729, 1731), True, 'import matplotlib.pyplot as plt\n'), ((1736, 1773), 'matplotlib.pyplot.title', 'plt.title'... |
# -*- coding: utf-8 -*-
"""
Creating ``tf.data.Dataset`` instance for image window sampler.
"""
from __future__ import absolute_import, division, print_function
import inspect
import numpy as np
import tensorflow as tf
# pylint: disable=no-name-in-module
from tensorflow.python.data.util import nest
from tensorflow.py... | [
"tensorflow.shape",
"tensorflow.pad",
"tensorflow.data.Dataset.range",
"tensorflow.logging.warning",
"tensorflow.logging.info",
"tensorflow.python.data.util.nest.flatten",
"numpy.asarray",
"tensorflow.data.Dataset.from_generator",
"niftynet.io.misc_io.squeeze_spatial_temporal_dim",
"niftynet.engin... | [((2100, 2131), 'niftynet.layer.base_layer.Layer.__init__', 'Layer.__init__', (['self'], {'name': 'name'}), '(self, name=name)\n', (2114, 2131), False, 'from niftynet.layer.base_layer import Layer\n'), ((2677, 2719), 'inspect.isgeneratorfunction', 'inspect.isgeneratorfunction', (['self.layer_op'], {}), '(self.layer_op)... |
import numpy as np
fft2 = np.fft.fft2
ifft2 = np.fft.ifft2
fftshift = np.fft.fftshift
ifftshift = np.fft.ifftshift
def cart2pol(x, y):
r = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
return (r, phi)
def pol2cart(r, phi):
x = r * np.cos(phi)
y = r * np.sin(phi)
return (x, y)
def ft2(g, d... | [
"numpy.cos",
"numpy.sin",
"numpy.sqrt",
"numpy.arctan2"
] | [((147, 171), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)\n', (154, 171), True, 'import numpy as np\n'), ((178, 194), 'numpy.arctan2', 'np.arctan2', (['y', 'x'], {}), '(y, x)\n', (188, 194), True, 'import numpy as np\n'), ((252, 263), 'numpy.cos', 'np.cos', (['phi'], {}), '(phi)\n', (258, 2... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# # How to use custom data and implement custom models and metrics
# %% [markdown]
# ## Building a simple, first model
# %% [markdown]
# For demonstration purposes we will choose a simple fully connected model. It take... | [
"torch.nn.ReLU",
"numpy.random.rand",
"torch.nn.Sequential",
"pytorch_lightning.Trainer",
"pytorch_forecasting.metrics.NormalDistributionLoss",
"numpy.arange",
"torch.arange",
"pytorch_forecasting.metrics.SMAPE",
"torch.roll",
"pytorch_forecasting.models.nn.MultiEmbedding",
"numpy.random.choice"... | [((582, 602), 'os.chdir', 'os.chdir', (['"""../../.."""'], {}), "('../../..')\n", (590, 602), False, 'import os\n'), ((1527, 1544), 'torch.rand', 'torch.rand', (['(20)', '(5)'], {}), '(20, 5)\n', (1537, 1544), False, 'import torch\n'), ((3507, 3738), 'pytorch_forecasting.TimeSeriesDataSet', 'TimeSeriesDataSet', (['test... |
# encoding: utf-8
"""
Training implementation
Author: <NAME>
Update time: 08/11/2020
"""
import re
import sys
import os
import cv2
import time
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.optim import lr_scheduler
import torch.optim as optim
import torchvision
im... | [
"numpy.uint8",
"re.compile",
"sklearn.metrics.roc_auc_score",
"numpy.array",
"cv2.threshold",
"model.Fusion_Branch",
"numpy.max",
"numpy.min",
"torchvision.transforms.ToTensor",
"os.path.isfile",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"cv2.resize",
"time.time"... | [((1369, 1444), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\n', (1389, 1444), True, 'import torchvision.transforms as transforms\n'), ((3162, 3229), 'cv2.threshold', 'cv2.thr... |
import typing
import matplotlib.pyplot as plt
import numpy as np
from . import plot_ticks
plot_specs = {
'PlotData': {
'common': {
'merge': {'key_name': 'key_content'},
# ... PlotDatum keys and values
},
'plots': {'PlotID': 'PlotDatum'},
'subplot_height': ... | [
"numpy.ceil",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplot... | [((4492, 4512), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '(**figure)\n', (4502, 4512), True, 'import matplotlib.pyplot as plt\n'), ((2031, 2087), 'matplotlib.pyplot.stackplot', 'plt.stackplot', (['x', "*plot_datum['stacks']"], {}), "(x, *plot_datum['stacks'], **stacks_kwargs)\n", (2044, 2087), True, 'import ... |
"""
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.contourf",
"numpy.where",
"matplotlib.pyplot.xlabel",
"sklearn.tree.DecisionTreeClassifier",
"numpy.concatenate",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.ylim",
"matplotli... | [((1171, 1265), 'sklearn.datasets.make_gaussian_quantiles', 'make_gaussian_quantiles', ([], {'cov': '(2.0)', 'n_samples': '(200)', 'n_features': '(2)', 'n_classes': '(2)', 'random_state': '(1)'}), '(cov=2.0, n_samples=200, n_features=2, n_classes=2,\n random_state=1)\n', (1194, 1265), False, 'from sklearn.datasets i... |
import param
import numpy as np
import panel as pn
import holoviews as hv
from alerce.core import Alerce
hv.extension("bokeh")
hv.opts.defaults(
hv.opts.ErrorBars(
width=300,
height=200,
lower_head=None,
upper_head=None,
xrotation=35,
invert_yaxis=True,
xlim=... | [
"alerce.core.Alerce",
"holoviews.extension",
"holoviews.Overlay",
"param.Integer",
"holoviews.opts.ErrorBars",
"holoviews.DynamicMap",
"param.depends",
"numpy.mod",
"holoviews.ErrorBars",
"panel.Column"
] | [((106, 127), 'holoviews.extension', 'hv.extension', (['"""bokeh"""'], {}), "('bokeh')\n", (118, 127), True, 'import holoviews as hv\n'), ((346, 354), 'alerce.core.Alerce', 'Alerce', ([], {}), '()\n', (352, 354), False, 'from alerce.core import Alerce\n'), ((1880, 1920), 'panel.Column', 'pn.Column', (['explorer.view', ... |
import os
import matplotlib.patches as mpatches
import numpy as np
import pkg_resources
from PyQt5 import QtGui, QtWidgets, QtCore, uic
from PyQt5.Qt import QSplashScreen, QObject
from PyQt5.QtCore import QSettings, QThread, pyqtSignal, QTimer, QDateTime
from PyQt5.QtWidgets import QMenu
from PyQt5.QtGui import QPixmap... | [
"matplotlib.backends.backend_qt5agg.NavigationToolbar2QT",
"PyQt5.QtWidgets.QMessageBox",
"PyQt5.uic.loadUiType",
"numpy.array",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"xas.xray.k2e",
"xas.xray.e2k",
"pathlib.Path",
"numpy.stack",
"isstools.elements.figure_update.update_figure",
"PyQt5.Q... | [((848, 921), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""isstools"""', '"""ui/ui_xview_project-mac.ui"""'], {}), "('isstools', 'ui/ui_xview_project-mac.ui')\n", (879, 921), False, 'import pkg_resources\n'), ((942, 1011), 'pkg_resources.resource_filename', 'pkg_resources.resource_filenam... |
import numpy as np
import pytest
from sklego.common import flatten
from sklego.dummy import RandomRegressor
from tests.conftest import nonmeta_checks, regressor_checks, general_checks, select_tests
@pytest.mark.parametrize(
"test_fn",
select_tests(
flatten([general_checks, nonmeta_checks, regressor_c... | [
"numpy.random.normal",
"numpy.mean",
"sklego.dummy.RandomRegressor",
"sklego.common.flatten",
"pytest.raises",
"numpy.random.seed",
"numpy.std"
] | [((859, 893), 'sklego.dummy.RandomRegressor', 'RandomRegressor', ([], {'strategy': '"""normal"""'}), "(strategy='normal')\n", (874, 893), False, 'from sklego.dummy import RandomRegressor\n'), ((977, 1012), 'sklego.dummy.RandomRegressor', 'RandomRegressor', ([], {'strategy': '"""uniform"""'}), "(strategy='uniform')\n", ... |
import numpy as np
NSAMPLE=64
NSPEC=4
for spec in range(NSPEC):
list = []
for i in range(NSAMPLE):
infile = "RUN%d/res.mass_spec%d_final_vert" % (i+1,spec+1)
a = np.loadtxt(infile)
list.append(a)
list = np.transpose(np.array(list))
mean = np.mean(list,axis=1)
st... | [
"numpy.mean",
"numpy.array",
"numpy.savetxt",
"numpy.std",
"numpy.loadtxt",
"numpy.transpose"
] | [((293, 314), 'numpy.mean', 'np.mean', (['list'], {'axis': '(1)'}), '(list, axis=1)\n', (300, 314), True, 'import numpy as np\n'), ((324, 352), 'numpy.std', 'np.std', (['list'], {'axis': '(1)', 'ddof': '(1)'}), '(list, axis=1, ddof=1)\n', (330, 352), True, 'import numpy as np\n'), ((371, 396), 'numpy.transpose', 'np.tr... |
import numpy as np
import data
import matplotlib.pyplot as plt
def sanityCheck(objType, phiType):
""" draw and save the figure of the mean, range for different methods and N
:param objType: objective type - worst/sum
:param phiType: phi-divergence type - cre/chi/m-chi
"""
loaded = np.load('data/'... | [
"matplotlib.pyplot.savefig",
"data.alphaSet",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"numpy.load",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.legend",
"matplo... | [((305, 362), 'numpy.load', 'np.load', (["('data/' + objType + '_' + phiType + '_final.npz')"], {}), "('data/' + objType + '_' + phiType + '_final.npz')\n", (312, 362), True, 'import numpy as np\n'), ((540, 566), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(7, 5)'}), '(figsize=(7, 5))\n', (550, 566), Tr... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import pprint
import fiolib.shared_chart as shared
from matplotlib import cm
# The module required for the 3D graph.
from mpl_toolkits.mplot3d import axes3d
from datetime import datetime
import matplotlib as mpl
import fiolib.supporting as suppor... | [
"numpy.ones_like",
"matplotlib.pyplot.cm.ScalarMappable",
"fiolib.shared_chart.get_dataset_types",
"fiolib.supporting.get_largest_scale_factor",
"fiolib.supporting.get_scale_factor",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"datetime.datetime.now",
"ma... | [((575, 608), 'fiolib.shared_chart.get_dataset_types', 'shared.get_dataset_types', (['dataset'], {}), '(dataset)\n', (599, 608), True, 'import fiolib.shared_chart as shared\n'), ((755, 825), 'fiolib.shared_chart.get_record_set_3d', 'shared.get_record_set_3d', (['settings', 'dataset', 'dataset_types', 'rw', 'metric'], {... |
import copy
import numpy as np
import pytest
import tensorflow as tf
from tfsnippet.layers import as_gated
def safe_sigmoid(x):
return np.where(x < 0, np.exp(x) / (1. + np.exp(x)), 1. / (1. + np.exp(-x)))
class AsGatedHelper(object):
def __init__(self, main_ret, gate_ret):
self.main_args = None
... | [
"numpy.random.normal",
"tfsnippet.layers.as_gated",
"numpy.exp",
"pytest.raises",
"copy.copy"
] | [((159, 168), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (165, 168), True, 'import numpy as np\n'), ((1149, 1217), 'pytest.raises', 'pytest.raises', (['ValueError'], {'match': '"""`default_name` cannot be inferred"""'}), "(ValueError, match='`default_name` cannot be inferred')\n", (1162, 1217), False, 'import pytest\... |
"""
GenBank format (:mod:`skbio.io.format.genbank`)
===============================================
.. currentmodule:: skbio.io.format.genbank
GenBank format (GenBank Flat File Format) stores sequence and its annotation
together. The start of the annotation section is marked by a line beginning
with the word "LOCUS".... | [
"pandas.Series",
"re.split",
"skbio.io.create_format",
"skbio.io.GenBankFormatError",
"datetime.datetime.strptime",
"skbio.io.format._base._too_many_blanks",
"re.match",
"skbio.util._misc.chunk_str",
"skbio.io.format._base._line_generator",
"numpy.zeros",
"functools.partial",
"pandas.concat",
... | [((10740, 10764), 'skbio.io.create_format', 'create_format', (['"""genbank"""'], {}), "('genbank')\n", (10753, 10764), False, 'from skbio.io import create_format, GenBankFormatError\n'), ((11287, 11310), 'skbio.io.format._base._too_many_blanks', '_too_many_blanks', (['fh', '(5)'], {}), '(fh, 5)\n', (11303, 11310), Fals... |
#!/usr/bin/env python
import sys
import serial
import time
import os.path
import cv2 as cv
import numpy as np
# load image
def load(file):
img = cv.imread(file, 1)
return cv.GaussianBlur(img, (11, 11), 5)
# black image at the size of im
def black(im):
return np.zeros(im.shape[0:2], np.uint8)
# taken f... | [
"time.sleep",
"numpy.array",
"sys.exit",
"numpy.histogram",
"cv2.contourArea",
"cv2.minAreaRect",
"numpy.hypot",
"cv2.drawContours",
"cv2.boxPoints",
"cv2.minEnclosingCircle",
"numpy.int0",
"cv2.morphologyEx",
"cv2.cvtColor",
"cv2.GaussianBlur",
"cv2.imread",
"cv2.imwrite",
"cv2.inRa... | [((151, 169), 'cv2.imread', 'cv.imread', (['file', '(1)'], {}), '(file, 1)\n', (160, 169), True, 'import cv2 as cv\n'), ((181, 214), 'cv2.GaussianBlur', 'cv.GaussianBlur', (['img', '(11, 11)', '(5)'], {}), '(img, (11, 11), 5)\n', (196, 214), True, 'import cv2 as cv\n'), ((275, 308), 'numpy.zeros', 'np.zeros', (['im.sha... |
"""
<NAME>
camera.py
Construct a camera matrix and apply it to project points onto an image plane.
___
/ _ \
| / \ |
| \_/ |
\___/ ___
_|_|_/[_]\__==_
... | [
"numpy.asmatrix",
"numpy.sin",
"numpy.asarray",
"numpy.argmax",
"numpy.min",
"numpy.max",
"numpy.matmul",
"numpy.vstack",
"numpy.cos",
"sys.exit",
"numpy.argmin",
"numpy.loadtxt"
] | [((2010, 2058), 'numpy.asmatrix', 'np.asmatrix', (['[[s, 0, ic], [0, s, jc], [0, 0, 1]]'], {}), '([[s, 0, ic], [0, s, jc], [0, 0, 1]])\n', (2021, 2058), True, 'import numpy as np\n'), ((3232, 3249), 'numpy.matmul', 'np.matmul', (['Rx', 'Ry'], {}), '(Rx, Ry)\n', (3241, 3249), True, 'import numpy as np\n'), ((3258, 3274)... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Interfaces under evaluation before upstreaming to nipype.interfaces.utility."""
import numpy as np
import re
import json
from collections import OrderedDict
from nipype.utils.filemanip import fname_pres... | [
"nipype.interfaces.base.InputMultiObject",
"nipype.interfaces.base.isdefined",
"nipype.utils.filemanip.fname_presuffix",
"nipype.interfaces.base.traits.Instance",
"nipype.interfaces.base.traits.Str",
"pandas.read_csv",
"nipype.interfaces.io.add_traits",
"nipype.interfaces.base.traits.List",
"nipype.... | [((645, 686), 'nipype.interfaces.base.Str', 'Str', ([], {'mandatory': '(True)', 'desc': '"""selective key"""'}), "(mandatory=True, desc='selective key')\n", (648, 686), False, 'from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, DynamicTraitedSpec, File, InputMultiObject, isdefined, SimpleInterfac... |
# Add parent folder to path
import sys, os
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import unittest
import numpy as np
from src.Equations.KineticEnergy import KineticEnergy
from src.Common import particle_dtype
class test_kinetic_energy(unittest.TestCase):
def test(self):
num = 100
pA =... | [
"numpy.zeros",
"os.path.join"
] | [((62, 93), 'os.path.join', 'os.path.join', (['sys.path[0]', '""".."""'], {}), "(sys.path[0], '..')\n", (74, 93), False, 'import sys, os\n'), ((321, 356), 'numpy.zeros', 'np.zeros', (['num'], {'dtype': 'particle_dtype'}), '(num, dtype=particle_dtype)\n', (329, 356), True, 'import numpy as np\n')] |
#-------------------------------------------------------------------------------
#
# Define classes for (uni/multi)-variate kernel density estimation.
#
# Currently, only Gaussian kernels are implemented.
#
# Copyright 2004-2005 by Enthought, Inc.
#
# The code has been adapted by <NAME> to work with GPUs
# using C... | [
"numpy.sqrt",
"math.floor",
"numpy.hstack",
"dataclasses.dataclass",
"cocos.numerics.numerical_package_selector.select_num_pack",
"numpy.array",
"numpy.cov",
"scipy.special.logsumexp",
"numpy.atleast_2d",
"scipy.linalg.cho_solve",
"numpy.reshape",
"numpy.isscalar",
"scipy.linalg.cho_factor",... | [((13173, 13195), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (13182, 13195), False, 'from dataclasses import dataclass\n'), ((6335, 6355), 'cocos.numerics.numerical_package_selector.select_num_pack', 'select_num_pack', (['gpu'], {}), '(gpu)\n', (6350, 6355), False, 'from cocos.... |
import numpy as np
def schlawin(x):
a1 = 0.44325141463
a2 = 0.06260601220
a3 = 0.04757383546
a4 = 0.01736506451
b1 = 0.24998368310
b2 = 0.09200180037
b3 = 0.04069697526
b4 = 0.00526449639
return 1 + x*(a1 + x*(a2 + x*(a3 + x*a4))) + x*(b1 + x*(b2 + x*(b3 + x*b4)))*np.log(1/x)
| [
"numpy.log"
] | [((302, 315), 'numpy.log', 'np.log', (['(1 / x)'], {}), '(1 / x)\n', (308, 315), True, 'import numpy as np\n')] |
import logging
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
import sys
import cv2
import math
from sklearn.metrics import accuracy_score, f1_score
class ClassifyEnv(gym.Env):
"""Classification as an unsupervised OpenAI Gym RL problem.
Includes scikit-learn digits d... | [
"cv2.resize",
"pandas.read_csv",
"domain.text_vectorizers.BiLSTMVectorizer",
"sklearn.model_selection.train_test_split",
"scipy.signal.spectrogram",
"numpy.argmax",
"numpy.array",
"numpy.sum",
"scipy.io.wavfile.read",
"numpy.empty",
"domain.text_vectorizers.ASCIIVectorizer",
"domain.text_vecto... | [((2937, 2980), 'pandas.read_csv', 'pd.read_csv', (['"""data/spam_classify/train.csv"""'], {}), "('data/spam_classify/train.csv')\n", (2948, 2980), True, 'import pandas as pd\n'), ((4135, 4173), 'pandas.read_csv', 'pd.read_csv', (['"""data/sen_imdb/train.csv"""'], {}), "('data/sen_imdb/train.csv')\n", (4146, 4173), Tru... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 The FATE 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/licens... | [
"federatedml.protobuf.generated.onehot_param_pb2.ColsMap",
"federatedml.param.onehot_encoder_param.OneHotEncoderParam",
"federatedml.protobuf.generated.onehot_param_pb2.OneHotParam",
"numpy.array",
"arch.api.utils.log_utils.getLogger",
"federatedml.statistic.data_overview.get_header",
"functools.partial... | [((1031, 1052), 'arch.api.utils.log_utils.getLogger', 'log_utils.getLogger', ([], {}), '()\n', (1050, 1052), False, 'from arch.api.utils import log_utils\n'), ((3866, 3886), 'federatedml.param.onehot_encoder_param.OneHotEncoderParam', 'OneHotEncoderParam', ([], {}), '()\n', (3884, 3886), False, 'from federatedml.param.... |
import os
import argparse
import random
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, AutoConfig
from transformers.optimization import get_linear_schedule_with_warmup, Adafactor
import nlp
from rouge_score import rouge_sc... | [
"torch.nn.CrossEntropyLoss",
"torch.nn.utils.rnn.pad_sequence",
"torch.cuda.device_count",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.is_available",
"transformers.AutoTokenizer.from_pretrained",
"nlp.load_dataset",
"transformers.optimization.get_linear_schedule_with_warmup",
"arg... | [((15429, 15451), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (15440, 15451), False, 'import random\n'), ((15456, 15481), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (15470, 15481), True, 'import numpy as np\n'), ((15486, 15514), 'torch.manual_seed', 'torch.manua... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import pandas as pd
import math
def moving_average(a, n=7) :
ret = np.cumsum(a, dtype=float)
ret[n:] = ret[n:] - ret[:-n]
return ret[n - 1:] / n
#leitura de dados e montagem dos arrays para plotagem:
df = pd.read_exc... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.patches.Patch",
"pandas.read_excel",
"pandas.DataFrame",
"numpy.cumsum",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((309, 336), 'pandas.read_excel', 'pd.read_excel', (['"""dados.xlsx"""'], {}), "('dados.xlsx')\n", (322, 336), True, 'import pandas as pd\n'), ((1952, 1965), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (1962, 1965), True, 'import matplotlib.pyplot as plt\n'), ((1979, 2034), 'matplotlib.patches.Pa... |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
from numpy.random import RandomState
from numpy.random import mtrand
def randomu(seed, di=None, binomial=None, double=False, gamma=False,
normal=False, poisson=False):
"""
Replicates the randomu fun... | [
"numpy.random.RandomState"
] | [((5125, 5138), 'numpy.random.RandomState', 'RandomState', ([], {}), '()\n', (5136, 5138), False, 'from numpy.random import RandomState\n')] |
import os
import numpy as np
def get_all_file(filepath):
files = os.listdir(filepath)
file_list = []
for fi in files:
fi_d = os.path.join(filepath, fi)
if os.path.isdir(fi_d):
get_all_file(fi_d)
elif 'acc_' in fi_d:
# file_list.append(os.path.join(filepath, fi... | [
"os.listdir",
"numpy.reshape",
"os.path.join",
"os.path.isdir",
"numpy.concatenate"
] | [((69, 89), 'os.listdir', 'os.listdir', (['filepath'], {}), '(filepath)\n', (79, 89), False, 'import os\n'), ((1494, 1518), 'numpy.reshape', 'np.reshape', (['x_all', '(-1,)'], {}), '(x_all, (-1,))\n', (1504, 1518), True, 'import numpy as np\n'), ((1562, 1583), 'numpy.reshape', 'np.reshape', (['y_all', '(-1)'], {}), '(y... |
import numpy as np
import pandas as pd
from datetime import datetime as dt, timedelta
import sys
N_DATASETS = 3
args = sys.argv[1:]
if __name__ == "__main__":
if len(args) == 1:
N_DATASETS = int(args[0])
for i in range(1,N_DATASETS+1):
start_date = dt.now()
days = int(np.random.randi... | [
"datetime.datetime.now",
"numpy.random.randint",
"pandas.date_range",
"datetime.timedelta"
] | [((277, 285), 'datetime.datetime.now', 'dt.now', ([], {}), '()\n', (283, 285), True, 'from datetime import datetime as dt, timedelta\n'), ((420, 455), 'pandas.date_range', 'pd.date_range', (['start_date', 'end_date'], {}), '(start_date, end_date)\n', (433, 455), True, 'import pandas as pd\n'), ((472, 518), 'numpy.rando... |
"""
Compute the principal eigenvector of a matrix using power iteration.
See also numpy.linalg.eig which calculates all the eigenvalues and
eigenvectors.
"""
from typing import Tuple
import numpy as np
def _normalise(nvec: np.ndarray) -> np.ndarray:
"""Normalises the given numpy array."""
with np.errstate(... | [
"numpy.sqrt",
"numpy.ones",
"numpy.errstate",
"numpy.array",
"numpy.dot"
] | [((604, 614), 'numpy.sqrt', 'np.sqrt', (['s'], {}), '(s)\n', (611, 614), True, 'import numpy as np\n'), ((1792, 1805), 'numpy.array', 'np.array', (['mat'], {}), '(mat)\n', (1800, 1805), True, 'import numpy as np\n'), ((1845, 1858), 'numpy.ones', 'np.ones', (['size'], {}), '(size)\n', (1852, 1858), True, 'import numpy a... |
"""CIFAR10
****************************************
This is a dataset of 50,000 32x32 color training images and 10,000 test
images, labeled over 10 categories. See more info at the
`CIFAR homepage <https://www.cs.toronto.edu/~kriz/cifar.html>`_
The classes are:
- airplane
- automobile
- bird
- cat
- deer
- dog
-... | [
"os.listdir",
"numpy.unique",
"os.makedirs",
"mltk.utils.logger.get_logger",
"keras_preprocessing.image.utils.array_to_img",
"os.path.join",
"pickle.load",
"numpy.empty",
"mltk.utils.archive_downloader.download_verify_extract",
"numpy.concatenate",
"mltk.utils.path.create_user_dir",
"tensorflo... | [((2006, 2263), 'mltk.utils.archive_downloader.download_verify_extract', 'download_verify_extract', ([], {'url': '"""https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"""', 'dest_subdir': '"""datasets/cifar10"""', 'file_hash': '"""6d958be074577803d12ecdefd02955f39262c83c16fe9348329d7fe0b5c001ce"""', 'show_progress... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.