code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import logging
from typing import List, Dict, Any, Tuple, Callable
import math
import numpy as np
from scipy.special import logit
from fiesta.util import belief_calc
logger = logging.getLogger(__name__)
def TTTS(data: List[Dict[str, Any]],
model_functions: List[Callable[[List[Dict[str, Any]],
... | [
"fiesta.util.belief_calc",
"numpy.random.uniform",
"numpy.argmax",
"numpy.log2",
"numpy.zeros",
"math.floor",
"numpy.argmin",
"scipy.special.logit",
"numpy.mean",
"numpy.var",
"logging.getLogger"
] | [((178, 205), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (195, 205), False, 'import logging\n'), ((3504, 3524), 'numpy.zeros', 'np.zeros', (['num_models'], {}), '(num_models)\n', (3512, 3524), True, 'import numpy as np\n'), ((3545, 3565), 'numpy.zeros', 'np.zeros', (['num_models'], {}... |
from pypot.primitive import LoopPrimitive
from .trajectory import ConstantTrajectory, FootstepTrajectory
from .ik import darwin_ik
from .ik import PELVIS_HEIGHT_REST, FOOT_SPREAD
from numpy import rad2deg
class WalkingState(object):
SINGLE_SUPPORT = 1
DOUBLE_SUPPORT = 2
class WalkStraight(LoopPrimitive):
... | [
"numpy.rad2deg",
"pypot.primitive.LoopPrimitive.__init__"
] | [((396, 442), 'pypot.primitive.LoopPrimitive.__init__', 'LoopPrimitive.__init__', (['self', 'robot', 'frequency'], {}), '(self, robot, frequency)\n', (418, 442), False, 'from pypot.primitive import LoopPrimitive\n'), ((4577, 4587), 'numpy.rad2deg', 'rad2deg', (['q'], {}), '(q)\n', (4584, 4587), False, 'from numpy impor... |
'''
---------------------------
Licensing and Distribution
---------------------------
Program name: Pilgrim
Version : 2021.5
License : MIT/x11
Copyright (c) 2021, <NAME> (<EMAIL>) and
<NAME> (<EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associat... | [
"numpy.matrix",
"common.fncs.angle",
"common.internal.zmat_thirdatom",
"numpy.zeros",
"numpy.hstack",
"numpy.rad2deg",
"common.internal.get_adjmatrix",
"numpy.vstack",
"common.internal.link_fragments"
] | [((2281, 2299), 'numpy.matrix', 'np.matrix', (['cmatrix'], {}), '(cmatrix)\n', (2290, 2299), True, 'import numpy as np\n'), ((2097, 2148), 'common.internal.get_adjmatrix', 'intl.get_adjmatrix', (['xcc', 'symbols', 'cscal'], {'mode': '"""int"""'}), "(xcc, symbols, cscal, mode='int')\n", (2115, 2148), True, 'import commo... |
# %%
import seaborn as sns
import torch
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import torch.nn.functional as F
from perturb_pca import compute_dot_products
from mpl_toolkits.axes_grid1 import make_axes_locatable
# matplotlib.style.use('seaborn-white')
plt.rcParams['font.family'] = 'Cali... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"seaborn.lineplot",
"perturb_pca.compute_dot_products",
"seaborn.despine",
"torch.Tensor",
"numpy.arange",
"matplotlib.pyplot.subplots",
"seaborn.set_theme"
] | [((1989, 2024), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {'figsize': '(18, 6)'}), '(1, 3, figsize=(18, 6))\n', (2001, 2024), True, 'import matplotlib.pyplot as plt\n'), ((3038, 3052), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3050, 3052), True, 'import matplotlib.pyplot as p... |
import json
from collections.__init__ import OrderedDict
import numpy as np
from PIL import Image
from annotation_predictor.util.class_reader import ClassReader
from annotation_predictor.util.oid_classcode_reader import OIDClassCodeReader
from settings import known_class_ids_annotation_predictor, path_to_model_evalua... | [
"json.load",
"numpy.asarray",
"numpy.zeros",
"numpy.expand_dims",
"PIL.Image.open",
"annotation_predictor.util.oid_classcode_reader.OIDClassCodeReader",
"annotation_predictor.util.class_reader.ClassReader"
] | [((1247, 1296), 'annotation_predictor.util.class_reader.ClassReader', 'ClassReader', (['known_class_ids_annotation_predictor'], {}), '(known_class_ids_annotation_predictor)\n', (1258, 1296), False, 'from annotation_predictor.util.class_reader import ClassReader\n'), ((1666, 1680), 'numpy.zeros', 'np.zeros', (['(1000)']... |
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.decomposition import PCA
import pandas as pd
from urllib.request import urlretrieve
import numpy as np
from sklearn.linear_model import LogisticRegression # for Logistic Regression Algorithm
from sklearn.mo... | [
"matplotlib.pyplot.show",
"numpy.nan_to_num",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"matplotlib.pyplot.subplots",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.export_graphviz",
"pydotplus.graph_from_dot_data",
"sklearn.model_select... | [((881, 915), 'pandas.read_csv', 'pd.read_csv', (['"""googleplaystore.csv"""'], {}), "('googleplaystore.csv')\n", (892, 915), True, 'import pandas as pd\n'), ((3249, 3263), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3261, 3263), True, 'import matplotlib.pyplot as plt\n'), ((3518, 3536), 'matplotli... |
import argparse
import os
from collections import defaultdict
from typing import Dict, List
import ipdb
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as F
from torch import nn
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
from yacs.config import CfgN... | [
"argparse.ArgumentParser",
"ipdb.set_trace",
"collections.defaultdict",
"maskrcnn_benchmark.config.cfg.merge_from_list",
"maskrcnn_benchmark.modeling.detector.build_detection_model",
"torch.device",
"torchvision.transforms.Normalize",
"maskrcnn_benchmark.structures.image_list.to_image_list",
"torch.... | [((1350, 1375), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1373, 1375), False, 'import argparse\n'), ((5589, 5658), 'maskrcnn_benchmark.structures.image_list.to_image_list', 'to_image_list', (['batch'], {'size_divisible': 'cfg.DATALOADER.SIZE_DIVISIBILITY'}), '(batch, size_divisible=cfg.DA... |
"""
Generative Adversarial Network for fitting tuning curve generator.
This module implements Wasserstein GAN (`BPTTWassersteinGAN`) to fit
`TuningCurveGenerator`. It is composed of the following components:
- `BPTTWassersteinGAN`
- `.TuningCurveGenerator`: generator
- `UnConditionalDiscriminator`: discriminato... | [
"lasagne.regularization.apply_penalty",
"lasagne.layers.get_all_params",
"numpy.random.RandomState",
"itertools.count",
"lasagne.layers.get_output",
"numpy.array",
"theano.tensor.jacobian",
"theano.tensor.sgn",
"theano.tensor.scalar",
"theano.tensor.matrix"
] | [((2229, 2239), 'theano.tensor.matrix', 'T.matrix', ([], {}), '()\n', (2237, 2239), True, 'from theano import tensor as T\n'), ((2293, 2303), 'theano.tensor.matrix', 'T.matrix', ([], {}), '()\n', (2301, 2303), True, 'from theano import tensor as T\n'), ((2614, 2671), 'lasagne.layers.get_all_params', 'lasagne.layers.get... |
import numpy as np
import os
import shutil
import random
from model_mask_cond import MaskNN
import torch
import sklearn.utils
from torch.nn import functional as F
vector_num = 256
cond_num = 12
rest_pitch = 129
hold_pitch = 128
cpath = "processed_data"
train_path = cpath + "/vae_train_data.npy"
validate_path = cpath + ... | [
"numpy.load",
"model_mask_cond.MaskNN",
"torch.cuda.is_available",
"numpy.array",
"torch.cuda.current_device",
"torch.no_grad",
"torch.from_numpy"
] | [((530, 568), 'numpy.load', 'np.load', (['train_path'], {'allow_pickle': '(True)'}), '(train_path, allow_pickle=True)\n', (537, 568), True, 'import numpy as np\n'), ((582, 619), 'numpy.load', 'np.load', (['test_path'], {'allow_pickle': '(True)'}), '(test_path, allow_pickle=True)\n', (589, 619), True, 'import numpy as n... |
import sys
print(sys.path)
sys.path.append('./')
print(sys.path)
from modeling import build_model
from data.datasets.cuhk_sysu import CUHK_SYSU
from data.datasets.transformer import get_transform
from tools.util import ship_data_to_cuda,draw_box_in_image
from torch.utils.data import DataLoader
import torch
from tqdm i... | [
"sys.path.append",
"data.datasets.transformer.get_transform",
"matplotlib.pyplot.show",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.imshow",
"torch.load",
"numpy.where",
"tools.util.draw_box_in_image",
"tools.util.ship_data_to_cuda"
] | [((27, 48), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (42, 48), False, 'import sys\n'), ((563, 585), 'torch.load', 'torch.load', (['model_path'], {}), '(model_path)\n', (573, 585), False, 'import torch\n'), ((740, 819), 'torch.utils.data.DataLoader', 'DataLoader', (['testset'], {'batch_size'... |
from pathlib import Path
import json
import sys
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import numpy as np
import matplotlib.pyplot as plt
from sklearn.dummy import DummyClassifier
from sklearn.metrics import accuracy_score
from src import DataProcessor,... | [
"matplotlib.pyplot.title",
"pathlib.Path",
"matplotlib.pyplot.figure",
"torch.device",
"torch.no_grad",
"sklearn.dummy.DummyClassifier",
"numpy.zeros_like",
"logging.FileHandler",
"torch.utils.data.DataLoader",
"src.binary_accuracy",
"torch.load",
"torch.cuda.set_device",
"src.Model",
"src... | [((1604, 1621), 'pathlib.Path', 'Path', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1608, 1621), False, 'from pathlib import Path\n'), ((2354, 2381), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2371, 2381), False, 'import logging\n'), ((2399, 2430), 'torch.manual_seed', 'torch.manual_s... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | [
"numpy.frombuffer",
"paddle.fluid.core.GETensor",
"paddle.fluid.core.GEShape",
"numpy.ones"
] | [((5204, 5230), 'paddle.fluid.core.GETensor', 'core.GETensor', (['tensor_desc'], {}), '(tensor_desc)\n', (5217, 5230), True, 'import paddle.fluid.core as core\n'), ((5391, 5425), 'numpy.frombuffer', 'np.frombuffer', (['buf'], {'dtype': 'np.uint8'}), '(buf, dtype=np.uint8)\n', (5404, 5425), True, 'import numpy as np\n')... |
"""
A class that is responsible for detecting a barcode and extracting information
from said barcode.
"""
import numpy as np
import cv2
import zbar.misc
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, Java the Hutts"
__license__ = "BSD"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"... | [
"cv2.GaussianBlur",
"cv2.subtract",
"numpy.int0",
"cv2.dilate",
"cv2.cvtColor",
"cv2.getStructuringElement",
"cv2.threshold",
"cv2.morphologyEx",
"cv2.blur",
"cv2.boxPoints",
"cv2.convertScaleAbs",
"cv2.minAreaRect",
"cv2.erode",
"cv2.boundingRect",
"cv2.Sobel"
] | [((1854, 1893), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (1866, 1893), False, 'import cv2\n'), ((1912, 1968), 'cv2.Sobel', 'cv2.Sobel', (['gray'], {'ddepth': 'cv2.CV_32F', 'dx': '(1)', 'dy': '(0)', 'ksize': '(-1)'}), '(gray, ddepth=cv2.CV_32F, dx=1, dy=0, k... |
# -*- coding: utf-8 -*-
"""nnetwork.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1pMeLa_X6bXVDBF07Nf5ISyPfmGEpurvH
"""
import pandas as pd
import numpy as np
# first neural network with keras tutorial
from numpy import loadtxt
from sklearn.mod... | [
"numpy.random.seed",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"numpy.corrcoef",
"sklearn.model_selection.train_test_split",
"numpy.array",
"tensorflow.keras.models.Sequential",
"tensorflow.test.gpu_device_name"
] | [((495, 520), 'tensorflow.test.gpu_device_name', 'tf.test.gpu_device_name', ([], {}), '()\n', (518, 520), True, 'import tensorflow as tf\n'), ((718, 781), 'pandas.read_csv', 'pd.read_csv', (['"""/content/drive/MyDrive/data_1000.csv"""'], {'nrows': '(1000)'}), "('/content/drive/MyDrive/data_1000.csv', nrows=1000)\n", (7... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
# 通过tf.set_random_seed设定种子数,后面定义的全部变量都可以跨会话生成相同的随机数
tf.set_random_seed(1)
np.random.seed(1)
learn_rate = 0.01
batch_size = 64
xdata = np.linspace(-1, 1, 100)[:, np.newaxis] # shape (100,... | [
"matplotlib.pyplot.show",
"numpy.random.seed",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"tensorflow.global_variables_initializer",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.power",
"tensorflow.Session",
"tensorflow.layers.dense",
"tensorflow.losses.mean_squared_e... | [((171, 192), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1)'], {}), '(1)\n', (189, 192), True, 'import tensorflow as tf\n'), ((193, 210), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (207, 210), True, 'import numpy as np\n'), ((332, 374), 'numpy.random.normal', 'np.random.normal', (['(0)'... |
import numpy as np
from scipy import linalg
from numpy.testing import assert_almost_equal
from megamix.online.base import _log_normal_matrix
from megamix.online.base import _full_covariance_matrices, _spherical_covariance_matrices
from megamix.utils_testing import generate
def test_log_normal_matrix_full():
n_poin... | [
"megamix.online.base._full_covariance_matrices",
"numpy.sum",
"numpy.log",
"megamix.online.base._log_normal_matrix",
"numpy.random.randn",
"numpy.empty",
"numpy.testing.assert_almost_equal",
"scipy.linalg.cholesky",
"megamix.utils_testing.generate.generate_covariance_matrices_full",
"numpy.linalg.... | [((376, 413), 'numpy.random.randn', 'np.random.randn', (['n_points', 'n_features'], {}), '(n_points, n_features)\n', (391, 413), True, 'import numpy as np\n'), ((425, 466), 'numpy.random.randn', 'np.random.randn', (['n_components', 'n_features'], {}), '(n_components, n_features)\n', (440, 466), True, 'import numpy as n... |
# =============================================================================
# Copyright 2020 NVIDIA. 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://ww... | [
"random.randint",
"numpy.asarray",
"nemo.collections.nlp.utils.callback_utils.get_classification_report",
"nemo.collections.nlp.utils.callback_utils.plot_confusion_matrix",
"nemo.logging.info",
"numpy.mean",
"nemo.collections.nlp.utils.callback_utils.get_f1_scores",
"nemo.collections.nlp.utils.callbac... | [((3299, 3343), 'numpy.asarray', 'np.asarray', (["global_vars['all_intent_labels']"], {}), "(global_vars['all_intent_labels'])\n", (3309, 3343), True, 'import numpy as np\n'), ((3363, 3406), 'numpy.asarray', 'np.asarray', (["global_vars['all_intent_preds']"], {}), "(global_vars['all_intent_preds'])\n", (3373, 3406), Tr... |
import threading
import numpy as np
from baselines.common.segment_tree import SumSegmentTree, MinSegmentTree
import math
from scipy.stats import rankdata
import json
class ReplayBuffer:
def __init__(self, buffer_shapes, size_in_transitions, T, sample_transitions):
"""Creates a replay buffer.
Args:... | [
"numpy.sum",
"numpy.empty",
"numpy.einsum",
"threading.Lock",
"numpy.random.randint",
"numpy.arange",
"numpy.array",
"numpy.exp",
"numpy.linalg.norm",
"numpy.linalg.det",
"numpy.concatenate"
] | [((1158, 1174), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1172, 1174), False, 'import threading\n'), ((4693, 4717), 'numpy.empty', 'np.empty', (['[self.size, 1]'], {}), '([self.size, 1])\n', (4701, 4717), True, 'import numpy as np\n'), ((5077, 5093), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (5... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import mlpredict
gpu = 'V100'
opt = 'SGD'
MLP = mlpredict.import_tools.import_dnn('MLP')
MLP.describe()
batchsize = 2**np.arange(0,10,1)
time_layer = np.zeros([2,10])
time_total = np.zeros(10)
for i in range(len(batchsize)):
time_total[i], ... | [
"matplotlib.pyplot.tight_layout",
"matplotlib.rc",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.ticker.ScalarFormatter",
"numpy.arange",
"matplotlib.pyplot.NullFormatter",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
... | [((121, 161), 'mlpredict.import_tools.import_dnn', 'mlpredict.import_tools.import_dnn', (['"""MLP"""'], {}), "('MLP')\n", (154, 161), False, 'import mlpredict\n'), ((225, 242), 'numpy.zeros', 'np.zeros', (['[2, 10]'], {}), '([2, 10])\n', (233, 242), True, 'import numpy as np\n'), ((255, 267), 'numpy.zeros', 'np.zeros',... |
import cv2
import time
import numpy as np
from grabscreen import grab_screen
from directkeys import PressKey, ReleaseKey
from directkeys import W, A, D
from countdown import CountDown
'''
Most of the code in this script was taken from Sentdex's Python plays GTA-V
'''
def roi(img, vertices):
mask = np.zeros_like(... | [
"cv2.GaussianBlur",
"cv2.bitwise_and",
"cv2.fillPoly",
"numpy.mean",
"cv2.HoughLinesP",
"cv2.line",
"numpy.zeros_like",
"cv2.cvtColor",
"directkeys.ReleaseKey",
"directkeys.PressKey",
"cv2.destroyAllWindows",
"cv2.Canny",
"numpy.median",
"cv2.waitKey",
"countdown.CountDown",
"time.slee... | [((306, 324), 'numpy.zeros_like', 'np.zeros_like', (['img'], {}), '(img)\n', (319, 324), True, 'import numpy as np\n'), ((329, 362), 'cv2.fillPoly', 'cv2.fillPoly', (['mask', 'vertices', '(255)'], {}), '(mask, vertices, 255)\n', (341, 362), False, 'import cv2\n'), ((376, 402), 'cv2.bitwise_and', 'cv2.bitwise_and', (['i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 10:52:40 2019
@author: guido
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 10:30:25 2018
@author: guido
"""
import os
import pandas as pd
import numpy as np
from oneibl.one import ONE
from define_paths import ana... | [
"matplotlib.pyplot.title",
"os.mkdir",
"numpy.abs",
"matplotlib.pyplot.figure",
"numpy.exp",
"os.path.join",
"numpy.unique",
"matplotlib.pyplot.xlabel",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"os.path.exists",
"oneibl.one.ONE",
"scipy.optimize.curve_fit",
"matplotlib.pyplot.ylabel"... | [((635, 640), 'oneibl.one.ONE', 'ONE', ([], {}), '()\n', (638, 640), False, 'from oneibl.one import ONE\n'), ((1096, 1111), 'define_paths.analysis_path', 'analysis_path', ([], {}), '()\n', (1109, 1111), False, 'from define_paths import analysis_path\n'), ((1218, 1296), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns... |
__author__ = "<NAME>"
# University of South Carolina
# <NAME>-Simpers group
# Starting Date: June, 2016
import matplotlib.pyplot as plt
import numpy as np
from scripts import ternary
def plt_ternary_save(data, tertitle='', labelNames=('Species A','Species B','Species C'), scale=100,
sv=False... | [
"scripts.ternary.figure",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplots",
"numpy.array",
"matplotlib.pyplot.tight_layout"
] | [((2008, 2037), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (2020, 2037), True, 'import matplotlib.pyplot as plt\n'), ((2108, 2142), 'scripts.ternary.figure', 'ternary.figure', ([], {'ax': 'ax', 'scale': 'scale'}), '(ax=ax, scale=scale)\n', (2122, 2142), False, 'fr... |
import requests
import json
import pandas as pd
import numpy as np
import sys
import logging
from pathlib import Path
logging.basicConfig(filename='logging_for_adding_group_permissions.log',level=logging.INFO)
"""
This python script is used to add group permissions based on the group_permissions_input file.
python3 ad... | [
"logging.basicConfig",
"pandas.read_csv",
"json.dumps",
"numpy.shape",
"logging.info",
"pathlib.Path",
"requests.get",
"requests.post"
] | [((118, 214), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""logging_for_adding_group_permissions.log"""', 'level': 'logging.INFO'}), "(filename='logging_for_adding_group_permissions.log',\n level=logging.INFO)\n", (137, 214), False, 'import logging\n'), ((450, 474), 'logging.info', 'logging.inf... |
import torch
import numpy as np
import pandas as pd
import torch.optim as optim
from agents.common.logger import Logger
from agents.common.replay_buffer import ReplayBuffer
from agents.common.utils import quantile_huber_loss
class EGreedyAgent():
def __init__(self,env,
network,
epsilon=0.05,
n_quanti... | [
"numpy.random.uniform",
"numpy.min",
"numpy.random.randint",
"torch.as_tensor",
"agents.common.replay_buffer.ReplayBuffer",
"torch.no_grad",
"agents.common.logger.Logger"
] | [((3554, 3569), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3567, 3569), False, 'import torch\n'), ((719, 733), 'agents.common.replay_buffer.ReplayBuffer', 'ReplayBuffer', ([], {}), '()\n', (731, 733), False, 'from agents.common.replay_buffer import ReplayBuffer\n'), ((1680, 1734), 'agents.common.logger.Logger... |
"""
NOTE: This file is not using to.testing.assert_allclose because most methods need to work for both torch and numpy.
"""
import pytest
import numpy as np
import torch as to
import itertools
import pickle
from typing import NamedTuple
from pyrado.algorithms.utils import ReplayMemory
from pyrado.sampling.step_sequenc... | [
"pyrado.sampling.step_sequence.StepSequence.concat",
"numpy.ones_like",
"pyrado.algorithms.utils.ReplayMemory",
"numpy.random.randn",
"numpy.empty_like",
"pyrado.sampling.step_sequence.StepSequence",
"torch.cat",
"pyrado.environments.pysim.ball_on_beam.BallOnBeamSim",
"numpy.array",
"pyrado.sampli... | [((1826, 1952), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data_format, tensor_type"""', "[('numpy', np.ndarray), ('torch', to.Tensor)]"], {'ids': "['numpy', 'torch']"}), "('data_format, tensor_type', [('numpy', np.ndarray),\n ('torch', to.Tensor)], ids=['numpy', 'torch'])\n", (1849, 1952), False, '... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"unittest.main",
"numpy.sum",
"warnings.simplefilter",
"test.datasets.get_deprecated_msg_ref",
"numpy.testing.assert_array_equal",
"numpy.ones",
"warnings.catch_warnings",
"numpy.array",
"qiskit_machine_learning.datasets.gaussian"
] | [((2435, 2450), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2448, 2450), False, 'import unittest\n'), ((860, 896), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (883, 896), False, 'import warnings\n'), ((917, 948), 'warnings.simplefilter', 'warnings.simple... |
from keras.datasets import boston_housing
from keras import models, layers
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
print("获取数据集")
(train_data, train_targets), (test_data, test_targets) = boston_housing.load_data()
print("训练数据大小", train_data.shape)
print("测试数据大小", t... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf",
"keras.models.Sequential",
"matplotlib.use",
"numpy.mean",
"keras.layers.Dense",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.concatenate",
"keras.datasets.boston_housing.load_data"
] | [((113, 136), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (127, 136), False, 'import matplotlib\n'), ((242, 268), 'keras.datasets.boston_housing.load_data', 'boston_housing.load_data', ([], {}), '()\n', (266, 268), False, 'from keras.datasets import boston_housing\n'), ((2150, 2170), 'matp... |
import numpy as np
import re
def extract(filename1,filename2):
input_file = open(filename1)
output_file = open(filename2)
data = input_file.readlines()
out_data = output_file.readlines()
"""
Number of training data records
"""
ntrain = int(data[0].split()[0])
traindata = data[1... | [
"numpy.array",
"re.sub"
] | [((770, 788), 'numpy.array', 'np.array', (['features'], {}), '(features)\n', (778, 788), True, 'import numpy as np\n'), ((819, 835), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (827, 835), True, 'import numpy as np\n'), ((1115, 1138), 'numpy.array', 'np.array', (['test_features'], {}), '(test_features)\n... |
import cv2
import numpy as np
import copy
import imgaug.augmenters as iaa
from . import pallete_aug as pa
def pallete_augmentation(img, img_data, config):
if config.pallete:
csv_path = img_data['csvpath']
#Exception none value.
if csv_path is None or '':
print("CSV path is {}".f... | [
"imgaug.augmenters.SomeOf",
"imgaug.augmenters.KMeansColorQuantization",
"numpy.random.randint",
"imgaug.augmenters.LogContrast",
"imgaug.augmenters.AllChannelsHistogramEqualization",
"imgaug.augmenters.GammaContrast",
"numpy.transpose",
"numpy.random.choice",
"copy.deepcopy",
"imgaug.augmenters.L... | [((1351, 1374), 'copy.deepcopy', 'copy.deepcopy', (['img_data'], {}), '(img_data)\n', (1364, 1374), False, 'import copy\n'), ((1403, 1439), 'cv2.imread', 'cv2.imread', (["img_data_aug['filepath']"], {}), "(img_data_aug['filepath'])\n", (1413, 1439), False, 'import cv2\n'), ((4948, 4998), 'imgaug.augmenters.SomeOf', 'ia... |
import numpy as np
from colearning.game import Player
class BasePlayer(Player):
"""docstring for BasePlayer"""
#----Fields
team = None
individual_id = None
def initialize_player(self, team, individual_id):
""" Setup the player's external attributes """
self.team = team
se... | [
"numpy.zeros"
] | [((649, 660), 'numpy.zeros', 'np.zeros', (['(5)'], {}), '(5)\n', (657, 660), True, 'import numpy as np\n')] |
import pickle
import logging
import numpy as np
import torch
import models
import utils
logger = logging.getLogger()
class BaseExperiment():
def __init__(self, args):
self.save_dir = args.save_dir
self.burn_in_steps = args.burn_in_steps
self.eval_freq = args.eval_freq
self.cpu =... | [
"pickle.dump",
"utils.DataLoader",
"utils.DataSampler",
"torch.load",
"utils.add_log",
"numpy.random.permutation",
"utils.get_dataset",
"utils.IndexBatchSampler",
"logging.getLogger"
] | [((100, 119), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (117, 119), False, 'import logging\n'), ((780, 811), 'utils.get_dataset', 'utils.get_dataset', (['args.dataset'], {}), '(args.dataset)\n', (797, 811), False, 'import utils\n'), ((1031, 1091), 'utils.DataSampler', 'utils.DataSampler', (['self.trai... |
import numpy as np
import cv2
import logging
from .utils.localization import LocResult
class CppLocalization:
def __init__(self, db_ids, local_db, global_descriptors, images, points):
import _hloc_cpp
self.hloc = _hloc_cpp.HLoc()
id_to_idx = {}
old_to_new_kpt = {}
for idx... | [
"_hloc_cpp.HLoc",
"logging.info",
"numpy.where",
"numpy.array",
"numpy.eye"
] | [((236, 252), '_hloc_cpp.HLoc', '_hloc_cpp.HLoc', ([], {}), '()\n', (250, 252), False, 'import _hloc_cpp\n'), ((1628, 1680), 'logging.info', 'logging.info', (['"""Localizing image %s"""', 'query_info.name'], {}), "('Localizing image %s', query_info.name)\n", (1640, 1680), False, 'import logging\n'), ((2124, 2133), 'num... |
import scipy.optimize as so
import numpy as np
import scipy as sp
import scipy.io as sio
import os
import sys
import matplotlib.pyplot as plt
localSize = 200
diagAdd = 0
maxIte = localSize
if len(sys.argv) > 1:
localSize = sys.argv[1]
if len(sys.argv) > 2:
diagAdd = sys.argv[2]
if len(sys.argv) > 3:
maxIt... | [
"matplotlib.pyplot.loglog",
"scipy.optimize.minimize",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.genfromtxt",
"os.system",
"scipy.io.mmread",
"scipy.optimize.Bounds",
"numpy.linalg.norm",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.xlabel",
... | [((572, 600), 'scipy.io.mmread', 'sio.mmread', (['"""Amat_TCMAT.mtx"""'], {}), "('Amat_TCMAT.mtx')\n", (582, 600), True, 'import scipy.io as sio\n'), ((1039, 1056), 'scipy.optimize.Bounds', 'so.Bounds', (['lb', 'ub'], {}), '(lb, ub)\n', (1048, 1056), True, 'import scipy.optimize as so\n'), ((1063, 1142), 'scipy.optimiz... |
import pytest
import numpy as np
from scipy.ndimage import gaussian_filter1d
import astropy.units as u
from astropy.utils.data import download_file
from astropy.tests.helper import assert_quantity_allclose
from ..io import EchelleSpectrum, Template, Spectrum
from ..ccf import cross_corr
lkca4_id = "1x3nIg1P5tYFQqJrw... | [
"numpy.trapz",
"numpy.random.seed",
"numpy.ones_like",
"numpy.roll",
"numpy.median",
"astropy.tests.helper.assert_quantity_allclose",
"numpy.arange",
"astropy.units.doppler_optical",
"astropy.utils.data.download_file",
"pytest.mark.parametrize"
] | [((681, 738), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url,"""', '[lkca4_url, proxima_url]'], {}), "('url,', [lkca4_url, proxima_url])\n", (704, 738), False, 'import pytest\n'), ((1198, 1255), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url,"""', '[lkca4_url, proxima_url]'], {}), "('u... |
import numpy as np
import scipy.linalg as la
import seaborn as sns
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
from plot_utils import *
nburnin = 500
nsample = 1000
niter = nburnin + nsample
##################
### 1-D Normal ###
##################... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"seaborn.kdeplot",
"numpy.sum",
"numpy.zeros",
"scipy.stats.multivariate_normal",
"scipy.linalg.inv",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.array",
"numpy.random.normal",
"numpy.random.rand",
"numpy.eye",
"numpy.cov",
"numpy.roun... | [((322, 342), 'numpy.random.seed', 'np.random.seed', (['(2019)'], {}), '(2019)\n', (336, 342), True, 'import numpy as np\n'), ((379, 431), 'numpy.random.normal', 'np.random.normal', (['sample_mean', 'sample_sig2'], {'size': '(100)'}), '(sample_mean, sample_sig2, size=100)\n', (395, 431), True, 'import numpy as np\n'), ... |
# coding: utf-8
# ## Pothole Detection
# #### Load important libraries
# In[1]:
import cv2
import numpy as np
import pygame
import time
import smtplib
import sys
from matplotlib import pyplot as plt
# In[2]:
file_name = 'pothole.jpg'
#file name can be passed as an commandline argument.
if sys.argv[1] != None... | [
"matplotlib.pyplot.title",
"cv2.GaussianBlur",
"cv2.approxPolyDP",
"cv2.arcLength",
"cv2.medianBlur",
"numpy.ones",
"cv2.isContourConvex",
"cv2.startWindowThread",
"cv2.rectangle",
"cv2.erode",
"cv2.imshow",
"cv2.contourArea",
"cv2.dilate",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"... | [((426, 449), 'cv2.startWindowThread', 'cv2.startWindowThread', ([], {}), '()\n', (447, 449), False, 'import cv2\n'), ((1707, 1728), 'cv2.imread', 'cv2.imread', (['file_name'], {}), '(file_name)\n', (1717, 1728), False, 'import cv2\n'), ((1835, 1861), 'matplotlib.pyplot.title', 'plt.title', (['"""Pothole Image"""'], {}... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 5 22:36:16 2017
@author: root
"""
import nltk
import numpy as np
import tflearn
import tensorflow as tf
import random
# restore all of our data structures
import pickle
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()... | [
"json.load",
"tflearn.fully_connected",
"tensorflow.reset_default_graph",
"random.choice",
"tflearn.regression",
"nltk.stem.lancaster.LancasterStemmer",
"tflearn.DNN",
"numpy.array",
"nltk.word_tokenize"
] | [((302, 320), 'nltk.stem.lancaster.LancasterStemmer', 'LancasterStemmer', ([], {}), '()\n', (318, 320), False, 'from nltk.stem.lancaster import LancasterStemmer\n'), ((697, 721), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (719, 721), True, 'import tensorflow as tf\n'), ((807, 838), 't... |
"""
N-dimensional grids.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
class Grid(object):
"""
N-dimensional grid.
Parameters
----------
shape : tuple
Number of grid points in each dimension.
center : ... | [
"numpy.zeros_like",
"numpy.asarray",
"numpy.zeros",
"numpy.indices",
"numpy.rint",
"numpy.array",
"numpy.atleast_2d"
] | [((639, 667), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'dtype'}), '(shape, dtype=dtype)\n', (647, 667), True, 'import numpy as np\n'), ((3600, 3656), 'numpy.zeros', 'np.zeros', (['(self.grid.shape + (self.grid.ndim,))'], {'dtype': 'int'}), '(self.grid.shape + (self.grid.ndim,), dtype=int)\n', (3608, 3656), True... |
import cv2
import os
import numpy as np
ROOT_PATH = 'G:\\MachineLearning\\unbalance\\core_500'
image_path = os.path.join(ROOT_PATH, 'Image') # 原图像保存位置
annotation_path = os.path.join(ROOT_PATH, 'Annotation') # 原目标框保存位置
image_save_path = os.path.join(ROOT_PATH, 'Image_new') # 原目标框保存位置
annotation_save_path = os.path.j... | [
"os.mkdir",
"cv2.getRotationMatrix2D",
"cv2.waitKey",
"cv2.imwrite",
"os.path.isdir",
"numpy.zeros",
"cv2.imread",
"cv2.warpAffine",
"cv2.rectangle",
"cv2.flip",
"cv2.imshow",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((109, 141), 'os.path.join', 'os.path.join', (['ROOT_PATH', '"""Image"""'], {}), "(ROOT_PATH, 'Image')\n", (121, 141), False, 'import os\n'), ((171, 208), 'os.path.join', 'os.path.join', (['ROOT_PATH', '"""Annotation"""'], {}), "(ROOT_PATH, 'Annotation')\n", (183, 208), False, 'import os\n'), ((239, 275), 'os.path.joi... |
import tensorflow as tf
import numpy as np
import logging
from global_utils import *
import time
import json
from tensorflow.python.layers import core as layers_core
from parametrs import *
global data1, data2, vocab, dict_rev, data1_validation, data2_validation, test1, test2
def load_data(parameterClass, length=Non... | [
"tensorflow.contrib.seq2seq.LuongAttention",
"tensorflow.trainable_variables",
"numpy.empty",
"numpy.ones",
"json.dumps",
"tensorflow.global_variables",
"tensorflow.Variable",
"numpy.mean",
"tensorflow.contrib.seq2seq.BasicDecoder",
"tensorflow.reduce_max",
"tensorflow.clip_by_global_norm",
"j... | [((531, 542), 'time.time', 'time.time', ([], {}), '()\n', (540, 542), False, 'import time\n'), ((3225, 3298), 'tensorflow.placeholder', 'tf.placeholder', ([], {'shape': '(None, None)', 'dtype': 'tf.int32', 'name': '"""encoder_inputs"""'}), "(shape=(None, None), dtype=tf.int32, name='encoder_inputs')\n", (3239, 3298), T... |
# Some part borrowed from official tutorial https://github.com/pytorch/examples/blob/master/imagenet/main.py
from __future__ import print_function
from __future__ import absolute_import
import os
import numpy as np
import argparse
import importlib
import time
import logging
import warnings
from collections import Orde... | [
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.isdir",
"torch.manual_seed",
"losses.SupConLoss",
"os.walk",
"os.path.exists",
"torch.cuda.manual_seed",
"torch.nn.CrossEntropyLoss",
"models.SupResNet",
"torch.cuda.manual_seed_all",
"models.SSLRes... | [((650, 703), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SSD evaluation"""'}), "(description='SSD evaluation')\n", (673, 703), False, 'import argparse\n'), ((2631, 2676), 'os.path.join', 'os.path.join', (['args.results_dir', 'args.exp_name'], {}), '(args.results_dir, args.exp_name)\n... |
"""
pytorch (0.3.1) miss some transforms, will be removed after official support.
"""
import torch
import numpy as np
from PIL import Image
import torchvision.transforms.functional as F
import torch.nn.functional as Func
import random
imagenet_pca = {
'eigval': np.asarray([0.2175, 0.0188, 0.0045]),
'eigvec': ... | [
"torchvision.transforms.functional.to_tensor",
"numpy.random.randn",
"numpy.asarray",
"numpy.clip",
"torch.squeeze",
"numpy.dot",
"numpy.add",
"torch.nn.functional.interpolate",
"torchvision.transforms.functional.normalize"
] | [((268, 304), 'numpy.asarray', 'np.asarray', (['[0.2175, 0.0188, 0.0045]'], {}), '([0.2175, 0.0188, 0.0045])\n', (278, 304), True, 'import numpy as np\n'), ((320, 419), 'numpy.asarray', 'np.asarray', (['[[-0.5675, 0.7192, 0.4009], [-0.5808, -0.0045, -0.814], [-0.5836, -0.6948, \n 0.4203]]'], {}), '([[-0.5675, 0.7192... |
# -*- coding: utf-8 -*-
"""
Colored text tool for RNN visualization
"""
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
class ColoredText(object):
"""
text: a sequence of characters
vals: a float vector, (-1 , 1), The same length as text
width: image width
... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"numpy.random.randn",
"matplotlib.pyplot.close",
"matplotlib.cm.bwr",
"matplotlib.pyplot.figure",
"numpy.linspace",
"itertools.product",
"numpy.vstack"
] | [((3643, 3713), 'itertools.product', 'product', (['[10, 113, 375, 819]', '[540, 1080]', '[10, 14, 18]', '[True, False]'], {}), '([10, 113, 375, 819], [540, 1080], [10, 14, 18], [True, False])\n', (3650, 3713), False, 'from itertools import product\n'), ((1974, 1989), 'matplotlib.cm.bwr', 'cm.bwr', (['subvals'], {}), '(... |
import sys
import os
from typing import Tuple
from numpy.random.mtrand import random
sys.path.append('C:\\Users\\coton\\Desktop\\github\\fema\\src\\')
import numpy as np
import math
from fem_basis import Basis
class FEMaSemiSupervisedClassifier:
"""
Class responsible to perform the classificatio... | [
"sys.path.append",
"numpy.append",
"numpy.zeros",
"numpy.argmax"
] | [((88, 153), 'sys.path.append', 'sys.path.append', (['"""C:\\\\Users\\\\coton\\\\Desktop\\\\github\\\\fema\\\\src\\\\"""'], {}), "('C:\\\\Users\\\\coton\\\\Desktop\\\\github\\\\fema\\\\src\\\\')\n", (103, 153), False, 'import sys\n'), ((1993, 2045), 'numpy.zeros', 'np.zeros', (['(self.num_classes, self.num_train_sample... |
import numpy as np
import math
# TODO: Use anytree to represent the tree
class TreeNode:
def __init__(self, lb, ub, num_split, rand = False):
self.lb = lb
self.ub = ub
self.x = 0.5 * (lb + ub) if not rand else np.random.uniform(lb, ub)
self.y = np.nan
self.ch... | [
"numpy.random.uniform",
"numpy.all",
"numpy.argmax"
] | [((726, 754), 'numpy.argmax', 'np.argmax', (['(self.ub - self.lb)'], {}), '(self.ub - self.lb)\n', (735, 754), True, 'import numpy as np\n'), ((247, 272), 'numpy.random.uniform', 'np.random.uniform', (['lb', 'ub'], {}), '(lb, ub)\n', (264, 272), True, 'import numpy as np\n'), ((383, 408), 'numpy.all', 'np.all', (['(sel... |
#!/usr/bin/env python
""" verlat numerical integration methods """
import numpy as np
def velocity_verlat(x_init, acc, step, time):
""" the velocity verlat method """
# finding count
count = int(time / step)
# initialization
x = np.zeros(count)
x_dot = np.zeros(count)
x[0] = x_init
... | [
"numpy.zeros",
"numpy.delete"
] | [((254, 269), 'numpy.zeros', 'np.zeros', (['count'], {}), '(count)\n', (262, 269), True, 'import numpy as np\n'), ((282, 297), 'numpy.zeros', 'np.zeros', (['count'], {}), '(count)\n', (290, 297), True, 'import numpy as np\n'), ((698, 717), 'numpy.zeros', 'np.zeros', (['(count + 2)'], {}), '(count + 2)\n', (706, 717), T... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
camera = cv2.VideoCapture(0)
gray = None
while True:
ret, frame = camera.read()
if ret is False:
print("Camera open failed")
break
newgray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
display_img = newgray
if ... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.VideoCapture",
"numpy.where",
"cv2.imshow"
] | [((87, 106), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (103, 106), False, 'import cv2\n'), ((247, 286), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2GRAY'], {}), '(frame, cv2.COLOR_BGR2GRAY)\n', (259, 286), False, 'import cv2\n'), ((565, 597), 'cv2.imshow', 'cv2.imshow', (['"""hello""... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from numpy import sin, cos, tan, arctan2, radians, degrees, sqrt
from Quaternion import Quat
def radec2eci(ra, dec):
"""
Convert from RA,Dec to ECI. The input ``ra`` and ``dec`` values can be 1-d
arrays of length N in whic... | [
"numpy.radians",
"numpy.sum",
"numpy.arctan2",
"Quaternion.Quat",
"numpy.degrees",
"numpy.cross",
"numpy.arcsin",
"numpy.sin",
"numpy.array",
"numpy.cos",
"numpy.dot",
"numpy.arccos",
"numpy.sqrt"
] | [((535, 546), 'numpy.radians', 'radians', (['ra'], {}), '(ra)\n', (542, 546), False, 'from numpy import sin, cos, tan, arctan2, radians, degrees, sqrt\n'), ((555, 567), 'numpy.radians', 'radians', (['dec'], {}), '(dec)\n', (562, 567), False, 'from numpy import sin, cos, tan, arctan2, radians, degrees, sqrt\n'), ((2382,... |
import torch
from torch import nn
from torch.nn import functional as F
from Utils.flags import FLAGS
import numpy as np
from torch.autograd import Variable
crossentropy = nn.CrossEntropyLoss()
softmax = nn.Softmax(1)
logsoftmax = nn.LogSoftmax(1)
# some utils TODO
def update_average(model_tgt, model_src, beta=0.999)... | [
"torch.mean",
"numpy.sum",
"torch.nn.LogSoftmax",
"torch.nn.CrossEntropyLoss",
"torch.cat",
"numpy.clip",
"torch.nn.functional.softmax",
"torch.nn.Softmax",
"numpy.exp",
"torch.nn.functional.log_softmax",
"numpy.cos",
"torch.sum",
"torch.from_numpy"
] | [((173, 194), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (192, 194), False, 'from torch import nn\n'), ((205, 218), 'torch.nn.Softmax', 'nn.Softmax', (['(1)'], {}), '(1)\n', (215, 218), False, 'from torch import nn\n'), ((232, 248), 'torch.nn.LogSoftmax', 'nn.LogSoftmax', (['(1)'], {}), '(1)\... |
"""libaray for multi-modal dataset loaders.
Acknowledgements:
`image_to_caption_collate_fn` is based on
https://github.com/yalesong/pvse/blob/master/data.py
"""
import os
import numpy as np
import torch
from torch.utils.data import DataLoader
from datasets.coco import CocoCaptionsCap
from datasets.cub import CUBCap... | [
"numpy.load",
"torch.stack",
"torch.utils.data.DataLoader",
"datasets.coco.CocoCaptionsCap",
"datasets._transforms.imagenet_transform",
"datasets.vocab.Vocabulary",
"torch.Tensor",
"datasets._transforms.caption_transform",
"os.path.join"
] | [((1247, 1269), 'torch.stack', 'torch.stack', (['images', '(0)'], {}), '(images, 0)\n', (1258, 1269), False, 'import torch\n'), ((3785, 3822), 'os.path.join', 'os.path.join', (['dataset_root', '"""images/"""'], {}), "(dataset_root, 'images/')\n", (3797, 3822), False, 'import os\n'), ((8301, 8378), 'datasets._transforms... |
"""
This module contains functions to average mdtraj-object data
"""
from copy import deepcopy
import numpy as np
from ase.data import chemical_symbols as symbols
def average_energies(mdtraj_list, tstart):
"""
function to compute averages of a selection of mdtraj objects
sorted by their composition... | [
"copy.deepcopy",
"numpy.std",
"numpy.zeros",
"numpy.mean",
"numpy.where"
] | [((876, 891), 'copy.deepcopy', 'deepcopy', (['comps'], {}), '(comps)\n', (884, 891), False, 'from copy import deepcopy\n'), ((1781, 1796), 'copy.deepcopy', 'deepcopy', (['comps'], {}), '(comps)\n', (1789, 1796), False, 'from copy import deepcopy\n'), ((4878, 4914), 'numpy.where', 'np.where', (["(dens['hists'][esub] != ... |
import re
import os
import glob
import shutil
import random
import logging
import torch
import numpy as np
logger = logging.getLogger(__name__)
def _rotate_checkpoints(args, checkpoint_prefix, use_mtime=False):
if not args.save_total_limit:
return
if args.save_total_limit <= 0:
return
#... | [
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed_all",
"torch.cuda.is_available",
"random.seed",
"os.path.getmtime",
"shutil.rmtree",
"logging.getLogger"
] | [((118, 145), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (135, 145), False, 'import logging\n'), ((1551, 1573), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (1562, 1573), False, 'import random\n'), ((1578, 1603), 'numpy.random.seed', 'np.random.seed', (['args.se... |
import numpy as np
from numba import jit
np.random.seed(1)
class rocket_engine():
def __init__(self, dimensions = 3, temperature = 10000, N = 1E5, mass = 1.67e-27, length = 1e-6):
self.k = 1.38064852e-23
self.T = temperature
self.N = N
self.m = mass
self.L = le... | [
"numpy.less_equal",
"numpy.zeros_like",
"numpy.abs",
"numpy.random.seed",
"numpy.logical_and",
"numpy.sum",
"numpy.ones_like",
"numpy.multiply",
"numpy.where",
"numba.jit",
"numpy.greater_equal",
"numpy.sqrt"
] | [((43, 60), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (57, 60), True, 'import numpy as np\n'), ((734, 752), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (737, 752), False, 'from numba import jit\n'), ((379, 412), 'numpy.sqrt', 'np.sqrt', (['(self.k * self.T / self.m)'], {}... |
import numpy as np
import pickle
import sys
import seaborn as sns
import pandas as pd
# import pkg_resources
# pkg_resources.require("scanpy==1.3")
import scanpy as sc
print(sc.__version__)
import os
import scipy.stats
import scipy.sparse
import matplotlib.pyplot as plt
import sklearn.preprocessing
from sklearn.metrics... | [
"pandas.DataFrame",
"scanpy.AnnData",
"sklearn.preprocessing.binarize",
"pandas.read_csv",
"numpy.asarray",
"pandas.isnull",
"sklearn.metrics.auc",
"gc.collect",
"pickle.load",
"numpy.array",
"multiprocessing.Pool",
"numpy.squeeze",
"numpy.round",
"os.path.join",
"numpy.concatenate"
] | [((703, 718), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {}), '(X)\n', (715, 718), True, 'import pandas as pd\n'), ((1010, 1078), 'numpy.array', 'np.array', (['[[(1 if i == y else 0) for y in y_cluster] for i in index]'], {}), '([[(1 if i == y else 0) for y in y_cluster] for i in index])\n', (1018, 1078), True, 'impor... |
"""Tests for the log_normal_distribution 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 requi... | [
"numpy.seterr",
"numpy.array",
"numpy.exp"
] | [((891, 913), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (900, 913), True, 'import numpy as np\n'), ((1107, 1132), 'numpy.array', 'np.array', (['[0.0, 1.0, 2.0]'], {}), '([0.0, 1.0, 2.0])\n', (1115, 1132), True, 'import numpy as np\n'), ((1145, 1170), 'numpy.array', 'np.array', (['[1.... |
import os, fnmatch, sys
import dill as pickle
import scipy.interpolate as interp
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import bead_util as bu
import configuration as config
dir1 = '/data/20180618/bead1/tf_20180618/freq_comb_elec5_10V'
dir1 = '/data/20180618/bead1/discha... | [
"numpy.fft.rfft",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.legend",
"bead_util.find_all_fnames",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"bead_util.DataFile"
] | [((470, 494), 'bead_util.find_all_fnames', 'bu.find_all_fnames', (['dir1'], {}), '(dir1)\n', (488, 494), True, 'import bead_util as bu\n'), ((524, 537), 'bead_util.DataFile', 'bu.DataFile', ([], {}), '()\n', (535, 537), True, 'import bead_util as bu\n'), ((622, 635), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], ... |
# -*- coding: utf-8 -*-
u"""
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import time
import os
import yaml
import numpy as np
def record_time(func, time_list, *args, ... | [
"numpy.fft.rfft",
"numpy.sum",
"yaml.dump",
"time.time",
"os.path.splitext",
"os.path.split",
"os.path.join"
] | [((340, 351), 'time.time', 'time.time', ([], {}), '()\n', (349, 351), False, 'import time\n'), ((387, 398), 'time.time', 'time.time', ([], {}), '()\n', (396, 398), False, 'import time\n'), ((3357, 3380), 'os.path.split', 'os.path.split', (['filename'], {}), '(filename)\n', (3370, 3380), False, 'import os\n'), ((4885, 4... |
import numpy as np
from abc import ABCMeta, abstractmethod
from ratcave.utils.observers import IterObservable
import itertools
from operator import setitem
from scipy.spatial.transform import Rotation as R
class Coordinates(IterObservable):
coords = {'x': 0, 'y': 1, 'z': 2}
def __init__(self, *args, **kwargs... | [
"numpy.radians",
"numpy.eye",
"numpy.degrees",
"scipy.spatial.transform.Rotation.from_euler",
"numpy.cross",
"numpy.identity",
"numpy.array",
"numpy.linalg.norm",
"scipy.spatial.transform.Rotation.from_matrix",
"scipy.spatial.transform.Rotation.from_quat",
"numpy.dot",
"operator.setitem",
"n... | [((6717, 6793), 'numpy.array', 'np.array', (['[[0, -vec[2], vec[1]], [vec[2], 0, -vec[0]], [-vec[1], vec[0], 0]]'], {}), '([[0, -vec[2], vec[1]], [vec[2], 0, -vec[0]], [-vec[1], vec[0], 0]])\n', (6725, 6793), True, 'import numpy as np\n'), ((7202, 7216), 'numpy.cross', 'np.cross', (['a', 'b'], {}), '(a, b)\n', (7210, 7... |
import numpy as np
'''
Includes blood glucose level proxy for diabetes: 0-3
(lo2 - counts as abnormal, lo1, normal, hi1, hi2 - counts as abnormal)
Initial distribution:
[.05, .15, .6, .15, .05] for non-diabetics and [.01, .05, .15, .6, .19] for diabetics
'''
class State(object):
NUM_OBS_STATES = 720
N... | [
"numpy.random.rand",
"numpy.floor",
"numpy.array",
"numpy.concatenate"
] | [((8262, 8278), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (8276, 8278), True, 'import numpy as np\n'), ((8293, 8327), 'numpy.concatenate', 'np.concatenate', (['[obs, [noise_obs]]'], {}), '([obs, [noise_obs]])\n', (8307, 8327), True, 'import numpy as np\n'), ((10379, 10423), 'numpy.concatenate', 'np.conca... |
'''
Assorted functions used in the machine learning codes during the Blue Stars project
Created by: <NAME> (<EMAIL>)
'''
#External packages and functions used
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation
from tensorflow.keras.optimizers import Adam
from sklearn.... | [
"seaborn.heatmap",
"sklearn.preprocessing.StandardScaler",
"tensorflow.keras.layers.Dense",
"sklearn.metrics.r2_score",
"sklearn.metrics.mean_absolute_error",
"tensorflow.keras.layers.LeakyReLU",
"matplotlib.pyplot.figure",
"sklearn.metrics.max_error",
"tensorflow.keras.models.Sequential",
"sklear... | [((7666, 7678), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (7676, 7678), False, 'from tensorflow.keras.models import Sequential\n'), ((8303, 8406), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.Adam', ([], {'learning_rate': 'learning_rate', 'beta_1': 'beta1', 'beta_2': 'beta2', 'ep... |
import argparse
import cv2
import numpy as np
from typing import Tuple
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.Argum... | [
"numpy.log",
"cv2.waitKey",
"numpy.fliplr",
"pathlib.Path",
"numpy.min",
"numpy.max",
"cv2.applyColorMap",
"numpy.random.rand",
"cv2.flip",
"cv2.imshow",
"argparse.ArgumentTypeError"
] | [((651, 693), 'cv2.applyColorMap', 'cv2.applyColorMap', (['depth', 'cv2.COLORMAP_JET'], {}), '(depth, cv2.COLORMAP_JET)\n', (668, 693), False, 'import cv2\n'), ((1276, 1295), 'numpy.log', 'np.log', (['depth_image'], {}), '(depth_image)\n', (1282, 1295), True, 'import numpy as np\n'), ((1458, 1497), 'pathlib.Path', 'Pat... |
#!/usr/bin/python3
import random
import math
import numpy as np
def softmax(z):
return np.exp(z) / np.sum(np.exp(z))
########################################################################################################################
# Input & Data Normalization
class Input(object):
def __init__(self... | [
"math.exp",
"random.randint",
"math.sqrt",
"math.tanh",
"random.uniform",
"random.random",
"numpy.exp"
] | [((13660, 13680), 'random.randint', 'random.randint', (['(0)', 'm'], {}), '(0, m)\n', (13674, 13680), False, 'import random\n'), ((13690, 13710), 'random.randint', 'random.randint', (['(0)', 'm'], {}), '(0, m)\n', (13704, 13710), False, 'import random\n'), ((13854, 13874), 'random.randint', 'random.randint', (['(0)', '... |
import os
import numpy as np
import h5py
import tensorflow as tf
import keras
import keras.backend as K
############################################
### Function to load data in h5py format ###
############################################
def load_data(path_to_data):
data = h5py.File(path_to_data,'r')
X_test... | [
"h5py.File",
"rpy2.robjects.packages.importr",
"random.randint",
"keras.backend.epsilon",
"numpy.zeros",
"numpy.transpose",
"numpy.array",
"numpy.reshape",
"numpy.tile",
"keras.backend.clip"
] | [((282, 310), 'h5py.File', 'h5py.File', (['path_to_data', '"""r"""'], {}), "(path_to_data, 'r')\n", (291, 310), False, 'import h5py\n'), ((483, 509), 'numpy.array', 'np.array', (["data['test_out']"], {}), "(data['test_out'])\n", (491, 509), True, 'import numpy as np\n'), ((527, 554), 'numpy.array', 'np.array', (["data[... |
#!/usr/bin/env python
"""
main.py
"""
import sys
import json
import argparse
import numpy as np
from helpers import compute_scores
P_AT_01_THRESHOLD = 0.475
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--cache-path', type=str, default='data/cache')
return parser.parse_ar... | [
"numpy.load",
"argparse.ArgumentParser",
"helpers.compute_scores",
"json.dumps",
"numpy.loadtxt"
] | [((196, 221), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (219, 221), False, 'import argparse\n'), ((434, 494), 'numpy.load', 'np.load', (["('%s_valid.npy' % args.cache_path)"], {'allow_pickle': '(True)'}), "('%s_valid.npy' % args.cache_path, allow_pickle=True)\n", (441, 494), True, 'import ... |
import torch
import numpy as np
from smplx import SMPL as _SMPL
from smplx.body_models import ModelOutput
from smplx.lbs import vertices2joints
import config
class SMPL(_SMPL):
"""
Extension of the official SMPL (from the smplx python package) implementation to
support more joints.
"""
def __init... | [
"numpy.load",
"smplx.body_models.ModelOutput",
"torch.cat",
"smplx.lbs.vertices2joints",
"torch.tensor"
] | [((427, 465), 'numpy.load', 'np.load', (['config.J_REGRESSOR_EXTRA_PATH'], {}), '(config.J_REGRESSOR_EXTRA_PATH)\n', (434, 465), True, 'import numpy as np\n'), ((497, 536), 'numpy.load', 'np.load', (['config.COCOPLUS_REGRESSOR_PATH'], {}), '(config.COCOPLUS_REGRESSOR_PATH)\n', (504, 536), True, 'import numpy as np\n'),... |
from __future__ import print_function
import argparse
import json
import logging
import os
import pandas as pd
import numpy as np
import pickle as pkl
from sagemaker_containers import entry_point
from sagemaker_xgboost_container.data_utils import get_dmatrix
import xgboost as xgb
from xgboost.sklearn import XGBClas... | [
"os.listdir",
"argparse.ArgumentParser",
"pandas.read_csv",
"os.environ.get",
"numpy.array",
"xgboost.XGBClassifier",
"numpy.bincount",
"os.path.join",
"pandas.concat"
] | [((568, 588), 'numpy.bincount', 'np.bincount', (['y_train'], {}), '(y_train)\n', (579, 588), True, 'import numpy as np\n'), ((1479, 1504), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1502, 1504), False, 'import argparse\n'), ((3426, 3446), 'pandas.concat', 'pd.concat', (['raw_data1'], {}), ... |
import os
from subprocess import PIPE, Popen
import numpy as np
import pytest
import vtk
import vtki
from vtki import examples
from vtki.plotting import running_xserver
TEST_DOWNLOADS = False
try:
if os.environ['TEST_DOWNLOADS'] == 'True':
TEST_DOWNLOADS = True
except KeyError:
pass
@pytest.mark.sk... | [
"vtki.examples.load_sphere",
"numpy.empty",
"vtki.examples.download_faults",
"vtki.examples.download_bolt_nut",
"numpy.sin",
"numpy.arange",
"vtki.examples.plot_wave",
"vtki.StructuredGrid",
"vtki.Plotter",
"numpy.meshgrid",
"vtki.examples.download_masonry_texture",
"numpy.linspace",
"vtki.e... | [((641, 662), 'numpy.empty', 'np.empty', (['(x.size, 3)'], {}), '((x.size, 3))\n', (649, 662), True, 'import numpy as np\n'), ((892, 921), 'vtki.Plotter', 'vtki.Plotter', ([], {'off_screen': '(True)'}), '(off_screen=True)\n', (904, 921), False, 'import vtki\n'), ((1368, 1392), 'numpy.arange', 'np.arange', (['(-10)', '(... |
import numpy as np
import matplotlib.pyplot as plt
from convolution_matrices.convmat2D import *
#generate a picture array with a circle
Nx = 2*256
Ny = 2*256;
A = 9*np.ones((Nx,Ny));
ci = Nx/2-1; cj= Ny/2-1;
cr = np.round(0.35*Nx);
I,J=np.meshgrid(np.arange(A.shape[0]),np.arange(A.shape[1]));
dist = np.sqrt((I-ci)**2... | [
"numpy.set_printoptions",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.imshow",
"numpy.ones",
"numpy.where",
"numpy.arange",
"numpy.linalg.norm",
"numpy.round",
"numpy.sqrt"
] | [((214, 233), 'numpy.round', 'np.round', (['(0.35 * Nx)'], {}), '(0.35 * Nx)\n', (222, 233), True, 'import numpy as np\n'), ((303, 341), 'numpy.sqrt', 'np.sqrt', (['((I - ci) ** 2 + (J - cj) ** 2)'], {}), '((I - ci) ** 2 + (J - cj) ** 2)\n', (310, 341), True, 'import numpy as np\n'), ((362, 375), 'matplotlib.pyplot.ims... |
# coding: utf-8
# In[1]:
import torch
import torch.nn as nn
import torchvision
import torch.nn.functional as F
from torchvision import datasets, transforms, models
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
import sys, os
from glob import glob
import imageio
import argparse
im... | [
"torch.distributed.is_initialized",
"os.mkdir",
"torch.nn.Dropout",
"argparse.ArgumentParser",
"torch.nn.AdaptiveMaxPool2d",
"torch.cat",
"torch.cuda.device_count",
"numpy.mean",
"torch.distributed.get_world_size",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.distributed.get_rank",
... | [((670, 702), 'os.path.exists', 'os.path.exists', (['weight_save_root'], {}), '(weight_save_root)\n', (684, 702), False, 'import sys, os\n'), ((708, 734), 'os.mkdir', 'os.mkdir', (['weight_save_root'], {}), '(weight_save_root)\n', (716, 734), False, 'import sys, os\n'), ((1076, 1101), 'torch.cuda.device_count', 'torch.... |
import numpy as np
from termcolor import colored
from pyfiglet import *
print(colored("Advent of Code - Day 25", "yellow").center(80, "-"))
print(colored(figlet_format("Sea Cucumber",font="small",justify="center"), 'green'))
print(colored("Output","yellow").center(80, "-"))
g = np.array([[{".": 0, ">": 2, "v": 1}[a] f... | [
"termcolor.colored",
"numpy.roll"
] | [((78, 122), 'termcolor.colored', 'colored', (['"""Advent of Code - Day 25"""', '"""yellow"""'], {}), "('Advent of Code - Day 25', 'yellow')\n", (85, 122), False, 'from termcolor import colored\n'), ((231, 258), 'termcolor.colored', 'colored', (['"""Output"""', '"""yellow"""'], {}), "('Output', 'yellow')\n", (238, 258)... |
import numpy as np
import os
import json
import quantities as pq
from mpi4py import MPI
import elephant.spade as spade
import argparse
import yaml
from utils import mkdirp, split_path
with open("configfile.yaml", 'r') as stream:
config = yaml.load(stream)
# max. time window width in number of bins
winlen = config... | [
"utils.mkdirp",
"yaml.load",
"numpy.load",
"argparse.ArgumentParser",
"os.path.exists",
"elephant.spade.spade",
"utils.split_path"
] | [((926, 1052), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute spade on artificial data for the given winlen and spectrum parameters"""'}), "(description=\n 'Compute spade on artificial data for the given winlen and spectrum parameters'\n )\n", (949, 1052), False, 'import ar... |
# **************************************************************************** #
# #
# ::: :::::::: #
# config.py :+: :+: :+: ... | [
"numpy.load",
"os.makedirs",
"os.path.exists",
"os.system",
"torch.cuda.is_available",
"torch.device",
"os.path.join"
] | [((11130, 11201), 'os.path.join', 'os.path.join', (['self.DataSet_Root', "self.DataSetConfig['train_index_file']"], {}), "(self.DataSet_Root, self.DataSetConfig['train_index_file'])\n", (11142, 11201), False, 'import os\n'), ((11231, 11300), 'os.path.join', 'os.path.join', (['self.DataSet_Root', "self.DataSetConfig['va... |
"""
measurement.py
MeasurementModel wraps up a halo.HaloDensityProfile instance with both a set of
observables (e.g., {r, DeltaSigma, DeltaSigma_err}) and a prior on the model
parameters of interest.
"""
from collections import OrderedDict
import numpy as np
from scipy import optimize
from colossus.halo.profile_ba... | [
"numpy.log",
"numpy.interp",
"numpy.isfinite",
"numpy.ones",
"numpy.any",
"scipy.optimize.fminbound",
"collections.OrderedDict"
] | [((3773, 3819), 'collections.OrderedDict', 'OrderedDict', (['[(p.name, p) for p in parameters]'], {}), '([(p.name, p) for p in parameters])\n', (3784, 3819), False, 'from collections import OrderedDict\n'), ((8424, 8486), 'numpy.any', 'np.any', (['[return_lnlike, return_profile, return_vir, return_sp]'], {}), '([return... |
"""
Solver D1Q2Q2 for the shallow water system on [0, 1]
d_t(h) + d_x(q) = 0, t > 0, 0 < x < 1,
d_t(q) + d_x(q^2/h+gh^2/2) = 0, t > 0, 0 < x < 1,
h(t=0,x) = h0(x), q(t=0,x) = q0(x),
d_t(h)(t,x=0) = d_t(h)(t,x=1) = 0
d_t(q)(t,x=0) = d_t(q)(t,x=1) = 0
the initial condition is a picewise constant function
in ... | [
"sympy.symbols",
"pylbm.Simulation",
"numpy.empty"
] | [((460, 488), 'sympy.symbols', 'sp.symbols', (['"""h, q, X, LA, g"""'], {}), "('h, q, X, LA, g')\n", (470, 488), True, 'import sympy as sp\n'), ((562, 579), 'numpy.empty', 'np.empty', (['x.shape'], {}), '(x.shape)\n', (570, 579), True, 'import numpy as np\n'), ((2339, 2376), 'pylbm.Simulation', 'pylbm.Simulation', (['d... |
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.minimum",
"numpy.sum",
"numpy.maximum",
"numpy.argmax",
"numpy.zeros",
"numpy.argsort",
"numpy.sort",
"numpy.cumsum",
"numpy.mean",
"numpy.arange",
"numpy.array",
"numpy.where",
"dataset.dataset_common.EDD_LABELS.items",
"numpy.max",
"numpy.finfo",
"numpy.concatenate"
] | [((1699, 1732), 'dataset.dataset_common.EDD_LABELS.items', 'dataset_common.EDD_LABELS.items', ([], {}), '()\n', (1730, 1732), False, 'from dataset import dataset_common\n'), ((2096, 2108), 'numpy.mean', 'np.mean', (['aps'], {}), '(aps)\n', (2103, 2108), True, 'import numpy as np\n'), ((2208, 2232), 'numpy.arange', 'np.... |
"""
This module recognizes shapes in pictures
"""
import numpy as np
import sys
np.set_printoptions(threshold=sys.maxsize)
import matplotlib.image as img
import matplotlib.pyplot as plt
# sample user interaction idea
# img = library.image('pic1.png')
# img_contour = img.draw_contours()
class Picture:
"""
Runs... | [
"matplotlib.image.imread",
"numpy.set_printoptions",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"numpy.array_equal"
] | [((80, 122), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (99, 122), True, 'import numpy as np\n'), ((9988, 9998), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (9996, 9998), True, 'import matplotlib.pyplot as plt\n'), ((2870, 2891), 'matplo... |
import torch
from itertools import accumulate
from fairseq.data import (
data_utils,
FairseqDataset,
Dictionary,
IdDataset,
NestedDictionaryDataset,
NumelDataset,
NumSamplesDataset,
)
from functools import lru_cache
import numpy as np
from seqp.hdf5 import Hdf5RecordReader
from typing import... | [
"fairseq.data.data_utils.collate_tokens",
"fairseq.data.NumelDataset",
"torch.stack",
"seqp.hdf5.Hdf5RecordReader",
"itertools.accumulate",
"fairseq.data.NumSamplesDataset",
"numpy.array",
"fairseq.data.IdDataset",
"functools.lru_cache"
] | [((1335, 1355), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(8)'}), '(maxsize=8)\n', (1344, 1355), False, 'from functools import lru_cache\n'), ((868, 896), 'seqp.hdf5.Hdf5RecordReader', 'Hdf5RecordReader', (['data_files'], {}), '(data_files)\n', (884, 896), False, 'from seqp.hdf5 import Hdf5RecordReader\n'),... |
from tqdm.auto import tqdm
import click
import numpy as np
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
from sklearn.metrics.pairwise import cosine_similarity
import torch
import math
import json
def load_vectors(path, max_n=200_000):
with open(path) as f:
ids = {}
dim = int(f.readl... | [
"numpy.stack",
"sklearn.metrics.pairwise.cosine_similarity",
"torch.zeros_like",
"transformers.GPT2TokenizerFast.from_pretrained",
"transformers.GPT2LMHeadModel.from_pretrained",
"click.option",
"numpy.zeros",
"click.command",
"torch.save",
"tqdm.auto.tqdm",
"numpy.argsort",
"torch.normal",
... | [((1882, 1897), 'click.command', 'click.command', ([], {}), '()\n', (1895, 1897), False, 'import click\n'), ((1899, 1988), 'click.option', 'click.option', (['"""--german_tokenizer"""'], {'help': '"""Name or path of trained German tokenizer."""'}), "('--german_tokenizer', help=\n 'Name or path of trained German token... |
#!/usr/bin/env python3
from itertools import product
from pathlib import Path
import numpy as np
import pygame
import os
# основные используемые цвета
background_color = (100, 100, 100)
layout_color = (120, 120, 120)
lighter_color = (150, 150, 150)
text_color = (200, 200, 200)
colors = {
# игровое поле и шрифт
... | [
"pygame.event.get",
"numpy.empty",
"pygame.Rect",
"numpy.arange",
"pygame.font.Font",
"pygame.mouse.get_pos",
"os.path.abspath",
"pygame.display.set_mode",
"numpy.random.choice",
"pygame.display.set_caption",
"pygame.quit",
"pygame.Surface",
"numpy.ceil",
"pygame.draw.rect",
"pygame.init... | [((764, 786), 'numpy.array', 'np.array', (['[[True] * 5]'], {}), '([[True] * 5])\n', (772, 786), True, 'import numpy as np\n'), ((792, 814), 'numpy.array', 'np.array', (['[[True] * 4]'], {}), '([[True] * 4])\n', (800, 814), True, 'import numpy as np\n'), ((820, 842), 'numpy.array', 'np.array', (['[[True] * 3]'], {}), '... |
#--------------------------------------------------------------
# This is a demo file intended to show the use of the SNIC algorithm
# Please compile the C files of snic.h and snic.c using:
# "python snic.c" on the command prompt prior to using this file.
#
# To see the demo use: "python SNICdemo.py" on the command pro... | [
"cffi.FFI",
"timeit.default_timer",
"numpy.asarray",
"numpy.zeros",
"PIL.Image.open",
"numpy.array",
"PIL.Image.fromarray",
"_snic.lib.SNIC_main"
] | [((854, 873), 'PIL.Image.open', 'Image.open', (['imgname'], {}), '(imgname)\n', (864, 873), False, 'from PIL import Image\n'), ((906, 921), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (916, 921), True, 'import numpy as np\n'), ((1302, 1334), 'numpy.zeros', 'np.zeros', (['(h, w)'], {'dtype': 'np.int32'}), '... |
"""
@brief test log(time=16s)
"""
import unittest
import numpy
from pandas import DataFrame
from pyquickhelper.pycode import ExtTestCase
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import BernoulliNB
from skl2onnx import convert_skl... | [
"unittest.main",
"pandas.DataFrame",
"mlprodict.tools.asv_options_helper.get_opset_number_from_onnx",
"numpy.abs",
"sklearn.model_selection.train_test_split",
"mlprodict.tools.asv_options_helper.get_ir_version_from_onnx",
"sklearn.datasets.make_classification",
"skl2onnx.common.data_types.FloatTensorT... | [((3510, 3525), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3523, 3525), False, 'import unittest\n'), ((783, 893), 'sklearn.datasets.make_classification', 'make_classification', ([], {'n_classes': 'n_classes', 'n_features': '(100)', 'n_samples': '(1000)', 'random_state': '(42)', 'n_informative': '(7)'}), '(n_c... |
import numpy as np
from mushroom.algorithms.agent import Agent
from mushroom.approximators import Regressor
from mushroom.approximators.parametric import LinearApproximator
class SAC(Agent):
"""
Stochastic Actor critic in the episodic setting as presented in:
"Model-Free Reinforcement Learning with Conti... | [
"numpy.zeros",
"mushroom.approximators.Regressor"
] | [((1497, 1570), 'mushroom.approximators.Regressor', 'Regressor', (['LinearApproximator'], {'input_shape': 'input_shape', 'output_shape': '(1,)'}), '(LinearApproximator, input_shape=input_shape, output_shape=(1,))\n', (1506, 1570), False, 'from mushroom.approximators import Regressor\n'), ((1620, 1650), 'numpy.zeros', '... |
from Binary.Scripts.utils import *
import scipy.optimize as opt
from scipy import stats
from sklearn.linear_model import LinearRegression
import numpy as np
np.random.seed(1234)
#
#
def obj_fun(theta, x, y_):
pre_dis = np.dot(x, theta)
loss = np.sum((pre_dis - y_) ** 2)
return loss
class xa... | [
"numpy.zeros_like",
"numpy.random.seed",
"numpy.sum",
"numpy.copy",
"numpy.abs",
"scipy.stats.norm",
"numpy.zeros",
"numpy.ones",
"sklearn.linear_model.LinearRegression",
"numpy.shape",
"numpy.random.randint",
"numpy.linalg.norm",
"numpy.random.random",
"numpy.array",
"numpy.random.choic... | [((157, 177), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (171, 177), True, 'import numpy as np\n'), ((233, 249), 'numpy.dot', 'np.dot', (['x', 'theta'], {}), '(x, theta)\n', (239, 249), True, 'import numpy as np\n'), ((261, 288), 'numpy.sum', 'np.sum', (['((pre_dis - y_) ** 2)'], {}), '((pre_d... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scikitplot.metrics import plot_confusion_matrix, plot_roc
class Plotting():
def plot_losses(self, training_losses, validation_losses):
plt.figure()
epochs = range(len(training_losses))
line1 = plt.plot(epochs, trai... | [
"matplotlib.pyplot.title",
"pandas.DataFrame",
"matplotlib.pyplot.show",
"numpy.ceil",
"matplotlib.pyplot.plot",
"scikitplot.metrics.plot_roc",
"matplotlib.pyplot.legend",
"numpy.transpose",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"scikitplot.metrics.plot_confus... | [((225, 237), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (235, 237), True, 'import matplotlib.pyplot as plt\n'), ((299, 355), 'matplotlib.pyplot.plot', 'plt.plot', (['epochs', 'training_losses'], {'label': '"""Training Loss"""'}), "(epochs, training_losses, label='Training Loss')\n", (307, 355), True, ... |
import meshio
import numpy as np
from src.htc_calculator.reference_face import ReferenceFace
from src.htc_calculator.activated_reference_face import ActivatedReferenceFace
from src.htc_calculator.construction import Material, Layer, ComponentConstruction
from src.htc_calculator.meshing.mesh_setup import MeshSetup
... | [
"src.htc_calculator.reference_face.ReferenceFace",
"src.htc_calculator.construction.Layer",
"src.htc_calculator.meshing.mesh_setup.MeshSetup",
"numpy.array",
"src.htc_calculator.construction.Material",
"src.htc_calculator.construction.ComponentConstruction",
"src.htc_calculator.activated_reference_face.... | [((410, 464), 'numpy.array', 'np.array', (['[[0, 0, 0], [5, 0, 0], [5, 5, 0], [0, 5, 0]]'], {}), '([[0, 0, 0], [5, 0, 0], [5, 5, 0], [0, 5, 0]])\n', (418, 464), True, 'import numpy as np\n'), ((545, 640), 'src.htc_calculator.construction.Material', 'Material', ([], {'name': '"""concrete"""', 'density': '(2600)', 'speci... |
import numpy as np
from PuzzleLib.Backend import gpuarray
from PuzzleLib.Backend.gpuarray import memoryPool as memPool
from PuzzleLib.Backend.Kernels import Pad
from PuzzleLib.Modules.Module import ModuleError, Module
from PuzzleLib.Modules.Pad2D import PadMode
class Pad1D(Module):
def __init__(self, pad, mode="co... | [
"PuzzleLib.Modules.Pad2D.PadMode",
"PuzzleLib.Backend.Kernels.Pad.reflectpad1dBackward",
"numpy.random.randn",
"numpy.allclose",
"PuzzleLib.Backend.gpuarray.empty",
"numpy.isclose",
"PuzzleLib.Backend.gpuarray.dtypesSupported",
"PuzzleLib.Backend.Kernels.Pad.reflectpad1d",
"PuzzleLib.Modules.Module.... | [((2767, 2841), 'numpy.allclose', 'np.allclose', (['hostOutData[:, :, lpad:hostOutData.shape[2] - rpad]', 'hostData'], {}), '(hostOutData[:, :, lpad:hostOutData.shape[2] - rpad], hostData)\n', (2778, 2841), True, 'import numpy as np\n'), ((2851, 2917), 'numpy.isclose', 'np.isclose', (['hostOutData[0, 0, hostOutData.sha... |
import sys
import os
import numpy as np
import tensorflow as tf
import math
import random
from tensorflow import keras
'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
'''
import matplotlib.pyplot as plt
class FittedQAgent():
'''
abstract class for the Tor... | [
"numpy.save",
"tensorflow.keras.models.load_model",
"matplotlib.pyplot.plot",
"tensorflow.train.Saver",
"numpy.argmax",
"tensorflow.global_variables_initializer",
"tensorflow.keras.backend.clear_session",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.InputLayer",
"matplotlib.pyplot.fig... | [((2357, 2385), 'numpy.random.shuffle', 'np.random.shuffle', (['randomize'], {}), '(randomize)\n', (2374, 2385), True, 'import numpy as np\n'), ((6431, 6463), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(16.0, 12.0)'}), '(figsize=(16.0, 12.0))\n', (6441, 6463), True, 'import matplotlib.pyplot as plt\n')... |
from __future__ import print_function
import unittest
import numpy as np
from openmdao.api import Problem, IndepVarComp, Group
from openmdao.utils.assert_utils import assert_rel_error, assert_check_partials
from CADRE.battery_dymos import BatterySOCComp
class TestBatteryDymos(unittest.TestCase):
@classmethod
... | [
"openmdao.api.IndepVarComp",
"numpy.set_printoptions",
"CADRE.battery_dymos.BatterySOCComp",
"openmdao.api.Group",
"numpy.ones",
"openmdao.utils.assert_utils.assert_check_partials",
"numpy.random.rand",
"numpy.all"
] | [((1013, 1031), 'numpy.random.rand', 'np.random.rand', (['nn'], {}), '(nn)\n', (1027, 1031), True, 'import numpy as np\n'), ((1182, 1217), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(1024)'}), '(linewidth=1024)\n', (1201, 1217), True, 'import numpy as np\n'), ((1275, 1301), 'openmdao.utils.ass... |
""" This module computes alignment solutions between all "a priori" solutions
for a dataset and GAIA.
"""
import pytest
import numpy as np
from drizzlepac.haputils import testutils
from ..resources import BaseACS, BaseWFC3
def compare_apriori(dataset):
"""This test will perform fits between ALL a priori s... | [
"pytest.mark.parametrize",
"numpy.allclose",
"numpy.sqrt",
"drizzlepac.haputils.testutils.compare_wcs_alignment"
] | [((925, 965), 'drizzlepac.haputils.testutils.compare_wcs_alignment', 'testutils.compare_wcs_alignment', (['dataset'], {}), '(dataset)\n', (956, 965), False, 'from drizzlepac.haputils import testutils\n'), ((1506, 1584), 'numpy.sqrt', 'np.sqrt', (["(pipeline_results['offset_x'] ** 2 + pipeline_results['offset_y'] ** 2)"... |
"""
Filter kernels (Szeliski 3.2)
"""
import numpy as np
KERNEL_BILINEAR = 1.0/16 * np.array(((1, 2, 1),
(2, 4, 2),
(1, 2, 1)))
KERNEL_GAUSSIAN = 1.0/256 * np.array(((1, 4, 6, 4, 1),
(4, 16, 24, 16, 4),
... | [
"numpy.arange",
"numpy.array",
"numpy.exp"
] | [((86, 129), 'numpy.array', 'np.array', (['((1, 2, 1), (2, 4, 2), (1, 2, 1))'], {}), '(((1, 2, 1), (2, 4, 2), (1, 2, 1)))\n', (94, 129), True, 'import numpy as np\n'), ((231, 340), 'numpy.array', 'np.array', (['((1, 4, 6, 4, 1), (4, 16, 24, 16, 4), (6, 24, 36, 24, 6), (4, 16, 24, 16, 4\n ), (1, 4, 6, 4, 1))'], {}), ... |
import numpy as np
import torch
import torch.nn as nn
from torch.distributions.log_normal import LogNormal
from geometry import get_ang,get_dih,get_cb
fold_params = {
"SG7" : np.array([[[-2,3,6,7,6,3,-2]]])/21,
"SG9" : np.array([[[-21,14,39,54,59,54,39,14,-21]]])/231,
"DCUT" : 19.5,
"ALPHA" ... | [
"torch.eye",
"geometry.get_cb",
"torch.cat",
"torch.randn",
"torch.cos",
"torch.ceil",
"torch.arange",
"torch.isnan",
"torch.ones",
"torch.hstack",
"torch.triu_indices",
"geometry.get_dih",
"torch.exp",
"geometry.get_ang",
"torch.zeros",
"torch.log",
"torch.zeros_like",
"torch.wher... | [((379, 471), 'numpy.array', 'np.array', (['[[-0.676, -1.294, 0.0], [0.0, 0.0, 0.0], [1.5, -0.174, 0.0]]'], {'dtype': 'np.float32'}), '([[-0.676, -1.294, 0.0], [0.0, 0.0, 0.0], [1.5, -0.174, 0.0]],\n dtype=np.float32)\n', (387, 471), True, 'import numpy as np\n'), ((618, 634), 'numpy.deg2rad', 'np.deg2rad', (['(10.0... |
# coding: utf-8
# In[6]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
get_ipython().magic('matplotlib inline')
#D:\Book4.csv
data = input('enter the data path ')
sep = input('enter the seperater ')
df = pd.read_csv(data,sep)
#select all non-num data
ap=df.select_dtypes(exclude=['number'... | [
"pandas.read_csv",
"numpy.array"
] | [((235, 257), 'pandas.read_csv', 'pd.read_csv', (['data', 'sep'], {}), '(data, sep)\n', (246, 257), True, 'import pandas as pd\n'), ((385, 398), 'numpy.array', 'np.array', (['df2'], {}), '(df2)\n', (393, 398), True, 'import numpy as np\n')] |
import numpy as np
from os import path
import MCPM
class TpfRectangles(object):
"""
Keeps information on rectangles that are used in TPF files.
Note that there may be multple rectangles for a single TPF,
some rectangles are not full,
and some may have width or height of 1 pixel
"""
... | [
"numpy.abs",
"numpy.argmax",
"numpy.argmin",
"numpy.argsort",
"numpy.array",
"numpy.loadtxt",
"os.path.join",
"numpy.sqrt"
] | [((814, 857), 'os.path.join', 'path.join', (['MCPM.MODULE_PATH', '"""data"""', 'subdir'], {}), "(MCPM.MODULE_PATH, 'data', subdir)\n", (823, 857), False, 'from os import path\n'), ((875, 924), 'os.path.join', 'path.join', (['directory', '"""tpf_rectangles"""', 'file_name'], {}), "(directory, 'tpf_rectangles', file_name... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 17:54:12 2020
@author: Shaji,Charu,Selva
"""
import scipy
import numpy as np
import pandas as pd
from sklearn.impute import KNNImputer
pd.set_option('mode.chained_assignment', None)
from . import helper
from . import exceptions
def get_distance(dataset,
... | [
"pandas.DataFrame",
"pandas.crosstab",
"numpy.corrcoef",
"scipy.stats.skew",
"sklearn.impute.KNNImputer",
"scipy.stats.chi2_contingency",
"scipy.stats.kendalltau",
"pandas.set_option",
"pandas.to_numeric",
"numpy.sqrt"
] | [((187, 233), 'pandas.set_option', 'pd.set_option', (['"""mode.chained_assignment"""', 'None'], {}), "('mode.chained_assignment', None)\n", (200, 233), True, 'import pandas as pd\n'), ((12490, 12507), 'pandas.crosstab', 'pd.crosstab', (['x', 'y'], {}), '(x, y)\n', (12501, 12507), True, 'import pandas as pd\n'), ((13326... |
import cv2 as cv
import os
import glob
import numpy as np
# Checkerboard contains 25mm squares - 8x6 vertices, 9x7 squares
# 28mm (equivalent) f/1.8 lens with OIS
# https://www.camerafv5.com/devices/manufacturers/google/pixel_3a_xl_bonito_0/
# 12.2Mp 1/2.55-inch sensor with 1.4µm pixel width
pixel_size = 1.... | [
"numpy.mean",
"glob.glob",
"cv2.imshow",
"os.chdir",
"cv2.undistort",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.destroyAllWindows",
"cv2.resize",
"cv2.getOptimalNewCameraMatrix",
"cv2.waitKey",
"cv2.projectPoints",
"cv2.calibrateCamera",
"cv2.norm",
"numpy.savez",
"cv2.drawChessboardCorners"... | [((501, 558), 'numpy.mean', 'np.mean', (['[23.36, 23.35, 23.32, 23.22, 23.43, 23.2, 23.28]'], {}), '([23.36, 23.35, 23.32, 23.22, 23.43, 23.2, 23.28])\n', (508, 558), True, 'import numpy as np\n'), ((584, 616), 'numpy.zeros', 'np.zeros', (['(8 * 6, 3)', 'np.float32'], {}), '((8 * 6, 3), np.float32)\n', (592, 616), True... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import codecademylib3
null_outcomes = []
for i in range(10000):
simulated_monthly_visitors = np.random.choice(['y', 'n'], size=500, p=[0.1, 0.9])
num_purchased = np.sum(simulated_monthly_visitors == 'y')
null_outcomes.append(num_purchased)... | [
"numpy.percentile",
"numpy.sum",
"numpy.random.choice"
] | [((368, 405), 'numpy.percentile', 'np.percentile', (['null_outcomes', '[5, 95]'], {}), '(null_outcomes, [5, 95])\n', (381, 405), True, 'import numpy as np\n'), ((168, 220), 'numpy.random.choice', 'np.random.choice', (["['y', 'n']"], {'size': '(500)', 'p': '[0.1, 0.9]'}), "(['y', 'n'], size=500, p=[0.1, 0.9])\n", (184, ... |
import json
import logging
import multiprocessing as mp
import sys
import pandas as pd
import random
import daisy
import numpy as np
from pymongo import MongoClient
from scipy.spatial import KDTree
import sqlite3
from funlib.math import cantor_number
from . import database, synapse, evaluation
logger = logging.getLo... | [
"pandas.DataFrame",
"daisy.open_ds",
"json.load",
"daisy.Coordinate",
"random.sample",
"numpy.unique",
"lsd.local_segmentation.LocalSegmentationExtractor",
"daisy.Roi",
"numpy.mean",
"numpy.array",
"sqlite3.connect",
"scipy.spatial.KDTree",
"multiprocessing.Pool",
"funlib.math.cantor_numbe... | [((307, 334), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (324, 334), False, 'import logging\n'), ((6222, 6236), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (6234, 6236), True, 'import pandas as pd\n'), ((12961, 13037), 'daisy.open_ds', 'daisy.open_ds', (["seg_config['fragmen... |
import numpy as np
import tensorflow as tf
class AbstractDiayn:
def __init__(self, n_skills, n_envs, train_on_trajectory=None):
assert train_on_trajectory is not None, "must pass argparse args"
self.train_on_trajectory = train_on_trajectory
self.n_skills = n_skills
self.n_envs = n_... | [
"tensorflow.convert_to_tensor",
"numpy.arange",
"collections.OrderedDict",
"tf_agents.trajectories.time_step.TimeStep",
"numpy.random.shuffle"
] | [((791, 828), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['augmented_image'], {}), '(augmented_image)\n', (811, 828), True, 'import tensorflow as tf\n'), ((898, 965), 'collections.OrderedDict', 'OrderedDict', (["[('direction', direction), ('image', augmented_image)]"], {}), "([('direction', direction), ('... |
"""
PROJECT: IMAGE CLASSIFICATION FOR DOG - CAT IMAGEs FROM KAGGLE
"""
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
import numpy
import cv2
import os
import glob
# inpu... | [
"tensorflow.keras.layers.Dense",
"sklearn.model_selection.train_test_split",
"cv2.imread",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.array",
"tensorflow.keras.models.Sequential",
"sklearn.neural_network.MLPClassifier",
"sklearn.svm.SVC",
"glob.glob",
"cv2.resize"
] | [((341, 402), 'glob.glob', 'glob.glob', (['"""D:/SP19/CIS-559_data mining/PROJECT/train1/*.jpg"""'], {}), "('D:/SP19/CIS-559_data mining/PROJECT/train1/*.jpg')\n", (350, 402), False, 'import glob\n'), ((1147, 1172), 'numpy.array', 'numpy.array', (['imagemaxtrix'], {}), '(imagemaxtrix)\n', (1158, 1172), False, 'import n... |
#!/usr/bin/python3
"""
Simple artificial neuron with 2d input
- input two numerical values separated by ","
- usage: python neuron.py --input 1,0
"""
import argparse
import numpy as np
def sigmoid(x):
"""Sigmoid activation function: f(x) = 1 / (1 + e^(-x))
"""
return 1 / (1 + np.exp(-x))
class Ne... | [
"numpy.dot",
"numpy.exp",
"numpy.array",
"argparse.ArgumentParser"
] | [((650, 718), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""[Info] neuron with two inputs"""'}), "(description='[Info] neuron with two inputs')\n", (673, 718), False, 'import argparse\n'), ((1034, 1050), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (1042, 1050), True, 'imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.