code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import unittest import numpy as np import sklearn_supp.random_coordinates as random_coordinates class TestRandomCoordinateForestClassifier(unittest.TestCase): """These are just some simple sanity checks to make sure we don't get exceptions. """ def test_simple(self): X = [[0], [1]] ...
[ "numpy.array", "numpy.all", "sklearn_supp.random_coordinates.RandomCoordinateForestClassifier" ]
[((352, 420), 'sklearn_supp.random_coordinates.RandomCoordinateForestClassifier', 'random_coordinates.RandomCoordinateForestClassifier', ([], {'n_estimators': '(50)'}), '(n_estimators=50)\n', (403, 420), True, 'import sklearn_supp.random_coordinates as random_coordinates\n'), ((537, 556), 'numpy.all', 'np.all', (['(y_p...
# Author : <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
[ "os.listdir", "utils.fetch_action_ids", "pandas.read_csv", "os.path.join", "numpy.array", "numpy.sum", "warnings.simplefilter", "utils.fetch_parsed_recipe" ]
[((824, 886), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (845, 886), False, 'import warnings\n'), ((974, 992), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (984, 992), False, 'import os\n'...
from owslib.wms import WebMapService from owslib import crs from PIL import Image, ImageEnhance, ImageFilter import cv2 import numpy as np from pyspark import SparkContext from pyproj import Proj c = crs.Crs('EPSG:3857') wms = WebMapService('http://www.ign.es/wms-inspire/pnoa-ma', version='1.3.0') box = 1000 # m? x=...
[ "cv2.imwrite", "cv2.drawContours", "owslib.wms.WebMapService", "cv2.inRange", "owslib.crs.Crs", "cv2.arcLength", "cv2.bitwise_and", "cv2.contourArea", "numpy.array", "cv2.approxPolyDP", "cv2.cvtColor", "pyproj.Proj", "cv2.findContours", "cv2.Canny", "cv2.imread", "cv2.boundingRect" ]
[((201, 221), 'owslib.crs.Crs', 'crs.Crs', (['"""EPSG:3857"""'], {}), "('EPSG:3857')\n", (208, 221), False, 'from owslib import crs\n'), ((228, 299), 'owslib.wms.WebMapService', 'WebMapService', (['"""http://www.ign.es/wms-inspire/pnoa-ma"""'], {'version': '"""1.3.0"""'}), "('http://www.ign.es/wms-inspire/pnoa-ma', ver...
from __future__ import annotations from typing import Union, Tuple, List import warnings import numpy as np class Question: """Question is a thershold/matching concept for splitting the node of the Decision Tree Args: column_index (int): Column index to be chosen from the array passed at the matching...
[ "numpy.mean", "numpy.unique", "numpy.square", "numpy.array", "warnings.warn", "numpy.log2", "numpy.var" ]
[((4092, 4124), 'numpy.unique', 'np.unique', (['a'], {'return_counts': '(True)'}), '(a, return_counts=True)\n', (4101, 4124), True, 'import numpy as np\n'), ((4464, 4498), 'numpy.unique', 'np.unique', (['arr'], {'return_counts': '(True)'}), '(arr, return_counts=True)\n', (4473, 4498), True, 'import numpy as np\n'), ((4...
""" Utilities for creating simulated data sets. """ from typing import Optional, Sequence import numpy as np import pandas as pd from scipy.linalg import toeplitz from ..api import AllTracker __all__ = ["sim_data"] __tracker = AllTracker(globals()) def sim_data( n: int = 100, intercept: float = -5, t...
[ "numpy.random.normal", "numpy.ones", "numpy.random.multivariate_normal", "numpy.fill_diagonal", "numpy.exp", "numpy.array", "numpy.linspace", "scipy.linalg.toeplitz", "numpy.zeros", "numpy.random.seed", "numpy.random.uniform", "numpy.sin", "numpy.arange" ]
[((3611, 3640), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'seed_val'}), '(seed=seed_val)\n', (3625, 3640), True, 'import numpy as np\n'), ((3765, 3795), 'numpy.array', 'np.array', (['[[2, 1.3], [1.3, 2]]'], {}), '([[2, 1.3], [1.3, 2]])\n', (3773, 3795), True, 'import numpy as np\n'), ((3849, 3897), 'numpy.ra...
# Lint as: python3 # Copyright 2019 DeepMind Technologies Limited. 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 # # ...
[ "numpy.testing.assert_allclose", "absl.testing.absltest.main", "absl.testing.parameterized.named_parameters", "jax.numpy.array", "jax.grad", "jax.numpy.zeros_like" ]
[((1173, 1371), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('JitOnp', jax.jit, lambda t: t)", "('NoJitOnp', lambda fn: fn, lambda t: t)", "('JitJnp', jax.jit, jax.device_put)", "('NoJitJnp', lambda fn: fn, jax.device_put)"], {}), "(('JitOnp', jax.jit, lambda t: t), (\n 'NoJit...
#!/usr/bin/env python3 """ Evolve network architecture on a classification dataset, while at the same time training the weights with one of several learning algorithms. """ import joblib import time import torch.utils.data import logging import numpy as np import copy import os import pickle from networks import Weigh...
[ "numpy.random.rand", "numpy.array", "copy.deepcopy", "utils.init_output", "utils.store_performance", "logging.info", "utils.write_champion_info", "utils.log_champion_info", "utils.load_params", "numpy.maximum", "learning.get_performance_value", "learning.train", "networks.WeightLearningNetwo...
[((582, 612), 'utils.load_params', 'utils.load_params', ([], {'mode': '"""wlnn"""'}), "(mode='wlnn')\n", (599, 612), False, 'import utils\n'), ((697, 760), 'utils.init_output', 'utils.init_output', (['params'], {'overwrite': "params['overwrite_output']"}), "(params, overwrite=params['overwrite_output'])\n", (714, 760),...
import os import sys import numpy as np import time from utils_io import get_job_config from utils.model_utils import read_data from utils.args import parse_job_args from fedsem import Fedsem_Trainer from fedavg import Fedavg_Trainer from fedprox import Fedprox_Trainer from fedsgd import Fedsgd_Trainer from fedbaye...
[ "fedbayes.Fedbayes_Sing_Trainer", "fedprox.Fedprox_Trainer", "os.path.join", "utils.args.parse_job_args", "fedsgd.Fedsgd_Trainer", "modelsaver.Model_Saver", "utils.model_utils.read_data", "numpy.array", "fedsem.Fedsem_Trainer", "utils_io.get_job_config", "fedavg.Fedavg_Trainer", "os.path.expan...
[((430, 496), 'os.path.join', 'os.path.join', (['""".."""', '"""configs"""', 'args.experiment', 'args.configuration'], {}), "('..', 'configs', args.experiment, args.configuration)\n", (442, 496), False, 'import os\n'), ((507, 532), 'utils_io.get_job_config', 'get_job_config', (['yaml_file'], {}), '(yaml_file)\n', (521,...
import numpy as np from touchstone.environments.make import make_vec_envs NUM_ENVS = 2 if __name__ == '__main__': env = make_vec_envs("Pendulum-v0", 42, NUM_ENVS) np.random.seed(42) state = env.reset() for i in range(1000): actions = env.action_space.sample() out = env.step([actions f...
[ "touchstone.environments.make.make_vec_envs", "numpy.random.seed" ]
[((126, 168), 'touchstone.environments.make.make_vec_envs', 'make_vec_envs', (['"""Pendulum-v0"""', '(42)', 'NUM_ENVS'], {}), "('Pendulum-v0', 42, NUM_ENVS)\n", (139, 168), False, 'from touchstone.environments.make import make_vec_envs\n'), ((173, 191), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (...
# 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. # # Description: generate inputs and targets for the DLRM benchmark # # Utility function(s) to download and pre-process public data sets # - Cr...
[ "os.path.exists", "numpy.transpose", "multiprocessing.Process", "numpy.int32", "numpy.sum", "numpy.zeros", "numpy.random.uniform", "numpy.array", "numpy.concatenate", "sys.exit", "multiprocessing.Manager", "numpy.savez_compressed", "numpy.load" ]
[((1153, 1179), 'os.path.exists', 'os.path.exists', (['filename_i'], {}), '(filename_i)\n', (1167, 1179), False, 'import os\n'), ((3617, 3716), 'numpy.savez_compressed', 'np.savez_compressed', (["(d_path + o_filename + '.npz')"], {'X_cat': 'X_cat', 'X_int': 'X_int', 'y': 'y', 'counts': 'counts'}), "(d_path + o_filename...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 23 10:06:05 2021 @author: ngbla """ import os import cv2 import numpy as np # Command: pip install pillow from PIL import Image #Initialize names and path to empty list names = [] path = [] # Get the names of all the users for users in os.list...
[ "numpy.array", "os.listdir", "cv2.face.LBPHFaceRecognizer_create", "PIL.Image.open" ]
[((313, 339), 'os.listdir', 'os.listdir', (['"""img_training"""'], {}), "('img_training')\n", (323, 339), False, 'import os\n'), ((940, 953), 'numpy.array', 'np.array', (['ids'], {}), '(ids)\n', (948, 953), True, 'import numpy as np\n'), ((1170, 1206), 'cv2.face.LBPHFaceRecognizer_create', 'cv2.face.LBPHFaceRecognizer_...
# -*- coding: utf-8 -*- """ Helper functions to organize CHDI imaging data Created on Fri Jan 15 11:07:53 2016 @author: <NAME> Python Version: Python 3.5.1 |Anaconda 2.4.1 (64-bit) """ import glob as gl import pandas as pd import numpy as np import os from functools import partial def linear_pred(m,b,x): y = m ...
[ "os.listdir", "numpy.unique", "pandas.read_csv", "numpy.ones", "os.path.join", "os.path.isfile", "numpy.array", "functools.partial", "numpy.isnan", "numpy.concatenate", "pandas.DataFrame" ]
[((20722, 20767), 'os.path.join', 'os.path.join', (['datadir', '"""track_pheno_data.csv"""'], {}), "(datadir, 'track_pheno_data.csv')\n", (20734, 20767), False, 'import os\n'), ((20775, 20799), 'os.path.isfile', 'os.path.isfile', (['pheno_fn'], {}), '(pheno_fn)\n', (20789, 20799), False, 'import os\n'), ((25366, 25393)...
from __future__ import print_function import numpy as np import yt from hyperion.model import Model import matplotlib as mpl mpl.use('Agg') import powderday.config as cfg from powderday.grid_construction import yt_octree_generate from powderday.find_order import find_order import powderday.powderday_test_octree as pt...
[ "powderday.helpers.energy_density_absorbed_by_CMB", "numpy.repeat", "powderday.find_order.find_order", "matplotlib.use", "hyperion.model.Model", "hyperion.dust.SphericalDust", "numpy.squeeze", "numpy.max", "numpy.array", "powderday.powderday_test_octree.test_octree", "numpy.min", "powderday.hy...
[((126, 140), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (133, 140), True, 'import matplotlib as mpl\n'), ((596, 632), 'powderday.grid_construction.yt_octree_generate', 'yt_octree_generate', (['fname', 'field_add'], {}), '(fname, field_add)\n', (614, 632), False, 'from powderday.grid_construction im...
import numpy as np from lib.lif import LIF, ParamsLIF from lib.causal import causaleffect #Set x = 0, sigma = 10 #wvals = 2..20 sigma = 10 mu = 1 tau = 1 t = 500 params = ParamsLIF(sigma = sigma, mu = mu, tau = tau) lif = LIF(params, t = t) lif.x = 0 #Simulate for a range of $W$ values. N = 19 nsims = 1 wmax = 20 n =...
[ "numpy.savez", "lib.lif.ParamsLIF", "lib.lif.LIF", "numpy.array", "numpy.linspace", "numpy.zeros" ]
[((172, 210), 'lib.lif.ParamsLIF', 'ParamsLIF', ([], {'sigma': 'sigma', 'mu': 'mu', 'tau': 'tau'}), '(sigma=sigma, mu=mu, tau=tau)\n', (181, 210), False, 'from lib.lif import LIF, ParamsLIF\n'), ((223, 239), 'lib.lif.LIF', 'LIF', (['params'], {'t': 't'}), '(params, t=t)\n', (226, 239), False, 'from lib.lif import LIF, ...
#!/usr/bin/env python3 import sys import numpy as np import cv2 import time def get_time(start_time): return int((time.time() - start_time) * 1000) def is_inside(inside, outside, limit_val=-1): point_limit = limit_val * len(inside) if limit_val < 0: point_limit = 1 in_point = 0; for i in ...
[ "cv2.rectangle", "cv2.imshow", "cv2.destroyAllWindows", "sys.exit", "cv2.Laplacian", "cv2.resizeWindow", "cv2.threshold", "cv2.contourArea", "cv2.minAreaRect", "numpy.concatenate", "cv2.matchTemplate", "cv2.waitKey", "cv2.drawContours", "cv2.boxPoints", "numpy.int0", "cv2.cvtColor", ...
[((542, 553), 'time.time', 'time.time', ([], {}), '()\n', (551, 553), False, 'import time\n'), ((943, 983), 'cv2.imread', 'cv2.imread', (["(input_name + '.' + input_ext)"], {}), "(input_name + '.' + input_ext)\n", (953, 983), False, 'import cv2\n'), ((1506, 1563), 'cv2.fastNlMeansDenoisingColored', 'cv2.fastNlMeansDeno...
# Part of code was adpated from https://github.com/r9y9/deepvoice3_pytorch/tree/master/compute_timestamp_ratio.py # Copyright (c) 2017: <NAME>. import argparse import sys import numpy as np from hparams import hparams, hparams_debug_string from deepvoice3_paddle.data import TextDataSource, MelSpecDataSource from nnmnk...
[ "argparse.ArgumentParser", "deepvoice3_paddle.data.TextDataSource", "deepvoice3_paddle.data.MelSpecDataSource", "hparams.hparams.parse", "numpy.array", "numpy.sum", "sys.exit" ]
[((456, 532), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute output/input timestamp ratio."""'}), "(description='Compute output/input timestamp ratio.')\n", (479, 532), False, 'import argparse\n'), ((1188, 1215), 'hparams.hparams.parse', 'hparams.parse', (['args.hparams'], {}), '...
import os import sys import cv2 import numpy as np class Equirectangular: def __init__(self, img): self._img = img #self._img = cv2.imread(img_name, cv2.IMREAD_COLOR) [self._height, self._width, _] = self._img.shape print(self._img.shape) def GetPerspective(self, FOV, THET...
[ "numpy.radians", "numpy.sqrt", "numpy.ones", "numpy.repeat", "numpy.arcsin", "numpy.array", "numpy.dot", "numpy.linspace", "numpy.arctan2", "numpy.stack" ]
[((743, 779), 'numpy.ones', 'np.ones', (['[height, width]', 'np.float32'], {}), '([height, width], np.float32)\n', (750, 779), True, 'import numpy as np\n'), ((936, 981), 'numpy.sqrt', 'np.sqrt', (['(x_map ** 2 + y_map ** 2 + z_map ** 2)'], {}), '(x_map ** 2 + y_map ** 2 + z_map ** 2)\n', (943, 981), True, 'import nump...
import numpy as np try: import matplotlib.pyplot as plt except ImportError: # mpl is optional pass def compareplot(comp_df, insample_dev=True, se=True, dse=True, ax=None, plot_kwargs=None): """ Model comparison summary plot in the style of the one used in the book Statistical Reth...
[ "numpy.linspace", "matplotlib.pyplot.subplots" ]
[((1348, 1406), 'numpy.linspace', 'np.linspace', (['(0)', '(-1)', '(comp_df.shape[0] * 2 - 1)'], {'retstep': '(True)'}), '(0, -1, comp_df.shape[0] * 2 - 1, retstep=True)\n', (1359, 1406), True, 'import numpy as np\n'), ((1255, 1269), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1267, 1269), True, 'i...
import numpy as np import re from nltk import Tree from nltk import induce_pcfg from nltk import Nonterminal from nltk.parse.generate import generate epsilon = 1e-20 class corpus: # stores all sentence forms in data def __init__(self): self.sentence_forms = {} for i in range(6): # init si...
[ "os.listdir", "numpy.power", "nltk.Nonterminal", "numpy.log", "nltk.Tree.fromstring", "nltk.induce_pcfg", "re.search" ]
[((5787, 5808), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (5797, 5808), False, 'import os\n'), ((7044, 7060), 'nltk.Nonterminal', 'Nonterminal', (['"""S"""'], {}), "('S')\n", (7055, 7060), False, 'from nltk import Nonterminal\n'), ((7075, 7102), 'nltk.induce_pcfg', 'induce_pcfg', (['S', 'product...
import bpy import numpy as np from PIL import Image class CarModelViewToImage(): # def __init__: # self.camera_ = None # self.image_folder_ = None # self.car_width_ = 0 # self.car_length_ = 0 # self.viewport_width_ = 0 # self.viewport_height_ = 0 # self.stri...
[ "numpy.radians", "numpy.clip", "bpy.ops.object.camera_add", "PIL.Image.fromarray", "numpy.sqrt", "bpy.ops.object.constraint_add", "numpy.array", "bpy.ops.render.render" ]
[((2180, 2207), 'bpy.ops.object.camera_add', 'bpy.ops.object.camera_add', ([], {}), '()\n', (2205, 2207), False, 'import bpy\n'), ((2367, 2381), 'numpy.radians', 'np.radians', (['(90)'], {}), '(90)\n', (2377, 2381), True, 'import numpy as np\n'), ((2526, 2572), 'bpy.ops.object.constraint_add', 'bpy.ops.object.constrain...
import torch import arcsim import gc import time import json import sys import gc import os import numpy as np import matplotlib.pyplot as plt from datetime import datetime now = datetime.now() timestamp = datetime.now().strftime('%Y-%m-%d_%H:%M:%S') #steps = 30 #epochs= 10 steps = 40 epochs= 20 #handles = [25, 60, 30...
[ "torch.optim.SGD", "matplotlib.pyplot.savefig", "torch.optim.lr_scheduler.CosineAnnealingWarmRestarts", "arcsim.get_sim", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "torch.set_num_threads", "datetime.datetime.now", "torch.norm", "os.mkdir", "numpy.vstack"...
[((180, 194), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (192, 194), False, 'from datetime import datetime\n'), ((659, 677), 'os.mkdir', 'os.mkdir', (['out_path'], {}), '(out_path)\n', (667, 677), False, 'import os\n'), ((909, 934), 'torch.set_num_threads', 'torch.set_num_threads', (['(16)'], {}), '(16)...
import salome import SMESH from salome.geom import geomBuilder from salome.smesh import smeshBuilder import sys import math import numpy as np from numpy.linalg import norm from numpy.random import uniform from pathlib import Path from auxiliaryFunctions import clusteringAlgorithm from auxiliaryFunctions import getTr...
[ "numpy.radians", "salome.salome_init", "numpy.allclose", "numpy.sqrt", "numpy.cross", "numpy.tan", "salome.geom.geomBuilder.New", "pathlib.Path.cwd", "numpy.linalg.norm", "numpy.column_stack", "numpy.array", "numpy.savetxt", "numpy.random.uniform", "auxiliaryFunctions.clusteringAlgorithm",...
[((392, 412), 'salome.salome_init', 'salome.salome_init', ([], {}), '()\n', (410, 412), False, 'import salome\n'), ((422, 439), 'salome.geom.geomBuilder.New', 'geomBuilder.New', ([], {}), '()\n', (437, 439), False, 'from salome.geom import geomBuilder\n'), ((448, 466), 'salome.smesh.smeshBuilder.New', 'smeshBuilder.New...
""" .. module:: Augmentation :platform: Unix, Windows :synopsis: A useful module indeed. .. moduleauthor:: <NAME> <<EMAIL>> """ import numpy as np import random from nltk.corpus import wordnet import collections import math #import nltk #nltk.download('wordnet') class Augmentation: r""" This is the clas...
[ "numpy.random.random", "numpy.random.choice", "numpy.max", "numpy.array", "collections.defaultdict", "nltk.corpus.wordnet.synsets" ]
[((2556, 2584), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (2579, 2584), False, 'import collections\n'), ((3466, 3501), 'numpy.random.random', 'np.random.random', ([], {'size': '(cache_len,)'}), '(size=(cache_len,))\n', (3482, 3501), True, 'import numpy as np\n'), ((4591, 4619), 'nu...
""" THIS CODE IS UNDER THE BSD 2-Clause LICENSE. YOU CAN FIND THE COMPLETE FILE AT THE SOURCE DIRECTORY. Copyright (C) 2017 <NAME> - All rights reserved @author : <EMAIL> Publication: A Novel Unsupervised Analysis of El...
[ "cudamat.cublas_init", "sys.path.insert", "_pickle.dump", "scipy.io.loadmat", "numpy.array", "cudamat.dot", "numpy.mod", "numpy.random.RandomState", "os.path.exists", "numpy.savez", "numpy.mean", "cudamat.CUDAMatrix", "numpy.max", "cudamat.log", "os.path.isdir", "numpy.empty", "numpy...
[((1300, 1343), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../dataPreprocessing/"""'], {}), "(0, '../dataPreprocessing/')\n", (1315, 1343), False, 'import sys\n'), ((1913, 1926), 'dataPreproc.DataPreproc', 'DataPreproc', ([], {}), '()\n', (1924, 1926), False, 'from dataPreproc import DataPreproc\n'), ((5883, 59...
from os.path import join import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import zscore from sklearn.decomposition import PCA import pandas as pd from itertools import combinations # Load helper function(s) for interacting with CTF dataset from ctf_dataset.load import create_wr...
[ "numpy.hstack", "numpy.nanmean", "numpy.array", "numpy.cumsum", "scipy.stats.pearsonr", "numpy.save", "numpy.arange", "seaborn.set", "sklearn.decomposition.PCA", "numpy.stack", "matplotlib.pyplot.yticks", "numpy.vstack", "pandas.DataFrame", "numpy.amin", "seaborn.lineplot", "scipy.stat...
[((403, 425), 'os.path.join', 'join', (['base_dir', '"""data"""'], {}), "(base_dir, 'data')\n", (407, 425), False, 'from os.path import join\n'), ((465, 533), 'ctf_dataset.load.create_wrapped_dataset', 'create_wrapped_dataset', (['data_dir'], {'output_dataset_name': '"""virtual.hdf5"""'}), "(data_dir, output_dataset_na...
import json import os import time from copy import deepcopy import TransportMaps.Distributions as dist import TransportMaps.Likelihoods as like from typing import List, Dict from matplotlib import pyplot as plt from factors.Factors import Factor, ExplicitPriorFactor, ImplicitPriorFactor, \ LikelihoodFactor, Bina...
[ "matplotlib.pyplot.ylabel", "numpy.hstack", "sampler.sampler_utils.JointFactor", "numpy.array", "utils.Functions.sample_dict_to_array", "copy.deepcopy", "sampler.SimulationBasedSampler.SimulationBasedSampler", "slam.Variables.Variable", "os.path.exists", "numpy.mean", "matplotlib.pyplot.xlabel",...
[((32008, 32052), 'os.path.exists', 'os.path.exists', (['f"""{case_dir}/run{run_count}"""'], {}), "(f'{case_dir}/run{run_count}')\n", (32022, 32052), False, 'import os\n'), ((32081, 32119), 'os.mkdir', 'os.mkdir', (['f"""{case_dir}/run{run_count}"""'], {}), "(f'{case_dir}/run{run_count}')\n", (32089, 32119), False, 'im...
#!/usr/bin/env python # coding: utf-8 import time #https://stackoverflow.com/questions/714063/importing-modules-from-parent-folder import sys sys.path.insert(0,'../gym') import numpy as np from support import * from model import * def run_exper(model, steps, get_features, pre_proc_features): from environment im...
[ "sys.path.insert", "argparse.ArgumentParser", "time.perf_counter", "time.sleep", "environment.SIMULATOR", "numpy.array", "numpy.zeros", "numpy.expand_dims", "sys.exit" ]
[((144, 172), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../gym"""'], {}), "(0, '../gym')\n", (159, 172), False, 'import sys\n'), ((384, 395), 'environment.SIMULATOR', 'SIMULATOR', ([], {}), '()\n', (393, 395), False, 'from environment import SIMULATOR\n'), ((2414, 2439), 'argparse.ArgumentParser', 'argparse.Ar...
import numpy as np one_d_array = [0, 1, 2, 3, 4, 5] two_d_array = [ [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28 ,29, 30], [31, 32, 33, 34, 35] ] t = one_d_array[3] # x: coord(index) e = two_d_array[2][1] # y x y:row x:column arr = ...
[ "numpy.array" ]
[((320, 341), 'numpy.array', 'np.array', (['two_d_array'], {}), '(two_d_array)\n', (328, 341), True, 'import numpy as np\n')]
''' Created on 2009-08-11 @author: malem303 ''' import unittest from imugrabber.algorithms import fong_accelero, utils, statistics from imugrabber.algorithms import io import os import scipy as sp from numpy import testing class FongTests(unittest.TestCase): def setUp(self): self.misalignments...
[ "imugrabber.algorithms.fong_accelero.fit", "scipy.array", "imugrabber.algorithms.utils.build_measures_matrix", "numpy.testing.assert_almost_equal", "imugrabber.algorithms.io.float_columns_from_CSV", "unittest.main" ]
[((1366, 1381), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1379, 1381), False, 'import unittest\n'), ((332, 502), 'scipy.array', 'sp.array', (['[[0.00408269136, -1.96002082e-05, 0.000116692771], [-6.73123099e-06, \n 0.00386658837, -0.000277361987], [-6.43895175e-05, 0.00029126093, \n 0.00393614477]]'], ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 15 09:44:30 2021 @author: erri """ import os import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap, BoundaryNorm #############################################################################################...
[ "numpy.count_nonzero", "numpy.array", "numpy.loadtxt", "numpy.nanmin", "os.path.exists", "matplotlib.colors.ListedColormap", "os.mkdir", "numpy.nanmax", "matplotlib.pyplot.savefig", "numpy.isnan", "numpy.savetxt", "numpy.nansum", "matplotlib.pyplot.show", "os.path.join", "numpy.logical_o...
[((959, 989), 'os.path.join', 'os.path.join', (['w_dir', 'DEM1_name'], {}), '(w_dir, DEM1_name)\n', (971, 989), False, 'import os\n'), ((1002, 1032), 'os.path.join', 'os.path.join', (['w_dir', 'DEM2_name'], {}), '(w_dir, DEM2_name)\n', (1014, 1032), False, 'import os\n'), ((1297, 1328), 'os.path.join', 'os.path.join', ...
import numpy as np def load_lda(path): rows = [] with open(path, 'r') as f: for line in f: line = line.strip(" []\n") if line: rows.append(np.fromstring(line, dtype=np.float32, sep=' ')) matrix = np.array(rows).T return matrix[:-1], matrix[-1]
[ "numpy.array", "numpy.fromstring" ]
[((259, 273), 'numpy.array', 'np.array', (['rows'], {}), '(rows)\n', (267, 273), True, 'import numpy as np\n'), ((197, 243), 'numpy.fromstring', 'np.fromstring', (['line'], {'dtype': 'np.float32', 'sep': '""" """'}), "(line, dtype=np.float32, sep=' ')\n", (210, 243), True, 'import numpy as np\n')]
#!/usr/bin/python from __future__ import absolute_import import torch import torch.nn as nn from torchvision import transforms from torchvision.models import vgg16_bn from torch.utils.data import Dataset, DataLoader from PIL import Image import numpy as np import matplotlib.pyplot as plt import os from statistics impor...
[ "torch.nn.ReLU", "torch.nn.Dropout", "statistics.stdev", "torch.nn.CrossEntropyLoss", "torch.max", "numpy.array", "matplotlib.pyplot.imshow", "numpy.mean", "os.listdir", "matplotlib.pyplot.plot", "numpy.asarray", "torchvision.models.vgg16_bn", "matplotlib.pyplot.ylim", "torchvision.transfo...
[((549, 569), 'PIL.Image.open', 'Image.open', (['img_path'], {}), '(img_path)\n', (559, 569), False, 'from PIL import Image\n'), ((615, 630), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (625, 630), True, 'import numpy as np\n'), ((760, 775), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n...
"""ะ›ะ  3.3, <NAME>, ะœ8ะž-303ะ‘-18""" import numpy as np import fire # CLI import matplotlib.pyplot as plt from sem1.lab1_1.gauss import lu_decomposition, lu_solve def f(coeffs, x): """ะ’ั‹ั‡ะธัะปะตะฝะธะต ะทะฝะฐั‡ะตะฝะธั ะฟะพะปะธะฝะพะผะฐ ั ะบะพัั„ั„ะธั†ะธะตะฝั‚ะฐะผะธ coeffs""" return sum([x ** i * c for i, c in enumerate(coeffs)]) def sum_squar...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.savefig", "fire.Fire", "sem1.lab1_1.gauss.lu_decomposition", "matplotlib.pyplot.plot", "sem1.lab1_1.gauss.lu_solve", "numpy.array", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((735, 748), 'numpy.array', 'np.array', (['mat'], {}), '(mat)\n', (743, 748), True, 'import numpy as np\n'), ((757, 768), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (765, 768), True, 'import numpy as np\n'), ((783, 804), 'sem1.lab1_1.gauss.lu_decomposition', 'lu_decomposition', (['mat'], {}), '(mat)\n', (799, 80...
from argparse import ArgumentParser from itertools import starmap import matplotlib.pyplot as plt import numpy as np import pandas as pd from fyne import blackscholes, heston from matplotlib.patches import Patch from scipy.stats import gaussian_kde import settings from align_settings import STARTTIME, ENDTIME from ut...
[ "numpy.clip", "pandas.to_timedelta", "pandas.read_parquet", "argparse.ArgumentParser", "numpy.reshape", "numpy.log", "pandas.Series.xs", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.patches.Patch", "numpy.rot90", "numpy.broadcast_arrays", "pandas.to_datetime" ]
[((2058, 2079), 'pandas.to_timedelta', 'pd.to_timedelta', (['"""1s"""'], {}), "('1s')\n", (2073, 2079), True, 'import pandas as pd\n'), ((2921, 2982), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(2)'], {'sharey': '(True)', 'sharex': '(True)', 'figsize': '(8, 10)'}), '(3, 2, sharey=True, sharex=True, figsize...
import os import random import datetime import argparse import numpy as np from tqdm import tqdm from model.unetdsbn import Unet2D from utils.loss import dice_loss1 from datasets.dataset import Dataset, ToTensor, CreateOnehotLabel import torch import torchvision.transforms as tfs from torch import optim from torch.op...
[ "torch.manual_seed", "os.path.exists", "utils.loss.dice_loss1", "argparse.ArgumentParser", "torch.optim.lr_scheduler.ExponentialLR", "os.makedirs", "datasets.dataset.CreateOnehotLabel", "tqdm.tqdm", "os.path.join", "torch.nn.DataParallel", "random.seed", "datasets.dataset.ToTensor", "datetim...
[((454, 514), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Dual Normalization U-Net Training"""'], {}), "('Dual Normalization U-Net Training')\n", (477, 514), False, 'import argparse\n'), ((1464, 1498), 'random.seed', 'random.seed', (['(args.seed + worker_id)'], {}), '(args.seed + worker_id)\n', (1475, 1...
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "mindspore.dataset.audio.transforms.Flanger", "numpy.abs", "mindspore.dataset.NumpySlicesDataset", "numpy.count_nonzero", "numpy.array", "numpy.random.sample", "pytest.raises" ]
[((1061, 1092), 'numpy.abs', 'np.abs', (['(data_expected - data_me)'], {}), '(data_expected - data_me)\n', (1067, 1092), True, 'import numpy as np\n'), ((1179, 1204), 'numpy.count_nonzero', 'np.count_nonzero', (['greater'], {}), '(greater)\n', (1195, 1204), True, 'import numpy as np\n'), ((1532, 1594), 'numpy.array', '...
''' Solution for day 13 of the 2021 Advent of Code calendar. Run it with the command `python -m adventofcode run_solution -y 2021 13` from the project root. ''' import numpy as np from adventofcode.types import Solution def part1(data, exit_on_first_fold=False): rows = [row for row in data.splitlines() if row an...
[ "numpy.flip" ]
[((754, 773), 'numpy.flip', 'np.flip', (['fold[::-1]'], {}), '(fold[::-1])\n', (761, 773), True, 'import numpy as np\n'), ((1173, 1186), 'numpy.flip', 'np.flip', (['fold'], {}), '(fold)\n', (1180, 1186), True, 'import numpy as np\n')]
""" Square ====== """ import numpy as np from ..topology_graph import Edge from .cof import Cof from .vertices import LinearVertex, NonLinearVertex class Square(Cof): """ Represents a sqaure COF topology graph. Unoptimized construction .. moldoc:: import moldoc.molecule as molecule ...
[ "numpy.array" ]
[((3649, 3674), 'numpy.array', 'np.array', (['[1.0, 0.0, 0.0]'], {}), '([1.0, 0.0, 0.0])\n', (3657, 3674), True, 'import numpy as np\n'), ((3681, 3706), 'numpy.array', 'np.array', (['[0.0, 1.0, 0.0]'], {}), '([0.0, 1.0, 0.0])\n', (3689, 3706), True, 'import numpy as np\n'), ((3713, 3738), 'numpy.array', 'np.array', (['...
import pandas as pd import matplotlib.cm as cm import numpy as np import matplotlib.pyplot as plt def plot(problemVariants, *, zero, outfile, numThreads): columns = ['Problem', 'NotTriedYet', 'Scheduled', 'Success', 'Timeout', 'Stopped', 'Ended'] colors = ['w', 'tab:purple', 'tab:green', 'tab:orange', 'tab:red...
[ "pandas.DataFrame", "matplotlib.pyplot.subplot", "matplotlib.pyplot.legend", "numpy.arange" ]
[((3598, 3614), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (3609, 3614), True, 'import matplotlib.pyplot as plt\n'), ((4671, 4709), 'matplotlib.pyplot.legend', 'plt.legend', (['n', 'labels'], {'loc': '[1.01, 0.1]'}), '(n, labels, loc=[1.01, 0.1])\n', (4681, 4709), True, 'import matplotlib.p...
import os from .vendored import colorconv import numpy as np import vispy.color _matplotlib_list_file = os.path.join(os.path.dirname(__file__), 'matplotlib_cmaps.txt') with open(_matplotlib_list_file) as fin: matplotlib_colormaps = [line.rstrip() for line in fin] def _all_r...
[ "numpy.clip", "numpy.convolve", "numpy.unique", "numpy.full", "numpy.max", "os.path.dirname", "numpy.array", "numpy.zeros", "numpy.stack", "numpy.concatenate", "numpy.meshgrid", "numpy.all", "numpy.broadcast_to", "numpy.arange" ]
[((609, 653), 'numpy.array', 'np.array', (['[0.0, -83.07790815, -134.09790293]'], {}), '([0.0, -83.07790815, -134.09790293])\n', (617, 653), True, 'import numpy as np\n'), ((662, 707), 'numpy.array', 'np.array', (['[100.0, 175.01447356, 107.39905336]'], {}), '([100.0, 175.01447356, 107.39905336])\n', (670, 707), True, ...
from dipy.denoise.nlmeans import nlmeans_3d, nlmeans from dipy.denoise.noise_estimate import estimate_sigma import cv2 as cv import numpy as np import nibabel as nib def preprocess(nifti, name): """Preprocess the 3D MRI image before image segmentation""" image = nifti.get_fdata() sigma = estimate_sigma(im...
[ "dipy.denoise.noise_estimate.estimate_sigma", "dipy.denoise.nlmeans.nlmeans", "nibabel.save", "nibabel.load", "cv2.kmeans", "numpy.argmax", "nibabel.Nifti1Image" ]
[((303, 330), 'dipy.denoise.noise_estimate.estimate_sigma', 'estimate_sigma', (['image'], {'N': '(16)'}), '(image, N=16)\n', (317, 330), False, 'from dipy.denoise.noise_estimate import estimate_sigma\n'), ((403, 424), 'dipy.denoise.nlmeans.nlmeans', 'nlmeans', (['image', 'sigma'], {}), '(image, sigma)\n', (410, 424), F...
""" @author: <NAME> @contact: <EMAIL> """ import random import copy import numpy as np from torch.utils.data.dataset import ConcatDataset from torch.utils.data.sampler import Sampler class DefaultSampler(Sampler): r"""Traverse all :math:`N` domains, randomly select :math:`K` samples in each domain to form a mini-...
[ "numpy.random.choice", "random.sample", "copy.deepcopy" ]
[((1183, 1226), 'copy.deepcopy', 'copy.deepcopy', (['self.sample_idxes_per_domain'], {}), '(self.sample_idxes_per_domain)\n', (1196, 1226), False, 'import copy\n'), ((3199, 3242), 'copy.deepcopy', 'copy.deepcopy', (['self.sample_idxes_per_domain'], {}), '(self.sample_idxes_per_domain)\n', (3212, 3242), False, 'import c...
from stuff import * # Get weekday pattern from case data in order to identify exact date on SGTF graph # 0 mod 7 is Thursday in daytodate notation (being 1970-01-01) nc={} with open('SAcases','r') as fp: for x in fp: y=x.split() nc[datetoday(y[0])]=int(y[1]) minday=min(nc) maxday=max(nc) c0=[0]*7 c1=[0]*7 f...
[ "numpy.dtype", "PIL.Image.fromarray", "PIL.Image.open", "numpy.roll", "numpy.argmax", "numpy.array", "numpy.zeros", "numpy.concatenate", "numpy.maximum", "numpy.arange" ]
[((1195, 1213), 'PIL.Image.open', 'Image.open', (['infile'], {}), '(infile)\n', (1205, 1213), False, 'from PIL import Image\n'), ((1219, 1248), 'numpy.array', 'np.array', (['im_frame'], {'dtype': 'int'}), '(im_frame, dtype=int)\n', (1227, 1248), True, 'import numpy as np\n'), ((2239, 2302), 'numpy.concatenate', 'np.con...
import numpy as np from sklearn import multioutput import xgboost as xgb class Regressor(): def _init_(self): super()._init_() self.model = None def fit(self, X, y): # Create empty model made self.model_bag = dict() # Data bag self.data_bag = di...
[ "xgboost.XGBRegressor", "numpy.asarray" ]
[((4365, 4382), 'numpy.asarray', 'np.asarray', (['preds'], {}), '(preds)\n', (4375, 4382), True, 'import numpy as np\n'), ((1460, 1502), 'numpy.asarray', 'np.asarray', (['self.data_bag[1][metadata_str]'], {}), '(self.data_bag[1][metadata_str])\n', (1470, 1502), True, 'import numpy as np\n'), ((2103, 2135), 'numpy.asarr...
import os import cv2 import gc import random import time from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt import argparse from glob import glob import torch import torch.nn as nn import torchvision.transforms as transforms from PIL import Image, ImageFilter from models.OEFT import OEFT parse...
[ "models.OEFT.OEFT", "torchvision.transforms.ToPILImage", "numpy.array", "os.path.exists", "os.listdir", "argparse.ArgumentParser", "torch.unsqueeze", "numpy.stack", "os.path.isdir", "numpy.random.seed", "torchvision.transforms.ToTensor", "gc.collect", "torchvision.transforms.Normalize", "t...
[((324, 379), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Code to optimize"""'}), "(description='Code to optimize')\n", (347, 379), False, 'import argparse\n'), ((4596, 4612), 'os.listdir', 'os.listdir', (['"""./"""'], {}), "('./')\n", (4606, 4612), False, 'import os\n'), ((4238, 4269...
import tensorflow as tf import numpy as np import random import time from math import exp from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers import Merge from keras.optimizers import RMSprop, Adam start_time = time.time() class UAV_fire_extinguish(object): ...
[ "keras.optimizers.Adam", "keras.layers.Merge", "keras.layers.core.Activation", "numpy.random.random", "numpy.argmax", "keras.models.Sequential", "numpy.max", "numpy.array", "numpy.zeros", "numpy.random.randint", "random.random", "time.time", "random.randint", "keras.layers.core.Dense" ]
[((271, 282), 'time.time', 'time.time', ([], {}), '()\n', (280, 282), False, 'import time\n'), ((16855, 16867), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (16865, 16867), False, 'from keras.models import Sequential\n'), ((17025, 17037), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (17035, ...
############################################################################### # Copyright (c) 2007-2018, National Research Foundation (Square Kilometre Array) # # Licensed under the BSD 3-Clause License (the "License"); you may not use # this file except in compliance with the License. You may obtain a copy # of the ...
[ "scikits.fitting.LinearLeastSquaresFit", "numpy.vander", "scikits.fitting.NonLinearLeastSquaresFit", "numpy.ix_", "numpy.array", "numpy.zeros", "numpy.testing.assert_almost_equal", "numpy.dot", "numpy.testing.run_module_suite", "numpy.random.randn", "numpy.arange" ]
[((5252, 5270), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (5268, 5270), False, 'from numpy.testing import TestCase, assert_almost_equal, run_module_suite\n'), ((1392, 1409), 'numpy.array', 'np.array', (['[1, -4]'], {}), '([1, -4])\n', (1400, 1409), True, 'import numpy as np\n'), ((1437, 14...
"""Main module.""" __authors__ = '<NAME>, <NAME>' __version__ = '1.0' __date__ = '9/10/2017' import json import os.path import pickle import random import urllib from bs4 import BeautifulSoup from nltk.corpus import stopwords from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extracti...
[ "numpy.convolve", "numpy.polyfit", "matplotlib.pyplot.ylabel", "numpy.array", "numpy.poly1d", "textblob.TextBlob", "numpy.mean", "nltk.corpus.stopwords.words", "sklearn.feature_extraction.text.CountVectorizer", "matplotlib.pyplot.xlabel", "numpy.max", "sklearn.naive_bayes.MultinomialNB", "ma...
[((4568, 4670), 'sklearn.feature_extraction.text.CountVectorizer', 'CountVectorizer', ([], {'lowercase': '(True)', 'strip_accents': '"""ascii"""', 'stop_words': 'stopset', 'decode_error': '"""replace"""'}), "(lowercase=True, strip_accents='ascii', stop_words=stopset,\n decode_error='replace')\n", (4583, 4670), False...
import numpy as np from numpy.testing import assert_allclose import pytest from mne._ola import _COLA, _Interp2, _Storer def test_interp_2pt(): """Test our two-point interpolator.""" n_pts = 200 assert n_pts % 50 == 0 feeds = [ # test a bunch of feeds to make sure they don't break things [n_...
[ "numpy.hanning", "mne._ola._COLA", "numpy.arange", "numpy.testing.assert_allclose", "mne._ola._Interp2", "pytest.mark.parametrize", "numpy.array", "numpy.linspace", "mne._ola._Storer", "numpy.concatenate", "numpy.full", "numpy.random.RandomState" ]
[((2880, 2922), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ndim"""', '(1, 2, 3)'], {}), "('ndim', (1, 2, 3))\n", (2903, 2922), False, 'import pytest\n'), ((493, 512), 'numpy.array', 'np.array', (['[10, -10]'], {}), '([10, -10])\n', (501, 512), True, 'import numpy as np\n'), ((528, 546), 'numpy.full', '...
import numpy as np import sys import string M=4 N=5 # grille rempli par sequence s_grille=np.full((M+N,M+N),0) # grille remplit par 0 -1 1 grille=np.full((M,N), -1) #grille[1][0]=0 sequence1=[1,1] sequence2=[2,1] # non-colore -1 # blanche 0 # noire 1 def lire_fichier(s_grille): #file=sys.argv[1:] try: ...
[ "numpy.full", "sys.exit" ]
[((92, 118), 'numpy.full', 'np.full', (['(M + N, M + N)', '(0)'], {}), '((M + N, M + N), 0)\n', (99, 118), True, 'import numpy as np\n'), ((148, 167), 'numpy.full', 'np.full', (['(M, N)', '(-1)'], {}), '((M, N), -1)\n', (155, 167), True, 'import numpy as np\n'), ((13363, 13382), 'numpy.full', 'np.full', (['(M, N)', '(-...
#for data cleaning and analysis import pandas as pd import numpy as np from random import randint #for visualization import matplotlib.pyplot as plt import seaborn as sns #for directory-related functions import os import glob import getpass #for web-scraping baseball data import pybaseball as pyb #for drafting ...
[ "tkinter.Button", "math.log", "numpy.array", "tkinter.Label", "getpass.getuser", "sklearn.cluster.MeanShift", "pandas.ExcelWriter", "pandas.date_range", "numpy.mean", "tkinter.Entry", "random.choice", "pybaseball.chadwick_register", "pandas.merge", "numpy.std", "datetime.date.today", "...
[((718, 751), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (741, 751), False, 'import warnings\n'), ((861, 868), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (866, 868), True, 'import tkinter as tk\n'), ((983, 1054), 'tkinter.Label', 'tk.Label', (['root'], {'text': '"""Choos...
# Evolutionary Learning Strategy Implementation # Learn more from https://blog.openai.com/evolution-strategies/ import gym import numpy as np from gym import wrappers # GLOBAL SETTINGS RNG_SEED = 8 ENVIRONMENT = "LunarLander-v2" POPULATION_SIZE = 100 # Population size GENERATION_LIMIT = 100 # Max number of generati...
[ "numpy.mean", "gym.upload", "numpy.argmax", "numpy.zeros", "numpy.matmul", "numpy.random.seed", "gym.wrappers.Monitor", "numpy.random.randn", "gym.make" ]
[((1961, 1982), 'gym.make', 'gym.make', (['ENVIRONMENT'], {}), '(ENVIRONMENT)\n', (1969, 1982), False, 'import gym\n'), ((2212, 2236), 'numpy.random.seed', 'np.random.seed', (['RNG_SEED'], {}), '(RNG_SEED)\n', (2226, 2236), True, 'import numpy as np\n'), ((2414, 2449), 'numpy.zeros', 'np.zeros', (['(input_size, output_...
""" Onoda 2012 ICA- and PCA-based algorithm See: Careful seeding method based on independent components analysis for k-means clustering http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.663.5343&rep=rep1&type=pdf#page=53 """ from abc import abstractmethod import numpy as np from initialisations.base import ...
[ "numpy.argmin", "numpy.array", "numpy.dot" ]
[((755, 774), 'numpy.array', 'np.array', (['centroids'], {}), '(centroids)\n', (763, 774), True, 'import numpy as np\n'), ((930, 952), 'numpy.dot', 'np.dot', (['component', 'row'], {}), '(component, row)\n', (936, 952), True, 'import numpy as np\n'), ((716, 736), 'numpy.argmin', 'np.argmin', (['distances'], {}), '(dist...
import numpy as np from math import sqrt from numba import njit, prange, jitclass from src.Common import ParticleType from typing import Tuple @jitclass([]) class TimeStep: def __init__(self): pass def compute(self, J: int, pA: np.array, gamma_c: float = 0.25, gamma_f: float = 0.25) -> Tuple[float, flo...
[ "numba.prange", "numpy.array", "math.sqrt", "numba.jitclass" ]
[((145, 157), 'numba.jitclass', 'jitclass', (['[]'], {}), '([])\n', (153, 157), False, 'from numba import njit, prange, jitclass\n'), ((2085, 2094), 'numba.prange', 'prange', (['J'], {}), '(J)\n', (2091, 2094), False, 'from numba import njit, prange, jitclass\n'), ((2387, 2398), 'numpy.array', 'np.array', (['h'], {}), ...
import numpy as np import tensorflow as tf from pytorch2onnx import AntiSpoofPredict import cv2 import torch import time #load pytorch device_id = 0 model_path = "./resources/anti_spoof_models/2020-09-28-13-11_Anti_Spoofing_1.2_112x112_model_iter-150.pth" anti_model = AntiSpoofPredict(device_id, model_path) dummy_img...
[ "tensorflow.lite.Interpreter", "numpy.random.random_sample", "time.time", "cv2.imread", "pytorch2onnx.AntiSpoofPredict" ]
[((270, 309), 'pytorch2onnx.AntiSpoofPredict', 'AntiSpoofPredict', (['device_id', 'model_path'], {}), '(device_id, model_path)\n', (286, 309), False, 'from pytorch2onnx import AntiSpoofPredict\n'), ((323, 421), 'cv2.imread', 'cv2.imread', (['"""./datasets/RGB_Images/1.2_112x112/test_caffee_model/0/1599816416115_69.png"...
import os import numpy as np def read_data(input_path, english_only, english_indices=None): """Returns the list of signatures, labels, and ids. These can have English-only signatures if specified.""" if english_indices is None: english_indices = [] sig_list = [] lab_list = [] # Genuine = 0, Forged = 1...
[ "os.listdir", "numpy.delete", "numpy.array", "numpy.zeros", "numpy.empty", "numpy.random.seed", "numpy.concatenate", "numpy.genfromtxt" ]
[((1179, 1213), 'numpy.empty', 'np.empty', (['(rows, data[0].shape[1])'], {}), '((rows, data[0].shape[1]))\n', (1187, 1213), True, 'import numpy as np\n'), ((3460, 3477), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (3474, 3477), True, 'import numpy as np\n'), ((570, 617), 'numpy.genfromtxt', 'np.genf...
''' a simple script for generating uniform randoms and jackknife regions assuming the KiDS-1000 mask ''' import fitsio import numpy as np import healpy as hp import kmeans_radec from kmeans_radec import KMeans, kmeans_sample from astropy.table import Table lens = fitsio.read("lens.fits", columns = ["ra_gal", "dec_gal...
[ "astropy.table.Table", "fitsio.read", "numpy.vstack", "numpy.savetxt", "numpy.random.uniform", "kmeans_radec.kmeans_sample" ]
[((266, 351), 'fitsio.read', 'fitsio.read', (['"""lens.fits"""'], {'columns': "['ra_gal', 'dec_gal', 'observed_redshift_gal']"}), "('lens.fits', columns=['ra_gal', 'dec_gal', 'observed_redshift_gal']\n )\n", (277, 351), False, 'import fitsio\n'), ((464, 493), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(3...
if True: import numpy as np d = 3 K = 50 N = 10 ** 6 a = np.zeros(3) b = np.ones(3) orders = np.array([K for i in range(d)]) coeffs = np.random.random([k + 2 for k in orders]) points = np.random.random((N, d)) # each line is a vector points_c = points.T.copy() # each column i...
[ "numpy.ones", "numpy.random.random", "eval_cubic_splines_cython.vec_eval_cubic_spline_3", "numpy.zeros", "time.time" ]
[((79, 90), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (87, 90), True, 'import numpy as np\n'), ((99, 109), 'numpy.ones', 'np.ones', (['(3)'], {}), '(3)\n', (106, 109), True, 'import numpy as np\n'), ((168, 211), 'numpy.random.random', 'np.random.random', (['[(k + 2) for k in orders]'], {}), '([(k + 2) for k in...
import numpy as np import matplotlib.pyplot as plt from matplotlib import patches def get_ellipse_params(rho,M): """ Returns ellipse params (excl center point) """ #eigenvalue decomposition to get the axes w,v=np.linalg.eigh(M/rho) try: #let the smaller eigenvalue define the width (m...
[ "matplotlib.pyplot.savefig", "numpy.sqrt", "numpy.max", "numpy.arctan2", "numpy.linalg.eigh", "matplotlib.patches.Ellipse", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((232, 255), 'numpy.linalg.eigh', 'np.linalg.eigh', (['(M / rho)'], {}), '(M / rho)\n', (246, 255), True, 'import numpy as np\n'), ((925, 1026), 'matplotlib.patches.Ellipse', 'patches.Ellipse', (['(px, py)', 'w', 'h', 'a'], {'alpha': 'alpha_val', 'ec': 'linec', 'facecolor': 'facec', 'linestyle': 'linest'}), '((px, py)...
import cv2 import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from google.colab.patches import cv2_imshow from tensorflow.keras.applications import * from tensorflow.keras.layers import * from tensorflow.keras.models import * from math import * import glob import os import time from ...
[ "tensorflow.keras.preprocessing.image.load_img", "numpy.reshape", "cv2.ximgproc.createStructuredEdgeDetection", "tensorflow.keras.applications.vgg16.preprocess_input", "cv2.cvtColor", "tensorflow.keras.preprocessing.image.img_to_array", "cv2.ximgproc.createEdgeBoxes", "cv2.resize", "cv2.imread", "...
[((882, 898), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (892, 898), False, 'import cv2\n'), ((907, 949), 'cv2.resize', 'cv2.resize', (['im', '(800, 800)', 'cv2.INTER_AREA'], {}), '(im, (800, 800), cv2.INTER_AREA)\n', (917, 949), False, 'import cv2\n'), ((955, 990), 'cv2.cvtColor', 'cv2.cvtColor', (['im', ...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from config import gamma, lr def flat_grad(grads): grad_flatten = [] for grad in grads: grad_flatten.append(grad.view(-1)) grad_flatten = torch.cat(grad_flatten) return grad_flatten def flat_hessian(hessians...
[ "torch.log", "numpy.random.choice", "torch.stack", "torch.Tensor", "torch.nn.Linear", "torch.nn.init.xavier_uniform", "torch.zeros_like", "torch.cat", "torch.dot" ]
[((246, 269), 'torch.cat', 'torch.cat', (['grad_flatten'], {}), '(grad_flatten)\n', (255, 269), False, 'import torch\n'), ((667, 684), 'torch.cat', 'torch.cat', (['params'], {}), '(params)\n', (676, 684), False, 'import torch\n'), ((1921, 1936), 'torch.dot', 'torch.dot', (['r', 'r'], {}), '(r, r)\n', (1930, 1936), Fals...
from numpy.random import randint def find_sum(a_list, target): r = [] sz = len(a_list) for i in range(sz): for j in range(i+1, sz): if (a_list[i] + a_list[j]) == target: r.append((a_list[i], a_list[j])) return r def fast_sum(a_list, target): r = [] h = {} ...
[ "numpy.random.randint" ]
[((482, 501), 'numpy.random.randint', 'randint', (['(0)', '(100)', '(20)'], {}), '(0, 100, 20)\n', (489, 501), False, 'from numpy.random import randint\n'), ((515, 527), 'numpy.random.randint', 'randint', (['(100)'], {}), '(100)\n', (522, 527), False, 'from numpy.random import randint\n')]
import os import re import mne import numpy as np class SeegRecording(): def __init__(self, contacts, data, sampling_rate): ''' contacts (list of tuples) is a list of all the contact labels and their corresponding number data (np.ndarr...
[ "numpy.fromfile", "mne.io.read_raw_fif", "re.match", "os.path.splitext", "os.path.isfile", "numpy.linspace", "mne.io.read_raw_edf" ]
[((1067, 1136), 'numpy.linspace', 'np.linspace', (['(0)', '((nsamples - 1) * (1.0 / self.sampling_rate))', 'nsamples'], {}), '(0, (nsamples - 1) * (1.0 / self.sampling_rate), nsamples)\n', (1078, 1136), True, 'import numpy as np\n'), ((1725, 1749), 'os.path.isfile', 'os.path.isfile', (['bad_file'], {}), '(bad_file)\n',...
# -*- coding: utf-8 -*- """ Created on Wed Nov 16 15:31:16 2016 @author: shaw """ import xlrd import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, FormatStrFormatter import numpy as np from pylab import * from itertools import product from matplotlib.colors import LogNorm #impo...
[ "numpy.mat", "matplotlib.ticker.MultipleLocator", "matplotlib.pyplot.gca", "xlrd.open_workbook", "numpy.array", "numpy.dot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.xlim" ]
[((2998, 3009), 'numpy.array', 'np.array', (['t'], {}), '(t)\n', (3006, 3009), True, 'import numpy as np\n'), ((3082, 3107), 'xlrd.open_workbook', 'xlrd.open_workbook', (['path1'], {}), '(path1)\n', (3100, 3107), False, 'import xlrd\n'), ((3122, 3147), 'xlrd.open_workbook', 'xlrd.open_workbook', (['path2'], {}), '(path...
from __future__ import print_function import sys, random, json, os, tempfile from collections import Counter import numpy as np INSIDE_BLENDER = True try: import bpy from mathutils import Vector except ImportError as e: INSIDE_BLENDER = False if INSIDE_BLENDER: try: import utils except ImportError as e: ...
[ "utils.add_material", "utils.get_camera_coords", "numpy.array", "sys.exit", "bpy.data.images.load", "utils.set_layer", "os.remove", "mathutils.Vector", "utils.delete_object", "bpy.ops.wm.open_mainfile", "utils.load_materials", "bpy.ops.mesh.primitive_plane_add", "utils.add_object", "bpy.op...
[((982, 1042), 'bpy.ops.wm.open_mainfile', 'bpy.ops.wm.open_mainfile', ([], {'filepath': 'args.base_scene_blendfile'}), '(filepath=args.base_scene_blendfile)\n', (1006, 1042), False, 'import bpy\n'), ((1065, 1104), 'utils.load_materials', 'utils.load_materials', (['args.material_dir'], {}), '(args.material_dir)\n', (10...
""" Renders the animation into a list of frames """ __all__ = ['OpenCvRenderer', 'FileRenderer'] from dataclasses import dataclass import cv2 import imageio as iio import numpy as np from .animation import Frame, Animation ESC = 27 @dataclass class Options: brightness: int = 100 cutoff: int = 0 @datacla...
[ "numpy.clip", "cv2.destroyWindow", "numpy.array", "cv2.getWindowProperty", "imageio.mimsave", "cv2.resize", "cv2.waitKey", "cv2.namedWindow" ]
[((609, 644), 'numpy.clip', 'np.clip', (['buffer', '(0)', '(255)'], {'out': 'buffer'}), '(buffer, 0, 255, out=buffer)\n', (616, 644), True, 'import numpy as np\n'), ((1002, 1087), 'cv2.resize', 'cv2.resize', (['self.buffer', '(w * scale, h * scale)'], {'interpolation': 'cv2.INTER_NEAREST'}), '(self.buffer, (w * scale, ...
import os import random import numpy as np import cv2 from lxml import etree def mkdir(path): if not os.path.exists(path): os.makedirs(path) def object_random(objects): """ random choice the object :param objects: ['object1','object2',...] :return: 'object3' """ return random.choi...
[ "lxml.etree.Element", "cv2.imwrite", "os.path.exists", "random.choice", "cv2.warpAffine", "lxml.etree.SubElement", "lxml.etree.ElementTree", "os.makedirs", "os.path.join", "numpy.max", "cv2.addWeighted", "numpy.zeros", "numpy.min", "cv2.getRotationMatrix2D", "random.random", "random.ra...
[((309, 331), 'random.choice', 'random.choice', (['objects'], {}), '(objects)\n', (322, 331), False, 'import random\n'), ((572, 615), 'numpy.zeros', 'np.zeros', (['[rows, cols, chunnel]', 'img1.dtype'], {}), '([rows, cols, chunnel], img1.dtype)\n', (580, 615), True, 'import numpy as np\n'), ((663, 704), 'cv2.addWeighte...
from __future__ import division from __future__ import print_function import os import glob import time import random import argparse import numpy as np import torch import torchvision.models as models import torch.autograd.profiler as profiler import torch.nn as nn import torch.nn.functional as F import torch.optim a...
[ "torch.manual_seed", "utils.load_data", "argparse.ArgumentParser", "torch.nn.functional.nll_loss", "utils.accuracy", "torch.load", "time.perf_counter", "random.seed", "torch.autograd.profiler.profile", "torch.cuda.is_available", "torch.autograd.profiler.record_function", "numpy.random.seed", ...
[((464, 489), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (487, 489), False, 'import argparse\n'), ((1894, 1916), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (1905, 1916), False, 'import random\n'), ((1917, 1942), 'numpy.random.seed', 'np.random.seed', (['args.seed'],...
import numpy as np import logging import random def open_stl(filename): count = 0 with open(filename) as f: for line in f: count += 1 logging.info("number of lines {}".format(count)) tri_count = (count - 2) / 7 logging.info("number of triangles {}".format(tri_count)...
[ "random.random", "numpy.zeros", "mayavi.mlab.show" ]
[((431, 455), 'numpy.zeros', 'np.zeros', (['(tri_count, 3)'], {}), '((tri_count, 3))\n', (439, 455), True, 'import numpy as np\n'), ((465, 489), 'numpy.zeros', 'np.zeros', (['(tri_count, 3)'], {}), '((tri_count, 3))\n', (473, 489), True, 'import numpy as np\n'), ((499, 523), 'numpy.zeros', 'np.zeros', (['(tri_count, 3)...
import sys sys.path.append('../lib') import exchange import datetime import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.stats import norm def transition_probabilities(chain, offset=1): states = np.array([s for s in set(chain)]) state_space = {s: i for i, s in enumerate(st...
[ "datetime.datetime", "numpy.mean", "numpy.diff", "numpy.sum", "numpy.zeros", "matplotlib.pyplot.figure", "exchange.Exchange", "scipy.stats.norm.pdf", "numpy.concatenate", "pandas.DataFrame", "datetime.timedelta", "sys.path.append", "matplotlib.pyplot.show" ]
[((11, 36), 'sys.path.append', 'sys.path.append', (['"""../lib"""'], {}), "('../lib')\n", (26, 36), False, 'import sys\n'), ((351, 395), 'numpy.zeros', 'np.zeros', (['(states.shape[0], states.shape[0])'], {}), '((states.shape[0], states.shape[0]))\n', (359, 395), True, 'import numpy as np\n'), ((789, 827), 'exchange.Ex...
import numpy as np import math from pyspark.sql import Row """ Implementation of Lorentz vector """ class LorentzVector(object): def __init__(self, *args): if len(args)>0: self.x = args[0] self.y = args[1] self.z = args[2] self.t = args[3] def SetPt...
[ "math.sqrt", "numpy.asarray", "math.log", "math.cos", "math.atan2", "math.sin", "math.sinh" ]
[((1956, 1973), 'numpy.asarray', 'np.asarray', (['pTmap'], {}), '(pTmap)\n', (1966, 1973), True, 'import numpy as np\n'), ((2141, 2158), 'numpy.asarray', 'np.asarray', (['pTmap'], {}), '(pTmap)\n', (2151, 2158), True, 'import numpy as np\n'), ((2322, 2339), 'numpy.asarray', 'np.asarray', (['pTmap'], {}), '(pTmap)\n', (...
import pytest, warnings, numpy as np from sequentia.classifiers import _Topology, _LeftRightTopology, _ErgodicTopology, _LinearTopology from ....support import assert_equal, assert_all_equal, assert_distribution # Set seed for reproducible randomness seed = 0 np.random.seed(seed) rng = np.random.RandomState(seed) # =...
[ "sequentia.classifiers._Topology", "sequentia.classifiers._LinearTopology", "pytest.warns", "sequentia.classifiers._LeftRightTopology", "numpy.array", "pytest.raises", "numpy.random.seed", "numpy.random.RandomState", "sequentia.classifiers._ErgodicTopology" ]
[((261, 281), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (275, 281), True, 'import pytest, warnings, numpy as np\n'), ((288, 315), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (309, 315), True, 'import pytest, warnings, numpy as np\n'), ((594, 633), 'sequentia...
# https://arxiv.org/pdf/1703.02910.pdf, Deep Bayesian Active Learning with Image Data import numpy as np from .baseline import Strategy from ..helpers.time import timeit class BayesianActiveLearning(Strategy): def __init__(self, nb_forward=10, **kwargs): super(BayesianActiveLearning, self).__init__() ...
[ "numpy.argsort", "numpy.mean", "numpy.zeros", "numpy.log" ]
[((828, 846), 'numpy.argsort', 'np.argsort', (['scores'], {}), '(scores)\n', (838, 846), True, 'import numpy as np\n'), ((1190, 1228), 'numpy.mean', 'np.mean', (['stacked_probabilities'], {'axis': '(0)'}), '(stacked_probabilities, axis=0)\n', (1197, 1228), True, 'import numpy as np\n'), ((1251, 1267), 'numpy.zeros', 'n...
import torch from torchvision.utils import make_grid import numpy as np from base import BaseTrainer from models import Generator, Discriminator from losses import * from data_loaders import CartoonDataLoader from utils import MetricTracker class ExpnameTrainer(BaseTrainer): def __init__(self, config): su...
[ "numpy.mean", "numpy.sqrt", "models.Generator", "torch.load", "data_loaders.CartoonDataLoader", "torch.nn.DataParallel", "models.Discriminator", "utils.MetricTracker", "torch.save", "torch.no_grad" ]
[((1475, 1689), 'data_loaders.CartoonDataLoader', 'CartoonDataLoader', ([], {'data_dir': 'self.config.data_dir', 'src_style': '"""real"""', 'tar_style': 'self.config.tar_style', 'batch_size': 'self.config.batch_size', 'image_size': 'self.config.image_size', 'num_workers': 'self.config.num_workers'}), "(data_dir=self.co...
# Copyright 2013-2021 The Salish Sea MEOPAR contributors # and The University of British Columbia # # 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/...
[ "numpy.ma.masked_values", "types.SimpleNamespace", "matplotlib.pyplot.colorbar", "numpy.ma.masked_where", "matplotlib.pyplot.figure", "matplotlib.gridspec.GridSpec", "salishsea_tools.visualisations.contour_thalweg", "salishsea_tools.viz_tools.set_aspect", "numpy.arange" ]
[((4625, 4687), 'numpy.ma.masked_where', 'np.ma.masked_where', (["(mesh_mask['tmask'][0, ...] == 0)", 'tracer_hr'], {}), "(mesh_mask['tmask'][0, ...] == 0, tracer_hr)\n", (4643, 4687), True, 'import numpy as np\n'), ((5016, 5224), 'types.SimpleNamespace', 'SimpleNamespace', ([], {'tracer_var': 'tracer_var', 'tracer_hr'...
#!/usr/bin/env python 3.6 # -*- coding: utf-8 -*- """ Created on Saturdau Sep 16 16:58:58 2017 @author: Hans - Clรฉment - Ali """ #----------Import_module----------- import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.model_selection impo...
[ "numpy.mean", "matplotlib.pyplot.title", "configparser.ConfigParser", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.colorbar", "numpy.asarray", "sklearn.neighbors.KNeighborsClassifier", "numpy.array", "numpy.zeros", "pandas.read_table", ...
[((2982, 3001), 'configparser.ConfigParser', 'conf.ConfigParser', ([], {}), '()\n', (2999, 3001), True, 'import configparser as conf\n'), ((3126, 3174), 'pandas.read_table', 'pd.read_table', (['"""../data/xtrain.txt"""'], {'header': 'None'}), "('../data/xtrain.txt', header=None)\n", (3139, 3174), True, 'import pandas a...
import sox import numpy as np import argparse import os parser = argparse.ArgumentParser() parser.add_argument("--input", help="input file name") args = parser.parse_args() print(args.input) np1 = np.arange(start=-1.0, stop=1.1, step=0.10) np2 = np.arange(start=0.9, stop=1.11, step=0.01) np3 = np.arange(start=0.9...
[ "sox.Transformer", "argparse.ArgumentParser", "os.system", "numpy.arange", "numpy.random.shuffle" ]
[((66, 91), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (89, 91), False, 'import argparse\n'), ((203, 244), 'numpy.arange', 'np.arange', ([], {'start': '(-1.0)', 'stop': '(1.1)', 'step': '(0.1)'}), '(start=-1.0, stop=1.1, step=0.1)\n', (212, 244), True, 'import numpy as np\n'), ((252, 294), ...
""" Overall test for the PYGA framework""" from src.ga import GA import numpy as np TEST_CONFIGURATION = { "generation_size": 100, "iterate_evolution": True, "max_fitness": 0.99, "display_info": False, } def give_score(weights) -> float: """ Higher weights give higher fitness """ return np.m...
[ "numpy.mean", "src.ga.GA" ]
[((346, 393), 'src.ga.GA', 'GA', ([], {'_num_weights': '(5)', 'fitness_function': 'give_score'}), '(_num_weights=5, fitness_function=give_score)\n', (348, 393), False, 'from src.ga import GA\n'), ((316, 332), 'numpy.mean', 'np.mean', (['weights'], {}), '(weights)\n', (323, 332), True, 'import numpy as np\n'), ((487, 50...
import numpy import torch from torch_rl.algos.base import BaseAlgo class I2Algorithm(BaseAlgo): def __init__(self, environment_class, n_processes=16, seed=1, acmodel=None, num_frames_per_proc=None, discount=0.99, lr=7e-4, gae_lambda=0.95, entropy_coef=0.01, value_loss_coef=0.5, max_grad_norm=0.5...
[ "numpy.arange" ]
[((3872, 3921), 'numpy.arange', 'numpy.arange', (['(0)', 'self.num_frames', 'self.recurrence'], {}), '(0, self.num_frames, self.recurrence)\n', (3884, 3921), False, 'import numpy\n')]
import pygame from pygame.locals import * from sys import exit from PIL import Image from PID import execute_PID import numpy as np # Global Variables larg = 1000.0 alt = 640.0 global position_, angle_, velocidade position_ = 0 angle_ = 0 velocidade = 0 class Screen: def __init__(self, larg, alt, bg_image): pygam...
[ "numpy.abs", "PIL.Image.open", "sys.exit", "pygame.init", "pygame.quit", "pygame.event.get", "pygame.display.set_mode", "pygame.mouse.get_pos", "pygame.time.Clock", "pygame.transform.rotate", "numpy.array", "pygame.key.get_pressed", "pygame.display.set_caption", "pygame.image.load", "pyg...
[((315, 328), 'pygame.init', 'pygame.init', ([], {}), '()\n', (326, 328), False, 'import pygame\n'), ((353, 404), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Simulador 2D de Drone"""'], {}), "('Simulador 2D de Drone')\n", (379, 404), False, 'import pygame\n'), ((478, 531), 'pygame.image.load', 'py...
import os import math import numpy as np from skimage import transform, io from PIL import Image import os Image.MAX_IMAGE_PIXELS = None root_path = r'X:\test_image\output' image_name = 'mask.tiff' output_name = 'new_heatmap.tiff' img_path = os.path.join(root_path, image_name) output_path = os.path.join(root_path, ou...
[ "os.path.join", "numpy.stack", "numpy.zeros", "skimage.io.imread", "skimage.io.imsave", "numpy.linalg.norm" ]
[((244, 279), 'os.path.join', 'os.path.join', (['root_path', 'image_name'], {}), '(root_path, image_name)\n', (256, 279), False, 'import os\n'), ((294, 330), 'os.path.join', 'os.path.join', (['root_path', 'output_name'], {}), '(root_path, output_name)\n', (306, 330), False, 'import os\n'), ((1533, 1563), 'skimage.io.im...
import gsum as gm import numpy as np from numpy import ndarray import matplotlib.pyplot as plt from matplotlib.patches import Patch import matplotlib.patches as mpatches from matplotlib.patches import Ellipse from matplotlib.legend_handler import HandlerPatch from matplotlib.legend import Legend from matplotlib.ticker ...
[ "seaborn.utils.despine", "matplotlib.pyplot.rc_context", "numpy.log", "numpy.column_stack", "numpy.isin", "matplotlib.ticker.MaxNLocator", "numpy.cov", "numpy.arange", "numpy.exp", "numpy.concatenate", "warnings.warn", "matplotlib.cm.get_cmap", "matplotlib.pyplot.gca", "matplotlib.pyplot.g...
[((768, 795), 'docrep.DocstringProcessor', 'docrep.DocstringProcessor', ([], {}), '()\n', (793, 795), False, 'import docrep\n'), ((2330, 2371), 'numpy.trapz', 'np.trapz', (['posterior_2d'], {'x': 'lengths', 'axis': '(0)'}), '(posterior_2d, x=lengths, axis=0)\n', (2338, 2371), True, 'import numpy as np\n'), ((2393, 2430...
# Standard imports import keras as k import tensorflow as tf import numpy as np """ NOTE: All functions in this file are directly adopted from continuum mechanics fundamentals and hence do not need further introduction. In order to not inflate this file unnecessarily with comments (and sacrificing readability), we...
[ "numpy.sqrt", "tensorflow.shape", "tensorflow.transpose", "tensorflow.math.subtract", "numpy.arccos", "tensorflow.linalg.inv", "tensorflow.math.divide", "tensorflow.gradients", "numpy.sin", "tensorflow.keras.backend.expand_dims", "tensorflow.eye", "numpy.multiply", "tensorflow.concat", "te...
[((4611, 4651), 'tensorflow.linalg.matmul', 'tf.linalg.matmul', (['F', 'F'], {'transpose_a': '(True)'}), '(F, F, transpose_a=True)\n', (4627, 4651), True, 'import tensorflow as tf\n'), ((5108, 5144), 'tensorflow.keras.backend.expand_dims', 'tf.keras.backend.expand_dims', (['dir', '(3)'], {}), '(dir, 3)\n', (5136, 5144)...
#------------------------------------------------------------------------------ # IMPORT NECESSARY MODULES #------------------------------------------------------------------------------ print (' ABOUT to Start Simulation:- Importing Modules') import anuga, anuga.parallel, numpy, time, os, glob from anuga.operat...
[ "anuga.Domain", "anuga.Reflective_boundary", "anuga.parallel.parallel_operator_factory.Boyd_pipe_operator", "numpy.array", "anuga.parallel.Inlet_operator", "anuga.create_mesh_from_regions", "time.time", "anuga.Dirichlet_boundary" ]
[((1311, 1508), 'anuga.create_mesh_from_regions', 'create_mesh_from_regions', (['bounding_polygon'], {'boundary_tags': "{'south': [0], 'east': [1], 'north': [2], 'west': [3]}", 'maximum_triangle_area': '(1.0)', 'filename': 'meshname', 'use_cache': '(False)', 'verbose': '(True)'}), "(bounding_polygon, boundary_tags={'so...
import unittest import numpy as np from mlscratch.models import losses class TestBinaryCrossEntropy(unittest.TestCase): def setUp(self): self.y_true = np.array([0, 1, 0.5]) self.y_pred = np.array([0, 1, 0.5]) def test_return(self): bce = losses.binary_cross_entropy(self.y_true, sel...
[ "mlscratch.models.losses.binary_cross_entropy", "numpy.array", "mlscratch.models.losses.mean_squared_error" ]
[((168, 189), 'numpy.array', 'np.array', (['[0, 1, 0.5]'], {}), '([0, 1, 0.5])\n', (176, 189), True, 'import numpy as np\n'), ((212, 233), 'numpy.array', 'np.array', (['[0, 1, 0.5]'], {}), '([0, 1, 0.5])\n', (220, 233), True, 'import numpy as np\n'), ((276, 329), 'mlscratch.models.losses.binary_cross_entropy', 'losses....
import torch import numpy as np class ToTensorGjz(object): def __call__(self, pic): img = torch.from_numpy(pic.transpose((2, 0, 1))) return img.float() def __repr__(self): return self.__class__.__name__ + '()' class NormalizeGjz(object): def __init__(self, mean, std): self...
[ "numpy.zeros" ]
[((638, 675), 'numpy.zeros', 'np.zeros', (['(dh, dw, 3)'], {'dtype': 'np.uint8'}), '((dh, dw, 3), dtype=np.uint8)\n', (646, 675), True, 'import numpy as np\n'), ((700, 734), 'numpy.zeros', 'np.zeros', (['(dh, dw)'], {'dtype': 'np.uint8'}), '((dh, dw), dtype=np.uint8)\n', (708, 734), True, 'import numpy as np\n')]
"""Random Forest classification and computation of assessment metrics.""" import numpy as np from imblearn.over_sampling import RandomOverSampler from imblearn.under_sampling import RandomUnderSampler from sklearn import metrics from sklearn.ensemble import RandomForestClassifier from raster import is_raster def tr...
[ "sklearn.metrics.f1_score", "sklearn.metrics.average_precision_score", "sklearn.metrics.precision_recall_curve", "sklearn.ensemble.RandomForestClassifier", "sklearn.metrics.precision_score", "numpy.count_nonzero", "sklearn.metrics.recall_score", "numpy.zeros", "imblearn.over_sampling.RandomOverSampl...
[((713, 768), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n_samples, n_features)', 'dtype': 'np.float'}), '(shape=(n_samples, n_features), dtype=np.float)\n', (721, 768), True, 'import numpy as np\n'), ((1924, 1950), 'numpy.count_nonzero', 'np.count_nonzero', (['training'], {}), '(training)\n', (1940, 1950), True, 'imp...
from collections import deque import pickle import cv2 import numpy as np import time import ast from utils import * import tensorflow_hub as hub import concurrent.futures from tensorflow.keras import layers import tensorflow as tf # Load Yolo net = cv2.dnn.readNet("./data/yolov4-tiny.weights", "./data/yolov4-tiny....
[ "cv2.rectangle", "numpy.sqrt", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "cv2.imshow", "numpy.array", "tensorflow.keras.models.load_model", "cv2.destroyAllWindows", "cv2.dnn.NMSBoxes", "cv2.setMouseCallback", "collections.deque", "cv2.perspectiveTransform", "cv2.waitKey", "c...
[((254, 325), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""./data/yolov4-tiny.weights"""', '"""./data/yolov4-tiny.cfg"""'], {}), "('./data/yolov4-tiny.weights', './data/yolov4-tiny.cfg')\n", (269, 325), False, 'import cv2\n'), ((741, 774), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""vid_short.mp4"""'], {}), "('vid_sho...
# Code made for <NAME> # 12 Abril 2021 # License MIT # Transport Phenomena: Python Program-Assessment 4.3 import matplotlib.pyplot as plt import seaborn as sns import numpy as np from scipy.optimize import minimize sns.set() # Solve for Temperature of Steam at given Pressure class enviroment_convective: def tem...
[ "numpy.log", "seaborn.set", "scipy.optimize.minimize" ]
[((217, 226), 'seaborn.set', 'sns.set', ([], {}), '()\n', (224, 226), True, 'import seaborn as sns\n'), ((4244, 4358), 'scipy.optimize.minimize', 'minimize', (['Opt.objective_T', 'x0'], {'method': '"""SLSQP"""', 'args': 'arguments', 'constraints': 'constraint', 'options': "{'maxiter': 5}"}), "(Opt.objective_T, x0, meth...
import cv2 import numpy as np from shapes import Myinit class Triangle(Myinit): def __init__(self): super(Triangle, self).__init__() self.vertices = np.array([[100,50], [150,150], [50,150]],np.int32) self.vertices = self.vertices.reshape((-1, 1, 2)) self.color=(255,0,255) ...
[ "cv2.fillPoly", "cv2.polylines", "cv2.imshow", "numpy.array", "cv2.destroyAllWindows", "cv2.waitKey" ]
[((177, 231), 'numpy.array', 'np.array', (['[[100, 50], [150, 150], [50, 150]]', 'np.int32'], {}), '([[100, 50], [150, 150], [50, 150]], np.int32)\n', (185, 231), True, 'import numpy as np\n'), ((368, 426), 'cv2.polylines', 'cv2.polylines', (['self.img', '[self.vertices]', '(True)', 'self.color'], {}), '(self.img, [sel...
import numpy as np class vents: def __init__(self, segments): self.segments = segments (self.maxx, self.maxy) = self._getmaxxy() self.board = np.zeros((self.maxx+1, self.maxy+1), dtype=int) def _getmaxxy(self): allxs = [x[0] for x in self.segments] allxs.extend([x[2] ...
[ "numpy.count_nonzero", "numpy.zeros", "numpy.transpose" ]
[((172, 223), 'numpy.zeros', 'np.zeros', (['(self.maxx + 1, self.maxy + 1)'], {'dtype': 'int'}), '((self.maxx + 1, self.maxy + 1), dtype=int)\n', (180, 223), True, 'import numpy as np\n'), ((1697, 1729), 'numpy.count_nonzero', 'np.count_nonzero', (['(self.board > 1)'], {}), '(self.board > 1)\n', (1713, 1729), True, 'im...
# This is used for testing Fine Tune Hyper-Parameters from datetime import datetime import itertools import json import matplotlib.pyplot as plt import numpy as np from keras.callbacks import ModelCheckpoint from keras.wrappers.scikit_learn import KerasClassifier from keras_preprocessing.sequence import pad_sequences ...
[ "pandas.read_csv", "matplotlib.pyplot.ylabel", "keras.layers.GlobalMaxPooling1D", "keras.utils.to_categorical", "keras.layers.Dense", "matplotlib.pyplot.imshow", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.style.use", "matplotlib.pyplot.yticks", "joblib.dump", "mat...
[((670, 701), 'pandas.read_csv', 'pd.read_csv', (['"""../data/test.csv"""'], {}), "('../data/test.csv')\n", (681, 701), True, 'import pandas as pd\n'), ((713, 755), 'pandas.read_csv', 'pd.read_csv', (['"""../data/kata_dasar_kbbi.csv"""'], {}), "('../data/kata_dasar_kbbi.csv')\n", (724, 755), True, 'import pandas as pd\...
# -*- coding: utf-8 -*- # Copyright 2017 Interstellar Technologies Inc. All Rights Reserved. from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from OpenGoddard.optimize import Problem, Guess, Condition, Dynamics class Rocket: g0 = 1.0 # Gravity at surface [-] def __in...
[ "OpenGoddard.optimize.Guess.cubic", "matplotlib.pyplot.grid", "matplotlib.pyplot.savefig", "OpenGoddard.optimize.Problem", "numpy.sqrt", "OpenGoddard.optimize.Guess.linear", "matplotlib.pyplot.ylabel", "OpenGoddard.optimize.Dynamics", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplo...
[((2361, 2377), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (2370, 2377), True, 'import matplotlib.pyplot as plt\n'), ((2636, 2698), 'OpenGoddard.optimize.Problem', 'Problem', (['time_init', 'n', 'num_states', 'num_controls', 'max_iteration'], {}), '(time_init, n, num_states, num_controls,...
import os import re import json from os.path import expanduser import zipfile import datetime import tensorflow as tf import numpy as np from utils import mkdir_p from inoutdoor_dataset_download import InoutdoorDatasetDownload from inoutdoor_versions import * from tf_features import * from PIL import Image class In...
[ "zipfile.ZipFile", "re.compile", "utils.mkdir_p", "tensorflow.compat.as_bytes", "os.remove", "re.search", "os.path.exists", "os.listdir", "tensorflow.train.Example", "tensorflow.Session", "numpy.asarray", "os.path.isdir", "tensorflow.python_io.TFRecordWriter", "os.path.expanduser", "tens...
[((1270, 1312), 'os.listdir', 'os.listdir', (['self.image_set_definition_path'], {}), '(self.image_set_definition_path)\n', (1280, 1312), False, 'import os\n'), ((1958, 1989), 'os.path.exists', 'os.path.exists', (['self.input_path'], {}), '(self.input_path)\n', (1972, 1989), False, 'import os\n'), ((2372, 2416), 'os.pa...
import numpy as np from arbol import aprint from dexp.processing.utils.scatter_gather_i2v import scatter_gather_i2v from dexp.utils.backends import Backend from dexp.utils.testing.testing import execute_both_backends from dexp.utils.timeit import timeit @execute_both_backends def test_scatter_gather_i2v(ndim=3, leng...
[ "dexp.utils.backends.Backend.get_xp_module", "numpy.random.default_rng", "dexp.utils.backends.Backend.to_numpy", "arbol.aprint", "dexp.processing.utils.scatter_gather_i2v.scatter_gather_i2v", "dexp.utils.timeit.timeit" ]
[((351, 374), 'dexp.utils.backends.Backend.get_xp_module', 'Backend.get_xp_module', ([], {}), '()\n', (372, 374), False, 'from dexp.utils.backends import Backend\n'), ((385, 408), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (406, 408), True, 'import numpy as np\n'), ((1079, 1104), 'dexp.utils...
import argparse import copy import datetime import gym import numpy as np import itertools import torch import csv import os import json from plane_env import Plane from sac import SAC from verify import verify_models, generate_agent_simulator from torch.utils.tensorboard import SummaryWriter from replay_memory import ...
[ "torch.manual_seed", "verify.generate_agent_simulator", "argparse.ArgumentParser", "verify.verify_models", "plane_env.Plane", "datetime.datetime.now", "itertools.count", "numpy.random.seed", "os.mkdir", "sac.SAC", "replay_memory.ReplayMemory" ]
[((343, 412), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Soft Actor-Critic Args"""'}), "(description='PyTorch Soft Actor-Critic Args')\n", (366, 412), False, 'import argparse\n'), ((3258, 3265), 'plane_env.Plane', 'Plane', ([], {}), '()\n', (3263, 3265), False, 'from plane_en...
#!/usr/bin/env python2.7 # Run as: # python setup.py install --user # -- Standard boilerplate header - begin import unittest as ut import sys, os from os.path import abspath, dirname from os.path import join as osjoin cdir = dirname(abspath(__file__)) # sys.argv[0])) = # testdir pdir = dirname(cdir) ...
[ "pandas.Series", "sys.path.insert", "numpy.random.rand", "pandas.DataFrame", "os.path.join", "pandas.DataFrame.from_dict", "os.path.dirname", "numpy.array", "pandas.to_numeric", "testutils.run_tests", "os.path.abspath", "numpy.matrix" ]
[((291, 304), 'os.path.dirname', 'dirname', (['cdir'], {}), '(cdir)\n', (298, 304), False, 'from os.path import abspath, dirname\n'), ((331, 351), 'os.path.join', 'osjoin', (['pdir', '"""mhut"""'], {}), "(pdir, 'mhut')\n", (337, 351), True, 'from os.path import join as osjoin\n'), ((352, 378), 'sys.path.insert', 'sys.p...
import pygame from pygame.locals import * import cv2 import numpy as np import sys import os from time import sleep import random import tensorflow as tf from utils import visualization_utils as viz_utils class RockPaperScissors(): def __init__(self): pygame.init() # TENSORFLOW MODEL self.detect_fn = tf.sav...
[ "pygame.init", "pygame.quit", "numpy.array", "cv2.destroyAllWindows", "numpy.rot90", "sys.exit", "pygame.font.Font", "pygame.surfarray.make_surface", "pygame.transform.scale", "tensorflow.saved_model.load", "pygame.time.get_ticks", "pygame.display.set_mode", "pygame.image.load", "pygame.di...
[((257, 270), 'pygame.init', 'pygame.init', ([], {}), '()\n', (268, 270), False, 'import pygame\n'), ((314, 404), 'tensorflow.saved_model.load', 'tf.saved_model.load', (['"""../tensorflow_object_detection_api/inference_graph/saved_model"""'], {}), "(\n '../tensorflow_object_detection_api/inference_graph/saved_model'...
""" This module contains the World class. """ from copy import deepcopy import numpy as np from models.object import Window class World: """ Contains all objects that are supposed to be drawn in the viewport. In this class comments, the actual slice of the world that is being shown, is r...
[ "numpy.negative", "models.object.Window", "copy.deepcopy" ]
[((1017, 1040), 'copy.deepcopy', 'deepcopy', (['self._objects'], {}), '(self._objects)\n', (1025, 1040), False, 'from copy import deepcopy\n'), ((618, 638), 'models.object.Window', 'Window', (['*window_size'], {}), '(*window_size)\n', (624, 638), False, 'from models.object import Window\n'), ((1267, 1301), 'numpy.negat...
import numpy as np ''' !! ๊ธฐ๋ณธ์ ์ธ ๊ฐœ๋… 1์ฐจ์› = ๋ฒกํ„ฐ 2์ฐจ์› = ํ–‰๋ ฌ 3์ฐจ์› = ํ…์„œ 4์ฐจ์› ๋ถ€ํ„ฐ๋Š” ์šฐ๋ฆฌ๋Š” 3์ฐจ์›์˜ ์„ธ์ƒ์—์„œ ์‚ด๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— 4์ฐจ์› ์ด์ƒ๋ถ€ํ„ฐ๋Š” ๋จธ๋ฆฌ๋กœ ์ƒ๊ฐํ•˜๊ธฐ ์–ด๋ ต๋‹ค. 2์ฐจ์› ํ…์„œ 2์ฐจ์› ํ…์„œ๋ฅผ ํ–‰๋ ฌ์ด๋ผ๊ณ  ๋งํ•œ๋‹ค. |t| = (batch size, dim) batch size = "ํ–‰" / dim = "์—ด" 3์ฐจ์› ํ…์„œ 3์ฐจ์› ํ…์„œ๋Š” ๊ทธ๋ƒฅ ํ…์„œ๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค. |t| = (batch size, width, height) batch size = "์„ธ๋กœ" / width = "๊ฐ€๋กœ" / height = "๋†’์ด" (์ž…์ฒด์ ์ธ ๋ถ€๋ถ„) ...
[ "torch.ones_like", "torch.stack", "numpy.array", "torch.zeros_like", "torch.FloatTensor", "torch.cat" ]
[((342, 387), 'numpy.array', 'np.array', (['[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]'], {}), '([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0])\n', (350, 387), True, 'import numpy as np\n'), ((641, 700), 'numpy.array', 'np.array', (['[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9]]'], {}), '([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8....