code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
"""Main module """ # Standard library imports import string # Third party imports import numpy as np import justpy as jp import pandas as pd START_INDEX: int = 1 END_INDEX: int = 20 GRID_OPTIONS = """ { class: 'ag-theme-alpine', defaultColDef: { filter: true, sortable: false, resizab...
[ "justpy.WebPage", "justpy.justpy", "justpy.Input", "justpy.Div", "pandas.DataFrame", "justpy.AgGrid", "numpy.arange" ]
[((1576, 1609), 'numpy.arange', 'np.arange', (['START_INDEX', 'END_INDEX'], {}), '(START_INDEX, END_INDEX)\n', (1585, 1609), True, 'import numpy as np\n'), ((1628, 1671), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'index', 'columns': 'headings'}), '(index=index, columns=headings)\n', (1640, 1671), True, 'import...
import logging import json import glob import pandas as pd import multiprocessing import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import ExtraTreesClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import AdaBoostClassifier from sklearn.metrics...
[ "sklearn.ensemble.ExtraTreesClassifier", "pandas.read_csv", "sklearn.metrics.classification_report", "multiprocessing.cpu_count", "sklearn.metrics.roc_auc_score", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score", "sklearn.metrics.roc_curve", "sklearn.model_selection.KFold", "loggi...
[((666, 700), 'numpy.random.seed', 'np.random.seed', (['config.RANDOM_SEED'], {}), '(config.RANDOM_SEED)\n', (680, 700), True, 'import numpy as np\n'), ((1547, 1574), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1572, 1574), False, 'import multiprocessing\n'), ((1832, 1903), 'sklearn.mod...
import numpy as np import tensorflow as tf from tensorflow.contrib import gan as tfgan from GeneralTools.graph_funcs.my_session import MySession from GeneralTools.math_funcs.graph_func_support import mean_cov_np, trace_sqrt_product_np from GeneralTools.misc_fun import FLAGS class GenerativeModelMetric(object): d...
[ "tensorflow.unstack", "numpy.trace", "tensorflow.transpose", "tensorflow.contrib.gan.eval.run_inception", "tensorflow.split", "tensorflow.contrib.gan.eval.get_graph_def_from_disk", "tensorflow.contrib.gan.eval.sliced_wasserstein_distance", "tensorflow.image.ssim_multiscale", "numpy.concatenate", "...
[((2250, 2372), 'tensorflow.contrib.gan.eval.run_inception', 'tfgan.eval.run_inception', (['image'], {'graph_def': 'self.inception_graph_def', 'input_tensor': '"""Mul:0"""', 'output_tensor': 'output_tensor'}), "(image, graph_def=self.inception_graph_def,\n input_tensor='Mul:0', output_tensor=output_tensor)\n", (2274...
from typing import Any, Callable import matplotlib.pyplot as plt from numpy import arange from .membership import Membership class BaseSet: def __init__( self, name: str, membership: Membership, aggregation: Callable[[Any, Any], Any], ): self.name = name self....
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "numpy.arange" ]
[((1352, 1364), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1362, 1364), True, 'import matplotlib.pyplot as plt\n'), ((1373, 1393), 'matplotlib.pyplot.title', 'plt.title', (['self.name'], {}), '(self.name)\n', (1382, 1393), True, 'import matplotlib.pyplot as plt\n'), ((1402, 1429), 'matplotlib.pyplot.x...
import numpy as np import chess import chess.engine from tkinter.filedialog import asksaveasfilename from parsing.math_encode import tensor_encode, tensor_decode from inference.infer_action import get_action class PlayLoop: __doc__ = ''' An interactive REPL environment for play with a trained chess AI ''...
[ "numpy.flip", "inference.infer_action.get_action", "chess.Move.from_uci", "chess.engine.SimpleEngine.popen_uci", "tkinter.filedialog.asksaveasfilename", "chess.Board", "chess.engine.Limit", "parsing.math_encode.tensor_encode", "numpy.around" ]
[((2322, 2335), 'chess.Board', 'chess.Board', ([], {}), '()\n', (2333, 2335), False, 'import chess\n'), ((5869, 5901), 'inference.infer_action.get_action', 'get_action', (['self.board', 'src', 'tgt'], {}), '(self.board, src, tgt)\n', (5879, 5901), False, 'from inference.infer_action import get_action\n'), ((4863, 4916)...
import bpy from aiohttp import web import numpy as np from mathutils import Matrix, Vector import asyncio from cinebot_mini_render_server.blender_timer_executor import EXECUTOR routes = web.RouteTableDef() def delete_animation_helper(obj): if not obj.animation_data: return False if not obj.animation_...
[ "numpy.array", "aiohttp.web.RouteTableDef", "aiohttp.web.json_response", "mathutils.Matrix", "aiohttp.web.HTTPBadRequest", "asyncio.get_event_loop", "bpy.data.actions.new" ]
[((187, 206), 'aiohttp.web.RouteTableDef', 'web.RouteTableDef', ([], {}), '()\n', (204, 206), False, 'from aiohttp import web\n'), ((1489, 1513), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1511, 1513), False, 'import asyncio\n'), ((1791, 1814), 'aiohttp.web.json_response', 'web.json_response...
from copy import deepcopy from numba import jit,njit import numpy as np import pymctdh.opfactory as opfactory from pymctdh.cy.sparsemat import CSRmat#,matvec @njit(fastmath=True) def matvec(nrows,IA,JA,data,vec,outvec): """ """ d_ind = 0 for i in range(nrows): ncol = IA[i+1]-IA[i] for...
[ "numpy.union1d", "numba.njit", "pymctdh.cy.sparsemat.CSRmat", "numpy.array", "numpy.zeros", "numpy.dot", "copy.deepcopy", "numpy.arange" ]
[((162, 181), 'numba.njit', 'njit', ([], {'fastmath': '(True)'}), '(fastmath=True)\n', (166, 181), False, 'from numba import jit, njit\n'), ((557, 570), 'copy.deepcopy', 'deepcopy', (['op2'], {}), '(op2)\n', (565, 570), False, 'from copy import deepcopy\n'), ((1268, 1282), 'numpy.array', 'np.array', (['data'], {}), '(d...
# Copyright (c) 2020 DeNA Co., Ltd. # Licensed under The MIT License [see LICENSE for details] # kaggle_environments licensed under Copyright 2020 Kaggle Inc. and the Apache License, Version 2.0 # (see https://github.com/Kaggle/kaggle-environments/blob/master/LICENSE for details) # wrapper of Hungry Geese environment...
[ "torch.nn.BatchNorm2d", "random.choice", "kaggle_environments.envs.hungry_geese.hungry_geese.Observation", "handyrl.envs.kaggle.public_flood_goose.public_flood_agent_goose.step", "torch.nn.Conv2d", "torch.cat", "numpy.zeros", "torch.nn.Linear", "handyrl.envs.kaggle.public_flood_goose.State.from_obs_...
[((962, 1073), 'torch.nn.Conv2d', 'nn.Conv2d', (['input_dim', 'output_dim'], {'kernel_size': 'kernel_size', 'padding': 'self.edge_size', 'padding_mode': '"""circular"""'}), "(input_dim, output_dim, kernel_size=kernel_size, padding=self.\n edge_size, padding_mode='circular')\n", (971, 1073), True, 'import torch.nn as...
"""Utilities for approximating gradients.""" import numpy as np from utils.misc import process_inputs from utils.simrunners import SimulationRunner def local_linear_gradients(X, f, p=None, weights=None): """Estimate a collection of gradients from input/output pairs. Given a set of input/output pairs, choo...
[ "numpy.eye", "numpy.sqrt", "numpy.ones", "numpy.log", "numpy.floor", "numpy.argsort", "numpy.sum", "numpy.zeros", "numpy.random.randint", "utils.simrunners.SimulationRunner", "numpy.linalg.lstsq", "utils.misc.process_inputs" ]
[((1186, 1203), 'utils.misc.process_inputs', 'process_inputs', (['X'], {}), '(X)\n', (1200, 1203), False, 'from utils.misc import process_inputs\n'), ((1646, 1663), 'numpy.zeros', 'np.zeros', (['(MM, m)'], {}), '((MM, m))\n', (1654, 1663), True, 'import numpy as np\n'), ((2664, 2681), 'utils.misc.process_inputs', 'proc...
import numpy as np import pandas as pd from os.path import join as oj import os import pygsheets import pandas as pd import sys import inspect from datetime import datetime, timedelta currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path...
[ "plotly.express.scatter", "inspect.currentframe", "os.path.join", "os.path.dirname", "numpy.array", "datetime.datetime.now", "datetime.datetime.today", "datetime.timedelta", "sys.path.append" ]
[((284, 311), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (299, 311), False, 'import os\n'), ((312, 338), 'sys.path.append', 'sys.path.append', (['parentdir'], {}), '(parentdir)\n', (327, 338), False, 'import sys\n'), ((339, 379), 'sys.path.append', 'sys.path.append', (["(parentdir + '...
""" .. module:: cnn_train :synopsis: Example nuts-ml pipeline for training a MLP on MNIST """ import torch import torch.nn.functional as F import torch.nn as nn import torch.optim as optim import nutsflow as nf import nutsml as nm import numpy as np from nutsml.network import PytorchNetwork from utils import downl...
[ "numpy.mean", "utils.load_mnist", "torch.nn.CrossEntropyLoss", "nutsml.network.PytorchNetwork", "nutsflow.Collect", "nutsml.PlotLines", "utils.download_mnist", "torch.cuda.is_available", "nutsflow.Shuffle", "nutsflow.PrintProgress", "torch.nn.Linear", "nutsml.BuildBatch", "sklearn.metrics.ac...
[((1856, 1872), 'utils.download_mnist', 'download_mnist', ([], {}), '()\n', (1870, 1872), False, 'from utils import download_mnist, load_mnist\n'), ((1912, 1932), 'utils.load_mnist', 'load_mnist', (['filepath'], {}), '(filepath)\n', (1922, 1932), False, 'from utils import download_mnist, load_mnist\n'), ((1945, 1978), ...
""" All the data sources are scattered around the D drive, this script organizes it and consolidates it into the "Data" subfolder in the "Chapter 2 Dune Aspect Ratio" folder. <NAME>, 5/6/2020 """ import shutil as sh import pandas as pd import numpy as np import os # Set the data directory to save files ...
[ "os.path.exists", "numpy.genfromtxt", "pandas.read_csv", "os.path.join", "os.mkdir", "shutil.copy", "pandas.DataFrame", "numpy.full", "numpy.loadtxt", "pandas.concat" ]
[((337, 363), 'os.path.join', 'os.path.join', (['""".."""', '"""Data"""'], {}), "('..', 'Data')\n", (349, 363), False, 'import os\n'), ((426, 501), 'os.path.join', 'os.path.join', (['""".."""', '""".."""', '"""XBeach Modelling"""', '"""Dune Complexity Experiments"""'], {}), "('..', '..', 'XBeach Modelling', 'Dune Compl...
def end_of_import(): return 0 def end_of_init(): return 0 def end_of_computing(): return 0 import numpy as np from sklearn.linear_model import LinearRegression end_of_import() X = np.array(range(0,100000)).reshape(-1, 1) # y = 2x + 3 y = np.dot(X, 2) + 3 end_of_init() reg = LinearRegression().fit(X, y)...
[ "numpy.dot", "sklearn.linear_model.LinearRegression" ]
[((254, 266), 'numpy.dot', 'np.dot', (['X', '(2)'], {}), '(X, 2)\n', (260, 266), True, 'import numpy as np\n'), ((292, 310), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (308, 310), False, 'from sklearn.linear_model import LinearRegression\n')]
# # # Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # # 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 # # www.apache.org/lice...
[ "struct.pack", "numpy.exp", "numpy.array", "numpy.linspace", "numpy.empty", "numpy.cos", "numpy.sin", "numpy.transpose", "sympy.combinatorics.Permutation.from_sequence" ]
[((4077, 4095), 'numpy.transpose', 'np.transpose', (['a', 'r'], {}), '(a, r)\n', (4089, 4095), True, 'import numpy as np\n'), ((4688, 4698), 'numpy.cos', 'np.cos', (['(-a)'], {}), '(-a)\n', (4694, 4698), True, 'import numpy as np\n'), ((4705, 4715), 'numpy.sin', 'np.sin', (['(-a)'], {}), '(-a)\n', (4711, 4715), True, '...
''' This inference script takes in images of dynamic size Runs inference in batch ** In this images have been resized but not need for this script ''' import onnx import onnxruntime as ort import numpy as np import cv2 from imagenet_classlist import get_class import os model_path = 'resnet18.onnx' model = onnx.load(...
[ "os.listdir", "onnx.helper.printable_graph", "onnxruntime.InferenceSession", "os.path.join", "numpy.argmax", "numpy.array", "onnx.load", "numpy.moveaxis", "cv2.resize", "onnx.checker.check_model" ]
[((310, 331), 'onnx.load', 'onnx.load', (['model_path'], {}), '(model_path)\n', (319, 331), False, 'import onnx\n'), ((405, 436), 'onnx.checker.check_model', 'onnx.checker.check_model', (['model'], {}), '(model)\n', (429, 436), False, 'import onnx\n'), ((441, 481), 'onnx.helper.printable_graph', 'onnx.helper.printable_...
import numpy as np import tensorflow as tf from tqdm import trange from fedsimul.utils.model_utils import batch_data from fedsimul.utils.tf_utils import graph_size from fedsimul.utils.tf_utils import process_grad class Model(object): ''' This is the tf model for the MNIST dataset with multiple class learner ...
[ "tensorflow.equal", "tensorflow.contrib.layers.l2_regularizer", "tensorflow.nn.softmax", "tensorflow.set_random_seed", "tensorflow.RunMetadata", "tensorflow.Graph", "tensorflow.Session", "tensorflow.placeholder", "fedsimul.utils.model_utils.batch_data", "tensorflow.train.get_global_step", "tenso...
[((751, 761), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (759, 761), True, 'import tensorflow as tf\n'), ((1331, 1380), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], {'gpu_options': 'gpu_options'}), '(gpu_options=gpu_options)\n', (1355, 1380), True, 'import tensorflow as tf\n'), ((1401, 14...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import math import networkx as nx import functools import scipy.stats import random import sys import copy import numpy as np import torch import utils try: sys.path.append('/opt/MatterSim/build/') # local docker or Philly im...
[ "networkx.all_pairs_dijkstra_path", "os.getenv", "MatterSim.Simulator", "utils.load_nav_graphs", "numpy.argmax", "math.radians", "functools.partial", "math.atan2", "sys.exit", "networkx.all_pairs_dijkstra_path_length", "sys.path.append" ]
[((247, 287), 'sys.path.append', 'sys.path.append', (['"""/opt/MatterSim/build/"""'], {}), "('/opt/MatterSim/build/')\n", (262, 287), False, 'import sys\n'), ((375, 433), 'sys.path.append', 'sys.path.append', (['"""/home/hoyeung/Documents/vnla/code/build"""'], {}), "('/home/hoyeung/Documents/vnla/code/build')\n", (390,...
import tensorflow as tf import numpy as np import unittest from dnc.controller import BaseController class DummyController(BaseController): def network_vars(self): self.W = tf.Variable(tf.truncated_normal([self.nn_input_size, 64])) self.b = tf.Variable(tf.zeros([64])) def network_op(self, X):...
[ "tensorflow.Graph", "tensorflow.initialize_all_variables", "numpy.reshape", "numpy.allclose", "tensorflow.nn.rnn_cell.BasicLSTMCell", "tensorflow.convert_to_tensor", "tensorflow.Session", "numpy.exp", "tensorflow.matmul", "numpy.random.uniform", "unittest.main", "numpy.transpose", "tensorflo...
[((7097, 7123), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (7110, 7123), False, 'import unittest\n'), ((469, 501), 'tensorflow.nn.rnn_cell.BasicLSTMCell', 'tf.nn.rnn_cell.BasicLSTMCell', (['(64)'], {}), '(64)\n', (497, 501), True, 'import tensorflow as tf\n'), ((718, 741), 'tensorf...
import inspect import pytest import numpy as np from datar.core.backends.pandas import Categorical, DataFrame, Series from datar.core.backends.pandas.testing import assert_frame_equal from datar.core.backends.pandas.core.groupby import SeriesGroupBy from datar.core.factory import func_factory from datar.core.tibble im...
[ "datar.tibble.tibble", "inspect.signature", "datar.core.backends.pandas.testing.assert_frame_equal", "datar.core.backends.pandas.DataFrame", "numpy.array", "datar.core.backends.pandas.Categorical", "pytest.raises", "datar.core.backends.pandas.Series", "datar.core.factory.func_factory" ]
[((524, 554), 'datar.core.factory.func_factory', 'func_factory', (['"""transform"""', '"""x"""'], {}), "('transform', 'x')\n", (536, 554), False, 'from datar.core.factory import func_factory\n'), ((744, 774), 'datar.core.factory.func_factory', 'func_factory', (['"""transform"""', '"""x"""'], {}), "('transform', 'x')\n"...
#!/usr/bin/env python3 """ Created on Tue Sep 1 2020 @author: kstoreyf """ import numpy as np import nbodykit import pandas as pd import pickle from nbodykit import cosmology def main(): save_fn = '../data/cosmology_train.pickle' x = generate_training_parameters(n_train=1000) y, extra_input = generate_...
[ "nbodykit.cosmology.correlation.CorrelationFunction", "pickle.dump", "numpy.random.rand", "nbodykit.cosmology.Cosmology", "numpy.array", "numpy.linspace", "nbodykit.cosmology.LinearPower", "pandas.DataFrame", "numpy.meshgrid", "numpy.arange" ]
[((1335, 1368), 'numpy.linspace', 'np.linspace', (['(0.26)', '(0.34)', 'n_points'], {}), '(0.26, 0.34, n_points)\n', (1346, 1368), True, 'import numpy as np\n'), ((1383, 1415), 'numpy.linspace', 'np.linspace', (['(0.7)', '(0.95)', 'n_points'], {}), '(0.7, 0.95, n_points)\n', (1394, 1415), True, 'import numpy as np\n'),...
#from data_loader import * from scipy import signal import matplotlib.pyplot as plt import copy import os import shutil import numpy as np def data_filter(exp_path, probe_type='point', Xtype='loc',ytype='f',num_point=0): shutil.rmtree(exp_path+probe_type+'_expand', ignore_errors=True) os.mkdir(exp_path+probe_t...
[ "numpy.hstack", "scipy.signal.filtfilt", "scipy.signal.butter", "numpy.array", "os.mkdir", "shutil.rmtree", "numpy.arange", "matplotlib.pyplot.show" ]
[((5134, 5144), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (5142, 5144), True, 'import matplotlib.pyplot as plt\n'), ((226, 294), 'shutil.rmtree', 'shutil.rmtree', (["(exp_path + probe_type + '_expand')"], {'ignore_errors': '(True)'}), "(exp_path + probe_type + '_expand', ignore_errors=True)\n", (239, 294)...
import numpy as np import cv2 import argparse from collections import deque import keyboard as kb import time from pynput.keyboard import Key, Controller, Listener class points(object): def __init__(self, x, y): self.x = x self.y = y sm_threshold = 100 lg_threshold = 200 guiding = True keyboar...
[ "cv2.imshow", "numpy.array", "cv2.destroyAllWindows", "collections.deque", "cv2.erode", "cv2.line", "cv2.waitKey", "numpy.ones", "cv2.minEnclosingCircle", "keyboard.is_pressed", "cv2.morphologyEx", "cv2.circle", "cv2.cvtColor", "cv2.moments", "pynput.keyboard.Controller", "cv2.inRange"...
[((324, 336), 'pynput.keyboard.Controller', 'Controller', ([], {}), '()\n', (334, 336), False, 'from pynput.keyboard import Key, Controller, Listener\n'), ((344, 363), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (360, 363), False, 'import cv2\n'), ((371, 387), 'collections.deque', 'deque', ([], {'ma...
import os import shutil import tensorflow as tf from tensorflow import keras from logs import logDecorator as lD import jsonref import numpy as np import pickle import warnings from tqdm import tqdm from modules.data import getData config = jsonref.load(open('../config/config.json')) logBase = config['logg...
[ "logs.logDecorator.log", "modules.data.getData.visualiseStackedArray", "tensorflow.keras.applications.xception.Xception", "tensorflow.keras.applications.nasnet.NASNetMobile", "os.path.exists", "tensorflow.Session", "tensorflow.keras.applications.mobilenet.MobileNet", "tensorflow.keras.applications.vgg...
[((479, 512), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (502, 512), False, 'import warnings\n'), ((515, 541), 'logs.logDecorator.log', 'lD.log', (["(logBase + '.model')"], {}), "(logBase + '.model')\n", (521, 541), True, 'from logs import logDecorator as lD\n'), ((253...
import glob, os import numpy as np import tensorflow as tf import tensorflow.contrib.graph_editor as ge class Flownet2: def __init__(self, bilinear_warping_module): self.weights = dict() for key, shape in self.all_variables(): self.weights[key] = tf.get_variable(key, shape=shape) ...
[ "tensorflow.nn.conv2d", "tensorflow.contrib.graph_editor.reroute.add_control_inputs", "tensorflow.image.resize_nearest_neighbor", "tensorflow.shape", "tensorflow.pad", "tensorflow.reshape", "tensorflow.get_variable", "tensorflow.to_float", "tensorflow.reduce_sum", "tensorflow.ones", "tensorflow....
[((469, 489), 'tensorflow.maximum', 'tf.maximum', (['x', '(s * x)'], {}), '(x, s * x)\n', (479, 489), True, 'import tensorflow as tf\n'), ((1098, 1126), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(flow * target)'], {}), '(flow * target)\n', (1111, 1126), True, 'import tensorflow as tf\n'), ((1173, 1267), 'tensorflow....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 7 14:40:40 2021 @author: victorsellemi """ import numpy as np def filter_MA(Y,q = 2): """ DESCRIPTION: Decompose a time series into a trend and stationary component using the moving average (MA) filter (i.e., low pass fi...
[ "numpy.eye", "numpy.zeros", "numpy.concatenate" ]
[((877, 897), 'numpy.zeros', 'np.zeros', (['(T - Q, T)'], {}), '((T - Q, T))\n', (885, 897), True, 'import numpy as np\n'), ((970, 1006), 'numpy.concatenate', 'np.concatenate', (['(p1, p2, p3)'], {'axis': '(0)'}), '((p1, p2, p3), axis=0)\n', (984, 1006), True, 'import numpy as np\n'), ((1060, 1073), 'numpy.eye', 'np.ey...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 19 18:08:01 2020 @author: <NAME> Implementação do ajuste do modelo SEIIHURD com separação de grupos. Necessita de mais verificações e funções para simplificar o input. Baseado nas classes disponíveis no modelos.py """ import numpy as np from funct...
[ "numpy.ones_like", "scipy.optimize.least_squares", "numpy.sqrt", "numpy.random.rand", "scipy.integrate.odeint", "numpy.flatnonzero", "pyswarms.single.LocalBestPSO", "joblib.Parallel", "numpy.array", "numpy.split", "numpy.zeros", "numpy.empty", "numpy.isnan", "copy.deepcopy", "joblib.dela...
[((987, 4278), 'numpy.array', 'np.array', (['[[0.47868515, 0.50507561, 0.29848922, 0.15763748, 0.26276959, 0.40185462, \n 0.46855027, 0.42581354, 0.2150961, 0.0856771, 0.08705463, 0.07551931, \n 0.05129175, 0.02344832, 0.00793644, 0.01072846], [0.35580205, \n 0.77874482, 0.51392686, 0.21151069, 0.08597966, 0.2...
import random import numpy as np import tensorflow as tf from collections import deque class PrioritizedReplayBuffer(): """ Class implements Prioritized Experience Replay (PER) """ def __init__(self, maxlen): """ PER constructor Args: maxlen (int): buffer length """ ...
[ "numpy.array", "collections.deque" ]
[((400, 425), 'collections.deque', 'deque', ([], {'maxlen': 'self.maxlen'}), '(maxlen=self.maxlen)\n', (405, 425), False, 'from collections import deque\n'), ((452, 477), 'collections.deque', 'deque', ([], {'maxlen': 'self.maxlen'}), '(maxlen=self.maxlen)\n', (457, 477), False, 'from collections import deque\n'), ((124...
#!/usr/bin/python3 # coding=utf-8 # 环境准备:pip install opencv_contrib_python # 输入话题:tianbot_mini/image_raw/compressed # 输出话题:roi import sys import os import rospy import sensor_msgs.msg from cv_bridge import CvBridge import cv2 import numpy as np from sensor_msgs.msg import RegionOfInterest as ROI from sensor_msgs.msg ...
[ "cv2.rectangle", "cv2.TrackerGOTURN_create", "rospy.init_node", "cv2.TrackerKCF_create", "cv2.imshow", "cv2.TrackerMedianFlow_create", "cv2.__version__.split", "cv2.TrackerMIL_create", "cv2.Tracker_create", "cv_bridge.CvBridge", "rospy.Subscriber", "cv2.waitKey", "sensor_msgs.msg.RegionOfInt...
[((350, 360), 'cv_bridge.CvBridge', 'CvBridge', ([], {}), '()\n', (358, 360), False, 'from cv_bridge import CvBridge\n'), ((4002, 4035), 'numpy.zeros', 'np.zeros', (['(640, 640, 3)', 'np.uint8'], {}), '((640, 640, 3), np.uint8)\n', (4010, 4035), True, 'import numpy as np\n'), ((4124, 4163), 'rospy.init_node', 'rospy.in...
from __future__ import print_function import warnings import numpy as np C4 = 261.6 # Hz piano_max = 4186.01 # Hz piano_min = 27.5000 # Hz - not audible __all__ = ['cent_per_value','get_f_min','get_f_max','FrequencyScale'] def cent_per_value(f_min, f_max, v_min, v_max): """ This function takes in a freque...
[ "warnings.warn", "numpy.log2", "numpy.round" ]
[((841, 863), 'numpy.log2', 'np.log2', (['(f_max / f_min)'], {}), '(f_max / f_min)\n', (848, 863), True, 'import numpy as np\n'), ((5680, 5737), 'warnings.warn', 'warnings.warn', (['"""Min y value is greater than max y value."""'], {}), "('Min y value is greater than max y value.')\n", (5693, 5737), False, 'import warn...
# -*- coding: utf-8 -*- """ Created on Tue May 30 16:43:10 2017 ☜☜☜☜☜☜★☆★☆★☆★☆ provided code ★☆★☆★☆★☆☞☞☞☞☞☞ @author: Minsooyeo """ import os import matplotlib.image as mpimg import matplotlib.pyplot as plt from PIL import Image as im import numpy as np import utills as ut import tensorflow as tf sess = tf.InteractiveS...
[ "tensorflow.InteractiveSession", "numpy.reshape", "utills._FlatModel", "utills._DropOut", "utills._SoftMax", "os.getcwd", "tensorflow.global_variables_initializer", "utills._CNNModel", "numpy.zeros", "numpy.concatenate", "utills.Nextbatch", "utills._SetAccuracy", "numpy.random.permutation" ]
[((305, 328), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (326, 328), True, 'import tensorflow as tf\n'), ((809, 820), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (818, 820), False, 'import os\n'), ((2117, 2155), 'numpy.random.permutation', 'np.random.permutation', (['total_data_poin'], ...
import numpy as np from common import projection_back EPS = 1e-9 def ilrma(mix, n_iter, n_basis=2, proj_back=True): """Implementation of ILRMA (Independent Low-Rank Matrix Analysis). This algorithm is called ILRMA1 in http://d-kitamura.net/pdf/misc/AlgorithmsForIndependentLowRankMatrixAnalysis.pdf It on...
[ "numpy.clip", "numpy.abs", "numpy.eye", "numpy.linalg.solve", "numpy.sqrt", "numpy.ones", "numpy.conj", "numpy.sum", "numpy.matmul", "common.projection_back", "numpy.random.randn" ]
[((1098, 1137), 'numpy.random.randn', 'np.random.randn', (['n_src', 'n_freq', 'n_basis'], {}), '(n_src, n_freq, n_basis)\n', (1113, 1137), True, 'import numpy as np\n'), ((1156, 1196), 'numpy.random.randn', 'np.random.randn', (['n_src', 'n_basis', 'n_frame'], {}), '(n_src, n_basis, n_frame)\n', (1171, 1196), True, 'imp...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # [0,0] = TN # [1,1] = TP # [0,1] = FP # [1,0] = FN # cm is a confusion matrix # Accuracy: (TP + TN) / Total def accuracy(cm: pd.DataFrame) -> float: return (cm[0,0] + cm[1,1]) / cm.sum() # Precision: TP / (TP + FP) de...
[ "numpy.mean", "numpy.delete", "seaborn.heatmap", "numpy.squeeze", "numpy.array_split", "numpy.array", "numpy.random.randint", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.random.seed", "numpy.empty", "numpy.concatenate", "pandas.DataFrame", "numpy.arange", "numpy.random.shuffle" ]
[((1018, 1034), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (1026, 1034), True, 'import numpy as np\n'), ((1142, 1196), 'pandas.DataFrame', 'pd.DataFrame', (['cm'], {'columns': "['0', '1']", 'index': "['0', '1']"}), "(cm, columns=['0', '1'], index=['0', '1'])\n", (1154, 1196), True, 'import pandas as pd\...
import math import random import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from fmt.pythonfmt.doubleintegrator import filter_reachable, gen_trajectory, show_trajectory from fmt.pythonfmt.world import World def dist2(p, q): return math.sqrt((p[1] - q[1]) ** 2 + (p[2] - q[2]) ** 2) # FM...
[ "numpy.ones", "numpy.random.default_rng", "fmt.pythonfmt.doubleintegrator.gen_trajectory", "fmt.pythonfmt.doubleintegrator.show_trajectory", "math.sqrt", "numpy.array", "numpy.zeros", "numpy.empty", "numpy.concatenate", "numpy.nonzero", "numpy.argmin", "random.random", "matplotlib.pyplot.pau...
[((263, 313), 'math.sqrt', 'math.sqrt', (['((p[1] - q[1]) ** 2 + (p[2] - q[2]) ** 2)'], {}), '((p[1] - q[1]) ** 2 + (p[2] - q[2]) ** 2)\n', (272, 313), False, 'import math\n'), ((1135, 1151), 'numpy.zeros', 'np.zeros', (['(N, 4)'], {}), '((N, 4))\n', (1143, 1151), True, 'import numpy as np\n'), ((1178, 1194), 'numpy.ar...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Aug 27 23:58:37 2020 @author: manal """ import numpy as np import GPy from GPy.kern.src.stationary import Stationary class Cosine_prod(Stationary): """ Cosine kernel: Product of 1D Cosine kernels .. math:: &k(x,x')_i = ...
[ "numpy.sin", "numpy.prod", "numpy.zeros", "numpy.cos" ]
[((1126, 1145), 'numpy.zeros', 'np.zeros', (['(m, m, n)'], {}), '((m, m, n))\n', (1134, 1145), True, 'import numpy as np\n'), ((1749, 1768), 'numpy.zeros', 'np.zeros', (['(m, m, n)'], {}), '((m, m, n))\n', (1757, 1768), True, 'import numpy as np\n'), ((1864, 1888), 'numpy.sin', 'np.sin', (['dist[:, :, dimX]'], {}), '(d...
import numpy as np import sys import cv2 sys.path.append("../") from utils.config import config class TestLoader: def __init__(self, imdb, batch_size=1, shuffle=False): self.imdb = imdb self.batch_size = batch_size self.shuffle = shuffle self.size = len(imdb)#num of data ...
[ "numpy.random.shuffle", "sys.path.append", "cv2.imread" ]
[((41, 63), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (56, 63), False, 'import sys\n'), ((1226, 1242), 'cv2.imread', 'cv2.imread', (['imdb'], {}), '(imdb)\n', (1236, 1242), False, 'import cv2\n'), ((516, 544), 'numpy.random.shuffle', 'np.random.shuffle', (['self.imdb'], {}), '(self.imdb)\n...
# -*- coding: utf-8 -*- """Nowruz at SemEval 2022: Tackling Cloze Tests with Transformers and Ordinal Regression Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1RXkjBpzNJtc0WhhrKMjU-50rd5uSviX3 """ import torch import torch.nn as nn from torch.functio...
[ "transformers.AutoModel.from_pretrained", "torch.nn.Dropout", "torch.nn.GELU", "transformers.TrainingArguments", "pandas.read_csv", "torch.nn.CrossEntropyLoss", "datasets.Dataset.from_dict", "torch.sigmoid", "data_loader.retrieve_labels_from_dataset_for_classification", "numpy.array", "data_load...
[((1360, 1402), 'pandas.read_csv', 'pd.read_csv', (['dataPath'], {'sep': '"""\t"""', 'quoting': '(3)'}), "(dataPath, sep='\\t', quoting=3)\n", (1371, 1402), True, 'import pandas as pd\n'), ((1436, 1476), 'data_loader.retrieve_instances_from_dataset', 'retrieve_instances_from_dataset', (['dataset'], {}), '(dataset)\n', ...
"""Tests for the bradley_terry module""" # 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 app...
[ "numpy.array", "numpy.seterr", "numpy.full" ]
[((903, 925), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (912, 925), True, 'import numpy as np\n'), ((1101, 1121), 'numpy.array', 'np.array', (['[1.0, 2.0]'], {}), '([1.0, 2.0])\n', (1109, 1121), True, 'import numpy as np\n'), ((1148, 1168), 'numpy.array', 'np.array', (['[1.0, 2.0]'],...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import numpy as np from PyQt5 import QtWidgets as QtWid import pyqtgraph as pg from dvg_pyqtgraph_threadsafe import PlotCurve USE_OPENGL = True if USE_OPENGL: print("OpenGL acceleration: Enabled") pg.setConfigOptions(useOpenGL=True) pg.setConfigO...
[ "PyQt5.QtWidgets.QHBoxLayout", "pyqtgraph.setConfigOptions", "numpy.array", "PyQt5.QtWidgets.QApplication", "pyqtgraph.GraphicsLayoutWidget", "pyqtgraph.mkPen" ]
[((267, 302), 'pyqtgraph.setConfigOptions', 'pg.setConfigOptions', ([], {'useOpenGL': '(True)'}), '(useOpenGL=True)\n', (286, 302), True, 'import pyqtgraph as pg\n'), ((307, 342), 'pyqtgraph.setConfigOptions', 'pg.setConfigOptions', ([], {'antialias': '(True)'}), '(antialias=True)\n', (326, 342), True, 'import pyqtgrap...
import numpy as np import itertools from .contrib import compress_filter, smooth, residual_model from .contrib import reduce_interferences def expectation_maximization(y, x, iterations=2, verbose=0, eps=None): r"""Expectation maximization algorithm, for refining source separation estimates. This algorith...
[ "numpy.abs", "numpy.eye", "numpy.sqrt", "numpy.linalg.pinv", "numpy.conj", "numpy.angle", "numpy.sum", "numpy.zeros", "numpy.real", "numpy.empty_like", "numpy.zeros_like" ]
[((4979, 5045), 'numpy.zeros', 'np.zeros', (['(nb_bins, nb_channels, nb_channels, nb_sources)', 'x.dtype'], {}), '((nb_bins, nb_channels, nb_channels, nb_sources), x.dtype)\n', (4987, 5045), True, 'import numpy as np\n'), ((5054, 5096), 'numpy.zeros', 'np.zeros', (['(nb_frames, nb_bins, nb_sources)'], {}), '((nb_frames...
import unittest import numpy as np from op_test import OpTest def modified_huber_loss_forward(val): if val < -1: return -4 * val elif val < 1: return (1 - val) * (1 - val) else: return 0 class TestModifiedHuberLossOp(OpTest): def setUp(self): self.op_type = 'modified_...
[ "unittest.main", "numpy.random.choice", "numpy.vectorize", "numpy.random.uniform" ]
[((1011, 1026), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1024, 1026), False, 'import unittest\n'), ((635, 676), 'numpy.vectorize', 'np.vectorize', (['modified_huber_loss_forward'], {}), '(modified_huber_loss_forward)\n', (647, 676), True, 'import numpy as np\n'), ((398, 442), 'numpy.random.uniform', 'np.ran...
"""The WaveBlocks Project Plot some quadrature rules. @author: <NAME> @copyright: Copyright (C) 2010, 2011 <NAME> @license: Modified BSD License """ from numpy import squeeze from matplotlib.pyplot import * from WaveBlocks import GaussHermiteQR tests = (2, 3, 4, 7, 32, 64, 128) for I in tests: Q = Gauss...
[ "WaveBlocks.GaussHermiteQR", "numpy.squeeze" ]
[((315, 332), 'WaveBlocks.GaussHermiteQR', 'GaussHermiteQR', (['I'], {}), '(I)\n', (329, 332), False, 'from WaveBlocks import GaussHermiteQR\n'), ((382, 392), 'numpy.squeeze', 'squeeze', (['N'], {}), '(N)\n', (389, 392), False, 'from numpy import squeeze\n'), ((438, 448), 'numpy.squeeze', 'squeeze', (['W'], {}), '(W)\n...
import os import cv2 import numpy as np import matplotlib.pyplot as plt import scipy ROWS = 64 COLS = 64 CHANNELS = 3 TRAIN_DIR = 'Train_data/' TEST_DIR = 'Test_data/' train_images = [TRAIN_DIR+i for i in os.listdir(TRAIN_DIR)] test_images = [TEST_DIR+i for i in os.listdir(TEST_DIR)] def read_image(file_path): ...
[ "numpy.abs", "os.listdir", "matplotlib.pyplot.ylabel", "numpy.power", "matplotlib.pyplot.xlabel", "numpy.log", "numpy.tanh", "numpy.squeeze", "numpy.exp", "numpy.sum", "numpy.zeros", "numpy.random.randn", "numpy.dot", "cv2.resize", "cv2.imread", "matplotlib.pyplot.legend", "matplotli...
[((6966, 6984), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""cost"""'], {}), "('cost')\n", (6976, 6984), True, 'import matplotlib.pyplot as plt\n'), ((6985, 7020), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""iterations (hundreds)"""'], {}), "('iterations (hundreds)')\n", (6995, 7020), True, 'import matplotlib.py...
"""Test motif.features.bitteli """ import unittest import numpy as np from motif.feature_extractors import bitteli def array_equal(array1, array2): return np.all(np.isclose(array1, array2, atol=1e-7)) class TestBitteliFeatures(unittest.TestCase): def setUp(self): self.ftr = bitteli.BitteliFeatures...
[ "numpy.isclose", "numpy.ones", "motif.feature_extractors.bitteli.BitteliFeatures", "numpy.array", "numpy.linspace" ]
[((169, 207), 'numpy.isclose', 'np.isclose', (['array1', 'array2'], {'atol': '(1e-07)'}), '(array1, array2, atol=1e-07)\n', (179, 207), True, 'import numpy as np\n'), ((297, 322), 'motif.feature_extractors.bitteli.BitteliFeatures', 'bitteli.BitteliFeatures', ([], {}), '()\n', (320, 322), False, 'from motif.feature_extr...
# -*- coding: utf-8 -*- """ # 3D Image Data Synthesis. # Copyright (C) 2021 <NAME>, <NAME>, <NAME>, <NAME>, <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 Liceense at # # http://www.apache....
[ "numpy.random.choice", "csv.writer", "os.path.join", "os.path.split", "csv.reader", "numpy.arange", "numpy.random.shuffle" ]
[((2046, 2066), 'numpy.arange', 'np.arange', (['num_files'], {}), '(num_files)\n', (2055, 2066), True, 'import numpy as np\n'), ((1316, 1344), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""";"""'}), "(f, delimiter=';')\n", (1326, 1344), False, 'import csv\n'), ((1723, 1751), 'numpy.random.shuffle', 'np.random.sh...
import numpy as np import torch from modules.frustum import get_box_corners_3d from kitti_meters.util import get_box_iou_3d __all__ = ['MeterFrustumKitti'] class MeterFrustumKitti: def __init__(self, num_heading_angle_bins, num_size_templates, size_templates, class_name_to_class_id, metric='iou_...
[ "modules.frustum.get_box_corners_3d", "numpy.sum", "torch.arange", "torch.argmax" ]
[((717, 784), 'torch.arange', 'torch.arange', (['(0)', '(2 * np.pi)', '(2 * np.pi / self.num_heading_angle_bins)'], {}), '(0, 2 * np.pi, 2 * np.pi / self.num_heading_angle_bins)\n', (729, 784), False, 'import torch\n'), ((2407, 2453), 'torch.arange', 'torch.arange', (['batch_size'], {'device': 'center.device'}), '(batc...
import numpy as np import pandas as pd from Bio import AlignIO, Seq # parameter to determine the maximum missing proportion that we keep missing_thresh = 0.4 # load the alignments and turn them into a numpy array alignments = AlignIO.read(snakemake.input[0], 'fasta') align_arr = np.array([list(rec) for rec in alignme...
[ "numpy.array", "Bio.Seq.Seq", "Bio.AlignIO.read", "Bio.AlignIO.write" ]
[((228, 269), 'Bio.AlignIO.read', 'AlignIO.read', (['snakemake.input[0]', '"""fasta"""'], {}), "(snakemake.input[0], 'fasta')\n", (240, 269), False, 'from Bio import AlignIO, Seq\n'), ((739, 798), 'numpy.array', 'np.array', (['[(m / align_arr.shape[0]) for m in missing_bases]'], {}), '([(m / align_arr.shape[0]) for m i...
from __future__ import (division, print_function, absolute_import, unicode_literals) import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline as InterpUS from powderday.nebular_emission.cloudy_tools import sym_to_name """ ---------------------------------------------------...
[ "numpy.array", "numpy.log10", "scipy.interpolate.InterpolatedUnivariateSpline", "powderday.nebular_emission.cloudy_tools.sym_to_name" ]
[((1685, 1698), 'powderday.nebular_emission.cloudy_tools.sym_to_name', 'sym_to_name', ([], {}), '()\n', (1696, 1698), False, 'from powderday.nebular_emission.cloudy_tools import sym_to_name\n'), ((2912, 2954), 'numpy.log10', 'np.log10', (['(0.08096 + 0.02618 * 10.0 ** logZ)'], {}), '(0.08096 + 0.02618 * 10.0 ** logZ)\n...
from sklearn.preprocessing import StandardScaler, LabelEncoder, MinMaxScaler, OneHotEncoder import numpy as np import pandas as pd import tqdm """ Class for Preprocessing CICIDS2017 Data represented as rows """ class CICIDSPreprocessor: def __init__(self): self.to_delete_columns = ['Flow ID', ' Timestamp...
[ "numpy.array" ]
[((1214, 1235), 'numpy.array', 'np.array', (['windows_arr'], {}), '(windows_arr)\n', (1222, 1235), True, 'import numpy as np\n')]
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2020 dlilien <<EMAIL>> # # Distributed under terms of the MIT license. """ """ import numpy as np import cartopy.crs as ccrs import matplotlib.pyplot as plt from .cartopy_overrides import SPS # import shapely.geometry as sgeom USP_EXTEN...
[ "cartopy.crs.epsg", "numpy.arange" ]
[((733, 750), 'numpy.arange', 'np.arange', (['(0)', '(180)'], {}), '(0, 180)\n', (742, 750), True, 'import numpy as np\n'), ((767, 791), 'numpy.arange', 'np.arange', (['(-90)', '(-80)', '(0.1)'], {}), '(-90, -80, 0.1)\n', (776, 791), True, 'import numpy as np\n'), ((700, 715), 'cartopy.crs.epsg', 'ccrs.epsg', (['(3031)...
import gym from gym import spaces, error, utils from gym.utils import seeding import numpy as np import configparser from os import path import matplotlib.pyplot as plt from matplotlib.pyplot import gca font = {'family': 'sans-serif', 'weight': 'bold', 'size': 14} class FlockingEnv(gym.Env): def...
[ "numpy.clip", "configparser.ConfigParser", "numpy.hstack", "numpy.sin", "gym.utils.seeding.np_random", "numpy.mean", "numpy.reshape", "numpy.min", "matplotlib.pyplot.ylim", "matplotlib.pyplot.gca", "numpy.fill_diagonal", "numpy.square", "os.path.dirname", "numpy.cos", "matplotlib.pyplot....
[((431, 458), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (456, 458), False, 'import configparser\n'), ((1387, 1428), 'numpy.zeros', 'np.zeros', (['(self.n_agents, self.nx_system)'], {}), '((self.n_agents, self.nx_system))\n', (1395, 1428), True, 'import numpy as np\n'), ((1446, 1480), '...
import logging from datetime import datetime import numpy as np from logging.config import dictConfig from kafkawrapper.producer import Producer from utils.mongo_utils import BenchMarkingProcessRepo from configs.configs import ulca_notifier_input_topic, ulca_notifier_benchmark_completed_event, ulca_notifier_benchmark_f...
[ "logging.getLogger", "kafkawrapper.producer.Producer", "utils.mongo_utils.BenchMarkingProcessRepo", "models.metric_manager.MetricManager.getInstance", "logging.config.dictConfig", "datetime.datetime.now", "numpy.round" ]
[((387, 412), 'logging.getLogger', 'logging.getLogger', (['"""file"""'], {}), "('file')\n", (404, 412), False, 'import logging\n'), ((421, 431), 'kafkawrapper.producer.Producer', 'Producer', ([], {}), '()\n', (429, 431), False, 'from kafkawrapper.producer import Producer\n'), ((439, 464), 'utils.mongo_utils.BenchMarkin...
""" Module containing helper routines for routes """ from typing import Dict, Any, Set, List, Tuple import numpy as np from route_distances.utils.type_utils import StrDict def calc_depth(tree_dict: StrDict, depth: int = 0) -> int: """ Calculate the depth of a route, recursively :param tree_dict: the ro...
[ "numpy.argsort" ]
[((3623, 3641), 'numpy.argsort', 'np.argsort', (['scores'], {}), '(scores)\n', (3633, 3641), True, 'import numpy as np\n')]
import os import dgl import time import argparse import numpy as np import torch as th import distutils.util import torch.nn.functional as F import utils import models import data_loader os.environ["CUDA_VISIBLE_DEVICES"] = '0' dev = th.device('cuda' if th.cuda.is_available() else 'cpu') if __name__ == '__main__': ...
[ "utils.feat_norm", "numpy.mean", "utils.compute_acc", "argparse.ArgumentParser", "torch.nn.functional.nll_loss", "torch.LongTensor", "os.path.join", "torch.FloatTensor", "data_loader.KddDataset", "utils.adj_preprocess", "torch.cuda.is_available", "dgl.DGLGraph", "torch.nn.functional.log_soft...
[((336, 371), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""training"""'], {}), "('training')\n", (359, 371), False, 'import argparse\n'), ((1666, 1745), 'data_loader.KddDataset', 'data_loader.KddDataset', (['args.adj_path', 'args.feat_path', 'args.label_path', 'indices'], {}), '(args.adj_path, args.feat_...
from bluepy import btle import concurrent from concurrent import futures import threading import multiprocessing import time from time_sync import * import eval_client import dashBoardClient from joblib import dump, load import numpy # to count labels and store in dict import operator # to get most predicted label im...
[ "random.choice", "numpy.unique", "bluepy.btle.DefaultDelegate.__init__", "concurrent.futures.ThreadPoolExecutor", "bluepy.btle.Peripheral", "dashBoardClient.Client", "json.dumps", "time.sleep", "sklearn.preprocessing.StandardScaler", "multiprocessing.Pool", "joblib.load", "operator.itemgetter"...
[((469, 518), 'bluepy.btle.UUID', 'btle.UUID', (['"""0000dfb1-0000-1000-8000-00805f9b34fb"""'], {}), "('0000dfb1-0000-1000-8000-00805f9b34fb')\n", (478, 518), False, 'from bluepy import btle\n'), ((25115, 25157), 'numpy.unique', 'numpy.unique', (['pred_arr'], {'return_counts': '(True)'}), '(pred_arr, return_counts=True...
from .modules.common import * import numpy as np import os from .modules.rs_structs import getRSformat class RockstarFile(object): def __init__(self,binfile,data,galaxies,debug): self.galaxies = galaxies self.binfile = binfile self.debug = debug self.header() self....
[ "os.path.isfile", "numpy.fromfile", "numpy.asarray", "numpy.zeros" ]
[((2883, 2898), 'numpy.asarray', 'np.asarray', (['arr'], {}), '(arr)\n', (2893, 2898), True, 'import numpy as np\n'), ((1123, 1187), 'numpy.fromfile', 'np.fromfile', (['self.f'], {'dtype': 'self.halostruct', 'count': 'self.num_halos'}), '(self.f, dtype=self.halostruct, count=self.num_halos)\n', (1134, 1187), True, 'imp...
#! -*- coding:utf-8 from typing import Callable, List, Optional import numpy as np import torch import torchvision __all__ = ["CIFAR10", "FashionMNIST"] class CIFAR10(torch.utils.data.Dataset): def __init__(self, root: str, train: bool = True, tra...
[ "numpy.random.shuffle", "torchvision.datasets.FashionMNIST", "torchvision.datasets.CIFAR10" ]
[((709, 835), 'torchvision.datasets.CIFAR10', 'torchvision.datasets.CIFAR10', (['root'], {'train': 'train', 'transform': 'transform', 'target_transform': 'target_transform', 'download': 'download'}), '(root, train=train, transform=transform,\n target_transform=target_transform, download=download)\n', (737, 835), Fal...
from detectron2 import model_zoo from detectron2.engine import DefaultPredictor from detectron2.config import get_cfg from detectron2.utils.visualizer import Visualizer from detectron2.data import MetadataCatalog import torch import numpy as np import cv2 class Model: def __init__(self,confidence_thresh=0.6): ...
[ "numpy.clip", "detectron2.config.get_cfg", "detectron2.model_zoo.get_checkpoint_url", "numpy.zeros", "detectron2.model_zoo.get_config_file", "detectron2.engine.DefaultPredictor" ]
[((333, 342), 'detectron2.config.get_cfg', 'get_cfg', ([], {}), '()\n', (340, 342), False, 'from detectron2.config import get_cfg\n'), ((580, 669), 'detectron2.model_zoo.get_checkpoint_url', 'model_zoo.get_checkpoint_url', (['"""COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml"""'], {}), "(\n 'COCO-InstanceSegme...
import numpy as np from example_functions import target_function_dict from line_search_methods import line_search_dict from main_methods import main_method_dict from config import best_params from helpers import generate_x0 def run_one(_theta, _main_method, _ls_method, params, ls_params): theta = _theta() x0...
[ "numpy.array", "helpers.generate_x0", "numpy.warnings.filterwarnings" ]
[((946, 1007), 'numpy.warnings.filterwarnings', 'np.warnings.filterwarnings', (['"""ignore"""'], {'category': 'RuntimeWarning'}), "('ignore', category=RuntimeWarning)\n", (972, 1007), True, 'import numpy as np\n'), ((323, 358), 'helpers.generate_x0', 'generate_x0', (['theta.n', '*theta.bounds'], {}), '(theta.n, *theta....
import skimage.color import matplotlib.pyplot as plt import numpy as np import cv2 import os import imghdr import time """ Duplicate Image Finder (DIF): function that searches a given directory for images and finds duplicate/similar images among them. Outputs the number of found duplicate/similar image pairs with a l...
[ "matplotlib.pyplot.imshow", "numpy.fromfile", "os.listdir", "os.stat", "time.sleep", "os.remove", "matplotlib.pyplot.figure", "os.path.isdir", "imghdr.what", "numpy.rot90", "numpy.concatenate", "matplotlib.pyplot.axis", "cv2.resize", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.show"...
[((3912, 3927), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (3922, 3927), False, 'import time\n'), ((6198, 6210), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (6208, 6210), True, 'import matplotlib.pyplot as plt\n'), ((6219, 6250), 'matplotlib.pyplot.suptitle', 'plt.suptitle', (["('MSE: %.2f'...
import torch import numpy as np PAD_TOKEN_INDEX = 0 def pad_masking(x, target_len): # x: (batch_size, seq_len) batch_size, seq_len = x.size() padded_positions = x == PAD_TOKEN_INDEX # (batch_size, seq_len) pad_mask = padded_positions.unsqueeze(1).expand(batch_size, target_len, seq_len) return pa...
[ "torch.tensor", "numpy.ones" ]
[((534, 563), 'torch.tensor', 'torch.tensor', (['subsequent_mask'], {}), '(subsequent_mask)\n', (546, 563), False, 'import torch\n'), ((456, 489), 'numpy.ones', 'np.ones', ([], {'shape': '(seq_len, seq_len)'}), '(shape=(seq_len, seq_len))\n', (463, 489), True, 'import numpy as np\n')]
import pandas as pd import numpy as np import matplotlib.pyplot as plt #%matplotlib inline import codecs import lightgbm as lgb from sklearn.model_selection import StratifiedShuffleSplit from sklearn.metrics import mean_squared_error from sklearn.metrics import r2_score # Read data image_file_path = './simulated_dpc_d...
[ "sklearn.model_selection.StratifiedShuffleSplit", "numpy.sqrt", "pandas.DataFrame", "pandas.merge", "lightgbm.train", "sklearn.metrics.mean_squared_error", "lightgbm.Dataset", "pandas.read_table", "pandas.get_dummies", "codecs.open", "sklearn.metrics.r2_score", "pandas.concat" ]
[((674, 703), 'pandas.get_dummies', 'pd.get_dummies', (["dpc_r['code']"], {}), "(dpc_r['code'])\n", (688, 703), True, 'import pandas as pd\n'), ((778, 809), 'pandas.concat', 'pd.concat', (['[dpc_r, g_r]'], {'axis': '(1)'}), '([dpc_r, g_r], axis=1)\n', (787, 809), True, 'import pandas as pd\n'), ((1684, 1762), 'pandas.m...
from typing import Tuple import numpy as np import png from skimage.transform import resize def load_world(filename: str, size: Tuple[int, int], resolution: int) -> np.array: """Load a preconstructred track to initialize world. Args: filename: Full path to the track file (png). ...
[ "numpy.multiply", "skimage.transform.resize", "png.Reader" ]
[((778, 807), 'numpy.multiply', 'np.multiply', (['size', 'resolution'], {}), '(size, resolution)\n', (789, 807), True, 'import numpy as np\n'), ((1122, 1170), 'skimage.transform.resize', 'resize', (['world', '(width_in_cells, height_in_cells)'], {}), '(world, (width_in_cells, height_in_cells))\n', (1128, 1170), False, ...
import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.decomposition import IncrementalPCA as _IncrementalPCA from ..count_matrix.zarr import dataset_to_array def _normalize_per_cell(matrix, cell_sum): print('normalize per cell to CPM') if cell_sum is None: ...
[ "pandas.Index", "sklearn.preprocessing.StandardScaler", "pandas.DataFrame", "sklearn.decomposition.IncrementalPCA", "numpy.log1p", "pandas.concat", "numpy.random.shuffle" ]
[((702, 754), 'sklearn.decomposition.IncrementalPCA', '_IncrementalPCA', ([], {'n_components': 'n_components'}), '(n_components=n_components, **kwargs)\n', (717, 754), True, 'from sklearn.decomposition import IncrementalPCA as _IncrementalPCA\n'), ((6155, 6175), 'pandas.concat', 'pd.concat', (['total_pcs'], {}), '(tota...
# Predict time series w/o using OutputProjectWrapper import tensorflow as tf import numpy as np import matplotlib.pyplot as plt # Create time series t_min, t_max = 0, 30 resolution = 0.1 def time_series(t): return t * np.sin(t) / 3 + 2 * np.sin(t * 5) def next_batch(batch_size, n_steps): t0 = np.random.rand...
[ "numpy.random.rand", "matplotlib.pyplot.ylabel", "numpy.array", "numpy.sin", "numpy.arange", "tensorflow.placeholder", "matplotlib.pyplot.plot", "matplotlib.pyplot.xlabel", "tensorflow.Session", "tensorflow.nn.dynamic_rnn", "numpy.linspace", "tensorflow.square", "tensorflow.train.AdamOptimiz...
[((540, 596), 'numpy.linspace', 'np.linspace', (['t_min', 't_max', '((t_max - t_min) // resolution)'], {}), '(t_min, t_max, (t_max - t_min) // resolution)\n', (551, 596), True, 'import numpy as np\n'), ((624, 689), 'numpy.linspace', 'np.linspace', (['(12.2)', '(12.2 + resolution * (n_steps + 1))', '(n_steps + 1)'], {})...
import os from argparse import ArgumentParser from glob import glob import cv2 import numpy as np import torch import torchvision import matplotlib as mpl import matplotlib.pyplot as plt from PIL import Image from fiery.trainer import TrainingModule from fiery.utils.network import NormalizeInverse from fiery.utils.in...
[ "fiery.trainer.TrainingModule.load_from_checkpoint", "fiery.utils.network.NormalizeInverse", "fiery.utils.instance.predict_instance_segmentation_and_trajectories", "torchvision.transforms.ToPILImage", "fiery.utils.visualisation.make_contour", "torch.from_numpy", "matplotlib.pyplot.imshow", "fiery.util...
[((652, 740), 'fiery.utils.instance.predict_instance_segmentation_and_trajectories', 'predict_instance_segmentation_and_trajectories', (['output'], {'compute_matched_centers': '(True)'}), '(output,\n compute_matched_centers=True)\n', (698, 740), False, 'from fiery.utils.instance import predict_instance_segmentation_...
import tensorflow as tf import numpy as np def euclidean_dist(x, y): return np.linalg.norm(x - y) def limit_gpu(): gpus = tf.config.list_physical_devices('GPU') if gpus: try: tf.config.set_logical_device_configuration( gpus[0], [tf.config.Logic...
[ "tensorflow.config.list_logical_devices", "tensorflow.config.list_physical_devices", "tensorflow.config.LogicalDeviceConfiguration", "numpy.linalg.norm" ]
[((82, 103), 'numpy.linalg.norm', 'np.linalg.norm', (['(x - y)'], {}), '(x - y)\n', (96, 103), True, 'import numpy as np\n'), ((134, 172), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (165, 172), True, 'import tensorflow as tf\n'), ((390, 427), 'tensorf...
from PIL import Image, ImageDraw from numpy import array, random, vstack, ones, linalg from const import TOWERS from copy import deepcopy from os import path class MapDrawer: """ a class for drawing Dota2Maps with replay-parsed data """ def __init__(self, towers, received_tables): ...
[ "PIL.Image.open", "os.path.dirname", "PIL.ImageDraw.Draw", "numpy.linalg.lstsq", "copy.deepcopy" ]
[((585, 628), 'PIL.Image.open', 'Image.open', (["(libdir + '/assets/dota2map.png')"], {}), "(libdir + '/assets/dota2map.png')\n", (595, 628), False, 'from PIL import Image, ImageDraw\n'), ((650, 676), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['self.image'], {}), '(self.image)\n', (664, 676), False, 'from PIL import Ima...
import torch import numpy as np import torch.nn as nn from torch.utils.data import Dataset, DataLoader def binary_reg(x: torch.Tensor): # forward: f(x) = (x>=0) # backward: f(x) = sigmoid a = torch.sigmoid(x) b = a.detach() c = (x.detach() >= 0).float() return a - b + c class HIN2vec(nn.Module...
[ "torch.mul", "numpy.tile", "torch.LongTensor", "torch.sigmoid", "torch.tensor", "numpy.zeros", "numpy.random.randint", "torch.sum", "torch.FloatTensor", "torch.nn.Embedding" ]
[((205, 221), 'torch.sigmoid', 'torch.sigmoid', (['x'], {}), '(x)\n', (218, 221), False, 'import torch\n'), ((3209, 3259), 'torch.tensor', 'torch.tensor', (['[-1.0, 0.0, 1.0]'], {'requires_grad': '(True)'}), '([-1.0, 0.0, 1.0], requires_grad=True)\n', (3221, 3259), False, 'import torch\n'), ((3262, 3278), 'torch.sigmoi...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import json import uuid from typing import Callable, Mapping, Optional import numpy as np from caffe2.python import workspace from caffe2.python.predictor import predictor_exporter from .builtin_task import register_builtin_...
[ "caffe2.python.workspace.RunNet", "caffe2.python.workspace.SwitchWorkspace", "caffe2.python.predictor.predictor_exporter.prepare_prediction_net", "uuid.uuid4", "numpy.array" ]
[((721, 760), 'caffe2.python.workspace.SwitchWorkspace', 'workspace.SwitchWorkspace', (['workspace_id'], {}), '(workspace_id)\n', (746, 760), False, 'from caffe2.python import workspace\n'), ((2019, 2048), 'caffe2.python.workspace.RunNet', 'workspace.RunNet', (['predict_net'], {}), '(predict_net)\n', (2035, 2048), Fals...
import os import re import hyperparams as hp from data_load import DataLoad from tqdm import tqdm import numpy as np import pandas as pd import tensorflow as tf def load_ckpt_paths(model_name='cdmf'): # get ckpt ckpt_path = '../model_ckpt/compare/{}/'.format(model_name) fpaths = [] with open(ckpt_pat...
[ "tensorflow.Graph", "tensorflow.reset_default_graph", "numpy.sqrt", "tensorflow.Session", "tqdm.tqdm", "os.path.join", "tensorflow.train.import_meta_graph", "data_load.DataLoad", "tensorflow.ConfigProto" ]
[((623, 886), 'data_load.DataLoad', 'DataLoad', ([], {'data_path': 'hp.DATA_PATH', 'fnames': 'hp.FNAMES', 'forced_seq_len': 'hp.FORCED_SEQ_LEN', 'vocab_size': 'hp.VOCAB_SIZE', 'paly_times': 'hp.PLAY_TIMES', 'num_main_actors': 'hp.NUM_MAIN_ACTORS', 'batch_size': 'hp.BATCH_SIZE', 'num_epochs': 'hp.NUM_EPOCHS', 'noise_rat...
# coding=utf-8 # Author: <NAME> <<EMAIL>> import numpy as np import re class KeelAttribute: """ A class that represent an attribute of keel dataset format. """ TYPE_REAL, TYPE_INTEGER, TYPE_NOMINAL = ("real", "integer", "nominal") def __init__(self, attribute_name, attribute_type, attribute_rang...
[ "numpy.unique", "numpy.max", "numpy.concatenate", "numpy.min", "re.findall", "numpy.transpose" ]
[((1202, 1224), 'numpy.concatenate', 'np.concatenate', (['labels'], {}), '(labels)\n', (1216, 1224), True, 'import numpy as np\n'), ((1253, 1290), 'numpy.unique', 'np.unique', (['labels'], {'return_counts': '(True)'}), '(labels, return_counts=True)\n', (1262, 1290), True, 'import numpy as np\n'), ((1320, 1341), 'numpy....
""" This test module has tests relating to kelvin model validations. All functions in /calculations/models_kelvin.py are tested here. The purposes are: - testing the meniscus shape determination function - testing the output of the kelvin equations - testing that the "function getter" is performing as exp...
[ "pygaps.characterisation.models_kelvin.get_meniscus_geometry", "numpy.isclose", "pytest.mark.parametrize", "pytest.raises", "pygaps.characterisation.models_kelvin.get_kelvin_model" ]
[((633, 914), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""branch, pore, geometry"""', "[('ads', 'slit', 'hemicylindrical'), ('ads', 'cylinder', 'cylindrical'), (\n 'ads', 'sphere', 'hemispherical'), ('des', 'slit', 'hemicylindrical'),\n ('des', 'cylinder', 'hemispherical'), ('des', 'sphere', 'hemi...
import os import sys import pytest import numpy as np import pandas as pd from scipy.stats import ks_2samp sys.path.append("zarnitsa/") from zarnitsa.stats import DataAugmenterExternally N_TO_CHECK = 500 SIG = 0.5 @pytest.fixture def dae(): return DataAugmenterExternally() @pytest.fixture def normal_data()...
[ "numpy.random.normal", "zarnitsa.stats.DataAugmenterExternally", "sys.path.append", "scipy.stats.ks_2samp" ]
[((109, 137), 'sys.path.append', 'sys.path.append', (['"""zarnitsa/"""'], {}), "('zarnitsa/')\n", (124, 137), False, 'import sys\n'), ((259, 284), 'zarnitsa.stats.DataAugmenterExternally', 'DataAugmenterExternally', ([], {}), '()\n', (282, 284), False, 'from zarnitsa.stats import DataAugmenterExternally\n'), ((343, 388...
from .Wavefunction import Wavefunction import numpy as np from scipy.fft import ifft2, fft2 import numba CACHE_OPTIMIZATIONS = True class Collision(): targetWavefunction = None # Implements wilson line incidentWavefunction = None # Doesn't (have to) implement wilson line _omega = None _omegaFFT = ...
[ "numpy.reshape", "scipy.fft.fft2", "numpy.sqrt", "numpy.conj", "numpy.exp", "numpy.array", "numpy.zeros", "numba.jit", "numpy.sum", "numpy.arctan2", "numpy.linalg.norm", "numpy.sin" ]
[((17641, 17773), 'numba.jit', 'numba.jit', (['(numba.float64[:, :], numba.int64, numba.int64, numba.int64, numba.float64)'], {'nopython': '(True)', 'cache': 'CACHE_OPTIMIZATIONS'}), '((numba.float64[:, :], numba.int64, numba.int64, numba.int64,\n numba.float64), nopython=True, cache=CACHE_OPTIMIZATIONS)\n', (17650,...
import sys sys.path.append("../../configs") #../../configs from path import EXP_PATH import numpy as np DECAY_PARAMS_DICT =\ { 'stair' : { 128 :{ 'a1': {'initial_lr' : 1e-5, 'decay_steps' : 50000, 'decay_rate' : 0.3}, 'a2' : {'initial_lr' : 3e-4, 'decay_step...
[ "sys.path.append", "numpy.arange" ]
[((11, 43), 'sys.path.append', 'sys.path.append', (['"""../../configs"""'], {}), "('../../configs')\n", (26, 43), False, 'import sys\n'), ((1616, 1631), 'numpy.arange', 'np.arange', (['(1)', '(5)'], {}), '(1, 5)\n', (1625, 1631), True, 'import numpy as np\n')]
import dgl import torch as th import numpy as np import itertools import time from collections import * Graph = namedtuple('Graph', ['g', 'src', 'tgt', 'tgt_y', 'nids', 'eids', 'nid_arr', 'n_nodes', 'n_edges', 'n_tokens', 'layer_eids']) # We need to create new graph pools for relative position atte...
[ "dgl.batch", "torch.tensor", "torch.cat", "numpy.zeros", "dgl.DGLGraph", "time.time", "torch.zeros", "torch.arange", "torch.ones" ]
[((1669, 1680), 'time.time', 'time.time', ([], {}), '()\n', (1678, 1680), False, 'import time\n'), ((4163, 4180), 'dgl.batch', 'dgl.batch', (['g_list'], {}), '(g_list)\n', (4172, 4180), False, 'import dgl\n'), ((8419, 8436), 'dgl.batch', 'dgl.batch', (['g_list'], {}), '(g_list)\n', (8428, 8436), False, 'import dgl\n'),...
import tensorflow as tf import prettytensor as pt import numpy as np import gym import math import random from collections import deque from agents import mixed_network, spaces, replay_buffer tensorType = tf.float32 """ Implements a Deep Deterministic Policy Gradient agent. Adjustable parameters: - Actor / Critic ...
[ "tensorflow.Graph", "agents.mixed_network.MixedNetwork", "collections.deque", "numpy.reshape", "tensorflow.variable_scope", "tensorflow.placeholder", "tensorflow.Session", "numpy.squeeze", "tensorflow.gradients", "tensorflow.global_variables_initializer", "tensorflow.negative", "tensorflow.con...
[((1300, 1310), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1308, 1310), True, 'import tensorflow as tf\n'), ((1334, 1362), 'tensorflow.Session', 'tf.Session', ([], {'graph': 'self.graph'}), '(graph=self.graph)\n', (1344, 1362), True, 'import tensorflow as tf\n'), ((1438, 1458), 'collections.deque', 'deque', ([]...
# -*- coding: utf-8 -*- from remi.gui import * from remi import start, App import cv2 import numpy import chdkptp import time import threading import rawpy class OpenCVVideoWidget(Image): def __init__(self, **kwargs): super(OpenCVVideoWidget, self).__init__("/%s/get_image_data" % id(self), **kwargs) ...
[ "numpy.dstack", "numpy.fromfile", "remi.start", "cv2.imencode", "chdkptp.ChdkDevice", "time.sleep", "threading.Event", "numpy.random.randint", "numpy.zeros", "numpy.empty", "cv2.cvtColor", "numpy.full", "numpy.dtype", "time.time", "threading.Thread", "chdkptp.list_devices" ]
[((31139, 31295), 'remi.start', 'start', (['M10GUI'], {'address': '"""0.0.0.0"""', 'port': '(8081)', 'multiple_instance': '(False)', 'enable_file_cache': '(True)', 'start_browser': '(False)', 'debug': '(False)', 'update_interval': '(0.01)'}), "(M10GUI, address='0.0.0.0', port=8081, multiple_instance=False,\n enable_...
# Copyright (c) 2021, NVIDIA CORPORATION. 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...
[ "os.path.exists", "numpy.ones", "triton_python_backend_utils.InferenceRequest", "swig_decoders.map_batch", "torch.utils.dlpack.to_dlpack", "triton_python_backend_utils.Tensor", "swig_decoders.Scorer", "multiprocessing.cpu_count", "numpy.zeros", "triton_python_backend_utils.get_output_tensor_by_nam...
[((1805, 1828), 'os.path.exists', 'os.path.exists', (['lm_path'], {}), '(lm_path)\n', (1819, 1828), False, 'import os\n'), ((6428, 6475), 'swig_decoders.map_batch', 'map_batch', (['best_sent', 'self.vocab', 'num_processes'], {}), '(best_sent, self.vocab, num_processes)\n', (6437, 6475), False, 'from swig_decoders impor...
"""Temporal VAE with gaussian margial and laplacian transition prior""" import torch import numpy as np import ipdb as pdb import torch.nn as nn import pytorch_lightning as pl import torch.distributions as D from torch.nn import functional as F from .components.beta import BetaVAE_MLP from .metrics.correla...
[ "numpy.sqrt", "numpy.log", "torch.sqrt", "torch.exp", "torch.nn.functional.sigmoid", "torch.sum", "torch.eye", "torch.zeros_like", "torch.randn", "torch.ones_like", "torch.abs", "torch.nn.functional.mse_loss", "torch.nn.LeakyReLU", "torch.distributions.laplace.Laplace", "torch.norm", "...
[((1386, 1423), 'torch.norm', 'torch.norm', (['diff'], {'dim': '(1)', 'keepdim': '(True)'}), '(diff, dim=1, keepdim=True)\n', (1396, 1423), False, 'import torch\n'), ((1550, 1565), 'torch.abs', 'torch.abs', (['diff'], {}), '(diff)\n', (1559, 1565), False, 'import torch\n'), ((2875, 2898), 'torch.nn.Linear', 'nn.Linear'...
import openmoc import openmc.openmoc_compatible import openmc.mgxs import numpy as np import matplotlib # Enable Matplotib to work for headless nodes matplotlib.use('Agg') import matplotlib.pyplot as plt plt.ioff() opts = openmoc.options.Options() openmoc.log.set_log_level('NORMAL') ##############################...
[ "matplotlib.pyplot.grid", "openmoc.plotter.plot_cells", "matplotlib.pyplot.ylabel", "openmoc.materialize.compute_sph_factors", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "openmoc.log.set_log_level", "matplotlib.pyplot.yscale", "openmoc.options.Options", "mat...
[((152, 173), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (166, 173), False, 'import matplotlib\n'), ((206, 216), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (214, 216), True, 'import matplotlib.pyplot as plt\n'), ((226, 251), 'openmoc.options.Options', 'openmoc.options.Options', (...
from sklearn.cluster import KMeans import cv2 import PIL import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np from matplotlib import image as img1 import pandas as pd from scipy.cluster.vq import whiten import os class DominantColors: CLUSTERS = None IMAGEPATH = None I...
[ "sklearn.cluster.KMeans", "matplotlib.pyplot.imshow", "numpy.histogram", "scipy.cluster.vq.kmeans", "os.listdir", "cv2.resize", "numpy.arange", "matplotlib.image.imread", "scipy.cluster.vq.whiten", "matplotlib.pyplot.figure", "numpy.zeros", "cv2.cvtColor", "pandas.DataFrame", "matplotlib.p...
[((564, 590), 'cv2.imread', 'cv2.imread', (['self.IMAGEPATH'], {}), '(self.IMAGEPATH)\n', (574, 590), False, 'import cv2\n'), ((766, 827), 'cv2.resize', 'cv2.resize', (['img', '(self.BASEWIDTH, hsize)', 'PIL.Image.ANTIALIAS'], {}), '(img, (self.BASEWIDTH, hsize), PIL.Image.ANTIALIAS)\n', (776, 827), False, 'import cv2\...
import torch from torch import nn import numpy as np from models.AttentionLayer import AttentionLayer from models.SelfAttentionLayer import SelfAttention, SelfAttentionPytorch,\ BertSelfAttentionScores, BertSelfAttentionScoresP, BertMultiSelfAttentionScoresP,\ BertMultiAttentionScoresP, BertAttentionClsQuery fr...
[ "models.SelfAttentionLayer.BertAttentionClsQuery", "models.SelfAttentionLayer.SelfAttentionPytorch", "torch.multinomial", "numpy.ones", "torch.nn.Softmax", "models.SelfAttentionLayer.BertMultiAttentionScoresP", "models.AttentionLayer.AttentionLayer", "models.SelfAttentionLayer.BertMultiSelfAttentionSc...
[((12737, 12793), 'torch.tensor', 'torch.tensor', (['embraced_features_token'], {'dtype': 'torch.float'}), '(embraced_features_token, dtype=torch.float)\n', (12749, 12793), False, 'import torch\n'), ((800, 831), 'models.SelfAttentionLayer.SelfAttention', 'SelfAttention', (['self.hidden_size'], {}), '(self.hidden_size)\...
""" Functions for ionospheric modelling: see SDP memo 97 """ import astropy.units as u import numpy from astropy.coordinates import SkyCoord from data_models.memory_data_models import BlockVisibility from processing_components.calibration.operations import create_gaintable_from_blockvisibility, \ create_gaintabl...
[ "logging.getLogger", "matplotlib.pyplot.ylabel", "processing_components.calibration.operations.create_gaintable_from_blockvisibility", "numpy.array", "processing_components.calibration.operations.create_gaintable_from_rows", "processing_library.util.coordinate_support.skycoord_to_lmn", "matplotlib.pyplo...
[((757, 784), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (774, 784), False, 'import logging\n'), ((1160, 1215), 'astropy.coordinates.SkyCoord', 'SkyCoord', ([], {'ra': 'ha', 'dec': 'dec', 'frame': '"""icrs"""', 'equinox': '"""J2000"""'}), "(ra=ha, dec=dec, frame='icrs', equinox='J2000...
import numpy as np import matplotlib.pyplot as plt N = 4 ind = np.arange(N) # the x locations for the groups width = 0.4 # the width of the bars fig, ax = plt.subplots() ax.set_ylim(0,11) # outliers only #ax2.set_ylim(0,35) # most of the data #ax.spines['bottom'].set_visible(False) #ax2.spines['top'].set_vi...
[ "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((66, 78), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (75, 78), True, 'import numpy as np\n'), ((165, 179), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (177, 179), True, 'import matplotlib.pyplot as plt\n'), ((2178, 2188), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2186, 2188)...
#+ echo=False import numpy from biobakery_workflows import utilities, visualizations, files from anadama2 import PweaveDocument document=PweaveDocument() # get the variables for this document generation task vars = document.get_vars() # determine the document format pdf_format = True if vars["format"] == "pdf" ...
[ "biobakery_workflows.files.ShotGunVis.path", "numpy.transpose", "anadama2.PweaveDocument", "biobakery_workflows.utilities.microbial_read_proportion_multiple_databases", "biobakery_workflows.visualizations.qc_read_counts" ]
[((141, 157), 'anadama2.PweaveDocument', 'PweaveDocument', ([], {}), '()\n', (155, 157), False, 'from anadama2 import PweaveDocument\n'), ((450, 514), 'biobakery_workflows.visualizations.qc_read_counts', 'visualizations.qc_read_counts', (['document', "vars['dna_read_counts']"], {}), "(document, vars['dna_read_counts'])...
''' This example provides three examples of a simple plot of 1-D data. 1. a publication-ready single column figure, which is printed to png (600 dpi), pdf, and svg 2. a presentation-ready figure on a black background Four steps are involved in each figure: - load/generate the data - construct a 1d plot (figure, axis,...
[ "jalapeno.plots.plots.print_fig", "jalapeno.plots.colorscheme.FigColors.scheme", "jalapeno.plots.plots.SquareFigure", "numpy.linspace", "numpy.cos", "jalapeno.plots.plots.print_fig_to_pdf" ]
[((573, 603), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(600)'], {}), '(0, 2 * np.pi, 600)\n', (584, 603), True, 'import numpy as np\n'), ((1024, 1096), 'jalapeno.plots.plots.print_fig', 'jpp.print_fig', (['fig', '"""xy-for-publication"""', "['pdf', 'png', 'svg']"], {'dpi': '(600)'}), "(fig, 'xy-for-pub...
from __future__ import division from __future__ import print_function from pathlib import Path import sys project_path = Path(__file__).resolve().parents[1] sys.path.append(str(project_path)) from keras.layers import Dense, Activation, Dropout from keras.models import Model, Sequential from keras.regularize...
[ "tensorflow.random.set_seed", "sklearn.preprocessing.normalize", "numpy.random.seed", "pathlib.Path" ]
[((623, 643), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (637, 643), True, 'import numpy as np\n'), ((645, 669), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed'], {}), '(seed)\n', (663, 669), True, 'import tensorflow as tf\n'), ((1912, 1935), 'sklearn.preprocessing.normalize', 'norm...
import io import zlib import numpy as np def maybe_compress(str, compress): return zlib.compress(str) if compress else str def maybe_decompress(str, decompress): return zlib.decompress(str) if decompress else str def serialize_numpy(arr: np.ndarray, compress: bool = False) -> str: """Serializes numpy...
[ "io.BytesIO", "zlib.compress", "numpy.save", "numpy.load", "zlib.decompress" ]
[((616, 628), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (626, 628), False, 'import io\n'), ((672, 689), 'numpy.save', 'np.save', (['buf', 'arr'], {}), '(buf, arr)\n', (679, 689), True, 'import numpy as np\n'), ((1232, 1247), 'io.BytesIO', 'io.BytesIO', (['str'], {}), '(str)\n', (1242, 1247), False, 'import io\n'), ...
from cv2 import fastNlMeansDenoisingColored from cv2 import cvtColor from cv2 import bitwise_not,threshold,getRotationMatrix2D from cv2 import warpAffine,filter2D,imread from cv2 import THRESH_BINARY,COLOR_BGR2GRAY,THRESH_OTSU from cv2 import INTER_CUBIC,BORDER_REPLICATE,minAreaRect from numpy import column_stack,array...
[ "matplotlib.pyplot.imshow", "cv2.warpAffine", "cv2.getRotationMatrix2D", "matplotlib.pyplot.xticks", "cv2.fastNlMeansDenoisingColored", "cv2.threshold", "numpy.where", "cv2.filter2D", "cv2.minAreaRect", "numpy.array", "matplotlib.pyplot.yticks", "cv2.cvtColor", "pytesseract.image_to_string",...
[((576, 631), 'cv2.fastNlMeansDenoisingColored', 'fastNlMeansDenoisingColored', (['image', 'None', '(20)', '(10)', '(7)', '(21)'], {}), '(image, None, 20, 10, 7, 21)\n', (603, 631), False, 'from cv2 import fastNlMeansDenoisingColored\n'), ((804, 835), 'cv2.cvtColor', 'cvtColor', (['image', 'COLOR_BGR2GRAY'], {}), '(ima...
import cv2 import numpy as np import matplotlib.pyplot as plt from findpoint import FindPoint class LineDetector: def __init__(self,img): self.frame = None self.leftx = None self.rightx = None # self.output = None self.frame = 0 self.frame_list = [] self.fi...
[ "cv2.rectangle", "numpy.dstack", "numpy.mean", "findpoint.FindPoint", "numpy.argmax", "numpy.max", "numpy.array", "cv2.circle" ]
[((330, 344), 'findpoint.FindPoint', 'FindPoint', (['img'], {}), '(img)\n', (339, 344), False, 'from findpoint import FindPoint\n'), ((444, 470), 'numpy.dstack', 'np.dstack', (['(img, img, img)'], {}), '((img, img, img))\n', (453, 470), True, 'import numpy as np\n'), ((629, 649), 'numpy.array', 'np.array', (['nonzero[0...
import numpy as np from matplotlib import _api from .axes_divider import make_axes_locatable, Size from .mpl_axes import Axes @_api.delete_parameter("3.3", "add_all") def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True, **kwargs): """ Parameters ---------- pad : float Fraction of th...
[ "numpy.dstack", "matplotlib._api.delete_parameter", "numpy.zeros_like", "matplotlib._api.deprecated" ]
[((130, 169), 'matplotlib._api.delete_parameter', '_api.delete_parameter', (['"""3.3"""', '"""add_all"""'], {}), "('3.3', 'add_all')\n", (151, 169), False, 'from matplotlib import _api\n'), ((1527, 1596), 'matplotlib._api.deprecated', '_api.deprecated', (['"""3.3"""'], {'alternative': '"""ax.imshow(np.dstack([r, g, b])...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the SCICO package. Details of the copyright # and user license can be found in the 'LICENSE.txt' file distributed # with the package. r""" Regularized Abel Inversion ========================== This example demonstrates a TV-regularized Abel inversio...
[ "scico.linop.abel.AbelProjector", "scico.functional.L1Norm", "scico.plot.subplots", "scico.plot.matplotlib.colors.Normalize", "numpy.random.normal", "scico.examples.create_circular_phantom", "scico.plot.imview", "scico.linop.FiniteDifference", "scico.optimize.admm.LinearSubproblemSolver", "numpy.r...
[((748, 821), 'scico.examples.create_circular_phantom', 'create_circular_phantom', (['(N, N)', '[0.4 * N, 0.2 * N, 0.1 * N]', '[1, 0, 0.5]'], {}), '((N, N), [0.4 * N, 0.2 * N, 0.1 * N], [1, 0, 0.5])\n', (771, 821), False, 'from scico.examples import create_circular_phantom\n'), ((894, 919), 'scico.linop.abel.AbelProjec...
import numpy as np import scipy.stats as sp from concept import Concept def info_gain(prev_dist, new_dist): return sp.entropy(prev_dist) - sp.entropy(new_dist) def main(): attributes = range(10) num_concepts = 5 concept_size = 4 concept_space = Concept(attributes, num_concepts, concept_size) problem1 = [(1, 2,...
[ "scipy.stats.entropy", "numpy.ones", "concept.Concept" ]
[((253, 300), 'concept.Concept', 'Concept', (['attributes', 'num_concepts', 'concept_size'], {}), '(attributes, num_concepts, concept_size)\n', (260, 300), False, 'from concept import Concept\n'), ((117, 138), 'scipy.stats.entropy', 'sp.entropy', (['prev_dist'], {}), '(prev_dist)\n', (127, 138), True, 'import scipy.sta...
# -*- coding: utf-8 -*- # %reset -f """ @author: <NAME> """ # Demonstration of MAEcce in PLS modeling import matplotlib.figure as figure import matplotlib.pyplot as plt import numpy as np from dcekit.validation import mae_cce from sklearn import datasets from sklearn.cross_decomposition import PLSRegressi...
[ "sklearn.datasets.make_regression", "matplotlib.pyplot.hist", "sklearn.cross_decomposition.PLSRegression", "matplotlib.pyplot.ylabel", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.figure.figaspect", "numpy.array", "matplotlib.pyplot....
[((719, 946), 'sklearn.datasets.make_regression', 'datasets.make_regression', ([], {'n_samples': '(number_of_training_samples + number_of_test_samples)', 'n_features': 'number_of_x_variables', 'n_informative': '(10)', 'noise': '(30)', 'random_state': '(number_of_training_samples + number_of_x_variables)'}), '(n_samples...
# -*- coding: utf-8 -*- ''' @author: <NAME> May 2018 ''' # import code # code.interact(local=locals()) import os import pickle # from fordclassifier.classifier.classifier import Classifier import numpy as np import pandas as pd from sklearn.metrics import roc_curve, auc import json import matplot...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "sklearn.metrics.auc", "numpy.ascontiguousarray", "numpy.argsort", "numpy.nanmean", "sklearn.metrics.roc_curve", "pandas.read_excel", "operator.itemgetter", "matplotlib.pyplot.imshow", "numpy.mean", "collections.OrderedDict.fromkeys", "ma...
[((4723, 4784), 'os.path.join', 'os.path.join', (['self._project_path', 'self._subfolders[subfolder]'], {}), '(self._project_path, self._subfolders[subfolder])\n', (4735, 4784), False, 'import os\n'), ((14515, 14600), 'os.path.join', 'os.path.join', (["(self._project_path + self._subfolders['test_data'])", '"""test_dat...
#!/usr/bin/env python3 # do not hesitate to debug import pdb # python computation modules and visualization import numpy as np import sympy as sy import scipy as sp import matplotlib.pyplot as plt from sympy import Q as syQ sy.init_printing(use_latex=True,forecolor="White") def Lyapunov_stability_test_linear(ev): ...
[ "sympy.sin", "numpy.sqrt", "sympy.re", "sympy.lambdify", "sympy.Matrix", "sympy.init_printing", "sympy.symbols", "numpy.linspace", "sympy.solve", "matplotlib.pyplot.subplots" ]
[((227, 278), 'sympy.init_printing', 'sy.init_printing', ([], {'use_latex': '(True)', 'forecolor': '"""White"""'}), "(use_latex=True, forecolor='White')\n", (243, 278), True, 'import sympy as sy\n'), ((4294, 4320), 'sympy.symbols', 'sy.symbols', (['"""t"""'], {'real': '(True)'}), "('t', real=True)\n", (4304, 4320), Tru...
#coding=utf-8 import numpy as np import tensorflow as tf import os import sys import time import shutil import re import signal import subprocess import numpy as np import math from Policy import * np.set_printoptions(threshold=np.inf) BASELINES = 1 class MultiBaseline: def __init__(self, baseline_number): ...
[ "tensorflow.reduce_sum", "math.cos", "numpy.array", "tensorflow.nn.softmax", "numpy.mean", "tensorflow.random_normal", "tensorflow.Session", "tensorflow.placeholder", "tensorflow.assign", "tensorflow.one_hot", "tensorflow.add", "tensorflow.train.GradientDescentOptimizer", "shutil.copy", "t...
[((199, 236), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (218, 236), True, 'import numpy as np\n'), ((2315, 2332), 'numpy.array', 'np.array', (['rewards'], {}), '(rewards)\n', (2323, 2332), True, 'import numpy as np\n'), ((3569, 3584), 'numpy.mean', 'np.mean'...
import numpy as np from scipy.special import factorial from itertools import permutations, product from pysat.solvers import Minisat22, Minicard from pysat.pb import PBEnc from clauses import build_clauses, build_max_min_clauses from clauses import build_permutation_clauses from clauses import build_cardinality_lits,...
[ "clauses.build_exclusivity_lits", "pysat.solvers.Minicard", "clauses.build_permutation_clauses", "scipy.special.factorial", "itertools.product", "clauses.build_cardinality_lits", "pysat.solvers.Minisat22", "numpy.argsort", "numpy.array", "clauses.build_max_min_clauses", "clauses.build_clauses", ...
[((5231, 5273), 'itertools.product', 'product', (['*[dice_solution[k] for k in keys]'], {}), '(*[dice_solution[k] for k in keys])\n', (5238, 5273), False, 'from itertools import permutations, product\n'), ((5738, 5884), 'clauses.build_clauses', 'build_clauses', (['d', 'dice_names', 'scores'], {'card_clauses': 'cardinal...
#!/usr/bin/env python # # import modules used here -- sys is a very standard one from __future__ import print_function import argparse import csv import logging import zipfile from collections import OrderedDict from glob import glob import os import sys import nibabel as nb import json import pandas as pd import num...
[ "os.path.exists", "collections.OrderedDict", "pandas.read_csv", "nibabel.load", "zipfile.ZipFile", "json.dumps", "os.path.join", "numpy.argmax", "os.path.split", "sys.stderr.write", "sys.exit", "pandas.DataFrame" ]
[((538, 564), 'os.path.split', 'os.path.split', (['sidecarJSON'], {}), '(sidecarJSON)\n', (551, 564), False, 'import os\n'), ((3938, 3951), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3949, 3951), False, 'from collections import OrderedDict\n'), ((13537, 13563), 'pandas.DataFrame', 'pd.DataFrame', (['i...