code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from numpy import equal
from plotly.graph_objects import Figure
from vizml.k_means_clustering.clustering import KMeansClustering
def test_show_data():
"""Tests the show data function in K means Clustering."""
clu = KMeansClustering()
fig = clu.show_data(return_fig=True)
assert isinstance(fig, Figure)... | [
"vizml.k_means_clustering.clustering.KMeansClustering",
"numpy.equal"
] | [((226, 244), 'vizml.k_means_clustering.clustering.KMeansClustering', 'KMeansClustering', ([], {}), '()\n', (242, 244), False, 'from vizml.k_means_clustering.clustering import KMeansClustering\n'), ((426, 444), 'vizml.k_means_clustering.clustering.KMeansClustering', 'KMeansClustering', ([], {}), '()\n', (442, 444), Fal... |
import numpy as np
import bct
from sklearn.externals import joblib
from my_settings import *
from sklearn.cross_validation import (StratifiedKFold, cross_val_score)
from sklearn.ensemble import AdaBoostClassifier
from sklearn.grid_search import GridSearchCV
subjects = ["0008", "0009", "0010", "0012", "0014", "0015", "... | [
"sklearn.cross_validation.StratifiedKFold",
"numpy.save",
"sklearn.cross_validation.cross_val_score",
"numpy.concatenate",
"sklearn.externals.joblib.dump",
"sklearn.ensemble.AdaBoostClassifier",
"numpy.load",
"numpy.empty",
"numpy.asarray",
"bct.strengths_und",
"numpy.nonzero",
"numpy.arange",... | [((428, 444), 'numpy.empty', 'np.empty', (['[4, 6]'], {}), '([4, 6])\n', (436, 444), True, 'import numpy as np\n'), ((744, 763), 'numpy.asarray', 'np.asarray', (['cls_all'], {}), '(cls_all)\n', (754, 763), True, 'import numpy as np\n'), ((776, 795), 'numpy.asarray', 'np.asarray', (['pln_all'], {}), '(pln_all)\n', (786,... |
"""
--- Ångström ---
Molecular angle determination and calculation for Ångström Python package.
"""
import numpy as np
def get_angles(bonds):
"""
Iterate through bonds to get angles.
Bonds should NOT contain duplicates.
Parameters
----------
bonds : list
List of bonded atoms.
Ret... | [
"numpy.dot",
"numpy.array",
"numpy.degrees",
"numpy.linalg.norm"
] | [((1561, 1578), 'numpy.degrees', 'np.degrees', (['angle'], {}), '(angle)\n', (1571, 1578), True, 'import numpy as np\n'), ((1398, 1410), 'numpy.array', 'np.array', (['p1'], {}), '(p1)\n', (1406, 1410), True, 'import numpy as np\n'), ((1413, 1425), 'numpy.array', 'np.array', (['p2'], {}), '(p2)\n', (1421, 1425), True, '... |
""" This script performs calibration of experiment geometry.
Usage: python calibration.py experiment-parameters-file poni-file
experiment-parameters-file : file from which to get experiment parameters
poni-file : file to write the calibration info to
"""
import numpy as np
import sys
import pyFAI
pyFAI.use_opencl ... | [
"pyFAI.calibrant.get_calibrant",
"importlib.util.module_from_spec",
"importlib.util.spec_from_file_location",
"numpy.array",
"pyFAI.geometryRefinement.GeometryRefinement",
"datetime.datetime.now",
"pyFAI.detectors.Detector"
] | [((573, 637), 'importlib.util.spec_from_file_location', 'importlib.util.spec_from_file_location', (['"""what.ever"""', 'sys.argv[1]'], {}), "('what.ever', sys.argv[1])\n", (611, 637), False, 'import importlib\n'), ((652, 689), 'importlib.util.module_from_spec', 'importlib.util.module_from_spec', (['spec'], {}), '(spec)... |
from statsmodels.compat.python import range
from statsmodels.compat.testing import skipif
import numpy as np
from numpy.testing import assert_equal, assert_almost_equal
from statsmodels.graphics.functional import \
banddepth, fboxplot, rainbowplot
try:
import matplotlib.pyplot as plt
import matpl... | [
"numpy.random.seed",
"statsmodels.compat.python.range",
"statsmodels.compat.testing.skipif",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"numpy.testing.assert_almost_equal",
"matplotlib.pyplot.close",
"numpy.linspace",
"numpy.testing.assert_equal",
"numpy.asarray",
... | [((1401, 1463), 'statsmodels.compat.testing.skipif', 'skipif', (['(not have_matplotlib)'], {'reason': '"""matplotlib not available"""'}), "(not have_matplotlib, reason='matplotlib not available')\n", (1407, 1463), False, 'from statsmodels.compat.testing import skipif\n'), ((616, 644), 'numpy.asarray', 'np.asarray', (['... |
import tensorflow as tf
from Synth_data import random_input
import pickle
import numpy as np
class Off_Discrim:
def discriminator(self, data, config, reuse=False):
with tf.variable_scope("discriminator") as scope:
# correct?
if reuse:
scope.reuse_variable... | [
"tensorflow.train.Saver",
"tensorflow.trainable_variables",
"tensorflow.global_variables_initializer",
"tensorflow.layers.dense",
"tensorflow.Session",
"tensorflow.variable_scope",
"tensorflow.layers.flatten",
"tensorflow.train.RMSPropOptimizer",
"tensorflow.ones_like",
"tensorflow.placeholder",
... | [((919, 974), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[batch_size, seq_length, 1]'], {}), '(tf.float32, [batch_size, seq_length, 1])\n', (933, 974), True, 'import tensorflow as tf\n'), ((993, 1048), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[batch_size, seq_length, 1]'], {}), '(t... |
import os
import jpeg4py as jpeg
import numpy as np
import pandas as pd
import torch
from pathlib import Path
from torch.utils.data import DataLoader
from torch.utils.data import Dataset
from utils import make_mask
class TrainDataset(Dataset):
def __init__(self, df, data_folder, phase, transforms, num_classes, ... | [
"torch.utils.data.DataLoader",
"pandas.read_csv",
"numpy.zeros",
"torch.cat",
"os.path.exists",
"utils.make_mask",
"jpeg4py.JPEG",
"pathlib.Path",
"os.path.join",
"pandas.concat"
] | [((3620, 3693), 'pathlib.Path', 'Path', (['"""../Datasets/caliche/severstal-steel-defect-detection/train_images"""'], {}), "('../Datasets/caliche/severstal-steel-defect-detection/train_images')\n", (3624, 3693), False, 'from pathlib import Path\n'), ((3709, 3781), 'pathlib.Path', 'Path', (['"""../Datasets/caliche/sever... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mountain_scooter import MountainScooter
np.random.seed(9)
class QLearning(object):
"""
QLearning is a class that implements the Q-Learning off-policy TD control algorithm
by <NAME>, Reinforc... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"numpy.random.seed",
"numpy.argmax",
"matplotlib.pyplot.axes",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"matplotlib.pyplot.fill_between",
"numpy.meshgrid",
"numpy.std",
"numpy.power",
"num... | [((156, 173), 'numpy.random.seed', 'np.random.seed', (['(9)'], {}), '(9)\n', (170, 173), True, 'import numpy as np\n'), ((11717, 11744), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (11727, 11744), True, 'import matplotlib.pyplot as plt\n'), ((11936, 11955), 'matplotlib... |
#!/usr/bin/env python
import numpy as np
import numpy.random as nr
from unittest import TestCase
from ..bipartite_graph import (BipartiteGraph, cross_knn, cross_eps,
check_feature_matrices)
def basicdata():
x = np.array( [[-1.998,-2.024], [-0.117,-1.010], [1.099,-0.057],
... | [
"numpy.random.randn",
"nose.run",
"numpy.array",
"numpy.arange",
"numpy.random.rand"
] | [((251, 441), 'numpy.array', 'np.array', (['[[-1.998, -2.024], [-0.117, -1.01], [1.099, -0.057], [1.729, -0.252], [\n 1.003, -0.021], [1.703, -0.739], [-0.557, 1.382], [-1.2, -0.446], [-\n 0.331, -0.256], [-0.8, -1.584]]'], {}), '([[-1.998, -2.024], [-0.117, -1.01], [1.099, -0.057], [1.729, -\n 0.252], [1.003,... |
from causal_world.evaluation.protocols.protocol import ProtocolBase
import numpy as np
class FullyRandomProtocol(ProtocolBase):
def __init__(self, name, variable_space='space_a_b'):
"""
This specifies a fully random protocol, where an intervention is
produced on every exposed variable by ... | [
"numpy.random.uniform",
"numpy.random.choice"
] | [((1425, 1463), 'numpy.random.choice', 'np.random.choice', (['[0, 1]'], {'p': '[0.5, 0.5]'}), '([0, 1], p=[0.5, 0.5])\n', (1441, 1463), True, 'import numpy as np\n'), ((1507, 1541), 'numpy.random.choice', 'np.random.choice', (['[0, 1]'], {'p': '[1, 0]'}), '([0, 1], p=[1, 0])\n', (1523, 1541), True, 'import numpy as np\... |
from os import environ
from os.path import join
import numpy as np
from astropy.io import fits
from astropy.convolution import convolve, Box1DKernel
from scipy.linalg import solve
from matplotlib import pyplot as plt
import seaborn as sns
plt.interactive(True)
from redmonster.datamgr.io2 import read_ndArch
from redmo... | [
"seaborn.set_style",
"numpy.abs",
"matplotlib.pyplot.interactive",
"numpy.zeros",
"numpy.ones",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.axis",
"numpy.transpose",
"matplotlib.pyplot.figure",
"numpy.arange",
"astropy.io.fits.open",
"seaborn.color_palette",
"numpy.dot",
"numpy.diag",
... | [((240, 261), 'matplotlib.pyplot.interactive', 'plt.interactive', (['(True)'], {}), '(True)\n', (255, 261), True, 'from matplotlib import pyplot as plt\n'), ((617, 668), 'astropy.io.fits.open', 'fits.open', (['"""/Users/timhutchinson/Desktop/test.fits"""'], {}), "('/Users/timhutchinson/Desktop/test.fits')\n", (626, 668... |
# The MIT License (MIT)
#
# Copyright © 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge,... | [
"numpy.sum",
"numpy.random.seed",
"numpy.multiply",
"numpy.argmax",
"numpy.log",
"numpy.square",
"numpy.zeros",
"numpy.linalg.eig",
"numpy.max",
"numpy.arange",
"numpy.matmul",
"numpy.sign",
"numpy.random.shuffle",
"numpy.sqrt"
] | [((9212, 9236), 'numpy.arange', 'np.arange', (['(0)', 'Y.shape[1]'], {}), '(0, Y.shape[1])\n', (9221, 9236), True, 'import numpy as np\n'), ((14508, 14527), 'numpy.matmul', 'np.matmul', (['W.T', 'dZL'], {}), '(W.T, dZL)\n', (14517, 14527), True, 'import numpy as np\n'), ((16298, 16314), 'numpy.linalg.eig', 'np.linalg.e... |
from keras.layers import Conv2D
from keras import backend as K
from keras.engine.topology import Layer
from keras.activations import softmax
import numpy as np
class NAIDE_Conv2D_Q1(Conv2D):
"""
Mask Shape :
filter_shape = (3,3)
1 1 0
1 0 0
0 0 0
On... | [
"keras.backend.variable",
"keras.backend.bias_add",
"numpy.zeros",
"keras.backend.conv2d"
] | [((2272, 2287), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (2280, 2287), True, 'import numpy as np\n'), ((2391, 2412), 'keras.backend.variable', 'K.variable', (['self.mask'], {}), '(self.mask)\n', (2401, 2412), True, 'from keras import backend as K\n'), ((6124, 6139), 'numpy.zeros', 'np.zeros', (['shape']... |
import numpy as np
from multiagent.core import World, Agent, Landmark
from multiagent.scenario import BaseScenario
import multiagent.scenarios.ksu_map as ksu
import random
import time
class Scenario(BaseScenario):
def make_world(self):
world = World()
# set any world properties first
# Set... | [
"numpy.random.uniform",
"random.sample",
"numpy.square",
"numpy.zeros",
"multiagent.core.Landmark",
"time.time",
"numpy.array",
"multiagent.core.World",
"numpy.sqrt",
"numpy.concatenate",
"multiagent.core.Agent"
] | [((258, 265), 'multiagent.core.World', 'World', ([], {}), '()\n', (263, 265), False, 'from multiagent.core import World, Agent, Landmark\n'), ((6876, 6939), 'random.sample', 'random.sample', (['ksu.green_escaper_init_pos', 'self.num_good_agents'], {}), '(ksu.green_escaper_init_pos, self.num_good_agents)\n', (6889, 6939... |
# Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"cirq.LinearCombinationOfGates",
"cirq.Ry",
"cirq.IdentityGate",
"numpy.allclose",
"collections.Counter",
"cirq.pauli_expansion",
"pytest.raises",
"cirq.Rx",
"numpy.array",
"cirq.Rz",
"numpy.cos",
"cirq.unitary",
"numpy.sin",
"pytest.mark.parametrize",
"numpy.diag",
"numpy.sqrt"
] | [((679, 825), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""terms"""', '({cirq.X: -2, cirq.H: 2}, {cirq.XX: 1, cirq.YY: 1.0j, cirq.ZZ: -1}, {cirq.\n TOFFOLI: 0.5j, cirq.FREDKIN: 0.5})'], {}), "('terms', ({cirq.X: -2, cirq.H: 2}, {cirq.XX: 1,\n cirq.YY: 1.0j, cirq.ZZ: -1}, {cirq.TOFFOLI: 0.5j, cirq.F... |
# -*- coding: utf-8 -*-
"""
Author <NAME>
"""
import importlib
import warnings
import tensorflow as tf
import keras
from random import shuffle
from keras import backend as K
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense, Input, LSTM, Embedding, Dropout, Activation,Sp... | [
"matplotlib.pyplot.title",
"pickle.dump",
"csv.reader",
"argparse.ArgumentParser",
"numpy.argmax",
"keras.preprocessing.sequence.pad_sequences",
"keras.backend.epsilon",
"matplotlib.pyplot.figure",
"pickle.load",
"os.path.join",
"csv.DictWriter",
"keras.layers.embeddings.Embedding",
"sklearn... | [((1132, 1201), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'category': 'DeprecationWarning'}), "(action='ignore', category=DeprecationWarning)\n", (1155, 1201), False, 'import warnings\n'), ((1475, 1500), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', ... |
import tensorflow as tf
import tensorflow.keras as keras
from copy import deepcopy
import numpy as np
from DDnetwork import DeepNN
from Qtable import Qtable, next_state
# Initialize replay memory to capacity D
replay_memory = []
# Initialize the Q-network with random weights
q_net = DeepNN()
# Initialize the target Q... | [
"copy.deepcopy",
"Qtable.Qtable.best_action",
"tensorflow.keras.losses.MeanSquaredError",
"tensorflow.random.uniform",
"tensorflow.keras.optimizers.SGD",
"DDnetwork.DeepNN",
"numpy.array",
"tensorflow.GradientTape",
"Qtable.next_state"
] | [((286, 294), 'DDnetwork.DeepNN', 'DeepNN', ([], {}), '()\n', (292, 294), False, 'from DDnetwork import DeepNN\n'), ((383, 398), 'copy.deepcopy', 'deepcopy', (['q_net'], {}), '(q_net)\n', (391, 398), False, 'from copy import deepcopy\n'), ((481, 522), 'tensorflow.keras.optimizers.SGD', 'keras.optimizers.SGD', ([], {'le... |
import os
from copy import deepcopy
from typing import Dict, Iterable, List
import numpy as np
import spacy
import torch
import torchtext
from spacy.symbols import ORTH
from torch.utils.data import DataLoader
from utils import MeanAccumulator
from .model import RNNLM
class Batch:
def __init__(self, x, y, hidde... | [
"copy.deepcopy",
"torch.isnan",
"torch.random.manual_seed",
"torchtext.datasets.PennTreebank.splits",
"torchtext.datasets.WikiText2.splits",
"torch.distributed.get_rank",
"torch.random.fork_rng",
"torch.nn.CrossEntropyLoss",
"utils.MeanAccumulator",
"spacy.load",
"torch.distributed.get_world_siz... | [((8756, 8898), 'torchtext.data.BPTTIterator.splits', 'torchtext.data.BPTTIterator.splits', (['(train, valid)'], {'batch_size': 'batch_size', 'bptt_len': 'rnn_bptt_len', 'device': 'device', 'repeat': '(True)', 'shuffle': '(True)'}), '((train, valid), batch_size=batch_size,\n bptt_len=rnn_bptt_len, device=device, rep... |
import os
import numpy as np
from UCTB.dataset import NodeTrafficLoader_CPT
from UCTB.model import STMeta_V1
from UCTB.evaluation import metric
from UCTB.model_unit import GraphBuilder
from UCTB.preprocess import is_work_day_china
model_dir_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mod... | [
"json.dump",
"os.path.abspath",
"argparse.ArgumentParser",
"numpy.array",
"os.path.join",
"numpy.concatenate"
] | [((4642, 4685), 'os.path.join', 'os.path.join', (['model_dir_path', "args['Group']"], {}), "(model_dir_path, args['Group'])\n", (4654, 4685), False, 'import os\n'), ((400, 454), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Argument Parser"""'}), "(description='Argument Parser')\n", (42... |
# Code heavily adapted from:
# https://github.com/keras-team/keras-preprocessing/blob/master/keras_preprocessing/
"""Utilities for real-time data augmentation on image data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import warnings
i... | [
"numpy.divide",
"copy.deepcopy",
"albumentations.Compose",
"numpy.multiply",
"numpy.random.seed",
"numpy.copy",
"six.moves.range",
"numpy.std",
"numpy.zeros_like",
"scipy.linalg.svd",
"numpy.mean",
"random.seed",
"numpy.reshape",
"numpy.dot",
"warnings.warn",
"numpy.prod",
"numpy.sqr... | [((31108, 31118), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (31115, 31118), True, 'import numpy as np\n'), ((3682, 3715), 'albumentations.Compose', 'albumentations.Compose', (['[augment]'], {}), '([augment])\n', (3704, 3715), False, 'import albumentations\n'), ((3757, 3774), 'copy.deepcopy', 'deepcopy', (['augment... |
#System
import numpy as np
import sys
import os
import random
from glob import glob
from skimage import io
from PIL import Image
import random
import SimpleITK as sitk
#Torch
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
import torch.optim as optim
import torch.nn.functional as F
... | [
"numpy.amin",
"torch.nn.parallel.DataParallel",
"torch.nn.NLLLoss",
"glob.glob",
"os.path.join",
"torch.utils.data.DataLoader",
"os.path.exists",
"UNet_3D.UNet3D",
"torch.nn.functional.log_softmax",
"numpy.uint8",
"torch.autograd.Variable",
"random.random",
"os.makedirs",
"nibabel.load",
... | [((742, 767), 'os.path.exists', 'os.path.exists', (['ckpt_path'], {}), '(ckpt_path)\n', (756, 767), False, 'import os\n'), ((773, 795), 'os.makedirs', 'os.makedirs', (['ckpt_path'], {}), '(ckpt_path)\n', (784, 795), False, 'import os\n'), ((1341, 1356), 'numpy.amin', 'np.amin', (['slices'], {}), '(slices)\n', (1348, 13... |
import numpy as np
import numpy.linalg as LA
from flightcontrol.Utils import *
class Controller:
"""
Abstract class for flight controllers
Provides disable_control_loops method, which disables loops based on NaNs in the reference input.
Must override this class.
"""
def __init__(self, params... | [
"numpy.stack",
"numpy.zeros",
"numpy.arcsin",
"numpy.isnan",
"numpy.clip",
"numpy.cross",
"numpy.array",
"numpy.linalg.norm",
"numpy.atleast_1d",
"numpy.concatenate"
] | [((724, 744), 'numpy.isnan', 'np.isnan', (["ref['pos']"], {}), "(ref['pos'])\n", (732, 744), True, 'import numpy as np\n'), ((2224, 2255), 'numpy.arcsin', 'np.arcsin', (['(acc_des_b[1] / T_des)'], {}), '(acc_des_b[1] / T_des)\n', (2233, 2255), True, 'import numpy as np\n'), ((2333, 2356), 'numpy.zeros', 'np.zeros', (['... |
import cv2
import numpy as np
def nothing(x):
pass
img=cv2.VideoCapture(0)
#cv2.namedWindow("Trackbars")
cv2.createTrackbar("L-H", "Trackbars",0, 255,nothing)
cv2.createTrackbar("L-S", "Trackbars",0, 255,nothing)
cv2.createTrackbar("L-V", "Trackbars",0, 255,nothing)
cv2.createTrackbar("U-H", "Trackbars",0, 255,n... | [
"cv2.createTrackbar",
"cv2.bitwise_and",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"numpy.array",
"cv2.getTrackbarPos",
"cv2.destroyAllWindows",
"cv2.inRange"
] | [((61, 80), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (77, 80), False, 'import cv2\n'), ((112, 167), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""L-H"""', '"""Trackbars"""', '(0)', '(255)', 'nothing'], {}), "('L-H', 'Trackbars', 0, 255, nothing)\n", (130, 167), False, 'import cv2\n'), ((166, ... |
import onnx
from onnx_tf.backend import prepare
ONNX_PATH = "mnist_cnn.onnx"
TF_PATH = "mnist_cnn_tf"
# Load the ONNX model
onnx_model = onnx.load(ONNX_PATH)
# Export ONNX model to TensorFlow model
tf_model = prepare(onnx_model)
tf_model.export_graph(TF_PATH)
import tensorflow as tf
import tensorflow_datasets as t... | [
"tensorflow_datasets.load",
"tensorflow.reshape",
"onnx_tf.backend.prepare",
"numpy.array",
"tensorflow.keras.metrics.SparseCategoricalAccuracy",
"onnx.load",
"tensorflow.saved_model.load"
] | [((139, 159), 'onnx.load', 'onnx.load', (['ONNX_PATH'], {}), '(ONNX_PATH)\n', (148, 159), False, 'import onnx\n'), ((212, 231), 'onnx_tf.backend.prepare', 'prepare', (['onnx_model'], {}), '(onnx_model)\n', (219, 231), False, 'from onnx_tf.backend import prepare\n'), ((380, 428), 'tensorflow_datasets.load', 'tfds.load',... |
import tensorflow as tf
import numpy as np
from scipy.stats import rankdata
tf.get_logger().setLevel('INFO')
tf.autograph.set_verbosity(1)
from collections import defaultdict as ddict
np.random.seed(1234)
import os
import time
import datetime, pickle
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.sum",
"numpy.argsort",
"tensorflow.ConfigProto",
"tensorflow.Variable",
"numpy.random.randint",
"os.path.join",
"tensorflow.autograph.set_verbosity",
"tensorflow.get_logger",
"tensorflow.set_random_seed",
"numpy.insert",
"numpy.reshape",... | [((109, 138), 'tensorflow.autograph.set_verbosity', 'tf.autograph.set_verbosity', (['(1)'], {}), '(1)\n', (135, 138), True, 'import tensorflow as tf\n'), ((186, 206), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (200, 206), True, 'import numpy as np\n'), ((500, 602), 'argparse.ArgumentParser', '... |
import itertools
import time
import numpy as np
from rlsuite.utils import Logger
def nstep_prediction(
env_fn,
policy,
alpha,
n,
gamma,
num_iter,
seed=0,
data_dir=None,
log_freq=0,
):
"""n-step value prediction.
Args:
env_fn (func): A function that creates an ins... | [
"numpy.random.seed",
"numpy.zeros",
"time.time",
"numpy.max",
"numpy.arange",
"rlsuite.utils.Logger",
"numpy.random.choice"
] | [((1295, 1341), 'rlsuite.utils.Logger', 'Logger', ([], {'output_dir': 'data_dir', 'log_freq': 'log_freq'}), '(output_dir=data_dir, log_freq=log_freq)\n', (1301, 1341), False, 'from rlsuite.utils import Logger\n'), ((1464, 1484), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1478, 1484), True, 'imp... |
#!/usr/bin/env python
# Copyright 2017 Calico LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"os.mkdir",
"os.remove",
"tensorflow.train.Coordinator",
"optparse.OptionParser",
"basenji.params.read_job_params",
"os.path.isfile",
"pickle.load",
"pandas.read_table",
"basenji.dna_io.dna_1hot",
"threading.Thread.__init__",
"numpy.copy",
"tensorflow.train.start_queue_runners",
"h5py.File",... | [((1435, 1454), 'optparse.OptionParser', 'OptionParser', (['usage'], {}), '(usage)\n', (1447, 1454), False, 'from optparse import OptionParser\n'), ((3474, 3509), 'basenji.params.read_job_params', 'params.read_job_params', (['params_file'], {}), '(params_file)\n', (3496, 3509), False, 'from basenji import params\n'), (... |
# Run the blending process
# <NAME>, July 6, 2017 (MATLAB)
# <NAME>, July 14, 2017 (Python)
import numpy as np
from scipy.integrate import odeint
# Here is the playlist for the accompanying screencasts:
# https://www.youtube.com/playlist?list=PL4xAk5aclnUhb0tM6nypIATyxPRk0fB3L
# Following on the first screencast (Bl... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.size",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.copy",
"scipy.integrate.odeint",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linspace",
"numpy.dot",
"matplotlib.pyplot.ylabel",
... | [((3009, 3032), 'numpy.linspace', 'np.linspace', (['(0)', 'tf', '(100)'], {}), '(0, tf, 100)\n', (3020, 3032), True, 'import numpy as np\n'), ((3096, 3130), 'scipy.integrate.odeint', 'odeint', (['blending', 'z0', 't'], {'args': '(u,)'}), '(blending, z0, t, args=(u,))\n', (3102, 3130), False, 'from scipy.integrate impor... |
from cycler import cycler
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import numpy as np
from PIL import Image
import pymc3 as pm
import theano
import theano.tensor as tt
from tqdm import tqdm
import scipy
def get_rainbow():
"""Creates a rainbow color cycle"""
return cycler(... | [
"cycler.cycler",
"PIL.Image.new",
"pymc3.Model",
"scipy.ndimage.filters.gaussian_filter",
"numpy.zeros_like",
"tqdm.tqdm",
"numpy.log",
"numpy.zeros",
"numpy.flipud",
"PIL.Image.open",
"pymc3.Metropolis",
"numpy.arange",
"numpy.linspace",
"numpy.round",
"matplotlib.pyplot.subplots",
"P... | [((313, 411), 'cycler.cycler', 'cycler', (['"""color"""', "['#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#0000FF', '#4B0082', '#9400D3']"], {}), "('color', ['#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#0000FF',\n '#4B0082', '#9400D3'])\n", (319, 411), False, 'from cycler import cycler\n'), ((898, 920), 'PIL.Image.o... |
################################################################################
# @file numerics.py
# @author <NAME>
# @brief
# @version 1.0.0
# @date 2022-02-22
# @copyright Copyright (c) 2022 by <NAME>.
# This work is licensed under terms of the MIT license (<LICENSE>).
#############################################... | [
"numpy.abs",
"numpy.copy",
"numpy.zeros",
"numpy.array",
"numpy.matmul",
"numpy.dot",
"numpy.linalg.solve",
"numpy.atleast_2d"
] | [((1565, 1586), 'numpy.zeros', 'np.zeros', (['b_mod.shape'], {}), '(b_mod.shape)\n', (1573, 1586), True, 'import numpy as np\n'), ((2841, 2885), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 25, 6], [1, 8, 1]]'], {}), '([[1, 2, 3], [4, 25, 6], [1, 8, 1]])\n', (2849, 2885), True, 'import numpy as np\n'), ((2894, 2920), ... |
# Copyright (c) 2017 The Khronos Group Inc.
#
# 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 ... | [
"tensorflow.train.Saver",
"tensorflow.reset_default_graph",
"os.walk",
"tensorflow.Session",
"tensorflow.assign",
"tempfile.mkdtemp",
"numpy.reshape",
"shutil.rmtree",
"tensorflow.get_default_graph",
"os.path.join"
] | [((4799, 4823), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (4821, 4823), True, 'import tensorflow as tf\n'), ((4882, 4898), 'tensorflow.train.Saver', 'tf.train.Saver', ([], {}), '()\n', (4896, 4898), True, 'import tensorflow as tf\n'), ((5607, 5624), 'os.walk', 'os.walk', (['dir_name'... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/loader.ipynb (unless otherwise specified).
__all__ = ['default_image_loader', 'TripletImageLoader', 'FILENAMES']
# Cell
from PIL import Image
import os
import os.path
import torch.utils.data
import torchvision.transforms as transforms
import numpy as np
# Cell
FILENAME... | [
"os.path.join",
"numpy.random.shuffle",
"PIL.Image.open"
] | [((2258, 2285), 'numpy.random.shuffle', 'np.random.shuffle', (['triplets'], {}), '(triplets)\n', (2275, 2285), True, 'import numpy as np\n'), ((839, 855), 'PIL.Image.open', 'Image.open', (['path'], {}), '(path)\n', (849, 855), False, 'from PIL import Image\n'), ((1670, 1704), 'os.path.join', 'os.path.join', (['self.roo... |
# resizing the matrices
import numpy as np
a=np.array([[1,2],[3,4],[5,6]])
print(a)
a=np.resize(a,(6,1))
print(a) | [
"numpy.array",
"numpy.resize"
] | [((45, 79), 'numpy.array', 'np.array', (['[[1, 2], [3, 4], [5, 6]]'], {}), '([[1, 2], [3, 4], [5, 6]])\n', (53, 79), True, 'import numpy as np\n'), ((86, 106), 'numpy.resize', 'np.resize', (['a', '(6, 1)'], {}), '(a, (6, 1))\n', (95, 106), True, 'import numpy as np\n')] |
import os
from pyneval.model.swc_node import SwcTree
from pyneval.model.euclidean_point import Line
from pyneval.metric.utils.edge_match_utils import \
get_idedge_dict, get_edge_rtree, get_lca_length, get_nearby_edges, get_route_node, \
cal_rad_threshold, cal_len_threshold
from pyneval.tools.re_sample import d... | [
"pyneval.metric.utils.edge_match_utils.get_idedge_dict",
"math.fabs",
"pyneval.metric.utils.edge_match_utils.cal_len_threshold",
"anytree.PreOrderIter",
"numpy.zeros",
"math.acos",
"pyneval.tools.re_sample.down_sample_swc_tree_command_line",
"pyneval.metric.utils.edge_match_utils.get_nearby_edges",
... | [((1127, 1171), 'pyneval.metric.utils.edge_match_utils.get_route_node', 'get_route_node', (['gold_line_tuple_a[0]', 'lca_id'], {}), '(gold_line_tuple_a[0], lca_id)\n', (1141, 1171), False, 'from pyneval.metric.utils.edge_match_utils import get_idedge_dict, get_edge_rtree, get_lca_length, get_nearby_edges, get_route_nod... |
from CHECLabPy.utils.mapping import get_clp_mapping_from_version
import numpy as np
from CHECLabPy.plotting.camera import CameraImage
from IPython import embed
def main():
file = np.load("cherenkov.npz")
cherenkov = file['frames']
min_array = file['min']
max_array = file['max']
n_pixels, n_frames ... | [
"CHECLabPy.plotting.camera.CameraImage.from_camera_version",
"numpy.load",
"CHECLabPy.utils.mapping.get_clp_mapping_from_version"
] | [((185, 209), 'numpy.load', 'np.load', (['"""cherenkov.npz"""'], {}), "('cherenkov.npz')\n", (192, 209), True, 'import numpy as np\n'), ((353, 387), 'numpy.load', 'np.load', (['"""happy_birthday_rich.npy"""'], {}), "('happy_birthday_rich.npy')\n", (360, 387), True, 'import numpy as np\n'), ((398, 438), 'CHECLabPy.plott... |
import numpy as np
class Atom(object):
def __init__(self,atno,x,y,z):
self.atno = atno
self.xyz = np.array((x,y,z),'d')
return
| [
"numpy.array"
] | [((119, 143), 'numpy.array', 'np.array', (['(x, y, z)', '"""d"""'], {}), "((x, y, z), 'd')\n", (127, 143), True, 'import numpy as np\n')] |
import numpy as np
import chainer
from scipy.spatial.transform import Rotation
import chainer_graphics.transform as T
TESTCASES = 10
def test_euler2rot():
angles = np.random.randn(TESTCASES, 3)
R1 = Rotation.from_euler('xyz', angles).as_dcm()
R2 = T.euler2rot(chainer.Variable(angles)).data
assert(np.... | [
"chainer.Variable",
"numpy.allclose",
"scipy.spatial.transform.Rotation.from_euler",
"numpy.random.randn"
] | [((171, 200), 'numpy.random.randn', 'np.random.randn', (['TESTCASES', '(3)'], {}), '(TESTCASES, 3)\n', (186, 200), True, 'import numpy as np\n'), ((317, 336), 'numpy.allclose', 'np.allclose', (['R1', 'R2'], {}), '(R1, R2)\n', (328, 336), True, 'import numpy as np\n'), ((375, 404), 'numpy.random.randn', 'np.random.randn... |
import numpy as np
import matplotlib.pyplot as plt
import os
N = 100
def parser(path):
with open(path, 'rb') as file:
return np.load(file)
def ocu(data):
oc = np.full((N, 3, N, 3), 0, dtype=complex)
for index, val in np.ndenumerate(data):
j = index[0]
m = index[1]
l = ind... | [
"numpy.full",
"numpy.load",
"numpy.ndenumerate",
"numpy.array",
"os.chdir"
] | [((660, 681), 'os.chdir', 'os.chdir', (['"""Coherent2"""'], {}), "('Coherent2')\n", (668, 681), False, 'import os\n'), ((179, 218), 'numpy.full', 'np.full', (['(N, 3, N, 3)', '(0)'], {'dtype': 'complex'}), '((N, 3, N, 3), 0, dtype=complex)\n', (186, 218), True, 'import numpy as np\n'), ((241, 261), 'numpy.ndenumerate',... |
"""Objects related to pandas dataframes."""
from typing import Tuple, Union, List, Any, Dict, Optional, cast, Callable
import numpy as np
import pandas as pd
from pandas.api.types import union_categoricals
from owid.datautils.common import ExceptionFromDocstring, warn_on_list_of_entities
class DataFramesHaveDiffer... | [
"pandas.DataFrame",
"pandas.merge",
"pandas.Categorical.from_codes",
"pandas.isnull",
"numpy.isclose",
"pandas.Categorical",
"pandas.concat",
"pandas.api.types.union_categoricals"
] | [((2711, 2725), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2723, 2725), True, 'import pandas as pd\n'), ((15849, 15873), 'pandas.concat', 'pd.concat', (['dfs'], {}), '(dfs, **kwargs)\n', (15858, 15873), True, 'import pandas as pd\n'), ((7048, 7062), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (706... |
import matplotlib.pyplot as plt
import numpy
# testing neuron1 output function for w = 2 and different s
def neuron1_output_function(x, s):
return 1 / (1 + abs(x - 2) / abs(s))
# domain
x = numpy.linspace(-8, 10)
for s in [1, 0.25, 4]:
plt.plot(x, neuron1_output_function(x, s), label="s : " + str(s))
plt.le... | [
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show",
"numpy.linspace"
] | [((196, 218), 'numpy.linspace', 'numpy.linspace', (['(-8)', '(10)'], {}), '(-8, 10)\n', (210, 218), False, 'import numpy\n'), ((314, 336), 'matplotlib.pyplot.legend', 'plt.legend', ([], {'loc': '"""best"""'}), "(loc='best')\n", (324, 336), True, 'import matplotlib.pyplot as plt\n'), ((337, 347), 'matplotlib.pyplot.show... |
import sys, pickle
from tqdm import trange
import numpy as np
import matplotlib.pyplot as plt
from sampler import ee_avg_jerk
warmup_discard = 2000
grid_size = 10
num_display = grid_size * grid_size
results = [
["ds_min_avg_jerk.samples.pkl"],
]
metrics = [
ee_avg_jerk
]
pr... | [
"numpy.mean",
"numpy.array"
] | [((2261, 2291), 'numpy.mean', 'np.mean', (['sampled_behavior_list'], {}), '(sampled_behavior_list)\n', (2268, 2291), True, 'import numpy as np\n'), ((1136, 1165), 'numpy.array', 'np.array', (['prior_behavior_list'], {}), '(prior_behavior_list)\n', (1144, 1165), True, 'import numpy as np\n')] |
"""Create weather realisation
"""
import os
import pandas as pd
import numpy as np
def create_folder(path_folder, name_subfolder=None):
"""Creates folder or subfolder
Arguments
----------
path : str
Path to folder
folder_name : str, default=None
Name of subfolder to create
"""
... | [
"pandas.DataFrame",
"numpy.load",
"os.makedirs",
"pandas.read_csv",
"os.path.exists",
"pandas.read_table",
"os.path.join"
] | [((1211, 1254), 'os.path.join', 'os.path.join', (['path_results', '"""_realizations"""'], {}), "(path_results, '_realizations')\n", (1223, 1254), False, 'import os\n'), ((1359, 1402), 'pandas.read_table', 'pd.read_table', (['path_stiching_table'], {'sep': '""" """'}), "(path_stiching_table, sep=' ')\n", (1372, 1402), T... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name, no-member
from collections import OrderedDict
import pytest
import numpy as np
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from astropy.modeling.functional_models import (
... | [
"astropy.units.Quantity",
"numpy.log",
"astropy.tests.helper.assert_quantity_allclose",
"pytest.skip",
"astropy.modeling.fitting.LevMarLSQFitter",
"pytest.mark.filterwarnings",
"pytest.raises",
"pytest.mark.skipif",
"numpy.exp",
"numpy.linspace",
"pytest.mark.parametrize",
"numpy.repeat"
] | [((8844, 8884), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model"""', 'MODELS'], {}), "('model', MODELS)\n", (8867, 8884), False, 'import pytest\n'), ((9542, 9582), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model"""', 'MODELS'], {}), "('model', MODELS)\n", (9565, 9582), False, 'import... |
import numpy as np
from gym.spaces import Box
from metaworld.envs.asset_path_utils import full_v2_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
from metaworld.envs.mujoco.sawyer_xyz.v2.sawyer_stick_push_v2 import SawyerStickPushEnvV2
class SawyerHookPullEnvV2(S... | [
"numpy.hstack",
"numpy.linalg.norm",
"numpy.array",
"metaworld.envs.asset_path_utils.full_v2_path_for",
"numpy.concatenate",
"metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env.SawyerXYZEnv.step"
] | [((1144, 1169), 'numpy.array', 'np.array', (['[0.2, 0.6, 0.0]'], {}), '([0.2, 0.6, 0.0])\n', (1152, 1169), True, 'import numpy as np\n'), ((1199, 1219), 'numpy.array', 'np.array', (['[0.0, 0.0]'], {}), '([0.0, 0.0])\n', (1207, 1219), True, 'import numpy as np\n'), ((1555, 1605), 'metaworld.envs.asset_path_utils.full_v2... |
"""Integrals of the power spectrum. This includes RMS variance of the density field, sigma2, as well as peak neight, nu. These were previously implemented in the bias module, but have been migrated to here.
"""
import cluster_toolkit
from cluster_toolkit import _dcast
import numpy as np
from numpy import ascontiguousa... | [
"cluster_toolkit._dcast",
"numpy.zeros_like"
] | [((912, 928), 'numpy.zeros_like', 'np.zeros_like', (['M'], {}), '(M)\n', (925, 928), True, 'import numpy as np\n'), ((1635, 1651), 'numpy.zeros_like', 'np.zeros_like', (['R'], {}), '(R)\n', (1648, 1651), True, 'import numpy as np\n'), ((2428, 2444), 'numpy.zeros_like', 'np.zeros_like', (['M'], {}), '(M)\n', (2441, 2444... |
import os
import cv2
import datetime
import numpy as np
import pandas as pd
from PIL import Image
import streamlit as st
from tensorflow import keras
from streamlit import caching
from keras.models import load_model
from keras.preprocessing import image
from keras.preprocessing.image import img_to_array
#//----------... | [
"keras.models.load_model",
"streamlit.image",
"numpy.sum",
"pandas.read_csv",
"keras.preprocessing.image.img_to_array",
"cv2.rectangle",
"streamlit.set_page_config",
"cv2.cvtColor",
"datetime.datetime.now",
"cv2.resize",
"streamlit.checkbox",
"streamlit.markdown",
"cv2.putText",
"os.makedi... | [((2101, 2170), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Emotion Detection"""', 'page_icon': 'favicon'}), "(page_title='Emotion Detection', page_icon=favicon)\n", (2119, 2170), True, 'import streamlit as st\n'), ((2181, 2197), 'PIL.Image.open', 'Image.open', (['logo'], {}), '(logo)\n',... |
import torch
from torch import nn
from torch.nn import CrossEntropyLoss
import jieba
import gensim
from transformers import BertTokenizer, BertForMaskedLM
from scipy.special import softmax
import numpy as np
import traceback
import OpenHowNet
def substitute_ranking(row_line, model_word2vector, model, tokenizer, hownet... | [
"OpenHowNet.HowNetDict",
"transformers.BertForMaskedLM.from_pretrained",
"transformers.BertTokenizer.from_pretrained",
"gensim.models.KeyedVectors.load_word2vec_format",
"scipy.special.softmax",
"numpy.log10",
"torch.no_grad"
] | [((3290, 3308), 'scipy.special.softmax', 'softmax', (['X'], {'axis': '(1)'}), '(X, axis=1)\n', (3297, 3308), False, 'from scipy.special import softmax\n'), ((3334, 3353), 'numpy.log10', 'np.log10', (['X[i, pos]'], {}), '(X[i, pos])\n', (3342, 3353), True, 'import numpy as np\n'), ((6163, 6205), 'transformers.BertTokeni... |
#!/usr/bin/env python3
import numpy as np
from numpy import pi
from numpy.testing import assert_array_less
import unittest
import networkx as nx
from graphik.graphs import (
ProblemGraphPlanar,
ProblemGraphRevolute,
)
from graphik.robots import RobotRevolute, RobotPlanar
from graphik.utils.dgp import pos_from_g... | [
"graphik.utils.dgp.bound_smoothing",
"graphik.graphs.ProblemGraphPlanar",
"numpy.random.seed",
"numpy.random.rand",
"numpy.zeros",
"numpy.ones",
"networkx.relabel_nodes",
"graphik.robots.RobotPlanar",
"networkx.to_dict_of_lists",
"graphik.utils.dgp.pos_from_graph",
"networkx.balanced_tree",
"g... | [((4154, 4172), 'numpy.random.seed', 'np.random.seed', (['(22)'], {}), '(22)\n', (4168, 4172), True, 'import numpy as np\n'), ((3461, 3472), 'graphik.utils.roboturdf.load_ur10', 'load_ur10', ([], {}), '()\n', (3470, 3472), False, 'from graphik.utils.roboturdf import load_ur10\n'), ((1136, 1155), 'graphik.robots.RobotPl... |
"""
Commands for making opening one or more dicoms very easy
"""
import os
from collections import namedtuple
from typing import Any
import numpy as np
import pandas as pd
import pydicom
from .utils import _rel_glob, BASE_DIR
type_info = namedtuple('type_info',
['inferrable', 'realtype', 'has... | [
"pandas.DataFrame",
"pydicom.read_file",
"numpy.isnan",
"collections.namedtuple",
"os.path.join"
] | [((242, 337), 'collections.namedtuple', 'namedtuple', (['"""type_info"""', "['inferrable', 'realtype', 'has_nulltype', 'length', 'is_complex']"], {}), "('type_info', ['inferrable', 'realtype', 'has_nulltype', 'length',\n 'is_complex'])\n", (252, 337), False, 'from collections import namedtuple\n'), ((1411, 1433), 'p... |
import numpy as np
from eelbrain._stats import opt, stats
np.random.seed(0)
n_cases = 100
n_tests = 1000
n_betas = 3
n_fs = 2
# lm
y = np.random.normal(0, 1, (n_cases, n_tests))
x = np.random.normal(0, 1, (n_cases, n_betas))
xsinv = np.random.normal(0, 1, (n_betas, n_cases))
betas = np.empty((n_tests, n_betas))
ss =... | [
"numpy.random.seed",
"numpy.empty",
"numpy.arange",
"numpy.array",
"numpy.random.normal",
"numpy.random.shuffle"
] | [((59, 76), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (73, 76), True, 'import numpy as np\n'), ((138, 180), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(n_cases, n_tests)'], {}), '(0, 1, (n_cases, n_tests))\n', (154, 180), True, 'import numpy as np\n'), ((185, 227), 'numpy.random.no... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
dataloader_tokens.py
Created on Oct 14 2019 12:13
Load sketch tokens
@author: <NAME> <EMAIL>
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import pandas as pd
import random... | [
"numpy.load",
"pandas.read_csv",
"random.shuffle",
"os.path.dirname",
"numpy.zeros",
"numpy.arange",
"numpy.array",
"numpy.squeeze",
"os.path.join",
"numpy.unique"
] | [((1658, 1675), 'numpy.load', 'np.load', (['seg_path'], {}), '(seg_path)\n', (1665, 1675), True, 'import numpy as np\n'), ((630, 648), 'numpy.load', 'np.load', (['data_path'], {}), '(data_path)\n', (637, 648), True, 'import numpy as np\n'), ((2556, 2582), 'os.path.dirname', 'os.path.dirname', (['data_path'], {}), '(dat... |
import numpy as np
import json
from functools import partial
import caffe
import time
import sys,os
sys.path.insert(0, './python/')
import ncs
from base import *
from easydict import EasyDict as edict
import pdb
from base import *
config=read_json("config.json")
proto=config['proto']
weights='./models/lenet300100/le... | [
"numpy.load",
"numpy.random.seed",
"ncs.NCS",
"sys.path.insert",
"time.sleep",
"numpy.where",
"numpy.array",
"pdb.set_trace",
"easydict.EasyDict"
] | [((100, 131), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./python/"""'], {}), "(0, './python/')\n", (115, 131), False, 'import sys, os\n'), ((886, 908), 'numpy.random.seed', 'np.random.seed', (['[seed]'], {}), '([seed])\n', (900, 908), True, 'import numpy as np\n'), ((4036, 4043), 'easydict.EasyDict', 'edict', ... |
import os
from tqdm import tqdm
import numpy as np
from mypath import Path
def calculate_weigths_labels(dataset, dataloader, num_classes):
# Create an instance from the data loader
z = np.zeros((num_classes,))
# Initialize tqdm
tqdm_batch = tqdm(dataloader)
print('Calculating classes weights')
for sample in tqdm... | [
"tqdm.tqdm",
"numpy.save",
"numpy.sum",
"numpy.log",
"numpy.zeros",
"numpy.array",
"numpy.bincount",
"mypath.Path.db_root_dir"
] | [((188, 212), 'numpy.zeros', 'np.zeros', (['(num_classes,)'], {}), '((num_classes,))\n', (196, 212), True, 'import numpy as np\n'), ((246, 262), 'tqdm.tqdm', 'tqdm', (['dataloader'], {}), '(dataloader)\n', (250, 262), False, 'from tqdm import tqdm\n'), ((564, 573), 'numpy.sum', 'np.sum', (['z'], {}), '(z)\n', (570, 573... |
import csv
import importlib
import os
from time import time
import glob
import cv2
import numpy as np
import tifffile
import torch
import subprocess
from PIL import Image, ImageOps
def get_class(class_name):
"""returns the class type for a given class name. Expects a string of type `module.submodule.Class`"""
... | [
"csv.reader",
"os.walk",
"os.path.join",
"cv2.imwrite",
"PIL.ImageOps.invert",
"numpy.reshape",
"importlib.import_module",
"os.path.basename",
"numpy.asarray",
"subprocess.call",
"os.listdir",
"os.makedirs",
"os.path.isdir",
"time.time",
"PIL.Image.open",
"cv2.imread",
"os.path.split... | [((887, 908), 'tifffile.imread', 'tifffile.imread', (['file'], {}), '(file)\n', (902, 908), False, 'import tifffile\n'), ((999, 1026), 'os.path.splitext', 'os.path.splitext', (['file_path'], {}), '(file_path)\n', (1015, 1026), False, 'import os\n'), ((1498, 1513), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n'... |
# ==============================================================================
# Copyright (C) 2018-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
from gstgva import VideoFrame, util
import sys
import numpy
import cv2
from argp... | [
"gi.require_version",
"cv2.putText",
"argparse.ArgumentParser",
"numpy.argmax",
"gi.repository.GLib.MainLoop",
"gstgva.VideoFrame",
"gstgva.util.GST_PAD_PROBE_INFO_BUFFER",
"gi.repository.Gst.parse_launch",
"gi.repository.Gst.init",
"sys.exit"
] | [((358, 394), 'gi.require_version', 'gi.require_version', (['"""GObject"""', '"""2.0"""'], {}), "('GObject', '2.0')\n", (376, 394), False, 'import gi\n'), ((395, 427), 'gi.require_version', 'gi.require_version', (['"""Gst"""', '"""1.0"""'], {}), "('Gst', '1.0')\n", (413, 427), False, 'import gi\n'), ((428, 463), 'gi.re... |
import collections
import itertools
from bidict import bidict
import numpy as np
from .utils import Y, CB, CR
EOB = (0, 0)
ZRL = (15, 0)
DC = 'DC'
AC = 'AC'
LUMINANCE = frozenset({Y})
CHROMINANCE = frozenset({CB, CR})
class Encoder:
def __init__(self, data, layer_type):
"""Create a encoder based on ba... | [
"bidict.bidict",
"numpy.empty",
"numpy.nditer",
"itertools.accumulate",
"itertools.count",
"itertools.groupby"
] | [((9552, 9577), 'itertools.accumulate', 'itertools.accumulate', (['seq'], {}), '(seq)\n', (9572, 9577), False, 'import itertools\n'), ((10725, 10740), 'numpy.nditer', 'np.nditer', (['data'], {}), '(data)\n', (10734, 10740), True, 'import numpy as np\n'), ((11431, 11464), 'numpy.empty', 'np.empty', (['(size, size)'], {'... |
from __future__ import print_function
import numpy as np
import config
import melbank
class ExpFilter:
"""Simple exponential smoothing filter. Wikipedia it..."""
def __init__(self, val=0.0, alpha_decay=0.5, alpha_rise=0.5):
"""Small rise / decay factors = more smoothing"""
assert 0.0 < alpha_... | [
"numpy.fft.fft",
"numpy.fft.rfft",
"melbank.compute_melmat"
] | [((1300, 1325), 'numpy.fft.fft', 'np.fft.fft', (['(data * window)'], {}), '(data * window)\n', (1310, 1325), True, 'import numpy as np\n'), ((1663, 1841), 'melbank.compute_melmat', 'melbank.compute_melmat', ([], {'num_mel_bands': 'config.N_FFT_BINS', 'freq_min': 'config.MIN_FREQUENCY', 'freq_max': 'config.MAX_FREQUENCY... |
import os
import time
import argparse
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import animation
from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler
from models.logistic_regression import LogisticRegression
plt.style.use('seaborn')
... | [
"sklearn.preprocessing.StandardScaler",
"argparse.ArgumentParser",
"matplotlib.pyplot.show",
"seaborn.scatterplot",
"os.makedirs",
"matplotlib.pyplot.close",
"os.path.exists",
"sklearn.datasets.make_blobs",
"matplotlib.animation.FuncAnimation",
"time.time",
"matplotlib.pyplot.style.use",
"matp... | [((293, 317), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (306, 317), True, 'import matplotlib.pyplot as plt\n'), ((353, 432), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parameters to tweak Logistic Regression."""'}), "(description='Param... |
# Copyright 2016 ELIFE. All rights reserved.
# Use of this source code is governed by a MIT
# license that can be found in the LICENSE file.
"""
`Transfer entropy`_ (TE) measures the amount of directed transfer of information
between two random processes. The local variant of TE is defined as
.. math::
t_{Y \\rig... | [
"ctypes.c_int",
"pyinform.error.error_guard",
"ctypes.byref",
"numpy.empty",
"ctypes.c_ulong",
"pyinform.error.ErrorCode",
"numpy.amax",
"numpy.ascontiguousarray",
"ctypes.POINTER"
] | [((7383, 7400), 'ctypes.POINTER', 'POINTER', (['c_double'], {}), '(c_double)\n', (7390, 7400), False, 'from ctypes import byref, c_char_p, c_int, c_ulong, c_double, POINTER\n'), ((5938, 5976), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['source', 'np.int32'], {}), '(source, np.int32)\n', (5958, 5976), True, 'i... |
from RigidFoilSimer import Parameters
import os, sys
import subprocess
import shutil
import numpy as np
MainCodePath = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(MainCodePath)
def getTasks(name):
timer = 0
ramp = 0
tasks = []
while tasks or ramp < 2:
tasks = ... | [
"sys.path.append",
"subprocess.Popen",
"os.path.abspath",
"os.path.realpath",
"os.popen",
"numpy.array",
"RigidFoilSimer.Parameters.path_check",
"sys.exit"
] | [((182, 211), 'sys.path.append', 'sys.path.append', (['MainCodePath'], {}), '(MainCodePath)\n', (197, 211), False, 'import os, sys\n'), ((1464, 1516), 'subprocess.Popen', 'subprocess.Popen', (["[WB_path, '-R', wbjn_path, method]"], {}), "([WB_path, '-R', wbjn_path, method])\n", (1480, 1516), False, 'import subprocess\n... |
import os, sys
import sklearn
sys.path.append('..')
import numpy as np
import h5py
import random
from matplotlib.pyplot import imshow, imsave
from PIL import Image
from lib.data_utils import convert_img, convert_img_back
def toy_dataset(DATASET='8gaussians', size=256):
if DATASET == '25gaussians':
da... | [
"sys.path.append",
"h5py.File",
"lib.data_utils.convert_img",
"numpy.random.randn",
"numpy.zeros",
"random.choice",
"PIL.Image.open",
"numpy.shape",
"sklearn.datasets.make_swiss_roll",
"numpy.array",
"matplotlib.pyplot.imsave",
"lib.data_utils.convert_img_back",
"os.listdir",
"numpy.random... | [((32, 53), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (47, 53), False, 'import os, sys\n'), ((2051, 2072), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (2061, 2072), False, 'import os, sys\n'), ((2082, 2130), 'numpy.zeros', 'np.zeros', (['(stop - start, C, H, W)'], {'dty... |
# Copyright (c) 2020, 2021, NECSTLab, Politecnico di Milano. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this li... | [
"numpy.abs",
"random.randint",
"polyglot.eval",
"numpy.zeros",
"java.lang.System.nanoTime",
"numpy.min",
"numpy.max",
"random.seed",
"numpy.array",
"numpy.exp",
"numpy.int64",
"numpy.random.rand",
"benchmark.time_phase",
"numpy.sqrt"
] | [((11349, 11373), 'benchmark.time_phase', 'time_phase', (['"""allocation"""'], {}), "('allocation')\n", (11359, 11373), False, 'from benchmark import Benchmark, time_phase, DEFAULT_BLOCK_SIZE_1D, DEFAULT_BLOCK_SIZE_2D, DEFAULT_NUM_BLOCKS\n'), ((14011, 14039), 'benchmark.time_phase', 'time_phase', (['"""initialization""... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 8 18:12:03 2017
@author: edanrein
This file has finalized models and a version ready for celerite and data generation.
v10-Oct-2018
-Cleaned Up
-Note: some functions are only useful when using commented-out debugging-related parts of the code.
v0... | [
"numpy.sum",
"numpy.empty",
"numpy.isnan",
"pyppluss.base_functions.get_star_planet_intersection",
"numpy.sin",
"pyppluss.base_functions.coord_swap",
"numpy.zeros_like",
"numpy.logical_not",
"numpy.empty_like",
"numpy.isfinite",
"pyppluss.base_functions.get_star_disk_intersection",
"numpy.mini... | [((3419, 3457), 'pyppluss.polygon_plus_segments.border_sort', 'border_sort', (['star_planet_intersections'], {}), '(star_planet_intersections)\n', (3430, 3457), False, 'from pyppluss.polygon_plus_segments import handler, Star, Planet, Disk, border_sort\n'), ((3748, 3805), 'pyppluss.polygon_plus_segments.intersection_ar... |
"""SSD Estimator."""
# pylint: disable=logging-format-interpolation,abstract-method
import os
import time
import warnings
import pandas as pd
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet import gluon
from mxnet import autograd
from mxnet.contrib import amp
from .... import utils as gutils
fro... | [
"numpy.clip",
"horovod.mxnet.init",
"mxnet.contrib.amp.init_trainer",
"os.path.join",
"warnings.simplefilter",
"horovod.mxnet.size",
"horovod.mxnet.local_rank",
"mxnet.autograd.backward",
"mxnet.nd.cast",
"warnings.catch_warnings",
"mxnet.autograd.record",
"mxnet.contrib.amp.init",
"mxnet.nd... | [((4001, 4031), 'mxnet.metric.Loss', 'mx.metric.Loss', (['"""CrossEntropy"""'], {}), "('CrossEntropy')\n", (4015, 4031), True, 'import mxnet as mx\n'), ((4058, 4084), 'mxnet.metric.Loss', 'mx.metric.Loss', (['"""SmoothL1"""'], {}), "('SmoothL1')\n", (4072, 4084), True, 'import mxnet as mx\n'), ((1878, 1888), 'mxnet.con... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import warnings
from ..engine import Layer, InputSpec
from .. import backend as K
from ..utils import conv_utils
from ..utils.generic_utils import to_list
from .. import regularizers
from ..... | [
"warnings.warn",
"numpy.zeros"
] | [((12472, 12618), 'warnings.warn', 'warnings.warn', (['"""The `AtrousConvolution1D` layer has been deprecated. Use instead the `Conv1D` layer with the `dilation_rate` argument."""'], {}), "(\n 'The `AtrousConvolution1D` layer has been deprecated. Use instead the `Conv1D` layer with the `dilation_rate` argument.'\n... |
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
from regression_model.preprocessing.errors import InvalidModelInputError
class LogTransformer(BaseEstimator, TransformerMixin):
"""Logarithm transformer"""
def __init__(self, variables=None) -> None:
if n... | [
"numpy.log",
"regression_model.preprocessing.errors.InvalidModelInputError"
] | [((868, 981), 'regression_model.preprocessing.errors.InvalidModelInputError', 'InvalidModelInputError', (['f"""Variables contain zero or negative values,cant\'t apply log for vars: {vars_}"""'], {}), '(\n f"Variables contain zero or negative values,cant\'t apply log for vars: {vars_}"\n )\n', (890, 981), False, '... |
import unittest
import numpy as np
import tensorflow as tf
from tf_qrnn import QRNN
class TestQRNNForward(unittest.TestCase):
def test_qrnn_linear_forward(self):
batch_size = 100
sentence_length = 5
word_size = 10
size = 5
data = self.create_test_data(batch_size, sentence_... | [
"unittest.main",
"tensorflow.global_variables_initializer",
"tf_qrnn.QRNN",
"tensorflow.Session",
"tensorflow.placeholder",
"numpy.array",
"tensorflow.Graph",
"numpy.random.rand"
] | [((2507, 2522), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2520, 2522), False, 'import unittest\n'), ((2458, 2473), 'numpy.array', 'np.array', (['batch'], {}), '(batch)\n', (2466, 2473), True, 'import numpy as np\n'), ((409, 456), 'tf_qrnn.QRNN', 'QRNN', ([], {'in_size': 'word_size', 'size': 'size', 'conv_siz... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import copy
import time
import argparse
import cv2 as cv
import numpy as np
import onnxruntime
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--device", type=int, default=0)
parser.add_argument("--movie", type=str, default=... | [
"copy.deepcopy",
"cv2.putText",
"argparse.ArgumentParser",
"cv2.cvtColor",
"gdown.download",
"cv2.waitKey",
"os.path.exists",
"cv2.imshow",
"time.time",
"cv2.VideoCapture",
"onnxruntime.InferenceSession",
"numpy.min",
"numpy.max",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((183, 208), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (206, 208), False, 'import argparse\n'), ((1012, 1032), 'copy.deepcopy', 'copy.deepcopy', (['image'], {}), '(image)\n', (1025, 1032), False, 'import copy\n'), ((1052, 1105), 'cv2.resize', 'cv.resize', (['temp_image'], {'dsize': '(inpu... |
import numpy as np
def metric(preds, actuals):
preds = preds.reshape(-1)
actuals = actuals.reshape(-1)
assert preds.shape == actuals.shape
return 100 * np.linalg.norm((actuals - preds) / actuals) / np.sqrt(preds.shape[0])
def custom_scorer_metric(actuals, preds):
preds = preds.reshape(-1)
act... | [
"numpy.linalg.norm",
"numpy.sqrt"
] | [((216, 239), 'numpy.sqrt', 'np.sqrt', (['preds.shape[0]'], {}), '(preds.shape[0])\n', (223, 239), True, 'import numpy as np\n'), ((450, 473), 'numpy.sqrt', 'np.sqrt', (['preds.shape[0]'], {}), '(preds.shape[0])\n', (457, 473), True, 'import numpy as np\n'), ((170, 213), 'numpy.linalg.norm', 'np.linalg.norm', (['((actu... |
from pydex.core.designer import Designer
import numpy as np
import sobol_seq
"""
Setting : a non-dynamic experimental system with 2 time-invariant control variables
and 1 response.
Problem : design optimal experiment for a order 2 polynomial.
Solution : 3^2 factorial design, varying efforts... | [
"numpy.exp",
"numpy.ones",
"pydex.core.designer.Designer"
] | [((1575, 1585), 'pydex.core.designer.Designer', 'Designer', ([], {}), '()\n', (1583, 1585), False, 'from pydex.core.designer import Designer\n'), ((1643, 1653), 'numpy.ones', 'np.ones', (['(6)'], {}), '(6)\n', (1650, 1653), True, 'import numpy as np\n'), ((1517, 1539), 'numpy.exp', 'np.exp', (['ti_controls[1]'], {}), '... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import os
import gym
import ray
import tensorflow as tf
from ray import tune
from ray.rllib.env.multi_agent_env import MultiAgentEnv
from ray.tune.registry import register_env
from ray.rlli... | [
"battlesnake_gym.snake_gym.BattlesnakeGym",
"battlesnake_gym.rewards.SimpleRewards",
"numpy.zeros",
"inference.inference_src.battlesnake_heuristics.MyBattlesnakeHeuristics",
"numpy.array",
"gym.spaces.Box",
"training.training_src.utils.sort_states_for_snake_id",
"numpy.concatenate"
] | [((1044, 1059), 'battlesnake_gym.rewards.SimpleRewards', 'SimpleRewards', ([], {}), '()\n', (1057, 1059), False, 'from battlesnake_gym.rewards import SimpleRewards\n'), ((1137, 1272), 'battlesnake_gym.snake_gym.BattlesnakeGym', 'BattlesnakeGym', ([], {'observation_type': 'observation_type', 'number_of_snakes': 'num_age... |
from __future__ import print_function
import numpy as np
from numpy import cos, sin
from numpy.testing import assert_equal
import unittest
import pcl
# from pcl.pcl_registration import icp, gicp, icp_nl
from pcl import IterativeClosestPoint, GeneralizedIterativeClosestPoint, IterativeClosestPointNonLinear
class Tes... | [
"unittest.TextTestRunner",
"unittest.TestSuite",
"unittest.makeSuite",
"numpy.random.RandomState",
"numpy.any",
"pcl.IterativeClosestPoint",
"numpy.sin",
"pcl.GeneralizedIterativeClosestPoint",
"numpy.testing.assert_equal",
"numpy.cos",
"numpy.dot",
"pcl.IterativeClosestPointNonLinear",
"pcl... | [((7776, 7796), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (7794, 7796), False, 'import unittest\n'), ((1043, 1068), 'numpy.dot', 'np.dot', (['source', 'transform'], {}), '(source, transform)\n', (1049, 1068), True, 'import numpy as np\n'), ((1565, 1602), 'numpy.testing.assert_equal', 'assert_equal',... |
import numpy as np
import shap
import pdb
import matplotlib.pyplot as plt
''' SHAP value based feature importance analysis and plotting feature importances '''
# conversion from spectrum index (between 0 and 16313) to ppm (between -2 ppm to 12 ppm).
RAW_SPECTRUM_LENGTH = 16314
MIN_PPM = -2
MAX_PPM = 12
def... | [
"numpy.absolute",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.colorbar",
"numpy.amax",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.xlabel"
] | [((983, 995), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (993, 995), True, 'import matplotlib.pyplot as plt\n'), ((1007, 1079), 'matplotlib.pyplot.scatter', 'plt.scatter', (['xs', 'ys'], {'c': 'vals', 's': 'sizes', 'marker': '"""o"""', 'cmap': '"""cool"""', 'alpha': '(0.3)'}), "(xs, ys, c=vals, s=sizes... |
"""
Generator is defined in this soruce code
This function is used for batch processing in machine learning
"""
# import cv2
import numpy as np
import sklearn
from scipy import ndimage
def generator(samples, batch_size=32, img_path='../small_dataset/IMG/'):
num_samples = len(samples)
while 1: # Loop forever s... | [
"sklearn.utils.shuffle",
"numpy.array",
"scipy.ndimage.imread"
] | [((377, 407), 'sklearn.utils.shuffle', 'sklearn.utils.shuffle', (['samples'], {}), '(samples)\n', (398, 407), False, 'import sklearn\n'), ((982, 998), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (990, 998), True, 'import numpy as np\n'), ((1021, 1037), 'numpy.array', 'np.array', (['angles'], {}), '(angle... |
import os
import argparse
import numpy as np
import tensorflow as tf
import tensorflow.keras.utils as utils
from Models.get_model import get_model
curr_path = os.getcwd()
parser = argparse.ArgumentParser()
# Network selection
parser.add_argument("--dataset", "-d", help="Please enter the data to train the model", de... | [
"numpy.load",
"tensorflow.keras.utils.to_categorical",
"argparse.ArgumentParser",
"os.getcwd",
"tensorflow.distribute.MirroredStrategy",
"Models.get_model.get_model",
"os.path.join",
"numpy.unique"
] | [((162, 173), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (171, 173), False, 'import os\n'), ((184, 209), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (207, 209), False, 'import argparse\n'), ((1587, 1645), 'numpy.load', 'np.load', (["(DATA_PATH + args.dataset + ' ' + 'Vis Images.npy')"], {})... |
##############################################################################
#
# Copyright (c) 2003-2018 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unti... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.pcolor",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axis",
"numpy.isnan",
"matplotlib.pyplot.colorbar",
"scipy.io.netcdf_file",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotl... | [((867, 888), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (881, 888), False, 'import matplotlib\n'), ((1133, 1159), 'scipy.io.netcdf_file', 'netcdf_file', (['FILENAME', '"""r"""'], {}), "(FILENAME, 'r')\n", (1144, 1159), False, 'from scipy.io import netcdf_file\n'), ((2471, 2503), 'numpy.meshg... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"paddle.fluid.data",
"numpy.random.seed",
"paddle.fluid.initializer.Constant",
"paddle.fluid.program_guard",
"paddle.fluid.CompiledProgram",
"numpy.random.randint",
"sys.stdout.flush",
"numpy.mean",
"paddle.fluid.layers.fc",
"unittest.main",
"paddle.fluid.Executor",
"six.moves.range",
"paddl... | [((1460, 1475), 'paddle.fluid.Program', 'fluid.Program', ([], {}), '()\n', (1473, 1475), True, 'import paddle.fluid as fluid\n'), ((1492, 1507), 'paddle.fluid.Program', 'fluid.Program', ([], {}), '()\n', (1505, 1507), True, 'import paddle.fluid as fluid\n'), ((9053, 9068), 'unittest.main', 'unittest.main', ([], {}), '(... |
# -*- coding: utf-8 -*-
"""
@Time:Created on 2019/5/20 19:40
@author: <NAME>
@Filename: model_glu.py
@Software: PyCharm
"""
# -*- coding: utf-8 -*-
"""
@Time:Created on 2019/5/7 13:40
@author: <NAME>
@Filename: model.py
@Software: PyCharm
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.n... | [
"torch.nn.Dropout",
"numpy.argmax",
"torch.mm",
"torch.no_grad",
"torch.nn.Conv1d",
"torch.FloatTensor",
"torch.squeeze",
"torch.nn.LayerNorm",
"torch.nn.Linear",
"torch.zeros",
"torch.matmul",
"torch.nn.functional.glu",
"numpy.random.shuffle",
"torch.norm",
"sklearn.metrics.recall_score... | [((683, 710), 'torch.nn.Linear', 'nn.Linear', (['hid_dim', 'hid_dim'], {}), '(hid_dim, hid_dim)\n', (692, 710), True, 'import torch.nn as nn\n'), ((730, 757), 'torch.nn.Linear', 'nn.Linear', (['hid_dim', 'hid_dim'], {}), '(hid_dim, hid_dim)\n', (739, 757), True, 'import torch.nn as nn\n'), ((777, 804), 'torch.nn.Linear... |
import robotoc
import numpy as np
import math
path_to_urdf = '../anymal_b_simple_description/urdf/anymal.urdf'
contact_frames = ['LF_FOOT', 'LH_FOOT', 'RF_FOOT', 'RH_FOOT']
contact_types = [robotoc.ContactType.PointContact for i in range(4)]
baumgarte_time_step = 0.04
robot = robotoc.Robot(path_to_urdf, robotoc.Base... | [
"robotoc.DiscreteTimeSwingFootRef",
"robotoc.JointVelocityLowerLimit",
"robotoc.JointTorquesUpperLimit",
"robotoc.OCPSolver",
"robotoc.FrictionCone",
"numpy.full",
"robotoc.Robot",
"robotoc.Constraints",
"robotoc.OCP",
"robotoc.CostFunction",
"robotoc.STOCostFunction",
"robotoc.utils.Trajector... | [((280, 399), 'robotoc.Robot', 'robotoc.Robot', (['path_to_urdf', 'robotoc.BaseJointType.FloatingBase', 'contact_frames', 'contact_types', 'baumgarte_time_step'], {}), '(path_to_urdf, robotoc.BaseJointType.FloatingBase,\n contact_frames, contact_types, baumgarte_time_step)\n', (293, 399), False, 'import robotoc\n'),... |
import pytest
from numpy import pi, array, linspace, zeros, cos, mean, sqrt, sin
from numpy.testing import assert_array_almost_equal
from SciDataTool import DataTime, Data1D, Norm_ref
from pyleecan.Functions.Electrical.dqh_transformation import (
n2dqh,
dqh2n,
n2dqh_DataTime,
dqh2n_DataTime,
)
from p... | [
"SciDataTool.DataTime",
"pyleecan.Functions.Winding.gen_phase_list.gen_name",
"pyleecan.Functions.Electrical.dqh_transformation.dqh2n_DataTime",
"numpy.zeros",
"pyleecan.Functions.Electrical.dqh_transformation.n2dqh",
"SciDataTool.Norm_ref",
"SciDataTool.Data1D",
"numpy.array",
"numpy.linspace",
"... | [((831, 880), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""param_dict"""', 'param_list'], {}), "('param_dict', param_list)\n", (854, 880), False, 'import pytest\n'), ((1301, 1344), 'numpy.linspace', 'linspace', (['(0)', '(1 / f_elec)', 'Nt'], {'endpoint': '(False)'}), '(0, 1 / f_elec, Nt, endpoint=False)... |
from os import cpu_count
from TransitionListener import observability
from time import time
import numpy as np
import scanner
DAISY_TYPE = 2
STABLE_VEV = 1e2
N_TRY_MAX = 3
ARGS_SHIFT = 1e-3
ARG_INDEX_TO_SHIFT = 0
PLOT_POTENTIAL_AT_T = False
PLOT_T = 1208
VERBOSE = False
OVERVIEW_DETECTOR_NAME = "LISA"
# ("lambda", "... | [
"TransitionListener.observability.GW_spectra_comparison",
"numpy.array",
"scanner.Full_calculation"
] | [((399, 630), 'scanner.Full_calculation', 'scanner.Full_calculation', (['""""""', '""""""', "('', '')", 'INPUT_VALS', 'DAISY_TYPE', 'STABLE_VEV', 'N_TRY_MAX', 'ARGS_SHIFT', 'ARG_INDEX_TO_SHIFT', '(True)', '(0)', '""""""', '""""""', '""""""', '(0)', '(0)', '(True)', 'VERBOSE', '(0)', 'PLOT_POTENTIAL_AT_T', 'PLOT_T', 'OV... |
import numpy as np
import pandas as pd
from scipy import stats,linalg
import matplotlib.pyplot as plt
def plotAllbyFeatures(IrisMatrix, i, j):
# quick plot function to display the 2 features together
# Input is taking the IrisMatrix with the knowledge of each class being of size 50 and feature (i,j)
index ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"scipy.stats.zscore",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.std",
"matplotlib.pyplot.figure",
"numpy.where",
"numpy.array",
"numpy.mean",
"matplotlib.pyplot.ylabel",... | [((389, 401), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (399, 401), True, 'import matplotlib.pyplot as plt\n'), ((406, 494), 'matplotlib.pyplot.scatter', 'plt.scatter', (['IrisMatrix[0:49, i]', 'IrisMatrix[0:49, j]'], {'color': '"""blue"""', 'label': '"""Setosa"""'}), "(IrisMatrix[0:49, i], IrisMatrix... |
"""
Change points detection related tests.
"""
import numpy as np
import pytest
from signal_processing_algorithms.e_divisive import EDivisive
from signal_processing_algorithms.e_divisive.calculators import cext_calculator, numpy_calculator
from signal_processing_algorithms.e_divisive.change_points import EDivisiveChan... | [
"numpy.full",
"signal_processing_algorithms.e_divisive.EDivisive",
"signal_processing_algorithms.e_divisive.change_points.EDivisiveChangePoint",
"signal_processing_algorithms.e_divisive.significance_test.QHatPermutationsSignificanceTester"
] | [((2050, 2142), 'signal_processing_algorithms.e_divisive.significance_test.QHatPermutationsSignificanceTester', 'QHatPermutationsSignificanceTester', ([], {'calculator': 'calculator', 'pvalue': '(0.01)', 'permutations': '(100)'}), '(calculator=calculator, pvalue=0.01,\n permutations=100)\n', (2084, 2142), False, 'fr... |
import numpy as np
from . import mmdpy_texture
from dataclasses import dataclass, field
from typing import Any, Union, List
# model info
@dataclass
class mmdpyTypeVertex():
ver: np.ndarray = field(init=False)
nor: np.ndarray = field(init=False)
uv: np.ndarray = field(init=False)
bone_id: np.ndarray = ... | [
"dataclasses.field",
"numpy.zeros",
"numpy.identity"
] | [((197, 214), 'dataclasses.field', 'field', ([], {'init': '(False)'}), '(init=False)\n', (202, 214), False, 'from dataclasses import dataclass, field\n'), ((237, 254), 'dataclasses.field', 'field', ([], {'init': '(False)'}), '(init=False)\n', (242, 254), False, 'from dataclasses import dataclass, field\n'), ((276, 293)... |
import numpy as np
import matplotlib.pyplot as plt
n_bins = 40
# create distributions
uniform = np.random.rand(30,1000)*10*2
distribution_names = ['exponential', 'gamma']
for name in distribution_names:
exec('%s=np.random.%s(10,size=(30,1000))'% (name, name))
binomial = np.random.binomial(30/0.5, 0.6, size=(10,1... | [
"matplotlib.pyplot.title",
"numpy.random.binomial",
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"numpy.mean",
"matplotlib.pyplot.sca",
"numpy.random.rand",
"matplotlib.pyplot.subplots"
] | [((278, 328), 'numpy.random.binomial', 'np.random.binomial', (['(30 / 0.5)', '(0.6)'], {'size': '(10, 1000)'}), '(30 / 0.5, 0.6, size=(10, 1000))\n', (296, 328), True, 'import numpy as np\n'), ((505, 562), 'matplotlib.pyplot.subplots', 'plt.subplots', (['n_distributions', '(2)'], {'constrained_layout': '(True)'}), '(n_... |
"""Command line tools for generating and plotting Fermi surfaces."""
import os
import sys
import warnings
from collections import defaultdict
import click
from click import option
from ifermi.defaults import AZIMUTH, ELEVATION, SCALE, SYMPREC, VECTOR_SPACING
plot_type = click.Choice(["matplotlib", "plotly", "mayavi"... | [
"ifermi.kpoints.kpoints_from_bandstructure",
"ifermi.surface.FermiSurface.from_band_structure",
"pymatgen.io.vasp.outputs.Vasprun",
"numpy.set_printoptions",
"warnings.filterwarnings",
"click.option",
"click.echo",
"ifermi.plot.FermiSlicePlotter",
"os.path.exists",
"click.Choice",
"collections.d... | [((274, 344), 'click.Choice', 'click.Choice', (["['matplotlib', 'plotly', 'mayavi']"], {'case_sensitive': '(False)'}), "(['matplotlib', 'plotly', 'mayavi'], case_sensitive=False)\n", (286, 344), False, 'import click\n'), ((357, 407), 'click.Choice', 'click.Choice', (["['up', 'down']"], {'case_sensitive': '(False)'}), "... |
#Hardcode for DeltaX = .25, .5
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
# Delta X = (1/2)
fig = plt.figure()
ax = fig.gca(projection='3d')
plt.title(r... | [
"matplotlib.pyplot.title",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"numpy.array",
"matplotlib.ticker.LinearLocator",
"matplotlib.ticker.FormatStrFormatter",
"numpy.linalg.solve",
"matplotlib.pyplot.subplots"
] | [((266, 278), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (276, 278), True, 'import matplotlib.pyplot as plt\n'), ((309, 383), 'matplotlib.pyplot.title', 'plt.title', (['"""2nd order FDM Output, $\\\\Delta$ X = (1/2) T(x, y)$\\\\degree$ C"""'], {}), "('2nd order FDM Output, $\\\\Delta$ X = (1/2) T(x, y)... |
import pyzed.sl as sl
import cv2
import numpy as np
import data_service
import cv_viewer.tracking_viewer as cv_viewer
from data_processors import to_csv
OBJECT_DETECTED_STARTING_FROM_PERCENT = 40
CONFIDENCE_THRESHOLD = 50
MAXIMUM_DISTANCE_IN_METERS = 30
MEASUREMENTS_PER_SECOND = 5
ACCURACY = 5
if __name__ == "__mai... | [
"cv_viewer.tracking_viewer.render_2D",
"cv2.imshow",
"data_processors.to_csv",
"numpy.full",
"pyzed.sl.ObjectDetectionParameters",
"pyzed.sl.RuntimeParameters",
"cv2.hconcat",
"pyzed.sl.Mat",
"cv2.destroyAllWindows",
"data_service.main",
"pyzed.sl.Camera",
"pyzed.sl.ObjectDetectionRuntimeParam... | [((365, 376), 'pyzed.sl.Camera', 'sl.Camera', ([], {}), '()\n', (374, 376), True, 'import pyzed.sl as sl\n'), ((466, 485), 'pyzed.sl.InitParameters', 'sl.InitParameters', ([], {}), '()\n', (483, 485), True, 'import pyzed.sl as sl\n'), ((1003, 1036), 'pyzed.sl.PositionalTrackingParameters', 'sl.PositionalTrackingParamet... |
#!/usr/bin/env python
### Point cloud
from sensor_msgs.msg import PointField, PointCloud2
import sensor_msgs.point_cloud2 as pc2
### Ground truth's bounding box
from geometry_msgs.msg import Pose
from geometry_msgs.msg import PoseArray
from geometry_msgs.msg import Point
from visualization_msgs.msg import Marker
from ... | [
"sensor_msgs.msg.Image",
"sensor_msgs.msg.PointCloud2",
"cv_bridge.CvBridge",
"cv2.cvtColor",
"geometry_msgs.msg.PoseArray",
"sensor_msgs.point_cloud2.create_cloud_xyz32",
"sensor_msgs.msg.PointField",
"numpy.append",
"numpy.array",
"geometry_msgs.msg.Point",
"visualization_msgs.msg.Marker",
"... | [((856, 896), 'sensor_msgs.point_cloud2.create_cloud', 'pc2.create_cloud', (['header', 'fields', 'points'], {}), '(header, fields, points)\n', (872, 896), True, 'import sensor_msgs.point_cloud2 as pc2\n'), ((1019, 1032), 'sensor_msgs.msg.PointCloud2', 'PointCloud2', ([], {}), '()\n', (1030, 1032), False, 'from sensor_m... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"tensorflow.python.ops.variables.initialize_local_variables",
"tensorflow.python.platform.tf_logging.info",
"tensorflow.python.client.session.Session",
"tensorflow.python.training.queue_runner.start_queue_runners",
"tensorflow.core.util.event_pb2.SessionLog",
"tensorflow.python.ops.data_flow_ops.initializ... | [((3055, 3170), 'collections.namedtuple', 'py_collections.namedtuple', (['"""SupervisorParams"""', "['is_chief', 'master', 'save_model_secs', 'save_summaries_secs']"], {}), "('SupervisorParams', ['is_chief', 'master',\n 'save_model_secs', 'save_summaries_secs'])\n", (3080, 3170), True, 'import collections as py_coll... |
# -*- coding: utf-8 -*-
"""keras_deployment_to android.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1OMaYO1wSjrBNNpl5gQ7A-O_5Zq3GcStr
"""
from numpy import loadtxt
from keras.models import Sequential
from keras.layers import Dense
from __futur... | [
"matplotlib.pyplot.title",
"keras.models.load_model",
"numpy.random.seed",
"numpy.clip",
"keras.models.Model",
"tensorflow.train.write_graph",
"matplotlib.pyplot.figure",
"tensorflow.global_variables",
"numpy.random.normal",
"keras.layers.Input",
"keras.layers.Reshape",
"matplotlib.pyplot.imsh... | [((740, 760), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (754, 760), True, 'import numpy as np\n'), ((806, 823), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (821, 823), False, 'from keras.datasets import mnist\n'), ((865, 917), 'numpy.reshape', 'np.reshape', (['x_tra... |
# -*- coding: utf-8 -*-
"""
Landlab component for overland flow using the kinematic-wave approximation.
Created on Fri May 27 14:26:13 2016
@author: gtucker
"""
from landlab import Component
import numpy as np
class KinwaveOverlandFlowModel(Component):
"""Calculate water flow over topography.
Landlab com... | [
"numpy.where",
"numpy.sign",
"doctest.testmod",
"numpy.sqrt"
] | [((6319, 6336), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (6334, 6336), False, 'import doctest\n'), ((4948, 4967), 'numpy.sqrt', 'np.sqrt', (['self.slope'], {}), '(self.slope)\n', (4955, 4967), True, 'import numpy as np\n'), ((4994, 5013), 'numpy.sign', 'np.sign', (['self.slope'], {}), '(self.slope)\n', (... |
### BAAMSAT CAMERA PAYLOAD CAMERA CLASS ###
import subprocess
import os, signal
from time import sleep
import cv2
import numpy as np
"""
Class to instanciate the camera features of the payload
"""
class Camera():
def __init__(self,input_format):
self.input_format = input_format
self.process = 0
... | [
"subprocess.Popen",
"os.popen",
"time.sleep",
"cv2.VideoCapture",
"numpy.array",
"cv2.imencode"
] | [((943, 980), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'shell': '(True)'}), '(command, shell=True)\n', (959, 980), False, 'import subprocess\n'), ((1072, 1135), 'os.popen', 'os.popen', (["('ps ax | grep ' + 'mjpg_streamer' + ' | grep -v grep')"], {}), "('ps ax | grep ' + 'mjpg_streamer' + ' | grep -v grep... |
# coding:utf-8
# @Time : 2019/10/17
# @Author : xuyouze
# @File Name : market_dataset.py
import os
import numpy as np
from torchvision.transforms import transforms
import scipy.io
from PIL import Image
from config import *
from dataset.dukemtmc_dataset import get_img, get_data
from dataset.regist... | [
"dataset.dukemtmc_dataset.get_data",
"numpy.asarray",
"torchvision.transforms.transforms.RandomHorizontalFlip",
"numpy.zeros",
"PIL.Image.open",
"torchvision.transforms.transforms.ToTensor",
"numpy.array",
"torchvision.transforms.transforms.Normalize",
"dataset.dukemtmc_dataset.get_img",
"dataset.... | [((5166, 5192), 'dataset.registry.Dataset.register', 'Dataset.register', (['"""market"""'], {}), "('market')\n", (5182, 5192), False, 'from dataset.registry import Dataset\n'), ((463, 535), 'dataset.dukemtmc_dataset.get_data', 'get_data', (['dataset_config.data_root_dir', 'dataset_config.data_group_suffix'], {}), '(dat... |
# -*- coding: utf-8 -*-
# File generated according to Generator/ClassesRef/Simulation/InputCurrent.csv
# WARNING! All changes made in this file will be lost!
"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Simulation/InputCurrent
"""
from os import linesep
from sys imp... | [
"numpy.array",
"sys.getsizeof"
] | [((11673, 11691), 'sys.getsizeof', 'getsizeof', (['self.Is'], {}), '(self.Is)\n', (11682, 11691), False, 'from sys import getsizeof\n'), ((11706, 11724), 'sys.getsizeof', 'getsizeof', (['self.Ir'], {}), '(self.Ir)\n', (11715, 11724), False, 'from sys import getsizeof\n'), ((11739, 11766), 'sys.getsizeof', 'getsizeof', ... |
"""
Copyright (c) 2018 <NAME>
ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | [
"unittest.main",
"nfvtcp.pmodel.VnfPerformanceModel",
"random.uniform",
"nfvtcp.selector.WeightedVnfSelector",
"numpy.linspace",
"networkx.DiGraph"
] | [((9411, 9426), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9424, 9426), False, 'import unittest\n'), ((1354, 1412), 'nfvtcp.pmodel.VnfPerformanceModel', 'VnfPerformanceModel', (['(0)', '"""vnf0"""', 'p', "(lambda c: c['p1'] * 0.2)"], {}), "(0, 'vnf0', p, lambda c: c['p1'] * 0.2)\n", (1373, 1412), False, 'from... |
import pandas as pd
import gzip
import datetime
import os
import numpy as np
import pickle
WINDOW_SIZE = 2880 #a week of information 7*24*60 -> for two days, 2880
LOOK_AHEAD = 2 # how much we want to predict, 2 hours
INSTRUMENT_OF_INTEREST = 'EURUSD'
def save_obj(obj, name):
with open(name + '.pkl', '... | [
"os.listdir",
"pickle.dump",
"gzip.open",
"pickle.load",
"datetime.timedelta",
"numpy.array",
"pandas.concat"
] | [((2808, 2829), 'os.listdir', 'os.listdir', (['"""./data/"""'], {}), "('./data/')\n", (2818, 2829), False, 'import os\n'), ((3571, 3605), 'pandas.concat', 'pd.concat', (['l'], {'axis': '(1)', 'join': '"""inner"""'}), "(l, axis=1, join='inner')\n", (3580, 3605), True, 'import pandas as pd\n'), ((340, 384), 'pickle.dump'... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
线性模型
岭回归
一种改良的最小二乘估计法,通过放弃最小二乘法的无偏性,以损失部分信息,降低精度为代价获得回归系数更为实际的回归方法;
对病态数据(比如某一两个数据偏离的极大)的拟合要好于最小二乘法。
https://blog.csdn.net/aoulun/article/details/78688572
"""
from sklearn import linear_model
import numpy as np
import matplotlib.pyplot as plt
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.logspace",
"numpy.ones",
"matplotlib.pyplot.axis",
"numpy.arange",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"sklearn.linear_model.Ridge"
] | [((432, 443), 'numpy.ones', 'np.ones', (['(10)'], {}), '(10)\n', (439, 443), True, 'import numpy as np\n'), ((485, 515), 'numpy.logspace', 'np.logspace', (['(-10)', '(-2)', 'n_alphas'], {}), '(-10, -2, n_alphas)\n', (496, 515), True, 'import numpy as np\n'), ((680, 689), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '(... |
import tensorflow as tf
from addition import *
import numpy as np
from tqdm import tqdm
import time
length = 6 # 限制每一个评论的长度
target_lenth = 10 #每一个目标的长度
hidden_size = 300 # 隐藏层的神经元个数
embedding_size = 300 # 词向量的维度
learning_rate = 0.01 # 梯度下降的学习率
batch_size = 6 # 样本的大小
keep_prob = 0.5
"""载入词向量 上下文 目标文本数据"""
embe... | [
"tensorflow.global_variables_initializer",
"tensorflow.nn.embedding_lookup",
"tensorflow.reshape",
"tensorflow.reduce_mean",
"tensorflow.concat",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.contrib.rnn.BasicLSTMCell",
"tensorflow.random_normal",
"numpy.loadtxt",
"tensorflow.nn.xw... | [((333, 357), 'numpy.loadtxt', 'np.loadtxt', (['"""glovec.txt"""'], {}), "('glovec.txt')\n", (343, 357), True, 'import numpy as np\n'), ((1724, 1770), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[None, length]'}), '(tf.int32, shape=[None, length])\n', (1738, 1770), True, 'import tensorflow as ... |
# Copyright (C) 2013 <NAME>
#
# This file is part of WESTPA.
#
# WESTPA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WESTPA is d... | [
"westpa.kinetics._kinetics.StreamingStats1D",
"numpy.zeros_like",
"numpy.allclose",
"numpy.zeros",
"westpa.kinetics._kinetics.calc_rates",
"numpy.ma.array",
"numpy.random.random",
"numpy.where",
"collections.namedtuple",
"numpy.random.normal",
"numpy.random.randint",
"westpa.kinetics.rate_aver... | [((1038, 1090), 'collections.namedtuple', 'namedtuple', (['"""StreamingStatsTuple"""', "['M1', 'M2', 'n']"], {}), "('StreamingStatsTuple', ['M1', 'M2', 'n'])\n", (1048, 1090), False, 'from collections import namedtuple\n'), ((1145, 1192), 'numpy.random.normal', 'numpy.random.normal', ([], {'size': '(nsets, nbins, nbins... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.