code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from typing import Callable, List, Optional, Sequence, Tuple, Union import numpy as np import numpy.testing as npt from assertpy import assert_that from bokeh.plotting import Figure from scipy.stats import entropy from sklearn import metrics as sklmetrics from .._evaluation import Evaluation, Evaluator, Quantity from...
[ "assertpy.assert_that", "numpy.average", "numpy.testing.assert_array_equal", "numpy.asarray", "sklearn.metrics.accuracy_score", "scipy.stats.entropy", "sklearn.metrics.log_loss", "sklearn.metrics.roc_auc_score", "numpy.shape", "sklearn.metrics.f1_score", "numpy.mean", "numpy.array", "sklearn...
[((20192, 20216), 'numpy.asarray', 'np.asarray', (['ground_truth'], {}), '(ground_truth)\n', (20202, 20216), True, 'import numpy as np\n'), ((21773, 21797), 'numpy.array', 'np.array', (['sample_weights'], {}), '(sample_weights)\n', (21781, 21797), True, 'import numpy as np\n'), ((21944, 22001), 'numpy.testing.assert_ar...
from __future__ import division import numpy as np from utils import group_offsets class Scorer(object): def __init__(self, score_func, **kwargs): self.score_func = score_func self.kwargs = kwargs def __call__(self, *args): return self.score_func(*args, **self.kwargs) # Precision ...
[ "numpy.maximum", "numpy.sum", "numpy.argsort", "numpy.sort", "numpy.mean", "numpy.take", "numpy.array", "numpy.where", "numpy.arange", "utils.group_offsets" ]
[((372, 391), 'numpy.argsort', 'np.argsort', (['(-y_pred)'], {}), '(-y_pred)\n', (382, 391), True, 'import numpy as np\n'), ((405, 431), 'numpy.take', 'np.take', (['y_true', 'order[:k]'], {}), '(y_true, order[:k])\n', (412, 431), True, 'import numpy as np\n'), ((802, 821), 'numpy.argsort', 'np.argsort', (['(-y_pred)'],...
import os,sys import utils as ut import numpy as np import pandas as pd from random import seed, shuffle import loss_funcs as lf # loss funcs that can be optimized subject to various constraints import time SEED = 1122334455 seed(SEED) # set the random seed so that the random permutations can be reproduced again np.ra...
[ "utils.add_intercept", "utils.print_classifier_fairness_stats", "numpy.random.seed", "utils.compute_p_rule", "utils.check_accuracy", "pandas.read_csv", "utils.train_model", "utils.get_one_hot_encoding", "utils.split_into_train_test", "time.time", "utils.get_correlations", "numpy.array", "ran...
[((226, 236), 'random.seed', 'seed', (['SEED'], {}), '(SEED)\n', (230, 236), False, 'from random import seed, shuffle\n'), ((315, 335), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (329, 335), True, 'import numpy as np\n'), ((4947, 4971), 'numpy.array', 'np.array', (['y'], {'dtype': 'float'}), '(y...
# Author: <NAME> | <EMAIL> # March, 2021 # ============================================================================================ import numpy as np import cv2 class Video(): FONT = cv2.FONT_HERSHEY_SIMPLEX BLUE = (255,0,0) GREEN= (0,255,0) RED = (0,0,255) def __init__(self,pat...
[ "cv2.line", "cv2.putText", "cv2.cvtColor", "numpy.ones", "cv2.VideoCapture", "cv2.VideoWriter" ]
[((1783, 1842), 'cv2.putText', 'cv2.putText', (['frame', 'text[0]', '(w, 23)', 'Video.FONT', '(0.5)', '(0)', '(1)'], {}), '(frame, text[0], (w, 23), Video.FONT, 0.5, 0, 1)\n', (1794, 1842), False, 'import cv2\n'), ((1852, 1911), 'cv2.putText', 'cv2.putText', (['frame', 'text[1]', '(w, 40)', 'Video.FONT', '(0.4)', '(0)'...
import pandas as pd import numpy as np from python_utilities import dataframes, testing, utils # noqa def test_compress_dataframe(): test_df = testing.get_test_example() initial_memory = dataframes.get_memory_usage(test_df) dataframes.compress_dataframe(test_df) new_memory = dataframes.get_memory_u...
[ "python_utilities.testing.get_test_example", "python_utilities.utils.is_string", "python_utilities.dataframes.calc_rolling_agg", "python_utilities.dataframes.filter_using_multiindex", "pandas.DataFrame", "python_utilities.dataframes.get_columns_of_type", "python_utilities.utils.is_datetime_series", "p...
[((151, 177), 'python_utilities.testing.get_test_example', 'testing.get_test_example', ([], {}), '()\n', (175, 177), False, 'from python_utilities import dataframes, testing, utils\n'), ((199, 235), 'python_utilities.dataframes.get_memory_usage', 'dataframes.get_memory_usage', (['test_df'], {}), '(test_df)\n', (226, 23...
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "paddlenlp.data.Pad", "numpy.random.seed", "argparse.ArgumentParser", "paddlenlp.transformers.distill_utils.to_distill", "os.path.join", "random.Random", "os.path.exists", "paddle.no_grad", "random.seed", "paddle.DataParallel", "paddle.set_device", "concurrent.futures.ThreadPoolExecutor", "n...
[((1570, 1624), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': 'FORMAT'}), '(level=logging.INFO, format=FORMAT)\n', (1589, 1624), False, 'import logging\n'), ((1634, 1661), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1651, 1661), False, 'import ...
#!/usr/bin/python # -*- coding:utf-8 -*- """ 逻辑回归 sklearn """ import numpy as np import matplotlib.pyplot as plt from sklearn.datasets.samples_generator import make_blobs from sklearn.linear_model import LogisticRegression def createData(): """ 构建测试数据 创建100个点,分为两组 在X上面,增加一列1 """ np.random.se...
[ "matplotlib.pyplot.show", "numpy.random.seed", "matplotlib.pyplot.scatter", "numpy.ones", "sklearn.linear_model.LogisticRegression", "sklearn.datasets.samples_generator.make_blobs" ]
[((308, 325), 'numpy.random.seed', 'np.random.seed', (['(6)'], {}), '(6)\n', (322, 325), True, 'import numpy as np\n'), ((338, 427), 'sklearn.datasets.samples_generator.make_blobs', 'make_blobs', ([], {'n_samples': '(100)', 'n_features': '(2)', 'centers': '(2)', 'cluster_std': '(1.05)', 'random_state': '(20)'}), '(n_sa...
import random import numpy as np n=0 a=[] while n<100: q=(np.random.randint(2)) # print(q) n+=1 a.append(q) n=0 for index,v in enumerate(a): if index%2 ==0: if v==0: a[index]=1 else: if v==1: a[index]=0 for i in a: if i==1: n+=1 print(n)
[ "numpy.random.randint" ]
[((63, 83), 'numpy.random.randint', 'np.random.randint', (['(2)'], {}), '(2)\n', (80, 83), True, 'import numpy as np\n')]
""" 公用方法模块 """ import random import time import cv2 import numpy import pyautogui from PIL import ImageGrab import aircv as ac # 禁用 pyautogui 的保护性退出 pyautogui.FAILSAFE = False # 采用封装后的算法来进行识别 效率非常好 def find_and_click(target, factor): """ 整合整个流程,找到目标位置偏移后点击 :param target:目标图片位置 :return pos:最终点击的位置 ...
[ "random.randint", "PIL.ImageGrab.grab", "numpy.asarray", "aircv.find_template", "pyautogui.click", "aircv.imread", "pyautogui.moveTo" ]
[((367, 384), 'aircv.imread', 'ac.imread', (['target'], {}), '(target)\n', (376, 384), True, 'import aircv as ac\n'), ((438, 482), 'aircv.find_template', 'ac.find_template', (['screen', 'target', 'confidence'], {}), '(screen, target, confidence)\n', (454, 482), True, 'import aircv as ac\n'), ((1523, 1539), 'PIL.ImageGr...
# -*- coding: utf-8 -*- import copy,time import numpy as np from scipy.spatial.distance import cdist from scipy.spatial import cKDTree from scipy.optimize import linear_sum_assignment from scipy.spatial.transform import Rotation from ase.data import atomic_numbers,atomic_masses_iupac2016 from mcse import Structur...
[ "numpy.sum", "numpy.abs", "mcse.Structure", "numpy.argmin", "numpy.argsort", "numpy.arange", "numpy.linalg.norm", "mcse.Structure.from_geo", "scipy.spatial.cKDTree", "numpy.unique", "mcse.crystals.standardize", "mcse.molecules.symmetry.get_mirror_symmetry", "mcse.molecules.utils.rot_mol", ...
[((4287, 4309), 'copy.deepcopy', 'copy.deepcopy', (['struct1'], {}), '(struct1)\n', (4300, 4309), False, 'import copy, time\n'), ((4333, 4355), 'copy.deepcopy', 'copy.deepcopy', (['struct2'], {}), '(struct2)\n', (4346, 4355), False, 'import copy, time\n'), ((5561, 5630), 'mcse.crystals.SupercellSphere', 'SupercellSpher...
import matplotlib.pyplot as plt import numpy as np FibArray = [1, 1] N = 10 def fibonacci(n): if n < 0: print("Incorrect input") elif n <= len(FibArray): return FibArray[n - 1] else: temp_fib = fibonacci(n - 1) + fibonacci(n - 2) FibArray.append(temp_fib) return te...
[ "numpy.arange", "numpy.exp", "matplotlib.pyplot.plot", "matplotlib.pyplot.show" ]
[((363, 382), 'numpy.arange', 'np.arange', (['*x_range'], {}), '(*x_range)\n', (372, 382), True, 'import numpy as np\n'), ((423, 437), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (431, 437), True, 'import matplotlib.pyplot as plt\n'), ((442, 452), 'matplotlib.pyplot.show', 'plt.show', ([], {}), ...
import numpy as np x = np.array([[1,2],[3,4]]) print(np.sum(x)) # Compute sum of all elements; prints "10" print(np.sum(x, axis=0)) # Compute sum of each column; prints "[4 6]" print(np.sum(x, axis=1)) # Compute sum of each row; prints "[3 7]"
[ "numpy.array", "numpy.sum" ]
[((24, 50), 'numpy.array', 'np.array', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (32, 50), True, 'import numpy as np\n'), ((55, 64), 'numpy.sum', 'np.sum', (['x'], {}), '(x)\n', (61, 64), True, 'import numpy as np\n'), ((116, 133), 'numpy.sum', 'np.sum', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (122, 133), ...
# encoding: utf-8 # ****************************************************** # Author : zzw922cn # Last modified: 2017-12-09 11:00 # Email : <EMAIL> # Filename : ed.py # Description : Calculating edit distance for Automatic Speech Recognition # ****************************************************** imp...
[ "numpy.asarray", "tensorflow.Session", "tensorflow.edit_distance", "numpy.array", "tensorflow.Graph", "tensorflow.sparse_placeholder" ]
[((2362, 2372), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2370, 2372), True, 'import tensorflow as tf\n'), ((2202, 2219), 'numpy.array', 'np.array', (['indices'], {}), '(indices)\n', (2210, 2219), True, 'import numpy as np\n'), ((2221, 2235), 'numpy.array', 'np.array', (['vals'], {}), '(vals)\n', (2229, 2235),...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import datetime as dt import numpy as np from ..utils.deprecation import rename_parameter from ..utils.logging import logger_init from ..extern import six from ..exter...
[ "numpy.ma.masked_where", "numpy.datetime64", "numpy.frombuffer", "numpy.asarray", "numpy.asanyarray", "numpy.dtype", "numpy.zeros", "numpy.char.decode", "datetime.datetime.strptime", "numpy.ma.getmask", "numpy.array", "numpy.char.strip", "numpy.where", "numpy.ma.is_masked", "numpy.asscal...
[((8870, 8885), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (8878, 8885), True, 'import numpy as np\n'), ((14219, 14252), 'numpy.issubdtype', 'np.issubdtype', (['dtype', 'np.unicode_'], {}), '(dtype, np.unicode_)\n', (14232, 14252), True, 'import numpy as np\n'), ((17178, 17217), 'numpy.frombuffer', 'np.fr...
# -*- coding: utf-8 -*- ''' setup.py -------------------------------------------------- part of the fastmat package Setup script for installation of fastmat package Usecases: - install fastmat package system-wide on your machine (needs su privileges) EXAMPLE: 'python setup.py install' -...
[ "subprocess.Popen", "os.path.dirname", "os.path.exists", "re.match", "distutils.core.Extension", "os.path.isfile", "numpy.get_include", "platform.system", "sys.exit" ]
[((4850, 4867), 'platform.system', 'platform.system', ([], {}), '()\n', (4865, 4867), False, 'import platform\n'), ((2139, 2165), 'os.path.isfile', 'os.path.isfile', (['""".version"""'], {}), "('.version')\n", (2153, 2165), False, 'import os\n'), ((3509, 3556), 're.match', 're.match', (['"""[.+\\\\d+]+\\\\d*[abr]\\\\d*...
# Audio Processing Imports import librosa import soundfile # Other Imports import numpy as np def feature_extract(filename: str, single=True): """ Extract features from audio required for model training. Parameters: - filename: path to the file - single: if True, returns one numpy object...
[ "librosa.feature.melspectrogram", "numpy.hstack", "numpy.array", "librosa.feature.chroma_stft", "soundfile.SoundFile", "librosa.feature.mfcc", "librosa.stft" ]
[((385, 414), 'soundfile.SoundFile', 'soundfile.SoundFile', (['filename'], {}), '(filename)\n', (404, 414), False, 'import soundfile\n'), ((629, 641), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (637, 641), True, 'import numpy as np\n'), ((795, 818), 'numpy.hstack', 'np.hstack', (['(data, mfcc)'], {}), '((data, ...
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== """Q learning parameters.""" import numpy as np import ast import configparser c...
[ "configparser.ConfigParser", "numpy.array" ]
[((619, 646), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (644, 646), False, 'import configparser\n'), ((3463, 3503), 'numpy.array', 'np.array', (['self.discretization_resolution'], {}), '(self.discretization_resolution)\n', (3471, 3503), True, 'import numpy as np\n')]
#!/usr/bin/env python # ------------------------------------------------------------------------------------------------------% # Created by "Thieu" at 10:36, 28/01/2021 % # ...
[ "numpy.random.uniform", "copy.deepcopy", "uuid.uuid4", "numpy.sum", "numpy.zeros", "numpy.ones", "time.time", "numpy.any", "numpy.cumsum", "numpy.min", "numpy.max", "numpy.array", "sys.exit", "numpy.delete", "numpy.all", "utils.schedule_util.matrix_to_schedule" ]
[((2510, 2521), 'numpy.zeros', 'zeros', (['size'], {}), '(size)\n', (2515, 2521), False, 'from numpy import array, inf, zeros, all, any, cumsum, delete, ones, min, max, sum\n'), ((2586, 2636), 'numpy.array', 'array', (['[solution[self.ID_FIT] for solution in pop]'], {}), '([solution[self.ID_FIT] for solution in pop])\n...
"""CARLA Environment Wrapper This script provides gym wrapper classes to handle possible variations of the base env. Classes: * MultiAgentWrapper - wrapper class for multi-agent setups * SkipFrameWrapper - wrapper class to handle frame skipping * SpaceWrapper - wrapper class for gym observation and action...
[ "carla.Location", "numpy.array", "gym.spaces.Box", "carla.Vector3D" ]
[((4607, 4639), 'gym.spaces.Box', 'Box', (['low', 'high'], {'dtype': 'np.float32'}), '(low, high, dtype=np.float32)\n', (4610, 4639), False, 'from gym.spaces import Box, Dict\n'), ((5156, 5208), 'gym.spaces.Box', 'Box', ([], {'low': 'low', 'high': 'high', 'shape': 'shape', 'dtype': 'np.uint8'}), '(low=low, high=high, s...
from numpy.random import rand import numpy as np import random def object(data, iter): sum = 0 for i in range(len(data)-1): iter +=1 sum += data[i]**2 return sum, iter """ Description: function which can be called objective take square of value that came from out,then increas...
[ "numpy.random.uniform", "numpy.arange", "random.randint", "random.uniform" ]
[((1210, 1256), 'numpy.random.uniform', 'np.random.uniform', (['min', 'max', 'countOfPopulation'], {}), '(min, max, countOfPopulation)\n', (1227, 1256), True, 'import numpy as np\n'), ((1416, 1437), 'random.randint', 'random.randint', (['(0)', '(10)'], {}), '(0, 10)\n', (1430, 1437), False, 'import random\n'), ((2068, ...
""" Copyright 2018 Johns Hopkins University (Author: <NAME>) Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ from __future__ import absolute_import from __future__ import print_function from __future__ import division from six.moves import xrange import os.path as path import copy import numpy as np i...
[ "copy.deepcopy", "h5py.File", "numpy.ix_", "numpy.unique", "numpy.asarray", "numpy.setdiff1d", "numpy.any", "six.moves.xrange", "os.path.splitext", "numpy.logical_or", "numpy.union1d", "numpy.all" ]
[((1207, 1226), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (1220, 1226), False, 'import copy\n'), ((1712, 1736), 'os.path.splitext', 'path.splitext', (['file_path'], {}), '(file_path)\n', (1725, 1736), True, 'import os.path as path\n'), ((3533, 3557), 'os.path.splitext', 'path.splitext', (['file_path...
from distutils.core import setup from Cython.Distutils import build_ext from Cython.Distutils.extension import Extension import numpy setup( ext_modules=[ Extension('bench', ['bench.pyx'], include_dirs=[numpy.get_include()], #extra_link_args=['-fopenmp'], extra_compile_args=['-fopenmp'], ...
[ "numpy.get_include" ]
[((217, 236), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (234, 236), False, 'import numpy\n')]
# Forecasting/autoforecast/src/models/keras_models.py import numpy as np import tensorflow as tf from autoforecast import metrics from autoforecast.configs.configspace.neural_net_space import ( base_keras_space, base_keras_x0, lstm_keras_space, lstm_keras_x0, ) from autoforecast.models.hyperparameters i...
[ "keras.Model", "keras.layers.LSTM", "tensorflow.keras.losses.MeanAbsolutePercentageError", "autoforecast.models.hyperparameters.HyperparametersTuner", "keras.layers.Dense", "tensorflow.keras.optimizers.Adam", "keras.layers.Input", "numpy.concatenate" ]
[((1333, 1367), 'keras.layers.Input', 'Input', ([], {'shape': '(n_input, n_features)'}), '(shape=(n_input, n_features))\n', (1338, 1367), False, 'from keras.layers import LSTM, Dense, Input\n'), ((1484, 1521), 'keras.Model', 'Model', ([], {'inputs': 'inputs', 'outputs': 'outputs'}), '(inputs=inputs, outputs=outputs)\n'...
# Copyright 2019 <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # d...
[ "keras.models.load_model", "keras.backend.placeholder", "keras.backend.learning_phase", "keras.backend.get_session", "numpy.expand_dims", "time.time", "PIL.Image.open", "numpy.array", "panorama._refmodels.yolo.keras_yolo.yolo_eval" ]
[((3445, 3467), 'keras.models.load_model', 'load_model', (['model_path'], {}), '(model_path)\n', (3455, 3467), False, 'from keras.models import load_model\n'), ((3488, 3503), 'keras.backend.get_session', 'K.get_session', ([], {}), '()\n', (3501, 3503), True, 'import keras.backend as K\n'), ((3716, 3741), 'keras.backend...
''' In this task we apply MOG2 background subtraction. ''' import cv2 import numpy as np import matplotlib.pyplot as plt def threshold_binarize(img): return np.where(img>45, 255, 0) def imshow_components(labels): label_hue = np.uint8(179*labels/np.max(labels)) blank_ch = 255*np.ones_like(label_hue) ...
[ "cv2.createBackgroundSubtractorMOG2", "matplotlib.pyplot.show", "numpy.ones_like", "cv2.cvtColor", "matplotlib.pyplot.imshow", "cv2.getStructuringElement", "cv2.morphologyEx", "numpy.ones", "cv2.connectedComponents", "cv2.imread", "numpy.max", "numpy.where", "cv2.merge" ]
[((166, 192), 'numpy.where', 'np.where', (['(img > 45)', '(255)', '(0)'], {}), '(img > 45, 255, 0)\n', (174, 192), True, 'import numpy as np\n'), ((336, 378), 'cv2.merge', 'cv2.merge', (['[label_hue, blank_ch, blank_ch]'], {}), '([label_hue, blank_ch, blank_ch])\n', (345, 378), False, 'import cv2\n'), ((397, 441), 'cv2...
""" Adapted from https://towardsdatascience.com/introduction-to-hidden-markov-models-cd2c93e6b781 May.2.20 """ import numpy as np import pandas as pd obs_map = {'Cold': 0, 'Hot': 1} obs = np.array([1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1]) inv_obs_map = dict((v, k) for k, v in obs_map.items()) obs_seq = [inv_obs_ma...
[ "pandas.DataFrame", "numpy.array", "pandas.Series", "numpy.column_stack" ]
[((190, 242), 'numpy.array', 'np.array', (['[1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1]'], {}), '([1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1])\n', (198, 242), True, 'import numpy as np\n'), ((612, 661), 'pandas.Series', 'pd.Series', (['pi'], {'index': 'hidden_states', 'name': '"""states"""'}), "(pi, index=hidden_states, ...
from numpy import array as ary; from numpy import log as ln from numpy import cos, sin, pi, sqrt, exp, arccos; tau = 2*pi import numpy as np; from matplotlib import pyplot as plt # from math import factorial # fac = lambda a: ary([factorial(i) for i in a]) from scipy.special import factorial as fac """ This module exp...
[ "matplotlib.pyplot.title", "scipy.special.factorial", "numpy.outer", "matplotlib.pyplot.show", "numpy.nan_to_num", "numpy.arange", "numpy.exp", "numpy.array", "numpy.log10", "numpy.add.outer", "numpy.sqrt" ]
[((1559, 1573), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (1568, 1573), True, 'import numpy as np\n'), ((1648, 1655), 'numpy.sqrt', 'sqrt', (['N'], {}), '(N)\n', (1652, 1655), False, 'from numpy import cos, sin, pi, sqrt, exp, arccos\n'), ((2952, 3049), 'matplotlib.pyplot.title', 'plt.title', (['"""sqrt ...
from __future__ import division import os import string import json import uuid import pdb import re import time import six import xlsxwriter import pandas as pd import numpy as np def generate_output(GlobalData,excel=True,dataframe=True,config=True): try: if excel: fpath=os.path.join(GlobalData.config['output...
[ "pandas.DataFrame", "uuid.uuid4", "dyntools.CHNF", "xlsxwriter.Workbook", "psspy.psseversion", "re.findall", "numpy.array", "numpy.bitwise_and", "os.path.join" ]
[((961, 987), 'xlsxwriter.Workbook', 'xlsxwriter.Workbook', (['fpath'], {}), '(fpath)\n', (980, 987), False, 'import xlsxwriter\n'), ((5244, 5320), 'os.path.join', 'os.path.join', (["GlobalData.config['outputConfig']['outputDir']", '"""options.json"""'], {}), "(GlobalData.config['outputConfig']['outputDir'], 'options.j...
# coding: utf-8 # Creates: # * line_velocity.pdf # * velocity_compare_guitierrez.pdf # * snec_velocity_comp.pdf # * phot_velocity_table.csv # In[1]: import os import glob from collections import namedtuple from astropy.io import ascii as asc from astropy.time import Time from astropy import table import astrop...
[ "astropy.table.Table", "astropy.constants.c.to", "numpy.abs", "matplotlib.pyplot.axes", "astropy.time.Time", "matplotlib.pyplot.legend", "numpy.argsort", "matplotlib.pyplot.ion", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "numpy.array", "numpy.interp", "matplotlib.pyplot.ylab...
[((549, 600), 'matplotlib.pyplot.style.use', 'plt.style.use', (["['seaborn-paper', 'az-paper-onecol']"], {}), "(['seaborn-paper', 'az-paper-onecol'])\n", (562, 600), True, 'from matplotlib import pyplot as plt\n'), ((1001, 1037), 'utilities_az.supernova.LightCurve2', 'supernova.LightCurve2', (['"""asassn-15oz"""'], {})...
"""Generate the HTML for the color palette. The colors in 'color_palette_colors.csv' are from Material Design's color system. They are the first 10 shades of each color. The A100, A200, A400, A700 colors shades were not included. Material Design's color system: https://material.io/design/color/the-color-system.html#to...
[ "numpy.genfromtxt" ]
[((407, 448), 'numpy.genfromtxt', 'np.genfromtxt', (['"""color_palette_colors.csv"""'], {}), "('color_palette_colors.csv')\n", (420, 448), True, 'import numpy as np\n')]
from ddapp.drakevisualizer import DrakeVisualizerApp from ddapp import objectmodel as om from ddapp import vtkNumpy as vnp from ddapp import lcmUtils from ddapp import filterUtils from ddapp import transformUtils from ddapp.debugVis import DebugData from ddapp import visualization as vis from ddapp import applogic imp...
[ "numpy.degrees", "ddapp.objectmodel.findObjectByName", "ddapp.debugVis.DebugData", "ddapp.transformUtils.getAxesFromTransform", "numpy.array", "ddapp.lcmUtils.addSubscriber", "ddapp.applogic.setBackgroundColor", "ddapp.filterUtils.computeDelaunay3D", "ddapp.objectmodel.removeFromObjectModel", "dda...
[((715, 740), 'ddapp.objectmodel.findObjectByName', 'om.findObjectByName', (['name'], {}), '(name)\n', (734, 740), True, 'from ddapp import objectmodel as om\n'), ((799, 814), 'numpy.array', 'np.array', (['msg.V'], {}), '(msg.V)\n', (807, 814), True, 'import numpy as np\n'), ((877, 916), 'ddapp.filterUtils.computeDelau...
# -*- coding: utf-8 -*- import os import pandas as pd # gestionar datasets import numpy as np #gestionar numeros import matplotlib.pyplot as plt # hacer gráficos os.chdir('/Users/pablobottero/github/master/python/data_analysis/tasks/first_one') print(os.getcwd()) songs = pd.read_csv('spotify.csv', sep=',...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.hist", "pandas.read_csv", "os.getcwd", "matplotlib.pyplot.bar", "numpy.std", "matplotlib.pyplot.text", "numpy.mean", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.chdir", "matplotlib.pyplo...
[((176, 263), 'os.chdir', 'os.chdir', (['"""/Users/pablobottero/github/master/python/data_analysis/tasks/first_one"""'], {}), "(\n '/Users/pablobottero/github/master/python/data_analysis/tasks/first_one')\n", (184, 263), False, 'import os\n'), ((287, 335), 'pandas.read_csv', 'pd.read_csv', (['"""spotify.csv"""'], {'...
# -*- coding: utf-8 -*- """ Created on Thu Mar 22 18:43:21 2018 @author: Raj """ import numpy as np def load_mask_txt(path, rows=64, flip=False): """ Loads mask from text :param path: Filepath to disk location of the mask :type path: str :param rows: Sets a hard limit on the rows of the mask, due to Igor i...
[ "numpy.copy", "numpy.fliplr", "numpy.append", "numpy.mean", "numpy.where", "numpy.array", "numpy.loadtxt" ]
[((563, 579), 'numpy.loadtxt', 'np.loadtxt', (['path'], {}), '(path)\n', (573, 579), True, 'import numpy as np\n'), ((1406, 1419), 'numpy.copy', 'np.copy', (['mask'], {}), '(mask)\n', (1413, 1419), True, 'import numpy as np\n'), ((1454, 1477), 'numpy.where', 'np.where', (['(mask_nan == 0)'], {}), '(mask_nan == 0)\n', (...
import logging import weakref import sys from typing import Optional, Callable, TextIO, Tuple import numpy as np # type: ignore from sunode import basic from sunode.basic import lib, ffi, data_dtype, index_dtype, Borrows, notnull, as_numpy, CPointer logger = logging.getLogger("sunode.vector") def empty_vector(le...
[ "sunode.basic.lib.N_VDestroy_Serial", "sunode.basic.lib.N_VGetArrayPointer_Serial", "sunode.basic.lib.N_VNew_Serial", "numpy.dtype", "sunode.basic.lib.N_VGetLength_Serial", "sunode.basic.ffi.from_buffer", "sunode.basic.notnull", "logging.getLogger" ]
[((264, 298), 'logging.getLogger', 'logging.getLogger', (['"""sunode.vector"""'], {}), "('sunode.vector')\n", (281, 298), False, 'import logging\n'), ((612, 637), 'sunode.basic.lib.N_VNew_Serial', 'lib.N_VNew_Serial', (['length'], {}), '(length)\n', (629, 637), False, 'from sunode.basic import lib, ffi, data_dtype, ind...
import os.path as osp import cv2 import torch.utils.data as data import xml.etree.ElementTree as ET from lib.datasets.det_dataset import DetDataset import numpy as np from six.moves import urllib import pickle #import lmdb TEMP_LP_CLASSES = ('part_cover','all_cover','lp', 'nolp', 'dirty_cover','other_cover','blur','l...
[ "pickle.loads", "xml.etree.ElementTree.parse", "os.path.join", "os.path.isdir", "random.shuffle", "cv2.imdecode", "numpy.zeros", "six.moves.urllib.request.urlopen", "numpy.array", "os.path.expanduser" ]
[((8221, 8244), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (8239, 8244), False, 'import sys, os\n'), ((8350, 8389), 'os.path.join', 'os.path.join', (['HOME', '"""data/coverLP_det/"""'], {}), "(HOME, 'data/coverLP_det/')\n", (8362, 8389), False, 'import sys, os\n'), ((9068, 9095), 'random....
# -*- coding: UTF-8 -*- from __future__ import print_function import gzip from subprocess import * import numpy as np try: import matplotlib as mpl mpl.use('Agg') import seaborn import matplotlib.pyplot as plt plt.style.use('seaborn-ticks') from matplotlib import transforms import matp...
[ "matplotlib.transforms.offset_copy", "matplotlib.pyplot.show", "matplotlib.font_manager.FontProperties", "numpy.sum", "numpy.power", "seaborn.despine", "matplotlib.pyplot.style.use", "matplotlib.use", "numpy.array", "numpy.arange", "gzip.GzipFile", "matplotlib.pyplot.xkcd" ]
[((161, 175), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (168, 175), True, 'import matplotlib as mpl\n'), ((236, 266), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-ticks"""'], {}), "('seaborn-ticks')\n", (249, 266), True, 'import matplotlib.pyplot as plt\n'), ((2008, 2022), 'numpy.a...
#!/usr/bin/python3 ''' This script does the following: 1. measure gayscale to determine if image captured is too dark ''' import numpy as np import cv2 import jetson.inference import jetson.utils import os def Camera_Setting(): #setting attributes fps = "15" brightness = "64" contrast = "12" sat...
[ "cv2.cvtColor", "cv2.imread", "os.system", "numpy.reshape" ]
[((1824, 1843), 'os.system', 'os.system', (['commands'], {}), '(commands)\n', (1833, 1843), False, 'import os\n'), ((1956, 1976), 'cv2.imread', 'cv2.imread', (['filepath'], {}), '(filepath)\n', (1966, 1976), False, 'import cv2\n'), ((1992, 2038), 'cv2.cvtColor', 'cv2.cvtColor', (['image_rgb_np', 'cv2.COLOR_BGR2GRAY'], ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pandas as pd import numpy as np import sys from pyannotation.utils import open_potential_gz from multiprocessing import Pool import time def parallelize_dataframe(df, func, n_cores=8): df_split = np.array_split(df, n_cores) pool = Pool(n_cores) df = pd....
[ "pandas.read_csv", "time.time", "pyannotation.utils.open_potential_gz", "multiprocessing.Pool", "numpy.array_split", "pandas.to_numeric" ]
[((255, 282), 'numpy.array_split', 'np.array_split', (['df', 'n_cores'], {}), '(df, n_cores)\n', (269, 282), True, 'import numpy as np\n'), ((294, 307), 'multiprocessing.Pool', 'Pool', (['n_cores'], {}), '(n_cores)\n', (298, 307), False, 'from multiprocessing import Pool\n'), ((1378, 1389), 'time.time', 'time.time', ([...
import json import os from collections import defaultdict from typing import Callable, Dict, Optional, Tuple import numpy as np from tqdm import tqdm import torch from torch.nn import Module from torch.utils.data import DataLoader from torch.optim.optimizer import Optimizer from src.utils.metrics import evaluate_batc...
[ "os.makedirs", "torch.load", "os.path.exists", "json.dumps", "collections.defaultdict", "numpy.mean", "torch.no_grad", "src.utils.metrics.evaluate_batch" ]
[((1742, 1766), 'collections.defaultdict', 'defaultdict', (['(lambda : [])'], {}), '(lambda : [])\n', (1753, 1766), False, 'from collections import defaultdict\n'), ((3931, 3958), 'os.makedirs', 'os.makedirs', (['model_save_dir'], {}), '(model_save_dir)\n', (3942, 3958), False, 'import os\n'), ((4649, 4676), 'numpy.mea...
"""This aims to do very fast and simple astrometric calibration of images. Author <NAME> written in python 3 """ # # #Author <NAME> #written in python 3 import numpy as np import pandas as pd import matplotlib.pyplot as plt # from sklearn.externals import joblib ##load pkl (pickle) file # from datetime import dat...
[ "matplotlib.pyplot.title", "photutils.aperture_photometry", "argparse.ArgumentParser", "pandas.read_csv", "astropy.stats.sigma_clipped_stats", "get_transformation.find_matches_keep_catalog_info", "numpy.isnan", "matplotlib.pyplot.figure", "matplotlib.colors.LogNorm", "get_catalog_data.get_photomet...
[((1609, 1646), 'astropy.stats.sigma_clipped_stats', 'sigma_clipped_stats', (['image'], {'sigma': '(3.0)'}), '(image, sigma=3.0)\n', (1628, 1646), False, 'from astropy.stats import sigma_clipped_stats\n'), ((1726, 1785), 'photutils.DAOStarFinder', 'DAOStarFinder', ([], {'fwhm': '(4.0)', 'threshold': '(5.0 * std)', 'bri...
''' Defines train_step_fns which allow fancy training regimens ''' from __future__ import absolute_import, division, print_function import numpy as np import time import tensorflow as tf import tensorflow.contrib.slim as slim ######################## # Train step functions ######################## def gan_train_ste...
[ "tensorflow.identity", "tensorflow.constant", "time.time", "tensorflow.assign", "numpy.mean", "tensorflow.mod", "tensorflow.greater_equal", "tensorflow.name_scope" ]
[((1284, 1295), 'time.time', 'time.time', ([], {}), '()\n', (1293, 1295), False, 'import time\n'), ((3551, 3562), 'time.time', 'time.time', ([], {}), '()\n', (3560, 3562), False, 'import time\n'), ((2299, 2310), 'time.time', 'time.time', ([], {}), '()\n', (2308, 2310), False, 'import time\n'), ((3083, 3100), 'numpy.mea...
import numpy as np import time from Adafruit_PWM_Servo_Driver import PWM from rlrobo.utils import set_servo_angle # Initialise the PWM device using the default address pwm = PWM(0x40) min_pulse = 150 # Min pulse length out of 4096 max_pulse = 600 # Max pulse length out of 4096 min_angle = 10 max_angle = 170 # S...
[ "time.sleep", "Adafruit_PWM_Servo_Driver.PWM", "numpy.linspace", "rlrobo.utils.set_servo_angle" ]
[((178, 185), 'Adafruit_PWM_Servo_Driver.PWM', 'PWM', (['(64)'], {}), '(64)\n', (181, 185), False, 'from Adafruit_PWM_Servo_Driver import PWM\n'), ((420, 460), 'numpy.linspace', 'np.linspace', (['min_angle', 'max_angle', 'steps'], {}), '(min_angle, max_angle, steps)\n', (431, 460), True, 'import numpy as np\n'), ((466,...
#!/usr/bin/env python3 from __future__ import division from optparse import OptionParser import roslib import rospy import rosparam import copy # import cv: open cv 1 not used import cv2 import numpy as np import threading import dynamic_reconfigure.server from cv_bridge import CvBridge, CvBridgeError from sensor_msgs....
[ "rospy.logwarn", "cv_bridge.CvBridge", "numpy.zeros_like", "rospy.Subscriber", "distutils.version.StrictVersion", "optparse.OptionParser", "cv2.cvtColor", "rospy.ServiceProxy", "rospy.Publisher", "rospy.spin", "numpy.zeros", "rospy.get_param", "rospy.is_shutdown", "numpy.random.randint", ...
[((765, 787), 'distutils.version.StrictVersion', 'StrictVersion', (['"""3.0.0"""'], {}), "('3.0.0')\n", (778, 787), False, 'from distutils.version import LooseVersion, StrictVersion\n'), ((10971, 10985), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (10983, 10985), False, 'from optparse import OptionParser...
import pickle import random import numpy as np def load_counts(dataset): fname = "{}_counts".format(dataset) with open(fname, 'rb') as f: loaded_cls_counts = pickle.load(f) return loaded_cls_counts def avg_cls_weights(dataset, num_classes): all_class_freq = load_counts(dataset) J = 40 ...
[ "random.shuffle", "pickle.load", "numpy.zeros" ]
[((353, 373), 'random.shuffle', 'random.shuffle', (['keys'], {}), '(keys)\n', (367, 373), False, 'import random\n'), ((399, 443), 'numpy.zeros', 'np.zeros', (['(J, num_classes)'], {'dtype': 'np.float32'}), '((J, num_classes), dtype=np.float32)\n', (407, 443), True, 'import numpy as np\n'), ((175, 189), 'pickle.load', '...
__author__ = "noe" import numpy as np def mean_finite_(x, min_finite=1): """ Computes mean over finite values """ isfin = np.isfinite(x) if np.count_nonzero(isfin) > min_finite: return np.mean(x[isfin]) else: return np.nan def std_finite_(x, min_finite=2): """ Computes mean over...
[ "numpy.count_nonzero", "numpy.concatenate", "numpy.log", "numpy.random.randn", "numpy.std", "numpy.sum", "numpy.zeros", "numpy.isfinite", "numpy.histogram", "numpy.mean", "numpy.arange", "numpy.exp", "numpy.linspace", "numpy.random.choice", "numpy.vstack", "numpy.sqrt" ]
[((133, 147), 'numpy.isfinite', 'np.isfinite', (['x'], {}), '(x)\n', (144, 147), True, 'import numpy as np\n'), ((351, 365), 'numpy.isfinite', 'np.isfinite', (['x'], {}), '(x)\n', (362, 365), True, 'import numpy as np\n'), ((2649, 2669), 'numpy.linspace', 'np.linspace', (['l', 'r', 'n'], {}), '(l, r, n)\n', (2660, 2669...
#encoding=utf8 import os import numpy as np os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "1" from tensorflow.keras import backend as K import tensorflow as tf batch_size = 1 time_step = 3 dim = 2 x = np.random.rand(batch_size, time_step, dim) # [1,3,2]生成输入 init_state = np.zeros(...
[ "numpy.random.rand", "tensorflow.keras.backend.rnn", "tensorflow.keras.backend.sum", "numpy.zeros" ]
[((240, 282), 'numpy.random.rand', 'np.random.rand', (['batch_size', 'time_step', 'dim'], {}), '(batch_size, time_step, dim)\n', (254, 282), True, 'import numpy as np\n'), ((470, 525), 'tensorflow.keras.backend.rnn', 'K.rnn', (['step_func'], {'inputs': 'x', 'initial_states': '[init_state]'}), '(step_func, inputs=x, ini...
import numpy as np import pandas as pd from app_data import AppData from page.base_page import BasePage import streamlit as st class Token2VecPage(BasePage): def __init__(self, app_data: AppData, **kwargs): super().__init__(app_data, **kwargs) self.title = 'token2vec' st.title(self.title)...
[ "pandas.DataFrame", "numpy.log", "streamlit.title" ]
[((300, 320), 'streamlit.title', 'st.title', (['self.title'], {}), '(self.title)\n', (308, 320), True, 'import streamlit as st\n'), ((794, 867), 'pandas.DataFrame', 'pd.DataFrame', (['token_sim'], {'columns': "['token', 'similarity', 'tags_in_token']"}), "(token_sim, columns=['token', 'similarity', 'tags_in_token'])\n"...
import eml_toolbox as eml; import numpy as np; import glob; from matplotlib import pyplot as plt; from IPython import get_ipython _ipython = get_ipython(); #%% first close everything: plt.close("all"); #%% define parameters: # define search string to find images: folder_search_str = "demo_images/*.tif*" # define...
[ "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.exp", "glob.glob", "numpy.atleast_2d", "matplotlib.pyplot.close", "matplotlib.pyplot.imshow", "numpy.append", "numpy.max", "IPython.get_ipython", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "numpy.ceil", "matplot...
[((141, 154), 'IPython.get_ipython', 'get_ipython', ([], {}), '()\n', (152, 154), False, 'from IPython import get_ipython\n'), ((185, 201), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (194, 201), True, 'from matplotlib import pyplot as plt\n'), ((409, 434), 'numpy.arange', 'np.arange', (['...
import numpy as np import os from scipy.ndimage import zoom import time import pyglet from pyglet.text import Label from pyglet.window import key, Window class Im(object): def __init__(self, display=None): self.window = None self.isopen = False self.display = display self.last_key...
[ "os.mkdir", "numpy.load", "numpy.save", "numpy.flip", "numpy.random.uniform", "pyglet.text.Label", "numpy.abs", "pyglet.window.key.symbol_string", "os.path.exists", "scipy.ndimage.zoom", "time.time", "time.sleep", "pyglet.window.Window", "os.listdir" ]
[((791, 802), 'time.time', 'time.time', ([], {}), '()\n', (800, 802), False, 'import time\n'), ((1712, 1861), 'pyglet.text.Label', 'Label', (['text'], {'font_name': '"""Times New Roman"""', 'font_size': '(12)', 'anchor_x': '"""center"""', 'anchor_y': '"""center"""', 'x': '(self.window.width // 2)', 'y': '(self.window.h...
from tensorflow.keras.models import load_model from collections import deque import numpy as np import argparse import pickle import cv2 import time import keras from imutils.video import VideoStream bg = None aWeight = 0.5 num_frames = 0 top, right, bottom, left = 175,350,399,574 fgbg = cv2.createBack...
[ "cv2.GaussianBlur", "argparse.ArgumentParser", "cv2.bitwise_and", "numpy.argmax", "cv2.VideoWriter_fourcc", "cv2.VideoWriter", "cv2.rectangle", "cv2.imshow", "collections.deque", "cv2.cvtColor", "cv2.resize", "tensorflow.keras.models.load_model", "cv2.waitKey", "cv2.flip", "cv2.createBac...
[((306, 342), 'cv2.createBackgroundSubtractorMOG2', 'cv2.createBackgroundSubtractorMOG2', ([], {}), '()\n', (340, 342), False, 'import cv2\n'), ((546, 571), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (569, 571), False, 'import argparse\n'), ((1084, 1109), 'tensorflow.keras.models.load_model...
#!/usr/bin/env python2.7 # encoding: utf-8 """ multivariate_normal.py Created by <NAME> on 2011-04-19. Copyright (c) 2011 University of Strathclyde. All rights reserved. """ import sys import os import numpy as np import matplotlib.pyplot as plt def main(): mu = [0,0] cov = [[1,0],[0,1]] x,y = np.random.multivar...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "matplotlib.pyplot.hexbin", "numpy.random.multivariate_normal" ]
[((351, 363), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (361, 363), True, 'import matplotlib.pyplot as plt\n'), ((365, 384), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y', '"""x"""'], {}), "(x, y, 'x')\n", (373, 384), True, 'import matplotlib.pyplot as plt\n'), ((386, 398), 'matplotlib.pyplot.figur...
import numpy as np #from sklearn.preprocessing import normalize import cv2 print('loading images...') imgL = cv2.imread('D:\\tsucuba_left.PNG') imgR = cv2.imread('D:\\tsucuba_right.PNG') # SGBM Parameters ----------------- window_size = 3 left_matcher = cv2.StereoSGBM_create( ...
[ "numpy.uint8", "cv2.imwrite", "cv2.imread", "cv2.ximgproc.createDisparityWLSFilter", "cv2.ximgproc.createRightMatcher", "cv2.normalize", "numpy.int16", "cv2.StereoSGBM_create" ]
[((117, 151), 'cv2.imread', 'cv2.imread', (['"""D:\\\\tsucuba_left.PNG"""'], {}), "('D:\\\\tsucuba_left.PNG')\n", (127, 151), False, 'import cv2\n'), ((160, 195), 'cv2.imread', 'cv2.imread', (['"""D:\\\\tsucuba_right.PNG"""'], {}), "('D:\\\\tsucuba_right.PNG')\n", (170, 195), False, 'import cv2\n'), ((292, 561), 'cv2.S...
import scipy import numpy as np import matplotlib import matplotlib.pyplot as plt from matplotlib.ticker import EngFormatter class AmplitudePlot: def __init__(self, sample_rate=48000, min_dBFS=None, max_dBFS=None, min_val=None, max_val=None ):...
[ "numpy.abs", "numpy.linspace", "scipy.signal.hilbert", "numpy.log10", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((953, 986), 'scipy.signal.hilbert', 'scipy.signal.hilbert', (['self.signal'], {}), '(self.signal)\n', (973, 986), False, 'import scipy\n'), ((1021, 1049), 'numpy.abs', 'np.abs', (['self.analytic_signal'], {}), '(self.analytic_signal)\n', (1027, 1049), True, 'import numpy as np\n'), ((1205, 1294), 'numpy.linspace', 'n...
import numpy as np from pensa import * from pensa.comparison import * from pensa.dimensionality import * import random import math """ Calculates the average and maximum Jensen-Shannon distance and the Kullback-Leibler divergences for each feature from two ensembles. Each of four functions uses the relative_entro...
[ "numpy.max", "numpy.mean", "numpy.min", "numpy.var", "numpy.prod" ]
[((2435, 2455), 'numpy.mean', 'np.mean', (['data_jsdist'], {}), '(data_jsdist)\n', (2442, 2455), True, 'import numpy as np\n'), ((2796, 2815), 'numpy.max', 'np.max', (['data_jsdist'], {}), '(data_jsdist)\n', (2802, 2815), True, 'import numpy as np\n'), ((3160, 3180), 'numpy.mean', 'np.mean', (['data_kld_ab'], {}), '(da...
import os import pandas as pd import numpy as np root = 'D:\\MT\\mt_framework\\evaluation' folder = ['add_car', 'add_bicycle', 'add_person', 'night', 'rainy'] model = ['basecnn', 'vgg16', 'resnet101'] for f in folder: img_list = os.listdir(os.path.join(root, f)) for m in model: data = [[0, 0] for i i...
[ "pandas.read_csv", "pandas.DataFrame", "os.path.join", "numpy.array" ]
[((247, 268), 'os.path.join', 'os.path.join', (['root', 'f'], {}), '(root, f)\n', (259, 268), False, 'import os\n'), ((347, 386), 'pandas.read_csv', 'pd.read_csv', (["(f + '_label_' + m + '.csv')"], {}), "(f + '_label_' + m + '.csv')\n", (358, 386), True, 'import pandas as pd\n'), ((617, 631), 'numpy.array', 'np.array'...
# !/usr/bin/env python # coding=UTF-8 """ @Author: <NAME> @LastEditors: <NAME> @Description: @Date: 2021-08-19 @LastEditTime: 2022-03-19 词嵌入模型以及相应的距离度量, 主要基于TextAttack的AttackedText类进行的实现 """ from abc import ABC, abstractmethod from collections import defaultdict import os import importlib from typing import Union, Li...
[ "numpy.stack", "zipfile.ZipFile", "importlib.import_module", "torch.sum", "os.path.basename", "torch.norm", "time.time", "collections.defaultdict", "numpy.argsort", "torch.nn.CosineSimilarity", "numpy.linalg.norm", "numpy.array", "os.path.join", "torch.tensor", "torch.from_numpy" ]
[((5335, 5352), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (5346, 5352), False, 'from collections import defaultdict\n'), ((5381, 5398), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (5392, 5398), False, 'from collections import defaultdict\n'), ((12062, 12095), 'impor...
import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d """ Authors: <NAME>, modified by <NAME> """ def create_perturbed_profiles(n_ens, f_orig_profile_LMU='./raso.raso', outdir='./'): for iens in range(1, n_ens+1): print('iens', iens) ## #load raso dat...
[ "numpy.random.seed", "numpy.amin", "numpy.copy", "numpy.arctan2", "numpy.amax", "numpy.sin", "numpy.arange", "numpy.loadtxt", "numpy.random.normal", "numpy.cos", "scipy.interpolate.interp1d", "numpy.sqrt" ]
[((6026, 6043), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (6040, 6043), True, 'import numpy as np\n'), ((332, 374), 'numpy.loadtxt', 'np.loadtxt', (['f_orig_profile_LMU'], {'skiprows': '(4)'}), '(f_orig_profile_LMU, skiprows=4)\n', (342, 374), True, 'import numpy as np\n'), ((1624, 1660), 'numpy.ra...
import numpy as np import json from pcd_writer import PCDFile epsilon = np.finfo(float).eps def normalize_quaternion(q): qw, qx, qy, qz = q len = np.sqrt(qw*qw + qx*qx + qy*qy + qz*qz) if len == 0: return (1, 0, 0, 0) else: s = 1.0 / np.sqrt((qw*qw + qx*qx + qy*qy + qz*qz)) return (qw * s, qx * s...
[ "numpy.absolute", "json.load", "numpy.arctan2", "pcd_writer.PCDFile", "numpy.finfo", "numpy.sin", "numpy.array", "pcd_writer.PCDFile.load", "numpy.sqrt" ]
[((73, 88), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (81, 88), True, 'import numpy as np\n'), ((153, 199), 'numpy.sqrt', 'np.sqrt', (['(qw * qw + qx * qx + qy * qy + qz * qz)'], {}), '(qw * qw + qx * qx + qy * qy + qz * qz)\n', (160, 199), True, 'import numpy as np\n'), ((405, 471), 'numpy.array', 'np.a...
import numpy as np def log2(df): '''x -> log_2 (x)''' return df.apply(np.log2, axis=1) def loge(df): '''x -> log_e (x)''' return df.apply(np.log, axis=1) def log2p(df): '''x -> log_2 (x+1)''' df = df.fillna(0) return df.apply(lambda x: np.log2(x+1), axis=1) def logep(df): ...
[ "numpy.std", "numpy.log2", "numpy.mean", "numpy.median" ]
[((280, 294), 'numpy.log2', 'np.log2', (['(x + 1)'], {}), '(x + 1)\n', (287, 294), True, 'import numpy as np\n'), ((504, 513), 'numpy.std', 'np.std', (['x'], {}), '(x)\n', (510, 513), True, 'import numpy as np\n'), ((604, 616), 'numpy.median', 'np.median', (['x'], {}), '(x)\n', (613, 616), True, 'import numpy as np\n')...
import random import numpy as np __all__ = ( 'EpsilonGreedy', 'BoltzmannPolicy' ) class EpsilonGreedy: def __init__(self, epsilon, q, epsilon_min=0.01): self.epsilon = epsilon self.q = q self.epsilon_min = 0.01 def act(self, s, explore=True): if random.random() < self....
[ "random.random", "numpy.argmax" ]
[((672, 685), 'numpy.argmax', 'np.argmax', (['qs'], {}), '(qs)\n', (681, 685), True, 'import numpy as np\n'), ((297, 312), 'random.random', 'random.random', ([], {}), '()\n', (310, 312), False, 'import random\n')]
# -*- coding: utf-8 -*- """ Testing basic functionalities of DL.utils.data_splitting.py """ import unittest import numpy as np from DL.utils.data_loading import loadRobotData from DL.utils.data_splitting import CompleteRolloutsDataSplitter from tests.fake_data_test_case import FakeDataTestCase class TestDataSplit...
[ "numpy.arange", "numpy.concatenate" ]
[((471, 483), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (480, 483), True, 'import numpy as np\n'), ((1137, 1174), 'numpy.arange', 'np.arange', (['self.observations.shape[0]'], {}), '(self.observations.shape[0])\n', (1146, 1174), True, 'import numpy as np\n'), ((1010, 1085), 'numpy.concatenate', 'np.concatena...
#!/usr/bin/env python __author__ = '<NAME>' #======================================================================== import copy import numpy as np import pickle from DatabaseManager.database import Database from Utilities.misc import Printer #====================================================================...
[ "DatabaseManager.database.Database", "Utilities.misc.Printer.__init__", "copy.deepcopy", "numpy.array" ]
[((649, 707), 'Utilities.misc.Printer.__init__', 'Printer.__init__', (['self', '"""FEEDBACK HANDLER"""'], {'color': '"""yellow"""'}), "(self, 'FEEDBACK HANDLER', color='yellow')\n", (665, 707), False, 'from Utilities.misc import Printer\n'), ((892, 998), 'DatabaseManager.database.Database', 'Database', (["db_settings['...
import sys sys.path.append('core') import argparse import os import cv2 import glob import numpy as np import torch from PIL import Image from tqdm import tqdm import torch import torch.nn.functional as F import pickle import os.path as osp from raft import RAFT from utils import flow_viz from utils.utils import Inp...
[ "pickle.dump", "argparse.ArgumentParser", "numpy.argmax", "torch.no_grad", "os.path.join", "sys.path.append", "torch.utils.data.DataLoader", "cv2.imwrite", "torch.load", "utils.utils.InputPadder", "tqdm.tqdm", "torch.cuda.is_available", "os.listdir", "raft.RAFT", "torch.from_numpy", "n...
[((11, 34), 'sys.path.append', 'sys.path.append', (['"""core"""'], {}), "('core')\n", (26, 34), False, 'import sys\n'), ((5127, 5154), 'cv2.imwrite', 'cv2.imwrite', (['filepath', 'flow'], {}), '(filepath, flow)\n', (5138, 5154), False, 'import cv2\n'), ((6643, 6668), 'argparse.ArgumentParser', 'argparse.ArgumentParser'...
import numpy as np def delta(feat, window): assert window > 0 delta_feat = np.zeros_like(feat) for i in range(1, window + 1): delta_feat[:-i] += i * feat[i:] delta_feat[i:] += -i * feat[:-i] delta_feat[-i:] += i * feat[-1] delta_feat[:i] += -i * feat[0] delta_feat /= 2 ...
[ "numpy.zeros_like", "numpy.concatenate" ]
[((85, 104), 'numpy.zeros_like', 'np.zeros_like', (['feat'], {}), '(feat)\n', (98, 104), True, 'import numpy as np\n'), ((527, 556), 'numpy.concatenate', 'np.concatenate', (['feats'], {'axis': '(1)'}), '(feats, axis=1)\n', (541, 556), True, 'import numpy as np\n')]
import matplotlib matplotlib.rcParams = matplotlib.rc_params_from_file('../../matplotlibrc') import numpy as np import solutions from matplotlib import pyplot as plt from scipy.stats import beta, norm def beta_pdf(): x = np.arange(0, 1.01, .01) y = beta.pdf(x, 8, 2) plt.plot(x, y) plt.savefig("beta_pd...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "solutions.invgammapdf", "scipy.stats.norm.pdf", "numpy.arange", "scipy.stats.beta.pdf", "matplotlib.rc_params_from_file", "matplotlib.pyplot.savefig" ]
[((40, 92), 'matplotlib.rc_params_from_file', 'matplotlib.rc_params_from_file', (['"""../../matplotlibrc"""'], {}), "('../../matplotlibrc')\n", (70, 92), False, 'import matplotlib\n'), ((227, 251), 'numpy.arange', 'np.arange', (['(0)', '(1.01)', '(0.01)'], {}), '(0, 1.01, 0.01)\n', (236, 251), True, 'import numpy as np...
"""Training GCMC model on the MovieLens data set. The script loads the full graph to the training device. """ import os, time import argparse import logging import random import string import numpy as np import pandas as pd import torch as th import torch.nn as nn import torch.nn.functional as F from data import DataS...
[ "numpy.random.seed", "argparse.ArgumentParser", "random.sample", "utils.get_activation", "random.choices", "numpy.random.randint", "utils.to_etype_name", "torch.device", "model.MLPDecoder", "torch.no_grad", "os.path.join", "torch.FloatTensor", "torch.softmax", "torch.nn.ModuleList", "tor...
[((6554, 6567), 'numpy.sqrt', 'np.sqrt', (['rmse'], {}), '(rmse)\n', (6561, 6567), True, 'import numpy as np\n'), ((7739, 7926), 'data.DataSetLoader', 'DataSetLoader', (['args.data_name', 'args.device'], {'use_one_hot_fea': 'args.use_one_hot_fea', 'symm': 'args.gcn_agg_norm_symm', 'test_ratio': 'args.data_test_ratio', ...
import numpy as np from hummingbird.parameters.constants import StateEnum, ActuatorEnum def gradient_descent(J, f, alpha, beta, phi, max_iters=5000, epsilon=1e-8, kappa=1e-6): """ Gradient descent algorithm """ iters = 0 J0 = np.inf while iters < max_iters: alpha_plus = alpha + epsilon ...
[ "numpy.zeros" ]
[((1014, 1073), 'numpy.zeros', 'np.zeros', (['(StateEnum.size, StateEnum.size)'], {'dtype': 'np.double'}), '((StateEnum.size, StateEnum.size), dtype=np.double)\n', (1022, 1073), True, 'import numpy as np\n'), ((1082, 1144), 'numpy.zeros', 'np.zeros', (['(StateEnum.size, ActuatorEnum.size)'], {'dtype': 'np.double'}), '(...
"""PyTorch implementations of segmentation routines """ import logging import itertools import numpy as np import torch def dx(x, xum=1.0): """Compute the gradient in the X direction Note that this function does not pad the image so the output is reduced in size. :param x: a Torch or Numpy 3-D ar...
[ "numpy.pad", "logging.debug", "torch.where", "torch.sqrt", "numpy.zeros", "torch.lt", "torch.cos", "torch.clamp", "numpy.arange", "torch.cuda.empty_cache", "torch.acos", "torch.from_numpy" ]
[((6520, 6538), 'torch.sqrt', 'torch.sqrt', (['(p2 / 6)'], {}), '(p2 / 6)\n', (6530, 6538), False, 'import torch\n'), ((6704, 6725), 'torch.clamp', 'torch.clamp', (['r', '(-1)', '(1)'], {}), '(r, -1, 1)\n', (6715, 6725), False, 'import torch\n'), ((7023, 7043), 'torch.lt', 'torch.lt', (['eig1', 'eig2'], {}), '(eig1, ei...
import random import numpy as np import math, time from gym import spaces from time_limit import TimeLimit from draw2d import Viewer, Rectangle, Frame, Circle, Line, Polygon class _HunterEnv(object): SIZE = 15 # 20x20 field VR = 2 # visible range: [x-2, x-1, x, x+1, x+2] SCAN_SIZE = (VR*2+...
[ "random.randint", "draw2d.Rectangle", "numpy.roll", "numpy.empty", "numpy.zeros", "gym.spaces.Discrete", "time.sleep", "random.random", "draw2d.Viewer", "numpy.array", "gym.spaces.Box", "numpy.arange", "draw2d.Circle" ]
[((539, 615), 'numpy.zeros', 'np.zeros', (['(self.SIZE + self.VR * 2, self.SIZE + self.VR * 2)'], {'dtype': 'np.float'}), '((self.SIZE + self.VR * 2, self.SIZE + self.VR * 2), dtype=np.float)\n', (547, 615), True, 'import numpy as np\n'), ((748, 760), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (757, 760), Tru...
""" Implementation based on explanation in https://pytorch.org/tutorials/beginner/data_loading_tutorial.html There are the Dataset class and the transformers to applicate in the DataLoader """ import os import pandas as pd import numpy as np import cv2 import torch from torch.utils.data import Dataset#, DataLoader...
[ "numpy.load", "numpy.zeros", "numpy.random.randint", "torch.is_tensor", "os.path.join", "cv2.resize", "torch.from_numpy" ]
[((1606, 1644), 'os.path.join', 'os.path.join', (['root_dir', 'annotation_dir'], {}), '(root_dir, annotation_dir)\n', (1618, 1644), False, 'import os\n'), ((2442, 2462), 'torch.is_tensor', 'torch.is_tensor', (['idx'], {}), '(idx)\n', (2457, 2462), False, 'import torch\n'), ((2712, 2805), 'os.path.join', 'os.path.join',...
import os import glob import sys import errno import random import urllib.request import numpy as np from scipy.io import loadmat class CWRU: def __init__(self, exp, rpm, length, split, cross=False): if exp not in ('12DriveEndFault', '12FanEndFault', '48DriveEndFault'): print ("wrong experi...
[ "os.makedirs", "scipy.io.loadmat", "os.path.isdir", "random.Random", "os.path.dirname", "numpy.zeros", "os.path.exists", "os.path.join", "numpy.vstack" ]
[((2163, 2189), 'numpy.zeros', 'np.zeros', (['(0, self.length)'], {}), '((0, self.length))\n', (2171, 2189), True, 'import numpy as np\n'), ((2212, 2238), 'numpy.zeros', 'np.zeros', (['(0, self.length)'], {}), '((0, self.length))\n', (2220, 2238), True, 'import numpy as np\n'), ((635, 660), 'os.path.dirname', 'os.path....
"""Estimate models with the method of simulated moments (MSM). The method of simulated moments is developed by [1]_, [2]_, and [3]_ and an estimation technique where the distance between the moments of the actual data and the moments implied by the model parameters is minimized. References: .. [1] <NAME>. (1989). A ...
[ "functools.partial", "numpy.sum", "numpy.isscalar", "numpy.diag", "pandas.concat", "numpy.diagonal" ]
[((4121, 4336), 'functools.partial', 'functools.partial', (['_msm'], {'simulate': 'simulate', 'calc_moments': 'calc_moments', 'empirical_moments': 'empirical_moments', 'replace_nans': 'replace_nans', 'weighting_matrix': 'weighting_matrix', 'additional_outputs': 'additional_outputs'}), '(_msm, simulate=simulate, calc_mo...
import matplotlib.pyplot as plt import sys import numpy as np import bisect def average(ls): return sum(ls)/len(ls) class TimeData: def __init__(self,filename): self.filename = filename self.load_data() def load_data(self): with open(self.filename) as file: file_lines ...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "bisect.bisect_right", "matplotlib.pyplot.close", "numpy.array", "bisect.bisect_left", "numpy.vstack" ]
[((626, 641), 'numpy.array', 'np.array', (['times'], {}), '(times)\n', (634, 641), True, 'import numpy as np\n'), ((1890, 1909), 'numpy.vstack', 'np.vstack', (['new_data'], {}), '(new_data)\n', (1899, 1909), True, 'import numpy as np\n'), ((1931, 1950), 'numpy.array', 'np.array', (['new_times'], {}), '(new_times)\n', (...
#!/usr/bin/env python3 # # Recognizing the topological phase transition by Variational Autoregressive Networks # 2d classical XY model import time # import pytorch import numpy as np from numpy import sqrt from torch import nn import torch from scipy import signal import math as m # import xy model import xy import ...
[ "xy.energy", "torch.std", "utils.init_out_dir", "torch.no_grad", "numpy.unique", "numpy.prod", "utils.my_log", "numpy.std", "torch.optim.lr_scheduler.ReduceLROnPlateau", "helicity.helicity", "torch.mean", "utils.clear_log", "torch.nn.utils.clip_grad_norm_", "utils.clear_checkpoint", "uti...
[((671, 682), 'time.time', 'time.time', ([], {}), '()\n', (680, 682), False, 'import time\n'), ((715, 729), 'utils.init_out_dir', 'init_out_dir', ([], {}), '()\n', (727, 729), False, 'from utils import clear_checkpoint, clear_log, get_last_checkpoint_step, ignore_param, init_out_dir, my_log, print_args\n'), ((821, 847)...
# -*- coding: utf-8 -*- """ Created on Tue Oct 22 17:34:03 2019 @author: abobashe """ #import os import numpy as np #import pandas as pd #import torchvision.datasets as dset #import torchvision.transforms as transforms import torch.utils.data.dataset class BinarySubset(torch.utils.data.dataset.Subset): """ ...
[ "numpy.argwhere", "numpy.random.randint", "numpy.array", "numpy.concatenate" ]
[((578, 603), 'numpy.array', 'np.array', (['dataset.targets'], {}), '(dataset.targets)\n', (586, 603), True, 'import numpy as np\n'), ((924, 974), 'numpy.argwhere', 'np.argwhere', (['(targets_array[:, self.class_idx] != 1)'], {}), '(targets_array[:, self.class_idx] != 1)\n', (935, 974), True, 'import numpy as np\n'), (...
import numpy as np import tensorflow as tf import numpy as np import math from models.attenvis import AttentionVis av = AttentionVis() @av.att_mat_func def Attention_Matrix(K, Q, use_mask=False): """ STUDENT MUST WRITE: This functions runs a single attention head. :param K: is [batch_size x window_si...
[ "tensorflow.nn.softmax", "models.attenvis.AttentionVis", "tensorflow.nn.relu", "math.sqrt", "tensorflow.keras.layers.Dense", "tensorflow.reshape", "tensorflow.keras.layers.LayerNormalization", "numpy.ones", "tensorflow.transpose", "tensorflow.matmul", "tensorflow.shape", "tensorflow.tensordot"...
[((120, 134), 'models.attenvis.AttentionVis', 'AttentionVis', ([], {}), '()\n', (132, 134), False, 'from models.attenvis import AttentionVis\n'), ((1468, 1489), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['matrix'], {}), '(matrix)\n', (1481, 1489), True, 'import tensorflow as tf\n'), ((753, 814), 'tensorflow.reshape', ...
# Copyright 2021 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.context.set_context", "mindspore.export", "argparse.ArgumentParser", "numpy.zeros", "mindspore.train.serialization.load_checkpoint", "src.pose_resnet.GetPoseResNet" ]
[((996, 1051), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""simple_baselines"""'}), "(description='simple_baselines')\n", (1019, 1051), False, 'import argparse\n'), ((1691, 1819), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target...
import numpy as np import pandas as pd def auto_pate(method): """自动添加括号""" method = str.strip(method) if method[-1] != ')': if '(' not in method: method = method + '()' else: method = method + ')' return method def back_args_str(*args, **kwargs): largs = [f...
[ "pandas.DataFrame", "numpy.abs", "numpy.log", "numpy.argmax", "numpy.median", "numpy.unique", "numpy.zeros", "numpy.ones", "numpy.sort", "numpy.cumsum", "sklearn.utils.multiclass.type_of_target", "numpy.array", "pandas.cut", "numpy.linspace", "numpy.where", "numpy.concatenate" ]
[((596, 612), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (604, 612), True, 'import numpy as np\n'), ((690, 715), 'numpy.median', 'np.median', (['points'], {'axis': '(0)'}), '(points, axis=0)\n', (699, 715), True, 'import numpy as np\n'), ((807, 830), 'numpy.abs', 'np.abs', (['(points - median)'], {}), '...
import numpy def sign_changings(data): """ Calculate indices of sign-changing locations in 1D array `data`. aka zero-crossing >>> # * * * * # changes >>> # 0 1 2 3 4 5 6 7 8 # index >>> data = [1, 2, 0, -3, -4, 7, 8, -2, 1] >>> sign_changin...
[ "numpy.append", "numpy.asanyarray" ]
[((424, 446), 'numpy.asanyarray', 'numpy.asanyarray', (['data'], {}), '(data)\n', (440, 446), False, 'import numpy\n'), ((655, 675), 'numpy.append', 'numpy.append', (['(0)', 'idx'], {}), '(0, idx)\n', (667, 675), False, 'import numpy\n')]
import tensorflow as tf import pandas as pd import numpy as np import numba from sklearn.preprocessing import MinMaxScaler def read_data(): training_data = pd.read_csv('./consumption_train.csv', index_col=0, parse_dates=['timestamp']) test_data = pd.read_csv('./cold_start_test.csv', index_col=0, parse_dates=...
[ "pandas.DataFrame", "pandas.date_range", "numpy.sum", "numpy.abs", "pandas.read_csv", "numpy.empty", "sklearn.preprocessing.MinMaxScaler", "numpy.zeros", "numpy.mean", "numba.jit", "numpy.cosh", "numpy.log1p" ]
[((3017, 3041), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (3026, 3041), False, 'import numba\n'), ((3381, 3405), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (3390, 3405), False, 'import numba\n'), ((165, 243), 'pandas.read_csv', 'pd.read_csv', (['"""./...
"""Test the module neighbourhood cleaning rule.""" # Authors: <NAME> <<EMAIL>> # <NAME> # License: MIT import numpy as np from pytest import raises from sklearn.utils.testing import assert_array_equal from sklearn.neighbors import NearestNeighbors from imblearn.under_sampling import NeighbourhoodCleaningRul...
[ "imblearn.under_sampling.NeighbourhoodCleaningRule", "pytest.raises", "sklearn.utils.testing.assert_array_equal", "sklearn.neighbors.NearestNeighbors", "numpy.array", "imblearn.utils.testing.warns" ]
[((368, 801), 'numpy.array', 'np.array', (['[[1.57737838, 0.1997882], [0.8960075, 0.46130762], [0.34096173, 0.50947647],\n [-0.91735824, 0.93110278], [-0.14619583, 1.33009918], [-0.20413357, \n 0.64628718], [0.85713638, 0.91069295], [0.35967591, 2.61186964], [\n 0.43142011, 0.52323596], [0.90701028, -0.5763692...
import numpy as np from loguru import logger from qtpy import QtWidgets from qtpy.QtCore import QSize, Signal from qtpy.QtWidgets import QPushButton from vispy import scene from survos2.frontend.components.base import * from survos2.frontend.components.base import HWidgets, Slider from survos2.frontend.plugin...
[ "survos2.frontend.components.base.HWidgets", "qtpy.QtWidgets.QHBoxLayout", "qtpy.QtWidgets.QWidget.__init__", "survos2.server.state.cfg.viewer.layers.remove", "survos2.frontend.plugins.base.ComboBox", "survos2.frontend.components.base.Slider", "loguru.logger.info", "qtpy.QtCore.QSize", "numpy.array"...
[((847, 861), 'qtpy.QtCore.Signal', 'Signal', (['object'], {}), '(object)\n', (853, 861), False, 'from qtpy.QtCore import QSize, Signal\n'), ((5762, 5776), 'qtpy.QtCore.Signal', 'Signal', (['object'], {}), '(object)\n', (5768, 5776), False, 'from qtpy.QtCore import QSize, Signal\n'), ((915, 964), 'qtpy.QtWidgets.QWidge...
from __future__ import absolute_import, division, print_function import pytest import os import numpy as np import sqlalchemy as sa from datashape import discover, dshape import datashape from into.backends.sql import (dshape_to_table, create_from_datashape, dshape_to_alchemy) from into....
[ "os.remove", "into.backends.sql.create_from_datashape", "datashape.dshape", "sqlalchemy.select", "pytest.raises", "into.resource", "sqlalchemy.Column", "into.backends.sql.dshape_to_table", "into.convert", "into.utils.tmpfile", "into.into", "into.backends.sql.dshape_to_alchemy", "sqlalchemy.S...
[((441, 513), 'into.resource', 'resource', (['"""sqlite:///:memory:::mytable"""'], {'dshape': '"""var * {x: int, y: int}"""'}), "('sqlite:///:memory:::mytable', dshape='var * {x: int, y: int}')\n", (449, 513), False, 'from into import convert, append, resource, discover, into\n'), ((774, 812), 'sqlalchemy.create_engine...
import cv2 import imutils import numpy as np from matplotlib import pyplot as plt def binarize_image_otsu(image): _, th_image = cv2.threshold(image, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU) return th_image def binarize_image_niblack(image, block_size=3, C=0): return cv2.ximgproc.niBlackThreshold(image...
[ "numpy.sum", "cv2.cvtColor", "cv2.waitKey", "cv2.threshold", "cv2.destroyAllWindows", "numpy.zeros", "numpy.ones", "cv2.adaptiveThreshold", "cv2.ximgproc.niBlackThreshold", "cv2.imread", "numpy.mean", "imutils.is_cv2", "cv2.imshow", "cv2.findContours" ]
[((133, 198), 'cv2.threshold', 'cv2.threshold', (['image', '(0)', '(255)', '(cv2.THRESH_BINARY + cv2.THRESH_OTSU)'], {}), '(image, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)\n', (146, 198), False, 'import cv2\n'), ((285, 360), 'cv2.ximgproc.niBlackThreshold', 'cv2.ximgproc.niBlackThreshold', (['image', '(255)', 'cv2....
""" This file is used to visualize the data generalization """ from genericpath import exists import numpy as np import random import matplotlib.pyplot as plt import os import sys import math import argparse import tqdm from tqdm import trange from matplotlib.backends.backend_pdf import PdfPages VELOCITY = 1.4 / 60.0 ...
[ "numpy.save", "argparse.ArgumentParser", "os.makedirs", "tqdm.trange", "numpy.std", "random.normalvariate", "os.path.exists", "random.random", "numpy.mean", "numpy.array", "random.seed", "numpy.random.randint", "os.path.join" ]
[((411, 424), 'random.seed', 'random.seed', ([], {}), '()\n', (422, 424), False, 'import random\n'), ((616, 680), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""training path generation."""'}), "(description='training path generation.')\n", (639, 680), False, 'import argparse\n'), ((1037...
#!/usr/bin/env python3 import gym import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d def nstep_sarsa(env, n=1, alpha=0.1, gamma=0.9, epsilon=0.1, num_ep=int(1e4)): """ TODO: implement the n-step sarsa algorithm """ Q_values = np.zeros((env.observation_space.n, env.actio...
[ "matplotlib.pyplot.title", "numpy.random.uniform", "matplotlib.pyplot.show", "gym.make", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.power", "matplotlib.pyplot.legend", "numpy.square", "numpy.zeros", "numpy.arange", "numpy.linspace", "scipy.interpolate.interp1d" ]
[((2065, 2106), 'gym.make', 'gym.make', (['"""FrozenLake-v0"""'], {'map_name': '"""8x8"""'}), "('FrozenLake-v0', map_name='8x8')\n", (2073, 2106), False, 'import gym\n'), ((2599, 2628), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'alpha_step'], {}), '(0, 1, alpha_step)\n', (2610, 2628), True, 'import numpy as np\n...
import numpy as np def conjunction(stats, ps=None): """Run a conjunction test. Parameters ---------- stats : np.array([float, ...]) A list of statistics, e.g *t*-values. ps : np.array([float, ...]), None A list of (optional) p-values matching elements in stats. ...
[ "numpy.min" ]
[((1865, 1878), 'numpy.min', 'np.min', (['stats'], {}), '(stats)\n', (1871, 1878), True, 'import numpy as np\n')]
import h5py from Bio import SeqIO, AlignIO import io import numpy as np import os pfam_path = '../Pfam-A.seed' import gzip def yield_alns(pfam_path , verbose = False): with open(pfam_path, 'r', encoding='ISO-8859-1') as f: aln= '' acc = None count =0 lCount = 0 for i,l ...
[ "io.StringIO", "h5py.File", "os.remove", "os.path.isfile", "numpy.array" ]
[((1196, 1228), 'os.path.isfile', 'os.path.isfile', (['"""Pfam-A.full.h5"""'], {}), "('Pfam-A.full.h5')\n", (1210, 1228), False, 'import os\n'), ((1234, 1261), 'os.remove', 'os.remove', (['"""Pfam-A.full.h5"""'], {}), "('Pfam-A.full.h5')\n", (1243, 1261), False, 'import os\n'), ((1304, 1342), 'h5py.File', 'h5py.File', ...
import numpy as np from matplotlib import pyplot as plt def mea_axes(ax, style='scalebar', mea='hidens', x=None, y=None, bbox=None, margin=20, barlength=None, yoffset=None, barposition='outside', barcolor='k', ): """ Standard layout for mapping on the multi electrode array. :para...
[ "matplotlib.pyplot.subplot", "numpy.greater", "numpy.isfinite", "matplotlib.pyplot.text", "numpy.min", "numpy.mean", "numpy.max", "matplotlib.pyplot.Circle", "matplotlib.pyplot.Normalize" ]
[((4100, 4116), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(211)'], {}), '(211)\n', (4111, 4116), True, 'from matplotlib import pyplot as plt\n'), ((4257, 4273), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(212)'], {}), '(212)\n', (4268, 4273), True, 'from matplotlib import pyplot as plt\n'), ((3789, 3837), 'num...
from flask import Flask, jsonify, request from flask_cors import CORS, cross_origin from random import randint from keras.models import load_model import numpy as np # initialize our Flask application model = load_model('models/model.h5') app= Flask(__name__) cors = CORS(app) app.config['CORS_HEADERS'] = 'Content-Type...
[ "keras.models.load_model", "flask.request.args.get", "numpy.argmax", "flask_cors.CORS", "flask.Flask", "numpy.zeros", "flask_cors.cross_origin", "numpy.array" ]
[((210, 239), 'keras.models.load_model', 'load_model', (['"""models/model.h5"""'], {}), "('models/model.h5')\n", (220, 239), False, 'from keras.models import load_model\n'), ((245, 260), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (250, 260), False, 'from flask import Flask, jsonify, request\n'), ((268,...
#!/usr/bin/env python # stdlib imports import os.path # third party imports import numpy as np import fiona # local imports from losspager.models.emploss import EmpiricalLoss, LognormalModel from losspager.models.econexposure import EconExposure def test(): event = 'northridge' homedir = os.path.dirname(os...
[ "numpy.nansum", "fiona.open", "numpy.testing.assert_almost_equal", "losspager.models.emploss.LognormalModel", "losspager.models.emploss.EmpiricalLoss.fromDefaultEconomic", "numpy.array", "losspager.models.econexposure.EconExposure" ]
[((996, 1032), 'losspager.models.econexposure.EconExposure', 'EconExposure', (['popfile', '(2012)', 'isofile'], {}), '(popfile, 2012, isofile)\n', (1008, 1032), False, 'from losspager.models.econexposure import EconExposure\n'), ((1178, 1213), 'losspager.models.emploss.EmpiricalLoss.fromDefaultEconomic', 'EmpiricalLoss...
#<EMAIL> 02/20/2018 import numpy as np from scipy.optimize import bisect class PyCFD: def __init__(self, params): self.sample_interval = params['sample_interval'] self.delay = int(params['delay']/self.sample_interval) self.fraction = params['fraction'] self.threshold = params['t...
[ "scipy.optimize.bisect", "numpy.where", "numpy.sign" ]
[((1700, 1722), 'numpy.sign', 'np.sign', (['wf_cal_m_walk'], {}), '(wf_cal_m_walk)\n', (1707, 1722), True, 'import numpy as np\n'), ((1745, 1898), 'numpy.where', 'np.where', (['((wf_cal_m_walk_sign[:-1] < wf_cal_m_walk_sign[1:]) & (wf_cal_m_walk_sign[1\n :] != 0) & (wf_cal_m_walk[1:] - wf_cal_m_walk[:-1] >= 1e-08))'...
""" Written by <NAME> <<EMAIL>> 2018-2019 """ import numpy as np import tensorflow as tf def orthogonal(shape, name=None): assert len(shape)>1 shape0 = shape if len(shape)>2: shape = [shape[0],np.prod(shape[1:])] w = np.random.randn(*2*[np.max(shape)]) u,*_ = np.linalg.svd(w) u = u[:...
[ "tensorflow.random_uniform", "tensorflow.distributions.Bernoulli", "tensorflow.placeholder_with_default", "tensorflow.concat", "tensorflow.constant", "numpy.prod", "tensorflow.placeholder", "numpy.max", "numpy.linalg.svd", "tensorflow.random_normal", "numpy.reshape", "tensorflow.tensordot", ...
[((292, 308), 'numpy.linalg.svd', 'np.linalg.svd', (['w'], {}), '(w)\n', (305, 308), True, 'import numpy as np\n'), ((348, 369), 'numpy.reshape', 'np.reshape', (['u', 'shape0'], {}), '(u, shape0)\n', (358, 369), True, 'import numpy as np\n'), ((504, 543), 'tensorflow.random_uniform', 'tf.random_uniform', (['shape', '(-...
import sys import numpy as np import pandas import plotly.graph_objects as go import csv from numpy import nan colors = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d...
[ "csv.reader", "plotly.graph_objects.Figure", "plotly.graph_objects.Bar", "numpy.isnan", "numpy.linalg.norm" ]
[((3648, 3669), 'plotly.graph_objects.Figure', 'go.Figure', (['bar_graphs'], {}), '(bar_graphs)\n', (3657, 3669), True, 'import plotly.graph_objects as go\n'), ((5674, 5695), 'plotly.graph_objects.Figure', 'go.Figure', (['bar_graphs'], {}), '(bar_graphs)\n', (5683, 5695), True, 'import plotly.graph_objects as go\n'), (...
from functools import partial import numpy as np import torch from src.language_model_usage.generation import generate from src.helpers.logger import Logger from src.winograd_collection_manipulation.text_manipulation import custom_tokenizer logger = Logger() def get_probability_of_next_sentence(tokenizer, model, t...
[ "src.winograd_collection_manipulation.text_manipulation.custom_tokenizer", "functools.partial", "src.language_model_usage.generation.generate", "numpy.prod", "torch.nn.Softmax", "src.helpers.logger.Logger", "torch.tensor" ]
[((253, 261), 'src.helpers.logger.Logger', 'Logger', ([], {}), '()\n', (259, 261), False, 'from src.helpers.logger import Logger\n'), ((648, 678), 'torch.tensor', 'torch.tensor', (['[indexed_tokens]'], {}), '([indexed_tokens])\n', (660, 678), False, 'import torch\n'), ((702, 730), 'torch.tensor', 'torch.tensor', (['[se...
"""Pyneal Real-time fMRI Acquisition and Analysis This is the main Pyneal application, designed to be called directly from the command line on the computer designated as your real-time analysis machine. It expects to receive incoming slice data from the Pyneal-Scanner application, which should be running concurrently ...
[ "atexit.register", "argparse.ArgumentParser", "zmq.Context.instance", "yaml.safe_load", "numpy.round", "os.path.join", "src.scanReceiver.ScanReceiver", "os.path.dirname", "os.path.exists", "src.pynealPreprocessing.Preprocessor", "src.resultsServer.ResultsServer", "src.pynealAnalysis.Analyzer",...
[((1197, 1222), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1212, 1222), False, 'import os\n'), ((3008, 3040), 'os.path.join', 'join', (['outputDir', '"""pynealLog.log"""'], {}), "(outputDir, 'pynealLog.log')\n", (3012, 3040), False, 'from os.path import join\n'), ((3054, 3076), 'src.pyne...
#This set of functions allows for building a Vietoris-Rips simplicial complex from point data import numpy as np import matplotlib.pyplot as plt import itertools import functools def euclidianDist(a,b): #this is the default metric we use but you can use whatever distance function you want return np.linalg.norm(a ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.annotate", "matplotlib.pyplot.clf", "matplotlib.pyplot.scatter", "matplotlib.pyplot.axis", "itertools.combinations", "numpy.linalg.norm", "matplotlib.pyplot.gca", "matplotlib.pyplot.Polygon", "functools.cmp_to_key" ]
[((303, 324), 'numpy.linalg.norm', 'np.linalg.norm', (['(a - b)'], {}), '(a - b)\n', (317, 324), True, 'import numpy as np\n'), ((4228, 4237), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (4235, 4237), True, 'import matplotlib.pyplot as plt\n'), ((4240, 4254), 'matplotlib.pyplot.axis', 'plt.axis', (['axes'], {...
# -*- coding: utf-8 -*- import numpy as np # Local imports try: from .Arm import Arm except ImportError: from Arm import Arm class Constant(Arm): """ Arm with a constant reward. """ def __init__(self, constant_reward=0.5, lower=0., amplitude=1.): constant_reward = float(constant_re...
[ "numpy.floor" ]
[((488, 513), 'numpy.floor', 'np.floor', (['constant_reward'], {}), '(constant_reward)\n', (496, 513), True, 'import numpy as np\n')]
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from PIL import Image from Chinese_aster.core import spatial_transformer class SpatialTransformerTest(tf.test.TestCase): def test_batch_transform(self): transformer = spatial_transformer.SpatialTransformer( output_image_size=(3...
[ "tensorflow.test.main", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "Chinese_aster.core.spatial_transformer.SpatialTransformer", "tensorflow.constant", "PIL.Image.open", "matplotlib.pyplot.figure", "numpy.array" ]
[((2803, 2817), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (2815, 2817), True, 'import tensorflow as tf\n'), ((254, 390), 'Chinese_aster.core.spatial_transformer.SpatialTransformer', 'spatial_transformer.SpatialTransformer', ([], {'output_image_size': '(32, 100)', 'num_control_points': '(6)', 'init_bias_...
"""Tests for input validation functions.""" import numpy as np from sklearn_theano.utils import check_tensor from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_raises def test_check_tensor(): """Test that check_tensor works for a variety of inputs.""" X = np.zeros((3, 4, 5...
[ "sklearn.utils.testing.assert_raises", "sklearn_theano.utils.check_tensor", "numpy.zeros" ]
[((303, 322), 'numpy.zeros', 'np.zeros', (['(3, 4, 5)'], {}), '((3, 4, 5))\n', (311, 322), True, 'import numpy as np\n'), ((379, 446), 'sklearn.utils.testing.assert_raises', 'assert_raises', (['ValueError', 'check_tensor', 'X'], {'dtype': 'np.float', 'n_dim': '(1)'}), '(ValueError, check_tensor, X, dtype=np.float, n_di...