code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Reference: [1]: Branlard, Flexible multibody dynamics using joint coordinates and the Rayleigh-Ritz approximation: the general framework behind and beyond Flex, Wind Energy, 2019 """ import numpy as np from .utils import * from .bodies import Body as GenericBody from .bodies import RigidBody as Gen...
[ "numpy.eye", "numpy.ones", "numpy.asarray", "numpy.array", "numpy.dot", "numpy.zeros", "numpy.linspace", "numpy.cos", "numpy.sin", "welib.beams.theory.UniformBeamBendingModes", "numpy.transpose", "numpy.arange" ]
[((661, 674), 'numpy.asarray', 'np.asarray', (['m'], {}), '(m)\n', (671, 674), True, 'import numpy as np\n'), ((730, 764), 'numpy.array', 'np.array', (['[[v[0]], [v[1]], [v[2]]]'], {}), '([[v[0]], [v[1]], [v[2]]])\n', (738, 764), True, 'import numpy as np\n'), ((20332, 20350), 'numpy.zeros', 'np.zeros', (['Bp.shape'], ...
import unittest import numpy as np from sklearn import exceptions # from sklearn.datasets import load_boston as load from skcosmo.datasets import load_csd_1000r as load from skcosmo.feature_selection import CUR class TestCUR(unittest.TestCase): def setUp(self): self.X, _ = load(return_X_y=True) def...
[ "numpy.linalg.eigh", "numpy.allclose", "numpy.argsort", "skcosmo.datasets.load_csd_1000r", "unittest.main", "skcosmo.feature_selection.CUR" ]
[((1455, 1481), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1468, 1481), False, 'import unittest\n'), ((290, 311), 'skcosmo.datasets.load_csd_1000r', 'load', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (294, 311), True, 'from skcosmo.datasets import load_csd_1000r as loa...
import warnings import numpy as np from sklearn.covariance import oas, ledoit_wolf, fast_mcd, empirical_covariance from .test import is_square # Mapping different estimator on the sklearn toolbox def _lwf(X): """Wrapper for sklearn ledoit wolf covariance estimator""" C, _ = ledoit_wolf(X.T) return C ...
[ "numpy.hanning", "numpy.trace", "numpy.array", "numpy.linalg.norm", "numpy.arange", "sklearn.covariance.fast_mcd", "numpy.fft.rfft", "numpy.empty", "numpy.concatenate", "warnings.warn", "numpy.abs", "numpy.eye", "numpy.ones", "sklearn.covariance.oas", "numpy.fill_diagonal", "numpy.lib....
[((288, 304), 'sklearn.covariance.ledoit_wolf', 'ledoit_wolf', (['X.T'], {}), '(X.T)\n', (299, 304), False, 'from sklearn.covariance import oas, ledoit_wolf, fast_mcd, empirical_covariance\n'), ((399, 407), 'sklearn.covariance.oas', 'oas', (['X.T'], {}), '(X.T)\n', (402, 407), False, 'from sklearn.covariance import oas...
from random import randint import numpy as np n = [ 500 ] m = [ n[i] * n[i + 1] for i in range(len(n) - 1) ] k, v1, v2 = 600, 10, 1000 print('%d %d %d 2' % (np.sum(n), np.sum(m), k)) b = 1 for i in range(len(n) - 1): for j in range(0, n[i]): for k in range(0, n[i + 1]): print('%d %d' % (b + j,...
[ "numpy.sum", "random.randint" ]
[((371, 391), 'random.randint', 'randint', (['v1', '(v1 + v2)'], {}), '(v1, v1 + v2)\n', (378, 391), False, 'from random import randint\n'), ((159, 168), 'numpy.sum', 'np.sum', (['n'], {}), '(n)\n', (165, 168), True, 'import numpy as np\n'), ((170, 179), 'numpy.sum', 'np.sum', (['m'], {}), '(m)\n', (176, 179), True, 'i...
#################################################################################################### ## ## Project: Embedded Learning Library (ELL) ## File: demoHelper.py ## Authors: <NAME> ## <NAME> ## ## Requires: Python 3.x ## #####################################################################...
[ "cv2.rectangle", "cv2.imshow", "sys.exc_info", "sys.path.append", "os.listdir", "ell.model.Map", "argparse.ArgumentParser", "ell.neural.utilities.ell_map_from_float_predictor", "os.path.split", "os.path.isdir", "cv2.waitKey", "cv2.putText", "os.path.dirname", "cv2.cvtColor", "cv2.getText...
[((475, 500), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (490, 500), False, 'import os\n'), ((914, 925), 'time.time', 'time.time', ([], {}), '()\n', (923, 925), False, 'import time\n'), ((4155, 4190), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['helpString'], {}), '(helpString...
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import FancyArrowPatch, Arc def get_angle_plot(line1, line2, radius=1, color=None, origin=(0, 0), len_x_axis=1, len_y_axis=1): l1xy = line1.get_xydata() # Angle between line1...
[ "matplotlib.pyplot.text", "matplotlib.pyplot.savefig", "matplotlib.patches.Arc", "matplotlib.use", "matplotlib.pyplot.plot", "matplotlib.patches.FancyArrowPatch", "numpy.diff", "numpy.linspace", "matplotlib.pyplot.Line2D", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((38, 59), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (52, 59), False, 'import matplotlib\n'), ((825, 914), 'matplotlib.patches.Arc', 'Arc', (['origin', '(len_x_axis * radius)', '(len_y_axis * radius)', '(0)', 'theta1', 'theta2'], {'color': 'color'}), '(origin, len_x_axis * radius, len_y_axi...
import unittest import numpy import chainer from chainer import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr @testing.parameterize(*testing.product({ 'use_cudnn': ['always', 'never'], })) class TestSpatialTransformerGrid(unitt...
[ "chainer.testing.run_module", "chainer.functions.SpatialTransformerGrid", "chainer.cuda.to_cpu", "chainer.testing.product", "numpy.linspace", "numpy.array", "numpy.random.uniform", "chainer.functions.spatial_transformer_grid", "chainer.testing.assert_allclose", "chainer.cuda.to_gpu", "chainer.us...
[((2252, 2290), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (2270, 2290), False, 'from chainer import testing\n'), ((824, 842), 'chainer.cuda.to_cpu', 'cuda.to_cpu', (['theta'], {}), '(theta)\n', (835, 842), False, 'from chainer import cuda\n'), ((1267, ...
""" Compute numerical solution for Poisson with background. Produces Fig. 7 from the Feldman & Cousins paper. """ import numpy as np from scipy.stats import poisson import matplotlib.pyplot as plt from gammapy.stats import ( fc_construct_acceptance_intervals_pdfs, fc_fix_limits, fc_get_limits, ) backgroun...
[ "gammapy.stats.fc_fix_limits", "matplotlib.pyplot.grid", "matplotlib.pyplot.plot", "gammapy.stats.fc_get_limits", "matplotlib.pyplot.figure", "scipy.stats.poisson", "matplotlib.pyplot.axis", "gammapy.stats.fc_construct_acceptance_intervals_pdfs", "numpy.arange", "matplotlib.pyplot.show" ]
[((409, 431), 'numpy.arange', 'np.arange', (['(0)', 'n_bins_x'], {}), '(0, n_bins_x)\n', (418, 431), True, 'import numpy as np\n'), ((609, 659), 'gammapy.stats.fc_construct_acceptance_intervals_pdfs', 'fc_construct_acceptance_intervals_pdfs', (['matrix', 'cl'], {}), '(matrix, cl)\n', (647, 659), False, 'from gammapy.st...
import os import argparse import pandas as pd import numpy as np import sys import json DEFAULT_PROJECT_REPO = os.path.sep.join(__file__.split(os.path.sep)[:-2]) PROJECT_REPO_DIR = os.path.abspath( os.environ.get('PROJECT_REPO_DIR', DEFAULT_PROJECT_REPO)) sys.path.append(os.path.join(PROJECT_REPO_DIR, 'src')) from...
[ "argparse.ArgumentParser", "feature_transformation.parse_id_cols", "pandas.merge", "os.path.join", "os.environ.get", "numpy.concatenate", "feature_transformation.parse_feature_cols", "json.load", "feature_transformation.parse_time_col", "json.dump" ]
[((202, 258), 'os.environ.get', 'os.environ.get', (['"""PROJECT_REPO_DIR"""', 'DEFAULT_PROJECT_REPO'], {}), "('PROJECT_REPO_DIR', DEFAULT_PROJECT_REPO)\n", (216, 258), False, 'import os\n'), ((277, 314), 'os.path.join', 'os.path.join', (['PROJECT_REPO_DIR', '"""src"""'], {}), "(PROJECT_REPO_DIR, 'src')\n", (289, 314), ...
#!/usr/bin/python # export PYTHONPATH=/home/lukas/anaconda3/envs/detectron/bin/python # import some common libraries from genericpath import isdir import numpy as np import os import json import cv2 import time import csv import detectron2 from detectron2 import model_zoo from detectron2.engine import DefaultPredicto...
[ "numpy.mean", "os.listdir", "detectron2.config.get_cfg", "csv.writer", "os.path.join", "time.perf_counter", "cv2.rotate", "numpy.array", "detectron2.model_zoo.get_checkpoint_url", "os.path.isdir", "detectron2.model_zoo.get_config_file", "detectron2.data.MetadataCatalog.get", "numpy.std", "...
[((2523, 2532), 'detectron2.config.get_cfg', 'get_cfg', ([], {}), '()\n', (2530, 2532), False, 'from detectron2.config import get_cfg\n'), ((2622, 2664), 'detectron2.model_zoo.get_checkpoint_url', 'model_zoo.get_checkpoint_url', (['params.model'], {}), '(params.model)\n', (2650, 2664), False, 'from detectron2 import mo...
import plotly.figure_factory as FF import numpy as np from scipy.spatial import Delaunay class СharacteristicQuadrilateral: def __init__(self, a): self.x0 = (a[0] - a[2])*1j self.y0 = a[0] + a[2] self.z0 = -a[1]*1j self.x1 = (a[0]-a[2]-a[3])*1j self.y1 = a[0]+a[2]+a[3] ...
[ "plotly.figure_factory.create_trisurf", "numpy.linspace", "numpy.vstack", "scipy.spatial.Delaunay", "numpy.meshgrid" ]
[((703, 721), 'scipy.spatial.Delaunay', 'Delaunay', (['points2D'], {}), '(points2D)\n', (711, 721), False, 'from scipy.spatial import Delaunay\n'), ((771, 924), 'plotly.figure_factory.create_trisurf', 'FF.create_trisurf', ([], {'x': 'x', 'y': 'y', 'z': 'z', 'colormap': "['rgb(50, 0, 75)', 'rgb(200, 0, 200)', '#c8dcc8']...
import sys, os, glob import argparse import time import random from copy import copy, deepcopy from termcolor import colored, cprint import numpy as np from sklearn.metrics import precision_recall_fscore_support from sklearn.metrics import roc_auc_score from sklearn.metrics import precision_recall_curve import torch ...
[ "torch.nn.ReLU", "models.cnn.CNNMatchModel", "msda_src.model_utils.get_critic_class", "dataset.OAGDomainDataset", "torch.log_softmax", "torch.max", "torch.nn.init.xavier_normal", "sklearn.metrics.roc_auc_score", "torch.softmax", "torch.nn.MSELoss", "numpy.array", "msda_src.utils.op.softmax", ...
[((521, 543), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (536, 543), False, 'import sys, os, glob\n'), ((1064, 1097), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1087, 1097), False, 'import warnings\n'), ((1111, 1198), 'argparse.ArgumentPar...
import unittest import numpy as np from .softlearning_env_test import AdapterTestClass from softlearning.environments.adapters.robosuite_adapter import ( RobosuiteAdapter) class TestRobosuiteAdapter(unittest.TestCase, AdapterTestClass): # TODO(hartikainen): This is a terrible way of testing the envs. # ...
[ "unittest.main", "numpy.ones", "softlearning.environments.adapters.robosuite_adapter.RobosuiteAdapter" ]
[((4622, 4637), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4635, 4637), False, 'import unittest\n'), ((458, 581), 'softlearning.environments.adapters.robosuite_adapter.RobosuiteAdapter', 'RobosuiteAdapter', (['domain', 'task', '*args'], {'has_renderer': '(False)', 'has_offscreen_renderer': '(False)', 'use_cam...
import Bio.PDB.Superimposer from Bio.PDB.Atom import Atom as BioPDBAtom import numpy as np import warnings from Bio.PDB.Atom import PDBConstructionWarning from classes.PDB import PDB from classes.Atom import Atom warnings.simplefilter('ignore', PDBConstructionWarning) def biopdb_aligned_chain(pdb_fixed, chain_id_fixe...
[ "Bio.PDB.Atom.Atom", "numpy.matmul", "warnings.simplefilter", "numpy.transpose", "classes.PDB.PDB" ]
[((213, 268), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'PDBConstructionWarning'], {}), "('ignore', PDBConstructionWarning)\n", (234, 268), False, 'import warnings\n'), ((1482, 1515), 'numpy.matmul', 'np.matmul', (['pdb_moving_coords', 'rot'], {}), '(pdb_moving_coords, rot)\n', (1491, 1515), T...
from typing import Any import numpy as np from xgboost import XGBClassifier from bender.model_trainer.interface import ModelTrainer from bender.split_strategy.split_strategy import TrainingDataSet from bender.trained_model.interface import TrainedModel from bender.trained_model.xgboosted_tree import TrainedXGBoostMod...
[ "bender.trained_model.xgboosted_tree.TrainedXGBoostModel", "numpy.round", "xgboost.XGBClassifier" ]
[((1720, 1756), 'xgboost.XGBClassifier', 'XGBClassifier', ([], {}), '(**self.xgboost_parmas)\n', (1733, 1756), False, 'from xgboost import XGBClassifier\n'), ((2163, 2212), 'bender.trained_model.xgboosted_tree.TrainedXGBoostModel', 'TrainedXGBoostModel', (['model', 'data_split.x_features'], {}), '(model, data_split.x_f...
# -*- coding: utf-8 -*- """ Defines unit tests for :mod:`colour.colorimetry.lightness` module. """ import numpy as np import unittest from colour.colorimetry import (lightness_Glasser1958, lightness_Wyszecki1963, intermediate_lightness_function_CIE1976, ...
[ "numpy.tile", "numpy.reshape", "colour.colorimetry.lightness_CIE1976", "colour.colorimetry.lightness_Glasser1958", "colour.utilities.domain_range_scale", "colour.colorimetry.lightness_Fairchild2011", "colour.colorimetry.lightness_Wyszecki1963", "numpy.array", "colour.colorimetry.lightness.lightness"...
[((17391, 17406), 'unittest.main', 'unittest.main', ([], {}), '()\n', (17404, 17406), False, 'import unittest\n'), ((1935, 1959), 'colour.colorimetry.lightness_Glasser1958', 'lightness_Glasser1958', (['Y'], {}), '(Y)\n', (1956, 1959), False, 'from colour.colorimetry import lightness_Glasser1958, lightness_Wyszecki1963,...
import sys import os # check SBMolGen_PATH setting if os.getenv('SBMolGen_PATH') == None: print("THe SBMolGen_PATH has not defined, please set it before use it!") exit(0) else: SBMolGen_PATH=os.getenv('SBMolGen_PATH') sys.path.append(SBMolGen_PATH+'/utils') from subprocess import Popen, PIPE from math i...
[ "add_node_type_zinc.node_to_add", "random.choice", "numpy.amax", "add_node_type_zinc.check_node_type", "os.getenv", "load_model.loaded_model", "add_node_type_zinc.chem_kn_simulation", "add_node_type_zinc.predict_smile", "yaml.load", "make_smile.zinc_data_with_bracket_original", "add_node_type_zi...
[((54, 80), 'os.getenv', 'os.getenv', (['"""SBMolGen_PATH"""'], {}), "('SBMolGen_PATH')\n", (63, 80), False, 'import os\n'), ((203, 229), 'os.getenv', 'os.getenv', (['"""SBMolGen_PATH"""'], {}), "('SBMolGen_PATH')\n", (212, 229), False, 'import os\n'), ((234, 275), 'sys.path.append', 'sys.path.append', (["(SBMolGen_PAT...
import sys import numpy as np from matplotlib import pyplot from matplotlib.animation import FuncAnimation import matplotlib as mpl sys.path.append('..') from submission import SubmissionBase def displayData(X, example_width=None, figsize=(10, 10)): """ Displays 2D data in a nice grid. Parameters --...
[ "numpy.mean", "numpy.ceil", "matplotlib.pyplot.grid", "numpy.sqrt", "matplotlib.animation.FuncAnimation", "matplotlib.pyplot.gcf", "numpy.diag", "numpy.stack", "matplotlib.pyplot.figure", "matplotlib.colors.Normalize", "numpy.std", "matplotlib.pyplot.scatter", "matplotlib.pyplot.title", "s...
[((133, 154), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (148, 154), False, 'import sys\n'), ((1316, 1376), 'matplotlib.pyplot.subplots', 'pyplot.subplots', (['display_rows', 'display_cols'], {'figsize': 'figsize'}), '(display_rows, display_cols, figsize=figsize)\n', (1331, 1376), False, 'fro...
# Copyright 2019 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "mindspore.ops.operations.SoftmaxCrossEntropyWithLogits", "numpy.ones", "mindspore.ops.operations.MatMul", "mindspore.context.set_context", "mindspore.ops.operations.comm_ops._VirtualDataset", "mindspore.ops.composite.grad_all", "mindspore.ops.operations.Gelu", "mindspore.common.api._executor.compile"...
[((906, 950), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE'}), '(mode=context.GRAPH_MODE)\n', (925, 950), False, 'from mindspore import context\n'), ((2725, 2756), 'mindspore.common.api._executor.compile', '_executor.compile', (['net', 'x', 'y', 'b'], {}), '(net, x, y, b)\n'...
#py3 """ ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example shows characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. With the exce...
[ "sklearn.cluster.SpectralClustering", "numpy.random.rand", "sklearn.neighbors.kneighbors_graph", "sklearn.datasets.make_circles", "sklearn.cluster.MeanShift", "matplotlib.patheffects.withStroke", "sklearn.cluster.DBSCAN", "sklearn.cluster.AgglomerativeClustering", "sklearn.datasets.make_blobs", "r...
[((1303, 1320), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1317, 1320), True, 'import numpy as np\n'), ((1528, 1594), 'sklearn.datasets.make_circles', 'datasets.make_circles', ([], {'n_samples': 'n_samples', 'factor': '(0.5)', 'noise': '(0.05)'}), '(n_samples=n_samples, factor=0.5, noise=0.05)\n', ...
# Copyright 2019 Google 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "numpy.clip", "numpy.array", "collections.namedtuple", "collections.deque" ]
[((699, 796), 'collections.namedtuple', 'namedtuple', (['"""observation"""', "['time', 'qpos_robot', 'qvel_robot', 'qpos_object', 'qvel_object']"], {}), "('observation', ['time', 'qpos_robot', 'qvel_robot',\n 'qpos_object', 'qvel_object'])\n", (709, 796), False, 'from collections import namedtuple\n'), ((1198, 1246)...
# -*- coding: utf-8 -*- """ Created on Fri Apr 22 02:51:53 2016 @author: utkarsh """ # FREQEST - Estimate fingerprint ridge frequency within image block # # Function to estimate the fingerprint ridge frequency within a small block # of a fingerprint image. This function is used by RIDGEFREQ # # Usage: # freqim = ...
[ "numpy.abs", "numpy.mean", "numpy.sqrt", "numpy.ones", "numpy.double", "numpy.where", "numpy.fix", "numpy.sum", "numpy.zeros", "numpy.cos", "math.atan2", "numpy.sin", "numpy.shape" ]
[((1590, 1602), 'numpy.shape', 'np.shape', (['im'], {}), '(im)\n', (1598, 1602), True, 'import numpy as np\n'), ((2738, 2759), 'numpy.sum', 'np.sum', (['rotim'], {'axis': '(0)'}), '(rotim, axis=0)\n', (2744, 2759), True, 'import numpy as np\n'), ((2860, 2883), 'numpy.abs', 'np.abs', (['(dilation - proj)'], {}), '(dilat...
import numpy as np import sys import argparse from data_util import Dataset from tqdm import tqdm, trange import matplotlib.pyplot as plt class Error(Exception): pass class MoreNeighbours(Error): pass def nearest_neighbour(train_data, test_data, k=1): # print(k) test_data = test_data[None, :, None] ...
[ "sys.exit", "argparse.ArgumentParser", "numpy.where", "numpy.argmax", "numpy.max", "numpy.argsort", "numpy.random.seed", "numpy.linalg.norm", "numpy.ravel", "numpy.bincount", "tqdm.trange", "numpy.arange", "data_util.Dataset" ]
[((333, 379), 'numpy.linalg.norm', 'np.linalg.norm', (['(train_data - test_data)'], {'axis': '(1)'}), '(train_data - test_data, axis=1)\n', (347, 379), True, 'import numpy as np\n'), ((396, 415), 'numpy.ravel', 'np.ravel', (['norm_l2.T'], {}), '(norm_l2.T)\n', (404, 415), True, 'import numpy as np\n'), ((428, 449), 'nu...
# Author: <NAME> # Contributors: <NAME> import numpy as np import scipy import torch class Geometry(): """Helper class to calculate distances, angles, and dihedrals with a unified, vectorized framework depending on whether pytorch or numpy is used. Parameters ---------- method : 'torch' or '...
[ "numpy.clip", "numpy.arccos", "torch.sum", "numpy.linalg.norm", "numpy.arange", "torch.arange", "numpy.cross", "torch.eye", "torch.acos", "numpy.arctan", "numpy.tile", "numpy.eye", "scipy.spatial.distance.squareform", "numpy.ones", "torch.norm", "numpy.isnan", "torch.atan", "torch....
[((686, 705), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (698, 705), False, 'import torch\n'), ((3751, 3804), 'scipy.spatial.distance.squareform', 'scipy.spatial.distance.squareform', (['pairwise_dist_inds'], {}), '(pairwise_dist_inds)\n', (3784, 3804), False, 'import scipy\n'), ((10447, 10472), ...
import numpy as np import io import matplotlib.pyplot as plt import SurfaceTopography.Uniform.GeometryAnalysis as CAA with io.StringIO( """ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
[ "SurfaceTopography.Uniform.GeometryAnalysis.outer_perimeter_area", "io.StringIO", "numpy.loadtxt", "SurfaceTopography.Uniform.GeometryAnalysis.inner_perimeter_area", "matplotlib.pyplot.subplots" ]
[((960, 974), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (972, 974), True, 'import matplotlib.pyplot as plt\n'), ((1027, 1100), 'SurfaceTopography.Uniform.GeometryAnalysis.inner_perimeter_area', 'CAA.inner_perimeter_area', (['contacting_points', '(True)'], {'stencil': 'CAA.nn_stencil'}), '(contacti...
# Copyright 2019 The TensorFlow 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 applica...
[ "numpy.random.standard_normal", "numpy.abs", "tensorflow.keras.optimizers.deserialize", "tensorflow.random.set_seed", "tensorflow_addons.optimizers.MovingAverage", "tensorflow.Variable", "pytest.mark.with_device", "tensorflow.keras.optimizers.serialize", "tensorflow.keras.initializers.Constant", "...
[((848, 902), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""maybe_run_functions_eagerly"""'], {}), "('maybe_run_functions_eagerly')\n", (871, 902), False, 'import pytest\n'), ((2237, 2291), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""maybe_run_functions_eagerly"""'], {}), "('maybe_run_func...
#!/usr/bin/env python # import random import numpy as np from copy import copy from bart_utils import empty, Tree, logsumexp, softmax, check_if_zero, get_children_id #from itertools import izip, count from itertools import count class Particle(Tree): def __init__(self, train_ids=np.arange(0, dtype='int'), param=...
[ "bart_utils.softmax", "numpy.random.rand", "random.shuffle", "numpy.ones", "bart_utils.get_children_id", "numpy.log", "numpy.random.multinomial", "bart_utils.Tree.__init__", "numpy.array", "numpy.sum", "bart_utils.empty", "numpy.cumsum", "copy.copy", "numpy.arange", "bart_utils.logsumexp...
[((4471, 4491), 'bart_utils.softmax', 'softmax', (['log_weights'], {}), '(log_weights)\n', (4478, 4491), False, 'from bart_utils import empty, Tree, logsumexp, softmax, check_if_zero, get_children_id\n'), ((4594, 4616), 'bart_utils.logsumexp', 'logsumexp', (['log_weights'], {}), '(log_weights)\n', (4603, 4616), False, ...
import logging import math import gym from gym import spaces from gym.utils import seeding import numpy as np import sys import math class ClassifyEnv(gym.Env): def __init__(self, trainSet, target): """ Data set is a tuple of [0] input data: [nSamples x nInputs] [1] labels: [nSamples x 1] ...
[ "cv2.warpAffine", "cv2.resize", "mnist.train_images", "sklearn.datasets.load_digits", "mnist.train_labels", "numpy.array", "numpy.sum", "numpy.empty", "numpy.concatenate", "cv2.moments", "numpy.shape", "numpy.load", "numpy.float32", "gym.utils.seeding.np_random" ]
[((2536, 2558), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([], {}), '()\n', (2556, 2558), False, 'from sklearn import datasets\n'), ((3192, 3230), 'numpy.load', 'np.load', (['"""../mnist_train_features.npy"""'], {}), "('../mnist_train_features.npy')\n", (3199, 3230), True, 'import numpy as np\n'), ((3244,...
import numpy as np from context import variationaloptimization def test_optimization(): knapsack = Knapsack() theta0 = 0.5*np.ones(4) minres = variationaloptimization.minimize_variational(knapsack, theta0, learning_rate=1e-2, ...
[ "numpy.array", "numpy.ones", "context.variationaloptimization.minimize_variational" ]
[((158, 259), 'context.variationaloptimization.minimize_variational', 'variationaloptimization.minimize_variational', (['knapsack', 'theta0'], {'learning_rate': '(0.01)', 'max_iter': '(1000)'}), '(knapsack, theta0,\n learning_rate=0.01, max_iter=1000)\n', (202, 259), False, 'from context import variationaloptimizati...
import numpy as np from vanhateren import VanHateren import vanhateren.preprocess as pp def load_patches(n, shape=(32, 32)): vh = VanHateren(calibrated=True) rng = np.random.RandomState(9) return vh.patches(n, shape, rng=rng) def show_patch(ax, patch): ax.imshow(patch, cmap='gray') ax.set_xtick...
[ "vanhateren.preprocess.contrast_normalize", "vanhateren.VanHateren", "vanhateren.preprocess.scale", "vanhateren.preprocess.zca", "numpy.random.RandomState" ]
[((137, 164), 'vanhateren.VanHateren', 'VanHateren', ([], {'calibrated': '(True)'}), '(calibrated=True)\n', (147, 164), False, 'from vanhateren import VanHateren\n'), ((175, 199), 'numpy.random.RandomState', 'np.random.RandomState', (['(9)'], {}), '(9)\n', (196, 199), True, 'import numpy as np\n'), ((539, 580), 'vanhat...
import json import os import time import numpy as np from metalearn import Metafeatures from tests.config import CORRECTNESS_SEED, METAFEATURES_DIR, METADATA_PATH from .dataset import read_dataset def get_dataset_metafeatures_path(dataset_filename): dataset_name = dataset_filename.rsplit(".", 1)[0] return o...
[ "metalearn.Metafeatures", "numpy.isclose", "json.dumps", "os.path.join", "json.load", "time.time", "json.dump" ]
[((319, 376), 'os.path.join', 'os.path.join', (['METAFEATURES_DIR', "(dataset_name + '_mf.json')"], {}), "(METAFEATURES_DIR, dataset_name + '_mf.json')\n", (331, 376), False, 'import os\n'), ((1079, 1090), 'time.time', 'time.time', ([], {}), '()\n', (1088, 1090), False, 'import time\n'), ((1216, 1227), 'time.time', 'ti...
import numpy as np import cv2 import cv2.aruco as aruco import sys, time, math from copy import deepcopy from threading import Thread, Lock class LocalizationTracker(): def __init__(self, id_to_find, marker_size, src, camera_matrix, ...
[ "math.sqrt", "cv2.imshow", "numpy.array", "cv2.warpPerspective", "cv2.destroyAllWindows", "numpy.linalg.norm", "copy.deepcopy", "cv2.aruco.drawDetectedMarkers", "numpy.where", "threading.Lock", "numpy.dot", "cv2.waitKey", "numpy.identity", "cv2.aruco.getPredefinedDictionary", "cv2.getPer...
[((18966, 19024), 'numpy.loadtxt', 'np.loadtxt', (["(calib_path + 'cameraMatrix.txt')"], {'delimiter': '""","""'}), "(calib_path + 'cameraMatrix.txt', delimiter=',')\n", (18976, 19024), True, 'import numpy as np\n'), ((19045, 19107), 'numpy.loadtxt', 'np.loadtxt', (["(calib_path + 'cameraDistortion.txt')"], {'delimiter...
import os import cv2 import copy import time import json from pprint import pprint import numpy as np import streamlit as st from PIL import ImageColor # import coco_annotation_parser as annot_parse # type:ignore import SessionState #type:ignore import circulation_skeletonizer as circ_skeleton #type:ignore ...
[ "streamlit.image", "streamlit.sidebar.form", "streamlit.button", "time.sleep", "circulation_skeletonizer.get_orientation_graph", "numpy.array", "streamlit.multiselect", "streamlit.empty", "streamlit.form", "streamlit.cache", "os.listdir", "json.dump", "os.path.isdir", "circulation_skeleton...
[((544, 599), 'streamlit.set_option', 'st.set_option', (['"""deprecation.showPyplotGlobalUse"""', '(False)'], {}), "('deprecation.showPyplotGlobalUse', False)\n", (557, 599), True, 'import streamlit as st\n'), ((601, 720), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Arch App"""', 'page_ic...
"""Generate synthetic data in LIBSVM format.""" import argparse import io import time import numpy as np from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split RNG = np.random.RandomState(2019) def generate_data(args): """Generates the data.""" print("Generati...
[ "argparse.ArgumentParser", "sklearn.model_selection.train_test_split", "io.StringIO", "time.time", "numpy.random.RandomState", "sklearn.datasets.make_classification" ]
[((216, 243), 'numpy.random.RandomState', 'np.random.RandomState', (['(2019)'], {}), '(2019)\n', (237, 243), True, 'import numpy as np\n'), ((526, 537), 'time.time', 'time.time', ([], {}), '()\n', (535, 537), False, 'import time\n'), ((846, 1030), 'sklearn.datasets.make_classification', 'make_classification', ([], {'n_...
# Copyright (c) 2019 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 app...
[ "numpy.product", "numpy.array", "paddle.fluid.Executor", "six.moves.xrange", "paddle.grad", "paddle.disable_static", "numpy.random.random", "paddle.fluid.default_startup_program", "paddle.ones", "paddle.enable_static", "paddle.fluid.default_main_program", "paddle.fluid.executor.global_scope", ...
[((4190, 4201), 'paddle.fluid.backward._as_list', '_as_list', (['y'], {}), '(y)\n', (4198, 4201), False, 'from paddle.fluid.backward import _append_grad_suffix_, _as_list\n'), ((4212, 4233), 'paddle.fluid.Executor', 'fluid.Executor', (['place'], {}), '(place)\n', (4226, 4233), True, 'import paddle.fluid as fluid\n'), (...
import glob import numpy as np import os import random import tensorflow as tf import tqdm import csv def load_dataset(enc, path, combine): paths = [] if os.path.isfile(path): # Simple file paths.append(path) elif os.path.isdir(path): # Directory for (dirpath, _, fnames) in...
[ "tqdm.tqdm", "os.walk", "os.path.join", "os.path.isfile", "os.path.isdir", "numpy.load", "csv.reader", "random.randint", "glob.glob" ]
[((164, 184), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (178, 184), False, 'import os\n'), ((549, 565), 'tqdm.tqdm', 'tqdm.tqdm', (['paths'], {}), '(paths)\n', (558, 565), False, 'import tqdm\n'), ((244, 263), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (257, 263), False, 'import...
# coding=utf-8 # Copyright 2020 The Mesh TensorFlow 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 applicab...
[ "numpy.prod", "mesh_tensorflow.Mesh", "numpy.log", "mesh_tensorflow.VariableDType", "mesh_tensorflow.Dimension", "numpy.array", "tensorflow.compat.v1.global_variables_initializer", "mesh_tensorflow.Shape", "numpy.tanh", "mesh_tensorflow.transformer.vocab_embeddings.MixtureOfSoftmaxes", "mesh_ten...
[((17888, 17902), 'tensorflow.compat.v1.test.main', 'tf.test.main', ([], {}), '()\n', (17900, 17902), True, 'import tensorflow.compat.v1 as tf\n'), ((1531, 1542), 'mesh_tensorflow.Graph', 'mtf.Graph', ([], {}), '()\n', (1540, 1542), True, 'import mesh_tensorflow as mtf\n'), ((1559, 1591), 'mesh_tensorflow.Mesh', 'mtf.M...
from __future__ import print_function import os import sys import cv2 import random import datetime import time import math import argparse import numpy as np import torch try: from iou import IOU except BaseException: # IOU cython speedup 10x def IOU(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2): sa = a...
[ "torch.log", "numpy.minimum", "numpy.where", "torch.exp", "math.log", "numpy.maximum", "torch.cat", "math.exp" ]
[((2754, 2782), 'torch.cat', 'torch.cat', (['[g_cxcy, g_wh]', '(1)'], {}), '([g_cxcy, g_wh], 1)\n', (2763, 2782), False, 'import torch\n'), ((821, 839), 'math.log', 'math.log', (['(ww / aww)'], {}), '(ww / aww)\n', (829, 839), False, 'import math\n'), ((841, 859), 'math.log', 'math.log', (['(hh / ahh)'], {}), '(hh / ah...
import copy from functools import wraps, reduce import socket import os from operator import mul import sys from statistics import mean import time import numpy as np from rdkit.Chem import AllChem, RWMol from rdkit import Chem from rdkit.Chem.rdChemReactions import ChemicalReaction from kgcn.data_util import dense_t...
[ "rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect", "numpy.argsort", "numpy.array", "rdkit.Chem.GetSymmSSSR", "sys.exit", "rdkit.Chem.MolFromSmarts", "kgcn.data_util.dense_to_sparse", "rdkit.Chem.AllChem.ReactionToSmarts", "numpy.asarray", "rdkit.Chem.MolToSmiles", "functools.wraps", "rdkit.Ch...
[((12876, 12887), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (12881, 12887), False, 'from functools import wraps, reduce\n'), ((1238, 1257), 'numpy.zeros', 'np.zeros', (['label_dim'], {}), '(label_dim)\n', (1246, 1257), True, 'import numpy as np\n'), ((1279, 1304), 'numpy.zeros_like', 'np.zeros_like', (['l...
import unittest import numpy as np from rlcard.games.leducholdem.game import LeducholdemGame as Game from rlcard.games.leducholdem.player import LeducholdemPlayer as Player from rlcard.games.leducholdem.judger import LeducholdemJudger as Judger from rlcard.core import Card class TestLeducholdemMethods(unittest.TestCa...
[ "rlcard.core.Card", "rlcard.games.leducholdem.player.LeducholdemPlayer", "rlcard.games.leducholdem.judger.LeducholdemJudger.judge_game", "rlcard.games.leducholdem.game.LeducholdemGame", "unittest.main", "numpy.random.RandomState" ]
[((3340, 3355), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3353, 3355), False, 'import unittest\n'), ((376, 382), 'rlcard.games.leducholdem.game.LeducholdemGame', 'Game', ([], {}), '()\n', (380, 382), True, 'from rlcard.games.leducholdem.game import LeducholdemGame as Game\n'), ((513, 519), 'rlcard.games.ledu...
import math import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from model.layers.attention_layers import SEModule, CBAM import config.yolov4_config as cfg class Mish(nn.Module): def __init__(self): super(Mish, self).__init__() def forward(self, x): return x ...
[ "numpy.fromfile", "model.layers.attention_layers.CBAM", "math.sqrt", "torch.from_numpy", "torch.nn.Conv2d", "torch.nn.functional.softplus", "model.layers.attention_layers.SEModule", "torch.nn.Identity", "torch.randn", "torch.cat" ]
[((465, 478), 'torch.nn.Identity', 'nn.Identity', ([], {}), '()\n', (476, 478), True, 'import torch.nn as nn\n'), ((8767, 8794), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(224)', '(224)'], {}), '(1, 3, 224, 224)\n', (8778, 8794), False, 'import torch\n'), ((762, 907), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_chan...
import os.path import cv2 import matplotlib.pyplot as plt import numpy as np from keras import Input, regularizers from keras.applications import vgg16 from keras.engine import Model from keras.layers import Flatten, Dense, Lambda, Cropping2D, Dropout, ELU, Activation, MaxPooling2D, Conv2D, \ BatchNormalization fr...
[ "keras.layers.Conv2D", "keras.applications.vgg16.VGG16", "matplotlib.pyplot.ylabel", "data_loader.load_training_data_as_generator", "data_loader.data_resampling", "keras.layers.Activation", "keras.layers.Dense", "keras.layers.Cropping2D", "data_loader.preprocessing_pipe", "keras.utils.plot_model",...
[((558, 580), 'keras.models.load_model', 'load_model', (['model_file'], {}), '(model_file)\n', (568, 580), False, 'from keras.models import Sequential, load_model\n'), ((594, 630), 'cv2.imread', 'cv2.imread', (['"""test_images/center.jpg"""'], {}), "('test_images/center.jpg')\n", (604, 630), False, 'import cv2\n'), ((6...
import os import math import numpy as np import tensorflow as tf from concept import Concept import pdb np.set_printoptions(precision=5, suppress=True) class Teacher: def __init__(self, sess, rl_gamma, boltzman_beta, belief_var_1d, num_distractors, attributes_size, message_space_size): self.sess = sess ...
[ "tensorflow.transpose", "tensorflow.math.log", "tensorflow.reduce_sum", "tensorflow.multiply", "numpy.array", "tensorflow.ones_like", "tensorflow.reduce_mean", "tensorflow.slice", "os.path.exists", "numpy.mean", "tensorflow.placeholder", "tensorflow.not_equal", "tensorflow.random_normal_init...
[((105, 152), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(5)', 'suppress': '(True)'}), '(precision=5, suppress=True)\n', (124, 152), True, 'import numpy as np\n'), ((1510, 1553), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', ([], {'learning_rate': '(0.001)'}), '(learning_rate=0.0...
# ====================================================================================== # # Useful functions for analyzing corp data. # Author: <NAME>, <EMAIL> # ====================================================================================== # import numpy as np import pandas as pd from fastparquet import Parqu...
[ "numpy.abs", "numpy.histogram", "numpy.unique", "pandas.read_csv", "datetime.datetime.strptime", "duckdb.connect", "numpy.log", "numpy.diff", "numpy.exp", "numpy.concatenate", "snappy.decompress", "os.path.expanduser" ]
[((571, 594), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (589, 594), False, 'import os\n'), ((672, 720), 'duckdb.connect', 'db.connect', ([], {'database': '""":memory:"""', 'read_only': '(False)'}), "(database=':memory:', read_only=False)\n", (682, 720), True, 'import duckdb as db\n'), ((...
#!/usr/bin/python from __future__ import (absolute_import, division, print_function, unicode_literals) import os import warnings import librosa import numpy as np import pandas as pd from keras.layers import Activation, Dense, Dropout, Flatten from keras.models import Sequential from keras.uti...
[ "sklearn.preprocessing.LabelEncoder", "pandas.read_csv", "sklearn.model_selection.train_test_split", "librosa.feature.mfcc", "pandas.DataFrame.from_dict", "keras.models.Sequential", "numpy.array", "keras.layers.Activation", "keras.layers.Dense", "numpy.load", "keras.layers.Dropout", "warnings....
[((440, 473), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (463, 473), False, 'import warnings\n'), ((799, 841), 'pandas.read_csv', 'pd.read_csv', (['"""./zh-CN/train.tsv"""'], {'sep': '"""\t"""'}), "('./zh-CN/train.tsv', sep='\\t')\n", (810, 841), True, 'import pandas a...
#components.py # Copyright (c) 2020 <NAME> <NAME> # # MIT License # # 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, co...
[ "torch.cuda.manual_seed_all", "torch.manual_seed", "torch.nn.ReLU", "torch.nn.Conv2d", "numpy.random.seed", "torch.cuda.manual_seed" ]
[((1187, 1204), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1201, 1204), True, 'import numpy as np\n'), ((1205, 1225), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (1222, 1225), False, 'import torch, torch.nn as nn\n'), ((1226, 1251), 'torch.cuda.manual_seed', 'torch.cuda.manual...
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
[ "sofima.flow_field._batched_peaks", "sofima.flow_field.JAXMaskedXCorrWithStatsCalculator", "numpy.sqrt", "numpy.ones", "absl.testing.absltest.main", "numpy.exp", "numpy.zeros", "numpy.min", "numpy.full", "numpy.testing.assert_array_equal" ]
[((3485, 3500), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (3498, 3500), False, 'from absl.testing import absltest\n'), ((824, 860), 'numpy.zeros', 'np.zeros', (['(120, 120)'], {'dtype': 'np.uint8'}), '((120, 120), dtype=np.uint8)\n', (832, 860), True, 'import numpy as np\n'), ((878, 914), 'numpy....
from statsmodels.compat.python import range import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as lines def tukeyplot(results, dim=None, yticklabels=None): npairs = len(results) fig = plt.figure() fsp = fig.add_subplot(111) fsp.axis([-50,50,0.5,10.5]) fsp.set_title('95 % f...
[ "numpy.array", "matplotlib.pyplot.figure", "numpy.arange", "statsmodels.compat.python.range" ]
[((2057, 2371), 'numpy.array', 'np.array', (['[[-10.04391794, 26.34391794], [-21.45225794, 14.93557794], [5.61441206, \n 42.00224794], [-13.40225794, 22.98557794], [-29.60225794, 6.78557794],\n [-2.53558794, 33.85224794], [-21.55225794, 14.83557794], [8.87275206, \n 45.26058794], [-10.14391794, 26.24391794], [...
#!/usr/bin/env python ''' optical_flow.py - Optical-flow velocity calculation and display using OpenCV To test: % python optical_flow.py # video from webcam % python optical_flow.py -f FILENAME # video from file % python optical_flow.py -c CAMERA # specific camera number ...
[ "cv2.calcOpticalFlowFarneback", "numpy.reshape", "math.tan", "optparse.OptionParser", "cv2.imshow", "cv2.circle", "cv2.waitKey", "cv2.VideoCapture", "cv2.cvtColor", "numpy.frombuffer", "cv2.resize", "time.time" ]
[((5486, 5509), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (5507, 5509), False, 'import optparse\n'), ((6037, 6106), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(camno if not options.filename else options.filename)'], {}), '(camno if not options.filename else options.filename)\n', (6053, 6106), ...
# Some part of the code was referenced from below. # https://github.com/pytorch/examples/tree/master/word_language_model import torch import torch.nn as nn import numpy as np from torch.autograd import Variable from data_utils import Dictionary, Corpus # Hyper Parameters embed_size = 128 hidden_size = 1024 num_layer...
[ "torch.nn.CrossEntropyLoss", "data_utils.Corpus", "torch.multinomial", "torch.nn.LSTM", "numpy.exp", "torch.nn.Linear", "torch.autograd.Variable", "torch.zeros", "torch.nn.Embedding", "torch.ones" ]
[((548, 556), 'data_utils.Corpus', 'Corpus', ([], {}), '()\n', (554, 556), False, 'from data_utils import Dictionary, Corpus\n'), ((1804, 1825), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1823, 1825), True, 'import torch.nn as nn\n'), ((3318, 3340), 'torch.ones', 'torch.ones', (['vocab_size'...
#!/usr/bin/env python # Written for Python 3.4 # # Dependencies # pillow # scikit-image # scikit-learn # ...and their dependencies # # @TODO@: # * implement shared palette # * range check numeric command-line arguments # * consider click instead of argparse # * error out if width or height is not a mult...
[ "numpy.mean", "numpy.repeat", "argparse.ArgumentParser", "io.BytesIO", "time.perf_counter", "struct.pack", "numpy.array", "platform.system", "glob.glob" ]
[((849, 881), 'numpy.array', 'np.array', (['[[0, 0, 7], [3, 5, 1]]'], {}), '([[0, 0, 7], [3, 5, 1]])\n', (857, 881), True, 'import numpy as np\n'), ((921, 982), 'numpy.array', 'np.array', (['[[0, 0, 0, 7, 5], [3, 5, 7, 5, 3], [1, 3, 5, 3, 1]]'], {}), '([[0, 0, 0, 7, 5], [3, 5, 7, 5, 3], [1, 3, 5, 3, 1]])\n', (929, 982)...
from distutils.version import StrictVersion import unittest from numpy.testing import assert_almost_equal from onnxruntime import InferenceSession, __version__ as ort_version from sklearn.ensemble import ( GradientBoostingClassifier, GradientBoostingRegressor, ) from sklearn.linear_model import LogisticRegressi...
[ "sklearn.neural_network.MLPRegressor", "sklearn.neural_network.MLPClassifier", "skl2onnx.common.data_types.FloatTensorType", "sklearn.ensemble.GradientBoostingRegressor", "sklearn.linear_model.LogisticRegression", "skl2onnx.common.data_types.Int64TensorType", "numpy.testing.assert_almost_equal", "test...
[((15487, 15502), 'unittest.main', 'unittest.main', ([], {}), '()\n', (15500, 15502), False, 'import unittest\n'), ((991, 1144), 'test_utils.dump_multiple_classification', 'dump_multiple_classification', (['model'], {'allow_failure': '"""StrictVersion(onnxruntime.__version__) <= StrictVersion(\'0.2.1\')"""', 'target_op...
import numpy as np import operator from random import choice from neat.activations import identity_activation from neat.aggregations import sum_aggregation class StateMachineNetwork(object): """ This class represents a working state machine which can actually run on robot or in simulation. """ def __init__(s...
[ "numpy.array", "numpy.multiply", "random.choice" ]
[((4246, 4262), 'numpy.array', 'np.array', (['biases'], {}), '(biases)\n', (4254, 4262), True, 'import numpy as np\n'), ((4426, 4443), 'numpy.array', 'np.array', (['weights'], {}), '(weights)\n', (4434, 4443), True, 'import numpy as np\n'), ((4710, 4726), 'numpy.array', 'np.array', (['inputs'], {}), '(inputs)\n', (4718...
import json import warnings from enum import Enum from typing import Any, List, Tuple, Union import numpy as np import torch from mmhuman3d.core.cameras.cameras import PerspectiveCameras from mmhuman3d.core.conventions.cameras.convert_convention import ( convert_camera_matrix, convert_K_3x3_to_4x4, conver...
[ "mmhuman3d.core.conventions.cameras.convert_convention.convert_K_4x4_to_3x3", "json.dumps", "torch.from_numpy", "numpy.array", "numpy.dot", "numpy.linalg.inv", "mmhuman3d.core.conventions.cameras.convert_convention.convert_K_3x3_to_4x4", "numpy.expand_dims", "json.load", "warnings.warn", "json.d...
[((3065, 3086), 'numpy.array', 'np.array', (['dist_coeffs'], {}), '(dist_coeffs)\n', (3073, 3086), True, 'import numpy as np\n'), ((8160, 8181), 'json.dumps', 'json.dumps', (['dump_dict'], {}), '(dump_dict)\n', (8170, 8181), False, 'import json\n'), ((14762, 14997), 'mmhuman3d.core.conventions.cameras.convert_conventio...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy as np from progress.bar import Bar import time import torch from src.lib.external.nms import soft_nms from src.lib.models.decode import ddd_decode from src.lib.models.utils import flip_...
[ "cv2.warpAffine", "torch.from_numpy", "torch.cuda.synchronize", "numpy.array", "src.lib.utils.image.get_affine_transform", "torch.no_grad", "src.lib.models.decode.ddd_decode", "time.time" ]
[((792, 923), 'numpy.array', 'np.array', (['[[707.0493, 0, 604.0814, 45.75831], [0, 707.0493, 180.5066, -0.3454157], [0,\n 0, 1.0, 0.004981016]]'], {'dtype': 'np.float32'}), '([[707.0493, 0, 604.0814, 45.75831], [0, 707.0493, 180.5066, -\n 0.3454157], [0, 0, 1.0, 0.004981016]], dtype=np.float32)\n', (800, 923), T...
from conv_layers import ResidueEmbedding, Conv1DLayer, Conv2DLayer, \ Outer1DTo2DLayer, ContactMapGather, ResAdd, Conv2DPool, Conv2DUp, \ Conv1DAtrous, Conv2DAtrous, Conv2DBilinearUp, Conv2DASPP, BatchNorm, \ TriangleInequality, Conv1DLayer_RaptorX, Conv2DLayer_RaptorX from diag_conv_layers import DiagConv2...
[ "tensorflow.shape", "tensorflow.random_normal", "tensorflow.transpose", "tensorflow.ones", "tensorflow.to_float", "tensorflow.reduce_sum", "numpy.log", "tensorflow.cumsum", "tensorflow.reduce_max", "tensorflow.concat", "tensorflow.nn.sigmoid", "tensorflow.reshape", "tensorflow.nn.sigmoid_cro...
[((769, 808), 'tensorflow.expand_dims', 'tf.expand_dims', (['parent_tensor', 'self.dim'], {}), '(parent_tensor, self.dim)\n', (783, 808), True, 'import tensorflow as tf\n'), ((1229, 1254), 'tensorflow.reduce_max', 'tf.reduce_max', (['n_residues'], {}), '(n_residues)\n', (1242, 1254), True, 'import tensorflow as tf\n'),...
from numpy.random import randn def add_and_sum(x, y): added = x + y summed = added.sum(axis=1) return summed def call_function(): x = randn(1000, 1000) y = randn(1000, 1000) return add_and_sum(x, y)
[ "numpy.random.randn" ]
[((146, 163), 'numpy.random.randn', 'randn', (['(1000)', '(1000)'], {}), '(1000, 1000)\n', (151, 163), False, 'from numpy.random import randn\n'), ((170, 187), 'numpy.random.randn', 'randn', (['(1000)', '(1000)'], {}), '(1000, 1000)\n', (175, 187), False, 'from numpy.random import randn\n')]
# Using Keras to load our model and images from keras.models import load_model from keras.preprocessing import image # To grab environment variables, image directories, and image paths import os from os.path import isfile, join # To sort our image directories by natural sort from natsort import os_sorted # To turn o...
[ "keras.preprocessing.image.img_to_array", "os.listdir", "keras.models.load_model", "os.path.join", "numpy.array", "numpy.expand_dims", "keras.preprocessing.image.load_img" ]
[((978, 1000), 'keras.models.load_model', 'load_model', (['MODEL_PATH'], {}), '(MODEL_PATH)\n', (988, 1000), False, 'from keras.models import load_model\n'), ((1213, 1264), 'keras.preprocessing.image.load_img', 'image.load_img', (['image_path'], {'target_size': 'TARGET_SIZE'}), '(image_path, target_size=TARGET_SIZE)\n'...
# coding=utf-8 # Copyright 2020 The Trax 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 or a...
[ "trax.fastmath.numpy.concatenate", "trax.fastmath.numpy.take", "numpy.log", "absl.logging.info", "trax.layers.initializers.GlorotUniformInitializer", "trax.fastmath.numpy.split", "trax.layers.base.Fn", "trax.fastmath.numpy.matmul", "trax.fastmath.numpy.max", "trax.fastmath.numpy.linalg.solve", "...
[((1060, 1086), 'trax.layers.assert_shape.assert_shape', 'assert_shape', (['"""...a->...b"""'], {}), "('...a->...b')\n", (1072, 1086), False, 'from trax.layers.assert_shape import assert_shape\n'), ((4439, 4464), 'trax.layers.assert_shape.assert_shape', 'assert_shape', (['"""...->...d"""'], {}), "('...->...d')\n", (445...
# This holds all the iteration per step of a pfasst or parareal run class Stats_per_step: Nsteps=1 # Total number of steps Niters=1 # Max iters from run Nblocks=1 iters_per_step=[] resid_per_step=[] delq0_per_step=[] def __init__(self, param_dict,Ns...
[ "numpy.loadtxt", "numpy.zeros" ]
[((606, 629), 'numpy.zeros', 'np.zeros', (['[self.Nsteps]'], {}), '([self.Nsteps])\n', (614, 629), True, 'import numpy as np\n'), ((662, 698), 'numpy.zeros', 'np.zeros', (['[self.Nsteps, self.Niters]'], {}), '([self.Nsteps, self.Niters])\n', (670, 698), True, 'import numpy as np\n'), ((730, 766), 'numpy.zeros', 'np.zer...
# -*- coding: utf-8 -*- """ Interpies - a libray for the interpretation of gravity and magnetic data. transforms.py: Functions for applying derivatives, transforms and filters to grids. @author: <NAME> Geophysics Labs, 2017 """ # Import numpy and scipy import numpy as np from scipy import signal from scipy.ndimag...
[ "numpy.convolve", "numpy.sqrt", "numpy.linalg.pinv", "scipy.ndimage.filters.gaussian_filter", "sklearn.preprocessing.PolynomialFeatures", "numpy.log", "numpy.array", "numpy.nanmean", "numpy.nanmin", "numpy.mod", "numpy.arange", "numpy.mean", "numpy.repeat", "numpy.fft.fft2", "numpy.exp",...
[((681, 717), 'numpy.array', 'np.array', (['[-0.5, 0, 0.5]', 'np.float32'], {}), '([-0.5, 0, 0.5], np.float32)\n', (689, 717), True, 'import numpy as np\n'), ((729, 768), 'numpy.array', 'np.array', (['[1, -8, 0, 8, -1]', 'np.float32'], {}), '([1, -8, 0, 8, -1], np.float32)\n', (737, 768), True, 'import numpy as np\n'),...
import io import os import shutil import tarfile from base64 import b64decode import dash from dash import dcc import numpy as np import plotly.express as px import plotly.graph_objects as go from app import app, dbroot, logger from dash.dependencies import Input, Output, State from dash.exceptions import PreventUpdat...
[ "app.logger.error", "io.BytesIO", "dash.dependencies.Input", "numpy.array", "app.logger.info", "numpy.arange", "numpy.flip", "os.listdir", "numpy.repeat", "numpy.searchsorted", "dash.dependencies.Output", "os.path.isdir", "app.logger.warn", "dash.dependencies.State", "plotly.express.imsh...
[((6168, 6234), 'app.logger.info', 'logger.info', (['f"""Generated tile with shape {tile.shape}. Scaling..."""'], {}), "(f'Generated tile with shape {tile.shape}. Scaling...')\n", (6179, 6234), False, 'from app import app, dbroot, logger\n'), ((6523, 6655), 'plotly.express.imshow', 'px.imshow', (['tile'], {'width': 'w'...
# (c) <NAME>, 2010-2022. MIT License. import pathlib import numpy as np import pandas as pd import pytest from pytest import approx from sklearn.cross_decomposition import PLSRegression from process_improve.multivariate.methods import ( PCA, PLS, MCUVScaler, SpecificationWarning, center, epsq...
[ "pandas.read_csv", "process_improve.multivariate.methods.PCA", "process_improve.multivariate.methods.MCUVScaler", "numpy.array", "numpy.mean", "pathlib.Path", "numpy.asarray", "process_improve.multivariate.methods.PLS", "pandas.DataFrame", "scipy.sparse.csr_matrix", "sklearn.cross_decomposition....
[((16384, 16459), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""API still has to be improved to handle this case"""'}), "(reason='API still has to be improved to handle this case')\n", (16400, 16459), False, 'import pytest\n'), ((2471, 2533), 'pandas.read_csv', 'pd.read_csv', (["(folder / 'kamyr.csv')"], ...
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved. # # This work is made available under the Nvidia Source Code License-NC. # To view a copy of this license, visit # https://nvlabs.github.io/stylegan2/license.html """Custom TensorFlow ops for efficient resampling of 2D images.""" import os import numpy as...
[ "tensorflow.nn.conv2d", "tensorflow.shape", "tensorflow.pad", "tensorflow.transpose", "numpy.asarray", "os.path.splitext", "numpy.sum", "numpy.outer", "tensorflow.constant", "tensorflow.nn.conv2d_transpose", "tensorflow.reshape", "tensorflow.convert_to_tensor" ]
[((3245, 3268), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['x'], {}), '(x)\n', (3265, 3268), True, 'import tensorflow as tf\n'), ((3277, 3308), 'numpy.asarray', 'np.asarray', (['k'], {'dtype': 'np.float32'}), '(k, dtype=np.float32)\n', (3287, 3308), True, 'import numpy as np\n'), ((3793, 3838), 'tensorfl...
''' trainer for GAT model ---- ACM CHIL 2020 paper <NAME>, 200228 ''' import os,sys,pickle,time,random,glob import numpy as np import pandas as pd from typing import List import copy import os.path as osp import torch import torch.utils.data from torch_sparse import SparseTensor, cat from torch_g...
[ "torch.LongTensor", "torch.from_numpy", "torch.cuda.is_available", "os.remove", "numpy.mean", "torch.nn.functional.nll_loss", "numpy.random.seed", "random.randint", "glob.glob", "pickle.load", "torch.nn.functional.log_softmax", "torch_geometric.nn.GATConv", "time.time", "torch_geometric.da...
[((816, 862), 'torch.LongTensor', 'torch.LongTensor', (['[coo_data.row, coo_data.col]'], {}), '([coo_data.row, coo_data.col])\n', (832, 862), False, 'import torch\n'), ((2170, 2196), 'random.randint', 'random.randint', (['(1)', '(1000000)'], {}), '(1, 1000000)\n', (2184, 2196), False, 'import os, sys, pickle, time, ran...
import numpy as np from sklearn import linear_model from sklearn.preprocessing import scale from sklearn.datasets import make_regression from plasticnet.solvers.functional import ( ordinary_least_squares, ridge, lasso, elastic_net, general_plastic_net, plastic_ridge, plastic_lasso, har...
[ "numpy.random.rand", "numpy.random.exponential", "plasticnet.solvers.functional.elastic_net", "plasticnet.solvers.functional.ridge", "plasticnet.solvers.functional.unified_plastic_net", "sklearn.datasets.make_regression", "numpy.testing.assert_almost_equal", "numpy.dot", "plasticnet.solvers.function...
[((653, 723), 'sklearn.datasets.make_regression', 'make_regression', ([], {'n_samples': 'N', 'n_features': 'D', 'n_informative': 'N', 'coef': '(True)'}), '(n_samples=N, n_features=D, n_informative=N, coef=True)\n', (668, 723), False, 'from sklearn.datasets import make_regression\n'), ((778, 809), 'sklearn.linear_model....
import numpy as np class DataSet(object): def __init__(self, data, shuffle=False): self._data = self._auto_expand(data) self._num_members = self._data.shape[0] self._index_in_epoch = 0 # Shuffle the data if shuffle: perm = np.arange(self._num_members) np.random.shuffle(perm) sel...
[ "numpy.random.randint", "numpy.expand_dims", "numpy.arange", "numpy.random.shuffle" ]
[((252, 280), 'numpy.arange', 'np.arange', (['self._num_members'], {}), '(self._num_members)\n', (261, 280), True, 'import numpy as np\n'), ((287, 310), 'numpy.random.shuffle', 'np.random.shuffle', (['perm'], {}), '(perm)\n', (304, 310), True, 'import numpy as np\n'), ((717, 745), 'numpy.arange', 'np.arange', (['self._...
""" Evaluate a musical composition represented as a `Piece` instance. Author: <NAME> """ from collections import Counter from typing import Any, Callable, Dict, Optional import numpy as np from scipy.stats import entropy from rlmusician.environment.piece import Piece from rlmusician.utils import rolling_aggregate ...
[ "collections.Counter", "scipy.stats.entropy", "numpy.array_equal", "rlmusician.utils.rolling_aggregate" ]
[((1804, 1822), 'collections.Counter', 'Counter', (['positions'], {}), '(positions)\n', (1811, 1822), False, 'from collections import Counter\n'), ((2165, 2186), 'scipy.stats.entropy', 'entropy', (['distribution'], {}), '(distribution)\n', (2172, 2186), False, 'from scipy.stats import entropy\n'), ((2274, 2307), 'scipy...
# flake8: noqa # Test cases taken from: # - Thomas Ho Company LTD: financial models, # http://www.thomasho.com/mainpages/analysoln.asp # - Analysis of Derivatives for the Chartered Financial Analyst® Program, # <NAME>, PhD, CFA, ©2003 CFA Institute import types import numpy as np import pandas as pd from pyfina...
[ "numpy.array", "numpy.random.seed" ]
[((342, 361), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (356, 361), True, 'import numpy as np\n'), ((2473, 2501), 'numpy.array', 'np.array', (['[2100, 2000, 1900]'], {}), '([2100, 2000, 1900])\n', (2481, 2501), True, 'import numpy as np\n'), ((2896, 2938), 'numpy.array', 'np.array', (['[1900.0,...
## Copyright 2018-2021 Intel Corporation ## SPDX-License-Identifier: Apache-2.0 import os from glob import glob from collections import defaultdict import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torch.utils.data.distributed import DistributedSampler from config import * from ut...
[ "numpy.clip", "numpy.sqrt", "torch.utils.data.distributed.DistributedSampler", "numpy.flip", "os.path.split", "os.path.isdir", "numpy.concatenate", "numpy.maximum", "os.path.relpath", "numpy.square", "os.path.isfile", "tza.Reader", "os.path.join", "numpy.swapaxes", "numpy.errstate", "c...
[((457, 489), 'os.path.join', 'os.path.join', (['cfg.data_dir', 'name'], {}), '(cfg.data_dir, name)\n', (469, 489), False, 'import os\n'), ((4881, 4911), 'numpy.concatenate', 'np.concatenate', (['images'], {'axis': '(2)'}), '(images, axis=2)\n', (4895, 4911), True, 'import numpy as np\n'), ((5057, 5076), 'os.path.split...
from gym.spaces import Box, Dict, Discrete, Tuple import numpy as np import unittest import ray import ray.rllib.algorithms.pg as pg from ray.rllib.evaluation.postprocessing import Postprocessing from ray.rllib.examples.env.random_env import RandomEnv from ray.rllib.models.tf.tf_action_dist import Categorical from ray...
[ "ray.rllib.utils.test_utils.check_compute_single_action", "numpy.mean", "ray.shutdown", "ray.rllib.utils.test_utils.check_train_results", "ray.rllib.utils.numpy.fc", "gym.spaces.Discrete", "gym.spaces.Box", "pytest.main", "numpy.array", "ray.rllib.algorithms.pg.PGConfig", "ray.rllib.utils.test_u...
[((723, 733), 'ray.init', 'ray.init', ([], {}), '()\n', (731, 733), False, 'import ray\n'), ((796, 810), 'ray.shutdown', 'ray.shutdown', ([], {}), '()\n', (808, 810), False, 'import ray\n'), ((937, 950), 'ray.rllib.algorithms.pg.PGConfig', 'pg.PGConfig', ([], {}), '()\n', (948, 950), True, 'import ray.rllib.algorithms....
from meta_policy_search.samplers.base import SampleProcessor from meta_policy_search.samplers.dice_sample_processor import DiceSampleProcessor from meta_policy_search.utils.rl2 import utils import numpy as np class MetaSampleProcessor(SampleProcessor): def process_samples(self, paths_meta_batch, log=False, log_pr...
[ "numpy.concatenate" ]
[((1726, 1815), 'numpy.concatenate', 'np.concatenate', (["[samples_data['rewards'] for samples_data in samples_data_meta_batch]"], {}), "([samples_data['rewards'] for samples_data in\n samples_data_meta_batch])\n", (1740, 1815), True, 'import numpy as np\n'), ((1853, 1942), 'numpy.concatenate', 'np.concatenate', (["...
import numpy as np from numpy.linalg import lstsq from numpy.testing import (assert_allclose, assert_equal, assert_, run_module_suite, assert_raises) from scipy.sparse import rand from scipy.sparse.linalg import aslinearoperator from scipy.optimize import lsq_linear A = np.array([ [0.17...
[ "scipy.sparse.rand", "numpy.testing.assert_equal", "numpy.testing.assert_allclose", "scipy.sparse.linalg.aslinearoperator", "numpy.testing.assert_", "numpy.array", "scipy.optimize.lsq_linear", "numpy.dot", "numpy.testing.run_module_suite", "numpy.linalg.lstsq", "numpy.random.RandomState" ]
[((300, 362), 'numpy.array', 'np.array', (['[[0.171, -0.057], [-0.049, -0.248], [-0.166, 0.054]]'], {}), '([[0.171, -0.057], [-0.049, -0.248], [-0.166, 0.054]])\n', (308, 362), True, 'import numpy as np\n'), ((382, 414), 'numpy.array', 'np.array', (['[0.074, 1.014, -0.383]'], {}), '([0.074, 1.014, -0.383])\n', (390, 41...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 31 11:26:25 2018 @author: cadu """ print("66") import pandas as pd import numpy as np from sklearn import datasets, svm, metrics from sklearn import cross_validation import matplotlib.pyplot as plt import sys sys.path.append("../src") from data_pro...
[ "tensorflow.cast", "tensorflow.InteractiveSession", "tensorflow.placeholder", "tensorflow.train.GradientDescentOptimizer", "tensorflow.global_variables_initializer", "tensorflow.argmax", "numpy.empty", "sklearn.cross_validation.train_test_split", "tensorflow.matmul", "data_prov2.get_tt", "tensor...
[((281, 306), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (296, 306), False, 'import sys\n'), ((373, 381), 'data_prov2.get_tt', 'get_tt', ([], {}), '()\n', (379, 381), False, 'from data_prov2 import get_tt\n'), ((514, 587), 'sklearn.cross_validation.train_test_split', 'cross_validation...
import numpy as np import torch import torch.nn.functional as F from nnlib.nnlib import visualizations as vis from nnlib.nnlib import losses, utils from modules import nn_utils from methods.predict import PredictGradBaseClassifier class LIMIT(PredictGradBaseClassifier): """ The main method of "Improving generali...
[ "nnlib.nnlib.losses.get_classification_loss", "numpy.sqrt", "modules.nn_utils.parse_network_from_config", "modules.nn_utils.get_grad_replacement_class", "nnlib.nnlib.losses.mse", "nnlib.nnlib.losses.mae", "torch.softmax", "nnlib.nnlib.visualizations.plot_predictions", "torch.nn.functional.one_hot", ...
[((4959, 5071), 'modules.nn_utils.parse_network_from_config', 'nn_utils.parse_network_from_config', ([], {'args': "self.architecture_args['classifier']", 'input_shape': 'self.input_shape'}), "(args=self.architecture_args['classifier'\n ], input_shape=self.input_shape)\n", (4993, 5071), False, 'from modules import nn...
import numpy as np import os import torch import torch.nn as nn import torch.nn.functional as F import copy import math import ego_utils as utils import hydra class Encoder(nn.Module): """Convolutional encoder for image-based observations.""" def __init__(self, view, obs_shape, feature_dim): super()....
[ "torch.tanh", "torch.optim.Adam", "torch.nn.functional.mse_loss", "ego_utils.mlp", "ego_utils.tie_weights", "hydra.utils.instantiate", "torch.load", "torch.nn.LayerNorm", "numpy.log", "torch.min", "torch.nn.Conv2d", "ego_utils.to_np", "torch.nn.Linear", "ego_utils.soft_update_params", "t...
[((3033, 3069), 'hydra.utils.instantiate', 'hydra.utils.instantiate', (['encoder_cfg'], {}), '(encoder_cfg)\n', (3056, 3069), False, 'import hydra\n'), ((3162, 3268), 'ego_utils.mlp', 'utils.mlp', (['(self.encoder.feature_dim + proprio_obs_shape)', 'hidden_dim', '(2 * action_shape[0])', 'hidden_depth'], {}), '(self.enc...
from collections import namedtuple import lasagne as nn from lasagne.layers.dnn import Conv2DDNNLayer, MaxPool2DDNNLayer import data_iterators import numpy as np import theano.tensor as T from functools import partial import utils_heart import nn_heart from pathfinder import PKL_TRAIN_DATA_PATH, TRAIN_LABELS_P...
[ "theano.tensor.mean", "utils_heart.heaviside_function", "numpy.random.RandomState", "lasagne.layers.get_all_params", "numpy.mean", "lasagne.init.Orthogonal", "lasagne.layers.dropout", "lasagne.init.Constant", "numpy.vstack", "nn_heart.lb_softplus", "nn_heart.NormalCDFLayer", "collections.named...
[((428, 453), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (449, 453), True, 'import numpy as np\n'), ((1530, 1578), 'utils.get_train_valid_split', 'utils.get_train_valid_split', (['PKL_TRAIN_DATA_PATH'], {}), '(PKL_TRAIN_DATA_PATH)\n', (1557, 1578), False, 'import utils\n'), ((1604, 1...
import cv2 import numpy as np n = 400 img = np.zeros((n, n, 3), np.uint8) * 255 (centerX, centerY) = (round(img.shape[1] / 2), round(img.shape[0] / 2)) # 将图像的中心作为圆心,实际值为d/2 red = (0, 0, 255) for r in range(5, round(n / 2), 12): cv2.circle(img, (centerX, centerY), r, red, 3) winname = "Demo19.01" cv2.namedWindow(w...
[ "cv2.imshow", "numpy.zeros", "cv2.circle", "cv2.destroyAllWindows", "cv2.waitKey", "cv2.namedWindow" ]
[((303, 327), 'cv2.namedWindow', 'cv2.namedWindow', (['winname'], {}), '(winname)\n', (318, 327), False, 'import cv2\n'), ((328, 352), 'cv2.imshow', 'cv2.imshow', (['winname', 'img'], {}), '(winname, img)\n', (338, 352), False, 'import cv2\n'), ((353, 367), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (364, 36...
#################### Random Forest SemEval evaluation #################### import pandas as pd import numpy as np from joblib import dump, load from sklearn.metrics import f1_score, accuracy_score, precision_score, recall_score ### Loading SemEval 2019 variables character_variables = np.load(f'non_dl_semeval_character...
[ "numpy.mean", "sklearn.metrics.f1_score", "numpy.std", "numpy.sum", "numpy.concatenate", "joblib.load", "pandas.DataFrame", "numpy.load" ]
[((286, 336), 'numpy.load', 'np.load', (['f"""non_dl_semeval_character_variables.npy"""'], {}), "(f'non_dl_semeval_character_variables.npy')\n", (293, 336), True, 'import numpy as np\n'), ((360, 411), 'numpy.load', 'np.load', (['f"""non_dl_semeval_dict_count_variables.npy"""'], {}), "(f'non_dl_semeval_dict_count_variab...
from easydict import EasyDict as edict import numpy as np config = edict() config.IMG_HEIGHT = 375 config.IMG_WIDTH = 1242 # TODO(shizehao): infer fea shape in run time config.FEA_HEIGHT = 12 config.FEA_WIDTH = 39 config.EPSILON = 1e-16 config.LOSS_COEF_BBOX = 5.0 config.LOSS_COEF_CONF_POS = 75.0 config.LOSS_COEF_...
[ "numpy.reshape", "easydict.EasyDict", "numpy.array", "numpy.concatenate", "numpy.arange" ]
[((68, 75), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (73, 75), True, 'from easydict import EasyDict as edict\n'), ((411, 451), 'numpy.array', 'np.array', (['[[[123.68, 116.779, 103.939]]]'], {}), '([[[123.68, 116.779, 103.939]]])\n', (419, 451), True, 'import numpy as np\n'), ((496, 645), 'numpy.array', 'np.arra...
def forrest(self): '''Random Forrest based reduction strategy. Somewhat more aggressive than for example 'spearman' because there are no negative values, but instead the highest positive correlation is minused from all the values so that max value is 0, and then values are turned into positive. The...
[ "numpy.array", "wrangle.df_corr_randomforest" ]
[((806, 863), 'wrangle.df_corr_randomforest', 'wrangle.df_corr_randomforest', (['data', 'self.reduction_metric'], {}), '(data, self.reduction_metric)\n', (834, 863), False, 'import wrangle\n'), ((1333, 1350), 'numpy.array', 'np.array', (['[value]'], {}), '([value])\n', (1341, 1350), True, 'import numpy as np\n')]
from abc import ABC, abstractmethod import numpy as np import torch from textattack.goal_function_results import GoalFunctionResultStatus from textattack.search_methods import PopulationBasedSearch, PopulationMember from textattack.shared.validators import transformation_consists_of_word_swaps class GeneticAlgorith...
[ "numpy.random.choice", "torch.Tensor", "numpy.count_nonzero", "numpy.sum", "textattack.shared.validators.transformation_consists_of_word_swaps", "numpy.random.uniform", "textattack.search_methods.PopulationMember" ]
[((3304, 3346), 'numpy.count_nonzero', 'np.count_nonzero', (['word_select_prob_weights'], {}), '(word_select_prob_weights)\n', (3320, 3346), True, 'import numpy as np\n'), ((11528, 11581), 'textattack.shared.validators.transformation_consists_of_word_swaps', 'transformation_consists_of_word_swaps', (['transformation'],...
import json from pathlib import Path import datetime, sys, getopt import numpy as np # python script to find .npy files and convert them to binary (int16), # and deleting the .npy files (saving %50 of space) # refer to python notebook for some QA checks on this conversion. def session_entry(session_name,Files,sp): ...
[ "getopt.getopt", "pathlib.Path", "numpy.arange", "sys.exc_info", "sys.exit", "datetime.date.today", "json.dump" ]
[((754, 789), 'getopt.getopt', 'getopt.getopt', (['sys.argv[1:]', '"""a:v:"""'], {}), "(sys.argv[1:], 'a:v:')\n", (767, 789), False, 'import datetime, sys, getopt\n'), ((1044, 1062), 'pathlib.Path', 'Path', (['"""./TasksDir"""'], {}), "('./TasksDir')\n", (1048, 1062), False, 'from pathlib import Path\n'), ((1127, 1148)...
# module from __future__ import print_function import argparse from tqdm import tqdm import torch import torch.nn.functional as F from torchvision import datasets, transforms from torchvision.utils import save_image import time import torch.nn as nn from SSGE import Attack,resnet18 import torchvision from attack impor...
[ "torch.optim.lr_scheduler.MultiStepLR", "matplotlib.pyplot.ylabel", "torch.cuda.is_available", "argparse.ArgumentParser", "SSGE.Attack", "matplotlib.pyplot.plot", "matplotlib.pyplot.xlabel", "model.Wide_ResNet1", "torchvision.transforms.ToTensor", "torchsummary.summary", "model.Wide_ResNet", "...
[((587, 633), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""privaCY"""'}), "(description='privaCY')\n", (610, 633), False, 'import argparse\n'), ((2184, 2212), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (2201, 2212), False, 'import torch\n'), ((2222,...
#!/usr/bin/env python import sys import rospy from geometry_msgs.msg import (Twist, Pose, Point, Quaternion, PoseStamped) import tf.transformations as tf import numpy from threading import Lock class Converter: def __init__(self): self.currentPose = None self.pub = None self.mutex = Lock() def callbackOdom(...
[ "tf.transformations.quaternion_multiply", "rospy.Subscriber", "rospy.init_node", "threading.Lock", "tf.transformations.quaternion_matrix", "rospy.myargv", "numpy.matmul", "rospy.spin", "tf.transformations.quaternion_from_euler", "geometry_msgs.msg.PoseStamped", "rospy.Publisher" ]
[((1522, 1544), 'rospy.myargv', 'rospy.myargv', (['sys.argv'], {}), '(sys.argv)\n', (1534, 1544), False, 'import rospy\n'), ((1586, 1638), 'rospy.init_node', 'rospy.init_node', (['"""cmd_vel_converter"""'], {'anonymous': '(True)'}), "('cmd_vel_converter', anonymous=True)\n", (1601, 1638), False, 'import rospy\n'), ((16...
"""importation""" from plotly.offline import plot # pour travailler en offline! import plotly.graph_objects as go import numpy as np from scipy.integrate import odeint # Population totale, N. N = 10000 # Nombre initial de sujets infectés et sauvés (immunisés, guéris, décédés). I0, D0, R0 = 1, 0, 0 # Tous les autre...
[ "scipy.integrate.odeint", "plotly.graph_objects.Figure", "numpy.linspace", "plotly.offline.plot" ]
[((519, 541), 'numpy.linspace', 'np.linspace', (['(0)', '(90)', '(90)'], {}), '(0, 90, 90)\n', (530, 541), True, 'import numpy as np\n'), ((843, 890), 'scipy.integrate.odeint', 'odeint', (['deriv', 'y0', 't'], {'args': '(N, beta, mu, theta)'}), '(deriv, y0, t, args=(N, beta, mu, theta))\n', (849, 890), False, 'from sci...
import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import numpy as np import matplotlib.pyplot as plt import sys import warnings warnings.filterwarnings("ignore", message=r"Passing", category=FutureWarning) import tensorflow as tf from tensorflow.contrib import slim np.random.seed(0) config = tf.ConfigProto( devi...
[ "numpy.ones", "tensorflow.Session", "tensorflow.global_variables_initializer", "tensorflow.constant", "numpy.random.seed", "tensorflow.constant_initializer", "tensorflow.ConfigProto", "warnings.filterwarnings" ]
[((130, 206), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""Passing"""', 'category': 'FutureWarning'}), "('ignore', message='Passing', category=FutureWarning)\n", (153, 206), False, 'import warnings\n'), ((269, 286), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n...
from threading import Thread from queue import Queue import numpy as np from ...libffcv import read class PageReader(Thread): def __init__(self, fname:str, queries: Queue, loaded: Queue, memory: np.ndarray): self.fname: str = fname self.queries: Queue = queries self.mem...
[ "numpy.uint64" ]
[((814, 853), 'numpy.uint64', 'np.uint64', (['(page_number * self.page_size)'], {}), '(page_number * self.page_size)\n', (823, 853), True, 'import numpy as np\n')]
import SimpleITK as sitk import numpy as np #from segmentation.lungmask import mask import glob from tqdm import tqdm import os from segmentation.predict import predict,get_model #from segmentation.unet import UNet os.environ["CUDA_VISIBLE_DEVICES"] = '6' lung_dir = '/mnt/data11/seg_of_XCT/lung/CAP/' leision_dir = '/...
[ "segmentation.predict.get_model", "SimpleITK.GetImageFromArray", "os.makedirs", "tqdm.tqdm", "SimpleITK.GetArrayFromImage", "numpy.array", "segmentation.predict.predict", "SimpleITK.ReadImage", "glob.glob" ]
[((413, 432), 'glob.glob', 'glob.glob', (['root_dir'], {}), '(root_dir)\n', (422, 432), False, 'import glob\n'), ((433, 472), 'os.makedirs', 'os.makedirs', (['leision_dir'], {'exist_ok': '(True)'}), '(leision_dir, exist_ok=True)\n', (444, 472), False, 'import os\n'), ((514, 544), 'segmentation.predict.get_model', 'get_...
#!/usr/bin/env python # coding=utf-8 # Filename: jpp.py # pylint: disable= """ Pump for the jpp file read through aanet interface. """ from __future__ import division, absolute_import, print_function import numpy as np from km3pipe import Pump, Blob from km3pipe.dataclasses import (EventInfo, TimesliceFrameInfo, ...
[ "km3pipe.dataclasses.TimesliceFrameInfo", "km3pipe.dataclasses.TimesliceHitSeries.from_arrays", "jppy.PyJDAQSummarysliceReader", "km3pipe.dataclasses.SummaryframeInfo", "numpy.zeros", "jppy.PyJDAQEventReader", "km3pipe.logger.logging.getLogger", "jppy.PyJDAQTimesliceReader", "km3pipe.dataclasses.Eve...
[((474, 501), 'km3pipe.logger.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (491, 501), False, 'from km3pipe.logger import logging\n'), ((1522, 1559), 'jppy.PyJDAQEventReader', 'jppy.PyJDAQEventReader', (['self.filename'], {}), '(self.filename)\n', (1544, 1559), False, 'import jppy\n'), (...
import numpy as np import statistics import matplotlib.pyplot as plt import seaborn as sns np_normal_dis = np.random.normal(5, 0.5, 100) print(np_normal_dis.min()) print(np_normal_dis.max()) print(np_normal_dis.mean()) # print(np_normal_dis.median()) # not working print(np_normal_dis.std()) two_dimension_array = np....
[ "matplotlib.pyplot.hist", "numpy.random.rand", "numpy.array", "numpy.mean", "numpy.repeat", "numpy.random.random", "numpy.max", "numpy.min", "numpy.random.normal", "numpy.tile", "numpy.amin", "numpy.random.choice", "numpy.std", "numpy.random.randn", "matplotlib.pyplot.show", "numpy.med...
[((109, 138), 'numpy.random.normal', 'np.random.normal', (['(5)', '(0.5)', '(100)'], {}), '(5, 0.5, 100)\n', (125, 138), True, 'import numpy as np\n'), ((317, 349), 'numpy.array', 'np.array', (['[(1, 2, 3), [4, 5, 6]]'], {}), '([(1, 2, 3), [4, 5, 6]])\n', (325, 349), True, 'import numpy as np\n'), ((767, 796), 'numpy.r...
import numpy as np from scipy import interpolate from progressbar import ProgressBar, Bar, Percentage class ImpulseResponseFunction(object): '''Internal bemio object to contain impulse response function (IRF) data ''' pass class WaveElevationTimeSeries(object): '''Internal bemio object to contain wave...
[ "numpy.array", "numpy.convolve", "scipy.interpolate.interp1d" ]
[((1897, 2009), 'scipy.interpolate.interp1d', 'interpolate.interp1d', ([], {'x': 'self.wave_elevation.t', 'y': 'self.wave_elevation.eta', 'bounds_error': '(False)', 'fill_value': '(0.0)'}), '(x=self.wave_elevation.t, y=self.wave_elevation.eta,\n bounds_error=False, fill_value=0.0)\n', (1917, 2009), False, 'from scip...
""" MODEL DRIVEN REGISTRATION for iBEAt study: quantitative renal MRI @<NAME> 2021 Test script for T1 sequence using Model driven registration Library """ import sys import glob import os import numpy as np import itk import SimpleITK as sitk import pydicom from pathlib import Path import time from PIL import Image im...
[ "os.listdir", "MDR.MDR.model_driven_registration", "importlib.import_module", "pathlib.Path", "MDR.Tools.get_sitk_image_details_from_DICOM", "MDR.Tools.read_elastix_model_parameters", "MDR.Tools.read_DICOM_files", "os.getcwd", "os.chdir", "numpy.zeros", "MDR.Tools.export_images", "numpy.shape"...
[((601, 643), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (620, 643), True, 'import numpy as np\n'), ((1334, 1353), 'os.chdir', 'os.chdir', (['DATA_PATH'], {}), '(DATA_PATH)\n', (1342, 1353), False, 'import os\n'), ((1438, 1450), 'os.listdir', 'os.li...
import altair as alt import pandas as pd import numpy as np import sys TRUSTTSV = sys.argv[1] CELLNUM = sys.argv[2] BCRTEMP = """ <div style="width: 100%; height: 700px; position: relative; clear:both;overflow: hidden; white-space:nowrap; padding-top: 10px;clear:both;"> <div style="width: 110%, position: absolute; ...
[ "pandas.read_csv", "numpy.where", "altair.Chart", "altair.Y", "pandas.DataFrame", "altair.Bin", "pandas.concat", "altair.Scale" ]
[((979, 1038), 'pandas.read_csv', 'pd.read_csv', (['TRUSTTSV'], {'delimiter': '"""\t"""', 'index_col': '"""#barcode"""'}), "(TRUSTTSV, delimiter='\\t', index_col='#barcode')\n", (990, 1038), True, 'import pandas as pd\n'), ((1525, 1701), 'pandas.DataFrame', 'pd.DataFrame', (['[No_BCR, L_only, H_only, paired, CELLNUM]']...
from help_modules import * from motor_control import * import pyaudio import wave import numpy as np import time import matplotlib.pyplot as plt import speech_recognition as sr from scipy import signal import math import threading import multiprocessing as ms import os import cv2 from nanpy import (ArduinoApi, SerialMa...
[ "cv2.rectangle", "numpy.array", "time.sleep", "speech_recognition.Recognizer", "dlib.get_frontal_face_detector", "numpy.zeros", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.VideoCapture", "pygame.mixer.music.load", "time.time", "pygame.mixer.music.play", "threading.Thread", "cv2.resize", ...
[((670, 702), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (700, 702), False, 'import dlib\n'), ((733, 752), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (749, 752), False, 'import cv2\n'), ((795, 810), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}...
############################################################################### ## Tool name: Generate GTFS Route Shapes ## Step 1: Generate Shapes on Map ## Creator: <NAME>, Esri ## Last updated: 4 September 2019 ############################################################################### ''' This tool genera...
[ "arcpy.management.CreateFeatureclass", "arcpy.management.CopyFeatures", "arcpy.CheckOutExtension", "arcpy.da.SearchCursor", "numpy.sin", "operator.itemgetter", "AGOLRouteHelper.generate_routes_from_AGOL_as_polylines", "arcpy.na.AddLocations", "arcpy.da.Editor", "arcpy.da.UpdateCursor", "re.searc...
[((22476, 22521), 'arcpy.AddMessage', 'arcpy.AddMessage', (['"""SQLizing the GTFS data..."""'], {}), "('SQLizing the GTFS data...')\n", (22492, 22521), False, 'import arcpy\n'), ((22527, 22597), 'arcpy.AddMessage', 'arcpy.AddMessage', (['"""(This step might take a while for large datasets.)"""'], {}), "('(This step mig...
"""Script demonstrating the joint use of simulation and control. The simulation is run by a `CtrlAviary` or `VisionAviary` environment. The control is given by the PID implementation in `DSLPIDControl`. Example ------- In a terminal, run as: $ python fly.py Notes ----- The drones move, at different altitudes, a...
[ "argparse.ArgumentParser", "gym_pybullet_drones.control.DSLPIDControl.DSLPIDControl", "gym_pybullet_drones.envs.VisionAviary.VisionAviary", "numpy.hstack", "numpy.floor", "numpy.array", "numpy.zeros", "gym_pybullet_drones.utils.utils.sync", "gym_pybullet_drones.envs.CtrlAviary.CtrlAviary", "numpy....
[((1120, 1234), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Helix flight script using CtrlAviary or VisionAviary and DSLPIDControl"""'}), "(description=\n 'Helix flight script using CtrlAviary or VisionAviary and DSLPIDControl')\n", (1143, 1234), False, 'import argparse\n'), ((4232...
#!/usr/bin/python3 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os,sys import plyfile import numpy as np import argparse import h5py reduced_length_dict = {"MarketplaceFeldkirch":[10538633,"marketsquarefeldkirch4-reduced"], ...
[ "numpy.zeros", "os.listdir", "os.path.join", "argparse.ArgumentParser" ]
[((1230, 1255), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1253, 1255), False, 'import argparse\n'), ((1776, 1854), 'os.path.join', 'os.path.join', (['args.datafolder', '"""results"""', "(length_dict[category][1] + '.labels')"], {}), "(args.datafolder, 'results', length_dict[category][1] +...
import sys import ast import wx from wx.lib.plot import PlotCanvas, PlotGraphics, PolyLine, PolyMarker import numpy as np import math class Analisis(object): def __init__(self): self.times = [] self.state_codes = [] self.estados = [] self.fechas = [] self.tiempo_promedio = 0...
[ "numpy.array", "wx.lib.plot.PlotGraphics", "wx.lib.plot.PolyLine" ]
[((1722, 1739), 'numpy.array', 'np.array', (['codigos'], {}), '(codigos)\n', (1730, 1739), True, 'import numpy as np\n'), ((1756, 1812), 'wx.lib.plot.PolyLine', 'PolyLine', (['data'], {'legend': '"""codigos de estado"""', 'colour': '"""red"""'}), "(data, legend='codigos de estado', colour='red')\n", (1764, 1812), False...
from copy import deepcopy import numpy as np from batchopt.optimizers.base_optimizer import BaseOptimizer, RandomRelocator class SineCosineAlgorithm(BaseOptimizer): """ Sine-Cosine Algorithm """ A = 2.0 def __init__( self, domain_range, log=True, epoch=750, ...
[ "numpy.abs", "numpy.where", "numpy.random.uniform", "numpy.cos", "copy.deepcopy", "numpy.sin", "numpy.broadcast_to" ]
[((846, 904), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(self.pop_size, self.problem_size)'}), '(size=(self.pop_size, self.problem_size))\n', (863, 904), True, 'import numpy as np\n'), ((992, 1015), 'copy.deepcopy', 'deepcopy', (['prev_position'], {}), '(prev_position)\n', (1000, 1015), False, 'from c...