code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Author: <NAME> """ import numpy as np def custom_round(x, base=5): """Rounding to a custom base. """ return int(base * np.ceil(float(x)/base)) def custom_ravel(a, b): """Custom ravelling function for arrays of varying lengths (len(a) > len(b)). """ ab = [] for i, x in enumerate(a...
[ "numpy.random.uniform", "numpy.meshgrid", "numpy.random.seed", "numpy.ceil", "numpy.ptp", "numpy.diff" ]
[((1253, 1276), 'numpy.meshgrid', 'np.meshgrid', (['locy', 'locx'], {}), '(locy, locx)\n', (1264, 1276), True, 'import numpy as np\n'), ((1281, 1298), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1295, 1298), True, 'import numpy as np\n'), ((1309, 1366), 'numpy.random.uniform', 'np.random.uniform', (...
import os import tensorflow as tf import numpy as np from modules.modules_spect_mmd import sampler, \ generator, joint_discriminator, spect_kernel from utils.model_utils import l1_loss, eval_kernel from utils.tf_forward_tan import lddmm class VariationalCycleGAN(object): def __init__(self, dim_pitch=1, ...
[ "tensorflow.trainable_variables", "tensorflow.reshape", "tensorflow.zeros_like", "tensorflow.get_default_graph", "tensorflow.summary.merge", "os.path.join", "utils.model_utils.eval_kernel", "os.path.exists", "tensorflow.concat", "tensorflow.placeholder", "tensorflow.name_scope", "tensorflow.tr...
[((811, 850), 'numpy.eye', 'np.eye', (['self.n_frames'], {'dtype': 'np.float32'}), '(self.n_frames, dtype=np.float32)\n', (817, 850), True, 'import numpy as np\n'), ((1381, 1397), 'tensorflow.train.Saver', 'tf.train.Saver', ([], {}), '()\n', (1395, 1397), True, 'import tensorflow as tf\n'), ((1418, 1430), 'tensorflow.S...
# # lajollaS # www.fabiocrameri.ch/colourmaps from matplotlib.colors import LinearSegmentedColormap cm_data = [[0.99983, 0.99974, 0.79991], [0.10023, 0.10091, 0.0037913], [0.86973, 0.45582, 0.31068], [0.94802, 0.76354, 0.37498], ...
[ "matplotlib.colors.LinearSegmentedColormap.from_list", "numpy.linspace", "matplotlib.pyplot.show", "viscm.viscm" ]
[((4739, 4793), 'matplotlib.colors.LinearSegmentedColormap.from_list', 'LinearSegmentedColormap.from_list', (['"""lajollaS"""', 'cm_data'], {}), "('lajollaS', cm_data)\n", (4772, 4793), False, 'from matplotlib.colors import LinearSegmentedColormap\n'), ((5290, 5300), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\...
from von_karman_psds import spatial_psds, von_karman_gust_intensity import numpy as np import pytest altitude = 20000 probability_of_exceedance = 1e-5 np.random.seed(0) x_max = 10000 dx_approx = 0.1 ### Scary FFT magic below this line... fft_exponent = int(np.round(np.log2(x_max / dx_approx))) - 1 k = np.arange(2 ...
[ "numpy.random.seed", "numpy.sum", "numpy.mean", "numpy.arange", "numpy.exp", "matplotlib.pyplot.tight_layout", "von_karman_psds.spatial_psds", "numpy.fft.irfft", "seaborn.husl_palette", "numpy.real", "numpy.log10", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "numpy.log2", "ma...
[((153, 170), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (167, 170), True, 'import numpy as np\n'), ((308, 340), 'numpy.arange', 'np.arange', (['(2 ** fft_exponent + 1)'], {}), '(2 ** fft_exponent + 1)\n', (317, 340), True, 'import numpy as np\n'), ((666, 701), 'numpy.sqrt', 'np.sqrt', (['(2 * spati...
import numpy as np # import scanpy.api as sc import pandas as pd def norm(x, reverse=False): if reverse: y = np.power(10, x) - 1.01 y = np.around(y).astype(np.int32) return y else: return np.log10(x + 1.01) def minmax_0_to_1(x, reverse=False, minmax=1): if reve...
[ "numpy.power", "numpy.asarray", "numpy.around", "numpy.max", "numpy.log10" ]
[((603, 620), 'numpy.asarray', 'np.asarray', (['array'], {}), '(array)\n', (613, 620), True, 'import numpy as np\n'), ((239, 257), 'numpy.log10', 'np.log10', (['(x + 1.01)'], {}), '(x + 1.01)\n', (247, 257), True, 'import numpy as np\n'), ((128, 143), 'numpy.power', 'np.power', (['(10)', 'x'], {}), '(10, x)\n', (136, 1...
import pandas as pd import numpy as np from sklearn.metrics import classification_report def binary_backtests_returns( backtests: pd.DataFrame, ) -> pd.DataFrame: """ Converts a Horizon backtest data frame into a binary backtests of directions """ return backtests.diff().apply(np.sign).dropna() ...
[ "pandas.DataFrame", "sklearn.metrics.classification_report", "numpy.sign" ]
[((478, 547), 'sklearn.metrics.classification_report', 'classification_report', ([], {'y_true': 'y_true', 'y_pred': 'y_pred', 'output_dict': '(True)'}), '(y_true=y_true, y_pred=y_pred, output_dict=True)\n', (499, 547), False, 'from sklearn.metrics import classification_report\n'), ((915, 931), 'numpy.sign', 'np.sign', ...
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import pytest import torch from mmcv.ops import boxes_iou3d, nms3d, nms3d_normal @pytest.mark.skipif( not torch.cuda.is_available(), reason='requires CUDA support') def test_boxes_iou3d(): np_boxes1 = np.asarray([[1.0, 1.0, 1.0, 2.0, 2.0, 2.0...
[ "numpy.random.seed", "mmcv.ops.boxes_iou3d", "numpy.asarray", "numpy.array", "torch.cuda.is_available", "numpy.random.rand", "torch.from_numpy" ]
[((279, 425), 'numpy.asarray', 'np.asarray', (['[[1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.0], [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 0.0],\n [3.0, 3.0, 3.0, 3.0, 2.0, 2.0, 0.0]]'], {'dtype': 'np.float32'}), '([[1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.0], [2.0, 2.0, 2.0, 2.0, 2.0, \n 2.0, 0.0], [3.0, 3.0, 3.0, 3.0, 2.0, 2.0, 0.0]], dtype...
import math from decimal import Decimal from NIM.benchmarks import Benchmark from numpy import zeros, pi, cos, exp, sqrt, array import numpy as np # double source class MultiSourceFunction(Benchmark): def __init__(self, lower=(0, 0, 0), upper=(20, 20, 0), dimension=3, pg_stability="F", u=2, q=1500, z=1, ...
[ "numpy.array" ]
[((3012, 3044), 'numpy.array', 'array', (['[[3.3, 9.0], [8.5, 16.5]]'], {}), '([[3.3, 9.0], [8.5, 16.5]])\n', (3017, 3044), False, 'from numpy import zeros, pi, cos, exp, sqrt, array\n')]
""" Basic Collaborative Filtering Tutorial (Matrix factorization) This tutorial is based on https://heartbeat.fritz.ai/recommender-systems-with-python-part-iii-collaborative-filtering-singular-value-decomposition-5b5dcb3f242b """ import os import pathlib import pandas as pd import numpy as np from scipy.sparse.linalg...
[ "pandas.DataFrame", "scipy.sparse.linalg.svds", "pathlib.Path", "numpy.mean", "numpy.dot", "numpy.diag", "os.path.join" ]
[((1975, 1993), 'numpy.mean', 'np.mean', (['R'], {'axis': '(1)'}), '(R, axis=1)\n', (1982, 1993), True, 'import numpy as np\n'), ((2162, 2184), 'scipy.sparse.linalg.svds', 'svds', (['R_demeaned'], {'k': '(50)'}), '(R_demeaned, k=50)\n', (2166, 2184), False, 'from scipy.sparse.linalg import svds\n'), ((2390, 2404), 'num...
from sklearn.svm import LinearSVC import numpy as np import pandas as pd from bluegraph.backends.stellargraph import StellarGraphNodeEmbedder from bluegraph.downstream.node_classification import NodeClassifier from sklearn import model_selection from bluegraph.downstream import (get_confusion_matrix, ...
[ "numpy.random.choice", "bluegraph.backends.stellargraph.StellarGraphNodeEmbedder", "bluegraph.downstream.get_classification_scores", "bluegraph.downstream.get_confusion_matrix", "bluegraph.downstream.plot_2d", "sklearn.svm.LinearSVC" ]
[((793, 906), 'bluegraph.backends.stellargraph.StellarGraphNodeEmbedder', 'StellarGraphNodeEmbedder', (['"""node2vec"""'], {'edge_weight': '"""mi"""', 'embedding_dimension': '(10)', 'length': '(5)', 'number_of_walks': '(10)'}), "('node2vec', edge_weight='mi', embedding_dimension=\n 10, length=5, number_of_walks=10)\...
import numpy as np def mag2db(mag): return 20*np.log10(mag)
[ "numpy.log10" ]
[((52, 65), 'numpy.log10', 'np.log10', (['mag'], {}), '(mag)\n', (60, 65), True, 'import numpy as np\n')]
import torch import numpy as np import torch.nn as nn from torch.nn import functional as F from torch.utils.data import DataLoader,Subset import yaml import pickle import os from operator import attrgetter from build_models import UltraModel from dataset import fingerset from utils import averageScalar,string_for_loss ...
[ "utils.string_for_loss", "numpy.abs", "torch.stack", "torch.utils.data.DataLoader", "dataset.fingerset", "utils.averageScalar", "torch.load", "os.path.exists", "torch.nn.functional.softmax", "torch.sigmoid", "numpy.mean", "numpy.array", "yaml.safe_load", "build_models.UltraModel", "torch...
[((690, 759), 'torch.load', 'torch.load', (['"""./best.pth.tar"""'], {'map_location': '(lambda storage, _: storage)'}), "('./best.pth.tar', map_location=lambda storage, _: storage)\n", (700, 759), False, 'import torch\n'), ((991, 1064), 'dataset.fingerset', 'fingerset', (['datasetset_pkl', '"""test"""', '[64, 64]', '(2...
import unittest from setup.settings import * from numpy.testing import * from pandas.util.testing import * import numpy as np import dolphindb_numpy as dnp import pandas as pd import orca class FunctionSinTest(unittest.TestCase): @classmethod def setUpClass(cls): # connect to a DolphinDB server ...
[ "unittest.main", "dolphindb_numpy.array", "orca.connect", "orca.Series", "numpy.sin", "numpy.array", "dolphindb_numpy.sin", "orca.DataFrame" ]
[((1971, 1986), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1984, 1986), False, 'import unittest\n'), ((323, 366), 'orca.connect', 'orca.connect', (['HOST', 'PORT', '"""admin"""', '"""123456"""'], {}), "(HOST, PORT, 'admin', '123456')\n", (335, 366), False, 'import orca\n'), ((1501, 1516), 'orca.Series', 'orca...
# Originally by <NAME> # Modified by <NAME> 9/2015 # Modified by <NAME> 5/2017 import numpy as np import logging from qcodes.instrument.base import Instrument from pycqed.instrument_drivers.pq_parameters import InstrumentParameter import time from qcodes.instrument_drivers.tektronix.AWG5014 import Tektronix_AWG5014 tr...
[ "logging.error", "numpy.zeros", "time.sleep", "time.time", "numpy.array", "numpy.vstack", "qcodes.instrument.base.Instrument.find_instrument" ]
[((5398, 5430), 'qcodes.instrument.base.Instrument.find_instrument', 'Instrument.find_instrument', (['name'], {}), '(name)\n', (5424, 5430), False, 'from qcodes.instrument.base import Instrument\n'), ((14275, 14286), 'time.time', 'time.time', ([], {}), '()\n', (14284, 14286), False, 'import time\n'), ((17445, 17460), '...
import argparse import os import torch import torch.nn as nn from model import VGG16 from vis_flux import vis_flux, vis_flux_v2, label2color from datasets import FluxSegmentationDataset from torch.autograd import Variable import scipy.io as sio from torch.utils.data import Dataset, DataLoader import cv2 impo...
[ "os.makedirs", "argparse.ArgumentParser", "os.path.exists", "scipy.io.savemat", "vis_flux.vis_flux_v2", "model.VGG16", "cv2.imread", "numpy.array", "glob.glob", "torch.device", "torch.no_grad", "torch.from_numpy" ]
[((597, 653), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Super-BPD Network"""'}), "(description='Super-BPD Network')\n", (620, 653), False, 'import argparse\n'), ((1286, 1293), 'model.VGG16', 'VGG16', ([], {}), '()\n', (1291, 1293), False, 'from model import VGG16\n'), ((1735, 1790),...
import os import numpy as np from PIL import Image, ImageFilter import cv2 parent_path = './dataset' #menggunakan folder 'dataset' sebagai parent path all_directories = os.listdir(parent_path+ '/') #initialisasi in/out training & test in_train = [] out_train = [] in_test = [] out_test = [] count = 0 #initialisasi co...
[ "PIL.Image.new", "numpy.save", "os.path.isdir", "cv2.waitKey", "numpy.zeros", "PIL.Image.open", "numpy.array", "cv2.imshow", "os.listdir" ]
[((170, 199), 'os.listdir', 'os.listdir', (["(parent_path + '/')"], {}), "(parent_path + '/')\n", (180, 199), False, 'import os\n'), ((666, 695), 'PIL.Image.new', 'Image.new', (['"""L"""', '(32, 32)', '(255)'], {}), "('L', (32, 32), 255)\n", (675, 695), False, 'from PIL import Image, ImageFilter\n'), ((3581, 3614), 'nu...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 7 18:55:31 2019 @author: shreya """ import numpy as np from scipy.io import loadmat from scipy.stats import mode from PCA import PCA from LDA import LDA data = int(input("Select 1.data.mat 2.pose.mat 3.illumination.mat: ")) opt = int(input("Selec...
[ "scipy.stats.mode", "scipy.io.loadmat", "numpy.argmax", "numpy.zeros", "LDA.LDA", "PCA.PCA", "numpy.max", "numpy.linalg.norm", "numpy.reshape" ]
[((2896, 2916), 'numpy.zeros', 'np.zeros', (['(ntest, 1)'], {}), '((ntest, 1))\n', (2904, 2916), True, 'import numpy as np\n'), ((441, 460), 'scipy.io.loadmat', 'loadmat', (['"""data.mat"""'], {}), "('data.mat')\n", (448, 460), False, 'from scipy.io import loadmat\n'), ((795, 816), 'numpy.zeros', 'np.zeros', (['(ntrain...
#!/usr/bin/env python3 import sys import os from types import SimpleNamespace sys.path.append(os.getcwd()) import os.path as osp import argparse import json import random from collections import OrderedDict, defaultdict import socket import getpass import torch import numpy as np from config import CLASS_NUM, IMAGE...
[ "numpy.random.seed", "argparse.ArgumentParser", "getpass.getuser", "boundary_attack.foolbox.attacks.CarliniWagnerL2Attack", "collections.defaultdict", "sys.stderr.fileno", "dataset.dataset_loader_maker.DataLoaderMaker.get_test_attacked_data", "torch.device", "boundary_attack.foolbox.criteria.TargetC...
[((95, 106), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (104, 106), False, 'import os\n'), ((865, 904), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (888, 904), False, 'import argparse\n'), ((8503, 8522), 'torch.stack', 'torch.stack', (['images'], {}), '(...
from typing import Any, Tuple from Bridges.bridge import Bridge from ROAR.utilities_module.data_structures_models import Vector3D, SensorsData, \ IMUData, DepthData, RGBData, Transform, Rotation, Location, ViveTrackerData, TrackingData from ROAR.utilities_module.vehicle_models import VehicleControl, Vehicle import...
[ "ROAR.utilities_module.data_structures_models.Rotation", "ROAR.utilities_module.data_structures_models.Location", "numpy.clip", "numpy.amax", "ROAR.utilities_module.vehicle_models.VehicleControl", "ROAR.utilities_module.data_structures_models.RGBData", "ROAR.utilities_module.data_structures_models.Vecto...
[((892, 939), 'ROAR.utilities_module.data_structures_models.Location', 'Location', ([], {'x': 'source[0]', 'y': 'source[1]', 'z': 'source[2]'}), '(x=source[0], y=source[1], z=source[2])\n', (900, 939), False, 'from ROAR.utilities_module.data_structures_models import Vector3D, SensorsData, IMUData, DepthData, RGBData, T...
"""Tests for the attribute .X""" import numpy as np import pandas as pd from scipy import sparse import anndata as ad from anndata import AnnData from anndata.utils import asarray import pytest from anndata.tests.helpers import gen_adata, assert_equal UNLABELLED_ARRAY_TYPES = [ pytest.param(sparse.csr_matrix, i...
[ "pytest.fixture", "anndata.tests.helpers.gen_adata", "numpy.ones", "pytest.param", "anndata.tests.helpers.assert_equal", "anndata.utils.asarray", "numpy.array", "pytest.mark.parametrize" ]
[((524, 563), 'pytest.fixture', 'pytest.fixture', ([], {'params': "['h5ad', 'zarr']"}), "(params=['h5ad', 'zarr'])\n", (538, 563), False, 'import pytest\n'), ((614, 663), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""shape"""', 'SINGULAR_SHAPES'], {}), "('shape', SINGULAR_SHAPES)\n", (637, 663), False, 'i...
from .query import QueryManager import pandas as pd import numpy as np import os import dateutil.parser import datetime import csv import pytz import tempfile from functools import reduce import sys class StatusTypes: open = 'open' backlog = 'backlog' accepted = 'committed' complete = 'complete' ab...
[ "pandas.DataFrame", "sys.platform.startswith", "pandas.date_range", "pandas.Series.to_frame", "pandas.read_csv", "pandas.merge", "datetime.date", "tempfile.SpooledTemporaryFile", "datetime.datetime", "os.path.isfile", "pandas.to_datetime", "pandas.Series", "numpy.array", "functools.reduce"...
[((5020, 5050), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (5043, 5050), False, 'import sys\n'), ((5781, 5840), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['key', 'fromDate', 'toDate', 'size']"}), "(columns=['key', 'fromDate', 'toDate', 'size'])\n", (5793, 5840), ...
from rlkit.samplers.rollout_functions import rollout import rlkit.torch.pytorch_util as ptu import argparse import pickle import uuid import roboverse import torch import matplotlib import matplotlib.pyplot as plt filename = str(uuid.uuid4()) import numpy as np from rlkit.torch.sac.policies import TanhGaussianPolicy, G...
[ "argparse.ArgumentParser", "ipdb.set_trace", "rlkit.torch.pytorch_util.from_numpy", "matplotlib.pyplot.figure", "rlkit.torch.conv_networks.CNN", "rlkit.torch.sac.policies.MakeDeterministic", "numpy.zeros_like", "matplotlib.pyplot.imshow", "torch.load", "torchvision.transforms.ToPILImage", "rlkit...
[((229, 241), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (239, 241), False, 'import uuid\n'), ((1138, 1184), 'roboverse.make', 'roboverse.make', (['args.env'], {'transpose_image': '(True)'}), '(args.env, transpose_image=True)\n', (1152, 1184), False, 'import roboverse\n'), ((2870, 2898), 'torch.load', 'torch.load', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import dataset_utils as du from skmultilearn.adapt import MLkNN import numpy as np from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences import os import sys MAX_NB_WORDS =20000 def tokenize_data(X): tokenizer = Token...
[ "skmultilearn.adapt.MLkNN", "keras.preprocessing.sequence.pad_sequences", "numpy.zeros", "keras.preprocessing.text.Tokenizer", "numpy.array", "dataset_utils.load_data", "numpy.vstack" ]
[((315, 348), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'num_words': 'MAX_NB_WORDS'}), '(num_words=MAX_NB_WORDS)\n', (324, 348), False, 'from keras.preprocessing.text import Tokenizer\n'), ((547, 570), 'dataset_utils.load_data', 'du.load_data', (['data_path'], {}), '(data_path)\n', (559, 570), True, 'imp...
# -*- coding: utf-8 -*- """Fast test.""" import numpy import ndd a = [7, 3, 5, 8, 9, 1, 3, 3, 1, 0, 2, 5, 2, 11, 4, 23, 5, 0, 8, 0] h = ndd.entropy(a, k=len(a)) # href = 2.623634344888532 # href = 2.623634344902917 href = 2.6192535776467056 absolute_error = numpy.abs(h - href) relative_error = absolute_error / href #...
[ "numpy.finfo", "numpy.abs" ]
[((260, 279), 'numpy.abs', 'numpy.abs', (['(h - href)'], {}), '(h - href)\n', (269, 279), False, 'import numpy\n'), ((372, 398), 'numpy.finfo', 'numpy.finfo', (['numpy.float32'], {}), '(numpy.float32)\n', (383, 398), False, 'import numpy\n')]
import numpy as np import matplotlib import glob import re from collections import Counter from string import punctuation # if you get the error: "TypeError: 'figure' is an unknown keyword argument" # uncomment the line below: # matplotlib.use('Qt4Agg') try: # pylint: disable=g-import-not-at-top from sklearn.m...
[ "numpy.load", "matplotlib.pyplot.show", "sklearn.manifold.TSNE", "matplotlib.pyplot.annotate", "matplotlib.pyplot.scatter", "matplotlib.pyplot.figure", "glob.glob", "collections.Counter", "re.sub", "matplotlib.pyplot.savefig" ]
[((665, 693), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(18, 18)'}), '(figsize=(18, 18))\n', (675, 693), True, 'import matplotlib.pyplot as plt\n'), ((1023, 1044), 'matplotlib.pyplot.savefig', 'plt.savefig', (['filename'], {}), '(filename)\n', (1034, 1044), True, 'import matplotlib.pyplot as plt\n'), ...
import argparse import os import numpy as np import math import itertools import yaml import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from .datasets import WCDataset from t...
[ "test_tube.Experiment", "argparse.ArgumentParser", "yaml.dump", "torch.cat", "torch.nn.init.constant_", "torch.nn.Softmax", "numpy.random.randint", "numpy.random.normal", "os.path.join", "torch.nn.MSELoss", "torch.utils.data.DataLoader", "torchvision.transforms.Lambda", "torch.nn.Upsample", ...
[((466, 491), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (489, 491), False, 'import torch\n'), ((669, 694), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (692, 694), False, 'import argparse\n'), ((2362, 2397), 'numpy.zeros', 'np.zeros', (['(y.shape[0], num_columns)...
# 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 # # Unless required by appli...
[ "paddle.fluid.io.save_inference_model", "os.remove", "os.mkdir", "paddle_fl.mpc.layers.fc", "paddle.fluid.Executor", "paddle_fl.mpc.data", "os.path.exists", "paddle.reader.compose", "paddle_fl.mpc.layers.softmax_with_cross_entropy", "paddle_fl.mpc.data_utils.data_utils.get_datautils", "paddle.fl...
[((917, 988), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(message)s"""'}), "(format='%(asctime)s - %(levelname)s - %(message)s')\n", (936, 988), False, 'import logging\n'), ((998, 1024), 'logging.getLogger', 'logging.getLogger', (['"""fluid"""'], {}), "('fluid')\n",...
from functions import * from global_variables import init_global import simpy import matplotlib.pyplot as plt import random as rd import numpy as np import os from scipy.optimize import curve_fit from scipy.special import factorial diff_serverns = [1, 2, 4] mu = 0.80 l = 0.64 end_n_actions = 12000 batch_size = 8000 i...
[ "matplotlib.pyplot.show", "numpy.average", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.transpose", "matplotlib.pyplot.figure", "global_variables.init_global", "simpy.Environment", "matplotlib.pyplot.gca", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((725, 769), 'numpy.zeros', 'np.zeros', (['(n_simulations, end_n_actions + 1)'], {}), '((n_simulations, end_n_actions + 1))\n', (733, 769), True, 'import numpy as np\n'), ((2243, 2255), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2253, 2255), True, 'import matplotlib.pyplot as plt\n'), ((2341, 2366), ...
import os from operator import itemgetter from numpy import random, zeros import numpy as np from scipy.spatial.distance import cosine from scipy.linalg import norm from sklearn.linear_model import LinearRegression, Lasso from math import log import matplotlib.pyplot as plt import pandas as pd def compute_user_rank(...
[ "matplotlib.pyplot.show", "numpy.random.random_sample", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.zeros", "sklearn.linear_model.Lasso", "numpy.random.random", "scipy.linalg.norm", "numpy.dot", "matplotlib.pyplot.ylabel", "math.log", "matplotlib.pyplot.xlabel", "operator.it...
[((3904, 3933), 'numpy.random.random', 'random.random', (['[user_len, 30]'], {}), '([user_len, 30])\n', (3917, 3933), False, 'from numpy import random, zeros\n'), ((3942, 3971), 'numpy.random.random', 'random.random', (['[item_len, 30]'], {}), '([item_len, 30])\n', (3955, 3971), False, 'from numpy import random, zeros\...
import pickle from datetime import timedelta from typing import Callable import numpy as np import pandas as pd from prometheus import get_series parameters = [ "jobs", "cpu", "memory", "io_read", "io_readReal", "io_readSyscalls", "io_write", # "io_writeCancelled", "io_writeReal",...
[ "pickle.dump", "numpy.random.seed", "pandas.DataFrame.from_dict", "prometheus.get_series", "pandas.get_dummies", "numpy.array", "datetime.timedelta", "numpy.random.permutation", "pandas.read_pickle", "pandas.to_numeric", "numpy.repeat" ]
[((837, 878), 'pandas.read_pickle', 'pd.read_pickle', (['fname'], {'compression': '"""gzip"""'}), "(fname, compression='gzip')\n", (851, 878), True, 'import pandas as pd\n'), ((971, 1012), 'pandas.read_pickle', 'pd.read_pickle', (['fname'], {'compression': '"""gzip"""'}), "(fname, compression='gzip')\n", (985, 1012), T...
"""Test regions mouse bindings.""" import collections import numpy as np import pytest from napari.utils.interactions import mouse_move_callbacks, mouse_press_callbacks, mouse_release_callbacks from napari_plot.layers import Region from napari_plot.layers.region.region import Mode, Orientation from napari_plot.utils....
[ "napari.utils.interactions.mouse_press_callbacks", "napari.utils.interactions.mouse_release_callbacks", "napari_plot.layers.Region", "napari_plot.layers.region.region.Mode.keys", "numpy.asarray", "collections.namedtuple", "pytest.mark.parametrize", "napari.utils.interactions.mouse_move_callbacks" ]
[((6040, 6108), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', "['select', 'move', 'add', 'select']"], {}), "('mode', ['select', 'move', 'add', 'select'])\n", (6063, 6108), False, 'import pytest\n'), ((12600, 12685), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""attr"""', "('_move_m...
# -*- coding: utf-8 -*- from __future__ import division __author__ = 'marco.muetze <at> tu-dresden.de' from .helper import check_bounds_and_get_dimension from .prototypes import Mesh import numpy as np from scipy.interpolate import RegularGridInterpolator def calculate_bounds(axes): lower = [] upper = []...
[ "numpy.zeros", "numpy.abs", "numpy.asarray", "numpy.array" ]
[((2576, 2600), 'numpy.array', 'np.array', (['self.bounds[0]'], {}), '(self.bounds[0])\n', (2584, 2600), True, 'import numpy as np\n'), ((2616, 2640), 'numpy.array', 'np.array', (['self.bounds[1]'], {}), '(self.bounds[1])\n', (2624, 2640), True, 'import numpy as np\n'), ((2655, 2671), 'numpy.array', 'np.array', (['offs...
# -*- coding: utf-8 -*- # @Time : 2019/4/16 11:31 # @Author : Anyue # @FileName: preprocess.py # @Software: PyCharm import os import glob from tqdm import tqdm import librosa import numpy as np from hparams import hparam as hp audio_path = glob.glob(os.path.dirname(hp.unprocessed_data)) def save_spectrogram_t...
[ "numpy.abs", "os.makedirs", "numpy.asarray", "os.path.dirname", "librosa.filters.mel", "librosa.core.load", "numpy.dot", "librosa.effects.split", "os.path.join", "os.listdir" ]
[((258, 294), 'os.path.dirname', 'os.path.dirname', (['hp.unprocessed_data'], {}), '(hp.unprocessed_data)\n', (273, 294), False, 'import os\n'), ((386, 432), 'os.makedirs', 'os.makedirs', (['hp.data.train_path'], {'exist_ok': '(True)'}), '(hp.data.train_path, exist_ok=True)\n', (397, 432), False, 'import os\n'), ((437,...
# Let's play some tones! import pyaudio import numpy def noteToFrequency(note): return 27.5 * ((2.0 ** (1.0/12.0)) ** float(note-1)) def playNotes(notes): p = pyaudio.PyAudio() volume = 0.5 sampleRate = 44100 for note in notes: frequency = noteToFrequency(note[0]) print(frequ...
[ "numpy.arange", "pyaudio.PyAudio" ]
[((174, 191), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (189, 191), False, 'import pyaudio\n'), ((366, 400), 'numpy.arange', 'numpy.arange', (['(sampleRate * note[1])'], {}), '(sampleRate * note[1])\n', (378, 400), False, 'import numpy\n')]
from flask import Flask,render_template,request import pickle from sklearn.preprocessing import StandardScaler import numpy as np app = Flask(__name__) model = pickle.load(open("model.pkl","rb")) vehicle_class = {'COMPACT': 0.0, 'SUV - SMALL': 11.0, 'MID-SIZE': 2.0, 'TWO-SEATER': 13.0, 'MINICOMPACT': 3.0, 'SUB...
[ "sklearn.preprocessing.StandardScaler", "flask.Flask", "numpy.array", "flask.render_template", "flask.request.form.items" ]
[((138, 153), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (143, 153), False, 'from flask import Flask, render_template, request\n'), ((1209, 1225), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (1223, 1225), False, 'from sklearn.preprocessing import StandardScaler\n'), ((10...
""" Author: <NAME> Date: 11/13/2017 Inputs: valid file location number of clusters attributes to ignore Outputs: the centroids of the clusters the number of instances in each class the total square error the number iterations that were used to get this result Notes: Runs in python 2.x ""...
[ "copy.deepcopy", "csv.reader", "math.pow", "random.sample", "numpy.array", "numpy.linalg.norm", "numpy.unique" ]
[((1380, 1412), 'numpy.array', 'np.array', (['data'], {'dtype': 'np.float32'}), '(data, dtype=np.float32)\n', (1388, 1412), True, 'import numpy as np\n'), ((1622, 1659), 'numpy.array', 'np.array', (['centroids'], {'dtype': 'np.float32'}), '(centroids, dtype=np.float32)\n', (1630, 1659), True, 'import numpy as np\n'), (...
""" TRAINER Module for training networks <NAME> 2018 """ import importlib import torch from torch.utils import tensorboard from torch import nn import numpy as np from lernomatic.train import schedule from lernomatic.models import common # timing stuff import time from datetime import timedelta # TODO : Update acc...
[ "torch.utils.data.DataLoader", "importlib.import_module", "torch.utils.data.Dataloader", "numpy.copy", "torch.load", "time.time", "torch.save", "datetime.timedelta", "torch.device" ]
[((22263, 22297), 'torch.save', 'torch.save', (['checkpoint_data', 'fname'], {}), '(checkpoint_data, fname)\n', (22273, 22297), False, 'import torch\n'), ((22440, 22457), 'torch.load', 'torch.load', (['fname'], {}), '(fname)\n', (22450, 22457), False, 'import torch\n'), ((22809, 22851), 'importlib.import_module', 'impo...
''' Code used to generate paired data by introducing perturbations to the images in the Celebahq dataset An image translation model learns to generate the reconstructed image from the imperfectly blended face image ''' import sys import os import random from glob import glob from tqdm import tqdm import multiprocess...
[ "torch.cuda.device_count", "cv2.warpAffine", "matplotlib.pyplot.imsave", "glob.glob", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "cv2.getRotationMatrix2D", "random.randint", "torch.load", "numpy.transpose", "concurrent.futures.ThreadPoolExecutor", "cv2.resize", "o...
[((811, 858), 'os.makedirs', 'os.makedirs', (['perturbed_image_dir'], {'exist_ok': '(True)'}), '(perturbed_image_dir, exist_ok=True)\n', (822, 858), False, 'import os\n'), ((952, 977), 'torch.cuda.device_count', 'torch.cuda.device_count', ([], {}), '()\n', (975, 977), False, 'import torch\n'), ((449, 480), 'os.path.joi...
# %% [markdown] ''' # STEP2 - Embed Samples into Latent Space as Points - Objective: Create LS with good similiarity dispersion, both globally & locally - Hyperparams: hparams = {'epochs': [40], 'image_size': [64,128,256], 'latent_dim': [64,128,256]} - Metrics: Reconstruction error (MSE loss comparing before/after...
[ "matplotlib.pyplot.title", "wandb.log", "numpy.random.seed", "wandb.watch", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.exp", "torch.no_grad", "numpy.unique", "pandas.DataFrame", "matplotlib.pyplot.axvline", "torch.set_deterministic", "t...
[((1301, 1326), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1324, 1326), False, 'import torch\n'), ((1429, 1458), 'torch.set_deterministic', 'torch.set_deterministic', (['(True)'], {}), '(True)\n', (1452, 1458), False, 'import torch\n'), ((1538, 1555), 'random.seed', 'random.seed', (['seed'...
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import projection_funcs as pf import policy_tools as pt import inspect from pprint import pprint profs_table={'prof1':'c:/Users/groberta/Work/data_accelerator/profiles/prof1.csv', 'prof_old': "c:/Users/groberta/Work/data_accelerator/profiles/p...
[ "projection_funcs.get_forecast", "numpy.ones", "numpy.isnan", "policy_tools.Shed", "numpy.arange", "pprint.pprint", "pandas.DataFrame", "numpy.multiply", "numpy.genfromtxt", "numpy.insert", "projection_funcs.get_forecast1", "numpy.append", "pandas.Period", "policy_tools.make_shape1", "nu...
[((2303, 2335), 'projection_funcs.mov_ave', 'pf.mov_ave', (['in_arr', '_ma_interval'], {}), '(in_arr, _ma_interval)\n', (2313, 2335), True, 'import projection_funcs as pf\n'), ((10545, 10565), 'projection_funcs.mov_ave', 'pf.mov_ave', (['prod', '(12)'], {}), '(prod, 12)\n', (10555, 10565), True, 'import projection_func...
# a data wrapper to iterate over large matrices in numpy import numpy as np # random, unlimited number of access to the corresponding data class RandomAccessData(object): def __init__(self, data): self.data = data self.lens = len(self.data) def next(self, rng, batchsize): ll = rng.cho...
[ "numpy.random.seed", "numpy.arange", "numpy.random.shuffle" ]
[((2236, 2265), 'numpy.arange', 'np.arange', (['self.semi_data_len'], {}), '(self.semi_data_len)\n', (2245, 2265), True, 'import numpy as np\n'), ((2274, 2305), 'numpy.random.shuffle', 'np.random.shuffle', (['semi_indices'], {}), '(semi_indices)\n', (2291, 2305), True, 'import numpy as np\n'), ((586, 612), 'numpy.rando...
import sys, os import Swing import pandas as pd import numpy as np from Swing.util.Evaluator import Evaluator import warnings import Swing.util.utility_module as Rutil import pdb class Analyzer: """ Analyzer is a object that analyzes groups of Rollers. Figures out the completeness if your experiment. Chec...
[ "pandas.DataFrame", "numpy.median", "pandas.read_csv", "Swing.util.utility_module.average_rank", "numpy.max", "Swing.util.Evaluator.Evaluator", "pandas.read_pickle", "os.listdir" ]
[((865, 879), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (877, 879), True, 'import pandas as pd\n'), ((5319, 5385), 'Swing.util.utility_module.average_rank', 'Rutil.average_rank', (['top_ranked_lists'], {'col_string': '"""importance_rank"""'}), "(top_ranked_lists, col_string='importance_rank')\n", (5337, 538...
import tensorflow as tf import numpy as np import random from model.transformer_utils import create_mel_padding_mask, create_mel_random_padding_mask, create_encoder_padding_mask from utils.losses import weighted_sum_losses, masked_mean_absolute_error, ctc_loss, amsoftmax_loss from data.text import TextToTokens from mo...
[ "tensorflow.keras.layers.Dense", "data.text.TextToTokens.default", "numpy.random.normal", "model.layers.Expand", "random.randint", "model.layers.SelfAttentionBlocksWithIN", "model.layers.SelfAttentionBlocks", "tensorflow.cast", "tensorflow.squeeze", "tensorflow.keras.layers.Embedding", "model.tr...
[((1286, 1374), 'data.text.TextToTokens.default', 'TextToTokens.default', (['english_lexicon_path', 'pinyin_lexicon_path'], {'add_start_end': '(False)'}), '(english_lexicon_path, pinyin_lexicon_path,\n add_start_end=False)\n', (1306, 1374), False, 'from data.text import TextToTokens\n'), ((1569, 1639), 'tensorflow.k...
import numpy as np from datetime import datetime from math import factorial import os import glob import logging import seaborn as sns import pandas as pd import warnings # Share logger between modules - TODO: Create another logger ## Import this module only after creating logger from `ssa_routine` logger = logging.ge...
[ "os.mkdir", "numpy.load", "numpy.argsort", "numpy.savez_compressed", "numpy.exp", "glob.glob", "os.path.join", "numpy.unique", "pandas.DataFrame", "numpy.isfinite", "numpy.cumsum", "numpy.int", "warnings.catch_warnings", "numpy.linspace", "numpy.random.choice", "datetime.datetime.now",...
[((310, 342), 'logging.getLogger', 'logging.getLogger', (['"""ssa_routine"""'], {}), "('ssa_routine')\n", (327, 342), False, 'import logging\n'), ((1020, 1068), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'df.columns', 'index': 'df.index'}), '(columns=df.columns, index=df.index)\n', (1032, 1068), True, 'import...
# -*- coding: utf-8 -*- """This file contains functions which can be used to model the behavior of flocs based on the chemical interactions of clay, coagulant, and humic acid. """ ######################### Imports ######################### import numpy as np from aide_design import utility as ut from aide_design.unit...
[ "aide_design.units.unit_registry.wraps", "numpy.log2", "numpy.log10", "aide_design.physchem.density_water", "aide_design.units.unit_registry.enable_contexts", "aide_design.physchem.viscosity_kinematic" ]
[((388, 413), 'aide_design.units.unit_registry.enable_contexts', 'u.enable_contexts', (['"""chem"""'], {}), "('chem')\n", (405, 413), True, 'from aide_design.units import unit_registry as u\n'), ((2811, 2848), 'aide_design.units.unit_registry.wraps', 'u.wraps', (['(u.kg / u.m ** 3)', 'None', '(False)'], {}), '(u.kg / u...
import time from threading import Thread import numpy as np import gym from gym import spaces, logger import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt plt.style.use(['fivethirtyeight', 'seaborn-whitegrid', 'seaborn-ticks']) from matplotlib import rcParams from matplotlib import gridspec import...
[ "numpy.random.uniform", "numpy.abs", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "matplotlib.rcParams.update", "numpy.clip", "matplotlib.pyplot.style.use", "matplotlib.use", "numpy.array", "gym.spaces.Box", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.ylabel", "matplotlib.p...
[((130, 144), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (137, 144), True, 'import matplotlib as mpl\n'), ((177, 249), 'matplotlib.pyplot.style.use', 'plt.style.use', (["['fivethirtyeight', 'seaborn-whitegrid', 'seaborn-ticks']"], {}), "(['fivethirtyeight', 'seaborn-whitegrid', 'seaborn-ticks'])\n",...
import numpy as np import pickle import cvxopt allNodes, edges, equalityPairs, layer, name2ind = [], [], [], dict(), dict() Cu, Cl = None, None ''' This is all python2.7 (don't judge me please) I had to unpickle your pickles and pickle them again in a way that python2.7 can read them. I guess you can just run this ...
[ "cvxopt.matrix", "numpy.zeros", "numpy.ones", "pickle.load", "numpy.array", "cvxopt.solvers.qp" ]
[((1960, 1980), 'numpy.zeros', 'np.zeros', (['(nrNodes,)'], {}), '((nrNodes,))\n', (1968, 1980), True, 'import numpy as np\n'), ((1990, 2010), 'numpy.zeros', 'np.zeros', (['(nrNodes,)'], {}), '((nrNodes,))\n', (1998, 2010), True, 'import numpy as np\n'), ((2582, 2598), 'cvxopt.matrix', 'cvxopt.matrix', (['A'], {}), '(A...
import numpy as np from numpy import pi as pi64 from jax import numpy as jnp from jax.config import config config.update('jax_enable_x64', True) __all__ = [ 'thermal_phase_curve', 'reflected_phase_curve', 'reflected_phase_curve_inhomogeneous' ] floatX = 'float32' pi = np.cast[floatX](pi64) h = np.cast[fl...
[ "numpy.abs", "jax.numpy.expm1", "numpy.argsort", "numpy.sin", "jax.numpy.where", "jax.numpy.abs", "jax.numpy.sin", "jax.config.config.update", "jax.numpy.sum", "jax.numpy.asarray", "jax.numpy.cos", "jax.numpy.tan", "jax.numpy.argsort", "jax.numpy.log", "jax.numpy.arange", "jax.numpy.ma...
[((107, 144), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (120, 144), False, 'from jax.config import config\n'), ((671, 717), 'jax.numpy.arange', 'jnp.arange', (['start', '(stop + dx)', 'dx'], {'dtype': 'floatX'}), '(start, stop + dx, dx, dtype=fl...
# Cazoo - 2021-06-12 # This code is free to use and re-distribute, but I cannot be held responsible for damages that it may or may not cause. ##################### from typing import List import re import os import json import copy ## copy.deepcopy import kkpmx_core as kklib import kkpmx_utils as util t...
[ "os.mkdir", "kkpmx_utils.ask_yes_no", "json.dumps", "os.path.isfile", "kkpmx_utils.main_starter", "os.path.join", "kkpmx_core.end", "nuthouse01_core.MY_GENERAL_INPUT_FUNC", "cv2.imwrite", "os.path.exists", "re.escape", "kkpmx_utils.load_json_file", "numpy.linspace", "re.search", "re.sub"...
[((5328, 5358), 'os.path.split', 'os.path.split', (['input_file_name'], {}), '(input_file_name)\n', (5341, 5358), False, 'import os\n'), ((5468, 5508), 'os.path.join', 'os.path.join', (['root', '"""#generateJSON.json"""'], {}), "(root, '#generateJSON.json')\n", (5480, 5508), False, 'import os\n'), ((6004, 6039), 'kkpmx...
import numpy.random as npr RANDOM_SEED = 5 class Person: def __init__(self, name): self.name = name # 自分の名前 # 到着するまでの時間を指数分布で与える。 expected_1 = 30.0 lam_1 = 1.0 / expected_1 # 期待値=1/lam self.arrive_time = npr.exponential(1. / lam_1) # 用を足すのにかかる時間をアーラン分布で与える。 ...
[ "numpy.random.gamma", "numpy.random.exponential", "numpy.random.seed" ]
[((1508, 1529), 'numpy.random.seed', 'npr.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (1516, 1529), True, 'import numpy.random as npr\n'), ((253, 281), 'numpy.random.exponential', 'npr.exponential', (['(1.0 / lam_1)'], {}), '(1.0 / lam_1)\n', (268, 281), True, 'import numpy.random as npr\n'), ((471, 496), 'numpy.r...
import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim from mobilenetv2 import backbone from utils import apply_bilateral_grid from tensorflow.python.framework import graph_util def get_tensor_shape(x): a = x.get_shape().as_list() b = [tf.shape(x)[i] for i in range(len(a))] retu...
[ "tensorflow.clip_by_value", "tensorflow.constant_initializer", "tensorflow.reshape", "numpy.tile", "tensorflow.split", "utils.apply_bilateral_grid", "tensorflow.get_variable", "tensorflow.nn.relu6", "numpy.random.randn", "tensorflow.variable_scope", "numpy.identity", "tensorflow.placeholder", ...
[((7022, 7068), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[1, 1024, 1024, 3]'], {}), '(tf.float32, [1, 1024, 1024, 3])\n', (7036, 7068), True, 'import tensorflow as tf\n'), ((488, 511), 'tensorflow.variable_scope', 'tf.variable_scope', (['name'], {}), '(name)\n', (505, 511), True, 'import tensorflow ...
import os import sys import unittest import numpy as np from scipy.io import mmread from scipy.linalg import det sys.path.append("../src") from qr import QR import utility as ut from variables import * class TestQR(unittest.TestCase): @unittest.skip("Skipping complex random matrix tests because of floating point ...
[ "sys.path.append", "unittest.main", "numpy.trace", "numpy.sum", "utility.complex_matrix", "unittest.skip", "qr.QR", "numpy.linalg.matrix_power", "numpy.linalg.det", "numpy.prod" ]
[((115, 140), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (130, 140), False, 'import sys\n'), ((242, 351), 'unittest.skip', 'unittest.skip', (['"""Skipping complex random matrix tests because of floating point precision problems."""'], {}), "(\n 'Skipping complex random matrix tests...
#The script uses the neurons selected for the test dataset (datasets_to_test) #to evaluate the performance of the model 'model'. # #The evaluation is based on the correlation coefficient of ground truth and #prediction, both of them downsampled to 25 Hz, as for the evaluation via #spikefinder.codeneuro.org. # #performa...
[ "numpy.median", "numpy.corrcoef", "numpy.zeros", "numpy.ones", "numpy.mean" ]
[((870, 887), 'numpy.zeros', 'np.zeros', (['[10, 1]'], {}), '([10, 1])\n', (878, 887), True, 'import numpy as np\n'), ((2294, 2316), 'numpy.median', 'np.median', (['Performance'], {}), '(Performance)\n', (2303, 2316), True, 'import numpy as np\n'), ((1248, 1309), 'numpy.zeros', 'np.zeros', (['(number_of_points, windows...
import copy import torch import logging import numpy as np from sacred import Experiment from noge.data_loaders import get_datasets, get_test_loader, get_train_generator from noge.factory import make_env, make_memory from noge.network import make_network from noge.neural import DFPRegressionLoss from noge.agent import...
[ "noge.preprocessors.Preprocessor", "noge.constants.EVAL_DIR.absolute", "torch.device", "noge.data_loaders.get_test_loader", "numpy.set_printoptions", "xlog.utils.get_logger", "noge.data_loaders.get_datasets", "sacred.Experiment", "noge.evaluation.Evaluator", "noge.policies.GraphDFPPolicy", "copy...
[((682, 743), 'sacred.Experiment', 'Experiment', ([], {'name': '"""NOGE_DFP"""', 'ingredients': '[eval_ing, loop_ing]'}), "(name='NOGE_DFP', ingredients=[eval_ing, loop_ing])\n", (692, 743), False, 'from sacred import Experiment\n'), ((843, 883), 'xlog.utils.get_logger', 'get_logger', (['__name__'], {'level': 'logging....
import pandas as pd import pandas_datareader as pdr import numpy as np import matplotlib.pyplot as plt import ipywidgets as widgets ## Data import and cleaning # a. Import of enviromental data form the OECD statistics bank API df = pdr.DataReader("AIR_GHG","oecd") df.head() # b. Import of locally placed OECD data on ...
[ "pandas_datareader.DataReader", "pandas.DataFrame", "matplotlib.pyplot.axhline", "numpy.nansum", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots" ]
[((233, 266), 'pandas_datareader.DataReader', 'pdr.DataReader', (['"""AIR_GHG"""', '"""oecd"""'], {}), "('AIR_GHG', 'oecd')\n", (247, 266), True, 'import pandas_datareader as pdr\n'), ((336, 364), 'pandas.read_csv', 'pd.read_csv', (['"""oecdwages.csv"""'], {}), "('oecdwages.csv')\n", (347, 364), True, 'import pandas as...
import numpy as np import pandas as pd import statsmodels.api as sm import asym_io def pred_fold(X, coefs): return coefs[0] + coefs[1] * X def linear_fit(X, Y): X = sm.add_constant(X) mod = sm.OLS(Y, X) return mod.fit() def linear_fit_with_ci(X, Y, ci=0.05): res = linear_fit(X, Y) fit_c...
[ "statsmodels.api.OLS", "asym_io.load_acpro", "asym_io.load_pfdb", "statsmodels.api.add_constant", "numpy.log10" ]
[((180, 198), 'statsmodels.api.add_constant', 'sm.add_constant', (['X'], {}), '(X)\n', (195, 198), True, 'import statsmodels.api as sm\n'), ((209, 221), 'statsmodels.api.OLS', 'sm.OLS', (['Y', 'X'], {}), '(Y, X)\n', (215, 221), True, 'import statsmodels.api as sm\n'), ((507, 524), 'numpy.log10', 'np.log10', (['pfdb[X]'...
""" Advanced Lane Detection Term 1 Self Driving Car NanoDegree """ # Pipeline for Advance Lane Detection # Importing Dependencies import sys import cv2 from PIL import Image import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import glob from moviepy.editor import VideoFileClip from IP...
[ "matplotlib.image.imread", "numpy.zeros_like", "cv2.findChessboardCorners", "numpy.load", "moviepy.editor.VideoFileClip", "cv2.cvtColor", "numpy.zeros", "line_detector.LineDetector", "cv2.calibrateCamera", "glob.glob", "numpy.arctan", "numpy.savez", "cv2.Sobel" ]
[((683, 703), 'glob.glob', 'glob.glob', (['image_url'], {}), '(image_url)\n', (692, 703), False, 'import glob\n'), ((732, 764), 'numpy.zeros', 'np.zeros', (['(6 * 9, 3)', 'np.float32'], {}), '((6 * 9, 3), np.float32)\n', (740, 764), True, 'import numpy as np\n'), ((1558, 1628), 'cv2.calibrateCamera', 'cv2.calibrateCame...
# -*- coding: utf-8 -*- """ RLBook.Chapter8.TicTacToe Tic Tac Toe game implementation """ from itertools import cycle import numpy as np from RLBook.Chapter8.DefaultPlayers import DEFAULT_PLAYERS class Game: """ TicTacToe game implementation to be used by Monte Carlo Tree Search https://en.wikipedia....
[ "numpy.isin", "numpy.sum", "numpy.zeros", "numpy.array", "numpy.argwhere", "itertools.cycle", "numpy.diag" ]
[((1196, 1241), 'numpy.zeros', 'np.zeros', (['(board_size, board_size)'], {'dtype': 'int'}), '((board_size, board_size), dtype=int)\n', (1204, 1241), True, 'import numpy as np\n'), ((1292, 1304), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1300, 1304), True, 'import numpy as np\n'), ((1498, 1517), 'itertools.cy...
from abc import ABC, abstractmethod import logging import math import os import re import subprocess import tempfile import time from typing import List import numpy as np log = logging.getLogger(__name__) class CostScaler: """ Serves to scale floats and converts them into integers (and vice versa) whilst ...
[ "subprocess.Popen", "os.unlink", "math.pow", "tempfile.mkstemp", "time.time", "numpy.array", "os.close", "numpy.log10", "re.search", "logging.getLogger" ]
[((181, 208), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (198, 208), False, 'import logging\n'), ((5356, 5380), 're.search', 're.search', (['regex', 'output'], {}), '(regex, output)\n', (5365, 5380), False, 'import re\n'), ((5691, 5709), 'numpy.array', 'np.array', (['flatList'], {}), ...
import pandas as pd, os import seaborn as sns, matplotlib.pyplot as plt, numpy as np sns.set_style('darkgrid') base = '../data/codedtruth' dfdict = {x[:-4]:pd.read_csv(f'{base}/{x}') for x in os.listdir(base) if x.endswith('.csv') and 'coded' not in x} plt.rcParams['figure.figsize'] = 4, 2 plt.rcParams.upd...
[ "pandas.DataFrame", "seaborn.set_style", "matplotlib.pyplot.xlim", "pandas.read_csv", "matplotlib.pyplot.legend", "matplotlib.pyplot.rcParams.update", "numpy.arange", "pandas.Categorical", "matplotlib.pyplot.gca", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.ylabel", "matplotlib.pyp...
[((85, 110), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (98, 110), True, 'import seaborn as sns, matplotlib.pyplot as plt, numpy as np\n'), ((304, 342), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 14}"], {}), "({'font.size': 14})\n", (323, 342), Tr...
import numpy as np from scipy.linalg import kron from IPython.display import Markdown as md spin_up = np.array([[1, 0]]).T spin_down = np.array([[0, 1]]).T # bit[0] = |0>, bit[1] = |1> bit = [spin_up, spin_down] def basis(string='00010'): '''string: the qubits sequence''' res = np.array([[1]]) ...
[ "numpy.matrix", "numpy.array" ]
[((109, 127), 'numpy.array', 'np.array', (['[[1, 0]]'], {}), '([[1, 0]])\n', (117, 127), True, 'import numpy as np\n'), ((143, 161), 'numpy.array', 'np.array', (['[[0, 1]]'], {}), '([[0, 1]])\n', (151, 161), True, 'import numpy as np\n'), ((302, 317), 'numpy.array', 'np.array', (['[[1]]'], {}), '([[1]])\n', (310, 317),...
import numpy as np from sk_dsp_comm import digitalcom as dc from . caf_verilog_base import CafVerilogBase from . xcorr import XCorr from . reference_buffer import ReferenceBuffer from . capture_buffer import CaptureBuffer from . freq_shift import FreqShift from . __version__ import __version__ from jinja2 import Enviro...
[ "numpy.abs", "sk_dsp_comm.digitalcom.xcorr", "numpy.zeros", "jinja2.Environment", "numpy.arange", "numpy.log10", "os.path.join", "shutil.copy" ]
[((6772, 6786), 'numpy.zeros', 'np.zeros', (['ztup'], {}), '(ztup)\n', (6780, 6786), True, 'import numpy as np\n'), ((6818, 6836), 'numpy.arange', 'np.arange', (['(0)', 'nlen'], {}), '(0, nlen)\n', (6827, 6836), True, 'import numpy as np\n'), ((4932, 4966), 'shutil.copy', 'copy', (['params_path', 'self.output_dir'], {}...
from __future__ import absolute_import, division, unicode_literals import sys import os import torch import logging import numpy as np from torch import nn np.set_printoptions(precision=4) np.set_printoptions(suppress=True) # get models.py from InferSent repo from models import InferSent # Set PATHs PATH_SENTEVAL = ...
[ "numpy.set_printoptions", "numpy.abs", "models.InferSent", "torch.load", "torch.FloatTensor", "sys.path.insert", "os.path.isfile", "senteval.utils.dotdict", "torch.nn.Softmax", "torch.nn.Linear" ]
[((158, 190), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)'}), '(precision=4)\n', (177, 190), True, 'import numpy as np\n'), ((191, 225), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (210, 225), True, 'import numpy as np\n'), ((657, 690)...
""" filter_var_in_file.py load variable in a given netCDF file containing time series on sigma level (variable shape 1, Ny, Nx, Nt), compute and store filtered and averaged fields create a netCDF and copy most of the dimensions and dimension variables from the original will store a subsampled version of the filtered f...
[ "netCDF4.Dataset", "scipy.signal.filtfilt", "datetime.date.today", "time.clock", "time.time", "def_chunk.get_indchk", "numpy.diff", "numpy.arange", "numpy.rollaxis", "scipy.signal.butter", "numpy.nanmean" ]
[((1496, 1518), 'netCDF4.Dataset', 'Dataset', (['pathstor', '"""w"""'], {}), "(pathstor, 'w')\n", (1503, 1518), False, 'from netCDF4 import Dataset\n'), ((3457, 3480), 'def_chunk.get_indchk', 'get_indchk', (['Ni', 'nchunks'], {}), '(Ni, nchunks)\n', (3467, 3480), False, 'from def_chunk import get_indchk\n'), ((3592, 36...
# -*- coding: utf-8 -*- """This module contains the class Network.""" import logging from typing import Dict, List, Optional import numpy as np from igraph import Graph, Vertex, VertexSeq from .gene import Gene __all__ = [ 'Network', ] logger = logging.getLogger(__name__) class Network: """Encapsulate a...
[ "numpy.array", "logging.getLogger" ]
[((255, 282), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (272, 282), False, 'import logging\n'), ((7974, 8013), 'numpy.array', 'np.array', (['self.graph.vs[attribute_name]'], {}), '(self.graph.vs[attribute_name])\n', (7982, 8013), True, 'import numpy as np\n')]
import numpy as np from Bio import Phylo import networkx as nx def tree_to_newick_fun_test(tree_set): tree_set_type = [nx.bfs_tree(G, 0) for G in tree_set] Phylo.write(tree_set_type, "tree_set.xml", "phyloxml") Phylo.convert("tree_set.xml", "phyloxml", "tree_set_newick.nhx", "newick") return "tree_set...
[ "Bio.Phylo.convert", "Bio.Phylo.write", "numpy.round", "networkx.bfs_tree" ]
[((166, 220), 'Bio.Phylo.write', 'Phylo.write', (['tree_set_type', '"""tree_set.xml"""', '"""phyloxml"""'], {}), "(tree_set_type, 'tree_set.xml', 'phyloxml')\n", (177, 220), False, 'from Bio import Phylo\n'), ((225, 299), 'Bio.Phylo.convert', 'Phylo.convert', (['"""tree_set.xml"""', '"""phyloxml"""', '"""tree_set_newic...
#!/usr/bin/python3 """ @Author: <NAME> @Site: https://github.com/liushaoweihua """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import json import numpy as np import tensorflow as tf from pyclue.tf1.open_sources.configs import pretrained_nam...
[ "pyclue.tf1.open_sources.download.get_pretrained_model", "os.path.abspath", "json.load", "tensorflow.gfile.Exists", "pyclue.tf1.tokenizers.bert_tokenizer.FullTokenizer", "tensorflow.gfile.MakeDirs", "tensorflow.Session", "pyclue.tf1.tasks.sentence_pair.siamese.inputs.Processor", "tensorflow.gfile.GF...
[((651, 678), 'os.path.abspath', 'os.path.abspath', (['model_file'], {}), '(model_file)\n', (666, 678), False, 'import os\n'), ((729, 784), 'os.path.join', 'os.path.join', (['self.model_file', '"""label_map_reverse.json"""'], {}), "(self.model_file, 'label_map_reverse.json')\n", (741, 784), False, 'import os\n'), ((107...
'''''' ''' @Author: <NAME> (<EMAIL>) @Date: 2020-03-01 @Copyright: Copyright (C) <NAME> 2020. All rights reserved. Please refer to the license file. @LastEditTime: 2020-05-27 @LastEditors: <NAME> @Description: This file contains functions related to GRIC computation ''' import numpy as np def compute_fundamental_res...
[ "numpy.sum", "numpy.log", "numpy.zeros", "numpy.transpose", "numpy.ones", "numpy.sin", "numpy.cos", "numpy.arccos", "numpy.sqrt" ]
[((661, 687), 'numpy.ones', 'np.ones', (['(3, kp1.shape[0])'], {}), '((3, kp1.shape[0]))\n', (668, 687), True, 'import numpy as np\n'), ((701, 726), 'numpy.transpose', 'np.transpose', (['kp1', '(1, 0)'], {}), '(kp1, (1, 0))\n', (713, 726), True, 'import numpy as np\n'), ((735, 761), 'numpy.ones', 'np.ones', (['(3, kp2....
import numpy as np from models.k_means import KMeans class GMM: """Implementes Gaussian Mixture Model fitted with EM algorithm. Similar to K-means, iteratively adjusts the clusters to match better the points belonging to them and then recompute which points belong to what cluster. In this case the clu...
[ "numpy.sum", "numpy.zeros", "numpy.linalg.norm", "models.k_means.KMeans", "numpy.matmul", "numpy.linalg.det", "numpy.linalg.pinv" ]
[((2290, 2319), 'numpy.zeros', 'np.zeros', (['(n_samples, self.k)'], {}), '((n_samples, self.k))\n', (2298, 2319), True, 'import numpy as np\n'), ((3223, 3247), 'numpy.linalg.pinv', 'np.linalg.pinv', (['variance'], {}), '(variance)\n', (3237, 3247), True, 'import numpy as np\n'), ((2556, 2588), 'numpy.sum', 'np.sum', (...
''' 1. Module Import ''' import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F from torchvision import transforms, datasets ''' 2. 딥러닝 모델을 설계할 때 활용하는 장비 확인 ''' if torch.cuda.is_available(): DEVICE = torch.device('cuda') else: DEVICE = torch.devi...
[ "matplotlib.pyplot.subplot", "torch.nn.MSELoss", "matplotlib.pyplot.show", "torch.nn.ReLU", "torch.utils.data.DataLoader", "matplotlib.pyplot.axis", "torch.nn.Linear", "matplotlib.pyplot.figure", "torch.cuda.is_available", "numpy.reshape", "torch.device", "torch.no_grad", "matplotlib.pyplot....
[((230, 255), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (253, 255), False, 'import torch\n'), ((933, 1024), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', ([], {'dataset': 'train_dataset', 'batch_size': 'BATCH_SIZE', 'shuffle': '(True)'}), '(dataset=train_dataset, batch_size...
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "numpy.zeros", "numpy.sum", "numpy.clip" ]
[((3209, 3237), 'numpy.zeros', 'np.zeros', (['horizon', '"""float32"""'], {}), "(horizon, 'float32')\n", (3217, 3237), True, 'import numpy as np\n'), ((3252, 3280), 'numpy.zeros', 'np.zeros', (['horizon', '"""float32"""'], {}), "(horizon, 'float32')\n", (3260, 3280), True, 'import numpy as np\n'), ((3294, 3322), 'numpy...
#!/usr/bin/env python # coding: utf-8 # ## 卷积神经网络(Convolutional Neural Network, CNN) # # ## 项目:实现一个狗品种识别算法App # # 在这个notebook文件中,有些模板代码已经提供给你,但你还需要实现更多的功能来完成这个项目。除非有明确要求,你无须修改任何已给出的代码。以**'(练习)'**开始的标题表示接下来的代码部分中有你需要实现的功能。这些部分都配有详细的指导,需要实现的部分也会在注释中以'TODO'标出。请仔细阅读所有的提示。 # # 除了实现代码外,你还**需要**回答一些与项目及代码相关的问题。每个需要回答的问题都会...
[ "keras.preprocessing.image.ImageDataGenerator", "numpy.load", "numpy.argmax", "random.shuffle", "keras.preprocessing.image.img_to_array", "cv2.rectangle", "glob.glob", "sklearn.datasets.load_files", "cv2.cvtColor", "matplotlib.pyplot.imshow", "keras.layers.GlobalAveragePooling2D", "keras.prepr...
[((3154, 3174), 'random.seed', 'random.seed', (['(8675309)'], {}), '(8675309)\n', (3165, 3174), False, 'import random\n'), ((3240, 3267), 'random.shuffle', 'random.shuffle', (['human_files'], {}), '(human_files)\n', (3254, 3267), False, 'import random\n'), ((3900, 3969), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier'...
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in complian...
[ "pytorch_lightning.Trainer", "monai.transforms.AddChanneld", "pandas.read_csv", "torch.argmax", "bisImgSeg.utilities.modelObjects.concatFunctionArguments", "torch.cuda.device_count", "pathlib.Path", "torch.no_grad", "os.path.join", "monai.transforms.Orientationd", "numpy.prod", "pandas.DataFra...
[((6344, 6378), 'pandas.read_csv', 'pd.read_csv', (['PATH'], {'index_col': '(False)'}), '(PATH, index_col=False)\n', (6355, 6378), True, 'import pandas as pd\n'), ((15228, 15349), 'pytorch_lightning.Trainer', 'pytorch_lightning.Trainer', ([], {'gpus': '[gpuidx]', 'logger': 'logL[0]', 'checkpoint_callback': 'logL[1]', '...
# ---------------------------------------------------------------------------- # Copyright (c) 2016--, Calour development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # -----------------------------------------------...
[ "unittest.main", "numpy.testing.assert_array_equal", "calour._testing.assert_experiment_equal", "calour.read", "numpy.all", "numpy.random.RandomState", "calour.filtering._balanced_subsample", "numpy.unique" ]
[((11414, 11420), 'unittest.main', 'main', ([], {}), '()\n', (11418, 11420), False, 'from unittest import main\n'), ((668, 742), 'calour.read', 'ca.read', (['self.test2_biom', 'self.test2_samp', 'self.test2_feat'], {'normalize': 'None'}), '(self.test2_biom, self.test2_samp, self.test2_feat, normalize=None)\n', (675, 74...
import sys import numpy as np def readfile(Basedir,allquery): featuresize=len(allquery) featureDic={} for feature in allquery: Susfile=Basedir+feature+'.txt' with open(Susfile) as myfile: for line in myfile: items=line.split(" ") Method=items[0] ...
[ "numpy.zeros" ]
[((474, 495), 'numpy.zeros', 'np.zeros', (['featuresize'], {}), '(featuresize)\n', (482, 495), True, 'import numpy as np\n')]
#!/usr/bin/env python import pytest from pytest import approx from math import radians, nan import numpy as np import pymap3d as pm lla0 = (42, -82, 200) rlla0 = (radians(lla0[0]), radians(lla0[1]), lla0[2]) lla1 = (42.002582, -81.997752, 1.1397018e3) rlla1 = (np.radians(lla1[0]), np.radians(lla1[1]), lla1[2]) xyz0 ...
[ "numpy.empty", "pytest.main", "pymap3d.aer2geodetic", "pytest.mark.parametrize", "pymap3d.ecef2geodetic", "pymap3d.ecef2enu", "pymap3d.Ellipsoid", "math.radians", "pytest.raises", "pymap3d.enu2ecef", "numpy.stack", "numpy.radians", "pymap3d.geodetic2aer", "pytest.approx", "pytest.importo...
[((476, 490), 'pymap3d.Ellipsoid', 'pm.Ellipsoid', ([], {}), '()\n', (488, 490), True, 'import pymap3d as pm\n'), ((4115, 4346), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lla, xyz"""', '[((0, 0, -1), (A - 1, 0, 0)), ((0, 90, -1), (0, A - 1, 0)), ((0, -90, -1),\n (0, -A + 1, 0)), ((90, 0, -1), (0, 0...
from __future__ import print_function, division, absolute_import import numpy as np def valueFormat(value_format, value, unc_format, unc, std_name, multi=None, deg=False, callable_val=None, \ callable_ci=None): """ Returns the formatted value with an uncertanty an confidence interval, if the uncertanty is gi...
[ "numpy.degrees" ]
[((1327, 1342), 'numpy.degrees', 'np.degrees', (['(1.0)'], {}), '(1.0)\n', (1337, 1342), True, 'import numpy as np\n')]
import re import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.feature_extraction.text import CountVectorizer from keras.preprocessing.text import Tokenizer LIMIT = 2 def cut(x, voc): return " ".join([w if w in voc else "rareword" for w in x.split(" ")]) def numbe...
[ "sklearn.feature_extraction.text.CountVectorizer", "pandas.merge", "sklearn.preprocessing.LabelEncoder", "numpy.hstack", "re.findall", "keras.preprocessing.text.Tokenizer" ]
[((350, 374), 're.findall', 're.findall', (['"""\\\\d\\\\d+"""', 'x'], {}), "('\\\\d\\\\d+', x)\n", (360, 374), False, 'import re\n'), ((507, 518), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {}), '()\n', (516, 518), False, 'from keras.preprocessing.text import Tokenizer\n'), ((1331, 1382), 'sklearn.feature...
import numpy as np def convert_time_to_timebin(time_in_sec,binsize_in_sec): timebin = np.round(time_in_sec/binsize_in_sec) return timebin def realign_data(align_time_in_bins,length_time_in_bins,data): maxtime = data.shape[-1] newshape = data.shape[:-1] newshape+=(length_time_in_bins,) newdata = np.empty(new...
[ "numpy.zeros", "numpy.empty", "numpy.round" ]
[((88, 126), 'numpy.round', 'np.round', (['(time_in_sec / binsize_in_sec)'], {}), '(time_in_sec / binsize_in_sec)\n', (96, 126), True, 'import numpy as np\n'), ((308, 326), 'numpy.empty', 'np.empty', (['newshape'], {}), '(newshape)\n', (316, 326), True, 'import numpy as np\n'), ((343, 378), 'numpy.zeros', 'np.zeros', (...
import os import json from collections import OrderedDict, Counter from operator import itemgetter import logging from pathlib import Path import pandas as pd pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 1000) pd.set_option('display.width', 100000) import re import json import numpy...
[ "datetime.datetime.strftime", "pandas.read_csv", "corpus.corpus_emerge_xray.CorpusEmergeXray", "logging.warn", "re.match", "corpus.document.Document", "numpy.isnan", "pandas.read_excel", "logging.info", "datetime.datetime.strptime", "re.sub", "collections.OrderedDict", "pandas.set_option", ...
[((165, 203), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (178, 203), True, 'import pandas as pd\n'), ((204, 246), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(1000)'], {}), "('display.max_columns', 1000)\n", (217, 246), True,...
import numpy as np class CliqueVector(dict): """ This is a convenience class for simplifying arithmetic over the concatenated vector of marginals and potentials. These vectors are represented as a dictionary mapping cliques (subsets of attributes) to marginals/potentials (Factor objects) ...
[ "numpy.isscalar" ]
[((2331, 2349), 'numpy.isscalar', 'np.isscalar', (['other'], {}), '(other)\n', (2342, 2349), True, 'import numpy as np\n')]
# -*- coding:utf-8 -*- import numpy as np import matplotlib.pyplot as plt class Windy_Grid_World(object): def __init__(self, epsilon=0.1, step_size=0.5, discount=1): self.world_size = (7, 10) # first number is row, second number is column self.num_action = 4 # the number of actions ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.close", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.max", "numpy.arange", "numpy.array", "numpy.random.choice", "numpy.random.rand", "matplotlib.pyplot.ylabel", "numpy.add.accumulate", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ...
[((2897, 3001), 'numpy.zeros', 'np.zeros', (['(windy_grid_word.num_action, windy_grid_word.world_size[0], windy_grid_word\n .world_size[1])'], {}), '((windy_grid_word.num_action, windy_grid_word.world_size[0],\n windy_grid_word.world_size[1]))\n', (2905, 3001), True, 'import numpy as np\n'), ((3271, 3288), 'numpy...
import numpy as np from pmesh.pm import ParticleMesh from nbodykit.lab import BigFileCatalog, BigFileMesh, FFTPower, MultipleSpeciesCatalog, transform from nbodykit.source.mesh.field import FieldMesh from nbodykit.lab import SimulationBox2PCF, FFTCorr from nbodykit import setup_logging import os import sys sys.pat...
[ "sys.path.append", "numpy.stack", "nbodykit.lab.BigFileCatalog", "nbodykit.setup_logging", "nbodykit.lab.SimulationBox2PCF", "os.path.dirname", "pmesh.pm.ParticleMesh", "numpy.ones", "numpy.random.RandomState", "time.time", "numpy.broadcast_to", "numpy.log10" ]
[((313, 339), 'sys.path.append', 'sys.path.append', (['"""./utils"""'], {}), "('./utils')\n", (328, 339), False, 'import sys\n'), ((468, 489), 'nbodykit.setup_logging', 'setup_logging', (['"""info"""'], {}), "('info')\n", (481, 489), False, 'from nbodykit import setup_logging\n'), ((1116, 1160), 'pmesh.pm.ParticleMesh'...
from sentence_transformers import SentenceTransformer, util import pandas as pd import numpy as np import matplotlib.pyplot as plt def sorulariDosyadanOkuveListeOlarakDondur(): gecici = [] for i in range(100): gecici.append([]) df = pd.read_csv('KVKK_100_SORU_CEVAP.txt',sep="\t") for ...
[ "matplotlib.pyplot.show", "pandas.read_csv", "numpy.std", "numpy.var", "numpy.min", "numpy.max", "matplotlib.pyplot.subplots", "sentence_transformers.SentenceTransformer" ]
[((263, 311), 'pandas.read_csv', 'pd.read_csv', (['"""KVKK_100_SORU_CEVAP.txt"""'], {'sep': '"""\t"""'}), "('KVKK_100_SORU_CEVAP.txt', sep='\\t')\n", (274, 311), True, 'import pandas as pd\n'), ((1451, 1473), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (['m'], {}), '(m)\n', (1470, 1473), False, ...
import os import numpy as np from h5py import File import matplotlib.pyplot as plt import seaborn as sns import json from collections import defaultdict if __name__ == "__main__": dir = "pcritical_ntidigits_output" files = os.listdir(dir) results = [json.load(open(os.path.join(dir, i), "r")) for i in fil...
[ "seaborn.set_style", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.show", "os.path.join", "numpy.std", "collections.defaultdict", "matplotlib.pyplot.rcParams.update", "numpy.array", "numpy.mean", "numpy.arange", "matplotlib.pyplot.subplots", "os.listdir" ]
[((233, 248), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (243, 248), False, 'import os\n'), ((329, 355), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (342, 355), True, 'import seaborn as sns\n'), ((360, 398), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (...
# coding:utf-8 """ Filename: app.py Author: @DvdNss Created on 12/10/2021 """ import csv import os.path import time import cv2 import gdown import numpy as np import streamlit as st import torch def load_classes(csv_reader): """ Load classes from csv. :param csv_reader: csv :return: """ res...
[ "csv.reader", "streamlit.image", "streamlit.title", "streamlit.sidebar.title", "streamlit.sidebar.selectbox", "cv2.rectangle", "torch.device", "torch.no_grad", "streamlit.set_page_config", "streamlit.spinner", "streamlit.cache", "cv2.cvtColor", "torch.load", "numpy.transpose", "streamlit...
[((1964, 1998), 'streamlit.cache', 'st.cache', ([], {'suppress_st_warning': '(True)'}), '(suppress_st_warning=True)\n', (1972, 1998), True, 'import streamlit as st\n'), ((5066, 5103), 'streamlit.set_page_config', 'st.set_page_config', ([], {'layout': '"""centered"""'}), "(layout='centered')\n", (5084, 5103), True, 'imp...
import numpy as np import torch import torch.nn as nn from enum import Enum from collections import namedtuple import torch.nn.functional as F import math def get_keys(d, name): if 'state_dict' in d: d = d['state_dict'] d_filt = {k[len(name) + 1:]: v for k, v in d.items() if k[:len(name)] == name} ...
[ "torch.randn", "torch.zeros", "math.log", "math.sqrt", "torch.nn.ModuleList", "torch.norm", "numpy.log2", "torch.nn.Conv2d", "torch.nn.BatchNorm2d", "torch.nn.MaxPool2d", "torch.nn.LeakyReLU", "torch.nn.Sigmoid", "torch.nn.AdaptiveAvgPool2d", "torch.nn.PReLU", "torch.nn.ReLU", "torch.n...
[((587, 641), 'collections.namedtuple', 'namedtuple', (['"""Block"""', "['in_channel', 'depth', 'stride']"], {}), "('Block', ['in_channel', 'depth', 'stride'])\n", (597, 641), False, 'from collections import namedtuple\n'), ((481, 513), 'torch.norm', 'torch.norm', (['input', '(2)', 'axis', '(True)'], {}), '(input, 2, a...
# -*- coding: utf-8 -*- import glob import json import os import cv2 import numpy as np from tqdm import tqdm from sklearn.model_selection import train_test_split from tensorpack.utils import logger from tensorpack.utils.timer import timed_operation from config import config as cfg from dataset import DatasetRegistr...
[ "cv2.imread", "os.path.isfile", "numpy.array", "os.path.join" ]
[((698, 718), 'cv2.imread', 'cv2.imread', (['img_path'], {}), '(img_path)\n', (708, 718), False, 'import cv2\n'), ((1485, 1518), 'numpy.array', 'np.array', (['boxes'], {'dtype': 'np.float32'}), '(boxes, dtype=np.float32)\n', (1493, 1518), True, 'import numpy as np\n'), ((1520, 1537), 'numpy.array', 'np.array', (['class...
"""Training Utilities for ViViT.""" import functools from typing import Callable, Dict, List, Optional, Tuple, Union from absl import logging from flax import jax_utils import flax.linen as nn import jax from jax.experimental.optimizers import clip_grads import jax.numpy as jnp import jax.profiler import matplotlib.p...
[ "numpy.sum", "numpy.nan_to_num", "seaborn.heatmap", "matplotlib.pyplot.figure", "jax.experimental.optimizers.clip_grads", "scenic.train_lib.train_utils.bind_rng_to_host_device", "flax.linen.softmax", "jax.tree_util.tree_leaves", "jax.numpy.expand_dims", "jax.numpy.argmax", "scenic.model_lib.base...
[((2882, 2915), 'jax.random.split', 'jax.random.split', (['train_state.rng'], {}), '(train_state.rng)\n', (2898, 2915), False, 'import jax\n'), ((3392, 3469), 'scenic.train_lib.train_utils.bind_rng_to_host_device', 'train_utils.bind_rng_to_host_device', (['rng'], {'axis_name': '"""batch"""', 'bind_to': '"""device"""'})...
import unittest import json import pandas as pd import numpy as np from assistant_dialog_skill_analysis.data_analysis import similarity_analyzer from assistant_dialog_skill_analysis.utils import skills_util, lang_utils TOLERANCE = 0.0000001 class TestSimilarityAnalzyer(unittest.TestCase): """Test for Similarity...
[ "unittest.main", "pandas.DataFrame", "json.load", "numpy.abs", "assistant_dialog_skill_analysis.data_analysis.similarity_analyzer._calculate_cosine_similarity", "assistant_dialog_skill_analysis.utils.lang_utils.LanguageUtility", "unittest.TestCase.tearDown", "numpy.array", "numpy.diag", "numpy.int...
[((2246, 2261), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2259, 2261), False, 'import unittest\n'), ((387, 419), 'assistant_dialog_skill_analysis.utils.lang_utils.LanguageUtility', 'lang_utils.LanguageUtility', (['"""en"""'], {}), "('en')\n", (413, 419), False, 'from assistant_dialog_skill_analysis.utils imp...
#!/usr/bin/env python import time, calendar, re, sys import numpy as np firstweekday = calendar.SUNDAY width = 20 offset0 = 0 offset1 = 0 alignment = 'alignc' monthNameSep = ' ' weekdaySep = ' ' labels = {0:'Mo', 1:'Tu', 2:'We', 3:'Th', 4:'Fr', 5:'Sa', 6:'Su'} todayColor = '${color5}' weekdayNamesColor = '${color #b...
[ "sys.stdout.write", "calendar.setfirstweekday", "time.strftime", "numpy.mod", "time.time", "calendar.Calendar" ]
[((494, 525), 'time.strftime', 'time.strftime', (['"""%Y.%m.%d %H:%M"""'], {}), "('%Y.%m.%d %H:%M')\n", (507, 525), False, 'import time, calendar, re, sys\n'), ((527, 565), 'calendar.setfirstweekday', 'calendar.setfirstweekday', (['firstweekday'], {}), '(firstweekday)\n', (551, 565), False, 'import time, calendar, re, ...
# # * The source code in this file is developed independently by NEC Corporation. # # # NLCPy License # # # Copyright (c) 2020-2021 NEC Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following cond...
[ "numpy.result_type", "nlcpy.nonzero", "nlcpy.ndarray", "numpy.asarray", "nlcpy.asarray", "nlcpy.arange", "nlcpy.request.request._push_request", "nlcpy.core._broadcast_core" ]
[((3915, 3939), 'nlcpy.asarray', 'nlcpy.asarray', (['condition'], {}), '(condition)\n', (3928, 3939), False, 'import nlcpy\n'), ((4272, 4295), 'numpy.result_type', 'numpy.result_type', (['x', 'y'], {}), '(x, y)\n', (4289, 4295), False, 'import numpy\n'), ((4309, 4341), 'nlcpy.asarray', 'nlcpy.asarray', (['x'], {'dtype'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 9 09:07:29 2022 @author: alex """ import numpy as np ############################################################################### class MarkovSystem: """ Mother class for discrete stochastic dynamical systems --------------------...
[ "numpy.dot", "numpy.zeros", "numpy.ones" ]
[((2044, 2063), 'numpy.zeros', 'np.zeros', (['(n, n, m)'], {}), '((n, n, m))\n', (2052, 2063), True, 'import numpy as np\n'), ((2320, 2339), 'numpy.zeros', 'np.zeros', (['(n, n, m)'], {}), '((n, n, m))\n', (2328, 2339), True, 'import numpy as np\n'), ((2483, 2494), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2491...
import numpy as np def pair2sum_1(arr, num): length = len(arr) for i in range(length - 1): for j in range(i + 1, length): if arr[i] + arr[j] == num: print(arr[i], arr[j]) print('Done') def pair2sum_2(arr, num): length = len(arr) for i in range(length - 1): ...
[ "numpy.random.randint" ]
[((616, 646), 'numpy.random.randint', 'np.random.randint', (['(10)'], {'size': '(10)'}), '(10, size=10)\n', (633, 646), True, 'import numpy as np\n')]
import numpy as np class Perturb: """ A simple perturb mechanism as specified in (Jaderberg et al., 2017). """ def __init__(self, cs_space=None, boundaries={}): self.boundaries = boundaries self.cs_space = cs_space def __call__(self, hyperparameters: dict) -> dict: """ ...
[ "numpy.random.choice" ]
[((641, 666), 'numpy.random.choice', 'np.random.choice', (['[-1, 1]'], {}), '([-1, 1])\n', (657, 666), True, 'import numpy as np\n')]
import os import cv2 import numpy as np import tensorrt as trt import pycuda.driver as cuda import pycuda.autoinit class EntropyCalibrator(trt.IInt8EntropyCalibrator2): def __init__(self, training_data, cache_file, image_size, mean=[0, 0, 0], std = [1, 1, 1], batch_size=2): # Whenever you specify a custo...
[ "cv2.resize", "tensorrt.IInt8EntropyCalibrator2.__init__", "cv2.cvtColor", "os.path.exists", "pycuda.driver.mem_alloc", "numpy.transpose", "numpy.expand_dims", "cv2.imread", "numpy.array", "pycuda.driver.memcpy_htod", "numpy.concatenate" ]
[((430, 472), 'tensorrt.IInt8EntropyCalibrator2.__init__', 'trt.IInt8EntropyCalibrator2.__init__', (['self'], {}), '(self)\n', (466, 472), True, 'import tensorrt as trt\n'), ((914, 967), 'pycuda.driver.mem_alloc', 'cuda.mem_alloc', (['(self.data[0].nbytes * self.batch_size)'], {}), '(self.data[0].nbytes * self.batch_si...
"""Functions for evaluating prediction performance.""" from __future__ import division from __future__ import print_function from collections import OrderedDict import numpy as np import pandas as pd import sklearn.metrics as skm from scipy.stats import kendalltau from six.moves import range from .data import CPG_N...
[ "numpy.abs", "pandas.pivot_table", "sklearn.metrics.accuracy_score", "sklearn.metrics.f1_score", "numpy.mean", "scipy.stats.kendalltau", "numpy.round", "numpy.unique", "pandas.DataFrame", "six.moves.range", "numpy.linspace", "pandas.concat", "numpy.random.shuffle", "numpy.corrcoef", "skl...
[((916, 937), 'numpy.mean', 'np.mean', (['((y - z) ** 2)'], {}), '((y - z) ** 2)\n', (923, 937), True, 'import numpy as np\n'), ((1214, 1237), 'sklearn.metrics.roc_auc_score', 'skm.roc_auc_score', (['y', 'z'], {}), '(y, z)\n', (1231, 1237), True, 'import sklearn.metrics as skm\n'), ((1368, 1392), 'sklearn.metrics.accur...
"""Experiment Helper Functions.""" import random as r import json import sys import os import numpy as np import tensorflow as tf from tensorflow import keras # Add the architecture path for the networkarch and RelMSE sys.path.append("../architecture/") from NetworkArch import NetworkArch def construct_network(**ar...
[ "sys.path.append", "os.path.abspath", "tensorflow.keras.models.load_model", "os.makedirs", "random.uniform", "tensorflow.keras.backend.clear_session", "numpy.zeros", "NetworkArch.NetworkArch", "numpy.argmin", "tensorflow.keras.callbacks.ModelCheckpoint", "random.seed", "numpy.vstack", "numpy...
[((220, 255), 'sys.path.append', 'sys.path.append', (['"""../architecture/"""'], {}), "('../architecture/')\n", (235, 255), False, 'import sys\n'), ((400, 434), 'NetworkArch.NetworkArch', 'NetworkArch', ([], {}), '(**architecture_config)\n', (411, 434), False, 'from NetworkArch import NetworkArch\n'), ((1224, 1250), 'n...
import numpy as py import sys sys.path.append('../ISCE') import insarhelpers import geopandas as gpd import matplotlib.pyplot as plt import glob import os from PIL import Image, ImageEnhance import rasterio import rasterio.merge import rasterio.plot import numpy as np from shapely.geometry import Polygon import geopand...
[ "sys.path.append", "rasterio.open", "os.path.join", "shapely.geometry.Polygon", "matplotlib.pyplot.close", "insarhelpers.make_MS_img", "numpy.array", "PIL.Image.fromarray", "matplotlib.pyplot.subplots", "geopandas.read_file" ]
[((30, 56), 'sys.path.append', 'sys.path.append', (['"""../ISCE"""'], {}), "('../ISCE')\n", (45, 56), False, 'import sys\n'), ((2312, 2389), 'insarhelpers.make_MS_img', 'insarhelpers.make_MS_img', (['mosaic_list16', 'band_order'], {'res': 'res', 'bounds': 'bounds16'}), '(mosaic_list16, band_order, res=res, bounds=bound...
# -*- coding: utf-8 -*- """ Created on Sat May 3 21:38:54 2014 @author: spatchcock """ import numpy as np import matplotlib.pyplot as plt # %% Import data high_file = './data/hippensteel_total_high_marsh.csv' intm_file = './data/hippensteel_total_intermediate_marsh.csv' low_file = './data/hippensteel_total_low_mar...
[ "matplotlib.pyplot.show", "numpy.polynomial.polynomial.polyfit", "numpy.genfromtxt", "matplotlib.pyplot.figure", "numpy.linspace" ]
[((341, 405), 'numpy.genfromtxt', 'np.genfromtxt', (['high_file'], {'dtype': 'float', 'delimiter': '""","""', 'names': '(True)'}), "(high_file, dtype=float, delimiter=',', names=True)\n", (354, 405), True, 'import numpy as np\n'), ((419, 483), 'numpy.genfromtxt', 'np.genfromtxt', (['intm_file'], {'dtype': 'float', 'del...