code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: a-poor
Sample Genetic Algorithm
"""
import numpy as np
from GenAlgLib import GeneticAlgorithm
# Defining custom fitness function
def fitness(genome):
total = 1
for n in genome:
total += np.sqrt(np.e**n)
return total
# Create instance o... | [
"GenAlgLib.GeneticAlgorithm",
"numpy.sqrt"
] | [((336, 436), 'GenAlgLib.GeneticAlgorithm', 'GeneticAlgorithm', (['(10)', '(30)', '(500)'], {'x_rate': '(0.9)', 'mutation_rate': '(0.005)', 'multithread': '(True)', 'random_seed': '(0)'}), '(10, 30, 500, x_rate=0.9, mutation_rate=0.005, multithread=\n True, random_seed=0)\n', (352, 436), False, 'from GenAlgLib impor... |
# -*- coding: utf-8 -*-
import unittest
import numpy as np
from arpym_template.estimation.flexible_probabilities import FlexibleProbabilities
from arpym_template.toolbox.min_rel_entropy import min_rel_entropy
class TestFP(unittest.TestCase):
def setUp(self):
pass
def test_mean_cov(self):
da... | [
"unittest.main",
"numpy.random.randn",
"numpy.ones",
"arpym_template.toolbox.min_rel_entropy.min_rel_entropy",
"numpy.mean",
"arpym_template.estimation.flexible_probabilities.FlexibleProbabilities",
"numpy.array",
"numpy.cov"
] | [((1107, 1122), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1120, 1122), False, 'import unittest\n'), ((325, 348), 'numpy.random.randn', 'np.random.randn', (['(100)', '(2)'], {}), '(100, 2)\n', (340, 348), True, 'import numpy as np\n'), ((362, 389), 'arpym_template.estimation.flexible_probabilities.FlexiblePro... |
import os
import numpy as np
import torch
from torch import nn
from torch.utils.data import DataLoader, sampler
import matplotlib.pyplot as plt
from torchvision import transforms as T
import argparse
from tqdm import tqdm
import cv2
from self_sup_data.mvtec import SelfSupMVTecDataset, CLASS_NAMES, TEXTURES, OBJECTS
f... | [
"tqdm.tqdm",
"torch.utils.data.get_worker_info",
"numpy.random.seed",
"argparse.ArgumentParser",
"os.makedirs",
"torch.manual_seed",
"torchvision.transforms.RandomRotation",
"torchvision.transforms.RandomVerticalFlip",
"os.path.exists",
"self_sup_data.mvtec.SelfSupMVTecDataset",
"torch.optim.lr_... | [((16895, 16921), 'numpy.random.seed', 'np.random.seed', (['seed_value'], {}), '(seed_value)\n', (16909, 16921), True, 'import numpy as np\n'), ((16926, 16955), 'torch.manual_seed', 'torch.manual_seed', (['seed_value'], {}), '(seed_value)\n', (16943, 16955), False, 'import torch\n'), ((16960, 16998), 'torch.cuda.manual... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import time
import numpy as np
import os
import defenses
import data_utils as data
import cvxpy as cvx
import tensorflow as tf
import random
def poison_with_influence_... | [
"data_utils.add_points",
"numpy.load",
"numpy.random.seed",
"numpy.sum",
"numpy.allclose",
"numpy.mean",
"numpy.arange",
"numpy.linalg.norm",
"numpy.round",
"os.path.join",
"random.randint",
"numpy.copy",
"os.path.exists",
"numpy.append",
"numpy.min",
"numpy.all",
"numpy.logical_and"... | [((1329, 1447), 'os.path.join', 'os.path.join', (['output_root', "('grad_influence_wrt_input_val_%s_testidx_%s.npy' % (model.model_name,\n test_description))"], {}), "(output_root, 'grad_influence_wrt_input_val_%s_testidx_%s.npy' %\n (model.model_name, test_description))\n", (1341, 1447), False, 'import os\n'), (... |
import cv2
import imutils
from imutils.video import VideoStream
import numpy as np
from keras.models import load_model
import utilsImg
# ****************************************************************************
thresholds = 0.60
# ****************************************************************************
cap = V... | [
"keras.models.load_model",
"imutils.video.VideoStream",
"utilsImg.preProcessing",
"cv2.waitKey",
"numpy.asarray",
"numpy.amax",
"imutils.resize",
"cv2.imshow",
"cv2.resize"
] | [((355, 384), 'keras.models.load_model', 'load_model', (['"""digits_model.h5"""'], {}), "('digits_model.h5')\n", (365, 384), False, 'from keras.models import load_model\n'), ((466, 498), 'imutils.resize', 'imutils.resize', (['frame'], {'width': '(320)'}), '(frame, width=320)\n', (480, 498), False, 'import imutils\n'), ... |
import concurrent.futures
import logging
import pytest
import sys
import numpy as np
import zappy.executor
import zappy.direct
import zappy.spark
import zarr
from numpy.testing import assert_allclose
from pyspark.sql import SparkSession
# add/change to "pywren_ndarray" to run the tests using Pywren (requires Pywren t... | [
"uuid.uuid4",
"zarr.open",
"numpy.sum",
"numpy.multiply",
"numpy.median",
"numpy.asarray",
"pytest.fixture",
"apache_beam.Pipeline",
"pyspark.sql.SparkSession.builder.master",
"apache_beam.options.pipeline_options.PipelineOptions",
"numpy.vstack",
"numpy.mean",
"numpy.array",
"zarr.TempSto... | [((880, 896), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (894, 896), False, 'import pytest\n'), ((1112, 1128), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1126, 1128), False, 'import pytest\n'), ((1179, 1195), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1193, 1195), False, 'import pytes... |
import random, re, numpy, operator
import macro_utils
from error_messages import error_messages
tokens = ["+", "-", "*", "/", "^", "(", ")"]
async def tokenize(request):
tokenized = []
temp_str = ""
for char in request:
if char == ' ':
if temp_str:
tokenized += [temp_st... | [
"macro_utils.expand_macro",
"random.randint",
"numpy.argmax",
"random.choice",
"numpy.argmin",
"re.compile"
] | [((1742, 1789), 're.compile', 're.compile', (['"""(?P<roll>.*?) *# *(?P<comment>.*)"""'], {}), "('(?P<roll>.*?) *# *(?P<comment>.*)')\n", (1752, 1789), False, 'import random, re, numpy, operator\n'), ((4178, 4222), 're.compile', 're.compile', (['f"""^{roll_string}{count_suffix}$"""'], {}), "(f'^{roll_string}{count_suff... |
from collections import deque, namedtuple
import operator
import datetime
import numpy as np
import pandas as pa
import inspect
import types
import sys
import cython
from .nodes import (
MDFNode,
MDFEvalNode,
MDFIterator,
MDFIteratorFactory,
MDFCallable,
_isgeneratorfunction,
_is_member_of,... | [
"pandas.DataFrame",
"pandas.datetools.BDay",
"numpy.isnan",
"inspect.getargspec",
"pandas.Series",
"collections.namedtuple",
"cython.declare",
"numpy.ndarray",
"collections.deque"
] | [((567, 607), 'cython.declare', 'cython.declare', (['int', 'sys.version_info[0]'], {}), '(int, sys.version_info[0])\n', (581, 607), False, 'import cython\n'), ((27312, 27380), 'collections.namedtuple', 'namedtuple', (['"""PerCtxData"""', "['value', 'generator', 'date', 'is_valid']"], {}), "('PerCtxData', ['value', 'gen... |
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn import ensemble
from sklearn.utils import validation
import tensorflow as tf
from scipy import stats
from scipy.stats import pearsonr
from sklearn.metrics import mean_absolute_error, mean_squared_error, ... | [
"numpy.full",
"os.mkdir",
"src.data.make_train_test_data",
"numpy.random.seed",
"numpy.save",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"os.path.exists",
"tensorflow.keras.callbacks.ModelCheckpoint",
"tensorflow.compat.v1.set_random_seed",
"numpy.arange",
"src.data.get_FLX_inputs",
"src.... | [((652, 669), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (666, 669), True, 'import numpy as np\n'), ((670, 702), 'tensorflow.compat.v1.set_random_seed', 'tf.compat.v1.set_random_seed', (['(13)'], {}), '(13)\n', (698, 702), True, 'import tensorflow as tf\n'), ((2149, 2281), 'src.data.get_FLX_inputs',... |
# AUTOGENERATED! DO NOT EDIT! File to edit: edge extraction.ipynb (unless otherwise specified).
__all__ = ['histogram_equalize', 'raster_edges']
# Cell
import os
import subprocess
from tempfile import TemporaryDirectory
import cv2
import numpy as np
# Cell
def histogram_equalize(data, max_val=None, endpoint=False... | [
"cv2.Canny",
"cv2.imwrite",
"numpy.asarray",
"numpy.shape",
"numpy.argsort",
"cv2.imread",
"subprocess.check_call"
] | [((341, 355), 'numpy.shape', 'np.shape', (['data'], {}), '(data)\n', (349, 355), True, 'import numpy as np\n'), ((471, 492), 'numpy.argsort', 'np.argsort', (['data_flat'], {}), '(data_flat)\n', (481, 492), True, 'import numpy as np\n'), ((757, 792), 'cv2.imwrite', 'cv2.imwrite', (['f"""{name}_in.bmp"""', 'gray'], {}), ... |
import numpy as np
import cv2 as cv
from imutils.video import WebcamVideoStream
import glob
import time
import math
# Load previously saved calibration data
path = './camera_data/camera_calibration.npz'
npzfile = np.load(path)
#Camera Matrix
mtx = npzfile[npzfile.files[0]]
#Distortion Matrix
dist = npzfile[npzfile.fi... | [
"numpy.load",
"numpy.sum",
"math.asin",
"cv2.bitwise_and",
"cv2.medianBlur",
"cv2.arcLength",
"math.atan2",
"numpy.ones",
"numpy.shape",
"cv2.imshow",
"cv2.inRange",
"cv2.line",
"cv2.cvtColor",
"numpy.transpose",
"cv2.solvePnPRansac",
"numpy.reshape",
"cv2.getTrackbarPos",
"cv2.des... | [((215, 228), 'numpy.load', 'np.load', (['path'], {}), '(path)\n', (222, 228), True, 'import numpy as np\n'), ((465, 476), 'time.time', 'time.time', ([], {}), '()\n', (474, 476), False, 'import time\n'), ((490, 785), 'numpy.array', 'np.array', (['[[0, 0, 0], [0.0255, 0, 0], [-0.0255, 0, 0], [0, 0.0255, 0], [0, -0.0255,... |
# -*- coding: utf-8 -*-
import time
import os
NUM_THREADS = "1"
os.environ["OMP_NUM_THREADS"] = NUM_THREADS
os.environ["OPENBLAS_NUM_THREADS"] = NUM_THREADS
os.environ["MKL_NUM_THREADS"] = NUM_THREADS
os.environ["VECLIB_MAXIMUM_THREADS"] = NUM_THREADS
os.environ["NUMEXPR_NUM_THREADS"] = NUM_THREADS
import numpy as np
... | [
"numpy.outer",
"numpy.log",
"numpy.copy",
"numpy.argmax",
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"scipy.special.psi",
"time.time",
"numpy.where",
"numpy.array",
"numpy.linalg.norm",
"numpy.random.rand",
"numpy.dot",
"numpy.sqrt"
] | [((1892, 1911), 'numpy.copy', 'np.copy', (['self.theta'], {}), '(self.theta)\n', (1899, 1911), True, 'import numpy as np\n'), ((2792, 2840), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.num_docs, self.num_topics)'}), '(shape=(self.num_docs, self.num_topics))\n', (2800, 2840), True, 'import numpy as np\n'), ((3024, ... |
import os
import time
import numpy as np
import tensorflow as tf
from face_py import facenet
from face_py import detect_face
from face_py import align_dataset_mtcnn
import cv2
import math
from util import Logging
class FeatureExtractor():
def __init__(self) :
start_time = time.time()
with tf.Gra... | [
"util.Logging.i",
"numpy.save",
"face_py.align_dataset_mtcnn.main",
"face_py.detect_face.create_mtcnn",
"math.ceil",
"face_py.facenet.prewhiten",
"os.path.realpath",
"numpy.zeros",
"tensorflow.Session",
"time.time",
"tensorflow.ConfigProto",
"face_py.facenet.load_model",
"face_py.facenet.to_... | [((3111, 3138), 'numpy.save', 'np.save', (['"""feature"""', 'feature'], {}), "('feature', feature)\n", (3118, 3138), True, 'import numpy as np\n'), ((289, 300), 'time.time', 'time.time', ([], {}), '()\n', (298, 300), False, 'import time\n'), ((1317, 1328), 'time.time', 'time.time', ([], {}), '()\n', (1326, 1328), False... |
#!/usr/bin/env python
# coding: utf-8
# # **<NAME> - Tracking Data Assignment**
#
# Sunday 11th October 2020
#
# ---
# In[1]:
import pandas as pd
import numpy as np
import datetime
# imports required by data prep functions
import json
# Laurie's libraries
import scipy.signal as signal
import matplotlib.animation ... | [
"numpy.sum",
"matplotlib.pyplot.clf",
"numpy.ones",
"numpy.isnan",
"collections.defaultdict",
"numpy.mean",
"numpy.arange",
"numpy.convolve",
"os.path.join",
"numpy.round",
"numpy.unique",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"numpy.linspace",
"pandas.isna",
"matplotlib.pyplo... | [((390, 445), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (413, 445), False, 'import warnings\n'), ((44945, 45046), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""Elfsborg_Goal_1.pdf"""'], {'dpi': '(300)', 'format': '"""... |
import os
import random
import torch
import torch.utils.data as data
from torchvision.datasets.folder import default_loader
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
def get_image_list(root):
# images = []
# for class_dir in os.listd... | [
"numpy.load",
"os.path.join",
"torch.zeros_like",
"torch.zeros",
"torchvision.transforms.ToTensor",
"PIL.Image.open",
"random.random",
"numpy.random.randint",
"torchvision.transforms.Grayscale",
"torchvision.datasets.folder.default_loader",
"torchvision.transforms.RandomCrop",
"torchvision.tra... | [((728, 751), 'torch.zeros_like', 'torch.zeros_like', (['image'], {}), '(image)\n', (744, 751), False, 'import torch\n'), ((3760, 3816), 'torch.tensor', 'torch.tensor', (['[0.229, 0.224, 0.225]'], {'dtype': 'torch.float32'}), '([0.229, 0.224, 0.225], dtype=torch.float32)\n', (3772, 3816), False, 'import torch\n'), ((38... |
# Make the "Fraction" class available here.
from util.math.fraction import Fraction
from util.math.points import mesh, chebyshev, polynomials, \
polynomial_indices, fekete_indices, fekete_points
from util.math.pairs import pair_to_index, index_to_pair, \
num_from_pairs, pairwise_distance
# Access different poly... | [
"numpy.log2",
"util.optimize.min_on_line",
"util.math.fraction.Fraction"
] | [((4318, 4336), 'util.math.fraction.Fraction', 'Fraction', (['(1)', '(1e+17)'], {}), '(1, 1e+17)\n', (4326, 4336), False, 'from util.math.fraction import Fraction\n'), ((4391, 4406), 'util.math.fraction.Fraction', 'Fraction', (['power'], {}), '(power)\n', (4399, 4406), False, 'from util.math.fraction import Fraction\n'... |
import cv2 as cv
import os
import numpy as np
cfg_file_path = "Hue_Booster_Config.txt"
os.chdir(os.path.dirname(__file__)) # Makes working directory as .py file
cfg_file = open(cfg_file_path, 'r')
r_cfg_file = cfg_file.readlines()
input_folder = r_cfg_file[0]
input_folder = input_folder[:-1] # Deletin... | [
"os.mkdir",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.dirname",
"os.walk",
"os.path.exists",
"cv2.imread",
"numpy.where"
] | [((579, 607), 'os.path.exists', 'os.path.exists', (['input_folder'], {}), '(input_folder)\n', (593, 607), False, 'import os\n'), ((104, 129), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (119, 129), False, 'import os\n'), ((652, 673), 'os.walk', 'os.walk', (['input_folder'], {}), '(input_fo... |
import nltk, numpy, tflearn, tensorflow, random, json, pickle, streamlit as st, SessionState, sys
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()
from PIL import Image
#load images
center = Image.open('images/pc.jpg')
pc_image = Image.open('images/pc2.jpg')
pc =Image.open('images/pc3.jpg... | [
"pickle.dump",
"json.load",
"streamlit.image",
"streamlit.text_input",
"tflearn.fully_connected",
"numpy.argmax",
"SessionState.get",
"tflearn.regression",
"PIL.Image.open",
"streamlit.title",
"nltk.stem.lancaster.LancasterStemmer",
"tflearn.DNN",
"streamlit.sidebar.title",
"numpy.array",
... | [((157, 175), 'nltk.stem.lancaster.LancasterStemmer', 'LancasterStemmer', ([], {}), '()\n', (173, 175), False, 'from nltk.stem.lancaster import LancasterStemmer\n'), ((222, 249), 'PIL.Image.open', 'Image.open', (['"""images/pc.jpg"""'], {}), "('images/pc.jpg')\n", (232, 249), False, 'from PIL import Image\n'), ((261, 2... |
"""
Project: RadarBook
File: frank_code.py
Created by: <NAME>
One: 1/26/2019
Created with: PyCharm
Copyright (C) 2019 Artech House (<EMAIL>)
This file is part of Introduction to Radar Using Python and MATLAB
and can not be copied and/or distributed without the express permission of Artech House.
"""
from scipy.constan... | [
"numpy.exp"
] | [((613, 626), 'numpy.exp', 'exp', (['(1.0j * p)'], {}), '(1.0j * p)\n', (616, 626), False, 'from numpy import exp\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 16:54:56 2021
@author: dawooood
Usage
python3 model_hum_corr.py path_to_model_features path_to_avg_human_ratings
"""
import sys
import pandas as pd
import numpy as np
from sklearn.model_selection import GridSearchCV
from sklearn.linear_model i... | [
"sklearn.model_selection.GridSearchCV",
"pandas.read_csv",
"sklearn.model_selection.cross_validate",
"numpy.corrcoef",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.transpose",
"numpy.reshape",
"sklearn.linear_model.Ridge"
] | [((437, 472), 'pandas.read_csv', 'pd.read_csv', (['human_mat'], {'header': 'None'}), '(human_mat, header=None)\n', (448, 472), True, 'import pandas as pd\n'), ((548, 566), 'numpy.zeros', 'np.zeros', (['(18, 18)'], {}), '((18, 18))\n', (556, 566), True, 'import numpy as np\n'), ((894, 926), 'numpy.reshape', 'np.reshape'... |
import numpy as np
from hardware import settings
from functions import *
class procedure(settings, atom):
def __init__(self, simulation=False):
self.simulation = simulation
super().__init__(self.simulation)
#### Procedures ####
def test(self, t=5e-8, ao=10., do=1):
ao_channels = {
... | [
"timeit.default_timer",
"numpy.exp",
"numpy.ones",
"numpy.linspace"
] | [((4770, 4792), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (4790, 4792), False, 'import timeit\n'), ((2881, 2913), 'numpy.linspace', 'np.linspace', (['(0.0001)', 't'], {'num': 'step'}), '(0.0001, t, num=step)\n', (2892, 2913), True, 'import numpy as np\n'), ((4002, 4026), 'numpy.ones', 'np.ones',... |
from typing import Union, Iterable, Sequence, Callable
import numpy as np
from .closed import prepare as prepare_closed
from .open import prepare as prepare_open
Line = Union[np.ndarray, Iterable[Sequence[float]]]
def _normalize_parameter(t):
if not (0 <= t <= 1):
raise ValueError('The interpolation pa... | [
"numpy.asarray"
] | [((434, 450), 'numpy.asarray', 'np.asarray', (['line'], {}), '(line)\n', (444, 450), True, 'import numpy as np\n')] |
from functools import partial
import numpy as np
import pyarrow.compute as pc
from vinum.core.functions import (
ConcatFunction,
FunctionType,
)
from vinum.parser.query import SQLOperator
SQL_OPERATOR_FUNCTIONS = {
SQLOperator.NEGATION: (np.negative, FunctionType.NUMPY),
SQLOperator.BINARY_NOT: (lamb... | [
"functools.partial",
"numpy.logical_or",
"numpy.logical_and"
] | [((1698, 1727), 'functools.partial', 'partial', (['np.isin'], {'invert': '(True)'}), '(np.isin, invert=True)\n', (1705, 1727), False, 'from functools import partial\n'), ((1835, 1870), 'numpy.logical_and', 'np.logical_and', (['(x >= low)', '(x <= high)'], {}), '(x >= low, x <= high)\n', (1849, 1870), True, 'import nump... |
# MIT License - Copyright <NAME> and contributors
# See the LICENSE.md file included in this source code package
"""Benchmarks for entropy estimation."""
import numpy as np
import timeit
setup = """
from ennemi import estimate_entropy
import numpy as np
rng = np.random.default_rng(0)
cov = np.array([
[ 1.0, 0.... | [
"timeit.repeat",
"numpy.mean",
"numpy.min"
] | [((1341, 1406), 'timeit.repeat', 'timeit.repeat', (['bench', 'setup'], {'repeat': '(5)', 'number': '(1)', 'globals': "{'N': n}"}), "(bench, setup, repeat=5, number=1, globals={'N': n})\n", (1354, 1406), False, 'import timeit\n'), ((1450, 1461), 'numpy.min', 'np.min', (['res'], {}), '(res)\n', (1456, 1461), True, 'impor... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
#os.environ['KMP_DUPLICATE_LIB_OK']='True'
from build_model import confusion_matrix, plot_confusion_matrix, plt, load_testdata
import numpy as np
import tensorflow as tf
import argparse
def load_data(dirname):
listfile=o... | [
"build_model.plt.savefig",
"numpy.set_printoptions",
"tensorflow.keras.models.load_model",
"argparse.ArgumentParser",
"build_model.plt.figure",
"numpy.argmax",
"numpy.array",
"build_model.plot_confusion_matrix",
"build_model.load_testdata",
"os.listdir"
] | [((319, 338), 'os.listdir', 'os.listdir', (['dirname'], {}), '(dirname)\n', (329, 338), False, 'import os\n'), ((1290, 1301), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (1298, 1301), True, 'import numpy as np\n'), ((1308, 1319), 'numpy.array', 'np.array', (['Y'], {}), '(Y)\n', (1316, 1319), True, 'import numpy as... |
"""
gunicorn --bind 0.0.0.0:5000 wsgi:app
"""
from flask import Flask, jsonify
from flask_swagger import swagger
from flask import redirect, session, request, json, render_template
from xgboost import XGBClassifier
import pandas as pd
import matplotlib.pyplot as plt
import shap
import pickle
import numpy as np
from job... | [
"tensorflow.keras.models.load_model",
"flask.request.args.get",
"flask.Flask",
"flask.json.dumps",
"numpy.array",
"flask_swagger.swagger",
"flask.render_template",
"joblib.load"
] | [((424, 439), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (429, 439), False, 'from flask import Flask, jsonify\n'), ((2815, 3070), 'flask.render_template', 'render_template', (['"""user_conversion.html"""'], {'shap_bar_graph': 'img_path', 'explanability': 'explanability', 'features': 'features', 'featur... |
from osgeo import ogr
import os
import numpy as np
from gdalhelpers.functions import create_points_at_angles_distance
PATH_DATA = os.path.join(os.path.dirname(__file__), "..", "tests", "test_data")
PATH_DATA_RESULTS = os.path.join(PATH_DATA, "results")
points = ogr.Open(os.path.join(PATH_DATA, "points.gpkg"))
angles... | [
"os.path.dirname",
"osgeo.ogr.GetDriverByName",
"gdalhelpers.functions.create_points_at_angles_distance",
"numpy.arange",
"os.path.join"
] | [((219, 253), 'os.path.join', 'os.path.join', (['PATH_DATA', '"""results"""'], {}), "(PATH_DATA, 'results')\n", (231, 253), False, 'import os\n'), ((373, 441), 'gdalhelpers.functions.create_points_at_angles_distance', 'create_points_at_angles_distance', (['points'], {'angles': 'angles', 'distance': '(25)'}), '(points, ... |
from multiprocessing import Pool
import numpy as np
import skimage
from . import saliency, utils
try:
import tensorflow as tf
except Exception:
import warnings
warnings.warn("Could not import tensorflow. DeepGaze models will not be runnable.")
class IttyKoch:
""" Python Implementation of the Itty K... | [
"numpy.log",
"tensorflow.get_collection",
"tensorflow.reset_default_graph",
"numpy.zeros",
"tensorflow.Session",
"numpy.array",
"multiprocessing.Pool",
"warnings.warn",
"skimage.filters.gaussian"
] | [((174, 262), 'warnings.warn', 'warnings.warn', (['"""Could not import tensorflow. DeepGaze models will not be runnable."""'], {}), "(\n 'Could not import tensorflow. DeepGaze models will not be runnable.')\n", (187, 262), False, 'import warnings\n'), ((3328, 3352), 'tensorflow.reset_default_graph', 'tf.reset_defaul... |
from deepSI.systems.system import System, System_deriv, System_data
import numpy as np
import jax.numpy as jnp
def f_double_pendulum(state, t=0, m1=1, m2=1, l1=1, l2=1, g=9.8):
t1, t2, w1, w2 = state
a1 = (l2 / l1) * (m2 / (m1 + m2)) * np.cos(t1 - t2)
a2 = (l1 / l2) * np.cos(t1 - t2)
f1 = -(l2 / l1) ... | [
"numpy.stack",
"functools.partial",
"matplotlib.pyplot.show",
"warnings.filterwarnings",
"jax.numpy.concatenate",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.patches.Circle",
"matplotlib.pyplot.figure",
"importlib.reload",
"matplotlib.pyplot.cla",
"numpy.sin",
"numpy.cos",
"moviep... | [((561, 587), 'numpy.stack', 'np.stack', (['[w1, w2, g1, g2]'], {}), '([w1, w2, g1, g2])\n', (569, 587), True, 'import numpy as np\n'), ((687, 758), 'jax.numpy.concatenate', 'jnp.concatenate', (['[(state[:2] + np.pi) % (2 * np.pi) - np.pi, state[2:]]'], {}), '([(state[:2] + np.pi) % (2 * np.pi) - np.pi, state[2:]])\n',... |
import pandas as pd
import numpy as np
from sklearn.svm import LinearSVC
from sklearn.preprocessing import LabelEncoder
train = pd.read_csv("../input/train.csv")
test = pd.read_csv("../input/test.csv")
sample_submission = pd.read_csv("../input/sampleSubmission.csv")
training_labels = LabelEncoder().fit_transform(train... | [
"pandas.DataFrame",
"pandas.read_csv",
"sklearn.preprocessing.LabelEncoder",
"numpy.exp",
"sklearn.svm.LinearSVC"
] | [((129, 162), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {}), "('../input/train.csv')\n", (140, 162), True, 'import pandas as pd\n'), ((170, 202), 'pandas.read_csv', 'pd.read_csv', (['"""../input/test.csv"""'], {}), "('../input/test.csv')\n", (181, 202), True, 'import pandas as pd\n'), ((223, 267)... |
#TwoLayerNet
import sys, os,pickle
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from dataset.mnist import load_mnist
from PIL import Image
def sigmoid(x):
return 1/(1 + np.exp(-x))
def softmax(a):
exp_a = np.exp(a)
sum_a = np.sum(exp_a) # これは、aが大きいと厳しい。
y = exp_a/sum_a
... | [
"sys.path.append",
"numpy.zeros_like",
"numpy.sum",
"numpy.log",
"numpy.argmax",
"numpy.random.randn",
"numpy.zeros",
"dataset.mnist.load_mnist",
"numpy.array",
"numpy.exp",
"numpy.random.choice",
"numpy.dot"
] | [((35, 61), 'sys.path.append', 'sys.path.append', (['os.pardir'], {}), '(os.pardir)\n', (50, 61), False, 'import sys, os, pickle\n'), ((2393, 2434), 'dataset.mnist.load_mnist', 'load_mnist', ([], {'flatten': '(True)', 'normalize': '(False)'}), '(flatten=True, normalize=False)\n', (2403, 2434), False, 'from dataset.mnis... |
#!/usr/bin/env python
"""
Plots of models over changes in parameters.
Creates plots to be joined by plots_join.sh into PDFs.
"""
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from empirical.util.classdef import Site, Fault, TectType, GMM
from empirical.util.empirical_facto... | [
"matplotlib.pyplot.loglog",
"empirical.util.empirical_factory.compute_gmm",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.logspace",
"empirical.util.classdef.Site",
"empirical.util.classdef.Fault",
"matplotlib.use",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"matplotlib.pypl... | [((167, 188), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (181, 188), False, 'import matplotlib\n'), ((388, 394), 'empirical.util.classdef.Site', 'Site', ([], {}), '()\n', (392, 394), False, 'from empirical.util.classdef import Site, Fault, TectType, GMM\n'), ((403, 410), 'empirical.util.class... |
from pathlib import Path
from unittest import TestCase
import numpy as np
from dicom_parser.image import Image
from dicom_parser.series import Series
from tests.fixtures import (
SERIES_SPATIAL_RESOLUTION,
TEST_IMAGE_PATH,
TEST_RSFMRI_SERIES_PATH,
TEST_RSFMRI_SERIES_PIXEL_ARRAY,
TEST_SERIES_PATH,
... | [
"numpy.array_equal",
"dicom_parser.series.Series",
"numpy.load",
"pathlib.Path"
] | [((428, 452), 'dicom_parser.series.Series', 'Series', (['TEST_SERIES_PATH'], {}), '(TEST_SERIES_PATH)\n', (434, 452), False, 'from dicom_parser.series import Series\n'), ((523, 547), 'dicom_parser.series.Series', 'Series', (['TEST_SERIES_PATH'], {}), '(TEST_SERIES_PATH)\n', (529, 547), False, 'from dicom_parser.series ... |
"""
Extracts features for the ImageNet dataset provided by torchvision using the
pre-trained resnet specified in `resnet.py`
"""
import logging
import os
import argparse
import numpy as np
from torchvision import transforms
from imagenet_dataset import ImageNet
from resnet import resnet50
import torch
from torch.n... | [
"argparse.ArgumentParser",
"imagenet_dataset.ImageNet",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"os.path.exists",
"torch.Tensor",
"torchvision.transforms.CenterCrop",
"logging.StreamHandler",
"numpy.concatenate",
"torchvision.transfor... | [((521, 609), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Apply pretrained network on ImageNet dataset"""'}), "(description=\n 'Apply pretrained network on ImageNet dataset')\n", (544, 609), False, 'import argparse\n'), ((1942, 1961), 'logging.getLogger', 'logging.getLogger', ([], ... |
import numpy as np
from tqdm import tqdm
def get_pixel_value(img, c_pixel):
'''c_pixel: 1 -> 4 mittlersten Pixel; 2-> 16 innersten pixel; 3 -> 36 innersten pixel
Berechnung: c_pixel^2 * 4 oder (2 * c_pixel) ^ 2
bei 1 -> 4 = (64-2*1) / 2 = 31 for i, j = 2*1
bei 2 -> 16 = (64-2*2) / 2... | [
"numpy.asarray"
] | [((936, 954), 'numpy.asarray', 'np.asarray', (['values'], {}), '(values)\n', (946, 954), True, 'import numpy as np\n')] |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"numpy.dtype"
] | [((776, 796), 'numpy.dtype', 'np.dtype', (['np.float16'], {}), '(np.float16)\n', (784, 796), True, 'import numpy as np\n'), ((802, 822), 'numpy.dtype', 'np.dtype', (['np.float32'], {}), '(np.float32)\n', (810, 822), True, 'import numpy as np\n'), ((828, 845), 'numpy.dtype', 'np.dtype', (['np.int8'], {}), '(np.int8)\n',... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import json
import os
import h5py
import numpy as np
class MicrosoftCocoDataset:
"""
包装了 MicrosoftCoco 数据集, 我们通过此类来访问该数据集
1.初始化完毕后, 结果放入 self.dataset (字典), 数据集的各个部分如下:
训练集(train)
key shape value
train_captions (400135, 17) 图... | [
"h5py.File",
"json.load",
"numpy.random.seed",
"numpy.asarray",
"numpy.shape",
"numpy.random.randint",
"numpy.random.choice",
"os.path.join"
] | [((2521, 2572), 'os.path.join', 'os.path.join', (['self.base_dir', '"""coco2014_captions.h5"""'], {}), "(self.base_dir, 'coco2014_captions.h5')\n", (2533, 2572), False, 'import os\n'), ((3399, 3449), 'os.path.join', 'os.path.join', (['self.base_dir', '"""coco2014_vocab.json"""'], {}), "(self.base_dir, 'coco2014_vocab.j... |
import tensorflow as tf
from helpers import ndc_rays, get_rays
import numpy as np
import imageio
import os
import time
def raw2outputs(raw, z_vals, rays_d):\
def raw2alpha(raw, dists, act_fn=tf.nn.relu):
return 1.0 - tf.exp(-act_fn(raw) * dists)
dists = z_vals[..., 1:] - z_vals[..., :-1]
dists =... | [
"tensorflow.reduce_sum",
"tensorflow.reshape",
"tensorflow.math.reduce_std",
"tensorflow.split",
"tensorflow.math.sigmoid",
"tensorflow.concat",
"tensorflow.cast",
"tensorflow.broadcast_to",
"numpy.stack",
"tensorflow.random.normal",
"tensorflow.linspace",
"tensorflow.stop_gradient",
"numpy.... | [((520, 549), 'tensorflow.math.sigmoid', 'tf.math.sigmoid', (['raw[..., :3]'], {}), '(raw[..., :3])\n', (535, 549), True, 'import tensorflow as tf\n'), ((1135, 1183), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(rgb * weights[..., None])'], {'axis': '(-2)'}), '(rgb * weights[..., None], axis=-2)\n', (1148, 1183), True... |
__author__ = 'indiquant'
from datetime import datetime
import numpy as np
class Option(object):
def __init__(self, undl, cp, mat, strike, bidpx, askpx, lastpx, volume):
self._undl = undl
self._cp = cp
self._mat = mat
self._strike = strike
self._bidpx = bidpx
self... | [
"numpy.append",
"numpy.array",
"numpy.unique"
] | [((1075, 1087), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1083, 1087), True, 'import numpy as np\n'), ((1294, 1320), 'numpy.append', 'np.append', (['self._mats', 'mat'], {}), '(self._mats, mat)\n', (1303, 1320), True, 'import numpy as np\n'), ((1774, 1786), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (... |
# ##### BEGIN GPL LICENSE BLOCK #####
# KeenTools for blender is a blender addon for using KeenTools in Blender.
# Copyright (C) 2019 KeenTools
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, ... | [
"gpu.shader.from_builtin",
"bpy.types.SpaceView3D.draw_handler_remove",
"bgl.glPolygonMode",
"bgl.glEnable",
"bgl.glActiveTexture",
"bgl.glHint",
"bgl.glBindTexture",
"bpy.types.SpaceView3D.draw_handler_add",
"bgl.glColorMask",
"bpy.data.images.new",
"numpy.array",
"bgl.glPolygonOffset",
"bg... | [((3074, 3165), 'bpy.types.SpaceView3D.draw_handler_add', 'bpy.types.SpaceView3D.draw_handler_add', (['self.draw_callback', 'args', '"""WINDOW"""', '"""POST_VIEW"""'], {}), "(self.draw_callback, args, 'WINDOW',\n 'POST_VIEW')\n", (3112, 3165), False, 'import bpy\n'), ((4816, 4842), 'bgl.glEnable', 'bgl.glEnable', ([... |
"""
Modules contains visibility related classes.
This contains classes to hold general visibilities and specialised classes hold visibilities from
certain spacecraft or instruments
"""
from datetime import datetime
import astropy.units as u
import numpy as np
from astropy.table import Table
from sunpy.io.fits import ... | [
"sunpy.io.fits.fits.open",
"sunpy.map.Map",
"astropy.units.quantity_input",
"sunpy.io.fits.fits.Column",
"numpy.zeros",
"sunpy.io.fits.fits.PrimaryHDU",
"numpy.all",
"datetime.datetime.now",
"numpy.argwhere",
"numpy.array",
"numpy.tile",
"sunpy.io.fits.fits.ColDefs",
"numpy.array_equal",
"... | [((1117, 1188), 'astropy.units.quantity_input', 'u.quantity_input', ([], {'uv': '(1 / u.arcsec)', 'center': 'u.arcsec', 'pixel_size': 'u.arcsec'}), '(uv=1 / u.arcsec, center=u.arcsec, pixel_size=u.arcsec)\n', (1133, 1188), True, 'import astropy.units as u\n'), ((4215, 4269), 'astropy.units.quantity_input', 'u.quantity_... |
from MCEq.misc import info
import six
import MCEq.geometry.nrlmsise00.nrlmsise00 as cmsis
class NRLMSISE00Base(object):
def __init__(self):
# Cache altitude value of last call
self.last_alt = None
self.inp = cmsis.nrlmsise_input()
self.output = cmsis.nrlmsise_output()
self... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.suptitle",
"MCEq.misc.info",
"MCEq.geometry.nrlmsise00.nrlmsise00.ap_array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"MCEq.geometry.nrlmsise00.nrlmsise00.byref",
"MCEq.geometry.nrlmsise00.nrlmsise00.nrlmsise_output",
"numpy.linspace... | [((5362, 5392), 'numpy.vectorize', 'np.vectorize', (['msis.get_density'], {}), '(msis.get_density)\n', (5374, 5392), True, 'import numpy as np\n'), ((5398, 5425), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(16, 5)'}), '(figsize=(16, 5))\n', (5408, 5425), True, 'import matplotlib.pyplot as plt\n'), ((54... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 16 18:15:37 2021
@author: jan
"""
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
import numpy as np
from sklearn.mixture import GaussianMixture
import os
import uuid
class VisualizeData:
def __init__(sel... | [
"matplotlib.pyplot.savefig",
"uuid.uuid4",
"os.makedirs",
"matplotlib.pyplot.scatter",
"os.path.dirname",
"scipy.stats.gaussian_kde",
"sklearn.mixture.GaussianMixture",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.contour",
"numpy.linspace",
"ma... | [((837, 890), 'os.path.join', 'os.path.join', (['path', '"""plots"""', 'genome', 'biosource', 'tf_id'], {}), "(path, 'plots', genome, biosource, tf_id)\n", (849, 890), False, 'import os\n'), ((917, 942), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (932, 942), False, 'import os\n'), ((966, ... |
import numpy as np
import ROOT
DIR_BOTH = 0
DIR_UP = 1
DIR_DOWN = -1
NUM_SECTORS = 68
NUM_SECTORS_Y = 14
# systematics has:
# a dict with with coordinate names "X", "Y" as keys
# - each value of these keys is a list/an array of systematic errors for each sector
# - so the list ha... | [
"ROOT.TFile",
"numpy.zeros",
"numpy.empty"
] | [((2249, 2276), 'ROOT.TFile', 'ROOT.TFile', (['minuend', '"""READ"""'], {}), "(minuend, 'READ')\n", (2259, 2276), False, 'import ROOT\n'), ((2289, 2319), 'ROOT.TFile', 'ROOT.TFile', (['subtrahend', '"""READ"""'], {}), "(subtrahend, 'READ')\n", (2299, 2319), False, 'import ROOT\n'), ((3601, 3631), 'ROOT.TFile', 'ROOT.TF... |
import warnings
# import pathlib
from torch.utils import data
from mido.midifiles.meta import KeySignatureError
import pretty_midi as pm
import numpy as np
from utils import init_fn
# PATHLIST = list(pathlib.Path('Datasets').glob('**/*.[Mm][Ii][Dd]'))
with open('pathlist.txt', 'r') as f:
PATHLIST = f.readlines()
P... | [
"warnings.simplefilter",
"pretty_midi.Note",
"numpy.zeros",
"pretty_midi.PrettyMIDI",
"numpy.array",
"warnings.catch_warnings",
"numpy.random.choice",
"pretty_midi.Instrument",
"numpy.random.shuffle"
] | [((360, 387), 'numpy.random.shuffle', 'np.random.shuffle', (['PATHLIST'], {}), '(PATHLIST)\n', (377, 387), True, 'import numpy as np\n'), ((676, 707), 'numpy.zeros', 'np.zeros', (['(256)'], {'dtype': 'np.float32'}), '(256, dtype=np.float32)\n', (684, 707), True, 'import numpy as np\n'), ((2408, 2468), 'numpy.array', 'n... |
'''
An example of the lake problem using the ema workbench.
The model itself is adapted from the Rhodium example by <NAME>,
see https://gist.github.com/dhadka/a8d7095c98130d8f73bc
'''
import math
import numpy as np
import pandas as pd
from SALib.analyze import sobol
from scipy.optimize import brentq
from ema_workbe... | [
"pandas.DataFrame",
"ema_workbench.RealParameter",
"ema_workbench.Model",
"scipy.optimize.brentq",
"numpy.sum",
"math.sqrt",
"ema_workbench.Constant",
"ema_workbench.ScalarOutcome",
"numpy.zeros",
"numpy.max",
"SALib.analyze.sobol.analyze",
"numpy.array",
"numpy.arange",
"numpy.diff",
"e... | [((1110, 1168), 'scipy.optimize.brentq', 'brentq', (['(lambda x: x ** q / (1 + x ** q) - b * x)', '(0.01)', '(1.5)'], {}), '(lambda x: x ** q / (1 + x ** q) - b * x, 0.01, 1.5)\n', (1116, 1168), False, 'from scipy.optimize import brentq\n'), ((1204, 1222), 'numpy.zeros', 'np.zeros', (['(nvars,)'], {}), '((nvars,))\n', ... |
from tomviz import utils
import numpy as np
from numpy.fft import fftn, fftshift, ifftn, ifftshift
import tomviz.operators
class ArtifactsTVOperator(tomviz.operators.CancelableOperator):
def transform_scalars(self, dataset, Niter=100, a=0.1,
wedgeSize=5, kmin=5, theta=0):
"""
... | [
"numpy.pad",
"numpy.fft.ifftshift",
"numpy.meshgrid",
"numpy.arctan2",
"numpy.roll",
"numpy.fft.fftn",
"numpy.square",
"tomviz.utils.get_array",
"numpy.ones",
"numpy.asfortranarray",
"numpy.where",
"numpy.arange",
"numpy.array",
"numpy.linalg.norm",
"numpy.random.rand",
"numpy.sqrt"
] | [((3120, 3170), 'numpy.pad', 'np.pad', (['img', '(1, 1)', '"""constant"""'], {'constant_values': '(0)'}), "(img, (1, 1), 'constant', constant_values=0)\n", (3126, 3170), True, 'import numpy as np\n'), ((3184, 3208), 'numpy.roll', 'np.roll', (['fxy', '(-1)'], {'axis': '(0)'}), '(fxy, -1, axis=0)\n', (3191, 3208), True, ... |
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... | [
"comsyl.waveoptics.SRWAdapter.SRWAdapter",
"comsyl.utils.Logger.log",
"numpy.sqrt"
] | [((2941, 2953), 'comsyl.waveoptics.SRWAdapter.SRWAdapter', 'SRWAdapter', ([], {}), '()\n', (2951, 2953), False, 'from comsyl.waveoptics.SRWAdapter import SRWAdapter\n'), ((3737, 3809), 'comsyl.utils.Logger.log', 'log', (["('Using initial z_0 for initial conditions: %e' % adapter._initial_z)"], {}), "('Using initial z_0... |
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import TensorDataset, DataLoader
from torch.utils.tensorboard import SummaryWriter
import os
import numpy as np
import torch
import sys
def data_loader(fn):
raw=np.load(fn,allow_pickle=True)
return raw
def data_combiner():
combine... | [
"torch.nn.MSELoss",
"numpy.load",
"torch.optim.lr_scheduler.StepLR",
"numpy.amin",
"torch.utils.data.DataLoader",
"torch.nn.ReLU",
"numpy.abs",
"torch.load",
"numpy.amax",
"sklearn.preprocessing.PolynomialFeatures",
"sklearn.linear_model.LinearRegression",
"numpy.array",
"torch.utils.tensorb... | [((2741, 2770), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', (['"""logging2.log"""'], {}), "('logging2.log')\n", (2754, 2770), False, 'from torch.utils.tensorboard import SummaryWriter\n'), ((2871, 2898), 'numpy.random.shuffle', 'np.random.shuffle', (['raw_data'], {}), '(raw_data)\n', (2888, 2898), True, '... |
import numpy as np
from PIL import Image
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy import stats
def grayscale():
img = Image.open("static/img/temp_img.jpeg")
img = img.convert("RGBA")
img_arr = np.asarray(img)
r = img_arr[:, :, 0]
g = img_arr[:, :, 1]
... | [
"matplotlib.pyplot.title",
"numpy.sum",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.bar",
"numpy.ones",
"numpy.clip",
"numpy.mean",
"numpy.full",
"numpy.zeros_like",
"numpy.asfarray",
"numpy.uint8",
"scipy.stats.mode",
"numpy.median",
"numpy.asarray",
"matplotlib.use",
"numpy.zeros",
... | [((59, 80), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (73, 80), False, 'import matplotlib\n'), ((166, 204), 'PIL.Image.open', 'Image.open', (['"""static/img/temp_img.jpeg"""'], {}), "('static/img/temp_img.jpeg')\n", (176, 204), False, 'from PIL import Image\n'), ((250, 265), 'numpy.asarray',... |
import numpy as np
from scipy import sparse, stats
import sklearn.utils.sparsefuncs as sf
def diffexp_ttest(meanA,vA,nA,meanB,vB,nB, top_n=8, diffexp_lfc_cutoff=0.01):
return diffexp_ttest_from_mean_var(meanA, vA, nA, meanB, vB, nB, 1000, diffexp_lfc_cutoff)
def diffexp_ttest_from_mean_var(meanA, varA, nA, mean... | [
"numpy.in1d",
"numpy.abs",
"scipy.sparse.issparse",
"numpy.errstate",
"numpy.isnan",
"numpy.argsort",
"sklearn.utils.sparsefuncs.mean_variance_axis",
"numpy.concatenate",
"numpy.sqrt"
] | [((1456, 1481), 'numpy.argsort', 'np.argsort', (['stats_to_sort'], {}), '(stats_to_sort)\n', (1466, 1481), True, 'import numpy as np\n'), ((1499, 1568), 'numpy.concatenate', 'np.concatenate', (['(sort_order[-top_n:][::-1], sort_order[:top_n][::-1])'], {}), '((sort_order[-top_n:][::-1], sort_order[:top_n][::-1]))\n', (1... |
import numpy as np
import pandas as pd
PATH_DATA = "./train_data/data.csv"
PATH_SEQUENTIAL = "./train_data/data_seq_test_10.npz"
SEQ_LEN = 10
object_class_converter = {"BULLSHIT":2,"OTHER":1,"DRONE":0}
feature_columns = ["speed_stability",
"estimated_coverage",
"size_mean_ort... | [
"pandas.read_csv",
"numpy.any",
"numpy.savez_compressed",
"numpy.asanyarray"
] | [((1436, 1471), 'pandas.read_csv', 'pd.read_csv', (['PATH_DATA'], {'index_col': '(0)'}), '(PATH_DATA, index_col=0)\n', (1447, 1471), True, 'import pandas as pd\n'), ((2194, 2218), 'numpy.asanyarray', 'np.asanyarray', (['sequences'], {}), '(sequences)\n', (2207, 2218), True, 'import numpy as np\n'), ((2228, 2249), 'nump... |
import matplotlib.pyplot as plt
import numpy as np
plt.title('Moto Parabolico')
plt.xlabel('Gittata (m)')
plt.ylabel('Alfa (rad)')
x, y = np.loadtxt('motogravi.dat', usecols=(1,0), unpack=True)
plt.plot(x, y, 'x-', label='Gittata')
plt.legend()
plt.show() | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((52, 80), 'matplotlib.pyplot.title', 'plt.title', (['"""Moto Parabolico"""'], {}), "('Moto Parabolico')\n", (61, 80), True, 'import matplotlib.pyplot as plt\n'), ((81, 106), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Gittata (m)"""'], {}), "('Gittata (m)')\n", (91, 106), True, 'import matplotlib.pyplot as plt\n'... |
from numpy import asarray
from numpy import savez_compressed
def load_images(path):
img_list = list()
for i in range(df.shape[0]):
print(i+1,df['image'][i])
# load and resize the image
filename=df['image'][i]
img = cv2.imread(path+filename)
# img process
... | [
"numpy.asarray",
"numpy.savez_compressed"
] | [((679, 696), 'numpy.asarray', 'asarray', (['img_list'], {}), '(img_list)\n', (686, 696), False, 'from numpy import asarray\n'), ((533, 550), 'numpy.asarray', 'asarray', (['img_list'], {}), '(img_list)\n', (540, 550), False, 'from numpy import asarray\n'), ((599, 633), 'numpy.savez_compressed', 'savez_compressed', (['f... |
"""
ckwg +31
Copyright 2020 by Kitware, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the ... | [
"kwiver.vital.modules.modules.load_known_modules",
"kwiver.vital.types.SFMConstraints",
"kwiver.vital.types.LocalGeoCS",
"nose.tools.ok_",
"nose.tools.assert_almost_equal",
"kwiver.vital.types.GeoPoint",
"nose.tools.assert_equal",
"kwiver.vital.types.SimpleMetadataMap",
"numpy.array",
"kwiver.vita... | [((2028, 2056), 'kwiver.vital.modules.modules.load_known_modules', 'modules.load_known_modules', ([], {}), '()\n', (2054, 2056), False, 'from kwiver.vital.modules import modules\n'), ((2159, 2178), 'kwiver.vital.types.SimpleMetadataMap', 'SimpleMetadataMap', ([], {}), '()\n', (2176, 2178), False, 'from kwiver.vital.typ... |
"""
Methods to gauge how well force balance is satisfied for an ensemble,
and to convert between polar and cartesian systems.
"""
import numpy as np
import numba
def polarToCartesian(force, alpha, beta, collapse=True):
"""
Convert a set of forces defined in polar coordinates (f, a, b),
to cartesian coord... | [
"numpy.zeros_like",
"numpy.sum",
"numpy.zeros",
"numpy.arcsin",
"numpy.shape",
"numpy.sin",
"numba.jit",
"numpy.array",
"numpy.cos",
"numpy.sqrt"
] | [((4503, 4527), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (4512, 4527), False, 'import numba\n'), ((1589, 1621), 'numpy.zeros', 'np.zeros', (['(forceArr.shape[0], 2)'], {}), '((forceArr.shape[0], 2))\n', (1597, 1621), True, 'import numpy as np\n'), ((4040, 4077), 'numpy.zeros', 'np.ze... |
"""
FishNet for ImageNet-1K, implemented in Gluon.
Original paper: 'FishNet: A Versatile Backbone for Image, Region, and Pixel Level Prediction,'
http://papers.nips.cc/paper/7356-fishnet-a-versatile-backbone-for-image-region-and-pixel-level-prediction.pdf.
"""
__all__ = ['FishNet', 'fishnet99', 'fishnet150... | [
"mxnet.gluon.nn.HybridSequential",
"mxnet.gluon.nn.MaxPool2D",
"mxnet.gluon.nn.Activation",
"mxnet.nd.zeros",
"mxnet.gluon.nn.BatchNorm",
"mxnet.cpu",
"mxnet.gluon.nn.AvgPool2D",
"mxnet.gluon.contrib.nn.Identity",
"os.path.join",
"mxnet.gluon.nn.Flatten",
"numpy.prod"
] | [((19168, 19173), 'mxnet.cpu', 'cpu', ([], {}), '()\n', (19171, 19173), False, 'from mxnet import cpu\n'), ((19196, 19233), 'os.path.join', 'os.path.join', (['"""~"""', '""".mxnet"""', '"""models"""'], {}), "('~', '.mxnet', 'models')\n", (19208, 19233), False, 'import os\n'), ((22765, 22773), 'mxnet.cpu', 'mx.cpu', ([]... |
import numpy as np
from scipy import optimize
import matplotlib.pylab as plt
import collections, copy, itertools
class TrajectorySource(object):
"""
Class to generate initial trajectories for linkage inference as well as for continued production
of trajectories feeding into a "live" linking process... | [
"numpy.random.uniform",
"numpy.zeros",
"numpy.ones",
"numpy.isnan",
"numpy.random.random",
"numpy.array",
"numpy.where",
"numpy.random.normal",
"numpy.random.choice",
"numpy.arange",
"numpy.random.shuffle"
] | [((9430, 9463), 'numpy.zeros', 'np.zeros', (['(num_t, 2, max_num_pos)'], {}), '((num_t, 2, max_num_pos))\n', (9438, 9463), True, 'import numpy as np\n'), ((9650, 9679), 'numpy.ones', 'np.ones', (['(num_t, max_num_pos)'], {}), '((num_t, max_num_pos))\n', (9657, 9679), True, 'import numpy as np\n'), ((2711, 2735), 'numpy... |
import numpy as np
import hashlib
from collections import OrderedDict
from mujoco_worldgen.objs.obj import Obj
from mujoco_worldgen.util.types import store_args
class Material(Obj):
placeable = False
@store_args
def __init__(self,
random=True,
rgba=None,
... | [
"collections.OrderedDict",
"numpy.random.RandomState"
] | [((1417, 1449), 'collections.OrderedDict', 'OrderedDict', ([], {'asset': 'self.xml_dict'}), '(asset=self.xml_dict)\n', (1428, 1449), False, 'from collections import OrderedDict\n'), ((2334, 2372), 'collections.OrderedDict', 'OrderedDict', ([], {'material': '[material_attrs]'}), '(material=[material_attrs])\n', (2345, 2... |
import os
import logging
logger = logging.getLogger(__name__)
from collections import OrderedDict
import numpy
import pyopencl
from pyopencl import array as cla
class OclMultiAnalyzer:
NUM_CRYSTAL = numpy.int32(13)
def __init__(self, L, L2, pixel, center, tha, thd, psi, rollx, rolly, device=None):
""... | [
"numpy.uint32",
"pyopencl.array.empty",
"numpy.empty",
"pyopencl.Program",
"numpy.arange",
"numpy.float64",
"os.path.dirname",
"pyopencl.CommandQueue",
"numpy.int32",
"numpy.uint8",
"pyopencl.create_some_context",
"numpy.deg2rad",
"numpy.dtype",
"numpy.zeros",
"pyopencl.array.to_device",... | [((34, 61), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (51, 61), False, 'import logging\n'), ((205, 220), 'numpy.int32', 'numpy.int32', (['(13)'], {}), '(13)\n', (216, 220), False, 'import numpy\n'), ((1177, 1193), 'numpy.float64', 'numpy.float64', (['L'], {}), '(L)\n', (1190, 1193), ... |
"""Tests for bdpy.util"""
import unittest
import numpy as np
import bdpy
class TestUtil(unittest.TestCase):
"""Tests for 'util' module"""
def test_create_groupvector_pass0001(self):
"""Test for create_groupvector (list and scalar inputs)."""
x = [1, 2, 3]
y = 2
exp_outpu... | [
"unittest.TextTestRunner",
"numpy.testing.assert_array_equal",
"bdpy.divide_chunks",
"numpy.array",
"unittest.TestLoader",
"bdpy.create_groupvector"
] | [((366, 395), 'bdpy.create_groupvector', 'bdpy.create_groupvector', (['x', 'y'], {}), '(x, y)\n', (389, 395), False, 'import bdpy\n'), ((686, 715), 'bdpy.create_groupvector', 'bdpy.create_groupvector', (['x', 'y'], {}), '(x, y)\n', (709, 715), False, 'import bdpy\n'), ((913, 932), 'numpy.array', 'np.array', (['[1, 2, 3... |
#!/usr/bin/env python
#-*-coding:utf-8-*-
from __future__ import print_function
import numpy as np
import tensorflow as tf
import pickle
#np.random.seed(1337)
#tf.set_random_seed(1337)
class Base_Line():
def __init__(self,model_params):
self.hidden_dim = model_params.hidden_dim
self.ques_len = mod... | [
"numpy.load",
"tensorflow.reduce_sum",
"tensorflow.clip_by_value",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.multiply",
"tensorflow.Variable",
"pickle.load",
"tensorflow.reduce_max",
"tensorflow.layers.Dense",
"tensorflow.variable_scope",
"tensorflow.concat",
"tensorflow.placeho... | [((13542, 13583), 'tensorflow.matmul', 'tf.matmul', (['sent1', 'sent2'], {'transpose_b': '(True)'}), '(sent1, sent2, transpose_b=True)\n', (13551, 13583), True, 'import tensorflow as tf\n'), ((13923, 13954), 'tensorflow.multiply', 'tf.multiply', (['matrix_e', 'sent_len'], {}), '(matrix_e, sent_len)\n', (13934, 13954), ... |
"""
OpenVINO DL Workbench
Rise algorithm implementation
Copyright (c) 2021 Intel Corporation
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
... | [
"numpy.empty",
"numpy.random.randint",
"skimage.transform.resize",
"numpy.array",
"numpy.random.rand"
] | [((1855, 1930), 'numpy.random.rand', 'np.random.rand', (['self.NUMBER_OF_RANDOM_MASKS', 'self.GRID_SIZE', 'self.GRID_SIZE'], {}), '(self.NUMBER_OF_RANDOM_MASKS, self.GRID_SIZE, self.GRID_SIZE)\n', (1869, 1930), True, 'import numpy as np\n'), ((2037, 2122), 'numpy.empty', 'np.empty', (['(self.NUMBER_OF_RANDOM_MASKS, *se... |
from __future__ import division
import numpy
# Style index functions
def scale_data(imgband_data, scale_from, scale_to):
sc_min, sc_max = scale_from
tc_min, tc_max = scale_to
clipped = imgband_data.clip(sc_min, sc_max)
normalised = (clipped - sc_min) / (sc_max - sc_min)
scaled = normalised * (tc_... | [
"numpy.arccos",
"numpy.log",
"numpy.log1p"
] | [((3760, 3785), 'numpy.arccos', 'numpy.arccos', (['(1 / (d + 1))'], {}), '(1 / (d + 1))\n', (3772, 3785), False, 'import numpy\n'), ((4235, 4247), 'numpy.log', 'numpy.log', (['d'], {}), '(d)\n', (4244, 4247), False, 'import numpy\n'), ((4278, 4300), 'numpy.log1p', 'numpy.log1p', (['(d * scale)'], {}), '(d * scale)\n', ... |
from pathlib import Path
import argparse
import numpy as np
from gym import wrappers
from rl.make_game import make_game
# TODO: Something's wrong with the seed -> Fix it
def visualize(game: str) -> None:
# NOTE: Has to be run from a terminal, not from VS Code!
cwd = Path.cwd()
run_vals = np.load(cwd / f"r... | [
"pathlib.Path.cwd",
"rl.make_game.make_game",
"argparse.ArgumentParser",
"numpy.load"
] | [((277, 287), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (285, 287), False, 'from pathlib import Path\n'), ((303, 336), 'numpy.load', 'np.load', (["(cwd / f'runs/{game}.npy')"], {}), "(cwd / f'runs/{game}.npy')\n", (310, 336), True, 'import numpy as np\n'), ((397, 412), 'rl.make_game.make_game', 'make_game', (['... |
"""
This module contains the change detection algorithm by
Conradsen et al. (2015).
TODO: Make all functions work with xarray Datasets
"""
from ..io import disassemble_complex
from ..filters import BoxcarFilter
from . import ChangeDetection
import numpy as np
import xarray as xr
# Cannot install libgsl-dev on ReadThe... | [
"os.environ.get",
"numpy.asarray"
] | [((1794, 1824), 'numpy.asarray', 'np.asarray', (['change'], {'dtype': 'bool'}), '(change, dtype=bool)\n', (1804, 1824), True, 'import numpy as np\n'), ((464, 493), 'os.environ.get', 'os.environ.get', (['"""READTHEDOCS"""'], {}), "('READTHEDOCS')\n", (478, 493), False, 'import os\n')] |
"""Class for loading CelebA dataset.
"""
import torch
from torch.utils.data import Dataset
from torch.utils.data import SubsetRandomSampler, SequentialSampler
import torchvision
from torchvision import transforms
import pandas as pd
from PIL import Image
from skimage import io, transform
from pathlib import Path
impor... | [
"data.celeba_plugins.constr_para_generator_circle_sector.opts2lm_circle_sector_rand",
"data.celeba_plugins.lm_ordering.opts2lm_ordering",
"random.randint",
"pandas.read_csv",
"data.celeba_plugins.SeqSampler.SeqSampler",
"data.celeba_plugins.constr_para_generator_bb.opts2face_bb_rand",
"pathlib.Path",
... | [((2203, 2225), 'data.celeba_plugins.lm_ordering.opts2lm_ordering', 'opts2lm_ordering', (['opts'], {}), '(opts)\n', (2219, 2225), False, 'from data.celeba_plugins.lm_ordering import opts2lm_ordering\n'), ((2332, 2351), 'pathlib.Path', 'Path', (['opts.imgs_dir'], {}), '(opts.imgs_dir)\n', (2336, 2351), False, 'from path... |
from fileinput import filename
from genericpath import isfile
from os.path import join
from os import listdir
import csv, cv2 , random, torch
import scipy.io as sio
import numpy as np
import sys
from torch import tensor
from facenet_pytorch import MTCNN, InceptionResnetV1
random.seed()
print("Preparing the data..."... | [
"cv2.face.LBPHFaceRecognizer_create",
"torch.stack",
"cv2.cvtColor",
"cv2.ml.SVM_create",
"cv2.imread",
"fileinput.filename.split",
"random.random",
"random.seed",
"numpy.array",
"facenet_pytorch.InceptionResnetV1",
"facenet_pytorch.MTCNN",
"os.path.join",
"os.listdir",
"cv2.resize",
"to... | [((276, 289), 'random.seed', 'random.seed', ([], {}), '()\n', (287, 289), False, 'import csv, cv2, random, torch\n'), ((1532, 1661), 'facenet_pytorch.MTCNN', 'MTCNN', ([], {'image_size': '(160)', 'margin': '(0)', 'min_face_size': '(20)', 'thresholds': '[0.6, 0.7, 0.7]', 'factor': '(0.709)', 'post_process': '(True)', 'd... |
# -*- coding: utf-8 -*-
#Estimate head pose according to the facial landmarks"""
import cv2
import numpy as np
import os
actor_height = 157
class PoseEstimator:
"""Estimate head pose according to the facial landmarks"""
"""
(0.0, 0.0, 0.0), # Nose tip
#(0.0, -330.0, -65.0),... | [
"matplotlib.pyplot.show",
"mpl_toolkits.mplot3d.Axes3D",
"cv2.polylines",
"os.getcwd",
"cv2.solvePnP",
"numpy.float32",
"numpy.zeros",
"cv2.solvePnPRansac",
"cv2.projectPoints",
"matplotlib.pyplot.figure",
"numpy.array",
"cv2.drawFrameAxes",
"numpy.reshape",
"matplotlib.pyplot.ylabel",
"... | [((2044, 2149), 'numpy.array', 'np.array', (['[(0.0, 1.7, -1.35), (-2.15, 0, 1.35), (2.15, 0, 1.35), (-4.3, 0.85, 5.4), (\n 4.3, 0.85, 5.4)]'], {}), '([(0.0, 1.7, -1.35), (-2.15, 0, 1.35), (2.15, 0, 1.35), (-4.3, 0.85,\n 5.4), (4.3, 0.85, 5.4)])\n', (2052, 2149), True, 'import numpy as np\n'), ((2821, 2957), 'num... |
import numpy as np
import analyzesimulation as asim
import os
import re
import pickle
def load_data_from_dir(data_dir):
filename_list = os.listdir(data_dir)
conditions = set()
for file in filename_list:
condition = re.findall(r'.*tf_.*_(.*)_t.*', file)
condition = condition[0]
cond... | [
"analyzesimulation.SimData",
"pickle.dump",
"analyzesimulation.get_freq_amp",
"numpy.rad2deg",
"numpy.max",
"re.findall",
"numpy.mean",
"analyzesimulation.get_pref_dir",
"os.path.join",
"os.listdir"
] | [((142, 162), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (152, 162), False, 'import os\n'), ((237, 273), 're.findall', 're.findall', (['""".*tf_.*_(.*)_t.*"""', 'file'], {}), "('.*tf_.*_(.*)_t.*', file)\n", (247, 273), False, 'import re\n'), ((590, 618), 'os.path.join', 'os.path.join', (['data_dir'... |
import torch
import torchvision
from torch import nn
from torch import optim
import pandas as pd
import numpy as np
from torch.utils.data import Dataset
from sklearn.preprocessing import maxabs_scale
from torch.utils.tensorboard import SummaryWriter
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Usin... | [
"torch.ones_like",
"torch.ones",
"torch.nn.ReLU",
"torch.nn.BCELoss",
"torch.utils.data.DataLoader",
"torch.zeros_like",
"pandas.read_csv",
"torch.nn.Tanh",
"torch.randn",
"sklearn.preprocessing.maxabs_scale",
"torchvision.utils.make_grid",
"torch.cuda.is_available",
"numpy.array",
"torch.... | [((1043, 1141), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['feature_set'], {'batch_size': 'batch_size', 'shuffle': '(True)', 'drop_last': '(True)'}), '(feature_set, batch_size=batch_size, shuffle=\n True, drop_last=True)\n', (1070, 1141), False, 'import torch\n'), ((2166, 2210), 'torch.randn', '... |
import os
import numpy as np
from PIL import Image
import torch
import kmod.glo as glo
import argparse
from kmod.torch_models import Generator
img_size = 64
dataname = 'lsun'
epoch = 20
num_images = 30000
gen_model_names = {
'1232_began': 'BEGAN_{}_G.pkl'.format(epoch),
'3212_began': 'BEGAN_{}_G.pkl'.format(e... | [
"numpy.save",
"argparse.ArgumentParser",
"os.makedirs",
"torch.rand",
"torch.manual_seed",
"os.path.exists",
"torch.set_default_tensor_type",
"kmod.torch_models.Generator",
"PIL.Image.open",
"kmod.glo.shared_resource_folder",
"torch.set_default_dtype",
"torch.cuda.is_available",
"torch.devic... | [((733, 776), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n", (745, 776), False, 'import torch\n'), ((1030, 1060), 'torch.set_default_dtype', 'torch.set_default_dtype', (['dtype'], {}), '(dtype)\n', (1053, 1060), False, 'import torch\n'), ((1065, 1108), 't... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2018 <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 req... | [
"numpy.save",
"imageio.imread",
"os.system",
"PIL.Image.open",
"png.from_array",
"os.path.join",
"os.listdir"
] | [((748, 764), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (758, 764), False, 'import os\n'), ((1369, 1394), 'numpy.save', 'np.save', (['"""nlst.npy"""', 'nlst'], {}), "('nlst.npy', nlst)\n", (1376, 1394), True, 'import numpy as np\n'), ((778, 799), 'os.path.join', 'os.path.join', (['root', 'i'], {}), '(root... |
#!/usr/bin/env python
import itertools as itt
import logging
import os
from datetime import datetime
from getpass import getuser
import numpy as np
import pandas as pd
from .generate import get_percentile_diff, get_inducible_pairs
from .. import hgnc, mi, up, snp as rs
from ..struct.hetnet import HetNet, encode_colo... | [
"pandas.DataFrame",
"numpy.random.seed",
"getpass.getuser",
"logging.getLogger",
"datetime.datetime.now",
"itertools.combinations",
"numpy.arange",
"numpy.random.normal",
"numpy.random.choice",
"itertools.product",
"os.path.join",
"numpy.random.shuffle"
] | [((334, 353), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (351, 353), False, 'import logging\n'), ((797, 817), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (811, 817), True, 'import numpy as np\n'), ((4312, 4332), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (... |
"""
"""
import numpy as np
import matplotlib.pyplot as plt
import socket
import os
import mne
from mne.minimum_norm import read_inverse_operator, source_induced_power
###############################################################################
# SETUP PATHS AND PREPARE RAW DATA
hostname = socket.gethostname()
if... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"mne.read_labels_from_annot",
"matplotlib.pyplot.imshow",
"mne.minimum_norm.source_induced_power",
"matplotlib.pyplot.colorbar",
"mne.minimum_norm.read_inverse_operator",
"socket.gethostname",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.a... | [((296, 316), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (314, 316), False, 'import socket\n'), ((518, 537), 'os.chdir', 'os.chdir', (['data_path'], {}), '(data_path)\n', (526, 537), False, 'import os\n'), ((1128, 1147), 'numpy.arange', 'np.arange', (['(6)', '(90)', '(3)'], {}), '(6, 90, 3)\n', (1137... |
import pandas as pd
import math
import time
import numpy as np
'''Find and replace NaN values'''
def est_nan(data, target_feature, reference_feature):
plotting = False # Show plots for data estimation where missing values were found
# Max number of values to use for ratio
tail_n = 100
# make sure t... | [
"math.fabs",
"numpy.random.normal",
"numpy.searchsorted",
"pandas.isnull"
] | [((368, 408), 'pandas.isnull', 'pd.isnull', (['data[target_feature].iloc[-1]'], {}), '(data[target_feature].iloc[-1])\n', (377, 408), True, 'import pandas as pd\n'), ((775, 814), 'pandas.isnull', 'pd.isnull', (['data[target_feature].iloc[0]'], {}), '(data[target_feature].iloc[0])\n', (784, 814), True, 'import pandas as... |
"""
Module provides methods for analyzing the statistics of a sample
(or values) generated with Monte Carlo techniques.
"""
import numpy as np
from scipy import stats
from .helper import interpret_array
def lag_auto_cov(values, k, mean=None):
if mean is None:
mean = np.mean(values)
return np.einsum('... | [
"numpy.random.uniform",
"numpy.maximum",
"numpy.ceil",
"numpy.empty",
"numpy.asanyarray",
"numpy.zeros",
"numpy.empty_like",
"numpy.histogramdd",
"numpy.einsum",
"numpy.min",
"numpy.max",
"numpy.where",
"numpy.mean",
"numpy.arange",
"numpy.var",
"scipy.stats.chisquare"
] | [((981, 1002), 'numpy.empty_like', 'np.empty_like', (['values'], {}), '(values)\n', (994, 1002), True, 'import numpy as np\n'), ((1872, 1893), 'numpy.zeros', 'np.zeros', (['sample.ndim'], {}), '(sample.ndim)\n', (1880, 1893), True, 'import numpy as np\n'), ((2605, 2632), 'numpy.min', 'np.min', (['sample.data'], {'axis'... |
import gym
import simple_environments # NOQA
import dqn
import rl_loop
from ngraph.frontends import neon
import numpy as np
def model(action_axes):
return neon.Sequential([
neon.Affine(
nout=10,
weight_init=neon.GlorotInit(),
bias_init=neon.ConstantInit(),
... | [
"gym.make",
"ngraph.frontends.neon.Tanh",
"ngraph.frontends.neon.ConstantInit",
"numpy.array",
"dqn.decay_generator",
"dqn.space_shape",
"rl_loop.rl_loop_train",
"ngraph.frontends.neon.GlorotInit",
"rl_loop.evaluate_single_episode"
] | [((603, 630), 'gym.make', 'gym.make', (['"""DependentEnv-v0"""'], {}), "('DependentEnv-v0')\n", (611, 630), False, 'import gym\n'), ((981, 1035), 'rl_loop.rl_loop_train', 'rl_loop.rl_loop_train', (['environment', 'agent'], {'episodes': '(10)'}), '(environment, agent, episodes=10)\n', (1002, 1035), False, 'import rl_loo... |
# Imports
import matplotlib.pyplot as plt
import pysal.lib as lp
import numpy as np
import geopandas as gpd
from pysal.explore.esda.moran import Moran_BV_matrix
from pysal.viz.splot.esda import moran_facet
# Load data and calculate Moran Local statistics
f = gpd.read_file(lp.examples.get_path("sids2.dbf"))
varnames ... | [
"pysal.lib.examples.get_path",
"matplotlib.pyplot.show",
"numpy.array",
"pysal.explore.esda.moran.Moran_BV_matrix",
"pysal.viz.splot.esda.moran_facet"
] | [((482, 525), 'pysal.explore.esda.moran.Moran_BV_matrix', 'Moran_BV_matrix', (['vars', 'w'], {'varnames': 'varnames'}), '(vars, w, varnames=varnames)\n', (497, 525), False, 'from pysal.explore.esda.moran import Moran_BV_matrix\n'), ((552, 577), 'pysal.viz.splot.esda.moran_facet', 'moran_facet', (['moran_matrix'], {}), ... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 13 13:01:38 2014
Downsample (or upsample) a curve defined as :
| v[0] | v[1] | ... | v[nz-1] |
z[0] z[1] z[2] z[nz-1] z[nz]
| | ... ... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.hold",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.loadtxt",
"numpy.linspace",
"numpy.vstack"
] | [((3641, 3672), 'numpy.loadtxt', 'np.loadtxt', (['"""VP-botteroRS4.txt"""'], {}), "('VP-botteroRS4.txt')\n", (3651, 3672), True, 'import numpy as np\n'), ((3678, 3709), 'numpy.loadtxt', 'np.loadtxt', (['"""VS-botteroRS4.txt"""'], {}), "('VS-botteroRS4.txt')\n", (3688, 3709), True, 'import numpy as np\n'), ((3751, 3778)... |
import numpy as np
lines = np.array([[57,106,177], [218,124,48], [62,150,81], [204,37,41], [83,81,84], [107,76,154], [146,36,40], [148,139,61]], dtype='float')/255
bars = np.array([[114,147,203], [225,151,76], [132,186,91], [211,94,96], [128,133,133], [144,103,167], [171,104,87], [204,194,16]], dtype='float')/255
# T... | [
"numpy.array",
"numpy.ones",
"numpy.clip"
] | [((28, 180), 'numpy.array', 'np.array', (['[[57, 106, 177], [218, 124, 48], [62, 150, 81], [204, 37, 41], [83, 81, 84],\n [107, 76, 154], [146, 36, 40], [148, 139, 61]]'], {'dtype': '"""float"""'}), "([[57, 106, 177], [218, 124, 48], [62, 150, 81], [204, 37, 41], [83,\n 81, 84], [107, 76, 154], [146, 36, 40], [14... |
import cv2 as cv
import numpy as np
import wget
from os import mkdir, path
from os.path import join, abspath, dirname, exists
file_path = abspath(__file__)
file_parent_dir = dirname(file_path)
config_dir = join(file_parent_dir, 'config')
inputs_dir = join(file_parent_dir, 'inputs')
yolo_weights_path = join(config_dir,... | [
"os.path.abspath",
"cv2.putText",
"cv2.dnn.NMSBoxes",
"numpy.argmax",
"cv2.waitKey",
"cv2.destroyAllWindows",
"os.path.dirname",
"cv2.dnn.blobFromImage",
"cv2.dnn.readNet",
"cv2.imread",
"cv2.rectangle",
"cv2.imshow",
"os.path.join"
] | [((139, 156), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (146, 156), False, 'from os.path import join, abspath, dirname, exists\n'), ((175, 193), 'os.path.dirname', 'dirname', (['file_path'], {}), '(file_path)\n', (182, 193), False, 'from os.path import join, abspath, dirname, exists\n'), ((207, ... |
import numpy as np
from typing import Dict
from alibi_detect.utils.sampling import reservoir_sampling
def update_reference(X_ref: np.ndarray,
X: np.ndarray,
n: int,
update_method: Dict[str, int] = None,
) -> np.ndarray:
"""
Up... | [
"numpy.concatenate",
"alibi_detect.utils.sampling.reservoir_sampling"
] | [((1041, 1078), 'alibi_detect.utils.sampling.reservoir_sampling', 'reservoir_sampling', (['X_ref', 'X', 'size', 'n'], {}), '(X_ref, X, size, n)\n', (1059, 1078), False, 'from alibi_detect.utils.sampling import reservoir_sampling\n'), ((1138, 1172), 'numpy.concatenate', 'np.concatenate', (['[X_ref, X]'], {'axis': '(0)'}... |
# game.py
#
# Author: <NAME>
# Created On: 01 Feb 2019
import pygame
from . import objects
from . import maze
from . import game_logic
from . import game_rendering
from . import ai
import os.path
import numpy as np
COLORS = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0),
(0, 255, 255), (255, 0, 255),... | [
"numpy.logical_and",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"numpy.array",
"pygame.surfarray.pixels3d",
"pygame.image.load",
"pygame.time.Clock",
"pygame.key.get_pressed"
] | [((443, 467), 'pygame.key.get_pressed', 'pygame.key.get_pressed', ([], {}), '()\n', (465, 467), False, 'import pygame\n'), ((1127, 1156), 'numpy.array', 'np.array', (['start'], {'dtype': 'np.int'}), '(start, dtype=np.int)\n', (1135, 1156), True, 'import numpy as np\n'), ((1795, 1828), 'pygame.surfarray.pixels3d', 'pyga... |
import cv2
import numpy as np
import copy
import posenet.constants
import math
#used to calculate the angles
def find_angle(a, b, c):
try:
ang = int(math.degrees(math.atan2(c[1]-b[1], c[0]-b[0]) - math.atan2(a[1]-b[1], a[0]-b[0])))
return ang + 360 if ang < 0 else ang
except Exception:
... | [
"cv2.polylines",
"math.atan2",
"cv2.cvtColor",
"copy.copy",
"cv2.imread",
"cv2.KeyPoint",
"numpy.array",
"cv2.KeyPoint_convert",
"cv2.resize"
] | [((815, 902), 'numpy.array', 'np.array', (['[source_img.shape[0] / target_height, source_img.shape[1] / target_width]'], {}), '([source_img.shape[0] / target_height, source_img.shape[1] /\n target_width])\n', (823, 902), True, 'import numpy as np\n'), ((916, 1006), 'cv2.resize', 'cv2.resize', (['source_img', '(targe... |
# Data filtering rules
#
# Note! Physics observable (fiducial / kinematic) cuts are defined in cuts.py, not here.
#
# <EMAIL>, 2021
import numpy as np
import numba
from icenet.tools import stx
def filter_nofilter(X, ids, isMC, xcorr_flow=False):
""" All pass """
return np.ones(X.shape[0], dtype=np.bool_) # ... | [
"icenet.tools.stx.apply_cutflow",
"icenet.tools.stx.construct_columnar_cuts",
"numpy.ones"
] | [((282, 317), 'numpy.ones', 'np.ones', (['X.shape[0]'], {'dtype': 'np.bool_'}), '(X.shape[0], dtype=np.bool_)\n', (289, 317), True, 'import numpy as np\n'), ((1148, 1206), 'icenet.tools.stx.construct_columnar_cuts', 'stx.construct_columnar_cuts', ([], {'X': 'X', 'ids': 'ids', 'cutlist': 'cutlist'}), '(X=X, ids=ids, cut... |
#!/usr/bin/env python3
import numpy as np
def compute_Happ(steps , s , Ms):
# Describes the applied field
# following the logic used by OOMMF
# N : é o numero de passos de simulação
# | Inicial | Final |Duracao|
# |x_i y z | x_f y z | steps |
# |1 2 3 | 4 5 6 | 7 ... | [
"numpy.arctan",
"numpy.zeros"
] | [((632, 652), 'numpy.zeros', 'np.zeros', (['(steps, 3)'], {}), '((steps, 3))\n', (640, 652), True, 'import numpy as np\n'), ((688, 700), 'numpy.arctan', 'np.arctan', (['(1)'], {}), '(1)\n', (697, 700), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 20 14:34:47 2019
@author: matusmacbookpro
"""
import numpy as np
from PIL import Image
from PIL import ImageDraw
from math import acos
from math import sqrt
from math import pi
import colorsys
import copy
#adapted from: https://github.com/NVlabs/De... | [
"numpy.stack",
"copy.deepcopy",
"PIL.Image.new",
"math.sqrt",
"colorsys.hsv_to_rgb",
"numpy.zeros",
"math.acos",
"numpy.finfo",
"numpy.linalg.norm",
"numpy.array",
"numpy.exp",
"numpy.rollaxis",
"PIL.ImageDraw.Draw",
"numpy.concatenate",
"numpy.sqrt"
] | [((964, 992), 'copy.deepcopy', 'copy.deepcopy', (['points_belief'], {}), '(points_belief)\n', (977, 992), False, 'import copy\n'), ((2256, 2288), 'numpy.rollaxis', 'np.rollaxis', (['belief_concat', '(2)', '(0)'], {}), '(belief_concat, 2, 0)\n', (2267, 2288), True, 'import numpy as np\n'), ((2350, 2374), 'numpy.linalg.n... |
'''
Author: <NAME> <<EMAIL>>
If you use this code, please cite the following paper:
<NAME>, and <NAME>. Unsupervised Depth Completion with Calibrated Backprojection Layers.
https://arxiv.org/pdf/2108.10531.pdf
@inproceedings{wong2021unsupervised,
title={Unsupervised Depth Completion with Calibrated Backprojection ... | [
"sklearn.cluster.MiniBatchKMeans",
"argparse.ArgumentParser",
"numpy.isnan",
"numpy.argsort",
"data_utils.write_paths",
"os.path.join",
"numpy.unique",
"numpy.zeros_like",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.dirname",
"os.path.exists",
"numpy.max",
"data_utils.save_validity_map",
"cv... | [((506, 539), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (529, 539), False, 'import warnings\n'), ((625, 650), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""src"""'], {}), "(0, 'src')\n", (640, 650), False, 'import os, sys, glob, cv2, argparse\n'), ((855, 880), 'a... |
from abc import ABC, abstractmethod
import torch
from . import metric_utils_lightning
import scipy
import numpy as np
import torchmetrics
class StyleGANMetric(torchmetrics.Metric, ABC):
def __init__(self, detector_url: str, detector_kwargs: dict = None,
max_real=None, num_gen=None,):
su... | [
"numpy.dot",
"numpy.trace",
"torch.square"
] | [((2400, 2429), 'numpy.dot', 'np.dot', (['sigma_gen', 'sigma_real'], {}), '(sigma_gen, sigma_real)\n', (2406, 2429), True, 'import numpy as np\n'), ((2301, 2331), 'torch.square', 'torch.square', (['(mu_gen - mu_real)'], {}), '(mu_gen - mu_real)\n', (2313, 2331), False, 'import torch\n'), ((2498, 2538), 'numpy.trace', '... |
# -*- coding: utf-8 -*-
# pylint: disable=wrong-import-position
"""
Cascade hypothesis class to generate photons expected from a cascade.
"""
from __future__ import absolute_import, division, print_function
__all__ = ["EM_CASCADE_PHOTONS_PER_GEV", "CascadeModel", "CascadeHypo"]
__author__ = "<NAME>, <NAME>"
__licen... | [
"numpy.arctan2",
"numpy.empty",
"numpy.sin",
"retro.utils.misc.validate_and_convert_enum",
"scipy.stats.pareto",
"sys.path.append",
"os.path.abspath",
"numpy.random.RandomState",
"scipy.stats.gamma",
"math.cos",
"math.log",
"numpy.arccos",
"numpy.ceil",
"math.sin",
"numpy.cos",
"numpy.... | [((1246, 1272), 'sys.path.append', 'sys.path.append', (['RETRO_DIR'], {}), '(RETRO_DIR)\n', (1261, 1272), False, 'import sys\n'), ((4281, 4341), 'retro.utils.misc.validate_and_convert_enum', 'validate_and_convert_enum', ([], {'val': 'model', 'enum_type': 'CascadeModel'}), '(val=model, enum_type=CascadeModel)\n', (4306,... |
import numpy as np
import pytest
from ..utils import compute_spectral_radius, create_rng, chunk_data
from ..utils import standardize_traindata, scale_data, unscale_data
def test_compute_spectral_radius():
# Test that a non-square matrix yields an error
rng = np.random.RandomState(17)
X = rng.rand(5, 3)
... | [
"numpy.testing.assert_array_equal",
"numpy.zeros",
"numpy.random.RandomState",
"pytest.raises",
"numpy.array",
"numpy.testing.assert_allclose"
] | [((269, 294), 'numpy.random.RandomState', 'np.random.RandomState', (['(17)'], {}), '(17)\n', (290, 294), True, 'import numpy as np\n'), ((466, 482), 'numpy.zeros', 'np.zeros', (['(5, 5)'], {}), '((5, 5))\n', (474, 482), True, 'import numpy as np\n'), ((655, 700), 'numpy.array', 'np.array', (['[[9, -1, 2], [-2, 8, 4], [... |
# Copyright 2016 Google Inc. 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 applicable law or ... | [
"tensorflow.reduce_sum",
"tensorflow.logging.info",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.Variable",
"tensorflow.reduce_max",
"tensorflow.contrib.slim.batch_norm",
"tensorflow.contrib.slim.l2_regularizer",
"tensorflow.variable_scope",
"tensorflow.concat",
"tensorflow.summary.his... | [((806, 926), 'tensorflow.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""MoNN_num_experts"""', '(4)', '"""The number of mixtures (excluding the dummy \'expert\') used for MoNNs."""'], {}), '(\'MoNN_num_experts\', 4,\n "The number of mixtures (excluding the dummy \'expert\') used for MoNNs.")\n', (826, 926), Fa... |
import os
import sys
import numpy as np
import h5py
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
# Download dataset for point cloud classification
DATA_DIR = os.path.join(BASE_DIR, 'data')
if not os.path.exists(DATA_DIR):
os.mkdir(DATA_DIR)
if not os.path.exists(os.path.join(DATA... | [
"os.mkdir",
"numpy.ones",
"numpy.sin",
"numpy.arange",
"os.path.join",
"sys.path.append",
"os.path.abspath",
"numpy.random.randn",
"os.path.exists",
"numpy.random.shuffle",
"h5py.File",
"os.path.basename",
"numpy.square",
"os.system",
"numpy.cos",
"numpy.dot",
"numpy.delete",
"nump... | [((106, 131), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (121, 131), False, 'import sys\n'), ((194, 224), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""data"""'], {}), "(BASE_DIR, 'data')\n", (206, 224), False, 'import os\n'), ((79, 104), 'os.path.abspath', 'os.path.abspath', (['__fil... |
import numpy
import matplotlib.pylab as plt
no_of_simulations = 1000
milestone_probabilities = [25, 50, 75, 90, 99]
milestone_current = 0
def birthday_paradox(no_of_people, simulations):
global milestone_probabilities, milestone_current
same_birthday_two_people = 0
#For simplicity, we assume that there... | [
"matplotlib.pylab.plot",
"numpy.random.choice",
"matplotlib.pylab.show"
] | [((1381, 1403), 'matplotlib.pylab.plot', 'plt.plot', (['day', 'success'], {}), '(day, success)\n', (1389, 1403), True, 'import matplotlib.pylab as plt\n'), ((1408, 1418), 'matplotlib.pylab.show', 'plt.show', ([], {}), '()\n', (1416, 1418), True, 'import matplotlib.pylab as plt\n'), ((403, 455), 'numpy.random.choice', '... |
""" Module routines for pre-processing data for recommender training
"""
import argparse
from typing import Sequence, Optional
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelBinarizer
from scipy import sparse
from aizynthfinder.training.utils import (
Config,
split_and_save_data... | [
"sklearn.preprocessing.LabelBinarizer",
"argparse.ArgumentParser",
"aizynthfinder.training.utils.Config",
"pandas.read_csv",
"numpy.apply_along_axis",
"aizynthfinder.training.utils.split_and_save_data",
"scipy.sparse.lil_matrix",
"aizynthfinder.training.utils.split_reaction_smiles"
] | [((470, 587), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Tool to pre-process a template library to be used to train a recommender network"""'], {}), "(\n 'Tool to pre-process a template library to be used to train a recommender network'\n )\n", (493, 587), False, 'import argparse\n'), ((727, 746)... |
# -------------------------------------------------------------------------------------------------------------------- #
# Import packages
# -------------------------------------------------------------------------------------------------------------------- #
import numpy as np
from .nurbs_surface import NurbsSurface
... | [
"numpy.sum",
"numpy.abs",
"numpy.asarray",
"numpy.zeros",
"numpy.cross",
"numpy.shape",
"numpy.sin",
"numpy.cos",
"numpy.linalg.solve",
"numpy.issubdtype"
] | [((3883, 3932), 'numpy.zeros', 'np.zeros', (['(3, n + 1, m + 1)'], {'dtype': 'self.data_type'}), '((3, n + 1, m + 1), dtype=self.data_type)\n', (3891, 3932), True, 'import numpy as np\n'), ((3979, 4025), 'numpy.zeros', 'np.zeros', (['(n + 1, m + 1)'], {'dtype': 'self.data_type'}), '((n + 1, m + 1), dtype=self.data_type... |
import numpy as np
from ase.build import bulk
from ipyatom.repeat_cell import atoms_to_dict
from ipyatom.plot_mpl import plot_atoms_top, plot_slice
def test_plot_atoms_top():
import matplotlib
matplotlib.pyplot.switch_backend('agg')
fe = bulk("Fe").repeat((5, 5, 5))
dct = atoms_to_dict(fe)
plot_a... | [
"matplotlib.pyplot.switch_backend",
"ase.build.bulk",
"ipyatom.plot_mpl.plot_atoms_top",
"numpy.array",
"ipyatom.plot_mpl.plot_slice",
"ipyatom.repeat_cell.atoms_to_dict"
] | [((203, 242), 'matplotlib.pyplot.switch_backend', 'matplotlib.pyplot.switch_backend', (['"""agg"""'], {}), "('agg')\n", (235, 242), False, 'import matplotlib\n'), ((292, 309), 'ipyatom.repeat_cell.atoms_to_dict', 'atoms_to_dict', (['fe'], {}), '(fe)\n', (305, 309), False, 'from ipyatom.repeat_cell import atoms_to_dict\... |
from DataReader import DataReader
from Preprocessor import Preprocessor
from Vectorizer import Vectorizer
from Classifier import Classifier
from DeepLearning import DeepLearner
from sklearn.model_selection import train_test_split as split
import numpy as np
dr = DataReader('./datasets/training-v1/offenseval-training-v... | [
"Preprocessor.Preprocessor",
"numpy.array",
"DeepLearning.DeepLearner",
"DataReader.DataReader",
"Vectorizer.Vectorizer"
] | [((264, 332), 'DataReader.DataReader', 'DataReader', (['"""./datasets/training-v1/offenseval-training-v1.tsv"""', '"""A"""'], {}), "('./datasets/training-v1/offenseval-training-v1.tsv', 'A')\n", (274, 332), False, 'from DataReader import DataReader\n'), ((458, 503), 'Preprocessor.Preprocessor', 'Preprocessor', (['"""re... |
# -*- coding: utf-8 -*-
import cv2
import numpy as np
def convolve(image, kernel):
(iH, iW) = image.shape[:2]
(kH, kW) = kernel.shape[:2]
pad = (kW - 1) / 2
image = cv2.copyMakeBorder(image, pad, pad, pad, pad,
cv2.BORDER_REPLICATE)
output = np.zeros((iH, ... | [
"cv2.cvtColor",
"numpy.zeros",
"cv2.copyMakeBorder",
"numpy.arange",
"numpy.loadtxt",
"numpy.array"
] | [((194, 261), 'cv2.copyMakeBorder', 'cv2.copyMakeBorder', (['image', 'pad', 'pad', 'pad', 'pad', 'cv2.BORDER_REPLICATE'], {}), '(image, pad, pad, pad, pad, cv2.BORDER_REPLICATE)\n', (212, 261), False, 'import cv2\n'), ((306, 341), 'numpy.zeros', 'np.zeros', (['(iH, iW)'], {'dtype': '"""float32"""'}), "((iH, iW), dtype=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.