code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
from functools import partial
from multiprocessing import Pool
from scipy import ndimage
from scipy.signal import medfilt
from scipy.interpolate import interp1d
from .utils import correlated_median_removal, pca
from .utils import interferograms_regrid
from .utils import cpu_count
# Helper functio... | [
"numpy.mean",
"numpy.abs",
"numpy.median",
"numpy.nanmedian",
"numpy.ma.array",
"numpy.polynomial.polynomial.polyfit",
"numpy.max",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.dot",
"functools.partial",
"scipy.ndimage.binary_dilation",
"numpy.min",
"scipy.signal.medfilt",
"numpy.... | [((2567, 2605), 'numpy.mean', 'np.mean', (['[bins[1:], bins[:-1]]'], {'axis': '(0)'}), '([bins[1:], bins[:-1]], axis=0)\n', (2574, 2605), True, 'import numpy as np\n'), ((2620, 2667), 'functools.partial', 'partial', (['_pool_interferograms_regrid'], {'bins': 'bins'}), '(_pool_interferograms_regrid, bins=bins)\n', (2627... |
# Copyright 1999-2021 Alibaba Group Holding 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 a... | [
"tempfile.TemporaryDirectory",
"PIL.Image.fromarray",
"numpy.sort",
"os.path.join",
"numpy.random.randint",
"pytest.mark.skipif",
"numpy.testing.assert_array_equal"
] | [((758, 818), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not Image)'], {'reason': '"""Pillow not installed"""'}), "(not Image, reason='Pillow not installed')\n", (776, 818), False, 'import pytest\n'), ((862, 891), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (889, 891), False, 'i... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
from functools import partial
import json
import traceback
import imlib as im
import numpy as np
import pylib
import tensorflow as tf
import tflib as tl
import data
import models
import matpl... | [
"pylib.mkdir",
"tflib.load_checkpoint",
"argparse.ArgumentParser",
"tensorflow.placeholder",
"data.Celeba.check_attribute_conflict",
"data.Custom.check_attribute_conflict",
"numpy.array",
"functools.partial",
"data.Custom",
"numpy.concatenate",
"tflib.session",
"json.load",
"numpy.full",
"... | [((595, 620), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (618, 620), False, 'import argparse\n'), ((1784, 1796), 'tflib.session', 'tl.session', ([], {}), '()\n', (1794, 1796), True, 'import tflib as tl\n'), ((2145, 2199), 'functools.partial', 'partial', (['models.Genc'], {'dim': 'enc_dim', ... |
import re
import numpy as np
from string import punctuation
# snowball stopwords from http://snowball.tartarus.org/algorithms/english/stop.txt
_STOPWORDS = {'a', 'about', 'above', 'after', 'again', 'against', 'all', 'am', 'an', 'and', 'any', 'are', "aren't", 'as',
'at', 'be', 'because', 'been', 'before',... | [
"numpy.sum",
"numpy.linalg.norm",
"re.compile"
] | [((1857, 1925), 're.compile', 're.compile', (['"""\\\\b(I|[Yy]ou|[Hh]e|[Ss]he|[Ii]t|[Ww]e|[Tt]hey)\'\\\\w+\\\\b"""'], {}), '("\\\\b(I|[Yy]ou|[Hh]e|[Ss]he|[Ii]t|[Ww]e|[Tt]hey)\'\\\\w+\\\\b")\n', (1867, 1925), False, 'import re\n'), ((1941, 1977), 're.compile', 're.compile', (['"""FW|(VB)\\\\w?|NN\\\\w?\\\\w?"""'], {}), ... |
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2019/7/28 0:51
# @Author: <EMAIL>
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.contrib.layers import l2_regularizer
import tensorflow as tf
from PIL import Image
import numpy as np
import os
input_node = 784 # 输入节点
output_node = 10 ... | [
"tensorflow.contrib.layers.l2_regularizer",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.random.truncated_normal",
"numpy.array",
"tensorflow.control_dependencies",
"tensorflow.compat.v1.train.GradientDescentOptimizer",
"tensorflow.compat.v1.get_collection",
"tensorflow... | [((1697, 1757), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', ([], {'train_dir': '"""./data/"""', 'one_hot': '(True)'}), "(train_dir='./data/', one_hot=True)\n", (1722, 1757), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((1775, 1837), 'tensorfl... |
#!/usr/bin/python
#!encoding:utf-8
import time
from hashlib import md5, sha512
import base64
import struct
import numpy
from const import MID, THRESHOLD, THRESHOLD, SRCID, \
VERNO, UI, PK, AK, SK, UI, PK, AK, FID_DECODED_LEN, FID_LEN
def hex_string(to_hex):
out = ""
hex_digit = "0123456789ABCDEF"
o... | [
"hashlib.md5",
"base64.b64encode",
"base64.b64decode",
"struct.pack",
"numpy.uint32",
"hashlib.sha512",
"time.time",
"struct.unpack_from"
] | [((604, 628), 'numpy.uint32', 'numpy.uint32', (['(~threshold)'], {}), '(~threshold)\n', (616, 628), False, 'import numpy\n'), ((650, 685), 'numpy.uint32', 'numpy.uint32', (['(filesize & 4294967295)'], {}), '(filesize & 4294967295)\n', (662, 685), False, 'import numpy\n'), ((1086, 1107), 'base64.b64decode', 'base64.b64d... |
# nuScenes dev-kit.
# Code written by <NAME>, 2020.
import colorsys
from typing import Any, Dict, List, Tuple, Callable
import cv2
import numpy as np
from pyquaternion import Quaternion
from nuscenes.prediction import PredictHelper
from nuscenes.prediction.helper import quaternion_yaw
from nuscenes.prediction.input_r... | [
"nuscenes.prediction.input_representation.utils.get_rotation_matrix",
"cv2.warpAffine",
"cv2.boxPoints",
"numpy.int0",
"numpy.zeros",
"nuscenes.prediction.input_representation.utils.convert_to_pixel_coords",
"pyquaternion.Quaternion",
"colorsys.rgb_to_hsv",
"nuscenes.prediction.input_representation.... | [((1622, 1648), 'cv2.boxPoints', 'cv2.boxPoints', (['coord_tuple'], {}), '(coord_tuple)\n', (1635, 1648), False, 'import cv2\n'), ((2474, 2559), 'nuscenes.prediction.input_representation.utils.convert_to_pixel_coords', 'convert_to_pixel_coords', (['location', 'center_coordinates', 'center_pixels', 'resolution'], {}), '... |
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import argparse
import numpy as np
import cv2
# Manually splitting the image because finding each individual petri
#dish automatically is not possible or we could not.
img = mpimg.imread('img/gray.jpg')
img1 = img[500:705, 75:300]
img2 = img[500:705, ... | [
"matplotlib.pyplot.imshow",
"matplotlib.image.imread",
"numpy.asarray",
"cv2.HoughCircles",
"cv2.circle",
"cv2.cvtColor"
] | [((243, 271), 'matplotlib.image.imread', 'mpimg.imread', (['"""img/gray.jpg"""'], {}), "('img/gray.jpg')\n", (255, 271), True, 'import matplotlib.image as mpimg\n'), ((588, 626), 'cv2.cvtColor', 'cv2.cvtColor', (['img1', 'cv2.COLOR_BGR2GRAY'], {}), '(img1, cv2.COLOR_BGR2GRAY)\n', (600, 626), False, 'import cv2\n'), ((6... |
import unittest
import sys
import os
import numpy as np
import SciFiReaders as sr
import sidpy
import wget
wget.download("https://github.com/pycroscopy/SciFiDatasets/raw/main/data/Bias-Spectroscopy041.dat",
out = 'Bias-Spectroscopy.dat')
wget.download("https://github.com/pycroscopy/SciFiDatasets/blob/main/data/COOx_... | [
"wget.download",
"SciFiReaders.NanonisSXMReader",
"numpy.array",
"SciFiReaders.NanonisDatReader",
"sys.path.append",
"os.remove"
] | [((108, 246), 'wget.download', 'wget.download', (['"""https://github.com/pycroscopy/SciFiDatasets/raw/main/data/Bias-Spectroscopy041.dat"""'], {'out': '"""Bias-Spectroscopy.dat"""'}), "(\n 'https://github.com/pycroscopy/SciFiDatasets/raw/main/data/Bias-Spectroscopy041.dat'\n , out='Bias-Spectroscopy.dat')\n", (12... |
import os
import numpy as np
import np_tif
# each raw data stack is a red/green delay scan (3 different delays,
# middle one 0 delay)
angles = [
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
]
g... | [
"os.path.exists",
"np_tif.tif_to_array",
"numpy.concatenate"
] | [((1070, 1095), 'numpy.concatenate', 'np.concatenate', (['data_list'], {}), '(data_list)\n', (1084, 1095), True, 'import numpy as np\n'), ((731, 755), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (745, 755), False, 'import os\n'), ((816, 845), 'np_tif.tif_to_array', 'np_tif.tif_to_array', (['... |
import pandas as pd
import numpy as np
import category_encoders as ce
import datetime
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
# Make NumPy printouts easier to read.
np.set_printoptions(precision=3, suppress=True)
def rearrange_date(df):
"""
Merges ... | [
"numpy.abs",
"category_encoders.TargetEncoder",
"pandas.read_csv",
"category_encoders.LeaveOneOutEncoder",
"numpy.argmin",
"category_encoders.OneHotEncoder",
"datetime.timedelta",
"sklearn.linear_model.LinearRegression",
"pandas.to_datetime",
"numpy.set_printoptions"
] | [((228, 275), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'suppress': '(True)'}), '(precision=3, suppress=True)\n', (247, 275), True, 'import numpy as np\n'), ((651, 677), 'pandas.to_datetime', 'pd.to_datetime', (["df['DATE']"], {}), "(df['DATE'])\n", (665, 677), True, 'import pandas as p... |
"""
GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
Atlanta, Georgia 30332-0415
All Rights Reserved
See LICENSE for the license information
Rot3 unit tests.
Author: <NAME>
"""
# pylint: disable=no-name-in-module
import unittest
import numpy as np
import gtsam
from gtsam import Rot3
from gtsam.utils.tes... | [
"gtsam.Rot3",
"numpy.array",
"numpy.testing.assert_almost_equal",
"unittest.main",
"numpy.rad2deg"
] | [((56664, 56679), 'unittest.main', 'unittest.main', ([], {}), '()\n', (56677, 56679), False, 'import unittest\n'), ((55826, 55949), 'numpy.array', 'np.array', (['[[-0.999957, 0.00922903, 0.00203116], [0.00926964, 0.999739, 0.0208927], [-\n 0.0018374, 0.0209105, -0.999781]]'], {}), '([[-0.999957, 0.00922903, 0.002031... |
#!/people/chen423/sw/anaconda3/bin/python
import numpy as np
import xarray as xr
import netCDF4 as nc
from calendar import monthrange
import sys
model = sys.argv[1]
def crt_filenames(model, year, month):
ARfile_NARRbase = '/pic/projects/hyperion/chen423/data/papers/AR-SST/data/%s/AR_tagged/Gershunov/SERDP6k... | [
"numpy.zeros",
"netCDF4.Dataset",
"xarray.open_dataset",
"numpy.arange"
] | [((2801, 2818), 'numpy.arange', 'np.arange', (['(10)', '(13)'], {}), '(10, 13)\n', (2810, 2818), True, 'import numpy as np\n'), ((3161, 3182), 'numpy.arange', 'np.arange', (['(2004)', '(2016)'], {}), '(2004, 2016)\n', (3170, 3182), True, 'import numpy as np\n'), ((1200, 1221), 'numpy.zeros', 'np.zeros', (['ARtag.shape'... |
import numpy as np
from numpy import array
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.utils import to_categorical
from tensorflow.python.keras.utils.vis_utils import plot_model
from tensorflow.keras.models import Model
from tensorf... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.utils.to_categorical",
"keras.preprocessing.text.Tokenizer",
"tensorflow.keras.layers.Dropout",
"tensorflow.python.keras.utils.vis_utils.plot_model",
"tensorflow.keras.models.Model",
"keras.layers.merge.add",
"numpy.array",
"tensorflow.keras.layers.... | [((2227, 2238), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {}), '()\n', (2236, 2238), False, 'from keras.preprocessing.text import Tokenizer\n'), ((3181, 3210), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(4096, 299, 299)'}), '(shape=(4096, 299, 299))\n', (3186, 3210), False, 'from tensorflow... |
"""Calculate morris indices for models with dependent parameters.
We convert frequently between iid uniform, iid standard normal and multivariate
normal variables. To not get confused, we use the following naming conventions:
-u refers to to uniform variables
-z refers to standard normal variables
-x refers to multiv... | [
"numpy.abs",
"numpy.repeat",
"scipy.stats.norm.ppf",
"joblib.delayed",
"joblib.Parallel",
"numba.guvectorize",
"numpy.zeros",
"numpy.array",
"multiprocessing.Pool",
"numpy.random.uniform",
"numpy.linalg.cholesky",
"chaospy.create_sobol_samples",
"numpy.arange"
] | [((9443, 9536), 'numba.guvectorize', 'nb.guvectorize', (["['f8[:], i8, f8[:]', 'i8[:], i8, i8[:]']", '"""(m), () -> (m)"""'], {'nopython': '(True)'}), "(['f8[:], i8, f8[:]', 'i8[:], i8, i8[:]'], '(m), () -> (m)',\n nopython=True)\n", (9457, 9536), True, 'import numba as nb\n'), ((6280, 6297), 'scipy.stats.norm.ppf',... |
from functools import lru_cache
import numpy as np
from lie_learn.representations.SO3.irrep_bases import change_of_basis_matrix
from lie_learn.representations.SO3.pinchon_hoggan.pinchon_hoggan_dense import rot_mat, Jd
from lie_learn.representations.SO3.wigner_d import wigner_d_matrix, wigner_D_matrix
import lie_lear... | [
"numpy.sqrt",
"lie_learn.representations.SO3.wigner_d.wigner_D_matrix",
"scipy.fftpack.fftshift",
"lie_learn.representations.SO3.indexing.flat_ind_so3",
"scipy.fftpack.fft2",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.einsum",
"numpy.empty",
"lie_learn.spaces.S3.quadrature_weights",
"sc... | [((15104, 15125), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(32)'}), '(maxsize=32)\n', (15113, 15125), False, 'from functools import lru_cache\n'), ((15226, 15247), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(32)'}), '(maxsize=32)\n', (15235, 15247), False, 'from functools import lru_cache\n'), (... |
import csv
from logging import Logger
import os
import sys
from typing import List
import numpy as np
import torch
from tqdm import trange
import pickle
from torch.optim.lr_scheduler import ExponentialLR
from torch.optim import Adam, SGD
import wandb
from .evaluate import evaluate, evaluate_predictions
from .predict ... | [
"wandb.log",
"numpy.nanmean",
"chemprop.utils.makedirs",
"numpy.array",
"chemprop.bayes.predict_std_gp",
"chemprop.bayes_utils.scheduler_const",
"chemprop.utils.get_metric_func",
"chemprop.data.utils.split_data",
"numpy.random.multinomial",
"chemprop.utils.build_lr_scheduler",
"numpy.exp",
"ch... | [((1780, 1835), 'chemprop.data.utils.get_data', 'get_data', ([], {'path': 'args.data_path', 'args': 'args', 'logger': 'logger'}), '(path=args.data_path, args=args, logger=logger)\n', (1788, 1835), False, 'from chemprop.data.utils import get_class_sizes, get_data, get_task_names, split_data\n'), ((2076, 2195), 'chemprop... |
import unittest
import numpy as np
from cdbw import CDbw
epsilon = 1e-16
# 1 - 3D DATA TEST 1
data_3d_1 = np.load("xyz.npy")
labels_3d_1 = np.load("labels.npy")
# 2 - 3D DATA TEST 2
data_3d_2 = np.load("xyz1.npy")
labels_3d_2 = np.load("labels1.npy")
# 3 - 2D BLOBS DATA TEST
data_2d_bl = np.load("xyzbl.npy")
labels... | [
"unittest.main",
"numpy.load",
"cdbw.CDbw"
] | [((110, 128), 'numpy.load', 'np.load', (['"""xyz.npy"""'], {}), "('xyz.npy')\n", (117, 128), True, 'import numpy as np\n'), ((143, 164), 'numpy.load', 'np.load', (['"""labels.npy"""'], {}), "('labels.npy')\n", (150, 164), True, 'import numpy as np\n'), ((198, 217), 'numpy.load', 'np.load', (['"""xyz1.npy"""'], {}), "('... |
import abc
import pickle
import typing as t
from typing import TYPE_CHECKING
from simple_di import inject
from simple_di import Provide
from ..types import LazyType
from ..configuration.containers import DeploymentContainer
SingleType = t.TypeVar("SingleType")
BatchType = t.TypeVar("BatchType")
IndexType = t.Union[... | [
"pickle.dumps",
"numpy.squeeze",
"numpy.stack",
"numpy.split",
"pyarrow.plasma.ObjectID",
"pickle.loads",
"pandas.concat",
"typing.TypeVar"
] | [((240, 263), 'typing.TypeVar', 't.TypeVar', (['"""SingleType"""'], {}), "('SingleType')\n", (249, 263), True, 'import typing as t\n'), ((276, 298), 'typing.TypeVar', 't.TypeVar', (['"""BatchType"""'], {}), "('BatchType')\n", (285, 298), True, 'import typing as t\n'), ((2436, 2470), 'numpy.stack', 'np.stack', (['single... |
#!/usr/bin/env python
import zmq
import math
import numpy as np
from common.params import Params
from common.numpy_fast import interp
import selfdrive.messaging as messaging
from cereal import car
from common.realtime import sec_since_boot
from selfdrive.swaglog import cloudlog
from selfdrive.config import Conversions... | [
"selfdrive.kegman_conf.get",
"selfdrive.controls.lib.long_mpc.LongitudinalMpc",
"selfdrive.messaging.new_message",
"common.numpy_fast.interp",
"zmq.Poller",
"common.params.Params",
"selfdrive.messaging.pub_sock",
"numpy.vstack",
"selfdrive.messaging.sub_sock",
"selfdrive.controls.lib.fcw.FCWChecke... | [((1483, 1508), 'selfdrive.kegman_conf.get', 'kegman.get', (['"""brakefactor"""'], {}), "('brakefactor')\n", (1493, 1508), True, 'import selfdrive.kegman_conf as kegman\n'), ((1707, 1755), 'common.numpy_fast.interp', 'interp', (['v_ego', '_A_CRUISE_MIN_BP', '_A_CRUISE_MIN_V'], {}), '(v_ego, _A_CRUISE_MIN_BP, _A_CRUISE_... |
import random
from math import sqrt
import numpy as np
import pandas as pd
from numpy import mean, var
from scipy.stats import mannwhitneyu, wilcoxon
def mwyu(g1, g2, override_alt=None):
"""Calculate mannwhitneyu test."""
g1_mean = np.mean(g1)
g2_mean = np.mean(g2)
if g1_mean < g2_mean:
altme... | [
"numpy.mean",
"math.sqrt",
"random.seed",
"pandas.DataFrame.from_dict",
"scipy.stats.wilcoxon",
"scipy.stats.mannwhitneyu",
"pandas.concat",
"numpy.var"
] | [((243, 254), 'numpy.mean', 'np.mean', (['g1'], {}), '(g1)\n', (250, 254), True, 'import numpy as np\n'), ((269, 280), 'numpy.mean', 'np.mean', (['g2'], {}), '(g2)\n', (276, 280), True, 'import numpy as np\n'), ((440, 483), 'scipy.stats.mannwhitneyu', 'mannwhitneyu', (['g1', 'g2'], {'alternative': 'altmethod'}), '(g1, ... |
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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
#
# Unles... | [
"core.graph_pattern_matching.get_nodes_in_branch",
"core.graph_pattern_matching.sort_graph",
"modules.packer.Packer",
"math.ceil",
"math.floor",
"core.data_types.Uint32",
"numpy.float64",
"core.data_types.QUANTIZED_NOT_PACKED",
"typing.cast",
"collections.defaultdict",
"numpy.empty",
"numpy.fu... | [((4844, 4861), 'core.graph_pattern_matching.sort_graph', 'sort_graph', (['graph'], {}), '(graph)\n', (4854, 4861), False, 'from core.graph_pattern_matching import get_nodes_in_branch, sort_graph\n'), ((8562, 8579), 'core.graph_pattern_matching.sort_graph', 'sort_graph', (['graph'], {}), '(graph)\n', (8572, 8579), Fals... |
# Copyright 2017 The KaiJIN Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"numpy.array",
"numpy.dot",
"numpy.linalg.norm"
] | [((1004, 1023), 'numpy.array', 'np.array', (['feat1[_i]'], {}), '(feat1[_i])\n', (1012, 1023), True, 'import numpy as np\n'), ((1032, 1051), 'numpy.array', 'np.array', (['feat2[_i]'], {}), '(feat2[_i])\n', (1040, 1051), True, 'import numpy as np\n'), ((1065, 1082), 'numpy.linalg.norm', 'np.linalg.norm', (['p'], {}), '(... |
import h5py
import time
import json
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.preprocessing import StandardScaler
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import RBF
from sklearn.svm import SVC, One... | [
"trackml.dataset.load_dataset",
"numpy.sqrt",
"sklearn.svm.OneClassSVM",
"h5py.File",
"sklearn.preprocessing.StandardScaler",
"json.load",
"time.time"
] | [((591, 624), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2 + z ** 2)'], {}), '(x ** 2 + y ** 2 + z ** 2)\n', (598, 624), True, 'import numpy as np\n'), ((680, 704), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)\n', (687, 704), True, 'import numpy as np\n'), ((738, 754), 'sklearn.preprocessing... |
import os
import h5py
import pandas as pd
import copy
from RAMAC import extract_feature
import torchvision
import torchvision.transforms as transforms
import torch.utils.data as data
import numpy as np
from PIL import Image, ImageChops
import torch
from diffusion import Diffusion
from resnet import resnet101
from cirto... | [
"RAMAC.extract_feature",
"torchvision.transforms.ToPILImage",
"PIL.Image.new",
"numpy.argsort",
"numpy.array",
"resnet.resnet101",
"diffusion.Diffusion",
"os.listdir",
"numpy.repeat",
"cirtorch.networks.imageretrievalnet.init_network",
"cirtorch.networks.imageretrievalnet.extract_vectors",
"nu... | [((870, 915), 'PIL.Image.new', 'Image.new', (['im.mode', '(imsize, imsize)', '"""white"""'], {}), "(im.mode, (imsize, imsize), 'white')\n", (879, 915), False, 'from PIL import Image, ImageChops\n'), ((1182, 1198), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1192, 1198), False, 'import os\n'), ((2465, 2491)... |
from __future__ import absolute_import, division, print_function, unicode_literals
__metaclass__ = type
import random
import os
import math
import h5py
import cv2
import numpy as np
import sqlite3
from .util import static_vars
from .task import DEBUG
from .google_storage import downloadIfAvailable
POSITIVE_IMAGE_DA... | [
"os.listdir",
"sqlite3.connect",
"numpy.delete",
"numpy.asarray",
"os.path.join",
"h5py.File",
"os.path.isfile",
"numpy.zeros",
"numpy.random.seed",
"cv2.resize",
"cv2.imread"
] | [((447, 506), 'os.path.join', 'os.path.join', (['POSITIVE_IMAGE_DATABASE_FOLDER', '"""aflw.sqlite"""'], {}), "(POSITIVE_IMAGE_DATABASE_FOLDER, 'aflw.sqlite')\n", (459, 506), False, 'import os\n'), ((1371, 1397), 'numpy.asarray', 'np.asarray', (['CALIB_PATTERNS'], {}), '(CALIB_PATTERNS)\n', (1381, 1397), True, 'import n... |
import pandas as pd
df = pd.read_csv('balanced_reviews.csv')
df.isnull().any(axis = 0)
#handle the missing data
df.dropna(inplace = True)
#leaving the reviews with rating 3 and collect reviews with
#rating 1, 2, 4 and 5 onyl
df = df [df['overall'] != 3]
import numpy as np
#creating a label
#based on the valu... | [
"pandas.read_csv",
"numpy.where",
"sklearn.model_selection.train_test_split",
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.linear_model.LogisticRegression",
"sklearn.metrics.roc_auc_score",
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.metrics.confusion_matrix"
] | [((27, 62), 'pandas.read_csv', 'pd.read_csv', (['"""balanced_reviews.csv"""'], {}), "('balanced_reviews.csv')\n", (38, 62), True, 'import pandas as pd\n'), ((360, 393), 'numpy.where', 'np.where', (["(df['overall'] > 3)", '(1)', '(0)'], {}), "(df['overall'] > 3, 1, 0)\n", (368, 393), True, 'import numpy as np\n'), ((610... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os
import pyaudio
import toga
from toga.style.pack import *
import wave
def GenerateSpectrum(filename):
file = wave.open(filename, "rb")
data = file.readframes(40000)
data = np.fromstring(data, 'Int16')
... | [
"toga.Label",
"wave.open",
"toga.Group",
"matplotlib.pyplot.savefig",
"toga.MainWindow",
"toga.ImageView",
"toga.Command",
"matplotlib.use",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.specgram",
"toga.ScrollContainer",
"toga.Box",
"pyaudio.PyAudio",
"toga.Image",
"numpy.fromstring",
... | [((19, 40), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (33, 40), False, 'import matplotlib\n'), ((219, 244), 'wave.open', 'wave.open', (['filename', '"""rb"""'], {}), "(filename, 'rb')\n", (228, 244), False, 'import wave\n'), ((290, 318), 'numpy.fromstring', 'np.fromstring', (['data', '"""Int... |
import numpy as np
# addition of vector with scalar
one_dim_array = np.array([11, 21, 31, 41]) #create an array
# array([11, 21, 31, 41])
one_dim_array + 1 # element wise addition
# array([12, 22, 32, 42])
one_dim_array ** 2 # element wise exponent
# array([ 121, 441, 961, 1681], dtype=int32)
one_dim... | [
"numpy.array",
"numpy.diag"
] | [((72, 98), 'numpy.array', 'np.array', (['[11, 21, 31, 41]'], {}), '([11, 21, 31, 41])\n', (80, 98), True, 'import numpy as np\n'), ((425, 446), 'numpy.diag', 'np.diag', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (432, 446), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 2 21:55:13 2019
@author: catalin
"""
import numpy as np
import my_db
class BB(my_db.UpdateDB):
def __init__(self, **kwargs):
self.wlen = kwargs['period_size']
self.n_std = kwargs['n_std']
self.__cirbuf = np.zeros(self... | [
"numpy.sum",
"numpy.zeros",
"numpy.multiply",
"numpy.subtract"
] | [((307, 326), 'numpy.zeros', 'np.zeros', (['self.wlen'], {}), '(self.wlen)\n', (315, 326), True, 'import numpy as np\n'), ((1335, 1349), 'numpy.sum', 'np.sum', (['cirbuf'], {}), '(cirbuf)\n', (1341, 1349), True, 'import numpy as np\n'), ((1530, 1558), 'numpy.multiply', 'np.multiply', (['self.n_std', 'std'], {}), '(self... |
import warnings
import numpy as np
from scipy.spatial.distance import cosine as cos_distance
from .utils import compute_fragments, average_agg_tanimoto, \
compute_scaffolds, fingerprints, \
get_mol, canonic_smiles, mol_passes_filters, \
logP, QED, SA, NP, weight
from moses.utils import mapper
from multiproc... | [
"numpy.mean",
"scipy.spatial.distance.cosine",
"fcd_torch.calculate_frechet_distance",
"fcd_torch.FCD",
"moses.utils.enable_rdkit_log",
"numpy.var",
"multiprocessing.Pool",
"moses.utils.mapper",
"warnings.warn",
"moses.utils.disable_rdkit_log"
] | [((2231, 2250), 'moses.utils.disable_rdkit_log', 'disable_rdkit_log', ([], {}), '()\n', (2248, 2250), False, 'from moses.utils import disable_rdkit_log, enable_rdkit_log\n'), ((5057, 5075), 'moses.utils.enable_rdkit_log', 'enable_rdkit_log', ([], {}), '()\n', (5073, 5075), False, 'from moses.utils import disable_rdkit_... |
from alr.utils import eval_fwd_exp, timeop, manual_seed
from alr import MCDropout
from alr.data.datasets import Dataset
from alr.data import UnlabelledDataset, DataManager
from alr.acquisition import BALD, RandomAcquisition
from alr.training.ephemeral_trainer import EphemeralTrainer
from alr.training.samplers import Ra... | [
"pickle.dump",
"alr.training.samplers.RandomFixedLengthSampler",
"pathlib.Path",
"alr.utils.timeop",
"alr.utils.manual_seed",
"alr.MCDropout",
"alr.training.ephemeral_trainer.EphemeralTrainer",
"alr.data.datasets.Dataset.MNIST.get_fixed",
"numpy.array",
"torch.cuda.is_available",
"collections.de... | [((1287, 1302), 'alr.utils.manual_seed', 'manual_seed', (['(42)'], {}), '(42)\n', (1298, 1302), False, 'from alr.utils import eval_fwd_exp, timeop, manual_seed\n'), ((1580, 1597), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1591, 1597), False, 'from collections import defaultdict\n'), ((1919,... |
import numpy as np
import torch
import os
import random
def seed_everything(seed):
random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.deterministic = True
np.random.seed(seed)
os.environ["PYTHONHASHSEED"] = str(seed)
class AverageMeter:
def __... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"os.path.splitext",
"random.seed",
"os.path.basename",
"numpy.random.seed"
] | [((89, 106), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (100, 106), False, 'import random\n'), ((111, 134), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (128, 134), False, 'import torch\n'), ((139, 171), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), ... |
#===============================================================================
# Copyright (c) 2016, <NAME>, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | [
"numpy.random.rand",
"GPy.util.linalg.DSYR",
"GPy.plotting.matplot_dep.util.fixed_inputs",
"numpy.array",
"GPy.util.univariate_Gaussian.logPdfNormal",
"numpy.sin",
"GPy.models.GPRegression",
"numpy.arange",
"numpy.random.binomial",
"numpy.mean",
"numpy.dot",
"GPy.util.univariate_Gaussian.deriv... | [((2371, 2403), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(25, 25)'], {}), '(0, 1, (25, 25))\n', (2387, 2403), True, 'import numpy as np\n'), ((2645, 2667), 'numpy.random.randn', 'np.random.randn', (['(10)', '(3)'], {}), '(10, 3)\n', (2660, 2667), True, 'import numpy as np\n'), ((2732, 2761), 'GPy.mod... |
"""-----------------------------------------------------------------------------
bidsIncremental.py
Implements the BIDS Incremental data type used for streaming BIDS data between
different applications.
-----------------------------------------------------------------------------"""
from copy import deepcopy
from op... | [
"logging.getLogger",
"rtCommon.bidsCommon.symmetricDictDifference",
"copy.deepcopy",
"rtCommon.bidsCommon.loadBidsEntities",
"rtCommon.bidsCommon.filterEntities",
"bids.layout.writing.build_path",
"rtCommon.errors.MissingMetadataError",
"pandas.DataFrame",
"pandas.DataFrame.equals",
"rtCommon.bids... | [((1102, 1129), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1119, 1129), False, 'import logging\n'), ((1170, 1188), 'rtCommon.bidsCommon.loadBidsEntities', 'loadBidsEntities', ([], {}), '()\n', (1186, 1188), False, 'from rtCommon.bidsCommon import BIDS_DIR_PATH_PATTERN, BIDS_FILE_PATT... |
# -*- coding: utf-8 -*-
# Author: <NAME>
import numpy as np
import matplotlib.pyplot as plt
import struct
import sys
import os.path
# check if path given
if len(sys.argv) < 2:
exit()
file_name = sys.argv[1]
plt.ion()
plt.show()
for i in range(1, len(sys.argv)):
file_name = sys.argv[i]
if os.path.isfile... | [
"matplotlib.pyplot.ion",
"matplotlib.pyplot.imshow",
"numpy.load",
"matplotlib.pyplot.show"
] | [((215, 224), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (222, 224), True, 'import matplotlib.pyplot as plt\n'), ((225, 235), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (233, 235), True, 'import matplotlib.pyplot as plt\n'), ((447, 465), 'numpy.load', 'np.load', (['load_from'], {}), '(load_from)... |
"""
Use SciPy to solve bundle adjustment
Ref: https://scipy-cookbook.readthedocs.io/items/bundle_adjustment.html
"""
from __future__ import print_function
import urllib3
import shutil
import bz2
import numpy as np
import util
import os
from scipy.sparse import lil_matrix
import matplotlib.pyplot as plt
import time
fr... | [
"urllib3.PoolManager",
"numpy.linalg.norm",
"numpy.sin",
"numpy.arange",
"scipy.optimize.least_squares",
"scipy.sparse.lil_matrix",
"numpy.cross",
"matplotlib.pyplot.plot",
"numpy.empty",
"shutil.copyfileobj",
"os.path.isfile",
"util.Section",
"numpy.cos",
"time.time",
"matplotlib.pyplot... | [((531, 581), 'os.path.join', 'os.path.join', (['self.__data_folder', 'self.__file_name'], {}), '(self.__data_folder, self.__file_name)\n', (543, 581), False, 'import os\n'), ((913, 925), 'matplotlib.pyplot.plot', 'plt.plot', (['f0'], {}), '(f0)\n', (921, 925), True, 'import matplotlib.pyplot as plt\n'), ((1056, 1067),... |
import numpy as np
import xarray as xr
def mse(
forecast_field: np.ndarray or xr.DataArray,
analysis_field: np.ndarray or xr.DataArray,
latitudes: np.ndarray or xr.DataArray
) -> np.ndarray or xr.DataArray:
"""
Mean Square Error (MSE)
Parameters
----------
forecast_field
... | [
"numpy.abs",
"numpy.sqrt",
"numpy.cos",
"numpy.power"
] | [((3630, 3650), 'numpy.sqrt', 'np.sqrt', (['(acc2 * acc3)'], {}), '(acc2 * acc3)\n', (3637, 3650), True, 'import numpy as np\n'), ((511, 544), 'numpy.cos', 'np.cos', (['(latitudes * np.pi / 180.0)'], {}), '(latitudes * np.pi / 180.0)\n', (517, 544), True, 'import numpy as np\n'), ((1150, 1183), 'numpy.cos', 'np.cos', (... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from pointnet2_lib.pointnet2.pointnet2_modules import PointnetSAModule
from lib.rpn.proposal_target_layer import ProposalTargetLayer
import pointnet2_lib.pointnet2.pytorch_utils as pt_utils
import lib.utils.loss_utils as loss_utils
from lib.config impor... | [
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.max",
"torch.from_numpy",
"lib.utils.iou3d.iou3d_utils.boxes_iou3d_gpu",
"torch.cuda.is_available",
"pointnet2_lib.pointnet2.pytorch_utils.Conv1d",
"lib.config.cfg.RCNN.SA_CONFIG.NPOINTS.__len... | [((736, 751), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (749, 751), True, 'import torch.nn as nn\n'), ((2439, 2465), 'torch.nn.Sequential', 'nn.Sequential', (['*cls_layers'], {}), '(*cls_layers)\n', (2452, 2465), True, 'import torch.nn as nn\n'), ((3935, 3961), 'torch.nn.Sequential', 'nn.Sequential', ([... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from rapyuta.inout import read_fits
from rapyuta.plots import pplot
slit = 'Ns'
## raw
name = 'raw'
ds = read_fits('3390001.1_'+slit,'3390001.1_'+slit+'_unc')
snr = np.mean(ds.data/ds.unc)
# p = pplot(ds.wave, ds.data[:,14,1], yerr=ds.unc[:,14,1],ec='r... | [
"rapyuta.inout.read_fits",
"rapyuta.plots.pplot",
"numpy.mean"
] | [((173, 233), 'rapyuta.inout.read_fits', 'read_fits', (["('3390001.1_' + slit)", "('3390001.1_' + slit + '_unc')"], {}), "('3390001.1_' + slit, '3390001.1_' + slit + '_unc')\n", (182, 233), False, 'from rapyuta.inout import read_fits\n'), ((233, 258), 'numpy.mean', 'np.mean', (['(ds.data / ds.unc)'], {}), '(ds.data / d... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as colors
from scipy.stats import binom
from scipy import linalg
from scipy.sparse.linalg import expm_multiply
from scipy.sparse import csc_matrix
from scipy.special import comb
import math
import time
def get_2sat_... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.genfromtxt",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.yticks",
"numpy.linalg.eigh",
"matplotlib.pyplot.ylim",
"numpy.eye",
"matplotlib.pyplot.savefig",
"numpy.ones",
"numpy.conj",
"numpy.kron",
"matplot... | [((354, 418), 'numpy.loadtxt', 'np.loadtxt', (["('../../instances_original/' + instance_name + '.m2s')"], {}), "('../../instances_original/' + instance_name + '.m2s')\n", (364, 418), True, 'import numpy as np\n'), ((557, 630), 'numpy.genfromtxt', 'np.genfromtxt', (['"""m2s_nqubits.csv"""'], {'delimiter': '""","""', 'sk... |
import time, random
import numpy as np
# Setting up simulation data
OBSERVATION_COUNT = 10
BUILDING_LEVELS = 11
ROOMS_PER_LEVEL = 30
WORKER_PER_ROOM = 1
TOTAL_CAPACITY = 2
ON_PAUSE = 0
"""
Elevators info:
- building level
- running or not
- current capacity
"""
X = { "1": [0, True, 0],
"2": [0, True, 0],
... | [
"numpy.random.choice",
"time.sleep",
"random.randrange"
] | [((1976, 2020), 'numpy.random.choice', 'np.random.choice', (['choices', '(1)'], {'p': '[0.34, 0.66]'}), '(choices, 1, p=[0.34, 0.66])\n', (1992, 2020), True, 'import numpy as np\n'), ((3042, 3055), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (3052, 3055), False, 'import time, random\n'), ((1361, 1405), 'numpy.r... |
from starry.compat import theano
from starry.compat import tt
import numpy as np
import starry
import matplotlib.pyplot as plt
import pytest
@pytest.fixture
def model():
class Model:
def __init__(self):
self.map = starry.Map(ydeg=1, reflected=True)
_b = tt.dvector("b")
... | [
"numpy.abs",
"numpy.allclose",
"starry.Map",
"numpy.zeros_like",
"starry.compat.tt.dvector",
"numpy.linspace",
"numpy.atleast_1d",
"numpy.gradient",
"starry.compat.tt.dscalar",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((6855, 6879), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', 'npts'], {}), '(-1, 1, npts)\n', (6866, 6879), True, 'import numpy as np\n'), ((7529, 7561), 'numpy.linspace', 'np.linspace', (['(-np.pi)', 'np.pi', 'npts'], {}), '(-np.pi, np.pi, npts)\n', (7540, 7561), True, 'import numpy as np\n'), ((8173, 8198), 'num... |
import argparse
from datetime import datetime
import logging
import random as rand
import numpy as np
import time
import environments
import experiments
from experiments import plotting
# Configure rewards per environment
ENV_SETTINGS = {
'small_lake': { 'step_prob': 0.6,
... | [
"logging.basicConfig",
"logging.getLogger",
"experiments.plotting.plot_paths",
"experiments.ExperimentDetails",
"argparse.ArgumentParser",
"experiments.value_iteration.create_dirs",
"random.seed",
"experiments.plotting.delete_output_dir",
"time.sleep",
"datetime.datetime.now",
"numpy.random.rand... | [((2744, 2851), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n", (2763, 2851), False, 'import logging\n'), ((2856, 2883), '... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License") you may not us... | [
"numpy.reshape",
"dnnc.reshape",
"dnnc.dropout",
"unittest.main",
"numpy.random.randn"
] | [((4211, 4226), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4224, 4226), False, 'import unittest\n'), ((1538, 1577), 'dnnc.dropout', 'dc.dropout', (['self.dc_float_a', 'self.ratio'], {}), '(self.dc_float_a, self.ratio)\n', (1548, 1577), True, 'import dnnc as dc\n'), ((1809, 1849), 'dnnc.dropout', 'dc.dropout',... |
import socket
import threading
import sys
import cv2
import pickle
import numpy as np
import struct
import time
import argparse
# Default camera
height = 480
width = 640
dimen = 3
class ThreadedServer(threading.Thread):
def __init__(self, host, port):
self.host = host
self.port =... | [
"struct.calcsize",
"socket.socket",
"argparse.ArgumentParser",
"cv2.imshow",
"numpy.zeros",
"struct.unpack",
"cv2.destroyAllWindows",
"pickle.loads",
"threading.Thread",
"cv2.waitKey"
] | [((2623, 2648), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2646, 2648), False, 'import argparse\n'), ((3445, 3468), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3466, 3468), False, 'import cv2\n'), ((347, 396), 'socket.socket', 'socket.socket', (['socket.AF_INET', '... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... | [
"tensorflow.keras.metrics.BinaryAccuracy",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.keras.Sequential",
"numpy.random.random",
"kerastuner.HyperParameters",
"tensorflow.keras.layers.Dense",
"kerastuner.RandomSearch"
] | [((1871, 1921), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['(data, labels)'], {}), '((data, labels))\n', (1905, 1921), True, 'import tensorflow as tf\n'), ((2199, 2217), 'tensorflow.keras.Sequential', 'keras.Sequential', ([], {}), '()\n', (2215, 2217), False, 'from tensorflow ... |
# -*- coding: utf-8 -*-
import astropy.units as u
import celerite
import lightkurve as lk
import matplotlib.pyplot as plt
import numpy as np
from astropy.units import cds
from celerite import terms
cds.enable()
class Granulation(object):
"""
Class to generate the granulation background using ... | [
"numpy.mean",
"numpy.sqrt",
"numpy.isscalar",
"matplotlib.pyplot.plot",
"celerite.GP",
"numpy.log",
"numpy.diff",
"numpy.array",
"lightkurve.LightCurve",
"astropy.units.cds.enable",
"matplotlib.pyplot.axvline",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((212, 224), 'astropy.units.cds.enable', 'cds.enable', ([], {}), '()\n', (222, 224), False, 'from astropy.units import cds\n'), ((5167, 5197), 'numpy.arange', 'np.arange', (['(0)', '(1000 * 86400)', 'dt'], {}), '(0, 1000 * 86400, dt)\n', (5176, 5197), True, 'import numpy as np\n'), ((5507, 5523), 'numpy.array', 'np.ar... |
import numpy as np
def euler2quaternion(phi1, Phi, phi2, P = 1):
# Input - Euler Angles in Radians, Permutation operator (+- 1)
# Output - Tuple containing quaternion form
SIGMA = 0.5*(phi1 + phi2)
DELTA = 0.5*(phi1 - phi2)
C = np.cos(Phi/2)
S = np.sin(Phi/2)
q0 = C*np.cos(SIGMA)
q1 = ... | [
"numpy.sqrt",
"numpy.tan",
"numpy.arccos",
"numpy.square",
"numpy.arctan2",
"numpy.cos",
"numpy.sign",
"numpy.sin",
"numpy.matrix"
] | [((249, 264), 'numpy.cos', 'np.cos', (['(Phi / 2)'], {}), '(Phi / 2)\n', (255, 264), True, 'import numpy as np\n'), ((271, 286), 'numpy.sin', 'np.sin', (['(Phi / 2)'], {}), '(Phi / 2)\n', (277, 286), True, 'import numpy as np\n'), ((749, 767), 'numpy.sqrt', 'np.sqrt', (['(q03 * q12)'], {}), '(q03 * q12)\n', (756, 767),... |
import dill
from tqdm import tqdm
from absl import flags
from absl import app
import time
import subprocess
import itertools
import glob
import numpy as np
import data
import os
from collections import defaultdict
import util
from preprocess_for_lambdamart_no_flags import get_features, get_single_sent_feat... | [
"sklearn.metrics.classification_report",
"util.print_execution_time",
"os.path.join",
"absl.app.run",
"dill.dump",
"sklearn.linear_model.LogisticRegressionCV",
"numpy.random.seed",
"util.shuffle",
"numpy.load",
"time.time"
] | [((1627, 1657), 'util.shuffle', 'util.shuffle', (['train_x', 'train_y'], {}), '(train_x, train_y)\n', (1639, 1657), False, 'import util\n'), ((1678, 1704), 'util.shuffle', 'util.shuffle', (['val_x', 'val_y'], {}), '(val_x, val_y)\n', (1690, 1704), False, 'import util\n'), ((2013, 2024), 'time.time', 'time.time', ([], {... |
'''
fuck rna
fuck deep learning
'''
# -*- coding: utf-8 -*-
import numpy as np
from keras.models import Model
from keras.layers import Input, Dropout, Embedding, LSTM
from keras.layers import Activation, dot, TimeDistributed
from keras.layers import concatenate, Dense, Bidirectional
from keras.models import model_fr... | [
"time.time",
"collections.Counter",
"keras.layers.LSTM",
"keras.layers.Input",
"numpy.zeros",
"keras.layers.concatenate",
"keras.models.Model",
"keras.layers.dot",
"keras.layers.Activation",
"numpy.array",
"keras.layers.Dense",
"keras.layers.Embedding",
"keras.layers.Dropout"
] | [((4594, 4642), 'keras.layers.Input', 'Input', ([], {'shape': '(MAX_IN_LEN,)', 'name': '"""encoder_input"""'}), "(shape=(MAX_IN_LEN,), name='encoder_input')\n", (4599, 4642), False, 'from keras.layers import Input, Dropout, Embedding, LSTM\n'), ((5349, 5378), 'keras.layers.concatenate', 'concatenate', (['[fwd_h1, bck_h... |
"""
@title vae.py
@author: <NAME>
@email: <EMAIL>
This script builds a Convolutional Variationel Autoencoder using keras framework with tensorflow backend.
"""
from keras.layers import Input, Dense, Reshape, Flatten, Lambda, Dropout
from keras.layers import BatchNormalization, MaxPooling2D
from keras.layers.advanced_... | [
"keras.backend.shape",
"keras.backend.sum",
"keras.backend.flatten",
"keras.layers.convolutional.UpSampling2D",
"keras.layers.Dense",
"keras.optimizers.Adadelta",
"numpy.arange",
"matplotlib.pyplot.imshow",
"keras.backend.square",
"numpy.max",
"matplotlib.pyplot.close",
"keras.models.Model",
... | [((1286, 1296), 'keras.optimizers.Adadelta', 'Adadelta', ([], {}), '()\n', (1294, 1296), False, 'from keras.optimizers import Adadelta\n'), ((3588, 3692), 'keras.backend.random_normal', 'K.random_normal', ([], {'shape': '(batch, dim)', 'mean': 'self.random_normal_mean', 'stddev': 'self.random_normal_stddev'}), '(shape=... |
#!/usr/bin/env python
import random
import sys
import cv2
import numpy as np
def auto_canny(image, sigma=0.33):
# compute the median of the single channel pixel intensities
v = np.median(image)
# apply automatic Canny edge detection using the computed median
lower = int(max(0, (1.0 - sigma) * v))
upper = int(m... | [
"cv2.imwrite",
"numpy.copy",
"numpy.median",
"numpy.array",
"random.random",
"cv2.Canny",
"cv2.imread"
] | [((453, 467), 'cv2.imread', 'cv2.imread', (['fn'], {}), '(fn)\n', (463, 467), False, 'import cv2\n'), ((590, 626), 'cv2.imwrite', 'cv2.imwrite', (['"""/tmp/edges.png"""', 'edges'], {}), "('/tmp/edges.png', edges)\n", (601, 626), False, 'import cv2\n'), ((3837, 3878), 'cv2.imwrite', 'cv2.imwrite', (['"""/tmp/lines.png""... |
"""Module with scared experiment for hyperparameter search."""
import os
import math
from tempfile import NamedTemporaryFile
from collections import defaultdict
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sacred import Experiment
from sacred.observers import ... | [
"numpy.mean",
"skopt.utils.use_named_args",
"os.path.join",
"sacred.Experiment",
"skopt.gp_minimize",
"math.log",
"skopt.dump",
"matplotlib.pyplot.close",
"tempfile.NamedTemporaryFile",
"numpy.isfinite",
"copy.deepcopy",
"pandas.DataFrame",
"sacred.utils.set_by_dotted_path",
"skopt.load"
] | [((529, 564), 'sacred.Experiment', 'Experiment', (['"""hyperparameter_search"""'], {}), "('hyperparameter_search')\n", (539, 564), False, 'from sacred import Experiment\n'), ((2396, 2409), 'copy.deepcopy', 'deepcopy', (['res'], {}), '(res)\n', (2404, 2409), False, 'from copy import deepcopy\n'), ((2433, 2446), 'copy.de... |
# -*- coding: utf-8 -*-
"""
Author
------
<NAME>
Email
-----
<EMAIL>
Created on
----------
- Tue Mar 8 15:26:00 2016 read_spectrum
Modifications
-------------
- Fri Jul 15 16:08:00 2016 migrate read_spectrum from lamost.py
Aims
----
- read various kinds of spectra
"""
import os
from collections import Ord... | [
"os.path.exists",
"collections.OrderedDict",
"astropy.table.Table",
"numpy.power",
"astropy.table.Column",
"astropy.io.fits.open",
"numpy.arange"
] | [((1133, 1146), 'astropy.io.fits.open', 'fits.open', (['fp'], {}), '(fp)\n', (1142, 1146), False, 'from astropy.io import fits\n'), ((1252, 1300), 'astropy.table.Table', 'Table', ([], {'data': '[wave, flux]', 'names': "['wave', 'flux']"}), "(data=[wave, flux], names=['wave', 'flux'])\n", (1257, 1300), False, 'from astr... |
"""Utilities for submitting to Argoverse tracking and forecasting competitions"""
import json
import math
import os
import shutil
import tempfile
import uuid
import zipfile
from typing import Dict, List, Optional, Tuple, Union
import h5py
import numpy as np
import quaternion
from scipy.spatial import ConvexHull
from ... | [
"quaternion.as_float_array",
"math.sqrt",
"numpy.array",
"shapely.geometry.Polygon",
"numpy.sin",
"os.path.exists",
"os.listdir",
"numpy.concatenate",
"numpy.floor",
"quaternion.from_rotation_matrix",
"uuid.uuid4",
"scipy.spatial.ConvexHull",
"tempfile.mkdtemp",
"math.atan2",
"numpy.cos"... | [((2953, 2977), 'numpy.concatenate', 'np.concatenate', (['d_all', '(0)'], {}), '(d_all, 0)\n', (2967, 2977), True, 'import numpy as np\n'), ((3641, 3659), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (3657, 3659), False, 'import tempfile\n'), ((3753, 3775), 'os.listdir', 'os.listdir', (['input_path'], {}),... |
import os
import numpy as np
import PIL.Image
import scipy.misc
import cv2
import random
import csv
import pandas as pd
import operator
from pytvision.datasets import dataProvide
from . import utility as utl
trainfile='stage1_train'
testfile='stage1_test'
testfilefinal='stage2_test_final'
class dsxbExProvide(da... | [
"os.listdir",
"os.path.join",
"numpy.loadtxt",
"csv.reader",
"os.path.expanduser"
] | [((775, 806), 'os.path.expanduser', 'os.path.expanduser', (['base_folder'], {}), '(base_folder)\n', (793, 806), False, 'import os\n'), ((1107, 1160), 'os.path.join', 'os.path.join', (['base_folder', 'sub_folder', 'folders_images'], {}), '(base_folder, sub_folder, folders_images)\n', (1119, 1160), False, 'import os\n'),... |
import random
import numpy as np
import skimage.transform
import skimage.color
import gym
import tensorflow as tf
def run_episode(env, agent, max_steps, render_every=None):
observation = env.reset()
agent.reset(observation)
reward = 0.
for step in range(max_steps):
action = agent.act(observat... | [
"tensorflow.one_hot",
"tensorflow.Graph",
"tensorflow.contrib.layers.flatten",
"tensorflow.contrib.framework.get_global_step",
"tensorflow.placeholder",
"tensorflow.contrib.layers.fully_connected",
"tensorflow.contrib.losses.mean_squared_error",
"tensorflow.multiply",
"numpy.array",
"tensorflow.ar... | [((925, 951), 'numpy.array', 'np.array', (['[0.1, 0.01, 0.5]'], {}), '([0.1, 0.01, 0.5])\n', (933, 951), True, 'import numpy as np\n'), ((969, 994), 'numpy.array', 'np.array', (['[0.4, 0.3, 0.3]'], {}), '([0.4, 0.3, 0.3])\n', (977, 994), True, 'import numpy as np\n'), ((3843, 3969), 'tensorflow.contrib.layers.convoluti... |
import numpy as np
import torch
import torch.nn.functional as F
from model import Generator, Encoder
import argparse
from tqdm import tqdm
from torch.utils import data
from dataset import get_image_dataset
import pdb
st = pdb.set_trace
if __name__ == "__main__":
torch.set_grad_enabled(False)
parser = argparse... | [
"numpy.savez",
"argparse.ArgumentParser",
"torch.load",
"tqdm.tqdm",
"torch.utils.data.SequentialSampler",
"model.Encoder",
"torch.no_grad",
"numpy.concatenate",
"torch.set_grad_enabled",
"dataset.get_image_dataset"
] | [((268, 297), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (290, 297), False, 'import torch\n'), ((312, 373), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get PCA for given ckpt"""'}), "(description='Get PCA for given ckpt')\n", (335, 373), False,... |
import numpy as np
import time
import sqlite3
import numpy as np
import io
from abc import ABC, abstractmethod
import fasttext
class EmbedingModel():
def __init__(self):
pass
@abstractmethod
def get_embeding(self, str_):
pass
class GloveEmbeding(EmbedingModel):
def __init__(self, ... | [
"sqlite3.register_converter",
"sqlite3.register_adapter",
"sqlite3.connect",
"numpy.reshape",
"io.BytesIO",
"numpy.array",
"fasttext.load_model",
"numpy.shape",
"numpy.load",
"time.time",
"numpy.save"
] | [((4421, 4432), 'time.time', 'time.time', ([], {}), '()\n', (4430, 4432), False, 'import time\n'), ((1021, 1095), 'sqlite3.connect', 'sqlite3.connect', (['"""glove.42B.300d.db"""'], {'detect_types': 'sqlite3.PARSE_DECLTYPES'}), "('glove.42B.300d.db', detect_types=sqlite3.PARSE_DECLTYPES)\n", (1036, 1095), False, 'impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'Justin'
__mtime__ = '2018-12-17'
"""
import unittest
import numpy as np
from core import Params, ImageCone, Open_Slide
from pytorch.encoder_factory import EncoderFactory
JSON_PATH = "D:/CloudSpace/WorkSpace/PatholImage/config/justin2.json"
# JSON_PATH =... | [
"numpy.random.rand",
"torch.from_numpy",
"core.Params",
"torch.randn",
"pytorch.encoder_factory.EncoderFactory",
"numpy.full",
"torchsummary.summary",
"numpy.random.randn",
"torch.zeros",
"visdom.Visdom"
] | [((520, 528), 'core.Params', 'Params', ([], {}), '()\n', (526, 528), False, 'from core import Params, ImageCone, Open_Slide\n'), ((641, 687), 'pytorch.encoder_factory.EncoderFactory', 'EncoderFactory', (['c', 'model_name', 'sample_name', '(32)'], {}), '(c, model_name, sample_name, 32)\n', (655, 687), False, 'from pytor... |
import csv
import subprocess
import re
import numpy as np
import pandas
from listener import Listener
class CheckGender(object):
def __init__(self, audio):
self.audio_name = self.transcode_2_wav(audio)
received_audio_data = self.get_audio_information(self.audio_name)
self.calculate_fowar... | [
"pandas.read_csv",
"numpy.asmatrix",
"numpy.asarray",
"numpy.exp",
"re.sub",
"csv.reader"
] | [((406, 453), 're.sub', 're.sub', (['"""(.mpeg|.mp4|.ogg)$"""', '""".wav"""', 'old_audio'], {}), "('(.mpeg|.mp4|.ogg)$', '.wav', old_audio)\n", (412, 453), False, 'import re\n'), ((3452, 3484), 'pandas.read_csv', 'pandas.read_csv', (['"""__dataset.csv"""'], {}), "('__dataset.csv')\n", (3467, 3484), False, 'import panda... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"mxnet.nd.random.uniform",
"random.choice",
"mxnet.autograd.record",
"common.with_seed",
"numpy.ones",
"mxnet.np.sum",
"mxnet.sym.Variable",
"nose.runmodule",
"mxnet.test_utils.rand_shape_nd",
"mxnet.sym.np.sum",
"numpy.random.randint",
"mxnet.nd.array"
] | [((1237, 1248), 'common.with_seed', 'with_seed', ([], {}), '()\n', (1246, 1248), False, 'from common import assertRaises, with_seed\n'), ((1742, 1766), 'random.choice', 'random.choice', (['[2, 3, 4]'], {}), '([2, 3, 4])\n', (1755, 1766), False, 'import random\n'), ((1779, 1812), 'mxnet.test_utils.rand_shape_nd', 'rand_... |
import numpy as np
from sklearn.metrics import r2_score
from metaflow_helper.models import KerasRegressor
from metaflow_helper.constants import RunMode
def test_keras_model_regressor_handler_train():
n_examples = 10
n_repeat = 10
offset = 0
X = np.repeat(np.arange(n_examples).astype(float)/n_examples,... | [
"numpy.testing.assert_allclose",
"metaflow_helper.models.KerasRegressor",
"sklearn.metrics.r2_score",
"numpy.arange"
] | [((446, 619), 'metaflow_helper.models.KerasRegressor', 'KerasRegressor', ([], {'build_model': '"""metaflow_helper.models.build_keras_regression_model"""', 'mode': 'RunMode.TRAIN', 'input_dim': '(1)', 'dense_layer_widths': '()', 'dropout_probabilities': '()'}), "(build_model=\n 'metaflow_helper.models.build_keras_reg... |
"""
Single Bubble Model: Natural seep bubble simulations
=====================================================
Use the ``TAMOC`` `single_bubble_model` to simulate the trajectory of a light
hydrocarbon bubble rising through the water column. This script demonstrates
the typical steps involved in running the single bub... | [
"tamoc.dispersed_phases.hydrate_formation_time",
"tamoc.dbm.FluidParticle",
"tamoc.ambient.Profile",
"numpy.array",
"tamoc.single_bubble_model.Model"
] | [((1045, 1082), 'tamoc.ambient.Profile', 'ambient.Profile', (['nc'], {'chem_names': '"""all"""'}), "(nc, chem_names='all')\n", (1060, 1082), False, 'from tamoc import ambient\n'), ((1185, 1216), 'tamoc.single_bubble_model.Model', 'single_bubble_model.Model', (['bm54'], {}), '(bm54)\n', (1210, 1216), False, 'from tamoc ... |
import collections.abc as container_abcs
import errno
import os
from itertools import repeat
import numpy as np
import torch
from torchvision.utils import make_grid
from torchvision.utils import save_image
def makedir_exist_ok(dirpath):
try:
os.makedirs(dirpath)
except OSError as e:
if e.errn... | [
"os.makedirs",
"torch.load",
"os.path.dirname",
"torch.save",
"numpy.load",
"numpy.save",
"itertools.repeat"
] | [((464, 485), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (479, 485), False, 'import os\n'), ((257, 277), 'os.makedirs', 'os.makedirs', (['dirpath'], {}), '(dirpath)\n', (268, 277), False, 'import os\n'), ((548, 597), 'torch.save', 'torch.save', (['input', 'path'], {'pickle_protocol': 'protocol'})... |
import numpy as np
from scipy.constants import g
from floodlight.utils.types import Numeric
from floodlight.core.xy import XY
from floodlight.core.property import PlayerProperty
from floodlight.models.base import BaseModel, requires_fit
from floodlight.models.kinematics import VelocityModel, AccelerationModel
class ... | [
"numpy.multiply",
"numpy.ones",
"numpy.power",
"floodlight.core.property.PlayerProperty",
"floodlight.models.kinematics.AccelerationModel",
"numpy.square",
"numpy.exp",
"numpy.array",
"numpy.nancumsum",
"numpy.matmul",
"numpy.piecewise",
"floodlight.models.kinematics.VelocityModel"
] | [((3328, 3382), 'numpy.array', 'np.array', (['(-107.05, 113.13, -1.13, -15.84, -1.7, 2.27)'], {}), '((-107.05, 113.13, -1.13, -15.84, -1.7, 2.27))\n', (3336, 3382), True, 'import numpy as np\n'), ((3567, 3618), 'numpy.array', 'np.array', (['[-0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4]'], {}), '([-0.3, -0.2, -0.1, 0, 0.1, ... |
import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense,Dropout
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.models import load_model
... | [
"numpy.mean",
"tensorflow.keras.models.load_model"
] | [((391, 412), 'tensorflow.keras.models.load_model', 'load_model', (['load_path'], {}), '(load_path)\n', (401, 412), False, 'from tensorflow.keras.models import load_model\n'), ((541, 554), 'numpy.mean', 'np.mean', (['pred'], {}), '(pred)\n', (548, 554), True, 'import numpy as np\n')] |
"""
Functions to perform normal, weighted and robust fitting.
"""
from __future__ import annotations
import inspect
from typing import Callable, Union, Sized, Optional
import warnings
import numpy as np
import pandas as pd
import scipy.optimize
from xdem.spatialstats import nd_binning
from geoutils.spatial_tools imp... | [
"sklearn.preprocessing.PolynomialFeatures",
"numpy.nanpercentile",
"numpy.polyfit",
"pandas.IntervalIndex",
"inspect.signature",
"numpy.isfinite",
"numpy.sin",
"numpy.divide",
"numpy.arange",
"numpy.where",
"numpy.sort",
"numpy.diff",
"numpy.empty",
"numpy.abs",
"numpy.trim_zeros",
"nu... | [((6652, 6688), 'sklearn.pipeline.make_pipeline', 'make_pipeline', (['model', 'init_estimator'], {}), '(model, init_estimator)\n', (6665, 6688), False, 'from sklearn.pipeline import make_pipeline\n'), ((9392, 9485), 'geoutils.spatial_tools.subsample_raster', 'subsample_raster', (['x'], {'subsample': 'subsample', 'retur... |
from abc import ABCMeta
import numpy as np
import torch
import torch.nn as nn
from torch.nn.modules.batchnorm import _BatchNorm
from mmcv.cnn import normal_init, constant_init
from core.gdrn_selfocc_modeling.tools.layers.layer_utils import resize
from core.gdrn_selfocc_modeling.tools.layers.conv_module import ConvModu... | [
"torch.nn.ModuleList",
"torch.nn.Sequential",
"core.gdrn_selfocc_modeling.tools.layers.conv_module.ConvModule",
"torch.nn.Dropout2d",
"core.gdrn_selfocc_modeling.tools.layers.layer_utils.resize",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.Upsample",
"mmcv.cnn.constant_init",
"numpy.log2",
"mmcv.c... | [((6161, 6176), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (6174, 6176), True, 'import torch.nn as nn\n'), ((2360, 2387), 'torch.nn.Dropout2d', 'nn.Dropout2d', (['dropout_ratio'], {}), '(dropout_ratio)\n', (2372, 2387), True, 'import torch.nn as nn\n'), ((4967, 5001), 'torch.cat', 'torch.cat', (['upsampl... |
# -*- coding: utf-8 -*-
"""A collection of filling routines."""
from __future__ import absolute_import, print_function
from typing import List, Optional, Union
import mando
import numpy as np
import pandas as pd
import typic
from mando.rst_text_formatter import RSTHelpFormatter
from .. import tsutils
try:
from... | [
"numpy.mean",
"numpy.abs",
"numpy.log10",
"numpy.array",
"numpy.std",
"pandas.DataFrame",
"pandas.concat",
"mando.command"
] | [((968, 1040), 'mando.command', 'mando.command', (['"""fill"""'], {'formatter_class': 'RSTHelpFormatter', 'doctype': '"""numpy"""'}), "('fill', formatter_class=RSTHelpFormatter, doctype='numpy')\n", (981, 1040), False, 'import mando\n'), ((9800, 9831), 'pandas.concat', 'pd.concat', (['[predf, ntsd, postf]'], {}), '([pr... |
import sys
import numpy as np
from matplotlib import pyplot as pl
def show_regression(x, y):
from scipy.stats import linregress
#pl.rc('text', usetex = True)
#pl.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
fit = linregress(np.log10(x), np.log10(y))
d = fit.slope
p = 10**fit... | [
"matplotlib.pyplot.grid",
"numpy.log10",
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"numpy.log",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.title",
"numpy.logspace",
"matp... | [((1192, 1219), 'numpy.array', 'np.array', (['xr'], {'dtype': '"""float"""'}), "(xr, dtype='float')\n", (1200, 1219), True, 'import numpy as np\n'), ((1227, 1254), 'numpy.array', 'np.array', (['yr'], {'dtype': '"""float"""'}), "(yr, dtype='float')\n", (1235, 1254), True, 'import numpy as np\n'), ((1275, 1298), 'numpy.l... |
from collections import OrderedDict
import matplotlib.pyplot as plt
import numpy as np
class Ledger():
def __init__(self, users):
super().__init__()
self.users = users
self.txs = []
def __repr__(self):
return "[{}]".format(",\n ".join([str(tx[0]) for tx in self.txs]))
def ... | [
"collections.OrderedDict",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((1456, 1469), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1467, 1469), False, 'from collections import OrderedDict\n'), ((2317, 2331), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2329, 2331), True, 'import matplotlib.pyplot as plt\n'), ((2346, 2361), 'numpy.arange', 'np.arange', ... |
#from metodos_numericos.RetroSubstituicao import RetroSubstituicao
from Utils import Utils
from numpy import zeros, diag, diagflat, dot
import numpy as np
class Jacobi():
def executar(self, M, B, chute_inicial, E, max_iteracoes):
ordem = len(M)
x = chute_inicial
xp = [0] * len(x)
pa... | [
"Utils.Utils",
"numpy.diag",
"numpy.array",
"numpy.dot",
"numpy.diagflat"
] | [((1790, 1825), 'numpy.array', 'np.array', (['chute_inicial', 'np.float64'], {}), '(chute_inicial, np.float64)\n', (1798, 1825), True, 'import numpy as np\n'), ((1839, 1874), 'numpy.array', 'np.array', (['chute_inicial', 'np.float64'], {}), '(chute_inicial, np.float64)\n', (1847, 1874), True, 'import numpy as np\n'), (... |
# Copyright 2019-2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import pickle
import random
import numpy as np
import pandas as pd
# common function to separate sr data 80% for train and 20% for test
def separate_data(request):
sr_ids = request['ids']
id_test, x_test, y_test, x_teach, y_teach = []... | [
"pandas.DataFrame",
"numpy.array",
"pickle.load",
"numpy.concatenate"
] | [((924, 941), 'numpy.array', 'np.array', (['x_teach'], {}), '(x_teach)\n', (932, 941), True, 'import numpy as np\n'), ((962, 979), 'numpy.array', 'np.array', (['y_teach'], {}), '(y_teach)\n', (970, 979), True, 'import numpy as np\n'), ((999, 1015), 'numpy.array', 'np.array', (['x_test'], {}), '(x_test)\n', (1007, 1015)... |
#!/usr/bin/env python
# encoding: utf-8
#
# bpt.py
#
# Created by <NAME> on 19 Jan 2017.
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from packaging.version import parse
import warnings
import matplotlib
import matplotlib.pyplot as plt
import numpy as ... | [
"numpy.arange",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.style.context",
"mpl_toolkits.axes_grid1.ImageGrid",
"warnings.warn",
"packaging.version.parse",
"numpy.ma.log10",
"marvin.utils.plot.bind_to_figure",
"matplotlib.pyplot.subplots_adjust"
] | [((1783, 1810), 'matplotlib.pyplot.figure', 'plt.figure', (['None', '(8.5, 10)'], {}), '(None, (8.5, 10))\n', (1793, 1810), True, 'import matplotlib.pyplot as plt\n'), ((1830, 1885), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'top': '(0.99)', 'bottom': '(0.08)', 'hspace': '(0.01)'}), '(top=0.99, ... |
import unittest
import numpy as np
import shapely.geometry as sp_geom
from hockbot.puck_dynamics import PuckDynamics, intersect_line_segment_polygon
import rospy
from geometry_msgs.msg import PointStamped
# TODO other things now
class TestPuckDynamics(unittest.TestCase):
def test_puck_intersection(self):
... | [
"numpy.array"
] | [((336, 356), 'numpy.array', 'np.array', (['[1.5, 1.0]'], {}), '([1.5, 1.0])\n', (344, 356), True, 'import numpy as np\n'), ((376, 398), 'numpy.array', 'np.array', (['[-1.0, -1.0]'], {}), '([-1.0, -1.0])\n', (384, 398), True, 'import numpy as np\n'), ((431, 476), 'numpy.array', 'np.array', (['[[0.5, 0], [0.75, 0.5], [1... |
# %% import
import glob
import os
from numpy.core.numeric import NaN
import pandas as pd
import numpy as np
# functions
def format_str(unformatted_str):
"""
Formats the trace string into a three column list, times | module | action
"""
output = []
for ind, word in enumerate(unformatted_str):
... | [
"pandas.DataFrame",
"numpy.savetxt",
"glob.glob",
"os.getcwd"
] | [((466, 477), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (475, 477), False, 'import os\n'), ((491, 513), 'glob.glob', 'glob.glob', (['import_path'], {}), '(import_path)\n', (500, 513), False, 'import glob\n'), ((4214, 4236), 'glob.glob', 'glob.glob', (['import_path'], {}), '(import_path)\n', (4223, 4236), False, 'impo... |
import cv2
import numpy as np
win_name = "scanning"
img = cv2.imread("img/paper.jpg")
rows, cols = img.shape[:2]
draw = img.copy()
pts_cnt = 0
pts = np.zeros((4,2), dtype=np.float32)
def onMouse(event, x, y, flags, param): #마우스 이벤트 콜백 함수 구현 ---①
global pts_cnt # 마우스로 찍은 좌표의 갯수 저장
if eve... | [
"cv2.setMouseCallback",
"cv2.getPerspectiveTransform",
"numpy.diff",
"numpy.argmax",
"cv2.imshow",
"numpy.zeros",
"cv2.circle",
"cv2.destroyAllWindows",
"cv2.warpPerspective",
"numpy.argmin",
"cv2.waitKey",
"numpy.float32",
"cv2.imread"
] | [((59, 86), 'cv2.imread', 'cv2.imread', (['"""img/paper.jpg"""'], {}), "('img/paper.jpg')\n", (69, 86), False, 'import cv2\n'), ((150, 184), 'numpy.zeros', 'np.zeros', (['(4, 2)'], {'dtype': 'np.float32'}), '((4, 2), dtype=np.float32)\n', (158, 184), True, 'import numpy as np\n'), ((2135, 2160), 'cv2.imshow', 'cv2.imsh... |
# -- coding utf-8 --
"""
Created on Thu Jul 25 143303 2019
@author <NAME>
"""
def interpolPlot(
df, shape_df, long, lat, pollutant, resolution=100, partitions=15, cmap="inferno"
):
import geopandas
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from geopandas import G... | [
"matplotlib.pyplot.contourf",
"polire.custom.CustomInterpolator",
"matplotlib.pyplot.Normalize",
"numpy.max",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"numpy.linspace",
"shapely.geometry.Polygon",
"geopandas.overlay",
"numpy.min",
"numpy.meshgrid",
"geopandas.GeoDataFrame",
"shap... | [((2650, 2672), 'numpy.max', 'np.max', (['trainX'], {'axis': '(0)'}), '(trainX, axis=0)\n', (2656, 2672), True, 'import numpy as np\n'), ((2692, 2714), 'numpy.min', 'np.min', (['trainX'], {'axis': '(0)'}), '(trainX, axis=0)\n', (2698, 2714), True, 'import numpy as np\n'), ((2724, 2761), 'numpy.linspace', 'np.linspace',... |
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
kb_boltzmann = 0.831446 # u * A^2 / ( ps^2 * K )
def boltzmann_distribution(trajectory):
print("\n***Velocity distribution analysis***")
velocity = np.reshape(np.linalg.norm(trajectory.get_velocity_mass_average(), axis=2), -1)
... | [
"numpy.average",
"matplotlib.pyplot.xlabel",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.std",
"matplotlib.pyplot.show"
] | [((335, 355), 'numpy.average', 'np.average', (['velocity'], {}), '(velocity)\n', (345, 355), True, 'import numpy as np\n'), ((372, 388), 'numpy.std', 'np.std', (['velocity'], {}), '(velocity)\n', (378, 388), True, 'import numpy as np\n'), ((778, 822), 'numpy.linspace', 'np.linspace', (['(0)', '(average + 3 * deviation)... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | [
"traceback.format_exc",
"paddle.fluid.layers.read_file",
"os.listdir",
"collections.namedtuple",
"logging.debug",
"logging.warn",
"os.path.join",
"paddle.fluid.layers.py_reader",
"os.path.isdir",
"os.path.basename",
"csv.reader",
"logging.error",
"numpy.random.shuffle"
] | [((1734, 1862), 'paddle.fluid.layers.py_reader', 'fluid.layers.py_reader', ([], {'capacity': '(50)', 'shapes': 'shapes', 'name': 'self.name', 'dtypes': 'types', 'lod_levels': 'levels', 'use_double_buffer': '(True)'}), '(capacity=50, shapes=shapes, name=self.name, dtypes=\n types, lod_levels=levels, use_double_buffer... |
from pathlib import Path
from typing import Sequence, Tuple
import numpy as np
import pandas as pd
def load_case_data(path: Path) -> pd.DataFrame:
df = pd.read_csv(path, usecols = ["date", "cases", "ward"])
df["date"] = pd.to_datetime(df["date"], format="%b-%d") + pd.offsets.DateOffset(year=2020)
df.ward... | [
"pandas.read_csv",
"numpy.log",
"numpy.isnan",
"numpy.matrix",
"pandas.offsets.DateOffset",
"pandas.to_datetime"
] | [((159, 211), 'pandas.read_csv', 'pd.read_csv', (['path'], {'usecols': "['date', 'cases', 'ward']"}), "(path, usecols=['date', 'cases', 'ward'])\n", (170, 211), True, 'import pandas as pd\n'), ((775, 787), 'numpy.matrix', 'np.matrix', (['M'], {}), '(M)\n', (784, 787), True, 'import numpy as np\n'), ((231, 273), 'pandas... |
import warnings
warnings.filterwarnings('ignore', category=UserWarning)
from numpy.testing import assert_equal, assert_almost_equal
import os
import sys
import numpy as np
import skvideo.io
import skvideo.datasets
import skvideo.measure
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import u... | [
"numpy.abs",
"warnings.filterwarnings"
] | [((16, 71), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (39, 71), False, 'import warnings\n'), ((787, 826), 'numpy.abs', 'np.abs', (['(correct_boundaries - boundaries)'], {}), '(correct_boundaries - boundaries)\n', (793, 82... |
import os
import numpy as np
import scipy.special
import scipy.interpolate
from bilby.core.prior import Interped
def EOSConstraintsLoglikelihood(eos_path, Neos, Constraint):
parameters = {}
logLs = []
for eos in range(1, Neos + 1):
radius, mass, Lambda = np.loadtxt('{0}/{1}.dat'.format(eos_path,... | [
"numpy.sort",
"numpy.exp",
"numpy.array",
"numpy.concatenate",
"bilby.core.prior.Interped",
"numpy.arange"
] | [((828, 843), 'numpy.array', 'np.array', (['logLs'], {}), '(logLs)\n', (836, 843), True, 'import numpy as np\n'), ((1867, 1890), 'numpy.exp', 'np.exp', (['(logLs - logNorm)'], {}), '(logLs - logNorm)\n', (1873, 1890), True, 'import numpy as np\n'), ((1912, 1928), 'numpy.sort', 'np.sort', (['weights'], {}), '(weights)\n... |
import interp_to_P
import matplotlib
import sys
import numpy as np
from metpy.units import units
#varlist = list(['QCLOUD','QRAIN','QSNOW','QGRAUP'])
#varlist = list(['TEMPERATURE','QVAPOR','QICE','QSNOW','QGRAUP','QCLOUD','QRAIN'])
varlist = list(['W','TEMPERATURE','QVAPOR','QNICE','QICE','QSNOW','QGRAUP','QCLOUD','Q... | [
"interp_to_P.interp_p_varlist",
"numpy.arange"
] | [((715, 784), 'interp_to_P.interp_p_varlist', 'interp_to_P.interp_p_varlist', (['plevs', '(2015)', '"""02"""', 'period', 'varlist', 'fix'], {}), "(plevs, 2015, '02', period, varlist, fix)\n", (743, 784), False, 'import interp_to_P\n'), ((456, 487), 'numpy.arange', 'np.arange', (['(100000)', '(10000)', '(-3000)'], {}), ... |
import os
from time import time
from datetime import timedelta
import numpy as np
# from torch.utils.tensorboard import SummaryWriter
from logx import EpochLogger,setup_logger_kwargs
class Trainer:
def __init__(self, env, env_test, algo, device, log_dir,logger, action_repeat=1,
num_steps=10**6, e... | [
"numpy.mean",
"os.path.exists",
"numpy.median",
"os.makedirs",
"os.path.join",
"numpy.max",
"numpy.min",
"time.time"
] | [((694, 726), 'os.path.join', 'os.path.join', (['log_dir', '"""summary"""'], {}), "(log_dir, 'summary')\n", (706, 726), False, 'import os\n'), ((841, 871), 'os.path.join', 'os.path.join', (['log_dir', '"""model"""'], {}), "(log_dir, 'model')\n", (853, 871), False, 'import os\n'), ((1271, 1277), 'time.time', 'time', ([]... |
import numbers
import numpy as np
import tensorflow as tf
# from tensorflow.python.eager import context
from tensorflow.python.framework import ops, tensor_shape, tensor_util
from tensorflow.python.ops import array_ops, random_ops, math_ops
# from tensorflow/pyton/ops/nn_ops/dropout
def unscaled_dropout(x, keep_prob,... | [
"tensorflow.expand_dims",
"numpy.prod",
"tensorflow.python.framework.tensor_shape.scalar",
"tensorflow.python.ops.random_ops.random_uniform",
"tensorflow.python.ops.math_ops.floor",
"tensorflow.nn.moments",
"tensorflow.python.ops.array_ops.shape",
"tensorflow.sqrt",
"tensorflow.nn.dropout",
"tenso... | [((6365, 6400), 'tensorflow.nn.dropout', 'tf.nn.dropout', (['x', '(1 - knockout_prob)'], {}), '(x, 1 - knockout_prob)\n', (6378, 6400), True, 'import tensorflow as tf\n'), ((1767, 1812), 'tensorflow.python.framework.ops.name_scope', 'ops.name_scope', (['name', '"""unscaled_dropout"""', '[x]'], {}), "(name, 'unscaled_dr... |
import cv2 as cv
import numpy as np
# 载入手写数字图片
img = cv.imread('handwriting.jpg', 0)
# 将图像二值化
_, thresh = cv.threshold(img, 0, 255, cv.THRESH_BINARY_INV + cv.THRESH_OTSU)
contours, hierarchy = cv.findContours(thresh, 3, 2)
# 创建出两幅彩色图用于绘制
img_color1 = cv.cvtColor(img, cv.COLOR_GRAY2BGR)
img_color2 = np.copy(img_color1... | [
"cv2.rectangle",
"numpy.hstack",
"cv2.imshow",
"cv2.ellipse",
"cv2.destroyAllWindows",
"cv2.fitEllipse",
"cv2.threshold",
"cv2.arcLength",
"cv2.contourArea",
"cv2.minAreaRect",
"cv2.waitKey",
"cv2.drawContours",
"cv2.boxPoints",
"cv2.minEnclosingCircle",
"cv2.circle",
"cv2.cvtColor",
... | [((54, 85), 'cv2.imread', 'cv.imread', (['"""handwriting.jpg"""', '(0)'], {}), "('handwriting.jpg', 0)\n", (63, 85), True, 'import cv2 as cv\n'), ((107, 171), 'cv2.threshold', 'cv.threshold', (['img', '(0)', '(255)', '(cv.THRESH_BINARY_INV + cv.THRESH_OTSU)'], {}), '(img, 0, 255, cv.THRESH_BINARY_INV + cv.THRESH_OTSU)\... |
import pathlib
import numpy as np
import pytest
from caput import mpiutil, pipeline
from draco.core import containers, io
# Run these tests under MPI
pytestmark = pytest.mark.mpi
@pytest.fixture
def mpi_tmp_path(tmp_path_factory):
dirname = None
if mpiutil.rank0:
dirname = str(tmp_path_factory.mkte... | [
"caput.mpiutil.split_local",
"pathlib.Path",
"caput.mpiutil.bcast",
"numpy.linspace",
"draco.core.io.LoadBasicCont",
"pytest.raises",
"numpy.arange"
] | [((345, 375), 'caput.mpiutil.bcast', 'mpiutil.bcast', (['dirname'], {'root': '(0)'}), '(dirname, root=0)\n', (358, 375), False, 'from caput import mpiutil, pipeline\n'), ((388, 409), 'pathlib.Path', 'pathlib.Path', (['dirname'], {}), '(dirname)\n', (400, 409), False, 'import pathlib\n'), ((1199, 1217), 'draco.core.io.L... |
#
# Copyright IBM Corporation 2022
#
# 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 wri... | [
"logging.getLogger",
"argparse.ArgumentParser",
"pandas.read_csv",
"os.path.join",
"re.match",
"doframework.core.gp.gp_model",
"json.load",
"numpy.array",
"yaml.safe_load",
"datetime.datetime.now",
"doframework.core.inputs.setup_logger",
"getpass.getuser",
"numpy.pad",
"json.dump"
] | [((7515, 7540), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7538, 7540), False, 'import argparse\n'), ((8164, 8181), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (8179, 8181), False, 'import getpass\n'), ((8342, 8383), 'os.path.join', 'os.path.join', (['data_root', '"""logs"""', ... |
#! /usr/bin/env python3
import os
import sys
import numpy as np
from multiprocessing import Pool
from datetime import datetime
import arrow
data_dir = 'raw_data/'
out_dir = 'clean_data/'
out_dir = os.path.dirname(out_dir) + '/'
if out_dir:
os.makedirs(out_dir, exist_ok=True)
def decode_to_bool(bytes_to_decode):
... | [
"numpy.mean",
"os.listdir",
"os.makedirs",
"os.path.dirname",
"numpy.split",
"numpy.ndarray",
"multiprocessing.Pool",
"numpy.timedelta64",
"numpy.loadtxt",
"numpy.arange"
] | [((3145, 3152), 'multiprocessing.Pool', 'Pool', (['(4)'], {}), '(4)\n', (3149, 3152), False, 'from multiprocessing import Pool\n'), ((199, 223), 'os.path.dirname', 'os.path.dirname', (['out_dir'], {}), '(out_dir)\n', (214, 223), False, 'import os\n'), ((246, 281), 'os.makedirs', 'os.makedirs', (['out_dir'], {'exist_ok'... |
import numpy as np
from ISR.utils.image_processing import (
process_array,
process_output,
split_image_into_overlapping_patches,
stich_together,
)
class ImageModel:
"""ISR models parent class.
Contains functions that are common across the super-scaling models.
"""
... | [
"ISR.utils.image_processing.process_output",
"ISR.utils.image_processing.split_image_into_overlapping_patches",
"numpy.multiply",
"ISR.utils.image_processing.stich_together",
"numpy.append",
"ISR.utils.image_processing.process_array"
] | [((2318, 2340), 'ISR.utils.image_processing.process_output', 'process_output', (['sr_img'], {}), '(sr_img)\n', (2332, 2340), False, 'from ISR.utils.image_processing import process_array, process_output, split_image_into_overlapping_patches, stich_together\n'), ((1172, 1218), 'ISR.utils.image_processing.process_array', ... |
# -*- coding: utf-8 -*-
'''CNN network for captcha recognition of generated captcha images.
References:
- [Multi-digit Number Recognition from Street View Imagery using
Deep Convolutional Neural Networks]()
'''
import os
# os.environ["CUDA_VISIBLE_DEVICES"]="-1"
import re
import datetime
import numpy as np
... | [
"tensorflow.python.keras.optimizers.SGD",
"numpy.array",
"tensorflow.python.keras.layers.Input",
"os.path.exists",
"tensorflow.python.keras.models.Model",
"tensorflow.python.keras.layers.MaxPooling2D",
"tensorflow.python.keras.layers.add",
"tensorflow.python.keras.layers.Conv2D",
"numpy.ones",
"py... | [((1113, 1136), 'numpy.array', 'np.array', (['img', 'np.uint8'], {}), '(img, np.uint8)\n', (1121, 1136), True, 'import numpy as np\n'), ((1500, 1520), 'numpy.random.shuffle', 'np.random.shuffle', (['a'], {}), '(a)\n', (1517, 1520), True, 'import numpy as np\n'), ((6619, 6640), 'numpy.argmax', 'np.argmax', (['out[-1]', ... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
from configs._base_.models.retinanet_r50_fpn import *
from configs._base_.datasets.dota_detection import *
from configs._base_.schedules.schedule_1x import *
from alpharotate.utils.pretrain_zoo import PretrainM... | [
"numpy.array",
"alpharotate.utils.pretrain_zoo.PretrainModelZoo"
] | [((867, 885), 'alpharotate.utils.pretrain_zoo.PretrainModelZoo', 'PretrainModelZoo', ([], {}), '()\n', (883, 885), False, 'from alpharotate.utils.pretrain_zoo import PretrainModelZoo\n'), ((467, 498), 'numpy.array', 'np.array', (['DECAY_EPOCH', 'np.int32'], {}), '(DECAY_EPOCH, np.int32)\n', (475, 498), True, 'import nu... |
#############################################################################
#
# Author: <NAME>, <NAME>
#
# Copyright: <NAME> TSRI 2000
#
#############################################################################
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/autodpfCommands.py,v 1.100.2.5 2016/02/23... | [
"tkinter.IntVar",
"os.path.exists",
"mglutil.gui.InputForm.Tk.gui.InputFormDescr",
"_py2k_string.rfind",
"Pmv.guiTools.MoleculeChooser",
"_py2k_string.split",
"ViewerFramework.VFCommand.CommandGUI",
"MolKit.Read",
"os.path.splitext",
"Pmv.mvCommand.MVCommand.__init__",
"os.path.split",
"MolKit... | [((10261, 10273), 'ViewerFramework.VFCommand.CommandGUI', 'CommandGUI', ([], {}), '()\n', (10271, 10273), False, 'from ViewerFramework.VFCommand import CommandGUI\n'), ((11864, 11876), 'ViewerFramework.VFCommand.CommandGUI', 'CommandGUI', ([], {}), '()\n', (11874, 11876), False, 'from ViewerFramework.VFCommand import C... |
"""Defines the BertGFPBrightness landscape."""
import os
import numpy as np
import requests
import tape
import torch
import design_bench
import flexs
import flexs.utils.sequence_utils as s_utils
def print_mem():
t = torch.cuda.get_device_properties(0).total_memory
r = torch.cuda.memory_reserved(0)
a = to... | [
"torch.cuda.memory_allocated",
"design_bench.make",
"torch.cuda.memory_reserved",
"numpy.array",
"pdb.set_trace",
"numpy.concatenate",
"torch.cuda.get_device_properties"
] | [((280, 309), 'torch.cuda.memory_reserved', 'torch.cuda.memory_reserved', (['(0)'], {}), '(0)\n', (306, 309), False, 'import torch\n'), ((318, 348), 'torch.cuda.memory_allocated', 'torch.cuda.memory_allocated', (['(0)'], {}), '(0)\n', (345, 348), False, 'import torch\n'), ((223, 258), 'torch.cuda.get_device_properties'... |
from numpy.lib.function_base import corrcoef
from statsmodels.tsa.stattools import grangercausalitytests as gct
from minepy import MINE
from scipy.stats import pearsonr
import numpy as np
class CausalTree():
def __init__(self,
num_features,
name_features,
corr_th... | [
"numpy.abs",
"numpy.where",
"seaborn.heatmap",
"minepy.MINE",
"numpy.sum",
"numpy.zeros",
"statsmodels.tsa.stattools.grangercausalitytests",
"scipy.stats.pearsonr",
"numpy.full",
"numpy.arange"
] | [((1314, 1362), 'numpy.zeros', 'np.zeros', (['(self.num_features, self.num_features)'], {}), '((self.num_features, self.num_features))\n', (1322, 1362), True, 'import numpy as np\n'), ((1881, 1934), 'seaborn.heatmap', 'sns.heatmap', (['corrcoef_matrix'], {'square': '(True)', 'annot': '(True)'}), '(corrcoef_matrix, squa... |
'''
MIT License
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.show",
"tensorflow.image.resize",
"tensorflow.io.read_file",
"tensorflow.keras.applications.resnet.preprocess_input",
"numpy.zeros",
"matplotlib.pyplot.figure",
"tensorflow.math.reduce_std",
"tensorflow.clip_by_value",
"ten... | [((1451, 1472), 'tensorflow.io.read_file', 'tf.io.read_file', (['path'], {}), '(path)\n', (1466, 1472), True, 'import tensorflow as tf\n'), ((1485, 1528), 'tensorflow.image.decode_jpeg', 'tf.image.decode_jpeg', (['image_raw'], {'channels': '(3)'}), '(image_raw, channels=3)\n', (1505, 1528), True, 'import tensorflow as ... |
import torch
import numpy as np
device = "cuda" if torch.cuda.is_available() else "cpu"
print(device)
arr = np.array([1, 2, 3])
my_tensor = torch.tensor(arr)
print(my_tensor)
arr[0] = 11
print(arr)
print(my_tensor.tolist())
print(my_tensor.numpy())
print("---------")
print(my_tensor)
print(my_tensor.dtype)
print(my_t... | [
"torch.any",
"torch.all",
"torch.rand",
"torch.logspace",
"torch.max",
"torch.clamp",
"numpy.array",
"torch.tensor",
"torch.cuda.is_available",
"torch.cat",
"torch.linspace",
"torch.empty",
"torch.randn",
"torch.arange",
"torch.argmax"
] | [((110, 129), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (118, 129), True, 'import numpy as np\n'), ((142, 159), 'torch.tensor', 'torch.tensor', (['arr'], {}), '(arr)\n', (154, 159), False, 'import torch\n'), ((393, 432), 'torch.empty', 'torch.empty', ([], {'size': '(3, 3)', 'device': 'device'}), ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.