code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import options
import twoDtest
import numpy as np
opt = options.test_options()
opt.istest = 0
#First use the validation set to pick best model
text_file = open(opt.dataset + "_progress.txt", "w")
auc1 = []
auc2=[]
auc3=[]
auc4=[]
ran = range(0,400,10)
for i in ran:
opt.epochs = i
roc_auc = twoDtest.main(opt)
... | [
"options.test_options",
"numpy.array",
"twoDtest.main"
] | [((57, 79), 'options.test_options', 'options.test_options', ([], {}), '()\n', (77, 79), False, 'import options\n'), ((301, 319), 'twoDtest.main', 'twoDtest.main', (['opt'], {}), '(opt)\n', (314, 319), False, 'import twoDtest\n'), ((633, 647), 'numpy.array', 'np.array', (['auc1'], {}), '(auc1)\n', (641, 647), True, 'imp... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import torch
from torch import nn
import numpy as np
from .line_ocr_engine import BaseEngineLineOCR
# scores_probs should be N,C,T, blank is last class
def greedy_decode_ctc(scores_probs, chars):
best = torch.argmax(scores_probs, 1) + 1
mask = bes... | [
"torch.argmax",
"torch.no_grad",
"torch.load",
"torch.nn.Conv1d",
"torchvision.models.vgg16",
"torch.nn.LSTM",
"torch.mean",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.nn.BatchNorm2d",
"torch.max",
"torch.cuda.is_available",
"torch.nn.functional.max_pool1d",
"torch.nn.MaxPool2d",
... | [((2478, 2500), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (2491, 2500), False, 'from torch import nn\n'), ((3247, 3269), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (3260, 3269), False, 'from torch import nn\n'), ((272, 301), 'torch.argmax', 'torch.argmax', ... |
# ===== [IMPORT: Importing standard libraries] =====
import os.path
import pafy
import shutil
import json
import random
import datetime
# ===== [IMPORT: Importing external libraries] =====
from cv2 import cv2
import tensorflow as tf
import numpy as np
import pandas as pd
import moviepy.editor
#_______________________... | [
"numpy.argmax",
"cv2.cv2.rectangle",
"cv2.cv2.cvtColor",
"cv2.cv2.CascadeClassifier",
"cv2.cv2.destroyAllWindows",
"cv2.cv2.putText",
"random.randint",
"pafy.new",
"cv2.cv2.VideoWriter",
"cv2.cv2.resize",
"datetime.timedelta",
"datetime.datetime.now",
"json.dump",
"tensorflow.keras.models.... | [((6445, 6468), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (6466, 6468), False, 'import datetime\n'), ((7965, 7998), 'cv2.cv2.VideoCapture', 'cv2.VideoCapture', (['video_file_path'], {}), '(video_file_path)\n', (7981, 7998), False, 'from cv2 import cv2\n'), ((8089, 8122), 'random.randint', 'ran... |
import argparse
import torch
import os
import platform
import sys
import math
import cv2
import numpy as np
from api.setup import SingleImageAlphaPose, get_args
from detector.apis import get_detector
from tqdm import tqdm
def key_sort(element):
return int(element.split('.')[0])
def evaluate(image_files_path, output... | [
"tqdm.tqdm",
"os.makedirs",
"os.path.basename",
"cv2.cvtColor",
"api.setup.SingleImageAlphaPose",
"os.path.exists",
"numpy.zeros",
"api.setup.get_args",
"cv2.imread",
"numpy.array",
"os.path.join",
"os.listdir"
] | [((475, 485), 'api.setup.get_args', 'get_args', ([], {}), '()\n', (483, 485), False, 'from api.setup import SingleImageAlphaPose, get_args\n'), ((494, 525), 'api.setup.SingleImageAlphaPose', 'SingleImageAlphaPose', (['args', 'cfg'], {}), '(args, cfg)\n', (514, 525), False, 'from api.setup import SingleImageAlphaPose, g... |
import numpy as np
from numpy.linalg import inv
#random y of type int32
y= np.random.randint(1,5,(20,1), dtype ='int32')
#print(y)
x = np.random.normal(0,1.0 , (20,20)) #we can change values mean,std deviation
#print(x)
xinv = inv(x)
xtrans = x.transpose()
#print(xtrans)
#print(xinv)
a=np.matmul(xtrans,x)
b=np.mat... | [
"numpy.matmul",
"numpy.random.randint",
"numpy.linalg.inv",
"numpy.random.normal"
] | [((76, 123), 'numpy.random.randint', 'np.random.randint', (['(1)', '(5)', '(20, 1)'], {'dtype': '"""int32"""'}), "(1, 5, (20, 1), dtype='int32')\n", (93, 123), True, 'import numpy as np\n'), ((137, 171), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1.0)', '(20, 20)'], {}), '(0, 1.0, (20, 20))\n', (153, 171), T... |
import gw_stripping
import math
import fire
import sys
import numpy as np
import pandas
def er(msg):
raise Exception(f"Fatal error:{msg}")
def write_res(res, out):
df = pandas.DataFrame(data=res)
s = df.to_csv(header=None, index=False)
out.write(s)
def run(m1, m2, r1, a0, eta, rel, max_time):
... | [
"pandas.DataFrame",
"numpy.full",
"gw_stripping.roche",
"fire.Fire",
"math.sqrt",
"numpy.empty",
"numpy.linspace",
"gw_stripping.mass_to_radius",
"gw_stripping.radius_to_mass"
] | [((180, 206), 'pandas.DataFrame', 'pandas.DataFrame', ([], {'data': 'res'}), '(data=res)\n', (196, 206), False, 'import pandas\n'), ((528, 556), 'math.sqrt', 'math.sqrt', (['(2 * a0 / (x1 * M))'], {}), '(2 * a0 / (x1 * M))\n', (537, 556), False, 'import math\n'), ((909, 942), 'gw_stripping.roche', 'gw_stripping.roche',... |
#%%
import pandas as pd
import numpy as np
from datetime import datetime
import os
import pickle
import matplotlib.pyplot as plt
import copy
exec(open('../../env_vars.py').read())
dir_data = os.environ['dir_data']
dir_picklejar = os.environ['dir_picklejar']
dir_code_methods = os.environ['dir_code_methods']
#%%
######... | [
"pandas.DataFrame",
"copy.deepcopy",
"pickle.dump",
"os.path.realpath",
"pickle.load",
"numpy.where",
"numpy.array",
"pandas.isna",
"pandas.concat"
] | [((649, 668), 'pickle.load', 'pickle.load', (['infile'], {}), '(infile)\n', (660, 668), False, 'import pickle\n'), ((817, 836), 'pickle.load', 'pickle.load', (['infile'], {}), '(infile)\n', (828, 836), False, 'import pickle\n'), ((4501, 4524), 'copy.deepcopy', 'copy.deepcopy', (['all_dict'], {}), '(all_dict)\n', (4514,... |
import cv2
import numpy as np
from .TFLiteFaceDetection import UltraLightFaceDetecion
from .TFLiteFaceAlignment import DenseFaceReconstruction, DepthFacialLandmarks
from .CtypesMeshRender import TrianglesMeshRender
def rotationMatrixToEulerAngles(R):
'''
Ref: https://stackoverflow.com/a/15029416
'''
... | [
"numpy.arctan2",
"cv2.polylines",
"numpy.degrees",
"numpy.max",
"numpy.mean",
"numpy.array",
"numpy.take",
"numpy.min",
"numpy.round",
"numpy.sqrt"
] | [((325, 361), 'numpy.sqrt', 'np.sqrt', (['(R[0, 0] ** 2 + R[1, 0] ** 2)'], {}), '(R[0, 0] ** 2 + R[1, 0] ** 2)\n', (332, 361), True, 'import numpy as np\n'), ((615, 636), 'numpy.degrees', 'np.degrees', (['[x, y, z]'], {}), '([x, y, z])\n', (625, 636), True, 'import numpy as np\n'), ((685, 695), 'numpy.sqrt', 'np.sqrt',... |
import numpy as np
from word2vec_np.utils.activations import sigmoid
def cost_ns(U):
# Get the the batch size.
m = U.shape[0]
# The first column of U corresponds to true labels, the rest are for negative samples
cost = np.sum(-np.log(sigmoid(U[:, 0])) - np.sum(np.log(sigmoid(-U[:, 1:])), axis=... | [
"numpy.multiply",
"numpy.exp",
"word2vec_np.utils.activations.sigmoid"
] | [((491, 509), 'numpy.multiply', 'np.multiply', (['YT', 'U'], {}), '(YT, U)\n', (502, 509), True, 'import numpy as np\n'), ((260, 276), 'word2vec_np.utils.activations.sigmoid', 'sigmoid', (['U[:, 0]'], {}), '(U[:, 0])\n', (267, 276), False, 'from word2vec_np.utils.activations import sigmoid\n'), ((294, 312), 'word2vec_n... |
# Author: <NAME>
# Email: <EMAIL>
"""A script to train a deepSpeech model on LibriSpeech data using multiple GPUs
with synchronous updates (data parallel training).
References:
1. Hannun, Awni, et al. "Deep speech: Scaling up end-to-end
speech recognition." arXiv preprint arXiv:1412.5567 (2014).
2. Amodei, Dario, et ... | [
"tensorflow.gfile.Exists",
"argparse.ArgumentParser",
"deepSpeech.loss",
"tensorflow.trainable_variables",
"tensorflow.get_collection",
"tensorflow.constant_initializer",
"tensorflow.get_variable_scope",
"numpy.isnan",
"tensorflow.ConfigProto",
"tensorflow.sparse_split",
"tensorflow.summary.merg... | [((1384, 1409), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1407, 1409), False, 'import argparse\n'), ((5997, 6040), 'deepSpeech.inference', 'deepSpeech.inference', (['feats', 'seq_lens', 'ARGS'], {}), '(feats, seq_lens, ARGS)\n', (6017, 6040), False, 'import deepSpeech\n'), ((6205, 6243), ... |
import os
import sys
import numpy as np
from binder import GroupByLength
from normalize import RecordNormalizedData, Normalize
from verify import VerifyMatching
from utils import ArrayToString, IntArrayToString, ReverseComplement, LeastGreatestMultiple, ReadMatrixFromFile
from plot import PlotSettings, Plot
fro... | [
"numpy.zeros_like",
"numpy.abs",
"numpy.sum",
"verify.VerifyMatching",
"os.path.basename",
"plot.PlotSettings",
"startup.CheckDependencies",
"startup.DisplayLogoLicense",
"normalize.RecordNormalizedData",
"binder.GroupByLength",
"numpy.nonzero",
"plot.Plot",
"normalize.Normalize",
"utils.R... | [((3066, 3088), 'numpy.zeros_like', 'np.zeros_like', (['forward'], {}), '(forward)\n', (3079, 3088), True, 'import numpy as np\n'), ((3114, 3136), 'numpy.zeros_like', 'np.zeros_like', (['reverse'], {}), '(reverse)\n', (3127, 3136), True, 'import numpy as np\n'), ((3756, 3799), 'utils.ReadMatrixFromFile', 'ReadMatrixFro... |
# ===============================================================================
# Copyright 2013 <NAME>
#
# 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/... | [
"os.mkdir",
"traitsui.api.ButtonEditor",
"traits.api.Str",
"traits.api.Range",
"os.path.join",
"pychron.core.stats.peak_detection.calculate_peak_center",
"traitsui.api.EnumEditor",
"numpy.savetxt",
"struct.pack",
"pychron.core.stats.peak_detection.find_peaks",
"threading.Thread",
"csv.writer",... | [((1956, 1967), 'traits.api.Str', 'Str', (['"""Ar40"""'], {}), "('Ar40')\n", (1959, 1967), False, 'from traits.api import HasTraits, Float, Int, List, Str, Any, Event, Property, on_trait_change, Range\n'), ((2092, 2100), 'traits.api.Float', 'Float', (['(4)'], {}), '(4)\n', (2097, 2100), False, 'from traits.api import H... |
import numpy as np
from scipy import linalg
from pressio4py import logger
from pressio4py import rom as rom
from pressio4py import solvers as solvers
np.set_printoptions(linewidth=140)
#----------------------------
class MyMasker:
def __init__(self, indices):
self.rows_ = indices
self.sampleMeshSize_ = le... | [
"pressio4py.logger.initialize",
"pressio4py.rom.galerkin.masked.ProblemDiscreteTimeTwoStates",
"numpy.set_printoptions",
"pressio4py.solvers.createNewtonRaphson",
"pressio4py.rom.galerkin.ArbitraryProjector",
"numpy.allclose",
"numpy.zeros",
"numpy.ones",
"pressio4py.logger.setVerbosity",
"pressio... | [((153, 187), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(140)'}), '(linewidth=140)\n', (172, 187), True, 'import numpy as np\n'), ((2410, 2458), 'pressio4py.logger.initialize', 'logger.initialize', (['logger.logto.terminal', '"""null"""'], {}), "(logger.logto.terminal, 'null')\n", (2427, 2458... |
import time
import os
import sys
import numpy as np
import xarray as xr
from glob import glob
from functools import partial
from multiprocessing import Pool, cpu_count
def ncks_subset(i, fl, gridtype, wait=True):
from time import sleep
from subprocess import call
from psutil import virtual_memory
... | [
"functools.partial",
"psutil.virtual_memory",
"os.remove",
"os.path.getsize",
"xarray.open_dataset",
"time.sleep",
"numpy.argsort",
"subprocess.call",
"glob.glob",
"multiprocessing.cpu_count"
] | [((1424, 1445), 'glob.glob', 'glob', (["(model_dir + '*')"], {}), "(model_dir + '*')\n", (1428, 1445), False, 'from glob import glob\n'), ((1469, 1488), 'numpy.argsort', 'np.argsort', (['dirlist'], {}), '(dirlist)\n', (1479, 1488), True, 'import numpy as np\n'), ((1772, 1832), 'functools.partial', 'partial', (['ncks_su... |
#!/usr/bin/env python
"""
Module test_miri_filters - unit tests for the MiriFilter classes.
:History:
11 Jul 2014: Created to replace the test_filters.py module, which was
based on the old Filters class.
21 Jul 2014: Detector names changed to MIRIMAGE, MIRIFUSHORT and MIRIFULONG.
08 Sep 2015: Made compa... | [
"unittest.main",
"os.remove",
"warnings.simplefilter",
"miri.datamodels.miri_filters.MiriQuantumEfficiency",
"miri.datamodels.miri_filters.MiriBandPassFilter",
"numpy.allclose",
"miri.datamodels.miri_filters.MiriFilter",
"os.path.isfile",
"warnings.catch_warnings",
"numpy.linspace",
"warnings.wa... | [((12507, 12522), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12520, 12522), False, 'import unittest\n'), ((1746, 1832), 'miri.datamodels.miri_filters.MiriFilter', 'MiriFilter', ([], {'filter_table': 'self.transmissions', 'filter_name': '"""N/A"""', 'filter_type': '"""N/A"""'}), "(filter_table=self.transmissio... |
import pyrealsense2 as rs
import numpy as np
import cv2
import os
def image_file_counter(path):
files = 0
for _, _, filenames in os.walk(path):
files += len(filenames)
return files + 1
def spatial_filtering(depth_frame, magnitude=2, alpha=0.5, delta=20, holes_fill=0):
spatial = rs.spatial_fi... | [
"os.makedirs",
"pyrealsense2.pipeline",
"cv2.waitKey",
"pyrealsense2.spatial_filter",
"os.walk",
"os.path.exists",
"pyrealsense2.align",
"pyrealsense2.colorizer",
"pyrealsense2.config",
"numpy.hstack",
"numpy.rot90",
"pyrealsense2.hole_filling_filter",
"cv2.imshow",
"os.path.join",
"cv2.... | [((139, 152), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (146, 152), False, 'import os\n'), ((307, 326), 'pyrealsense2.spatial_filter', 'rs.spatial_filter', ([], {}), '()\n', (324, 326), True, 'import pyrealsense2 as rs\n'), ((690, 714), 'pyrealsense2.hole_filling_filter', 'rs.hole_filling_filter', ([], {}), '()... |
#!/usr/bin/env python
"""Executable for generating depth images from a stereo pair."""
import argparse
import cv2
import logging as log
import numpy as np
from scipy import signal
from tqdm import tqdm
from clubs_dataset_tools.stereo_matching import (rectify_images, stereo_match,
... | [
"argparse.ArgumentParser",
"clubs_dataset_tools.common.CalibrationParams",
"clubs_dataset_tools.filesystem_tools.create_stereo_depth_folder",
"clubs_dataset_tools.filesystem_tools.find_all_folders",
"cv2.remap",
"clubs_dataset_tools.stereo_matching.rectify_images",
"logging.error",
"clubs_dataset_tool... | [((1455, 1523), 'clubs_dataset_tools.filesystem_tools.find_files_with_extension_in_folder', 'find_files_with_extension_in_folder', (['(scene_folder + sensor_folder[0])'], {}), '(scene_folder + sensor_folder[0])\n', (1490, 1523), False, 'from clubs_dataset_tools.filesystem_tools import read_images, find_files_with_exten... |
from sklearn.externals import joblib
from collections import defaultdict, Counter
import gzip
import sys
import string
import numpy as np
def CreateXid(dict_in, limit):
word2id, id2word = {}, {}
word2id["PAD"] = 0
id2word[0] = "PAD"
word2id["<BOS>"] = 1
id2word[1] = "<BOS>"
word2... | [
"sklearn.externals.joblib.dump",
"gzip.open",
"numpy.zeros",
"numpy.array",
"collections.Counter"
] | [((1119, 1181), 'numpy.zeros', 'np.zeros', (['(num_of_tokens + 1, dim_of_vector)'], {'dtype': 'np.float16'}), '((num_of_tokens + 1, dim_of_vector), dtype=np.float16)\n', (1127, 1181), True, 'import numpy as np\n'), ((1992, 2011), 'collections.Counter', 'Counter', (['token_list'], {}), '(token_list)\n', (1999, 2011), Fa... |
from __future__ import with_statement
from katcorelib import standard_script_options, verify_and_connect, start_session, user_logger
import time
import numpy as np
import katpoint
targets = {'ant1' : (25.119, -8.944, 0.083),
'ant2' : (90.315, 26.648, -0.067),
'ant3' : (3.989, 26.925, -0.006),
... | [
"katpoint.rad2deg",
"numpy.arctan2",
"numpy.asarray",
"katcorelib.user_logger.info",
"time.sleep",
"katcorelib.standard_script_options",
"numpy.array",
"numpy.sqrt",
"katcorelib.verify_and_connect",
"numpy.all",
"katcorelib.user_logger.warning"
] | [((2321, 2448), 'katcorelib.standard_script_options', 'standard_script_options', ([], {'usage': '"""%prog [options] <target>"""', 'description': '"""Point dishes at the given target and record data."""'}), "(usage='%prog [options] <target>', description=\n 'Point dishes at the given target and record data.')\n", (23... |
import numpy as np
from mapel.roommates.models._utils import convert
from mapel.main._utils import *
def generate_roommates_ic_votes(num_agents: int = None):
""" Impartial Culture """
votes = [list(np.random.permutation(num_agents)) for _ in range(num_agents)]
return convert(votes)
def generate_room... | [
"mapel.roommates.models._utils.convert",
"numpy.zeros",
"numpy.random.permutation"
] | [((286, 300), 'mapel.roommates.models._utils.convert', 'convert', (['votes'], {}), '(votes)\n', (293, 300), False, 'from mapel.roommates.models._utils import convert\n'), ((990, 1004), 'mapel.roommates.models._utils.convert', 'convert', (['votes'], {}), '(votes)\n', (997, 1004), False, 'from mapel.roommates.models._uti... |
import gym
import numpy as np
import torch
from torch import Tensor
import torch.nn as nn
import torch.optim as optim
import time
from spinup.algos.sac_pytorch.core import TanhGaussianPolicy, Mlp, soft_update_model1_with_model2, ReplayBuffer
from spinup.utils.logx import EpochLogger
from spinup.utils.run_utils import s... | [
"spinup.utils.run_utils.setup_logger_kwargs",
"torch.nn.MSELoss",
"numpy.random.seed",
"spinup.algos.sac_pytorch.core.ReplayBuffer",
"argparse.ArgumentParser",
"gym.make",
"spinup.algos.sac_pytorch.core.soft_update_model1_with_model2",
"torch.manual_seed",
"numpy.zeros",
"spinup.algos.sac_pytorch.... | [((3295, 3323), 'spinup.utils.logx.EpochLogger', 'EpochLogger', ([], {}), '(**logger_kwargs)\n', (3306, 3323), False, 'from spinup.utils.logx import EpochLogger\n'), ((3430, 3453), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (3447, 3453), False, 'import torch\n'), ((3458, 3478), 'numpy.random.... |
import pandas as pd
import numpy as np
import itertools
import os
from scipy import interpolate
from matplotlib import pyplot as plt
import matplotlib.ticker as ticker
from mpl_toolkits.mplot3d import Axes3D
''' Get directory '''
dir_config = '/home/hector/ros/ual_ws/src/upat_follower/config/'
dir_data = '/home/hector... | [
"numpy.abs",
"pandas.read_csv",
"numpy.around",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.std",
"os.path.exists",
"numpy.max",
"numpy.var",
"matplotlib.pyplot.errorbar",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.min",
"matplotlib.pyplot.subplots_... | [((10248, 10268), 'matplotlib.pyplot.show', 'plt.show', ([], {'block': '(True)'}), '(block=True)\n', (10256, 10268), True, 'from matplotlib import pyplot as plt\n'), ((616, 645), 'os.path.exists', 'os.path.exists', (['dir_save_data'], {}), '(dir_save_data)\n', (630, 645), False, 'import os\n'), ((651, 677), 'os.makedir... |
"""
A framework for calibration assessment of binary classification models
written in Python.
References
----------
[1] <NAME>, <NAME>., <NAME>, and <NAME>.
Applied logistic regression. Vol. 398. John Wiley & Sons, 2013.
[2] Pigeon, <NAME>., and <NAME>.
An improved goodness of fit statistic for probabili... | [
"pandas.DataFrame",
"numpy.abs",
"pandas.Interval",
"matplotlib.pyplot.scatter",
"statsmodels.nonparametric.smoothers_lowess.lowess",
"pandas.cut",
"numpy.histogram",
"numpy.array",
"numpy.arange",
"pandas.qcut",
"scipy.integrate.trapezoid",
"warnings.warn",
"math.log2",
"matplotlib.pyplot... | [((4462, 4478), 'numpy.array', 'np.array', (['y_true'], {}), '(y_true)\n', (4470, 4478), True, 'import numpy as np\n'), ((4518, 4534), 'numpy.array', 'np.array', (['y_pred'], {}), '(y_pred)\n', (4526, 4534), True, 'import numpy as np\n'), ((9454, 9678), 'pandas.DataFrame', 'pd.DataFrame', (["{'total': total, 'mean_pred... |
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
ATOL = 0.2
RTOL = 0.2
output_path = Path('output')
plot_path = Path('plot')
tools = {
'amici': 'AMICI',
'pypesto': 'pyPESTO',
}
vectors = {
'default': 'PEtab nominal',
'midpoint': ... | [
"pandas.DataFrame",
"matplotlib.pyplot.tight_layout",
"seaborn.heatmap",
"pathlib.Path",
"numpy.array",
"matplotlib.pyplot.subplots"
] | [((158, 172), 'pathlib.Path', 'Path', (['"""output"""'], {}), "('output')\n", (162, 172), False, 'from pathlib import Path\n'), ((185, 197), 'pathlib.Path', 'Path', (['"""plot"""'], {}), "('plot')\n", (189, 197), False, 'from pathlib import Path\n'), ((1181, 1211), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'sor... |
from __future__ import print_function
import ctypes
import numpy as np
import cv2
import tensorrt as trt
import pycuda.driver as cuda
try:
ctypes.cdll.LoadLibrary('../plugins/libyolo_layer.so')
except OSError as e:
raise SystemExit('ERROR: failed to load ./plugins/libyolo_layer.so. '
'... | [
"pycuda.driver.Stream",
"tensorrt.Logger",
"pycuda.driver.memcpy_dtoh_async",
"numpy.subtract",
"pycuda.driver.pagelocked_empty",
"cv2.cvtColor",
"pycuda.driver.memcpy_htod_async",
"ctypes.cdll.LoadLibrary",
"numpy.expand_dims",
"pycuda.driver.mem_alloc",
"numpy.array",
"tensorrt.Runtime",
"... | [((147, 201), 'ctypes.cdll.LoadLibrary', 'ctypes.cdll.LoadLibrary', (['"""../plugins/libyolo_layer.so"""'], {}), "('../plugins/libyolo_layer.so')\n", (170, 201), False, 'import ctypes\n'), ((911, 942), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (919, 942), True, 'import num... |
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | [
"unittest.main",
"numpy.allclose",
"numpy.zeros"
] | [((3053, 3068), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3066, 3068), False, 'import unittest\n'), ((1263, 1275), 'numpy.zeros', 'np.zeros', (['(20)'], {}), '(20)\n', (1271, 1275), True, 'import numpy as np\n'), ((2265, 2277), 'numpy.zeros', 'np.zeros', (['(20)'], {}), '(20)\n', (2273, 2277), True, 'import ... |
# -*- coding: utf-8 -*-
"""Mnist_testing_least_variance_direction_dirichlet.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1xHmmcFk_REH865XvBafXANHO7i7enMJl
"""
import torch.nn as nn
import torch.nn.functional as F
import pandas as pd
import nu... | [
"numpy.random.seed",
"torch.cat",
"numpy.linalg.svd",
"numpy.random.randint",
"numpy.linalg.norm",
"torchvision.transforms.Normalize",
"torch.no_grad",
"torch.utils.data.DataLoader",
"numpy.reshape",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.AvgPool2d",
"matplotlib.pyplot.legend",
"torch... | [((674, 707), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (697, 707), False, 'import warnings\n'), ((823, 916), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([], {'root': '"""./data"""', 'train': '(True)', 'download': '(True)', 'transform': 'transform'}),... |
# Copyright 2020 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.std",
"numpy.mean",
"numpy.array",
"argparse.ArgumentParser"
] | [((660, 712), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""LR Regression"""'}), "(description='LR Regression')\n", (683, 712), False, 'import argparse\n'), ((1320, 1340), 'numpy.array', 'np.array', (['df_feature'], {}), '(df_feature)\n', (1328, 1340), True, 'import numpy as np\n'), ((1... |
import os
import subprocess
import warnings
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from scipy.stats import spearmanr
from warnings import filterwarnings
from lpocv.lpocv import LeavePairOut
from options_parser import arguments
from datasets import brca_data
# OptionP... | [
"pandas.DataFrame",
"datasets.brca_data",
"warnings.filterwarnings",
"pandas.read_csv",
"scipy.stats.spearmanr",
"sklearn.ensemble.RandomForestRegressor",
"numpy.argsort",
"lpocv.lpocv.LeavePairOut",
"options_parser.arguments",
"pandas.concat"
] | [((342, 353), 'options_parser.arguments', 'arguments', ([], {}), '()\n', (351, 353), False, 'from options_parser import arguments\n'), ((382, 393), 'datasets.brca_data', 'brca_data', ([], {}), '()\n', (391, 393), False, 'from datasets import brca_data\n'), ((459, 496), 'pandas.read_csv', 'pd.read_csv', (['options.param... |
from . import transformations
from . import scorecard
from .. import models
import numpy as np
from matplotlib import pyplot, use
from skimage.graph import route_through_array, shortest_path
import math
import simplification
from simplification.cutil import simplify_coords_idx
# from pathfinding.core.diagonal_movemen... | [
"pyastar.astar_path",
"numpy.load",
"numpy.copy",
"math.sqrt",
"math.pow",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"matplotlib.pyplot.axis",
"datetime.datetime.now",
"numba.int32",
"matplotlib.pyplot.figure",
"numpy.min",
"numpy.max",
"numpy.array",
"simplification.cutil.simplify_coor... | [((8912, 8965), 'numpy.zeros', 'np.zeros', (['(layers, _width, _height)'], {'dtype': 'np.float32'}), '((layers, _width, _height), dtype=np.float32)\n', (8920, 8965), True, 'import numpy as np\n'), ((8991, 9044), 'numpy.zeros', 'np.zeros', (['(layers, _width, _height)'], {'dtype': 'np.float32'}), '((layers, _width, _hei... |
#!/usr/bin/env python
"""Command line interface for FrankaPanda with Kinect2.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import atexit
import os.path
import sys
from builtins import input
import numpy as np
import matplotlib.pyplo... | [
"matplotlib.pyplot.title",
"atexit.register",
"robovat.perception.camera.Kinect2",
"robovat.perception.point_cloud_utils.remove_table",
"argparse.ArgumentParser",
"matplotlib.pyplot.figure",
"robovat.robots.franka_panda.factory",
"robovat.simulation.camera.BulletCamera",
"sys.stdout.flush",
"robov... | [((1095, 1120), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1118, 1120), False, 'import argparse\n'), ((17911, 17973), 'robovat.utils.logging.logger.info', 'logger.info', (['"""Creating the FrankaPanda command line client..."""'], {}), "('Creating the FrankaPanda command line client...')\n"... |
import collections
import utils
import observation
import tensorflow as tf
import numpy as np
import tensorflow_probability as tfp
import utils
from tensorflow.keras.layers import Input, Dense, Lambda, Add, Conv2D, Flatten, LSTM, Reshape, ConvLSTM2D, BatchNormalization, Conv3D
from tensorflow_probability.python.distrib... | [
"itertools.repeat",
"utils.batch_apply",
"tensorflow.linalg.matmul",
"tensorflow.keras.layers.Dense",
"tensorflow.math.reduce_max",
"tensorflow.reshape",
"tensorflow.concat",
"tensorflow.keras.layers.LSTMCell",
"tensorflow.transpose",
"tensorflow.stack",
"utils.select_actions",
"tensorflow.sha... | [((1109, 1330), 'collections.namedtuple', 'collections.namedtuple', (['"""AgentOutput"""', '"""enum enum_logits x x_logits y y_logits target_unit target_unit_logits ability ability_logits item item_logits baseline"""'], {}), "('AgentOutput',\n 'enum enum_logits x ... |
"""Tests that need to be run under `fil-profile python`.
To run:
$ fil-profile python -m pytest tests/test-scripts/fil-interpreter.py
"""
import sys
import os
from ctypes import c_void_p
import re
from pathlib import Path
from subprocess import check_output, check_call
import multiprocessing
import pytest
import nu... | [
"IPython.core.interactiveshell.InteractiveShell.clear_instance",
"numexpr.set_num_threads",
"numpy.ones",
"multiprocessing.get_context",
"pathlib.Path",
"pytest.mark.parametrize",
"filprofiler._tracer.disable_thread_pools",
"os.chdir",
"subprocess.check_call",
"blosc.set_nthreads",
"threadpoolct... | [((6789, 6853), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', "['spawn', 'forkserver', 'fork']"], {}), "('mode', ['spawn', 'forkserver', 'fork'])\n", (6812, 6853), False, 'import pytest\n'), ((7370, 7434), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', "['spawn', 'forkserv... |
from confseq.betting import betting_ci
import numpy as np
import time
import os, sys
import matplotlib.pyplot as plt
dirname = os.path.dirname(__file__)
sys.path.append(os.path.join(dirname, "../.."))
from other_bounds import (
ptl_l2_ci,
)
sample_sizes = np.arange(5, 250, step=10)
ptl_compute_times = [None] * l... | [
"matplotlib.pyplot.plot",
"other_bounds.ptl_l2_ci",
"numpy.random.beta",
"os.path.dirname",
"matplotlib.pyplot.legend",
"confseq.betting.betting_ci",
"time.time",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join",
"matplotlib.pyplot.savefig"
] | [((128, 153), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (143, 153), False, 'import os, sys\n'), ((263, 289), 'numpy.arange', 'np.arange', (['(5)', '(250)'], {'step': '(10)'}), '(5, 250, step=10)\n', (272, 289), True, 'import numpy as np\n'), ((1207, 1310), 'matplotlib.pyplot.plot', 'plt.... |
import math
import random
import softwareproperties.ppa
import WilliamsDivergenceMaker as wdm
import BioPythonMaker as bpm
import GeometryMaker as dfm
import HtmlReportMaker as hrm
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
rep = hrm.HtmlReportMaker("WCCC","williams... | [
"WilliamsDivergenceMaker.WilliamsDivergenceMaker",
"HtmlReportMaker.HtmlReportMaker",
"numpy.max",
"BioPythonMaker.loadPdbStructures",
"GeometryMaker.GeometryMaker"
] | [((284, 340), 'HtmlReportMaker.HtmlReportMaker', 'hrm.HtmlReportMaker', (['"""WCCC"""', '"""williams_new.html"""'], {'cols': '(7)'}), "('WCCC', 'williams_new.html', cols=7)\n", (303, 340), True, 'import HtmlReportMaker as hrm\n'), ((435, 500), 'BioPythonMaker.loadPdbStructures', 'bpm.loadPdbStructures', (['[]', '"""Dat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from numpy import zeros, linspace
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
pp = PdfPages('SIR1.pdf')
print("Setup Complete")
# Time unit: 1 h
betas = (10./(40*8*24),2./(40*8*24),0.001/(40*8*24))
print(betas)
days = (30,60,365)
p... | [
"matplotlib.backends.backend_pdf.PdfPages",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((171, 191), 'matplotlib.backends.backend_pdf.PdfPages', 'PdfPages', (['"""SIR1.pdf"""'], {}), "('SIR1.pdf')\n", (179, 191), False, 'from matplotlib.backends.backend_pdf import PdfPages\n'), ((501, 531), 'numpy.linspace', 'linspace', (['(0)', '(N_t * dt)', '(N_t + 1)'], {}), '(0, N_t * dt, N_t + 1)\n', (509, 531), Fal... |
# encdoing: utf-8
"""
@File: main
@Author: <NAME>
@Time: 2021/4/28 21:23
@Description: main function to run DIP model on real-world data sets
"""
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from utils import compute_metrics
from tabulate import tabulate
from datas... | [
"datasets.dataset.DATASET",
"numpy.sum",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"numpy.random.RandomState",
"models.DIP.DIPModel",
"numpy.array",
"utils.compute_metrics"
] | [((628, 655), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (649, 655), True, 'import numpy as np\n'), ((705, 784), 'sklearn.model_selection.train_test_split', 'train_test_split', (['ds.X', 'ds.y'], {'test_size': 'ds.test_size', 'random_state': 'random_state'}), '(ds.X, ds.y, test_siz... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from theseus.core.tests.... | [
"torch.ones",
"torch.cat",
"theseus.SE2.rand",
"torch.randn",
"theseus.Point2",
"theseus.core.tests.common.check_copy_var",
"numpy.linspace",
"torch.rand",
"torch.allclose",
"torch.Generator"
] | [((784, 810), 'torch.randn', 'torch.randn', (['batch_size', '(2)'], {}), '(batch_size, 2)\n', (795, 810), False, 'import torch\n'), ((832, 860), 'torch.cat', 'torch.cat', (['[u, theta]'], {'dim': '(1)'}), '([u, theta], dim=1)\n', (841, 860), False, 'import torch\n'), ((1580, 1597), 'torch.Generator', 'torch.Generator',... |
from __future__ import print_function
import numpy as np
from warnings import warn
from joblib import Parallel, delayed
from . import utils
import copy,argparse,os,math,random,time
from scipy import io,linalg
import scipy.sparse as sp
from scipy.sparse import csr_matrix
from scipy.linalg import blas
import warnings
imp... | [
"sklearn.utils.check_random_state",
"numpy.abs",
"numpy.sum",
"numpy.maximum",
"scipy.sparse.issparse",
"tensorflow.reset_default_graph",
"numpy.empty",
"tensorflow.zeros_like",
"tensorflow.compat.v1.assign",
"tensorflow.matmul",
"tensorflow.compat.v1.train.exponential_decay",
"tensorflow.Vari... | [((871, 891), 'numpy.finfo', 'np.finfo', (['np.float32'], {}), '(np.float32)\n', (879, 891), True, 'import numpy as np\n'), ((8400, 8414), 'sklearn.utils.check_array', 'check_array', (['A'], {}), '(A)\n', (8411, 8414), False, 'from sklearn.utils import check_random_state, check_array\n'), ((8595, 8622), 'sklearn.utils.... |
import random
import json
import pickle
import numpy as np
#Start Import for Speech to talk
import os
import time
import playsound
import speech_recognition as speech_rec
from gtts import gTTS
#from AppKit import NSSound
#End Import for Speech to talkhj
import nltk
from nltk.stem import WordNetLemmatizer
from tensor... | [
"playsound.playsound",
"os.remove",
"tensorflow.keras.models.load_model",
"nltk.stem.WordNetLemmatizer",
"gtts.gTTS",
"random.choice",
"speech_recognition.Microphone",
"numpy.array",
"nltk.word_tokenize",
"speech_recognition.Recognizer"
] | [((370, 389), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (387, 389), False, 'from nltk.stem import WordNetLemmatizer\n'), ((557, 590), 'tensorflow.keras.models.load_model', 'load_model', (['"""talkbotnlp_model.h5"""'], {}), "('talkbotnlp_model.h5')\n", (567, 590), False, 'from tensorflow.kera... |
import numpy as np
import pylab
from qiskit import Aer
from qiskit.opflow import X, Z, I
from qiskit.utils import QuantumInstance, algorithm_globals
from qiskit.algorithms import VQE, NumPyMinimumEigensolver
from qiskit.algorithms.optimizers import COBYLA, L_BFGS_B, SLSQP
from qiskit.circuit.library import TwoLocal
#... | [
"pylab.show",
"pylab.title",
"qiskit.algorithms.NumPyMinimumEigensolver",
"qiskit.opflow.gradients.Gradient",
"numpy.asarray",
"pylab.ylabel",
"qiskit.algorithms.optimizers.COBYLA",
"qiskit.algorithms.optimizers.SLSQP",
"pylab.xlabel",
"qiskit.circuit.library.TwoLocal",
"pylab.yscale",
"pylab.... | [((1846, 1872), 'pylab.xlabel', 'pylab.xlabel', (['"""Eval count"""'], {}), "('Eval count')\n", (1858, 1872), False, 'import pylab\n'), ((1873, 1895), 'pylab.ylabel', 'pylab.ylabel', (['"""Energy"""'], {}), "('Energy')\n", (1885, 1895), False, 'import pylab\n'), ((1896, 1953), 'pylab.title', 'pylab.title', (['"""Energy... |
# -*- coding: utf-8 -*-
"""
ENG 1600
the path-finding snake
"""
import random
import time
import pygame
import sys
import numpy as np
from pygame.locals import *
class PFSnake(object):
# class attributes
# a 50x50 gameboard
window_height = 100 #400
window_width = 100 #400
cell_size = 20
boar... | [
"pygame.quit",
"pygame.draw.line",
"random.randint",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.Rect",
"numpy.zeros",
"pygame.init",
"time.sleep",
"pygame.display.update",
"pygame.display.set_caption",
"pygame.time.Clock"
] | [((822, 835), 'pygame.init', 'pygame.init', ([], {}), '()\n', (833, 835), False, 'import pygame\n'), ((886, 905), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (903, 905), False, 'import pygame\n'), ((1124, 1177), 'numpy.zeros', 'np.zeros', (['(PFSnake.board_height, PFSnake.board_width)'], {}), '((PFSnake... |
#<NAME>
import cv2
import numpy as np
def read_keypoints(ith):
"""This function reads wrote keypoints
Parameters
----------
ith : A number or character that is represents the file name of the input txt file
Returns
-------
keypoints : read keypoints that is given b... | [
"cv2.drawMatches",
"cv2.imwrite",
"numpy.float32",
"cv2.imread",
"cv2.findHomography"
] | [((2356, 2399), 'cv2.imread', 'cv2.imread', (['filename1', 'cv2.IMREAD_GRAYSCALE'], {}), '(filename1, cv2.IMREAD_GRAYSCALE)\n', (2366, 2399), False, 'import cv2\n'), ((2497, 2540), 'cv2.imread', 'cv2.imread', (['filename2', 'cv2.IMREAD_GRAYSCALE'], {}), '(filename2, cv2.IMREAD_GRAYSCALE)\n', (2507, 2540), False, 'impor... |
"""
Implementation of a dataset that add phenotype data.
"""
from typing import Optional, List
from dataclasses import dataclass
import torch
import pandas as pd
import numpy as np
from .core import GeneticDataset, GeneticDatasetBackend
_STANDARDIZE_MAX_SAMPLE = 10_000
@dataclass
class StdVariableScaler(object)... | [
"pandas.DataFrame",
"pandas.merge",
"numpy.nanstd",
"torch.nan_to_num",
"numpy.arange",
"torch.tensor",
"numpy.nanmean"
] | [((6512, 6551), 'pandas.DataFrame', 'pd.DataFrame', (["{'left_id': left_samples}"], {}), "({'left_id': left_samples})\n", (6524, 6551), True, 'import pandas as pd\n'), ((6578, 6605), 'numpy.arange', 'np.arange', (['left_df.shape[0]'], {}), '(left_df.shape[0])\n', (6587, 6605), True, 'import numpy as np\n'), ((6622, 666... |
import cv2.cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
img = cv.imread('../Resources/Photos/cats.jpg')
cv.imshow('Cats', img)
blank = np.zeros(img.shape[:2], dtype='uint8')
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow('Gray', gray)
circle = cv.circle(blank, (img.shape[1]//2, img.shape[0]//2... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"cv2.cv2.destroyAllWindows",
"cv2.cv2.circle",
"cv2.cv2.bitwise_and",
"matplotlib.pyplot.show",
"cv2.cv2.waitKey",
"matplotlib.pyplot.plot",
"numpy.zeros",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.figure",
"cv2.cv2.calcHist",
"cv2.cv... | [((79, 120), 'cv2.cv2.imread', 'cv.imread', (['"""../Resources/Photos/cats.jpg"""'], {}), "('../Resources/Photos/cats.jpg')\n", (88, 120), True, 'import cv2.cv2 as cv\n'), ((121, 143), 'cv2.cv2.imshow', 'cv.imshow', (['"""Cats"""', 'img'], {}), "('Cats', img)\n", (130, 143), True, 'import cv2.cv2 as cv\n'), ((153, 191)... |
from lib import cache
from lib import math
from api import helpers
import numpy as np
import scipy.sparse
class Task4:
def __init__(self, init_params, data):
self.config = init_params['config']
self.app_mode = init_params['app_mode']
self.project_directory = init_params['project_directory']
self.cache = cac... | [
"api.helpers.get_file_name",
"api.helpers.sort",
"numpy.asarray",
"numpy.savetxt",
"lib.math.Math",
"numpy.squeeze"
] | [((418, 429), 'lib.math.Math', 'math.Math', ([], {}), '()\n', (427, 429), False, 'from lib import math\n'), ((956, 982), 'numpy.squeeze', 'np.squeeze', (['reduction_data'], {}), '(reduction_data)\n', (966, 982), True, 'import numpy as np\n'), ((1082, 1104), 'numpy.asarray', 'np.asarray', (['components'], {}), '(compone... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pytest
import pandas as pd
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_equal,
assert_almost_equal, assert_allclose)
from sm2.tools.sm_exceptions import MissingDataError
from sm2.datasets impor... | [
"numpy.random.seed",
"pandas.read_csv",
"numpy.empty",
"sm2.tsa.tests.results.datamlw_tls.mlccf.ccf1000.ravel",
"sm2.datasets.sunspots.load_pandas",
"numpy.ones",
"pandas.DatetimeIndex",
"numpy.arange",
"numpy.random.normal",
"sm2.datasets.macrodata.load_pandas",
"pytest.mark.parametrize",
"os... | [((901, 957), 'os.path.join', 'os.path.join', (['cur_dir', '"""results"""', '"""results_corrgram.csv"""'], {}), "(cur_dir, 'results', 'results_corrgram.csv')\n", (913, 957), False, 'import os\n'), ((977, 1009), 'pandas.read_csv', 'pd.read_csv', (['path'], {'delimiter': '""","""'}), "(path, delimiter=',')\n", (988, 1009... |
import numpy as np
import inspect
import os
import pytest
import MiraTitanHMFemulator
class TestClass:
z_arr = np.linspace(0, 2.02, 4)
m_arr = np.logspace(13, 16, 31)
def test_init(self):
self.HMFemu = MiraTitanHMFemulator.Emulator()
def test_translate_params(self):
HMFemu = MiraTi... | [
"numpy.load",
"inspect.stack",
"numpy.random.seed",
"numpy.sum",
"numpy.logspace",
"numpy.isclose",
"pytest.raises",
"numpy.linspace",
"MiraTitanHMFemulator.Emulator",
"os.path.join"
] | [((117, 140), 'numpy.linspace', 'np.linspace', (['(0)', '(2.02)', '(4)'], {}), '(0, 2.02, 4)\n', (128, 140), True, 'import numpy as np\n'), ((153, 176), 'numpy.logspace', 'np.logspace', (['(13)', '(16)', '(31)'], {}), '(13, 16, 31)\n', (164, 176), True, 'import numpy as np\n'), ((226, 257), 'MiraTitanHMFemulator.Emulat... |
'''
This file does the heavy-lifting of the OCR.
I refered to multiple tutorials / StackOverflow answers online to learn this.
kNN Regression in OpenCV: https://docs.opencv.org/3.0-beta/modules/ml/doc/k_nearest_neighbors.html
OCR with kNN Regressions: https://stackoverflow.com/a/9620295/4982987
NOTE: The "OCR with kN... | [
"cv2.resize",
"cv2.GaussianBlur",
"cv2.contourArea",
"sys.path.remove",
"cv2.ml.KNearest_create",
"numpy.float32",
"cv2.adaptiveThreshold",
"numpy.loadtxt",
"cv2.boundingRect",
"cv2.findContours"
] | [((802, 845), 'numpy.loadtxt', 'np.loadtxt', (['"""ocr_features.data"""', 'np.float32'], {}), "('ocr_features.data', np.float32)\n", (812, 845), True, 'import numpy as np\n'), ((855, 896), 'numpy.loadtxt', 'np.loadtxt', (['"""ocr_labels.data"""', 'np.float32'], {}), "('ocr_labels.data', np.float32)\n", (865, 896), True... |
"""This module defines a dataclass which holds metadata about a WSI.
With this class, metadata is in a normalized consistent format
which is quite useful when working with many different WSI formats.
The raw metadata is also preserved and accessible via a dictionary. The
format of this dictionary may vary between WSI ... | [
"numpy.ceil",
"numpy.floor",
"pathlib.Path",
"numpy.array",
"numpy.interp",
"warnings.warn"
] | [((8117, 8185), 'numpy.interp', 'np.interp', (['level', '[floor, ceil]', '[floor_downsample, ceil_downsample]'], {}), '(level, [floor, ceil], [floor_downsample, ceil_downsample])\n', (8126, 8185), True, 'import numpy as np\n'), ((5303, 5318), 'pathlib.Path', 'Path', (['file_path'], {}), '(file_path)\n', (5307, 5318), F... |
import os
from PIL import Image
import sys
import numpy as np
import cv2
import fnmatch
from skimage.io import imread
import numpy.matlib as matlib
import json
import zlib
import base64
mainDir = '/home/samik/NISSL/Aarti/ds/'
annDir = mainDir + 'ann/'
imgdir = mainDir + 'img/'
outDir = mainDir + 'maskout/'
def imread... | [
"json.load",
"numpy.uint8",
"os.path.basename",
"cv2.cvtColor",
"cv2.imdecode",
"numpy.zeros",
"os.system",
"base64.b64decode",
"cv2.imread",
"numpy.fromstring",
"os.listdir",
"skimage.io.imread"
] | [((713, 731), 'os.listdir', 'os.listdir', (['imgdir'], {}), '(imgdir)\n', (723, 731), False, 'import os\n'), ((394, 422), 'os.path.basename', 'os.path.basename', (['img_path_C'], {}), '(img_path_C)\n', (410, 422), False, 'import os\n'), ((460, 486), 'os.path.basename', 'os.path.basename', (['img_path'], {}), '(img_path... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.multiply",
"argparse.ArgumentParser",
"numpy.float32",
"numpy.expand_dims",
"cv2.imread",
"math.log10",
"numpy.array",
"os.path.join",
"os.listdir"
] | [((788, 813), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (811, 813), False, 'import argparse\n'), ((1228, 1242), 'numpy.float32', 'np.float32', (['hr'], {}), '(hr)\n', (1238, 1242), True, 'import numpy as np\n'), ((1252, 1266), 'numpy.float32', 'np.float32', (['sr'], {}), '(sr)\n', (1262, 1... |
import tensorflow as tf
import numpy as np
from tensorflow.saved_model import signature_constants
def cnn_model_fn(features, labels, mode):
"""Model function for CNN."""
# Input Layer
input_layer = tf.reshape(features["x"], [-1, 28, 28, 1])
# Convolutional Layer #1
conv1 = tf.layers.conv2d(
... | [
"tensorflow.estimator.export.ServingInputReceiver",
"tensorflow.reshape",
"tensorflow.estimator.Estimator",
"tensorflow.estimator.TrainSpec",
"tensorflow.layers.max_pooling2d",
"tensorflow.nn.softmax",
"tensorflow.metrics.accuracy",
"tensorflow.train.get_or_create_global_step",
"tensorflow.io.decode... | [((212, 254), 'tensorflow.reshape', 'tf.reshape', (["features['x']", '[-1, 28, 28, 1]'], {}), "(features['x'], [-1, 28, 28, 1])\n", (222, 254), True, 'import tensorflow as tf\n'), ((296, 407), 'tensorflow.layers.conv2d', 'tf.layers.conv2d', ([], {'inputs': 'input_layer', 'filters': '(32)', 'kernel_size': '[5, 5]', 'pad... |
'''
This benchmark script was inspired by https://github.com/nmerrill67/GPU_GSPCA/blob/master/demo.py
'''
import numpy as np
import matplotlib.pyplot as plt
from time import time
from sklearn.decomposition import PCA
import pudding
def benchmark_random():
'''
This function benchmark our implementation with S... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"pudding.dimension_reduction.PCA",
"matplotlib.pyplot.legend",
"time.time",
"matplotlib.pyplot.figure",
"sklearn.decomposition.PCA",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((1332, 1344), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1342, 1344), True, 'import matplotlib.pyplot as plt\n'), ((1349, 1420), 'matplotlib.pyplot.plot', 'plt.plot', (['n_samples[1:]', 'times_pudding_num_samples[1:]'], {'label': '"""Pudding"""'}), "(n_samples[1:], times_pudding_num_samples[1:], lab... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from edfplus import Edfplus
from bcg import load_bcg
from scipy.signal import lfilter
from scipy.signal import resample_poly
import pdb
def load_ecg(filepath, filter=True, resp=False):
... | [
"scipy.signal.lfilter",
"scipy.signal.resample_poly",
"numpy.loadtxt",
"edfplus.Edfplus"
] | [((424, 441), 'edfplus.Edfplus', 'Edfplus', (['filepath'], {}), '(filepath)\n', (431, 441), False, 'from edfplus import Edfplus\n'), ((697, 748), 'numpy.loadtxt', 'np.loadtxt', (['"""filter/ecg_notch_b.csv"""'], {'delimiter': '""","""'}), "('filter/ecg_notch_b.csv', delimiter=',')\n", (707, 748), True, 'import numpy as... |
from typing import Union
import chess
import numpy as np
class ChessPositionSerializer:
def __init__(
self,
is_pieces: bool = True,
is_enpassant: bool = True,
is_castling: bool = True,
is_turn: bool = True,
dtype=np.int8, # TODO: add type
) -> None:
sel... | [
"numpy.empty",
"numpy.zeros",
"dataset.ChessValueDataset.from_file",
"chess.parse_square",
"numpy.savez",
"chess.square",
"numpy.concatenate"
] | [((6380, 6419), 'dataset.ChessValueDataset.from_file', 'ChessValueDataset.from_file', (['"""cvd.json"""'], {}), "('cvd.json')\n", (6407, 6419), False, 'from dataset import ChessValueDataset\n'), ((6599, 6632), 'numpy.savez', 'np.savez', (['"""dataset.npz"""'], {'X': 'X', 'y': 'y'}), "('dataset.npz', X=X, y=y)\n", (6607... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"qiskit.providers.aer.backends.QasmSimulator",
"qiskit.QuantumCircuit",
"qiskit.providers.aer.utils.qobj_utils.unitary_instr",
"numpy.array",
"qiskit.ClassicalRegister",
"qiskit.providers.aer.utils.qobj_utils.measure_instr",
"qiskit.QuantumRegister"
] | [((1194, 1212), 'qiskit.QuantumRegister', 'QuantumRegister', (['(1)'], {}), '(1)\n', (1209, 1212), False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), ((1227, 1245), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['qr'], {}), '(qr)\n', (1241, 1245), False, 'from qiskit import QuantumRegister... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 14 9:56am 2019
Plotting phase curves
Updated on Mon Jun 3 - Added name_par_list for NICERsoft segments
"""
from __future__ import division, print_function
from astropy.io import fits
import numpy as np
import Lv0_dirs,Lv0_fits2dict,Lv1_data_bin,Lv2... | [
"Lv1_data_bin.binning_tE",
"Lv1_data_bin.binning_E",
"numpy.argsort",
"matplotlib.pyplot.step",
"matplotlib.pyplot.figure",
"numpy.mean",
"pathlib.Path",
"pint.eventstats.z2m",
"PyAstronomy.pyasl.foldAt",
"matplotlib.pyplot.close",
"pint.eventstats.sf_z2m",
"numpy.max",
"numpy.linspace",
"... | [((534, 555), 'Lv0_dirs.global_par', 'Lv0_dirs.global_par', ([], {}), '()\n', (553, 555), False, 'import Lv0_dirs, Lv0_fits2dict, Lv1_data_bin, Lv2_mkdir\n'), ((1209, 1249), 'PyAstronomy.pyasl.foldAt', 'foldAt', (['times', 'period'], {'T0': '(shift * period)'}), '(times, period, T0=shift * period)\n', (1215, 1249), Fal... |
#Author: <NAME>
import numpy as np
from PlayGame.simulate import simulate_game
import matplotlib.pyplot as pt
def simulate(opponent:int):
print("simulating 100 events of TreeAI vs BaselineAI")
if opponent ==1 :
hist = [],[]
for i in range(100):
size = np.random.randint(2,5),np.rando... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.random.randint",
"PlayGame.simulate.simulate_game"
] | [((509, 531), 'matplotlib.pyplot.plot', 'pt.plot', (['hist[0]', '"""b-"""'], {}), "(hist[0], 'b-')\n", (516, 531), True, 'import matplotlib.pyplot as pt\n'), ((540, 562), 'matplotlib.pyplot.plot', 'pt.plot', (['hist[1]', '"""r-"""'], {}), "(hist[1], 'r-')\n", (547, 562), True, 'import matplotlib.pyplot as pt\n'), ((571... |
# Copyright (c) 2019 Horizon Robotics. 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 applicab... | [
"alf.utils.common.should_record_summaries",
"alf.utils.averager.ScalarWindowAverager",
"alf.utils.dist_utils.entropy_with_fallback",
"numpy.log",
"tensorflow.reduce_sum",
"tensorflow.summary.scalar",
"alf.utils.common.namedtuple",
"tensorflow.maximum",
"numpy.float32",
"absl.logging.info",
"tens... | [((1059, 1112), 'alf.utils.common.namedtuple', 'namedtuple', (['"""EntropyTargetLossInfo"""', "['entropy_loss']"], {}), "('EntropyTargetLossInfo', ['entropy_loss'])\n", (1069, 1112), False, 'from alf.utils.common import namedtuple, run_if, should_record_summaries\n'), ((1133, 1187), 'alf.utils.common.namedtuple', 'name... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# DPP kernel fitter
# <NAME>
# Dec. 2019
from __future__ import print_function
import matplotlib as mpl
mpl.use('Agg')
import numpy as np
import pandas as pd
import argparse
import functools
import random
import chainer
import chainer.functions as F
import chainer.links a... | [
"chainer.training.extensions.observe_lr",
"argparse.ArgumentParser",
"chainer.training.extensions.LinearShift",
"chainer.links.get",
"numpy.arange",
"chainer.iterators.SerialIterator",
"os.path.join",
"chainer.training.extensions.LogReport",
"chainer.links.Linear",
"numpy.set_printoptions",
"cha... | [((151, 165), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (158, 165), True, 'import matplotlib as mpl\n'), ((6436, 6521), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fitting non-symmetric DPP kernels to data"""'}), "(description='Fitting non-symmetric DPP kernels to... |
import pandas as pd
import os
from glob import glob
from pandas.core.frame import DataFrame
from tqdm import tqdm
import numpy as np
from numpy.random import randint
from typing import Union, Tuple
from sklearn.ensemble import RandomForestRegressor
from sklearn.base import RegressorMixin
from collections import Ordered... | [
"numpy.sum",
"pandas.read_csv",
"numpy.random.randint",
"numpy.arange",
"os.path.join",
"numpy.atleast_2d",
"pandas.DataFrame",
"multiprocessing.cpu_count",
"os.path.abspath",
"numpy.random.shuffle",
"tqdm.tqdm",
"copy.deepcopy",
"pandas.date_range",
"os.path.basename",
"microtc.utils.lo... | [((532, 557), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (547, 557), False, 'import os\n'), ((1182, 1207), 'numpy.arange', 'np.arange', (['costs.shape[0]'], {}), '(costs.shape[0])\n', (1191, 1207), True, 'import numpy as np\n'), ((2555, 2576), 'numpy.log', 'np.log', (['presc_norm_df'], {}... |
"""A parser for reading VLBI data from vgosDb files
Description:
------------
Reads data from files in the vgosDb files as defined in [1]. The data is organized in multiple smaller database
files based on netCDF.
References:
-----------
..[1] vgosDb format
ftp://gemini.gsfc.nasa.gov/pub/misc/jmg/VLBI_Structure_... | [
"numpy.full",
"numpy.zeros",
"numpy.isnan",
"where.lib.log.error",
"datetime.datetime",
"midgard.parsers.parse_file",
"where.lib.log.warn",
"numpy.isclose",
"datetime.timedelta",
"scipy.interpolate.interp1d"
] | [((10038, 10055), 'datetime.timedelta', 'timedelta', ([], {'days': '(1)'}), '(days=1)\n', (10047, 10055), False, 'from datetime import datetime, timedelta\n'), ((4989, 5006), 'numpy.zeros', 'np.zeros', (['num_obs'], {}), '(num_obs)\n', (4997, 5006), True, 'import numpy as np\n'), ((5019, 5076), 'where.lib.log.error', '... |
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import dgl
from collections import defaultdict as ddict
from ordered_set import OrderedSet
class TrainDataset(Dataset):
"""
Training Dataset class.
Parameters
----------
triples: The triples used for training the model... | [
"dgl.graph",
"torch.stack",
"torch.LongTensor",
"numpy.zeros",
"torch.FloatTensor",
"collections.defaultdict",
"ordered_set.OrderedSet",
"torch.Tensor",
"numpy.arange",
"numpy.int32"
] | [((675, 714), 'numpy.arange', 'np.arange', (['self.num_ent'], {'dtype': 'np.int32'}), '(self.num_ent, dtype=np.int32)\n', (684, 714), True, 'import numpy as np\n'), ((1342, 1369), 'torch.stack', 'torch.stack', (['triples'], {'dim': '(0)'}), '(triples, dim=0)\n', (1353, 1369), False, 'import torch\n'), ((1390, 1416), 't... |
# Copied from semi-supervised.ipynb notebook
import argparse
import json
import os
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
import tqdm
from sklearn.metrics import r2_score
from sklearn.model_selection import KFold, GroupKFold
from EVE.VAE_model import VAE_model
... | [
"matplotlib.pyplot.title",
"numpy.sum",
"argparse.ArgumentParser",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"torch.cat",
"os.path.isfile",
"numpy.random.randint",
"numpy.arange",
"torch.device",
"EVE.VAE_model.VAE_model",
"torch.no_grad",
"os.path.join",
"utils.data_utils.MSA_processing... | [((2068, 2118), 'os.makedirs', 'os.makedirs', (['training_logs_location'], {'exist_ok': '(True)'}), '(training_logs_location, exist_ok=True)\n', (2079, 2118), False, 'import os\n'), ((2214, 2242), 'os.path.exists', 'os.path.exists', (['MSA_LOCATION'], {}), '(MSA_LOCATION)\n', (2228, 2242), False, 'import os\n'), ((2294... |
from agent import Agent
import numpy as np
import random
import time
import os
import subprocess
# from bands import sound_params
action_set = [
"INCREASE_PARAM",
"DECREASE_PARAM",
"SAME_PARAM",
]
DATA_LOCATION = os.getcwd() + "/raw_data/"
SOUND_LOCATION = os.getcwd() + "/raw_sound/"
# print('outputting data ... | [
"subprocess.Popen",
"random.randint",
"socketio.Client",
"os.getcwd",
"supercollider.AudioBus",
"numpy.ones",
"time.time",
"time.sleep",
"numpy.hstack",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.array",
"supercollider.Synth",
"supercollider.Server",
"supercollider.Group",
"agent... | [((1992, 2010), 'supercollider.Server', 'Server', ([], {'port': '(57110)'}), '(port=57110)\n', (1998, 2010), False, 'from supercollider import Server, Synth, Buffer, AudioBus, ADD_TO_TAIL, Group\n'), ((2065, 2082), 'socketio.Client', 'socketio.Client', ([], {}), '()\n', (2080, 2082), False, 'import socketio\n'), ((222,... |
"""Data Equivalence Tests"""
from __future__ import print_function
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import os.path as op
import inspect
from nose.tools import assert_equal
from numpy.testing import assert_array_almost_equal, assert_array_equal
from mne.utils import _TempDir
from mne.fiff impor... | [
"mne.fiff.brainvision.read_raw_brainvision",
"os.path.abspath",
"mne.utils._TempDir",
"numpy.testing.assert_array_equal",
"mne.fiff.Raw",
"inspect.currentframe",
"numpy.testing.assert_array_almost_equal",
"mne.fiff.pick_types",
"os.path.join"
] | [((509, 539), 'os.path.join', 'op.join', (['data_dir', '"""test.vhdr"""'], {}), "(data_dir, 'test.vhdr')\n", (516, 539), True, 'import os.path as op\n'), ((551, 584), 'os.path.join', 'op.join', (['data_dir', '"""test_elp.txt"""'], {}), "(data_dir, 'test_elp.txt')\n", (558, 584), True, 'import os.path as op\n'), ((595, ... |
"""
nbkode.events
~~~~~~~~~~~~
Methods for dealing with events.
Adapted from: https://github.com/scipy/scipy/blob/v1.5.4/scipy/integrate/_ivp/ivp.py
:copyright: 2020 by nbkode Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from typing import Callable,... | [
"numpy.empty",
"numpy.sign"
] | [((4358, 4369), 'numpy.empty', 'np.empty', (['(0)'], {}), '(0)\n', (4366, 4369), True, 'import numpy as np\n'), ((5005, 5016), 'numpy.empty', 'np.empty', (['(0)'], {}), '(0)\n', (5013, 5016), True, 'import numpy as np\n'), ((6473, 6497), 'numpy.sign', 'np.sign', (['event.direction'], {}), '(event.direction)\n', (6480, ... |
import pickle
import os
import math
import random
import numpy as np
from sklearn.preprocessing import PolynomialFeatures
import context
from src.device import Device, Device_Type
from src.packet import Packet, Packet_Type
class TCPML():
def __init__(self):
self.packets_to_send = list()
self.packe... | [
"sklearn.preprocessing.PolynomialFeatures",
"os.path.dirname",
"src.packet.Packet",
"numpy.array"
] | [((1043, 1094), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', ([], {'degree': '(2)', 'interaction_only': '(True)'}), '(degree=2, interaction_only=True)\n', (1061, 1094), False, 'from sklearn.preprocessing import PolynomialFeatures\n'), ((1467, 1525), 'src.packet.Packet', 'Packet', (['self.def_seg_no... |
"""Reads and writes Cerfacs' XDMF files.
"""
import os
import warnings
import numpy as np
import h5py
import meshio
from meshio._common import num_nodes_per_cell
from pyhip.commands.readers import read_hdf5_mesh
from pyhip.commands.writers import write_hdf5
from pyhip.commands.operations import hip_exit
from pyhip.... | [
"pyhip.commands.readers.read_hdf5_mesh",
"os.remove",
"h5py.File",
"yamio.Mesh",
"pyhip.commands.writers.write_hdf5",
"numpy.array",
"pyhip.commands.mesh_idcard.extract_hdf_meshinfo",
"warnings.warn",
"meshio.CellBlock",
"pyhip.hipster.pyhip_cmd",
"numpy.concatenate",
"pyhip.commands.operation... | [((1087, 1137), 'yamio.Mesh', 'yamio.Mesh', (['points', 'cells'], {'bnd_patches': 'bnd_patches'}), '(points, cells, bnd_patches=bnd_patches)\n', (1097, 1137), False, 'import yamio\n'), ((4420, 4448), 'pyhip.commands.readers.read_hdf5_mesh', 'read_hdf5_mesh', (['tmp_filename'], {}), '(tmp_filename)\n', (4434, 4448), Fal... |
# ==================================================================
## {Description} -Mean Shift Intro - Practical Machine Learning Tutorial with Python p.41
# ==================================================================
## {License_info}
# ==================================================================
## Au... | [
"matplotlib.pyplot.show",
"matplotlib.style.use",
"numpy.average",
"os.getcwd",
"matplotlib.pyplot.scatter",
"numpy.linalg.norm",
"numpy.array",
"sklearn.datasets.samples_generator.make_blobs",
"numpy.array_equal"
] | [((813, 824), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (822, 824), False, 'import os\n'), ((886, 905), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (895, 905), False, 'from matplotlib import style\n'), ((1214, 1233), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggpl... |
# -*- coding: utf-8 -*-
"""This script generates a sklearn random forest
model that predict values that were created using the
formula (a + b) / 2
The two arrays a and b must have values with range [0, 256].
"""
import numpy as np
from sklearn.model_selection import cross_val_score
from sklearn.model_selection impo... | [
"pandas.DataFrame",
"sklearn.externals.joblib.dump",
"sklearn.model_selection.cross_val_score",
"sklearn.model_selection.cross_val_predict",
"sklearn.ensemble.RandomForestRegressor",
"numpy.random.randint",
"sklearn.metrics.mean_squared_error"
] | [((772, 804), 'numpy.random.randint', 'np.random.randint', (['(-1)', '(257)', '(1000)'], {}), '(-1, 257, 1000)\n', (789, 804), True, 'import numpy as np\n'), ((809, 841), 'numpy.random.randint', 'np.random.randint', (['(-1)', '(257)', '(1000)'], {}), '(-1, 257, 1000)\n', (826, 841), True, 'import numpy as np\n'), ((991... |
import tensorflow as tf
if __name__=='__main__':
tf.compat.v1.enable_eager_execution()
import random
import numpy as np
from tensorflow import keras
import math
def step_decay(epoch, initial_lrate=0.1, drop=0.5, epochs_drop=10.0):
'''
Specify the learning step decay
Example usage:
epochs = np.... | [
"tensorflow.keras.optimizers.RMSprop",
"numpy.random.seed",
"tensorflow.compat.v1.enable_eager_execution",
"tensorflow.keras.models.clone_model",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Sequential",
"math.floor",
"tensorflow.keras.callbacks.ModelCheckpoint",
"tensorflow.compat.v1.set_rand... | [((54, 91), 'tensorflow.compat.v1.enable_eager_execution', 'tf.compat.v1.enable_eager_execution', ([], {}), '()\n', (89, 91), True, 'import tensorflow as tf\n'), ((1453, 1487), 'tensorflow.compat.v1.reset_default_graph', 'tf.compat.v1.reset_default_graph', ([], {}), '()\n', (1485, 1487), True, 'import tensorflow as tf\... |
import numpy as np
class Atom:
"""
The class "Atom" defines atom objects which have the attributes:
:param id: atom id number
:param element: chemical element
:param pos: x,y,z-coordinates of atom position
:param mag_mom: magnetic moment of atom (only used in class: vasp)
:param dyn: selec... | [
"numpy.zeros"
] | [((2480, 2502), 'numpy.zeros', 'np.zeros', ([], {'shape': '(1, 3)'}), '(shape=(1, 3))\n', (2488, 2502), True, 'import numpy as np\n'), ((2531, 2553), 'numpy.zeros', 'np.zeros', ([], {'shape': '(1, 3)'}), '(shape=(1, 3))\n', (2539, 2553), True, 'import numpy as np\n'), ((2589, 2611), 'numpy.zeros', 'np.zeros', ([], {'sh... |
import json
from functools import partial
from pathlib import Path
from datetime import datetime
from itertools import repeat
from collections import OrderedDict
import torch
from PIL import Image
import numpy as np
import torch.nn.functional as F
def map_fn(batch, fn):
if isinstance(batch, dict):
for k ... | [
"torch.clamp_min",
"numpy.random.seed",
"pathlib.Path",
"torch.inverse",
"torch.nn.functional.pad",
"torch.ones",
"torch.median",
"random.seed",
"torch.nn.functional.relu",
"datetime.datetime.now",
"functools.partial",
"json.dump",
"torch.manual_seed",
"torch.max",
"torch.sum",
"torch.... | [((5072, 5103), 'functools.partial', 'partial', (['torch.unsqueeze'], {'dim': '(0)'}), '(torch.unsqueeze, dim=0)\n', (5079, 5103), False, 'from functools import partial\n'), ((2108, 2142), 'torch.nn.functional.relu', 'torch.nn.functional.relu', (['depth_gt'], {}), '(depth_gt)\n', (2132, 2142), False, 'import torch\n'),... |
import os
import os.path as osp
import torch
from torch.utils.data import Dataset
from torch.utils.data.dataloader import default_collate
from torchvision.transforms import functional as F
import numpy as np
import numpy.linalg as LA
import cv2
import json
import csv
import matplotlib.pyplot as plt
from pylsd import ... | [
"numpy.maximum",
"numpy.abs",
"numpy.sum",
"numpy.floor",
"numpy.ones",
"numpy.linalg.norm",
"datasets.transforms.Normalize",
"cv2.cvtColor",
"numpy.random.choice",
"torch.zeros",
"cv2.resize",
"numpy.radians",
"numpy.minimum",
"numpy.cross",
"pylsd.lsd",
"numpy.min",
"datasets.trans... | [((422, 432), 'numpy.min', 'np.min', (['sz'], {}), '(sz)\n', (428, 432), True, 'import numpy as np\n'), ((901, 951), 'torch.zeros', 'torch.zeros', (['(1, height, width)'], {'dtype': 'torch.uint8'}), '((1, height, width), dtype=torch.uint8)\n', (912, 951), False, 'import torch\n'), ((1029, 1072), 'numpy.linalg.norm', 'L... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 18 15:04:55 2015
@author: Ben
"""
import clearplot.plot_functions as pf
import numpy as np
x = np.arange(0,10,0.01)
y = np.sqrt(x)
pf.plot('bare_bones.png', x, y); | [
"numpy.arange",
"clearplot.plot_functions.plot",
"numpy.sqrt"
] | [((144, 166), 'numpy.arange', 'np.arange', (['(0)', '(10)', '(0.01)'], {}), '(0, 10, 0.01)\n', (153, 166), True, 'import numpy as np\n'), ((169, 179), 'numpy.sqrt', 'np.sqrt', (['x'], {}), '(x)\n', (176, 179), True, 'import numpy as np\n'), ((180, 211), 'clearplot.plot_functions.plot', 'pf.plot', (['"""bare_bones.png""... |
import cv2
import numpy as np
class HandDetection:
def __init__(self):
self.trained_hand = False
self.hand_row_nw = None
self.hand_row_se = None
self.hand_col_nw = None
self.hand_col_se = None
self.hand_hist = None
def draw_hand_rect(self, frame):
... | [
"cv2.cvtColor",
"cv2.calcHist",
"numpy.zeros",
"numpy.array",
"cv2.normalize"
] | [((387, 542), 'numpy.array', 'np.array', (['[6 * rows / 20, 6 * rows / 20, 6 * rows / 20, 10 * rows / 20, 10 * rows / \n 20, 10 * rows / 20, 14 * rows / 20, 14 * rows / 20, 14 * rows / 20]'], {}), '([6 * rows / 20, 6 * rows / 20, 6 * rows / 20, 10 * rows / 20, 10 *\n rows / 20, 10 * rows / 20, 14 * rows / 20, 14 ... |
# -*- coding: utf-8 -*-
"""Supports the Vector Electric Field Instrument (VEFI)
onboard the Communication and Navigation Outage Forecasting
System (C/NOFS) satellite. Downloads data from the
NASA Coordinated Data Analysis Web (CDAWeb).
Parameters
----------
platform : string
'cnofs'
name : string
'vefi'
tag : ... | [
"pysat.datetime",
"functools.partial",
"numpy.where"
] | [((1070, 1134), 'functools.partial', 'functools.partial', (['cdw.list_files'], {'supported_tags': 'supported_tags'}), '(cdw.list_files, supported_tags=supported_tags)\n', (1087, 1134), False, 'import functools\n'), ((1480, 1527), 'functools.partial', 'functools.partial', (['cdw.download', 'supported_tags'], {}), '(cdw.... |
#!/usr/bin/env python
import numpy as np
import astropy.io.fits as pyfits
import pylab
import specter.psf
import sys
import argparse
import string
import os.path
def readpsf(filename) :
try :
psftype=pyfits.open(filename)[0].header["PSFTYPE"]
except KeyError :
psftype=""
print("PSF Type=",p... | [
"pylab.show",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.max",
"numpy.array",
"astropy.io.fits.open",
"numpy.linspace"
] | [((505, 584), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (528, 584), False, 'import argparse\n'), ((3088, 3100), 'pylab.show', 'pylab.show', ([], {}), '()\n', (3098, 3100), False... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.animation import FuncAnimation
from fplanck import fokker_planck, boundary, gaussian_pdf
nm = 1e-9
viscosity = 8e-4
radius = 50*nm
drag = 6*np.pi*viscosity*radius
L = 20*nm
U = lambda x: 5e-21*np.cos(x/L)
sim = fokker_planck(... | [
"fplanck.gaussian_pdf",
"fplanck.fokker_planck",
"matplotlib.pyplot.show",
"numpy.cos",
"matplotlib.pyplot.subplots"
] | [((306, 431), 'fplanck.fokker_planck', 'fokker_planck', ([], {'temperature': '(300)', 'drag': 'drag', 'extent': '(600 * nm)', 'resolution': '(10 * nm)', 'boundary': 'boundary.reflecting', 'potential': 'U'}), '(temperature=300, drag=drag, extent=600 * nm, resolution=10 *\n nm, boundary=boundary.reflecting, potential=... |
#!/usr/bin/env python
import time
import sys
import numpy as np
import LX200
from LX200.LX200Utils import *
port = LX200.LXSerial(debug=False)
port.connect('/dev/tty.usbserial')
scope = LX200.Telescope(port, "LX200GPS", debug=False)
alt = from_lx200_angle(scope.get_Altitude())
az = from_lx200_angle(scope.get_AZ())
... | [
"LX200.LXSerial",
"numpy.sin",
"LX200.Telescope"
] | [((117, 144), 'LX200.LXSerial', 'LX200.LXSerial', ([], {'debug': '(False)'}), '(debug=False)\n', (131, 144), False, 'import LX200\n'), ((189, 235), 'LX200.Telescope', 'LX200.Telescope', (['port', '"""LX200GPS"""'], {'debug': '(False)'}), "(port, 'LX200GPS', debug=False)\n", (204, 235), False, 'import LX200\n'), ((484, ... |
import numpy as np
import em
import common
X = np.loadtxt("test_incomplete.txt")
X_gold = np.loadtxt("test_complete.txt")
K = 4
n, d = X.shape
seed = 0
# TODO: Your code here
| [
"numpy.loadtxt"
] | [((48, 81), 'numpy.loadtxt', 'np.loadtxt', (['"""test_incomplete.txt"""'], {}), "('test_incomplete.txt')\n", (58, 81), True, 'import numpy as np\n'), ((91, 122), 'numpy.loadtxt', 'np.loadtxt', (['"""test_complete.txt"""'], {}), "('test_complete.txt')\n", (101, 122), True, 'import numpy as np\n')] |
"""
Example of running optical and contact cluster stuff on gromacs file
"""
from __future__ import absolute_import, division, print_function
import os.path as op
import numpy as np
import numpy.testing as npt
import pdb
import gsd.hoomd
import sys
import clustering as cl
import random
import scipy
import time
#from co... | [
"numpy.array",
"os.path.join",
"clustering.SnapSystem",
"time.time"
] | [((1238, 1272), 'os.path.join', 'op.join', (['data_path', '"""md_whole.xtc"""'], {}), "(data_path, 'md_whole.xtc')\n", (1245, 1272), True, 'import os.path as op\n'), ((1282, 1316), 'os.path.join', 'op.join', (['data_path', '"""md_dummy.tpr"""'], {}), "(data_path, 'md_dummy.tpr')\n", (1289, 1316), True, 'import os.path ... |
import numpy as np
import pytest
import torch
from theissues import training
def test_build_sequences_splits_returns_indices():
tokens = torch.LongTensor([1, 2, 3, 1, 2])
indices = training.build_sequences_splits(tokens, 2)
np.testing.assert_equal(indices.tolist(), [1, 4])
def test_build_sequences_spli... | [
"theissues.training.build_sequence_gather_indices",
"torch.LongTensor",
"numpy.random.PCG64",
"theissues.training.build_sequence_mask_after",
"pytest.raises",
"theissues.training.select_uniqueish_token",
"theissues.training.build_sequences_splits"
] | [((144, 177), 'torch.LongTensor', 'torch.LongTensor', (['[1, 2, 3, 1, 2]'], {}), '([1, 2, 3, 1, 2])\n', (160, 177), False, 'import torch\n'), ((192, 234), 'theissues.training.build_sequences_splits', 'training.build_sequences_splits', (['tokens', '(2)'], {}), '(tokens, 2)\n', (223, 234), False, 'from theissues import t... |
# Core functionality
import logging
from marvin import config
from astropy.io import fits
import astropy.units as u
from astropy.cosmology import WMAP9
import numpy as np
from extinction import fm07 as extinction_law
from marvin.tools.image import Image
from marvin.tools.maps import Maps
from marvin.tools.cube imp... | [
"astropy.units.with_H0",
"marvin.tools.image.Image.from_list",
"astropy.table.Table",
"numpy.abs",
"logging.warning",
"marvin.config.lookUpVersions",
"numpy.argsort",
"numpy.array",
"marvin.utils.general.general.get_dapall_file",
"marvin.utils.general.general.get_drpall_table",
"numpy.log10",
... | [((19120, 19187), 'numpy.array', 'np.array', (['[ind_dict_dap[plateifu] for plateifu in barred_plateifus]'], {}), '([ind_dict_dap[plateifu] for plateifu in barred_plateifus])\n', (19128, 19187), True, 'import numpy as np\n'), ((19215, 19283), 'numpy.array', 'np.array', (['[(ind != bad_barred_ind) for ind in barred_samp... |
import numpy as np
import cv2
import glob
import config
import random
from multiprocessing.pool import ThreadPool
LABEL_PATH ='./labels'
IMG_PATH = './imgs'
# add dynamic scaling and shifting later
SCALE_RANGE = [0.6, 1.4]
SHIFT_RANGE = [-200, 200]
def random_warp(img, label, scale_range, shift_range, imgsize):
... | [
"numpy.stack",
"numpy.random.uniform",
"numpy.uint8",
"numpy.log",
"multiprocessing.pool.ThreadPool",
"numpy.argmax",
"cv2.waitKey",
"random.sample",
"numpy.float32",
"numpy.zeros",
"cv2.rectangle",
"cv2.warpAffine",
"cv2.imread",
"numpy.exp",
"glob.glob",
"cv2.imshow",
"cv2.resize",... | [((328, 386), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 'scale_range[0]', 'high': 'scale_range[1]'}), '(low=scale_range[0], high=scale_range[1])\n', (345, 386), True, 'import numpy as np\n'), ((398, 456), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 'shift_range[0]', 'high': 'shift_range[1]... |
import numpy as np
import matplotlib.pyplot as plt
import math
def eval(x):
if x > 0.21111 and x < 0.3232:
return True
if x > 0.4957 and x < 0.9191:
return True
return False
N=[100,500,1000]
fig = plt.figure(figsize=(20,5))
for i in range(3):
x = np.array([])
d = np.random.rand(N[i... | [
"matplotlib.pyplot.show",
"numpy.hstack",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.random.rand"
] | [((227, 254), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 5)'}), '(figsize=(20, 5))\n', (237, 254), True, 'import matplotlib.pyplot as plt\n'), ((757, 767), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (765, 767), True, 'import matplotlib.pyplot as plt\n'), ((281, 293), 'numpy.array', 'n... |
from . import utils
from .klines import KLines
import numpy as np
class XLines(object):
def __init__(self, candidates, alpha0=0., init_alpha="one", max_iter=10, tol=0.001,
clustering_n_init=3, clustering_init="estimate", metric="silhouette",
verbose=0):
"""
... | [
"numpy.argmax"
] | [((4988, 5011), 'numpy.argmax', 'np.argmax', (['self.scores_'], {}), '(self.scores_)\n', (4997, 5011), True, 'import numpy as np\n')] |
import functools
import operator
import os
import os.path
import sys
import numpy as np
# Bamboo utilities
current_file = os.path.realpath(__file__)
current_dir = os.path.dirname(current_file)
sys.path.insert(0, os.path.join(os.path.dirname(current_dir), 'common_python'))
import tools
# ==============================... | [
"tools.create_python_data_reader",
"numpy.random.seed",
"os.path.realpath",
"os.path.dirname",
"tools.create_tests",
"numpy.nditer",
"numpy.finfo",
"numpy.random.randint",
"numpy.mean",
"numpy.random.normal",
"tools.numpy_l2norm2"
] | [((123, 149), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (139, 149), False, 'import os\n'), ((164, 193), 'os.path.dirname', 'os.path.dirname', (['current_file'], {}), '(current_file)\n', (179, 193), False, 'import os\n'), ((6033, 6079), 'tools.create_tests', 'tools.create_tests', (['set... |
# <NAME>
import argparse, sys, os
import numpy as np
import pylab as plt
from glob import glob
from spectral.io import envi
from scipy.stats import norm
from scipy.linalg import solve, inv
from astropy import modeling
from sklearn.linear_model import RANSACRegressor
from skimage.filters import threshold_otsu
from numpy... | [
"pylab.show",
"argparse.ArgumentParser",
"numpy.nanmedian",
"numpy.polyfit",
"numpy.polyval",
"numpy.argmax",
"numpy.std",
"numpy.fromfile",
"os.path.exists",
"numpy.ones",
"numpy.zeros",
"PIL.Image.open",
"numpy.isfinite",
"numpy.where",
"numpy.array",
"numpy.arange",
"numpy.squeeze... | [((452, 483), 'os.path.exists', 'os.path.exists', (["(infile + '.hdr')"], {}), "(infile + '.hdr')\n", (466, 483), False, 'import argparse, sys, os\n'), ((840, 857), 'numpy.argmax', 'np.argmax', (['series'], {}), '(series)\n', (849, 857), True, 'import numpy as np\n'), ((979, 1004), 'numpy.polyfit', 'np.polyfit', (['x',... |
import cv2
import csv
import torch
import numpy as np
from random import random, shuffle, randint
from torch.utils.data import DataLoader, Dataset
from django.db.models import Sum, Count
from django.db.models import Q
from data_labelling.models import DepthImage, FRONT_NORMAL_CAMERA_TYPE_V2, FRONT_ZOOM_CAMERA_TYPE_V2
t... | [
"numpy.zeros_like",
"cv2.dilate",
"torch.FloatTensor",
"numpy.ones",
"django.db.models.Q",
"torch.set_num_threads",
"numpy.array",
"cv2.resize"
] | [((319, 343), 'torch.set_num_threads', 'torch.set_num_threads', (['(5)'], {}), '(5)\n', (340, 343), False, 'import torch\n'), ((4313, 4348), 'cv2.resize', 'cv2.resize', (['image', '(self.W, self.H)'], {}), '(image, (self.W, self.H))\n', (4323, 4348), False, 'import cv2\n'), ((4364, 4398), 'cv2.resize', 'cv2.resize', ([... |
import numpy as np
import pybdv
from pybdv.bdv_datasets import BdvDataset
def on_the_fly_2d():
"""Minimal example for writing to a single timepoint and setup slice by slice.
"""
x = np.random.rand(64, 128, 128)
scale_factors = [
(1, 2, 2), (1, 2, 2)
]
path = "./data.n5"
pybdv.ini... | [
"numpy.random.rand",
"pybdv.bdv_datasets.BdvDataset",
"pybdv.initialize_bdv"
] | [((196, 224), 'numpy.random.rand', 'np.random.rand', (['(64)', '(128)', '(128)'], {}), '(64, 128, 128)\n', (210, 224), True, 'import numpy as np\n'), ((311, 425), 'pybdv.initialize_bdv', 'pybdv.initialize_bdv', (['path'], {'shape': 'x.shape', 'dtype': 'x.dtype', 'downscale_factors': 'scale_factors', 'chunks': '(1, 64, ... |
# Copyright (c) 2019, Build-A-Cell. All rights reserved.
# See LICENSE file in the project root directory for details.
from warnings import warn
from .sbmlutil import *
import warnings
import copy
import numpy as np
class Species(object):
""" A formal species object for a CRN
A Species must have a name. T... | [
"bioscrape.simulator.DeterministicSimulator",
"matplotlib.pyplot.show",
"roadrunner.RoadRunner",
"bioscrape.types.Model",
"bioscrape.sbmlutil.import_sbml",
"matplotlib.pyplot.plot",
"bioscrape.simulator.SSASimulator",
"copy.copy",
"bioscrape.simulator.py_simulate_model",
"numpy.array",
"bioscrap... | [((27320, 27424), 'bioscrape.types.Model', 'Model', ([], {'species': 'species_list', 'reactions': 'reaction_list', 'initial_condition_dict': 'initial_condition_dict'}), '(species=species_list, reactions=reaction_list, initial_condition_dict\n =initial_condition_dict)\n', (27325, 27424), False, 'from bioscrape.types ... |
#!/usr/bin/env python
import os
import sys
import hashlib
from collections import OrderedDict
sys.path.insert(0, os.pardir)
sys.path.insert(0, os.path.join(os.pardir, 'openmoc'))
from testing_harness import TestHarness
from input_set import SimpleLatticeInput
import openmoc.process as process
import numpy as np
clas... | [
"input_set.SimpleLatticeInput",
"openmoc.process.Mesh",
"numpy.zeros",
"sys.path.insert",
"collections.OrderedDict",
"os.path.join"
] | [((95, 124), 'sys.path.insert', 'sys.path.insert', (['(0)', 'os.pardir'], {}), '(0, os.pardir)\n', (110, 124), False, 'import sys\n'), ((144, 178), 'os.path.join', 'os.path.join', (['os.pardir', '"""openmoc"""'], {}), "(os.pardir, 'openmoc')\n", (156, 178), False, 'import os\n'), ((587, 607), 'input_set.SimpleLatticeIn... |
import io
import textwrap
from collections import namedtuple
import numpy as np
import pandas as pd
ProcessedModel = namedtuple("ProcessedModel", "params info name")
def _get_models_multiindex():
df = pd.DataFrame(
data=np.ones((3, 4)), columns=["value", "ci_lower", "ci_upper", "p_value"]
)
df.i... | [
"textwrap.dedent",
"io.StringIO",
"pandas.MultiIndex.from_tuples",
"numpy.ones",
"collections.namedtuple"
] | [((119, 167), 'collections.namedtuple', 'namedtuple', (['"""ProcessedModel"""', '"""params info name"""'], {}), "('ProcessedModel', 'params info name')\n", (129, 167), False, 'from collections import namedtuple\n'), ((327, 402), 'pandas.MultiIndex.from_tuples', 'pd.MultiIndex.from_tuples', (["[('p_1', 'v_1'), ('p_1', '... |
"""
Spatial Analysis - Sales Prices in Washington State
Copyright (c) 2022 Cannlytics
Authors: <NAME> <<EMAIL>>
Created: 2/16/2022
Updated: 2/16/2022
License: MIT License <https://opensource.org/licenses/MIT>
Description: This script creates a histogram of flower prices from the
Washington State traceability data (20... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"numpy.percentile",
"matplotlib.pyplot.text",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.rcParams.update",
"pandas.to_datetime",
"numpy.exp",
"seaborn.color_palette",
"matplotlib.pyplot.subplots",
"numpy.sqrt"
] | [((580, 612), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (593, 612), True, 'import matplotlib.pyplot as plt\n'), ((613, 685), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.family': 'Times New Roman', 'font.size': 32}"], {}), "({'font... |
import numpy as np
# from modules.Node import Node
def sigmoid(sigma):
"""
sigmoid 激活函数
:param sigma: 求和值
:return: 激活值
"""
return 1.0 / (1 + np.exp(- sigma))
def norm2(point):
"""
欧几里得范数
:param point: 输出向量
:return: 范数值
"""
return np.vdot(point, point)
def classif... | [
"numpy.outer",
"numpy.vdot",
"numpy.random.random",
"numpy.array",
"numpy.exp",
"numpy.dot"
] | [((285, 306), 'numpy.vdot', 'np.vdot', (['point', 'point'], {}), '(point, point)\n', (292, 306), True, 'import numpy as np\n'), ((819, 863), 'numpy.array', 'np.array', (['[[1, 2, 3], [-1, 3, 4], [2, 5, 2]]'], {}), '([[1, 2, 3], [-1, 3, 4], [2, 5, 2]])\n', (827, 863), True, 'import numpy as np\n'), ((1034, 1059), 'numpy... |
import torch
import torch.nn as nn
import torch.optim as optim
import sys
import argparse
import torchvision.models as models
from torchvision import transforms as trn
from PIL import Image
import numpy as np
from big_sleep.biggan import BigGAN
from torchvision.utils import save_image
parser = argparse.ArgumentParser()... | [
"argparse.ArgumentParser",
"torch.load",
"torch.sigmoid",
"torch.cuda.is_available",
"big_sleep.biggan.BigGAN.from_pretrained",
"numpy.linspace",
"torch.no_grad"
] | [((295, 320), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (318, 320), False, 'import argparse\n'), ((1191, 1211), 'torch.load', 'torch.load', (['opt.lat1'], {}), '(opt.lat1)\n', (1201, 1211), False, 'import torch\n'), ((1219, 1239), 'torch.load', 'torch.load', (['opt.lat2'], {}), '(opt.lat2)... |
######
## Inspired by the SVHN example on torchvision
## for AFEW dataset with folders of frame images
#####
import torch
import torchvision.transforms as transforms
import torch.utils.data as data
import torch.nn.functional as F
from torch.utils.data.sampler import SubsetRandomSampler, Sampler
import os
from lis... | [
"list.list_files",
"torch.distributions.Categorical",
"random.shuffle",
"videotransforms.video_transforms.Resize",
"videotransforms.volume_transforms.ClipToTensor",
"list.list_dir",
"os.path.join",
"videotransforms.video_transforms.Compose",
"videotransforms.video_transforms.ColorJitter",
"torch.u... | [((19285, 19322), 'random.shuffle', 'random.shuffle', (['dataset.valid_indices'], {}), '(dataset.valid_indices)\n', (19299, 19322), False, 'import random\n'), ((19327, 19364), 'random.shuffle', 'random.shuffle', (['dataset.train_indices'], {}), '(dataset.train_indices)\n', (19341, 19364), False, 'import random\n'), ((1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.