code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
"NN models for classification" import re import tensorflow as tf from tensorflow import keras import numpy as np import sqlite3 import random import os import glob import sys from multiprocessing import Pool from functools import partial from transformers import BertTokenizer, TFBertModel from sklearn.metrics import m...
[ "csv.reader", "tensorflow.compat.v1.InteractiveSession", "tensorflow.keras.layers.Dense", "compare.SimMul", "tensorflow.keras.layers.Multiply", "transformers.TFBertModel.from_pretrained", "tensorflow.keras.layers.GlobalMaxPooling1D", "tensorflow.keras.callbacks.ModelCheckpoint", "sys.exc_info", "t...
[((632, 645), 'tensorflow.compat.v1.ConfigProto', 'ConfigProto', ([], {}), '()\n', (643, 645), False, 'from tensorflow.compat.v1 import ConfigProto\n'), ((753, 786), 'tensorflow.compat.v1.InteractiveSession', 'InteractiveSession', ([], {'config': 'config'}), '(config=config)\n', (771, 786), False, 'from tensorflow.comp...
""" Methods to upsample or downsample an image via DNN super-resolution or pyramid scheme, respectively. Note that the super-resolution models need to be downloaded separately, as they are not my own original work. Four methods are compatible with this package: - [EDSR](https://arxiv.org/pdf/1707.02921.pdf) ([impleme...
[ "os.path.isdir", "numpy.sort", "skimage.measure.block_reduce", "pathlib.Path", "cv2.pyrDown", "os.listdir", "cv2.dnn_superres.DnnSuperResImpl_create" ]
[((2642, 2666), 'numpy.sort', 'np.sort', (['availableModels'], {}), '(availableModels)\n', (2649, 2666), True, 'import numpy as np\n'), ((5181, 5218), 'cv2.dnn_superres.DnnSuperResImpl_create', 'dnn_superres.DnnSuperResImpl_create', ([], {}), '()\n', (5216, 5218), False, 'from cv2 import dnn_superres\n'), ((6572, 6590)...
import phydra import numpy as np @phydra.comp(init_stage=5) class EMPOWER_Growth_ML: """ XXX """ resource = phydra.variable(foreign=True, flux='growth', negative=True) consumer = phydra.variable(foreign=True, flux='growth', negative=False) mu_max = phydra.parameter(description='maximum growth ra...
[ "numpy.log", "phydra.forcing", "phydra.flux", "phydra.parameter", "numpy.exp", "phydra.variable", "phydra.comp" ]
[((37, 62), 'phydra.comp', 'phydra.comp', ([], {'init_stage': '(5)'}), '(init_stage=5)\n', (48, 62), False, 'import phydra\n'), ((1250, 1275), 'phydra.comp', 'phydra.comp', ([], {'init_stage': '(4)'}), '(init_stage=4)\n', (1261, 1275), False, 'import phydra\n'), ((2348, 2373), 'phydra.comp', 'phydra.comp', ([], {'init_...
import cv2 import numpy as np from PIL import ImageFont, ImageDraw, Image import textwrap import random import os import string import config async def process_pic(content, book_name): if not content and not book_name: return os.path.join(config.res, 'source', 'mkmeme', 'luxun_say', 'sample.png') tex...
[ "random.sample", "cv2.imwrite", "textwrap.wrap", "PIL.ImageFont.truetype", "numpy.array", "PIL.ImageDraw.Draw", "os.path.join" ]
[((349, 418), 'os.path.join', 'os.path.join', (['config.res', '"""source"""', '"""mkmeme"""', '"""luxun_say"""', '"""msyh.ttf"""'], {}), "(config.res, 'source', 'mkmeme', 'luxun_say', 'msyh.ttf')\n", (361, 418), False, 'import os\n'), ((616, 637), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (6...
import cvxpy as cp import numpy as np from numpy.linalg import pinv, inv, norm from scipy.linalg import eig def alternative_minimization(X, alpha, beta, num_iters, dual=False): n = X.shape[0] """ helper functions """ def dual_helper(Y): m = n * (n + 1) // 2 # positio...
[ "numpy.diag", "numpy.trace", "numpy.abs", "cvxpy.trace", "numpy.zeros", "numpy.ones", "numpy.arange", "cvxpy.Problem", "numpy.linalg.norm", "cvxpy.Variable", "cvxpy.norm", "numpy.eye", "numpy.linalg.pinv", "numpy.vstack", "cvxpy.quad_form" ]
[((3628, 3648), 'numpy.arange', 'np.arange', (['num_iters'], {}), '(num_iters)\n', (3637, 3648), True, 'import numpy as np\n'), ((341, 357), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (349, 357), True, 'import numpy as np\n'), ((393, 408), 'numpy.arange', 'np.arange', (['(0)', 'n'], {}), '(0, n)\n', (40...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from statsmodels.discrete.discrete_model import Logit from sklearn.linear_model import LogisticRegression #from high_dim_log_reg import hdlr2 #from high_dim_log_reg.datasets import bernoulli X=np.load('high_dim_log_reg/datasets/bernoulli_X.npy') b...
[ "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "statsmodels.discrete.discrete_model.Logit", "numpy.where", "sklearn.preprocessing.normalize", "numpy.squeeze", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((266, 318), 'numpy.load', 'np.load', (['"""high_dim_log_reg/datasets/bernoulli_X.npy"""'], {}), "('high_dim_log_reg/datasets/bernoulli_X.npy')\n", (273, 318), True, 'import numpy as np\n'), ((321, 373), 'numpy.load', 'np.load', (['"""high_dim_log_reg/datasets/bernoulli_b.npy"""'], {}), "('high_dim_log_reg/datasets/be...
""" AllenNLP uses most `PyTorch learning rate schedulers <http://pytorch.org/docs/master/optim.html#how-to-adjust-learning-rate>`_, with a thin wrapper to allow registering them and instantiating them ``from_params``. The available learning rate schedulers from PyTorch are * `"step" <http://pytorch.org/docs/master/op...
[ "allennlp.common.checks.ConfigurationError", "numpy.cos", "logging.getLogger" ]
[((1856, 1883), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1873, 1883), False, 'import logging\n'), ((4104, 4288), 'allennlp.common.checks.ConfigurationError', 'ConfigurationError', (['"""The reduce_on_plateau learning rate scheduler requires a validation metric to compute the schedu...
"""Metrics. Evaluation metrics * :func:`.log_prob` * :func:`.acc` * :func:`.accuracy` * :func:`.mse` * :func:`.sse` * :func:`.mae` ---------- """ __all__ = [ "accuracy", "mean_squared_error", "sum_squared_error", "mean_absolute_error", "r_squared", "true_positive_rate", "true_negative_...
[ "numpy.abs", "numpy.sum", "numpy.square", "numpy.expand_dims", "numpy.mean" ]
[((1504, 1529), 'numpy.mean', 'np.mean', (['(y_pred == y_true)'], {}), '(y_pred == y_true)\n', (1511, 1529), True, 'import numpy as np\n'), ((2254, 2273), 'numpy.sum', 'np.sum', (['(y_true == 1)'], {}), '(y_true == 1)\n', (2260, 2273), True, 'import numpy as np\n'), ((2283, 2325), 'numpy.sum', 'np.sum', (['((y_pred == ...
# This script is for learning. import cv2 # cv2.setNumThreads(0) import os import shutil import numpy as np from sklearn.utils import shuffle from sklearn.model_selection import train_test_split from utilities import resize_image, random_distort, load_train_data, load_train_data_multi, load_train_data_multi_pack...
[ "os.mkdir", "numpy.load", "numpy.abs", "numpy.sum", "numpy.argmax", "numpy.empty", "utilities.resize_image", "numpy.clip", "numpy.random.default_rng", "torch.nn.NLLLoss", "os.path.isfile", "numpy.mean", "numpy.linalg.norm", "numpy.arange", "numpy.exp", "cv2.imshow", "utilities.load_t...
[((1207, 1320), 'numpy.empty', 'np.empty', (['(batchSize, nFramesSample, featureSample.shape[0], featureSample.shape[1],\n featureSample.shape[2])'], {}), '((batchSize, nFramesSample, featureSample.shape[0], featureSample.\n shape[1], featureSample.shape[2]))\n', (1215, 1320), True, 'import numpy as np\n'), ((132...
# -*- coding: utf-8 -*- import os import math import numpy as np import nibabel as nib from nilearn.image import math_img, threshold_img from nilearn.masking import intersect_masks from sklearn.cluster import KMeans from scipy.spatial import distance_matrix """ People will never want to ROIze only the seed and loo...
[ "os.mkdir", "scipy.spatial.distance_matrix", "numpy.argsort", "numpy.arange", "os.path.join", "numpy.unique", "nilearn.image.threshold_img", "sklearn.cluster.KMeans", "nilearn.image.math_img", "os.path.exists", "nibabel.save", "nibabel.Nifti1Image", "math.sqrt", "os.path.basename", "nump...
[((12312, 12333), 'nibabel.load', 'nib.load', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (12320, 12333), True, 'import nibabel as nib\n'), ((12342, 12409), 'nibabel.load', 'nib.load', (['"""/data/BCBlab/Data/tests/Thr100_2mm_avg152T1_gray.nii.gz"""'], {}), "('/data/BCBlab/Data/tests/Thr100_2mm_avg152T1_gray.nii.gz')\n",...
# -*- coding: utf-8 -*- """ Created on Thu Feb 01 08:07:14 2018 @author: zhaoy """ import os import os.path as osp import numpy as np import json import argparse from fnmatch import fnmatch import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt from matplotlib.ticker import AutoMinorLocator from numpy...
[ "numpy.polyfit", "numpy.argsort", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "os.path.join", "numpy.polyval", "os.path.exists", "numpy.log10", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "os.path.basename", "matplotlib.pyplot.legend", "os.path.realpath", "matplotlib.color...
[((209, 230), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (223, 230), False, 'import matplotlib\n'), ((1168, 1180), 'numpy.array', 'np.array', (['xs'], {}), '(xs)\n', (1176, 1180), True, 'import numpy as np\n'), ((1190, 1202), 'numpy.array', 'np.array', (['ys'], {}), '(ys)\n', (1198, 1202), Tr...
# Copyright 2018 The TensorFlow 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 applicab...
[ "numpy.square", "numpy.concatenate", "gym.envs.mujoco.mujoco_env.MujocoEnv.__init__", "gym.utils.EzPickle.__init__" ]
[((1244, 1293), 'gym.envs.mujoco.mujoco_env.MujocoEnv.__init__', 'mujoco_env.MujocoEnv.__init__', (['self', 'file_path', '(5)'], {}), '(self, file_path, 5)\n', (1273, 1293), False, 'from gym.envs.mujoco import mujoco_env\n'), ((1298, 1327), 'gym.utils.EzPickle.__init__', 'utils.EzPickle.__init__', (['self'], {}), '(sel...
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
[ "pandas.DataFrame", "modin.pandas.test.utils.random_state.randint", "io.StringIO", "modin.pandas.Series", "pytest.warns", "modin.pandas.test.utils.df_equals", "modin.config.NPartitions.put", "modin.pandas.test.utils.create_test_dfs", "matplotlib.use", "numpy.arange", "pytest.raises", "modin.pa...
[((1104, 1122), 'modin.config.NPartitions.put', 'NPartitions.put', (['(4)'], {}), '(4)\n', (1119, 1122), False, 'from modin.config import NPartitions\n'), ((1176, 1197), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1190, 1197), False, 'import matplotlib\n'), ((1201, 1270), 'pytest.mark.paramet...
import os # test importance sampling in the gas-phase. # (ytz): not pretty, but this is needed to get XLA to be less stupid # see https://github.com/google/jax/issues/1408 for more information # needs to be set before xla/jax is initialized, and is set to a number # suitable for running on CI # os.environ["XLA_FLAGS"...
[ "jax.config.config.update", "jax.vmap", "numpy.sum", "numpy.abs", "md.enhanced.VacuumState", "tests.test_ligands.get_biphenyl", "md.enhanced.generate_log_weighted_samples", "timemachine.potentials.bonded.signed_torsion_angle", "ff.Forcefield", "numpy.histogram", "numpy.mean", "md.enhanced.samp...
[((400, 437), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (413, 437), False, 'from jax.config import config\n'), ((855, 914), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""This takes too long to run on CI"""'}), "(reason='This takes ...
"""Computes label metadata dictionaries from label arrays.""" import numpy as np class LabelInfoMaker(): """ Given a labeled image array with shape (frames, height, width, features), generates dictionaries with label metadata. The dictionaries are cell_ids: key for each feature, values are numpy...
[ "numpy.unique" ]
[((1886, 1911), 'numpy.unique', 'np.unique', (['feature_labels'], {}), '(feature_labels)\n', (1895, 1911), True, 'import numpy as np\n'), ((2513, 2538), 'numpy.unique', 'np.unique', (['feature_labels'], {}), '(feature_labels)\n', (2522, 2538), True, 'import numpy as np\n'), ((3428, 3450), 'numpy.unique', 'np.unique', (...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import GoogleTrend import RoadSection import bpnn import dynamic_bpnn import time import csv import math from multiprocessing import Pool import neural from sklearn.metrics import mean_squared_error # Load Data--------------------------------------...
[ "GoogleTrend.GoogleTrend", "time.time", "RoadSection.RoadSection", "numpy.array", "sklearn.metrics.mean_squared_error" ]
[((341, 385), 'GoogleTrend.GoogleTrend', 'GoogleTrend.GoogleTrend', (['"""multiTimeline.csv"""'], {}), "('multiTimeline.csv')\n", (364, 385), False, 'import GoogleTrend\n'), ((417, 465), 'RoadSection.RoadSection', 'RoadSection.RoadSection', (['"""03F2614S-03F2709S.csv"""'], {}), "('03F2614S-03F2709S.csv')\n", (440, 465...
from __future__ import print_function, division import matplotlib.pyplot as plt import numpy as np import scipy from keras.datasets import mnist from keras.layers import BatchNormalization from keras.layers import Input, Dense, Reshape, Flatten from keras.layers.advanced_activations import LeakyReLU from keras.models ...
[ "numpy.ones", "keras.models.Model", "numpy.random.randint", "numpy.random.normal", "keras.layers.Input", "keras.layers.Reshape", "numpy.prod", "matplotlib.pyplot.close", "keras.layers.Flatten", "numpy.add", "matplotlib.pyplot.subplots", "keras.layers.BatchNormalization", "numpy.concatenate",...
[((1359, 1378), 'keras.layers.Input', 'Input', ([], {'shape': '(100,)'}), '(shape=(100,))\n', (1364, 1378), False, 'from keras.layers import Input, Dense, Reshape, Flatten\n'), ((1852, 1878), 'keras.models.Model', 'Model', (['z', '[valid1, valid2]'], {}), '(z, [valid1, valid2])\n', (1857, 1878), False, 'from keras.mode...
#!/usr/local/bin/python import os import glob import numpy as np import pandas as pd from matplotlib import cm import matplotlib.pyplot as plt import matplotlib.colors as colors from matplotlib.ticker import MultipleLocator, FormatStrFormatter, ScalarFormatter plt.rcParams['mathtext.fontset'] = 'stix' # Plotting def...
[ "pandas.read_csv", "numpy.logspace", "scipy.interpolate.CubicSpline", "numpy.argsort", "matplotlib.pyplot.figure", "matplotlib.colors.LogNorm", "numpy.arange", "matplotlib.pyplot.gca", "glob.glob", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.close", "matplotlib.pyplot.colorbar", "nu...
[((1317, 1355), 'glob.glob', 'glob.glob', (["('%sfiles/*' % path_to_dists)"], {}), "('%sfiles/*' % path_to_dists)\n", (1326, 1355), False, 'import glob\n'), ((2266, 2300), 'matplotlib.collections.LineCollection', 'LineCollection', (['segments'], {}), '(segments, **kwargs)\n', (2280, 2300), False, 'from matplotlib.colle...
# Lint as: python3 # Copyright 2020 The TensorFlow 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 ...
[ "lingvo.core.schedule.SqrtDecay.Params", "lingvo.core.py_utils.NestedMap", "lingvo.compat.ensure_shape", "lingvo.compat.minimum", "lingvo.core.gshard_utils.GetVarSharding", "lingvo.compat.roll", "numpy.product", "lingvo.core.program.SimpleProgramScheduleForTask", "lingvo.core.gshard_utils.GetNonPod2...
[((5923, 5981), 'lingvo.core.gshard_utils.GetNonPod2dMesh', 'gshard_utils.GetNonPod2dMesh', (['DEVICE_MESH_SHAPE', '[8, 8, 2]'], {}), '(DEVICE_MESH_SHAPE, [8, 8, 2])\n', (5951, 5981), False, 'from lingvo.core import gshard_utils\n'), ((6983, 7043), 'lingvo.core.gshard_utils.GetNonPod2dMesh', 'gshard_utils.GetNonPod2dMe...
import sys import numpy as np if __name__ == '__main__': filenames = sys.argv[1:] scores = [] for filename in filenames: with open(filename, 'r') as f: lines = f.readlines() if len(lines) < 2: print('WARNING!', filename, 'is invalid') continue...
[ "numpy.average", "numpy.median", "numpy.min", "numpy.max", "numpy.array" ]
[((515, 533), 'numpy.average', 'np.average', (['scores'], {}), '(scores)\n', (525, 533), True, 'import numpy as np\n'), ((556, 573), 'numpy.median', 'np.median', (['scores'], {}), '(scores)\n', (565, 573), True, 'import numpy as np\n'), ((593, 607), 'numpy.min', 'np.min', (['scores'], {}), '(scores)\n', (599, 607), Tru...
""" This file is part of pyS5p https://github.com/rmvanhees/pys5p.git The class S5Pplot contains generic plot functions Copyright (c) 2017-2021 SRON - Netherlands Institute for Space Research All Rights Reserved License: BSD-3-Clause """ # pylint: disable=too-many-lines from datetime import datetime from pathli...
[ "matplotlib.backends.backend_pdf.PdfPages", "numpy.nanpercentile", "numpy.sum", "numpy.array_equal", "numpy.empty", "numpy.isnan", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "matplotlib.colors.ListedColormap", "numpy.full_like", "cartopy.crs.Robinson", "matplotlib.pyplot.close", "n...
[((6326, 6342), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (6335, 6342), True, 'import matplotlib.pyplot as plt\n'), ((12250, 12313), 'matplotlib.pyplot.colorbar', 'plt.colorbar', (['ax_img'], {'cax': 'cax', 'ticks': 'mbounds', 'boundaries': 'bounds'}), '(ax_img, cax=cax, ticks=mbounds, b...
import train_test_model import pandas as pd import numpy as np #import math import os, sys, time from scipy.sparse import csr_matrix, save_npz, load_npz import pickle ########################################################################################## def usecases(predictions,item_vecs,model,movie_lis...
[ "pandas.DataFrame", "numpy.load", "train_test_model.main", "scipy.sparse.load_npz", "pickle.load", "scipy.sparse.csr_matrix", "pandas.read_pickle" ]
[((2204, 2227), 'train_test_model.main', 'train_test_model.main', ([], {}), '()\n', (2225, 2227), False, 'import train_test_model\n'), ((2239, 2276), 'pandas.read_pickle', 'pd.read_pickle', (['"""./output/movies.pkl"""'], {}), "('./output/movies.pkl')\n", (2253, 2276), True, 'import pandas as pd\n'), ((2298, 2339), 'sc...
import numpy as np import math c_map = [ [+1, -1, -1, -1, -1, +1, +1, -1, -1, -1, -1, +1, +1, -1, +1, +1, -1, -1, +1, +1, -1, -1, +1, +1, -1, +1, -1, -1, +1, +1], [-1, +1, +1, +1, +1, -1, +1, +1, -1, -1, +1, +1, -1, +1, +1, +1, -1, +1, -1, -1, +1, +1, -1, +1, +1, +1, -1, +1, -1, +1], [-1, -1, +1, +...
[ "math.exp", "numpy.sum", "numpy.zeros", "numpy.transpose", "numpy.array", "numpy.sign", "math.log", "numpy.round" ]
[((3347, 3366), 'numpy.transpose', 'np.transpose', (['c_map'], {}), '(c_map)\n', (3359, 3366), True, 'import numpy as np\n'), ((3390, 3408), 'numpy.zeros', 'np.zeros', (['(31, 25)'], {}), '((31, 25))\n', (3398, 3408), True, 'import numpy as np\n'), ((3580, 3589), 'numpy.sum', 'np.sum', (['w'], {}), '(w)\n', (3586, 3589...
#!/usr/bin/python #-*- coding:utf-8 -*- ''' All Rights Reserved by THX This program is used to verify liner regression. Samples are generated by SameplesGenerate.py. Github:https://github.com/HuaJiuShi/MachineLearningBasicAigorithms.git ''' import numpy as np import csv import matplotlib.pyplot as plt...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.log", "numpy.sum", "numpy.zeros", "numpy.ones", "numpy.transpose", "matplotlib.pyplot.figure", "numpy.array", "numpy.exp", "numpy.linspace" ]
[((825, 838), 'numpy.zeros', 'np.zeros', (['num'], {}), '(num)\n', (833, 838), True, 'import numpy as np\n'), ((1201, 1219), 'matplotlib.pyplot.figure', 'plt.figure', (['"""Cost"""'], {}), "('Cost')\n", (1211, 1219), True, 'import matplotlib.pyplot as plt\n'), ((1318, 1335), 'matplotlib.pyplot.title', 'plt.title', (['"...
""" CAD :cite:`cad-Russo2017_e19428` is a method aimed to capture structures of higher-order correlation in massively parallel spike trains. In particular, it is able to extract patterns of spikes with arbitrary configuration of time lags (time interval between spikes in a pattern), and at multiple time scales, e.g. fr...
[ "numpy.sum", "numpy.argmax", "numpy.ones", "scipy.stats.f.sf", "elephant.utils.deprecated_alias", "numpy.multiply", "numpy.append", "numpy.int", "numpy.minimum", "math.ceil", "numpy.zeros", "math.floor", "copy.copy", "time.time", "numpy.amax", "numpy.nonzero", "numpy.where", "numpy...
[((2733, 2871), 'elephant.utils.deprecated_alias', 'deprecated_alias', ([], {'data': '"""binned_spiketrain"""', 'maxlag': '"""max_lag"""', 'min_occ': '"""min_occurrences"""', 'same_config_cut': '"""same_configuration_pruning"""'}), "(data='binned_spiketrain', maxlag='max_lag', min_occ=\n 'min_occurrences', same_conf...
import heterocl as hcl import numpy as np def test_issue_410(): A = hcl.Struct ({'foo': hcl.UInt(16) }) B = hcl.Struct ({'foo': 'uint16' }) assert A['foo'] == B['foo'] def test_issue_410_2(): A = hcl.placeholder((10,), dtype="uint16") def f(A): t = hcl.Struct ({'foo': 'uint16' }) ...
[ "heterocl.compute", "numpy.zeros", "heterocl.placeholder", "numpy.random.randint", "heterocl.Struct", "heterocl.build", "heterocl.create_schedule", "heterocl.UInt", "heterocl.asarray" ]
[((118, 147), 'heterocl.Struct', 'hcl.Struct', (["{'foo': 'uint16'}"], {}), "({'foo': 'uint16'})\n", (128, 147), True, 'import heterocl as hcl\n'), ((217, 255), 'heterocl.placeholder', 'hcl.placeholder', (['(10,)'], {'dtype': '"""uint16"""'}), "((10,), dtype='uint16')\n", (232, 255), True, 'import heterocl as hcl\n'), ...
import pandas as pd import numpy as np from molmass import Formula from sklearn.preprocessing import StandardScaler, RobustScaler from .standards import M_PROTON def get_mz_mean_from_formulas(formulas, ms_mode=None, verbose=False): if verbose: print(formulas) masses = [] for formula in formulas: ...
[ "sklearn.preprocessing.StandardScaler", "sklearn.preprocessing.RobustScaler", "numpy.power", "numpy.round", "molmass.Formula" ]
[((650, 667), 'numpy.round', 'np.round', (['mass', '(4)'], {}), '(mass, 4)\n', (658, 667), True, 'import numpy as np\n'), ((950, 966), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (964, 966), False, 'from sklearn.preprocessing import StandardScaler, RobustScaler\n'), ((1013, 1027), 'sklea...
"""Utility functions for data generation and result visualization in experiments.""" import numpy as np from functools import partial import calibre.util.data as data_util """ 1. Data generation """ def generate_data_1d(N_train=20, N_test=20, N_valid=500, noise_sd=0.03, data_gen_func=data_uti...
[ "calibre.util.data.generate_1d_data_multiscale", "functools.partial", "calibre.util.data.generate_1d_data_multimodal", "numpy.random.seed", "numpy.expand_dims", "numpy.sort", "numpy.where", "numpy.linspace", "calibre.util.data.generate_1d_data" ]
[((1530, 1668), 'calibre.util.data.generate_1d_data', 'data_util.generate_1d_data', ([], {'N': 'N_train', 'f': 'data_gen_func', 'noise_sd': 'noise_sd', 'seed': 'seed_train', 'uniform_x': '(True)', 'uniform_x_range': 'data_range'}), '(N=N_train, f=data_gen_func, noise_sd=noise_sd,\n seed=seed_train, uniform_x=True, u...
import os import sys import numpy as np import macro def metropolis_hastings(valences,chemical_formula,iteration): # normalize and rounding mean_vect = chemical_formula[chemical_formula>1.0e-6] mean_sum = np.sum(mean_vect) mean_vect = mean_vect/mean_sum mean_vect = np.round(mean_vec...
[ "numpy.sum", "numpy.argmax", "numpy.min", "numpy.max", "numpy.array", "numpy.random.multivariate_normal", "numpy.random.random", "numpy.exp", "numpy.dot", "numpy.round" ]
[((232, 249), 'numpy.sum', 'np.sum', (['mean_vect'], {}), '(mean_vect)\n', (238, 249), True, 'import numpy as np\n'), ((303, 345), 'numpy.round', 'np.round', (['mean_vect'], {'decimals': 'macro._ROUND'}), '(mean_vect, decimals=macro._ROUND)\n', (311, 345), True, 'import numpy as np\n'), ((559, 588), 'numpy.array', 'np....
#en este programa vamos a calcular el chi2 MOG-sn considerando todos los parametros fijos. Solo hay que prestarle atencion al valor de H0. import numpy as np from numpy.linalg import inv from matplotlib import pyplot as plt from scipy.interpolate import interp1d from scipy.integrate import simps from scipy.constants im...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.transpose", "scipy.integrate.solve_ivp", "scipy.interpolate.interp1d", "numpy.linalg.inv", "numpy.loadtxt", "numpy.linspace", "numpy.dot", "numpy.diag", "numpy.log10", "matplotlib.pyplot.subplots", "scipy.integrate.simps" ]
[((2023, 2101), 'numpy.loadtxt', 'np.loadtxt', (['"""lcparam_full_long_zhel.txt"""'], {'usecols': '(1, 2, 3, 4, 5)', 'unpack': '(True)'}), "('lcparam_full_long_zhel.txt', usecols=(1, 2, 3, 4, 5), unpack=True)\n", (2033, 2101), True, 'import numpy as np\n'), ((2217, 2236), 'numpy.diag', 'np.diag', (['(dmb ** 2.0)'], {})...
## ECCV-2018-Image Super-Resolution Using Very Deep Residual Channel Attention Networks ## https://arxiv.org/abs/1807.02758 from model import common import torch import torch.nn as nn import numpy as np import math def make_model(args, parent=False): return RCAN(args) ## Channel Attention (CA) Layer class CALayer...
[ "torch.nn.AdaptiveAvgPool2d", "torch.nn.ReLU", "torch.nn.Sequential", "torch.nn.ModuleList", "torch.nn.Conv2d", "numpy.min", "numpy.max", "torch.nn.BatchNorm2d", "torch.nn.PixelShuffle", "torch.zeros", "math.log", "torch.nn.Sigmoid" ]
[((496, 519), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1)'], {}), '(1)\n', (516, 519), True, 'import torch.nn as nn\n'), ((2850, 2862), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (2860, 2862), True, 'import torch.nn as nn\n'), ((3629, 3642), 'torch.nn.ReLU', 'nn.ReLU', (['(True)'], {}), '(True...
# coding: utf-8 # In[1]: # Reload when code changed: get_ipython().magic('load_ext autoreload') get_ipython().magic('autoreload 2') get_ipython().magic('pwd') # In[2]: import os import core import importlib importlib.reload(core) import pandas as pd pd.__version__ # ### Load directories # In[3]: root_direct...
[ "os.getcwd", "core.WorkSpace", "importlib.reload", "numpy.where" ]
[((214, 236), 'importlib.reload', 'importlib.reload', (['core'], {}), '(core)\n', (230, 236), False, 'import importlib\n'), ((326, 337), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (335, 337), False, 'import os\n'), ((528, 639), 'core.WorkSpace', 'core.WorkSpace', ([], {'name': '"""default"""', 'parent_directory': 'wor...
''' stemdiff.dbase -------------- Read 4D-STEM datafiles and create database of all files. The database contains [filename, S-entropy and XY-center] of each datafile. * The database enables fast filtering of datafiles and fast access to datafile features. * S-entropy = Shannon entropy = a fast-to-calcu...
[ "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "numpy.argmax", "matplotlib.pyplot.legend", "numpy.cumsum", "numpy.histogram", "skimage.measure.shannon_entropy", "pandas.read_pickle", "matplotlib.pyplot.grid" ]
[((3254, 3348), 'pandas.DataFrame', 'pd.DataFrame', (['list_of_datafiles'], {'columns': "['DatafileName', 'Entropy', 'Xcenter', 'Ycenter']"}), "(list_of_datafiles, columns=['DatafileName', 'Entropy',\n 'Xcenter', 'Ycenter'])\n", (3266, 3348), True, 'import pandas as pd\n'), ((12847, 12882), 'numpy.histogram', 'np.hi...
""" registration.py --------------- Functions for registering (aligning) point clouds with meshes. """ import numpy as np from . import util from . import bounds from . import transformations from .transformations import transform_points try: from scipy.spatial import cKDTree except BaseException as E: # w...
[ "numpy.eye", "numpy.asanyarray", "numpy.zeros", "numpy.identity", "numpy.argmin", "numpy.append", "numpy.linalg.inv", "numpy.array", "scipy.spatial.cKDTree", "numpy.dot" ]
[((6715, 6749), 'numpy.asanyarray', 'np.asanyarray', (['a'], {'dtype': 'np.float64'}), '(a, dtype=np.float64)\n', (6728, 6749), True, 'import numpy as np\n'), ((6758, 6792), 'numpy.asanyarray', 'np.asanyarray', (['b'], {'dtype': 'np.float64'}), '(b, dtype=np.float64)\n', (6771, 6792), True, 'import numpy as np\n'), ((8...
# Routine to stitch together several catalogues from different sources # Steps: # 1) Open all csv files # 2) Collect all events in one dataframe # 3) Discard multiple entries (priority given) # 4) Exclude fake events (EMEC list)( # 5) Harmonize catalogue to Mw # 6) Write out single catalogue.csv import csv import nump...
[ "csv.reader", "numpy.asarray", "numpy.where", "numpy.array", "numpy.logical_or", "openquake.hazardlib.geo.Point", "csv.DictWriter" ]
[((23003, 23068), 'numpy.array', 'np.array', (['[0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]'], {}), '([0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334])\n', (23011, 23068), True, 'import numpy as np\n'), ((23114, 23179), 'numpy.array', 'np.array', (['[0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, ...
""" Assingment No. 11 Part I Name: <NAME> ID: 201700399 """ import numpy as np from numpy import exp as E import matplotlib.pyplot as plt from matplotlib.pyplot import cm J=1 T=4 H=0 n=10 total = np.power(n,2) ts=1100 nCut = 100 plot = False def interactingSpinsIndices(i,j,s=1): """ ...
[ "matplotlib.pyplot.title", "numpy.sum", "numpy.ones", "numpy.product", "numpy.mean", "numpy.arange", "numpy.exp", "numpy.round", "numpy.power", "matplotlib.pyplot.close", "matplotlib.pyplot.matshow", "numpy.linspace", "numpy.size", "matplotlib.pyplot.legend", "time.perf_counter", "matp...
[((217, 231), 'numpy.power', 'np.power', (['n', '(2)'], {}), '(n, 2)\n', (225, 231), True, 'import numpy as np\n'), ((2980, 3003), 'numpy.arange', 'np.arange', (['(0.5)', '(5)', '(0.05)'], {}), '(0.5, 5, 0.05)\n', (2989, 3003), True, 'import numpy as np\n'), ((3029, 3042), 'numpy.size', 'np.size', (['Temp'], {}), '(Tem...
import os import pytest from unittest import mock import pmdarima import numpy as np import pandas as pd import yaml import mlflow.pmdarima from mlflow import pyfunc from mlflow.exceptions import MlflowException from mlflow.models import infer_signature, Model from mlflow.models.utils import _read_example import mlfl...
[ "mlflow.utils.model_utils._get_flavor_configuration", "yaml.safe_load", "mlflow.models.utils._read_example", "numpy.testing.assert_array_almost_equal", "os.path.join", "pandas.DataFrame", "tests.helper_functions._compare_logged_code_paths", "mlflow.store.artifact.s3_artifact_repo.S3ArtifactRepository"...
[((1230, 1262), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (1244, 1262), False, 'import pytest\n'), ((1534, 1564), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1548, 1564), False, 'import pytest\n'), ((1904, 1934), 'pytes...
import os import math import numpy as np import pandas as pd import time from tqdm.notebook import tqdm ## Imports for plotting import matplotlib.pyplot as plt from IPython.display import set_matplotlib_formats set_matplotlib_formats('svg', 'pdf') from matplotlib.colors import to_rgba import seaborn as sns sns.set() ...
[ "matplotlib.pyplot.title", "numpy.empty", "tqdm.notebook.tqdm", "torch.cat", "matplotlib.pyplot.figure", "numpy.random.normal", "torch.no_grad", "torch.ones", "torch.utils.data.cpu", "torch.Tensor", "torch.nn.Linear", "torch.zeros", "IPython.display.set_matplotlib_formats", "seaborn.set", ...
[((212, 248), 'IPython.display.set_matplotlib_formats', 'set_matplotlib_formats', (['"""svg"""', '"""pdf"""'], {}), "('svg', 'pdf')\n", (234, 248), False, 'from IPython.display import set_matplotlib_formats\n'), ((310, 319), 'seaborn.set', 'sns.set', ([], {}), '()\n', (317, 319), True, 'import seaborn as sns\n'), ((468...
# Based on https://www.kaggle.com/tunguz/logistic-regression-with-words-and-char-n-grams/ import os import sys import pprint import logging from collections import defaultdict from datetime import datetime from unidecode import unidecode import numpy as np from numpy.random import RandomState import pandas as pd from...
[ "common.load_data", "pprint.pformat", "os.path.join", "pandas.DataFrame.from_dict", "sklearn.feature_extraction.text.TfidfVectorizer", "pandas.read_csv", "common.stratified_kfold", "joblib.dump", "numpy.random.RandomState", "collections.defaultdict", "sklearn.linear_model.LogisticRegression", ...
[((480, 507), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (497, 507), False, 'import logging\n'), ((578, 592), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (590, 592), False, 'from datetime import datetime\n'), ((985, 1014), 'numpy.random.RandomState', 'RandomState', (['s...
# -*- coding: utf-8 -*- import datetime import numpy as np import pytest from ...types.detection import Detection from ...types.hypothesis import SingleHypothesis from ...types.particle import Particle from ...types.prediction import ( GaussianStatePrediction, GaussianMeasurementPrediction, StatePrediction, S...
[ "numpy.allclose", "numpy.ones", "numpy.hstack", "pytest.raises", "numpy.array", "numpy.array_equal", "datetime.datetime.now" ]
[((787, 810), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (808, 810), False, 'import datetime\n'), ((1512, 1567), 'numpy.array_equal', 'np.array_equal', (['state_vector', 'state_update.state_vector'], {}), '(state_vector, state_update.state_vector)\n', (1526, 1567), True, 'import numpy as np\n')...
from collections import OrderedDict from mobject.components.edge import Edge from mobject.components.node import Node from mobject.mobject import Group from scipy.spatial import Delaunay, distance_matrix from utils.simple_functions import update_without_overwrite import constants import numpy as np import sys class G...
[ "numpy.random.seed", "numpy.random.rand", "utils.simple_functions.update_without_overwrite", "numpy.diag_indices", "scipy.spatial.distance_matrix", "numpy.append", "numpy.min", "numpy.linalg.norm", "mobject.components.node.Node.assert_primitive", "collections.OrderedDict", "mobject.mobject.Group...
[((793, 838), 'utils.simple_functions.update_without_overwrite', 'update_without_overwrite', (['kwargs', 'self.CONFIG'], {}), '(kwargs, self.CONFIG)\n', (817, 838), False, 'from utils.simple_functions import update_without_overwrite\n'), ((847, 877), 'mobject.mobject.Group.__init__', 'Group.__init__', (['self'], {}), '...
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
[ "numpy.log2", "numpy.zeros", "numpy.abs" ]
[((3096, 3107), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (3104, 3107), True, 'import numpy as np\n'), ((3000, 3030), 'numpy.log2', 'np.log2', (['state_vector.shape[0]'], {}), '(state_vector.shape[0])\n', (3007, 3030), True, 'import numpy as np\n'), ((3058, 3078), 'numpy.abs', 'np.abs', (['state_vector'], {}), '...
#import tensorflow as tf; import torch.optim as optim import os; from distutils.util import strtobool; import numpy as np; import torch import glob; import skimage.io as io; #from sa_net_train import CNNTrainer; #from sa_net_arch import AbstractCNNArch; #from sa_net_arch_utilities import CNNArchUtils; #fro...
[ "numpy.multiply", "distutils.util.strtobool", "numpy.transpose", "numpy.zeros", "numpy.expand_dims", "numpy.arange", "numpy.matmul", "torch.no_grad", "os.path.join", "os.path.split" ]
[((4583, 4672), 'numpy.zeros', 'np.zeros', (['(square_side, stains_matrix_rgb.shape[0] * square_side, 3)'], {'dtype': 'np.uint8'}), '((square_side, stains_matrix_rgb.shape[0] * square_side, 3), dtype=\n np.uint8)\n', (4591, 4672), True, 'import numpy as np\n'), ((5549, 5593), 'numpy.transpose', 'np.transpose', (['ba...
# 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 re from collections.abc import Iterable from datetime import datetime, timedelta from operator import attrgetter from unittest import Tes...
[ "datetime.datetime.strftime", "kats.detectors.detector_consts.ChangePointInterval", "pandas.DataFrame", "numpy.random.seed", "kats.detectors.detector_consts.AnomalyResponse", "kats.detectors.detector_consts.SingleSpike", "numpy.testing.assert_array_equal", "kats.detectors.detector_consts.PercentageCha...
[((3895, 4191), 'parameterized.parameterized.expand', 'parameterized.expand', (["[['start_time', 'current_start'], ['end_time', 'current_end'], [\n 'start_time_str', 'current_start_time_str'], ['end_time_str',\n 'current_end_time_str'], ['mean_val', 'current_mean'], ['variance_val',\n 'current_variance'], ['pr...
# Copyright 2017 Yahoo Inc. # Licensed under the terms of the Apache 2.0 license. # Please see LICENSE file in the project root for terms. # Distributed MNIST on grid based on TensorFlow MNIST example from __future__ import absolute_import from __future__ import division from __future__ import nested_scopes from __fu...
[ "tensorflow.clip_by_value", "tensorflow.Variable", "tensorflow.get_default_graph", "tensorflow.truncated_normal", "tensorflow.nn.relu", "com.yahoo.ml.tf.TFNode.DataFeed", "com.yahoo.ml.tf.TFNode.start_cluster_server", "tensorflow.placeholder", "tensorflow.cast", "datetime.datetime.now", "tensorf...
[((1019, 1065), 'com.yahoo.ml.tf.TFNode.start_cluster_server', 'TFNode.start_cluster_server', (['ctx', '(1)', 'args.rdma'], {}), '(ctx, 1, args.rdma)\n', (1046, 1065), False, 'from com.yahoo.ml.tf import TFNode\n'), ((855, 887), 'time.sleep', 'time.sleep', (['((worker_num + 1) * 5)'], {}), '((worker_num + 1) * 5)\n', (...
# Copyright 2019 The Cirq Developers # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
[ "cirq.protocols.circuit_diagram_info", "cirq.protocols.unitary", "numpy.identity", "cirq.read_json", "cirq.to_json", "cirq.LineQubit.range", "cirq.Circuit", "pytest.mark.parametrize" ]
[((1535, 1621), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""phase"""', '[0, 0.1, 0.4, math.pi / 2, math.pi, 2 * math.pi]'], {}), "('phase', [0, 0.1, 0.4, math.pi / 2, math.pi, 2 *\n math.pi])\n", (1558, 1621), False, 'import pytest\n'), ((1852, 1938), 'pytest.mark.parametrize', 'pytest.mark.parametri...
import datetime import matplotlib import numpy as np from distutils.command.build import build from floodsystem.stationdata import build_station_list, update_water_levels from floodsystem.station import MonitoringStation from floodsystem.flood import stations_level_under_threshold, stations_level_over_threshold from fl...
[ "floodsystem.flood.stations_level_over_threshold", "floodsystem.stationdata.build_station_list", "floodsystem.flood.stations_level_under_threshold", "floodsystem.analysis.polyfit", "datetime.timedelta", "numpy.linspace", "matplotlib.dates.date2num", "floodsystem.stationdata.update_water_levels" ]
[((1525, 1545), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (1543, 1545), False, 'from floodsystem.stationdata import build_station_list, update_water_levels\n'), ((1550, 1579), 'floodsystem.stationdata.update_water_levels', 'update_water_levels', (['stations'], {}), '(stations...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ make_mosaic.py Written by <NAME> (10/2021) Create a weighted mosaic from a series of tiles COMMAND LINE OPTIONS: --help: list the command line options -d X, --directory X: directory to run -g X, --glob_string X: quoted string to pass to glob to find the f...
[ "matplotlib.pyplot.show", "argparse.ArgumentParser", "os.getcwd", "matplotlib.pyplot.imshow", "numpy.zeros", "numpy.ones", "pointCollection.grid.mosaic", "matplotlib.pyplot.colorbar", "numpy.any", "numpy.nonzero", "numpy.sort", "pointCollection.grid.data", "numpy.array", "glob.glob", "os...
[((1969, 1994), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1992, 1994), False, 'import argparse\n'), ((5576, 5612), 'pointCollection.grid.mosaic', 'pc.grid.mosaic', ([], {'spacing': 'args.spacing'}), '(spacing=args.spacing)\n', (5590, 5612), True, 'import pointCollection as pc\n'), ((6626,...
import numpy as np from six.moves import zip_longest import unittest import chainer from chainer.iterators import SerialIterator from chainer import testing from chainercv.utils import apply_to_iterator @testing.parameterize(*testing.product({ 'multi_in_values': [False, True], 'multi_out_values': [False, Tr...
[ "chainer.testing.product", "numpy.random.uniform", "chainer.datasets.TupleDataset", "chainercv.utils.apply_to_iterator", "six.moves.zip_longest", "numpy.random.randint", "chainer.iterators.SerialIterator", "numpy.testing.assert_equal", "chainer.testing.run_module" ]
[((4552, 4590), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (4570, 4590), False, 'from chainer import testing\n'), ((2077, 2132), 'chainer.iterators.SerialIterator', 'SerialIterator', (['dataset', '(2)'], {'repeat': '(False)', 'shuffle': '(False)'}), '(d...
# %% from matplotlib.backends.backend_pdf import PdfPages import numpy as np import math from scipy.stats import norm from scipy.optimize import curve_fit import matplotlib.pyplot as plt # Frechet逆関数 def Frechet(x): return -np.log(-np.log(x)) # 回帰式 def func(x, a, b): f = a*x + b return f # データの読み込み Qin ...
[ "matplotlib.backends.backend_pdf.PdfPages", "numpy.sum", "numpy.empty", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.round", "matplotlib.pyplot.hlines", "numpy.unique", "numpy.savetxt", "numpy.append", "math.gamma", "numpy.loadtxt", "matplotlib.pyplot.show", "numpy.co...
[((322, 374), 'numpy.loadtxt', 'np.loadtxt', (['"""./Data.csv"""'], {'delimiter': '""","""', 'usecols': '[0]'}), "('./Data.csv', delimiter=',', usecols=[0])\n", (332, 374), True, 'import numpy as np\n'), ((409, 421), 'numpy.sort', 'np.sort', (['Qin'], {}), '(Qin)\n', (416, 421), True, 'import numpy as np\n'), ((487, 50...
def load_hcp_data(credentials, slice_number=None): # Import dictionaries import neuropythy as ny import ipyvolume as ipv import nibabel as nib import numpy as np # Configure neuropythy ny.config['hcp_credentials'] = credentials fs = ny.data['hcp'].s3fs # Get full path to T1w NIFTI...
[ "neuropythy.hcp_subject", "numpy.asarray" ]
[((857, 877), 'numpy.asarray', 'np.asarray', (['im_array'], {}), '(im_array)\n', (867, 877), True, 'import numpy as np\n'), ((712, 732), 'neuropythy.hcp_subject', 'ny.hcp_subject', (['i[1]'], {}), '(i[1])\n', (726, 732), True, 'import neuropythy as ny\n')]
'''ESPCN Model''' from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import tensorflow as tf import numpy as np class SuperResolution(object): def __init__(self, config): self.variables = {} self.fa...
[ "tensorflow.split", "tensorflow.truncated_normal_initializer", "numpy.log", "tensorflow.summary.scalar", "tensorflow.reshape", "tensorflow.variable_scope", "tensorflow.div", "tensorflow.placeholder", "tensorflow.Variable", "tensorflow.squared_difference", "tensorflow.sqrt", "tensorflow.train.A...
[((808, 830), 'tensorflow.summary.merge_all', 'tf.summary.merge_all', ([], {}), '()\n', (828, 830), True, 'import tensorflow as tf\n'), ((2733, 2769), 'tensorflow.summary.scalar', 'tf.summary.scalar', (['"""loss"""', 'self.loss'], {}), "('loss', self.loss)\n", (2750, 2769), True, 'import tensorflow as tf\n'), ((3045, 3...
import os import sys import time import inspect import numpy as np import pandas as pd import matplotlib.pyplot as plt import FATS.featureFunction as featureFunction class FeatureSpace: """ This Class is a wrapper class, to allow user select the features based on the available time series vectors (magni...
[ "inspect.getsourcelines", "inspect.isclass", "numpy.asarray", "numpy.argsort", "inspect.getmembers" ]
[((5840, 5856), 'numpy.asarray', 'np.asarray', (['data'], {}), '(data)\n', (5850, 5856), True, 'import numpy as np\n'), ((4875, 4904), 'numpy.argsort', 'np.argsort', (['self.featureOrder'], {}), '(self.featureOrder)\n', (4885, 4904), True, 'import numpy as np\n'), ((5016, 5044), 'numpy.argsort', 'np.argsort', (['self.f...
import pandas as pd import numpy as np from analysis.lib.graph.speedups import DirectedGraph from analysis.constants import HUC2_EXITS def connect_huc2s(joins): """Find all connected groups of HUC2s. This reads in all flowline joins for all HUC2s and detects those that cross HUC2 boundaries to determin...
[ "pandas.DataFrame", "analysis.constants.HUC2_EXITS.values", "numpy.setdiff1d", "numpy.append", "analysis.lib.graph.speedups.DirectedGraph", "pandas.Series" ]
[((2170, 2189), 'analysis.constants.HUC2_EXITS.values', 'HUC2_EXITS.values', ([], {}), '()\n', (2187, 2189), False, 'from analysis.constants import HUC2_EXITS\n'), ((2490, 2539), 'numpy.append', 'np.append', (['tmp.upstream_HUC2', 'tmp.downstream_HUC2'], {}), '(tmp.upstream_HUC2, tmp.downstream_HUC2)\n', (2499, 2539), ...
from OpenGL import GL from PIL import Image from ..shaders import Shader from .view import View import numpy as np from ..objects.bufferobject import BufferObject from ..objects.textobject import TextObject from ..objects.vectorobject import VectorObject from compas.geometry import transform_points_numpy class Vie...
[ "compas.geometry.transform_points_numpy", "OpenGL.GL.glDisable", "OpenGL.GL.glReadPixels", "numpy.frombuffer", "numpy.identity", "PIL.Image.fromarray", "OpenGL.GL.glEnable" ]
[((734, 748), 'numpy.identity', 'np.identity', (['(4)'], {}), '(4)\n', (745, 748), True, 'import numpy as np\n'), ((7591, 7623), 'OpenGL.GL.glDisable', 'GL.glDisable', (['GL.GL_POINT_SMOOTH'], {}), '(GL.GL_POINT_SMOOTH)\n', (7603, 7623), False, 'from OpenGL import GL\n'), ((7632, 7663), 'OpenGL.GL.glDisable', 'GL.glDis...
'''Preprocessing data.''' import os import numpy as np import cv2 from tensorflow.python.keras.preprocessing.image import DirectoryIterator as Keras_DirectoryIterator from tensorflow.python.keras.preprocessing.image import ImageDataGenerator as Keras_ImageDataGenerator from tensorflow.python.keras.preprocessing.image...
[ "numpy.random.uniform", "numpy.random.seed", "numpy.ceil", "tensorflow.python.keras.preprocessing.image.img_to_array", "numpy.asarray", "tensorflow.python.keras.backend.floatx", "numpy.random.randint", "numpy.random.random", "os.path.join", "tensorflow.python.keras.preprocessing.image.array_to_img...
[((417, 434), 'numpy.random.seed', 'np.random.seed', (['(3)'], {}), '(3)\n', (431, 434), True, 'import numpy as np\n'), ((2196, 2231), 'numpy.ceil', 'np.ceil', (['(size_height_img * coef_max)'], {}), '(size_height_img * coef_max)\n', (2203, 2231), True, 'import numpy as np\n'), ((2254, 2288), 'numpy.ceil', 'np.ceil', (...
import numpy as np def cvtIntegralImage(X): H, W = X.shape Z = np.zeros((H+1, W+1), np.float64) Z[1:,1:] = np.cumsum(np.cumsum(X,0),1) return Z def cvtIntegralImage45_old(X): H, W = X.shape Z = np.zeros((H+2, W+1), np.float64) Z[1:-1, 1:] = X tmpX = Z.copy() for J in range(2, Z.sha...
[ "numpy.ctypeslib.load_library", "numpy.stack", "numpy.ctypeslib.ndpointer", "numpy.ceil", "numpy.power", "numpy.zeros", "numpy.ones", "numpy.isnan", "numpy.isinf", "numpy.nonzero", "numpy.cumsum", "numpy.max", "numpy.argsort", "numpy.sign", "numpy.sqrt" ]
[((662, 725), 'numpy.ctypeslib.load_library', 'np.ctypeslib.load_library', (['"""lib_cvtIntegralImage45.so"""', '"""utils"""'], {}), "('lib_cvtIntegralImage45.so', 'utils')\n", (687, 725), True, 'import numpy as np\n'), ((762, 832), 'numpy.ctypeslib.ndpointer', 'np.ctypeslib.ndpointer', ([], {'dtype': 'np.float64', 'nd...
import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras import backend as K import tensorflow as tf from tensorflow.keras.callbacks import TensorBoard from sqlalchemy import create_engine from sklearn.preprocessing import StandardScaler, normalize import m...
[ "pandas.DataFrame", "keras.layers.Activation", "keras.optimizers.Adam", "time.time", "numpy.min", "pandas.read_sql_table", "numpy.max", "constants.TRADED_PAIRS.items", "keras.layers.Dense", "sqlalchemy.create_engine", "keras.models.Sequential", "matplotlib.pyplot.subplots" ]
[((1077, 1107), 'constants.TRADED_PAIRS.items', 'constants.TRADED_PAIRS.items', ([], {}), '()\n', (1105, 1107), False, 'import constants\n'), ((661, 686), 'numpy.min', 'np.min', (['rawpoints'], {'axis': '(0)'}), '(rawpoints, axis=0)\n', (667, 686), True, 'import numpy as np\n'), ((699, 724), 'numpy.max', 'np.max', (['r...
import os import sys import copy import json from threading import Lock from abe_sim.brain.geom import angle_diff, euler_to_quaternion, euler_diff_to_angvel, invert_quaternion, quaternion_product, quaternion_to_euler, poseFromTQ import math import time import random import numpy as np import schemasim.simulators.p...
[ "os.remove", "trimesh.load", "math.atan2", "os.path.isfile", "abe_sim.brain.geom.poseFromTQ", "os.path.join", "abe_sim.brain.geom.euler_diff_to_angvel", "os.path.dirname", "threading.Lock", "math.cos", "abe_sim.brain.geom.angle_diff", "abe_sim.brain.geom.euler_to_quaternion", "schemasim.simu...
[((499, 505), 'threading.Lock', 'Lock', ([], {}), '()\n', (503, 505), False, 'from threading import Lock\n'), ((1846, 1852), 'threading.Lock', 'Lock', ([], {}), '()\n', (1850, 1852), False, 'from threading import Lock\n'), ((3635, 3669), 'abe_sim.brain.geom.angle_diff', 'angle_diff', (["wpA['yaw']", "wpB['yaw']"], {}),...
import unittest import Environment from Environment import Environment from Agent import Agent from TicTacBoard import TicTacBoard import numpy as np test = unittest.TestCase() BOARD_SIZE = 3 agent1 = Agent(0.1 , 0.01 , BOARD_SIZE ,1) agent2 = Agent(0.1 , 0.01 , BOARD_SIZE,2) tic_tac_board = TicTacBoard(BOARD_SIZE) ...
[ "TicTacBoard.TicTacBoard", "Environment.Environment", "unittest.TestCase", "Agent.Agent", "numpy.array" ]
[((158, 177), 'unittest.TestCase', 'unittest.TestCase', ([], {}), '()\n', (175, 177), False, 'import unittest\n'), ((203, 234), 'Agent.Agent', 'Agent', (['(0.1)', '(0.01)', 'BOARD_SIZE', '(1)'], {}), '(0.1, 0.01, BOARD_SIZE, 1)\n', (208, 234), False, 'from Agent import Agent\n'), ((246, 277), 'Agent.Agent', 'Agent', ([...
"""Dev@Octo12,2017""" import numpy as np damaged_4Mpixel = np.array( [ [1157, 2167 - 1231], [1158, 2167 - 1231], [1159, 2167 - 1231], [1160, 2167 - 1231], [1157, 2167 - 1230], [1158, 2167 - 1230], [1159, 2167 - 1230], [1160, 2167 - 1230], [116...
[ "numpy.array" ]
[((60, 473), 'numpy.array', 'np.array', (['[[1157, 2167 - 1231], [1158, 2167 - 1231], [1159, 2167 - 1231], [1160, 2167 -\n 1231], [1157, 2167 - 1230], [1158, 2167 - 1230], [1159, 2167 - 1230], [\n 1160, 2167 - 1230], [1161, 2167 - 1230], [1157, 2167 - 1229], [1158, \n 2167 - 1229], [1159, 2167 - 1229], [1160, ...
#!/usr/bin/env python import time import sys, os, argparse, re import numpy as np import fitsio import desispec.io from desispec.io import findfile from desispec.io.util import create_camword, decode_camword, parse_cameras # from desispec.calibfinder import findcalibfile from desiutil.log import get_logger from . ...
[ "desiutil.log.get_logger", "fitsio.FITS", "desispec.io.util.parse_cameras", "argparse.ArgumentParser", "numpy.isscalar", "os.makedirs", "time.strftime", "os.path.isfile", "time.mktime", "numpy.array", "desispec.io.util.decode_camword", "sys.exit", "os.path.join", "desispec.io.findfile", ...
[((1016, 1065), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""{prog} [options]"""'}), "(usage='{prog} [options]')\n", (1039, 1065), False, 'import sys, os, argparse, re\n'), ((8375, 8396), 'fitsio.FITS', 'fitsio.FITS', (['pathname'], {}), '(pathname)\n', (8386, 8396), False, 'import fitsio\n'...
import os import glob from datetime import datetime from collections import Counter import torch import numpy as np from torch import nn import copy from sklearn import preprocessing from sklearn import model_selection from sklearn import metrics import config import dataset import engine from model import OcrModel ...
[ "torch.argmax", "sklearn.model_selection.train_test_split", "dataset.ClassificationDataset", "engine.train_fn", "sklearn.metrics.accuracy_score", "os.path.join", "torch.utils.data.DataLoader", "torch.optim.lr_scheduler.ReduceLROnPlateau", "sklearn.preprocessing.LabelEncoder", "torch.softmax", "p...
[((433, 442), 'rich.console.Console', 'Console', ([], {}), '()\n', (440, 442), False, 'from rich.console import Console\n'), ((443, 467), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (465, 467), False, 'import torch\n'), ((1126, 1155), 'torch.softmax', 'torch.softmax', (['predictions', '(2)'], ...
import numpy as np # 6x6 행렬 만들기 a = np.array([i for i in range(36)]).reshape(6,6) # 3x3 필터 만들기 Filter = np.eye(3,3) # 행렬 확인 print('---a\n',a) print('---filter\n',Filter) ############################################################################ ### 합성곱 연산 방법 1 ### # 단일 곱셈-누산 vs 행렬곱 연산 d = np.array([[1,2,3],[4,...
[ "numpy.pad", "numpy.sum", "math.ceil", "numpy.zeros", "numpy.max", "numpy.lib.stride_tricks.as_strided", "numpy.array", "numpy.arange", "numpy.dot", "numpy.eye" ]
[((107, 119), 'numpy.eye', 'np.eye', (['(3)', '(3)'], {}), '(3, 3)\n', (113, 119), True, 'import numpy as np\n'), ((299, 342), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n', (307, 342), True, 'import numpy as np\n'), ((1156, 1214), 'numpy.pad', 'np.pad',...
import jax import jax.numpy as jnp import haiku as hk import numpy as np import optax from einops import rearrange, reduce, repeat from haiku_baselines.DQN.base_class import Q_Network_Family from haiku_baselines.IQN.network import Model from haiku_baselines.common.Module import PreProcess from haiku_baselines.common....
[ "jax.numpy.take_along_axis", "jax.random.uniform", "haiku_baselines.common.Module.PreProcess", "jax.jit", "jax.nn.logsumexp", "optax.apply_updates", "jax.numpy.expand_dims", "numpy.random.choice", "haiku.data_structures.merge", "haiku_baselines.common.utils.convert_jax", "haiku_baselines.IQN.net...
[((3058, 3106), 'haiku.data_structures.merge', 'hk.data_structures.merge', (['pre_param', 'model_param'], {}), '(pre_param, model_param)\n', (3082, 3106), True, 'import haiku as hk\n'), ((3345, 3381), 'haiku_baselines.common.utils.print_param', 'print_param', (['"""preprocess"""', 'pre_param'], {}), "('preprocess', pre...
#! /usr/bin/env python3 ''' experimenting deprojection in realsense SDK ''' import csv import numpy as np from cv2 import cv2 import rospy from pyrealsense2 import pyrealsense2 as rs # 3D to 2D projection camera_matrix = np.array( [[610.899, 0.0, 324.496], [0.0, 610.824, 234.984], [0.0, 0.0, 1.0]]) Pc = [[1, 0, ...
[ "pyrealsense2.pyrealsense2.align", "pyrealsense2.pyrealsense2.hole_filling_filter", "numpy.linalg.norm", "cv2.cv2.waitKey", "numpy.round", "pyrealsense2.pyrealsense2.spatial_filter", "cv2.cv2.destroyAllWindows", "pyrealsense2.pyrealsense2.rs2_deproject_pixel_to_point", "numpy.append", "pyrealsense...
[((224, 301), 'numpy.array', 'np.array', (['[[610.899, 0.0, 324.496], [0.0, 610.824, 234.984], [0.0, 0.0, 1.0]]'], {}), '([[610.899, 0.0, 324.496], [0.0, 610.824, 234.984], [0.0, 0.0, 1.0]])\n', (232, 301), True, 'import numpy as np\n'), ((383, 411), 'numpy.matmul', 'np.matmul', (['camera_matrix', 'Pc'], {}), '(camera_...
""" Test cases for ARMORY datasets. """ import os import pytest import numpy as np from armory.data import datasets from armory.data import adversarial_datasets from armory import paths DATASET_DIR = paths.DockerPaths().dataset_dir def test__parse_token(): for x in "test", "train[15:20]", "train[:10%]", "trai...
[ "armory.data.datasets.digit", "armory.data.datasets.german_traffic_sign", "armory.data.datasets.librispeech_dev_clean", "armory.data.datasets.parse_split_index", "armory.data.datasets.cifar10", "armory.data.adversarial_datasets.librispeech_adversarial", "os.path.join", "armory.data.adversarial_dataset...
[((204, 223), 'armory.paths.DockerPaths', 'paths.DockerPaths', ([], {}), '()\n', (221, 223), False, 'from armory import paths\n'), ((1925, 2011), 'armory.data.datasets.mnist', 'datasets.mnist', (['"""test"""'], {'shuffle_files': '(False)', 'preprocessing_fn': 'None', 'framework': '"""tf"""'}), "('test', shuffle_files=F...
# install.packages(reticulate) # reticulate::repl_python() # py_run_string() # py_run_file() import pandas as pd import numpy as np import matplotlib.pylab as plt # read and index col 설정 df = pd.read_csv('https://raw.githubusercontent.com/eunjiJeong729/QuantArtificial_Intelligence/master/SPY.csv', index_col='Date', p...
[ "pandas.read_csv", "numpy.mean", "numpy.std", "numpy.sqrt" ]
[((194, 350), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/eunjiJeong729/QuantArtificial_Intelligence/master/SPY.csv"""'], {'index_col': '"""Date"""', 'parse_dates': "['Date']"}), "(\n 'https://raw.githubusercontent.com/eunjiJeong729/QuantArtificial_Intelligence/master/SPY.csv'\n , in...
import numpy as np import os import tensorflow as tf from yadlt.models.autoencoders import deep_autoencoder from yadlt.utils import datasets, utilities # #################### # # Flags definition # # #################### # flags = tf.app.flags FLAGS = flags.FLAGS # Global configuration flags.DEFINE_string('datas...
[ "numpy.load", "yadlt.models.autoencoders.deep_autoencoder.DeepAutoencoder", "yadlt.utils.utilities.random_seed_np_tf", "yadlt.utils.datasets.load_cifar10_dataset", "os.path.join", "yadlt.utils.utilities.str2actfunc", "yadlt.utils.utilities.flag_to_list", "yadlt.utils.datasets.load_mnist_dataset" ]
[((3883, 3930), 'yadlt.utils.utilities.flag_to_list', 'utilities.flag_to_list', (['FLAGS.dae_layers', '"""int"""'], {}), "(FLAGS.dae_layers, 'int')\n", (3905, 3930), False, 'from yadlt.utils import datasets, utilities\n'), ((3950, 4003), 'yadlt.utils.utilities.flag_to_list', 'utilities.flag_to_list', (['FLAGS.dae_enc_a...
#!/usr/bin/env python """Run binary clasification probing experiment.""" import argparse from collections import namedtuple from operator import attrgetter from pathlib import Path import re import sys from joblib import delayed, parallel_backend, Parallel import numpy as np import pandas as pd from sklearn import met...
[ "torch.nn.Dropout", "numpy.load", "yaml.load", "numpy.random.seed", "argparse.ArgumentParser", "pandas.read_csv", "sklearn.metrics.accuracy_score", "joblib.parallel_backend", "pathlib.Path", "numpy.arange", "skorch.NeuralNetClassifier", "sklearn.metrics.precision_recall_fscore_support", "sko...
[((642, 699), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (684, 699), False, 'import torch\n'), ((714, 775), 'collections.namedtuple', 'namedtuple', (['"""Utterance"""', "['uri', 'feats_path', 'phones_path']"], {}), "('Utt...
import numpy as np import scipy.linalg import solver from activation import softmax, softmax_log class SoftmaxRegression(object): def __init__(self, solver='gradient', alpha=1e-3, e=1e-3, verbose=False): self.w = None self.e = e self.verbose = verbose self.solver = solver s...
[ "numpy.sum", "numpy.zeros", "numpy.transpose", "numpy.reshape", "numpy.dot", "solver.newton", "solver.gradient_descent" ]
[((377, 418), 'numpy.reshape', 'np.reshape', (['self.w', '(x.shape[1], -1)', '"""F"""'], {}), "(self.w, (x.shape[1], -1), 'F')\n", (387, 418), True, 'import numpy as np\n'), ((518, 553), 'numpy.zeros', 'np.zeros', (['[x.shape[1] * t.shape[1]]'], {}), '([x.shape[1] * t.shape[1]])\n', (526, 553), True, 'import numpy as n...
#!/usr/bin/env python3 import matplotlib.pyplot as plt import numpy as np import os import tensorflow as tf from tensorflow.python.framework import tensor_util from tensorflow.core.util import event_pb2 from tensorflow.python.lib.io import tf_record def my_summary_iterator(path): for r in tf_record.tf_record_iter...
[ "matplotlib.pyplot.title", "numpy.stack", "tensorflow.core.util.event_pb2.Event.FromString", "tensorflow.python.lib.io.tf_record.tf_record_iterator", "matplotlib.pyplot.boxplot", "matplotlib.pyplot.bar", "matplotlib.pyplot.axis", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.ylabe...
[((296, 330), 'tensorflow.python.lib.io.tf_record.tf_record_iterator', 'tf_record.tf_record_iterator', (['path'], {}), '(path)\n', (324, 330), False, 'from tensorflow.python.lib.io import tf_record\n'), ((448, 471), 'os.listdir', 'os.listdir', (['summary_dir'], {}), '(summary_dir)\n', (458, 471), False, 'import os\n'),...
# pylint: disable=missing-function-docstring, missing-module-docstring/ from numpy import zeros from numpy import ones n = 5 x1 = zeros(4) x2 = zeros(n) #x3 = zeros(n, 'int') y1 = zeros((4, 3)) y2 = zeros((n, 2*n)) m = 5 a1 = ones(4) a2 = ones(n) #a3 = ones(n, 'int') b1 = ones((4, 3)) b2 = ones((n, 2*n))
[ "numpy.zeros", "numpy.ones" ]
[((132, 140), 'numpy.zeros', 'zeros', (['(4)'], {}), '(4)\n', (137, 140), False, 'from numpy import zeros\n'), ((146, 154), 'numpy.zeros', 'zeros', (['n'], {}), '(n)\n', (151, 154), False, 'from numpy import zeros\n'), ((183, 196), 'numpy.zeros', 'zeros', (['(4, 3)'], {}), '((4, 3))\n', (188, 196), False, 'from numpy i...
from typing import List import numpy as np from data_processing.sentence_getter import SentenceGetter from data_processing.transformers import transform from models.keras_lstm import BiLSTMNER MAX_LEN = 50 def bilstm_ner_model_experiment(sentences: List, words: List, tags: List, n_words: int, n_tags: int, max_len:...
[ "data_processing.transformers.transform", "models.keras_lstm.BiLSTMNER", "numpy.argmax", "data_processing.sentence_getter.SentenceGetter", "numpy.array" ]
[((438, 558), 'data_processing.transformers.transform', 'transform', ([], {'word2idx': 'word2idx', 'tag2idx': 'tag2idx', 'sentences': 'sentences', 'n_words': 'n_words', 'n_tags': 'n_tags', 'max_len': 'max_len'}), '(word2idx=word2idx, tag2idx=tag2idx, sentences=sentences, n_words=\n n_words, n_tags=n_tags, max_len=ma...
# Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[ "unittest.main", "json.loads", "os.path.isdir", "tempfile.mkdtemp", "numpy.random.rand", "shutil.rmtree", "os.path.join" ]
[((2641, 2656), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2654, 2656), False, 'import unittest\n'), ((1040, 1058), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1056, 1058), False, 'import tempfile\n'), ((1124, 1152), 'os.path.isdir', 'os.path.isdir', (['self._tmp_dir'], {}), '(self._tmp_dir)\n'...
from environment import Environment import numpy as np number_of_customers = 100 number_of_experiments = 1000 if __name__ == "__main__": env = Environment(number_of_customers) results = np.zeros((number_of_experiments, 3)) for i in range(number_of_experiments): print(i, "start") expectatio...
[ "numpy.save", "numpy.argmax", "numpy.zeros", "numpy.mean", "environment.Environment" ]
[((149, 181), 'environment.Environment', 'Environment', (['number_of_customers'], {}), '(number_of_customers)\n', (160, 181), False, 'from environment import Environment\n'), ((196, 232), 'numpy.zeros', 'np.zeros', (['(number_of_experiments, 3)'], {}), '((number_of_experiments, 3))\n', (204, 232), True, 'import numpy a...
import sqlite3 import numpy as np from PyQt5.QtGui import QImage, QPixmap class FaceData: def __init__(self, m_name, m_image, m_feature): self.p_name = m_name self.p_image = m_image self.p_feature = m_feature def modify_name(self, m_name): self.p_name = m_name def modify_...
[ "numpy.frombuffer", "PyQt5.QtGui.QImage", "sqlite3.connect", "PyQt5.QtGui.QPixmap.fromImage" ]
[((474, 531), 'PyQt5.QtGui.QImage', 'QImage', (['self.p_image.data', '(640)', '(480)', 'QImage.Format_RGB888'], {}), '(self.p_image.data, 640, 480, QImage.Format_RGB888)\n', (480, 531), False, 'from PyQt5.QtGui import QImage, QPixmap\n'), ((605, 634), 'PyQt5.QtGui.QPixmap.fromImage', 'QPixmap.fromImage', (['show_image'...
import pytest import nptdms import numpy as np import pathlib from fixitfelix import fix, source def test_processes_example_file_correct(tmpdir): meta = source.MetaData( chunk_size=6, recurrence_size=2, recurrence_distance=3, consistency_sample_size=10, ) output_filename =...
[ "nptdms.TdmsFile", "fixitfelix.source.MetaData", "pathlib.Path", "pytest.raises", "numpy.array", "numpy.arange", "fixitfelix.fix.export_correct_data" ]
[((160, 263), 'fixitfelix.source.MetaData', 'source.MetaData', ([], {'chunk_size': '(6)', 'recurrence_size': '(2)', 'recurrence_distance': '(3)', 'consistency_sample_size': '(10)'}), '(chunk_size=6, recurrence_size=2, recurrence_distance=3,\n consistency_sample_size=10)\n', (175, 263), False, 'from fixitfelix import...
import cv2 import sys import time import torch import pickle import getopt import numpy as np from cv2 import cv2 from tqdm import tqdm from net import resnet50 as yolonet from utils import VOC_CLASSES, imageTransform, targetGenerator, imageShow # return ap (area of bellow PR curve) def getAP(recall_curve, precisio...
[ "pickle.dump", "numpy.sum", "getopt.getopt", "numpy.maximum", "numpy.ones", "torch.cuda.device_count", "net.resnet50", "numpy.argsort", "numpy.mean", "pickle.load", "utils.targetGenerator.loadBoxLabel", "torch.no_grad", "numpy.cumsum", "utils.imageTransform.loadImageTensor", "utils.targe...
[((377, 421), 'numpy.concatenate', 'np.concatenate', (['([0.0], recall_curve, [1.0])'], {}), '(([0.0], recall_curve, [1.0]))\n', (391, 421), True, 'import numpy as np\n'), ((442, 489), 'numpy.concatenate', 'np.concatenate', (['([0.0], precision_curve, [0.0])'], {}), '(([0.0], precision_curve, [0.0]))\n', (456, 489), Tr...
# File :HierarchicalClustering.py # Author :WJ # Function :层次聚类 # Time :2021/02/07 # Version : # Amend : from sklearn.cluster import AgglomerativeClustering import numpy as np import pandas as pd import matplotlib.pyplot as plt from itertools import cycle ##python自带的迭代器模块 def merge...
[ "pandas.DataFrame", "sklearn.cluster.AgglomerativeClustering", "numpy.array", "numpy.loadtxt" ]
[((365, 379), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (377, 379), True, 'import pandas as pd\n'), ((998, 1010), 'numpy.array', 'np.array', (['XY'], {}), '(XY)\n', (1006, 1010), True, 'import numpy as np\n'), ((1245, 1313), 'sklearn.cluster.AgglomerativeClustering', 'AgglomerativeClustering', ([], {'linkag...
import numpy as np import numpy.testing as npt from numpy.testing import assert_raises from statsmodels.distributions import StepFunction, monotone_fn_inverter class TestDistributions(object): def test_StepFunction(self): x = np.arange(20) y = np.arange(20) f = StepFunction(x, y) n...
[ "numpy.testing.assert_raises", "numpy.testing.assert_array_equal", "numpy.zeros", "numpy.arange", "numpy.array", "statsmodels.distributions.StepFunction", "statsmodels.distributions.monotone_fn_inverter" ]
[((240, 253), 'numpy.arange', 'np.arange', (['(20)'], {}), '(20)\n', (249, 253), True, 'import numpy as np\n'), ((266, 279), 'numpy.arange', 'np.arange', (['(20)'], {}), '(20)\n', (275, 279), True, 'import numpy as np\n'), ((292, 310), 'statsmodels.distributions.StepFunction', 'StepFunction', (['x', 'y'], {}), '(x, y)\...
import numpy as np import random class CollaborativeFiltering: def __init__(self, alpha, convergence_j_threshold, max_iter, n_features, seed = None): self.alpha = alpha self.convergence_j_threshold = convergence_j_threshold self.max_iter = max_iter self.n_features ...
[ "numpy.full", "numpy.random.seed", "numpy.mean", "numpy.random.rand", "numpy.unique" ]
[((534, 571), 'numpy.full', 'np.full', (['shape', 'unobserved_fill_value'], {}), '(shape, unobserved_fill_value)\n', (541, 571), True, 'import numpy as np\n'), ((928, 953), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (942, 953), True, 'import numpy as np\n'), ((1072, 1117), 'numpy.rando...
import tensorflow as tf import numpy as np import optimizee import math def lstm_func(x, h, c, wx, wh, b): """ x: (N, D) h: (N, H) c: (N, H) wx: (D, 4H) wh: (H, 4H) b: (4H, ) """ N, H = tf.shape(h)[0], tf.shape(h)[1] a = tf.reshape(tf.matmul(x, wx) + tf.m...
[ "numpy.random.uniform", "optimizee.Optimizee.__init__", "numpy.zeros", "math.sin", "tensorflow.placeholder", "tensorflow.shape", "tensorflow.zeros", "tensorflow.matmul", "numpy.random.normal", "tensorflow.tanh", "tensorflow.sigmoid" ]
[((414, 427), 'tensorflow.sigmoid', 'tf.sigmoid', (['i'], {}), '(i)\n', (424, 427), True, 'import tensorflow as tf\n'), ((436, 449), 'tensorflow.sigmoid', 'tf.sigmoid', (['f'], {}), '(f)\n', (446, 449), True, 'import tensorflow as tf\n'), ((458, 471), 'tensorflow.sigmoid', 'tf.sigmoid', (['o'], {}), '(o)\n', (468, 471)...
"""This module contains utility functions (e.g. validation) commonly used by pandas wranglers. """ import numpy as np import pandas as pd from pandas.core.groupby.generic import DataFrameGroupBy from pywrangler.util.sanitizer import ensure_iterable from pywrangler.util.types import TYPE_ASCENDING, TYPE_COLUMNS def...
[ "numpy.zeros", "pywrangler.util.sanitizer.ensure_iterable" ]
[((974, 998), 'pywrangler.util.sanitizer.ensure_iterable', 'ensure_iterable', (['columns'], {}), '(columns)\n', (989, 998), False, 'from pywrangler.util.sanitizer import ensure_iterable\n'), ((2470, 2491), 'numpy.zeros', 'np.zeros', (['df.shape[0]'], {}), '(df.shape[0])\n', (2478, 2491), True, 'import numpy as np\n')]
import os, sys import numpy as np import pandas as pd import subprocess import glob import json import csv import pickle from Bio.Seq import Seq from itertools import product #-------------------------------------------------------------------------------------------- def codon_translationrates_indprofiles(data_scik...
[ "pandas.DataFrame", "numpy.sum", "numpy.savetxt", "numpy.zeros", "numpy.percentile", "numpy.around", "numpy.shape", "numpy.mean", "numpy.array" ]
[((753, 789), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'codons_nonstop'}), '(columns=codons_nonstop)\n', (765, 789), True, 'import pandas as pd\n'), ((803, 838), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'codon_duplets'}), '(columns=codon_duplets)\n', (815, 838), True, 'import pandas as pd\n'), (...
import numpy as np import torch import time from dataset.utils import string2timestamp class DataFetcher(object): """ construct XC, XP, XT, Y current timestamp - offset = timestamp of interest data = fetchdata (timestamp of interest) """ def __init__(self, data, raw_ts, avg_data, ext_cls, t...
[ "numpy.stack", "numpy.asarray", "numpy.timedelta64", "dataset.utils.string2timestamp", "numpy.concatenate" ]
[((724, 762), 'numpy.timedelta64', 'np.timedelta64', (['(24 * 60 // self.T)', '"""m"""'], {}), "(24 * 60 // self.T, 'm')\n", (738, 762), True, 'import numpy as np\n'), ((781, 829), 'dataset.utils.string2timestamp', 'string2timestamp', (['self.raw_ts', 'self.offset_frame'], {}), '(self.raw_ts, self.offset_frame)\n', (79...
# -*- coding: utf-8 -*- # @Date : 2020/5/24 # @Author: Luokun # @Email : <EMAIL> import sys from os.path import dirname, abspath import numpy as np import matplotlib.pyplot as plt sys.path.append(dirname(dirname(abspath(__file__)))) def test_pca(): from models.pca import PCA x = np.random.randn(3, 200, 2...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "os.path.abspath", "matplotlib.pyplot.show", "numpy.random.randn", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.sin", "numpy.array", "models.pca.PCA", "numpy.cos", "numpy.diag" ...
[((295, 321), 'numpy.random.randn', 'np.random.randn', (['(3)', '(200)', '(2)'], {}), '(3, 200, 2)\n', (310, 321), True, 'import numpy as np\n'), ((334, 351), 'numpy.array', 'np.array', (['[-2, 0]'], {}), '([-2, 0])\n', (342, 351), True, 'import numpy as np\n'), ((364, 380), 'numpy.array', 'np.array', (['[2, 0]'], {}),...
from typing import Optional, Union import numpy as np from anndata import AnnData from pandas.api.types import CategoricalDtype from scvi.data.anndata._utils import _make_obs_column_categorical from ._obs_field import CategoricalObsField class LabelsWithUnlabeledObsField(CategoricalObsField): """ An AnnDat...
[ "numpy.where", "pandas.api.types.CategoricalDtype", "scvi.data.anndata._utils._make_obs_column_categorical" ]
[((1397, 1442), 'numpy.where', 'np.where', (['(mapping == self._unlabeled_category)'], {}), '(mapping == self._unlabeled_category)\n', (1405, 1442), True, 'import numpy as np\n'), ((1663, 1713), 'pandas.api.types.CategoricalDtype', 'CategoricalDtype', ([], {'categories': 'mapping', 'ordered': '(True)'}), '(categories=m...
""" This module gathers optimization functions.""" # Authors: <NAME> <<EMAIL>> # License: BSD (3-clause) import time import warnings import numpy as np from scipy.optimize.linesearch import line_search_armijo def fista(grad, obj, prox, x0, momentum=True, max_iter=100, step_size=None, early_stopping=True, e...
[ "numpy.zeros_like", "numpy.abs", "numpy.copy", "time.time", "numpy.finfo", "warnings.warn", "numpy.sqrt" ]
[((782, 799), 'numpy.zeros_like', 'np.zeros_like', (['x0'], {}), '(x0)\n', (795, 799), True, 'import numpy as np\n'), ((808, 819), 'numpy.copy', 'np.copy', (['x0'], {}), '(x0)\n', (815, 819), True, 'import numpy as np\n'), ((3120, 3136), 'numpy.zeros_like', 'np.zeros_like', (['y'], {}), '(y)\n', (3133, 3136), True, 'im...
"""Proposal for a simple, understandable MetaWorld API.""" import abc import pickle from collections import OrderedDict from typing import List, NamedTuple, Type import metaworld.envs.mujoco.env_dict as _env_dict import numpy as np EnvName = str class Task(NamedTuple): """All data necessary to describe a singl...
[ "collections.OrderedDict", "numpy.array", "pickle.dumps" ]
[((3602, 3632), 'collections.OrderedDict', 'OrderedDict', (['[(env_name, cls)]'], {}), '([(env_name, cls)])\n', (3613, 3632), False, 'from collections import OrderedDict\n'), ((3705, 3735), 'collections.OrderedDict', 'OrderedDict', (['[(env_name, cls)]'], {}), '([(env_name, cls)])\n', (3716, 3735), False, 'from collect...
import tensorflow as tf import os from PIL import Image import numpy as np import logging import time from goods.models import ProblemGoods from dl.step1_cnn import Step1CNN from dl.step2_cnn import Step2CNN from dl.step3_cnn import Step3CNN from dl.tradition_match import TraditionMatch from dl.util import visualize_bo...
[ "tensorflow.gfile.Exists", "goods.models.ExportAction.objects.filter", "goods.models.ProblemGoods.objects.create", "tensorflow.gfile.MakeDirs", "os.path.realpath", "os.path.dirname", "PIL.Image.open", "time.time", "tensorflow.ConfigProto", "time.sleep", "PIL.Image.fromarray", "numpy.array", ...
[((423, 450), 'logging.getLogger', 'logging.getLogger', (['"""detect"""'], {}), "('detect')\n", (440, 450), False, 'import logging\n'), ((2112, 2128), 'dl.tradition_match.TraditionMatch', 'TraditionMatch', ([], {}), '()\n', (2126, 2128), False, 'from dl.tradition_match import TraditionMatch\n'), ((2177, 2193), 'tensorf...
import os import json import pickle import torch import torch.nn as nn from torch.autograd import Variable import numpy as np from pytorch_pretrained_bert import BertTokenizer from commons.embeddings.graph_utils import * from datasets.schema import Schema from typing import List class WordEmbedding(nn.Module): d...
[ "numpy.load", "json.load", "pickle.dump", "torch.LongTensor", "pytorch_pretrained_bert.BertTokenizer.from_pretrained", "torch.autograd.Variable", "numpy.zeros", "os.path.isfile", "pickle.load", "numpy.array", "torch.tensor", "torch.from_numpy" ]
[((662, 732), 'pytorch_pretrained_bert.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-large-cased"""'], {'do_lower_case': '(False)'}), "('bert-large-cased', do_lower_case=False)\n", (691, 732), False, 'from pytorch_pretrained_bert import BertTokenizer\n'), ((2901, 2928), 'numpy.zeros', 'np....
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "preprocess_c.Preprocess.__init__", "layers_c.Layers.__init__", "math.exp", "tensorflow.keras.utils.to_categorical", "hypertune_c.HyperTune.__init__", "tensorflow_datasets.load", "pretraining_c.Pretraining.__init__", "sklearn.model_selection.train_test_split", "numpy.asarray", "tensorflow.keras.da...
[((2025, 2077), 'layers_c.Layers.__init__', 'Layers.__init__', (['self', 'init_weights', 'reg', 'relu', 'bias'], {}), '(self, init_weights, reg, relu, bias)\n', (2040, 2077), False, 'from layers_c import Layers\n'), ((2086, 2111), 'preprocess_c.Preprocess.__init__', 'Preprocess.__init__', (['self'], {}), '(self)\n', (2...
#pythran export run(float, float, float, float, float, float, int, int, float [][]) import math from numpy import zeros def run(xmin, ymin, xmax, ymax, step, range_, range_x, range_y, t): pt = zeros((range_x, range_y, 3)) "omp parallel for private(i,j,k,tmp)" for i in xrange(range_x): for j in xrang...
[ "numpy.zeros", "math.cos", "math.sin" ]
[((197, 225), 'numpy.zeros', 'zeros', (['(range_x, range_y, 3)'], {}), '((range_x, range_y, 3))\n', (202, 225), False, 'from numpy import zeros\n'), ((544, 579), 'math.cos', 'math.cos', (['(ymin + step * j - t[k, 1])'], {}), '(ymin + step * j - t[k, 1])\n', (552, 579), False, 'import math\n'), ((577, 602), 'math.sin', ...
import torch import random import numpy as np class InfiniteDataLoader(torch.utils.data.DataLoader): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.dataset_iterator = super().__iter__() def __iter__(self): return self def __next__(self): ...
[ "traceback.format_exception", "numpy.random.seed", "os.makedirs", "logging.FileHandler", "torch.manual_seed", "logging.StreamHandler", "os.path.exists", "logging.Formatter", "logging.info", "torch.cuda.manual_seed_all", "random.seed", "logging.getLogger" ]
[((865, 882), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (876, 882), False, 'import random\n'), ((887, 907), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (901, 907), True, 'import numpy as np\n'), ((912, 935), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (92...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Jan 29, 2021 @file: train_unmixing.py @desc: Perform the training of the models for the unmixing problem. @author: laugh12321 @contact: <EMAIL> """ import os import numpy as np import tensorflow as tf from typing import Dict import src.model.enums as enums ...
[ "numpy.random.seed", "src.utils.transforms.MinMaxNormalize", "src.evaluation.time_metrics.TimeHistory", "src.utils.io.save_metrics", "numpy.array", "tensorflow.keras.optimizers.Adam", "src.utils.transforms.apply_transformations", "src.model.models._get_model", "os.path.join", "tensorflow.keras.cal...
[((2138, 2163), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'seed'}), '(seed=seed)\n', (2152, 2163), True, 'import numpy as np\n'), ((2177, 2268), 'src.model.models._get_model', '_get_model', ([], {'model_key': 'model_name'}), "(model_key=model_name, **{'input_size': sample_size, 'n_classes':\n n_classes})\...
""" =================================== Demo of OPTICS clustering algorithm =================================== .. currentmodule:: sklearn Finds core samples of high density and expands clusters from them. This example uses data that is generated so that the clusters have different densities. The :class:`~cluster.OPT...
[ "matplotlib.pyplot.subplot", "numpy.full_like", "sklearn.cluster.cluster_optics_dbscan", "numpy.random.seed", "matplotlib.pyplot.show", "numpy.random.randn", "matplotlib.pyplot.figure", "sklearn.cluster.OPTICS", "matplotlib.gridspec.GridSpec", "matplotlib.pyplot.tight_layout", "numpy.vstack" ]
[((869, 886), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (883, 886), True, 'import numpy as np\n'), ((1285, 1320), 'numpy.vstack', 'np.vstack', (['(C1, C2, C3, C4, C5, C6)'], {}), '((C1, C2, C3, C4, C5, C6))\n', (1294, 1320), True, 'import numpy as np\n'), ((1330, 1384), 'sklearn.cluster.OPTICS', 'O...
''' Copyright 2022 Airbus SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
[ "copy.deepcopy", "numpy.delete", "gemseo.core.scenario.Scenario.set_differentiation_method", "gemseo.algos.design_space.DesignSpace", "sos_trades_core.api.get_sos_logger", "gemseo.core.scenario.Scenario._update_input_grammar", "numpy.array", "gemseo.formulations.formulations_factory.MDOFormulationsFac...
[((2169, 2180), 'multiprocessing.cpu_count', 'cpu_count', ([], {}), '()\n', (2178, 2180), False, 'from multiprocessing import cpu_count\n'), ((6474, 6526), 'sos_trades_core.api.get_sos_logger', 'get_sos_logger', (['f"""{self.ee.logger.name}.SoSScenario"""'], {}), "(f'{self.ee.logger.name}.SoSScenario')\n", (6488, 6526)...
from subprocess import PIPE, Popen import numpy as np import scphylo as scp from scphylo.external.gpps._nh2lgf import newick_to_edgelist __author__ = "<NAME>" __date__ = "11/30/21" class Node: def __init__( self, name, parent, id_node, mutation_id, loss=False, ...
[ "subprocess.Popen", "scphylo.ul.tmpdirsys", "scphylo.ul.executable", "scphylo.external.gpps._nh2lgf.newick_to_edgelist", "numpy.savetxt" ]
[((4403, 4454), 'scphylo.ul.executable', 'scp.ul.executable', (['"""gpps_tree"""', '"""gpps tree scripts"""'], {}), "('gpps_tree', 'gpps tree scripts')\n", (4420, 4454), True, 'import scphylo as scp\n'), ((4468, 4500), 'scphylo.ul.tmpdirsys', 'scp.ul.tmpdirsys', ([], {'suffix': '""".gpps"""'}), "(suffix='.gpps')\n", (4...
# Copyright 2021 <NAME> # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistr...
[ "copy.deepcopy", "causalicp.data._Data", "numpy.sum", "numpy.ones" ]
[((1814, 1832), 'numpy.sum', 'np.sum', (['self.n_obs'], {}), '(self.n_obs)\n', (1820, 1832), True, 'import numpy as np\n'), ((2149, 2163), 'causalicp.data._Data', '_Data', (['self.XX'], {}), '(self.XX)\n', (2154, 2163), False, 'from causalicp.data import _Data\n'), ((2487, 2509), 'copy.deepcopy', 'copy.deepcopy', (['se...