code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
"""Exercise 1 Usage: $ CUDA_VISIBLE_DEVICES=2 python practico_1_train_petfinder.py --dataset_dir ../ --epochs 30 --dropout 0.1 0.1 --hidden_layer_sizes 200 100 To know which GPU to use, you can check it with the command $ nvidia-smi """ import argparse import os import mlflow import pickle import numpy as np impo...
[ "mlflow.set_experiment", "mlflow.log_param", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.Input", "os.path.exists", "argparse.ArgumentParser", "tensorflow.data.Dataset.from_tensor_slices", "mlflow.log_metric", "auxiliary.log_dir_name", "auxiliary.load_dataset", "tensorflow.keras.mod...
[((475, 508), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (498, 508), False, 'import warnings\n'), ((654, 732), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Training a MLP on the petfinder dataset"""'}), "(description='Training a MLP on...
import numpy as np import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt from os import listdir from tensorflow.keras.callbacks import ModelCheckpoint dataDir = "./data/trainSmallFA/" files = listdir(dataDir) files.sort() totalLength = len(files) inputs = np.empty((len(files), 3, 64, 64)...
[ "matplotlib.pyplot.imshow", "os.listdir", "numpy.sqrt", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.subplot", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "numpy.load", "numpy.amax", "matplotlib.pyplot.show" ]
[((224, 240), 'os.listdir', 'listdir', (['dataDir'], {}), '(dataDir)\n', (231, 240), False, 'from os import listdir\n'), ((833, 861), 'numpy.amax', 'np.amax', (['targets[:, 0, :, :]'], {}), '(targets[:, 0, :, :])\n', (840, 861), True, 'import numpy as np\n'), ((413, 436), 'numpy.load', 'np.load', (['(dataDir + file)'],...
import os import shutil import numpy as np import pandas as pd ...
[ "seaborn.set", "numpy.power", "numpy.geomspace", "numpy.array", "cosmicfish.makedirectory", "cosmicfish.forecast" ]
[((665, 674), 'seaborn.set', 'sns.set', ([], {}), '()\n', (672, 674), True, 'import seaborn as sns\n'), ((1328, 1359), 'cosmicfish.makedirectory', 'cf.makedirectory', (['fp_resultsdir'], {}), '(fp_resultsdir)\n', (1344, 1359), True, 'import cosmicfish as cf\n'), ((3270, 3368), 'numpy.array', 'np.array', (['[0.65, 0.75,...
import argparse import warnings warnings.simplefilter("ignore", UserWarning) import files from tensorboardX import SummaryWriter import os import numpy as np import time import torch import torch.optim import torch.nn as nn import torch.utils.data import torchvision import torchvision.transforms as tfs from data impo...
[ "torch.nn.CrossEntropyLoss", "torchvision.transforms.ColorJitter", "torchvision.transforms.functional.rotate", "torch.cuda.is_available", "files.save_checkpoint_all", "numpy.arange", "util.setup_runtime", "tensorboardX.SummaryWriter", "argparse.ArgumentParser", "util.write_conv", "torchvision.da...
[((32, 76), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'UserWarning'], {}), "('ignore', UserWarning)\n", (53, 76), False, 'import warnings\n'), ((594, 662), 'torchvision.transforms.Normalize', 'tfs.Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.48...
import numpy as np from something import Top i = 0 while i < 10: a = np.ndarray((10,4)) b = np.ones((10, Top)) i += 1 del Top # show_store()
[ "numpy.ndarray", "numpy.ones" ]
[((74, 93), 'numpy.ndarray', 'np.ndarray', (['(10, 4)'], {}), '((10, 4))\n', (84, 93), True, 'import numpy as np\n'), ((101, 119), 'numpy.ones', 'np.ones', (['(10, Top)'], {}), '((10, Top))\n', (108, 119), True, 'import numpy as np\n')]
import torch import numpy as np import hashlib from torch.autograd import Variable import os def deterministic_random(min_value, max_value, data): digest = hashlib.sha256(data.encode()).digest() raw_value = int.from_bytes(digest[:4], byteorder='little', signed=False) return int(raw_value / (2 ** 32 - 1...
[ "numpy.mean", "torch.mean", "numpy.linalg.det", "numpy.sum", "numpy.matmul", "numpy.linalg.svd", "torch.autograd.Variable" ]
[((2852, 2890), 'numpy.mean', 'np.mean', (['target'], {'axis': '(1)', 'keepdims': '(True)'}), '(target, axis=1, keepdims=True)\n', (2859, 2890), True, 'import numpy as np\n'), ((2901, 2942), 'numpy.mean', 'np.mean', (['predicted'], {'axis': '(1)', 'keepdims': '(True)'}), '(predicted, axis=1, keepdims=True)\n', (2908, 2...
# should re-write compiled functions to take a local and global dict # as input. from __future__ import absolute_import, print_function import sys import os from . import ext_tools from . import catalog from . import common_info from numpy.core.multiarray import _get_ndarray_c_version ndarray_api_version = '/* NDARRA...
[ "numpy.core.multiarray._get_ndarray_c_version", "sys.path.insert", "sys._getframe", "os.path.split" ]
[((19930, 19956), 'os.path.split', 'os.path.split', (['module_path'], {}), '(module_path)\n', (19943, 19956), False, 'import os\n'), ((344, 368), 'numpy.core.multiarray._get_ndarray_c_version', '_get_ndarray_c_version', ([], {}), '()\n', (366, 368), False, 'from numpy.core.multiarray import _get_ndarray_c_version\n'), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """A module containing an algorithm for hand gesture recognition""" import numpy as np import cv2 from typing import Tuple __author__ = "<NAME>" __license__ = "GNU GPL 3.0 or later" def recognize(img_gray): """Recognizes hand gesture in a single-channel depth image ...
[ "cv2.convexHull", "numpy.median", "numpy.ones", "numpy.cross", "cv2.threshold", "cv2.arcLength", "cv2.floodFill", "cv2.convexityDefects", "cv2.morphologyEx", "numpy.zeros", "numpy.dot", "cv2.approxPolyDP", "cv2.cvtColor", "cv2.findContours" ]
[((1022, 1063), 'cv2.cvtColor', 'cv2.cvtColor', (['segment', 'cv2.COLOR_GRAY2RGB'], {}), '(segment, cv2.COLOR_GRAY2RGB)\n', (1034, 1063), False, 'import cv2\n'), ((2042, 2059), 'numpy.median', 'np.median', (['center'], {}), '(center)\n', (2051, 2059), True, 'import numpy as np\n'), ((2225, 2250), 'numpy.ones', 'np.ones...
from typing import Callable import numpy as np from hmc.integrators.states.leapfrog_state import LeapfrogState from hmc.integrators.fields import riemannian from hmc.linalg import solve_psd class RiemannianLeapfrogState(LeapfrogState): """The Riemannian leapfrog state uses the Fisher information matrix to provi...
[ "hmc.integrators.fields.riemannian.velocity", "hmc.integrators.fields.riemannian.grad_logdet", "hmc.integrators.fields.riemannian.force", "numpy.swapaxes", "hmc.linalg.solve_psd" ]
[((1817, 1847), 'numpy.swapaxes', 'np.swapaxes', (['jac_metric', '(0)', '(-1)'], {}), '(jac_metric, 0, -1)\n', (1828, 1847), True, 'import numpy as np\n'), ((1883, 1918), 'hmc.linalg.solve_psd', 'solve_psd', (['metric'], {'return_chol': '(True)'}), '(metric, return_chol=True)\n', (1892, 1918), False, 'from hmc.linalg i...
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[ "tensorflow.python.ops.array_ops.placeholder", "tensorflow.python.ops.distributions.bijector_test_util.assert_scalar_congruency", "numpy.float64", "tensorflow.contrib.distributions.python.ops.bijectors.affine_scalar.AffineScalar", "numpy.log", "numpy.array", "tensorflow.python.platform.test.main" ]
[((5795, 5806), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (5804, 5806), False, 'from tensorflow.python.platform import test\n'), ((1410, 1432), 'tensorflow.contrib.distributions.python.ops.bijectors.affine_scalar.AffineScalar', 'AffineScalar', ([], {'shift': 'mu'}), '(shift=mu)\n', (1422, 1...
from __future__ import annotations import numpy as np import pandas as pd from sklearn import datasets from IMLearn.metrics import mean_square_error from IMLearn.utils import split_train_test from IMLearn.model_selection import cross_validate from IMLearn.learners.regressors import PolynomialFitting, LinearRegression, ...
[ "numpy.random.normal", "pandas.Series", "plotnine.ggtitle", "plotnine.ggsave", "plotnine.ggplot", "plotnine.theme_bw", "plotnine.geom_line", "plotnine.aes", "IMLearn.learners.regressors.LinearRegression", "numpy.array", "numpy.linspace", "sklearn.datasets.load_diabetes", "numpy.random.seed",...
[((1030, 1061), 'numpy.linspace', 'np.linspace', (['(-1.2)', '(2)', 'n_samples'], {}), '(-1.2, 2, n_samples)\n', (1041, 1061), True, 'import numpy as np\n'), ((1408, 1433), 'numpy.linspace', 'np.linspace', (['(-1.4)', '(2)', '(100)'], {}), '(-1.4, 2, 100)\n', (1419, 1433), True, 'import numpy as np\n'), ((1518, 1548), ...
__author__ = "<NAME>" __copyright__ = "Copyright 2017, Stanford University" __license__ = "MIT" import sys from deepchem.models import KerasModel from deepchem.models.layers import AtomicConvolution from deepchem.models.losses import L2Loss from tensorflow.keras.layers import Input, Layer import numpy as np import t...
[ "tensorflow.equal", "numpy.sqrt", "tensorflow.reduce_sum", "numpy.array", "tensorflow.random.truncated_normal", "tensorflow.keras.layers.Input", "numpy.reshape", "deepchem.models.losses.L2Loss", "itertools.product", "tensorflow.matmul", "tensorflow.zeros_like", "tensorflow.zeros", "tensorflo...
[((1263, 1293), 'tensorflow.Variable', 'tf.Variable', (['weights'], {'name': '"""w"""'}), "(weights, name='w')\n", (1274, 1293), True, 'import tensorflow as tf\n'), ((1300, 1329), 'tensorflow.Variable', 'tf.Variable', (['biases'], {'name': '"""b"""'}), "(biases, name='b')\n", (1311, 1329), True, 'import tensorflow as t...
import math import os from copy import deepcopy from ast import literal_eval import pandas as pd from math import factorial import random from collections import Counter, defaultdict import sys from nltk import word_tokenize from tqdm import tqdm, trange import argparse import numpy as np import re import csv from skle...
[ "pandas.read_csv", "copy.deepcopy", "argparse.ArgumentParser", "os.path.split", "os.path.isdir", "numpy.random.seed", "os.mkdir", "random.randint", "numpy.random.permutation", "random.choice", "sklearn.model_selection.train_test_split", "csv.writer", "ast.literal_eval", "os.path.isfile", ...
[((21335, 21360), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (21358, 21360), False, 'import argparse\n'), ((22879, 22901), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (22890, 22901), False, 'import random\n'), ((22906, 22931), 'numpy.random.seed', 'np.random.seed', (...
from typing import Optional, Tuple, Union import numpy as np import pandas as pd import pyvista as pv from pyvista import DataSet, MultiBlock, PolyData, UnstructuredGrid try: from typing import Literal except ImportError: from typing_extensions import Literal from .ddrtree import DDRTree, cal_ncenter from .s...
[ "simpleppt.ppt", "pyvista.PolyData", "pandas.merge", "numpy.asarray", "numpy.real", "numpy.dot", "numpy.empty", "numpy.vstack", "numpy.nonzero", "pandas.DataFrame", "numpy.triu" ]
[((4270, 4302), 'numpy.triu', 'np.triu', (['matrix_edges_weights', '(1)'], {}), '(matrix_edges_weights, 1)\n', (4277, 4302), True, 'import numpy as np\n'), ((5574, 5587), 'numpy.asarray', 'np.asarray', (['X'], {}), '(X)\n', (5584, 5587), True, 'import numpy as np\n'), ((5603, 5657), 'simpleppt.ppt', 'simpleppt.ppt', ([...
# sacher_epos.py, python wrapper for sacher epos motor # <NAME> <<EMAIL>>, August 2014 # """ Possbily Maxon EPOS now """ """ This is the actual version that works But only in the lab32 virtual environment """ # from instrument import Instrument # import qt import ctypes import ctypes.wintypes import logging import t...
[ "numpy.sqrt", "time.sleep", "ctypes.create_string_buffer", "ctypes.c_void_p", "logging.error", "ctypes.c_int8", "ctypes.wintypes.DWORD", "ctypes.windll.LoadLibrary", "numpy.ceil", "numpy.int16", "logging.warning", "ctypes.wintypes.WORD", "ctypes.wintypes.BOOL", "ctypes.wintypes.HANDLE", ...
[((1377, 1462), 'ctypes.windll.LoadLibrary', 'ctypes.windll.LoadLibrary', (['"""C:\\\\Users\\\\Carbro\\\\Desktop\\\\Charmander\\\\EposCmd.dll"""'], {}), "('C:\\\\Users\\\\Carbro\\\\Desktop\\\\Charmander\\\\EposCmd.dll'\n )\n", (1402, 1462), False, 'import ctypes\n'), ((6700, 6710), 'numpy.ceil', 'np.ceil', (['d'], {...
# File: Converting_RGB_to_GreyScale.py # Description: Opening RGB image as array, converting to GreyScale and saving result into new file # Environment: PyCharm and Anaconda environment # # MIT License # Copyright (c) 2018 <NAME> # github.com/sichkar-valentyn # # Reference to: # <NAME>. Image processing in Python // Gi...
[ "matplotlib.pyplot.imshow", "skimage.color.rgb2gray", "PIL.Image.open", "numpy.array", "matplotlib.pyplot.figure", "skimage.io.imread", "numpy.array_equal", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((673, 703), 'PIL.Image.open', 'Image.open', (['"""images/eagle.jpg"""'], {}), "('images/eagle.jpg')\n", (683, 703), False, 'from PIL import Image\n'), ((715, 734), 'numpy.array', 'np.array', (['image_RGB'], {}), '(image_RGB)\n', (723, 734), True, 'import numpy as np\n'), ((1054, 1084), 'matplotlib.pyplot.subplots', '...
import math import numpy as np import pandas as pd from sklearn.base import BaseEstimator import sys import os sys.path.append(os.path.abspath('../DecisionTree')) from DecisionTree import DecisionTree class RandomForest(BaseEstimator): """ Simple implementation of Random Forest. This class has implementat...
[ "numpy.random.default_rng", "numpy.average", "math.sqrt", "DecisionTree.DecisionTree", "numpy.empty", "numpy.random.seed", "numpy.concatenate", "numpy.expand_dims", "os.path.abspath", "numpy.shape", "numpy.random.shuffle" ]
[((127, 161), 'os.path.abspath', 'os.path.abspath', (['"""../DecisionTree"""'], {}), "('../DecisionTree')\n", (142, 161), False, 'import os\n'), ((3279, 3309), 'numpy.concatenate', 'np.concatenate', (['(X, y)'], {'axis': '(1)'}), '((X, y), axis=1)\n', (3293, 3309), True, 'import numpy as np\n'), ((3351, 3372), 'numpy.r...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Authors : <NAME> (<EMAIL>) & <NAME> (<EMAIL>) # @Paper : Rethinking Graph Autoencoder Models for Attributed Graph Clustering # @License : MIT License import torch import numpy as np import torch.nn as nn import scipy.sparse as sp import torch.nn.functional as F from t...
[ "numpy.sqrt", "torch.LongTensor", "numpy.log", "sklearn.metrics.adjusted_rand_score", "torch.from_numpy", "sklearn.metrics.precision_score", "numpy.argsort", "numpy.array", "sklearn.metrics.recall_score", "torch.exp", "torch.sum", "numpy.isin", "sklearn.metrics.normalized_mutual_info_score",...
[((664, 703), 'numpy.sqrt', 'np.sqrt', (['(6.0 / (input_dim + output_dim))'], {}), '(6.0 / (input_dim + output_dim))\n', (671, 703), True, 'import numpy as np\n'), ((789, 810), 'torch.nn.Parameter', 'nn.Parameter', (['initial'], {}), '(initial)\n', (801, 810), True, 'import torch.nn as nn\n'), ((1386, 1409), 'numpy.zer...
import math import numpy as np import numpy.random as npr import torch import torch.utils.data as data import torch.utils.data.sampler as torch_sampler from torch.utils.data.dataloader import default_collate from torch._six import int_classes as _int_classes from core.config import cfg from roi_data.minibatch import ...
[ "torch.utils.data.dataloader.default_collate", "numpy.ceil", "roi_data.minibatch.get_minibatch", "numpy.empty", "numpy.random.permutation" ]
[((1746, 1768), 'numpy.empty', 'np.empty', (['(DATA_SIZE,)'], {}), '((DATA_SIZE,))\n', (1754, 1768), True, 'import numpy as np\n'), ((815, 858), 'roi_data.minibatch.get_minibatch', 'get_minibatch', (['single_db', 'self._num_classes'], {}), '(single_db, self._num_classes)\n', (828, 858), False, 'from roi_data.minibatch ...
""" Utility methods for parsing data returned from MapD """ import datetime from collections import namedtuple from sqlalchemy import text import mapd.ttypes as T from ._utils import seconds_to_time Description = namedtuple("Description", ["name", "type_code", "display_size", ...
[ "datetime.datetime", "pyarrow.read_message", "collections.namedtuple", "sqlalchemy.text", "pygdf.gpuarrow.GpuArrowReader", "pyarrow.read_record_batch", "numba.cuda.devicearray.DeviceNDArray", "pygdf.dataframe.DataFrame", "datetime.timedelta", "numba.cuda.cudadrv.drvapi.cu_ipc_mem_handle", "pyarr...
[((216, 334), 'collections.namedtuple', 'namedtuple', (['"""Description"""', "['name', 'type_code', 'display_size', 'internal_size', 'precision', 'scale',\n 'null_ok']"], {}), "('Description', ['name', 'type_code', 'display_size',\n 'internal_size', 'precision', 'scale', 'null_ok'])\n", (226, 334), False, 'from c...
import logging import warnings import dask.dataframe as dd import numpy as np import pandas as pd from featuretools import variable_types as vtypes from featuretools.utils.entity_utils import ( col_is_datetime, convert_all_variable_data, convert_variable_data, get_linked_vars, infer_variable_types...
[ "logging.getLogger", "pandas.Series", "featuretools.utils.entity_utils.convert_variable_data", "featuretools.utils.gen_utils.is_instance", "numpy.sum", "featuretools.utils.entity_utils.convert_all_variable_data", "featuretools.utils.entity_utils.col_is_datetime", "featuretools.utils.entity_utils.get_l...
[((539, 574), 'featuretools.utils.gen_utils.import_or_none', 'import_or_none', (['"""databricks.koalas"""'], {}), "('databricks.koalas')\n", (553, 574), False, 'from featuretools.utils.gen_utils import import_or_none, is_instance\n'), ((585, 628), 'logging.getLogger', 'logging.getLogger', (['"""featuretools.entityset""...
import numpy as np def get_position_of_minimum(matrix): return np.unravel_index(np.nanargmin(matrix), matrix.shape) def get_position_of_maximum(matrix): return np.unravel_index(np.nanargmax(matrix), matrix.shape) def get_distance_matrix(cell_grid_x, cell_grid_y, x, y): return np.sqrt((x - cell_grid_x)...
[ "numpy.nanargmax", "numpy.nanargmin", "numpy.sqrt" ]
[((295, 351), 'numpy.sqrt', 'np.sqrt', (['((x - cell_grid_x) ** 2 + (y - cell_grid_y) ** 2)'], {}), '((x - cell_grid_x) ** 2 + (y - cell_grid_y) ** 2)\n', (302, 351), True, 'import numpy as np\n'), ((86, 106), 'numpy.nanargmin', 'np.nanargmin', (['matrix'], {}), '(matrix)\n', (98, 106), True, 'import numpy as np\n'), (...
import json import copy import pdb import numpy as np import pickle def listify_mat(matrix): matrix = np.array(matrix).astype(str) if len(matrix.shape) > 1: matrix_list = [] for row in matrix: try: matrix_list.append(list(row)) except: pd...
[ "pickle.dump", "numpy.array", "pdb.set_trace", "copy.deepcopy", "json.dump" ]
[((1905, 1920), 'pdb.set_trace', 'pdb.set_trace', ([], {}), '()\n', (1918, 1920), False, 'import pdb\n'), ((108, 124), 'numpy.array', 'np.array', (['matrix'], {}), '(matrix)\n', (116, 124), True, 'import numpy as np\n'), ((555, 584), 'copy.deepcopy', 'copy.deepcopy', (['self._cur_traj'], {}), '(self._cur_traj)\n', (568...
import torch from mmdet.datasets.pipelines.transforms import Pad from mmdet.datasets.pipelines.transforms import FilterBox import numpy as np import cv2 def test_pad(): raw = dict( img=np.zeros((200, 401, 3), dtype=np.uint8) ) cv2.imshow('raw', raw['img']) pad = Pad(square=True, pad_val=255) ...
[ "cv2.imshow", "numpy.array", "numpy.zeros", "mmdet.datasets.pipelines.transforms.FilterBox", "mmdet.datasets.pipelines.transforms.Pad", "cv2.waitKey" ]
[((249, 278), 'cv2.imshow', 'cv2.imshow', (['"""raw"""', "raw['img']"], {}), "('raw', raw['img'])\n", (259, 278), False, 'import cv2\n'), ((289, 318), 'mmdet.datasets.pipelines.transforms.Pad', 'Pad', ([], {'square': '(True)', 'pad_val': '(255)'}), '(square=True, pad_val=255)\n', (292, 318), False, 'from mmdet.datasets...
#coding:utf-8 #0导入模块 ,生成模拟数据集 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import opt4_8_generateds import opt4_8_forward STEPS = 40000 BATCH_SIZE = 30 LEARNING_RATE_BASE = 0.001 LEARNING_RATE_DECAY = 0.999 REGULARIZER = 0.01 def backward(): x = tf.placeholder(tf.float32, shape=(None, ...
[ "tensorflow.Variable", "opt4_8_generateds.generateds", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.get_collection", "opt4_8_forward.forward", "numpy.squeeze", "tensorflow.global_variables_initializer", "matplotlib.pyplot.contour", "tensorflow.train.exponential_decay", "tensorflow...
[((280, 323), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(None, 2)'}), '(tf.float32, shape=(None, 2))\n', (294, 323), True, 'import tensorflow as tf\n'), ((330, 373), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(None, 1)'}), '(tf.float32, shape=(None, 1))\n', (34...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np def remove_nan(xyzs): return xyzs[~np.isnan(xyzs).any(axis = 1)] def measure_twocores(core_xyz_ref, core_xyz_tar): ''' Measure the following aspects of two helical cores. - Interhelical distance vector between the centers. - Inte...
[ "numpy.nanmean", "numpy.dot", "numpy.isnan", "numpy.linalg.norm" ]
[((402, 434), 'numpy.nanmean', 'np.nanmean', (['core_xyz_ref'], {'axis': '(0)'}), '(core_xyz_ref, axis=0)\n', (412, 434), True, 'import numpy as np\n'), ((454, 486), 'numpy.nanmean', 'np.nanmean', (['core_xyz_tar'], {'axis': '(0)'}), '(core_xyz_tar, axis=0)\n', (464, 486), True, 'import numpy as np\n'), ((662, 685), 'n...
# https://medium.com/@kumon/how-to-realize-similarity-search-with-elasticsearch-3dd5641b9adb # https://docs.aws.amazon.com/opensearch-service/latest/developerguide/knn.html import sys import requests import h5py import numpy as np import json import aiohttp import asyncio import time import httpx from requests.auth imp...
[ "statistics.mean", "json.loads", "requests.auth.HTTPBasicAuth", "h5py.File", "numpy.array", "time.time" ]
[((1014, 1050), 'requests.auth.HTTPBasicAuth', 'HTTPBasicAuth', (['"""admin"""', '"""<PASSWORD>"""'], {}), "('admin', '<PASSWORD>')\n", (1027, 1050), False, 'from requests.auth import HTTPBasicAuth\n'), ((2465, 2485), 'h5py.File', 'h5py.File', (['path', '"""r"""'], {}), "(path, 'r')\n", (2474, 2485), False, 'import h5p...
import numpy as np from ctypes import c_void_p from .Shader import Shader from .transforms import * from OpenGL.GL import * class Path: # position=[x1, y1, z1, ..., xn, yn, zn] ; rotation = [[Rx1, Ry1, Rz1], ..., [Rxn, Ryn, Rzn]] def __init__(self, position, rotation=None): self.loadPath(position) ...
[ "numpy.identity", "numpy.array", "ctypes.c_void_p" ]
[((4234, 4248), 'numpy.identity', 'np.identity', (['(4)'], {}), '(4)\n', (4245, 4248), True, 'import numpy as np\n'), ((1016, 1056), 'numpy.array', 'np.array', (['self.vertices'], {'dtype': '"""float32"""'}), "(self.vertices, dtype='float32')\n", (1024, 1056), True, 'import numpy as np\n'), ((1137, 1148), 'ctypes.c_voi...
# standard library imports import os # third party imports import numpy as np from PIL import Image import torch.nn as nn from torchvision import transforms # local imports import config from . import utils from . import geometric_transformer class GeoTransformationInfer(nn.Module): def __init__(self, output_di...
[ "numpy.uint8", "PIL.Image.new", "numpy.moveaxis" ]
[((3034, 3072), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(1568, 224)', '"""white"""'], {}), "('RGB', (1568, 224), 'white')\n", (3043, 3072), False, 'from PIL import Image\n'), ((1872, 1901), 'numpy.uint8', 'np.uint8', (['(model_apparel * 255)'], {}), '(model_apparel * 255)\n', (1880, 1901), True, 'import numpy as ...
from pathlib import Path import h5py import numpy as np from torchvision.datasets.vision import VisionDataset from PIL import Image import requests import zipfile from tqdm import tqdm def download_file_from_google_drive(id, destination): URL = "https://docs.google.com/uc?export=download" session = requests...
[ "PIL.Image.fromarray", "requests.Session", "pathlib.Path", "numpy.square", "numpy.random.seed", "numpy.concatenate", "numpy.arange", "numpy.random.shuffle" ]
[((312, 330), 'requests.Session', 'requests.Session', ([], {}), '()\n', (328, 330), False, 'import requests\n'), ((2396, 2418), 'numpy.random.seed', 'np.random.seed', (['(484347)'], {}), '(484347)\n', (2410, 2418), True, 'import numpy as np\n'), ((2538, 2566), 'numpy.random.shuffle', 'np.random.shuffle', (['font_idxs']...
# Copyright (c) 2020-2022, 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 ...
[ "torch.load", "torch.tensor", "numpy.zeros", "torch.classes.load_library", "numpy.maximum" ]
[((946, 982), 'torch.classes.load_library', 'torch.classes.load_library', (['ths_path'], {}), '(ths_path)\n', (972, 982), False, 'import torch\n'), ((10265, 10296), 'torch.load', 'torch.load', (['"""pytorch_model.bin"""'], {}), "('pytorch_model.bin')\n", (10275, 10296), False, 'import torch\n'), ((9514, 9557), 'torch.t...
#/usr/bin/python __version__ = '1.0' __author__ = '<EMAIL>' ## ## Imports import string import os import errno import shutil import sys import glob import datetime import subprocess import logging as log import numpy as np import csv from io import StringIO import PyPDF2 from sklearn import preprocessing from collecti...
[ "sklearn.preprocessing.LabelEncoder", "numpy.array", "sys.exit", "logging.error", "lxml.etree.tostring", "numpy.arange", "os.path.exists", "xml.etree.cElementTree.XML", "subprocess.Popen", "os.path.lexists", "os.path.isdir", "numpy.empty", "lxml.etree.DTD", "csv.reader", "os.path.isfile"...
[((22060, 22081), 'os.path.lexists', 'os.path.lexists', (['path'], {}), '(path)\n', (22075, 22081), False, 'import os\n'), ((28633, 28654), 'lxml.etree.Element', 'etree.Element', (['"""data"""'], {}), "('data')\n", (28646, 28654), False, 'from lxml import etree\n'), ((28787, 28843), 'lxml.etree.Element', 'etree.Element...
#! /usr/bin/env python # -*- coding: utf-8 -*- # # author: <NAME> # contact: <EMAIL> import torch import SimpleITK as sitk import numpy as np import nibabel as nib from torch.autograd import Variable from skimage.transform import resize from torchvision import transforms from time import gmtime, strftime from tqdm i...
[ "numpy.uint8", "nibabel.load", "torch.from_numpy", "numpy.array", "torch.cuda.is_available", "numpy.empty", "os.system", "torchvision.transforms.ToTensor", "os.path.expanduser", "os.path.dirname", "torchvision.transforms.Normalize", "skimage.transform.resize", "numpy.transpose", "torchvisi...
[((422, 437), 'os.path.expanduser', 'expanduser', (['"""~"""'], {}), "('~')\n", (432, 437), False, 'from os.path import expanduser\n'), ((584, 614), 'os.path.join', 'os.path.join', (['"""/opt/ANTs/bin/"""'], {}), "('/opt/ANTs/bin/')\n", (596, 614), False, 'import os\n'), ((2026, 2111), 'os.path.join', 'os.path.join', (...
import numpy as np from statsmodels.discrete.conditional_models import ( ConditionalLogit, ConditionalPoisson) from statsmodels.tools.numdiff import approx_fprime from numpy.testing import assert_allclose import pandas as pd def test_logit_1d(): y = np.r_[0, 1, 0, 1, 0, 1, 0, 1, 1, 1] g = np.r_[0, 0, 0...
[ "numpy.random.normal", "statsmodels.discrete.conditional_models.ConditionalLogit", "numpy.ones", "numpy.random.poisson", "numpy.hstack", "numpy.testing.assert_allclose", "statsmodels.discrete.conditional_models.ConditionalPoisson", "statsmodels.discrete.conditional_models.ConditionalPoisson.from_formu...
[((420, 452), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (['y', 'x'], {'groups': 'g'}), '(y, x, groups=g)\n', (436, 452), False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((997, 1057), 'numpy.testing.assert_allclose', 'assert_allc...
from abc import ABCMeta, abstractmethod import numpy as np class Agent(object): __metaclass__ = ABCMeta def __init__(self, name, id_, action_num, env): self.name = name self.id_ = id_ self.action_num = action_num # len(env.action_space[id_]) # self.opp_action_space = e...
[ "numpy.random.choice", "numpy.array", "numpy.random.dirichlet", "numpy.sum", "numpy.min" ]
[((1170, 1199), 'numpy.array', 'np.array', (['pi'], {'dtype': 'np.double'}), '(pi, dtype=np.double)\n', (1178, 1199), True, 'import numpy as np\n'), ((1482, 1492), 'numpy.min', 'np.min', (['pi'], {}), '(pi)\n', (1488, 1492), True, 'import numpy as np\n'), ((1559, 1569), 'numpy.sum', 'np.sum', (['pi'], {}), '(pi)\n', (1...
import unittest from musket_core import coders import numpy as np import pandas as pd import os import math fl=__file__ fl=os.path.dirname(fl) class TestCoders(unittest.TestCase): def test_binary_num(self): a=np.array([0,1,0,1]) bc=coders.get_coder("binary",a, None) self.as...
[ "os.path.dirname", "numpy.array", "musket_core.coders.get_coder", "math.isnan" ]
[((134, 153), 'os.path.dirname', 'os.path.dirname', (['fl'], {}), '(fl)\n', (149, 153), False, 'import os\n'), ((237, 259), 'numpy.array', 'np.array', (['[0, 1, 0, 1]'], {}), '([0, 1, 0, 1])\n', (245, 259), True, 'import numpy as np\n'), ((269, 304), 'musket_core.coders.get_coder', 'coders.get_coder', (['"""binary"""',...
''' @file momentum_kinematics_optimizer.py @package momentumopt @author <NAME> (<EMAIL>) @license License BSD-3-Clause @copyright Copyright (c) 2019, New York University and Max Planck Gesellschaft. @date 2019-10-08 ''' import os import numpy as np from momentumopt.kinoptpy.qp import QpSolver from momentumopt.kinoptp...
[ "numpy.all", "pinocchio.integrate", "pinocchio.neutral", "numpy.zeros", "pinocchio.RobotWrapper", "numpy.vstack", "numpy.linalg.norm", "numpy.matrix", "momentumopt.kinoptpy.inverse_kinematics.PointContactInverseKinematics" ]
[((3951, 3989), 'numpy.zeros', 'np.zeros', (['(num_time_steps, num_eff, 3)'], {}), '((num_time_steps, num_eff, 3))\n', (3959, 3989), True, 'import numpy as np\n'), ((4015, 4053), 'numpy.zeros', 'np.zeros', (['(num_time_steps, num_eff, 3)'], {}), '((num_time_steps, num_eff, 3))\n', (4023, 4053), True, 'import numpy as n...
import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt # NOT -> ParameterModule # NOT -> children_and_parameters # NOT -> flatten_model # NOT -> lr_range # NOT -> scheduling functions # NOT -> SmoothenValue # YES -> lr_find # NOT -> plot_lr_find # NOT TO BE MODIFIED class ParameterModu...
[ "numpy.array", "matplotlib.pyplot.FormatStrFormatter", "numpy.cos", "torch.isnan", "matplotlib.pyplot.subplots", "torch.device" ]
[((1675, 1688), 'numpy.array', 'np.array', (['res'], {}), '(res)\n', (1683, 1688), True, 'import numpy as np\n'), ((4280, 4300), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (4292, 4300), False, 'import torch\n'), ((9315, 9333), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), ...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Calibration Controller Performs calibration for hue, center of camera position, and servo offsets """ import os import cv2 import time import json import argparse import datetime import numpy as np import logging as log from env import Moa...
[ "numpy.radians", "time.sleep", "numpy.arctan2", "numpy.sin", "logging.info", "hardware.plate_angles_to_servo_positions", "numpy.mean", "argparse.ArgumentParser", "env.MoabEnv", "numpy.linspace", "numpy.degrees", "numpy.abs", "controllers.pid_controller", "logging.warning", "os.path.isfil...
[((3843, 3885), 'logging.warning', 'log.warning', (['f"""Offset calibration failed."""'], {}), "(f'Offset calibration failed.')\n", (3854, 3885), True, 'import logging as log\n'), ((4006, 4017), 'time.time', 'time.time', ([], {}), '()\n', (4015, 4017), False, 'import time\n'), ((4031, 4044), 'common.Vector2', 'Vector2'...
import cv2 import os import numpy as np from PIL import Image def frame2video(im_dir, video_dir, fps): im_list = os.listdir(im_dir) im_list.sort(key=lambda x: int(x.replace("_RBPNF7", "").split('.')[0])) img = Image.open(os.path.join(im_dir, im_list[0])) img_size = img.size # 获得图片分辨率,im_dir文件夹下的图片分辨率...
[ "numpy.fromfile", "os.listdir", "os.path.join", "cv2.VideoWriter", "cv2.VideoWriter_fourcc" ]
[((119, 137), 'os.listdir', 'os.listdir', (['im_dir'], {}), '(im_dir)\n', (129, 137), False, 'import os\n'), ((338, 369), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'XVID'"], {}), "(*'XVID')\n", (360, 369), False, 'import cv2\n'), ((388, 437), 'cv2.VideoWriter', 'cv2.VideoWriter', (['video_dir', 'fourcc', ...
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.colors as colors from numpy import array from numpy import max map = Basemap(llcrnrlon=-0.5,llcrnrlat=39.8,urcrnrlon=4.,urcrnrlat=43., resolution='i', projection='tmerc', lat_0 = 39.5, lon_0 = 1) map.readshapefil...
[ "matplotlib.pyplot.show", "numpy.array", "mpl_toolkits.basemap.Basemap", "matplotlib.pyplot.figure", "matplotlib.colors.LogNorm" ]
[((162, 293), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'llcrnrlon': '(-0.5)', 'llcrnrlat': '(39.8)', 'urcrnrlon': '(4.0)', 'urcrnrlat': '(43.0)', 'resolution': '"""i"""', 'projection': '"""tmerc"""', 'lat_0': '(39.5)', 'lon_0': '(1)'}), "(llcrnrlon=-0.5, llcrnrlat=39.8, urcrnrlon=4.0, urcrnrlat=43.0,\n resol...
# test_fluxqubit.py # meant to be run with 'pytest' # # This file is part of scqubits. # # Copyright (c) 2019 and later, <NAME> and <NAME> # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ##############...
[ "numpy.linspace" ]
[((788, 815), 'numpy.linspace', 'np.linspace', (['(0.45)', '(0.55)', '(50)'], {}), '(0.45, 0.55, 50)\n', (799, 815), True, 'import numpy as np\n')]
from calendar import c from typing import Dict, List, Union from zlib import DEF_BUF_SIZE import json_lines import numpy as np import re from sklearn.preprocessing import MultiLabelBinarizer from sklearn.manifold import TSNE from sklearn.preprocessing import StandardScaler import pandas as pd import json from scipy.spa...
[ "sklearn.manifold.TSNE", "numpy.diag", "sklearn.preprocessing.StandardScaler", "os.path.dirname", "os.chdir", "numpy.array", "scipy.sparse.linalg.svds", "scipy.spatial.distance.chebyshev", "pandas.DataFrame", "re.sub", "sklearn.preprocessing.MultiLabelBinarizer" ]
[((1288, 1309), 'sklearn.preprocessing.MultiLabelBinarizer', 'MultiLabelBinarizer', ([], {}), '()\n', (1307, 1309), False, 'from sklearn.preprocessing import MultiLabelBinarizer\n'), ((1442, 1481), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': '(2)', 'learning_rate': '(200)'}), '(n_components=2, learning_rate=...
import functools import json from os.path import abspath, dirname, exists, join from typing import Dict, Sequence import numpy as np import pandas as pd import torch from pymatgen.core import Composition from torch.utils.data import Dataset class CompositionData(Dataset): def __init__( self, df: ...
[ "os.path.exists", "numpy.atleast_2d", "torch.LongTensor", "torch.stack", "torch.Tensor", "pymatgen.core.Composition", "numpy.max", "numpy.sum", "torch.tensor", "numpy.vstack", "json.load", "functools.lru_cache", "os.path.abspath", "torch.cat" ]
[((2395, 2428), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (2414, 2428), False, 'import functools\n'), ((4310, 4331), 'torch.Tensor', 'torch.Tensor', (['weights'], {}), '(weights)\n', (4322, 4331), False, 'import torch\n'), ((4351, 4373), 'torch.Tensor', 'torch.Tensor',...
# coding=utf-8 # Copyright 2019 The Tensor2Tensor Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
[ "jax.numpy.abs", "tensor2tensor.trax.trax.get_random_number_generator_and_set_seed", "absl.logging.info", "tensor2tensor.trax.optimizers.Adam", "jax.jit", "jax.numpy.mean", "jax.random.split", "tensor2tensor.trax.layers.LogSoftmax", "tensorflow.io.gfile.GFile", "jax.numpy.std", "absl.logging.vlo...
[((20220, 20263), 'functools.partial', 'functools.partial', (['jit'], {'static_argnums': '(3,)'}), '(jit, static_argnums=(3,))\n', (20237, 20263), False, 'import functools\n'), ((21315, 21363), 'functools.partial', 'functools.partial', (['jit'], {'static_argnums': '(2, 3, 4)'}), '(jit, static_argnums=(2, 3, 4))\n', (21...
""" Data: Temperature and Salinity time series from SIO Scripps Pier Salinity: measured in PSU at the surface (~0.5m) and at depth (~5m) Temp: measured in degrees C at the surface (~0.5m) and at depth (~5m) - Timestamp included beginning in 1990 """ # imports import sys,os import pandas as pd import numpy as...
[ "numpy.mean", "matplotlib.pyplot.savefig", "SIO_modules.var_fft", "pandas.read_csv", "numpy.polyfit", "scipy.signal.filtfilt", "pandas.DataFrame", "numpy.conj", "scipy.signal.butter", "numpy.zeros", "importlib.reload", "pandas.read_excel", "numpy.poly1d", "matplotlib.pyplot.subplots", "p...
[((482, 497), 'importlib.reload', 'reload', (['SIO_mod'], {}), '(SIO_mod)\n', (488, 497), False, 'from importlib import reload\n'), ((539, 661), 'pandas.read_csv', 'pd.read_csv', (['"""/Users/MMStoll/Python/Data/Ocean569_Data/SIO_Data/SIO_SALT_1916-201905.txt"""'], {'sep': '"""\t"""', 'skiprows': '(27)'}), "(\n '/Us...
import numpy as np def normalize(x): return x / np.linalg.norm(x) def norm_sq(v): return np.dot(v,v) def norm(v): return np.linalg.norm(v) def get_sub_keys(v): if type(v) is not tuple and type(v) is not list: return [] return [k for k in v if type(k) is str] def to_vec3(v): if isinstance(v, (float, int)): ...
[ "numpy.count_nonzero", "numpy.array", "numpy.dot", "numpy.linalg.norm" ]
[((93, 105), 'numpy.dot', 'np.dot', (['v', 'v'], {}), '(v, v)\n', (99, 105), True, 'import numpy as np\n'), ((127, 144), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {}), '(v)\n', (141, 144), True, 'import numpy as np\n'), ((50, 67), 'numpy.linalg.norm', 'np.linalg.norm', (['x'], {}), '(x)\n', (64, 67), True, 'import...
# -*- coding:utf-8 -*- # ------------------------ # written by <NAME> # 2018-10 # ------------------------ import os import skimage.io from skimage.color import rgb2gray import skimage.transform from scipy.io import loadmat import numpy as np import cv2 import math import warnings import random import torch import mat...
[ "os.path.exists", "numpy.multiply", "skimage.color.rgb2gray", "math.floor", "scipy.io.loadmat", "os.path.join", "cv2.getGaussianKernel", "numpy.zeros", "os.mkdir", "random.random", "warnings.filterwarnings" ]
[((342, 375), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (365, 375), False, 'import warnings\n'), ((434, 455), 'numpy.zeros', 'np.zeros', (['image.shape'], {}), '(image.shape)\n', (442, 455), True, 'import numpy as np\n'), ((1505, 1538), 'os.path.join', 'os.path.join',...
#! /usr/bin/env python import copy from copy import deepcopy import rospy import threading import quaternion import numpy as np from geometry_msgs.msg import Point from visualization_msgs.msg import * from franka_interface import ArmInterface from panda_robot import PandaArm import matplotlib.pyplot as plt from scipy.s...
[ "numpy.block", "quaternion.as_float_array", "numpy.linalg.multi_dot", "rospy.init_node", "numpy.array", "rospy.Rate", "numpy.sin", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.subtract", "numpy.dot", "numpy.diagflat", "panda_robot.PandaArm", "numpy.identity", "quaternion....
[((353, 385), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (372, 385), True, 'import numpy as np\n'), ((2012, 2154), 'numpy.array', 'np.array', (['[[Kp, 0, 0, 0, 0, 0], [0, Kp, 0, 0, 0, 0], [0, 0, Kpz, 0, 0, 0], [0, 0, 0,\n Ko, 0, 0], [0, 0, 0, 0, Ko, 0], [0, 0, 0, ...
""" transforms.py is for shape-preserving functions. """ import numpy as np def shift(values: np.ndarray, periods: int, axis: int, fill_value) -> np.ndarray: new_values = values if periods == 0 or values.size == 0: return new_values.copy() # make sure array sent to np.roll is c_con...
[ "numpy.intp" ]
[((564, 580), 'numpy.intp', 'np.intp', (['periods'], {}), '(periods)\n', (571, 580), True, 'import numpy as np\n')]
import random import math from functools import partial import json import pysndfx import librosa import numpy as np import torch from ops.audio import ( read_audio, compute_stft, trim_audio, mix_audio_and_labels, shuffle_audio, cutout ) SAMPLE_RATE = 44100 class Augmentation: """A base class for data...
[ "random.uniform", "random.choice", "ops.audio.compute_stft", "numpy.flipud", "random.randrange", "ops.audio.mix_audio_and_labels", "numpy.random.randint", "ops.audio.shuffle_audio", "pysndfx.AudioEffectsChain", "ops.audio.read_audio", "numpy.random.uniform", "numpy.expand_dims", "numpy.trans...
[((2606, 2636), 'ops.audio.read_audio', 'read_audio', (["inputs['filename']"], {}), "(inputs['filename'])\n", (2616, 2636), False, 'from ops.audio import read_audio, compute_stft, trim_audio, mix_audio_and_labels, shuffle_audio, cutout\n'), ((2962, 3058), 'ops.audio.compute_stft', 'compute_stft', (["inputs['audio']"], ...
#!/usr/env/bin python import os # os.environ['OMP_NUM_THREADS'] = '1' from newpoisson import poisson import numpy as np from fenics import set_log_level, File, RectangleMesh, Point mesh = RectangleMesh(Point(0,0), Point(1,1), 36, 36) # comm = mesh.mpi_comm() set_log_level(40) # ERROR=40 # from mpi4py import MPI # com...
[ "fenics.Point", "numpy.random.rand", "argparse.ArgumentParser", "fenics.set_log_level", "numpy.random.randn", "fenics.File", "newpoisson.poisson" ]
[((261, 278), 'fenics.set_log_level', 'set_log_level', (['(40)'], {}), '(40)\n', (274, 278), False, 'from fenics import set_log_level, File, RectangleMesh, Point\n'), ((203, 214), 'fenics.Point', 'Point', (['(0)', '(0)'], {}), '(0, 0)\n', (208, 214), False, 'from fenics import set_log_level, File, RectangleMesh, Point\...
import streamlit as st import math from scipy.stats import * import pandas as pd import numpy as np from plotnine import * def app(): # title of the app st.subheader("Proportions") st.sidebar.subheader("Proportion Settings") prop_choice = st.sidebar.radio("",["One Proportion","Two Proportions"]) ...
[ "streamlit.markdown", "math.sqrt", "streamlit.write", "streamlit.radio", "streamlit.sidebar.radio", "streamlit.sidebar.subheader", "streamlit.subheader", "streamlit.text_input", "pandas.DataFrame", "streamlit.columns", "numpy.arange" ]
[((162, 189), 'streamlit.subheader', 'st.subheader', (['"""Proportions"""'], {}), "('Proportions')\n", (174, 189), True, 'import streamlit as st\n'), ((194, 237), 'streamlit.sidebar.subheader', 'st.sidebar.subheader', (['"""Proportion Settings"""'], {}), "('Proportion Settings')\n", (214, 237), True, 'import streamlit ...
#Answer Generation import csv import os import numpy as np from keras.models import * from keras.models import Model from keras.preprocessing import text def load_model(): print('\nLoading model...') # load json and create model json_file = open('models/MODEL.json', 'r') loaded_model_json = json_file...
[ "os.path.exists", "keras.preprocessing.text.Tokenizer", "numpy.argmax", "os.path.isfile", "os.mkdir", "numpy.load", "csv.reader" ]
[((976, 1017), 'numpy.load', 'np.load', (['"""data/vectorized/Test_title.npy"""'], {}), "('data/vectorized/Test_title.npy')\n", (983, 1017), True, 'import numpy as np\n'), ((1045, 1088), 'numpy.load', 'np.load', (['"""data/vectorized/Test_summary.npy"""'], {}), "('data/vectorized/Test_summary.npy')\n", (1052, 1088), Tr...
"""Non-linear SPDE model on a periodic 1D spatial domain for laminar wave fronts. Based on the Kuramato--Sivashinsky PDE model [1, 2] which exhibits spatio-temporally chaotic dynamics. References: 1. Kuramoto and Tsuzuki. Persistent propagation of concentration waves in dissipative media far from thermal ...
[ "dapy.models.transforms.fft.irfft", "dapy.models.transforms.rfft_coeff_to_real_array", "numpy.exp", "dapy.integrators.etdrk4.FourierETDRK4Integrator", "numpy.zeros", "dapy.models.transforms.real_array_to_rfft_coeff", "numpy.arange" ]
[((6910, 6989), 'dapy.models.transforms.rfft_coeff_to_real_array', 'rfft_coeff_to_real_array', (['(state_noise_kernel + 1.0j * state_noise_kernel)', '(False)'], {}), '(state_noise_kernel + 1.0j * state_noise_kernel, False)\n', (6934, 6989), False, 'from dapy.models.transforms import OneDimensionalFourierTransformedDiag...
import matplotlib.pyplot as plt import numpy as np import sys sys.path.append('../../../software/models/') import dftModel as DFT import math k0 = 8.5 N = 64 w = np.ones(N) x = np.cos(2*np.pi*k0/N*np.arange(-N/2,N/2)) mX, pX = DFT.dftAnal(x, w, N) y = DFT.dftSynth(mX, pX, N) plt.figure(1, figsize=(9.5, 5)) plt.subpl...
[ "matplotlib.pyplot.savefig", "numpy.ones", "numpy.arange", "matplotlib.pyplot.axis", "matplotlib.pyplot.subplot", "matplotlib.pyplot.figure", "dftModel.dftAnal", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.title", "sys.path.append", "dftModel.dftSynth", "matplotlib.pyplot.show" ]
[((63, 107), 'sys.path.append', 'sys.path.append', (['"""../../../software/models/"""'], {}), "('../../../software/models/')\n", (78, 107), False, 'import sys\n'), ((164, 174), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (171, 174), True, 'import numpy as np\n'), ((229, 249), 'dftModel.dftAnal', 'DFT.dftAnal', (['x'...
import pytest import numpy as np from fanok.selection import adaptive_significance_threshold @pytest.mark.parametrize( "w, q, offset, expected", [ ([1, 2, 3, 4, 5], 0.1, 0, 1), ([-1, 2, -3, 4, 5], 0.1, 0, 4), ([-3, -2, -1, 0, 1, 2, 3], 0.1, 0, np.inf), ([-3, -2, -1, 0, 1, 2, ...
[ "fanok.selection.adaptive_significance_threshold", "pytest.mark.parametrize", "numpy.array" ]
[((98, 480), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""w, q, offset, expected"""', '[([1, 2, 3, 4, 5], 0.1, 0, 1), ([-1, 2, -3, 4, 5], 0.1, 0, 4), ([-3, -2, -1,\n 0, 1, 2, 3], 0.1, 0, np.inf), ([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, \n 9, 10], 0.1, 0, 4), ([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8...
# Copyright 2019 <NAME> # License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import math import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as tf import librosa.filters as filters from aps.const import EPSILON from typing import Optional, Union, Tuple def init_wind...
[ "torch.nn.functional.conv1d", "math.log2", "torch.hann_window", "torch.sin", "torch.cos", "torch.sum", "torch.nn.functional.pad", "torch.repeat_interleave", "torch.arange", "numpy.arange", "math.gcd", "torch.unsqueeze", "torch.eye", "torch.matmul", "numpy.abs", "torch.transpose", "li...
[((2301, 2317), 'torch.fft', 'th.fft', (['(I / S)', '(1)'], {}), '(I / S, 1)\n', (2307, 2317), True, 'import torch as th\n'), ((2531, 2569), 'torch.reshape', 'th.reshape', (['K', '(B * 2, 1, K.shape[-1])'], {}), '(K, (B * 2, 1, K.shape[-1]))\n', (2541, 2569), True, 'import torch as th\n'), ((3742, 3847), 'librosa.filte...
""" Module for plotting analyses """ import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from copy import deepcopy import pickle, json import os from matplotlib.offsetbox import AnchoredOffsetbox try: basestring except NameError: basestring = str colorList = [[0.42, 0.67, 0.84], [0....
[ "numpy.abs", "matplotlib.offsetbox.VPacker", "matplotlib.patches.Rectangle", "matplotlib.offsetbox.AuxTransformBox", "os.path.join", "numpy.max", "os.path.isfile", "matplotlib.pyplot.close", "matplotlib.offsetbox.TextArea", "matplotlib.offsetbox.AnchoredOffsetbox.__init__", "matplotlib.style.use...
[((970, 999), 'copy.deepcopy', 'deepcopy', (['mpl.rcParamsDefault'], {}), '(mpl.rcParamsDefault)\n', (978, 999), False, 'from copy import deepcopy\n'), ((2219, 2271), 'matplotlib.pyplot.subplots', 'plt.subplots', (['nrows', 'ncols'], {'figsize': 'figSize', 'dpi': 'dpi'}), '(nrows, ncols, figsize=figSize, dpi=dpi)\n', (...
import os import time import cv2 import sys sys.path.append('..') import numpy as np from math import cos, sin from lib.FSANET_model import * import numpy as np from keras.layers import Average def draw_axis(img, yaw, pitch, roll, tdx=None, tdy=None, size = 50): print(yaw,roll,pitch) pitch = pitch * np.pi /...
[ "cv2.rectangle", "cv2.resize", "os.makedirs", "cv2.normalize", "cv2.dnn.readNetFromCaffe", "cv2.imshow", "math.cos", "numpy.array", "os.path.sep.join", "cv2.waitKey", "numpy.empty", "cv2.VideoCapture", "numpy.expand_dims", "time.time", "numpy.shape", "math.sin", "sys.path.append", ...
[((45, 66), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (60, 66), False, 'import sys\n'), ((3243, 3278), 'os.makedirs', 'os.makedirs', (['"""./img"""'], {'exist_ok': '(True)'}), "('./img', exist_ok=True)\n", (3254, 3278), False, 'import os\n'), ((4861, 4915), 'os.path.sep.join', 'os.path.sep.j...
#!//anaconda/envs/py36/bin/python # # File name: kmc_pld.py # Date: 2018/08/03 09:07 # Author: <NAME> # # Description: # import numpy as np from collections import Counter class EventTree: """ Class maintaining a binary tree for random event type lookup and arrays for choosing specific even...
[ "collections.Counter", "numpy.array", "numpy.random.random" ]
[((1264, 1305), 'collections.Counter', 'Counter', (["[e['type'] for e in self.events]"], {}), "([e['type'] for e in self.events])\n", (1271, 1305), False, 'from collections import Counter\n'), ((724, 741), 'numpy.array', 'np.array', (['e_ratio'], {}), '(e_ratio)\n', (732, 741), True, 'import numpy as np\n'), ((1958, 19...
import os os.environ['CUDA_VISIBLE_DEVICES'] = '2' import torch torch.rand(10) import torch.nn as nn import torch.nn.functional as F import glob from tqdm import tqdm, trange print(torch.cuda.is_available()) print(torch.cuda.get_device_name()) print(torch.cuda.current_device()) device = torch.device('cuda' if torch.cu...
[ "torch.from_numpy", "numpy.array", "torch.cuda.is_available", "matplotlib.pyplot.imshow", "os.listdir", "numpy.asarray", "torch.cuda.memory_reserved", "my_utils.xyxy_2_xyxyo", "torch.cuda.current_device", "glob.glob", "random.choice", "cv2.cvtColor", "cv2.resize", "cv2.imread", "utils.to...
[((64, 78), 'torch.rand', 'torch.rand', (['(10)'], {}), '(10)\n', (74, 78), False, 'import torch\n'), ((1189, 1206), 'utils.torch_utils.select_device', 'select_device', (['""""""'], {}), "('')\n", (1202, 1206), False, 'from utils.torch_utils import select_device, load_classifier, time_synchronized\n'), ((2183, 2238), '...
from . import model import numpy as np from scipy import special, stats class RoyleNicholsModel(model.UnmarkedModel): def __init__(self, det_formula, abun_formula, data): self.response = model.Response(data.y) abun = model.Submodel("Abundance", "abun", abun_formula, np.exp, data.site_covs) ...
[ "numpy.tile", "scipy.stats.poisson.pmf", "numpy.random.poisson", "numpy.exp", "numpy.array", "scipy.stats.binom.logpmf", "numpy.empty", "numpy.random.binomial" ]
[((522, 533), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (530, 533), True, 'import numpy as np\n'), ((1524, 1549), 'numpy.random.poisson', 'np.random.poisson', (['lam', 'N'], {}), '(lam, N)\n', (1541, 1549), True, 'import numpy as np\n'), ((1631, 1647), 'numpy.empty', 'np.empty', (['(N, J)'], {}), '((N, J))\n', (...
#Contains the functions needed to process both chords and regularized beards # proc_chords is used for chords #proc_beard_regularize for generating beards #proc_pdf saves pdfs of a variable below cloud base #Both have a large overlap, but I split them in two to keep the one script from getting to confusing. import nu...
[ "numpy.sqrt", "math.floor", "numpy.hstack", "numpy.log", "scipy.interpolate.interp1d", "numpy.array", "sys.exit", "scipy.interpolate.interp2d", "numpy.mean", "numpy.savez", "numpy.histogram", "numpy.where", "netCDF4.Dataset", "numpy.asarray", "numpy.max", "numpy.exp", "numpy.linspace...
[((2599, 2614), 'time.time', 'ttiimmee.time', ([], {}), '()\n', (2612, 2614), True, 'import time as ttiimmee\n'), ((2799, 2836), 'numpy.array', 'np.array', (['[5, 10, 35, 50, 65, 90, 95]'], {}), '([5, 10, 35, 50, 65, 90, 95])\n', (2807, 2836), True, 'import numpy as np\n'), ((4604, 4636), 'netCDF4.Dataset', 'Dataset', ...
#! /usr/bin/env python3 """Parse through the simulated sequencing group specific kmer counts.""" import argparse as ap from collections import OrderedDict import glob import gzip import os import sys import time import numpy as np import multiprocessing as mp SAMPLES = OrderedDict() KMERS = {} HAMMING = OrderedDict() ...
[ "os.path.exists", "collections.OrderedDict", "numpy.median", "numpy.mean", "argparse.ArgumentParser", "gzip.open", "numpy.array", "os.path.basename" ]
[((271, 284), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (282, 284), False, 'from collections import OrderedDict\n'), ((306, 319), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (317, 319), False, 'from collections import OrderedDict\n'), ((1866, 1884), 'numpy.array', 'np.array', (['covera...
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Train a new model on one or across multiple GPUs. """ import collections import logging import math import os im...
[ "logging.getLogger", "fairseq.options.parse_args_and_arch", "fairseq.logging.metrics.get_meter", "fairseq.options.get_training_parser", "fairseq.checkpoint_utils.checkpoint_paths", "torch.autograd.profiler.record_function", "fairseq.logging.metrics.reset", "os.remove", "os.path.lexists", "torch.cu...
[((1010, 1048), 'logging.getLogger', 'logging.getLogger', (['"""fairseq_cli.train"""'], {}), "('fairseq_cli.train')\n", (1027, 1048), False, 'import logging\n'), ((9829, 9855), 'fairseq.logging.metrics.aggregate', 'metrics.aggregate', (['"""train"""'], {}), "('train')\n", (9846, 9855), False, 'from fairseq.logging impo...
import torch import torch.nn as nn from torch.nn import functional as F from PIL import Image import cv2 as cv from matplotlib import cm import numpy as np class GradCAM: """ #### Args: layer_name: module name (not child name), if None, will use the last layer befor...
[ "numpy.uint8", "PIL.Image.fromarray", "numpy.asarray", "torch.nn.functional.relu", "torch.no_grad", "cv2.resize", "matplotlib.cm.get_cmap" ]
[((1644, 1659), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1657, 1659), False, 'import torch\n'), ((2015, 2032), 'torch.nn.functional.relu', 'F.relu', (['cam', '(True)'], {}), '(cam, True)\n', (2021, 2032), True, 'from torch.nn import functional as F\n'), ((2200, 2245), 'cv2.resize', 'cv.resize', (['cam', 'im...
"""Generates a random terrain at Minitaur gym environment reset.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(os.path...
[ "numpy.random.random_sample", "inspect.currentframe", "math.sqrt", "numpy.linalg.norm", "os.sys.path.insert", "os.path.dirname", "numpy.array", "numpy.cos", "numpy.random.uniform", "numpy.sin" ]
[((398, 430), 'os.sys.path.insert', 'os.sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (416, 430), False, 'import os, inspect\n'), ((313, 340), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (328, 340), False, 'import os, inspect\n'), ((370, 396), 'os.path.dirname', 'os...
""" VAE on the swirl task. Basically, VAEs don't work. It's probably because the prior isn't very good and/or because the learning signal is pretty weak when both the encoder and decoder change quickly. However, I tried also alternating between the two, and that didn't seem to help. """ from torch.distributions import...
[ "torch.nn.ReLU", "matplotlib.pyplot.plot", "railrl.torch.pytorch_util.np_to_var", "numpy.array", "numpy.random.randn", "numpy.cos", "torch.nn.Linear", "numpy.random.uniform", "numpy.sin", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "torch.randn", "matplotlib.pyplot.legend", "ma...
[((621, 670), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': 'batch_size', 'low': '(0)', 'high': 'T'}), '(size=batch_size, low=0, high=T)\n', (638, 670), True, 'import numpy as np\n'), ((3240, 3260), 'railrl.torch.pytorch_util.np_to_var', 'ptu.np_to_var', (['batch'], {}), '(batch)\n', (3253, 3260), True, 'i...
class FoodClassifier: #Class Attributes: #model - the underlying keras model #labels - the labels to be associated with the activation of each output neuron. #Labels must be the same size as the output layer of the neural network. def __init__(self, modelpath, labels, min_confidence =...
[ "keras.preprocessing.image.img_to_array", "keras.preprocessing.image.ImageDataGenerator", "keras.optimizers.SGD", "numpy.save", "os.path.exists", "os.listdir", "os.path.isdir", "numpy.vstack", "keras.callbacks.EarlyStopping", "numpy.argmax", "keras.models.Sequential", "keras.applications.resne...
[((3487, 3507), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '()\n', (3505, 3507), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((3656, 3673), 'os.listdir', 'listdir', (['location'], {}), '(location)\n', (3663, 3673), False, 'from os import listdir\n'), ((5158...
""" Created on Thu Oct 26 14:19:44 2017 @author: <NAME> - github.com/utkuozbulak """ import os import numpy as np import torch from torch.optim import SGD from torchvision import models from misc_functions import preprocess_image, recreate_image, save_image class ClassSpecificImageGeneration(): """ Pro...
[ "torch.optim.SGD", "misc_functions.recreate_image", "misc_functions.save_image", "misc_functions.preprocess_image", "torchvision.models.alexnet", "numpy.random.uniform" ]
[((2551, 2582), 'torchvision.models.alexnet', 'models.alexnet', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (2565, 2582), False, 'from torchvision import models\n'), ((698, 738), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(255)', '(224, 224, 3)'], {}), '(0, 255, (224, 224, 3))\n', (715, 738), Tru...
#!/usr/bin/env python3 ###### # General Detector # 06.12.2018 / Last Update: 20.05.2021 # LRB ###### import numpy as np import os import sys import tensorflow as tf import hashlib import cv2 import magic import PySimpleGUI as sg import csv import imagehash import face_recognition import subprocess from itertools impo...
[ "cv2.rectangle", "PySimpleGUI.OneLineProgressMeter", "numpy.argsort", "numpy.array", "face_recognition.load_image_file", "tensorflow.gfile.GFile", "PySimpleGUI.OK", "sys.path.append", "tensorflow.Graph", "PySimpleGUI.Popup", "PySimpleGUI.Slider", "pathlib.Path", "subprocess.Popen", "tensor...
[((16564, 16598), 'pathlib.Path', 'Path', (['"""Models/OpenVINO/age-gender"""'], {}), "('Models/OpenVINO/age-gender')\n", (16568, 16598), False, 'from pathlib import Path\n'), ((16953, 16961), 'openvino.inference_engine.IECore', 'IECore', ([], {}), '()\n', (16959, 16961), False, 'from openvino.inference_engine import I...
""" Laplacian of a compressed-sparse graph """ # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # License: BSD import numpy as np from scipy.sparse import isspmatrix, coo_matrix ############################################################################### # Graph laplacian def l...
[ "scipy.sparse.isspmatrix", "numpy.sqrt", "numpy.asarray", "numpy.issubdtype", "numpy.concatenate", "scipy.sparse.coo_matrix" ]
[((2298, 2317), 'scipy.sparse.isspmatrix', 'isspmatrix', (['csgraph'], {}), '(csgraph)\n', (2308, 2317), False, 'from scipy.sparse import isspmatrix, coo_matrix\n'), ((3169, 3210), 'numpy.concatenate', 'np.concatenate', (['[lap.row, diagonal_holes]'], {}), '([lap.row, diagonal_holes])\n', (3183, 3210), True, 'import nu...
from .base import Controller from .base import Action import numpy as np import pandas as pd import logging from collections import namedtuple from tqdm import tqdm logger = logging.getLogger(__name__) CONTROL_QUEST = 'simglucose/params/Quest.csv' PATIENT_PARA_FILE = 'simglucose/params/vpatient_params.csv' ParamTup = ...
[ "logging.getLogger", "numpy.random.normal", "collections.namedtuple", "pandas.read_csv", "numpy.stack", "numpy.random.uniform", "pandas.DataFrame" ]
[((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n'), ((320, 365), 'collections.namedtuple', 'namedtuple', (['"""ParamTup"""', "['basal', 'cf', 'cr']"], {}), "('ParamTup', ['basal', 'cf', 'cr'])\n", (330, 365), False, 'from collections import...
from torch.utils.data import DataLoader from dataset.wiki_dataset import BERTDataset from models.bert_model import * from tqdm import tqdm import numpy as np import pandas as pd import os config = {} config['train_corpus_path'] = './corpus/train_wiki.txt' config['test_corpus_path'] = './corpus/test_wiki.txt' config[...
[ "pandas.read_pickle", "os.path.exists", "os.listdir", "dataset.wiki_dataset.BERTDataset", "pandas.DataFrame", "numpy.power", "os.path.isfile", "numpy.sum", "numpy.zeros", "os.mkdir", "torch.utils.data.DataLoader", "numpy.sin" ]
[((1318, 1497), 'dataset.wiki_dataset.BERTDataset', 'BERTDataset', ([], {'corpus_path': "config['train_corpus_path']", 'word2idx_path': "config['word2idx_path']", 'seq_len': 'self.max_seq_len', 'hidden_dim': 'bertconfig.hidden_size', 'on_memory': '(False)'}), "(corpus_path=config['train_corpus_path'], word2idx_path=con...
#!/usr/bin/env python # # Author: <NAME> <<EMAIL>> # ''' A simple example to run MCSCF with background charges. ''' import numpy from pyscf import gto, scf, mcscf, qmmm mol = gto.M(atom=''' C 1.1879 -0.3829 0.0000 C 0.0000 0.5526 0.0000 O -1.1867 -0.2472 0.0000 H -1.9237 0.3850 0.0000 H ...
[ "pyscf.qmmm.mm_charge", "pyscf.gto.M", "numpy.random.random", "pyscf.mcscf.CASSCF", "pyscf.mcscf.CASCI", "numpy.random.seed", "pyscf.scf.RHF", "numpy.arange" ]
[((178, 526), 'pyscf.gto.M', 'gto.M', ([], {'atom': '"""\nC 1.1879 -0.3829 0.0000\nC 0.0000 0.5526 0.0000\nO -1.1867 -0.2472 0.0000\nH -1.9237 0.3850 0.0000\nH 2.0985 0.2306 0.0000\nH 1.1184 -1.0093 0.8869\nH 1.1184 -1.0093 -0.8869\nH -0.0227 1.1812 0.8852\nH ...
import numpy as np import time import cv2 import colorsys import tensorflow as tf from tensorflow.keras import backend as K from tensorflow.keras.layers import Activation, ReLU, Multiply # Custom objects from backbones package https://github.com/david8862/keras-YOLOv3-model-set/tree/master/common/backbones def mish(...
[ "cv2.rectangle", "tensorflow.keras.layers.Activation", "tensorflow.keras.layers.Multiply", "tensorflow.keras.layers.ReLU", "tensorflow.keras.backend.backend", "colorsys.hsv_to_rgb", "cv2.putText", "numpy.array", "tensorflow.keras.backend.sigmoid", "numpy.random.seed", "numpy.around", "tensorfl...
[((1919, 1982), 'numpy.around', 'np.around', (['(base_anchors * target_shape[::-1] / base_shape[::-1])'], {}), '(base_anchors * target_shape[::-1] / base_shape[::-1])\n', (1928, 1982), True, 'import numpy as np\n'), ((2790, 2811), 'numpy.random.seed', 'np.random.seed', (['(10101)'], {}), '(10101)\n', (2804, 2811), True...
import matplotlib.pyplot as plt import numpy as np import pickle # import csv # from collections import namedtuple # from mpl_toolkits.mplot3d import Axes3D # import matplotlib.animation as animation # import matplotlib.colors as mc class FEModel: def __init__(self, name=None, hist_data=None): self.name =...
[ "matplotlib.pyplot.plot", "pickle.load", "numpy.array", "matplotlib.pyplot.figure", "matplotlib.pyplot.subplots" ]
[((9287, 9317), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(2)', 'ncols': '(3)'}), '(nrows=2, ncols=3)\n', (9299, 9317), True, 'import matplotlib.pyplot as plt\n'), ((9955, 9985), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(2)', 'ncols': '(3)'}), '(nrows=2, ncols=3)\n', (9967, 9985...
import numpy as np from sources import BaseSource from sources.base import BaseSourceWrapper from sources.preloaded import PreLoadedSource import json class WordsSource(BaseSource): def __init__(self, source): self._source = source def __len__(self): return len(self._source) def _remove_...
[ "numpy.mean", "json.loads", "json.dumps", "numpy.array", "numpy.std" ]
[((2030, 2043), 'json.loads', 'json.loads', (['s'], {}), '(s)\n', (2040, 2043), False, 'import json\n'), ((2091, 2108), 'numpy.array', 'np.array', (["d['mu']"], {}), "(d['mu'])\n", (2099, 2108), True, 'import numpy as np\n'), ((2122, 2139), 'numpy.array', 'np.array', (["d['sd']"], {}), "(d['sd'])\n", (2130, 2139), True...
import numpy as np import torch import matplotlib.pyplot as plt from torch import optim, nn from pytorch.xor.multilayer_perceptron import MultilayerPerceptron from pytorch.xor.utils import LABELS, get_toy_data, visualize_results, plot_intermediate_representations input_size = 2 output_size = len(set(LABELS)) num_hidd...
[ "torch.cuda.manual_seed_all", "torch.manual_seed", "matplotlib.pyplot.savefig", "torch.nn.CrossEntropyLoss", "pytorch.xor.utils.get_toy_data", "pytorch.xor.utils.plot_intermediate_representations", "pytorch.xor.multilayer_perceptron.MultilayerPerceptron", "pytorch.xor.utils.visualize_results", "nump...
[((401, 424), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (418, 424), False, 'import torch\n'), ((425, 457), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), '(seed)\n', (451, 457), False, 'import torch\n'), ((458, 478), 'numpy.random.seed', 'np.random.seed', (['seed...
import cv2 from PIL import Image import argparse from pathlib import Path from multiprocessing import Process, Pipe,Value,Array import torch from config import get_config from mtcnn import MTCNN from Learner_trans_tf import face_learner from utils import load_facebank, draw_box_name, prepare_facebank, save_label_score,...
[ "matplotlib.pyplot.ylabel", "sklearn.metrics.auc", "numpy.array", "sklearn.metrics.roc_curve", "sklearn.model_selection.KFold", "utils.prepare_facebank", "os.remove", "os.path.exists", "os.listdir", "argparse.ArgumentParser", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib....
[((651, 711), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""for face verification"""'}), "(description='for face verification')\n", (674, 711), False, 'import argparse\n'), ((2874, 2896), 'config.get_config', 'get_config', (['(True)', 'args'], {}), '(True, args)\n', (2884, 2896), False,...
import numpy as np DEFAULT_FILE_PATH = "utils/datasets/glove.6B.50d.txt" def loadWordVectors(tokens, filepath=DEFAULT_FILE_PATH, dimensions=50): """Read pretrained GloVe vectors""" wordVectors = np.zeros((len(tokens), dimensions)) with open(filepath) as ifs: for line in ifs: line = lin...
[ "numpy.asarray" ]
[((692, 708), 'numpy.asarray', 'np.asarray', (['data'], {}), '(data)\n', (702, 708), True, 'import numpy as np\n')]
import argparse import numpy as np from .._helpers import read, reader_map from ._helpers import _get_version_text def info(argv=None): # Parse command line arguments. parser = _get_info_parser() args = parser.parse_args(argv) # read mesh data mesh = read(args.infile, file_format=args.input_for...
[ "numpy.any", "numpy.zeros", "argparse.ArgumentParser" ]
[((1006, 1113), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Print mesh info."""', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(description='Print mesh info.', formatter_class=\n argparse.RawTextHelpFormatter)\n", (1029, 1113), False, 'import argparse\n'), ((469, 510), 'n...
import sys import os import argparse import logging import json import time import subprocess from shutil import copyfile import numpy as np from sklearn import metrics from easydict import EasyDict as edict import torch from torch.utils.data import DataLoader import torch.nn.functional as F from torch.nn import DataP...
[ "sklearn.metrics.auc", "torch.cuda.device_count", "numpy.array", "sklearn.metrics.roc_curve", "os.path.exists", "tensorboardX.SummaryWriter", "argparse.ArgumentParser", "torch.unsqueeze", "json.dumps", "os.mkdir", "subprocess.getstatusoutput", "utils.misc.lr_schedule", "time.time", "data.d...
[((466, 486), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (483, 486), False, 'import torch\n'), ((487, 516), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['(0)'], {}), '(0)\n', (513, 516), False, 'import torch\n'), ((711, 761), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ...
"""Coordinate changes in state space models.""" import abc try: # cached_property is only available in Python >=3.8 from functools import cached_property except ImportError: from cached_property import cached_property import numpy as np import scipy.special # for vectorised factorial from probnum impor...
[ "numpy.abs", "numpy.eye", "probnum.randvars.Normal", "probnum.linops.Scaling", "numpy.diag", "probnum.linops.Identity", "numpy.arange" ]
[((1145, 1210), 'probnum.randvars.Normal', 'randvars.Normal', (['new_mean', 'new_cov'], {'cov_cholesky': 'new_cov_cholesky'}), '(new_mean, new_cov, cov_cholesky=new_cov_cholesky)\n', (1160, 1210), False, 'from probnum import config, linops, randvars\n'), ((2482, 2506), 'numpy.arange', 'np.arange', (['order', '(-1)', '(...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets from torch.autograd import Variable from sklearn.model_selection import train_test_split import time import pandas as pd import numpy as np import csv batch_size = 128 NUM_EPOC...
[ "numpy.int64", "numpy.reshape", "pandas.read_csv", "sklearn.model_selection.train_test_split", "torch.LongTensor", "torch.nn.LSTM", "torch.unsqueeze", "torch.utils.data.TensorDataset", "torch.nn.Conv2d", "numpy.concatenate", "torch.utils.data.DataLoader", "torch.nn.Linear", "torch.nn.functio...
[((2241, 2281), 'pandas.read_csv', 'pd.read_csv', (['"""./drive/My Drive/DATA.csv"""'], {}), "('./drive/My Drive/DATA.csv')\n", (2252, 2281), True, 'import pandas as pd\n'), ((2387, 2416), 'torch.FloatTensor', 'torch.FloatTensor', (['board_data'], {}), '(board_data)\n', (2404, 2416), False, 'import torch\n'), ((2422, 2...
#!/usr/bin/python3 from PIL import Image from numpy import complex, array from tqdm import tqdm import colorsys W=512 #W=142 def mandelbrot(x, y): def get_colors(i): color = 255 * array(colorsys.hsv_to_rgb(i / 255.0, 1.0, 0.5)) return tuple(color.astype(int)) c, cc = 0, complex(x, y) fo...
[ "numpy.complex", "colorsys.hsv_to_rgb" ]
[((300, 313), 'numpy.complex', 'complex', (['x', 'y'], {}), '(x, y)\n', (307, 313), False, 'from numpy import complex, array\n'), ((202, 242), 'colorsys.hsv_to_rgb', 'colorsys.hsv_to_rgb', (['(i / 255.0)', '(1.0)', '(0.5)'], {}), '(i / 255.0, 1.0, 0.5)\n', (221, 242), False, 'import colorsys\n')]
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # <NAME> # California Institute of Technology # (C) 2006-2010 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
[ "journal.debug", "unittestX.main", "mcni.utils.conversion.e2v", "numpy.array", "mcni.neutron", "numpy.linalg.norm", "journal.warning", "mccomponents.mccomponentsbp.create_Broadened_E_Q_Kernel" ]
[((445, 491), 'journal.debug', 'journal.debug', (['"""Broadened_E_Q_Kernel_TestCase"""'], {}), "('Broadened_E_Q_Kernel_TestCase')\n", (458, 491), False, 'import journal\n'), ((504, 552), 'journal.warning', 'journal.warning', (['"""Broadened_E_Q_Kernel_TestCase"""'], {}), "('Broadened_E_Q_Kernel_TestCase')\n", (519, 552...
# -*- coding: utf-8 -*- """ Created on Mon Sep 7 11:48:59 2020 @author: mazal """ """ ========================================= Support functions of pydicom (Not sourced) ========================================= Purpose: Create support functions for the pydicom project """ """ Test mode 1 | Basics...
[ "distutils.dir_util.mkpath", "distutils.dir_util.create_tree", "distutils.dir_util.copy_tree", "math.log1p", "pandas.read_csv", "numpy.array", "scipy.stats.loglaplace", "os.listdir", "scipy.stats.loglaplace.ppf", "pandas.DataFrame", "random.randrange", "scipy.stats.loglaplace.std", "scipy.st...
[((1713, 1734), 'os.chdir', 'os.chdir', (['path_source'], {}), '(path_source)\n', (1721, 1734), False, 'import os\n'), ((1756, 1779), 'os.listdir', 'os.listdir', (['path_source'], {}), '(path_source)\n', (1766, 1779), False, 'import os\n'), ((2403, 2443), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'Population_Di...
#!/usr/bin/env python3 import sys import re import numpy as np from PIL import Image moves = { 'e': (2, 0), 'se': (1, 2), 'sw': (-1, 2), 'w': (-2, 0), 'nw': (-1, -2), 'ne': (1, -2) } # Save (x, y): True/False in tiles. True = black, False = white. tiles = {} for line in open(sys.argv[1]).read().splitlines(): po...
[ "numpy.copy", "numpy.where", "PIL.Image.new", "numpy.array", "numpy.zeros", "re.findall" ]
[((683, 722), 'numpy.zeros', 'np.zeros', (['(width * heigth)'], {'dtype': 'np.int8'}), '(width * heigth, dtype=np.int8)\n', (691, 722), True, 'import numpy as np\n'), ((1959, 1974), 'numpy.where', 'np.where', (['board'], {}), '(board)\n', (1967, 1974), True, 'import numpy as np\n'), ((324, 340), 'numpy.array', 'np.arra...
import numpy as np import eyekit import algorithms import core data = eyekit.io.load(core.FIXATIONS / 'sample.json') passages = eyekit.io.load(core.DATA / 'passages.json') original_sequence = data['trial_5']['fixations'] fixation_XY = np.array([fixation.xy for fixation in original_sequence], dtype=int) word_XY = np....
[ "eyekit.vis.Image", "eyekit.vis.Figure", "numpy.column_stack", "algorithms.dynamic_time_warping", "eyekit.io.load", "numpy.array" ]
[((71, 117), 'eyekit.io.load', 'eyekit.io.load', (["(core.FIXATIONS / 'sample.json')"], {}), "(core.FIXATIONS / 'sample.json')\n", (85, 117), False, 'import eyekit\n'), ((129, 172), 'eyekit.io.load', 'eyekit.io.load', (["(core.DATA / 'passages.json')"], {}), "(core.DATA / 'passages.json')\n", (143, 172), False, 'import...
#!/usr/bin/python3 ''' This script follows formulas put forth in Kislyuk et al. (2011) to calculate genome fluidity of a pangenome dataset. Variance and standard error are estimated as total variance containing both the variance due to subsampling all possible combinations (without replacement) of N genomes from th...
[ "matplotlib.pyplot.grid", "scipy.optimize.differential_evolution", "matplotlib.pyplot.ylabel", "numpy.array", "random.choices", "sys.exit", "numpy.mean", "argparse.ArgumentParser", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.minorticks_on", "numpy.exp", "os.path....
[((1749, 1760), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1758, 1760), False, 'import os, sys, re, argparse, random, itertools, scipy, warnings, subprocess\n'), ((1921, 2213), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""./%(prog)s [options] -i orthogroups -o output_folder"""', 'descripti...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tools to create profiles (i.e. 1D "slices" from 2D images).""" import numpy as np import scipy.ndimage from astropy import units as u from astropy.convolution import Box1DKernel, Gaussian1DKernel from astropy.coordinates import Angle from astropy.table ...
[ "numpy.sqrt", "astropy.table.Table", "numpy.arange", "numpy.digitize", "matplotlib.pyplot.gca", "numpy.diff", "astropy.convolution.Gaussian1DKernel", "matplotlib.pyplot.figure", "numpy.isnan", "numpy.nanmax", "astropy.convolution.Box1DKernel", "numpy.nansum", "astropy.units.Quantity" ]
[((5684, 5691), 'astropy.table.Table', 'Table', ([], {}), '()\n', (5689, 5691), False, 'from astropy.table import Table\n'), ((8050, 8068), 'astropy.units.Quantity', 'u.Quantity', (['radius'], {}), '(radius)\n', (8060, 8068), True, 'from astropy import units as u\n'), ((12194, 12221), 'matplotlib.pyplot.figure', 'plt.f...
import open3d as o3d import numpy as np pc_load_pathname = '/home/caizhongang/github/waymo_kitti_converter/007283-000.bin' pc = np.fromfile(pc_load_pathname, dtype=np.float32).reshape(-1, 3) pcd = o3d.geometry.PointCloud() pcd.points = o3d.utility.Vector3dVector(pc) axis = o3d.geometry.TriangleMesh.create_coordinat...
[ "numpy.fromfile", "open3d.visualization.draw_geometries", "open3d.geometry.PointCloud", "open3d.geometry.TriangleMesh.create_coordinate_frame", "open3d.utility.Vector3dVector" ]
[((199, 224), 'open3d.geometry.PointCloud', 'o3d.geometry.PointCloud', ([], {}), '()\n', (222, 224), True, 'import open3d as o3d\n'), ((239, 269), 'open3d.utility.Vector3dVector', 'o3d.utility.Vector3dVector', (['pc'], {}), '(pc)\n', (265, 269), True, 'import open3d as o3d\n'), ((278, 353), 'open3d.geometry.TriangleMes...
#!/usr/bin/env python """ Compute diffusion coefficient from MSD data. Time interval, DT, is obtained from in.pmd in the same directory. Usage: msd2diff.py [options] MSD_FILE Options: -h, --help Show this message and exit. -o, --offset OFFSET Offset of given data. [default: 0] --plot Plot ...
[ "seaborn.set", "matplotlib.pyplot.savefig", "matplotlib.pyplot.plot", "os.path.dirname", "numpy.array", "numpy.linalg.lstsq", "docopt.docopt", "numpy.var" ]
[((2111, 2126), 'numpy.var', 'np.var', (['A[:, 0]'], {}), '(A[:, 0])\n', (2117, 2126), True, 'import numpy as np\n'), ((2142, 2178), 'numpy.linalg.lstsq', 'np.linalg.lstsq', (['A', 'msds'], {'rcond': 'None'}), '(A, msds, rcond=None)\n', (2157, 2178), True, 'import numpy as np\n'), ((2436, 2451), 'docopt.docopt', 'docop...
import pytest import numbers import numpy as np from numpy.testing import assert_raises from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import assert_raises_regex from skopt.space import LogN, Normalize @pytest.mark.fast_test def test_logn2_integer(): transf...
[ "numpy.round", "skopt.space.LogN", "numpy.testing.assert_raises", "skopt.space.Normalize" ]
[((328, 335), 'skopt.space.LogN', 'LogN', (['(2)'], {}), '(2)\n', (332, 335), False, 'from skopt.space import LogN, Normalize\n'), ((559, 566), 'skopt.space.LogN', 'LogN', (['(2)'], {}), '(2)\n', (563, 566), False, 'from skopt.space import LogN, Normalize\n'), ((793, 822), 'skopt.space.Normalize', 'Normalize', (['(1)',...
import os import json import numpy as np import pickle from typing import Any from pycocotools.coco import COCO from torch.utils.data import Dataset class DetectionMSCOCODataset(Dataset): def __init__(self, annotation_file: str, image_dir: str): self._annotation_file = annotation_file self._imag...
[ "os.path.exists", "pickle.dump", "pycocotools.coco.COCO", "os.path.join", "pickle.load", "numpy.array", "json.load" ]
[((420, 447), 'pycocotools.coco.COCO', 'COCO', (['self._annotation_file'], {}), '(self._annotation_file)\n', (424, 447), False, 'from pycocotools.coco import COCO\n'), ((1061, 1093), 'os.path.exists', 'os.path.exists', (['self._cache_file'], {}), '(self._cache_file)\n', (1075, 1093), False, 'import os\n'), ((1572, 1584...
# usr/bin/env python """Functions to cluster using UPGMA upgma takes an dictionary of pair tuples mapped to distances as input. UPGMA_cluster takes an array and a list of PhyloNode objects corresponding to the array as input. Can also generate this type of input from a DictArray using inputs_from_dict_array function....
[ "numpy.eye", "numpy.average", "cogent3.core.tree.PhyloNode", "cogent3.util.dict_array.DictArray", "numpy.take", "numpy.argmin", "numpy.ravel" ]
[((1128, 1157), 'cogent3.util.dict_array.DictArray', 'DictArray', (['pairwise_distances'], {}), '(pairwise_distances)\n', (1137, 1157), False, 'from cogent3.util.dict_array import DictArray\n'), ((1944, 1957), 'numpy.ravel', 'ravel', (['matrix'], {}), '(matrix)\n', (1949, 1957), False, 'from numpy import argmin, array,...
import numpy as np from coffeine.covariance_transformers import ( Diag, LogDiag, ExpandFeatures, Riemann, RiemannSnp, NaiveVec) from coffeine.spatial_filters import ( ProjIdentitySpace, ProjCommonSpace, ProjLWSpace, ProjRandomSpace, ProjSPoCSpace) from sklearn.compose impor...
[ "coffeine.covariance_transformers.ExpandFeatures", "sklearn.linear_model.LogisticRegression", "sklearn.preprocessing.StandardScaler", "sklearn.pipeline.make_pipeline", "numpy.logspace" ]
[((8747, 8807), 'sklearn.pipeline.make_pipeline', 'make_pipeline', (['filter_bank_transformer', 'scaling_', 'estimator_'], {}), '(filter_bank_transformer, scaling_, estimator_)\n', (8760, 8807), False, 'from sklearn.pipeline import make_pipeline\n'), ((12164, 12224), 'sklearn.pipeline.make_pipeline', 'make_pipeline', (...
import os import df2img import disnake import numpy as np import pandas as pd from menus.menu import Menu from PIL import Image import discordbot.config_discordbot as cfg from discordbot.config_discordbot import gst_imgur, logger from discordbot.helpers import autocrop_image from gamestonk_terminal.stocks.options imp...
[ "gamestonk_terminal.stocks.options.yfinance_model.option_expirations", "disnake.Embed", "PIL.Image.open", "discordbot.helpers.autocrop_image", "df2img.save_dataframe", "discordbot.config_discordbot.logger.debug", "disnake.SelectOption", "menus.menu.Menu", "os.remove", "numpy.percentile", "discor...
[((860, 901), 'gamestonk_terminal.stocks.options.yfinance_model.option_expirations', 'yfinance_model.option_expirations', (['ticker'], {}), '(ticker)\n', (893, 901), False, 'from gamestonk_terminal.stocks.options import yfinance_model\n'), ((1587, 1617), 'numpy.percentile', 'np.percentile', (["df['strike']", '(1)'], {}...