code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from numpy import array, cos, identity, sin from core.dynamics import SystemDynamics, RoboticDynamics class DoubleInvertedPendulum(RoboticDynamics): def __init__(self, m_1, m_2, l_1, l_2, g=9.81): SystemDynamics.__init__(self, 4, 2) RoboticDynamics.__init__(self, identity(2)) self.params = ...
[ "numpy.identity", "numpy.sin", "numpy.array", "numpy.cos", "core.dynamics.SystemDynamics.__init__" ]
[((210, 245), 'core.dynamics.SystemDynamics.__init__', 'SystemDynamics.__init__', (['self', '(4)', '(2)'], {}), '(self, 4, 2)\n', (233, 245), False, 'from core.dynamics import SystemDynamics, RoboticDynamics\n'), ((666, 701), 'numpy.array', 'array', (['[[D_11, D_12], [D_21, D_22]]'], {}), '([[D_11, D_12], [D_21, D_22]]...
import argparse from multiprocessing import Process, Queue import time import logging log = logging.getLogger(__name__) import cooler import numpy as np import pandas as pd from hicmatrix import HiCMatrix from hicmatrix.lib import MatrixFileHandler from schicexplorer._version import __version__ from schicexplorer.ut...
[ "pandas.DataFrame", "numpy.absolute", "argparse.ArgumentParser", "numpy.isinf", "numpy.argmin", "numpy.isnan", "time.sleep", "schicexplorer.utilities.cell_name_list", "cooler.Cooler", "numpy.array", "multiprocessing.Queue", "hicmatrix.lib.MatrixFileHandler", "logging.getLogger" ]
[((92, 119), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (109, 119), False, 'import logging\n'), ((398, 514), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'add_help': '(False)', 'description': '""""""'}), "(for...
import numpy as np import gym class SmartDiscrete: def __init__(self, ignore_keys=None, always_attack=0): if ignore_keys is None: ignore_keys = [] self.always_attack = always_attack self.angle = 5 self.all_actions_dict = { "[('attack', {}), ('back', 0), ('ca...
[ "numpy.issubdtype" ]
[((6138, 6170), 'numpy.issubdtype', 'np.issubdtype', (['action_dtype', 'int'], {}), '(action_dtype, int)\n', (6151, 6170), True, 'import numpy as np\n'), ((6221, 6255), 'numpy.issubdtype', 'np.issubdtype', (['action_dtype', 'float'], {}), '(action_dtype, float)\n', (6234, 6255), True, 'import numpy as np\n')]
from keras.models import Sequential from keras.layers import Dense, Activation import numpy as np import csv import random # create model with 4 inputs and 3 outputs model = Sequential() model.add(Dense(4, input_shape=(4,))) model.add(Activation("sigmoid")) model.add(Dense(8)) model.add(Activation("sigmoid")) mode...
[ "csv.reader", "keras.layers.Activation", "random.shuffle", "keras.layers.Dense", "numpy.array", "keras.models.Sequential" ]
[((176, 188), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (186, 188), False, 'from keras.models import Sequential\n'), ((792, 812), 'random.shuffle', 'random.shuffle', (['data'], {}), '(data)\n', (806, 812), False, 'import random\n'), ((200, 226), 'keras.layers.Dense', 'Dense', (['(4)'], {'input_shape': ...
import numpy as np import pandas as pd import pytest from dask.dataframe.utils import assert_eq import cudf as gd import dask_cudf as dgd def _make_random_frame(nelem, npartitions=2): df = pd.DataFrame( { "x": np.random.randint(0, 5, size=nelem), "y": np.random.normal(size=nelem...
[ "numpy.random.seed", "dask_cudf.from_cudf", "cudf.DataFrame.from_pandas", "numpy.random.randint", "dask.dataframe.utils.assert_eq", "numpy.random.normal", "pytest.mark.parametrize" ]
[((653, 698), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""reducer"""', '_reducers'], {}), "('reducer', _reducers)\n", (676, 698), False, 'import pytest\n'), ((353, 381), 'cudf.DataFrame.from_pandas', 'gd.DataFrame.from_pandas', (['df'], {}), '(df)\n', (377, 381), True, 'import cudf as gd\n'), ((392, 435...
# -*- coding: utf-8 -*- """ Practica 6 - Espacio Fasico <NAME> y <NAME> """ import numpy as np import matplotlib.pyplot as plt from scipy.integrate import simps from numpy import trapz ''' Funcion que calcula la derivada como limite como cociente de diferencias input: q: vector de posiciones dq0:...
[ "numpy.empty", "numpy.around", "matplotlib.pyplot.figure", "numpy.arange", "numpy.insert", "numpy.max", "numpy.int", "numpy.linspace", "numpy.log10", "matplotlib.pyplot.subplots", "scipy.integrate.simps", "numpy.trapz", "matplotlib.pyplot.show", "matplotlib.pyplot.get_cmap", "matplotlib....
[((2612, 2641), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(12, 5)'}), '(figsize=(12, 5))\n', (2624, 2641), True, 'import matplotlib.pyplot as plt\n'), ((2641, 2660), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(-1.5)', '(1.5)'], {}), '(-1.5, 1.5)\n', (2649, 2660), True, 'import matplotlib.pyplot as p...
import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader import torchpruner as pruner import torchpruner.model_tools as model_tools import torchslim import torchslim.slim_solver as slim_solver from torchslim.modules.rep_modules import ( merge_conv_bn, merge_conv_compactor, ...
[ "torchslim.modules.rep_modules.ModuleCompactor", "numpy.sum", "torchslim.modules.rep_modules.merge_conv_bn", "torchpruner.model_tools.replace_object_by_name_groups", "numpy.ones", "numpy.argsort", "numpy.arange", "torchpruner.model_tools.replace_object_by_names", "torchpruner.ONNXGraph", "torch.op...
[((479, 497), 'numpy.arange', 'np.arange', (['(0)', 'size'], {}), '(0, size)\n', (488, 497), True, 'import numpy as np\n'), ((2515, 2535), 'copy.deepcopy', 'copy.deepcopy', (['model'], {}), '(model)\n', (2528, 2535), False, 'import copy\n'), ((2555, 2603), 'torchpruner.model_tools.get_names_by_class', 'model_tools.get_...
import math import multiprocessing import time from functools import lru_cache, partial from multiprocessing import Pool import pandas as pd from numpy.random import shuffle from retry.api import retry_call from ..mongodb import get_db from ..scripts.trading_calendar import is_trading_day from ..setting.constants imp...
[ "pandas.Timestamp", "retry.api.retry_call", "pandas.to_datetime", "multiprocessing.Pool", "pandas.Timedelta", "functools.lru_cache", "numpy.random.shuffle" ]
[((2556, 2571), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (2565, 2571), False, 'from functools import lru_cache, partial\n'), ((942, 961), 'pandas.to_datetime', 'pd.to_datetime', (['dts'], {}), '(dts)\n', (956, 961), True, 'import pandas as pd\n'), ((3183, 3197), 'numpy.random.shuffle', 'shuffle',...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Unit tests for jointmoments. """ from __future__ import division import os import sys import numpy as np HERE = os.path.dirname(os.path.realpath(__file__)) sys.path.insert(0, os.path.join(HERE, os.pardir)) sys.path.insert(0, os.path.join(HERE, os.pardir, "jointmoments...
[ "numpy.array", "os.path.realpath", "os.path.join" ]
[((180, 206), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (196, 206), False, 'import os\n'), ((227, 256), 'os.path.join', 'os.path.join', (['HERE', 'os.pardir'], {}), '(HERE, os.pardir)\n', (239, 256), False, 'import os\n'), ((277, 322), 'os.path.join', 'os.path.join', (['HERE', 'os.pard...
import pandas as pd import numpy as np from matplotlib import pyplot as plt def read_file(filename): labels = ["futures", "title", "wait", "exec", "duration", "us_future", "queue", "numa_sensitive", "num_threads", "info_string", "libcds"] data = pd.read_csv(filename, sep=',', header=None) data.columns = labels ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.legend", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "pandas.concat", "matplotlib.pyplot.savefig" ]
[((1460, 1509), 'matplotlib.pyplot.plot', 'plt.plot', (['threads', 'overhead_exec_none'], {'marker': '"""x"""'}), "(threads, overhead_exec_none, marker='x')\n", (1468, 1509), True, 'from matplotlib import pyplot as plt\n'), ((1510, 1572), 'matplotlib.pyplot.plot', 'plt.plot', (['threads', 'overhead_exec_parallel_execut...
import copy from typing import List import numpy as np from pyecg.annotations import ECGAnnotation def is_monotonic_increasing(x): return np.all(np.diff(x) > 0) class SubjectInfo: sex = None # 1=male, 2=female race = None # 1=white, 2=black, 3=oriental birth_data = None record_data = None ...
[ "pyecg.importers.WFDBLoader", "copy.copy", "numpy.diff", "numpy.array", "numpy.arange", "pyecg.importers.ISHINELoader" ]
[((603, 618), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (612, 618), False, 'import copy\n'), ((2842, 2878), 'numpy.array', 'np.array', (['[s for s in self._signals]'], {}), '([s for s in self._signals])\n', (2850, 2878), True, 'import numpy as np\n'), ((3676, 3691), 'copy.copy', 'copy.copy', (['self'], {}),...
import numpy as np from cs231n.layers import * from cs231n.layer_utils import * def affine_batchnorm_relu_forward(x, w, b, gamma, beta, bn_params): """ Convenience layer that perorms an affine transform followed by a ReLU Inputs: - x: Input to the affine layer - w, b: Weights for the affine la...
[ "numpy.random.randn", "numpy.square", "numpy.zeros", "numpy.ones", "numpy.arange", "numpy.prod" ]
[((2547, 2567), 'numpy.zeros', 'np.zeros', (['hidden_dim'], {}), '(hidden_dim)\n', (2555, 2567), True, 'import numpy as np\n'), ((2680, 2701), 'numpy.zeros', 'np.zeros', (['num_classes'], {}), '(num_classes)\n', (2688, 2701), True, 'import numpy as np\n'), ((3564, 3584), 'numpy.prod', 'np.prod', (['X.shape[1:]'], {}), ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import sys import numpy as np from scipy import special import six ######################## # LOG-SPACE ARITHMETIC # ######################## def compute_rdp(q, noise_multiplier, steps, orders): ...
[ "scipy.special.binom", "math.exp", "math.sqrt", "numpy.isscalar", "numpy.isinf", "scipy.special.erfc", "math.log", "scipy.special.log_ndtr" ]
[((703, 722), 'numpy.isscalar', 'np.isscalar', (['orders'], {}), '(orders)\n', (714, 722), True, 'import numpy as np\n'), ((1295, 1310), 'numpy.isinf', 'np.isinf', (['alpha'], {}), '(alpha)\n', (1303, 1310), True, 'import numpy as np\n'), ((2017, 2040), 'scipy.special.binom', 'special.binom', (['alpha', 'i'], {}), '(al...
import numpy as np from uncertainties import correlated_values, covariance_matrix, nominal_value, std_dev from uncertainties.unumpy import nominal_values, std_devs def setup(baseunit): global convertpscale, Distance, distances, pixels, microns if baseunit == "pixels": from .pixels import convertpscale, Distan...
[ "uncertainties.correlated_values", "numpy.array" ]
[((1186, 1226), 'uncertainties.correlated_values', 'correlated_values', (['distances', 'covariance'], {}), '(distances, covariance)\n', (1203, 1226), False, 'from uncertainties import correlated_values, covariance_matrix, nominal_value, std_dev\n'), ((849, 865), 'numpy.array', 'np.array', (['pixels'], {}), '(pixels)\n'...
import numpy as np from scipy.special import gamma import pickle as pk import os import argparse def metropolisHastingsSymmetric(p, nsamples): x = 0 out = np.zeros((nsamples,)) for i in range(nsamples): xHat = x + np.random.normal() if np.random.uniform() < p(xHat) / p(x): x = xHat out[i] = x return out ...
[ "numpy.random.uniform", "numpy.fill_diagonal", "argparse.ArgumentParser", "os.makedirs", "os.path.join", "numpy.zeros", "os.path.exists", "numpy.sin", "numpy.arange", "numpy.reshape", "numpy.random.normal", "numpy.exp", "scipy.special.gamma" ]
[((2739, 2806), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""artificial spikes generation"""'}), "(description='artificial spikes generation')\n", (2762, 2806), False, 'import argparse\n'), ((158, 179), 'numpy.zeros', 'np.zeros', (['(nsamples,)'], {}), '((nsamples,))\n', (166, 179), Tr...
""" Author: <NAME> """ import sys sys.path.append("..") import tensorflow as tf from tensorflow.python.ops import math_ops from tensorflow.python.ops import nn_ops import time from sklearn import metrics import numpy as np import os ''' _,loss,summary_str,acc,_, cr,out = sess.run([model.train_op, model.loss, model.sum...
[ "tensorflow.reduce_sum", "numpy.sum", "tensorflow.contrib.layers.l2_regularizer", "re.finditer", "tensorflow.reshape", "tensorflow.nn.rnn_cell.DropoutWrapper", "tensorflow.local_variables_initializer", "tensorflow.initializers.glorot_uniform", "tensorflow.summary.merge", "os.path.join", "sys.pat...
[((34, 55), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (49, 55), False, 'import sys\n'), ((2053, 2116), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.n_steps, self.n_inputs]'], {}), '(tf.float32, [None, self.n_steps, self.n_inputs])\n', (2067, 2116), True, 'import t...
import os import glob import argparse from collections import OrderedDict import numpy as np def parse_args(): """ Parse input arguments""" parser = argparse.ArgumentParser() parser.add_argument( '-d', '--dataset', type=str, default='./data/50_salads_dataset') parser.add_argument( ...
[ "argparse.ArgumentParser", "numpy.median", "os.path.exists", "numpy.min", "numpy.max", "glob.glob", "collections.OrderedDict", "os.path.join", "os.listdir" ]
[((159, 184), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (182, 184), False, 'import argparse\n'), ((608, 636), 'os.path.exists', 'os.path.exists', (['args.dataset'], {}), '(args.dataset)\n', (622, 636), False, 'import os\n'), ((1145, 1168), 'os.path.exists', 'os.path.exists', (['lbl_pth'], ...
import numpy as np import pandas as pd import math as mt from timeit import default_timer as timer def read_data(): train = pd.read_csv('./data/train_data.csv') test = pd.read_csv('./data/test_data.csv') sum_ratings = 0 ratings = train['rating'] for r in ratings: sum_ratings += r m...
[ "numpy.random.uniform", "pandas.read_csv", "timeit.default_timer", "numpy.zeros", "numpy.dot" ]
[((130, 166), 'pandas.read_csv', 'pd.read_csv', (['"""./data/train_data.csv"""'], {}), "('./data/train_data.csv')\n", (141, 166), True, 'import pandas as pd\n'), ((178, 213), 'pandas.read_csv', 'pd.read_csv', (['"""./data/test_data.csv"""'], {}), "('./data/test_data.csv')\n", (189, 213), True, 'import pandas as pd\n'),...
from __future__ import annotations """A module containing the core class to specify a Factor Graph.""" import collections import copy import functools import inspect import typing from dataclasses import asdict, dataclass from types import MappingProxyType from typing import ( Any, Callable, Dict, Fro...
[ "pgmax.groups.enumeration.EnumerationFactorGroup", "typing.cast", "numpy.empty", "pgmax.fg.groups.SingleFactorGroup", "pgmax.fg.groups.CompositeVariableGroup", "jax.device_put", "jax.numpy.argmax", "numpy.max", "functools.partial", "jax.lax.scan", "jax.numpy.zeros_like", "jax.scipy.special.log...
[((15208, 15240), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)', 'eq': '(False)'}), '(frozen=True, eq=False)\n', (15217, 15240), False, 'from dataclasses import asdict, dataclass\n'), ((17234, 17266), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)', 'eq': '(False)'}), '(frozen=True, eq=F...
import geonumpy as gnp import geonumpy.io as gio import geonumpy.util as gutil import geonumpy.draw as gdraw import geonumpy.match as gmt import numpy as np import matplotlib.pyplot as plt from PIL import Image from glob import glob def draw_simple(): shandong = gio.read_shp('../data/shape/shandong.shp') s...
[ "geonumpy.match.build_index", "geonumpy.match.match_idx", "geonumpy.io.read_shp", "geonumpy.draw.draw_text", "geonumpy.draw.draw_bound", "geonumpy.draw.draw_unit", "numpy.zeros", "geonumpy.draw.draw_ruler", "PIL.Image.fromarray", "geonumpy.draw.draw_polygon", "geonumpy.draw.draw_lab", "geonump...
[((272, 314), 'geonumpy.io.read_shp', 'gio.read_shp', (['"""../data/shape/shandong.shp"""'], {}), "('../data/shape/shandong.shp')\n", (284, 314), True, 'import geonumpy.io as gio\n'), ((362, 404), 'geonumpy.util.shp2box', 'gutil.shp2box', (['shandong', '(3600, 2400)', '(0.1)'], {}), '(shandong, (3600, 2400), 0.1)\n', (...
import numpy as np from scipy import signal from scipy import ndimage from scipy import spatial from scipy import stats import skimage import warnings from skimage.segmentation import watershed from ephysiopy.common.utils import blurImage """ These methods differ from MapCalcsGeneric in that they are mostly concerned ...
[ "numpy.sum", "skimage.feature.peak_local_max", "numpy.abs", "numpy.ravel", "numpy.arctan2", "numpy.floor", "skimage.exposure.rescale_intensity", "numpy.isnan", "numpy.argmin", "numpy.shape", "numpy.argsort", "skimage.measure.label", "numpy.mean", "numpy.arange", "skimage.measure.find_con...
[((834, 845), 'numpy.isnan', 'np.isnan', (['A'], {}), '(A)\n', (842, 845), True, 'import numpy as np\n'), ((912, 945), 'ephysiopy.common.utils.blurImage', 'blurImage', (['A', 'h'], {'ftype': '"""gaussian"""'}), "(A, h, ftype='gaussian')\n", (921, 945), False, 'from ephysiopy.common.utils import blurImage\n'), ((1033, 1...
""" Unit Tests for EM module. """ import unittest import sys import argparse import math import numpy from mixemt import phylotree from mixemt import preprocess from mixemt import em class TestEMHelpers(unittest.TestCase): def test_init_props(self): props = em.init_props(10) self.assertEqual(len...
[ "unittest.main", "mixemt.preprocess.build_em_matrix", "numpy.full_like", "mixemt.em.em_step", "mixemt.em.run_em", "argparse.ArgumentParser", "numpy.sum", "mixemt.em.init_props", "numpy.allclose", "numpy.empty_like", "numpy.all", "mixemt.em.converged", "numpy.array", "numpy.exp", "math.lo...
[((4439, 4454), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4452, 4454), False, 'import unittest\n'), ((274, 291), 'mixemt.em.init_props', 'em.init_props', (['(10)'], {}), '(10)\n', (287, 291), False, 'from mixemt import em\n'), ((749, 765), 'numpy.array', 'numpy.array', (['cur'], {}), '(cur)\n', (760, 765), F...
import torch from torch.nn import functional as F import numpy as np import gtimer as gt import rlkit.torch.pytorch_util as ptu from diayn_original_tb.algo.algo_diayn_tb_eval import DIAYNTorchOnlineRLAlgorithmTbEval class DIAYNTorchOnlineRLAlgorithmTbPerfLoggingEffiently(DIAYNTorchOnlineRLAlgorithmTbEval): # Sa...
[ "numpy.argmax", "torch.argmax", "rlkit.torch.pytorch_util.from_numpy", "torch.nn.functional.log_softmax", "torch.Size", "gtimer.stamp", "numpy.concatenate" ]
[((1019, 1046), 'torch.argmax', 'torch.argmax', (['z_hat'], {'dim': '(-1)'}), '(z_hat, dim=-1)\n', (1031, 1046), False, 'import torch\n'), ((1262, 1291), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['d_pred'], {'dim': '(-1)'}), '(d_pred, dim=-1)\n', (1275, 1291), True, 'from torch.nn import functional as F\n')...
import numpy as np from scipy.stats import chi2 import matplotlib.pyplot as plt import termplotlib as tpl class ChiQQ: """Object for creating Chisquare QQ plots. params ------ src: input matrix of shape (n:int, p:int) where n is the sample size and p is the number of dependent variables np.nda...
[ "numpy.random.uniform", "numpy.random.chisquare", "matplotlib.pyplot.scatter", "scipy.stats.chi2.ppf", "numpy.mean", "numpy.linalg.inv", "numpy.array", "numpy.random.normal", "numpy.matmul", "termplotlib.figure" ]
[((1068, 1093), 'numpy.mean', 'np.mean', (['self.src'], {'axis': '(0)'}), '(self.src, axis=0)\n', (1075, 1093), True, 'import numpy as np\n'), ((1343, 1373), 'numpy.linalg.inv', 'np.linalg.inv', (['self.cov_matrix'], {}), '(self.cov_matrix)\n', (1356, 1373), True, 'import numpy as np\n'), ((2335, 2364), 'numpy.random.u...
from hierarchical_emb_clustering import CFIEClustering import pickle import numpy as np import networkx as nx import pandas as pd from reuters_utils import is_valid_category, get_label_doc_graph, get_disconnected_docs, parallelize, parallelize_intercluster import itertools import time class ReutersEvaluator: def ...
[ "reuters_utils.get_disconnected_docs", "time.time", "reuters_utils.parallelize_intercluster", "reuters_utils.is_valid_category", "numpy.array", "reuters_utils.parallelize", "networkx.compose", "itertools.chain", "reuters_utils.get_label_doc_graph" ]
[((4717, 4728), 'time.time', 'time.time', ([], {}), '()\n', (4726, 4728), False, 'import time\n'), ((10872, 10944), 'reuters_utils.get_label_doc_graph', 'get_label_doc_graph', (['cfi_obj._closed_fi_graph', 'doc_df', '"""selected_labels"""'], {}), "(cfi_obj._closed_fi_graph, doc_df, 'selected_labels')\n", (10891, 10944)...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import codecs import json import os import tempfile import random import string import copy import torch import logging import shutil from losses.BaseLossConf import BaseLossConf #import traceback from settings import Langua...
[ "utils.common_utils.md5", "utils.common_utils.log_set", "logging.debug", "losses.BaseLossConf.BaseLossConf.get_conf", "random.sample", "os.path.dirname", "tempfile.gettempdir", "utils.common_utils.load_from_json", "json.keys", "torch.cuda.device_count", "logging.info", "os.path.isfile", "tor...
[((3541, 3580), 'logging.debug', 'logging.debug', (['"""Print ModelConf below:"""'], {}), "('Print ModelConf below:')\n", (3554, 3580), False, 'import logging\n'), ((3589, 3612), 'logging.debug', 'logging.debug', (["('=' * 80)"], {}), "('=' * 80)\n", (3602, 3612), False, 'import logging\n'), ((3807, 3830), 'logging.deb...
"""Mixture model using EM""" from typing import Tuple import numpy as np from utils import GaussianMixture def estep(X: np.ndarray, mixture: GaussianMixture) -> Tuple[np.ndarray, float]: """E-step: Softly assigns each datapoint to a gaussian component Args: X: (n, d) array holding the data mi...
[ "numpy.sum", "numpy.abs", "numpy.zeros", "utils.GaussianMixture", "numpy.linalg.norm", "numpy.exp", "numpy.sqrt" ]
[((590, 606), 'numpy.zeros', 'np.zeros', (['(n, K)'], {}), '((n, K))\n', (598, 606), True, 'import numpy as np\n'), ((616, 655), 'numpy.sqrt', 'np.sqrt', (['((2 * np.pi * mixture.var) ** d)'], {}), '((2 * np.pi * mixture.var) ** d)\n', (623, 655), True, 'import numpy as np\n'), ((1471, 1487), 'numpy.zeros', 'np.zeros',...
import os import argparse import pandas as pd import numpy as np import subprocess from tqdm import tqdm import sys from surfboard.sound import Waveform from surfboard.feature_extraction import extract_features from config import * DOC_PATH = 'alc_original/DOC/IS2011CHALLENGE' DATA_PATH = 'alc_original' TRAIN_TABLE ...
[ "numpy.stack", "subprocess.run", "tqdm.tqdm", "os.mkdir", "os.remove", "argparse.ArgumentParser", "os.makedirs", "pandas.read_csv", "os.path.exists", "surfboard.feature_extraction.extract_features", "os.path.join" ]
[((4229, 4295), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""args for processing dataset"""'}), "(description='args for processing dataset')\n", (4252, 4295), False, 'import argparse\n'), ((951, 984), 'os.path.exists', 'os.path.exists', (['self.dataset_path'], {}), '(self.dataset_path)...
import qi import time import numpy as np import cv2 import argparse import imutils import os class YOLO(): def __init__(self, istiny = False): # loading the yolo & network if (istiny == True): self.net = cv2.dnn.readNet("./darknet/yolov3-tiny.weights", "./darknet/cfg/yolov3-tiny.cfg") ...
[ "cv2.putText", "cv2.dnn.NMSBoxes", "numpy.argmax", "cv2.waitKey", "cv2.dnn.blobFromImage", "cv2.imshow", "time.time", "cv2.dnn.readNet", "cv2.imread", "cv2.VideoCapture", "cv2.rectangle", "cv2.destroyAllWindows", "cv2.resize" ]
[((1203, 1214), 'time.time', 'time.time', ([], {}), '()\n', (1212, 1214), False, 'import time\n'), ((3652, 3675), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3673, 3675), False, 'import cv2\n'), ((3784, 3808), 'cv2.imread', 'cv2.imread', (['self.imgname'], {}), '(self.imgname)\n', (3794, 3808),...
""" Utility functions for simulations. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import json from sklearn.model_selection import ParameterGrid import pathlib import numpy as np import pandas as pd import glob import os from ac...
[ "numpy.random.seed", "numpy.sum", "active_learning_dd.utils.evaluation.eval_on_metrics", "pandas.read_csv", "active_learning_dd.database_loaders.prepare_loader.prepare_loader", "numpy.ones", "numpy.product", "pathlib.Path", "glob.glob", "numpy.unique", "pandas.DataFrame", "os.path.exists", "...
[((932, 1017), 'active_learning_dd.database_loaders.prepare_loader.prepare_loader', 'prepare_loader', ([], {'data_loader_params': 'training_loader_params', 'task_names': 'task_names'}), '(data_loader_params=training_loader_params, task_names=task_names\n )\n', (946, 1017), False, 'from active_learning_dd.database_lo...
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- ''' @File : nba_test.py @Time : 2021/02/06 00:25:00 @Author : <NAME> @Version : 1.0 @Contact : <EMAIL> @Desc : None ''' # 這邊是在測試把algorithms 引入進來的時候 if __name__ == '__main__':內的東西是否會跳過 # import algorithms # print('這邊測試下~') # algorithms.call_foo() ...
[ "numpy.random.randint" ]
[((451, 493), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(1)', 'high': '(11)', 'size': '(25)'}), '(low=1, high=11, size=25)\n', (468, 493), True, 'import numpy as np\n')]
import argparse, datetime, os, sympy import numpy as np ################################### # Encryption using Diffie-Hellman # ################################### # The bounds for the public and private key # These should be very large and prime large_bounds = [1e300, 1e301] # Fix the public base for simplicity # Th...
[ "os.mkdir", "sympy.randprime", "os.path.join", "argparse.ArgumentParser", "os.path.isdir", "numpy.empty", "numpy.savetxt", "numpy.linalg.matrix_rank", "numpy.array", "numpy.loadtxt", "numpy.dot", "sympy.isprime", "datetime.datetime.now", "numpy.sqrt" ]
[((745, 786), 'sympy.randprime', 'sympy.randprime', (['(bounds[0] - 1)', 'bounds[1]'], {}), '(bounds[0] - 1, bounds[1])\n', (760, 786), False, 'import argparse, datetime, os, sympy\n'), ((4255, 4278), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (4276, 4278), False, 'import argparse, datetime, os...
# lint-amnesty, pylint: disable=missing-module-docstring import logging import time import numpy as np from edxval.api import get_videos_for_course from rest_framework.generics import GenericAPIView from rest_framework.response import Response from scipy import stats from openedx.core.lib.api.view_utils import Develo...
[ "xmodule.modulestore.django.modulestore", "scipy.stats.mode", "numpy.median", "openedx.core.lib.cache_utils.request_cached", "time.time", "edxval.api.get_videos_for_course", "rest_framework.response.Response", "numpy.mean", "openedx.core.lib.api.view_utils.view_auth_classes", "openedx.core.lib.gra...
[((602, 629), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (619, 629), False, 'import logging\n'), ((633, 652), 'openedx.core.lib.api.view_utils.view_auth_classes', 'view_auth_classes', ([], {}), '()\n', (650, 652), False, 'from openedx.core.lib.api.view_utils import DeveloperErrorViewM...
import numpy as np from numba import njit import scipy.sparse as sp import scipy.linalg as spl from graphadv.utils.estimate_utils import (estimate_loss_with_delta_eigenvals, estimate_loss_with_perturbation_gradient) from graphadv.utils import filter_singletons from graphadv....
[ "graphadv.utils.filter_singletons", "graphadv.utils.estimate_utils.estimate_loss_with_delta_eigenvals", "scipy.sparse.diags", "numpy.tile" ]
[((1986, 2108), 'graphadv.utils.estimate_utils.estimate_loss_with_delta_eigenvals', 'estimate_loss_with_delta_eigenvals', (['candidates', 'delta_w', 'self.vals_org', 'self.vecs_org', 'self.n_nodes', 'dim', 'window_size'], {}), '(candidates, delta_w, self.vals_org, self\n .vecs_org, self.n_nodes, dim, window_size)\n'...
# -*- coding: utf-8 -*- """ /*************************************************************************** FloodTool2DockWidget A QGIS plugin MyCoast FloodTool Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ ------------------- ...
[ "PyQt5.QtCore.pyqtSignal", "netCDF4.Dataset", "qgis.core.QgsVectorLayer", "qgis.core.QgsProject.instance", "pandas.date_range", "PyQt5.QtCore.QDate", "qgis.core.QgsFeature", "datetime.datetime.strptime", "numpy.max", "numpy.array", "qgis.core.QgsField", "qgis.core.QgsMessageLog.logMessage", ...
[((1954, 1966), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (1964, 1966), False, 'from PyQt5.QtCore import pyqtSignal\n'), ((5206, 5223), 'numpy.array', 'np.array', (['wave_id'], {}), '(wave_id)\n', (5214, 5223), True, 'import numpy as np\n'), ((5243, 5261), 'numpy.array', 'np.array', (['hydro_id'], {}),...
import argparse import gzip import numpy as np import tensorflow as tf from attalos.dataset.dataset import Dataset from attalos.evaluation.evaluation import Eval def tags_2_vec(tags, w2v_model=None): """ Takes a list of text tags and returns the normalized sum of the word vectors Args: tags: A i...
[ "numpy.sum", "argparse.ArgumentParser", "gzip.open", "attalos.evaluation.evaluation.Eval", "numpy.zeros", "os.path.exists", "tensorflow.ConfigProto", "numpy.linalg.norm", "attalos.dataset.dataset.Dataset", "numpy.dot", "tensorflow.contrib.learn.TensorFlowDNNRegressor" ]
[((2646, 2693), 'attalos.evaluation.evaluation.Eval', 'Eval', (['ground_truth_one_hot', 'predictions_one_hot'], {}), '(ground_truth_one_hot, predictions_one_hot)\n', (2650, 2693), False, 'from attalos.evaluation.evaluation import Eval\n'), ((3802, 3854), 'numpy.zeros', 'np.zeros', (['(test_dataset.num_images, image_fea...
#!/usr/bin/env python # coding: utf-8 # by <EMAIL> __version__ = "0.0.1" from datetime import datetime from glob import glob from os.path import dirname from pathlib import Path import openTSNE import plotly.express as px from numpy import array, sqrt, unique from pandas import concat, read_pickle from plotly.offlin...
[ "tqdm.tqdm", "openTSNE.TSNEEmbedding", "sklearn.manifold.TSNE", "openTSNE.TSNE", "os.path.dirname", "pandas.read_pickle", "plotly.express.line", "SeqEN2.model.model.Model", "openTSNE.affinity.PerplexityBasedNN", "SeqEN2.utils.custom_arg_parser.TestSessionArgParser", "glob.glob", "plotly.expres...
[((12402, 12424), 'SeqEN2.utils.custom_arg_parser.TestSessionArgParser', 'TestSessionArgParser', ([], {}), '()\n', (12422, 12424), False, 'from SeqEN2.utils.custom_arg_parser import TestSessionArgParser\n'), ((3750, 3859), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': 'dim', 'learning_rate': '"""auto"""', 'ini...
# -*- coding: utf-8 -*- """ Created on Mon Nov 13 10:20:15 2017 @author: <NAME> @email: <EMAIL> Descripcion ----------- Pequeno script para realizar el calculo de la energia y forma de los orbitales del atomo de hidrogeno partiendo de sus funciones. Referencias ----------- (1) <NAME>. (2012). The Spherical Harmonics...
[ "matplotlib.pyplot.title", "numpy.meshgrid", "numpy.vectorize", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "scipy.special.assoc_laguerre", "matplotlib.pyplot.legend", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.contourf", "numpy.real", ...
[((962, 978), 'numpy.arctan', 'np.arctan', (['(y / x)'], {}), '(y / x)\n', (971, 978), True, 'import numpy as np\n'), ((999, 1038), 'numpy.arctan', 'np.arctan', (['((x ** 2 + y ** 2) ** 0.5 / z)'], {}), '((x ** 2 + y ** 2) ** 0.5 / z)\n', (1008, 1038), True, 'import numpy as np\n'), ((1431, 1460), 'scipy.special.assoc_...
import numpy as np class SquaredL2ErrorMeasure: def __init__(self, inputs: int): self._inputs = inputs def forward(self, input, target): r = input - target return np.sum(r*r) def backward(self, input, target): return 2*(input - target)
[ "numpy.sum" ]
[((197, 210), 'numpy.sum', 'np.sum', (['(r * r)'], {}), '(r * r)\n', (203, 210), True, 'import numpy as np\n')]
# coding=utf-8 import os import csv import numpy as np import matplotlib.pyplot as plt import matplotlib plt.rcParams["figure.figsize"] = [6,6] matplotlib.rcParams[u'font.sans-serif'] = ['simhei'] flows = [] if os.path.exists('flows.npy'): flows = np.load('flows.npy') else: # Read size from local file filename = ...
[ "numpy.load", "numpy.save", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.asarray", "csv.DictReader", "os.path.exists", "numpy.sort", "numpy.max", "numpy.min", "numpy.arange", "matplotlib.pyplot.ylabel", "numpy.log10" ]
[((214, 241), 'os.path.exists', 'os.path.exists', (['"""flows.npy"""'], {}), "('flows.npy')\n", (228, 241), False, 'import os\n'), ((578, 605), 'numpy.save', 'np.save', (['"""flows.npy"""', 'flows'], {}), "('flows.npy', flows)\n", (585, 605), True, 'import numpy as np\n'), ((687, 701), 'numpy.sort', 'np.sort', (['flows...
import julia from julia import DPMMSubClusters import numpy as np class prior: def to_julia_prior(self): pass def get_type(self): pass def to_JSON(self): pass class niw(prior): def __init__(self, kappa, mu, nu, psi): if nu < len(mu): raise Exception('nu shou...
[ "julia.DPMMSubClusters.niw_hyperparams", "julia.DPMMSubClusters.multinomial_hyper", "numpy.ones" ]
[((491, 562), 'julia.DPMMSubClusters.niw_hyperparams', 'DPMMSubClusters.niw_hyperparams', (['self.kappa', 'self.mu', 'self.nu', 'self.psi'], {}), '(self.kappa, self.mu, self.nu, self.psi)\n', (522, 562), False, 'from julia import DPMMSubClusters\n'), ((1058, 1103), 'julia.DPMMSubClusters.multinomial_hyper', 'DPMMSubClu...
"""Preprocess the face images """ import pickle import argparse import glob import logging import os import sys import numpy as np import cv2 import dlib # yapf: disable # Copied from https://github.com/cmusatyalab/openface/blob/master/openface/align_dlib.py TEMPLATE = np.float32([ (0.0792396913815, 0.339223741...
[ "argparse.ArgumentParser", "cv2.warpAffine", "dlib.shape_predictor", "os.path.join", "cv2.cvtColor", "cv2.imwrite", "os.path.dirname", "os.path.exists", "numpy.max", "os.path.basename", "numpy.min", "dlib.get_frontal_face_detector", "os.listdir", "os.makedirs", "logging.basicConfig", "...
[((274, 2745), 'numpy.float32', 'np.float32', (['[(0.0792396913815, 0.339223741112), (0.0829219487236, 0.456955367943), (\n 0.0967927109165, 0.575648016728), (0.122141515615, 0.691921601066), (\n 0.168687863544, 0.800341263616), (0.239789390707, 0.895732504778), (\n 0.325662452515, 0.977068762493), (0.42231828...
# <NAME> 2014-2020 # mlxtend Machine Learning Library Extensions # # A function for loading the open-source MNIST. # Author: <NAME> <<EMAIL>> # # License: BSD 3 clause import numpy as np import os this_dir, this_filename = os.path.split(__file__) DATA_PATH = os.path.join(this_dir, "data", "mnist_5k.csv.gz") def mni...
[ "os.path.split", "os.path.join", "numpy.genfromtxt" ]
[((225, 248), 'os.path.split', 'os.path.split', (['__file__'], {}), '(__file__)\n', (238, 248), False, 'import os\n'), ((261, 310), 'os.path.join', 'os.path.join', (['this_dir', '"""data"""', '"""mnist_5k.csv.gz"""'], {}), "(this_dir, 'data', 'mnist_5k.csv.gz')\n", (273, 310), False, 'import os\n'), ((890, 935), 'numpy...
import os import cv2 import numpy as np import math import dlib predictor_path = "shape_predictor_68_face_landmarks.dat" image_path = 'women/' def detect_landmarks(image, filepath): # obtain detector and predictor detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor(predictor_path...
[ "cv2.warpAffine", "cv2.imshow", "dlib.shape_predictor", "os.path.join", "numpy.copy", "numpy.append", "numpy.int", "math.cos", "numpy.int32", "numpy.reshape", "cv2.Subdiv2D", "cv2.waitKey", "math.sin", "cv2.transform", "dlib.get_frontal_face_detector", "os.listdir", "numpy.float32", ...
[((236, 268), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (266, 268), False, 'import dlib\n'), ((285, 321), 'dlib.shape_predictor', 'dlib.shape_predictor', (['predictor_path'], {}), '(predictor_path)\n', (305, 321), False, 'import dlib\n'), ((376, 396), 'numpy.asanyarray', 'np....
import numpy as np from robosuite.models.robots.robot import Robot from robosuite.utils.mjcf_utils import xml_path_completion, array_to_string class JR2DiffDrive(Robot): """JR2.""" def __init__(self): super().__init__(xml_path_completion("robots/jr2/jr2_diff_drive.xml")) self.bottom_offset =...
[ "numpy.zeros", "numpy.array", "robosuite.utils.mjcf_utils.array_to_string", "robosuite.utils.mjcf_utils.xml_path_completion" ]
[((321, 340), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (329, 340), True, 'import numpy as np\n'), ((1128, 1139), 'numpy.zeros', 'np.zeros', (['(8)'], {}), '(8)\n', (1136, 1139), True, 'import numpy as np\n'), ((237, 289), 'robosuite.utils.mjcf_utils.xml_path_completion', 'xml_path_completion', (...
import os import json import argparse import io import numpy as np import torch import faiss import glob import torch.nn as nn import requests import matplotlib.pyplot as plt import torchvision.transforms.functional as F import clip from PIL import Image from torchvision.utils import make_grid import model import ret...
[ "argparse.Namespace", "io.BytesIO", "json.load", "torchvision.transforms.functional.to_tensor", "torch.load", "numpy.asarray", "clip.tokenize", "clip.load", "torchvision.utils.make_grid", "torchvision.transforms.functional.to_pil_image", "torch.cuda.is_available", "requests.get", "glob.glob"...
[((3150, 3428), 'argparse.Namespace', 'argparse.Namespace', ([], {'config': '"""./checkpoints/12xdqrwd-config"""', 'index_dirs': '"""./unigrams,./bigrams,./artstyles,./emotions"""', 'clip_model': '"""ViT-B/16"""', 'knn': '(3)', 'maxlen': '(72)', 'num_return_sequences': '(32)', 'num_beams': '(1)', 'temperature': '(0.8)'...
#!/home/andrew/.envs/venv38/bin/python3 import sys import numpy as np def get_input(): cuboids = [] for line in sys.stdin: line = line.strip() if len(line) == 0: continue fields = line.split() cuboid = {} cuboid["mode"] = fields[0] for dim_region in...
[ "numpy.outer", "numpy.sum", "numpy.ediff1d" ]
[((3787, 3833), 'numpy.outer', 'np.outer', (["cell_lengths['y']", "cell_lengths['z']"], {}), "(cell_lengths['y'], cell_lengths['z'])\n", (3795, 3833), True, 'import numpy as np\n'), ((2483, 2520), 'numpy.ediff1d', 'np.ediff1d', (["self.bounding_planes['x']"], {}), "(self.bounding_planes['x'])\n", (2493, 2520), True, 'i...
""" Defines class Clusters that holds clusters-related data from one or more observations (experiments) divided (classified) in groups. The observations are expected to be generated by scripts/cluster_analysis.py. # Author: <NAME> (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_li...
[ "copy.deepcopy", "logging.debug", "logging.warning", "numpy.asarray", "pyto.io.Pickled", "numpy.where", "numpy.array", "numpy.arange", "builtins.zip" ]
[((6257, 6279), 'pyto.io.Pickled', 'pyto.io.Pickled', (['files'], {}), '(files)\n', (6272, 6279), False, 'import pyto\n'), ((13674, 13696), 'pyto.io.Pickled', 'pyto.io.Pickled', (['files'], {}), '(files)\n', (13689, 13696), False, 'import pyto\n'), ((7964, 8013), 'logging.debug', 'logging.debug', (["('Clusters: Reading...
from scipy.io import wavfile from scipy import signal import warnings import numpy as np import os from os import path from tqdm import tqdm def process_wav_file(fpath, rate=12, norm=0.5): """ Decimates and normalizes a wav file to the range [-norm, norm]. Parameters fpath : str path to the .w...
[ "tqdm.tqdm", "numpy.zeros_like", "os.makedirs", "numpy.zeros", "numpy.iinfo", "numpy.clip", "scipy.io.wavfile.read", "scipy.signal.decimate", "numpy.array", "os.path.splitext", "os.path.join", "os.listdir" ]
[((728, 747), 'scipy.io.wavfile.read', 'wavfile.read', (['fpath'], {}), '(fpath)\n', (740, 747), False, 'from scipy.io import wavfile\n'), ((759, 786), 'scipy.signal.decimate', 'signal.decimate', (['data', 'rate'], {}), '(data, rate)\n', (774, 786), False, 'from scipy import signal\n'), ((1887, 1931), 'os.makedirs', 'o...
import sys import logging import numpy as np from os import listdir from os.path import isfile, join from matplotlib import pyplot as plt from label_mapping import * #pc_range=(-51.2, -51.2, -5.0, 51.2, 51.2, 3.0), def load_cloud_from_bin_file(pc_f, lb_f): logging.info('loading cloud from: {} and labels from ...
[ "logging.error", "numpy.argmax", "numpy.fromfile", "matplotlib.pyplot.imshow", "matplotlib.pyplot.clf", "numpy.zeros", "matplotlib.pyplot.figure", "os.path.join", "os.listdir", "matplotlib.pyplot.savefig" ]
[((477, 511), 'numpy.fromfile', 'np.fromfile', (['lb_f'], {'dtype': 'np.uint32'}), '(lb_f, dtype=np.uint32)\n', (488, 511), True, 'import numpy as np\n'), ((1127, 1172), 'numpy.zeros', 'np.zeros', (['[grid_size, grid_size, num_classes]'], {}), '([grid_size, grid_size, num_classes])\n', (1135, 1172), True, 'import numpy...
### 1. Creating a training script for hyperparameter tuning #Script must include 2 things- 1. Include an argument for each hyperparameter you want to vary. 2. Log the target performance metric. This enables the hyperdrive run to evaluate the performance of the child runs it initiates, and identify the one that produce...
[ "numpy.average", "argparse.ArgumentParser", "sklearn.model_selection.train_test_split", "azureml.core.Run.get_context", "joblib.dump", "azureml.train.hyperdrive.HyperDriveConfig", "numpy.float", "sklearn.linear_model.LogisticRegression", "azureml.core.Experiment" ]
[((599, 624), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (622, 624), False, 'import argparse\n'), ((795, 812), 'azureml.core.Run.get_context', 'Run.get_context', ([], {}), '()\n', (810, 812), False, 'from azureml.core import Run\n'), ((1097, 1134), 'sklearn.model_selection.train_test_split'...
""" Filename: plot_ts_hexbin.py Author: <NAME>, <EMAIL> Description: Plot ocean volume distribution in T-S space """ # Import general Python modules import sys import os import re import pdb import argparse import numpy import pandas import matplotlib.pyplot as plt from matplotlib.lines import Line2D ...
[ "matplotlib.pyplot.title", "argparse.ArgumentParser", "cmdline_provenance.write_log", "iris.load_cube", "numpy.arange", "os.path.join", "sys.path.append", "matplotlib.lines.Line2D", "matplotlib.pyplot.imshow", "numpy.histogram2d", "general_io.salinity_unit_check", "matplotlib.pyplot.colorbar",...
[((642, 653), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (651, 653), False, 'import os\n'), ((822, 855), 'os.path.join', 'os.path.join', (['repo_dir', '"""modules"""'], {}), "(repo_dir, 'modules')\n", (834, 855), False, 'import os\n'), ((856, 884), 'sys.path.append', 'sys.path.append', (['modules_dir'], {}), '(modules...
""" Various tools which may be needed in various processes. """ from math import sin, asin, cos, atan, atan2, degrees, radians, sqrt, pi import numpy as np R_EARTH = 6378.139 class InputError(Exception): pass def gen_mat(mrot, mlon, mlat): """ Precursor for xy2ll and ll2xy functions. mrot: model ...
[ "numpy.radians", "math.atan", "math.sqrt", "math.radians", "math.sin", "numpy.argmin", "numpy.sin", "numpy.array", "math.cos", "numpy.where", "numpy.column_stack", "numpy.cos", "numpy.linalg.det", "math.degrees", "numpy.arctan", "numpy.sqrt" ]
[((412, 425), 'math.radians', 'radians', (['mrot'], {}), '(mrot)\n', (419, 425), False, 'from math import sin, asin, cos, atan, atan2, degrees, radians, sqrt, pi\n'), ((437, 445), 'math.cos', 'cos', (['arg'], {}), '(arg)\n', (440, 445), False, 'from math import sin, asin, cos, atan, atan2, degrees, radians, sqrt, pi\n'...
import numpy as np import math def exp_fun(average, x): return 1 - pow(np.exp(1), -(average * x)) def normal_fun(alpha, sigma, x): denominator = np.sqrt(sigma) * np.sqrt(2 * np.pi) numerator = (np.exp(-pow(x - alpha, 2) / (2 * sigma))) val = numerator / denominator return val def dis_fun(alpha...
[ "numpy.exp", "numpy.sqrt" ]
[((157, 171), 'numpy.sqrt', 'np.sqrt', (['sigma'], {}), '(sigma)\n', (164, 171), True, 'import numpy as np\n'), ((174, 192), 'numpy.sqrt', 'np.sqrt', (['(2 * np.pi)'], {}), '(2 * np.pi)\n', (181, 192), True, 'import numpy as np\n'), ((77, 86), 'numpy.exp', 'np.exp', (['(1)'], {}), '(1)\n', (83, 86), True, 'import numpy...
''' chain2params.py ============================== Extract parameters from trained model on chainer. ''' from __future__ import print_function import argparse import os try: import h5py except ImportError: pass import numpy as np parser = argparse.ArgumentParser() parser.add_argument('chainer_model', help='P...
[ "h5py.File", "numpy.save", "numpy.load", "argparse.ArgumentParser", "os.makedirs", "os.path.isdir", "os.path.dirname", "numpy.asarray" ]
[((250, 275), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (273, 275), False, 'import argparse\n'), ((906, 941), 'os.path.dirname', 'os.path.dirname', (['args.chainer_model'], {}), '(args.chainer_model)\n', (921, 941), False, 'import os\n'), ((960, 983), 'os.path.isdir', 'os.path.isdir', (['s...
#!/usr/bin/env python '''Light submodule for dGraph scene description module <NAME> Jan 2017 - created by splitting off from dGraph ALL UNITS ARE IN METRIC ie 1 cm = .01 www.qenops.com ''' __author__ = ('<NAME>') __version__ = '1.6' __all__ = ["Light", "PointLight", "DirectionLight"] from dGraph import * impo...
[ "numpy.array" ]
[((635, 666), 'numpy.array', 'np.array', (['intensity', 'np.float32'], {}), '(intensity, np.float32)\n', (643, 666), True, 'import numpy as np\n'), ((972, 1002), 'numpy.array', 'np.array', (['position', 'np.float32'], {}), '(position, np.float32)\n', (980, 1002), True, 'import numpy as np\n'), ((1947, 1978), 'numpy.arr...
import numpy as np import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras.models import Model from tensorflow.keras.applications import MobileNet from tensorflow.keras import initializers print(tf.__version__) seed = 42 np.random.seed(seed) tf.random.set_seed(seed) def KeypointModel(input...
[ "tensorflow.random.set_seed", "numpy.random.seed", "tensorflow.keras.models.Model", "tensorflow.keras.layers.Input", "tensorflow.keras.layers.GlobalAveragePooling2D", "tensorflow.keras.initializers.he_normal" ]
[((249, 269), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (263, 269), True, 'import numpy as np\n'), ((270, 294), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed'], {}), '(seed)\n', (288, 294), True, 'import tensorflow as tf\n'), ((883, 952), 'tensorflow.keras.models.Model', 'Model', ...
''' @file momentum_kinematics_optimizer.py @package momentumopt @author <NAME> (<EMAIL>) @license License BSD-3-Clause @copyright Copyright (c) 2019, New York University and Max Planck Gesellschaft. @date 2019-10-08 ''' import os import numpy as np from momentumopt.kinoptpy.qp import QpSolver from momentumopt.kinoptp...
[ "numpy.matrix", "pinocchio.RobotWrapper", "numpy.zeros", "numpy.ones", "pinocchio.neutral", "pinocchio.integrate", "numpy.array", "momentumopt.kinoptpy.inverse_kinematics.PointContactInverseKinematics", "momentumopt.kinoptpy.second_order_ik.SecondOrderInverseKinematics", "numpy.linalg.norm", "nu...
[((4587, 4625), 'numpy.zeros', 'np.zeros', (['(num_time_steps, num_eff, 3)'], {}), '((num_time_steps, num_eff, 3))\n', (4595, 4625), True, 'import numpy as np\n'), ((4651, 4689), 'numpy.zeros', 'np.zeros', (['(num_time_steps, num_eff, 3)'], {}), '((num_time_steps, num_eff, 3))\n', (4659, 4689), True, 'import numpy as n...
# -*- coding: utf-8 -*- """ Get the cartesian indices of input 1-D arrays Similar to the Julia CartesianIndices https://stackoverflow.com/questions/1208118/using-numpy-to-build-an-array-of-all-combinations-of-two-arrays """ import numpy as np def cartesian(*arrays, order='F'): """ -i- arrays : list of array-l...
[ "numpy.meshgrid", "numpy.arange" ]
[((636, 671), 'numpy.meshgrid', 'np.meshgrid', (['*arrays'], {'indexing': '"""ij"""'}), "(*arrays, indexing='ij')\n", (647, 671), True, 'import numpy as np\n'), ((690, 706), 'numpy.arange', 'np.arange', (['(N + 1)'], {}), '(N + 1)\n', (699, 706), True, 'import numpy as np\n')]
# Ground truth is from covid-hospitalization-all-state-merged_vEW202210.csv import pandas as pd import numpy as np from datetime import datetime, timedelta import glob from epiweeks import Week from metrics import * EPS = 1e-6 import matplotlib.pyplot as plt import math # In[2]: # ground truth df_ground_truth = p...
[ "pandas.DataFrame.from_dict", "warnings.filterwarnings", "pandas.read_csv", "pandas.merge", "numpy.array" ]
[((319, 350), 'pandas.read_csv', 'pd.read_csv', (['"""ground_truth.csv"""'], {}), "('ground_truth.csv')\n", (330, 350), True, 'import pandas as pd\n'), ((881, 902), 'pandas.read_csv', 'pd.read_csv', (['file_dir'], {}), '(file_dir)\n', (892, 902), True, 'import pandas as pd\n'), ((1842, 1890), 'pandas.merge', 'pd.merge'...
from mux import * from transfer import * import numpy as np import matplotlib.pyplot as plt from parameters import * for name, max_val in zip(names[:], max_vals[:]): x = np.logspace(0, max_val, 1000) x = x.astype(np.double) print("ID_"+name, end="...") print(*params[cells["ID_"+name]]) print("NO...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.logspace", "matplotlib.pyplot.legend", "matplotlib.pyplot.gca" ]
[((177, 206), 'numpy.logspace', 'np.logspace', (['(0)', 'max_val', '(1000)'], {}), '(0, max_val, 1000)\n', (188, 206), True, 'import numpy as np\n'), ((747, 777), 'matplotlib.pyplot.plot', 'plt.plot', (['l', 'x', '"""."""'], {'label': '"""x"""'}), "(l, x, '.', label='x')\n", (755, 777), True, 'import matplotlib.pyplot ...
# Figure # Running times of computation tasks import numpy as np import matplotlib.pyplot as plt # from brokenaxes import brokenaxes # x = np.linspace(1, 8, 8) x = np.array([1,16,32,48,64,80,96,112,128,144,160]) y1 = [0.685,10.985,22.058,33.032,43.961,55.007,66.084,77.082,87.850,99.113,110.151] # DataBroker attestin...
[ "matplotlib.pyplot.show", "numpy.array", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "matplotlib.pyplot.grid" ]
[((167, 224), 'numpy.array', 'np.array', (['[1, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160]'], {}), '([1, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160])\n', (175, 224), True, 'import numpy as np\n'), ((1051, 1065), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1063, 1065), True, 'import matplotlib.pypl...
import numpy as np import pymc class TestObsCorrelation(): def prepare_model(self, n, nad, order): l1 = pymc.GrapheneLattice(n) FK = pymc.Hamiltonian(lattice=l1, t=-1, U=2) o_C = pymc.CorrelationObs(FK) for _ in range(100): FK.put_adatoms(nad, order) o_C.ca...
[ "pymc.Hamiltonian", "pymc.CorrelationObs", "numpy.testing.assert_almost_equal", "pymc.GrapheneLattice" ]
[((119, 142), 'pymc.GrapheneLattice', 'pymc.GrapheneLattice', (['n'], {}), '(n)\n', (139, 142), False, 'import pymc\n'), ((156, 195), 'pymc.Hamiltonian', 'pymc.Hamiltonian', ([], {'lattice': 'l1', 't': '(-1)', 'U': '(2)'}), '(lattice=l1, t=-1, U=2)\n', (172, 195), False, 'import pymc\n'), ((210, 233), 'pymc.Correlation...
# -*- coding: utf-8 -*- """ Created on Sun Nov 22 14:14:34 2020 @author: mclea """ import numpy as np import matplotlib.pyplot as plt dx = 0.01 X = np.arange(-4, 4+dx, dx) Y = np.arange(-4, 4+dx, dx) XY = np.meshgrid(X, Y) a = 1 epsilon = 0.02 N = np.array([[1,0], [0,1]]) def cartesian_to_polar(x, y)...
[ "numpy.meshgrid", "numpy.zeros", "numpy.ones", "matplotlib.pyplot.colorbar", "numpy.sin", "numpy.array", "numpy.arange", "matplotlib.pyplot.contourf", "numpy.arctan", "numpy.gradient", "numpy.sqrt" ]
[((150, 175), 'numpy.arange', 'np.arange', (['(-4)', '(4 + dx)', 'dx'], {}), '(-4, 4 + dx, dx)\n', (159, 175), True, 'import numpy as np\n'), ((178, 203), 'numpy.arange', 'np.arange', (['(-4)', '(4 + dx)', 'dx'], {}), '(-4, 4 + dx, dx)\n', (187, 203), True, 'import numpy as np\n'), ((207, 224), 'numpy.meshgrid', 'np.me...
"""This module consists of functions for simulating the phase shift of a given object. It contained two functions: 1) linsupPhi - using the linear superposition principle for application in model based iterative reconstruction (MBIR) type 3D reconstruction of magnetization (both magnetic and electrostatic). T...
[ "numpy.dstack", "numpy.fft.ifftshift", "numpy.meshgrid", "numpy.sum", "numpy.array_equal", "numpy.deg2rad", "numpy.zeros", "numpy.ones", "time.time", "numpy.shape", "numpy.where", "numba.jit", "numpy.array", "numpy.exp", "numpy.arange", "numpy.fft.fft2", "numpy.sin", "numpy.sqrt" ]
[((620, 653), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'parallel': '(True)'}), '(nopython=True, parallel=True)\n', (623, 653), False, 'from numba import jit\n'), ((4157, 4191), 'numpy.meshgrid', 'np.meshgrid', (['ly', 'lx'], {'indexing': '"""ij"""'}), "(ly, lx, indexing='ij')\n", (4168, 4191), True, 'import nump...
# -*- coding: utf-8 -*- """ Created on Wed June 13 11:55:20 2018 @author: mbgunay1in """ # import libraries and modules needed import os import numpy as np from scipy import integrate, linalg from matplotlib import pyplot # load geometry from data file naca_filepath = os.path.join('datfile.dat') with ...
[ "numpy.sum", "numpy.empty", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linalg.solve", "os.path.join", "numpy.copy", "numpy.empty_like", "numpy.append", "numpy.loadtxt", "numpy.linspace", "numpy.arccos", "numpy.fill_diagonal", "numpy.radians", "scipy.integrate.quad", "matplotlib.py...
[((286, 313), 'os.path.join', 'os.path.join', (['"""datfile.dat"""'], {}), "('datfile.dat')\n", (298, 313), False, 'import os\n'), ((447, 484), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {'figsize': '(width, width)'}), '(figsize=(width, width))\n', (460, 484), False, 'from matplotlib import pyplot\n'), ((486, 49...
import numpy as np def add_noise(batch, mean=0, var=0.1, amount=0.01, mode='pepper'): original_size = batch.shape batch = np.squeeze(batch) batch_noisy = np.zeros(batch.shape) for ii in range(batch.shape[0]): image = np.squeeze(batch[ii]) if mode == 'gaussian': gauss = np.r...
[ "numpy.squeeze", "numpy.zeros", "numpy.ceil", "numpy.random.normal" ]
[((132, 149), 'numpy.squeeze', 'np.squeeze', (['batch'], {}), '(batch)\n', (142, 149), True, 'import numpy as np\n'), ((168, 189), 'numpy.zeros', 'np.zeros', (['batch.shape'], {}), '(batch.shape)\n', (176, 189), True, 'import numpy as np\n'), ((243, 264), 'numpy.squeeze', 'np.squeeze', (['batch[ii]'], {}), '(batch[ii])...
""" Metric for ML """ import numpy as np def gini(y_valid, y_pred): """Calculate gini coefficient.""" assert y_valid.shape == y_pred.shape n_samples = y_valid.shape[0] # Sort rows on prediction column # (from largest to smallest) arr = np.array([y_valid, y_pred]).transpose() true_order =...
[ "numpy.array", "numpy.cumsum", "numpy.sum", "numpy.linspace" ]
[((556, 596), 'numpy.linspace', 'np.linspace', (['(1 / n_samples)', '(1)', 'n_samples'], {}), '(1 / n_samples, 1, n_samples)\n', (567, 596), True, 'import numpy as np\n'), ((661, 684), 'numpy.sum', 'np.sum', (['(l_ones - l_true)'], {}), '(l_ones - l_true)\n', (667, 684), True, 'import numpy as np\n'), ((698, 721), 'num...
from utils.scip_models import mvc_model, CSBaselineSepa, set_aggresive_separation, CSResetSepa, maxcut_mccormic_model from pathlib import Path import numpy as np import pyarrow as pa from utils.functions import get_normalized_areas from tqdm import tqdm import pickle from argparse import ArgumentParser import ray impor...
[ "yaml.load", "pickle.dump", "numpy.random.seed", "argparse.ArgumentParser", "utils.scip_models.CSResetSepa", "utils.scip_models.maxcut_mccormic_model", "numpy.floor", "pickle.load", "utils.functions.get_normalized_areas", "glob.glob", "os.path.join", "os.path.exists", "utils.scip_models.CSBa...
[((409, 425), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (423, 425), False, 'from argparse import ArgumentParser\n'), ((1382, 1401), 'numpy.random.seed', 'np.random.seed', (['(777)'], {}), '(777)\n', (1396, 1401), True, 'import numpy as np\n'), ((1588, 1624), 'yaml.load', 'yaml.load', (['f'], {'Load...
# Author: <EMAIL> (Any bug report is welcome) # Time Created: Aug 2016 # Time Last Updated: Nov 2016 # Addr: Shenzhen, China # Description: define functions and parameters related to input data from __future__ import absolute_import from __future__ import division from __future__ import print_function import os impo...
[ "pandas.DataFrame", "h5py.File", "numpy.log", "random.shuffle", "numpy.zeros", "numpy.genfromtxt", "numpy.clip", "numpy.isnan", "numpy.arange", "os.path.join", "pandas.concat", "numpy.vstack" ]
[((472, 506), 'os.path.join', 'os.path.join', (['data_dir', '"""h5_files"""'], {}), "(data_dir, 'h5_files')\n", (484, 506), False, 'import os\n'), ((980, 1015), 'numpy.zeros', 'np.zeros', (['(num_labels, num_classes)'], {}), '((num_labels, num_classes))\n', (988, 1015), True, 'import numpy as np\n'), ((925, 946), 'nump...
import numpy as np from math import atan2, sin, cos, pi, tan import DR20API.sim import time import matplotlib.pyplot as plt class Controller: def __init__(self, port = 19997): """ Initialize the controller of DR20 robot, and connect and start the simulation in CoppeliaSim. Arguments: ...
[ "numpy.random.randn", "math.atan2", "numpy.zeros", "math.sin", "time.sleep", "numpy.array", "numpy.linalg.norm", "math.cos" ]
[((455, 510), 'numpy.zeros', 'np.zeros', (['(self.map_size, self.map_size)'], {'dtype': '"""uint8"""'}), "((self.map_size, self.map_size), dtype='uint8')\n", (463, 510), True, 'import numpy as np\n'), ((4153, 4168), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (4163, 4168), False, 'import time\n'), ((5973, 5...
# -*- coding: utf-8 -*- """ This module is used for calculations of the boundary wavelets in the frequency domain. The boundary_wavelets.py package is licensed under the MIT "Expat" license. Copyright (c) 2019: <NAME> and <NAME>. """ # ============================================================================= # Im...
[ "numpy.sum", "boundwave.boundary_wavelets.inner_product_phi_x", "boundwave.boundary_wavelets.moments", "numpy.transpose", "numpy.shape", "numpy.arange", "numpy.exp", "numpy.convolve", "numpy.prod", "numpy.sqrt" ]
[((2488, 2528), 'numpy.sum', 'np.sum', (['phi'], {'axis': '(2)', 'dtype': 'np.complex128'}), '(phi, axis=2, dtype=np.complex128)\n', (2494, 2528), True, 'import numpy as np\n'), ((4131, 4155), 'numpy.arange', 'np.arange', (['(-2 * a + 2)', '(1)'], {}), '(-2 * a + 2, 1)\n', (4140, 4155), True, 'import numpy as np\n'), (...
import rospy from geometry_msgs.msg import PoseArray, Pose from tf.transformations import euler_from_quaternion import time import math import matplotlib.pyplot as plt from nav_msgs.msg import Odometry from mpl_toolkits.mplot3d import Axes3D import numpy as np from geometry_msgs.msg import Twist from nav_msgs.msg imp...
[ "rospy.Subscriber", "nav_msgs.msg.Odometry", "math.pow", "math.atan2", "numpy.asarray", "rospy.Publisher", "rospy.Rate", "geometry_msgs.msg.Twist", "numpy.sin", "rospy.init_node", "numpy.cos", "tf.transformations.euler_from_quaternion", "rospy.spin", "geometry_msgs.msg.Pose" ]
[((415, 472), 'rospy.init_node', 'rospy.init_node', (['"""pid_controller_initial"""'], {'anonymous': '(True)'}), "('pid_controller_initial', anonymous=True)\n", (430, 472), False, 'import rospy\n'), ((508, 564), 'rospy.Publisher', 'rospy.Publisher', (['"""/drone1/cmd_vel"""', 'Twist'], {'queue_size': '(10)'}), "('/dron...
import torch import numpy as np def position_encoding(n_postion, dim_hidden, padding_idx = None): """ from paper: Attention is all you need <http://papers.nips.cc/paper/7181-attention-is-all-you-need.pdf> """ def angle(postion, hidden_idx): """ pos/10000^(2i/d_{model}) """ ...
[ "numpy.power", "numpy.sin", "torch.FloatTensor", "numpy.cos" ]
[((615, 641), 'numpy.sin', 'np.sin', (['sin_table[:, 0::2]'], {}), '(sin_table[:, 0::2])\n', (621, 641), True, 'import numpy as np\n'), ((667, 693), 'numpy.cos', 'np.cos', (['sin_table[:, 1::2]'], {}), '(sin_table[:, 1::2])\n', (673, 693), True, 'import numpy as np\n'), ((776, 804), 'torch.FloatTensor', 'torch.FloatTen...
from sklearn.externals import joblib import pandas as pd import numpy as np from flask import request def prediction(): if request.method == 'POST': model_logreg = joblib.load("models/Liver_prediction_model/logreg.pkl") age = int(request.form.get('age')) sex = int(request.form.get('sex')) ...
[ "flask.request.form.get", "pandas.read_csv", "numpy.min", "numpy.max", "sklearn.externals.joblib.load" ]
[((177, 232), 'sklearn.externals.joblib.load', 'joblib.load', (['"""models/Liver_prediction_model/logreg.pkl"""'], {}), "('models/Liver_prediction_model/logreg.pkl')\n", (188, 232), False, 'from sklearn.externals import joblib\n'), ((1356, 1425), 'pandas.read_csv', 'pd.read_csv', (['"""models/Liver_prediction_model/ind...
import numpy as np from PIL import Image import os, os.path import imageio from skimage.color import rgb2gray import matplotlib.image as mpimg import glob import cv2 import matplotlib.pyplot as plt import numpy as np import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation fr...
[ "matplotlib.pyplot.show", "keras.optimizers.SGD", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "os.getcwd", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "cv2.imread", "numpy.vstack", "keras.layers.Dense", "numpy.array", "glob.glob", "keras.models.Sequential", "matplotlib.p...
[((620, 636), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (628, 636), True, 'import numpy as np\n'), ((807, 823), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (815, 823), True, 'import numpy as np\n'), ((886, 917), 'numpy.vstack', 'np.vstack', (['(images_0, images_1)'], {}), '((images_0, im...
# -*- coding: utf-8 -*- """ @file @brief Ce module définit un segment qui va parcourir l'image, en plus d'être un segment, cette classe inclut la dimension de l'image, et une fonction repérant sur ce segment les gradients presque orthogonaux à l'image. """ import copy import numpy from .geometrie import Segment, Point ...
[ "numpy.dot", "copy.deepcopy", "copy.copy" ]
[((881, 900), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (894, 900), False, 'import copy\n'), ((2228, 2245), 'copy.copy', 'copy.copy', (['self.a'], {}), '(self.a)\n', (2237, 2245), False, 'import copy\n'), ((3082, 3099), 'numpy.dot', 'numpy.dot', (['g', 'nor'], {}), '(g, nor)\n', (3091, 3099), False,...
############################## ##### Helper functions ##### ############################## # This is a list of helper functions related to # file read/write and converting pgn to np array, etc. from PIL import Image import numpy as np import os piece_to_num_dict = { 'P': 1, 'N': 2, 'B': 3, 'R': 4, ...
[ "numpy.append", "numpy.asarray", "numpy.array", "PIL.Image.open" ]
[((1772, 1787), 'numpy.array', 'np.array', (['board'], {}), '(board)\n', (1780, 1787), True, 'import numpy as np\n'), ((3032, 3045), 'PIL.Image.open', 'Image.open', (['f'], {}), '(f)\n', (3042, 3045), False, 'from PIL import Image\n'), ((3113, 3144), 'numpy.append', 'np.append', (['x_array', 'arr'], {'axis': '(0)'}), '...
# importar modulos import numpy as np import matplotlib.pyplot as plt from matplotlib import animation def compox (v, a): return v * np.cos(a) def compoy (v, a): return v * np.sin(a) v = 100 #float (input("Velocidad inicial ")) a = 45 #float (input("Angulo: ")) a = np.deg2rad (a) g = 9.8 xmax = v ** 2.0 ...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "numpy.deg2rad", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linspace", "numpy.cos" ]
[((280, 293), 'numpy.deg2rad', 'np.deg2rad', (['a'], {}), '(a)\n', (290, 293), True, 'import numpy as np\n'), ((477, 504), 'numpy.linspace', 'np.linspace', (['(0.0)', 'ttot', '(100)'], {}), '(0.0, ttot, 100)\n', (488, 504), True, 'import numpy as np\n'), ((593, 607), 'matplotlib.pyplot.figure', 'plt.figure', (['(20)'],...
import os import sys import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import torch import numpy as np import codes.graph_utils as gu from codes.simulator import ByzantineWorker from codes.utils import filter_entries_from_json from codes.attacks import get_attackers from template import MNISTT...
[ "pandas.DataFrame", "seaborn.lineplot", "os.path.join", "numpy.printoptions", "os.makedirs", "template.get_sampler_callback", "os.path.exists", "matplotlib.pyplot.subplots", "codes.graph_utils.TwoCliquesWithByzantine", "codes.utils.filter_entries_from_json", "codes.graph_utils.get_graph", "cod...
[((854, 872), 'codes.graph_utils.get_graph', 'gu.get_graph', (['args'], {}), '(args)\n', (866, 872), True, 'import codes.graph_utils as gu\n'), ((802, 841), 'codes.graph_utils.TwoCliquesWithByzantine', 'gu.TwoCliquesWithByzantine', (['m', 'b', 'delta'], {}), '(m, b, delta)\n', (828, 841), True, 'import codes.graph_util...
# Law of large numbers import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (20,10) from distributionLib import Dist import os import imageio np.random.seed(404) N = 1000 data = np.random.choice([0, 1], size=(N,1), p=[0.49, 0.51]) E_x = np.sum(data)/N sampleLook = 801 temp = 0 yData = ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "numpy.random.seed", "numpy.sum", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "matplotlib.pyplot.draw", "numpy.random.randint", "numpy.mean", "numpy.random.choice", "matplotl...
[((173, 192), 'numpy.random.seed', 'np.random.seed', (['(404)'], {}), '(404)\n', (187, 192), True, 'import numpy as np\n'), ((211, 264), 'numpy.random.choice', 'np.random.choice', (['[0, 1]'], {'size': '(N, 1)', 'p': '[0.49, 0.51]'}), '([0, 1], size=(N, 1), p=[0.49, 0.51])\n', (227, 264), True, 'import numpy as np\n'),...
from amodem import calib from amodem import common from amodem import config from io import BytesIO import numpy as np import random import pytest import mock config = config.fastest() class ProcessMock: def __init__(self): self.buf = BytesIO() self.stdin = self self.stdout = self ...
[ "amodem.calib.detector", "io.BytesIO", "amodem.common.dumps", "amodem.config.fastest", "amodem.calib.volume_controller", "mock.call", "random.Random", "amodem.calib.recv_iter", "pytest.fixture", "mock.patch", "pytest.raises", "amodem.calib.recv", "numpy.cos", "amodem.calib.send" ]
[((171, 187), 'amodem.config.fastest', 'config.fastest', ([], {}), '()\n', (185, 187), False, 'from amodem import config\n'), ((1924, 2038), 'pytest.fixture', 'pytest.fixture', ([], {'params': '([0] + [(sign * mag) for sign in (+1, -1) for mag in (0.1, 1, 10, 100, \n 1000.0, 2000.0)])'}), '(params=[0] + [(sign * mag...
import os import glob from collections import defaultdict import pickle from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from scipy.optimize import Bounds, minimize, differential_evolution, brute, fmin from scipy.stats import uniform ...
[ "keras.backend.gradients", "scipy.optimize.minimize", "numpy.minimum", "numpy.zeros_like", "numpy.maximum", "numpy.argmax", "keras.backend.get_session", "numpy.zeros", "numpy.float", "numpy.clip", "numpy.argmin", "scipy.optimize.differential_evolution", "scipy.optimize.Bounds", "numpy.arra...
[((2025, 2040), 'numpy.array', 'np.array', (['nodes'], {}), '(nodes)\n', (2033, 2040), True, 'import numpy as np\n'), ((2308, 2338), 'numpy.zeros_like', 'np.zeros_like', (['lower_bound_tot'], {}), '(lower_bound_tot)\n', (2321, 2338), True, 'import numpy as np\n'), ((2357, 2410), 'numpy.clip', 'np.clip', (['(upper_bound...
import math import pandas as pd import xlsxwriter import numpy as np from scipy.stats.contingency import chi2_contingency from scipy.stats.contingency import margins import pyreadstat def write_long_crosttab_to_xslx(df_name, varx, vary, PONDER = 'weight', file_name = 'ispis_baze.xlsx'): ''' Takes in sps...
[ "pandas.crosstab", "math.sqrt", "numpy.asarray", "xlsxwriter.Workbook", "scipy.stats.contingency.margins", "numpy.split", "pandas.read_spss", "scipy.stats.contingency.chi2_contingency", "pyreadstat.read_sav" ]
[((604, 653), 'pandas.read_spss', 'pd.read_spss', (['df_name'], {'convert_categoricals': '(False)'}), '(df_name, convert_categoricals=False)\n', (616, 653), True, 'import pandas as pd\n'), ((677, 731), 'pyreadstat.read_sav', 'pyreadstat.read_sav', (['df_name'], {'apply_value_formats': '(True)'}), '(df_name, apply_value...
import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Churn_Modelling.csv') X = dataset.iloc[:, 3:13].values y = dataset.iloc[:, 13].values # Encoding categorical data from sklearn.preprocessing import LabelEncoder, OneHotEncoder labelencoder_X_1 = Label...
[ "sklearn.metrics.confusion_matrix", "keras.wrappers.scikit_learn.KerasClassifier", "sklearn.preprocessing.StandardScaler", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.model_selection.cross_val_score", "sklearn.preprocessing.OneHotEncoder", "sklearn.preprocessing.LabelEncode...
[((106, 140), 'pandas.read_csv', 'pd.read_csv', (['"""Churn_Modelling.csv"""'], {}), "('Churn_Modelling.csv')\n", (117, 140), True, 'import pandas as pd\n'), ((315, 329), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (327, 329), False, 'from sklearn.preprocessing import LabelEncoder, OneHotEnc...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Pascal VOC2012 dataset manager """ import cv2 from glob import glob import numpy as np import os from PIL import Image class DBManager(): def __init__(self): super(DBManager, self).__init__() def load_data(db_path, train_ratio=0.7, img_is_gray=Tru...
[ "numpy.random.seed", "os.path.basename", "numpy.expand_dims", "PIL.Image.open", "numpy.array", "numpy.arange", "glob.glob", "numpy.random.shuffle" ]
[((739, 759), 'glob.glob', 'glob', (["(db_path + '/*')"], {}), "(db_path + '/*')\n", (743, 759), False, 'from glob import glob\n'), ((876, 901), 'numpy.arange', 'np.arange', (['number_of_imgs'], {}), '(number_of_imgs)\n', (885, 901), True, 'import numpy as np\n'), ((910, 928), 'numpy.random.seed', 'np.random.seed', (['...
import os, glob, torch, time import numpy as np from PIL import Image import torch.nn as nn def resampling(x, new_size): l = len(x.shape) if l == 2: x = torch.from_numpy(x).type(torch.FloatTensor).unsqueeze(0).unsqueeze(1) if l == 3: x = torch.from_numpy(x).type(torch.FloatTensor).unsqueez...
[ "numpy.multiply", "numpy.zeros", "numpy.expand_dims", "PIL.Image.fromarray", "numpy.array", "numpy.squeeze", "torch.nn.functional.interpolate", "os.path.join", "numpy.concatenate", "torch.from_numpy" ]
[((450, 463), 'numpy.squeeze', 'np.squeeze', (['x'], {}), '(x)\n', (460, 463), True, 'import numpy as np\n'), ((568, 603), 'numpy.multiply', 'np.multiply', (['img[:, :, 0]', '(1 - mask)'], {}), '(img[:, :, 0], 1 - mask)\n', (579, 603), True, 'import numpy as np\n'), ((3024, 3064), 'numpy.zeros', 'np.zeros', (['raw_mask...
from random import random import cv2 import numpy as np import torchvision.transforms.functional as F from PIL import Image, ImageOps from albumentations import ( PadIfNeeded, HorizontalFlip, VerticalFlip, CenterCrop, Compose, GridDistortion, OpticalDistortion, RandomCrop, OneOf, ...
[ "torchvision.transforms.functional.to_tensor", "albumentations.RandomScale", "torchvision.transforms.functional.affine", "albumentations.HorizontalFlip", "torchvision.transforms.functional.hflip", "albumentations.CenterCrop", "albumentations.OpticalDistortion", "torchvision.transforms.functional.vflip...
[((629, 647), 'torchvision.transforms.functional.to_tensor', 'F.to_tensor', (['image'], {}), '(image)\n', (640, 647), True, 'import torchvision.transforms.functional as F\n'), ((660, 678), 'torchvision.transforms.functional.to_tensor', 'F.to_tensor', (['label'], {}), '(label)\n', (671, 678), True, 'import torchvision.t...
from fastapi import FastAPI from pydantic import BaseModel, create_model import numpy as np from tensorflow.keras.models import load_model import json class FastMlOps(FastAPI): def helloTao(self): print("Hello Tao") def createAPI(self, config): method, path, inputModel, responseModel, model ...
[ "tensorflow.keras.models.load_model", "numpy.argmax", "fastapi.FastAPI.post", "json.dumps", "pydantic.create_model" ]
[((486, 525), 'pydantic.create_model', 'create_model', (['"""BaseModel"""'], {}), "('BaseModel', **inputModel)\n", (498, 525), False, 'from pydantic import BaseModel, create_model\n'), ((544, 561), 'tensorflow.keras.models.load_model', 'load_model', (['model'], {}), '(model)\n', (554, 561), False, 'from tensorflow.kera...
import numpy as np from numpy.testing import assert_array_almost_equal from scipy.signal import convolve from pylops.waveeqprocessing.marchenko import directwave # Test data inputfile2d = 'testdata/marchenko/input.npz' inputfile3d = 'testdata/marchenko/direct3D.npz' # Parameters vel = 2400.0 # velocity def test_d...
[ "numpy.load", "numpy.abs", "numpy.argmax", "numpy.zeros", "numpy.apply_along_axis", "numpy.diff", "pylops.waveeqprocessing.marchenko.directwave", "numpy.sqrt" ]
[((432, 452), 'numpy.load', 'np.load', (['inputfile2d'], {}), '(inputfile2d)\n', (439, 452), True, 'import numpy as np\n'), ((715, 729), 'numpy.argmax', 'np.argmax', (['wav'], {}), '(wav)\n', (724, 729), True, 'import numpy as np\n'), ((742, 798), 'numpy.apply_along_axis', 'np.apply_along_axis', (['convolve', '(0)', 'G...
from sunpy.map import Map from sunpy.instr.aia import aiaprep as AP from skimage.transform import resize as R import numpy as np import os from pandas import read_csv class sdo_prep: def __init__(self, resize=False, isize=None, rsun=None): if resize == True: if isize : if type...
[ "numpy.pad", "sunpy.map.Map", "pandas.read_csv", "os.path.exists", "numpy.where", "skimage.transform.resize", "numpy.arange", "numpy.sqrt" ]
[((1651, 1729), 'skimage.transform.resize', 'R', (['data', '(isize_new, isize_new)'], {'order': '(1)', 'mode': '"""constant"""', 'preserve_range': '(True)'}), "(data, (isize_new, isize_new), order=1, mode='constant', preserve_range=True)\n", (1652, 1729), True, 'from skimage.transform import resize as R\n'), ((2555, 26...
import numpy as np import matplotlib.pyplot as plt from robolearn.old_utils.trajectory_interpolators import polynomial5_interpolation from robolearn.old_utils.trajectory_interpolators import spline_interpolation N = 100 xf = np.array([2, 3, 4, 1]) x0 = np.array([2, 2, 2, 2]) dxf = np.array([0, 0, 0, 0])*N dx0 = np.arr...
[ "numpy.array", "matplotlib.pyplot.plot", "robolearn.old_utils.trajectory_interpolators.spline_interpolation", "matplotlib.pyplot.show" ]
[((226, 248), 'numpy.array', 'np.array', (['[2, 3, 4, 1]'], {}), '([2, 3, 4, 1])\n', (234, 248), True, 'import numpy as np\n'), ((254, 276), 'numpy.array', 'np.array', (['[2, 2, 2, 2]'], {}), '([2, 2, 2, 2])\n', (262, 276), True, 'import numpy as np\n'), ((572, 595), 'numpy.array', 'np.array', (['[0, 5, 7, 10]'], {}), ...
import os from numpy.lib.twodim_base import mask_indices import torch import numpy as np import glob FAR_PLANE = 3 NEAR_PLANE = 0.1 def work(name): if not os.path.exists(os.path.join(name, 'online_masks')): os.mkdir(os.path.join(name, 'online_masks')) data3d = torch.load(os.path.join(name, name + '_i...
[ "torch.stack", "torch.sum", "numpy.loadtxt", "torch.zeros", "os.path.join", "torch.tensor", "torch.from_numpy" ]
[((291, 333), 'os.path.join', 'os.path.join', (['name', "(name + '_instance.pth')"], {}), "(name, name + '_instance.pth')\n", (303, 333), False, 'import os\n'), ((392, 427), 'os.path.join', 'os.path.join', (['name', '"""pose"""', '"""*.txt"""'], {}), "(name, 'pose', '*.txt')\n", (404, 427), False, 'import os\n'), ((660...
# # Copyright (c) 2018 TECHNICAL UNIVERSITY OF MUNICH, DEPARTMENT OF MECHANICAL ENGINEERING, CHAIR OF APPLIED MECHANICS, # BOLTZMANNSTRASSE 15, 85748 GARCHING/MUNICH, GERMANY, <EMAIL>. # # Distributed under 3-Clause BSD license. See LICENSE file for more information. # from unittest import TestCase import scipy.spars...
[ "numpy.array" ]
[((478, 570), 'numpy.array', 'numpy.array', (['[[4, -2, 0, 0], [-2, 4, -2, 0], [0, -2, 4, -1], [0, 0, -1, 1]]'], {'dtype': 'float'}), '([[4, -2, 0, 0], [-2, 4, -2, 0], [0, -2, 4, -1], [0, 0, -1, 1]],\n dtype=float)\n', (489, 570), False, 'import numpy\n'), ((619, 652), 'numpy.array', 'numpy.array', (['[1.4, 1.2, 0.8...
#!/usr/bin/env python3 # -*- coding: utf8 -*- # Copyright 2019 Université de Liège # # 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 # # Un...
[ "CVLM.vortex_setitem", "CVLM.vertices_getitem", "CVLM.vortex_getitem", "CVLM.memory_setup", "CVLM.cycleliftsurf", "CVLM.VLMData", "numpy.sin", "CVLM.vertices_setitem", "CVLM.aeroforce_getitem", "CVLM.setup", "CVLM.nsurf_getitem", "CVLM.geometry_setup", "CVLM.reset_wake", "CVLM.normal_getit...
[((769, 783), 'CVLM.VLMData', 'CVLM.VLMData', ([], {}), '()\n', (781, 783), False, 'import CVLM\n'), ((792, 821), 'CVLM.setup', 'CVLM.setup', (['infile', 'self.data'], {}), '(infile, self.data)\n', (802, 821), False, 'import CVLM\n'), ((940, 970), 'CVLM.geometry_setup', 'CVLM.geometry_setup', (['self.data'], {}), '(sel...
import sys import os if float(sys.version[0])<3: import cPickle as pickle import datetime import numpy as np import netCDF4 import matplotlib.mlab as mp def get_cstr(): '''Returns case-string''' path = os.getcwd() return path.split(os.sep)[-1] class Filelist(): '''Object linking points...
[ "numpy.abs", "os.getcwd", "numpy.empty", "netCDF4.date2num", "numpy.argmin", "datetime.datetime", "numpy.where", "netCDF4.num2date" ]
[((221, 232), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (230, 232), False, 'import os\n'), ((598, 609), 'numpy.empty', 'np.empty', (['(0)'], {}), '(0)\n', (606, 609), True, 'import numpy as np\n'), ((1303, 1353), 'netCDF4.num2date', 'netCDF4.num2date', (['self.time'], {'units': 'self.time_units'}), '(self.time, units...
import os import random import numpy as np from scipy.spatial.distance import cdist import cv2 import time import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F # import torch.multiprocessing as mp from torch.utils.data import DataLoader from torch.optim import Adam # fro...
[ "package.loss.regularization._Regularization", "numpy.stack", "numpy.multiply", "numpy.concatenate", "numpy.copy", "torch.utils.data.DataLoader", "torch.load", "time.time", "numpy.mean", "numpy.arange", "numpy.array", "sklearn.neighbors.NearestNeighbors", "torch.nn.kneighbors", "package.mo...
[((1741, 1783), 'torch.load', 'torch.load', (['checkpoint'], {'map_location': '"""cpu"""'}), "(checkpoint, map_location='cpu')\n", (1751, 1783), False, 'import torch\n'), ((2922, 2938), 'numpy.mean', 'np.mean', (['matches'], {}), '(matches)\n', (2929, 2938), True, 'import numpy as np\n'), ((2978, 2995), 'numpy.copy', '...
import numpy as np import scipy.stats as si def black_scholes_call_div(S, K, T, r, q, sigma): # S: spot price # K: strike price # T: time to maturity # r: interest rate # q: rate of continuous dividend paying asset # sigma: volatility of underlying asset d1 = (np.log(S / K) + (r - q + 0....
[ "scipy.stats.norm.cdf", "numpy.exp", "numpy.log", "numpy.sqrt" ]
[((293, 306), 'numpy.log', 'np.log', (['(S / K)'], {}), '(S / K)\n', (299, 306), True, 'import numpy as np\n'), ((352, 362), 'numpy.sqrt', 'np.sqrt', (['T'], {}), '(T)\n', (359, 362), True, 'import numpy as np\n'), ((374, 387), 'numpy.log', 'np.log', (['(S / K)'], {}), '(S / K)\n', (380, 387), True, 'import numpy as np...
import os import shutil import numpy as np import numpy.matlib as matl import torch from sklearn.cluster import KMeans from sklearn.metrics import pairwise_distances from torchvision import transforms from tqdm import tqdm class AverageMeter(object): """Computes and stores the average and current value""" d...
[ "numpy.argsort", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "numpy.unique", "sklearn.cluster.KMeans", "numpy.random.choice", "torchvision.transforms.CenterCrop", "numpy.fill_diagonal", "tqdm.tqdm", "torchvision.transforms.RandomHorizontalFlip", "sklearn.metrics.pairwi...
[((1525, 1557), 'os.path.join', 'os.path.join', (['"""output"""', 'filename'], {}), "('output', filename)\n", (1537, 1557), False, 'import os\n'), ((1562, 1589), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (1572, 1589), False, 'import torch\n'), ((2205, 2245), 'torchvision.transforms...
import tkinter as tk import pandas as pd import numpy as np from sklearn import tree from sklearn.tree import DecisionTreeClassifier # Import Decision Tree Classifier from sklearn.model_selection import train_test_split # Import train_test_split function from sklearn import metrics #Import scikit-learn metrics module f...
[ "tkinter.Label", "tkinter.Text", "tkinter.Tk.__init__", "csv.writer", "tkinter.Frame.__init__", "pandas.read_csv", "tkinter.Button", "sklearn.metrics.accuracy_score", "tkinter.Entry", "numpy.asarray", "sklearn.tree.DecisionTreeClassifier", "program.show", "numpy.arange", "matplotlib.pyplot...
[((715, 737), 'seaborn.set', 'sns.set', ([], {'style': '"""ticks"""'}), "(style='ticks')\n", (722, 737), True, 'import seaborn as sns\n'), ((738, 779), 'matplotlib.pyplot.rc', 'plt.rc', (['"""figure"""'], {'figsize': '(8, 5)', 'dpi': '(100)'}), "('figure', figsize=(8, 5), dpi=100)\n", (744, 779), True, 'from matplotlib...