code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import tensorflow as tf from Autoencoders import add_gaussian_noise mnist = tf.keras.datasets.mnist def load_auto_encoder_mnist_data(noise_sigma=None, with_test=False): (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0 if wit...
[ "Autoencoders.add_gaussian_noise", "numpy.concatenate" ]
[((691, 732), 'numpy.concatenate', 'np.concatenate', (['(x_train, x_test)'], {'axis': '(0)'}), '((x_train, x_test), axis=0)\n', (705, 732), True, 'import numpy as np\n'), ((1132, 1173), 'numpy.concatenate', 'np.concatenate', (['(x_train, x_test)'], {'axis': '(0)'}), '((x_train, x_test), axis=0)\n', (1146, 1173), True, ...
""" Possible bug in fb prophet for multiplicative seasonalities. """ # %% import numpy as np import pandas as pd import prophet # %% df = pd.DataFrame() df['ds'] = pd.date_range(start='2019-01-01',end='2021-01-01',freq='4H') df['daily_effect'] = np.cos(df['ds'].dt.hour/24 * 2*np.pi)*-0.5+0.5 df['yearly_effect'] = np....
[ "pandas.DataFrame", "pandas.date_range", "numpy.log", "prophet.Prophet", "numpy.exp", "numpy.cos" ]
[((140, 154), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (152, 154), True, 'import pandas as pd\n'), ((166, 228), 'pandas.date_range', 'pd.date_range', ([], {'start': '"""2019-01-01"""', 'end': '"""2021-01-01"""', 'freq': '"""4H"""'}), "(start='2019-01-01', end='2021-01-01', freq='4H')\n", (179, 228), True, ...
import numpy as np from ravel.schema import fields class Array(fields.List): def process(self, obj): processed_obj, error = super().process(obj) if error: return (None, error) arr = np.array(processed_obj, dtype=self.nested.np_dtype) return (arr, None)
[ "numpy.array" ]
[((225, 276), 'numpy.array', 'np.array', (['processed_obj'], {'dtype': 'self.nested.np_dtype'}), '(processed_obj, dtype=self.nested.np_dtype)\n', (233, 276), True, 'import numpy as np\n')]
# Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # Supported by <NAME> <<EMAIL>> # License: BSD 3 clause import numbers from warnings import warn import numpy as np from sklearn.base import BaseEstimator, OutlierMixin from sklearn.metrics import euclidean_distances from sklearn.utils.validation import...
[ "numpy.nanargmin", "numpy.fill_diagonal", "numpy.ones_like", "numpy.amin", "numpy.empty", "numpy.iinfo", "numpy.ones", "sklearn.utils.validation.check_is_fitted", "numpy.argmin", "numpy.finfo", "sklearn.utils.validation.check_random_state", "numpy.mean", "sklearn.metrics.euclidean_distances"...
[((368, 386), 'numpy.iinfo', 'np.iinfo', (['np.int32'], {}), '(np.int32)\n', (376, 386), True, 'import numpy as np\n'), ((403, 418), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (411, 418), True, 'import numpy as np\n'), ((5547, 5607), 'numpy.empty', 'np.empty', (['[self.n_estimators, self.max_samples_, n_f...
"""Processes a CRD file. Note: Interfacing with external files is done in the `interfacer.py` library. """ from pathlib import Path from typing import List, Tuple import warnings from iniabu import ini import numpy as np from . import processor_utils from .data_io.crd_reader import CRDReader from .utilities import ...
[ "numpy.zeros_like", "numpy.sum", "numpy.abs", "numpy.logical_and", "numpy.where", "numpy.array", "numpy.arange", "warnings.warn", "numpy.delete" ]
[((8603, 8632), 'numpy.sum', 'np.sum', (['self.data_pkg'], {'axis': '(1)'}), '(self.data_pkg, axis=1)\n', (8609, 8632), True, 'import numpy as np\n'), ((8745, 8811), 'numpy.delete', 'np.delete', (['self.data_pkg', 'self._filter_max_ion_per_pkg_ind'], {'axis': '(0)'}), '(self.data_pkg, self._filter_max_ion_per_pkg_ind, ...
# AUTOGENERATED! DO NOT EDIT! File to edit: utils.ipynb (unless otherwise specified). __all__ = ['test', 'test_eq', 'simplify_qd'] # Cell import open3d as o3d import operator import numpy as np # Cell def test(a,b,cmp,cname=None): if cname is None: cname=cmp.__name__ assert cmp(a,b),f"{cname}:\n{a}\n{b}" de...
[ "open3d.utility.Vector3iVector", "numpy.asarray", "open3d.geometry.TriangleMesh", "open3d.utility.Vector3dVector" ]
[((441, 468), 'open3d.geometry.TriangleMesh', 'o3d.geometry.TriangleMesh', ([], {}), '()\n', (466, 468), True, 'import open3d as o3d\n'), ((490, 523), 'open3d.utility.Vector3iVector', 'o3d.utility.Vector3iVector', (['faces'], {}), '(faces)\n', (516, 523), True, 'import open3d as o3d\n'), ((544, 577), 'open3d.utility.Ve...
""" A script to calculate the p-values and averages for Section 6.3 of the paper. """ import json import pickle import numpy as np from scipy.stats import mannwhitneyu, ttest_1samp from bld.project_paths import project_paths_join as ppj def calc_p_value_by_super_game( data_experiment, super_star_data...
[ "json.dump", "bld.project_paths.project_paths_join", "scipy.stats.mannwhitneyu", "scipy.stats.ttest_1samp", "pickle.load", "numpy.array" ]
[((5296, 5344), 'numpy.array', 'np.array', (["all_output_grids_2_agents['avg_price']"], {}), "(all_output_grids_2_agents['avg_price'])\n", (5304, 5344), True, 'import numpy as np\n'), ((5670, 5718), 'numpy.array', 'np.array', (["all_output_grids_3_agents['avg_price']"], {}), "(all_output_grids_3_agents['avg_price'])\n"...
""" Main experimentation pipeline for measuring robustness of explainers. Unlike the other pipelines, we just want to compare the original LIME with its robustified version, so we do not require a list of configs to run through. We mainly run three experiments: * Robustness of original LIME against Fooling LIME attac...
[ "sklearn.externals.joblib.dump", "sklearn.preprocessing.StandardScaler", "numpy.random.seed", "argparse.ArgumentParser", "sklearn.model_selection.train_test_split", "logging.getLogger", "experiments.utils.explainers.get_explainer", "experiments.utils.datasets.get_dataset", "numpy.mean", "pandas.Da...
[((4675, 4703), 'experiments.utils.datasets.get_dataset', 'get_dataset', (['dataset', 'params'], {}), '(dataset, params)\n', (4686, 4703), False, 'from experiments.utils.datasets import get_dataset\n'), ((7319, 7335), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (7333, 7335), False, 'from...
#!/usr/bin/env python3 """ Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import gtn import numpy as np def gen_transitions(num_classes, calc_grad=False): """Make a bigram transition gra...
[ "gtn.viterbi_path", "gtn.backward", "gtn.forward_score", "gtn.subtract", "numpy.random.randint", "gtn.intersect", "gtn.Graph", "gtn.project_output", "numpy.mean", "gtn.compose" ]
[((335, 355), 'gtn.Graph', 'gtn.Graph', (['calc_grad'], {}), '(calc_grad)\n', (344, 355), False, 'import gtn\n'), ((738, 758), 'gtn.Graph', 'gtn.Graph', (['calc_grad'], {}), '(calc_grad)\n', (747, 758), False, 'import gtn\n'), ((1514, 1534), 'gtn.Graph', 'gtn.Graph', (['calc_grad'], {}), '(calc_grad)\n', (1523, 1534), ...
import numpy as np from scipy.stats import norm def ci_test_fisher_z(data_matrix, x, y, s, **kwargs): assert 'corr_matrix' in kwargs cm = kwargs['corr_matrix'] n = data_matrix.shape[0] z = zstat(x, y, list(s), cm, n) p_val = 2.0 * norm.sf(np.absolute(z)) return p_val def zstat(x, y, s, cm, n):...
[ "numpy.absolute", "numpy.isnan", "numpy.linalg.pinv", "numpy.log1p", "numpy.sqrt" ]
[((413, 425), 'numpy.isnan', 'np.isnan', (['zv'], {}), '(zv)\n', (421, 425), True, 'import numpy as np\n'), ((538, 563), 'numpy.log1p', 'np.log1p', (['(2 * r / (1 - r))'], {}), '(2 * r / (1 - r))\n', (546, 563), True, 'import numpy as np\n'), ((662, 710), 'numpy.linalg.pinv', 'np.linalg.pinv', (['cm[[x, y] + s, :][:, [...
from math import sqrt from random import choice from re import escape from socket import socket, AF_INET, SOCK_STREAM from time import sleep import cv2 as cv import numpy as np # ------------------------------- CONSTANTS ----------------------------------- IP = "172.16.17.32" PORT = 3456 BUFFER_SIZE = 2**16 SOCKET = ...
[ "math.sqrt", "cv2.waitKey", "numpy.std", "socket.socket", "cv2.imread", "numpy.fliplr", "numpy.mean", "cv2.destroyAllWindows", "numpy.delete", "cv2.resize", "cv2.matchTemplate" ]
[((1804, 1817), 'cv2.waitKey', 'cv.waitKey', (['(0)'], {}), '(0)\n', (1814, 1817), True, 'import cv2 as cv\n'), ((1819, 1841), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n', (1839, 1841), True, 'import cv2 as cv\n'), ((1984, 2013), 'numpy.delete', 'np.delete', (['img', 'white_cols', '(1)'], {}), '(i...
# https://www.hackerrank.com/challenges/np-linear-algebra/problem import numpy # Inputs standard_input = """2 1.1 1.1 1.1 1.1""" n = int(input()) # 2 a = numpy.array([input().split() for _ in range(n)], float) # 1.1 1.1 # 1.1 1.1 numpy.set_printoptions(legacy="1.13") print(numpy.linalg.det(a)) # 0.0 """ Refer...
[ "numpy.linalg.det", "numpy.set_printoptions" ]
[((238, 275), 'numpy.set_printoptions', 'numpy.set_printoptions', ([], {'legacy': '"""1.13"""'}), "(legacy='1.13')\n", (260, 275), False, 'import numpy\n'), ((282, 301), 'numpy.linalg.det', 'numpy.linalg.det', (['a'], {}), '(a)\n', (298, 301), False, 'import numpy\n')]
#!/usr/bin/env python import click import matplotlib import matplotlib.pyplot as plt #matplotlib.style.use('ggplot') import numpy as np import pandas as pd from projections.pd_utils import load_pandas import projections.modelr as modelr LU2 = {'annual': 'c3ann + c4ann', 'nitrogen': 'c3nfx', 'pasture': '...
[ "numpy.full", "projections.modelr.load", "matplotlib.pyplot.show", "click.option", "click.command", "numpy.linspace", "click.Path", "matplotlib.pyplot.savefig" ]
[((731, 746), 'click.command', 'click.command', ([], {}), '()\n', (744, 746), False, 'import click\n'), ((811, 865), 'click.option', 'click.option', (['"""-m"""', '"""--max-x"""'], {'type': 'float', 'default': '(1.2)'}), "('-m', '--max-x', type=float, default=1.2)\n", (823, 865), False, 'import click\n'), ((867, 918), ...
""" @author: <NAME> @description : Rest pose of a skeleton File Format: numpy file (npy) Content: 1 numpy array - float_array(num_bones, size(BONE_ATTRIBUTES)) """ import deep_deformation.utils.common as common import os import numpy as np class RestPoseData: def __init__(self): self.bone_data = No...
[ "numpy.load", "numpy.save", "numpy.zeros", "os.path.exists", "deep_deformation.utils.common.get_rest_pose_path" ]
[((451, 489), 'numpy.zeros', 'np.zeros', (['bone_data_shape'], {'dtype': 'float'}), '(bone_data_shape, dtype=float)\n', (459, 489), True, 'import numpy as np\n'), ((550, 577), 'deep_deformation.utils.common.get_rest_pose_path', 'common.get_rest_pose_path', ([], {}), '()\n', (575, 577), True, 'import deep_deformation.ut...
# -*- coding: utf-8 -*- """ Environment Functions: initialize(unit, fovea_center, fovea_size, objects) - initialize unit size environment containing objects and fovea with size fovea_size and center in fovea_center. redraw(environment, unit, objects) - redraw the unit size environment containing objects. "...
[ "geometricshapes.Square", "geometricshapes.Circle", "numpy.zeros", "geometricshapes.Fovea", "numpy.array", "geometricshapes.Rectangle" ]
[((972, 997), 'numpy.zeros', 'np.zeros', (['[unit, unit, 3]'], {}), '([unit, unit, 3])\n', (980, 997), True, 'import numpy as np\n'), ((1010, 1058), 'geometricshapes.Fovea', 'Fovea', (['fovea_center', 'fovea_size', '[0, 0, 0]', 'unit'], {}), '(fovea_center, fovea_size, [0, 0, 0], unit)\n', (1015, 1058), False, 'from ge...
""" Implementation of filters for images and texts""" import numpy as np from jina import Executor, DocumentArray, requests class ImageReader(Executor): @requests(on='/index') def index_read(self, docs: 'DocumentArray', **kwargs): array = DocumentArray(list(filter(lambda doc: doc.modality=='image', d...
[ "jina.DocumentArray", "numpy.array", "jina.requests" ]
[((161, 182), 'jina.requests', 'requests', ([], {'on': '"""/index"""'}), "(on='/index')\n", (169, 182), False, 'from jina import Executor, DocumentArray, requests\n'), ((486, 508), 'jina.requests', 'requests', ([], {'on': '"""/search"""'}), "(on='/search')\n", (494, 508), False, 'from jina import Executor, DocumentArra...
#!/usr/bin/env python import nibabel as nib import numpy as np import glob import nipype from nipype.interfaces import niftyreg import os import tempfile from tqdm import tqdm import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import argparse def get_args(): parser = argparse.ArgumentParser(...
[ "os.mkdir", "numpy.load", "argparse.ArgumentParser", "numpy.ones", "numpy.clip", "numpy.mean", "os.path.join", "tempfile.TemporaryDirectory", "numpy.std", "matplotlib.pyplot.imshow", "matplotlib.pyplot.close", "os.path.exists", "nipype.interfaces.niftyreg.RegAladin", "numpy.save", "os.pa...
[((195, 216), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (209, 216), False, 'import matplotlib\n'), ((296, 409), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""performs 12-DOF affine registration of a T1 image to ICBM152 template"""'}), "(description=\n 'per...
import copy from fv3fit._shared.config import SliceConfig from fv3fit._shared.packer import ( pack_tfdataset, clip_sample, ) from fv3fit.tfdataset import tfdataset_from_batches import tensorflow as tf from typing import Mapping, Sequence import numpy as np import pytest import xarray as xr import fv3fit.tfdatas...
[ "fv3fit._shared.packer.pack_tfdataset", "fv3fit.tfdataset.tfdataset_from_batches", "copy.deepcopy", "numpy.random.uniform", "tensorflow.abs", "numpy.testing.assert_array_equal", "numpy.asarray", "fv3fit._shared.config.SliceConfig", "pytest.param", "pytest.raises", "fv3fit._shared.packer.clip_sam...
[((4379, 4423), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n_dims"""', '[2, 3, 5]'], {}), "('n_dims', [2, 3, 5])\n", (4402, 4423), False, 'import pytest\n'), ((5488, 5532), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n_dims"""', '[2, 3, 5]'], {}), "('n_dims', [2, 3, 5])\n", (5511, 5532)...
from math import ceil, floor, log2 import numpy as np from CQT_Toolbox.winfuns import winfuns def nsgcqwin(*args): fmin, fmax, bins, sr, Ls = args[:5] bwfac = 1 min_win = 4 fractional = 0 winfun = "hann" gamma = 0 nargin = len(args) if nargin < 5: raise ValueError("Not enou...
[ "numpy.ceil", "math.ceil", "numpy.floor", "numpy.zeros", "numpy.empty_like", "math.floor", "numpy.insert", "numpy.diff", "numpy.where", "numpy.arange", "CQT_Toolbox.winfuns.winfuns", "math.log2", "numpy.round", "numpy.all", "numpy.sqrt" ]
[((1861, 1882), 'numpy.insert', 'np.insert', (['fbas', '(0)', '(0)'], {}), '(fbas, 0, 0)\n', (1870, 1882), True, 'import numpy as np\n'), ((2017, 2064), 'numpy.insert', 'np.insert', (['bw', '(0)', '(fbas[Lfbas + 2] - fbas[Lfbas])'], {}), '(bw, 0, fbas[Lfbas + 2] - fbas[Lfbas])\n', (2026, 2064), True, 'import numpy as n...
import numpy as np import os, sys import pickle, functools, operator import keras from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from sklearn.externals import joblib from keras.utils import to_categorical from keras.models import Model, load_model from keras.layers...
[ "sklearn.externals.joblib.dump", "argparse.ArgumentParser", "keras.preprocessing.sequence.pad_sequences", "keras.models.Model", "argument.add_arguments", "keras.layers.Input", "os.path.join", "keras.optimizers.adam", "os.path.exists", "keras.preprocessing.text.Tokenizer", "keras.utils.to_categor...
[((494, 552), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Video to Text Model"""'}), "(description='Video to Text Model')\n", (517, 552), False, 'import argparse, json\n'), ((1285, 1306), 'argument.add_arguments', 'add_arguments', (['parser'], {}), '(parser)\n', (1298, 1306), False, '...
"""Various one off plots. Usage: ./plots.py Author: <NAME> - 2021-08-30 """ import matplotlib.pyplot as plt import pandas as pd import numpy as np from typing import List, Optional from scipy.stats import norm from warzone.base import normalize, running_mean, cumulative_mean from warzone.document_filter import Docu...
[ "matplotlib.pyplot.title", "pandas.DataFrame", "matplotlib.pyplot.show", "pandas.DataFrame.from_dict", "matplotlib.pyplot.get_cmap", "matplotlib.pyplot.figure", "numpy.mean", "numpy.array", "matplotlib.pyplot.subplots" ]
[((758, 806), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(3)', 'ncols': '(2)', 'figsize': '(30, 30)'}), '(nrows=3, ncols=2, figsize=(30, 30))\n', (770, 806), True, 'import matplotlib.pyplot as plt\n'), ((811, 886), 'matplotlib.pyplot.title', 'plt.title', (["('Personal Data for: ' + doc_filter.usernam...
# coding: utf-8 import tensorflow as tf import numpy as np class TCNNConfig(object): """CNN配置参数""" embedding_dim = 64 # 词向量维度 seq_length = 30 # 序列长度 num_classes = 8 # 类别数 num_filters = 128 # 卷积核数目 vocab_size = 5000 # 词汇表达小 l2_reg_lambda = 0.0 filter_sizes = [2, 3, 4, 5] kern...
[ "tensorflow.contrib.layers.xavier_initializer", "tensorflow.reshape", "tensorflow.train.AdamOptimizer", "numpy.shape", "tensorflow.multiply", "tensorflow.sigmoid", "tensorflow.Variable", "tensorflow.nn.conv2d", "tensorflow.reduce_max", "tensorflow.sqrt", "tensorflow.layers.batch_normalization", ...
[((817, 889), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None, self.config.seq_length]'], {'name': '"""input_x"""'}), "(tf.int32, [None, self.config.seq_length], name='input_x')\n", (831, 889), True, 'import tensorflow as tf\n'), ((913, 988), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', ...
import torch import torch.nn as nn import numpy as np import math from torch.nn import functional as F from maskrcnn_benchmark.modeling.box_coder import BoxCoder from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.boxlist_ops import boxlist_nms from maskrcnn_benchmark.struc...
[ "torch.nn.functional.binary_cross_entropy", "maskrcnn_benchmark.structures.bounding_box.BoxList", "torch.bmm", "numpy.argmax", "maskrcnn_benchmark.structures.boxlist_ops.boxlist_iou", "torch.cat", "torch.full", "torch.cos", "numpy.arange", "torch.arange", "numpy.tile", "torch.no_grad", "torc...
[((30157, 30175), 'torch.sin', 'torch.sin', (['mul_mat'], {}), '(mul_mat)\n', (30166, 30175), False, 'import torch\n'), ((30190, 30208), 'torch.cos', 'torch.cos', (['mul_mat'], {}), '(mul_mat)\n', (30199, 30208), False, 'import torch\n'), ((30225, 30258), 'torch.cat', 'torch.cat', (['(sin_mat, cos_mat)', '(-1)'], {}), ...
import json import os import numpy as np from absl import flags, app from sklearn.metrics import ( confusion_matrix, f1_score, precision_recall_fscore_support, accuracy_score, ) import seaborn as sns import matplotlib.pyplot as plt from dataloader.audio import EmotionDataset # This scoring assumes only...
[ "seaborn.heatmap", "matplotlib.pyplot.clf", "numpy.argmax", "sklearn.metrics.accuracy_score", "json.dumps", "sklearn.metrics.f1_score", "absl.flags.DEFINE_boolean", "absl.flags.DEFINE_list", "sklearn.metrics.precision_recall_fscore_support", "numpy.savetxt", "absl.flags.mark_flag_as_required", ...
[((359, 421), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""ref"""', 'None', '"""Path to reference emotions"""'], {}), "('ref', None, 'Path to reference emotions')\n", (378, 421), False, 'from absl import flags, app\n'), ((422, 485), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""pred"""', 'None', ...
import glob import pandas as pd from datetime import datetime import xml.etree.ElementTree as ET import numpy as np # Define a a function to extract .csv files def extract_from_csv(file_to_process): dataframe = pd.read_csv(file_to_process, index_col=0) return dataframe # Define a a function to extract .json f...
[ "pandas.DataFrame", "xml.etree.ElementTree.parse", "pandas.read_csv", "pandas.read_json", "glob.glob", "numpy.float64", "datetime.datetime.now" ]
[((216, 257), 'pandas.read_csv', 'pd.read_csv', (['file_to_process'], {'index_col': '(0)'}), '(file_to_process, index_col=0)\n', (227, 257), True, 'import pandas as pd\n'), ((381, 422), 'pandas.read_json', 'pd.read_json', (['file_to_process'], {'lines': '(True)'}), '(file_to_process, lines=True)\n', (393, 422), True, '...
import numpy as np from scipy import sparse def _preprare_data_in_groups(X, y=None, sample_weights=None): """ Takes the first column of the feature Matrix X given and transforms the data into groups accordingly. Parameters ---------- X : (2d-array like) Feature matrix with the first column th...
[ "scipy.sparse.issparse", "numpy.unique" ]
[((699, 717), 'scipy.sparse.issparse', 'sparse.issparse', (['X'], {}), '(X)\n', (714, 717), False, 'from scipy import sparse\n'), ((916, 959), 'numpy.unique', 'np.unique', (['group_labels'], {'return_counts': '(True)'}), '(group_labels, return_counts=True)\n', (925, 959), True, 'import numpy as np\n')]
from rdkit import Chem from rdkit.Chem import MACCSkeys from random import shuffle import numpy as np import pandas as pd #import torch import scipy from scipy import sparse from rdkit.Chem.AllChem import GetMorganFingerprintAsBitVect as Morgan from functools import partial import os #print(os.listdir()) _mcf = pd.read...
[ "rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect", "scipy.sparse.vstack", "pandas.read_csv", "scipy.sparse.issparse", "rdkit.Chem.MolFromSmarts", "numpy.asarray", "numpy.zeros", "rdkit.Chem.SanitizeMol", "numpy.vstack", "numpy.array", "rdkit.Chem.MolToSmiles", "rdkit.Chem.AddHs", "rdkit.Che...
[((313, 352), 'pandas.read_csv', 'pd.read_csv', (['"""pt_metrics_utils/mcf.csv"""'], {}), "('pt_metrics_utils/mcf.csv')\n", (324, 352), True, 'import pandas as pd\n'), ((362, 435), 'pandas.read_csv', 'pd.read_csv', (['"""pt_metrics_utils/wehi_pains.csv"""'], {'names': "['smarts', 'names']"}), "('pt_metrics_utils/wehi_p...
#Import necessarry tools from torch import torch import torch.nn as nn #Import necessarry tools from tpstorch from tpstorch.ml.data import EXPReweightSimulation from tpstorch.ml.optim import ParallelAdam, ParallelSGD from tpstorch.ml.nn import BKELossEXP, BKELossFTS #Import model-specific classes from brownian_ml im...
[ "brownian_ml.CommittorNet", "numpy.random.seed", "torch.manual_seed", "brownian_ml.BrownianParticle", "torch.load", "time.time", "tpstorch.ml.nn.BKELossEXP", "tpstorch.ml.data.EXPReweightSimulation", "torch.no_grad", "torch.tensor" ]
[((528, 548), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (545, 548), False, 'import torch\n'), ((549, 566), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (563, 566), True, 'import numpy as np\n'), ((640, 662), 'torch.tensor', 'torch.tensor', (['[[-1.0]]'], {}), '([[-1.0]])\n', (6...
import numpy as np from PIL import Image from tqdm import tqdm import paddle from paddle.vision.datasets import Cifar10 from paddle.vision import transforms def config_dataset(config): if "cifar" in config["dataset"]: config["topK"] = -1 config["n_class"] = 10 elif config["dataset"] in ["nusw...
[ "numpy.sum", "paddle.concat", "numpy.argsort", "numpy.mean", "paddle.no_grad", "paddle.vision.transforms.CenterCrop", "numpy.reshape", "numpy.linspace", "paddle.vision.transforms.RandomCrop", "tqdm.tqdm", "paddle.vision.transforms.ToTensor", "numpy.random.permutation", "paddle.sign", "nump...
[((7717, 7733), 'paddle.no_grad', 'paddle.no_grad', ([], {}), '()\n', (7731, 7733), False, 'import paddle\n'), ((3369, 3383), 'numpy.array', 'np.array', (['rslt'], {}), '(rslt)\n', (3377, 3383), True, 'import numpy as np\n'), ((5903, 6003), 'paddle.io.DataLoader', 'paddle.io.DataLoader', ([], {'dataset': 'train_dataset...
#! /usr/bin/env python from __future__ import print_function import numpy as np from scipy.special import gamma, gammaincc from scipy.interpolate import RegularGridInterpolator from k_correction import GAMA_KCorrection class LuminosityFunction(object): def __init__(self): pass def __initialize_interp...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.yscale", "matplotlib.pyplot.show", "numpy.log", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "scipy.special.gamma", "numpy.searchsorted", "scipy.interpolate.RegularGridInterpolator", "numpy.arange", "numpy.exp", "...
[((5543, 5566), 'numpy.arange', 'np.arange', (['(0)', '(-25)', '(-0.1)'], {}), '(0, -25, -0.1)\n', (5552, 5566), True, 'import numpy as np\n'), ((5843, 5863), 'matplotlib.pyplot.plot', 'plt.plot', (['mags', 'logn'], {}), '(mags, logn)\n', (5851, 5863), True, 'import matplotlib.pyplot as plt\n'), ((5868, 5896), 'matplot...
#! /usr/bin/env python3 import argparse import logging import os import pickle import sys import numpy as np import pandas as pd import misc.logging_utils as logging_utils import misc.parallel as parallel import misc.utils as utils import misc.pandas_utils as pandas_utils from misc.suppress_stdout_stderr import sup...
[ "pandas.DataFrame", "misc.pandas_utils.write_df", "numpy.sum", "argparse.ArgumentParser", "numpy.argmax", "pandas.read_csv", "logging.warning", "misc.logging_utils.update_logging", "misc.utils.remove_nones", "misc.logging_utils.add_logging_options", "misc.suppress_stdout_stderr.suppress_stdout_s...
[((350, 377), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (367, 377), False, 'import logging\n'), ((4920, 4937), 'pandas.DataFrame', 'pd.DataFrame', (['ret'], {}), '(ret)\n', (4932, 4937), True, 'import pandas as pd\n'), ((5007, 5416), 'argparse.ArgumentParser', 'argparse.ArgumentParse...
""" A module that contains a metaclass mixin that provides Galois field class properties. """ import math import numpy as np from .._poly_conversion import integer_to_poly, poly_to_str from ._dtypes import DTYPES class PropertiesMeta(type): """ A mixin metaclass that contains Galois field properties. "...
[ "numpy.sort", "numpy.array", "numpy.iinfo", "math.gcd" ]
[((7639, 7658), 'numpy.array', 'np.array', (['totatives'], {}), '(totatives)\n', (7647, 7658), True, 'import numpy as np\n'), ((7674, 7714), 'numpy.sort', 'np.sort', (['(cls.primitive_element ** powers)'], {}), '(cls.primitive_element ** powers)\n', (7681, 7714), True, 'import numpy as np\n'), ((7601, 7615), 'math.gcd'...
from logging import getLogger import numpy as np from eit_ai.pytorch.dataset import PYTORCH_DATASET_HANDLERS from eit_ai.pytorch.models import (PYTORCH_MODEL_HANDLERS, PYTORCH_MODELS, StdPytorchModelHandler) from eit_ai.raw_data.raw_samples import RawSamples from eit_ai.train_utils....
[ "eit_ai.train_utils.workspace.WrongSingleXError", "glob_utils.log.log.change_level_logging", "eit_ai.train_utils.lists.get_from_dict", "eit_ai.train_utils.workspace.WrongDatasetError", "numpy.reshape", "glob_utils.log.log.main_log", "logging.getLogger" ]
[((817, 836), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (826, 836), False, 'from logging import getLogger\n'), ((4960, 4970), 'glob_utils.log.log.main_log', 'main_log', ([], {}), '()\n', (4968, 4970), False, 'from glob_utils.log.log import change_level_logging, main_log\n'), ((4975, 5010), '...
import numpy as np import matplotlib.pyplot as plt import padding def filtering(src, mask, pad_type='zero', return_uint8=True): print('filtering start...') h, w = src.shape[:2] mh, mw = mask.shape[:2] pad_img = padding.padding(src=src, pad_size=(mh//2, mw//2), pad_type=pad_type) dst = np.zeros((...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.imshow", "numpy.zeros", "padding.padding", "numpy.clip", "numpy.ones", "matplotlib.pyplot.figure", "numpy.arange", "numpy.exp", "numpy.round", "numpy.sqrt" ]
[((230, 302), 'padding.padding', 'padding.padding', ([], {'src': 'src', 'pad_size': '(mh // 2, mw // 2)', 'pad_type': 'pad_type'}), '(src=src, pad_size=(mh // 2, mw // 2), pad_type=pad_type)\n', (245, 302), False, 'import padding\n'), ((310, 326), 'numpy.zeros', 'np.zeros', (['(h, w)'], {}), '((h, w))\n', (318, 326), T...
import os import subprocess import sys import importlib import inspect import functools import tensorflow as tf import numpy as np from baselines.common import tf_util as U import re def store_args(method): """Stores provided method args as instance attributes. """ argspec = inspect.getfullargspec(method) ...
[ "tensorflow.contrib.layers.xavier_initializer", "numpy.argmax", "os.environ.copy", "tensorflow.reshape", "sys.stdout.flush", "subprocess.check_call", "tensorflow.concat", "tensorflow.cast", "sys.stderr.flush", "importlib.import_module", "subprocess.check_output", "baselines.common.tf_util.nume...
[((289, 319), 'inspect.getfullargspec', 'inspect.getfullargspec', (['method'], {}), '(method)\n', (311, 319), False, 'import inspect\n'), ((604, 627), 'functools.wraps', 'functools.wraps', (['method'], {}), '(method)\n', (619, 627), False, 'import functools\n'), ((2849, 2882), 'importlib.import_module', 'importlib.impo...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Nov 16 11:19:34 2018 @author: jennywong """ ############################################################################### # GETPARAMETERS.PY # ##############################################...
[ "slurpy.lookup.liquidus", "numpy.zeros", "slurpy.lookup.ohtaki", "slurpy.lookup.premgravity", "numpy.linspace", "scipy.interpolate.interp1d", "slurpy.lookup.premvp", "slurpy.lookup.premdensity", "scipy.integrate.simps" ]
[((1203, 1223), 'slurpy.lookup.liquidus', 'liquidus', (['csb_radius'], {}), '(csb_radius)\n', (1211, 1223), False, 'from slurpy.lookup import liquidus, premgravity, premdensity, premvp, ohtaki\n'), ((4057, 4076), 'slurpy.lookup.premgravity', 'premgravity', (['radius'], {}), '(radius)\n', (4068, 4076), False, 'from slur...
from moviepy.editor import * from PIL import Image, ImageOps import numpy as np from glob import glob def make_youtube_video(introfile, audiofile, cover_img, outputfn, firstchapter=False): """ Generate a video of an audiobook file given following parameters. :param introfile: introduction video clip (ie. ...
[ "PIL.ImageOps.pad", "numpy.asarray", "PIL.Image.open" ]
[((842, 863), 'PIL.Image.open', 'Image.open', (['cover_img'], {}), '(cover_img)\n', (852, 863), False, 'from PIL import Image, ImageOps\n'), ((1022, 1048), 'PIL.ImageOps.pad', 'ImageOps.pad', (['im_rsz', 'd_sz'], {}), '(im_rsz, d_sz)\n', (1034, 1048), False, 'from PIL import Image, ImageOps\n'), ((1067, 1089), 'numpy.a...
#!/usr/bin/env python3 #-*- coding:utf-8 -*- import numpy as np import matplotlib.pyplot as plt import pandas as pd np.random.seed(42) #设置随机种子 x = np.random.randn(100) #产生100符合均值为0,方差为1的正太分布数据 #手动计算直方图 bins = np.linspace(-5, 5, 20) #直方图的区间 counts = np.zeros_like(bins) #产生一个形状(维度)和bins相同,值全为0的矩阵 #为x中的每个元素在bins中找出其所在的...
[ "numpy.zeros_like", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.random.randn", "numpy.searchsorted", "numpy.linspace", "numpy.add.at" ]
[((117, 135), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (131, 135), True, 'import numpy as np\n'), ((148, 168), 'numpy.random.randn', 'np.random.randn', (['(100)'], {}), '(100)\n', (163, 168), True, 'import numpy as np\n'), ((211, 233), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(20)'], {...
#!/usr/bin/env python # Copyright 2019 <NAME> # author: <NAME> <<EMAIL>> # # 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...
[ "dask.dataframe.core.new_dd_object", "dask.dot.to_graphviz", "dask.delayed", "dask.highlevelgraph.HighLevelGraph.from_collections", "dask.optimization.fuse", "dask.base.tokenize", "itertools.zip_longest", "dask.optimization.cull", "numpy.cumsum", "numpy.array", "xarray.DataArray", "dask.highle...
[((10737, 10809), 'typing.TypeVar', 'T.TypeVar', (['"""ArrayVar"""', 'xarray.DataArray', 'dask.array.Array', 'numpy.ndarray'], {}), "('ArrayVar', xarray.DataArray, dask.array.Array, numpy.ndarray)\n", (10746, 10809), True, 'import typing as T\n'), ((2601, 2629), 'itertools.product', 'itertools.product', (['*block_id'],...
import os import pandas as pd import matplotlib.pyplot as plt import numpy as np path = os.path.join('output', 'test_1.csv') df = pd.read_csv(path) df = df.groupby(['Index', 'Asked for articles'])['Time in MS'].mean().reset_index() data_np = df.values # converting to numpy unique_classes = np.unique(data_np[:, 0]) ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.yscale", "matplotlib.pyplot.savefig", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join", "numpy.unique" ]
[((91, 127), 'os.path.join', 'os.path.join', (['"""output"""', '"""test_1.csv"""'], {}), "('output', 'test_1.csv')\n", (103, 127), False, 'import os\n'), ((133, 150), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (144, 150), True, 'import pandas as pd\n'), ((295, 319), 'numpy.unique', 'np.unique', (['da...
import copy import numpy as np import time from .freezable import Freezable class Timing(Freezable): def __init__(self, node, method_name=None): self.__name = type(node).__name__ self.__method_name = method_name self.__start = 0 self.__first_start = 0 self.__last_stop = 0 ...
[ "copy.deepcopy", "numpy.median", "time.time", "numpy.min", "numpy.mean", "numpy.max" ]
[((411, 422), 'time.time', 'time.time', ([], {}), '()\n', (420, 422), False, 'import time\n'), ((587, 598), 'time.time', 'time.time', ([], {}), '()\n', (596, 598), False, 'import time\n'), ((1795, 1813), 'numpy.min', 'np.min', (['self.times'], {}), '(self.times)\n', (1801, 1813), True, 'import numpy as np\n'), ((1849, ...
import unittest import numpy as np from mil.models import AttentionDeepPoolingMil from mil.utils.padding import Padding class TestAttentionDeepPoolingMil(unittest.TestCase): def setUp(self): self.training_bag = np.random.normal(0, 1, (30, 3, 28, 28, 1)) self.training_label = np.ze...
[ "unittest.main", "mil.models.AttentionDeepPoolingMil", "numpy.zeros", "numpy.random.normal", "mil.utils.padding.Padding" ]
[((2370, 2385), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2383, 2385), False, 'import unittest\n'), ((241, 283), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(30, 3, 28, 28, 1)'], {}), '(0, 1, (30, 3, 28, 28, 1))\n', (257, 283), True, 'import numpy as np\n'), ((315, 327), 'numpy.zeros', 'np.ze...
from tensorflow.keras.models import load_model from tensorflow.python.keras.backend import set_session import tensorflow as tf from flask import Flask, request, render_template, jsonify, send_file, url_for import os from PIL import Image, ImageOps import numpy as np import math import time import base64 app = Flask(__...
[ "base64.b64decode", "flask.jsonify", "numpy.ndarray", "flask.request.get_json", "tensorflow.python.keras.backend.set_session", "numpy.set_printoptions", "flask.request.headers.get", "flask.request.files.keys", "tensorflow.keras.models.load_model", "PIL.ImageOps.fit", "tensorflow.compat.v1.get_de...
[((312, 327), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (317, 327), False, 'from flask import Flask, request, render_template, jsonify, send_file, url_for\n'), ((531, 543), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (541, 543), True, 'import tensorflow as tf\n'), ((553, 585), 'tensorflow.co...
import numpy as np class Control: def __init__(self, model): # Bind model self.model = model # Desired x_pos self.xd = 0.0 # Control parameters self.N = 100 # Prediction and control horizon # Control parameters if se...
[ "numpy.zeros", "numpy.identity", "numpy.linalg.matrix_power", "numpy.arange", "numpy.kron", "numpy.eye", "numpy.mat" ]
[((803, 828), 'numpy.mat', 'np.mat', (['self.model.A_disc'], {}), '(self.model.A_disc)\n', (809, 828), True, 'import numpy as np\n'), ((841, 866), 'numpy.mat', 'np.mat', (['self.model.B_disc'], {}), '(self.model.B_disc)\n', (847, 866), True, 'import numpy as np\n'), ((1838, 1852), 'numpy.eye', 'np.eye', (['self.N'], {}...
from matplotlib import pyplot as plt import numpy as np forceControlData = np.load('force_control_response.npz') F = forceControlData['force'] U = forceControlData['displacement'] plt.plot(U, F, marker='o') plt.xlabel('Displacement') plt.ylabel('Force') plotComparison = True if plotComparison: dispControlData = ...
[ "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((76, 113), 'numpy.load', 'np.load', (['"""force_control_response.npz"""'], {}), "('force_control_response.npz')\n", (83, 113), True, 'import numpy as np\n'), ((182, 208), 'matplotlib.pyplot.plot', 'plt.plot', (['U', 'F'], {'marker': '"""o"""'}), "(U, F, marker='o')\n", (190, 208), True, 'from matplotlib import pyplot...
import numpy as np import random import matplotlib.pyplot as plt import matplotlib from io_utilities import load_data from visualizations import show_clusters_centroids def distance(a,b): """ Compute Euclidean Distance Between Two Points Input: a (list): an n-dimensional list or array b (l...
[ "matplotlib.pyplot.show", "numpy.argmin", "io_utilities.load_data", "visualizations.show_clusters_centroids", "numpy.mean", "numpy.array" ]
[((2602, 2631), 'io_utilities.load_data', 'load_data', (['"""./data/iris.data"""'], {}), "('./data/iris.data')\n", (2611, 2631), False, 'from io_utilities import load_data\n'), ((2651, 2683), 'numpy.array', 'np.array', (['[f[:-1] for f in data]'], {}), '([f[:-1] for f in data])\n', (2659, 2683), True, 'import numpy as ...
import numpy as np def simpson(f, a, b, nstrips): ''' Compute the quadrature of f on [a, b]. Parameters ---------- f : function The integrand a : float The start of the domain b : float The end of the domain nstrips : int The number of strips Retur...
[ "numpy.linspace" ]
[((405, 472), 'numpy.linspace', 'np.linspace', (['a', 'b'], {'num': '(2 * nstrips + 1)', 'endpoint': '(True)', 'retstep': '(True)'}), '(a, b, num=2 * nstrips + 1, endpoint=True, retstep=True)\n', (416, 472), True, 'import numpy as np\n')]
import numpy as np from sklearn import svm import matplotlib.pyplot as plt X = np.array([[0,0],[1,1]]) Y = [0,1] clf.fit(X,Y) clf =svm.SVC() svc(kernel='precomputed') clf.predict(gram) plt.scatter(X[:,0],X[:,1],c=Y,s=50,cmap='spring') plt.show()
[ "matplotlib.pyplot.scatter", "matplotlib.pyplot.show", "numpy.array", "sklearn.svm.SVC" ]
[((82, 108), 'numpy.array', 'np.array', (['[[0, 0], [1, 1]]'], {}), '([[0, 0], [1, 1]])\n', (90, 108), True, 'import numpy as np\n'), ((137, 146), 'sklearn.svm.SVC', 'svm.SVC', ([], {}), '()\n', (144, 146), False, 'from sklearn import svm\n'), ((194, 249), 'matplotlib.pyplot.scatter', 'plt.scatter', (['X[:, 0]', 'X[:, ...
#!/usr/bin/env python3 import math from decimal import * import numpy as np # CHANGEME: probtab = np.loadtxt(open("data/probability_table.csv", "rb"), delimiter=",").astype(Decimal) print("The marginal probabilities of all the values of 𝑋") print(probtab) print("- " * 10) px = np.sum(probtab, axis=0) py = np.sum(...
[ "math.log2", "numpy.sum" ]
[((283, 306), 'numpy.sum', 'np.sum', (['probtab'], {'axis': '(0)'}), '(probtab, axis=0)\n', (289, 306), True, 'import numpy as np\n'), ((312, 335), 'numpy.sum', 'np.sum', (['probtab'], {'axis': '(1)'}), '(probtab, axis=1)\n', (318, 335), True, 'import numpy as np\n'), ((864, 880), 'math.log2', 'math.log2', (['(j / k)']...
""" Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University. All rights reserved. Description : Author:<NAME> """ import os, glob from xml.dom.minidom import parse import xml.dom.minidom import config import numpy as np from sklearn.cluster import KMeans datase_name = 'inria_person' in...
[ "numpy.array", "sklearn.cluster.KMeans", "os.path.join" ]
[((2015, 2035), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': '(2)'}), '(n_clusters=2)\n', (2021, 2035), False, 'from sklearn.cluster import KMeans\n'), ((790, 858), 'os.path.join', 'os.path.join', (["dataset_info_map[datase_name]['anotation_dir']", '"""*xml"""'], {}), "(dataset_info_map[datase_name]['anotati...
# Copyright 2021 TileDB Inc. # Licensed under the MIT License. import numpy as np import pytest from tiledb.cf.creator import DataspaceRegistry from tiledb.cf.netcdf_engine import ( NetCDF4CoordToDimConverter, NetCDF4DimToDimConverter, NetCDF4ScalarToDimConverter, ) netCDF4 = pytest.importorskip("netCDF4"...
[ "pytest.importorskip", "tiledb.cf.netcdf_engine.NetCDF4CoordToDimConverter.from_netcdf", "numpy.dtype", "tiledb.cf.netcdf_engine.NetCDF4DimToDimConverter.from_netcdf", "pytest.raises", "numpy.arange", "numpy.testing.assert_equal", "numpy.random.rand", "pytest.mark.parametrize", "tiledb.cf.netcdf_e...
[((291, 321), 'pytest.importorskip', 'pytest.importorskip', (['"""netCDF4"""'], {}), "('netCDF4')\n", (310, 321), False, 'import pytest\n'), ((10119, 10167), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sparse"""', '[True, False]'], {}), "('sparse', [True, False])\n", (10142, 10167), False, 'import pytes...
from __future__ import print_function, division from keras.layers import Input, Dense, Reshape, Flatten, Dropout, concatenate from keras.layers import BatchNormalization, Activation, ZeroPadding2D from keras.layers.advanced_activations import LeakyReLU from keras.layers.convolutional import UpSampling2D, Conv2D from k...
[ "utils.dataset_utils.load_dataset", "numpy.ones", "keras.models.Model", "numpy.random.randint", "numpy.random.normal", "keras.layers.ZeroPadding2D", "keras.layers.Input", "keras.layers.Reshape", "keras.layers.concatenate", "tensorflow.GPUOptions", "pandas.DataFrame", "keras.layers.convolutiona...
[((521, 535), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (528, 535), True, 'import matplotlib as mpl\n'), ((990, 1015), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (1000, 1015), True, 'import tensorflow as tf\n'), ((12406, 12498), 'numpy.zeros', 'np.zeros', (...
import models import numpy as np import torch import torch.optim as optim import torch.nn.functional as F import torch.nn as nn from functools import reduce import torch.optim as optim import utils from datetime import datetime from PIL import Image from scipy.spatial.distance import pdist, squareform import torc...
[ "torch.nn.Dropout", "models.VGG16", "argparse.ArgumentParser", "torch.cat", "numpy.argsort", "numpy.mean", "scipy.spatial.distance.pdist", "torch.device", "glob.glob", "torch.no_grad", "torch.utils.data.DataLoader", "utils.get_stats", "torchvision.transforms.Compose", "numpy.random.choice"...
[((402, 458), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""VAE MNIST Example"""'}), "(description='VAE MNIST Example')\n", (425, 458), False, 'import argparse\n'), ((1571, 1615), 'torch.device', 'torch.device', (["('cuda' if args.cuda else 'cpu')"], {}), "('cuda' if args.cuda else 'cpu...
import torch import logging import sys import sacred import scipy.ndimage import numpy as np def place_tensor(tensor): """ Places a tensor on GPU, if PyTorch sees CUDA; otherwise, the returned tensor remains on CPU. """ if torch.cuda.is_available(): return tensor.cuda() return tensor ...
[ "torch.load", "numpy.zeros", "torch.save", "torch.squeeze", "torch.cuda.is_available", "torch.nn.functional.conv1d", "torch.unsqueeze", "torch.tensor" ]
[((244, 269), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (267, 269), False, 'import torch\n'), ((1567, 1599), 'torch.save', 'torch.save', (['save_dict', 'save_path'], {}), '(save_dict, save_path)\n', (1577, 1599), False, 'import torch\n'), ((1942, 1963), 'torch.load', 'torch.load', (['load_...
#!/usr/local/anaconda/bin/python # -*- coding: utf-8 -*- """ Created on Thu Oct 08 14:16:09 2015 @author: Derrick """ import glob import os import shutil import sys import numpy as np import obspy import pandas as pd # get start and stop times # stations = glob.glob(os.path.join(conDir,'*'))...
[ "pandas.DataFrame", "numpy.sum", "os.makedirs", "pandas.read_csv", "os.walk", "os.path.exists", "sys.stdout.flush", "obspy.UTCDateTime", "pandas.Series", "glob.glob", "os.path.join", "sys.exit", "obspy.read" ]
[((625, 648), 'obspy.UTCDateTime', 'obspy.UTCDateTime', (['utc1'], {}), '(utc1)\n', (642, 648), False, 'import obspy\n'), ((661, 684), 'obspy.UTCDateTime', 'obspy.UTCDateTime', (['utc2'], {}), '(utc2)\n', (678, 684), False, 'import obspy\n'), ((1260, 1361), 'os.path.join', 'os.path.join', (['conDir', 'stanet', 'year', ...
import requests import torch import numpy as np from . import payloadutils class Helper(): def __init__(self, datasource, task='binary_classifier'): self.dp_settings = None self.agg_settings = None self.task = task self.datasource = datasource def set_diff_privacy(self, mechan...
[ "numpy.random.uniform", "torch.repeat_interleave", "numpy.asarray", "numpy.array", "requests.post", "torch.is_tensor" ]
[((1582, 1601), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (1599, 1601), True, 'import numpy as np\n'), ((1797, 1825), 'torch.is_tensor', 'torch.is_tensor', (['input_point'], {}), '(input_point)\n', (1812, 1825), False, 'import torch\n'), ((1983, 2007), 'torch.is_tensor', 'torch.is_tensor', (['targe...
import numpy as np import heapq from dataclasses import dataclass, field from typing import Tuple, DefaultDict, Dict, List, Set from collections import defaultdict def read_file(filename): with open(filename) as f: return [line.strip() for line in f.readlines()] def parse_input(data: List[str]) -> np.ndar...
[ "heapq.heappush", "numpy.mod", "heapq.heappop", "dataclasses.field", "collections.defaultdict", "numpy.array" ]
[((336, 393), 'numpy.array', 'np.array', (['[[c for c in line] for line in data]'], {'dtype': 'int'}), '([[c for c in line] for line in data], dtype=int)\n', (344, 393), True, 'import numpy as np\n'), ((681, 720), 'dataclasses.field', 'field', ([], {'default_factory': 'list', 'repr': '(False)'}), '(default_factory=list...
""" Base class for Flat File vocabulary importers """ import numpy as np from collections import OrderedDict from os import path from vocabulary_importers.vocabulary_importer import VocabularyImporter class FlatFileVocabularyImporter(VocabularyImporter): """Base class for Flat File vocabulary importers """ ...
[ "collections.OrderedDict", "os.path.join", "numpy.array" ]
[((1387, 1449), 'os.path.join', 'path.join', (['vocabulary_dir', 'self.tokens_and_embeddings_filename'], {}), '(vocabulary_dir, self.tokens_and_embeddings_filename)\n', (1396, 1449), False, 'from os import path\n'), ((1483, 1496), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1494, 1496), False, 'from co...
# =============================================================================================================== # Copyright (c) 2019, Cornell University. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that # the following conditions...
[ "scipy.linalg.rq", "numpy.zeros", "numpy.all", "numpy.ones", "numpy.hstack", "numpy.vstack", "scipy.linalg.svd", "numpy.array", "scipy.linalg.det", "scipy.linalg.lstsq", "numpy.real", "numpy.dot", "numpy.diag" ]
[((2285, 2309), 'scipy.linalg.rq', 'linalg.rq', (['matrix[:, :3]'], {}), '(matrix[:, :3])\n', (2294, 2309), False, 'from scipy import linalg\n'), ((2959, 2977), 'numpy.diag', 'np.diag', (['(1, 1, 1)'], {}), '((1, 1, 1))\n', (2966, 2977), True, 'import numpy as np\n'), ((3203, 3217), 'numpy.dot', 'np.dot', (['r', 'fix']...
from collections import OrderedDict, namedtuple from functools import partial from six import string_types from artemis.config import get_artemis_config_value from artemis.general.checkpoint_counter import Checkpoints from artemis.plotting.matplotlib_backend import BarPlot, BoundingBoxPlot, ResamplingLineHistory from...
[ "artemis.general.checkpoint_counter.Checkpoints", "matplotlib.pyplot.clf", "artemis.config.get_artemis_config_value", "matplotlib.pyplot.figure", "artemis.remote.plotting.plotting_client.dbplot_remotely", "matplotlib.pyplot.close", "artemis.plotting.drawing_plots.redraw_figure", "artemis.plotting.expa...
[((878, 901), 'artemis.plotting.matplotlib_backend.is_server_plotting_on', 'is_server_plotting_on', ([], {}), '()\n', (899, 901), False, 'from artemis.plotting.matplotlib_backend import LinePlot, ImagePlot, is_server_plotting_on\n'), ((8117, 8173), 'collections.namedtuple', 'namedtuple', (['"""PlotWindow"""', "['figure...
import numpy as np import torch import shadow.losses def test_softmax_mse_loss(): """Simple test for softmax mse loss.""" input_logits = torch.tensor([[0.5, 1.]]) target_logits = torch.tensor([[1., 1.]]) # softmax of input_logits is 0.3775, 0.6225, and target_logits is 0.5, 0.5 # therefore would...
[ "numpy.array", "torch.tensor" ]
[((148, 174), 'torch.tensor', 'torch.tensor', (['[[0.5, 1.0]]'], {}), '([[0.5, 1.0]])\n', (160, 174), False, 'import torch\n'), ((194, 220), 'torch.tensor', 'torch.tensor', (['[[1.0, 1.0]]'], {}), '([[1.0, 1.0]])\n', (206, 220), False, 'import torch\n'), ((652, 678), 'torch.tensor', 'torch.tensor', (['[[0.5, 1.0]]'], {...
# -*- coding: utf-8 -*- # extract Balvan data from tifs import pandas as pd import skimage.io as skio import skimage.transform as skt import skimage.util as sku from tqdm import tqdm from glob import glob import os, random, math, cv2, re import numpy as np import matplotlib.pyplot as plt # %% src_dir = '....
[ "os.makedirs", "os.path.basename", "skimage.util.img_as_ubyte", "numpy.asarray", "os.path.exists", "glob.glob", "skimage.io.imsave", "skimage.io.imread" ]
[((1242, 1260), 'numpy.asarray', 'np.asarray', (['shapes'], {}), '(shapes)\n', (1252, 1260), True, 'import numpy as np\n'), ((459, 481), 'os.path.exists', 'os.path.exists', (['dir_IR'], {}), '(dir_IR)\n', (473, 481), False, 'import os, random, math, cv2, re\n'), ((488, 507), 'os.makedirs', 'os.makedirs', (['dir_IR'], {...
from __future__ import division from builtins import next from builtins import str from builtins import range from past.utils import old_div import re import numpy as np def parse_file(self): if self.prog == "GAUSSIAN": parse_file_gaussian(self) elif self.prog == "CQ": parse_file_cq(self) def parse_file_...
[ "past.utils.old_div", "numpy.asarray", "numpy.zeros", "numpy.genfromtxt", "builtins.next", "re.findall", "numpy.array", "builtins.str", "builtins.range", "numpy.delete" ]
[((400, 444), 'numpy.genfromtxt', 'np.genfromtxt', (['self.fieldFile'], {'delimiter': '""","""'}), "(self.fieldFile, delimiter=',')\n", (413, 444), True, 'import numpy as np\n'), ((460, 486), 'numpy.delete', 'np.delete', (['FieldData', '(0)', '(0)'], {}), '(FieldData, 0, 0)\n', (469, 486), True, 'import numpy as np\n')...
# Authors: <NAME> <<EMAIL>> # # License: BSD-3 (3-clause) import pytest import numpy as np import torch from braindecode.training.losses import mixup_criterion def test_mixup_criterion(): n_classes = 2 n_samples = 5 y_a = torch.zeros(n_samples, dtype=torch.int64) y_b = torch.ones(n_samples, dtype=tor...
[ "torch.ones", "braindecode.training.losses.mixup_criterion", "numpy.random.RandomState", "torch.arange", "torch.zeros", "pytest.approx" ]
[((237, 278), 'torch.zeros', 'torch.zeros', (['n_samples'], {'dtype': 'torch.int64'}), '(n_samples, dtype=torch.int64)\n', (248, 278), False, 'import torch\n'), ((289, 329), 'torch.ones', 'torch.ones', (['n_samples'], {'dtype': 'torch.int64'}), '(n_samples, dtype=torch.int64)\n', (299, 329), False, 'import torch\n'), (...
# Copyright (c) 2021 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...
[ "sys.path.append", "unittest.main", "functools.partial", "program_config.OpConfig", "auto_scan_test.AutoScanTest.__init__", "hypothesis.strategies.sampled_from", "numpy.random.random", "numpy.array", "hypothesis.strategies.integers" ]
[((622, 644), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (637, 644), False, 'import sys\n'), ((4218, 4242), 'unittest.main', 'unittest.main', ([], {'argv': "['']"}), "(argv=[''])\n", (4231, 4242), False, 'import unittest\n'), ((1111, 1155), 'auto_scan_test.AutoScanTest.__init__', 'AutoScanT...
import scipy.io import torch import numpy as np #import time import os ####################################################################### # Evaluate ''' 验证,传参:query_feature[i],query_label[i],query_cam[i],gallery_feature,gallery_label,gallery_cam :param qf torch.Tensor,待识别图片的特征 :param ql numpy.int32,待识...
[ "torch.mean", "torch.FloatTensor", "torch.mm", "numpy.setdiff1d", "numpy.argsort", "numpy.append", "os.path.isfile", "numpy.argwhere", "numpy.intersect1d", "numpy.in1d" ]
[((3248, 3284), 'torch.FloatTensor', 'torch.FloatTensor', (["result['query_f']"], {}), "(result['query_f'])\n", (3265, 3284), False, 'import torch\n'), ((3454, 3492), 'torch.FloatTensor', 'torch.FloatTensor', (["result['gallery_f']"], {}), "(result['gallery_f'])\n", (3471, 3492), False, 'import torch\n'), ((3651, 3684)...
import sys import os # sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from src.insightface.deploy import face_model from imutils import paths import numpy as np import pickle import cv2 import os def genFaceEmbedings(): print('---->>> Creating data embeddings <<<---') embedding_mo...
[ "imutils.paths.list_images", "pickle.dump", "cv2.cvtColor", "numpy.transpose", "cv2.imread", "src.insightface.deploy.face_model.FaceModel" ]
[((326, 419), 'src.insightface.deploy.face_model.FaceModel', 'face_model.FaceModel', (['"""112,112"""', '"""src/insightface/models/model-y1-test2/model,0"""', '(1.24)', '(0)'], {}), "('112,112',\n 'src/insightface/models/model-y1-test2/model,0', 1.24, 0)\n", (346, 419), False, 'from src.insightface.deploy import fac...
import unittest import numpy as np import tensorflow.keras.backend as K import lib.losses as losses import lib.spatial_geometry as spatial_geometry from lib.cameras import PinholeCamera # Losses assume the input: # y = [ quaternion, translation, shape3D ] # y = [ q0,q1,q2,q3, t0,t1,t2, sx0,sy0,sz0,...,sxN,syN,s...
[ "numpy.abs", "lib.losses.reprojection", "lib.losses.multiview_reprojection", "lib.losses.xqt", "numpy.mean", "unittest.main", "numpy.eye", "lib.losses.geometric_alignment", "numpy.reshape", "tensorflow.keras.backend.variable", "lib.spatial_geometry.quaternion_translation_to_pose", "numpy.squar...
[((766, 971), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -30.0, -0.98854052, 2.12746976, -3.8310884,\n -0.41849216, 2.69751813, -3.26104, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -40.0,\n 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -20.0]]'], {}), '([[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -30.0, -0.98854052, 2.12746976, -\n ...
import numpy as np from ...core.likelihood import Likelihood class BasicGravitationalWaveTransient(Likelihood): def __init__(self, interferometers, waveform_generator): """ A likelihood object, able to compute the likelihood of the data given some model parameters The simplest ...
[ "numpy.vdot", "numpy.nan_to_num" ]
[((2103, 2125), 'numpy.nan_to_num', 'np.nan_to_num', (['(-np.inf)'], {}), '(-np.inf)\n', (2116, 2125), True, 'import numpy as np\n'), ((3052, 3223), 'numpy.vdot', 'np.vdot', (['(interferometer.frequency_domain_strain - signal_ifo)', '((interferometer.frequency_domain_strain - signal_ifo) / interferometer.\n power_sp...
import numpy as np def l21shrink(epsilon, x): """ Args: epsilon: the shrinkage parameter x: matrix to shrink on Ref: wiki Regularization: {https://en.wikipedia.org/wiki/Regularization_(mathematics)} Returns: The shrunk matrix """ output = x.copy() norm = ...
[ "numpy.linalg.norm" ]
[((320, 352), 'numpy.linalg.norm', 'np.linalg.norm', (['x'], {'ord': '(2)', 'axis': '(0)'}), '(x, ord=2, axis=0)\n', (334, 352), True, 'import numpy as np\n')]
from styx_msgs.msg import TrafficLight import rospy import numpy as np import os import tensorflow as tf from utilities import label_map_util from utilities import visualization_utils as vis_util import cv2 class TLClassifier(object): def __init__(self, is_site): # set default value for no detection ...
[ "utilities.label_map_util.load_labelmap", "utilities.label_map_util.convert_label_map_to_categories", "utilities.visualization_utils.visualize_boxes_and_labels_on_image_array", "os.path.realpath", "tensorflow.Session", "numpy.expand_dims", "tensorflow.ConfigProto", "tensorflow.gfile.GFile", "tensorf...
[((790, 831), 'utilities.label_map_util.load_labelmap', 'label_map_util.load_labelmap', (['labels_file'], {}), '(labels_file)\n', (818, 831), False, 'from utilities import label_map_util\n'), ((853, 967), 'utilities.label_map_util.convert_label_map_to_categories', 'label_map_util.convert_label_map_to_categories', (['la...
import matplotlib.pyplot as plt from scipy import integrate import numpy as np plt.style.use('paper') reds = plt.get_cmap('Reds') blues = plt.get_cmap('Blues') class Constants: hbar_au = 1.0 h_au = hbar_au * 2.0 * np.pi kb_au = 3.1668114E-6 # hartrees K-1 h_SI = 6.62607004E-34 # J s na = 6....
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.get_cmap", "numpy.log", "matplotlib.pyplot.ylim", "numpy.std", "matplotlib.pyplot.style.use", "numpy.mean", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((79, 101), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""paper"""'], {}), "('paper')\n", (92, 101), True, 'import matplotlib.pyplot as plt\n'), ((109, 129), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""Reds"""'], {}), "('Reds')\n", (121, 129), True, 'import matplotlib.pyplot as plt\n'), ((138, 159), 'm...
import numpy as np import random import matplotlib.pyplot as plt import time from matplotlib.animation import FuncAnimation import matplotlib.animation as animation # from p5 import Vector, stroke, circle import warnings warnings.simplefilter('error') class Boid(object): def __init__(self, n_boids, width, delta_T,...
[ "numpy.fill_diagonal", "numpy.abs", "warnings.simplefilter", "numpy.random.randn", "numpy.zeros", "numpy.cross", "numpy.ones", "numpy.arccos", "numpy.mean", "numpy.array", "pdb.set_trace", "numpy.linalg.norm", "numpy.sign", "numpy.random.rand", "numpy.dot", "numpy.cos", "numpy.sin", ...
[((221, 251), 'warnings.simplefilter', 'warnings.simplefilter', (['"""error"""'], {}), "('error')\n", (242, 251), False, 'import warnings\n'), ((1557, 1585), 'numpy.all', 'np.all', (['(loc < self.width * 3)'], {}), '(loc < self.width * 3)\n', (1563, 1585), True, 'import numpy as np\n'), ((1601, 1630), 'numpy.all', 'np....
import matplotlib.pyplot as plt import numpy as np results = [] for line in open("results_target.txt","r"): eval(line) results_target = results x_targets = [] y_targets = [] for line in results_target: x_targets.append(line["target"]) y_targets.append(line["perfs_ft"][-1]) indices = np.argsort(x_targets) ...
[ "matplotlib.pyplot.xscale", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.asarray", "matplotlib.pyplot.legend", "numpy.argsort", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((298, 319), 'numpy.argsort', 'np.argsort', (['x_targets'], {}), '(x_targets)\n', (308, 319), True, 'import numpy as np\n'), ((643, 696), 'matplotlib.pyplot.plot', 'plt.plot', (['x_targets', 'y_targets'], {'label': '"""Dynamic width"""'}), "(x_targets, y_targets, label='Dynamic width')\n", (651, 696), True, 'import ma...
import os import torch import numpy as np import cv2 from torch.utils.data import Dataset from torch.nn.functional import interpolate import matplotlib.pyplot as plt class LOLDataset(Dataset): """LOL Sony dataset.""" def __init__(self, list_file ,root_dir, ps,transform=None): self.ps = p...
[ "numpy.minimum", "numpy.maximum", "numpy.flip", "cv2.cvtColor", "numpy.float32", "numpy.transpose", "cv2.imread", "numpy.random.randint", "os.path.join", "torch.from_numpy" ]
[((2369, 2402), 'numpy.random.randint', 'np.random.randint', (['(0)', '(W - self.ps)'], {}), '(0, W - self.ps)\n', (2386, 2402), True, 'import numpy as np\n'), ((2417, 2450), 'numpy.random.randint', 'np.random.randint', (['(0)', '(H - self.ps)'], {}), '(0, H - self.ps)\n', (2434, 2450), True, 'import numpy as np\n'), (...
import os import sys from typing import Any import numpy as np import torch from PIL import Image from torchvision import transforms from torchvision.datasets.utils import extract_archive from torchvision.datasets.vision import VisionDataset from src.datasets.specs import Input2dSpec # From DATASET_ROOT/chexpert/Che...
[ "numpy.maximum", "os.makedirs", "os.path.exists", "os.system", "torchvision.transforms.ToTensor", "numpy.array", "numpy.loadtxt", "src.datasets.specs.Input2dSpec", "torch.tensor", "torchvision.datasets.utils.extract_archive", "os.path.join", "os.startfile", "torchvision.transforms.Resize" ]
[((1252, 1448), 'numpy.array', 'np.array', (["[CHEXPERT_LABELS['Atelectasis'], CHEXPERT_LABELS['Cardiomegaly'],\n CHEXPERT_LABELS['Consolidation'], CHEXPERT_LABELS['Edema'],\n CHEXPERT_LABELS['Pleural Effusion']]"], {'dtype': 'np.int32'}), "([CHEXPERT_LABELS['Atelectasis'], CHEXPERT_LABELS['Cardiomegaly'],\n C...
import argparse import sys from tensorflow.python.framework import dtypes import tensorflow as tf import numpy as np from collections import namedtuple import json from os import makedirs from os import path FLAGS = None Datasets = namedtuple('Datasets', ['train', 'validation', 'test']) def export_def_graph(outdir=...
[ "argparse.ArgumentParser", "tensorflow.reshape", "tensorflow.matmul", "tensorflow.Variable", "numpy.arange", "tensorflow.nn.conv2d", "tensorflow.InteractiveSession", "tensorflow.get_default_graph", "tensorflow.truncated_normal", "numpy.multiply", "tensorflow.nn.softmax_cross_entropy_with_logits"...
[((234, 289), 'collections.namedtuple', 'namedtuple', (['"""Datasets"""', "['train', 'validation', 'test']"], {}), "('Datasets', ['train', 'validation', 'test'])\n", (244, 289), False, 'from collections import namedtuple\n'), ((545, 583), 'tensorflow.truncated_normal', 'tf.truncated_normal', (['shape'], {'stddev': '(0....
from fypy.model.FourierModel import FourierModel import numpy as np from scipy.fft import ifft from fypy.pricing.StrikesPricer import StrikesPricer from scipy.interpolate import interp1d from scipy.integrate import quad class LewisEuropeanPricer(StrikesPricer): def __init__(self, model: FourierMo...
[ "numpy.log", "scipy.integrate.quad", "numpy.arange", "numpy.exp", "scipy.interpolate.interp1d", "scipy.fft.ifft", "numpy.sqrt" ]
[((1590, 1602), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (1599, 1602), True, 'import numpy as np\n'), ((3134, 3148), 'numpy.log', 'np.log', (['(S0 / K)'], {}), '(S0 / K)\n', (3140, 3148), True, 'import numpy as np\n'), ((1517, 1529), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (1526, 1529), True, 'impo...
#!/usr/bin/env python # Copyright 2017 Johns Hopkins University (<NAME>) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import copy import json import logging import math import os import re # chainer related import chainer from chainer.datasets import TransformDataset from chainer import reporter as ...
[ "espnet.asr.asr_utils.adadelta_eps_decay", "espnet.nets.e2e_asr_th.E2E", "torch.optim.Adadelta", "espnet.asr.asr_utils.restore_snapshot", "json.dumps", "espnet.asr.asr_utils.CompareValueTrigger", "numpy.exp", "torch.device", "torch.no_grad", "chainer.training.extensions.LogReport", "espnet.lm.ex...
[((1364, 1385), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1378, 1385), False, 'import matplotlib\n'), ((1444, 1465), 're.search', 're.search', (['"""\\\\d+$"""', 's'], {}), "('\\\\d+$', s)\n", (1453, 1465), False, 'import re\n'), ((1513, 1536), 're.search', 're.search', (['"""^[a-z]+"""', '...
# -*- coding: utf-8 -*- """ 2019-10-07-adjustables.py: Experiment runner file for generating data for many combinations of numbers of high- vs. low-fidelity samples, specifically for the adjustable benchmark functions. A specific adjustable parameter can be given as commandline argument. """ __author__ = '<NAME>' __e...
[ "experiments.create_model_error_grid", "numpy.linspace", "itertools.product", "experiments.Instance", "pyprojroot.here" ]
[((512, 549), 'pyprojroot.here', 'here', (['"""files/2019-10-07-adjustables/"""'], {}), "('files/2019-10-07-adjustables/')\n", (516, 549), False, 'from pyprojroot import here\n'), ((1427, 1467), 'itertools.product', 'product', (['cases', 'kernels', 'scaling_options'], {}), '(cases, kernels, scaling_options)\n', (1434, ...
import numpy as np from cost_functions import trajectory_cost_fn import time import logging def dd(s): logging.getLogger("hw4").debug(s) def di(s): logging.getLogger("hw4").info(s) class Controller(): def __init__(self): pass # Get the appropriate action(s) for this state(s) def get_act...
[ "cost_functions.trajectory_cost_fn", "logging.getLogger", "numpy.argmin", "numpy.tile", "numpy.concatenate" ]
[((1504, 1549), 'numpy.tile', 'np.tile', (['state', '(self.num_simulated_paths, 1)'], {}), '(state, (self.num_simulated_paths, 1))\n', (1511, 1549), True, 'import numpy as np\n'), ((2957, 3019), 'cost_functions.trajectory_cost_fn', 'trajectory_cost_fn', (['self.cost_fn', 'states', 'actions', 'next_states'], {}), '(self...
""" Movie recommender. Copyright (C) <NAME> 2019 See the LICENSE file for more information. Example usage: $ python rmovie.py "lord of the rings" $ python rmovie.py "shawshank redemption" """ import argparse import numpy as np import pandas as pd if __name__ != '__main__': m = '"rmovie.py" can\'t be imported' ...
[ "pandas.read_csv", "numpy.any", "argparse.ArgumentParser", "numpy.unique" ]
[((358, 383), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (381, 383), False, 'import argparse\n'), ((3288, 3317), 'numpy.unique', 'np.unique', (['recommended_movies'], {}), '(recommended_movies)\n', (3297, 3317), True, 'import numpy as np\n'), ((610, 641), 'pandas.read_csv', 'pd.read_csv', (...
import numpy as np import tensorflow as tf tf.compat.v1.disable_eager_execution() # need to disable eager in TF2.x input_size = 3 # the length of input feature vectors to simple RNN cells output_size = 5 # the length of output feature vectors produced by simple RNN cells """ * When thinking in low level, the op...
[ "tensorflow.random.normal", "tensorflow.compat.v1.placeholder", "tensorflow.compat.v1.disable_eager_execution", "tensorflow.compat.v1.Session", "tensorflow.matmul", "numpy.array", "tensorflow.compat.v1.global_variables_initializer" ]
[((44, 82), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (80, 82), True, 'import tensorflow as tf\n'), ((1188, 1244), 'tensorflow.compat.v1.placeholder', 'tf.compat.v1.placeholder', (['tf.float32', '[input_size, None]'], {}), '(tf.float32, [input_size, None])...
import pickle import fire import matplotlib.pyplot as plt import numpy as np def create_graph(time_trace_path, out, roi_select="0 1 2 3 4 5 6 7 8 9 10 11"): with open(time_trace_path, "rb") as f: time_traces = pickle.load(f) std_past = None for num_1, key in enumerate(time_traces.keys()): ...
[ "fire.Fire", "numpy.std", "numpy.hstack", "matplotlib.pyplot.figure", "pickle.load", "numpy.arange", "matplotlib.pyplot.gcf", "numpy.vstack" ]
[((1802, 1825), 'fire.Fire', 'fire.Fire', (['create_graph'], {}), '(create_graph)\n', (1811, 1825), False, 'import fire\n'), ((225, 239), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (236, 239), False, 'import pickle\n'), ((686, 710), 'numpy.vstack', 'np.vstack', (['mean_flor_den'], {}), '(mean_flor_den)\n', (69...
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by <NAME> (<EMAIL>) # ------------------------------------------------------------------------------ from __future__ import absolute_import from __future__ impor...
[ "numpy.array", "yaml.load", "os.path.join", "easydict.EasyDict" ]
[((472, 479), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (477, 479), True, 'from easydict import EasyDict as edict\n'), ((654, 661), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (659, 661), True, 'from easydict import EasyDict as edict\n'), ((805, 812), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (810, 812)...
import os import time import numpy as np import cv2 def getPathList(path, suffix='png'): if (path[-1] != '/') & (path[-1] != '\\'): path = path + '/' pathlist = list() g = os.walk(path) for p, d, filelist in g: for filename in filelist: if filename.endswith(suffix): ...
[ "os.mkdir", "os.path.isdir", "os.walk", "numpy.ascontiguousarray", "numpy.clip", "time.time", "numpy.array", "os.path.split", "os.path.join" ]
[((194, 207), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (201, 207), False, 'import os\n'), ((671, 703), 'numpy.array', 'np.array', (['mean'], {'dtype': 'np.float32'}), '(mean, dtype=np.float32)\n', (679, 703), True, 'import numpy as np\n'), ((714, 745), 'numpy.array', 'np.array', (['std'], {'dtype': 'np.float32...
import os, sys from pdb import set_trace as st import numpy as np from functools import partial import copy from model.config import LENET import nninst_mode as mode from dataset import mnist from dataset.config import MNIST_TRAIN from dataset.mnist_transforms import * from trace.lenet_mnist_class_trace_v2 import ( ...
[ "functools.partial", "model.config.LENET.network_class.graph", "numpy.set_printoptions", "numpy.count_nonzero", "copy.deepcopy", "numpy.packbits", "numpy.zeros", "numpy.unravel_index", "numpy.array", "numpy.reshape", "numpy.logical_or", "numpy.ravel_multi_index", "trace.common.class_trace", ...
[((1007, 1075), 'trace.common.class_trace', 'class_trace', (['trace_name'], {'model_config': 'LENET', 'data_config': 'data_config'}), '(trace_name, model_config=LENET, data_config=data_config)\n', (1018, 1075), False, 'from trace.common import class_trace\n'), ((1493, 1510), 'numpy.packbits', 'np.packbits', (['mask'], ...
import numpy as np from layers import ( FullyConnectedLayer, ReLULayer, ConvolutionalLayer, MaxPoolingLayer, Flattener, softmax_with_cross_entropy, l2_regularization, softmax_with_cross_entropy, softmax ) class ConvNet: """ Implements a very simple conv net Input -> Conv[3x3] -> Relu -> ...
[ "layers.Flattener", "numpy.zeros_like", "layers.ConvolutionalLayer", "numpy.argmax", "layers.MaxPoolingLayer", "layers.softmax_with_cross_entropy", "layers.FullyConnectedLayer", "layers.softmax", "layers.ReLULayer" ]
[((1115, 1167), 'layers.ConvolutionalLayer', 'ConvolutionalLayer', (['n_channels', 'conv1_channels', '(3)', '(1)'], {}), '(n_channels, conv1_channels, 3, 1)\n', (1133, 1167), False, 'from layers import FullyConnectedLayer, ReLULayer, ConvolutionalLayer, MaxPoolingLayer, Flattener, softmax_with_cross_entropy, l2_regular...
#!/usr/bin/python3 import matplotlib.pyplot as plt import numpy as np import copy import re # Helper functions def getRowsAndCols(line): index = 0 words = line.split() for word in words: if index == 0: try: rows = int(word) except: raise Exce...
[ "numpy.zeros" ]
[((1062, 1078), 'numpy.zeros', 'np.zeros', (['(0, 0)'], {}), '((0, 0))\n', (1070, 1078), True, 'import numpy as np\n')]
import sys import os import cv2 as cv import numpy as np import piexif import piexif.helper class Photo: ''' Photo class to store individual photo data ''' def __init__(self, image): self.image = image def imageCV(self, image): ''' Return image as cv image array ''' im = cv.imrea...
[ "os.path.join", "cv2.waitKey", "cv2.destroyAllWindows", "numpy.asarray", "os.walk", "cv2.imwrite", "cv2.createAlignMTB", "cv2.imread", "piexif.load", "cv2.createMergeDebevec", "cv2.createCalibrateDebevec", "cv2.imshow", "cv2.createTonemapReinhard" ]
[((2352, 2380), 'cv2.imread', 'cv.imread', (['"""hdr_preview.jpg"""'], {}), "('hdr_preview.jpg')\n", (2361, 2380), True, 'import cv2 as cv\n'), ((2381, 2402), 'cv2.imshow', 'cv.imshow', (['"""HDR"""', 'hdr'], {}), "('HDR', hdr)\n", (2390, 2402), True, 'import cv2 as cv\n'), ((2403, 2416), 'cv2.waitKey', 'cv.waitKey', (...
from matplotlib import pyplot as plt import numpy as np file_name='../result_split.txt' def draw_best(): with open(file_name,'r') as f: plt.figure() old_freq=0 accuracy=[] best=[] for line in f.readlines(): freq=line.strip().split()[2][:-1] accu=line.s...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.savefig" ]
[((1537, 1549), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1547, 1549), True, 'from matplotlib import pyplot as plt\n'), ((1694, 1706), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (1704, 1706), True, 'from matplotlib import pyplot as plt\n'), ((1711, 1740), 'matplotlib.pyplot.savefig',...
import subprocess import pandas import io import requests import time import json from matplotlib import pyplot as plt import numpy as np from merlin.core import analysistask class SlurmReport(analysistask.AnalysisTask): """ An analysis task that generates reports on previously completed analysis tasks ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.yscale", "io.StringIO", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.legend", "matplotlib.pyplot.setp", "json.dumps", "time.time", "matplotlib.pyplot.figure", "n...
[((3037, 3064), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 4)'}), '(figsize=(15, 4))\n', (3047, 3064), True, 'from matplotlib import pyplot as plt\n'), ((3074, 3094), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(4)', '(1)'], {}), '(1, 4, 1)\n', (3085, 3094), True, 'from matplotlib import...
import numpy as np import cv2 as cv from matplotlib import pyplot as plt from tkinter import filedialog from tkinter import * import matplotlib.pyplot as plt from skimage import data, util from skimage.draw import ellipse from skimage.measure import label, regionprops from skimage.transform import rotate impo...
[ "matplotlib.pyplot.title", "numpy.sum", "matplotlib.pyplot.figure", "cv2.ellipse", "numpy.mean", "numpy.sin", "cv2.erode", "cv2.imshow", "cv2.line", "numpy.zeros_like", "numpy.std", "cv2.cvtColor", "tkinter.filedialog.askopenfilename", "cv2.setMouseCallback", "cv2.fitEllipse", "cv2.dra...
[((474, 598), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'initialdir': '"""/"""', 'title': '"""Select file"""', 'filetypes': "(('all files', '.*'), ('jpg files', '.jpg'))"}), "(initialdir='/', title='Select file', filetypes=(\n ('all files', '.*'), ('jpg files', '.jpg')))\n", (500, 598...
import cv2 as cv import numpy as np IMAGE = cv.imread('D:\@Semester 06\Digital Image Processing\Lab\Manuals\Figures\lab7\_img1.png', 0) cv.imshow('Original Image', IMAGE) cv.waitKey() cv.destroyAllWindows() print(IMAGE.shape) def globalAdaptiveThreshold(_img): size = np.shape(_img) # Find img size rows = s...
[ "cv2.waitKey", "cv2.destroyAllWindows", "numpy.zeros", "numpy.shape", "cv2.imread", "numpy.mean", "cv2.imshow" ]
[((45, 153), 'cv2.imread', 'cv.imread', (['"""D:\\\\@Semester 06\\\\Digital Image Processing\\\\Lab\\\\Manuals\\\\Figures\\\\lab7\\\\_img1.png"""', '(0)'], {}), "(\n 'D:\\\\@Semester 06\\\\Digital Image Processing\\\\Lab\\\\Manuals\\\\Figures\\\\lab7\\\\_img1.png'\n , 0)\n", (54, 153), True, 'import cv2 as cv\n')...
''' ModelNet dataset. Support ModelNet40, ModelNet10, XYZ and normal channels. Up to 10000 points. ''' import os import os.path import numpy as np import sys from glob import glob from collections import Counter import tensorflow as tf BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = BASE_DIR sys....
[ "provider.shuffle_points", "numpy.load", "numpy.sum", "numpy.mean", "numpy.arange", "provider.rotate_perturbation_point_cloud_with_normal", "glob.glob", "os.path.join", "provider.rotate_perturbation_point_cloud", "os.path.abspath", "numpy.random.choice", "collections.Counter", "provider.rota...
[((269, 294), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (284, 294), False, 'import os\n'), ((332, 363), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""utils"""'], {}), "(ROOT_DIR, 'utils')\n", (344, 363), False, 'import os\n'), ((439, 458), 'numpy.mean', 'np.mean', (['pc'], {'axis': '...
import setting.constant as const import numpy as np import cv2 def overlay(image, layer): if (len(layer.shape) == 2): layer = cv2.cvtColor(layer, cv2.COLOR_GRAY2BGR) image = cv2.cvtColor(image, cv2.COLOR_BGR2BGRA) layer = cv2.cvtColor(layer, cv2.COLOR_BGR2BGRA) layer[np.where((layer == [0...
[ "cv2.equalizeHist", "cv2.Canny", "numpy.uint8", "cv2.bitwise_not", "cv2.GaussianBlur", "cv2.medianBlur", "cv2.cvtColor", "cv2.threshold", "numpy.zeros", "numpy.clip", "cv2.addWeighted", "cv2.split", "numpy.array", "numpy.mean", "cv2.createCLAHE", "cv2.merge" ]
[((196, 235), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2BGRA'], {}), '(image, cv2.COLOR_BGR2BGRA)\n', (208, 235), False, 'import cv2\n'), ((248, 287), 'cv2.cvtColor', 'cv2.cvtColor', (['layer', 'cv2.COLOR_BGR2BGRA'], {}), '(layer, cv2.COLOR_BGR2BGRA)\n', (260, 287), False, 'import cv2\n'), ((487, 529), ...
import sys sys.path.append("..") sys.path.append("../..") import numpy as np import os import argparse from sklearn.metrics import accuracy_score import tensorflow as tf from data.synthetic_dataset_wt_conf_za_link import SyntheticDataset, confounder_monotonicities_1,get_subportion_confounders import pandas as pd fro...
[ "tensorflow.random.set_seed", "numpy.random.seed", "argparse.ArgumentParser", "numpy.sum", "sklearn.metrics.accuracy_score", "sklearn.preprocessing.MinMaxScaler", "numpy.ones", "data.synthetic_dataset_wt_conf_za_link.get_subportion_confounders", "sklearn.metrics.f1_score", "numpy.random.randint", ...
[((12, 33), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (27, 33), False, 'import sys\n'), ((34, 58), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (49, 58), False, 'import sys\n'), ((1653, 1667), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {}), '()\...
from kuruve.envs.GymEnv import KuruveGymEnv from kuruve.KurveGame import * from gym import spaces import pygame import numpy as np import math class SimpleAiEnv(KuruveGymEnv): """ Environment with an AI opponent """ def __init__(self, headless=False, observation_size=(64, 64), fps_cap=0, frameskip=0,...
[ "numpy.dstack", "pygame.Surface", "math.ceil", "pygame.draw.rect", "gym.spaces.Discrete", "gym.spaces.Box", "pygame.surfarray.pixels3d", "numpy.dot" ]
[((758, 790), 'pygame.Surface', 'pygame.Surface', (['self.screen_size'], {}), '(self.screen_size)\n', (772, 790), False, 'import pygame\n'), ((895, 913), 'gym.spaces.Discrete', 'spaces.Discrete', (['(3)'], {}), '(3)\n', (910, 913), False, 'from gym import spaces\n'), ((947, 1047), 'gym.spaces.Box', 'spaces.Box', ([], {...
import os import sys import argparse import cv2 import numpy as np from tensorflow import keras sys.path.insert(1, './src/file_management') import file_manager ############################################################################################################### def pre_process(image): ""...
[ "tensorflow.keras.models.load_model", "argparse.ArgumentParser", "file_manager.get_content_from_folder", "numpy.expand_dims", "sys.path.insert", "numpy.mean", "os.path.join" ]
[((106, 149), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""./src/file_management"""'], {}), "(1, './src/file_management')\n", (121, 149), False, 'import sys\n'), ((846, 890), 'file_manager.get_content_from_folder', 'file_manager.get_content_from_folder', (['folder'], {}), '(folder)\n', (882, 890), False, 'import ...
""" This class will be removed before the first stable version of ZairaChem. Computing time is simply unaffordable for the stacking methodology, unfortunately. """ import os import numpy as np import pandas as pd import json import h5py import joblib from .. import ZairaBase from ..estimators.base import BaseEstimator...
[ "pandas.DataFrame", "json.load", "pandas.read_csv", "numpy.hstack", "numpy.array", "os.path.join", "pandas.concat" ]
[((2990, 3007), 'numpy.hstack', 'np.hstack', (['self.X'], {}), '(self.X)\n', (2999, 3007), True, 'import numpy as np\n'), ((3021, 3058), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'columns': 'self.columns'}), '(X, columns=self.columns)\n', (3033, 3058), True, 'import pandas as pd\n'), ((3610, 3628), 'numpy.array', 'n...