code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import gym
import tensorflow as tf
import numpy as np
INPUT_SIZE = 4
HIDDEN_UNIT_NUM = 4
OUTPUT_SIZE = 1
LEARNING_RATE = 0.01
DISCOUNT_RATE = 0.95
def Cartpole_policy():
initializer = tf.contrib.layers.variance_scaling_initializer()
X = tf.placeholder(tf.float32, shape=(None, INPUT_SIZE))
hidden = tf.laye... | [
"numpy.mean",
"tensorflow.to_float",
"tensorflow.contrib.layers.variance_scaling_initializer",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"tensorflow.log",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.nn.sigmoid",
"tensorflow.concat",
"numpy.concatenate",... | [((190, 238), 'tensorflow.contrib.layers.variance_scaling_initializer', 'tf.contrib.layers.variance_scaling_initializer', ([], {}), '()\n', (236, 238), True, 'import tensorflow as tf\n'), ((247, 299), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(None, INPUT_SIZE)'}), '(tf.float32, shape=(Non... |
""" change images between different color spaces """
import cv2 as cv
import numpy as np
from imagewizard.helpers import helpers
def img2grayscale(img,
to_binary: bool = False,
to_zero: bool = False,
inverted: bool = False,
trunc: bool = False,
... | [
"cv2.merge",
"imagewizard.helpers.helpers.format_image_to_PIL",
"imagewizard.helpers.helpers.format_output_order_input_BGR",
"imagewizard.helpers.helpers.format_output_order_input_RGB",
"cv2.threshold",
"numpy.asarray",
"numpy.array",
"imagewizard.helpers.helpers.calculate_distance",
"cv2.split",
... | [((1014, 1043), 'imagewizard.helpers.helpers.image2BGR', 'helpers.image2BGR', (['img', 'order'], {}), '(img, order)\n', (1031, 1043), False, 'from imagewizard.helpers import helpers\n'), ((2143, 2195), 'imagewizard.helpers.helpers.format_output_order_input_BGR', 'helpers.format_output_order_input_BGR', (['gs_img', 'ord... |
import torch
import torch.nn as nn
import numpy as np
import scipy.io as scio
import os
import matplotlib.pyplot as plt
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
torch.manual_seed(1)
np.random.seed(1)
lapl_op = [[[[ 0, 0, -1/12, 0, 0],
[ 0, 0, 4/3, 0, 0],
[-1/12, 4/3... | [
"torch.manual_seed",
"matplotlib.pyplot.savefig",
"scipy.io.savemat",
"numpy.ones",
"numpy.roll",
"numpy.random.random",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.random.seed",
"numpy.concatenate",
"numpy.meshgr... | [((162, 182), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (179, 182), False, 'import torch\n'), ((184, 201), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (198, 201), True, 'import numpy as np\n'), ((4640, 4656), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (4648, 46... |
###########################################################################
###########################################################################
# SPyH
###########################################################################
#########################################################... | [
"matplotlib.pyplot.draw",
"matplotlib.pyplot.MaxNLocator",
"matplotlib.collections.PolyCollection",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.Normalize",
"matplotlib.pyplot.xlabel",
"matplotlib.colorbar.ColorbarBase",
"numpy.swapaxes",
"matplotlib.pyplot.figure",
"m... | [((614, 648), 'matplotlib.rc', 'matplotlib.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (627, 648), False, 'import matplotlib\n'), ((1829, 1860), 'matplotlib.pyplot.Normalize', 'plt.Normalize', (['propMin', 'propMax'], {}), '(propMin, propMax)\n', (1842, 1860), True, 'import matplotlib.pyplot... |
import numpy as np
from PIL import Image
from scipy import special
# PSF functions
def scalar_a(x):
if x == 0:
return 1.0
else:
return (special.jn(1,2*np.pi*x)/(np.pi*x))**2
a = np.vectorize(scalar_a)
def s_b(x, NA=0.8, n=1.33):
if x == 0:
return 0
else:
return (NA/n)**... | [
"scipy.special.jn",
"numpy.abs",
"PIL.Image.fromarray",
"PIL.Image.open",
"numpy.sqrt",
"numpy.fft.fftfreq",
"numpy.array",
"numpy.int",
"numpy.fft.ifftshift",
"numpy.pad",
"numpy.vectorize"
] | [((203, 225), 'numpy.vectorize', 'np.vectorize', (['scalar_a'], {}), '(scalar_a)\n', (215, 225), True, 'import numpy as np\n'), ((365, 382), 'numpy.vectorize', 'np.vectorize', (['s_b'], {}), '(s_b)\n', (377, 382), True, 'import numpy as np\n'), ((1124, 1146), 'PIL.Image.fromarray', 'Image.fromarray', (['image'], {}), '... |
# imports needed for the following examples
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.spatial.distance as distance
import scipy.cluster.hierarchy as hierarchy
# read a local file (path is relative to python's working directory)
# sep, header=True/None
infile = '../data/PO_asof... | [
"scipy.cluster.hierarchy.dendrogram",
"scipy.spatial.distance.pdist",
"numpy.log",
"scipy.cluster.hierarchy.linkage",
"pandas.read_table",
"numpy.log2",
"scipy.cluster.hierarchy.fcluster",
"matplotlib.pyplot.show"
] | [((340, 385), 'pandas.read_table', 'pd.read_table', (['infile'], {'sep': '"""|"""', 'thousands': '""","""'}), "(infile, sep='|', thousands=',')\n", (353, 385), True, 'import pandas as pd\n'), ((678, 701), 'numpy.log2', 'np.log2', (["grouped['amt']"], {}), "(grouped['amt'])\n", (685, 701), True, 'import numpy as np\n'),... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_multilabel_classification
from sklearn.multiclass import OneVsRestClassifier
from sklearn.svm import SVC
from sklearn.decomposition import PCA
from sklearn.cross_decomposition import CCA
def plot_hyperplane(clf, min_x, max_x, linest... | [
"matplotlib.pyplot.ylabel",
"sklearn.cross_decomposition.CCA",
"numpy.where",
"sklearn.decomposition.PCA",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.linspace",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.scatter",
"numpy.min",
"matplotlib.pyplot.ylim",
"mat... | [((2112, 2138), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 6)'}), '(figsize=(8, 6))\n', (2122, 2138), True, 'import matplotlib.pyplot as plt\n'), ((2147, 2245), 'sklearn.datasets.make_multilabel_classification', 'make_multilabel_classification', ([], {'n_classes': '(2)', 'n_labels': '(1)', 'allow_u... |
#!/usr/bin/env python3
# ver 0.1 - coding python by <NAME> on 2/26/2017
# ver 0.2 - save .npz file for outputfile on 12/2/2017
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='block average 1D Profile from np.savetxt file')
## args
parse... | [
"numpy.mean",
"hjung.time.end_print",
"hjung.time.init",
"argparse.ArgumentParser",
"hjung.blockavg.print_init",
"numpy.column_stack",
"hjung.io.read_simple",
"numpy.savetxt",
"numpy.std",
"hjung.blockavg.check",
"numpy.save",
"hjung.blockavg.main_1d"
] | [((158, 308), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""block average 1D Profile from np.savetxt file"""'}), "(formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, description=\n 'block average 1D Profile from ... |
# -*- coding: utf-8 -*-
import numpy as np
class Schrodinger:
def __init__(self, V0, c, basis_size, basis_function, fxn):
'''Creates a system to calculate the schrodinger equation
Args:
V0 (float): Initial Potential Energy
c (float): Constant to be used in Schrodinger equation
... | [
"numpy.exp",
"numpy.linspace",
"numpy.polynomial.legendre.legder",
"numpy.zeros"
] | [((709, 732), 'numpy.linspace', 'np.linspace', (['(0)', '(2)', '(2000)'], {}), '(0, 2, 2000)\n', (720, 732), True, 'import numpy as np\n'), ((1256, 1294), 'numpy.exp', 'np.exp', (['(-2.0j * n * np.pi * self.x / l)'], {}), '(-2.0j * n * np.pi * self.x / l)\n', (1262, 1294), True, 'import numpy as np\n'), ((1396, 1435), ... |
#!/usr/bin/env python3
## MIT License
##
## Copyright (c) 2019 <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 ... | [
"numpy.intersect1d",
"numpy.roll",
"numpy.unique",
"numpy.arange",
"rule_handlers.Ruleset",
"sys.stderr.flush",
"numpy.iinfo",
"object_packer.ObjectPacker",
"numpy.max",
"sys.stderr.write",
"numpy.lexsort",
"numpy.zeros",
"numpy.empty",
"numpy.nextafter",
"numpy.concatenate",
"numpy.fu... | [((1677, 1698), 'sys.stderr.write', 'sys.stderr.write', (['msg'], {}), '(msg)\n', (1693, 1698), False, 'import sys\n'), ((1700, 1718), 'sys.stderr.flush', 'sys.stderr.flush', ([], {}), '()\n', (1716, 1718), False, 'import sys\n'), ((1636, 1679), 'sys.stderr.write', 'sys.stderr.write', (["('\\x08' * _log_last_length)"],... |
"""
DeCliff filter contributed by Minecraft Forums user "DrRomz"
Originally posted here:
http://www.minecraftforum.net/topic/13807-mcedit-minecraft-world-editor-compatible-with-mc-beta-18/page__st__3940__p__7648793#entry7648793
"""
from numpy import zeros, array
import itertools
from pymclevel import alphaMaterials
a... | [
"numpy.array",
"numpy.zeros"
] | [((780, 807), 'numpy.zeros', 'zeros', (['(256,)'], {'dtype': '"""bool"""'}), "((256,), dtype='bool')\n", (785, 807), False, 'from numpy import zeros, array\n'), ((4745, 4798), 'numpy.zeros', 'zeros', (['(schema.Width, schema.Length)'], {'dtype': '"""float32"""'}), "((schema.Width, schema.Length), dtype='float32')\n", (... |
"""
Dihedral angle effect
=====================
Effect of dihedral on the lift coefficient slope of rectangular wings.
References
----------
.. [1] <NAME>., *Low-Speed Aerodynamics*, 2nd ed, Cambridge University
Press, 2001: figure 12.21
"""
import time
import matplotlib.pyplot as plt
import numpy as np
import e... | [
"matplotlib.pyplot.grid",
"ezaero.vlm.steady.WingParameters",
"matplotlib.pyplot.ylabel",
"ezaero.vlm.steady.FlightConditions",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"ezaero.vlm.steady.MeshParameters",
"matplotlib.pyplot.figure",
"ezaero.vlm.steady.Simulation",
"nu... | [((353, 364), 'time.time', 'time.time', ([], {}), '()\n', (362, 364), False, 'import time\n'), ((504, 533), 'ezaero.vlm.steady.MeshParameters', 'vlm.MeshParameters', ([], {'m': '(8)', 'n': '(30)'}), '(m=8, n=30)\n', (522, 533), True, 'import ezaero.vlm.steady as vlm\n'), ((610, 658), 'ezaero.vlm.steady.FlightConditions... |
import torch
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import thinplate as tps
from numpy.testing import assert_allclose
def test_pytorch_grid():
c_dst = np.array([
[0., 0],
[1., 0],
[1, 1],
[0, 1],
], dtype=np.float32)
c_src =... | [
"thinplate.tps_grid",
"numpy.testing.assert_allclose",
"numpy.array",
"torch.tensor",
"thinplate.tps_theta_from_points"
] | [((199, 263), 'numpy.array', 'np.array', (['[[0.0, 0], [1.0, 0], [1, 1], [0, 1]]'], {'dtype': 'np.float32'}), '([[0.0, 0], [1.0, 0], [1, 1], [0, 1]], dtype=np.float32)\n', (207, 263), True, 'import numpy as np\n'), ((456, 495), 'thinplate.tps_theta_from_points', 'tps.tps_theta_from_points', (['c_src', 'c_dst'], {}), '(... |
import numpy as np
import pybullet as p
import pybullet_data as pd
import pybullet_utils.bullet_client as bc
from gym import spaces
try:
from .. import Environment
from .robots import get_robot
from .tasks import get_task
except ImportError:
from karolos.environments import Environment
from karolos... | [
"pybullet.resetDebugVisualizerCamera",
"pybullet.getPhysicsEngineParameters",
"pybullet_data.getDataPath",
"karolos.environments.robot_task_environments.tasks.get_task",
"gym.spaces.Dict",
"time.sleep",
"karolos.environments.robot_task_environments.robots.get_robot",
"pybullet_utils.bullet_client.Bull... | [((3306, 3422), 'pybullet.resetDebugVisualizerCamera', 'p.resetDebugVisualizerCamera', ([], {'cameraDistance': '(1.5)', 'cameraYaw': '(70)', 'cameraPitch': '(-27)', 'cameraTargetPosition': '(0, 0, 0)'}), '(cameraDistance=1.5, cameraYaw=70, cameraPitch=\n -27, cameraTargetPosition=(0, 0, 0))\n', (3334, 3422), True, '... |
# -*- coding: utf-8 -*-
# test_nabsH.py
# This module provides the tests for the nabsH function.
# Copyright 2014 <NAME>
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB delta sigma toolbox (aka "delsigma"), upon which it is heavily based.
# The ... | [
"numpy.allclose",
"deltasigma.evalTF",
"numpy.exp",
"numpy.linspace",
"deltasigma.nabsH"
] | [((1001, 1048), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)'], {'num': 'N', 'endpoint': '(True)'}), '(0, 2 * np.pi, num=N, endpoint=True)\n', (1012, 1048), True, 'import numpy as np\n'), ((1059, 1075), 'numpy.exp', 'np.exp', (['(1.0j * w)'], {}), '(1.0j * w)\n', (1065, 1075), True, 'import numpy as np\n'), (... |
# ======================================================================
# Created by <NAME>, <NAME>, <NAME> 11/2021
# ======================================================================
import numpy as np
from parameters import *
from variables import *
import equations
#======================================... | [
"numpy.copy",
"numpy.zeros",
"numpy.empty",
"equations.f_ctt"
] | [((1628, 1646), 'numpy.zeros', 'np.zeros', (['N', 'float'], {}), '(N, float)\n', (1636, 1646), True, 'import numpy as np\n'), ((2530, 2548), 'numpy.empty', 'np.empty', (['M', 'float'], {}), '(M, float)\n', (2538, 2548), True, 'import numpy as np\n'), ((2579, 2590), 'numpy.zeros', 'np.zeros', (['s'], {}), '(s)\n', (2587... |
import numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from oolearning.model_wrappers.HyperParamsBase import HyperParamsBase
from oolearning.model_wrappers.ModelExceptions import MissingValueError
from oolearning.model_wrappers.ModelWrapperBase import ModelWrapperBase
from oolearning.model_wrapp... | [
"oolearning.model_wrappers.ModelExceptions.MissingValueError",
"numpy.isnan",
"sklearn.linear_model.Lasso"
] | [((1624, 1701), 'sklearn.linear_model.Lasso', 'Lasso', ([], {'alpha': "param_dict['alpha']", 'fit_intercept': '(True)', 'random_state': 'self._seed'}), "(alpha=param_dict['alpha'], fit_intercept=True, random_state=self._seed)\n", (1629, 1701), False, 'from sklearn.linear_model import Lasso\n'), ((1511, 1530), 'oolearni... |
"""
This file contains Numba-accelerated functions used in the main detections.
"""
import numpy as np
from numba import jit
__all__ = []
#############################################################################
# NUMBA JIT UTILITY FUNCTIONS
#######################################################################... | [
"numba.jit",
"numpy.sqrt"
] | [((330, 383), 'numba.jit', 'jit', (['"""float64(float64[:], float64[:])"""'], {'nopython': '(True)'}), "('float64(float64[:], float64[:])', nopython=True)\n", (333, 383), False, 'from numba import jit\n'), ((758, 811), 'numba.jit', 'jit', (['"""float64(float64[:], float64[:])"""'], {'nopython': '(True)'}), "('float64(f... |
import ctypes
import numpy as np
from devito.tools.utils import prod
__all__ = ['numpy_to_ctypes', 'numpy_to_mpitypes', 'numpy_view_offsets']
def numpy_to_ctypes(dtype):
"""Map numpy types to ctypes types."""
return {np.int32: ctypes.c_int,
np.float32: ctypes.c_float,
np.int64: ctype... | [
"devito.tools.utils.prod",
"numpy.byte_bounds"
] | [((1848, 1872), 'devito.tools.utils.prod', 'prod', (['base.shape[i + 1:]'], {}), '(base.shape[i + 1:])\n', (1852, 1872), False, 'from devito.tools.utils import prod\n'), ((1404, 1425), 'numpy.byte_bounds', 'np.byte_bounds', (['array'], {}), '(array)\n', (1418, 1425), True, 'import numpy as np\n'), ((1431, 1451), 'numpy... |
from __future__ import division
import matplotlib.pyplot as plt
import numpy
from . import deck
# create a deck
d = deck.deck()
balanced = []
points = []
num = int(1e4)
steps = num // 10
for i in range(num):
if (i+1) % steps == 0:
print("%d of %d" % (i+1, num))
d.shuffle(7)
d.cut()
h1, h2,... | [
"numpy.histogram2d",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.draw"
] | [((640, 652), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (650, 652), True, 'import matplotlib.pyplot as plt\n'), ((973, 985), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (983, 985), True, 'import matplotlib.pyplot as plt\n'), ((1271, 1290), 'numpy.array', 'numpy.array', (['points'], {})... |
from bokeh.plotting import figure
from bokeh.io import output_file, show,export_png
import numpy as np
from scipy.stats import norm
def h(x):
return 750*x/(5+745*x)
F = figure(title='P(S|+) as a function of population incidence if 25% false negatives and .5% false positives',toolbar_location=None)
x=np.linspace(0... | [
"bokeh.io.export_png",
"numpy.linspace",
"bokeh.plotting.figure"
] | [((175, 315), 'bokeh.plotting.figure', 'figure', ([], {'title': '"""P(S|+) as a function of population incidence if 25% false negatives and .5% false positives"""', 'toolbar_location': 'None'}), "(title=\n 'P(S|+) as a function of population incidence if 25% false negatives and .5% false positives'\n , toolbar_lo... |
''' Implementation of GPHMC - Gaussian Process HMC '''
import numpy
from sklearn.gaussian_process import GaussianProcessRegressor
from pypuffin.decorators import accepts
from pypuffin.numeric.mcmc.base import MCMCBase
from pypuffin.sklearn.gaussian_process import gradient_of_mean, gradient_of_std
from pypuffin.types... | [
"numpy.mean",
"pypuffin.sklearn.gaussian_process.gradient_of_mean",
"pypuffin.sklearn.gaussian_process.gradient_of_std",
"numpy.asarray",
"pypuffin.decorators.accepts"
] | [((1140, 1216), 'pypuffin.decorators.accepts', 'accepts', (['object', 'Callable', 'GaussianProcessRegressor', 'Callable', 'numpy.ndarray'], {}), '(object, Callable, GaussianProcessRegressor, Callable, numpy.ndarray)\n', (1147, 1216), False, 'from pypuffin.decorators import accepts\n'), ((2303, 2331), 'numpy.asarray', '... |
from tensorflow import keras
from pathlib import Path
import numpy as np
from training.image_adapter import ImageAdapter
import cv2
from training.model.model_creator import define_composite_model
class ModelSerializer:
model_names = ['d_model_A', "d_model_B", "g_model_AtoB", "g_model_BtoA"]
base_path = './tra... | [
"cv2.imwrite",
"numpy.hstack",
"training.image_adapter.ImageAdapter",
"pathlib.Path",
"tensorflow.keras.models.load_model",
"training.model.model_creator.define_composite_model"
] | [((1214, 1328), 'training.model.model_creator.define_composite_model', 'define_composite_model', (["models['g_model_AtoB']", "models['d_model_B']", "models['g_model_BtoA']", 'self.image_shape'], {}), "(models['g_model_AtoB'], models['d_model_B'], models[\n 'g_model_BtoA'], self.image_shape)\n", (1236, 1328), False, ... |
# implementing RNN and LSTM
# %%
import pandas as pd
import numpy as np
import nltk
import sklearn
import matplotlib.pyplot as plt
import re
import tqdm
twitter_df = pd.read_csv('twitter_train.csv')
twitter_df = twitter_df.fillna('0')
twitter_df_test = pd.read_csv('twitter_test.csv')
twitter_df_test = twitter_df_tes... | [
"pandas.read_csv",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"re.compile",
"matplotlib.pyplot.ylabel",
"tensorflow.keras.callbacks.EarlyStopping",
"tensorflow.keras.layers.Dense",
"gensim.models.word2vec.Word2Vec",
"nltk.TweetTokenizer",
"nltk.corpus.stopwords.words",
"tensorflow.ke... | [((168, 200), 'pandas.read_csv', 'pd.read_csv', (['"""twitter_train.csv"""'], {}), "('twitter_train.csv')\n", (179, 200), True, 'import pandas as pd\n'), ((256, 287), 'pandas.read_csv', 'pd.read_csv', (['"""twitter_test.csv"""'], {}), "('twitter_test.csv')\n", (267, 287), True, 'import pandas as pd\n'), ((1030, 1049), ... |
import numpy as np
import pandas as pd
from itertools import islice
import multiprocessing
from multiprocessing.pool import ThreadPool, Pool
N_CPUS = multiprocessing.cpu_count()
def batch_generator(iterable, n=1):
if hasattr(iterable, '__len__'):
# https://stackoverflow.com/questions/8290397/how-to-split... | [
"itertools.islice",
"multiprocessing.cpu_count",
"numpy.array_split",
"numpy.concatenate",
"pandas.concat"
] | [((151, 178), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (176, 178), False, 'import multiprocessing\n'), ((1786, 1818), 'numpy.array_split', 'np.array_split', (['df', 'n_partitions'], {}), '(df, n_partitions)\n', (1800, 1818), True, 'import numpy as np\n'), ((1927, 1953), 'pandas.concat... |
from __future__ import absolute_import, print_function, division
import warnings
import numpy as np
import astropy.units as u
__all__ = ["_get_x_in_wavenumbers", "_test_valid_x_range"]
def _get_x_in_wavenumbers(in_x):
"""
Convert input x to wavenumber given x has units.
Otherwise, assume x is in wavene... | [
"numpy.any",
"astropy.units.spectral",
"warnings.warn",
"astropy.units.Quantity",
"numpy.atleast_1d"
] | [((606, 625), 'numpy.atleast_1d', 'np.atleast_1d', (['in_x'], {}), '(in_x)\n', (619, 625), True, 'import numpy as np\n'), ((743, 829), 'warnings.warn', 'warnings.warn', (['"""x has no units, assuming x units are inverse microns"""', 'UserWarning'], {}), "('x has no units, assuming x units are inverse microns',\n Use... |
"""
Specific Models
===============
"""
##########################################
# Introduction
# ^^^^^^^^^^^^
# From the algorithm preseneted in “`ABESS algorithm: details <https://abess.readthedocs.io/en/latest/auto_gallery/1-glm/plot_a2_abess_algorithm_details.html>`__”,
# one of the bottleneck in algorithm is th... | [
"abess.linear.LogisticRegression",
"abess.datasets.make_glm_data",
"numpy.random.seed",
"numpy.nonzero",
"abess.linear.LinearRegression",
"time.time"
] | [((2194, 2211), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (2208, 2211), True, 'import numpy as np\n'), ((2219, 2273), 'abess.datasets.make_glm_data', 'make_glm_data', ([], {'n': '(10000)', 'p': '(100)', 'k': '(10)', 'family': '"""gaussian"""'}), "(n=10000, p=100, k=10, family='gaussian')\n", (2232,... |
#!/usr/bin/env python2
#***************************************************************************
#
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#... | [
"mavros_test_common_uav0.MavrosTestCommon",
"rospy.init_node",
"gazebo_msgs.msg.ModelStates",
"numpy.array",
"rospy.Rate",
"numpy.linalg.norm",
"subprocess.Popen",
"geometry_msgs.msg.Quaternion",
"os.system",
"rospy.Subscriber",
"mavros_test_common_uav1.MavrosTestCommon",
"math.radians",
"ro... | [((13152, 13196), 'rospy.init_node', 'rospy.init_node', (['"""test_node"""'], {'anonymous': '(True)'}), "('test_node', anonymous=True)\n", (13167, 13196), False, 'import rospy\n'), ((2850, 2863), 'geometry_msgs.msg.PoseStamped', 'PoseStamped', ([], {}), '()\n', (2861, 2863), False, 'from geometry_msgs.msg import PoseSt... |
# Copyright 2020 <NAME>, University of Pittsburgh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"tensorflow.unstack",
"numpy.minimum",
"numpy.squeeze",
"numpy.stack",
"numpy.split",
"tensorflow.maximum",
"numpy.maximum",
"tensorflow.minimum",
"tensorflow.stack"
] | [((1133, 1157), 'tensorflow.unstack', 'tf.unstack', (['box'], {'axis': '(-1)'}), '(box, axis=-1)\n', (1143, 1157), True, 'import tensorflow as tf\n'), ((1167, 1222), 'tensorflow.stack', 'tf.stack', (['[ymin, 1.0 - xmax, ymax, 1.0 - xmin]'], {'axis': '(-1)'}), '([ymin, 1.0 - xmax, ymax, 1.0 - xmin], axis=-1)\n', (1175, ... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import c3.experiment
import c3.optimizers.c1
import c3.libraries.fidelities as fid
import os
from c3.optimizers.c1 import C1
import c3.libraries.algorithms as algorithms
import c3.libraries.fidelities as fidelities
import examples.single_qubit_b... | [
"os.path.join",
"c3.optimizers.c1.C1",
"numpy.append",
"numpy.linspace",
"c3.libraries.fidelities.unitary_infid",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.legend"
] | [((1389, 1407), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (1401, 1407), True, 'import matplotlib.pyplot as plt\n'), ((1468, 1521), 'numpy.linspace', 'np.linspace', (['(0.0)', '(dt * pop_t.shape[1])', 'pop_t.shape[1]'], {}), '(0.0, dt * pop_t.shape[1], pop_t.shape[1])\n', (1479, 152... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 26 00:32:31 2020
@author: <NAME>
based on code by <NAME>
"""
import numpy as np
from sklearn.cross_decomposition import PLSRegression
# OSC
# nicomp is the number of internal components, ncomp is the number of
# components to remove (ncomp=1 recommended)
class OSC:
... | [
"numpy.identity",
"numpy.mean",
"numpy.sum",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.linalg.svd",
"sklearn.cross_decomposition.PLSRegression"
] | [((1299, 1333), 'numpy.zeros', 'np.zeros', (['(X.shape[1], self.ncomp)'], {}), '((X.shape[1], self.ncomp))\n', (1307, 1333), True, 'import numpy as np\n'), ((1349, 1383), 'numpy.zeros', 'np.zeros', (['(X.shape[1], self.ncomp)'], {}), '((X.shape[1], self.ncomp))\n', (1357, 1383), True, 'import numpy as np\n'), ((1447, 1... |
# 5
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from keras.layers import Dropout
import numpy as np
# sinusoidal position encoding
def get_3d_sincos_pos_embed(embed_dim, grid_size, cls_token=False):
grid_h = np.arange(grid_size)
grid_w = np.arange(grid_size)
gri... | [
"tensorflow.keras.layers.Conv3D",
"tensorflow.meshgrid",
"tensorflow.transpose",
"tensorflow.keras.layers.GlobalAvgPool1D",
"tensorflow.keras.layers.Dense",
"numpy.einsum",
"numpy.sin",
"tensorflow.cast",
"numpy.arange",
"numpy.reshape",
"tensorflow.keras.layers.MultiHeadAttention",
"numpy.con... | [((258, 278), 'numpy.arange', 'np.arange', (['grid_size'], {}), '(grid_size)\n', (267, 278), True, 'import numpy as np\n'), ((292, 312), 'numpy.arange', 'np.arange', (['grid_size'], {}), '(grid_size)\n', (301, 312), True, 'import numpy as np\n'), ((326, 346), 'numpy.arange', 'np.arange', (['grid_size'], {}), '(grid_siz... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 3 10:45:39 2022
@author: dgbli
"""
import numpy as np
import matplotlib.pyplot as plt
def return_true(n):
x = []
for i in range(n):
if i%2==0:
x.append(i)
x.append(i+1)
else:
x.append(None)
... | [
"numpy.random.rand",
"matplotlib.pyplot.subplots"
] | [((914, 928), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (926, 928), True, 'import matplotlib.pyplot as plt\n'), ((2072, 2090), 'numpy.random.rand', 'np.random.rand', (['(25)'], {}), '(25)\n', (2086, 2090), True, 'import numpy as np\n'), ((2106, 2124), 'numpy.random.rand', 'np.random.rand', (['(25)... |
import numpy as np
from skimage import feature
from sklearn import preprocessing
class LBP:
def __init__(self, p, r):
self.p = p
self.r = r
def getVecLength(self):
return 2**self.p
def getFeature(self, imgMat):
feat = feature.local_binary_pattern(
... | [
"numpy.append",
"numpy.array",
"sklearn.preprocessing.normalize",
"skimage.feature.hog",
"numpy.load",
"numpy.float32",
"numpy.save",
"skimage.feature.local_binary_pattern"
] | [((2895, 2930), 'numpy.append', 'np.append', (['featHog', 'featLbp'], {'axis': '(1)'}), '(featHog, featLbp, axis=1)\n', (2904, 2930), True, 'import numpy as np\n'), ((280, 350), 'skimage.feature.local_binary_pattern', 'feature.local_binary_pattern', (['imgMat', 'self.p', 'self.r'], {'method': '"""uniform"""'}), "(imgMa... |
#!/usr/bin/env
"""
Read in two extracted light curves (interest band and reference band), split
into segments, compute the power spectra per band and cross spectrum of each
segment, averages cross spectrum of all the segments, and computes frequency
lags between the two bands.
Example call:
python simple_cross_spectra... | [
"numpy.sqrt",
"astropy.table.Table",
"scipy.fftpack.fftfreq",
"numpy.arctan2",
"scipy.fftpack.fft",
"astropy.io.fits.open",
"numpy.int8",
"numpy.mean",
"argparse.ArgumentParser",
"numpy.where",
"numpy.subtract",
"numpy.real",
"subprocess.call",
"numpy.abs",
"numpy.conj",
"argparse.Argu... | [((1664, 1699), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (['message'], {}), '(message)\n', (1690, 1699), False, 'import argparse\n'), ((2358, 2370), 'numpy.int8', 'np.int8', (['ext'], {}), '(ext)\n', (2365, 2370), True, 'import numpy as np\n'), ((4602, 4628), 'numpy.sum', 'np.sum', (['(power * df)'],... |
import streamlit as st
import numpy as np
import pandas as pd
from sklearn.datasets import load_iris
from .generic import Tool
iris = pd.DataFrame(load_iris()["data"])
df = pd.DataFrame(
np.random.randn(50, 20),
columns=('col %d' % i for i in range(20)))
# st.dataframe(df) # Same as st.write(df)
class Da... | [
"sklearn.datasets.load_iris",
"streamlit.checkbox",
"pandas.read_csv",
"streamlit.write",
"numpy.random.randn"
] | [((194, 217), 'numpy.random.randn', 'np.random.randn', (['(50)', '(20)'], {}), '(50, 20)\n', (209, 217), True, 'import numpy as np\n'), ((150, 161), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (159, 161), False, 'from sklearn.datasets import load_iris\n'), ((1000, 1034), 'streamlit.checkbox', 'st.check... |
#!/usr/bin/python3
"""
一些基础的类和函数
注意, import关系需要能够拓扑排序(不要相互调用).
"""
# 加载不应该被COPY的包
import io2 as io
import deap
from deap import algorithms, base, creator, gp, tools
from prettytable import PrettyTable
# COPY #
import copy
import random
import warnings
import sys
import pdb
import inspect
import shu... | [
"numpy.hstack",
"pandas.value_counts",
"numpy.array",
"numpy.nanmean",
"numpy.mean",
"numpy.full_like",
"inspect.isclass",
"scipy.stats.kurtosis",
"numpy.ix_",
"numpy.stack",
"numpy.dot",
"numpy.linalg.lstsq",
"numpy.isinf",
"deap.gp.PrimitiveTree",
"prettytable.PrettyTable",
"numpy.ab... | [((2907, 2932), 'numpy.full_like', 'np.full_like', (['arr', 'np.nan'], {}), '(arr, np.nan)\n', (2919, 2932), True, 'import numpy as np\n'), ((4449, 4473), 'numpy.stack', 'np.stack', (['ret'], {'axis': 'axis'}), '(ret, axis=axis)\n', (4457, 4473), True, 'import numpy as np\n'), ((4984, 5008), 'numpy.stack', 'np.stack', ... |
from typing import Optional, Union
import numpy as np
from scipy.spatial import cKDTree
import bbknn
from scipy.sparse import csr_matrix
import scanpy as sc
from numpy.testing import assert_array_equal, assert_array_compare
import operator
import numpy as np
from anndata import AnnData
from sklearn.utils import che... | [
"bbknn.trimming",
"numpy.copy",
"bbknn.query_tree",
"numpy.shape",
"numpy.unique",
"bbknn.create_tree",
"numpy.argsort",
"numpy.testing.assert_array_compare",
"scanpy.tl.umap",
"scanpy.pl.umap",
"scipy.sparse.csr_matrix",
"numpy.arange",
"bbknn.compute_connectivities_umap"
] | [((1148, 1169), 'numpy.unique', 'np.unique', (['batch_list'], {}), '(batch_list)\n', (1157, 1169), True, 'import numpy as np\n'), ((5800, 5833), 'numpy.argsort', 'np.argsort', (['knn_distances'], {'axis': '(1)'}), '(knn_distances, axis=1)\n', (5810, 5833), True, 'import numpy as np\n'), ((6100, 6288), 'bbknn.compute_co... |
import scann
from argparse import ArgumentParser
from pl_bolts.models.self_supervised import SimCLR
from pl_bolts.models.self_supervised.resnets import resnet18
from pl_bolts.models.self_supervised.simclr.transforms import SimCLREvalDataTransform, SimCLRTrainDataTransform
from pathlib import Path
import torch
import os... | [
"matplotlib.pyplot.ylabel",
"pl_bolts.models.self_supervised.SimCLR",
"pl_bolts.models.self_supervised.simclr.transforms.SimCLREvalDataTransform",
"numpy.linalg.norm",
"os.remove",
"os.path.exists",
"seaborn.set",
"argparse.ArgumentParser",
"pathlib.Path",
"torch.unsqueeze",
"matplotlib.pyplot.x... | [((868, 881), 'tqdm.tqdm', 'tqdm', (['dataset'], {}), '(dataset)\n', (872, 881), False, 'from tqdm import tqdm\n'), ((1226, 1251), 'os.path.exists', 'os.path.exists', (['"""data.h5"""'], {}), "('data.h5')\n", (1240, 1251), False, 'import os\n'), ((1285, 1310), 'h5py.File', 'h5py.File', (['"""data.h5"""', '"""w"""'], {}... |
import argparse
import numpy as np
import models.ensemble as e
import utils.load as l
import utils.metrics as m
import utils.wrapper as w
def get_arguments():
"""Gets arguments from the command line.
Returns:
A parser with the input arguments.
"""
# Creates the ArgumentParser
parser =... | [
"argparse.ArgumentParser",
"utils.wrapper.optimize_umda",
"numpy.random.seed",
"models.ensemble.boolean_classifiers",
"utils.load.load_candidates"
] | [((321, 448), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""Optimizes a boolean-based ensemble using Univariate Marginal Distribution Algorithm."""'}), "(usage=\n 'Optimizes a boolean-based ensemble using Univariate Marginal Distribution Algorithm.'\n )\n", (344, 448), False, 'import ar... |
import os
import cv2
import numpy as np
from math import *
from scipy.stats import mode
import time
# 图像矫正类
class ImgCorrect:
"""
霍夫变换进行线段检索,再根据这些线段算出夹角,利用角度的加权平均值和频率最高的思想作为旋转的最佳角度
"""
def __init__(self, img):
self.img = img
"""
# 图像归一化处理 会造成图像清晰度变低
self.h, self.w, self.... | [
"numpy.array",
"os.path.exists",
"os.listdir",
"cv2.threshold",
"time.localtime",
"cv2.warpAffine",
"os.rename",
"cv2.cvtColor",
"cv2.getRotationMatrix2D",
"cv2.Canny",
"cv2.imread",
"cv2.imwrite",
"cv2.HoughLinesP",
"os.makedirs",
"scipy.stats.mode",
"os.path.join",
"os.path.abspath... | [((6384, 6406), 'os.listdir', 'os.listdir', (['input_path'], {}), '(input_path)\n', (6394, 6406), False, 'import os\n'), ((7140, 7162), 'os.listdir', 'os.listdir', (['input_path'], {}), '(input_path)\n', (7150, 7162), False, 'import os\n'), ((882, 924), 'cv2.cvtColor', 'cv2.cvtColor', (['self.img', 'cv2.COLOR_BGR2GRAY'... |
from __future__ import print_function, division, absolute_import
import argparse
import math
import time
import matplotlib.pyplot as plt
import numpy as np
import scipy.io as sio
import torch
from hubconf import SRResNet
parser = argparse.ArgumentParser(description="PyTorch SRResNet Demo")
parser.add_argument("--de... | [
"numpy.clip",
"numpy.mean",
"hubconf.SRResNet",
"argparse.ArgumentParser",
"matplotlib.pyplot.show",
"torch.load",
"scipy.io.loadmat",
"torch.from_numpy",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"torch.set_grad_enabled",
"math.log10",
"time.time",
"torch.device"
] | [((234, 294), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch SRResNet Demo"""'}), "(description='PyTorch SRResNet Demo')\n", (257, 294), False, 'import argparse\n'), ((1153, 1177), 'torch.device', 'torch.device', (['opt.device'], {}), '(opt.device)\n', (1165, 1177), False, 'impor... |
from py_dp.dispersion.binning import make_input_for_binning_with_freq, make_1d_abs_vel_bins, class_index_abs_log
from py_dp.dispersion.convert_to_time_process_with_freq import remove_duplicate
import numpy as np
from copy import copy
from py_dp.dispersion.mapping import mapping_v_sgn_repeat
import os
def test_mapping_... | [
"py_dp.dispersion.binning.make_input_for_binning_with_freq",
"py_dp.dispersion.binning.class_index_abs_log",
"numpy.unique",
"py_dp.dispersion.binning.make_1d_abs_vel_bins",
"numpy.log",
"os.path.join",
"numpy.array",
"os.path.dirname",
"py_dp.dispersion.convert_to_time_process_with_freq.remove_dupl... | [((413, 489), 'os.path.join', 'os.path.join', (['main_folder', '"""test_related_files"""', '"""particle_tracking_results"""'], {}), "(main_folder, 'test_related_files', 'particle_tracking_results')\n", (425, 489), False, 'import os\n'), ((592, 651), 'py_dp.dispersion.binning.make_input_for_binning_with_freq', 'make_inp... |
import numpy as np
import tensorflow as tf
OUTPUT_PATH = "../events/"
def save():
input_node = tf.placeholder(shape=[None, 100, 100, 3], dtype=tf.float32)
net = tf.layers.conv2d(input_node, 32, (3, 3), strides=(2, 2), padding='same', name='conv_1')
net = tf.layers.conv2d(net, 32, (3, 3), strides=(1, 1), ... | [
"tensorflow.local_variables_initializer",
"numpy.alltrue",
"tensorflow.reset_default_graph",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.layers.conv2d",
"tensorflow.train.import_meta_graph",
"tensorflow.get_defaul... | [((102, 161), 'tensorflow.placeholder', 'tf.placeholder', ([], {'shape': '[None, 100, 100, 3]', 'dtype': 'tf.float32'}), '(shape=[None, 100, 100, 3], dtype=tf.float32)\n', (116, 161), True, 'import tensorflow as tf\n'), ((172, 263), 'tensorflow.layers.conv2d', 'tf.layers.conv2d', (['input_node', '(32)', '(3, 3)'], {'st... |
# Copyright 2020 The TensorFlow Probability Authors.
#
# 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.compat.v2.where",
"tensorflow.compat.v2.constant",
"tensorflow.compat.v2.is_tensor",
"tensorflow.compat.v2.nest.map_structure",
"tensorflow.compat.v2.math.abs",
"tensorflow.compat.v2.cast",
"tensorflow_probability.python.math.gradient.value_and_gradient",
"tensorflow.compat.v2.reshape",
... | [((2719, 2752), 'tensorflow.compat.v2.cast', 'tf.cast', (['result'], {'dtype': 'tf.float64'}), '(result, dtype=tf.float64)\n', (2726, 2752), True, 'import tensorflow.compat.v2 as tf\n'), ((2763, 2795), 'tensorflow.compat.v2.cast', 'tf.cast', (['truth'], {'dtype': 'tf.float64'}), '(truth, dtype=tf.float64)\n', (2770, 27... |
import copy
import numpy as np
import pandas as pd
from sklearn.linear_model import RidgeCV
from sklearn.model_selection import cross_val_score, GridSearchCV
import warnings
# warnings.simplefilter('ignore')
def main():
features = [
'OverallQual',
'GrLivArea',
'GarageArea',
'Tota... | [
"pandas.read_feather",
"numpy.log",
"copy.deepcopy"
] | [((487, 530), 'pandas.read_feather', 'pd.read_feather', (['"""data/input/train.feather"""'], {}), "('data/input/train.feather')\n", (502, 530), True, 'import pandas as pd\n'), ((955, 978), 'copy.deepcopy', 'copy.deepcopy', (['features'], {}), '(features)\n', (968, 978), False, 'import copy\n'), ((1406, 1435), 'numpy.lo... |
from __future__ import division
import numpy as np
from numpy import pi, sqrt, exp, power, log, log10
import os
import constants as ct
import particle as pt
import tools as tl
##############################
# Preparing SKA configurations
##############################
def initialize():
"""This routine is supp... | [
"numpy.log10",
"numpy.sqrt",
"numpy.log",
"numpy.array",
"constants.angle_to_solid_angle",
"numpy.where",
"numpy.heaviside",
"numpy.concatenate",
"numpy.logspace",
"numpy.isinf",
"numpy.abs",
"numpy.squeeze",
"particle.lambda_from_nu",
"numpy.interp",
"numpy.ones_like",
"tools.treat_as... | [((22044, 22104), 'numpy.loadtxt', 'np.loadtxt', (["(local_path + '/data/Tsky_mid.csv')"], {'delimiter': '""","""'}), "(local_path + '/data/Tsky_mid.csv', delimiter=',')\n", (22054, 22104), True, 'import numpy as np\n'), ((22114, 22174), 'numpy.loadtxt', 'np.loadtxt', (["(local_path + '/data/Tsky_low.csv')"], {'delimit... |
import os
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
from src.data_management.New_DataSplitter_leave_k_out import New_DataSplitter_leave_k_out
from src.data_management.RecSys2019Reader import RecSys2019Reader
from src.data_management.data_reader import get_ICM_train, get_UCM_train... | [
"matplotlib.pyplot.ylabel",
"src.utils.general_utility_functions.get_split_seed",
"numpy.arange",
"os.path.exists",
"src.data_management.data_reader.get_ICM_train",
"numpy.sort",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.mkdir",
"src.feature.demographics_content.get_user_demographi... | [((733, 742), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (740, 742), True, 'import matplotlib.pyplot as plt\n'), ((1520, 1552), 'src.data_management.RecSys2019Reader.RecSys2019Reader', 'RecSys2019Reader', (['root_data_path'], {}), '(root_data_path)\n', (1536, 1552), False, 'from src.data_management.RecSys201... |
import os
from pathlib import Path
from time import time
from tqdm import tqdm
from argparse import ArgumentParser
import numpy as np
import torch
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from datasets import GloveDataset
from glove import GloveModel,... | [
"torch.utils.tensorboard.SummaryWriter",
"numpy.mean",
"torch.log",
"argparse.ArgumentParser",
"pathlib.Path",
"tqdm.tqdm",
"glove.weight_func",
"torch.cuda.is_available",
"glove.GloveModel",
"time.time"
] | [((809, 850), 'glove.GloveModel', 'GloveModel', (['dataset._vocab_len', 'EMBED_DIM'], {}), '(dataset._vocab_len, EMBED_DIM)\n', (819, 850), False, 'from glove import GloveModel, weight_func, wmse_loss\n'), ((961, 967), 'time.time', 'time', ([], {}), '()\n', (965, 967), False, 'from time import time\n'), ((1165, 1194), ... |
# 实现PCA分析和法向量计算,并加载数据集中的文件进行验证
import os
import time
import numpy as np
from pyntcloud import PyntCloud
import open3d as o3d
def PCA(data: PyntCloud.points, correlation: bool=False, sort: bool=True) -> np.array:
""" Calculate PCA
Parameters
----------
data(PyntCloud.points): 点云,NX3的矩阵
co... | [
"numpy.mean",
"numpy.full",
"open3d.geometry.KDTreeFlann",
"open3d.utility.Vector2iVector",
"os.path.join",
"numpy.asarray",
"numpy.array",
"numpy.dot",
"os.path.isdir",
"open3d.visualization.draw_geometries",
"numpy.vstack",
"open3d.geometry.PointCloud",
"open3d.geometry.TriangleMesh.create... | [((671, 687), 'numpy.dot', 'np.dot', (['X_.T', 'X_'], {}), '(X_.T, X_)\n', (677, 687), True, 'import numpy as np\n'), ((991, 1007), 'numpy.linalg.svd', 'np.linalg.svd', (['H'], {}), '(H)\n', (1004, 1007), True, 'import numpy as np\n'), ((612, 633), 'numpy.mean', 'np.mean', (['data'], {'axis': '(0)'}), '(data, axis=0)\n... |
from __future__ import absolute_import
from datashader.utils import ngjit
from numba import vectorize, int64
import numpy as np
import os
"""
Initially based on https://github.com/galtay/hilbert_curve, but specialized
for 2 dimensions with numba acceleration
"""
NUMBA_DISABLE_JIT = os.environ.get('NUMBA_DISABLE_JIT',... | [
"numpy.array",
"numpy.zeros",
"numba.int64",
"os.environ.get"
] | [((285, 323), 'os.environ.get', 'os.environ.get', (['"""NUMBA_DISABLE_JIT"""', '(0)'], {}), "('NUMBA_DISABLE_JIT', 0)\n", (299, 323), False, 'import os\n'), ((464, 495), 'numpy.zeros', 'np.zeros', (['width'], {'dtype': 'np.uint8'}), '(width, dtype=np.uint8)\n', (472, 495), True, 'import numpy as np\n'), ((1761, 1792), ... |
# =============================================================================
# HEPHAESTUS VALIDATION 8 - BEAM DISPLACEMENTS AND ROTATIONS SIMPLE AL BOX BEAM
# =============================================================================
# IMPORTS:
import sys
import os
sys.path.append(os.path.abspath('..\..'))
fr... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.hold",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"AeroComBAT.AircraftParts.Wing",
"numpy.array",
"numpy.linspace",
"AeroComBAT.FEM.Model",
"matplotlib.pyplot.figure",
"numpy.linalg.nor... | [((579, 604), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0])\n', (587, 604), True, 'import numpy as np\n'), ((605, 631), 'numpy.array', 'np.array', (['[0.0, 0.0, 20.0]'], {}), '([0.0, 0.0, 20.0])\n', (613, 631), True, 'import numpy as np\n'), ((635, 659), 'numpy.linspace', 'np.linspace', (['(0... |
import pkg_resources
import re
import requests
import numpy as np
import scipy as sp
import scipy.sparse
import scipy.sparse.linalg
from . import index
__all__ = ['PowerNetwork', 'load_case']
class PowerNetwork:
def __init__(self, basemva, bus=None, gen=None, gencost=None, branch=None, perunit=True):
i... | [
"scipy.sparse.csc_matrix",
"numpy.multiply",
"pkg_resources.resource_exists",
"numpy.ones",
"numpy.arange",
"numpy.where",
"requests.get",
"numpy.max",
"numpy.sum",
"numpy.concatenate",
"pkg_resources.resource_stream",
"numpy.all",
"pkg_resources.resource_listdir",
"numpy.divide",
"re.se... | [((10122, 10172), 'pkg_resources.resource_listdir', 'pkg_resources.resource_listdir', (['"""phasorpy"""', '"""data"""'], {}), "('phasorpy', 'data')\n", (10152, 10172), False, 'import pkg_resources\n'), ((3941, 3974), 'numpy.all', 'np.all', (["(self.gen['RAMP_AGC'] == 0)"], {}), "(self.gen['RAMP_AGC'] == 0)\n", (3947, 3... |
import torch
import torch.nn as nn
from torch.nn import Parameter
import torch.nn.functional as F
import numpy as np
class Identity(torch.nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
class Flatten(nn.Module):
def forward(self, input):
... | [
"torch.mul",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.nn.ReflectionPad2d",
"torch.nn.L1Loss",
"torch.sqrt",
"torch.pow",
"torch.from_numpy",
"torch.nn.functional.interpolate",
"torch.nn.BatchNorm2d",
"torch.nn.Sigmoid",
"numpy.histogram",
"torch.mean",
"torch.nn... | [((2338, 2349), 'torch.nn.L1Loss', 'nn.L1Loss', ([], {}), '()\n', (2347, 2349), True, 'import torch.nn as nn\n'), ((3231, 3273), 'torch.cat', 'torch.cat', (['(hue, saturation, value)'], {'dim': '(1)'}), '((hue, saturation, value), dim=1)\n', (3240, 3273), False, 'import torch\n'), ((3375, 3410), 'torch.nn.functional.l1... |
import unittest
import numpy as np
from hypothesis import given
import hypothesis.strategies as some
import hypothesis.extra.numpy as some_np
from extractor.gps import gps_to_ltp, gps_from_ltp, \
interpolate_gps
class TestGps(unittest.TestCase):
@given(
some_np.arrays(
dtype=np.float... | [
"extractor.gps.gps_to_ltp",
"numpy.allclose",
"hypothesis.strategies.integers",
"extractor.gps.interpolate_gps",
"extractor.gps.gps_from_ltp",
"hypothesis.strategies.floats",
"numpy.array"
] | [((648, 663), 'extractor.gps.gps_to_ltp', 'gps_to_ltp', (['gps'], {}), '(gps)\n', (658, 663), False, 'from extractor.gps import gps_to_ltp, gps_from_ltp, interpolate_gps\n'), ((688, 717), 'extractor.gps.gps_from_ltp', 'gps_from_ltp', (['gps_ltp', 'origin'], {}), '(gps_ltp, origin)\n', (700, 717), False, 'from extractor... |
import torch
from torch.utils.data import Dataset, DataLoader
import torchvision
from torchvision import transforms
import torch.nn as nn
import os
import glob
import numpy as np
import time
import cv2
from einops import rearrange, reduce, repeat
from PIL import Image
#from utils.augmentations import SSDAugmentation,... | [
"torch.stack",
"einops.rearrange",
"torch.tensor",
"os.path.isdir",
"numpy.std",
"numpy.load",
"cv2.imread",
"torch.FloatTensor",
"glob.glob"
] | [((10433, 10449), 'torch.stack', 'torch.stack', (['rfs'], {}), '(rfs)\n', (10444, 10449), False, 'import torch\n'), ((11547, 11563), 'torch.stack', 'torch.stack', (['rfs'], {}), '(rfs)\n', (11558, 11563), False, 'import torch\n'), ((1526, 1553), 'glob.glob', 'glob.glob', (["(data_path + '/*')"], {}), "(data_path + '/*'... |
# -*- coding: utf-8 -*-
from quartical.config.external import Gain
from quartical.config.internal import yield_from
from loguru import logger # noqa
import numpy as np
import dask.array as da
from pathlib import Path
import shutil
from daskms.experimental.zarr import xds_to_zarr
from quartical.gains import TERM_TYPES
... | [
"dask.array.compute",
"dask.array.blockwise",
"numpy.tile",
"numpy.ones",
"loguru.logger.info",
"pathlib.Path",
"quartical.config.internal.yield_from",
"quartical.gains.general.generics.combine_gains",
"dask.array.map_blocks",
"loguru.logger.warning",
"quartical.utils.dask.blockwise_unique",
"... | [((3964, 3996), 'dask.array.compute', 'da.compute', (['tipc_list', 'fipc_list'], {}), '(tipc_list, fipc_list)\n', (3974, 3996), True, 'import dask.array as da\n'), ((9030, 9106), 'quartical.gains.general.generics.combine_gains', 'combine_gains', (['t_bin_arr', 'f_map_arr', 'd_map_arr', 'net_shape', 'corr_mode', '*gains... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 19 01:31:38 2019.
@author: mtageld
"""
import unittest
import girder_client
import numpy as np
from skimage.transform import resize
# from matplotlib import pylab as plt
# from matplotlib.colors import ListedColormap
from histomicstk.saliency.tissue... | [
"histomicstk.saliency.tissue_detection.get_tissue_mask",
"girder_client.GirderClient",
"histomicstk.preprocessing.color_normalization.deconvolution_based_normalization.deconvolution_based_normalization",
"numpy.array",
"unittest.main",
"skimage.transform.resize",
"histomicstk.saliency.tissue_detection.g... | [((839, 880), 'girder_client.GirderClient', 'girder_client.GirderClient', ([], {'apiUrl': 'APIURL'}), '(apiUrl=APIURL)\n', (865, 880), False, 'import girder_client\n'), ((1181, 1310), 'numpy.array', 'np.array', (['[[0.5807549, 0.08314027, 0.08213795], [0.71681094, 0.90081588, 0.41999816],\n [0.38588316, 0.42616716, ... |
# mathematical imports -
import numpy as np
# pytorch imports -
import torch
import torch.utils.data as data
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def createDiff(data):
dataOut = np.zeros(shape=(data.shape[0],data.shape[1]-1))
for i in range(data.shape[1]-1):
da... | [
"torch.Tensor",
"numpy.zeros",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"numpy.load"
] | [((225, 275), 'numpy.zeros', 'np.zeros', ([], {'shape': '(data.shape[0], data.shape[1] - 1)'}), '(shape=(data.shape[0], data.shape[1] - 1))\n', (233, 275), True, 'import numpy as np\n'), ((7075, 7099), 'numpy.load', 'np.load', (['(path + fileName)'], {}), '(path + fileName)\n', (7082, 7099), True, 'import numpy as np\n... |
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
from matplotlib import pyplot
import cv2
class DataAugmentation:
shift = 0.15;
datagen = None;
# constructor
def __init__(self):
# define data preparation
self.datagen = ImageDataGenerator(featurewise_center=False,
samplewis... | [
"matplotlib.pyplot.imshow",
"cv2.flip",
"keras.preprocessing.image.ImageDataGenerator",
"numpy.squeeze",
"numpy.array",
"cv2.resize",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((256, 686), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'featurewise_center': '(False)', 'samplewise_center': '(False)', 'featurewise_std_normalization': '(False)', 'samplewise_std_normalization': '(False)', 'zca_whitening': '(False)', 'rotation_range': '(0.0)', 'width_shift_range': 's... |
import glob, os, shutil, sys, json
from pathlib import Path
import pylab as plt
import trimesh
import open3d
from easydict import EasyDict
import numpy as np
from tqdm import tqdm
import utils
from features import MeshFPFH
FIX_BAD_ANNOTATION_HUMAN_15 = 0
# Labels for all datasets
# -----------------------
sigg17_pa... | [
"csv.DictReader",
"numpy.array",
"open3d.io.read_triangle_mesh",
"numpy.linalg.norm",
"trimesh.proximity.closest_point",
"numpy.sin",
"os.path.exists",
"numpy.savez",
"os.listdir",
"numpy.mean",
"pathlib.Path",
"numpy.asarray",
"numpy.max",
"os.path.split",
"easydict.EasyDict",
"numpy.... | [((6944, 6977), 'numpy.dot', 'np.dot', (['vertices', 'R'], {'out': 'vertices'}), '(vertices, R, out=vertices)\n', (6950, 6977), True, 'import numpy as np\n'), ((7017, 7095), 'trimesh.Trimesh', 'trimesh.Trimesh', ([], {'vertices': "mesh['vertices']", 'faces': "mesh['faces']", 'process': '(False)'}), "(vertices=mesh['ver... |
from ..tasks import video, task_base
import numpy as np
def get_videos(subject, session):
video_idx = np.loadtxt(
"data/liris/order_fmri_neuromod.csv", delimiter=",", skiprows=1, dtype=np.int
)
selected_idx = video_idx[video_idx[:, 0] == session, subject + 1]
return selected_idx
def get_task... | [
"numpy.loadtxt"
] | [((108, 201), 'numpy.loadtxt', 'np.loadtxt', (['"""data/liris/order_fmri_neuromod.csv"""'], {'delimiter': '""","""', 'skiprows': '(1)', 'dtype': 'np.int'}), "('data/liris/order_fmri_neuromod.csv', delimiter=',', skiprows=1,\n dtype=np.int)\n", (118, 201), True, 'import numpy as np\n')] |
"""Module providing adapter class making node-label prediction possible in sklearn models."""
from sklearn.base import ClassifierMixin
from typing import Type, List, Dict, Optional, Any
import numpy as np
import copy
from ensmallen import Graph
from embiggen.embedding_transformers import NodeLabelPredictionTransformer,... | [
"embiggen.utils.sklearn_utils.must_be_an_sklearn_classifier_model",
"embiggen.embedding_transformers.NodeLabelPredictionTransformer",
"numpy.array",
"copy.deepcopy",
"embiggen.embedding_transformers.NodeTransformer"
] | [((1386, 1437), 'embiggen.utils.sklearn_utils.must_be_an_sklearn_classifier_model', 'must_be_an_sklearn_classifier_model', (['model_instance'], {}), '(model_instance)\n', (1421, 1437), False, 'from embiggen.utils.sklearn_utils import must_be_an_sklearn_classifier_model\n'), ((1786, 1805), 'copy.deepcopy', 'copy.deepcop... |
#!/usr/bin/python
#
# Copyright 2018, <NAME>
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaim... | [
"logging.getLogger",
"sklearn.model_selection.GridSearchCV",
"logging.StreamHandler",
"rdkit.Chem.AllChem.GetMolFrags",
"rdkit.Chem.AllChem.SanitizeMol",
"pandas.read_csv",
"sklearn.metrics.classification_report",
"rdkit.Chem.AllChem.Compute2DCoords",
"numpy.log",
"rdkit.Chem.AllChem.SDMolSupplier... | [((3056, 3079), 'rdkit.Chem.AllChem.GetPeriodicTable', 'Chem.GetPeriodicTable', ([], {}), '()\n', (3077, 3079), True, 'from rdkit.Chem import AllChem as Chem\n'), ((13855, 14034), 'logging.info', 'logging.info', (["('Generating feature using RDKit matrix from: %s -- with options skipH (%r) iterative(%r) filterRubbish(%... |
import collections.abc
import enum
import os
from typing import (
TYPE_CHECKING,
Annotated,
Any,
AsyncGenerator,
Optional,
Union,
)
import aiohttp
import inflection
import numpy as np
import pandas as pd
import pydantic
import structlog
import uplink
import uplink.converters
from pandera.decora... | [
"numpy.log",
"uplink.retry.backoff.jittered",
"uplink.retry.stop.after_delay",
"uplink.Query",
"wraeblast.constants.get_cluster_jewel_passive",
"uplink.ratelimit",
"pandera.model_components.Field",
"pandas.DataFrame",
"inflection.pluralize",
"pydantic.PrivateAttr",
"pydantic.validator",
"wraeb... | [((782, 804), 'structlog.get_logger', 'structlog.get_logger', ([], {}), '()\n', (802, 804), False, 'import structlog\n'), ((11725, 11766), 'pandera.decorators.check_output', 'check_output', (['ExtendedNinjaOverviewSchema'], {}), '(ExtendedNinjaOverviewSchema)\n', (11737, 11766), False, 'from pandera.decorators import c... |
from heapq import heappush ,heappop, heapify ,_heapify_max
from typing import Union
# Running scalar median
# Ack: https://medium.com/mind-boggling-algorithms/streaming-algorithms-running-median-of-an-array-using-two-heaps-cd1b61b3c034
def med(s,x:Union[float,int]=None)->dict:
""" Running median
:param x... | [
"numpy.median",
"random.choice",
"heapq._heapify_max",
"heapq.heappop",
"heapq.heappush"
] | [((516, 542), 'heapq.heappush', 'heappush', (["s['low_heap']", 'x'], {}), "(s['low_heap'], x)\n", (524, 542), False, 'from heapq import heappush, heappop, heapify, _heapify_max\n'), ((551, 578), 'heapq._heapify_max', '_heapify_max', (["s['low_heap']"], {}), "(s['low_heap'])\n", (563, 578), False, 'from heapq import hea... |
"""Unit tests for satellite_utils.py."""
import unittest
import numpy
from ml4tc.utils import satellite_utils
TOLERANCE = 1e-6
# The following constants are used to test _find_storm_center_px_space.
GRID_LATITUDES_DEG_N = numpy.array(
[-10, -8, -6, -4, -2, 0, 3, 6, 9, 12, 20], dtype=float
)
GRID_LONGITUDES_DEG_E... | [
"numpy.allclose",
"ml4tc.utils.satellite_utils.get_cyclone_id",
"ml4tc.utils.satellite_utils._crop_image_around_storm_center",
"ml4tc.utils.satellite_utils._find_storm_center_px_space",
"numpy.array",
"ml4tc.utils.satellite_utils.parse_cyclone_id",
"unittest.main"
] | [((225, 292), 'numpy.array', 'numpy.array', (['[-10, -8, -6, -4, -2, 0, 3, 6, 9, 12, 20]'], {'dtype': 'float'}), '([-10, -8, -6, -4, -2, 0, 3, 6, 9, 12, 20], dtype=float)\n', (236, 292), False, 'import numpy\n'), ((323, 397), 'numpy.array', 'numpy.array', (['[350, 355, 0, 5, 10, 15, 25, 35, 45, 55, 65, 75]'], {'dtype':... |
"""Test file for float subgraph fusing"""
import random
from inspect import signature
import numpy
import pytest
from concrete.common.data_types.integers import Integer
from concrete.common.debugging.custom_assert import assert_not_reached
from concrete.common.optimization.topological import fuse_float_operations
fr... | [
"numpy.product",
"numpy.int64",
"numpy.reshape",
"numpy.ones",
"concrete.common.data_types.integers.Integer",
"numpy.int32",
"inspect.signature",
"concrete.common.optimization.topological.fuse_float_operations",
"pytest.param",
"pytest.mark.parametrize",
"pytest.raises",
"numpy.cos",
"concre... | [((24956, 25028), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""fun"""', 'tracing.NPTracer.LIST_OF_SUPPORTED_UFUNC'], {}), "('fun', tracing.NPTracer.LIST_OF_SUPPORTED_UFUNC)\n", (24979, 25028), False, 'import pytest\n'), ((1158, 1170), 'numpy.cos', 'numpy.cos', (['x'], {}), '(x)\n', (1167, 1170), False, '... |
import torch
from torch import nn
import numpy as np
from collections import OrderedDict
from torch.utils.data import DataLoader
from torch.utils.data import Sampler
from contextlib import nullcontext
import yaml
from yaml import SafeLoader as yaml_Loader, SafeDumper as yaml_Dumper
import os,sys
from tqdm import tqdm... | [
"torch.utils.data.DistributedSampler",
"yaml.load",
"lib.utils.dotdict.HDict.L",
"numpy.array_split",
"numpy.arange",
"lib.utils.dotdict.HDict",
"torch.nn.parallel.DistributedDataParallel",
"collections.OrderedDict",
"yaml.dump",
"torch.distributed.all_reduce",
"os.path.dirname",
"yaml.represe... | [((358, 399), 'lib.utils.dotdict.HDict.L.update_globals', 'HDict.L.update_globals', (["{'path': os.path}"], {}), "({'path': os.path})\n", (380, 399), False, 'from lib.utils.dotdict import HDict\n'), ((637, 705), 'yaml.representer.SafeRepresenter.add_representer', 'yaml.representer.SafeRepresenter.add_representer', (['s... |
import networkx as nx
import numpy as np
def project3d(points, direction):
"""
投影函数,将三维点集投影到二维
投影平面内的y方向为z轴投影(如果投影的法向量为z轴,则y方向为x轴投影)
:param points: 三维点集
:param direction: 投影平面的法向量(u,v,w),投影平面通过原点(0,0,0)
"""
d = direction / np.linalg.norm(direction)
y0 = np.array([1, 0, 0]) if np.array(... | [
"numpy.cross",
"networkx.draw_networkx_edge_labels",
"networkx.is_connected",
"networkx.get_edge_attributes",
"networkx.Graph",
"networkx.connected_components",
"networkx.draw_networkx",
"networkx.draw_networkx_nodes",
"numpy.array",
"numpy.dot",
"networkx.draw_networkx_labels",
"networkx.get_... | [((446, 465), 'numpy.cross', 'np.cross', (['norm_y', 'd'], {}), '(norm_y, d)\n', (454, 465), True, 'import numpy as np\n'), ((253, 278), 'numpy.linalg.norm', 'np.linalg.norm', (['direction'], {}), '(direction)\n', (267, 278), True, 'import numpy as np\n'), ((288, 307), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '(... |
import numpy as np
from scipy import ndimage
'''
See paper: Sensors 2018, 18(4), 1055; https://doi.org/10.3390/s18041055
"Divide and Conquer-Based 1D CNN Human Activity Recognition Using Test Data Sharpening"
by <NAME> & <NAME>
This code loads and sharpens UCI HAR Dataset data.
UCI HAR Dataset data can be download... | [
"numpy.array",
"numpy.empty",
"scipy.ndimage.gaussian_filter"
] | [((1051, 1067), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (1059, 1067), True, 'import numpy as np\n'), ((1463, 1479), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (1471, 1479), True, 'import numpy as np\n'), ((1581, 1597), 'numpy.empty', 'np.empty', (['(r, c)'], {}), '((r, c))\n', (1589, ... |
import matplotlib.pyplot as plt
import numpy as np
import numpy.random as rng
import scipy.special as scp
import os
import writer
import main
#Same as above, but random
def random_airfoil_eval(n,param,boundary,control,forces_control):
#Random stuff
par={'n':n, 'deg':int(rng.rand(1)*10), 'N1':rng.rand(1), 'N2':rng.r... | [
"writer.write_blockMeshDict",
"numpy.flip",
"numpy.multiply",
"numpy.sqrt",
"numpy.random.rand",
"main.airfoil_data",
"writer.write_controlDict",
"writer.write_forceCoeffs",
"os.scandir",
"writer.write_boundaryCond",
"numpy.linspace",
"numpy.zeros",
"numpy.linalg.norm",
"os.system",
"mai... | [((432, 443), 'numpy.random.rand', 'rng.rand', (['(1)'], {}), '(1)\n', (440, 443), True, 'import numpy.random as rng\n'), ((872, 944), 'main.airfoil_data', 'main.airfoil_data', (['Au', 'Al', 'par', 'param', 'boundary', 'control', 'forces_control'], {}), '(Au, Al, par, param, boundary, control, forces_control)\n', (889,... |
"""
Created on August 06 15:20, 2020
@author: fassial
"""
import os
import timeit
import pyflann
import numpy as np
# local dep
import utils
# file loc params
PREFIX = ".."
# dataset & testdataset
DATASET = os.path.join(PREFIX, "dataset")
PREDATASET = os.path.join(PREFIX, "predataset")
# eval dir
EVAL_DIR = os.path.j... | [
"os.path.exists",
"timeit.default_timer",
"utils.store_data",
"os.path.join",
"numpy.max",
"pyflann.FLANN",
"numpy.zeros",
"numpy.sum",
"os.mkdir",
"utils.remap",
"utils.load_dataset",
"os.remove"
] | [((209, 240), 'os.path.join', 'os.path.join', (['PREFIX', '"""dataset"""'], {}), "(PREFIX, 'dataset')\n", (221, 240), False, 'import os\n'), ((254, 288), 'os.path.join', 'os.path.join', (['PREFIX', '"""predataset"""'], {}), "(PREFIX, 'predataset')\n", (266, 288), False, 'import os\n'), ((311, 336), 'os.path.join', 'os.... |
import os
import glob
import json
import argparse
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('--env', type=str, required=True)
parser.add_argument('--hash-bc', type=str, required=True)
parser.add_argument('--hash-dagger', type=str, re... | [
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"os.path.join",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.style.context",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.autoscale",
"matplotlib.pyplot.tight_layout",
"json.load",
"matp... | [((133, 158), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (156, 158), False, 'import argparse\n'), ((1714, 1728), 'numpy.array', 'np.array', (['y_bc'], {}), '(y_bc)\n', (1722, 1728), True, 'import numpy as np\n'), ((1740, 1758), 'numpy.array', 'np.array', (['y_dagger'], {}), '(y_dagger)\n', ... |
import tensorflow as tf
from keras.models import Sequential,load_model,model_from_json
from keras.layers import Dense, Dropout,Activation,MaxPooling2D,Conv2D,Flatten
from keras.applications.imagenet_utils import preprocess_input, decode_predictions
from keras.preprocessing.image import load_img
from keras.preprocessing... | [
"flask.render_template",
"numpy.array",
"flask.request.form.get",
"flask.Flask"
] | [((628, 643), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (633, 643), False, 'from flask import Flask, redirect, url_for, request, render_template\n'), ((958, 992), 'flask.render_template', 'render_template', (['"""prediction.html"""'], {}), "('prediction.html')\n", (973, 992), False, 'from flask import... |
import numpy as np
import warnings
warnings.filterwarnings("ignore")
def knee_pt(y, x=None):
x_was_none = False
use_absolute_dev_p = True
res_x = np.nan
idx_of_result = np.nan
if type(y) is not np.ndarray:
print('knee_pt: y must be a numpy 1D vector')
return res_x, idx_of_result
... | [
"numpy.abs",
"numpy.multiply",
"numpy.nanargmin",
"numpy.full",
"numpy.size",
"numpy.sort",
"numpy.diff",
"numpy.argsort",
"numpy.min",
"numpy.argmin",
"numpy.cumsum",
"numpy.amax",
"warnings.filterwarnings"
] | [((36, 69), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (59, 69), False, 'import warnings\n'), ((458, 468), 'numpy.size', 'np.size', (['y'], {}), '(y)\n', (465, 468), True, 'import numpy as np\n'), ((1314, 1334), 'numpy.cumsum', 'np.cumsum', (['x'], {'axis': '(0)'}), '(... |
#########################################################################
# Dicomifier - Copyright (C) Universite de Strasbourg
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for... | [
"numpy.isclose",
"numpy.cross",
"odil.Tag",
"pickle.dumps",
"re.match",
"numpy.subtract",
"numpy.argsort",
"numpy.linalg.norm",
"numpy.shape"
] | [((21251, 21269), 'odil.Tag', 'odil.Tag', (['group', '(0)'], {}), '(group, 0)\n', (21259, 21269), False, 'import odil\n'), ((8609, 8634), 'numpy.cross', 'numpy.cross', (['*orientation'], {}), '(*orientation)\n', (8620, 8634), False, 'import numpy\n'), ((15293, 15380), 're.match', 're.match', (["b'^b=([\\\\d.]+)\\\\((-?... |
import numpy as np
from math import factorial
def main():
x = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
y = np.array([1, 2, 3, 4])
z = np.convolve(x, y, mode="valid")
print(z)
z = np.convolve(x, y, mode="full")
print(z)
x = np.arange(0, 20, 1) ** 2
smoothed = savitzky_golay(x, 4, 3... | [
"numpy.abs",
"numpy.convolve",
"numpy.linalg.pinv",
"math.factorial",
"numpy.array",
"numpy.concatenate",
"numpy.arange"
] | [((68, 109), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]'], {}), '([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])\n', (76, 109), True, 'import numpy as np\n'), ((118, 140), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (126, 140), True, 'import numpy as np\n'), ((150, 181), 'numpy.convolve'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 10 11:15:49 2018
# Congo basin tree fraction using 2018 dataset with gain
@author: earjba
"""
import numpy as np
import importlib
import iris
import iris.quickplot as qplt
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
fro... | [
"matplotlib.pyplot.imshow",
"gdal.Open",
"numpy.hstack",
"mpl_toolkits.basemap.interp",
"iris.save",
"numpy.where",
"matplotlib.pyplot.colorbar",
"numpy.nanmean",
"numpy.zeros",
"jpros.harmonised.write_netcdf",
"numpy.empty",
"iris.load_cube",
"importlib.reload",
"numpy.concatenate",
"nu... | [((445, 472), 'importlib.reload', 'importlib.reload', (['readfiles'], {}), '(readfiles)\n', (461, 472), False, 'import importlib\n'), ((473, 501), 'importlib.reload', 'importlib.reload', (['harmonised'], {}), '(harmonised)\n', (489, 501), False, 'import importlib\n'), ((7309, 7325), 'matplotlib.pyplot.imshow', 'plt.ims... |
#<NAME>
#30/11/21
#Some basic college coding - NDVI, Advanced list manipulations & plotting
########################
#Imports & Inits
########################
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
import seaborn as sns
from sklearn.linear_model imp... | [
"scipy.stats.linregress",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"pandas.ExcelFile",
"pandas.read_excel",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((524, 547), 'pandas.read_excel', 'pd.read_excel', (['location'], {}), '(location)\n', (537, 547), True, 'import pandas as pd\n'), ((557, 669), 'pandas.ExcelFile', 'pd.ExcelFile', (['"""C:\\\\Data\\\\Remote_Sensing\\\\CourseData\\\\Remotesensing(1)\\\\Achterhoek_FieldSpec_2008.xlsx"""'], {}), "(\n 'C:\\\\Data\\\\Re... |
import os, pprint
import numpy as np
import joblib
from utils.BaseModel import BaseModel
from utils.AwesomeTimeIt import timeit
from utils.RegressionReport import evaluate_regression
from utils.FeatureImportanceReport import report_feature_importance
from sklearn.model_selection import RandomizedSearchCV
from sklearn... | [
"sklearn.model_selection.GridSearchCV",
"pprint.pformat",
"xgboost.XGBRegressor",
"numpy.linspace",
"joblib.load",
"xgboost.DMatrix",
"joblib.dump",
"sklearn.model_selection.RandomizedSearchCV"
] | [((2116, 2166), 'xgboost.DMatrix', 'xgb.DMatrix', ([], {'data': 'self.X_train', 'label': 'self.Y_train'}), '(data=self.X_train, label=self.Y_train)\n', (2127, 2166), True, 'import xgboost as xgb\n'), ((2192, 2397), 'xgboost.XGBRegressor', 'xgb.XGBRegressor', ([], {'max_depth': 'self.max_depth', 'learning_rate': 'self.l... |
import os
import json
import numpy as np
from SoccerNet.Downloader import getListGames
from config.classes import EVENT_DICTIONARY_V2, INVERSE_EVENT_DICTIONARY_V2
def predictions2json(predictions_half_1, output_path, framerate=2):
os.makedirs(output_path, exist_ok=True)
output_file_path = output_path + "/Pred... | [
"numpy.where",
"json.dump",
"os.makedirs"
] | [((237, 276), 'os.makedirs', 'os.makedirs', (['output_path'], {'exist_ok': '(True)'}), '(output_path, exist_ok=True)\n', (248, 276), False, 'import os\n'), ((372, 405), 'numpy.where', 'np.where', (['(predictions_half_1 >= 0)'], {}), '(predictions_half_1 >= 0)\n', (380, 405), True, 'import numpy as np\n'), ((1203, 1246)... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import io
import warnings
from sklearn.model_selection import cross_validate
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score, precision_... | [
"sklearn.metrics.classification_report",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.model_selection.KFold",
"matplotlib.lines.Line2D",
"numpy.mean",
"seaborn.color_palette",
"pandas.DataFrame",
"warnings.simplefilter",
"io.StringIO",
"numpy.abs",
"sklearn.model... | [((4194, 4211), 'pandas.get_dummies', 'pd.get_dummies', (['X'], {}), '(X)\n', (4208, 4211), True, 'import pandas as pd\n'), ((5547, 5632), 'pandas.DataFrame', 'pd.DataFrame', (['entries'], {'columns': "['model_name', 'fold_idx', 'accuracy', use_metric]"}), "(entries, columns=['model_name', 'fold_idx', 'accuracy',\n ... |
#!/usr/bin/env python
# encoding: utf-8
'''
@project : MSRGCN
@file : draw_pictures.py
@author : Droliven
@contact : <EMAIL>
@ide : PyCharm
@time : 2021-07-27 21:22
'''
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import se... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.random.randn",
"matplotlib.pyplot.... | [((217, 238), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (231, 238), False, 'import matplotlib\n'), ((670, 682), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (680, 682), True, 'import matplotlib.pyplot as plt\n'), ((692, 725), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111... |
import math
import numpy as np
import torch
from torch import nn
import copy
import random
import concurrent.futures
## Distributions
def generate_gaussian_parity(n, cov_scale=1, angle_params=None, k=1, acorn=None):
""" Generate Gaussian XOR, a mixture of four Gaussians elonging to two classes.
Class 0 cons... | [
"numpy.copy",
"torch.nn.ReLU",
"numpy.ones",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"numpy.sin",
"torch.nn.BatchNorm1d",
"numpy.matmul",
"numpy.cos",
"numpy.concatenate",
"torch.nn.Linear",
"torch.nn.BCEWithLogitsLoss",
"numpy.zeros_like",
"torch.FloatTensor",
"numpy.random.permut... | [((1050, 1069), 'numpy.zeros_like', 'np.zeros_like', (['blob'], {}), '(blob)\n', (1063, 1069), True, 'import numpy as np\n'), ((4746, 4774), 'torch.nn.BCEWithLogitsLoss', 'torch.nn.BCEWithLogitsLoss', ([], {}), '()\n', (4772, 4774), False, 'import torch\n'), ((7182, 7209), 'numpy.random.permutation', 'np.random.permuta... |
import numpy as np
import pandas as pd
import sys
import csv
def check_overlap(interval, array):
height = array.shape[0]
intervals = np.stack([np.tile(interval,(height,1)), array],axis=0)
swaghook = (intervals[0,:,0] < intervals[1,:,0]).astype(int)
return intervals[1-swaghook,np.arange(height),1] > i... | [
"numpy.tile",
"pandas.read_table",
"numpy.arange"
] | [((367, 406), 'pandas.read_table', 'pd.read_table', (['sys.argv[1]'], {'header': 'None'}), '(sys.argv[1], header=None)\n', (380, 406), True, 'import pandas as pd\n'), ((154, 184), 'numpy.tile', 'np.tile', (['interval', '(height, 1)'], {}), '(interval, (height, 1))\n', (161, 184), True, 'import numpy as np\n'), ((296, 3... |
from graph import get_goodreads_graph, get_sc_graph
import json
import numpy as np
import math
import os
# don't let matplotlib use xwindows
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.pylab import savefig
import seaborn as sns
sns.set_style("ticks")
import pandas as pd
out... | [
"os.path.exists",
"os.makedirs",
"seaborn.despine",
"matplotlib.use",
"matplotlib.pyplot.legend",
"graph.get_goodreads_graph",
"numpy.log",
"seaborn.set_style",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"json.load",
"seaborn.scatterplot",
"pandas.DataFrame",
"matplotlib.lines.... | [((160, 181), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (174, 181), False, 'import matplotlib\n'), ((273, 295), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {}), "('ticks')\n", (286, 295), True, 'import seaborn as sns\n'), ((360, 397), 'os.path.exists', 'os.path.exists', (['output... |
# -*- coding: utf-8 -*-
"""
This module contains a method for flagging consecutive data values where the
recorded value repeats multiple times.
================================================================================
@Author:
| <NAME>, NSSC Contractor (ORAU)
| U.S. EPA / ORD / CEMM / AMCD / SFSB
Created:... | [
"pandas.DataFrame",
"numpy.arange"
] | [((2216, 2230), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2228, 2230), True, 'import pandas as pd\n'), ((2244, 2285), 'numpy.arange', 'np.arange', (['(1)', '(tolerance + 1)', '(1)'], {'dtype': 'int'}), '(1, tolerance + 1, 1, dtype=int)\n', (2253, 2285), True, 'import numpy as np\n')] |
import math
from os import path
import logging
from tqdm import tqdm
import numpy as np
import torch
import torch.nn as nn
from torch.functional import F
from transformers import BertTokenizer
from h02_bert_embeddings.bert import BertProcessor
from utils import constants
from utils import utils
class BertEmbeddingsG... | [
"tqdm.tqdm.write",
"tqdm.tqdm",
"os.path.join",
"h02_bert_embeddings.bert.BertProcessor",
"utils.utils.get_n_lines",
"utils.utils.write_pickle",
"torch.no_grad",
"numpy.matrix",
"logging.info",
"utils.utils.get_filenames"
] | [((743, 791), 'logging.info', 'logging.info', (['"""Loading pre-trained BERT network"""'], {}), "('Loading pre-trained BERT network')\n", (755, 791), False, 'import logging\n'), ((807, 854), 'h02_bert_embeddings.bert.BertProcessor', 'BertProcessor', (['bert_option'], {'tgt_words': 'tgt_words'}), '(bert_option, tgt_word... |
# 1. Only add your code inside the function (including newly improted packages).
# You can design a new function and call the new function in the given functions.
# 2. For bonus: Give your own picturs. If you have N pictures, name your pictures such as ["t3_1.png", "t3_2.png", ..., "t3_N.png"], and put them inside t... | [
"cv2.imwrite",
"cv2.imread",
"numpy.sqrt",
"cv2.findHomography",
"cv2.imshow",
"numpy.argsort",
"numpy.array",
"cv2.SIFT_create",
"cv2.equalizeHist",
"numpy.sum",
"numpy.concatenate",
"cv2.cvtColor",
"cv2.perspectiveTransform",
"cv2.waitKey",
"numpy.float32",
"matplotlib.pyplot.show"
] | [((947, 990), 'cv2.perspectiveTransform', 'cv2.perspectiveTransform', (['img2_dims_temp', 'M'], {}), '(img2_dims_temp, M)\n', (971, 990), False, 'import cv2\n'), ((1037, 1083), 'numpy.concatenate', 'np.concatenate', (['(img1_dims, img2_dims)'], {'axis': '(0)'}), '((img1_dims, img2_dims), axis=0)\n', (1051, 1083), True,... |
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license
(https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import os
import numpy as np
from PIL import Image
import torch
import torch.backends.cudnn as cudnn
from torchvision import transfor... | [
"numpy.uint8",
"os.listdir",
"nntools.maybe_cuda.mbcuda",
"PIL.Image.open",
"argparse.ArgumentParser",
"os.path.join",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torch.no_grad",
"torchvision.transforms.ToTensor",
"numpy.transpose",
"torchvision.transforms.Compose"
] | [((460, 485), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (483, 485), False, 'import argparse\n'), ((1278, 1293), 'nntools.maybe_cuda.mbcuda', 'mbcuda', (['trainer'], {}), '(trainer)\n', (1284, 1293), False, 'from nntools.maybe_cuda import mbcuda\n'), ((1539, 1573), 'torchvision.transforms.C... |
import random
import numpy
import simpy
from file_manager import SharedFile
def new_inter_session_time():
"""
Ritorna un valore per l'istanza di "inter-session time"
"""
return numpy.random.lognormal(mean=7.971, sigma=1.308)
def new_session_duration():
"""
Ritorna un valore per l'istanza di ... | [
"random.choice",
"simpy.events.AllOf",
"file_manager.SharedFile.from_cloud",
"random.random",
"simpy.Container",
"numpy.random.lognormal"
] | [((195, 242), 'numpy.random.lognormal', 'numpy.random.lognormal', ([], {'mean': '(7.971)', 'sigma': '(1.308)'}), '(mean=7.971, sigma=1.308)\n', (217, 242), False, 'import numpy\n'), ((354, 401), 'numpy.random.lognormal', 'numpy.random.lognormal', ([], {'mean': '(8.492)', 'sigma': '(1.545)'}), '(mean=8.492, sigma=1.545)... |
#!/usr/bin/env python #
# #
# Autor: <NAME>, GSFC/CRESST/UMBC . #
# #
# T... | [
"numpy.log10",
"numpy.sqrt",
"re.compile",
"matplotlib.pyplot.ylabel",
"scipy.special.factorial",
"numpy.log",
"numpy.array",
"re.search",
"os.path.exists",
"numpy.where",
"matplotlib.pyplot.xlabel",
"itertools.product",
"Xgam.utils.spline_.xInterpolatedUnivariateSplineLinear",
"matplotlib... | [((1202, 1226), 're.compile', 're.compile', (['"""\\\\_\\\\d+\\\\."""'], {}), "('\\\\_\\\\d+\\\\.')\n", (1212, 1226), False, 'import re\n'), ((2036, 2053), 'numpy.array', 'np.array', (['fore_en'], {}), '(fore_en)\n', (2044, 2053), True, 'import numpy as np\n'), ((2198, 2222), 'os.path.exists', 'os.path.exists', (['out_... |
import numpy as np
def minmax(it):
min = max = None
for val in it:
if min is None or val < min:
min = val
if max is None or val > max:
max = val
return min, max
def NGaussFunc(x, *params): # x0 pk width
y = np.zeros_like(x)
for i in range(0, len(params) -... | [
"numpy.exp",
"numpy.zeros_like"
] | [((268, 284), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (281, 284), True, 'import numpy as np\n'), ((430, 461), 'numpy.exp', 'np.exp', (['(-((x - ctr) / wid) ** 2)'], {}), '(-((x - ctr) / wid) ** 2)\n', (436, 461), True, 'import numpy as np\n')] |
# -*- coding:utf-8 -*-
# =========================================================================== #
# Project : MLStudio #
# File : \test_optimizers copy.py #
# Python : 3.8.3 ... | [
"numpy.allclose",
"pathlib.Path",
"mlstudio.supervised.algorithms.optimization.services.optimizers.Nesterov",
"os.path.join",
"mlstudio.supervised.algorithms.optimization.services.optimizers.Adagrad",
"mlstudio.supervised.algorithms.optimization.services.optimizers.Momentum",
"sys.path.append"
] | [((1738, 1779), 'os.path.join', 'os.path.join', (['homedir', '"""tests\\\\test_data"""'], {}), "(homedir, 'tests\\\\test_data')\n", (1750, 1779), False, 'import os\n'), ((1780, 1804), 'sys.path.append', 'sys.path.append', (['homedir'], {}), '(homedir)\n', (1795, 1804), False, 'import sys\n'), ((1805, 1829), 'sys.path.a... |
#
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
import os
import sys
import csv
import ast
import logging
import pickle
import numpy as np
import pa... | [
"logging.getLogger",
"logging.StreamHandler",
"pickle.dump",
"numpy.asarray",
"ts_datasets.anomaly.smd.download",
"pickle.load",
"os.path.join",
"ast.literal_eval",
"os.path.abspath",
"numpy.zeros",
"pandas.DataFrame",
"csv.reader"
] | [((469, 496), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (486, 496), False, 'import logging\n'), ((540, 573), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (561, 573), False, 'import logging\n'), ((2680, 2698), 'numpy.asarray', 'np.asarray',... |
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import glob
import matplotlib.pyplot as plt
from PIL import Image
class customDataset(Dataset):
def __init__(self, data, targets, transform=None):
self.data = data
self.targets = torch.Tensor(targets)
self.tran... | [
"torch.Tensor",
"numpy.array",
"torch.utils.data.DataLoader",
"numpy.load",
"glob.glob"
] | [((749, 773), 'numpy.array', 'np.array', (["data['images']"], {}), "(data['images'])\n", (757, 773), True, 'import numpy as np\n'), ((787, 811), 'numpy.array', 'np.array', (["data['labels']"], {}), "(data['labels'])\n", (795, 811), True, 'import numpy as np\n'), ((873, 923), 'glob.glob', 'glob.glob', (['"""../../../dat... |
import unittest
import parameterized
import numpy as np
from rlutil.envs.tabular_cy import q_iteration, tabular_env
from rlutil.envs.tabular import q_iteration as q_iteration_py
class QIterationTest(unittest.TestCase):
def setUp(self):
self.env = tabular_env.CliffwalkEnv(num_states=3, transition_noise=0.01)
... | [
"numpy.allclose",
"rlutil.envs.tabular_cy.q_iteration.softq_iteration",
"rlutil.envs.tabular_cy.tabular_env.CliffwalkEnv",
"rlutil.envs.tabular_cy.q_iteration.softq_evaluation",
"numpy.sum",
"numpy.zeros",
"rlutil.envs.tabular.q_iteration.softq_iteration",
"rlutil.envs.tabular.q_iteration.compute_visi... | [((2468, 2483), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2481, 2483), False, 'import unittest\n'), ((256, 317), 'rlutil.envs.tabular_cy.tabular_env.CliffwalkEnv', 'tabular_env.CliffwalkEnv', ([], {'num_states': '(3)', 'transition_noise': '(0.01)'}), '(num_states=3, transition_noise=0.01)\n', (280, 317), Fal... |
# -*- coding: UTF-8 -*-
import numpy as np
import pandas as pd
import itertools
import csv
import gensim
import re
import nltk.data
import tensorflow
from nltk.tokenize import WordPunctTokenizer
from collections import Counter
from keras.models import Sequential, Graph
from keras.layers.core import Dense, Dropout, Acti... | [
"itertools.chain",
"keras.layers.core.Flatten",
"keras.layers.Merge",
"keras.layers.core.Activation",
"pandas.read_csv",
"keras.models.Graph",
"nltk.tokenize.WordPunctTokenizer",
"gensim.models.Word2Vec.load",
"keras.models.Sequential",
"keras.utils.visualize_util.to_graph",
"numpy.array",
"ke... | [((6080, 6097), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (6094, 6097), True, 'import numpy as np\n'), ((7765, 7772), 'keras.models.Graph', 'Graph', ([], {}), '()\n', (7770, 7772), False, 'from keras.models import Sequential, Graph\n'), ((8664, 8676), 'keras.models.Sequential', 'Sequential', ([], {... |
import os
import torch
import numpy as np
from mpi_utils.mpi_utils import sync_networks
from rl_modules.buffer import ReplayBuffer
from networks import LanguageCritic, LanguageActor
from mpi_utils.normalizer import Normalizer
from her_modules.her import HerSampler
from updates import update_language
from utils import h... | [
"numpy.clip",
"rl_modules.buffer.ReplayBuffer",
"utils.available_device",
"os.path.islink",
"utils.soft_update",
"os.readlink",
"mpi_utils.mpi_utils.sync_networks",
"numpy.asarray",
"networks.LanguageCritic",
"utils.hard_update",
"networks.LanguageActor",
"torch.Tensor",
"her_modules.her.Her... | [((2412, 2427), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2425, 2427), False, 'import torch\n'), ((702, 732), 'networks.LanguageActor', 'LanguageActor', (['cfg', 'env_params'], {}), '(cfg, env_params)\n', (715, 732), False, 'from networks import LanguageCritic, LanguageActor\n'), ((763, 794), 'networks.Langu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.