code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Poisson matrix factorization with Batch inference and Stochastic inference CREATED: 2014-03-25 02:06:52 by <NAME> <<EMAIL>> """ import sys import numpy as np from scipy import special from scipy import stats from sklearn.metrics import mean_squared_error as mse from sklearn.decomposition import NMF from sklearn...
[ "sys.stdout.write", "sklearn.decomposition.NMF", "numpy.triu", "numpy.random.seed", "numpy.log", "scipy.stats.gamma.rvs", "numpy.multiply", "numpy.identity", "scipy.special.psi", "numpy.random.gamma", "numpy.mean", "sys.stdout.flush", "numpy.exp", "scipy.special.gammaln", "numpy.dot", ...
[((6876, 6920), 'scipy.stats.gamma.rvs', 'stats.gamma.rvs', (['(0.5)'], {'scale': '(0.1)', 'size': '(N, K)'}), '(0.5, scale=0.1, size=(N, K))\n', (6891, 6920), False, 'from scipy import stats\n'), ((6966, 6976), 'numpy.triu', 'np.triu', (['A'], {}), '(A)\n', (6973, 6976), True, 'import numpy as np\n'), ((2154, 2189), '...
import subprocess import os import numpy as np import cv2 import torch BASE_DIR = os.path.dirname(os.path.realpath(__file__)) if subprocess.call(['make', '-C', BASE_DIR]) != 0: # return value raise RuntimeError('Cannot compile pse: {}'.format(BASE_DIR)) def pse_warpper(kernals, min_area=5): ''' referenc...
[ "numpy.sum", "os.path.realpath", "torch.sigmoid", "numpy.mean", "numpy.array", "subprocess.call", "cv2.boxPoints", "cv2.minAreaRect", "numpy.where" ]
[((99, 125), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (115, 125), False, 'import os\n'), ((131, 172), 'subprocess.call', 'subprocess.call', (["['make', '-C', BASE_DIR]"], {}), "(['make', '-C', BASE_DIR])\n", (146, 172), False, 'import subprocess\n'), ((582, 599), 'numpy.array', 'np.ar...
import cv2 as cv import numpy as np A = np.array([[2,1,1], [1,1,0], [1,0,-3]]) B = np.array([[2], [2], [1]]) x = np.linalg.solve(A,B) print(x)
[ "numpy.linalg.solve", "numpy.array" ]
[((41, 85), 'numpy.array', 'np.array', (['[[2, 1, 1], [1, 1, 0], [1, 0, -3]]'], {}), '([[2, 1, 1], [1, 1, 0], [1, 0, -3]])\n', (49, 85), True, 'import numpy as np\n'), ((111, 136), 'numpy.array', 'np.array', (['[[2], [2], [1]]'], {}), '([[2], [2], [1]])\n', (119, 136), True, 'import numpy as np\n'), ((168, 189), 'numpy...
import cv2 import numpy as np import time import os import advancedcv.hand_tracking as htm brush_thickness = 15 eraser_thickness = 100 folder_path = 'headers' my_list = os.listdir(folder_path) my_list.pop(0) my_list.sort() overlay_list = [] for img_path in my_list: image = cv2.imread(f'{folder_path}/{img_path}...
[ "cv2.line", "advancedcv.hand_tracking.HandDetector", "cv2.circle", "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "cv2.threshold", "numpy.zeros", "time.time", "cv2.VideoCapture", "cv2.imread", "cv2.addWeighted", "cv2.bitwise_or", "cv2.rectangle", "cv2.flip", "cv2.imshow", "os.list...
[((172, 195), 'os.listdir', 'os.listdir', (['folder_path'], {}), '(folder_path)\n', (182, 195), False, 'import os\n'), ((414, 433), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (430, 433), False, 'import cv2\n'), ((480, 513), 'numpy.zeros', 'np.zeros', (['(540, 960, 3)', 'np.uint8'], {}), '((540, 960...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import _init_paths import os import cv2 import numpy as np import sys sys.path.append("..") from opts_pose import opts from detectors.detector_factory import detector_factory class Clothes_detector(): ...
[ "sys.path.append", "cv2.circle", "numpy.abs", "cv2.waitKey", "cv2.VideoCapture", "cv2.rectangle", "numpy.max", "numpy.min", "opts_pose.opts", "cv2.imshow" ]
[((182, 203), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (197, 203), False, 'import sys\n'), ((3170, 3189), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (3186, 3189), False, 'import cv2\n'), ((3242, 3266), 'cv2.imshow', 'cv2.imshow', (['"""input"""', 'img'], {}), "('input',...
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import scipy.stats def density(x, desired_length=100, bandwith=1, show=False): """Density estimation. Computes kernel density estimates. Parameters ----------- x : Union[list, np.array, pd.Series] A vector of values. desi...
[ "pandas.DataFrame", "numpy.min", "numpy.max" ]
[((1317, 1326), 'numpy.min', 'np.min', (['x'], {}), '(x)\n', (1323, 1326), True, 'import numpy as np\n'), ((1328, 1337), 'numpy.max', 'np.max', (['x'], {}), '(x)\n', (1334, 1337), True, 'import numpy as np\n'), ((1417, 1447), 'pandas.DataFrame', 'pd.DataFrame', (["{'x': x, 'y': y}"], {}), "({'x': x, 'y': y})\n", (1429,...
import numpy as np from mlutils.core.event.handler import EventHandler from mlutils.core.engine.callback.metrics import MetricsList, Loss class Monitor(EventHandler): def __init__(self, additional_metrics=[]): self.metrics = MetricsList([Loss()] + additional_metrics) def _on_batch_end(self, state): ...
[ "mlutils.core.engine.callback.metrics.Loss", "numpy.float" ]
[((253, 259), 'mlutils.core.engine.callback.metrics.Loss', 'Loss', ([], {}), '()\n', (257, 259), False, 'from mlutils.core.engine.callback.metrics import MetricsList, Loss\n'), ((760, 775), 'numpy.float', 'np.float', (['"""inf"""'], {}), "('inf')\n", (768, 775), True, 'import numpy as np\n'), ((711, 726), 'numpy.float'...
import re import cv2 import glob import argparse import numpy as np from colour import Color def parse_args(): arg_parser = argparse.ArgumentParser( description='Plot exploration_100 experiment result as heatmap') arg_parser.add_argument('--maze-size', type=str, default='10x10', ...
[ "colour.Color", "argparse.ArgumentParser", "cv2.imwrite", "numpy.asarray", "numpy.array", "glob.glob", "re.search", "cv2.resize" ]
[((130, 223), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot exploration_100 experiment result as heatmap"""'}), "(description=\n 'Plot exploration_100 experiment result as heatmap')\n", (153, 223), False, 'import argparse\n'), ((918, 945), 'glob.glob', 'glob.glob', (['log_file_p...
from processing import * from analysis import * import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates #load the structure with the statistics D=load_obj("dict") #store the dictionary of each stat by day days=[] stats=[] for key in sorted(D): days.append(key) stats.append(D[key]) pr...
[ "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.show", "matplotlib.dates.DayLocator", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "matplotlib.dates.DateFormatter", "numpy.array", "matplotlib.pyplot.ticklabel_format", "matplotlib.pyplot.gca", "matplotlib...
[((1118, 1160), 'numpy.array', 'np.array', (["[a['n Lib dems'] for a in stats]"], {}), "([a['n Lib dems'] for a in stats])\n", (1126, 1160), True, 'import numpy as np\n'), ((1167, 1218), 'numpy.array', 'np.array', (["[a['n Liberal Democrats'] for a in stats]"], {}), "([a['n Liberal Democrats'] for a in stats])\n", (117...
import numpy as np # x = np.array([1,2,3]) # print(x) # 행렬의 계산 x = np.array([1.0,2.0,3.0]) y = np.array([2.0,4.0,6.0]) x + y x * y x / y x / 2.0 # 브로드 캐스트 기능 A = np.array([[1,2],[3,4]]) print(A) A.shape A.dtype B = np.array([[3,0],[0,6]]) A + B A * B A * 10 # 브로드 캐스트 # 브로드 캐스트 -> 스칼라값을 확대 A = np.array([1,2],[3,4])...
[ "numpy.array" ]
[((69, 94), 'numpy.array', 'np.array', (['[1.0, 2.0, 3.0]'], {}), '([1.0, 2.0, 3.0])\n', (77, 94), True, 'import numpy as np\n'), ((97, 122), 'numpy.array', 'np.array', (['[2.0, 4.0, 6.0]'], {}), '([2.0, 4.0, 6.0])\n', (105, 122), True, 'import numpy as np\n'), ((165, 191), 'numpy.array', 'np.array', (['[[1, 2], [3, 4]...
from matplotlib import pyplot as plt # Pyplot for nice graphs from matplotlib import patches as mpatches from mpl_toolkits.mplot3d import Axes3D # Used for 3D plots from matplotlib.widgets import Slider, Button import matplotlib import numpy as np # NumPy # import seaborn from numpy import lin...
[ "matplotlib.pyplot.title", "numpy.diag", "numpy.set_printoptions", "matplotlib.pyplot.imshow", "matplotlib.pyplot.colorbar", "numpy.linspace", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "Functions.RecursionRoutine", "matplotlib.pyplot.ylabel", "matplotlib.p...
[((444, 486), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (463, 486), True, 'import numpy as np\n'), ((1125, 1191), 'numpy.array', 'np.array', (['[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]'], {}), '([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0...
""" Because reinventing the wheel is so much fun, here is my own PCA implementation using SVD in numpy. Ok, I did read a lot of existing implementations, for instance: http://stackoverflow.com/questions/1730600/principal-component-analysis-in-python http://www.cs.stevens.edu/~mordohai/classes/cs559_s09/PCA_in_MATLAB.pd...
[ "time.ctime", "numpy.linalg.svd", "numpy.dot", "numpy.all", "numpy.sqrt" ]
[((3030, 3056), 'numpy.sqrt', 'np.sqrt', (['(data.shape[0] - 1)'], {}), '(data.shape[0] - 1)\n', (3037, 3056), True, 'import numpy as np\n'), ((3140, 3170), 'numpy.linalg.svd', 'svd', (['data'], {'full_matrices': '(False)'}), '(data, full_matrices=False)\n', (3143, 3170), False, 'from numpy.linalg import svd\n'), ((331...
from pyoma.browser import db import pickle import pandas as pd import h5py import itertools import json import random from scipy.sparse import csr_matrix from tables import * import numpy as np import random np.random.seed(0) random.seed(0) import ete3 from datasketch import WeightedMinHashGenerator #from validatio...
[ "pyprofiler.utils.hashutils.tree2str_DCA", "numpy.random.seed", "numpy.argsort", "gc.collect", "multiprocessing.log_to_stderr", "multiprocessing.Queue", "random.seed", "numpy.fill_diagonal", "h5py.File", "functools.partial", "pandas.DataFrame.from_dict", "numpy.asarray", "time.sleep", "num...
[((210, 227), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (224, 227), True, 'import numpy as np\n'), ((230, 244), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (241, 244), False, 'import random\n'), ((1058, 1088), 'h5py.File', 'h5py.File', (['hashes_h5'], {'mode': '"""r"""'}), "(hashes_h5, mo...
# -*- coding: utf-8 -*- from warnings import warn import numpy as np import pandas as pd import sklearn.metrics.pairwise from ..misc import NeuroKitWarning from ..signal.signal_psd import signal_psd from .complexity_embedding import complexity_embedding from .optim_complexity_delay import complexity_delay def compl...
[ "numpy.sum", "numpy.log", "numpy.ceil", "numpy.linalg.lstsq", "numpy.zeros", "numpy.identity", "numpy.argmin", "numpy.isfinite", "numpy.argsort", "numpy.where", "numpy.array", "numpy.arange", "numpy.dot", "numpy.diag", "warnings.warn" ]
[((6535, 6575), 'numpy.argmin', 'np.argmin', (['dists[:ntraj, :ntraj]'], {'axis': '(1)'}), '(dists[:ntraj, :ntraj], axis=1)\n', (6544, 6575), True, 'import numpy as np\n'), ((6752, 6776), 'numpy.zeros', 'np.zeros', (['len_trajectory'], {}), '(len_trajectory)\n', (6760, 6776), True, 'import numpy as np\n'), ((8145, 8165...
import numpy as np import torch from matplotlib import pyplot as plt from torch import nn import torch.nn.functional as F class ResidualBlock(nn.Module): def __init__(self, inchannel, outchannel, stride=1, shortcut=None): super().__init__() self.left = nn.Sequential( nn.Conv2d(inchanne...
[ "torch.nn.ReLU", "torch.nn.Sequential", "torch.nn.functional.avg_pool2d", "torch.load", "torch.nn.Conv2d", "numpy.transpose", "torch.randn", "torch.nn.BatchNorm2d", "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.functional.relu" ]
[((2616, 2643), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(416)', '(416)'], {}), '(1, 3, 416, 416)\n', (2627, 2643), False, 'import torch\n'), ((743, 754), 'torch.nn.functional.relu', 'F.relu', (['out'], {}), '(out)\n', (749, 754), True, 'import torch.nn.functional as F\n'), ((1320, 1346), 'torch.nn.Linear', 'nn.L...
#!/bin/env python # -*- coding: utf-8 -*- # # Created on 14.01.21 # # Created for py_bacy # # @author: <NAME>, <EMAIL> # # Copyright (C) {2021} {<NAME>} # System modules import logging from typing import Iterable, Tuple, List, Dict, Any, Union import os.path from collections import OrderedDict # External modules...
[ "pandas.DataFrame", "numpy.abs", "xarray.concat", "tabulate.tabulate", "collections.OrderedDict", "pandas.concat" ]
[((2344, 2386), 'xarray.concat', 'xr.concat', (['obs_equivalent'], {'dim': '"""obs_group"""'}), "(obs_equivalent, dim='obs_group')\n", (2353, 2386), True, 'import xarray as xr\n'), ((2406, 2455), 'xarray.concat', 'xr.concat', (['filtered_observations'], {'dim': '"""obs_group"""'}), "(filtered_observations, dim='obs_gro...
import gc import os from datetime import timedelta from typing import Dict, Any, List import cv2 import numpy as np import torch import torch.distributed as dist from fire import Fire from omegaconf import OmegaConf from pytorch_toolbelt.utils.distributed import is_main_process from pytorch_toolbelt.utils import fs fr...
[ "numpy.random.seed", "gc.collect", "torch.no_grad", "os.path.join", "os.path.exists", "xview3.inference.predict_multilabel_scenes", "numpy.isfinite", "datetime.timedelta", "torch.cuda.set_device", "cv2.resize", "tqdm.tqdm", "torch.manual_seed", "pytorch_toolbelt.utils.fs.id_from_fname", "p...
[((1091, 1133), 'os.makedirs', 'os.makedirs', (['submission_dir'], {'exist_ok': '(True)'}), '(submission_dir, exist_ok=True)\n', (1102, 1133), False, 'import os\n'), ((1917, 1929), 'gc.collect', 'gc.collect', ([], {}), '()\n', (1927, 1929), False, 'import gc\n'), ((1935, 1977), 'os.makedirs', 'os.makedirs', (['submissi...
from re import L import numpy as np from games.maze.maze_game import MazeGame from games.maze.maze_level import MazeLevel from novelty_neat.generation import NeatLevelGenerator from novelty_neat.types import LevelNeuralNet from games.level import Level import neat class GenerateMazeLevelUsingOnePass(NeatLevelGenerator...
[ "numpy.random.randn", "games.maze.maze_level.MazeLevel", "numpy.zeros", "numpy.ones", "numpy.any", "numpy.random.rand" ]
[((13722, 13738), 'numpy.zeros', 'np.zeros', (['(h, w)'], {}), '((h, w))\n', (13730, 13738), True, 'import numpy as np\n'), ((14334, 14356), 'numpy.any', 'np.any', (['(output < -0.01)'], {}), '(output < -0.01)\n', (14340, 14356), True, 'import numpy as np\n'), ((18416, 18434), 'numpy.random.randn', 'np.random.randn', (...
import numpy as np from opytimizer.optimizers.evolutionary import iwo from opytimizer.spaces import search np.random.seed(0) def test_iwo_params(): params = { 'min_seeds': 0, 'max_seeds': 5, 'e': 2, 'final_sigma': 0.001, 'init_sigma': 3 } new_iwo = iwo.IWO(params...
[ "opytimizer.optimizers.evolutionary.iwo.IWO", "numpy.sum", "numpy.random.seed", "opytimizer.spaces.search.SearchSpace" ]
[((109, 126), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (123, 126), True, 'import numpy as np\n'), ((306, 328), 'opytimizer.optimizers.evolutionary.iwo.IWO', 'iwo.IWO', ([], {'params': 'params'}), '(params=params)\n', (313, 328), False, 'from opytimizer.optimizers.evolutionary import iwo\n'), ((549...
# NEI.py (stewi) # !/usr/bin/env python3 # coding=utf-8 """ Imports NEI data and processes to Standardized EPA output format. Uses the NEI data exports from EIS. Must contain locally downloaded data for options A:C. This file requires parameters be passed like: Option -Y Year Options: A - for downloading NEI ...
[ "stewi.globals.write_metadata", "stewi.globals.config", "argparse.ArgumentParser", "pandas.read_csv", "stewi.validate.write_validation_result", "esupy.util.strip_file_extension", "pandas.read_table", "pandas.DataFrame", "stewi.globals.aggregate", "requests.Session", "os.path.exists", "stewi.va...
[((1683, 1747), 'pandas.read_table', 'pd.read_table', (["(nei_data_dir + 'NEI_required_fields.csv')"], {'sep': '""","""'}), "(nei_data_dir + 'NEI_required_fields.csv', sep=',')\n", (1696, 1747), True, 'import pandas as pd\n'), ((1892, 1948), 'pandas.read_parquet', 'pd.read_parquet', (['file'], {'columns': 'usecols', 'e...
import numpy as np from argparse import ArgumentParser from distutils.util import strtobool from tpp.models import ENCODER_NAMES, DECODER_NAMES def parse_args(allow_unknown=False): parser = ArgumentParser(allow_abbrev=False) # Run configuration parser.add_argument("--seed", type=int, default=0, help="Th...
[ "numpy.random.uniform", "numpy.random.seed", "argparse.ArgumentParser", "distutils.util.strtobool", "numpy.array" ]
[((198, 232), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'allow_abbrev': '(False)'}), '(allow_abbrev=False)\n', (212, 232), False, 'from argparse import ArgumentParser\n'), ((17560, 17595), 'numpy.array', 'np.array', (['args.mu'], {'dtype': 'np.float32'}), '(args.mu, dtype=np.float32)\n', (17568, 17595), True, ...
#! /usr/bin/env python import argparse,os,subprocess from wpipe import * from stips.observation_module import ObservationModule import numpy as np filtdict = {'R':'R062', 'Z':'Z087', 'Y':'Y106', 'J':'J129', 'H':'H158', 'F':'F184'} def register(PID,task_name)...
[ "subprocess.run", "stips.observation_module.ObservationModule", "numpy.random.randint", "argparse.ArgumentParser" ]
[((2151, 2211), 'subprocess.run', 'subprocess.run', (["['sbatch', slurmfile]"], {'cwd': 'myConfig.procpath'}), "(['sbatch', slurmfile], cwd=myConfig.procpath)\n", (2165, 2211), False, 'import argparse, os, subprocess\n'), ((3571, 3622), 'stips.observation_module.ObservationModule', 'ObservationModule', (['obs'], {'scen...
import numpy as np import matplotlib.pylab as plt class KalmanFilter(object): def __init__(self, initial_position=(0, 0)): self.delta_t = 1 self.P = np.identity(4) self.Q = np.identity(4) self.R = np.identity(2) self.H = np.array([[1, 0, 0, 0], [0, 1, 0, 0]]) ...
[ "matplotlib.pylab.scatter", "matplotlib.pylab.legend", "numpy.identity", "time.time", "matplotlib.pylab.plot", "numpy.sin", "numpy.array", "numpy.linalg.inv", "numpy.linspace", "numpy.dot", "matplotlib.pylab.show" ]
[((2840, 2876), 'matplotlib.pylab.plot', 'plt.plot', (['x', 'y'], {'label': '"""Actual Track"""'}), "(x, y, label='Actual Track')\n", (2848, 2876), True, 'import matplotlib.pylab as plt\n'), ((2882, 2899), 'matplotlib.pylab.scatter', 'plt.scatter', (['x', 'y'], {}), '(x, y)\n', (2893, 2899), True, 'import matplotlib.py...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # ----------------------------------------------------------------------------- "...
[ "vispy.scene.visuals.Text", "vispy.app.run", "vispy.visuals.Visual.__init__", "vispy.visuals.transforms.MatrixTransform", "vispy.scene.visuals.create_visual_node", "numpy.array", "vispy.scene.SceneCanvas" ]
[((7262, 7308), 'vispy.scene.visuals.create_visual_node', 'scene.visuals.create_visual_node', (['MyRectVisual'], {}), '(MyRectVisual)\n', (7294, 7308), False, 'from vispy import app, gloo, visuals, scene\n'), ((7381, 7429), 'vispy.scene.SceneCanvas', 'scene.SceneCanvas', ([], {'keys': '"""interactive"""', 'show': '(Tru...
import numpy as np import scipy as sp import datajoint as dj import matplotlib.pyplot as plt from scipy import signal from pipeline import experiment, tracking, ephys # ======== Define some useful variables ============== _side_cam = {'tracking_device': 'Camera 0'} _tracked_nose_features = [n for n in tracking.Tr...
[ "numpy.abs", "numpy.angle", "numpy.floor", "numpy.isnan", "pipeline.experiment.TrialEventType.fetch", "numpy.histogram", "numpy.arange", "numpy.full", "numpy.cumsum", "numpy.linspace", "pipeline.experiment.ActionEventType.fetch", "matplotlib.pyplot.subplots", "scipy.signal.butter", "numpy....
[((1387, 1427), 'numpy.full', 'np.full', (['(window_size,)', '(1 / window_size)'], {}), '((window_size,), 1 / window_size)\n', (1394, 1427), True, 'import numpy as np\n'), ((1446, 1498), 'scipy.signal.convolve', 'signal.convolve', (['trial_outcomes', 'kernel'], {'mode': '"""same"""'}), "(trial_outcomes, kernel, mode='s...
from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score ,mean_squared_error from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor from sklearn.neighbors import KNeighborsRegressor from sklearn.svm import SVR from sklearn.ensemble ...
[ "gpa.load_data", "sklearn.model_selection.train_test_split", "xgboost.XGBRegressor", "catboost.CatBoostRegressor", "sklearn.tree.DecisionTreeRegressor", "sklearn.linear_model.ElasticNet", "sklearn.metrics.mean_squared_error", "sklearn.linear_model.Ridge", "sklearn.linear_model.Lasso", "sklearn.lin...
[((565, 600), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""streamlit-app"""'], {}), "(1, 'streamlit-app')\n", (580, 600), False, 'import sys\n'), ((731, 746), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (736, 746), False, 'from flask import Flask, request\n'), ((832, 843), 'gpa.load_data', 'load_d...
""" This software is an implementation of Deep MRI brain extraction: A 3D convolutional neural network for skull stripping You can download the paper at http://dx.doi.org/10.1016/j.neuroimage.2016.01.024 If you use this software for your projects please cite: Kleesiek and Urban et al, Deep MRI brain extraction: A 3...
[ "theano.tensor.maximum", "numpy.ones", "numpy.mean", "numpy.random.normal", "numpy.prod", "theano.compile.get_default_mode", "theano.tensor.log", "theano.tensor.concatenate", "theano.tensor.set_subtensor", "theano.tensor.zeros_like", "theano.tensor.mean", "theano.shared", "numpy.float.is_int...
[((2613, 2635), 'numpy.log2', 'np.log2', (['output_stride'], {}), '(output_stride)\n', (2620, 2635), True, 'import numpy as np\n'), ((2736, 2762), 'numpy.all', 'np.all', (['(output_stride == 2)'], {}), '(output_stride == 2)\n', (2742, 2762), True, 'import numpy as np\n'), ((2652, 2674), 'numpy.float.is_integer', 'np.fl...
import numpy as np from numpy_fracdiff import fracdiff from statsmodels.tsa.stattools import adfuller import scipy.optimize def loss_fn(d: float, x: np.array, n_trunc: int) -> float: # compute fractal diff for given order and truncation z = fracdiff(x, order=d, truncation=n_trunc) # compute ADF test s...
[ "numpy.empty", "statsmodels.tsa.stattools.adfuller", "numpy_fracdiff.fracdiff" ]
[((251, 291), 'numpy_fracdiff.fracdiff', 'fracdiff', (['x'], {'order': 'd', 'truncation': 'n_trunc'}), '(x, order=d, truncation=n_trunc)\n', (259, 291), False, 'from numpy_fracdiff import fracdiff\n'), ((347, 399), 'statsmodels.tsa.stattools.adfuller', 'adfuller', (['z[n_trunc:]'], {'regression': '"""c"""', 'autolag': ...
import random import numpy as np from lib.tools.grid import Grid from lib.objects.tracktile import TrackTile # this part could obviously be streamlined for smaller code footprint # not sure how to go about it without sacrificing code readability # since this is called once every game, this wouldn't be the main bottle...
[ "numpy.zeros", "random.choice", "lib.tools.grid.Grid", "lib.objects.tracktile.TrackTile", "numpy.vstack" ]
[((1125, 1140), 'numpy.vstack', 'np.vstack', (['arrs'], {}), '(arrs)\n', (1134, 1140), True, 'import numpy as np\n'), ((2876, 2914), 'numpy.zeros', 'np.zeros', (['(height, width)'], {'dtype': '"""int"""'}), "((height, width), dtype='int')\n", (2884, 2914), True, 'import numpy as np\n'), ((2279, 2294), 'lib.objects.trac...
"""Problem solutions for approximation lecture.""" from itertools import product import numpy as np import pandas as pd from approximation_algorithms import get_interpolator from approximation_auxiliary import compute_interpolation_error_df from approximation_auxiliary import get_uniform_nodes from approximation_probl...
[ "pandas.DataFrame", "pandas.MultiIndex.from_tuples", "approximation_auxiliary.get_uniform_nodes", "numpy.linspace", "approximation_algorithms.get_interpolator", "approximation_problems.problem_runge" ]
[((598, 657), 'pandas.MultiIndex.from_tuples', 'pd.MultiIndex.from_tuples', (['index'], {'names': "('Degree', 'Point')"}), "(index, names=('Degree', 'Point'))\n", (623, 657), True, 'import pandas as pd\n'), ((667, 728), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Value', 'Approximation']", 'index': 'index'}...
# -*- coding: utf-8 -*- # ---------------------------- IMPORTS ---------------------------- # from __future__ import division from __future__ import print_function from __future__ import absolute_import # multiprocessing from builtins import zip from builtins import object import itertools as it from multiprocess...
[ "cv2.GaussianBlur", "numpy.sum", "cv2.warpAffine", "cv2.xfeatures2d.SURF_create", "numpy.sin", "numpy.arange", "itertools.imap", "cv2.invertAffineTransform", "cv2.BFMatcher", "cv2.BRISK", "cv2.resize", "multiprocessing.pool.ThreadPool", "cv2.FlannBasedMatcher", "numpy.hstack", "cv2.ORB_c...
[((796, 819), 'multiprocessing.pool.ThreadPool', 'Pool', ([], {'processes': 'NO_CPUs'}), '(processes=NO_CPUs)\n', (800, 819), True, 'from multiprocessing.pool import ThreadPool as Pool\n'), ((11012, 11046), 'numpy.float32', 'np.float32', (['[[1, 0, 0], [0, 1, 0]]'], {}), '([[1, 0, 0], [0, 1, 0]])\n', (11022, 11046), Tr...
"""Synthetic observation data testing. """ import copy import unittest import numpy import tigernet from .network_objects import network_lattice_1x1_geomelem from .network_objects import network_empirical_simplified import platform os = platform.platform()[:7].lower() if os == "windows": WINDOWS = True DECI...
[ "unittest.main", "unittest.skipIf", "copy.deepcopy", "tigernet.Observations", "platform.platform", "numpy.array", "tigernet.generate_obs" ]
[((12671, 12740), 'unittest.skipIf', 'unittest.skipIf', (['WINDOWS', '"""Skipping Windows due to precision issues."""'], {}), "(WINDOWS, 'Skipping Windows due to precision issues.')\n", (12686, 12740), False, 'import unittest\n'), ((13610, 13679), 'unittest.skipIf', 'unittest.skipIf', (['WINDOWS', '"""Skipping Windows ...
## @ingroup Methods-Aerodynamics-Common-Fidelity_Zero-Lift # compute_HFW_inflow_velocities.py # # Created: Sep 2021, <NAME> # Modified: # ---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- from SUAVE.Core impor...
[ "numpy.size", "SUAVE.Core.Data", "numpy.zeros", "numpy.sin", "numpy.cos", "scipy.interpolate.interp1d", "SUAVE.Methods.Aerodynamics.Common.Fidelity_Zero.Lift.compute_wake_induced_velocity.compute_wake_induced_velocity", "SUAVE.Methods.Aerodynamics.Common.Fidelity_Zero.Lift.generate_propeller_wake_dist...
[((1028, 1034), 'SUAVE.Core.Data', 'Data', ([], {}), '()\n', (1032, 1034), False, 'from SUAVE.Core import Data\n'), ((1590, 1596), 'SUAVE.Core.Data', 'Data', ([], {}), '()\n', (1594, 1596), False, 'from SUAVE.Core import Data\n'), ((1620, 1626), 'SUAVE.Core.Data', 'Data', ([], {}), '()\n', (1624, 1626), False, 'from SU...
import sys, h5py, subprocess, os, numpy def write_text_2d(fname, head, dm): '''Write text file of 2d arrays. ''' with open(fname, 'w') as f: f.write(head) for i, dm1 in enumerate(dm): for j, dm2 in enumerate(dm1): if abs(dm2) > 1.e-12: f.write...
[ "numpy.conj", "numpy.trace", "numpy.abs", "subprocess.check_output", "numpy.zeros", "os.path.isfile", "subprocess.call", "sys.argv.index" ]
[((2911, 2935), 'subprocess.call', 'subprocess.call', (['command'], {}), '(command)\n', (2926, 2935), False, 'import sys, h5py, subprocess, os, numpy\n'), ((3247, 3271), 'subprocess.call', 'subprocess.call', (['command'], {}), '(command)\n', (3262, 3271), False, 'import sys, h5py, subprocess, os, numpy\n'), ((3785, 380...
import numpy as np # Set up an NCSS query from thredds using siphon query = ncss.query() query.accept('netcdf4') query.variables('Temperature_isobaric', 'Geopotential_height_isobaric') query.vertical_level(50000) now = datetime.utcnow() query.time_range(now, now + timedelta(days=1)) query.lonlat_box(west=-110, east=-4...
[ "numpy.arange" ]
[((782, 807), 'numpy.arange', 'np.arange', (['(5000)', '(6000)', '(80)'], {}), '(5000, 6000, 80)\n', (791, 807), True, 'import numpy as np\n')]
"""Landlab component that simulates overland flow. This component simulates overland flow using the 2-D numerical model of shallow-water flow over topography using the de Almeida et al., 2012 algorithm for storage-cell inundation modeling. .. codeauthor:: <NAME> Examples -------- >>> import numpy as np >>> from land...
[ "landlab.grid.structured_quad.links.vertical_active_link_ids", "landlab.grid.structured_quad.links.fixed_link_ids", "numpy.maximum", "landlab.grid.structured_quad.links.horizontal_west_link_neighbor", "landlab.grid.structured_quad.links.horizontal_active_link_ids", "landlab.grid.structured_quad.links.vert...
[((9613, 9677), 'landlab.grid.structured_quad.links.active_link_ids', 'links.active_link_ids', (['self.grid.shape', 'self.grid.status_at_node'], {}), '(self.grid.shape, self.grid.status_at_node)\n', (9634, 9677), False, 'from landlab.grid.structured_quad import links\n'), ((9827, 9869), 'landlab.grid.structured_quad.li...
#!/opt/local/bin/python3 import random from math import log, sqrt, cos, sin, pi from collections import Counter, namedtuple from multiprocessing import Pool from toolz import concat import numpy as np import scipy import statsmodels.api as sm import matplotlib matplotlib.use('Agg') import seaborn as sns import matp...
[ "statsmodels.api.nonparametric.lowess", "numpy.sum", "numpy.random.multinomial", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "numpy.random.randint", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.close", "math.cos", "collections.Counter", "...
[((265, 286), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (279, 286), False, 'import matplotlib\n'), ((342, 372), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-white"""'], {}), "('seaborn-white')\n", (355, 372), True, 'import matplotlib.pyplot as plt\n'), ((4732, 4741), 'numpy....
import json import logging as log import numbers import numpy as np import os import shutil import sys import weakref from io import StringIO from bson import json_util from tensorflow.python.client import device_lib from constants import json_constant_map def xstr(s): return '' if s is None else str(s) def g...
[ "io.StringIO", "os.remove", "os.unlink", "os.path.isdir", "bson.json_util.dumps", "os.path.exists", "sklearn.utils.validation._num_samples", "sklearn.model_selection._split._validate_shuffle_split", "tensorflow.python.client.device_lib.list_local_devices", "os.path.isfile", "os.path.islink", "...
[((352, 383), 'tensorflow.python.client.device_lib.list_local_devices', 'device_lib.list_local_devices', ([], {}), '()\n', (381, 383), False, 'from tensorflow.python.client import device_lib\n'), ((421, 443), 'os.path.exists', 'os.path.exists', (['folder'], {}), '(folder)\n', (435, 443), False, 'import os\n'), ((3345, ...
""" This code processes balance sheet data in order to fit company data into a normalised balance sheet. This code outputs a CSV file with the first row corresponding to the lines that make up a balance sheet financial statement Progress 3/11/2020 - Wrote code so that it outputs a spreadsheet that works for the first...
[ "pandas.DataFrame", "os.path.join", "ftfy.fix_text", "sklearn.feature_extraction.text.TfidfVectorizer", "os.getcwd", "numpy.isnan", "pandas.to_datetime", "sklearn.neighbors.NearestNeighbors", "re.sub", "os.listdir" ]
[((1632, 1660), 'os.listdir', 'os.listdir', (['source_directory'], {}), '(source_directory)\n', (1642, 1660), False, 'import os\n'), ((5513, 5570), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'clean_unique_income_statement_terms'}), '(columns=clean_unique_income_statement_terms)\n', (5525, 5570), True, 'import...
# Copyright (c) 2020 fortiss GmbH # # Authors: <NAME>, <NAME>, <NAME>, and # <NAME> # # This software is released under the MIT License. # https://opensource.org/licenses/MIT import unittest import numpy as np import os import matplotlib import time from bark_ml.behaviors.cont_behavior import BehaviorContinuousML fr...
[ "unittest.main", "bark.runtime.commons.parameters.ParameterServer", "bark_ml.behaviors.discrete_behavior.BehaviorDiscreteMacroActionsML", "numpy.array", "bark_ml.behaviors.cont_behavior.BehaviorContinuousML" ]
[((1190, 1205), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1203, 1205), False, 'import unittest\n'), ((706, 723), 'bark.runtime.commons.parameters.ParameterServer', 'ParameterServer', ([], {}), '()\n', (721, 723), False, 'from bark.runtime.commons.parameters import ParameterServer\n'), ((748, 786), 'bark_ml.b...
#!/usr/bin/env python """Contains functionality that doesn't fit elsewhere """ import collections.abc import inspect import functools import shelve import struct import logging import pickle import copy import ast import operator import abc import inspect import io import pprint import traceback import numpy import...
[ "pprint.pformat", "numpy.isnan", "progressbar.Percentage", "inspect.getframeinfo", "progressbar.Bar", "inspect.signature", "progressbar.AbsoluteETA", "traceback.format_stack", "inspect.getsource", "ast.parse", "functools.partial", "io.StringIO", "shelve.open", "numpy.ma.concatenate", "fu...
[((396, 426), 'progressbar.Bar', 'progressbar.Bar', (['"""="""', '"""["""', '"""]"""'], {}), "('=', '[', ']')\n", (411, 426), False, 'import progressbar\n'), ((449, 473), 'progressbar.Percentage', 'progressbar.Percentage', ([], {}), '()\n', (471, 473), False, 'import progressbar\n'), ((497, 522), 'progressbar.AdaptiveE...
import numpy as np from numpy.linalg import inv from bokeh.models import ColumnDataSource class Structure: def __init__(self, masses, massSupports, trusses, trussLength, base): masslist = list() for i in range(len(masses)): masslist.append( ColumnDataSource(data=masses[i])...
[ "bokeh.models.ColumnDataSource", "numpy.zeros", "numpy.ones", "numpy.array", "numpy.linalg.inv", "numpy.dot", "numpy.linalg.solve" ]
[((9365, 9381), 'numpy.ones', 'np.ones', (['noNodes'], {}), '(noNodes)\n', (9372, 9381), True, 'import numpy as np\n'), ((9728, 9744), 'numpy.ones', 'np.ones', (['noNodes'], {}), '(noNodes)\n', (9735, 9744), True, 'import numpy as np\n'), ((10207, 10223), 'numpy.zeros', 'np.zeros', (['(3, N)'], {}), '((3, N))\n', (1021...
import os import re import pandas as pd import numpy as np if __name__ == '__main__': wordListPath = os.path.dirname(__file__)+'\..\Data\Treated\list_of_words.txt' datasetPath = os.path.dirname(__file__)+'\..\Data\Treated\mxm_dataset_full.txt' outputPath = os.path.dirname(__file__)+'\..\Data\Treated\d...
[ "re.split", "os.path.dirname", "numpy.arange", "pandas.Series", "pandas.SparseDataFrame" ]
[((111, 136), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (126, 136), False, 'import os\n'), ((192, 217), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (207, 217), False, 'import os\n'), ((275, 300), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__...
import torch from parameters import * from PIL import Image import numpy as np from typing import Union __all__ = ['Normalize', 'ToTensor', 'Resize', 'AlphaKill', 'DictNormalize', 'Dict2Tensor', 'DictResize', 'DictAlphaKill'] class Normalize(object): def __init__(self, mean=(0., 0., 0.), ...
[ "PIL.Image.fromarray", "numpy.array", "numpy.expand_dims", "torch.from_numpy" ]
[((3238, 3268), 'numpy.expand_dims', 'np.expand_dims', (['label'], {'axis': '(-1)'}), '(label, axis=-1)\n', (3252, 3268), True, 'import numpy as np\n'), ((2386, 2409), 'torch.from_numpy', 'torch.from_numpy', (['image'], {}), '(image)\n', (2402, 2409), False, 'import torch\n'), ((3503, 3526), 'torch.from_numpy', 'torch....
# Copyright (c) 2017 The Verde Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause # # This code is part of the Fatiando a Terra project (https://www.fatiando.org) # """ .. _model_selection: Model Selection =============== In :ref:`model_evaluation`, we saw h...
[ "verde.datasets.setup_texas_wind_map", "verde.Spline", "matplotlib.pyplot.show", "cartopy.crs.Mercator", "verde.datasets.fetch_texas_wind", "numpy.argmax", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "verde.grid_coordinates", "verde.SplineCV", "verde.cross_val_score", "itertools....
[((849, 879), 'verde.datasets.fetch_texas_wind', 'vd.datasets.fetch_texas_wind', ([], {}), '()\n', (877, 879), True, 'import verde as vd\n'), ((1092, 1138), 'verde.get_region', 'vd.get_region', (['(data.longitude, data.latitude)'], {}), '((data.longitude, data.latitude))\n', (1105, 1138), True, 'import verde as vd\n'),...
from functools import lru_cache from typing import Union, Tuple, Optional import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle as mpl_Circle from skimage.measure._regionprops import _RegionProperties from .geometry import Circle, Point, Rectangle def bbox_center(region: _Region...
[ "numpy.nanmedian", "numpy.deg2rad", "numpy.copy", "numpy.nanstd", "numpy.nanmin", "matplotlib.patches.Circle", "functools.lru_cache", "matplotlib.pyplot.subplots", "numpy.nanmax" ]
[((2198, 2209), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (2207, 2209), False, 'from functools import lru_cache\n'), ((2569, 2580), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (2578, 2580), False, 'from functools import lru_cache\n'), ((2355, 2379), 'numpy.nanmedian', 'np.nanmedian', (['masked_img...
import numpy as np import os import pickle from torch.utils import data class WikipediaDataset(data.Dataset): def __init__(self, data_dir, split="train"): self.path = data_dir #self.path = '/Users/tyler/Desktop/lent/advanced_ml/from_git_mar_5/Neural-Statistician/SentEval/words/from_cluster' self.file_index =...
[ "pickle.load", "numpy.array" ]
[((567, 587), 'pickle.load', 'pickle.load', (['in_file'], {}), '(in_file)\n', (578, 587), False, 'import pickle\n'), ((599, 639), 'numpy.array', 'np.array', (['self.content[self.content_idx]'], {}), '(self.content[self.content_idx])\n', (607, 639), True, 'import numpy as np\n')]
import cv2 from scipy.fftpack import fftn import numpy as np from matplotlib import pyplot as plt #img = cv2.imread('131317.jpg',0) cap = cv2.VideoCapture('vtest.mp4') fourcc = cv2.VideoWriter_fourcc('X','V','I','D') frame_width = int(cap.get(3)) frame_height = int(cap.get(4)) self_out = cv2.VideoW...
[ "cv2.magnitude", "cv2.VideoWriter_fourcc", "cv2.cvtColor", "cv2.waitKey", "numpy.float32", "cv2.VideoCapture", "numpy.fft.fftshift", "cv2.VideoWriter", "cv2.flip", "cv2.destroyAllWindows" ]
[((151, 180), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""vtest.mp4"""'], {}), "('vtest.mp4')\n", (167, 180), False, 'import cv2\n'), ((193, 235), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (['"""X"""', '"""V"""', '"""I"""', '"""D"""'], {}), "('X', 'V', 'I', 'D')\n", (215, 235), False, 'import cv2\n'), ((310...
""" Tutorial 3: Null models for gradient significance ================================================== In this tutorial we assess the significance of correlations between the first canonical gradient and data from other modalities (curvature, cortical thickness and T1w/T2w image intensity). A normal test of the signi...
[ "numpy.abs", "brainspace.datasets.load_marker", "numpy.empty", "numpy.isnan", "numpy.argsort", "brainspace.plotting.plot_hemispheres", "scipy.sparse.csgraph.dijkstra", "brainspace.datasets.load_gradient", "brainspace.datasets.load_mask", "matplotlib.pyplot.subplots", "brainspace.mesh.mesh_elemen...
[((1689, 1703), 'brainspace.datasets.load_conte69', 'load_conte69', ([], {}), '()\n', (1701, 1703), False, 'from brainspace.datasets import load_gradient, load_marker, load_conte69\n'), ((1727, 1755), 'brainspace.datasets.load_conte69', 'load_conte69', ([], {'as_sphere': '(True)'}), '(as_sphere=True)\n', (1739, 1755), ...
"""Functions for supporting image operations on a canvas (currently only numpy arrays are supported). """ # standard imports from typing import Optional # thirdparty imports import numpy as np # toolbox imports from ..base.image import Image, Imagelike from ..base.image import Size, Sizelike def canvas_create(ima...
[ "numpy.zeros" ]
[((1268, 1329), 'numpy.zeros', 'np.zeros', (['(size.height, size.width, channels)'], {'dtype': 'np.uint8'}), '((size.height, size.width, channels), dtype=np.uint8)\n', (1276, 1329), True, 'import numpy as np\n')]
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
[ "unittest.main", "numpy.random.seed", "numpy.einsum", "pyscf.pbc.tools.k2gamma.get_phase", "pyscf.pbc.tools.k2gamma.kpts_to_kmesh", "numpy.eye", "pyscf.pbc.scf.rsjk.RangeSeparationJKBuilder", "pyscf.pbc.gto.Cell" ]
[((4937, 4952), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4950, 4952), False, 'import unittest\n'), ((795, 801), 'pyscf.pbc.gto.Cell', 'Cell', ([], {}), '()\n', (799, 801), False, 'from pyscf.pbc.gto import Cell\n'), ((970, 976), 'pyscf.pbc.gto.Cell', 'Cell', ([], {}), '()\n', (974, 976), False, 'from pyscf....
#!/usr/bin/python import sys import numpy import os import argparse from tabulate import tabulate from pymicmac import utils_execution def run(xmlFile, foldersNames): (gcpsXYZ, cpsXYZ) = utils_execution.readGCPXMLFile(xmlFile) tableGCPs = [] tableCPs = [] tableKOs = [] for folderName in foldersN...
[ "pymicmac.utils_execution.readGCPXMLFile", "argparse.ArgumentParser", "numpy.std", "numpy.median", "os.path.isfile", "numpy.min", "tabulate.tabulate", "numpy.max", "numpy.mean", "sys.exit" ]
[((193, 232), 'pymicmac.utils_execution.readGCPXMLFile', 'utils_execution.readGCPXMLFile', (['xmlFile'], {}), '(xmlFile)\n', (223, 232), False, 'from pymicmac import utils_execution\n'), ((3557, 3605), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)...
from pmdarima.utils.array import diff, diff_inv, c, is_iterable, as_series, \ check_exog from pmdarima.utils import get_callable from numpy.testing import assert_array_equal, assert_array_almost_equal import pytest import pandas as pd import numpy as np x = np.arange(5) m = np.array([10, 5, 12, 23, 18, 3, 2, 0, ...
[ "numpy.testing.assert_array_equal", "numpy.zeros", "numpy.ones", "pmdarima.utils.array.c", "numpy.random.RandomState", "pytest.param", "pytest.raises", "pmdarima.utils.array.diff", "numpy.array", "numpy.arange", "pmdarima.utils.get_callable", "pmdarima.utils.array.check_exog", "numpy.random....
[((265, 277), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (274, 277), True, 'import numpy as np\n'), ((6199, 6245), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""arr"""', '[X_nan, X_inf]'], {}), "('arr', [X_nan, X_inf])\n", (6222, 6245), False, 'import pytest\n'), ((4486, 4540), 'pmdarima.utils.a...
import numpy as np from skimage import measure def psnrc(true_tensor,test_tensor,val=1): psnrt=0 for i in range(true_tensor.shape[0]): mse=np.mean((np.abs(true_tensor[i,:,:,:]-test_tensor[i,:,:,:]))**2) psnrt+=10*np.log10(val**2/mse) psnrt=psnrt/true_tensor.shape[0] return psnrt def metric...
[ "numpy.log10", "skimage.measure.compare_psnr", "numpy.abs", "skimage.measure.compare_ssim" ]
[((447, 536), 'skimage.measure.compare_psnr', 'measure.compare_psnr', (['true_tensor[i, :, :]', 'test_tensor[i, :, :]'], {'data_range': 'max_val'}), '(true_tensor[i, :, :], test_tensor[i, :, :], data_range\n =max_val)\n', (467, 536), False, 'from skimage import measure\n'), ((546, 635), 'skimage.measure.compare_ssim...
#!/usr/bin/env python """ Create a sine wave in Gaussian noise and compare the Bayesian spectral estimation to a power spectrum """ import matplotlib.pyplot as pl import matplotlib.mlab as mlab import matplotlib.gridspec as gridspec import numpy as np # set plot to render labels using latex pl.rc('text', usetex=True...
[ "matplotlib.pyplot.subplot", "numpy.trapz", "numpy.sum", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.sin", "numpy.max", "matplotlib.pyplot.rc", "numpy.linspace", "matplotlib.pyplot.gca", "numpy.cos", "matplotlib.gridspe...
[((295, 321), 'matplotlib.pyplot.rc', 'pl.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (300, 321), True, 'import matplotlib.pyplot as pl\n'), ((322, 351), 'matplotlib.pyplot.rc', 'pl.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (327, 351), True, 'import matp...
import numpy as np from scipy.linalg import lu_factor, lu_solve from compas.geometry import allclose # noqa: F401 from compas_nurbs.helpers import find_spans from compas_nurbs.helpers import basis_functions from compas_nurbs.knot_vectors import knot_vector_and_params from compas_nurbs.knot_vectors import CurveKnotSt...
[ "compas_nurbs.knot_vectors.knot_vector_and_params", "compas_nurbs.Curve", "compas_nurbs.helpers.basis_functions", "scipy.linalg.lu_solve", "numpy.insert", "compas_nurbs.helpers.find_spans", "numpy.array", "scipy.linalg.lu_factor", "compas.geometry.allclose" ]
[((1457, 1473), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (1465, 1473), True, 'import numpy as np\n'), ((1487, 1553), 'compas_nurbs.knot_vectors.knot_vector_and_params', 'knot_vector_and_params', (['points', 'degree', 'knot_style'], {'extended': '(False)'}), '(points, degree, knot_style, extended=False...
import time import math import random import numpy as np import basis.robot_math as rm import networkx as nx import matplotlib.pyplot as plt from operator import itemgetter class RRTDW(object): def __init__(self, robot_s): self.robot_s = robot_s.copy() self.roadmap = nx.Graph() self.start...
[ "matplotlib.pyplot.clf", "numpy.argmin", "numpy.linalg.norm", "matplotlib.pyplot.gca", "basis.robot_math.unit_vector", "random.randint", "networkx.shortest_path", "numpy.linspace", "matplotlib.pyplot.pause", "matplotlib.pyplot.show", "math.ceil", "matplotlib.pyplot.ylim", "numpy.asarray", ...
[((16325, 16335), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (16333, 16335), True, 'import matplotlib.pyplot as plt\n'), ((291, 301), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (299, 301), True, 'import networkx as nx\n'), ((1696, 1722), 'numpy.array', 'np.array', (['nodes_value_list'], {}), '(nodes_v...
import numpy as np import cv2 cap = cv2.VideoCapture("C:\\Users\\prana\\Desktop\\droplet.mov") fourcc = cv2.VideoWriter_fourcc(*'DVIX') #frameVid = cv2.VideoWriter('frame.avi',-1, 20.0, (640,480)) #maskVid = cv2.VideoWriter('mask.avi',-1, 20.0, (640,480)) #resVid = cv2.VideoWriter('res.avi',-1, 20.0, (640,480))...
[ "cv2.VideoWriter_fourcc", "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "numpy.array", "cv2.destroyAllWindows", "cv2.inRange" ]
[((40, 98), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""C:\\\\Users\\\\prana\\\\Desktop\\\\droplet.mov"""'], {}), "('C:\\\\Users\\\\prana\\\\Desktop\\\\droplet.mov')\n", (56, 98), False, 'import cv2\n'), ((109, 140), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'DVIX'"], {}), "(*'DVIX')\n", (131, 140), Fal...
import cv2 import numpy as np drawing = False # true if mouse is pressed mode = True # if True, draw rectangle. Press 'm' to toggle to curve ix, iy = -1, -1 def draw_circle(event, x, y, flags, param): global ix, iy, drawing, mode if event == cv2.EVENT_LBUTTONDOWN: drawing = True ix, iy = x,...
[ "cv2.circle", "cv2.waitKey", "cv2.destroyAllWindows", "numpy.zeros", "cv2.setMouseCallback", "cv2.rectangle", "cv2.imshow", "cv2.namedWindow" ]
[((951, 984), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (959, 984), True, 'import numpy as np\n'), ((989, 1013), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image"""'], {}), "('image')\n", (1004, 1013), False, 'import cv2\n'), ((1018, 1060), 'cv2.setMouseCallback', '...
#!/usr/bin/python # -*- coding: utf-8 -*- import threading import matplotlib.pyplot as plt import numpy as np import re import sys import time import math #Detector de leitura (Elmadjian, 2015) #------------------------------------ class Detector (threading.Thread): def __init__(self, thresh, cv): thre...
[ "threading.Thread.__init__", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.ptp", "threading.Condition", "time.time", "time.sleep", "numpy.append", "matplotlib.pyplot.axhspan", "numpy.array", "matplotlib.pyplot.grid", "re.compile" ]
[((5717, 5738), 'threading.Condition', 'threading.Condition', ([], {}), '()\n', (5736, 5738), False, 'import threading\n'), ((6632, 6664), 'matplotlib.pyplot.plot', 'plt.plot', (['timelist', 'xlist', '"""bo-"""'], {}), "(timelist, xlist, 'bo-')\n", (6640, 6664), True, 'import matplotlib.pyplot as plt\n'), ((6669, 6701)...
import sys import unittest import dask.array as da import dask.distributed as dd import numpy as np import xarray as xr # Import from directory structure if coverage test, or from installed # packages otherwise if "--cov" in str(sys.argv): from src.geocat.comp import heat_index else: from geocat.comp import h...
[ "dask.distributed.Client", "numpy.allclose", "numpy.asarray", "geocat.comp.heat_index", "numpy.array", "xarray.DataArray", "dask.array.from_array" ]
[((775, 823), 'numpy.array', 'np.array', (['[104, 100, 92, 92, 86, 80, 80, 60, 30]'], {}), '([104, 100, 92, 92, 86, 80, 80, 60, 30])\n', (783, 823), True, 'import numpy as np\n'), ((842, 888), 'numpy.array', 'np.array', (['[55, 65, 60, 90, 90, 40, 75, 90, 50]'], {}), '([55, 65, 60, 90, 90, 40, 75, 90, 50])\n', (850, 88...
import numpy as np def mask_nan_labels_np(labels, null_val=0.): with np.errstate(divide='ignore', invalid='ignore'): if np.isnan(null_val): mask = ~np.isnan(labels) else: mask = np.not_equal(labels, null_val) mask = mask.astype('float32') mask /= np.mean(mas...
[ "numpy.nan_to_num", "numpy.subtract", "numpy.isnan", "numpy.errstate", "numpy.not_equal", "numpy.mean" ]
[((75, 121), 'numpy.errstate', 'np.errstate', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (86, 121), True, 'import numpy as np\n'), ((134, 152), 'numpy.isnan', 'np.isnan', (['null_val'], {}), '(null_val)\n', (142, 152), True, 'import numpy as np\n'), ((309, 322)...
import json import pprint import argparse import firebase_admin import numpy as np from copy import deepcopy from firebase_admin import credentials, db, firestore pp = pprint.PrettyPrinter(indent=4) def valid_identifier(identifier): splited = identifier.split(' ') if len(splited) != 2 or not splited[0].isupper()...
[ "firebase_admin.credentials.Certificate", "json.load", "copy.deepcopy", "argparse.ArgumentParser", "numpy.std", "pprint.PrettyPrinter", "numpy.mean", "firebase_admin.db.reference", "firebase_admin.initialize_app" ]
[((171, 201), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', (191, 201), False, 'import pprint\n'), ((7731, 7756), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7754, 7756), False, 'import argparse\n'), ((4317, 4329), 'json.load', 'json.load', (['f'],...
import numpy as np import imcut.pycut as pspc import matplotlib.pyplot as plt # create data data = np.random.rand(30, 30, 30) data[10:20, 5:15, 3:13] += 1 data = data * 30 data = data.astype(np.int16) # Make seeds seeds = np.zeros([30, 30, 30]) seeds[13:17, 7:10, 5:11] = 1 seeds[0:5:, 0:10, 0:11] = 2 # Run igc = psp...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "imcut.pycut.ImageGraphCut", "matplotlib.pyplot.contour", "numpy.random.rand", "matplotlib.pyplot.cm.get_cmap", "matplotlib.pyplot.savefig" ]
[((100, 126), 'numpy.random.rand', 'np.random.rand', (['(30)', '(30)', '(30)'], {}), '(30, 30, 30)\n', (114, 126), True, 'import numpy as np\n'), ((224, 246), 'numpy.zeros', 'np.zeros', (['[30, 30, 30]'], {}), '([30, 30, 30])\n', (232, 246), True, 'import numpy as np\n'), ((317, 362), 'imcut.pycut.ImageGraphCut', 'pspc...
import numpy as np class ReverseScalar(): def __init__(self, val: float): self._val = val self._gradient = 1 self._children = {} def get(self): return self._val, self.compute_gradient() def compute_gradient(self): if len...
[ "numpy.log" ]
[((4035, 4048), 'numpy.log', 'np.log', (['other'], {}), '(other)\n', (4041, 4048), True, 'import numpy as np\n'), ((3646, 3663), 'numpy.log', 'np.log', (['self._val'], {}), '(self._val)\n', (3652, 3663), True, 'import numpy as np\n')]
import dolfin as df import numpy as np import os from . import * from common.io import mpi_is_root, load_mesh from common.bcs import Fixed, Charged from .porous import Obstacles from mpi4py import MPI __author__ = "<NAME>" comm = MPI.COMM_WORLD size = comm.Get_size() rank = comm.Get_rank() class PeriodicBoundary(df....
[ "common.bcs.Charged", "numpy.zeros_like", "common.bcs.Fixed", "numpy.zeros", "dolfin.Expression", "dolfin.Constant", "dolfin.assemble", "os.path.join", "dolfin.SubDomain.__init__", "dolfin.near" ]
[((4628, 4647), 'numpy.zeros', 'np.zeros', (['(size, 2)'], {}), '((size, 2))\n', (4636, 4647), True, 'import numpy as np\n'), ((4976, 4997), 'numpy.zeros_like', 'np.zeros_like', (['x_proc'], {}), '(x_proc)\n', (4989, 4997), True, 'import numpy as np\n'), ((5615, 5632), 'common.bcs.Fixed', 'Fixed', (['(0.0, 0.0)'], {}),...
# Copyright 2021 <NAME>, Department of Chemistry, University of Wisconsin-Madison # 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 re...
[ "matplotlib.pyplot.title", "numpy.sum", "matplotlib.pyplot.figure", "matplotlib.pyplot.tick_params", "numpy.diag", "matplotlib.pyplot.tight_layout", "numpy.power", "numpy.savetxt", "numpy.identity", "numpy.insert", "numpy.reshape", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "os.pa...
[((2366, 2409), 'numpy.zeros', 'np.zeros', (['(input_len, dimension, dimension)'], {}), '((input_len, dimension, dimension))\n', (2374, 2409), True, 'import numpy as np\n'), ((2434, 2453), 'numpy.zeros', 'np.zeros', (['input_len'], {}), '(input_len)\n', (2442, 2453), True, 'import numpy as np\n'), ((2477, 2524), 'numpy...
#!/usr/bin/env python # coding: utf-8 # # Author: <NAME> # URL: http://kazuto1011.github.io # Created: 2017-11-01 from __future__ import absolute_import, division, print_function import os.path as osp import click import cv2 import numpy as np import torch import torch.nn as nn import torch.nn.functional as ...
[ "tensorboardX.SummaryWriter", "torch.utils.data.DataLoader", "libs.models.DeepLabV2_ResNet101_MSC", "torch.load", "torchnet.meter.MovingAverageValueMeter", "numpy.zeros", "click.option", "libs.utils.loss.CrossEntropyLoss2d", "click.command", "torch.autograd.Variable", "torch.cuda.is_available", ...
[((1990, 2005), 'click.command', 'click.command', ([], {}), '()\n', (2003, 2005), False, 'import click\n'), ((2007, 2062), 'click.option', 'click.option', (['"""--config"""', '"""-c"""'], {'type': 'str', 'required': '(True)'}), "('--config', '-c', type=str, required=True)\n", (2019, 2062), False, 'import click\n'), ((2...
#!/usr/bin/env python3 from ctypes import * import numpy as np import os import sys try: shared_library = None shared_library = os.environ['LIB_DARKNET'] if not os.path.exists(shared_library): raise ValueError(f'Path "{shared_library}" does not exist.') else: import fnmatch ...
[ "numpy.ascontiguousarray", "os.path.exists", "fnmatch.fnmatch", "sys.exit" ]
[((177, 207), 'os.path.exists', 'os.path.exists', (['shared_library'], {}), '(shared_library)\n', (191, 207), False, 'import os\n'), ((479, 523), 'sys.exit', 'sys.exit', (['"""LIB_DARKNET variable is not set."""'], {}), "('LIB_DARKNET variable is not set.')\n", (487, 523), False, 'import sys\n'), ((560, 579), 'sys.exit...
import cv2 import tensorflow as tf import pytesseract from PIL import Image import numpy as np import json from django.http import JsonResponse from django.http import HttpResponse import pathlib pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe' path_to_classifier = pathlib.Path(...
[ "tensorflow.keras.models.load_model", "cv2.cvtColor", "numpy.expand_dims", "pytesseract.image_to_string", "cv2.adaptiveThreshold", "cv2.VideoCapture", "django.http.JsonResponse", "pathlib.Path", "cv2.imencode", "cv2.resize" ]
[((1975, 2042), 'cv2.resize', 'cv2.resize', (['card'], {'dsize': 'cam_pic_size', 'interpolation': 'cv2.INTER_CUBIC'}), '(card, dsize=cam_pic_size, interpolation=cv2.INTER_CUBIC)\n', (1985, 2042), False, 'import cv2\n'), ((2054, 2093), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2GRAY'], {}), '(frame, cv2.C...
import pandas as pd import numpy as np import pickle5 as pickle import argparse import time import json import os from sklearn.tree import export_graphviz from imblearn.ensemble import BalancedRandomForestClassifier import matplotlib.pyplot as plt from sklearn import tree # Currently use sys to get other script - in F...
[ "sys.path.append", "help_functions.str_to_bool", "argparse.ArgumentParser", "numpy.asarray", "os.path.realpath", "os.system", "time.time", "pandas.read_pickle", "matplotlib.pyplot.subplots" ]
[((426, 464), 'sys.path.append', 'sys.path.append', (["(path_main + '/Utils/')"], {}), "(path_main + '/Utils/')\n", (441, 464), False, 'import sys\n'), ((1683, 1707), 'os.system', 'os.system', (['"""rm tree.dot"""'], {}), "('rm tree.dot')\n", (1692, 1707), False, 'import os\n'), ((1725, 1780), 'matplotlib.pyplot.subplo...
# -*- coding: utf-8 -*- """ Created on Sun May 30 00:05:15 2021 @author: Antho """ # Imports from datetime import timedelta import numpy as np def daterange(start_date, end_date): """ Create a list day by day from start_date to end_date. Parameters ---------- start_date : date...
[ "numpy.log", "datetime.timedelta", "numpy.exp" ]
[((954, 976), 'numpy.exp', 'np.exp', (['weekly_returns'], {}), '(weekly_returns)\n', (960, 976), True, 'import numpy as np\n'), ((901, 921), 'numpy.log', 'np.log', (['weekly_price'], {}), '(weekly_price)\n', (907, 921), True, 'import numpy as np\n'), ((536, 548), 'datetime.timedelta', 'timedelta', (['n'], {}), '(n)\n',...
import numpy as np def gradient_descent(w0, optimizer, regularizer, opts=dict()): # f, gradf # n_iter, eta0, algorithm='GD', batch_size=1, learning_rate_scheduling=None): w = w0 dim = w0.size eta = opts.get('eta0', 0.01) n_iter = opts.get('n_iter', 10) batch_size = opts.get('batch_size', ...
[ "numpy.abs", "numpy.random.randn", "numpy.power", "numpy.square", "numpy.zeros", "numpy.ones", "numpy.random.randint", "numpy.arange", "numpy.linalg.norm", "numpy.random.normal", "numpy.sign", "numpy.dot", "numpy.random.shuffle", "numpy.sqrt" ]
[((466, 492), 'numpy.arange', 'np.arange', (['(0)', 'n_samples', '(1)'], {}), '(0, n_samples, 1)\n', (475, 492), True, 'import numpy as np\n'), ((568, 595), 'numpy.zeros', 'np.zeros', (['(n_iter + 1, dim)'], {}), '((n_iter + 1, dim))\n', (576, 595), True, 'import numpy as np\n'), ((714, 758), 'numpy.zeros', 'np.zeros',...
from numpy import arange, outer from scipy.stats import norm as normdistr from functools import partial from .trialbased import ( MODELS, linear_gaussian_per_finger, linear_separate_gaussians_per_finger, ) def add_gauss(seed, X, n_points, fun): v = fun(seed[:-2], X) t = arange(n_points) r...
[ "functools.partial", "numpy.outer", "numpy.arange", "scipy.stats.norm.pdf" ]
[((298, 314), 'numpy.arange', 'arange', (['n_points'], {}), '(n_points)\n', (304, 314), False, 'from numpy import arange, outer\n'), ((330, 376), 'scipy.stats.norm.pdf', 'normdistr.pdf', (['t'], {'loc': 'seed[-2]', 'scale': 'seed[-1]'}), '(t, loc=seed[-2], scale=seed[-1])\n', (343, 376), True, 'from scipy.stats import ...
from os.path import join, isdir import os import argparse import numpy as np import json import cv2 from tqdm import tqdm def crop_patch(im, img_sz): w = float((img_sz[0] / 2) * (1 + args.padding)) h = float((img_sz[1] / 2) * (1 + args.padding)) x = float((img_sz[0] / 2) - w / 2) y = float((img_sz[1]...
[ "os.mkdir", "tqdm.tqdm", "argparse.ArgumentParser", "os.path.isdir", "numpy.zeros", "os.path.exists", "cv2.warpAffine", "cv2.imread", "numpy.where", "numpy.array", "os.path.join", "os.chdir" ]
[((451, 499), 'numpy.array', 'np.array', (['[[a, 0, c], [0, b, d]]'], {'dtype': 'np.float'}), '([[a, 0, c], [0, b, d]], dtype=np.float)\n', (459, 499), True, 'import numpy as np\n'), ((536, 660), 'cv2.warpAffine', 'cv2.warpAffine', (['im', 'mapping', '(args.output_size, args.output_size)'], {'borderMode': 'cv2.BORDER_C...
# Copyright 2020 <NAME> (<EMAIL>) # 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 writi...
[ "tensorflow.random.set_seed", "os.mkdir", "getopt.getopt", "tensorflow.keras.metrics.Mean", "evaluate.calculate_total_pckh", "os.path.join", "tensorflow.distribute.cluster_resolver.TPUClusterResolver", "tensorflow.keras.losses.MeanSquaredError", "tensorflow.config.list_logical_devices", "os.path.e...
[((979, 1079), 'tensorflow.distribute.cluster_resolver.TPUClusterResolver', 'tf.distribute.cluster_resolver.TPUClusterResolver', ([], {'tpu': "('grpc://' + os.environ['COLAB_TPU_ADDR'])"}), "(tpu='grpc://' + os.\n environ['COLAB_TPU_ADDR'])\n", (1028, 1079), True, 'import tensorflow as tf\n'), ((1075, 1126), 'tensor...
import os import pickle import random import cv2 import h5py import numpy as np import numpy.random as npr from train.h5py_utils import load_dict_from_hdf5 class DataGenerator: def __init__(self, label_dataset_path, bboxes_dataset_path, landmarks_dataset_path, batch_size, im_size, shuffle=Fals...
[ "h5py.File", "cv2.waitKey", "numpy.empty", "numpy.zeros", "numpy.ones", "train.h5py_utils.load_dict_from_hdf5", "pickle.load", "numpy.array", "cv2.destroyAllWindows", "numpy.concatenate" ]
[((8105, 8139), 'numpy.empty', 'np.empty', (['(0, im_size, im_size, 3)'], {}), '((0, im_size, im_size, 3))\n', (8113, 8139), True, 'import numpy as np\n'), ((8155, 8171), 'numpy.empty', 'np.empty', (['(0, 2)'], {}), '((0, 2))\n', (8163, 8171), True, 'import numpy as np\n'), ((8187, 8203), 'numpy.empty', 'np.empty', (['...
import os import sys import json import csv import random import argparse import torch import dataloaders import models import inspect import math from datetime import datetime from utils import losses from utils import Logger from utils.torchsummary import summary from trainer import Trainer from torchvision import tr...
[ "os.mkdir", "tqdm.tqdm", "json.dump", "torch.no_grad", "csv.writer", "os.path.exists", "torch.cuda.device_count", "numpy.sort", "trainer.Trainer", "torch.nn.DataParallel", "utils.Logger", "os.path.join", "torch.from_numpy" ]
[((1264, 1326), 'os.path.join', 'os.path.join', (['episode_dir', "cfg['trainer']['original_save_dir']"], {}), "(episode_dir, cfg['trainer']['original_save_dir'])\n", (1276, 1326), False, 'import os\n'), ((1362, 1423), 'os.path.join', 'os.path.join', (['episode_dir', "cfg['trainer']['original_log_dir']"], {}), "(episode...
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models import numpy as np def SPSP(x, P=1, method='avg'): batch_size = x.size(0) map_size = x.size()[-2:] pool_features = [] for p in range(1, P+1): pool_size = [np.int(d / p) for d in map_size] ...
[ "torch.nn.ReLU", "torch.rand", "torch.nn.Sequential", "torch.nn.functional.avg_pool2d", "torch.nn.BatchNorm1d", "torch.cat", "torch.nn.Linear", "numpy.int", "torch.pow", "torch.nn.functional.max_pool2d" ]
[((1383, 1414), 'torch.cat', 'torch.cat', (['pool_features'], {'dim': '(1)'}), '(pool_features, dim=1)\n', (1392, 1414), False, 'import torch\n'), ((4492, 4520), 'torch.rand', 'torch.rand', (['(1, 3, 224, 224)'], {}), '((1, 3, 224, 224))\n', (4502, 4520), False, 'import torch\n'), ((2506, 2530), 'torch.nn.Sequential', ...
from time import time import numpy as np import math import random from abc import ABCMeta, abstractmethod, abstractproperty from copy import deepcopy class GeneticThing(): __metaclass__ = ABCMeta @abstractproperty def fitness(self): pass @abstractmethod def mutate(self, r_mutate): ...
[ "copy.deepcopy", "random.random", "numpy.mean", "numpy.exp", "numpy.var" ]
[((2619, 2647), 'copy.deepcopy', 'deepcopy', (['self.population[0]'], {}), '(self.population[0])\n', (2627, 2647), False, 'from copy import deepcopy\n'), ((2953, 2969), 'numpy.mean', 'np.mean', (['fitness'], {}), '(fitness)\n', (2960, 2969), True, 'import numpy as np\n'), ((3235, 3263), 'copy.deepcopy', 'deepcopy', (['...
import numpy as np import matplotlib.pyplot as plt x1 = np.linspace(-10, -0.1, 30) y1 = 1 / x1 x2 = np.linspace(0.1, 10, 30) y2 = 1 / x2 plt.xlim(-10, 10) plt.plot(x1, y1) plt.plot(x2, y2) plt.show()
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.linspace" ]
[((57, 83), 'numpy.linspace', 'np.linspace', (['(-10)', '(-0.1)', '(30)'], {}), '(-10, -0.1, 30)\n', (68, 83), True, 'import numpy as np\n'), ((101, 125), 'numpy.linspace', 'np.linspace', (['(0.1)', '(10)', '(30)'], {}), '(0.1, 10, 30)\n', (112, 125), True, 'import numpy as np\n'), ((138, 155), 'matplotlib.pyplot.xlim'...
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
[ "itertools.chain.from_iterable", "dm_control.mjcf.RootElement", "numpy.zeros" ]
[((1839, 1872), 'dm_control.mjcf.RootElement', 'mjcf.RootElement', ([], {'model': '"""markers"""'}), "(model='markers')\n", (1855, 1872), False, 'from dm_control import mjcf\n'), ((2737, 2774), 'numpy.zeros', 'np.zeros', (['(2, board_size, board_size)'], {}), '((2, board_size, board_size))\n', (2745, 2774), True, 'impo...
import numpy as np from matplotlib import pyplot as plt from spikewidgets.widgets.basewidget import BaseMultiWidget import spiketoolkit as st def plot_pca_features(recording, sorting, unit_ids=None, max_spikes_per_unit=100, nproj=4, colormap=None, figure=None, ax=None, axes=None, **pca_kwargs): ...
[ "matplotlib.pyplot.get_cmap", "spiketoolkit.postprocessing.compute_unit_pca_scores", "numpy.median", "spikewidgets.widgets.basewidget.BaseMultiWidget.__init__", "numpy.argsort", "numpy.mean", "numpy.array", "numpy.linalg.norm" ]
[((1863, 1911), 'spikewidgets.widgets.basewidget.BaseMultiWidget.__init__', 'BaseMultiWidget.__init__', (['self', 'figure', 'ax', 'axes'], {}), '(self, figure, ax, axes)\n', (1887, 1911), False, 'from spikewidgets.widgets.basewidget import BaseMultiWidget\n'), ((2232, 2347), 'spiketoolkit.postprocessing.compute_unit_pc...
# -*- coding: utf-8 -*- import os import shutil import json import cv2 import numpy as np classname2id = {'tampered':1} #0是背景 class txt2coco: def __init__(self, image_dir, mask_file): self.images = [] self.annotations = [] self.categories = [] self.img_id = 0 self.ann_id = ...
[ "cv2.threshold", "cv2.boxPoints", "numpy.array", "cv2.minAreaRect", "os.path.join", "os.listdir", "cv2.findContours" ]
[((2063, 2089), 'os.listdir', 'os.listdir', (['self.image_dir'], {}), '(self.image_dir)\n', (2073, 2089), False, 'import os\n'), ((2638, 2664), 'os.listdir', 'os.listdir', (['self.mask_file'], {}), '(self.mask_file)\n', (2648, 2664), False, 'import os\n'), ((3708, 3727), 'os.listdir', 'os.listdir', (['self.gt'], {}), '...
#!usr/bin/env python #coding:utf8 import matplotlib.pyplot as plt from wordcloud import WordCloud from pathlib import Path import numpy as np from PIL import Image from PIL import ImageFilter from keras.utils import plot_model from ann_visualizer.visualize import ann_viz from keras.models import load_model def plotWo...
[ "keras.models.load_model", "numpy.sum", "matplotlib.pyplot.clf", "matplotlib.pyplot.margins", "matplotlib.pyplot.bar", "wordcloud.WordCloud", "ann_visualizer.visualize.ann_viz", "matplotlib.pyplot.figure", "pathlib.Path", "numpy.arange", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.ims...
[((1217, 1271), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../build/preprocessed/bow_X_train.txt"""'], {}), "('../build/preprocessed/bow_X_train.txt')\n", (1230, 1271), True, 'import numpy as np\n'), ((1341, 1408), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../build/preprocessed/bow_y_train.txt"""'], {'unpack': '(True)...
import argparse import itertools import pprint import progressbar import random import requests import time import cv2 import numpy as np class APIError(Exception): """An API Error Exception""" def __init__(self, status): self.status = status def __str__(self): return "APIError: {}".form...
[ "argparse.ArgumentParser", "random.shuffle", "numpy.frombuffer", "progressbar.Bar", "progressbar.ETA", "time.sleep", "cv2.imread", "progressbar.AdaptiveETA", "pprint.PrettyPrinter", "requests.get", "progressbar.Timer", "requests.post" ]
[((7304, 7434), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tool for drawing via firenodejs"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Tool for drawing via firenodejs',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (7327, 7434...
import numpy as np import torch import os import pickle from numba import jit import torch.nn as nn from .ucb import UCB from .utils import Model @jit(nopython=True) def calc_confidence_multiplier(confidence_scaling_factor, approximator_dim, iteration, bound_features, reg_factor, delta):...
[ "torch.nn.MSELoss", "numpy.log", "torch.FloatTensor", "numpy.max", "numpy.linalg.norm", "numba.jit", "numpy.sqrt" ]
[((148, 166), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (151, 166), False, 'from numba import jit\n'), ((1126, 1146), 'numpy.sqrt', 'np.sqrt', (['hidden_size'], {}), '(hidden_size)\n', (1133, 1146), True, 'import numpy as np\n'), ((4820, 4886), 'numpy.max', 'np.max', (['[0, self.iteration %...
import keras import numpy as np import pandas as pd from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D, MaxPool2D train_data= pd.read_csv(r"train.csv") X_test= pd.read_csv(r"test.csv") train_data.shape, X_test.shape y...
[ "pandas.read_csv", "cv2.cvtColor", "keras.layers.Dropout", "keras.layers.MaxPool2D", "keras.layers.Flatten", "keras.optimizers.Adam", "cv2.imread", "keras.layers.Dense", "numpy.array", "numpy.reshape", "keras.layers.Conv2D", "keras.models.Sequential", "keras.utils.to_categorical" ]
[((228, 252), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (239, 252), True, 'import pandas as pd\n'), ((262, 285), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (273, 285), True, 'import pandas as pd\n'), ((534, 582), 'keras.utils.to_categorical', 'ker...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright 2018 by ShabaniPy Authors, see AUTHORS for more details. # # Distributed under the terms of the MIT license. # # The full license is in the file LICENCE, distributed with this software. # ----------------...
[ "numpy.power", "numpy.log10" ]
[((838, 862), 'numpy.power', 'np.power', (['(10)', '(power / 10)'], {}), '(10, power / 10)\n', (846, 862), True, 'import numpy as np\n'), ((882, 911), 'numpy.power', 'np.power', (['(10)', '(norm_power / 10)'], {}), '(10, norm_power / 10)\n', (890, 911), True, 'import numpy as np\n'), ((924, 960), 'numpy.log10', 'np.log...
#!/usr/bin/env python3 import os import numpy as np import yaml import pickle import argparse def init_color_space(color_path): # type: (str) -> None """ Initialization of color space from yaml or pickle.txt file :param str color_path: path to file containing the accepted colors :return: None ...
[ "pickle.dump", "numpy.count_nonzero", "argparse.ArgumentParser", "numpy.logical_and", "numpy.zeros", "os.path.exists", "numpy.where", "numpy.array", "yaml.safe_load", "pickle.load", "numpy.warnings.filterwarnings" ]
[((343, 384), 'numpy.zeros', 'np.zeros', (['(256, 256, 256)'], {'dtype': 'np.uint8'}), '((256, 256, 256), dtype=np.uint8)\n', (351, 384), True, 'import numpy as np\n'), ((1655, 1697), 'numpy.logical_and', 'np.logical_and', (['mask', 'positive_color_space'], {}), '(mask, positive_color_space)\n', (1669, 1697), True, 'im...
import pandas as pd import numpy as np import itertools import shutil from inferelator_ng.default import DEFAULT_METADATA_FOR_BATCH_CORRECTION from inferelator_ng.default import DEFAULT_RANDOM_SEED from inferelator_ng import utils """ This file is all preprocessing functions. All functions must take positional argume...
[ "pandas.DataFrame", "magic.MAGIC", "numpy.log2", "numpy.dtype", "pandas.Index", "inferelator_ng.utils.Debug.vprint", "numpy.log10", "pandas.concat", "numpy.vstack", "numpy.log1p" ]
[((1189, 1247), 'inferelator_ng.utils.Debug.vprint', 'utils.Debug.vprint', (['"""Normalizing UMI counts per cell ... """'], {}), "('Normalizing UMI counts per cell ... ')\n", (1207, 1247), False, 'from inferelator_ng import utils\n'), ((2123, 2191), 'inferelator_ng.utils.Debug.vprint', 'utils.Debug.vprint', (['"""Norma...
import numpy as np import pandas as pd from scipy.stats import norm import unittest import networkx as nx from context import grama as gr from context import models ## FD stepsize h = 1e-8 ## Core function tests ################################################## class TestModel(unittest.TestCase): """Test implem...
[ "context.grama.df_equal", "context.grama.Domain", "numpy.allclose", "context.grama.eval_nominal", "numpy.isclose", "context.grama.MarginalNamed", "unittest.main", "pandas.DataFrame", "context.grama.cp_copula_gaussian", "context.grama.FunctionModel", "context.grama.Model", "scipy.stats.norm.cdf...
[((13386, 13401), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13399, 13401), False, 'import unittest\n'), ((416, 452), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'z': [0.0, 1.0]}"}), "(data={'z': [0.0, 1.0]})\n", (428, 452), True, 'import pandas as pd\n'), ((526, 582), 'context.grama.Domain', 'gr.Doma...
#!/usr/bin/env python """ Experiment of Changing Priors <NAME> 2020-1-14 """ import pickle import datetime import numpy as np import torch import stability_testers as st import sinkhorn_torch as sk class PriorVariation: """ Changing priors. Basic requirements on paramaters: ------------------------...
[ "torch.ones", "pickle.dump", "datetime.datetime.today", "stability_testers.StabilityTester", "pickle.load", "numpy.array", "numpy.linalg.inv", "numpy.linspace", "numpy.matmul", "numpy.cos", "numpy.sin", "torch.tensor", "numpy.sqrt" ]
[((863, 893), 'numpy.array', 'np.array', (['[x_unit_3, y_unit_3]'], {}), '([x_unit_3, y_unit_3])\n', (871, 893), True, 'import numpy as np\n'), ((908, 942), 'numpy.array', 'np.array', (['(0, 1)'], {'dtype': 'np.float64'}), '((0, 1), dtype=np.float64)\n', (916, 942), True, 'import numpy as np\n'), ((1027, 1055), 'numpy....
"""Unit test for analysis.py module""" import datetime import numpy as np from matplotlib.dates import date2num from floodsystem.analysis import polyfit, forecast def test_polyfit(): dates = [datetime.datetime(2016, 12, 30), datetime.datetime(2016, 12, 31), datetime.datetime(2017, 1, 1), datetime.datetime(2...
[ "numpy.poly1d", "floodsystem.analysis.forecast", "datetime.datetime", "floodsystem.analysis.polyfit", "matplotlib.dates.date2num", "datetime.datetime.now" ]
[((439, 454), 'matplotlib.dates.date2num', 'date2num', (['dates'], {}), '(dates)\n', (447, 454), False, 'from matplotlib.dates import date2num\n'), ((464, 489), 'numpy.poly1d', 'np.poly1d', (['[1, -2, 10, 4]'], {}), '([1, -2, 10, 4])\n', (473, 489), True, 'import numpy as np\n'), ((611, 631), 'floodsystem.analysis.poly...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from .spectral_normalization import SpectralNorm from torch.autograd import Variable from torchvision import models import sys try: xrange # Python 2 except NameError: xrange = range # Python 3 class Vgg19(torch.nn.M...
[ "torch.nn.Dropout", "torchvision.models.vgg19", "torch.nn.AdaptiveMaxPool2d", "torch.cat", "torch.nn.InstanceNorm2d", "torch.nn.functional.tanh", "torch.nn.functional.pad", "torch.__version__.split", "torch.nn.ReflectionPad2d", "numpy.power", "torch.load", "torch.nn.functional.avg_pool2d", "...
[((544, 565), 'torch.nn.Sequential', 'torch.nn.Sequential', ([], {}), '()\n', (563, 565), False, 'import torch\n'), ((588, 609), 'torch.nn.Sequential', 'torch.nn.Sequential', ([], {}), '()\n', (607, 609), False, 'import torch\n'), ((632, 653), 'torch.nn.Sequential', 'torch.nn.Sequential', ([], {}), '()\n', (651, 653), ...
import argparse import pandas as pd import numpy as np # 18 total exch_index2id = np.array([[1, 3], [3, 1], [0, 4], [4, 0], [3, 2], [2, 3], [1, 2], [2, 1], [ 0, 2], [2, 0], [3, 0], [0, 3], [1, 0], [0, 1], [1, 4], [4, 1], [4, 2], [2, 4]], dtype=int) rate2pair = {} symbols = ["USD", "EUR", "JPY...
[ "pandas.read_csv", "numpy.array", "argparse.ArgumentParser" ]
[((82, 256), 'numpy.array', 'np.array', (['[[1, 3], [3, 1], [0, 4], [4, 0], [3, 2], [2, 3], [1, 2], [2, 1], [0, 2], [2,\n 0], [3, 0], [0, 3], [1, 0], [0, 1], [1, 4], [4, 1], [4, 2], [2, 4]]'], {'dtype': 'int'}), '([[1, 3], [3, 1], [0, 4], [4, 0], [3, 2], [2, 3], [1, 2], [2, 1], [\n 0, 2], [2, 0], [3, 0], [0, 3], ...
import numpy as np from deduplipy.classifier_pipeline.classifier_pipeline import ClassifierPipeline def test_base_case(): myClassifierPipeline = ClassifierPipeline() assert list(myClassifierPipeline.classifier.named_steps.keys()) == ['standardscaler', 'logisticregression'] X = [[0], [1]] y = [0, 1] ...
[ "numpy.testing.assert_array_equal", "deduplipy.classifier_pipeline.classifier_pipeline.ClassifierPipeline" ]
[((152, 172), 'deduplipy.classifier_pipeline.classifier_pipeline.ClassifierPipeline', 'ClassifierPipeline', ([], {}), '()\n', (170, 172), False, 'from deduplipy.classifier_pipeline.classifier_pipeline import ClassifierPipeline\n'), ((498, 542), 'numpy.testing.assert_array_equal', 'np.testing.assert_array_equal', (['pre...
import json import cv2 import os import code import sys import torch import numpy as np from Progress import ProgressBar class HandwrittenDataset: def __init__(self, path, max_load=None): self.path = path with open(os.path.join(self.path, 'meta.json'), 'r') as file: self.meta = json.loads(file.read())['clas...
[ "numpy.load", "os.path.join", "os.listdir", "torch.tensor" ]
[((1733, 1764), 'torch.tensor', 'torch.tensor', (['self.train_inputs'], {}), '(self.train_inputs)\n', (1745, 1764), False, 'import torch\n'), ((2046, 2077), 'torch.tensor', 'torch.tensor', (['self.train_labels'], {}), '(self.train_labels)\n', (2058, 2077), False, 'import torch\n'), ((2156, 2185), 'torch.tensor', 'torch...
#!/usr/bin/env python import numpy as np import joblib from tensorflow.keras.models import load_model import tensorflow from models.turnikecg import Turnikv7 from get_ecg_features import get_ecg_features def run_12ECG_classifier(data, header_data, classes,model): num_classes = len(classes) current_label = n...
[ "numpy.argmax", "numpy.zeros", "numpy.expand_dims", "models.turnikecg.Turnikv7", "numpy.array", "get_ecg_features.get_ecg_features" ]
[((319, 351), 'numpy.zeros', 'np.zeros', (['num_classes'], {'dtype': 'int'}), '(num_classes, dtype=int)\n', (327, 351), True, 'import numpy as np\n'), ((372, 393), 'numpy.zeros', 'np.zeros', (['num_classes'], {}), '(num_classes)\n', (380, 393), True, 'import numpy as np\n'), ((550, 572), 'get_ecg_features.get_ecg_featu...
#!/usr/bin/env python """ npy.py It is used to transform binartproto file to npy file. --liuyuan """ import numpy as np caffe_root = '../' import sys sys.path.insert(0, caffe_root + 'python') import caffe blob = caffe.proto.caffe_pb2.BlobProto() data = open('../../' + caffe_root + 'path/to/mean/file/ImageNet-tiny-2...
[ "caffe.io.blobproto_to_array", "numpy.save", "sys.path.insert", "caffe.proto.caffe_pb2.BlobProto" ]
[((152, 193), 'sys.path.insert', 'sys.path.insert', (['(0)', "(caffe_root + 'python')"], {}), "(0, caffe_root + 'python')\n", (167, 193), False, 'import sys\n'), ((216, 249), 'caffe.proto.caffe_pb2.BlobProto', 'caffe.proto.caffe_pb2.BlobProto', ([], {}), '()\n', (247, 249), False, 'import caffe\n'), ((454, 549), 'numpy...