code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# Copyright 2019 The Dreamer Authors. Copyright 2020 Plan2Explore 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...
[ "numpy.stack", "numpy.array", "tensorflow.py_func" ]
[((1506, 1575), 'tensorflow.py_func', 'tf.py_func', (['self._batch_env.step', '[action]', 'self._dtypes'], {'name': '"""step"""'}), "(self._batch_env.step, [action], self._dtypes, name='step')\n", (1516, 1575), True, 'import tensorflow as tf\n'), ((1765, 1837), 'tensorflow.py_func', 'tf.py_func', (['self._batch_env.res...
#coding:utf-8 from __future__ import division import torch import torch.optim as optim from adjacency import sparse_mx_to_torch_sparse_tensor from net.gcn_v import GCN_V import yaml from easydict import EasyDict from tensorboardX import SummaryWriter import numpy as np import scipy.sparse as sp import time import pprin...
[ "numpy.load", "numpy.abs", "argparse.ArgumentParser", "numpy.mean", "numpy.linalg.norm", "pprint.pprint", "net.gcn_v.GCN_V", "os.path.join", "numpy.round", "torch.utils.data.DataLoader", "numpy.power", "torch.load", "torch.FloatTensor", "math.cos", "easydict.EasyDict", "scipy.sparse.di...
[((959, 974), 'scipy.sparse.diags', 'sp.diags', (['r_inv'], {}), '(r_inv)\n', (967, 974), True, 'import scipy.sparse as sp\n'), ((2520, 2545), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2543, 2545), False, 'import argparse\n'), ((3104, 3115), 'time.time', 'time.time', ([], {}), '()\n', (31...
import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np # Read in the image image = mpimg.imread('test.jpg') print('This image is: ', type(image), 'with dimensions:', image.shape) # Grab the x and y size and make a copy of the image ysize = image.shape[0] xsize = ima...
[ "matplotlib.image.imread", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.copy", "numpy.polyfit", "matplotlib.pyplot.imshow", "numpy.arange" ]
[((118, 142), 'matplotlib.image.imread', 'mpimg.imread', (['"""test.jpg"""'], {}), "('test.jpg')\n", (130, 142), True, 'import matplotlib.image as mpimg\n'), ((348, 362), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (355, 362), True, 'import numpy as np\n'), ((377, 391), 'numpy.copy', 'np.copy', (['image'], {...
import bs4 as bs import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import numpy as np import os import pandas as pd pd.core.common.is_list_like = pd.api.types.is_list_like import pandas_datareader.data as web import pickle import requests style.use('ggplot') def save_sp500_tickers():...
[ "pandas.DataFrame", "matplotlib.pyplot.tight_layout", "pickle.dump", "matplotlib.pyplot.show", "matplotlib.style.use", "os.makedirs", "pandas.read_csv", "pandas_datareader.data.DataReader", "os.path.exists", "datetime.datetime", "matplotlib.pyplot.figure", "pickle.load", "numpy.arange", "r...
[((273, 292), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (282, 292), False, 'from matplotlib import style\n'), ((332, 404), 'requests.get', 'requests.get', (['"""http://en.wikipedia.org/wiki/List_of_S%26P_500_companies"""'], {}), "('http://en.wikipedia.org/wiki/List_of_S%26P_500_compan...
"""Module for the Risk-Exploiting Circuit Scenario (i.e. Simplified Comm Relay) - Network of agents are to act as a connecition between origin and destination terminals of known (observed). - This is a simplified, surrogate scenario for the more complex communication relay scenario since would be expected to produc...
[ "numpy.random.uniform", "particle_environments.common.delta_vel", "particle_environments.mager.world.HazardousWorld", "particle_environments.common.ResistanceNetwork", "particle_environments.mager.observation.format_observation", "particle_environments.common.distance", "numpy.zeros", "particle_enviro...
[((2935, 2951), 'particle_environments.mager.world.HazardousWorld', 'HazardousWorld', ([], {}), '()\n', (2949, 2951), False, 'from particle_environments.mager.world import MortalAgent, HazardousWorld, RiskRewardLandmark\n'), ((6033, 6066), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(2.0 * np.pi)'], {}), '(0...
# Python implantation of metropolis-hastings sampler for quantum states # The original programs we have modified require the following notice ############################ COPYRIGHT NOTICE ################################# # # Code provided by <NAME> and <NAME>, written by <NAME>, December 2016 # # Permission is grante...
[ "numpy.zeros" ]
[((2918, 2945), 'numpy.zeros', 'np.zeros', (['(self.n_spins, 4)'], {}), '((self.n_spins, 4))\n', (2926, 2945), True, 'import numpy as np\n')]
""" Copyright 2020 ETH Zurich, Secure, Reliable, and Intelligent Systems Lab 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 requi...
[ "numpy.asarray", "deepzono_nodes.remove_dimensions", "time.time", "deepzono_nodes.add_dimensions", "numpy.array", "multiprocessing.Pool" ]
[((6106, 6138), 'numpy.asarray', 'np.asarray', (['lbi'], {'dtype': 'np.double'}), '(lbi, dtype=np.double)\n', (6116, 6138), True, 'import numpy as np\n'), ((6149, 6181), 'numpy.asarray', 'np.asarray', (['ubi'], {'dtype': 'np.double'}), '(ubi, dtype=np.double)\n', (6159, 6181), True, 'import numpy as np\n'), ((6751, 676...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import numpy as np from tensorkit.base import EvaluatorBase def evaluate(sess, input_node, output_node, dataset, stage, eval_list, limit=-1): if limit == -1: limit = len(dataset.labe...
[ "numpy.sum", "numpy.array", "numpy.argmax", "time.time" ]
[((342, 353), 'time.time', 'time.time', ([], {}), '()\n', (351, 353), False, 'import time\n'), ((536, 552), 'numpy.array', 'np.array', (['res[0]'], {}), '(res[0])\n', (544, 552), True, 'import numpy as np\n'), ((566, 582), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (574, 582), True, 'import numpy as np\...
# -*- coding: utf-8 -*- ''' Created on Jul 28 2019 Last large update on Jun 22 2020 @author: <NAME> @supervisor: <NAME> It's (will be) a Python3.6 or higher program that perform massive search and classification of variable stars into VVV data. ''' import os import sys import math import numpy as np import pandas as ...
[ "matplotlib.pyplot.title", "numpy.nanpercentile", "numpy.sum", "pandas.read_csv", "matplotlib.pyplot.bar", "periodogram.Periodogram", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "os.path.join", "sys.path.append", "pandas.DataFrame", "variability_indicator.Variability", "num...
[((816, 886), 'sys.path.append', 'sys.path.append', (['"""/home/botan/OneDrive/Doutorado/VVV_DATA/my_modules/"""'], {}), "('/home/botan/OneDrive/Doutorado/VVV_DATA/my_modules/')\n", (831, 886), False, 'import sys\n'), ((70288, 70339), 'importlib.reload', 'importlib.reload', (["sys.modules['clean_match_tables']"], {}), ...
# coding: utf-8 # In[1]: import datetime import glob import hashlib import multiprocessing as mp import os import queue import random import threading from functools import partial import keras.backend.tensorflow_backend as KTF #import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from keras i...
[ "keras.preprocessing.image.random_shift", "random.sample", "keras.models.Model", "keras.backend.abs", "keras.preprocessing.image.img_to_array", "tensorflow.ConfigProto", "multiprocessing.Queue", "keras.layers.Input", "tensorflow.GPUOptions", "pelops.analysis.camerautil.make_good_bad", "pelops.an...
[((15935, 16011), 'pelops.datasets.veri.VeriDataset', 'VeriDataset', (['"""/local_data/dgrossman/VeRi"""'], {'set_type': 'utils.SetType.TEST.value'}), "('/local_data/dgrossman/VeRi', set_type=utils.SetType.TEST.value)\n", (15946, 16011), False, 'from pelops.datasets.veri import VeriDataset\n'), ((16030, 16107), 'pelops...
import numpy as np from keras.utils import to_categorical def preprocess(dataset): data = np.load(dataset) x = data['x'] y = data['y'] print(x.shape) print(y.shape) sc = 152 st = 44 train_length = int(0.7*x.shape[0]/ (sc+st)) - 1 test_length = int(0.3 * x.shape[0]...
[ "numpy.load", "numpy.zeros", "numpy.savez", "numpy.concatenate", "keras.utils.to_categorical" ]
[((104, 120), 'numpy.load', 'np.load', (['dataset'], {}), '(dataset)\n', (111, 120), True, 'import numpy as np\n'), ((1642, 1664), 'numpy.concatenate', 'np.concatenate', (['trainX'], {}), '(trainX)\n', (1656, 1664), True, 'import numpy as np\n'), ((1679, 1701), 'numpy.concatenate', 'np.concatenate', (['trainY'], {}), '...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of exma (https://github.com/fernandezfran/exma/). # Copyright (c) 2021, <NAME> # License: MIT # Full Text: https://github.com/fernandezfran/exma/blob/master/LICENSE # ============================================================================ # DOCS...
[ "warnings.warn", "numpy.arange" ]
[((4241, 4275), 'numpy.arange', 'np.arange', (['(1)', "(dframe['natoms'] + 1)"], {}), "(1, dframe['natoms'] + 1)\n", (4250, 4275), True, 'import numpy as np\n'), ((2088, 2125), 'numpy.arange', 'np.arange', (['(1)', "(xyz_frame['natoms'] + 1)"], {}), "(1, xyz_frame['natoms'] + 1)\n", (2097, 2125), True, 'import numpy as...
# coding: utf-8 import time import pickle import random import warnings from typing import Dict, List, Tuple import pandas as pd import numpy as np import torch from gym import Env from gym.spaces import Discrete, Space from torch import Tensor from joeynmt.constants import BOS_TOKEN, EOS_TOKEN, UNK_TOKEN from joeynm...
[ "warnings.simplefilter", "torch.LongTensor", "pandas.read_csv", "joeynmt.vocabulary.Vocabulary", "pickle.load", "numpy.array", "warnings.catch_warnings", "pandas.concat" ]
[((411, 442), 'pandas.read_csv', 'pd.read_csv', (['filepath'], {'sep': '"""\t"""'}), "(filepath, sep='\\t')\n", (422, 442), True, 'import pandas as pd\n'), ((2375, 2400), 'joeynmt.vocabulary.Vocabulary', 'Vocabulary', ([], {'tokens': 'tokens'}), '(tokens=tokens)\n', (2385, 2400), False, 'from joeynmt.vocabulary import ...
"""Process A/V dataset.""" import os import os.path as op import time import warnings import numpy as np from scipy import signal, stats import matplotlib.pyplot as plt import openpyxl import pandas as pd with warnings.catch_warnings(record=True): warnings.simplefilter('ignore', FutureWarning) from nilearn.g...
[ "mne.stats.fdr_correction", "mne.preprocessing.nirs.tddr", "mne.pick_types", "mne.surface._project_onto_surface", "openpyxl.load_workbook", "numpy.ones", "mne.preprocessing.nirs.beer_lambert_law", "os.path.isfile", "numpy.mean", "numpy.arange", "scipy.stats.kendalltau", "os.path.join", "pand...
[((1347, 1391), 'os.path.join', 'op.join', (['"""data"""', '"""NIRx behavioral data.xlsx"""'], {}), "('data', 'NIRx behavioral data.xlsx')\n", (1354, 1391), True, 'import os.path as op\n'), ((1441, 1481), 'os.makedirs', 'os.makedirs', (['results_path'], {'exist_ok': '(True)'}), '(results_path, exist_ok=True)\n', (1452,...
import os from glob import glob import numpy as np import tensorlayer as tl from predict_M1.model import * import tensorflow as tf os.environ['CUDA_VISIBLE_DEVICES'] = '0' flags = tf.app.flags flags.DEFINE_integer("image_size", 64, "The size of the images [64]") flags.DEFINE_string("load_dir", "pretrained", "Directory ...
[ "tensorlayer.files.folder_exists", "tensorflow.nn.softmax", "os.path.abspath", "os.path.basename", "tensorlayer.layers.initialize_global_variables", "tensorflow.placeholder", "tensorflow.ConfigProto", "tensorlayer.visualize.read_image", "numpy.squeeze", "os.path.join", "tensorlayer.files.load_an...
[((671, 703), 'os.path.join', 'os.path.join', (['cur_path', 'LOAD_DIR'], {}), '(cur_path, LOAD_DIR)\n', (683, 703), False, 'import os\n'), ((719, 761), 'os.path.join', 'os.path.join', (['cur_path', 'LOAD_DIR', 'LOAD_NPZ'], {}), '(cur_path, LOAD_DIR, LOAD_NPZ)\n', (731, 761), False, 'import os\n'), ((597, 622), 'os.path...
#!/usr/bin/env python """ This program implements the symbolic dynamic filtering (SDF) algorithm as a time series feature extraction method, presented in the following paper: Bahrampour, Soheil, <NAME>, <NAME>, <NAME>, and <NAME>. "Performance comparison of feature extraction algorithms for target detection an...
[ "numpy.sum", "numpy.asarray", "numpy.floor", "numpy.zeros", "numpy.transpose", "numpy.hstack", "mhealthx.extractors.symbolic_dynamic_filtering.analyze_symbol_sequence", "numpy.sort", "mhealthx.extractors.symbolic_dynamic_filtering.generate_symbol_sequence", "mhealthx.extractors.symbolic_dynamic_fi...
[((1880, 1893), 'numpy.sort', 'np.sort', (['data'], {}), '(data)\n', (1887, 1893), True, 'import numpy as np\n'), ((2783, 2804), 'numpy.zeros', 'np.zeros', (['npartitions'], {}), '(npartitions)\n', (2791, 2804), True, 'import numpy as np\n'), ((4011, 4041), 'numpy.hstack', 'np.hstack', (['(partition, np.Inf)'], {}), '(...
# Author: <NAME> # Date: Dec.07.2020 # Title: Graph-based Deep Generative Model version 3 (single batch only) # Affiliation: JLK Genome Research Centre from dataclasses import dataclass, field from typing import List from rdkit import Chem from rdkit.Chem import rdmolfiles, rdmolops, AllChem from rdkit.Chem.S...
[ "numpy.stack" ]
[((3037, 3060), 'numpy.stack', 'np.stack', (['atom_features'], {}), '(atom_features)\n', (3045, 3060), True, 'import numpy as np\n'), ((5605, 5628), 'numpy.stack', 'np.stack', (['edge_features'], {}), '(edge_features)\n', (5613, 5628), True, 'import numpy as np\n')]
from statistics import stdev, mean import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.stats import trim_mean from tqdm import tqdm from scripts.vandv.graphs import plot_to_html_image def __html_table_from_dataframe(df, term_style='{:.0%}', highlight_max=True, first_col=1): df_styl...
[ "pandas.DataFrame", "numpy.partition", "tqdm.tqdm", "statistics.stdev", "scripts.vandv.graphs.plot_to_html_image", "matplotlib.pyplot.figure", "statistics.mean", "scipy.stats.trim_mean" ]
[((1765, 1814), 'numpy.partition', 'np.partition', (['data', '(lower_cut, upper_cut - 1)', '(0)'], {}), '(data, (lower_cut, upper_cut - 1), 0)\n', (1777, 1814), True, 'import numpy as np\n'), ((2234, 2264), 'pandas.DataFrame', 'pd.DataFrame', (['means'], {'index': '[0]'}), '(means, index=[0])\n', (2246, 2264), True, 'i...
from numpy import zeros, ones def compose_soln(x, n, V): A = zeros((n, n)) A[0, :] = V * ones(n) A[-1, :] = -V * ones(n) A[1 : -1, 1 : -1] = x.reshape((n - 2, n - 2)) return A
[ "numpy.zeros", "numpy.ones" ]
[((67, 80), 'numpy.zeros', 'zeros', (['(n, n)'], {}), '((n, n))\n', (72, 80), False, 'from numpy import zeros, ones\n'), ((99, 106), 'numpy.ones', 'ones', (['n'], {}), '(n)\n', (103, 106), False, 'from numpy import zeros, ones\n'), ((127, 134), 'numpy.ones', 'ones', (['n'], {}), '(n)\n', (131, 134), False, 'from numpy ...
#by <NAME> 2020 import numpy as np import matplotlib.pyplot as plt import skimage import skimage.external.tifffile import os import pandas as pd import seaborn as sns ######################################################## #2 import sys import argparse #default_i = "../data/PositiveControl/FilamentProjection...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.savefig", "numpy.abs", "argparse.ArgumentParser", "numpy.floor", "os.path.isfile", "numpy.mean", "matplotlib.pyplot.figure", "pathlib.Path", "matplotlib.pyplot.gca", "os.path.join", "numpy.std", "numpy.max", "matplotlib.pyplot.ylim", "matplot...
[((806, 873), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""ActinPolarity by <NAME> 2020"""'}), "(description='ActinPolarity by <NAME> 2020')\n", (829, 873), False, 'import argparse\n'), ((2003, 2035), 'os.path.isfile', 'os.path.isfile', (['input_image_path'], {}), '(input_image_path)\n...
'''Train CIFAR10 with PyTorch.''' from __future__ import print_function import os os.environ["CUDA_VISIBLE_DEVICES"] = "3" import time import torch import logging import argparse import torchvision import torch.nn as nn import numpy as np import torch.optim as optim import torch.nn.functional as F from tor...
[ "argparse.ArgumentParser", "torchvision.transforms.Normalize", "torch.no_grad", "torch.utils.data.DataLoader", "torch.nn.Linear", "torch.nn.AvgPool2d", "torchvision.transforms.RandomHorizontalFlip", "torch.autograd.Variable", "torch.nn.Conv2d", "torchvision.datasets.CIFAR100", "torch.nn.BatchNor...
[((601, 640), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (620, 640), False, 'import logging\n'), ((651, 715), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch CIFAR100 Training"""'}), "(description='PyTorch CIFAR100 Trai...
from mido import MidiFile import pretty_midi import matplotlib.pyplot as plt import numpy as np import os import sys import math source = '/Users/jonathanmairena/Documents/Fall2021/CIS519/Project/Pretrained Results -interp/Pretrained_results_902_907' files = os.listdir(source) global_tempo = [] velocity = [] key = []...
[ "numpy.argmax", "numpy.argmin", "numpy.mean", "pretty_midi.PrettyMIDI", "os.path.join", "os.listdir" ]
[((259, 277), 'os.listdir', 'os.listdir', (['source'], {}), '(source)\n', (269, 277), False, 'import os\n'), ((435, 465), 'os.path.join', 'os.path.join', (['source', 'files[i]'], {}), '(source, files[i])\n', (447, 465), False, 'import os\n'), ((529, 567), 'pretty_midi.PrettyMIDI', 'pretty_midi.PrettyMIDI', (['midi_file...
''' this script is to evaluate stochastic motion prediction on amass ''' import numpy as np import argparse import os import sys import pickle import csv sys.path.append(os.getcwd()) from utils import * from experiments.utils.config import Config from experiments.utils.batch_gen_amass import BatchGeneratorAMASSCanonic...
[ "numpy.stack", "pickle.dump", "numpy.random.seed", "argparse.ArgumentParser", "os.makedirs", "os.getcwd", "experiments.utils.config.Config", "os.path.exists", "experiments.utils.batch_gen_amass.BatchGeneratorAMASSCanonicalized", "numpy.reshape", "os.path.join", "csv.DictWriter" ]
[((171, 182), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (180, 182), False, 'import os\n'), ((2933, 2960), 'numpy.stack', 'np.stack', (["gen_results['gt']"], {}), "(gen_results['gt'])\n", (2941, 2960), True, 'import numpy as np\n'), ((5018, 5043), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n',...
from numpy import array, zeros, unique, searchsorted, where, arange from pyNastran.dev.bdf_vectorized.cards.elements.spring.spring_element import SpringElement from pyNastran.bdf.field_writer_8 import print_card_8 from pyNastran.bdf.field_writer_16 import print_card_16 from pyNastran.bdf.bdf_interface.assign_type imp...
[ "pyNastran.bdf.bdf_interface.assign_type.integer", "pyNastran.bdf.field_writer_8.print_card_8", "numpy.zeros", "numpy.searchsorted", "pyNastran.bdf.bdf_interface.assign_type.integer_or_blank", "numpy.where", "numpy.array", "numpy.arange", "pyNastran.dev.bdf_vectorized.cards.elements.spring.spring_el...
[((584, 619), 'pyNastran.dev.bdf_vectorized.cards.elements.spring.spring_element.SpringElement.__init__', 'SpringElement.__init__', (['self', 'model'], {}), '(self, model)\n', (606, 619), False, 'from pyNastran.dev.bdf_vectorized.cards.elements.spring.spring_element import SpringElement\n'), ((1164, 1187), 'pyNastran.b...
import tensorflow as tf import numpy as np def generate_anchors_pre(height, width, feat_stride=16, anchor_scales=(8, 16, 32), anchor_ratios=(0.5, 1, 2)): shift_x = tf.range(width) * feat_stride # width shift_y = tf.range(height) * feat_stride # height shift_x, shift_y = tf.meshgrid(shift_x, shift_y) ...
[ "tensorflow.meshgrid", "tensorflow.range", "tensorflow.reshape", "tensorflow.add", "numpy.hstack", "tensorflow.stack", "tensorflow.multiply", "tensorflow.cast", "numpy.arange", "numpy.array", "numpy.round", "numpy.sqrt" ]
[((287, 316), 'tensorflow.meshgrid', 'tf.meshgrid', (['shift_x', 'shift_y'], {}), '(shift_x, shift_y)\n', (298, 316), True, 'import tensorflow as tf\n'), ((326, 358), 'tensorflow.reshape', 'tf.reshape', (['shift_x'], {'shape': '(-1,)'}), '(shift_x, shape=(-1,))\n', (336, 358), True, 'import tensorflow as tf\n'), ((368,...
from src.network import NeuralNetwork import src.util_functions as uf import numpy from src.util.status import DataStore from src.util.status import TrainSettings from src.util.status import Status import os import pickle def print_log(status_train: Status, status_valid: Status): current_epoch = status_train....
[ "pickle.dump", "src.util.status.Status", "src.util_functions.pick_class", "os.path.realpath", "numpy.array", "os.path.split", "os.path.join" ]
[((942, 973), 'src.util_functions.pick_class', 'uf.pick_class', (['status.soft_prob'], {}), '(status.soft_prob)\n', (955, 973), True, 'import src.util_functions as uf\n'), ((1443, 1489), 'src.util.status.Status', 'Status', (['train_settings', 'data_store_train', '(True)'], {}), '(train_settings, data_store_train, True)...
#coding=utf-8 import networkx as nx import numpy as np import pandas as pd import os import matplotlib.pyplot as plt from util import * from sklearn.metrics import mutual_info_score def param_update(X, A, Y, W, alpha): W_apprx = X * A * X.T N, M = Y.shape X_new, A_new = np.zeros(X.shape), np.zeros(A.shape)...
[ "numpy.pad", "numpy.random.seed", "numpy.sum", "numpy.argmax", "synthetic.generate_evolution3", "numpy.zeros", "synthetic.generate_evolution", "sklearn.metrics.mutual_info_score", "synthetic.generate_evolution2", "numpy.random.rand", "numpy.diag" ]
[((1515, 1531), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (1523, 1531), True, 'import numpy as np\n'), ((3481, 3535), 'synthetic.generate_evolution', 'generate_evolution', (['"""./data/syntetic1/"""'], {'tsteps': 'tsteps'}), "('./data/syntetic1/', tsteps=tsteps)\n", (3499, 3535), False, 'from synthetic...
import collections import cv2 import json import numpy as np import os import re import tensorflow as tf import xml.etree.ElementTree as et from xml.dom import minidom import yaml from yaml.constructor import ConstructorError from mpl_toolkits.axes_grid1 import ImageGrid from tensorflow.python.framework import ops im...
[ "tensorflow.gfile.Exists", "yaml.load", "tensorflow.logging.info", "tensorflow.identity", "yaml.dump", "tensorflow.negative", "tensorflow.Variable", "tensorflow.gfile.Walk", "tensorflow.nn.conv2d", "tensorflow.get_default_graph", "os.path.join", "tensorflow.truncated_normal", "os.path.abspat...
[((6897, 6935), 'tensorflow.truncated_normal', 'tf.truncated_normal', (['shape'], {'stddev': '(0.1)'}), '(shape, stddev=0.1)\n', (6916, 6935), True, 'import tensorflow as tf\n'), ((6945, 6965), 'tensorflow.Variable', 'tf.Variable', (['initial'], {}), '(initial)\n', (6956, 6965), True, 'import tensorflow as tf\n'), ((70...
import matplotlib.pyplot as plt import numpy as np def visualise_array(Xs, Ys, A, samples=None): im = plt.imshow(A, origin='lower') im.set_extent([Xs.min(), Xs.max(), Ys.min(), Ys.max()]) im.set_interpolation('nearest') im.set_cmap('gray') if samples is not None: plt.plot(samples[:, 0], sam...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.plot", "matplotlib.pyplot.imshow", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.array", "numpy.linspace", "matplotlib.pyplot.tight_layout" ]
[((107, 136), 'matplotlib.pyplot.imshow', 'plt.imshow', (['A'], {'origin': '"""lower"""'}), "(A, origin='lower')\n", (117, 136), True, 'import matplotlib.pyplot as plt\n'), ((482, 499), 'numpy.zeros', 'np.zeros', (['D.shape'], {}), '(D.shape)\n', (490, 499), True, 'import numpy as np\n'), ((872, 884), 'matplotlib.pyplo...
import os import random import cv2 import numpy as np class ImageGenerator: def __init__(self, save_path, plates_path, nums_path, chars_path, transparent=False): self.save_path = save_path # Plate self.list_ = os.listdir(plates_path) self.plate = plates_path # Load Number...
[ "os.mkdir", "numpy.random.uniform", "cv2.bitwise_not", "random.randint", "cv2.bitwise_and", "cv2.cvtColor", "cv2.threshold", "cv2.add", "os.path.exists", "cv2.imread", "numpy.array", "os.path.join", "os.listdir", "cv2.resize" ]
[((240, 263), 'os.listdir', 'os.listdir', (['plates_path'], {}), '(plates_path)\n', (250, 263), False, 'import os\n'), ((372, 393), 'os.listdir', 'os.listdir', (['file_path'], {}), '(file_path)\n', (382, 393), False, 'import os\n'), ((1018, 1039), 'os.listdir', 'os.listdir', (['file_path'], {}), '(file_path)\n', (1028,...
import numpy as np import pytest from forest_benchmarking import qubit_spectroscopy as qs @pytest.fixture() def mock_rabi(): actual_rabi_period = 2.15 * np.pi # not quite 2pi return {'rabi_per': actual_rabi_period} def test_sinusoidal_waveform(mock_rabi): thetas = np.linspace(0, 2 * np.pi, 30) da...
[ "forest_benchmarking.qubit_spectroscopy.fit_to_sinusoidal_waveform", "pytest.fixture", "numpy.isclose", "numpy.sin", "numpy.linspace" ]
[((94, 110), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (108, 110), False, 'import pytest\n'), ((284, 313), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(30)'], {}), '(0, 2 * np.pi, 30)\n', (295, 313), True, 'import numpy as np\n'), ((471, 514), 'forest_benchmarking.qubit_spectroscopy.fit_to_sin...
#!/usr/bin/python3 # ================================================================================================= # A minimal example that defines a triangle mesh of a cylinder with multiple circular # cross-sections, riggs it with an armature, and animates the mesh using dual-quaternion skinning. # # Copyright 2...
[ "numpy.dstack", "math.exp", "numpy.sum", "numpy.deg2rad", "open3d.geometry.TriangleMesh.create_cylinder", "open3d.geometry.TriangleMesh.create_coordinate_frame", "dq3d.quat.identity", "open3d.utility.Vector3dVector", "numpy.array", "numpy.exp", "numpy.linspace", "dq3d.op.dlb", "open3d.visual...
[((822, 928), 'math.exp', 'math.exp', (['(-(anchor_to_point_distance * anchor_to_point_distance) / (2 *\n node_coverage * node_coverage))'], {}), '(-(anchor_to_point_distance * anchor_to_point_distance) / (2 *\n node_coverage * node_coverage))\n', (830, 928), False, 'import math\n'), ((1114, 1164), 'numpy.linspac...
#!/usr/bin/env python from __future__ import print_function import roslib #roslib.load_manifest('ros_to_cv_v2') import sys import rospy import cv2 import numpy as np from std_msgs.msg import String from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError from depth.msg import cood x=0 y=0 class ...
[ "cv_bridge.CvBridge", "cv2.warpPerspective", "rospy.Subscriber", "cv2.circle", "cv2.getPerspectiveTransform", "numpy.float32", "cv2.imshow", "rospy.Publisher", "rospy.init_node", "rospy.spin", "cv2.destroyAllWindows" ]
[((1774, 1820), 'rospy.init_node', 'rospy.init_node', (['"""image_depth"""'], {'anonymous': '(True)'}), "('image_depth', anonymous=True)\n", (1789, 1820), False, 'import rospy\n'), ((1902, 1925), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1923, 1925), False, 'import cv2\n'), ((377, 435), 'rosp...
# This code is modified on # https://github.com/openai/baselines/blob/master/baselines/deepq/replay_buffer.py import numpy as np class ReplayBuffer(object): def __init__(self, size, priority_replay=False, alpha=0.7, beta=0.5, eps=1e-7): """Create Replay buffer. Parameters ---------- ...
[ "numpy.zeros", "numpy.abs", "numpy.max", "numpy.array" ]
[((906, 933), 'numpy.max', 'np.max', (['self._probabilities'], {}), '(self._probabilities)\n', (912, 933), True, 'import numpy as np\n'), ((1052, 1069), 'numpy.array', 'np.array', (['[obs_t]'], {}), '([obs_t])\n', (1060, 1069), True, 'import numpy as np\n'), ((1098, 1116), 'numpy.array', 'np.array', (['[action]'], {}),...
import gym import numpy as np import pickle env = gym.make('CartPole-v0') # There are four variable, use a linear model W*x + b so actually five params # Given some param, run a full episode and compute reward def run_episode(W, max_step=1000, render=False): observation = env.reset() total_reward = 0 N_st...
[ "numpy.dot", "numpy.append", "numpy.random.rand", "gym.make" ]
[((50, 73), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (58, 73), False, 'import gym\n'), ((443, 470), 'numpy.append', 'np.append', (['observation', '(1.0)'], {}), '(observation, 1.0)\n', (452, 470), True, 'import numpy as np\n'), ((493, 505), 'numpy.dot', 'np.dot', (['W', 'b'], {}), '(W, ...
import os import sys import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from .Equirec2Cube import Equirec2Cube class SpherePad(nn.Module): def __init__(self, pad_size): super(SpherePad, self).__init__() self.pad_size = pad_size ...
[ "torch.nn.functional.grid_sample", "torch.cat", "torch.clamp", "numpy.array", "numpy.arctan", "torch.nn.functional.pad" ]
[((5771, 5792), 'torch.cat', 'torch.cat', (['out'], {'dim': '(0)'}), '(out, dim=0)\n', (5780, 5792), False, 'import torch\n'), ((1447, 1492), 'numpy.array', 'np.array', (['[[f, 0, cx], [0, f, cy], [0, 0, 1]]'], {}), '([[f, 0, cx], [0, f, cy], [0, 0, 1]])\n', (1455, 1492), True, 'import numpy as np\n'), ((4675, 4713), '...
import os import numpy as np import pandas as pd import pickle import glob from scipy import io from astropy.time import Time from astropy import units as u from solarsystemMB import SSObject, planet_geometry from .database_setup import database_connect def merc_year(datatime=None, initialize=False): """Insert/re...
[ "pandas.DataFrame", "solarsystemMB.planet_geometry", "pandas.read_sql", "numpy.sum", "pickle.dump", "os.path.basename", "astropy.time.Time", "astropy.units.def_unit", "numpy.arange", "numpy.linalg.norm", "numpy.array", "glob.glob", "numpy.dot", "numpy.ndarray", "solarsystemMB.SSObject" ]
[((459, 514), 'astropy.time.Time', 'Time', (['"""2011-03-18T00:00:00"""'], {'format': '"""isot"""', 'scale': '"""utc"""'}), "('2011-03-18T00:00:00', format='isot', scale='utc')\n", (463, 514), False, 'from astropy.time import Time\n'), ((526, 581), 'astropy.time.Time', 'Time', (['"""2015-04-30T23:59:59"""'], {'format':...
import librosa import numpy as np from pathlib import Path import json import os.path import sys import argparse THIS_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.abspath(os.path.join(THIS_DIR, os.pardir)) sys.path.append(ROOT_DIR) from audio_feature_utils import * from utils import distribute_t...
[ "sys.path.append", "numpy.save", "utils.distribute_tasks", "argparse.ArgumentParser", "pathlib.Path", "librosa.load", "numpy.concatenate" ]
[((230, 255), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (245, 255), False, 'import sys\n'), ((335, 395), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Preprocess audio data"""'}), "(description='Preprocess audio data')\n", (358, 395), False, 'import argpa...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Testing the orientation models.""" import numpy as np import pytest from fiberoripy.orientation import ( ard_rsc_ode, folgar_tucker_ode, iard_ode, iardrpr_ode, jeffery_ode, maier_saupe_ode, mrd_ode, pard_ode, pardrpr_ode, rsc_ode...
[ "numpy.eye", "numpy.allclose", "numpy.array", "numpy.linspace", "pytest.mark.parametrize" ]
[((327, 478), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model"""', '[ard_rsc_ode, rsc_ode, folgar_tucker_ode, maier_saupe_ode, iard_ode,\n mrd_ode, iardrpr_ode, pard_ode, pardrpr_ode]'], {}), "('model', [ard_rsc_ode, rsc_ode, folgar_tucker_ode,\n maier_saupe_ode, iard_ode, mrd_ode, iardrpr_ode, ...
'''Class and utilities for one level of an HSA agent.''' # python import os import pickle from copy import copy from time import time # scipy from numpy.linalg import inv, norm from numpy.random import choice, permutation, rand, randint, shuffle from numpy import argmax, arange, array, cos, concatenate, dot, empty, ex...
[ "numpy.sum", "numpy.argmax", "tensorflow.gather_nd", "tensorflow.keras.optimizers.SGD", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.linalg.norm", "numpy.random.randint", "numpy.sin", "numpy.round", "tensorflow.keras.optimizers.RMSprop", "numpy.prod", "tensorflow.keras....
[((1990, 2012), 'numpy.prod', 'prod', (['self.outputShape'], {}), '(self.outputShape)\n', (1994, 2012), False, 'from numpy import argmax, arange, array, cos, concatenate, dot, empty, exp, eye, flipud, floor, logical_not, isinf, max, maximum, mean, min, minimum, ones, pi, prod, repeat, reshape, round, sign, sin, squeeze...
from __future__ import division import numpy as np '''----------------------------------------------------------------------------- Perceptron Class -- Single Layer Neuron -----------------------------------------------------------------------------''' class Perceptron(): #########################################...
[ "numpy.random.uniform", "numpy.random.seed", "numpy.transpose", "numpy.exp", "numpy.dot" ]
[((3709, 3733), 'numpy.random.uniform', 'np.random.uniform', (['(-1)', '(1)'], {}), '(-1, 1)\n', (3726, 3733), True, 'import numpy as np\n'), ((8848, 8871), 'numpy.dot', 'np.dot', (['weights', 'inputs'], {}), '(weights, inputs)\n', (8854, 8871), True, 'import numpy as np\n'), ((11735, 11765), 'numpy.dot', 'np.dot', (['...
import math import numpy import lfa from scipy.interpolate import InterpolatedUnivariateSpline from makesky import * from prepord import * def lsd_multiorder(tmpl_wave, tmpl_flux, tmpl_e_flux, tmpl_msk, wave, flux, e_flux, msk, orders, vl, vh, nv, ...
[ "numpy.linalg.lstsq", "numpy.logical_and", "scipy.interpolate.InterpolatedUnivariateSpline", "numpy.empty", "numpy.zeros", "numpy.isfinite", "numpy.identity", "numpy.linspace" ]
[((421, 447), 'numpy.linspace', 'numpy.linspace', (['zl', 'zh', 'nv'], {}), '(zl, zh, nv)\n', (435, 447), False, 'import numpy\n'), ((492, 513), 'numpy.zeros', 'numpy.zeros', (['[nv, nv]'], {}), '([nv, nv])\n', (503, 513), False, 'import numpy\n'), ((523, 540), 'numpy.zeros', 'numpy.zeros', (['[nv]'], {}), '([nv])\n', ...
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import argparse import logging import json import numpy as np import os import trimesh import deep_sdf import deep_sdf.workspace as ws def evaluate(experiment_directory, checkpoint, data_dir, split_filename, max_meshes, keep_normalized=F...
[ "deep_sdf.configure_logging", "numpy.load", "json.load", "logging.debug", "argparse.ArgumentParser", "deep_sdf.workspace.get_reconstructed_training_mesh_filename", "trimesh.load", "deep_sdf.workspace.get_evaluation_dir", "deep_sdf.add_common_args", "numpy.mean", "os.path.join", "deep_sdf.metri...
[((3759, 3828), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluate a DeepSDF autodecoder"""'}), "(description='Evaluate a DeepSDF autodecoder')\n", (3782, 3828), False, 'import argparse\n'), ((5063, 5099), 'deep_sdf.add_common_args', 'deep_sdf.add_common_args', (['arg_parser'], {}),...
import cv2 import os import numpy as np data_root = "/home/csc302/workspace/luohao/code/AlignedReID/data/market1501/query" gen_root = "/home/csc302/workspace/luohao/code/AlignedReID/data/market1501_partial/query" def random_crop(img, sample_rate=0.6): h,w = img.shape[:2] sh = np.random.randint(sample_rate*h, ...
[ "cv2.imwrite", "cv2.imread", "numpy.random.randint", "os.path.join", "os.listdir", "cv2.resize" ]
[((470, 491), 'os.listdir', 'os.listdir', (['data_root'], {}), '(data_root)\n', (480, 491), False, 'import os\n'), ((412, 435), 'cv2.resize', 'cv2.resize', (['img', '(w, h)'], {}), '(img, (w, h))\n', (422, 435), False, 'import cv2\n'), ((558, 593), 'os.path.join', 'os.path.join', (['data_root', 'image_name'], {}), '(da...
import save_keras_model as saver import time import matplotlib.pyplot as plt import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import Flatten from keras.constraints import maxnorm from keras.optimizers import SGD from keras.layers im...
[ "os.mkdir", "save_keras_model.save_model", "numpy.load", "keras.constraints.NonNeg", "os.path.isdir", "keras.backend.backend", "keras.layers.Dropout", "keras.layers.Flatten", "keras.backend.set_image_dim_ordering", "keras.utils.np_utils.to_categorical", "pathlib.Path", "keras.models.Sequential...
[((1117, 1142), 'keras.datasets.fashion_mnist.load_data', 'fashion_mnist.load_data', ([], {}), '()\n', (1140, 1142), False, 'from keras.datasets import fashion_mnist\n'), ((1154, 1199), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['y_train', 'num_classes'], {}), '(y_train, num_classes)\n', (1177,...
from core.vocoder.models.fatchord_version import WaveRNN from core.vocoder.vocoder_dataset import VocoderDataset, collate_vocoder from core.vocoder.distribution import discretized_mix_logistic_loss from core.vocoder.display import stream, simple_table from core.vocoder.gen_wavernn import gen_testset from torch.utils.da...
[ "core.vocoder.display.stream", "core.vocoder.models.fatchord_version.WaveRNN", "numpy.cumprod", "core.vocoder.vocoder_dataset.VocoderDataset", "torch.utils.data.DataLoader", "time.time", "torch.cuda.is_available", "core.vocoder.gen_wavernn.gen_testset", "core.vocoder.display.simple_table", "torch....
[((938, 1280), 'core.vocoder.models.fatchord_version.WaveRNN', 'WaveRNN', ([], {'rnn_dims': 'hp.voc_rnn_dims', 'fc_dims': 'hp.voc_fc_dims', 'bits': 'hp.bits', 'pad': 'hp.voc_pad', 'upsample_factors': 'hp.voc_upsample_factors', 'feat_dims': 'hp.num_mels', 'compute_dims': 'hp.voc_compute_dims', 'res_out_dims': 'hp.voc_re...
"""Inference. Runs inference using a trained network. Raise ImportError when importing torch to force numpy. Author: <NAME> <<EMAIL>> Created on: April 3, 2020 """ try: # raise ImportError import torch from torchvision.datasets import MNIST from model import FCNetwork as NNModel USE_NUMPY ...
[ "numpy.load", "argparse.ArgumentParser", "utils.mnist_data.MNIST", "model.NumpyModel", "torch.load", "time.time", "torch.cuda.is_available", "numpy.array", "torch.device", "torch.no_grad", "torch.tensor" ]
[((586, 645), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""runs inference on the network"""'}), "(description='runs inference on the network')\n", (600, 645), False, 'from argparse import ArgumentParser\n'), ((3814, 3820), 'time.time', 'time', ([], {}), '()\n', (3818, 3820), False, 'from time i...
import torch from torch.utils.data import TensorDataset, DataLoader import models from pathlib import Path from ignite.utils import setup_logger from ignite.handlers import Checkpoint, DiskSaver import pandas as pd import numpy as np import argparse import os from tqdm import tqdm from dataset import set_seed def mai...
[ "tqdm.tqdm", "torch.distributed.init_process_group", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "numpy.concatenate", "pandas.read_csv", "torch.nn.parallel.DistributedDataParallel", "torch.cuda.device_count", "ignite.utils.setup_logger", "pathlib.Path", "torch.cuda.set_device", "...
[((336, 361), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (359, 361), False, 'import argparse\n'), ((1706, 1720), 'dataset.set_seed', 'set_seed', (['args'], {}), '(args)\n', (1714, 1720), False, 'from dataset import set_seed\n'), ((1732, 1789), 'ignite.utils.setup_logger', 'setup_logger', ([...
# -*- coding: utf-8 -*- """ Created on Tue Sep 15 23:37:44 2020 @author: nguye *Author : nguyenrobot Copyright : nguyenrobot https://github.com/nguyenrobot https://www.nguyenrobot.com """ """ documentation & tutorials https://docs.opencv.org/master/dc/dbb/tutorial_py_calibration.html https://docs.opencv.org/2.4/modul...
[ "cv2.findChessboardCorners", "os.path.basename", "cv2.cvtColor", "cv2.imwrite", "cv2.waitKey", "numpy.zeros", "cv2.imshow", "cv2.cornerSubPix", "cv2.imread", "cv2.calibrateCamera", "glob.glob", "cv2.drawChessboardCorners", "cv2.destroyAllWindows" ]
[((788, 826), 'numpy.zeros', 'numpy.zeros', (['(9 * 6, 3)', 'numpy.float32'], {}), '((9 * 6, 3), numpy.float32)\n', (799, 826), False, 'import numpy\n'), ((1044, 1081), 'glob.glob', 'glob.glob', (['"""images_calibration/*.jpg"""'], {}), "('images_calibration/*.jpg')\n", (1053, 1081), False, 'import glob\n'), ((1876, 18...
import cv2 import numpy as np vid = cv2.VideoCapture(0) vid.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) vid.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) def apply_template(img_rgb, template): img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) w, h = template.shape[::-1] res = cv2.matchTemplate(img_gray, template, cv2....
[ "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "cv2.imread", "numpy.where", "cv2.rectangle", "cv2.destroyAllWindows", "cv2.matchTemplate" ]
[((38, 57), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (54, 57), False, 'import cv2\n'), ((533, 578), 'cv2.imread', 'cv2.imread', (['"""templates/book_mongo_300.jpg"""', '(0)'], {}), "('templates/book_mongo_300.jpg', 0)\n", (543, 578), False, 'import cv2\n'), ((881, 904), 'cv2.destroyAllWindows', '...
# Code for paper: # [Title] - "Region-based Non-local Operation for Video Classification" # [Author] - <NAME>, <NAME> # [Github] - https://github.com/guoxih/region-based-non-local-network from __future__ import print_function from collections import OrderedDict import torch import torch.nn as nn import numpy as np ...
[ "torch.nn.init.xavier_uniform_", "torch.Tensor", "numpy.array", "torch.mul" ]
[((1486, 1533), 'torch.nn.init.xavier_uniform_', 'torch.nn.init.xavier_uniform_', (['self.weight.data'], {}), '(self.weight.data)\n', (1515, 1533), False, 'import torch\n'), ((1936, 1969), 'torch.mul', 'torch.mul', (['self.weight', 'self.mask'], {}), '(self.weight, self.mask)\n', (1945, 1969), False, 'import torch\n'),...
import os import unittest import numpy as np from os.path import join as pjoin from io import BytesIO from ..array_sequence import ArraySequence from ..tractogram import Tractogram from ..tractogram_file import HeaderWarning, HeaderError from ..tractogram_file import DataError from .. import tck as tck_module from ....
[ "io.BytesIO", "pytest.warns", "numpy.testing.assert_array_equal", "pytest.raises", "numpy.arange", "numpy.eye", "os.path.join" ]
[((566, 595), 'os.path.join', 'pjoin', (['data_path', '"""empty.tck"""'], {}), "(data_path, 'empty.tck')\n", (571, 595), True, 'from os.path import join as pjoin\n'), ((670, 700), 'os.path.join', 'pjoin', (['data_path', '"""simple.tck"""'], {}), "(data_path, 'simple.tck')\n", (675, 700), True, 'from os.path import join...
""" demo04_lr.py 逻辑分类 """ import numpy as np import matplotlib.pyplot as mp import sklearn.linear_model as lm x = np.array([ [3, 1], [2, 5], [1, 8], [6, 4], [5, 2], [3, 5], [4, 7], [4, -1]]) y = np.array([0, 1, 1, 0, 0, 1, 1, 0]) # 把整个空间分为500*500的网格化矩阵 l, r = x[:,0].min()-1, x[:,0].ma...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "sklearn.linear_model.LogisticRegression", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.pcolormesh", "numpy.linspace", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.ylabel", "matplotlib.pyplo...
[((116, 191), 'numpy.array', 'np.array', (['[[3, 1], [2, 5], [1, 8], [6, 4], [5, 2], [3, 5], [4, 7], [4, -1]]'], {}), '([[3, 1], [2, 5], [1, 8], [6, 4], [5, 2], [3, 5], [4, 7], [4, -1]])\n', (124, 191), True, 'import numpy as np\n'), ((229, 263), 'numpy.array', 'np.array', (['[0, 1, 1, 0, 0, 1, 1, 0]'], {}), '([0, 1, 1...
#!/usr/bin/env python # -*- coding: utf-8 -*- import itk import numpy as np from utils.utils import image2array, array2image, cast_image __author__ = ['<NAME>'] __email__ = ['<EMAIL>'] def median_filter(image, radius = 1, out_type = None) : ''' Apply a median filter on image Parameters ---------- ...
[ "itk.template", "numpy.dtype", "numpy.zeros", "utils.utils.cast_image", "utils.utils.image2array", "utils.utils.array2image", "numpy.min_scalar_type", "numpy.argsort", "numpy.arange", "numpy.unique" ]
[((2255, 2273), 'utils.utils.image2array', 'image2array', (['image'], {}), '(image)\n', (2266, 2273), False, 'from utils.utils import image2array, array2image, cast_image\n'), ((2379, 2403), 'utils.utils.array2image', 'array2image', (['array', 'info'], {}), '(array, info)\n', (2390, 2403), False, 'from utils.utils impo...
import numpy as np import unittest import clpybind class TestClp(unittest.TestCase): def test_solve(self): x = clpybind.Matrix(np.array([ [3, 2, 5], [2, 1, 1], [1, 1, 3], [5, 2, 4] ], dtype=np.double)) col_lb = np.zeros(3, dtype=np.double) ...
[ "clpybind.Simplex", "numpy.testing.assert_almost_equal", "numpy.zeros", "numpy.array", "numpy.testing.assert_equal", "numpy.repeat" ]
[((290, 318), 'numpy.zeros', 'np.zeros', (['(3)'], {'dtype': 'np.double'}), '(3, dtype=np.double)\n', (298, 318), True, 'import numpy as np\n'), ((336, 358), 'numpy.repeat', 'np.repeat', (['np.infty', '(3)'], {}), '(np.infty, 3)\n', (345, 358), True, 'import numpy as np\n'), ((373, 412), 'numpy.array', 'np.array', (['[...
# @Time : 2018-9-10 # @Author : zxh import numpy as np class LoopQueue: def __init__(self, size, mean_over): self.data = np.zeros([size], dtype=np.float32) self.mean_over = mean_over self.index = 0 self.size = size def set(self, n): self.data[self.index] = n s...
[ "numpy.zeros" ]
[((135, 169), 'numpy.zeros', 'np.zeros', (['[size]'], {'dtype': 'np.float32'}), '([size], dtype=np.float32)\n', (143, 169), True, 'import numpy as np\n')]
import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import os import sys import random import torch import torchaudio import torch.nn.functional as F import numpy as np import time import struct from torchaudio.compliance.kaldi import fbank from torch.utils.data import Dataset,DataLoader from t...
[ "torch.argmax", "torch.nn.InstanceNorm2d", "torch.cat", "matplotlib.pyplot.figure", "torch.nn.Softmax", "torch.std_mean", "torch.no_grad", "redis.Redis", "torch.nn.MSELoss", "random.randint", "torch.utils.data.DataLoader", "torch.load", "struct.pack", "torch.squeeze", "torch.utils.tensor...
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((1153, 1177), 'struct.pack', 'struct.pack', (['""">II"""', 'h', 'w'], {}), "('>II', h, w)\n", (1164, 1177), False, 'import struct\n'), ((1431, 1464), 'struct.unpack', 'struct.unpack', (['""">II"""...
import unittest import pqkmeans import numpy import collections import pickle class TestPQKMeans(unittest.TestCase): def data_source(self, n: int): for i in range(n): yield [i * 100] * 6 def setUp(self): # Train PQ encoder self.encoder = pqkmeans.encoder.PQEncoder(num_subd...
[ "pickle.loads", "numpy.testing.assert_array_equal", "collections.defaultdict", "numpy.array", "numpy.linalg.norm", "pqkmeans.clustering.PQKMeans", "pqkmeans.encoder.PQEncoder", "pickle.dumps" ]
[((285, 332), 'pqkmeans.encoder.PQEncoder', 'pqkmeans.encoder.PQEncoder', ([], {'num_subdim': '(3)', 'Ks': '(20)'}), '(num_subdim=3, Ks=20)\n', (311, 332), False, 'import pqkmeans\n'), ((447, 535), 'pqkmeans.clustering.PQKMeans', 'pqkmeans.clustering.PQKMeans', ([], {'encoder': 'self.encoder', 'k': '(5)', 'iteration': ...
from ...core.abstract_builder import AbstractBuilder from uwndc19.helpers.dataset import get_train_datasets, load_data, RANDOM_SEED from uwndc19.models.multiclass.input import build_input_fn, build_serving_input_receiver_fn from uwndc19.models.multiclass.model import model_fn import numpy as np class Builder(Abstract...
[ "numpy.nan_to_num", "numpy.isnan", "uwndc19.helpers.dataset.load_data", "uwndc19.models.multiclass.input.build_input_fn", "uwndc19.models.multiclass.input.build_serving_input_receiver_fn" ]
[((446, 457), 'uwndc19.helpers.dataset.load_data', 'load_data', ([], {}), '()\n', (455, 457), False, 'from uwndc19.helpers.dataset import get_train_datasets, load_data, RANDOM_SEED\n'), ((849, 876), 'numpy.nan_to_num', 'np.nan_to_num', (['train_labels'], {}), '(train_labels)\n', (862, 876), True, 'import numpy as np\n'...
import pygame from pygame.locals import * import numpy as np WINDOW_HEIGHT = 420 WINDOW_WIDTH = 420 BLACK = (0, 0, 0) WHITE = (255, 255, 255) GRID_SIZE = 4 FPS = 12 # Initial state def setup(g): # Glider gun g[10][100] = 1 g[10][99] = 1 g[9][100] = 1 g[10][92] = 1 g[10][91] = 1 g[9][93]...
[ "pygame.Surface", "numpy.copy", "pygame.event.get", "pygame.display.set_mode", "pygame.Rect", "numpy.zeros", "pygame.init", "pygame.display.flip", "pygame.display.set_caption", "pygame.time.Clock" ]
[((825, 863), 'numpy.zeros', 'np.zeros', ([], {'shape': '(sizeY + 2, sizeX + 2)'}), '(shape=(sizeY + 2, sizeX + 2))\n', (833, 863), True, 'import numpy as np\n'), ((901, 939), 'pygame.Surface', 'pygame.Surface', (['(GRID_SIZE, GRID_SIZE)'], {}), '((GRID_SIZE, GRID_SIZE))\n', (915, 939), False, 'import pygame\n'), ((973...
''' @Author = Ollie ''' from data import * import numpy as np ''' This file contains functions that can be used to analyse stock returns against a baseline stock (FTSE 100 tracker) and risk free stock (UK Gilds). Functions calculate 3 different metrics: - beta: volatility of stock compared to base through covariance...
[ "numpy.std", "numpy.cov" ]
[((1393, 1420), 'numpy.cov', 'np.cov', (["df['Returns']", 'base'], {}), "(df['Returns'], base)\n", (1399, 1420), True, 'import numpy as np\n'), ((1719, 1740), 'numpy.std', 'np.std', (["df['Returns']"], {}), "(df['Returns'])\n", (1725, 1740), True, 'import numpy as np\n'), ((1818, 1839), 'numpy.std', 'np.std', (["df['Re...
from rl.make_game import make_game import numpy as np import multiprocessing def random_rollout(actions, env): done = False while not done: action = np.random.choice(actions) s, r, done, _ = env.step(action) if done: return r class State(object): def __init__(self, pa...
[ "rl.make_game.make_game", "numpy.mean", "numpy.arange", "numpy.random.randint", "numpy.random.choice", "multiprocessing.cpu_count" ]
[((167, 192), 'numpy.random.choice', 'np.random.choice', (['actions'], {}), '(actions)\n', (183, 192), True, 'import numpy as np\n'), ((545, 574), 'numpy.arange', 'np.arange', (['self.na'], {'dtype': 'int'}), '(self.na, dtype=int)\n', (554, 574), True, 'import numpy as np\n'), ((765, 781), 'numpy.mean', 'np.mean', (['r...
import numpy as np import numpy.testing as npt import pandas as pd from unittest import TestCase, main from nimble import Events class EvTestCase(TestCase): @staticmethod def assertStartStops(events, vstarts, vstops): npt.assert_array_equal(events._starts, vstarts) npt.assert_array_equal(event...
[ "unittest.main", "numpy.random.seed", "numpy.testing.assert_array_equal", "numpy.array", "pandas.Series", "nimble.Events", "numpy.random.random_integers" ]
[((13500, 13506), 'unittest.main', 'main', ([], {}), '()\n', (13504, 13506), False, 'from unittest import TestCase, main\n'), ((236, 283), 'numpy.testing.assert_array_equal', 'npt.assert_array_equal', (['events._starts', 'vstarts'], {}), '(events._starts, vstarts)\n', (258, 283), True, 'import numpy.testing as npt\n'),...
import os import os.path as osp from abc import ABC, abstractmethod from typing import Any, Dict, Iterable, List, Tuple, Union import numpy as np from PIL import Image from habitat.tasks.rearrange.rearrange_sim import RearrangeSim from habitat.tasks.rearrange.utils import IkHelper from habitat_baselines.motion_planni...
[ "numpy.full", "numpy.stack", "os.makedirs", "ompl.base.CostToGoHeuristic", "numpy.clip", "ompl.base.PathLengthOptimizationObjective", "ompl.base.State", "numpy.sin", "numpy.linalg.norm", "numpy.array", "numpy.cos", "numpy.isclose", "ompl.geometric.RRTConnect", "os.path.join" ]
[((606, 621), 'ompl.base.State', 'ob.State', (['space'], {}), '(space)\n', (614, 621), True, 'from ompl import base as ob\n'), ((2678, 2716), 'ompl.base.PathLengthOptimizationObjective', 'ob.PathLengthOptimizationObjective', (['si'], {}), '(si)\n', (2712, 2716), True, 'from ompl import base as ob\n'), ((2746, 2789), 'o...
# Fix OpenCv2 configuration error with ROS # import sys # sys.path.remove("/opt/ros/kinetic/lib/python2.7/dist-packages") import networkx as nx import numpy as np import matplotlib.pyplot as plt import bcd # The Boustrophedon Cellular decomposition import move_boustrophedon # Uses output of bcd cells in order to mov...
[ "move_boustrophedon.plt.show", "matplotlib.pyplot.show", "numpy.empty", "bcd.cv2.imread", "bcd.bcd", "networkx.algorithms.bfs_tree", "numpy.random.randint", "networkx.Graph", "networkx.draw", "bcd.display_separate_map", "matplotlib.pyplot.subplots", "bcd.cv2.threshold", "ccp_v0.complete_cove...
[((884, 921), 'bcd.cv2.imread', 'bcd.cv2.imread', (['"""../data/map0001.png"""'], {}), "('../data/map0001.png')\n", (898, 921), False, 'import bcd\n'), ((1495, 1514), 'bcd.bcd', 'bcd.bcd', (['binary_map'], {}), '(binary_map)\n', (1502, 1514), False, 'import bcd\n'), ((1566, 1617), 'bcd.display_separate_map', 'bcd.displ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright (c) 2021, ETH Zurich, Computer Engineering Group (TEC) 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 ...
[ "bokeh.models.ColumnDataSource", "numpy.sum", "numpy.empty", "numpy.isnan", "bokeh.plotting.output_file", "numpy.mean", "pandas.DataFrame", "holoviews.opts.Violin", "holoviews.extension", "numpy.append", "hashlib.sha256", "numpy.max", "holoviews.render", "dominate.util.raw", "bokeh.layou...
[((2022, 2043), 'holoviews.extension', 'hv.extension', (['"""bokeh"""'], {}), "('bokeh')\n", (2034, 2043), True, 'import holoviews as hv\n'), ((2866, 2901), 'numpy.append', 'np.append', (['colsArray', 'dfValuesArray'], {}), '(colsArray, dfValuesArray)\n', (2875, 2901), True, 'import numpy as np\n'), ((4061, 4074), 'col...
#!/usr/bin/env python3 # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """Main DrQA reader training script.""" import socket import argparse import torch import numpy as np import j...
[ "msr.reader.utils.Timer", "numpy.random.seed", "argparse.ArgumentParser", "msr.reader.utils.metric_max_over_ground_truths", "msr.reader.utils.build_word_dict", "msr.reader.utils.build_feature_dict", "time.strftime", "msr.reader.utils.load_words", "logging.Formatter", "collections.defaultdict", "...
[((656, 675), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (673, 675), False, 'import logging\n'), ((9068, 9180), 'msr.reader.data.ReaderDataset', 'data.ReaderDataset', (['args', 'exs', 'args.word_dict', 'args.feature_dict'], {'single_answer': '(False)', 'train_time': 'train_time'}), '(args, exs, args.wo...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2019 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
[ "unittest.main", "iris.coords.AuxCoord", "iris.cube.CubeList", "improver.tests.ensemble_calibration.ensemble_calibration.helper_functions.set_up_temperature_cube", "improver.utilities.warnings_handler.ManageWarnings", "iris.coords.DimCoord", "iris.util.new_axis", "numpy.array", "improver.utilities.c...
[((2619, 2646), 'improver.utilities.warnings_handler.ManageWarnings', 'ManageWarnings', ([], {'record': '(True)'}), '(record=True)\n', (2633, 2646), False, 'from improver.utilities.warnings_handler import ManageWarnings\n'), ((7525, 7540), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7538, 7540), False, 'import...
import run import numpy as np import pytest F = 1/np.sqrt(2) def test_one_project(): np.testing.assert_almost_equal( np.array([0, 1]), run.one_project(1, 0)) np.testing.assert_almost_equal( np.array([0, 1, 0, 1]), run.one_project(2, 0)) np.testing.assert_almost_equal( np.array([0, 0, 1, 1]), run...
[ "numpy.random.seed", "run.parse_qubit", "numpy.zeros", "run.one_project", "pytest.raises", "run.simulate_h", "numpy.array", "run.simulate_cp", "numpy.diag", "run.simulate_m", "numpy.sqrt" ]
[((52, 62), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (59, 62), True, 'import numpy as np\n'), ((2626, 2643), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (2640, 2643), True, 'import numpy as np\n'), ((2653, 2669), 'numpy.array', 'np.array', (['[F, F]'], {}), '([F, F])\n', (2661, 2669), True, '...
import os import gym import time import enum import random import carla import pygame import numpy as np from gym import spaces from typing import Callable, Dict, Union, List from pygame.constants import K_q, K_UP, K_w, K_LEFT, K_a, K_RIGHT, K_d, K_DOWN, K_s, K_SPACE, K_ESCAPE, KMOD_CTRL from rl import utils as rl_ut...
[ "rl.environments.carla.sensors.SensorSpecs.rgb_camera", "rl.environments.carla.tools.misc.compute_distance", "rl.environments.carla.env_utils.random_spawn_point", "pygame.event.get", "rl.environments.carla.env_utils.magnitude", "rl.environments.carla.env_utils.resize", "time.strftime", "carla.WorldSet...
[((32676, 32734), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(0.0)', 'high': '(1.0)', 'shape': 'RoadOption.VOID.shape'}), '(low=0.0, high=1.0, shape=RoadOption.VOID.shape)\n', (32686, 32734), False, 'from gym import spaces\n'), ((2428, 2451), 'rl.environments.carla.env_utils.init_pygame', 'env_utils.init_pygame', ([...
# # 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. # from salina_cl.core import Model from salina import instantiate_class from salina_cl.agents.tools import weight_init import numpy as np cl...
[ "salina.instantiate_class", "numpy.sum" ]
[((536, 573), 'salina.instantiate_class', 'instantiate_class', (['self.cfg.algorithm'], {}), '(self.cfg.algorithm)\n', (553, 573), False, 'from salina import instantiate_class\n'), ((1071, 1106), 'salina.instantiate_class', 'instantiate_class', (['policy_agent_cfg'], {}), '(policy_agent_cfg)\n', (1088, 1106), False, 'f...
""" Copyright 2022 <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 distrib...
[ "numpy.abs", "numpy.eye", "numpy.zeros", "numpy.ones", "numpy.linalg.svd", "numpy.dot", "graphtastic.clustering.connectivity", "numpy.diag" ]
[((18720, 18756), 'numpy.linalg.svd', 'np.linalg.svd', (['D'], {'full_matrices': '(True)'}), '(D, full_matrices=True)\n', (18733, 18756), True, 'import numpy as np\n'), ((18834, 18849), 'numpy.dot', 'np.dot', (['Z.T', 'Vt'], {}), '(Z.T, Vt)\n', (18840, 18849), True, 'import numpy as np\n'), ((14936, 14961), 'graphtasti...
import numpy as np from tqdm import trange def simulate(runs, time, bandits): rewards = np.zeros((len(bandits), runs, time)) best_action_counts = np.zeros(rewards.shape) for i, bandit in enumerate(bandits): for r in trange(runs): bandit.reset() for t in range(time): ...
[ "numpy.zeros", "tqdm.trange" ]
[((156, 179), 'numpy.zeros', 'np.zeros', (['rewards.shape'], {}), '(rewards.shape)\n', (164, 179), True, 'import numpy as np\n'), ((238, 250), 'tqdm.trange', 'trange', (['runs'], {}), '(runs)\n', (244, 250), False, 'from tqdm import trange\n')]
import numpy as np from gym import utils from envs.mujoco_env import MujocoEnv import math diff_to_path = { 'easy': 'point.xml', 'medium': 'point_medium.xml', 'hard': 'point_hard.xml', 'harder': 'point_harder.xml', 'maze': 'maze.xml', 'maze_easy': 'maze_easy.xml' } class PointEnv(MujocoEnv, ...
[ "gym.utils.EzPickle.__init__", "numpy.clip", "numpy.array", "numpy.linalg.norm", "envs.mujoco_env.MujocoEnv.__init__", "numpy.concatenate" ]
[((695, 729), 'envs.mujoco_env.MujocoEnv.__init__', 'MujocoEnv.__init__', (['self', 'model', '(1)'], {}), '(self, model, 1)\n', (713, 729), False, 'from envs.mujoco_env import MujocoEnv\n'), ((738, 767), 'gym.utils.EzPickle.__init__', 'utils.EzPickle.__init__', (['self'], {}), '(self)\n', (761, 767), False, 'from gym i...
# coding: utf-8 """ """ from __future__ import division, print_function __author__ = "adrn <<EMAIL>>" # Standard library import os, sys import time # Third-party import numpy as np # Project import streams.io as io from streams.coordinates import _gc_to_hel, _hel_to_gc from streams.coordinates.frame import helio...
[ "numpy.zeros_like", "streams.io.read_config", "streams.potential.lm10.LawMajewski2010", "streams.inference.StreamModel.from_config", "streams.coordinates._hel_to_gc", "time.time", "numpy.min", "numpy.array", "streams.io.SgrSimulation", "numpy.vstack" ]
[((561, 578), 'streams.potential.lm10.LawMajewski2010', 'LawMajewski2010', ([], {}), '()\n', (576, 578), False, 'from streams.potential.lm10 import LawMajewski2010\n'), ((592, 639), 'streams.io.SgrSimulation', 'io.SgrSimulation', (['"""sgr_nfw/M2.5e+08"""', '"""SNAP113"""'], {}), "('sgr_nfw/M2.5e+08', 'SNAP113')\n", (6...
import numpy as np from sklearn.linear_model import LinearRegression import sys import pandas as pd class Indicators(): """ Holds all indicators for a given ticker in one place """ def __init__(self, data): self.data = data def get(self, i): if i=='MA...
[ "numpy.full", "numpy.zeros", "sklearn.linear_model.LinearRegression", "numpy.cumsum", "numpy.arange", "numpy.round" ]
[((2423, 2462), 'numpy.round', 'np.round', (['(100.0 - 100.0 / (1.0 + RS))', '(0)'], {}), '(100.0 - 100.0 / (1.0 + RS), 0)\n', (2431, 2462), True, 'import numpy as np\n'), ((6445, 6456), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (6453, 6456), True, 'import numpy as np\n'), ((6323, 6340), 'numpy.arange', 'np.aran...
import os import torch import numpy as np from collections import Sequence from plyfile import PlyData from torch_scatter import scatter_sum, scatter_mul import MinkowskiEngineBackend as MEB import MinkowskiEngine as ME # Use ScanNet default colors colors = [ (0, 0, 0), # unlabeled 0 (174, 199...
[ "numpy.floor", "torch.cat", "numpy.arange", "torch.arange", "os.path.join", "torch.ones", "numpy.set_printoptions", "os.path.exists", "torch.exp", "torch.Tensor", "torch.zeros", "plyfile.PlyData.read", "torch.where", "torch.floor", "torch.IntTensor", "MinkowskiEngine.utils.sparse_colla...
[((3117, 3149), 'plyfile.PlyData.read', 'PlyData.read', (["(file_name + '.ply')"], {}), "(file_name + '.ply')\n", (3129, 3149), False, 'from plyfile import PlyData\n'), ((4409, 4441), 'plyfile.PlyData.read', 'PlyData.read', (["(file_name + '.ply')"], {}), "(file_name + '.ply')\n", (4421, 4441), False, 'from plyfile imp...
import unittest import numpy as np import openmdao.api as om from openmdao.utils.assert_utils import assert_near_equal class TestOptionsDictionaryFeature(unittest.TestCase): def test_simple(self): import openmdao.api as om from openmdao.test_suite.components.options_feature_vector import Vector...
[ "unittest.main", "openmdao.api.Problem", "openmdao.test_suite.components.options_feature_function.UnitaryFunctionComp", "numpy.array", "numpy.arange", "openmdao.test_suite.components.options_feature_vector.VectorDoublingComp", "openmdao.test_suite.components.options_feature_lincomb.LinearCombinationComp...
[((4529, 4544), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4542, 4544), False, 'import unittest\n'), ((349, 361), 'openmdao.api.Problem', 'om.Problem', ([], {}), '()\n', (359, 361), True, 'import openmdao.api as om\n'), ((794, 806), 'openmdao.api.Problem', 'om.Problem', ([], {}), '()\n', (804, 806), True, 'im...
from vehicles.idmmobil_merge_vehicle import IDMMOBILVehicleMerge import numpy as np import pickle from importlib import reload import tensorflow as tf import json class NeuralIDMVehicle(IDMMOBILVehicleMerge): def __init__(self): super().__init__(id=None, lane_id=None, glob_x=None, speed=None, aggr...
[ "json.load", "numpy.float32", "tensorflow.reshape", "numpy.zeros", "tensorflow.concat", "json.dumps", "importlib.reload", "pickle.load", "numpy.array", "models.core.neural_idm.NeurIDMModel" ]
[((514, 574), 'numpy.zeros', 'np.zeros', (['[self.samples_n, self.history_len, self.state_dim]'], {}), '([self.samples_n, self.history_len, self.state_dim])\n', (522, 574), True, 'import numpy as np\n'), ((675, 693), 'importlib.reload', 'reload', (['neural_idm'], {}), '(neural_idm)\n', (681, 693), False, 'from importli...
import pybullet as p import os import numpy as np import Helper def load(): # work in the following section to load your robot robotName = 'HextechCatcher.urdf' # robotPath = os.path.join('project', 'proj2_baseball', 'rsc', robotName) robotPath = Helper.findURDF(robotName) robotInitPos = [-0.6, 0....
[ "pybullet.getLinkState", "numpy.arctan2", "pybullet.addUserDebugLine", "Helper.findURDF", "numpy.sin", "numpy.linalg.norm", "numpy.cos", "pybullet.getNumJoints", "pybullet.loadURDF" ]
[((265, 291), 'Helper.findURDF', 'Helper.findURDF', (['robotName'], {}), '(robotName)\n', (280, 291), False, 'import Helper\n'), ((386, 435), 'pybullet.loadURDF', 'p.loadURDF', (['robotPath', 'robotInitPos', 'robotInitOrn'], {}), '(robotPath, robotInitPos, robotInitOrn)\n', (396, 435), True, 'import pybullet as p\n'), ...
#!/usr/bin/env python3 import numpy as np from numpy.core.function_base import geomspace from numpy.core.numeric import NaN import roslib import tf2_ros roslib.load_manifest("multipath_sim") import rospy from multipath_sim.msg import MultipathOffset from gazebo_msgs.srv import GetModelState from geometry_msgs.msg impo...
[ "tf2_ros.TransformBroadcaster", "rospy.Subscriber", "nav_msgs.msg.Odometry", "rospy.Time.now", "geometry_msgs.msg.TransformStamped", "rospy.Publisher", "rospy.ServiceProxy", "numpy.array", "rospy.init_node", "rospy.spin", "roslib.load_manifest" ]
[((153, 190), 'roslib.load_manifest', 'roslib.load_manifest', (['"""multipath_sim"""'], {}), "('multipath_sim')\n", (173, 190), False, 'import roslib\n'), ((586, 682), 'numpy.array', 'np.array', (['[true_pose.pose.position.x, true_pose.pose.position.y, true_pose.pose.\n position.z]'], {}), '([true_pose.pose.position...
import os import sys import warnings from random import sample import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.optim as optim from torch.optim.lr_scheduler import MultiStepLR from torch.utils.data import Dataset, DataLoader from torch.utils.data.dataloader import defa...
[ "matplotlib.pyplot.title", "torch.cat", "torch.nn.NLLLoss", "validate.validate", "os.path.isfile", "module.normalizer.Normalizer", "sys.path.append", "torch.nn.MSELoss", "cgcnn.data.collate_pool", "torch.utils.data.DataLoader", "torch.load", "numpy.max", "torch.Tensor", "torch.zeros", "m...
[((390, 421), 'sys.path.append', 'sys.path.append', (['os.path.pardir'], {}), '(os.path.pardir)\n', (405, 421), False, 'import sys\n'), ((717, 728), 'module.arguments.arguments', 'arguments', ([], {}), '()\n', (726, 728), False, 'from module.arguments import arguments\n'), ((898, 925), 'cgcnn.data.CIFData', 'CIFData', ...
""" IMAGE WORD2VEC <NAME> - <EMAIL> Vectorization Module - based on CNNs encoded in Keras. The module is used to convert a set of images into corresponding feature vectors. Each feature vector is of length 2048. """ # import libraries import numpy as np from keras.applications import vgg16, inception_v3, resnet50, m...
[ "os.mkdir", "numpy.save", "matplotlib.pyplot.show", "sklearn.manifold.TSNE", "matplotlib.pyplot.annotate", "os.path.isdir", "matplotlib.pyplot.scatter", "numpy.expand_dims", "keras.models.Model", "keras.applications.mobilenet.MobileNet", "keras.preprocessing.image.img_to_array", "keras.preproc...
[((4621, 4647), 'os.path.isdir', 'os.path.isdir', (['inputfolder'], {}), '(inputfolder)\n', (4634, 4647), False, 'import os\n'), ((4857, 4880), 'os.listdir', 'os.listdir', (['inputfolder'], {}), '(inputfolder)\n', (4867, 4880), False, 'import os\n'), ((2412, 2458), 'keras.preprocessing.image.load_img', 'image.load_img'...
''' made by @finnkso (github) 2020.04.09 tensorflow-gpu==1.15.0 : tf.compat.v1 if tensorflow-gpu==1.8.0, please replayce tf.compat.v1 to tf ''' import argparse import os import tkinter as tk from tkinter import filedialog import cv2 from tqdm import tqdm import numpy as np import tensorflow as tf from net...
[ "tkinter.filedialog.asksaveasfilename", "argparse.ArgumentParser", "cv2.VideoWriter_fourcc", "tensorflow.compat.v1.GPUOptions", "os.path.join", "tensorflow.compat.v1.variable_scope", "cv2.cvtColor", "tensorflow.compat.v1.placeholder", "os.path.dirname", "tkinter.filedialog.askopenfilename", "too...
[((585, 626), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'desc'}), '(description=desc)\n', (608, 626), False, 'import argparse\n'), ((1400, 1407), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1405, 1407), True, 'import tkinter as tk\n'), ((1799, 1835), 'cv2.cvtColor', 'cv2.cvtColor', (['img...
import numpy as np import sys, os pykin_path = os.path.dirname(os.path.dirname(os.getcwd())) sys.path.append(pykin_path) from pykin.kinematics import transform as tf from pykin.robots.single_arm import SingleArm from pykin.utils import plot_utils as plt from pykin.utils.transform_utils import compute_pose_error file...
[ "sys.path.append", "pykin.utils.transform_utils.compute_pose_error", "pykin.utils.plot_utils.init_3d_figure", "numpy.random.randn", "os.getcwd", "pykin.kinematics.transform.Transform", "numpy.zeros", "pykin.utils.plot_utils.show_figure", "pykin.utils.plot_utils.plot_robot" ]
[((94, 121), 'sys.path.append', 'sys.path.append', (['pykin_path'], {}), '(pykin_path)\n', (109, 121), False, 'import sys, os\n'), ((600, 618), 'numpy.random.randn', 'np.random.randn', (['(7)'], {}), '(7)\n', (615, 618), True, 'import numpy as np\n'), ((666, 699), 'pykin.utils.plot_utils.init_3d_figure', 'plt.init_3d_f...
import numpy as np from hypothesis import given, settings import hypothesis.strategies as st import unittest from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial class TestTile(serial.Serial...
[ "unittest.main", "unittest.skipIf", "numpy.asarray", "hypothesis.settings", "caffe2.python.core.CreateOperator", "numpy.array", "numpy.tile", "numpy.random.rand", "hypothesis.strategies.integers" ]
[((638, 662), 'hypothesis.settings', 'settings', ([], {'deadline': '(10000)'}), '(deadline=10000)\n', (646, 662), False, 'from hypothesis import given, settings\n'), ((1451, 1515), 'unittest.skipIf', 'unittest.skipIf', (['(not workspace.has_gpu_support)', '"""No gpu support"""'], {}), "(not workspace.has_gpu_support, '...
import joblib from ..utils.matrices import Hdf5 import numpy as np import faiss from numpy import linalg as LA from sklearn.neighbors import NearestNeighbors CPU = 1 faiss.omp_set_num_threads(CPU) N_NEIGHBORS = 5 class FaissSimilarity(object): def __init__(self, n_neighbors=N_NEIGHBORS): self.n_neighbor...
[ "faiss.write_index", "faiss.omp_set_num_threads", "numpy.sum", "faiss.read_index", "joblib.dump", "faiss.IndexFlatIP", "numpy.linalg.norm", "sklearn.neighbors.NearestNeighbors", "joblib.load" ]
[((167, 197), 'faiss.omp_set_num_threads', 'faiss.omp_set_num_threads', (['CPU'], {}), '(CPU)\n', (192, 197), False, 'import faiss\n'), ((491, 513), 'faiss.IndexFlatIP', 'faiss.IndexFlatIP', (['dim'], {}), '(dim)\n', (508, 513), False, 'import faiss\n'), ((531, 549), 'numpy.linalg.norm', 'LA.norm', (['V'], {'axis': '(1...
from itertools import permutations import random import numpy as np import tensorflow as tf from tensorflow.keras.datasets import mnist from mlgm.sampler import MetaSampler class MnistMetaSampler(MetaSampler): def __init__( self, batch_size, meta_batch_size, train...
[ "tensorflow.one_hot", "tensorflow.gather", "numpy.empty", "tensorflow.convert_to_tensor", "random.shuffle", "itertools.permutations", "tensorflow.data.Dataset.from_tensor_slices", "tensorflow.keras.datasets.mnist.load_data", "numpy.append", "numpy.where", "numpy.array", "numpy.random.choice", ...
[((1073, 1090), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (1088, 1090), False, 'from tensorflow.keras.datasets import mnist\n'), ((1109, 1152), 'numpy.concatenate', 'np.concatenate', (['(train_inputs, test_inputs)'], {}), '((train_inputs, test_inputs))\n', (1123, 1152), True, 'im...
# *************************************************************************** # # HyperNet # # --------------------------------------------------------------------------- # # Machine Learning-Based library for modeling # ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.yscale", "numpy.amin", "matplotlib.pyplot.figure", "numpy.exp", "hypernet.src.thermophysicalModels.specie.specie.Specie", "matplotlib.pyplot.gca", "hypernet.src.general.utils.app_decorator", "sys.path.append", "pandas.DataFrame", "matplotlib.pyplot.c...
[((4807, 4837), 'hypernet.src.general.utils.app_decorator', 'utils.app_decorator', ([], {'name': 'NAME'}), '(name=NAME)\n', (4826, 4837), False, 'from hypernet.src.general import utils\n'), ((1176, 1204), 'os.path.dirname', 'os.path.dirname', (['db.__file__'], {}), '(db.__file__)\n', (1191, 1204), False, 'import os\n')...
import time import cv2 import numpy as np from chainer import serializers, Variable, cuda import chainer.functions as F import argparse from model import YOLOv2, YOLOv2Predictor from lib.utils import nms from lib.utils import Box fcn = False class Predictor: def __init__(self, gpu=0): # hyper parameters ...
[ "chainer.Variable", "lib.utils.Box", "cv2.putText", "argparse.ArgumentParser", "model.YOLOv2", "chainer.serializers.load_npz", "cv2.cvtColor", "cv2.imwrite", "numpy.asarray", "chainer.cuda.get_device", "chainer.cuda.to_cpu", "cv2.imread", "model.YOLOv2Predictor", "chainer.functions.reshape...
[((3398, 3450), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""predict image"""'}), "(description='predict image')\n", (3421, 3450), False, 'import argparse\n'), ((3655, 3677), 'cv2.imread', 'cv2.imread', (['image_file'], {}), '(image_file)\n', (3665, 3677), False, 'import cv2\n'), ((427...
__author__ = "<NAME>" import unittest import numpy as np import numpy.testing as npt import skbio from mohawk._format import (locus_generator, extract_subsequences, encode_sequence, join_contigs, sample_fro...
[ "unittest.main", "numpy.random.seed", "skbio.DNA.concat", "skbio.DNA", "mohawk._format.encode_sequence", "numpy.array", "mohawk._format.locus_generator", "numpy.testing.assert_equal", "mohawk._format.join_contigs", "numpy.arange", "mohawk._format.extract_subsequences", "mohawk._format.sample_f...
[((4211, 4226), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4224, 4226), False, 'import unittest\n'), ((641, 681), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]'], {}), '([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n', (649, 681), True, 'import numpy as np\n'), ((696, 758), 'mohawk._format.locus_generator',...
import numpy as np import sumu def test_pairwise_causal_estimation(): np.random.seed(0) n = 6 bn = sumu.GaussianBNet.random(n) data = bn.sample(20000) dags, scores = sumu.Gadget(data=data, mcmc={"iters": 80000}).sample() causal_effects = sumu.Beeps(dags=dags, data=data).sample_pairwise() m...
[ "sumu.Gadget", "numpy.random.seed", "sumu.Beeps", "numpy.eye", "sumu.GaussianBNet.random" ]
[((76, 93), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (90, 93), True, 'import numpy as np\n'), ((113, 140), 'sumu.GaussianBNet.random', 'sumu.GaussianBNet.random', (['n'], {}), '(n)\n', (137, 140), False, 'import sumu\n'), ((188, 233), 'sumu.Gadget', 'sumu.Gadget', ([], {'data': 'data', 'mcmc': "{'...
# -*- coding: utf-8 -*- """ .. Authors <NAME> <<EMAIL>> A set of routines for related to Voigt distributions. """ import numpy as np from scipy.interpolate import interp1d from scipy.special import wofz def voigt( x ,intensity=None ,location=None ,sigma=None ,gamma=None): ...
[ "numpy.sum", "numpy.log", "numpy.abs", "numpy.cumsum", "numpy.max", "numpy.min", "numpy.linspace", "scipy.special.wofz", "numpy.interp", "scipy.interpolate.interp1d", "numpy.sqrt" ]
[((1997, 2041), 'numpy.sqrt', 'np.sqrt', (['(gauss_hwfm ** 2 + lorentz_hwfm ** 2)'], {}), '(gauss_hwfm ** 2 + lorentz_hwfm ** 2)\n', (2004, 2041), True, 'import numpy as np\n'), ((2401, 2441), 'numpy.linspace', 'np.linspace', (['(-value)', 'value', '(gridsize + 1)'], {}), '(-value, value, gridsize + 1)\n', (2412, 2441)...
""" Code for self-training with weak supervision. Author: <NAME> (<EMAIL>) """ import math import numpy as np import tensorflow as tf import tensorflow.keras as K from tensorflow.keras.layers import Embedding, Input, Dropout, Dense, Lambda class RAN: """ Rule Attention Network * Input: t...
[ "tensorflow.random.set_seed", "tensorflow.nn.compute_average_loss", "tensorflow.keras.layers.Add", "tensorflow.keras.layers.Dense", "numpy.argmax", "numpy.empty", "numpy.ones", "tensorflow.keras.initializers.GlorotUniform", "tensorflow.keras.activations.sigmoid", "tensorflow.keras.callbacks.EarlyS...
[((11507, 11565), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(student_emb_dim,)', 'name': '"""student_embeddings"""'}), "(shape=(student_emb_dim,), name='student_embeddings')\n", (11512, 11565), False, 'from tensorflow.keras.layers import Embedding, Input, Dropout, Dense, Lambda\n'), ((11582, 11650), 'te...
import os import sys import numpy as np import pandas as pd from scipy import sparse from sklearn import metrics sys.path.append(os.path.abspath(os.path.join("./libs/residual2vec"))) from residual2vec.residual2vec import _find_blocks_by_sbm sys.path.append(os.path.abspath(os.path.join("./libs/graph_embeddings"))) fr...
[ "numpy.sum", "pandas.read_csv", "numpy.ones", "numpy.isclose", "numpy.arange", "graph_embeddings.utils.to_trans_mat", "os.path.join", "pandas.DataFrame", "numpy.power", "residual2vec.residual2vec._find_blocks_by_sbm", "numpy.max", "pandas.concat", "graph_embeddings.utils.calc_rwr", "scipy....
[((4431, 4467), 'pandas.concat', 'pd.concat', (['dflist'], {'ignore_index': '(True)'}), '(dflist, ignore_index=True)\n', (4440, 4467), True, 'import pandas as pd\n'), ((526, 547), 'graph_embeddings.utils.to_trans_mat', 'utils.to_trans_mat', (['A'], {}), '(A)\n', (544, 547), False, 'from graph_embeddings import utils\n'...
# -*- coding: utf-8 -*- """@package Methods.Geometry.Arc1.get_center Compute the coordinate of the center of an Arc1 method @date Created on Fri Dec 05 13:37:19 2014 @copyright (C) 2014-2015 EOMYS ENGINEERING. @author pierre_b """ from numpy import abs as np_abs, angle as np_angle, arcsin, exp, pi def get_center(self...
[ "numpy.angle", "numpy.abs" ]
[((1298, 1308), 'numpy.abs', 'np_abs', (['Zc'], {}), '(Zc)\n', (1304, 1308), True, 'from numpy import abs as np_abs, angle as np_angle, arcsin, exp, pi\n'), ((984, 1001), 'numpy.angle', 'np_angle', (['(z2 - z1)'], {}), '(z2 - z1)\n', (992, 1001), True, 'from numpy import abs as np_abs, angle as np_angle, arcsin, exp, p...
"""Migdal effect """ import numericalunits as nu import numpy as np import pandas as pd from scipy.interpolate import interp1d from scipy.integrate import dblquad import wimprates as wr export, __all__ = wr.exporter() # Differential transition probabilities for Xe vs energy (eV) df_migdal = pd.read_csv(wr.data_file(...
[ "wimprates.data_file", "numpy.maximum", "wimprates.v_max", "wimprates.exporter", "wimprates.mu_nucleus", "scipy.interpolate.interp1d", "numpy.array", "wimprates.StandardHaloModel", "wimprates.mn", "wimprates.sigma_erec" ]
[((206, 219), 'wimprates.exporter', 'wr.exporter', ([], {}), '()\n', (217, 219), True, 'import wimprates as wr\n'), ((307, 354), 'wimprates.data_file', 'wr.data_file', (['"""migdal/migdal_transition_ps.csv"""'], {}), "('migdal/migdal_transition_ps.csv')\n", (319, 354), True, 'import wimprates as wr\n'), ((1039, 1055), ...
from qutip import * import numpy as np import scipy import itertools import random import matplotlib.pyplot as plt import pickle from time import time #Pauli matrices #s = [sigmax(), sigmay(), sigmaz()] s = {0: sigmax(), 1: sigmay(), 2: sigmaz()} #General qubit state, input as list of Bloch vector components, i.e. r...
[ "numpy.trace", "numpy.abs", "numpy.log", "numpy.random.rand", "numpy.zeros", "numpy.imag", "numpy.isclose", "numpy.array", "numpy.linalg.norm", "numpy.linspace", "numpy.random.choice", "random.seed", "numpy.eye", "numpy.real", "itertools.product", "numpy.exp", "numpy.sqrt" ]
[((578, 609), 'numpy.zeros', 'np.zeros', (['[4, 4]'], {'dtype': 'complex'}), '([4, 4], dtype=complex)\n', (586, 609), True, 'import numpy as np\n'), ((1040, 1072), 'numpy.array', 'np.array', (['density'], {'dtype': 'complex'}), '(density, dtype=complex)\n', (1048, 1072), True, 'import numpy as np\n'), ((2246, 2299), 'n...
# Built-in libraries import json import math import random from functools import partial from typing import Any, Callable, Dict, List import numpy as np # Plotting settings import plotly.graph_objects as go import seaborn as sns from plotly.offline import plot as plotoffline from .data_input import check_valid_batch...
[ "functools.partial", "plotly.graph_objects.Scatter", "plotly.graph_objects.Frame", "json.loads", "plotly.graph_objects.Figure", "random.shuffle", "seaborn.husl_palette", "numpy.floor", "math.floor", "plotly.offline.plot", "random.seed", "numpy.linspace" ]
[((1240, 1373), 'plotly.offline.plot', 'plotoffline', ([], {'figure_or_data': 'fig', 'config': 'config', 'filename': 'filename', 'include_plotlyjs': '"""cdn"""', 'include_mathjax': '"""cdn"""', 'auto_open': '(False)'}), "(figure_or_data=fig, config=config, filename=filename,\n include_plotlyjs='cdn', include_mathjax...
# emmm.py: EM algorithm on discrete random points. import argparse from math import exp, inf, log, pi import matplotlib.pyplot as plt import numpy as np from kmeans import randCent X = None mju = None sigma = None pre = None gamma = None n = 0 k = 0 def multiNormal(x, mean, stdvar): dis = x - mean frac = -...
[ "math.exp", "matplotlib.pyplot.show", "argparse.ArgumentParser", "numpy.sum", "numpy.argmax", "matplotlib.pyplot.scatter", "kmeans.randCent", "numpy.zeros", "numpy.where", "numpy.linalg.inv", "numpy.loadtxt", "numpy.linalg.det", "numpy.dot", "numpy.eye", "math.log", "numpy.random.shuff...
[((679, 690), 'numpy.zeros', 'np.zeros', (['k'], {}), '(k)\n', (687, 690), True, 'import numpy as np\n'), ((1445, 1485), 'numpy.loadtxt', 'np.loadtxt', (['"""rawdata.csv"""'], {'delimiter': '""","""'}), "('rawdata.csv', delimiter=',')\n", (1455, 1485), True, 'import numpy as np\n'), ((1499, 1560), 'argparse.ArgumentPar...