code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import pickle import numpy as np from tqdm.auto import tqdm import moses from moses import CharVocab class NGram: def __init__(self, max_context_len=10, verbose=False): self.max_context_len = max_context_len self._dict = dict() self.vocab = None self.default_probs = None se...
[ "pickle.dump", "moses.CharVocab.from_data", "numpy.log", "moses.get_dataset", "pickle.load", "numpy.array", "numpy.random.seed", "tqdm.auto.tqdm", "moses.get_all_metrics" ]
[((5491, 5517), 'moses.get_dataset', 'moses.get_dataset', (['"""train"""'], {}), "('train')\n", (5508, 5517), False, 'import moses\n'), ((5581, 5601), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (5595, 5601), True, 'import numpy as np\n'), ((5668, 5727), 'moses.get_all_metrics', 'moses.get_all_me...
import numpy from matplotlib import pyplot from surrogates.kernels import MCMCSimulation from surrogates.kernels.samplers.hmc import Hamiltonian from surrogates.models.simple import UnconditionedModel from surrogates.utils.distributions import Normal from surrogates.utils.file import change_directory from surrogates.u...
[ "numpy.mean", "surrogates.utils.file.change_directory", "surrogates.models.simple.UnconditionedModel", "surrogates.utils.plotting.plot_trace", "matplotlib.pyplot.close", "numpy.array", "surrogates.utils.plotting.plot_corner", "surrogates.utils.plotting.plot_log_p", "surrogates.kernels.MCMCSimulation...
[((692, 718), 'surrogates.models.simple.UnconditionedModel', 'UnconditionedModel', (['priors'], {}), '(priors)\n', (710, 718), False, 'from surrogates.models.simple import UnconditionedModel\n'), ((807, 825), 'numpy.array', 'numpy.array', (['[0.0]'], {}), '([0.0])\n', (818, 825), False, 'import numpy\n'), ((840, 858), ...
import numpy as np def gaussian_band(wn, A, s, m): return A/s*np.sqrt(2*np.pi)*np.exp(-(wn-m)**2/2/s**2) def lorentzian_band(wn, A, w, m): return A /(1 + (wn - m)**2/w**2)/(w*np.pi) def band(wn, band_params): if band_params[0] == "gauss": return gaussian_band(wn, *band_params[1:]) elif ...
[ "numpy.exp", "numpy.sqrt", "numpy.random.randn", "numpy.zeros_like" ]
[((540, 557), 'numpy.zeros_like', 'np.zeros_like', (['wn'], {}), '(wn)\n', (553, 557), True, 'import numpy as np\n'), ((85, 120), 'numpy.exp', 'np.exp', (['(-(wn - m) ** 2 / 2 / s ** 2)'], {}), '(-(wn - m) ** 2 / 2 / s ** 2)\n', (91, 120), True, 'import numpy as np\n'), ((68, 86), 'numpy.sqrt', 'np.sqrt', (['(2 * np.pi...
import numpy as np import torch def stocks_train(num_training, trainprocess, algorithm, encoder=False): if encoder: filenames_encoder = [] filenames_head = [] for i in range(num_training): filename_encoder = '{}_encoder{}.pt'.format(algorithm, i) filename_head = '{}_...
[ "numpy.array", "torch.load" ]
[((1363, 1381), 'numpy.array', 'np.array', (['loss_tmp'], {}), '(loss_tmp)\n', (1371, 1381), True, 'import numpy as np\n'), ((1711, 1729), 'numpy.array', 'np.array', (['loss_tmp'], {}), '(loss_tmp)\n', (1719, 1729), True, 'import numpy as np\n'), ((1776, 1790), 'numpy.array', 'np.array', (['loss'], {}), '(loss)\n', (17...
import tensorflow as tf import h5py import collections import six from syft.workers.websocket_server import WebsocketServerWorker import torch import sys import syft import sys import argparse from torchvision import datasets from torchvision import transforms import numpy as np import tensorflow_federated as tff im...
[ "syft.BaseDataset", "syft.workers.websocket_server.WebsocketServerWorker", "numpy.empty", "syft.TorchHook", "numpy.concatenate", "torchvision.transforms.Normalize", "torchvision.transforms.ToTensor", "six.iteritems" ]
[((2030, 2051), 'syft.TorchHook', 'syft.TorchHook', (['torch'], {}), '(torch)\n', (2044, 2051), False, 'import syft\n'), ((2065, 2139), 'syft.workers.websocket_server.WebsocketServerWorker', 'WebsocketServerWorker', ([], {'id': '_id', 'host': 'ip', 'port': '(8778)', 'hook': 'hook', 'verbose': '(True)'}), '(id=_id, host...
import json import numpy as np import matplotlib.pyplot as plt import os import yaml from sklearn.metrics import f1_score, roc_auc_score from fcos_core.config.paths_catalog import DatasetCatalog from Data.Preprocess import join_path def compute_iou(box1, box2): """ Compute IoU between two boxes....
[ "numpy.abs", "sklearn.metrics.f1_score", "numpy.where", "Data.Preprocess.join_path", "sklearn.metrics.roc_auc_score", "numpy.count_nonzero", "numpy.array", "numpy.zeros", "numpy.max", "fcos_core.config.paths_catalog.DatasetCatalog", "numpy.nonzero", "json.load" ]
[((1096, 1112), 'numpy.zeros', 'np.zeros', (['[n, m]'], {}), '([n, m])\n', (1104, 1112), True, 'import numpy as np\n'), ((1708, 1735), 'numpy.nonzero', 'np.nonzero', (['(matrix > iou_th)'], {}), '(matrix > iou_th)\n', (1718, 1735), True, 'import numpy as np\n'), ((3042, 3077), 'numpy.where', 'np.where', (['(label > neg...
import torch from torch.utils.data import DataLoader,Dataset import random import numpy as np from torch.utils.data.sampler import Sampler #从数据集中选取support_set 和query_set class get_SQ_set(object): def __init__(self, data_classes, number_class, support_sample_num, query_sample_num): self.data_classe...
[ "torch.randperm", "numpy.random.shuffle", "random.shuffle", "torch.utils.data.DataLoader" ]
[((3750, 3825), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': '(num_per_class * Number_way)', 'sampler': 'sampler'}), '(dataset, batch_size=num_per_class * Number_way, sampler=sampler)\n', (3760, 3825), False, 'from torch.utils.data import DataLoader, Dataset\n'), ((549, 580), 'numpy.random....
import json import logging import os import threading import numpy as np import pandas as pd import tiledb from server_timing import Timing as ServerTiming from server.common.constants import Axis, XApproximateDistribution from server.common.errors import DatasetAccessError, ConfigurationError from server.common.immu...
[ "tiledb.Array", "server.common.errors.DatasetAccessError", "server.compute.diffexp_cxg.diffexp_ttest", "pandas.Index", "numpy.count_nonzero", "logging.error", "numpy.arange", "server.common.utils.utils.path_join", "server.common.utils.type_conversion_utils.get_schema_type_hint_from_dtype", "numpy....
[((829, 950), 'tiledb.Ctx', 'tiledb.Ctx', (["{'sm.tile_cache_size': 8 * 1024 * 1024 * 1024, 'sm.num_reader_threads': 32,\n 'vfs.s3.region': 'us-east-1'}"], {}), "({'sm.tile_cache_size': 8 * 1024 * 1024 * 1024,\n 'sm.num_reader_threads': 32, 'vfs.s3.region': 'us-east-1'})\n", (839, 950), False, 'import tiledb\n'),...
import random import logging import numpy as np class MetropolisHastingsSampler(object): def __init__(self, tree, X): self.tree = tree self.X = X self.last_move = None self.likelihoods = [] def initialize_assignments(self): self.tree.initialize_from_data(self.X) d...
[ "random.choice", "logging.debug", "numpy.random.random", "numpy.exp", "numpy.arange" ]
[((446, 478), 'logging.debug', 'logging.debug', (['"""Copying tree..."""'], {}), "('Copying tree...')\n", (459, 478), False, 'import logging\n'), ((577, 638), 'logging.debug', 'logging.debug', (["('Old Marginal Likelihood: %f' % old_likelihood)"], {}), "('Old Marginal Likelihood: %f' % old_likelihood)\n", (590, 638), F...
# Copyright (c) 2022 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 ap...
[ "paddle.mean", "paddle.disable_static", "unittest.main", "paddle.fluid.core.disable_autotune", "paddle.CPUPlace", "numpy.random.random", "paddle.static.default_startup_program", "paddle.enable_static", "paddle.fluid.core.is_compiled_with_cuda", "paddle.fluid.core.autotune_status", "paddle.fluid....
[((948, 964), 'paddle.mean', 'paddle.mean', (['out'], {}), '(out)\n', (959, 964), False, 'import paddle\n'), ((1148, 1164), 'paddle.mean', 'paddle.mean', (['out'], {}), '(out)\n', (1159, 1164), False, 'import paddle\n'), ((1176, 1199), 'paddle.optimizer.Adam', 'paddle.optimizer.Adam', ([], {}), '()\n', (1197, 1199), Fa...
import cv2 import numpy as np from keras import Model from keras.applications import VGG16 from keras.preprocessing import image from keras.applications.vgg16 import preprocess_input class FeatureExtractor: def __init__(self): self.model = VGG16(weights='imagenet', include_top=True) def extract_feat...
[ "cv2.imread", "keras.applications.vgg16.preprocess_input", "numpy.expand_dims", "keras.applications.VGG16" ]
[((255, 298), 'keras.applications.VGG16', 'VGG16', ([], {'weights': '"""imagenet"""', 'include_top': '(True)'}), "(weights='imagenet', include_top=True)\n", (260, 298), False, 'from keras.applications import VGG16\n'), ((451, 484), 'numpy.expand_dims', 'np.expand_dims', (['img_array'], {'axis': '(0)'}), '(img_array, ax...
import numpy as np import os import matplotlib.pyplot as plt import SNN import data SAVE_PATH = os.getcwd() + '/weight_mnist' mnist = data.MNIST(path=["MNIST/t10k-images.idx3-ubyte", "MNIST/t10k-labels.idx1-ubyte"]) w1 = np.load(SAVE_PATH + '1.npy') w2 = np.load(SAVE_PATH + '2.npy') Ts = 1e-3 scale = 2 view_max = 2 ...
[ "numpy.argmax", "os.getcwd", "SNN.SNNDiscrete", "data.MNIST", "numpy.argmin", "numpy.load" ]
[((135, 220), 'data.MNIST', 'data.MNIST', ([], {'path': "['MNIST/t10k-images.idx3-ubyte', 'MNIST/t10k-labels.idx1-ubyte']"}), "(path=['MNIST/t10k-images.idx3-ubyte',\n 'MNIST/t10k-labels.idx1-ubyte'])\n", (145, 220), False, 'import data\n'), ((223, 251), 'numpy.load', 'np.load', (["(SAVE_PATH + '1.npy')"], {}), "(SA...
""" Lidar """ # requies glob to be installed: "pip3 install glob2" # requires rplidar to be installed: "pip3 install rplidar" import time import math import pickle import serial import numpy as np from donkeycar.utils import norm_deg, dist, deg2rad, arr_to_img from PIL import Image, ImageDraw class RPLidar(object): ...
[ "PyLidar3.YdLidarX4", "numpy.radians", "breezyslam.sensors.Laser", "numpy.copy", "donkeycar.utils.norm_deg", "PIL.Image.new", "breezyslam.algorithms.RMHC_SLAM", "rplidar.RPLidar", "time.sleep", "numpy.argsort", "math.cos", "PIL.ImageDraw.Draw", "numpy.array", "serial.Serial", "math.sin",...
[((638, 663), 'glob.glob', 'glob.glob', (['"""/dev/ttyUSB*"""'], {}), "('/dev/ttyUSB*')\n", (647, 663), False, 'import glob\n'), ((2591, 2604), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (2601, 2604), False, 'import time\n'), ((3028, 3052), 'PyLidar3.YdLidarX4', 'PyLidar3.YdLidarX4', (['port'], {}), '(port)\n'...
"""By: Xiaochi (<NAME>: github.com/XC-Li""" from gensim.models.doc2vec import Doc2Vec import numpy as np from scipy.sparse import hstack as sparse_hstack class D2V(object): def __init__(self, file): self.model = Doc2Vec.load(file) def fit(self, X): pass def transform(self, X): te...
[ "scipy.sparse.hstack", "numpy.vstack", "gensim.models.doc2vec.Doc2Vec.load" ]
[((226, 244), 'gensim.models.doc2vec.Doc2Vec.load', 'Doc2Vec.load', (['file'], {}), '(file)\n', (238, 244), False, 'from gensim.models.doc2vec import Doc2Vec\n'), ((425, 440), 'numpy.vstack', 'np.vstack', (['temp'], {}), '(temp)\n', (434, 440), True, 'import numpy as np\n'), ((530, 548), 'gensim.models.doc2vec.Doc2Vec....
from collections.abc import Sequence import random import cv2 import torch import numpy as np def set_all_randomness(seed, set_for_cuda=True): """Sets the random seed for numpy, pytorch, python.random """ random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) if set_for_cuda: t...
[ "torch.cuda.manual_seed_all", "torch.manual_seed", "cv2.fillPoly", "random.uniform", "random.seed", "torch.from_numpy", "numpy.array", "numpy.zeros", "numpy.random.seed", "cv2.cvtColor" ]
[((219, 236), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (230, 236), False, 'import random\n'), ((241, 261), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (255, 261), True, 'import numpy as np\n'), ((266, 289), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (28...
# Copyright 2018/2019 The RLgraph 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...
[ "numpy.mean", "rlgraph.agents.IMPALAAgent.from_spec", "time.sleep", "rlgraph.tests.test_util.config_from_path", "rlgraph.utils.root_logger.setLevel", "rlgraph.environments.OpenAIGymEnv" ]
[((1221, 1261), 'rlgraph.utils.root_logger.setLevel', 'root_logger.setLevel', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (1241, 1261), False, 'from rlgraph.utils import root_logger\n'), ((1842, 1942), 'rlgraph.environments.OpenAIGymEnv', 'OpenAIGymEnv', (['"""Breakout-v0"""'], {'frameskip': '(4)', 'max_...
# Authors: # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: BSD 3 clause """ Simulate the lid driven cavity dt rho + dx qx + dy qy = 0 dt qx + dx (qx^2/rho + c^2 rho) + dy (qx*qy/rho) = 0 dt qy + dx (qx*qy/rho) + dy (qy^2/rho + c^2 rho) = 0 """ import numpy as np import sympy as sp import matplotlib.pyplot...
[ "numpy.abs", "numpy.sqrt", "numpy.random.rand", "pylbm.Simulation", "sympy.symbols", "numpy.array", "matplotlib.pyplot.show" ]
[((389, 407), 'sympy.symbols', 'sp.symbols', (['"""X, Y"""'], {}), "('X, Y')\n", (399, 407), True, 'import sympy as sp\n'), ((422, 447), 'sympy.symbols', 'sp.symbols', (['"""rho, qx, qy"""'], {}), "('rho, qx, qy')\n", (432, 447), True, 'import sympy as sp\n'), ((453, 489), 'sympy.symbols', 'sp.symbols', (['"""lambda"""...
# -*- coding: utf-8 -*- """ Author: <NAME> <<EMAIL>> License: MIT """ import numpy as np import matplotlib.pyplot as plt if __name__ == "__main__": # Parameters fkind = "float32" # Initialize figure fig = plt.figure(figsize = (10, 5), facecolor = "white") fig.patch.set_alpha(0.) ax1 = f...
[ "numpy.fromfile", "numpy.reshape", "numpy.max", "matplotlib.pyplot.figure", "numpy.min" ]
[((230, 276), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 5)', 'facecolor': '"""white"""'}), "(figsize=(10, 5), facecolor='white')\n", (240, 276), True, 'import matplotlib.pyplot as plt\n'), ((488, 543), 'numpy.fromfile', 'np.fromfile', (['"""../examples/rand/data1d.bin"""'], {'dtype': 'fkind'}), "...
from numpy.testing import TestCase, run_module_suite, assert_allclose from scipy.linalg import cython_lapack as cython_lapack from scipy.linalg import lapack class test_lamch(TestCase): def test_slamch(self): for c in [b'e', b's', b'b', b'p', b'n', b'r', b'm', b'u', b'l', b'o']: asse...
[ "scipy.linalg.cython_lapack._test_slamch", "scipy.linalg.lapack.slamch", "scipy.linalg.cython_lapack._test_dlamch", "numpy.testing.run_module_suite", "scipy.linalg.lapack.dlamch" ]
[((664, 682), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (680, 682), False, 'from numpy.testing import TestCase, run_module_suite, assert_allclose\n'), ((332, 361), 'scipy.linalg.cython_lapack._test_slamch', 'cython_lapack._test_slamch', (['c'], {}), '(c)\n', (358, 361), True, 'from scipy.l...
import matplotlib.pyplot as plt import numpy as np import torch import cv2 def draw_figure(fig): fig.canvas.draw() fig.canvas.flush_events() plt.pause(0.001) def show_tensor(a: torch.Tensor, fig_num = None, title = None, range=(None, None), ax=None): """Display a 2D tensor. args: ...
[ "matplotlib.pyplot.imshow", "cv2.rectangle", "matplotlib.pyplot.title", "numpy.unique", "matplotlib.pyplot.gcf", "matplotlib.pyplot.plot", "numpy.asarray", "numpy.array", "matplotlib.pyplot.figure", "numpy.zeros", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.pause", "matplotlib.pyplo...
[((164, 180), 'matplotlib.pyplot.pause', 'plt.pause', (['(0.001)'], {}), '(0.001)\n', (173, 180), True, 'import matplotlib.pyplot as plt\n'), ((1361, 1380), 'matplotlib.pyplot.figure', 'plt.figure', (['fig_num'], {}), '(fig_num)\n', (1371, 1380), True, 'import matplotlib.pyplot as plt\n'), ((1412, 1421), 'matplotlib.py...
import numpy as np from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Conv1D, MaxPooling1D, GlobalAveragePooling1D def create_and_fit_dense_model(batch_size, epochs, callbacks, X_train, X_test, y_train, y_test): # BUILD THE MODEL model = Sequential...
[ "keras.layers.MaxPooling1D", "keras.layers.GlobalAveragePooling1D", "keras.layers.Conv1D", "keras.models.Sequential", "keras.layers.Activation", "keras.layers.Dense", "keras.layers.Dropout", "numpy.save" ]
[((310, 322), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (320, 322), False, 'from keras.models import Sequential\n'), ((964, 1014), 'numpy.save', 'np.save', (['"""Auswertung/history.npy"""', 'history.history'], {}), "('Auswertung/history.npy', history.history)\n", (971, 1014), True, 'import numpy as np\...
# Copyright (C) <NAME> 2020. # Distributed under the MIT License (see the accompanying README.md and LICENSE files). import numpy as np import policies.plackettluce as pl import utils.variance as var def optimize_logging_policy(n_update_steps, logging_policy, da...
[ "numpy.mean", "numpy.equal", "numpy.sum", "policies.plackettluce.gradient_based_on_samples", "utils.variance.oracle_list_variance", "policies.plackettluce.sample_rankings", "numpy.amax" ]
[((1277, 1364), 'policies.plackettluce.sample_rankings', 'pl.sample_rankings', (['policy_query_scores', '(10 ** 3)'], {'cutoff': 'cutoff', 'prob_per_rank': '(True)'}), '(policy_query_scores, 10 ** 3, cutoff=cutoff,\n prob_per_rank=True)\n', (1295, 1364), True, 'import policies.plackettluce as pl\n'), ((1553, 1624), ...
from collections import OrderedDict import numpy as np import tensorflow as tf import kaggle_environments.envs.halite.helpers as hh from gym_halite.envs.halite_env import get_scalar_features, get_feature_maps NETWORKS = {'CartPole-v1': models.get_q_mlp, 'CartPole-v1_duel': models.get_dueling_q_mlp, ...
[ "tensorflow.keras.layers.Input", "collections.OrderedDict", "tensorflow.keras.layers.Concatenate", "tensorflow.keras.initializers.random_uniform", "tensorflow.keras.initializers.constant", "tensorflow.convert_to_tensor", "tensorflow.keras.initializers.variance_scaling", "tensorflow.reduce_max", "gym...
[((1052, 1111), 'tensorflow.keras.layers.Input', 'layers.Input', ([], {'shape': 'feature_maps_shape', 'name': '"""feature_maps"""'}), "(shape=feature_maps_shape, name='feature_maps')\n", (1064, 1111), True, 'import tensorflow.keras.layers as layers\n'), ((1203, 1268), 'tensorflow.keras.layers.Input', 'layers.Input', ([...
import numpy as np from africanus.util.numba import jit @jit(nogil=True, nopython=True, cache=True) def fac(x): if x < 0: raise ValueError("Factorial input is negative.") if x == 0: return 1 factorial = 1 for i in range(1, x + 1): factorial *= i return factorial @jit(no...
[ "numpy.product", "numpy.empty", "numpy.cos", "numpy.arctan2", "africanus.util.numba.jit", "numpy.sin" ]
[((61, 103), 'africanus.util.numba.jit', 'jit', ([], {'nogil': '(True)', 'nopython': '(True)', 'cache': '(True)'}), '(nogil=True, nopython=True, cache=True)\n', (64, 103), False, 'from africanus.util.numba import jit\n'), ((314, 356), 'africanus.util.numba.jit', 'jit', ([], {'nogil': '(True)', 'nopython': '(True)', 'ca...
"""OTE MVTec Dataset facilitate OTE Anomaly Training. License: MVTec AD dataset is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)(https://creativecommons.org/licenses/by-nc-sa/4.0/). Reference: - <NAME>, <NAME>, <NAME>, <NAME>, <NAM...
[ "numpy.ones_like", "ote_sdk.entities.datasets.DatasetEntity", "ote_sdk.entities.image.Image", "pathlib.Path", "ote_sdk.entities.annotation.AnnotationSceneEntity", "ote_sdk.entities.id.ID", "ote_sdk.entities.color.Color", "ote_sdk.entities.annotation.Annotation", "ote_sdk.entities.shapes.rectangle.Re...
[((4932, 5067), 'anomalib.data.mvtec.make_mvtec_dataset', 'make_mvtec_dataset', ([], {'path': 'self.path', 'split_ratio': 'self.split_ratio', 'seed': 'self.seed', 'create_validation_set': 'self.create_validation_set'}), '(path=self.path, split_ratio=self.split_ratio, seed=self.\n seed, create_validation_set=self.cre...
''' This file was cloned from https://github.com/nogueirs/JMLR2018/blob/master/python/stability/__init__.py The method was propsoed in Nogueira et al. 2017. Docstring and signatures format were revised to google style. Reference: ---------- <NAME>., <NAME>., & <NAME>. (2017). On the stability of feature selection alg...
[ "numpy.mean", "numpy.multiply", "numpy.power", "scipy.stats.norm.ppf", "math.sqrt", "numpy.asarray", "numpy.sum", "numpy.zeros", "multiprocessing.Pool", "numpy.std", "scipy.stats.norm.cdf" ]
[((1332, 1350), 'numpy.mean', 'np.mean', (['Z'], {'axis': '(0)'}), '(Z, axis=0)\n', (1339, 1350), True, 'import numpy as np\n'), ((1359, 1372), 'numpy.sum', 'np.sum', (['hatPF'], {}), '(hatPF)\n', (1365, 1372), True, 'import numpy as np\n'), ((2425, 2443), 'numpy.mean', 'np.mean', (['Z'], {'axis': '(0)'}), '(Z, axis=0)...
def bedrockchannel(tend,uplift,kappa1,kappa2,deltaz): import numpy as np # Initial Topography nx=200 dx=10 xgrid=np.arange(0,nx*dx,dx) # Grid area=np.zeros(nx) area=500+0.5*xgrid**2 # Hack's law relating drainage area and stream length # Channel Width #...
[ "numpy.zeros", "numpy.ones", "numpy.arange" ]
[((135, 160), 'numpy.arange', 'np.arange', (['(0)', '(nx * dx)', 'dx'], {}), '(0, nx * dx, dx)\n', (144, 160), True, 'import numpy as np\n'), ((184, 196), 'numpy.zeros', 'np.zeros', (['nx'], {}), '(nx)\n', (192, 196), True, 'import numpy as np\n'), ((440, 452), 'numpy.zeros', 'np.zeros', (['nx'], {}), '(nx)\n', (448, 4...
import tensorflow as tf import os import numpy as np from matplotlib import pyplot as plt from tensorflow.keras.layers import Conv2D, BatchNormalization, Activation, MaxPool2D, Dropout, Flatten, Dense from tensorflow.keras import Model from utils import BATCH_SIZE, EPOCH, TEST_SET, TRAIN_SET np.set_printoptions(thresh...
[ "os.path.exists", "tensorflow.keras.layers.Conv2D", "numpy.set_printoptions", "tensorflow.keras.losses.SparseCategoricalCrossentropy", "tensorflow.keras.layers.Dense", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.MaxPool2D" ]
[((294, 331), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (313, 331), True, 'import numpy as np\n'), ((1876, 1923), 'os.path.exists', 'os.path.exists', (["(checkpoint_save_path + '.index')"], {}), "(checkpoint_save_path + '.index')\n", (1890, 1923), False, 'im...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 26 19:17:11 2019 @author: plunder """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 25 09:44:55 2019 @author: plunder """ import matplotlib.pyplot as plt import numpy as np import sympy as sp from discrete_pms import Dis...
[ "init_plot_settings.init_plot_settings", "matplotlib.pyplot.savefig", "discrete_pms.DiscretePMS", "numpy.linspace", "scipy.stats.norm.pdf", "matplotlib.pyplot.show" ]
[((411, 434), 'init_plot_settings.init_plot_settings', 'init_plot_settings', (['plt'], {}), '(plt)\n', (429, 434), False, 'from init_plot_settings import init_plot_settings\n'), ((444, 457), 'discrete_pms.DiscretePMS', 'DiscretePMS', ([], {}), '()\n', (455, 457), False, 'from discrete_pms import DiscretePMS\n'), ((1183...
from abc import abstractmethod from collections import OrderedDict from functools import partial from typing import List import numpy as np import pymc3 as pm import theano as th import theano.tensor as tt from pymc3.variational.updates import get_or_compute_grads from .. import types from ..io import io_commons from...
[ "collections.OrderedDict", "theano.tensor.constant", "pymc3.variational.updates.get_or_compute_grads", "numpy.asarray", "numpy.zeros", "pymc3.theanof.floatX", "theano.tensor.inc_subtensor" ]
[((6396, 6439), 'pymc3.variational.updates.get_or_compute_grads', 'get_or_compute_grads', (['loss_or_grads', 'params'], {}), '(loss_or_grads, params)\n', (6416, 6439), False, 'from pymc3.variational.updates import get_or_compute_grads\n'), ((6458, 6471), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (6469...
from verifai.simulators.webots.webots_task import webots_task from verifai.simulators.webots.client_webots import ClientWebots from math import sin from math import cos import numpy as np from math import atan2 from collections import namedtuple import os from dotmap import DotMap import pickle from shapely.geometry im...
[ "collections.namedtuple", "numpy.argpartition", "controller.Supervisor", "dotmap.DotMap", "verifai.simulators.webots.client_webots.ClientWebots", "os.getcwd", "math.cos", "numpy.array", "shapely.geometry.Polygon", "shapely.geometry.Point", "sys.exit", "math.sin" ]
[((654, 698), 'collections.namedtuple', 'namedtuple', (['"""Line"""', "['x1', 'y1', 'x2', 'y2']"], {}), "('Line', ['x1', 'y1', 'x2', 'y2'])\n", (664, 698), False, 'from collections import namedtuple\n'), ((1005, 1016), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1014, 1016), False, 'import os\n'), ((4786, 4798), 'cont...
import matplotlib.pyplot as plt import numpy as np from keras import regularizers from keras.models import Sequential from keras.layers import Dense, Dropout from keras.utils.np_utils import to_categorical from keras.optimizers import Adam import numpy as np from sklearn.ensemble import RandomForestClassifier from sk...
[ "keras.optimizers.Adam", "matplotlib.pyplot.show", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "keras.models.Sequential", "keras.regularizers.l2", "keras.layers.Dense", "numpy.loadtxt", "keras.layers.Dropout", "numpy.arange", ...
[((419, 463), 'numpy.loadtxt', 'np.loadtxt', (['"""vgg19_train.csv"""'], {'delimiter': '""","""'}), "('vgg19_train.csv', delimiter=',')\n", (429, 463), True, 'import numpy as np\n'), ((468, 498), 'numpy.arange', 'np.arange', (['train_data.shape[0]'], {}), '(train_data.shape[0])\n', (477, 498), True, 'import numpy as np...
from DataSocket import TCPSendSocket, TCPReceiveSocket, RAW import time import numpy as np import threading import struct import sys send_port = 4242 rec_port = 4242 ip = '127.0.0.1' # define function to print the echo back from matlab def print_data(data): print(data, "unpacked:", struct.unpack('ff', data)) #...
[ "numpy.random.random", "struct.pack", "time.sleep", "threading.Event", "struct.unpack", "DataSocket.TCPSendSocket", "sys.exit", "threading.Thread", "DataSocket.TCPReceiveSocket" ]
[((368, 427), 'DataSocket.TCPSendSocket', 'TCPSendSocket', ([], {'tcp_port': 'send_port', 'tcp_ip': 'ip', 'send_type': 'RAW'}), '(tcp_port=send_port, tcp_ip=ip, send_type=RAW)\n', (381, 427), False, 'from DataSocket import TCPSendSocket, TCPReceiveSocket, RAW\n'), ((445, 545), 'DataSocket.TCPReceiveSocket', 'TCPReceive...
from numpy import loadtxt, ndarray, min, max from sklearn.metrics import adjusted_mutual_info_score, adjusted_rand_score, fowlkes_mallows_score from SNNDPC import SNNDPC if __name__ == '__main__': # Parameter # -------------------------------------------------------------------------------- # pathData = "../data/...
[ "SNNDPC.SNNDPC", "sklearn.metrics.adjusted_mutual_info_score", "sklearn.metrics.adjusted_rand_score", "numpy.max", "sklearn.metrics.fowlkes_mallows_score", "numpy.min", "numpy.loadtxt" ]
[((515, 532), 'numpy.loadtxt', 'loadtxt', (['pathData'], {}), '(pathData)\n', (522, 532), False, 'from numpy import loadtxt, ndarray, min, max\n'), ((685, 704), 'SNNDPC.SNNDPC', 'SNNDPC', (['k', 'nc', 'data'], {}), '(k, nc, data)\n', (691, 704), False, 'from SNNDPC import SNNDPC\n'), ((600, 617), 'numpy.min', 'min', ([...
import streamlit as st import numpy as np import pandas as pd import joblib import matplotlib.pyplot as plt import matplotlib import seaborn as sns import plotly.express as px from PIL import Image import os import cv2 #from google.colab.patches import cv2_imshow import dlib from skimage import io import matplotlib.p...
[ "streamlit.image", "PIL.ImageOps.fit", "numpy.array", "streamlit.title", "streamlit.sidebar.write", "numpy.asarray", "dlib.get_frontal_face_detector", "numpy.frombuffer", "streamlit.file_uploader", "streamlit.write", "numpy.argmax", "streamlit.subheader", "cv2.cvtColor", "streamlit.camera_...
[((7064, 7126), 'streamlit.sidebar.selectbox', 'st.sidebar.selectbox', (['"""다음중 선택해주세요"""', "('설명서', '사진파일입력', '캠코더입력')"], {}), "('다음중 선택해주세요', ('설명서', '사진파일입력', '캠코더입력'))\n", (7084, 7126), True, 'import streamlit as st\n'), ((468, 519), 'streamlit.title', 'st.title', (['"""이 앱은 나의 관상으로 보았을때 어떤 직업이 어울리는지 보는 앱입니다."""']...
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap # Lots of different places that widgets could come from... try: from ipywidgets import interact, FloatSlider, IntSlider except ImportError: import warnings # ignore ShimWarning raised by IPython, see GH...
[ "numpy.ones", "warnings.catch_warnings", "IPython.html.widgets.IntSlider", "IPython.html.widgets.FloatSlider", "numpy.linspace", "warnings.simplefilter", "matplotlib.colors.LinearSegmentedColormap.from_list", "matplotlib.pyplot.subplots" ]
[((1366, 1421), 'matplotlib.colors.LinearSegmentedColormap.from_list', 'LinearSegmentedColormap.from_list', (['"""interactive"""', 'greys'], {}), "('interactive', greys)\n", (1399, 1421), False, 'from matplotlib.colors import LinearSegmentedColormap\n'), ((1812, 1846), 'matplotlib.pyplot.subplots', 'plt.subplots', ([],...
#!/usr/bin/env python # coding=UTF-8 ''' @Author: <NAME> @LastEditors: <NAME> @Description: @Date: 2019-04-19 @LastEditTime: 2019-04-22 10:38 ''' import numpy as np import torch import torch.utils.data as Data from torch.autograd import Variable from EvalBox.Evaluation.evaluation import Evaluation from EvalBox.Evaluat...
[ "numpy.prod", "numpy.reshape", "torch.from_numpy", "torch.argmax" ]
[((1686, 1720), 'torch.from_numpy', 'torch.from_numpy', (['self.outputs_adv'], {}), '(self.outputs_adv)\n', (1702, 1720), False, 'import torch\n'), ((1737, 1761), 'torch.argmax', 'torch.argmax', (['outputs', '(1)'], {}), '(outputs, 1)\n', (1749, 1761), False, 'import torch\n'), ((1502, 1527), 'numpy.prod', 'np.prod', (...
import random from tensorflow.keras import layers, models, losses, Model import tensorflow as tf import numpy as np from boardlogic import BoardLogic from coder import Coder import matplotlib.pyplot as plt import math from tensorflow import keras from keras.models import Sequential from keras.layers import Dense, Drop...
[ "keras.layers.Conv2D", "math.log", "numpy.asfarray", "keras.layers.Softmax", "helpers.Helpers.get_games_from_dataset", "tensorflow.keras.layers.Dense", "keras.layers.Dense", "coder.Coder.get_move_as_numpy", "tensorflow.keras.layers.Conv2D", "coder.Coder.decode_move", "numpy.asarray", "keras.ap...
[((2095, 2114), 'tensorflow.keras.models.Sequential', 'models.Sequential', ([], {}), '()\n', (2112, 2114), False, 'from tensorflow.keras import layers, models, losses, Model\n'), ((3362, 3381), 'tensorflow.keras.models.Sequential', 'models.Sequential', ([], {}), '()\n', (3379, 3381), False, 'from tensorflow.keras impor...
#!/usr/bin/env python """demo_simulate_nyu_finger_double Simple demo showing how the simulation setup works. License: BSD 3-Clause License Copyright (C) 2018-2021, New York University , Max Planck Gesellschaft Copyright note valid unless otherwise stated in individual files. All rights reserved. """ import time fro...
[ "numpy.ones", "bullet_utils.env.BulletEnv", "numpy.zeros", "robot_properties_nyu_finger.wrapper.NYUFingerDoubleRobot" ]
[((552, 563), 'bullet_utils.env.BulletEnv', 'BulletEnv', ([], {}), '()\n', (561, 563), False, 'from bullet_utils.env import BulletEnv\n'), ((654, 676), 'robot_properties_nyu_finger.wrapper.NYUFingerDoubleRobot', 'NYUFingerDoubleRobot', ([], {}), '()\n', (674, 676), False, 'from robot_properties_nyu_finger.wrapper impor...
# usage: mpython lig2protDist.py t1_v178a import mdtraj as md import itertools import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import sys key=sys.argv[1] print('loading in {} trajectory...'.format(key)) t=md.load(key+'.dcd',top=key+'.psf',stride=100) print('assigning residue groups...')...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gca", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.clf", "itertools.product", "mdtraj.compute_contacts", "matplotlib.pyplot.figure", "mdtraj.load", "matplotlib.pyplot.subplot", "numpy.aran...
[((237, 288), 'mdtraj.load', 'md.load', (["(key + '.dcd')"], {'top': "(key + '.psf')", 'stride': '(100)'}), "(key + '.dcd', top=key + '.psf', stride=100)\n", (244, 288), True, 'import mdtraj as md\n'), ((805, 835), 'mdtraj.compute_contacts', 'md.compute_contacts', (['t', 'pairs1'], {}), '(t, pairs1)\n', (824, 835), Tru...
#!/usr/bin/env pytest import numpy as np import pytest import siglib as sl @pytest.mark.parametrize( "x,frame_length,frame_step,pad,pad_value,expected", ( (np.arange(10), 5, 5, True, 0j, np.arange(10, dtype=np.complex).reshape(2, 5)), (np.arange(10), 5, 5, False, 0j, np.arange(10, dtype=np.comp...
[ "siglib.opening", "numpy.testing.assert_equal", "siglib.dcm", "numpy.arange", "siglib.closing", "numpy.testing.assert_allclose", "pytest.mark.parametrize", "numpy.array", "numpy.testing.assert_almost_equal", "siglib.resample", "numpy.zeros", "siglib.frame", "siglib.hamming" ]
[((1532, 1820), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""x,delay,pad,pad_value,expected"""', '(([1 + 3.0j, 4 + 2.0j, 5 + 6.0j, 1 + 0.0j], 1, True, 1 + 0.0j, [10 - 10.0j,\n 32 + 14.0j, 5.0 - 6.0j, 1.0 + 0.0j]), ([1 + 3.0j, 4 + 2.0j, 5 + 6.0j, 1 +\n 0.0j], 1, False, 1 + 0.0j, [10 - 10.0j, 32 + 14...
# This example implements macroscopic homogenized model of Biot-Darcy-Brinkman model of flow in deformable # double porous media. # The mathematical model is described in: # #<NAME>., <NAME>., <NAME>. #The Biot-Darcy-Brinkman model of flow in deformable double porous media; homogenization and numerical modelling. ...
[ "numpy.tile", "numpy.ones_like", "os.path.join", "numpy.array", "sfepy.homogenization.micmac.get_homog_coefs_linear", "sfepy.homogenization.utils.define_box_regions", "sfepy.discrete.fem.mesh.Mesh.from_file" ]
[((4957, 4986), 'sfepy.discrete.fem.mesh.Mesh.from_file', 'Mesh.from_file', (['filename_mesh'], {}), '(filename_mesh)\n', (4971, 4986), False, 'from sfepy.discrete.fem.mesh import Mesh\n'), ((5012, 5049), 'os.path.join', 'osp.join', (['data_dir', '"""perf_BDB_mes.py"""'], {}), "(data_dir, 'perf_BDB_mes.py')\n", (5020, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: <NAME> <<EMAIL>> import numbers from typing import Optional, Tuple import numpy as np class BBox: def __init__(self, x: int, y: int, width: int, height: int) -> None: assert min(width, height) >= 0, "width and height must be non-negative" ...
[ "numpy.asarray", "numpy.concatenate" ]
[((356, 401), 'numpy.asarray', 'np.asarray', (['(x + width // 2, y + height // 2)'], {}), '((x + width // 2, y + height // 2))\n', (366, 401), True, 'import numpy as np\n'), ((435, 462), 'numpy.asarray', 'np.asarray', (['(width, height)'], {}), '((width, height))\n', (445, 462), True, 'import numpy as np\n'), ((1360, 1...
''' Script to infer labels on data from a pre-saved keras model, using folder-structured testing data ''' import argparse import os import csv import PIL from PIL import Image import numpy as np import cv2 import tensorflow from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.mod...
[ "os.listdir", "numpy.repeat", "numpy.unique", "argparse.ArgumentParser", "csv.writer", "os.path.join", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "numpy.squeeze", "numpy.array", "tensorflow.keras.models.load_model", "cv2.resize" ]
[((611, 685), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': 'rescale_val', 'preprocessing_function': 'preprocess'}), '(rescale=rescale_val, preprocessing_function=preprocess)\n', (629, 685), False, 'from tensorflow.keras.preprocessing.image import ImageDataGenerator\n...
import os,argparse,time import numpy as np from omegaconf import OmegaConf import torch import torch.backends.cudnn as cudnn import torch.utils.data import utils import wandb tstart=time.time() # Arguments parser = argparse.ArgumentParser(description='RRR') parser.add_argument('--config', type=str, default='./conf...
[ "utils.save_code", "wandb.init", "torch.cuda.is_available", "utils.print_time", "argparse.ArgumentParser", "wandb.config.update", "numpy.random.seed", "omegaconf.OmegaConf.from_cli", "dataloaders.datagenerator.DatasetGen", "omegaconf.OmegaConf.merge", "time.time", "utils.make_directories", "...
[((184, 195), 'time.time', 'time.time', ([], {}), '()\n', (193, 195), False, 'import os, argparse, time\n'), ((218, 260), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""RRR"""'}), "(description='RRR')\n", (241, 260), False, 'import os, argparse, time\n'), ((626, 661), 'omegaconf.OmegaCon...
""" References: [1] <NAME> "Factorization Machines" (https://www.csie.ntu.edu.tw/~b97053/paper/Rendle2010FM.pdf) [2] <NAME> et al. "Neural Factorization Machines for Sparse Predictive Analytics" (https://arxiv.org/pdf/1708.05027.pdf) author: massquantity """ from itertools import islice impor...
[ "numpy.clip", "tensorflow.compat.v1.disable_v2_behavior", "tensorflow.compat.v1.shape", "tensorflow.compat.v1.train.AdamOptimizer", "tensorflow.compat.v1.losses.mean_squared_error", "tensorflow.compat.v1.set_random_seed", "tensorflow.compat.v1.concat", "tensorflow.compat.v1.get_collection", "tensorf...
[((963, 987), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (985, 987), True, 'import tensorflow.compat.v1 as tf\n'), ((3404, 3433), 'tensorflow.compat.v1.set_random_seed', 'tf.set_random_seed', (['self.seed'], {}), '(self.seed)\n', (3422, 3433), True, 'import tensorflow.compat...
#!/usr/bin/env python import numpy as np import os import pandas as pd import utils_snpko as utils from scipy.stats import fisher_exact logger = utils.logger def stats(args): ''' Compute some simple statistics on the data: * Univariate (uncorrected) p-value * (Uncorrected) likelihood ratio * B...
[ "utils_snpko.safe_mkdir", "numpy.logical_and", "utils_snpko.parse_arguments", "scipy.stats.fisher_exact", "os.path.join", "numpy.zeros", "utils_snpko.initialize_logger", "utils_snpko.genotype_to_nonwild_type_count" ]
[((3828, 3851), 'utils_snpko.parse_arguments', 'utils.parse_arguments', ([], {}), '()\n', (3849, 3851), True, 'import utils_snpko as utils\n'), ((3856, 3890), 'utils_snpko.safe_mkdir', 'utils.safe_mkdir', (['args.working_dir'], {}), '(args.working_dir)\n', (3872, 3890), True, 'import utils_snpko as utils\n'), ((3895, 3...
import numpy as np import tensorflow as tf from BasicAutoencoder import DeepAE as DAE from shrink import l21shrink as SHR class RobustL21Autoencoder(): """ @author: <NAME> first version. complete: 10/20/2016 Update to Python3: 03/15/2019 Des: X = L + S L is a non-linearly low d...
[ "tensorflow.Session", "shrink.l21shrink.l21shrink", "numpy.zeros", "BasicAutoencoder.DeepAE.Deep_Autoencoder", "numpy.load" ]
[((900, 965), 'BasicAutoencoder.DeepAE.Deep_Autoencoder', 'DAE.Deep_Autoencoder', ([], {'sess': 'sess', 'input_dim_list': 'self.layers_sizes'}), '(sess=sess, input_dim_list=self.layers_sizes)\n', (920, 965), True, 'from BasicAutoencoder import DeepAE as DAE\n'), ((1300, 1317), 'numpy.zeros', 'np.zeros', (['X.shape'], {...
""" Comparison of Dimension Reduction Techniques -------------------------------------------- A comparison of several different dimension reduction techniques on a variety of toy datasets. The datasets are all toy datasets, but should provide a representative range of the strengths and weaknesses of the different algo...
[ "colorsys.hsv_to_rgb", "numpy.arctan2", "numpy.arange", "seaborn.set", "sklearn.datasets.make_blobs", "gtsne.gtsne", "sklearn.datasets.load_iris", "numpy.random.normal", "numpy.abs", "time.time", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.show", "matplotlib.pyplot.setp", "skle...
[((2141, 2180), 'seaborn.set', 'sns.set', ([], {'context': '"""paper"""', 'style': '"""white"""'}), "(context='paper', style='white')\n", (2148, 2180), True, 'import seaborn as sns\n'), ((2203, 2280), 'sklearn.datasets.make_blobs', 'datasets.make_blobs', ([], {'n_samples': '(500)', 'n_features': '(10)', 'centers': '(5)...
import pre_ml import numpy as np import re def import_data(data_name): with open("samples/datasets/"+data_name+"_data.csv","r", encoding="utf-8") as f_data_in: #waveform_data lines = f_data_in.readlines() # print(type(lines)) dataset = list() for line in lines: ...
[ "pre_ml.baco", "numpy.array", "pre_ml.draw_baco" ]
[((1242, 1327), 'pre_ml.baco', 'pre_ml.baco', (['x', 'y'], {'t_percent': '(40)', 'heu_meth': '"""method_1"""', 'ml_alg': '"""knn1"""', 'iter_num': '(10)'}), "(x, y, t_percent=40, heu_meth='method_1', ml_alg='knn1', iter_num=10\n )\n", (1253, 1327), False, 'import pre_ml\n'), ((1328, 1354), 'pre_ml.draw_baco', 'pre_m...
from itertools import takewhile, product import numpy as np import string # used for doc testing def letters_25(): """ >>> letters_25() array([['A', 'B', 'C', 'D', 'E'], ['F', 'G', 'H', 'I', 'J'], ['K', 'L', 'M', 'N', 'O'], ['P', 'Q', 'R', 'S', 'T'], ['U', 'W', '...
[ "doctest.testmod", "numpy.ones" ]
[((8393, 8410), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (8408, 8410), False, 'import doctest\n'), ((6135, 6150), 'numpy.ones', 'np.ones', (['(0, 0)'], {}), '((0, 0))\n', (6142, 6150), True, 'import numpy as np\n')]
"""Script to use ordinary least squares and ridge regression with stochastic gradient descend.""" import numpy as np def gradient_RR_OLS(y, X, beta, lmbda): """ Define the gradient for ordinary least squares and ridge regression :param y: observed values :param X: design matrix :param beta: param...
[ "numpy.any", "numpy.exp", "numpy.zeros", "numpy.random.randint", "numpy.finfo" ]
[((651, 676), 'numpy.zeros', 'np.zeros', (['(z.shape[0], 1)'], {}), '((z.shape[0], 1))\n', (659, 676), True, 'import numpy as np\n'), ((2161, 2216), 'numpy.random.randint', 'np.random.randint', (['num_observations'], {'size': 'num_min_batch'}), '(num_observations, size=num_min_batch)\n', (2178, 2216), True, 'import num...
from pathlib import Path import keras from keras.datasets import cifar10, cifar100, mnist from keras.utils import to_categorical # Does One-hot-encoding import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from ..utils.data import consolidate_bins, crop_center def load_data(load_...
[ "numpy.ceil", "keras.datasets.cifar10.load_data", "keras.datasets.mnist.load_data", "pathlib.Path", "keras.datasets.cifar100.load_data", "numpy.log", "keras.utils.to_categorical", "sklearn.preprocessing.StandardScaler", "numpy.array", "numpy.random.seed", "pandas.DataFrame", "numpy.random.perm...
[((2009, 2026), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (2024, 2026), False, 'from keras.datasets import cifar10, cifar100, mnist\n'), ((2431, 2450), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (2448, 2450), False, 'from keras.datasets import cifar10, cifar1...
import numpy as np import pytest import pyximport; pyximport.install() from CRADLE.correctbiasutils.cython import coalesceSections @pytest.mark.parametrize("starts,values,analysisEnd,stepSize,sectionCount,startEntries,endEntries,valueEntries", [ ( np.arange(0, 0), np.array([]), 1, 1, 0, [], [], [] )...
[ "CRADLE.correctbiasutils.cython.coalesceSections", "numpy.array", "pyximport.install", "numpy.isnan", "numpy.arange" ]
[((51, 70), 'pyximport.install', 'pyximport.install', ([], {}), '()\n', (68, 70), False, 'import pyximport\n'), ((1389, 1444), 'CRADLE.correctbiasutils.cython.coalesceSections', 'coalesceSections', (['starts', 'values', 'analysisEnd', 'stepSize'], {}), '(starts, values, analysisEnd, stepSize)\n', (1405, 1444), False, '...
import numpy as np import collections def raw_frequency(term, doc): count = 0 if isinstance(doc, str): for word in doc.split(): if term == word: count = count + 1 return count def get_most_freq_term( doc): doc_freq = dict([word, raw_frequency(word, doc)] for word...
[ "numpy.sqrt", "numpy.square", "collections.Counter", "numpy.array", "numpy.sum" ]
[((1376, 1395), 'numpy.sqrt', 'np.sqrt', (['vector_sum'], {}), '(vector_sum)\n', (1383, 1395), True, 'import numpy as np\n'), ((1483, 1499), 'numpy.array', 'np.array', (['vector'], {}), '(vector)\n', (1491, 1499), True, 'import numpy as np\n'), ((1796, 1813), 'numpy.array', 'np.array', (['vector1'], {}), '(vector1)\n',...
#!/usr/bin/env python import numpy as np import pandas as pd import pytest from modnet.preprocessing import get_cross_nmi from modnet.preprocessing import nmi_target def test_nmi_target(): # Test with linear data (should get 1.0 mutual information, or very close due to algorithm used # in mutual_info_regre...
[ "pytest.approx", "numpy.random.rand", "numpy.ones", "modnet.preprocessing.nmi_target", "numpy.linspace", "pytest.raises", "numpy.random.seed", "pandas.DataFrame", "numpy.meshgrid", "modnet.preprocessing.get_cross_nmi", "numpy.arange", "numpy.random.shuffle" ]
[((352, 382), 'numpy.linspace', 'np.linspace', (['(0.5)', '(3.5)', 'npoints'], {}), '(0.5, 3.5, npoints)\n', (363, 382), True, 'import numpy as np\n'), ((430, 460), 'pandas.DataFrame', 'pd.DataFrame', (["{'x': x, 'y': y}"], {}), "({'x': x, 'y': y})\n", (442, 460), True, 'import pandas as pd\n'), ((477, 499), 'pandas.Da...
import numpy as np from sklearn.metrics import roc_auc_score from numba import jit def array2str(tmp_array, sep = " "): str_list = ["{:.3f}".format(tmp_item) for tmp_item in tmp_array] return sep.join(str_list) def generate_sorted_groups(pred, y, a): a_idx = np.where(a == 0) b_idx = np.where(a == 1)...
[ "numpy.where", "sklearn.metrics.roc_auc_score", "numpy.argsort", "numpy.sum", "numpy.array", "numba.jit", "numpy.zeros", "numpy.concatenate" ]
[((4364, 4382), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (4367, 4382), False, 'from numba import jit\n'), ((5726, 5744), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (5729, 5744), False, 'from numba import jit\n'), ((7858, 7876), 'numba.jit', 'jit', ([], {'nopytho...
# import os import numpy as np import scipy import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, cm import statsmodels.api as sm from matplotlib.collections import PatchCollection from matplotlib.patches import Rectangle def plotBox(data, labelC=None, labelS=None, colorLst='rbkgcmy', title=None, ...
[ "numpy.sqrt", "numpy.polyfit", "numpy.column_stack", "numpy.array", "scipy.stats.pearsonr", "numpy.poly1d", "statsmodels.api.OLS", "scipy.stats.norm.cdf", "numpy.sort", "numpy.max", "numpy.linspace", "numpy.min", "numpy.meshgrid", "numpy.abs", "numpy.isnan", "matplotlib.pyplot.setp", ...
[((397, 451), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': 'nc', 'sharey': 'sharey', 'figsize': 'figsize'}), '(ncols=nc, sharey=sharey, figsize=figsize)\n', (409, 451), True, 'import matplotlib.pyplot as plt\n'), ((1493, 1512), 'numpy.polyfit', 'np.polyfit', (['x', 'y', '(1)'], {}), '(x, y, 1)\n', (1503...
import numpy as np class History(): """ Keeps the history of evaluations, but only of the TRUE MODEL. Additionally keeps wheter the model or the surrogate was used. This enables us to guarantee a certain amount of past model evaluations being available for the training set. Every line is of t...
[ "numpy.array", "numpy.zeros", "numpy.mean", "numpy.roll" ]
[((1083, 1121), 'numpy.zeros', 'np.zeros', (['(self.size, self._dimension)'], {}), '((self.size, self._dimension))\n', (1091, 1121), True, 'import numpy as np\n'), ((1147, 1170), 'numpy.zeros', 'np.zeros', (['self.use_size'], {}), '(self.use_size)\n', (1155, 1170), True, 'import numpy as np\n'), ((2598, 2625), 'numpy.r...
#!/usr/bin/env python3 import networkx as nx import numpy as np import sys input_lines = [list(y) for y in [x.strip() for x in open(sys.argv[1], 'r').readlines()]] maze_arr = np.array(input_lines, dtype=int) # Need to turn the maze into a graph maze = nx.DiGraph() for idx, x in np.ndenumerate(maze_arr): me = "{...
[ "numpy.array", "networkx.DiGraph", "networkx.shortest_path", "numpy.ndenumerate" ]
[((178, 210), 'numpy.array', 'np.array', (['input_lines'], {'dtype': 'int'}), '(input_lines, dtype=int)\n', (186, 210), True, 'import numpy as np\n'), ((256, 268), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (266, 268), True, 'import networkx as nx\n'), ((283, 307), 'numpy.ndenumerate', 'np.ndenumerate', (['maz...
import sys, getopt import numpy as np import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import os import ICA_support_lib as sup import ICA_coupling_pattern as cp import ICA_ising as ising class astro_pp_ising_creator: def __init__(self): self.main_Path = os.getcwd() self.ising_model_Path...
[ "numpy.clip", "ICA_coupling_pattern.astro_pp_pattern_generator", "getopt.getopt", "ICA_ising.astro_pp_model_ising", "tensorflow.compat.v1.disable_v2_behavior", "numpy.amin", "tensorflow.compat.v1.global_variables_initializer", "numpy.average", "numpy.where", "numpy.size", "os.path.join", "os.g...
[((72, 96), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (94, 96), True, 'import tensorflow.compat.v1 as tf\n'), ((279, 290), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (288, 290), False, 'import os\n'), ((422, 470), 'ICA_support_lib.check_create_save_dir', 'sup.check_create_...
import pickle import math import numpy as np import copy class AdaBoostClassifier: '''A simple AdaBoost Classifier.''' __base_classifier__ = None __classifiers__ = None __max_base__ = 0 __n_base__ = 0 __alpha__ = None def __init__(self, weak_classifier, n_weakers_limit): self.__bas...
[ "math.log", "numpy.array", "numpy.zeros", "numpy.sum", "copy.deepcopy", "math.exp" ]
[((495, 536), 'numpy.zeros', 'np.zeros', (['[self.__max_base__, X.shape[0]]'], {}), '([self.__max_base__, X.shape[0]])\n', (503, 536), True, 'import numpy as np\n'), ((1986, 2010), 'numpy.array', 'np.array', (['self.__alpha__'], {}), '(self.__alpha__)\n', (1994, 2010), True, 'import numpy as np\n'), ((2023, 2062), 'num...
# Copyright 2022 Sony Semiconductors Israel, Inc. 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 b...
[ "model_compression_toolkit.QuantizationConfig", "tensorflow.add", "numpy.random.uniform" ]
[((1406, 1512), 'model_compression_toolkit.QuantizationConfig', 'cmo.QuantizationConfig', ([], {'activation_error_method': 'self.activation_threshold_method', 'activation_n_bits': '(8)'}), '(activation_error_method=self.\n activation_threshold_method, activation_n_bits=8)\n', (1428, 1512), True, 'import model_compre...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import numpy.testing as npt from textworld.generator import make_world, make_small_map, make_world_with from textworld.logic import Variable, Proposition def test_make_world_no_rng(): world = make_world(1) assert...
[ "textworld.generator.make_world", "numpy.testing.assert_raises", "textworld.generator.make_small_map", "textworld.generator.make_world_with", "textworld.logic.Variable", "textworld.logic.Proposition" ]
[((296, 309), 'textworld.generator.make_world', 'make_world', (['(1)'], {}), '(1)\n', (306, 309), False, 'from textworld.generator import make_world, make_small_map, make_world_with\n'), ((411, 467), 'numpy.testing.assert_raises', 'npt.assert_raises', (['ValueError', 'make_small_map'], {'n_rooms': '(6)'}), '(ValueError...
from __future__ import absolute_import, division, print_function import numpy as np __all__ = ['scale_mag_as_flux', 'flux_to_mag', 'mag_to_flux',] def scale_mag_as_flux(mag, flux_scale=1.0): """ Identical to flux_to_mag(mag_to_flux(mag)*flux_scale) """ return mag - 2.5*np.log10(flux_scale) def flux_...
[ "numpy.log10", "numpy.power" ]
[((614, 658), 'numpy.power', 'np.power', (['(10.0)', '(-0.4 * (mag - zeropoint_mag))'], {}), '(10.0, -0.4 * (mag - zeropoint_mag))\n', (622, 658), True, 'import numpy as np\n'), ((289, 309), 'numpy.log10', 'np.log10', (['flux_scale'], {}), '(flux_scale)\n', (297, 309), True, 'import numpy as np\n'), ((465, 479), 'numpy...
import os import pickle import numpy as np import pandas as pd from utils import data def preprocess(df: pd.DataFrame, shuffle: bool = True, scale_label: bool = True): """Apply preprocessing steps on the pandas dataframe. Arguments: df {pd.DataFrame} -- Catalog dataframe to preprocess R...
[ "pandas.concat", "numpy.random.shuffle" ]
[((1969, 1994), 'numpy.random.shuffle', 'np.random.shuffle', (['groups'], {}), '(groups)\n', (1986, 1994), True, 'import numpy as np\n'), ((2004, 2021), 'pandas.concat', 'pd.concat', (['groups'], {}), '(groups)\n', (2013, 2021), True, 'import pandas as pd\n')]
import torch import numpy as np from loss_functions.ND_Crossentropy import CrossentropyND from loss_functions.topk_loss import TopKLoss from torch import nn def softmax_helper(x): rpt = [1 for _ in range(len(x.size()))] rpt[1] = x.size(1) x_max = x.max(1, keepdim=True)[0].repeat(*rpt) e_x = torch.exp(...
[ "numpy.prod", "numpy.unique", "torch.exp", "torch.from_numpy", "torch.unbind", "loss_functions.topk_loss.TopKLoss", "loss_functions.ND_Crossentropy.CrossentropyND", "torch.no_grad", "torch.zeros", "torch.ones" ]
[((310, 330), 'torch.exp', 'torch.exp', (['(x - x_max)'], {}), '(x - x_max)\n', (319, 330), False, 'import torch\n'), ((5061, 5088), 'torch.ones', 'torch.ones', (['intersect.shape'], {}), '(intersect.shape)\n', (5071, 5088), False, 'import torch\n'), ((5875, 5895), 'torch.ones', 'torch.ones', (['tp.shape'], {}), '(tp.s...
from typing import Deque from random import sample from matplotlib import pyplot as plt import numpy as np from torch import nn class ReplayBuffer: def __init__(self, capacity: int) -> None: self.buffer = Deque([], maxlen=capacity) def save(self, obs): self.buffer.append(obs) def get_bat...
[ "typing.Deque", "random.sample", "numpy.ceil", "torch.nn.ReLU", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.exp", "torch.nn.BatchNorm1d", "torch.nn.Linear", "matplotlib.pyplot.title", "matplotlib.pyplot.show" ]
[((1322, 1338), 'matplotlib.pyplot.title', 'plt.title', (['"""eps"""'], {}), "('eps')\n", (1331, 1338), True, 'from matplotlib import pyplot as plt\n'), ((1339, 1355), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""ep"""'], {}), "('ep')\n", (1349, 1355), True, 'from matplotlib import pyplot as plt\n'), ((1356, 1373), ...
import suspect import numpy def test_null_transform(): fid = numpy.ones(128, 'complex') data = suspect.MRSData(fid, 1.0 / 128, 123) transformed_data = suspect.processing.frequency_correction.transform_fid(data, 0, 0) assert type(transformed_data) == suspect.MRSData def test_water_peak_alignment_mis...
[ "suspect.processing.frequency_correction.transform_fid", "numpy.arange", "numpy.reshape", "suspect.basis.gaussian", "numpy.testing.assert_allclose", "numpy.fft.fft", "suspect.MRSData", "numpy.testing.assert_almost_equal", "suspect.processing.apodize", "suspect.processing.frequency_correction.spect...
[((68, 94), 'numpy.ones', 'numpy.ones', (['(128)', '"""complex"""'], {}), "(128, 'complex')\n", (78, 94), False, 'import numpy\n'), ((106, 142), 'suspect.MRSData', 'suspect.MRSData', (['fid', '(1.0 / 128)', '(123)'], {}), '(fid, 1.0 / 128, 123)\n', (121, 142), False, 'import suspect\n'), ((166, 231), 'suspect.processin...
# import the necessary libraries import cv2 import imutils import numpy as np class AspectAwarePreprocessor: def __init__(self, width: int, height: int, inter: int = cv2.INTER_AREA): # store the target image width, height, and interpolation # method used when resizing self.width = width ...
[ "imutils.resize", "cv2.resize", "numpy.concatenate" ]
[((3515, 3585), 'cv2.resize', 'cv2.resize', (['image', '(self.width, self.height)'], {'interpolation': 'self.inter'}), '(image, (self.width, self.height), interpolation=self.inter)\n', (3525, 3585), False, 'import cv2\n'), ((888, 945), 'imutils.resize', 'imutils.resize', (['image'], {'width': 'self.width', 'inter': 'se...
import pytest from lasagne.layers import RecurrentLayer, LSTMLayer, CustomRecurrentLayer from lasagne.layers import InputLayer, DenseLayer, GRULayer, Gate, Layer from lasagne.layers import helper import theano import theano.tensor as T import numpy as np import lasagne from mock import Mock def test_recurrent_return...
[ "theano.tensor.mean", "lasagne.layers.GRULayer", "numpy.arange", "lasagne.layers.get_all_params", "lasagne.layers.RecurrentLayer", "lasagne.layers.LSTMLayer", "lasagne.layers.get_output_shape", "numpy.random.random", "numpy.testing.assert_almost_equal", "lasagne.layers.Conv2DLayer", "lasagne.ini...
[((420, 431), 'theano.tensor.tensor4', 'T.tensor4', ([], {}), '()\n', (429, 431), True, 'import theano.tensor as T\n'), ((504, 522), 'lasagne.layers.InputLayer', 'InputLayer', (['in_shp'], {}), '(in_shp)\n', (514, 522), False, 'from lasagne.layers import InputLayer, DenseLayer, GRULayer, Gate, Layer\n'), ((535, 577), '...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join import numpy as np import gym from src.envs.base import Env from src.utils.helpers import preprocessAtari class AtariEnv(Env): # low dimensional observations def __init__(self, *...
[ "numpy.ones", "numpy.random.rand", "os.path.join", "numpy.array", "numpy.zeros", "src.utils.helpers.preprocessAtari", "gym.make" ]
[((484, 503), 'gym.make', 'gym.make', (['self.game'], {}), '(self.game)\n', (492, 503), False, 'import gym\n'), ((1025, 1060), 'numpy.ones', 'np.ones', (['(1, *self.state_shape[1:])'], {}), '((1, *self.state_shape[1:]))\n', (1032, 1060), True, 'import numpy as np\n'), ((2424, 2456), 'src.utils.helpers.preprocessAtari',...
import random import numpy as np import tensorflow as tf Normal = tf.contrib.distributions.Normal np.random.seed(0) tf.set_random_seed(0) class VariationalAutoencoder(object): #"VAE implementation is based on the implementation from McCoy, J.T.,et al." #https://www-sciencedirect-com.stanford.idm.oclc.org/science/arti...
[ "numpy.sqrt", "tensorflow.shape", "tensorflow.reduce_mean", "tensorflow.set_random_seed", "tensorflow.placeholder", "tensorflow.Session", "numpy.random.seed", "tensorflow.matmul", "tensorflow.square", "tensorflow.train.AdamOptimizer", "tensorflow.zeros", "tensorflow.InteractiveSession", "num...
[((98, 115), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (112, 115), True, 'import numpy as np\n'), ((116, 137), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(0)'], {}), '(0)\n', (134, 137), True, 'import tensorflow as tf\n'), ((8734, 8762), 'numpy.copy', 'np.copy', (['data[sample_ind, :]']...
from __future__ import absolute_import, division from psychopy import locale_setup from psychopy import prefs from psychopy import sound, gui, visual, core, data, event, logging, clock from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED, STOPPED, FINISHED, PRESSED, REL...
[ "psychopy.core.quit", "time.sleep", "numpy.array", "psychopy.visual.ImageStim", "numpy.arange", "psychopy.gui.DlgFromDict", "os.listdir", "numpy.diff", "psychopy.hardware.keyboard.Keyboard", "psychopy.core.Clock", "numpy.random.choice", "psychopy.visual.TextStim", "psychopy.visual.Window", ...
[((767, 785), 'os.chdir', 'os.chdir', (['_thisDir'], {}), '(_thisDir)\n', (775, 785), False, 'import os\n'), ((948, 1014), 'psychopy.gui.DlgFromDict', 'gui.DlgFromDict', ([], {'dictionary': 'expInfo', 'sortKeys': '(False)', 'title': 'expName'}), '(dictionary=expInfo, sortKeys=False, title=expName)\n', (963, 1014), Fals...
from __future__ import absolute_import from collections import Counter from collections import OrderedDict from itertools import chain import numpy as np from .enchant_backend import in_dictionary from .enchant_backend import suggest_words from .nltk_backend import make_ngrams from .nltk_backend import calculate_levens...
[ "itertools.chain", "collections.OrderedDict", "numpy.asarray", "numpy.zeros", "numpy.concatenate" ]
[((1801, 1847), 'collections.OrderedDict', 'OrderedDict', (['((token, None) for token in tokens)'], {}), '((token, None) for token in tokens)\n', (1812, 1847), False, 'from collections import OrderedDict\n'), ((8368, 8384), 'numpy.asarray', 'np.asarray', (['data'], {}), '(data)\n', (8378, 8384), True, 'import numpy as ...
# Copyright (c) 2022, ETH Zurich and UNC Chapel Hill. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this ...
[ "os.path.exists", "sqlite3.connect", "os.makedirs", "argparse.ArgumentParser", "gzip.open", "os.path.splitext", "os.path.join", "numpy.zeros", "numpy.fromstring", "os.remove" ]
[((1844, 1869), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1867, 1869), False, 'import argparse\n'), ((2366, 2401), 'sqlite3.connect', 'sqlite3.connect', (['args.database_path'], {}), '(args.database_path)\n', (2381, 2401), False, 'import sqlite3\n'), ((2453, 2482), 'os.makedirs', 'os.make...
# ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware # <NAME>, <NAME>, <NAME> # International Conference on Learning Representations (ICLR), 2019. import numpy as np from search.utils import * class DataProvider: VALID_SEED = 0 # random seed for the validation set @staticmethod ...
[ "numpy.argmax" ]
[((1598, 1614), 'numpy.argmax', 'np.argmax', (['label'], {}), '(label)\n', (1607, 1614), True, 'import numpy as np\n')]
import os import json import ecco from IPython import display as d from ecco import util, lm_plots import random import matplotlib.pyplot as plt import numpy as np import torch from torch.nn import functional as F from sklearn import decomposition from typing import Optional, List class OutputSeq: def __init__(se...
[ "torch.nn.functional.softmax", "ecco.lm_plots.plot_inner_token_rankings", "IPython.display.Javascript", "ecco.lm_plots.plot_inner_token_rankings_watch", "json.dumps", "torch.argsort", "numpy.empty", "numpy.concatenate", "numpy.maximum", "sklearn.decomposition.NMF", "numpy.ones", "torch.Tensor"...
[((1292, 1322), 'os.path.dirname', 'os.path.dirname', (['ecco.__file__'], {}), '(ecco.__file__)\n', (1307, 1322), False, 'import os\n'), ((11693, 11740), 'numpy.empty', 'np.empty', (['(n_layers - 1, position)'], {'dtype': '"""U25"""'}), "((n_layers - 1, position), dtype='U25')\n", (11701, 11740), True, 'import numpy as...
# Copyright (c) 2020 zfit import functools import math as _mt from collections import defaultdict from typing import Any, Callable import numpy as np import tensorflow as tf from ..settings import ztypes from ..util.exception import BreakingAPIChangeError from ..util.warnings import warn_advanced_feature def const...
[ "tensorflow.unstack", "tensorflow.math.imag", "tensorflow.shape", "zfit.core.data.Data.from_tensor", "numpy.float64", "tensorflow.py_function", "functools.wraps", "tensorflow.math.conj", "tensorflow.where", "tensorflow.constant", "collections.defaultdict", "tensorflow.function", "tensorflow....
[((663, 681), 'numpy.float64', 'np.float64', (['_mt.pi'], {}), '(_mt.pi)\n', (673, 681), True, 'import numpy as np\n'), ((8528, 8559), 'functools.wraps', 'functools.wraps', (['tf.py_function'], {}), '(tf.py_function)\n', (8543, 8559), False, 'import functools\n'), ((600, 655), 'tensorflow.constant', 'tf.constant', (['v...
import numpy as np import matplotlib.pyplot as plt import cvxpy as cvx from scipy.linalg import circulant from scipy.stats import norm import seaborn as sns import pandas as pd from scipy.integrate import solve_ivp from scipy.spatial.distance import cdist def BinaryRandomMatrix(S,M,p): r = np.random.rand(S,M) ...
[ "numpy.random.normal", "cvxpy.Variable", "cvxpy.Problem", "numpy.eye", "numpy.random.rand", "numpy.ones", "numpy.hstack", "numpy.random.choice", "scipy.spatial.distance.cdist", "numpy.zeros", "numpy.linspace", "scipy.stats.norm.pdf", "cvxpy.quad_form", "numpy.random.randn", "numpy.random...
[((297, 317), 'numpy.random.rand', 'np.random.rand', (['S', 'M'], {}), '(S, M)\n', (311, 317), True, 'import numpy as np\n'), ((325, 341), 'numpy.zeros', 'np.zeros', (['(S, M)'], {}), '((S, M))\n', (333, 341), True, 'import numpy as np\n'), ((3057, 3079), 'cvxpy.Variable', 'cvx.Variable', (['Num_treg'], {}), '(Num_treg...
# Distributed DL Server runs on worker nodes # @author: <NAME> # @created date: 2021-06-28 # @last modified date: 2021-09-03 # @note: import asyncio import gc import numpy as np import sys import time from asyncio import StreamReader, StreamWriter from pympler import asizeof from tensorflow.keras import datasets, layer...
[ "textwrap.dedent", "tensorflow.keras.utils.to_categorical", "asyncio.sleep", "tensorflow.keras.datasets.mnist.load_data", "asyncio.start_server", "tensorflow.keras.datasets.cifar10.load_data", "gc.collect", "numpy.expand_dims", "asyncio.get_event_loop" ]
[((1222, 1246), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1244, 1246), False, 'import asyncio\n'), ((4360, 4379), 'textwrap.dedent', 'dedent', (['method_code'], {}), '(method_code)\n', (4366, 4379), False, 'from textwrap import dedent\n'), ((10228, 10247), 'textwrap.dedent', 'dedent', (['me...
import faiss import torch import logging import numpy as np from tqdm import tqdm from torch.utils.data import DataLoader from torch.utils.data.dataset import Subset # Compute R@1, R@5, R@10, R@20 RECALL_VALUES = [1, 5, 10, 20] def test(args, eval_ds, model): """Compute descriptors of the given dataset and com...
[ "logging.debug", "numpy.in1d", "tqdm.tqdm", "torch.no_grad", "torch.utils.data.DataLoader", "faiss.IndexFlatL2" ]
[((1997, 2034), 'faiss.IndexFlatL2', 'faiss.IndexFlatL2', (['args.fc_output_dim'], {}), '(args.fc_output_dim)\n', (2014, 2034), False, 'import faiss\n'), ((2132, 2168), 'logging.debug', 'logging.debug', (['"""Calculating recalls"""'], {}), "('Calculating recalls')\n", (2145, 2168), False, 'import logging\n'), ((380, 39...
from __future__ import division from math import ceil import numpy as np import chainer import chainer.functions as F from chainer import initializers import chainer.links as L from chainercv.experimental.links.model.pspnet.transforms import \ convolution_crop from chainercv.links import Conv2DBNActiv from chain...
[ "chainercv.links.model.resnet.ResBlock", "math.ceil", "chainer.functions.concat", "chainer.functions.average_pooling_2d", "chainercv.transforms.resize_contain", "chainer.functions.max_pooling_2d", "numpy.array", "chainer.backends.cuda.get_array_module", "chainercv.links.Conv2DBNActiv", "chainer.in...
[((492, 546), 'numpy.array', 'np.array', (['(123.68, 116.779, 103.939)'], {'dtype': 'np.float32'}), '((123.68, 116.779, 103.939), dtype=np.float32)\n', (500, 546), True, 'import numpy as np\n'), ((11780, 11829), 'chainer.backends.cuda.get_array_module', 'chainer.backends.cuda.get_array_module', (['scores[0]'], {}), '(s...
"""Tests for timeseries anomalies detection and imputation.""" from typing import Tuple import numpy as np import pytest import pudl.analysis.timeseries_cleaning def simulate_series( n: int = 10, periods: int = 20, frequency: int = 24, amplitude_range: Tuple[float, float] = (0.0, 1.0), offset_ra...
[ "numpy.random.default_rng", "numpy.equal", "numpy.isin", "pytest.mark.parametrize", "numpy.sin", "numpy.arange" ]
[((2014, 2354), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""series_seed,anomalies_seed"""', '[(16662093832, 741013840), (7088438834, 382046123), (11357816575, \n 18413484987), (5150844305, 5634704703), (5248964137, 8991153078), (\n 2654087352, 8105685070), (18949329570, 5605034834), (16844944928, ...
# coding:utf-8 # Unit test for Dense class # Created : 1, 30, 2018 # Revised : 1, 30, 2018 # All rights reserved #------------------------------------------------------------------------------------------------ __author__ = 'dawei.leng' import os, sys os.environ['THEANO_FLAGS'] = "floatX=float32, mode=FAST_RUN,...
[ "numpy.abs", "lasagne_ext.utils.get_layer_by_name", "theano.function", "numpy.random.rand", "lasagne.layers.InputLayer", "os.path.split", "lasagne.layers.get_output", "theano.tensor.fmatrix", "lasagne.layers.DenseLayer" ]
[((585, 618), 'os.path.split', 'os.path.split', (['dandelion.__file__'], {}), '(dandelion.__file__)\n', (598, 618), False, 'import os, sys\n'), ((1099, 1118), 'theano.tensor.fmatrix', 'tensor.fmatrix', (['"""x"""'], {}), "('x')\n", (1113, 1118), False, 'from theano import tensor\n'), ((1132, 1200), 'lasagne.layers.Inpu...
import numpy as np from collections.abc import Iterable import dash_vtk import dash_html_components as html from dash_vtk.utils import to_mesh_state class MeshViewType: POINTS = 0 WIREFRAME = 1 SURFACE = 2 class ScalarMode: DEFAULT = 0 USE_POINT_DATA = 1 USE_CELL_DATA = 2 USE_POINT_FIEL...
[ "dash_vtk.utils.to_mesh_state", "numpy.array", "dash_vtk.Mesh", "numpy.nanmax", "dash_vtk.View", "numpy.nanmin" ]
[((4438, 4491), 'dash_vtk.View', 'dash_vtk.View', ([], {'children': 'children', 'background': 'bg_color'}), '(children=children, background=bg_color)\n', (4451, 4491), False, 'import dash_vtk\n'), ((1226, 1249), 'dash_vtk.utils.to_mesh_state', 'to_mesh_state', (['vtk_mesh'], {}), '(vtk_mesh)\n', (1239, 1249), False, 'f...
""" Copyright (C) 2020 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
[ "numpy.exp", "numpy.argmax", "ngraph.function_from_cnn", "numpy.ndindex" ]
[((3345, 3379), 'ngraph.function_from_cnn', 'ngraph.function_from_cnn', (['self.net'], {}), '(self.net)\n', (3369, 3379), False, 'import ngraph\n'), ((4952, 5008), 'numpy.ndindex', 'np.ndindex', (['params.sides[0]', 'params.sides[1]', 'params.num'], {}), '(params.sides[0], params.sides[1], params.num)\n', (4962, 5008),...
import numpy as np import pydart2 as pydart import QPsolver import IKsolve_one import momentum_con import motionPlan from scipy import optimize import yulTrajectoryOpt from fltk import * from PyCommon.modules.GUI import hpSimpleViewer as hsv from PyCommon.modules.Renderer import ysRenderer as yr from PyCommon.modules....
[ "PyCommon.modules.GUI.hpSimpleViewer.hpSimpleViewer", "PyCommon.modules.Renderer.ysRenderer.VectorsRenderer", "pydart2.init", "pydart2.World.__init__", "numpy.zeros", "numpy.diagflat", "numpy.linalg.inv", "numpy.dot", "PyCommon.modules.Renderer.ysRenderer.PointsRenderer", "numpy.array", "pydart2...
[((28790, 28803), 'pydart2.init', 'pydart.init', ([], {}), '()\n', (28801, 28803), True, 'import pydart2 as pydart\n'), ((28903, 28956), 'pydart2.World', 'pydart.World', (['(1.0 / 1000.0)', '"""./data/skel/ground.skel"""'], {}), "(1.0 / 1000.0, './data/skel/ground.skel')\n", (28915, 28956), True, 'import pydart2 as pyd...
# -*- coding: utf-8 -*- """ Created on Mon May 27 12:13:26 2019 @author: DiPu """ import pandas as pd import numpy as np data=pd.read_csv("Bahubali2_vs_Dangal.csv") features =data.iloc[:, 0].values features=features.reshape(9,1) labels = data.iloc[:,1:3 ].values """ train the model now """ from sklearn.linear_mo...
[ "numpy.array", "sklearn.linear_model.LinearRegression", "pandas.read_csv" ]
[((128, 166), 'pandas.read_csv', 'pd.read_csv', (['"""Bahubali2_vs_Dangal.csv"""'], {}), "('Bahubali2_vs_Dangal.csv')\n", (139, 166), True, 'import pandas as pd\n'), ((362, 380), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (378, 380), False, 'from sklearn.linear_model import LinearReg...
import numpy from numpy.random import normal import matplotlib.pyplot as plt def matlab_hist(v): plt.hist(v, bins=50, normed=False) plt.show() def numpy_hist(v): (n,bins) = numpy.histogram(v, bins=50, normed=False) plt.plot(.5*(bins[1:]+bins[:-1]), n) plt.show() if __name__ == "__main__": mu,...
[ "numpy.random.normal", "numpy.histogram", "matplotlib.pyplot.hist", "matplotlib.pyplot.plot", "matplotlib.pyplot.show" ]
[((102, 136), 'matplotlib.pyplot.hist', 'plt.hist', (['v'], {'bins': '(50)', 'normed': '(False)'}), '(v, bins=50, normed=False)\n', (110, 136), True, 'import matplotlib.pyplot as plt\n'), ((141, 151), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (149, 151), True, 'import matplotlib.pyplot as plt\n'), ((187, ...
import nltk import numpy as np import pyjsonrpc from features import Feature from stst.data import dict_utils from stst.libs.kernel import vector_kernel as vk class Embedding(object): def __init__(self): self.http_client = pyjsonrpc.HttpClient( url="http://localhost:8084", ) def ...
[ "numpy.reshape", "nltk.FreqDist", "stst.data.dict_utils.DictLoader", "numpy.array", "numpy.zeros", "stst.libs.kernel.vector_kernel.get_all_kernel", "pyjsonrpc.HttpClient" ]
[((951, 973), 'nltk.FreqDist', 'nltk.FreqDist', (['word_sa'], {}), '(word_sa)\n', (964, 973), False, 'import nltk\n'), ((2262, 2284), 'numpy.reshape', 'np.reshape', (['vecs', '[-1]'], {}), '(vecs, [-1])\n', (2272, 2284), True, 'import numpy as np\n'), ((238, 287), 'pyjsonrpc.HttpClient', 'pyjsonrpc.HttpClient', ([], {'...
import os import numpy as np from scipy.special import logit, expit import torch from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler from genEM3.data.wkwdata import WkwData, DataSplit from genEM3.model.autoencoder2d import Encoder_4_sampling_bn_1px_deep_convonly_skip, AE_...
[ "genEM3.data.wkwdata.WkwData", "genEM3.inference.inference.Predictor", "torch.load", "os.path.join", "torch.multiprocessing.set_sharing_strategy", "numpy.exp", "genEM3.data.wkwdata.WkwData.datasources_from_json", "torch.utils.data.DataLoader", "os.path.abspath", "genEM3.model.autoencoder2d.Classif...
[((409, 466), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (451, 466), False, 'import torch\n'), ((539, 572), 'os.path.join', 'os.path.join', (['run_root', '""".cache/"""'], {}), "(run_root, '.cache/')\n", (551, 572), False...
from src.classification.knn_classify import KNNClassify from sklearn.neighbors import KNeighborsClassifier import numpy as np def test_knn_sklearn(): '''Compare knn predictions to sklearn.''' n = 100 d = 5 neighbor_counts = [1, 3, 5, 7] trials = 5 for k in neighbor_counts: for _ in ran...
[ "sklearn.neighbors.KNeighborsClassifier", "numpy.random.randint", "src.classification.knn_classify.KNNClassify", "numpy.random.rand" ]
[((348, 368), 'numpy.random.rand', 'np.random.rand', (['n', 'd'], {}), '(n, d)\n', (362, 368), True, 'import numpy as np\n'), ((385, 411), 'numpy.random.randint', 'np.random.randint', (['(0)', 'd', 'n'], {}), '(0, d, n)\n', (402, 411), True, 'import numpy as np\n'), ((432, 474), 'src.classification.knn_classify.KNNClas...
"""This file can be used to create a new python file that will return the dictionary of Levelsymmetric quadratures.""" import numpy as np import sys def createdict(): """Create a dictionary based on the quadrature files stored in data/""" orders = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] D = dict() for o...
[ "numpy.set_printoptions" ]
[((742, 784), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (761, 784), True, 'import numpy as np\n'), ((789, 822), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(15)'}), '(precision=15)\n', (808, 822), True, 'import numpy as np\...
import numpy as np data = np.loadtxt('GSRM_plate_outlines.gmt',dtype=str) data = np.flip(data,1) # Locate the starting position of each plate bnds_index, = np.where(data[:,1] == '>') n = len(bnds_index) # Separate the boundaries of each plate and write it in a file for i in range(n): vi = bnds_index[i] j1 = ...
[ "numpy.where", "numpy.flip", "numpy.loadtxt", "numpy.savetxt" ]
[((27, 75), 'numpy.loadtxt', 'np.loadtxt', (['"""GSRM_plate_outlines.gmt"""'], {'dtype': 'str'}), "('GSRM_plate_outlines.gmt', dtype=str)\n", (37, 75), True, 'import numpy as np\n'), ((82, 98), 'numpy.flip', 'np.flip', (['data', '(1)'], {}), '(data, 1)\n', (89, 98), True, 'import numpy as np\n'), ((157, 184), 'numpy.wh...
#%% #%% import os import time import shutil import numpy as np import tensorflow as tf from PIL import Image import random import matplotlib.pyplot as plt import cv2 from cv2 import cv2 scal = 224 sampleModel = tf.keras.applications.ResNet50V2(weights='imagenet', include_top=F...
[ "matplotlib.pyplot.imshow", "cv2.cv2.imread", "tensorflow.keras.applications.resnet_v2.decode_predictions", "numpy.argmax", "tensorflow.keras.applications.ResNet50V2", "tensorflow.keras.utils.plot_model", "numpy.max", "cv2.cv2.resize", "tensorflow.nn.softmax", "numpy.expand_dims", "tensorflow.ke...
[((212, 316), 'tensorflow.keras.applications.ResNet50V2', 'tf.keras.applications.ResNet50V2', ([], {'weights': '"""imagenet"""', 'include_top': '(False)', 'input_shape': '(scal, scal, 3)'}), "(weights='imagenet', include_top=False,\n input_shape=(scal, scal, 3))\n", (244, 316), True, 'import tensorflow as tf\n'), ((...
import sys import numpy as np import hdf5storage as h5 np.set_printoptions(threshold=sys.maxsize) uv_path = 'uvmat/101_6-pp_Page_605-S0H0001.mat' uv = h5.loadmat(uv_path)['uv'] print(type(uv)) # np.ndarray print(uv.shape) first = uv[:, :, 0] second = uv[:, :, 1] third = uv[:, :, 2] # print(first) # print(second) # ...
[ "hdf5storage.loadmat", "numpy.unique", "numpy.set_printoptions" ]
[((55, 97), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (74, 97), True, 'import numpy as np\n'), ((152, 171), 'hdf5storage.loadmat', 'h5.loadmat', (['uv_path'], {}), '(uv_path)\n', (162, 171), True, 'import hdf5storage as h5\n'), ((340, 356), 'numpy....
import os, torch, random, cv2, math, glob import numpy as np from torch.utils import data from torchvision import transforms as T from PIL import Image from torch.nn import functional as F from collections import defaultdict import random import copy from torch.utils.data.sampler import Sampler class IdentityCameraS...
[ "random.uniform", "PIL.Image.open", "numpy.unique", "torch.randperm", "random.shuffle", "numpy.random.choice", "torch.stack", "torchvision.transforms.RandomHorizontalFlip", "math.sqrt", "torch.from_numpy", "numpy.array", "collections.defaultdict", "torchvision.transforms.Normalize", "torch...
[((3988, 4054), 'torchvision.transforms.Normalize', 'T.Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])\n', (3999, 4054), True, 'from torchvision import transforms as T\n'), ((900, 917), 'collections.defaultdict', 'defaultdict'...
# -*- coding: utf-8 -*- """ Module to provide a simulator to render a laparoscopic view comprising models of anatomy along with a laparoscopic ultrasound probe. """ import numpy as np import vtk import sksurgerycore.transforms.matrix as cmu import sksurgeryvtk.widgets.vtk_rendering_generator as rg import sksurgeryvtk...
[ "vtk.vtkTransformPolyDataFilter", "sksurgerycore.transforms.matrix.construct_rx_matrix", "numpy.eye", "vtk.vtkCylinderSource", "vtk.vtkPolyDataMapper", "vtk.vtkTransform", "vtk.vtkActor", "numpy.zeros", "numpy.linalg.inv", "sksurgeryvtk.utils.matrix_utils.create_matrix_from_list", "sksurgeryvtk....
[((2183, 2222), 'numpy.loadtxt', 'np.loadtxt', (['liver2camera_reference_file'], {}), '(liver2camera_reference_file)\n', (2193, 2222), True, 'import numpy as np\n'), ((2252, 2291), 'numpy.loadtxt', 'np.loadtxt', (['probe2camera_reference_file'], {}), '(probe2camera_reference_file)\n', (2262, 2291), True, 'import numpy ...
import numpy as np from pysmore.libs.util import fast_sigmoid from numba import jit @jit(nopython=True, fastmath=True) def get_dotproduct_loss(from_embedding, to_embedding, weight): weight = float(weight) prediction = np.dot(from_embedding, to_embedding.T) gradient = weight - prediction from_loss = gr...
[ "pysmore.libs.util.fast_sigmoid", "numpy.dot", "numba.jit" ]
[((86, 119), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'fastmath': '(True)'}), '(nopython=True, fastmath=True)\n', (89, 119), False, 'from numba import jit\n'), ((415, 448), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'fastmath': '(True)'}), '(nopython=True, fastmath=True)\n', (418, 448), False, 'from numba i...