code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
from ecogdata.util import get_default_args
from ecogdata.util import fenced_out
from ecogdata.devices.units import nice_unit_text
from ecoglib.vis.plot_util import filled_interval, light_boxplot
from ecoglib.vis.colormaps import nancmap
from ecoglib.estimation.spatial_variance import covar_to_iqr_l... | [
"numpy.sum",
"numpy.ones",
"numpy.isnan",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"ecoglib.vis.plot_util.filled_interval",
"numpy.nanmean",
"numpy.std",
"numpy.random.rand",
"numpy.isfinite",
"ecoglib.estimation.spatial_variance.make_matern_label",
"ecoglib.vis.colormaps.diverging_cm",
... | [((2227, 2255), 'numpy.sqrt', 'np.sqrt', (['(df_band_pwr * f[-1])'], {}), '(df_band_pwr * f[-1])\n', (2234, 2255), True, 'import numpy as np\n'), ((5026, 5052), 'numpy.mean', 'np.mean', (['s_pwr[s_pwr_mask]'], {}), '(s_pwr[s_pwr_mask])\n', (5033, 5052), True, 'import numpy as np\n'), ((5063, 5073), 'numpy.log', 'np.log... |
"""
Copyright 2019 <NAME> (Johns Hopkins University)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import pytest
import numpy as np
from numpy.testing import assert_allclose
from hyperion.hyp_defs import float_cpu
from hyperion.feats.stft import *
from hyperion.feats.feature_windows import FeatureWin... | [
"hyperion.hyp_defs.float_cpu",
"numpy.testing.assert_allclose",
"hyperion.feats.feature_windows.FeatureWindowFactory.create",
"numpy.random.RandomState"
] | [((402, 434), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': '(1024)'}), '(seed=1024)\n', (423, 434), True, 'import numpy as np\n'), ((584, 610), 'hyperion.feats.feature_windows.FeatureWindowFactory.create', 'FWF.create', (['"""hanning"""', '(512)'], {}), "('hanning', 512)\n", (594, 610), True, 'fro... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
implementation of the patches data structure
"""
import pandas as pd
import os
import glob
import numpy as np
import h5py
import cupy as cp
from multiprocessing import Pool, cpu_count
import functools
import time
from numpy.random import default_rng
import abc... | [
"numpy.random.default_rng",
"h5py.File",
"cupy.get_array_module"
] | [((10416, 10429), 'numpy.random.default_rng', 'default_rng', ([], {}), '()\n', (10427, 10429), False, 'from numpy.random import default_rng\n'), ((11412, 11436), 'cupy.get_array_module', 'cp.get_array_module', (['vol'], {}), '(vol)\n', (11431, 11436), True, 'import cupy as cp\n'), ((1890, 1911), 'h5py.File', 'h5py.File... |
import os
import tqdm
import pickle
import numpy as np
import pandas as pd
import geopandas as gpd
# Imports from eo-learn and sentinelhub-py
from eolearn.core import EOPatch, EOTask, LinearWorkflow, FeatureType
from sentinelhub import bbox_to_dimensions
from lib.utils import _get_point
from lib.data_utils import (get... | [
"numpy.stack",
"pickle.dump",
"sentinelhub.bbox_to_dimensions",
"lib.data_utils.get_sen3_data",
"os.path.dirname",
"lib.data_utils.get_cams_data",
"lib.data_utils.get_s5p_data",
"lib.data_utils.get_modis_data",
"lib.data_utils.get_era5_data",
"lib.data_utils.get_land_cover_data",
"os.path.isfile... | [((727, 762), 'numpy.array', 'np.array', (["cams_eop.meta_info['day']"], {}), "(cams_eop.meta_info['day'])\n", (735, 762), True, 'import numpy as np\n'), ((2439, 2461), 'geopandas.read_file', 'gpd.read_file', (['gt_path'], {}), '(gt_path)\n', (2452, 2461), True, 'import geopandas as gpd\n'), ((2017, 2038), 'os.path.dir... |
import itertools
import warnings
import networkx as nx
import numpy as np
import pandas as pd
from tqdm import tqdm
from AppGenerator import AppGenerator
from ServerlessAppWorkflow import ServerlessAppWorkflow
warnings.filterwarnings("ignore")
class PerfOpt:
def __init__(self, Appworkflow, generate_perf_profile=... | [
"pandas.DataFrame",
"tqdm.tqdm",
"numpy.multiply",
"numpy.abs",
"networkx.set_node_attributes",
"warnings.filterwarnings",
"networkx.get_node_attributes",
"numpy.argsort",
"numpy.array",
"pandas.Series",
"networkx.all_simple_paths",
"itertools.product",
"AppGenerator.AppGenerator",
"iterto... | [((211, 244), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (234, 244), False, 'import warnings\n'), ((401, 434), 'AppGenerator.AppGenerator', 'AppGenerator', ([], {'seed': '(16)', 'type': '"""4PL"""'}), "(seed=16, type='4PL')\n", (413, 434), False, 'from AppGenerator imp... |
import cv2
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
def view_img_mask(img, mask, thres_val, model=False):
if model:
pred = model.predict(np.expand_dims(img, axis=0)).reshape((1, img.shape[0], img.shape[1], 1))
pred = np.squeeze(pred)
fig, ax = plt.subplo... | [
"matplotlib.pyplot.show",
"numpy.expand_dims",
"cv2.VideoCapture",
"numpy.squeeze",
"matplotlib.pyplot.imread",
"matplotlib.pyplot.subplots",
"cv2.resize"
] | [((644, 664), 'matplotlib.pyplot.imread', 'plt.imread', (['img_path'], {}), '(img_path)\n', (654, 664), True, 'import matplotlib.pyplot as plt\n'), ((675, 702), 'cv2.resize', 'cv2.resize', (['img', '(128, 128)'], {}), '(img, (128, 128))\n', (685, 702), False, 'import cv2\n'), ((799, 815), 'numpy.squeeze', 'np.squeeze',... |
# from collections import ChainMap # Might use eventually
import numpy as np
from openpnm.phases import GenericPhase as GenericPhase
from openpnm.utils import logging, HealthDict, PrintableList
logger = logging.getLogger(__name__)
class GenericMixture(GenericPhase):
r"""
Creates Phase object that represents ... | [
"numpy.sum",
"numpy.zeros",
"numpy.any",
"numpy.where",
"numpy.array",
"openpnm.utils.logging.getLogger",
"openpnm.utils.PrintableList",
"openpnm.utils.HealthDict"
] | [((204, 231), 'openpnm.utils.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (221, 231), False, 'from openpnm.utils import logging, HealthDict, PrintableList\n'), ((1655, 1685), 'numpy.zeros', 'np.zeros', (['self.Np'], {'dtype': 'float'}), '(self.Np, dtype=float)\n', (1663, 1685), True, 'im... |
import os
import numpy as np
import torch
from datasets import get_swag_data
from transformers import BertTokenizer, AdamW, get_linear_schedule_with_warmup
from modeling_bert import BertForMultipleChoice
import utils
from tqdm import tqdm
from torch.utils.tensorboard import SummaryWriter
from evaluation import evaluate... | [
"torch.cuda.device_count",
"os.path.join",
"torch.utils.data.DataLoader",
"utils.set_random_seed",
"torch.utils.tensorboard.SummaryWriter",
"utils.initialize_wandb",
"tqdm.tqdm",
"numpy.save",
"datasets.get_swag_data",
"numpy.mod",
"evaluation.evaluate_accuracy",
"transformers.BertTokenizer.fr... | [((443, 466), 'utils.parse_arguments', 'utils.parse_arguments', ([], {}), '()\n', (464, 466), False, 'import utils\n'), ((488, 538), 'os.path.join', 'os.path.join', (['args.checkpoint_dir', 'args.model_name'], {}), '(args.checkpoint_dir, args.model_name)\n', (500, 538), False, 'import os\n'), ((556, 602), 'os.path.join... |
"""
Python Flight Mechanics Engine (PyFME).
Copyright (c) AeroPython Development Team.
Distributed under the terms of the MIT License.
"""
from pyfme.utils.anemometry import tas2eas, tas2cas, calculate_alpha_beta_TAS
from collections import namedtuple
# Conditions class
Conditions = namedtuple('conditions', ['T... | [
"pyfme.utils.anemometry.calculate_alpha_beta_TAS",
"pyfme.utils.anemometry.tas2eas",
"pyfme.utils.anemometry.tas2cas",
"pyfme.environment.wind.NoWind",
"pyfme.environment.gravity.VerticalConstant",
"numpy.square",
"pyfme.environment.atmosphere.SeaLevel",
"collections.namedtuple"
] | [((292, 410), 'collections.namedtuple', 'namedtuple', (['"""conditions"""', "['TAS', 'CAS', 'Mach', 'q_inf', 'rho', 'T', 'P', 'a', 'alpha', 'beta',\n 'gravity_vector']"], {}), "('conditions', ['TAS', 'CAS', 'Mach', 'q_inf', 'rho', 'T', 'P',\n 'a', 'alpha', 'beta', 'gravity_vector'])\n", (302, 410), False, 'from c... |
#Histograms -->allow to visualize distribution of pixel intensity of an image (grayscale or RGB)
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
# img = cv.imread("Photos/cats 2.jpg")
# # cv.imshow("Original Image",img)
img = cv.imread('Photos/cats.jpg')
# cv.imshow("Original Image",img)
# gray =... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"cv2.circle",
"matplotlib.pyplot.show",
"cv2.bitwise_and",
"matplotlib.pyplot.plot",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.calcHist",
"numpy.zeros",
"cv2.imread",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"cv2.imshow... | [((248, 276), 'cv2.imread', 'cv.imread', (['"""Photos/cats.jpg"""'], {}), "('Photos/cats.jpg')\n", (257, 276), True, 'import cv2 as cv\n'), ((385, 424), 'numpy.zeros', 'np.zeros', (['img.shape[:2]'], {'dtype': 'np.uint8'}), '(img.shape[:2], dtype=np.uint8)\n', (393, 424), True, 'import numpy as np\n'), ((1029, 1099), '... |
"""A pre-trained implimentation of VGG16 with weights trained on ImageNet.
NOTE: It's not a great idea to use tf.constant to take in large arrays that will
not change, better to use a non-trainable variable.
https://stackoverflow.com/questions/41150741/in-tensorflow-what-is-the-difference-between-a-constant-and-a-non-... | [
"numpy.load",
"tensorflow.nn.relu",
"tensorflow.reshape",
"tensorflow.Session",
"tensorflow.constant",
"time.time",
"numpy.argsort",
"tensorflow.placeholder",
"tensorflow.nn.max_pool",
"scipy.misc.imread",
"os.path.isfile",
"tensorflow.nn.conv2d",
"tensorflow.matmul",
"scipy.misc.imresize"... | [((7226, 7232), 'time.time', 'time', ([], {}), '()\n', (7230, 7232), False, 'from time import time\n'), ((1296, 1315), 'tensorflow.name_scope', 'tf.name_scope', (['name'], {}), '(name)\n', (1309, 1315), True, 'import tensorflow as tf\n'), ((1335, 1367), 'tensorflow.constant', 'tf.constant', (["params[name + '_W']"], {}... |
import numpy as np
import typicle
import graphicle
types_ = typicle.Types()
def test_pdgs():
pdg_vals = np.arange(1, 7, dtype=types_.int)
pdgs = graphicle.PdgArray(pdg_vals)
assert list(pdgs.name) == ["d", "u", "s", "c", "b", "t"]
| [
"graphicle.PdgArray",
"numpy.arange",
"typicle.Types"
] | [((63, 78), 'typicle.Types', 'typicle.Types', ([], {}), '()\n', (76, 78), False, 'import typicle\n'), ((113, 146), 'numpy.arange', 'np.arange', (['(1)', '(7)'], {'dtype': 'types_.int'}), '(1, 7, dtype=types_.int)\n', (122, 146), True, 'import numpy as np\n'), ((158, 186), 'graphicle.PdgArray', 'graphicle.PdgArray', (['... |
import argparse
import numpy as np
import torch
import torch.nn as nn
from collections import namedtuple, OrderedDict
import torchvision as tv
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
from torch import optim
from functools import partial
import copy
from SGD import SGD
from cor... | [
"torch.cuda.synchronize",
"argparse.ArgumentParser",
"torch.sqrt",
"core.Table",
"torch.nn.CELU",
"numpy.random.randint",
"torch.no_grad",
"core.PiecewiseLinear",
"torch_backend.Mul",
"core.union",
"numpy.random.randn",
"torch_backend.trainable_params",
"torch.nn.functional.nll_loss",
"tor... | [((754, 779), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (777, 779), False, 'import argparse\n'), ((7683, 7698), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7696, 7698), False, 'import torch\n'), ((8789, 8857), 'core.PiecewiseLinear', 'PiecewiseLinear', (['[0, epochs / 5, epochs - ... |
import random
import torch
import torch.nn.functional as F
import numpy as np
from PIL import ImageOps, ImageEnhance, ImageFilter, Image
"""
For PIL.Image
"""
def autocontrast(x, *args, **kwargs):
return ImageOps.autocontrast(x.convert("RGB")).convert("RGBA")
def brightness(x, level, magnitude=10, max_level=1... | [
"torch.ones_like",
"torch.flip",
"PIL.ImageEnhance.Brightness",
"torch.randint",
"random.randint",
"torch.randn_like",
"PIL.ImageEnhance.Color",
"numpy.square",
"PIL.ImageEnhance.Contrast",
"random.random",
"PIL.ImageEnhance.Sharpness",
"torch.zeros",
"torch.no_grad",
"torch.from_numpy"
] | [((3245, 3274), 'random.randint', 'random.randint', (['(0)', '(height - 1)'], {}), '(0, height - 1)\n', (3259, 3274), False, 'import random\n'), ((3291, 3319), 'random.randint', 'random.randint', (['(0)', '(width - 1)'], {}), '(0, width - 1)\n', (3305, 3319), False, 'import random\n'), ((1349, 1364), 'random.random', '... |
import torchio
import os
import numpy as np
import pydicom as dicom
import time
import torch
import random
import math
import tensorflow as tf
prev_time = time.time()
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
imgs_shape = (512, 512)
crop_shape = (128, 128)
load_dir = 'C:/Users/trist/cs_projects/Cancer_Project/Cance... | [
"tensorflow.image.random_crop",
"pydicom.dcmread",
"numpy.save",
"torch.utils.data.DataLoader",
"os.walk",
"math.floor",
"random.choice",
"torchio.SubjectsDataset",
"time.time",
"torchio.Subject",
"numpy.append",
"torchio.ScalarImage",
"torch.device",
"os.path.join"
] | [((156, 167), 'time.time', 'time.time', ([], {}), '()\n', (165, 167), False, 'import time\n'), ((436, 453), 'os.walk', 'os.walk', (['load_dir'], {}), '(load_dir)\n', (443, 453), False, 'import os\n'), ((655, 677), 'math.floor', 'math.floor', (['total_imgs'], {}), '(total_imgs)\n', (665, 677), False, 'import math\n'), (... |
# -*- coding: utf-8 -*-
"""multilinearRegression.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1OSTS53kURF8OctaWn6l88Wlur2FKP2sp
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
veriler = pd.read_csv('/content/veriler... | [
"statsmodels.api.OLS",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"numpy.ones",
"sklearn.preprocessing.LabelEncoder",
"sklearn.linear_model.LinearRegression",
"numpy.array",
"pandas.concat"
] | [((291, 326), 'pandas.read_csv', 'pd.read_csv', (['"""/content/veriler.csv"""'], {}), "('/content/veriler.csv')\n", (302, 326), True, 'import pandas as pd\n'), ((477, 505), 'sklearn.preprocessing.LabelEncoder', 'preprocessing.LabelEncoder', ([], {}), '()\n', (503, 505), False, 'from sklearn import preprocessing\n'), ((... |
import tensorflow as tf
import numpy as np
import os
import time
from tensorflow.contrib.tensorboard.plugins import projector
slim = tf.contrib.slim
from MNIST_Classification_with_embedding import Classification_Model
from tensorflow.examples.tutorials.mnist import input_data
def main(_):
tf.logging.set_verbo... | [
"tensorflow.train.Coordinator",
"tensorflow.trainable_variables",
"tensorflow.get_collection",
"tensorflow.logging.set_verbosity",
"tensorflow.local_variables_initializer",
"tensorflow.InteractiveSession",
"tensorflow.contrib.tensorboard.plugins.projector.visualize_embeddings",
"os.path.dirname",
"t... | [((300, 342), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.DEBUG'], {}), '(tf.logging.DEBUG)\n', (324, 342), True, 'import tensorflow as tf\n'), ((5188, 5200), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (5198, 5200), True, 'import tensorflow as tf\n'), ((451, 504), 'tensorflo... |
import torch
import numpy as np
import os
import argparse
from PIL import Image
from tools import display_images_in_folder
parser = argparse.ArgumentParser('Generated Anime Faces')
parser.add_argument('--num_images', type=int, default=64, help='number of generated images')
args = parser.parse_args()
if __name__ == "_... | [
"numpy.random.uniform",
"os.makedirs",
"argparse.ArgumentParser",
"torch.load",
"numpy.transpose",
"torch.cuda.is_available",
"PIL.Image.fromarray",
"os.path.join"
] | [((133, 181), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Generated Anime Faces"""'], {}), "('Generated Anime Faces')\n", (156, 181), False, 'import argparse\n'), ((374, 424), 'os.makedirs', 'os.makedirs', (['generated_image_folder'], {'exist_ok': '(True)'}), '(generated_image_folder, exist_ok=True)\n',... |
#!/usr/bin/env python
import argparse
import numpy as np
from scipy.spatial import distance
import string
import __main__
import xtalmd
from xtalmd.utils import cellbasis
parser = argparse.ArgumentParser(description="Generate crystal lattices by using some reference crystal lattice.\
... | [
"argparse.ArgumentParser",
"pymol.cmd.copy",
"pymol.cmd.remove",
"numpy.floor",
"pymol.cmd.save",
"pymol.cmd.get_object_list",
"pymol.finish_launching",
"pymol.cmd.transform_object",
"pymol.cmd.delete",
"pymol.cmd.get_extent",
"scipy.spatial.distance.cdist",
"pymol.cmd.alter",
"pymol.cmd.cre... | [((182, 377), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate crystal lattices by using some reference crystal lattice. Written by <NAME>, <NAME>, <EMAIL>"""'}), "(description=\n 'Generate crystal lattices by using some reference cr... |
import tensorflow as tf
import os
import keras.backend as K
import hickle as hkl
import numpy as np
import argparse
from DeepSilencer import DeepSilencer
from sklearn.utils import shuffle
from Loading_data import seq_to_kspec,checkseq,chunks,loadindex,load_genome,num2acgt,acgt2num,seq2mat,encoding_matrix
from openpyxl ... | [
"argparse.ArgumentParser",
"numpy.copy",
"os.makedirs",
"Loading_data.checkseq",
"os.getcwd",
"numpy.savetxt",
"os.path.exists",
"openpyxl.load_workbook",
"Loading_data.loadindex",
"numpy.append",
"Loading_data.seq_to_kspec",
"numpy.array",
"Loading_data.load_genome",
"Loading_data.seq2mat... | [((381, 495), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""DeepSilencer: Newly developed deep learning model to predict silencers"""'}), "(description=\n 'DeepSilencer: Newly developed deep learning model to predict silencers')\n", (404, 495), False, 'import argparse\n'), ((1720, 17... |
from torch import optim
from torch.autograd import Variable
from torchvision import transforms, models
import torch
from sacred import Experiment
from sacred.observers import FileStorageObserver
from EL import CONSTS
import argparse
import numpy as np
import os
from EL.data.data import OncologyDataset
from EL.models.mo... | [
"argparse.Namespace",
"numpy.random.seed",
"EL.models.models.SenderOncoFeat",
"pickle.load",
"torch.device",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomRotation",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"os.path.exists",
"EL.models.model... | [((640, 680), 'os.path.join', 'os.path.join', (['CONSTS.RESULTS_DIR', '"""logs"""'], {}), "(CONSTS.RESULTS_DIR, 'logs')\n", (652, 680), False, 'import os\n'), ((718, 734), 'sacred.Experiment', 'Experiment', (['"""EL"""'], {}), "('EL')\n", (728, 734), False, 'from sacred import Experiment\n'), ((3568, 3601), 'argparse.N... |
#!/usr/bin/env python
from __future__ import print_function, division
import itertools, time, copy
import collections, random
import os, pickle
import numba
import numpy as np
board_size = 15
show_q = False
class AIPlayer:
def __init__(self, name, model):
self.name = name
self.model = model
... | [
"numpy.argmax",
"numpy.empty",
"numpy.zeros",
"numpy.argsort",
"numba.jit",
"numpy.array"
] | [((8858, 8894), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)', 'nogil': '(True)'}), '(nopython=True, nogil=True)\n', (8867, 8894), False, 'import numba\n'), ((20434, 20470), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)', 'nogil': '(True)'}), '(nopython=True, nogil=True)\n', (20443, 20470), False, 'import ... |
import copy
import typing as tp
from pathlib import Path
import numpy as np
import pandas as pd
import yaml
from bluesky.callbacks import CallbackBase
from bluesky.callbacks.best_effort import LivePlot, LiveScatter
from bluesky.callbacks.broker import LiveImage
from databroker.v2 import Broker
from event_model import ... | [
"matplotlib.widgets.Slider",
"yaml.dump",
"pdfstream.callbacks.from_descriptor.yield_1d_array",
"pathlib.Path",
"matplotlib.pyplot.figure",
"numpy.ma.masked_array",
"bluesky.callbacks.best_effort.LivePlot",
"pandas.DataFrame",
"event_model.unpack_event_page",
"pyFAI.io.ponifile.PoniFile",
"numpy... | [((1110, 1125), 'pathlib.Path', 'Path', (['directory'], {}), '(directory)\n', (1114, 1125), False, 'from pathlib import Path\n'), ((1491, 1527), 'pdfstream.callbacks.from_start.get_indeps', 'fs.get_indeps', (['doc'], {'exclude': "{'time'}"}), "(doc, exclude={'time'})\n", (1504, 1527), True, 'import pdfstream.callbacks.... |
import scipy.integrate as integrate
import numpy as np
import numpy.random as rd
from fractions import *
import scipy as sp
import sys
def axionphi(y,N):
phi = np.sum(y[:,0:-1:3][:],axis=-1)
phid = np.sum(y[:,1::3][:],axis=1)
return phi,phid
def dense(rhol,rho_m0,rho_r0,rho_b0,N,y,n,t,ma_array):
rhom=[]
rhor=[]... | [
"numpy.size",
"numpy.sum",
"numpy.zeros",
"numpy.array",
"numpy.sign",
"numpy.sqrt"
] | [((162, 194), 'numpy.sum', 'np.sum', (['y[:, 0:-1:3][:]'], {'axis': '(-1)'}), '(y[:, 0:-1:3][:], axis=-1)\n', (168, 194), True, 'import numpy as np\n'), ((201, 230), 'numpy.sum', 'np.sum', (['y[:, 1::3][:]'], {'axis': '(1)'}), '(y[:, 1::3][:], axis=1)\n', (207, 230), True, 'import numpy as np\n'), ((338, 368), 'numpy.s... |
import os
import h5py
from copy import deepcopy
import numpy as np
import subprocess
import itertools
class DataSet(object):
def __init__(self, config):
self.config = config
def count3gametes(self, matrix):
columnPairs = list(itertools.permutations(range(self.config.nMuts), 2))
nCol... | [
"h5py.File",
"numpy.count_nonzero",
"numpy.sum",
"numpy.lexsort",
"numpy.asarray",
"subprocess.check_output",
"numpy.zeros",
"numpy.ones",
"os.path.exists",
"numpy.shape",
"numpy.where",
"numpy.array",
"numpy.random.permutation",
"numpy.squeeze",
"os.path.join",
"numpy.concatenate"
] | [((591, 640), 'numpy.count_nonzero', 'np.count_nonzero', (['(x[:, 0, :] < x[:, 1, :])'], {'axis': '(1)'}), '(x[:, 0, :] < x[:, 1, :], axis=1)\n', (607, 640), True, 'import numpy as np\n'), ((659, 708), 'numpy.count_nonzero', 'np.count_nonzero', (['(x[:, 0, :] > x[:, 1, :])'], {'axis': '(1)'}), '(x[:, 0, :] > x[:, 1, :]... |
import numpy as np
from data.baseDataset import BaseDataset
__author__ = 'Andres'
class TrainDataset(BaseDataset):
def _saveNewFile(self, name, audio, spectrogram):
self._loaded_files[name] = [0, spectrogram]
def _sliceAudio(self, audio):
return audio[:int(0.8*audio.shape[0])]
def __ge... | [
"numpy.random.randint",
"torch.utils.data.DataLoader"
] | [((1095, 1167), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': '(128 // 16)', 'shuffle': '(True)'}), '(dataset, batch_size=128 // 16, shuffle=True)\n', (1122, 1167), False, 'import torch\n'), ((496, 588), 'numpy.random.randint', 'np.random.randint', (['(0)', '(spectrogram.sha... |
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | [
"collections.OrderedDict",
"net.Net",
"numpy.zeros",
"numpy.array"
] | [((1923, 1936), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1934, 1936), False, 'from collections import OrderedDict\n'), ((2274, 2303), 'net.Net', 'Net', (['options', 'None', 'workspace'], {}), '(options, None, workspace)\n', (2277, 2303), False, 'from net import Net\n'), ((2815, 2846), 'numpy.zeros',... |
"""
CV traffic analysis
Video processing
This code creates the VideoTracker class and provides basic command line interface to
process video inputs.
"""
#-------------------------------------------------------------------------------------
# Settings
import os
impor... | [
"numpy.isin",
"argparse.ArgumentParser",
"cv2.VideoWriter_fourcc",
"numpy.empty",
"utils.draw.draw_boxes",
"os.path.isfile",
"cv2.VideoWriter",
"cv2.imshow",
"os.path.join",
"numpy.full",
"pandas.DataFrame",
"cv2.cvtColor",
"os.path.exists",
"numpy.append",
"utils.log.get_logger",
"os.... | [((8239, 8264), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (8262, 8264), False, 'import argparse\n'), ((9265, 9276), 'time.time', 'time.time', ([], {}), '()\n', (9274, 9276), False, 'import time\n'), ((9311, 9323), 'utils.parser.get_config', 'get_config', ([], {}), '()\n', (9321, 9323), Fal... |
"""Poisson problem PDE definition"""
import math
import numpy as np
import mshr
import fenics as fa
from .poisson import Poisson
from .. import arguments
from ..graph.visualization import scalar_field_paraview, save_solution
class PoissonRobot(Poisson):
def __init__(self, args):
super(PoissonRobot, self... | [
"fenics.project",
"fenics.TrialFunction",
"fenics.Function",
"fenics.near",
"fenics.FunctionSpace",
"fenics.assemble",
"fenics.FacetNormal",
"fenics.det",
"numpy.save",
"fenics.Point",
"fenics.DirichletBC",
"fenics.variable",
"fenics.Constant",
"fenics.grad",
"fenics.VectorFunctionSpace"... | [((1748, 1789), 'fenics.VectorFunctionSpace', 'fa.VectorFunctionSpace', (['self.mesh', '"""P"""', '(1)'], {}), "(self.mesh, 'P', 1)\n", (1770, 1789), True, 'import fenics as fa\n'), ((1807, 1843), 'fenics.FunctionSpace', 'fa.FunctionSpace', (['self.mesh', '"""DG"""', '(0)'], {}), "(self.mesh, 'DG', 0)\n", (1823, 1843),... |
# Copyright 2015 PerfKitBenchmarker 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 appli... | [
"numpy.array",
"six.moves.zip",
"csv.reader",
"itertools.islice"
] | [((967, 981), 'csv.reader', 'csv.reader', (['fp'], {}), '(fp)\n', (977, 981), False, 'import csv\n'), ((999, 1026), 'itertools.islice', 'itertools.islice', (['reader', '(5)'], {}), '(reader, 5)\n', (1015, 1026), False, 'import itertools\n'), ((2632, 2659), 'numpy.array', 'np.array', (['data'], {'dtype': 'float'}), '(da... |
# -*- coding: utf-8 -*-
from src.logger import logger, loggerMapClicked
from cv2 import cv2
from os import listdir
from random import randint
from random import random
import numpy as np
import mss
import os
import subprocess
import zipfile
import pyautogui
import time
import sys
import yaml
# Load config file.
st... | [
"os.remove",
"cv2.cv2.rectangle",
"yaml.safe_load",
"sys.stdout.flush",
"cv2.cv2.waitKey",
"src.logger.logger",
"random.randint",
"src.logger.loggerMapClicked",
"pyautogui.scroll",
"subprocess.Popen",
"time.sleep",
"random.random",
"pyautogui.dragRel",
"pyautogui.click",
"cv2.cv2.imread"... | [((356, 378), 'yaml.safe_load', 'yaml.safe_load', (['stream'], {}), '(stream)\n', (370, 378), False, 'import yaml\n'), ((3364, 3381), 'os.listdir', 'listdir', (['dir_path'], {}), '(dir_path)\n', (3371, 3381), False, 'from os import listdir\n'), ((3655, 3695), 'os.listdir', 'listdir', (['"""./targets/heroes-to-send-home... |
import linear_network, relu_network, softplus_network
import data_retriever
import matplotlib.pyplot as plt
import numpy as np
training_data = data_retriever.get_data()
data_size = len(training_data)
net1 = linear_network.LinearNetwork([1, 1])
# net2 = relu_network.ReluNetwork([1, 5, 7, 7, 7, 1]) # ReLU ne... | [
"softplus_network.SoftplusNetwork",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"numpy.array",
"linear_network.LinearNetwork",
"data_retriever.get_data"
] | [((149, 174), 'data_retriever.get_data', 'data_retriever.get_data', ([], {}), '()\n', (172, 174), False, 'import data_retriever\n'), ((219, 255), 'linear_network.LinearNetwork', 'linear_network.LinearNetwork', (['[1, 1]'], {}), '([1, 1])\n', (247, 255), False, 'import linear_network, relu_network, softplus_network\n'),... |
#!/usr/bin/env python
# python 3 compatibility
from __future__ import print_function
import os.path
import sys
import shutil
import time
# stdlib imports
import abc
import textwrap
import glob
import os
import tempfile
# hack the path so that I can debug these functions if I need to
homedir = os.path.dirname(os.path... | [
"mapio.grid2d.Grid2D",
"rasterio.warp.reproject",
"mapio.geodict.GeoDict",
"numpy.ones",
"rasterio.crs.CRS",
"numpy.arange",
"mapio.gdal.get_affine",
"shutil.rmtree",
"os.path.join",
"os.path.abspath",
"shapely.geometry.Polygon",
"numpy.testing.assert_almost_equal",
"tempfile.mkdtemp",
"ma... | [((500, 528), 'sys.path.insert', 'sys.path.insert', (['(0)', 'mapiodir'], {}), '(0, mapiodir)\n', (515, 528), False, 'import sys\n'), ((313, 338), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (328, 338), False, 'import os\n'), ((392, 419), 'os.path.join', 'os.path.join', (['homedir', '"""..... |
import numpy as np
from map import Map
from agent import Agent
import matplotlib.pyplot as plt
def decide_action(next_state, episode, q_table):
epsilon = 0.5
#εグリーディ方策
if epsilon <= np.random.uniform(0,1):
next_action = np.argmax(q_table[next_state])
else:
next_action = np.random.choic... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"numpy.argmax",
"matplotlib.pyplot.legend",
"map.Map",
"matplotlib.pyplot.figure",
"agent.Agent"
] | [((1503, 1515), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1513, 1515), True, 'import matplotlib.pyplot as plt\n'), ((1617, 1629), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (1627, 1629), True, 'import matplotlib.pyplot as plt\n'), ((1634, 1644), 'matplotlib.pyplot.show', 'plt.show', ... |
#!/Users/robertpoenaru/.pyenv/shims/python
import numpy as np
import matplotlib.pyplot as plt
from numpy import random as rd
N_COILS = 3 # INTEGER NUMBER
RADIUS = 3 # CENTIMETERS
CURRENT = 5 # AMPERES
B_FIELD = 2.5 # TESLA
# ANGLE BETWEEN THE MAGNETIC MOMENT OF THE LOOP AND THE MAGNETIC FIELD B
THETA = 30.0 # R... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.power",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.savefig"
] | [((1723, 1748), 'numpy.arange', 'np.arange', (['(-120)', '(120)', '(2.5)'], {}), '(-120, 120, 2.5)\n', (1732, 1748), True, 'import numpy as np\n'), ((1817, 1831), 'numpy.sin', 'np.sin', (['alphas'], {}), '(alphas)\n', (1823, 1831), True, 'import numpy as np\n'), ((2085, 2134), 'matplotlib.pyplot.plot', 'plt.plot', (['d... |
#!/l_mnt/python/envs/teaching/bin/python3
#import Bio.PDB as bio
import pandas as pd
import numpy as np
import Geometry.GeoAtom as atm
import Geometry.GeoDensity as den
import Geometry.GeoCalcs as calcs
'''
singleton object to manage only loading pdbs once
https://python-3-patterns-idioms-test.readthedocs.io/en/lat... | [
"pandas.DataFrame",
"pandas.DataFrame.from_dict",
"Bio.PDB.PDBList",
"Geometry.GeoDensity.GeoDensity",
"Geometry.GeoCalcs.torsion",
"numpy.zeros",
"Bio.PDB.DSSP.DSSP",
"Geometry.GeoCalcs.distance",
"time.sleep",
"Geometry.GeoCalcs.angle",
"Bio.PDB.PDBParser",
"Geometry.GeoAtom.GeoAtom"
] | [((2699, 2713), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2711, 2713), True, 'import pandas as pd\n'), ((2767, 2781), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2779, 2781), True, 'import pandas as pd\n'), ((4612, 4642), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['dicdfs'], {}), ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import pickle
from argparse import ArgumentParser
import numpy as np
import yaml
def import_from_snapshot_dump(streamit, folder: str, npy_name: str, meta_name: str, category: str):
"""Import specified category from snapshot dump ... | [
"numpy.load",
"argparse.ArgumentParser",
"maro.streamit.streamit.episode",
"maro.streamit.streamit.data",
"maro.streamit.streamit.complex",
"os.path.exists",
"maro.streamit.streamit.tick",
"numpy.where",
"pickle.load",
"yaml.safe_load",
"os.path.join"
] | [((675, 705), 'os.path.join', 'os.path.join', (['folder', 'npy_name'], {}), '(folder, npy_name)\n', (687, 705), False, 'import os\n'), ((722, 753), 'os.path.join', 'os.path.join', (['folder', 'meta_name'], {}), '(folder, meta_name)\n', (734, 753), False, 'import os\n'), ((1013, 1030), 'numpy.load', 'np.load', (['npy_pa... |
import jellyfish
import math
import numpy as np
from bs4 import BeautifulSoup
import requests
import threading
import re
from . import YDHP_SiteInfo, YDHP_ScrapySystem
class NextPage:
def __init__(self, html, site_info):
self.m_html = html
self.m_site_info = site_info
def next_page(self):
... | [
"bs4.BeautifulSoup",
"threading.Thread",
"jellyfish.jaro_distance",
"numpy.average"
] | [((2125, 2146), 'numpy.average', 'np.average', (['distances'], {}), '(distances)\n', (2135, 2146), True, 'import numpy as np\n'), ((2490, 2524), 'bs4.BeautifulSoup', 'BeautifulSoup', (['self.m_html', '"""lxml"""'], {}), "(self.m_html, 'lxml')\n", (2503, 2524), False, 'from bs4 import BeautifulSoup\n'), ((1382, 1502), '... |
import sys
import numpy as np
import pandas as pd
import csv
import os
import ast
import logging
from paths import *
from data.etl import etl, over_sample
from models import train_model, predict_model
from pathlib import Path
# logger config
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
ch = log... | [
"ast.literal_eval",
"logging.FileHandler",
"csv.writer",
"pandas.read_csv",
"os.path.getsize",
"logging.StreamHandler",
"os.path.exists",
"data.etl.etl",
"logging.Formatter",
"numpy.arange",
"data.etl.over_sample",
"logging.getLogger"
] | [((252, 279), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (269, 279), False, 'import logging\n'), ((317, 340), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (338, 340), False, 'import logging\n'), ((374, 421), 'logging.FileHandler', 'logging.FileHandler', (["(log_... |
import sys,json,math
sys.path.insert(0, "/Users/tom/Dropbox/msc-ml/project/src/")
sys.path.insert(0, "/cs/student/msc/ml/2017/thosking/dev/msc-project/src/")
sys.path.insert(0, "/home/thosking/msc-project/src/")
import tensorflow as tf
import numpy as np
from instance import DiscriminatorInstance
import helpers.load... | [
"json.load",
"numpy.random.binomial",
"numpy.round",
"math.floor",
"sys.path.insert",
"numpy.mean",
"helpers.loader.load_squad_triples",
"instance.DiscriminatorInstance",
"tensorflow.app.run",
"numpy.random.shuffle"
] | [((21, 81), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/Users/tom/Dropbox/msc-ml/project/src/"""'], {}), "(0, '/Users/tom/Dropbox/msc-ml/project/src/')\n", (36, 81), False, 'import sys, json, math\n'), ((82, 157), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/cs/student/msc/ml/2017/thosking/dev/msc-projec... |
# coding:utf-8
import numpy as np
import torch
import math
import cv2
class IOUMetric(object):
"""
Class to calculate mean-iou using fast_hist method
"""
def __init__(self, num_classes):
self.num_classes = num_classes
self.hist = np.zeros((num_classes, num_classes))
def _fast_hi... | [
"torch.from_numpy",
"math.sqrt",
"torch.matmul",
"numpy.zeros",
"torch.sign",
"numpy.max",
"numpy.where",
"torch.linalg.norm",
"torch.zeros",
"numpy.diag",
"torch.no_grad",
"torch.abs",
"cv2.distanceTransform",
"numpy.concatenate",
"numpy.nanmean"
] | [((1428, 1443), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1441, 1443), False, 'import torch\n'), ((1995, 2051), 'torch.zeros', 'torch.zeros', ([], {'size': '(n_samples, n_coeffs)', 'device': 'b.device'}), '(size=(n_samples, n_coeffs), device=b.device)\n', (2006, 2051), False, 'import torch\n'), ((2071, 2127)... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>, Dept. of Land Surveying and Geo-Informatics, The Hong Kong Polytechnic Univ.
Email: <EMAIL>
"""
import gdal
import numpy as np
import keras
import rscls
import glob
data = 'all'
pfile = 'model/p48all_1602772409.6505635.h5'
size = 48
#%%
im1_file = r'images/Guangzhou.tif'
... | [
"keras.models.load_model",
"gdal.GetDriverByName",
"numpy.float32",
"numpy.zeros",
"gdal.Open",
"rscls.save_cmap",
"numpy.array",
"rscls.rscls"
] | [((2380, 2443), 'rscls.save_cmap', 'rscls.save_cmap', (['a', '"""nipy_spectral"""', "(im1_file[:-4] + '_pre.png')"], {}), "(a, 'nipy_spectral', im1_file[:-4] + '_pre.png')\n", (2395, 2443), False, 'import rscls\n'), ((851, 881), 'keras.models.load_model', 'keras.models.load_model', (['pfile'], {}), '(pfile)\n', (874, 8... |
import taichi as ti
import time
import math
import numpy as np
from renderer_utils import ray_aabb_intersection, intersect_sphere, ray_plane_intersect, reflect, refract
ti.init(arch=ti.gpu)
res = (800, 800)
color_buffer = ti.Vector(3, dt=ti.f32, shape=res)
max_ray_depth = 10
eps = 1e-4
inf = 1e10
fov = 1.0
camera_pos... | [
"taichi.Vector.zero",
"taichi.GUI",
"taichi.sin",
"taichi.cross",
"taichi.random",
"renderer_utils.reflect",
"time.time",
"taichi.dot",
"renderer_utils.refract",
"renderer_utils.ray_aabb_intersection",
"taichi.init",
"taichi.sqrt",
"taichi.cos",
"taichi.Vector",
"taichi.normalized",
"r... | [((170, 190), 'taichi.init', 'ti.init', ([], {'arch': 'ti.gpu'}), '(arch=ti.gpu)\n', (177, 190), True, 'import taichi as ti\n'), ((223, 257), 'taichi.Vector', 'ti.Vector', (['(3)'], {'dt': 'ti.f32', 'shape': 'res'}), '(3, dt=ti.f32, shape=res)\n', (232, 257), True, 'import taichi as ti\n'), ((323, 349), 'taichi.Vector'... |
import numpy as np
class QAgent(object):
""" Taken from tf_rl/examples/Q_Learning """
def __init__(self, num_state, num_action, gamma=0.95):
self._num_action = num_action
self._gamma = gamma
self.Q = np.zeros((num_state, num_action))
def select_action(self, state, epsilon=1.0):
... | [
"numpy.argmax",
"numpy.zeros",
"numpy.ones",
"numpy.max",
"numpy.random.random",
"numpy.arange"
] | [((234, 267), 'numpy.zeros', 'np.zeros', (['(num_state, num_action)'], {}), '((num_state, num_action))\n', (242, 267), True, 'import numpy as np\n'), ((590, 614), 'numpy.argmax', 'np.argmax', (['self.Q[state]'], {}), '(self.Q[state])\n', (599, 614), True, 'import numpy as np\n'), ((329, 347), 'numpy.random.random', 'np... |
"""
Testing cases here make sure that the outputs of the reduced implementation
on `DecisionTreeClassifier` and `ExtraTreeClassifier` are exactly the same as
the original version in Scikit-Learn after the data binning.
"""
import pytest
from numpy.testing import assert_array_equal
from sklearn.tree import (
Decisi... | [
"sklearn.tree.DecisionTreeRegressor",
"sklearn.model_selection.train_test_split",
"numpy.testing.assert_array_equal",
"deepforest.DecisionTreeClassifier",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.ExtraTreeRegressor",
"deepforest.ExtraTreeClassifier",
"deepforest.DecisionTreeRegressor",
"... | [((1062, 1122), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""load_func"""', '[load_iris, load_wine]'], {}), "('load_func', [load_iris, load_wine])\n", (1085, 1122), False, 'import pytest\n'), ((2047, 2107), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""load_func"""', '[load_iris, load_wine]... |
## mpiexec -n 2 python ex-2.34.py
# Use of ready-mode and synchonous-mode
# --------------------------------------------------------------------
from mpi4py import MPI
try:
import numpy
except ImportError:
raise SystemExit
if MPI.COMM_WORLD.Get_size() < 2:
raise SystemExit
# ---------------------------... | [
"numpy.empty",
"mpi4py.MPI.Status",
"mpi4py.MPI.COMM_WORLD.Get_size",
"mpi4py.MPI.Request.Waitall"
] | [((393, 443), 'numpy.empty', 'numpy.empty', (['(1000, 2)'], {'dtype': '"""f"""', 'order': '"""fortran"""'}), "((1000, 2), dtype='f', order='fortran')\n", (404, 443), False, 'import numpy\n'), ((238, 263), 'mpi4py.MPI.COMM_WORLD.Get_size', 'MPI.COMM_WORLD.Get_size', ([], {}), '()\n', (261, 263), False, 'from mpi4py impo... |
"""Boundary Spatial Dissimilarity Index."""
__author__ = "<NAME> <<EMAIL>>, <NAME> <<EMAIL>> and <NAME> <<EMAIL>>"
import numpy as np
from sklearn.metrics.pairwise import manhattan_distances
from .._base import (SingleGroupIndex, SpatialExplicitIndex,
_return_length_weighted_w)
from .dissim impo... | [
"numpy.where",
"sklearn.metrics.pairwise.manhattan_distances"
] | [((2119, 2204), 'numpy.where', 'np.where', (['(data[total_pop_var] == 0)', '(0)', '(data[group_pop_var] / data[total_pop_var])'], {}), '(data[total_pop_var] == 0, 0, data[group_pop_var] / data[total_pop_var]\n )\n', (2127, 2204), True, 'import numpy as np\n'), ((2522, 2555), 'sklearn.metrics.pairwise.manhattan_dista... |
# Copyright 2013 Devsim LLC
#
# 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, s... | [
"numpy.transpose",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.linalg.solve",
"sys.exit"
] | [((6672, 6691), 'numpy.zeros', 'numpy.zeros', (['(nee,)'], {}), '((nee,))\n', (6683, 6691), False, 'import numpy\n'), ((6749, 6772), 'numpy.zeros', 'numpy.zeros', (['(nee, dim)'], {}), '((nee, dim))\n', (6760, 6772), False, 'import numpy\n'), ((7440, 7459), 'numpy.zeros', 'numpy.zeros', (['(nee,)'], {}), '((nee,))\n', ... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib2tikz
from qflow.wavefunctions import RBMWavefunction
from qflow.hamiltonians import HarmonicOscillator
from qflow.samplers import ImportanceSampler
from qflow.optimizers import SgdOptimizer, AdamOptimizer
from qflow.training import EnergyCallback, tr... | [
"matplotlib2tikz.save",
"matplotlib.pyplot.show",
"numpy.abs",
"qflow.training.train",
"qflow.mpi.master_rank",
"numpy.empty",
"qflow.hamiltonians.HarmonicOscillator",
"numpy.asarray",
"qflow.wavefunctions.RBMWavefunction",
"qflow.samplers.ImportanceSampler",
"matplotlib.pyplot.subplots",
"qfl... | [((380, 396), 'numpy.empty', 'np.empty', (['(N, D)'], {}), '((N, D))\n', (388, 396), True, 'import numpy as np\n'), ((401, 431), 'qflow.hamiltonians.HarmonicOscillator', 'HarmonicOscillator', ([], {'omega_ho': '(1)'}), '(omega_ho=1)\n', (419, 431), False, 'from qflow.hamiltonians import HarmonicOscillator\n'), ((438, 4... |
from collections import OrderedDict, deque
from typing import Any, NamedTuple
import dm_env
import numpy as np
from dm_control import manipulation, suite
from dm_control.suite.wrappers import action_scale, pixels
from dm_env import StepType, specs
import custom_dmc_tasks as cdmc
class ExtendedTimeStep(NamedTuple):
... | [
"dm_env.specs.Array",
"dm_control.suite.wrappers.pixels.Wrapper",
"collections.deque",
"numpy.zeros",
"dm_env.specs.BoundedArray",
"numpy.prod",
"custom_dmc_tasks.make_jaco",
"collections.OrderedDict",
"numpy.squeeze",
"dm_control.suite.wrappers.action_scale.Wrapper",
"numpy.concatenate",
"dm_... | [((10067, 10103), 'custom_dmc_tasks.make_jaco', 'cdmc.make_jaco', (['task', 'obs_type', 'seed'], {}), '(task, obs_type, seed)\n', (10081, 10103), True, 'import custom_dmc_tasks as cdmc\n'), ((12004, 12057), 'dm_control.suite.wrappers.action_scale.Wrapper', 'action_scale.Wrapper', (['env'], {'minimum': '(-1.0)', 'maximu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The setup script.
"""
# Third-party
import numpy
from numpy import f2py
from setuptools.extension import Extension
from setuptools import find_packages
from setuptools import setup
from setuptools.command.build_ext import build_ext
# Import Cython AFTER setuptools
from... | [
"Cython.Build.cythonize",
"numpy.f2py.compile",
"setuptools.extension.Extension",
"numpy.get_include",
"setuptools.find_packages"
] | [((2089, 2160), 'numpy.f2py.compile', 'f2py.compile', (['code'], {'modulename': '"""src/stormtrack.extra.fronts._libfronts"""'}), "(code, modulename='src/stormtrack.extra.fronts._libfronts')\n", (2101, 2160), False, 'from numpy import f2py\n'), ((2601, 2661), 'setuptools.extension.Extension', 'Extension', (['"""*"""', ... |
import numpy as np
import matplotlib.pyplot as plt
import gd
if __name__ == "__main__":
def f(xx):
x = xx[0]
y = xx[1]
return 5 * x ** 2 - 6 * x * y + 3 * y ** 2 + 6 * x - 6 * y
def df(xx):
x = xx[0]
y = xx[1]
return np.array([10 * x - 6 * y + 6, -6 * x + 6 * y... | [
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"gd.GradiantDecent",
"numpy.array",
"numpy.linspace"
] | [((339, 363), 'gd.GradiantDecent', 'gd.GradiantDecent', (['f', 'df'], {}), '(f, df)\n', (356, 363), False, 'import gd\n'), ((378, 394), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n', (386, 394), True, 'import numpy as np\n'), ((468, 526), 'matplotlib.pyplot.scatter', 'plt.scatter', (['initial[0]', 'initial[... |
import cv2
import numpy as np
def track_hand(results,frame, net) :
"""
:param results:
:param frame:
:param net:
:return:
"""
handLms = results.multi_hand_landmarks[0]
xList=[]
yList=[]
for id, lm in enumerate(handLms.landmark) :
h,w,c = frame.shape
cx,cy = int(... | [
"numpy.asarray",
"cv2.circle",
"numpy.reshape",
"cv2.resize"
] | [((861, 924), 'cv2.resize', 'cv2.resize', (['crop_img', '(256, 256)'], {'interpolation': 'cv2.INTER_CUBIC'}), '(crop_img, (256, 256), interpolation=cv2.INTER_CUBIC)\n', (871, 924), False, 'import cv2\n'), ((942, 983), 'numpy.reshape', 'np.reshape', (['final_frame', '(1, 256, 256, 3)'], {}), '(final_frame, (1, 256, 256,... |
__author__ = '<NAME> (<EMAIL>)'
import gc
import os
import json
from multiprocessing import Pool
from functools import partial
import numpy as np
import scipy.sparse as spsp
import networkx as nx
from reveal_user_annotation.common.config_package import get_threads_number
from reveal_user_annotation.common.datarw impo... | [
"networkx.to_scipy_sparse_matrix",
"reveal_graph_embedding.datautil.snow_datautil.scipy_sparse_to_csv",
"numpy.ones",
"gc.collect",
"numpy.arange",
"reveal_graph_embedding.datautil.snow_datautil.read_adjacency_matrix",
"reveal_user_annotation.twitter.manage_resources.get_reveal_set",
"reveal_user_anno... | [((1702, 1770), 'networkx.to_scipy_sparse_matrix', 'nx.to_scipy_sparse_matrix', (['sub_graph'], {'dtype': 'np.float64', 'format': '"""csr"""'}), "(sub_graph, dtype=np.float64, format='csr')\n", (1727, 1770), True, 'import networkx as nx\n'), ((2233, 2265), 'numpy.arange', 'np.arange', (['(0)', 'submatrix_row_size'], {}... |
import netCDF4
from tvtk.api import tvtk
from mayavi import mlab
import numpy
from scipy.interpolate import griddata,RegularGridInterpolator
from numpy import mgrid, empty, sin, pi, array, meshgrid, arange, prod
import rasterio
import os
import matplotlib.pyplot as plt
from matplotlib import cm
from pyproj import Proj,... | [
"numpy.isnan",
"folium.TileLayer",
"matplotlib.pyplot.figure",
"numpy.arange",
"netCDF4.Dataset",
"datetime.timedelta",
"numpy.linspace",
"mplleaflet.fig_to_geojson",
"folium.features.DivIcon",
"dateutil.parser.parse",
"scipy.interpolate.griddata",
"folium.Popup",
"branca.colormap.linear.vir... | [((783, 828), 'dateutil.parser.parse', 'dateutil.parser.parse', (['"""2019-09-02T12:00:00Z"""'], {}), "('2019-09-02T12:00:00Z')\n", (804, 828), False, 'import dateutil\n'), ((1354, 1375), 'netCDF4.Dataset', 'netCDF4.Dataset', (['path'], {}), '(path)\n', (1369, 1375), False, 'import netCDF4\n'), ((1463, 1495), 'pyproj.t... |
import itertools
from collections import deque
import networkx as nx
import numpy as np
import pandas as pd
import scanpy as sc
from .._util import CapitalData
class Tree_Alignment:
def __init__(self):
self.__successors1 = None
self.__postorder1 = None
self.__tree1 = None
self.__s... | [
"pandas.DataFrame",
"scanpy.pp.highly_variable_genes",
"numpy.empty",
"networkx.dfs_tree",
"networkx.topological_sort",
"networkx.shortest_path",
"itertools.combinations",
"numpy.vstack",
"numpy.array",
"networkx.compose",
"networkx.convert_matrix.from_pandas_adjacency",
"networkx.DiGraph",
... | [((854, 887), 'numpy.array', 'np.array', (['gene_list'], {'dtype': 'object'}), '(gene_list, dtype=object)\n', (862, 887), True, 'import numpy as np\n'), ((955, 988), 'numpy.array', 'np.array', (['gene_list'], {'dtype': 'object'}), '(gene_list, dtype=object)\n', (963, 988), True, 'import numpy as np\n'), ((2352, 2459), ... |
import _context
import unittest
import torch
from torch import nn
import vugrad as vg
import numpy as np
"""
This is mostly a collection of test code at the moment, rather than a proper suite of unit tests.
"""
def fd_mlp():
"""
Test the framework by computing finite differences approximation to the gradie... | [
"vugrad.Exp.do_forward",
"vugrad.load_synth",
"numpy.random.randn",
"vugrad.MatrixMultiply.do_forward",
"numpy.asarray",
"vugrad.MLP",
"vugrad.TensorNode",
"vugrad.Sum.do_forward",
"vugrad.Sigmoid.do_forward",
"numpy.eye",
"vugrad.celoss",
"vugrad.Normalize.do_forward"
] | [((436, 451), 'vugrad.load_synth', 'vg.load_synth', ([], {}), '()\n', (449, 451), True, 'import vugrad as vg\n'), ((609, 635), 'vugrad.TensorNode', 'vg.TensorNode', ([], {'value': 'batch'}), '(value=batch)\n', (622, 635), True, 'import vugrad as vg\n'), ((694, 750), 'vugrad.MLP', 'vg.MLP', ([], {'input_size': 'num_feat... |
from unittest import TestCase, main
import pandas as pd
import numpy as np
import numpy.testing as npt
import os
from io import StringIO
from metapool.metapool import (read_plate_map_csv, read_pico_csv,
calculate_norm_vol, format_dna_norm_picklist,
format_... | [
"metapool.metapool.compute_shotgun_pooling_values_eqvol",
"metapool.metapool.format_index_picklist",
"metapool.metapool.calculate_norm_vol",
"metapool.metapool.add_dna_conc",
"metapool.metapool.compute_shotgun_pooling_values_qpcr",
"metapool.metapool.format_dna_norm_picklist",
"metapool.metapool.make_2D... | [((28033, 28039), 'unittest.main', 'main', ([], {}), '()\n', (28037, 28039), False, 'from unittest import TestCase, main\n'), ((1089, 1184), 'numpy.array', 'np.array', (['[[10.14, 7.89, 7.9, 15.48], [7.86, 8.07, 8.16, 9.64], [12.29, 7.64, 7.32, \n 13.74]]'], {}), '([[10.14, 7.89, 7.9, 15.48], [7.86, 8.07, 8.16, 9.64... |
import numpy
from chainer import backend
from chainer import function_node
from chainer.utils import argument
from chainer.utils import type_check
# {numpy: True, cupy: False}
_xp_supports_batch_eigh = {}
# routines for batched matrices
def _eigh(a, xp):
if xp not in _xp_supports_batch_eigh:
try:
... | [
"chainer.utils.argument.parse_kwargs",
"numpy.arange",
"chainer.backend.get_array_module",
"chainer.utils.type_check.expect"
] | [((1025, 1041), 'numpy.arange', 'numpy.arange', (['s1'], {}), '(s1)\n', (1037, 1041), False, 'import numpy\n'), ((10230, 10366), 'chainer.utils.argument.parse_kwargs', 'argument.parse_kwargs', (['kwargs', "('groups', 16)", "('eps', 2e-05)", "('running_mean', None)", "('running_projection', None)", "('decay', 0.9)"], {}... |
import h5py
import copy
from collections import OrderedDict
import numpy as np
import torch
from gwpy.timeseries import TimeSeries, TimeSeriesDict
from .signal import bandpass
class TimeSeriesDataset:
""" Torch dataset in timeseries format """
def __init__(self):
""" Initialized attributes """
... | [
"numpy.stack",
"numpy.pad",
"copy.deepcopy",
"h5py.File",
"gwpy.timeseries.TimeSeriesDict.get",
"numpy.ceil",
"numpy.argsort",
"torch.Tensor",
"numpy.sin",
"numpy.where",
"numpy.delete",
"gwpy.timeseries.TimeSeries"
] | [((817, 894), 'gwpy.timeseries.TimeSeriesDict.get', 'TimeSeriesDict.get', (['channels', 't0', '(t0 + duration)'], {'nproc': 'nproc', 'allow_tape': '(True)'}), '(channels, t0, t0 + duration, nproc=nproc, allow_tape=True)\n', (835, 894), False, 'from gwpy.timeseries import TimeSeries, TimeSeriesDict\n'), ((1339, 1358), '... |
from __future__ import print_function
import json
import itertools
import re
import os.path as path
import sys
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))
import tempfile
import random
import numpy as np
import pulp
from nltk.corpus import stopwords
from nltk.stem.snowball impo... | [
"random.sample",
"json.dumps",
"sklearn.svm.SVC",
"pulp.lpSum",
"os.path.abspath",
"summarizer.utils.data_helpers.get_parse_info",
"tempfile.mkdtemp",
"summarizer.utils.data_helpers.prune_phrases",
"pulp.LpProblem",
"itertools.chain",
"re.search",
"re.sub",
"pulp.CPLEX",
"pulp.value",
"s... | [((2511, 2546), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'prefix': '"""simufee-"""'}), "(prefix='simufee-')\n", (2527, 2546), False, 'import tempfile\n'), ((2687, 2705), 'summarizer.baselines.sume_wrap.SumeWrap', 'SumeWrap', (['language'], {}), '(language)\n', (2695, 2705), False, 'from summarizer.baselines.sume_w... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import numpy as np
from polyaxon_schemas.optimizers import SGDConfig
import polyaxon_lib as plx
import tensorflow as tf
from polyaxon_schemas.losses import MeanSquaredErrorConfig
from sklearn import datasets
from sklearn impo... | [
"polyaxon_lib.layers.Dense",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"numpy.asarray",
"polyaxon_lib.estimators.Estimator",
"polyaxon_schemas.optimizers.SGDConfig",
"tensorflow.logging.set_verbosity",
"polyaxon_schemas.losses.MeanSquaredErrorConfig",
"numpy... | [((912, 934), 'sklearn.datasets.load_boston', 'datasets.load_boston', ([], {}), '()\n', (932, 934), False, 'from sklearn import datasets\n'), ((1051, 1121), 'sklearn.model_selection.train_test_split', 'model_selection.train_test_split', (['x', 'y'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(x, y, test_size=0.2... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | [
"argparse.ArgumentParser",
"torch.utils.data.RandomSampler",
"configs.add_args",
"logging.getLogger",
"torch.cuda.device_count",
"numpy.mean",
"torch.device",
"torch.no_grad",
"os.path.join",
"multiprocessing.cpu_count",
"utils.load_and_cache_malware_data",
"torch.utils.data.DataLoader",
"to... | [((2212, 2239), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (2237, 2239), False, 'import multiprocessing\n'), ((2241, 2384), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""',... |
"""
Tests implementations of sub-population model metrics and tools.
"""
# Author: <NAME> <<EMAIL>>
# License: new BSD
import pytest
import numpy as np
import fatf.utils.metrics.subgroup_metrics as fums
MISSING_LABEL_WARNING = ('Some of the given labels are not present in either '
'of the i... | [
"fatf.utils.metrics.subgroup_metrics.apply_metric",
"fatf.utils.metrics.subgroup_metrics.performance_per_subgroup_indexed",
"pytest.warns",
"fatf.utils.metrics.subgroup_metrics.performance_per_subgroup",
"numpy.zeros",
"pytest.raises",
"numpy.array",
"pytest.approx",
"fatf.utils.metrics.subgroup_met... | [((351, 630), 'numpy.array', 'np.array', (["[['0', '3', '0'], ['0', '5', '0'], ['0', '7', '0'], ['0', '5', '0'], ['0',\n '7', '0'], ['0', '3', '0'], ['0', '5', '0'], ['0', '3', '0'], ['0', '7',\n '0'], ['0', '5', '0'], ['0', '7', '0'], ['0', '7', '0'], ['0', '5', '0'\n ], ['0', '7', '0'], ['0', '7', '0']]"], {... |
"""Facebook API"""
import os
import json
import logging
import pandas as pd
import time
import numpy as np
from datetime import datetime
from facebook_business.api import FacebookAdsApi
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.serverside.event import Event
from facebo... | [
"pandas.DataFrame",
"logging.error",
"json.load",
"logging.debug",
"facebook_business.adobjects.serverside.custom_data.CustomData",
"datetime.datetime.today",
"logging.warning",
"facebook_business.adobjects.serverside.user_data.UserData",
"facebook_business.api.FacebookAdsApi.init",
"logging.info"... | [((2945, 2963), 'pandas.DataFrame', 'pd.DataFrame', (['logs'], {}), '(logs)\n', (2957, 2963), True, 'import pandas as pd\n'), ((2071, 2137), 'facebook_business.adobjects.serverside.user_data.UserData', 'UserData', ([], {'country_code': "row['shop']", 'fbp': "row['facebook_browser_id']"}), "(country_code=row['shop'], fb... |
import os
import sys
import h5py
import torch
import torch.nn as nn
import argparse
import numpy as np
from tqdm import tqdm
from plyfile import PlyData, PlyElement
import math
from imageio import imread
from PIL import Image
import torchvision.transforms as transforms
sys.path.append(os.path.join(os.getcwd())) # HACK... | [
"h5py.File",
"tqdm.tqdm",
"os.getcwd",
"imageio.imread",
"numpy.asarray",
"numpy.transpose",
"torch.zeros",
"torch.Tensor",
"numpy.array",
"PIL.Image.fromarray",
"torchvision.transforms.CenterCrop",
"torchvision.transforms.Normalize",
"os.path.join",
"torch.sort",
"lib.projection.Project... | [((542, 580), 'os.path.join', 'os.path.join', (['SCANNET_FRAME_ROOT', '"""{}"""'], {}), "(SCANNET_FRAME_ROOT, '{}')\n", (554, 580), False, 'import os\n'), ((795, 849), 'lib.projection.ProjectionHelper', 'ProjectionHelper', (['INTRINSICS', '(0.1)', '(4.0)', '[41, 32]', '(0.05)'], {}), '(INTRINSICS, 0.1, 4.0, [41, 32], 0... |
import numpy as np
from scipy.stats import norm
from dcf import dcf
def blacklet(K, F, vol, omega=1):
log_ratio = np.log(F / K)
d1 = (log_ratio + 0.5 * vol**2) / vol
d2 = (log_ratio - 0.5 * vol**2) / vol
return F * omega * norm.cdf(omega * d1) - K * omega * norm.cdf(omega * d2)
d... | [
"scipy.stats.norm.cdf",
"dcf.dcf",
"numpy.log",
"numpy.sqrt"
] | [((128, 141), 'numpy.log', 'np.log', (['(F / K)'], {}), '(F / K)\n', (134, 141), True, 'import numpy as np\n'), ((405, 429), 'dcf.dcf', 'dcf', (['S', 'T'], {'method': 'method'}), '(S, T, method=method)\n', (408, 429), False, 'from dcf import dcf\n'), ((1097, 1121), 'dcf.dcf', 'dcf', (['S', 'T'], {'method': 'method'}), ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 12 13:00:50 2017
@author: Charlie
Program for storing and plotting information about reading habits: "bookworm"
IMPORTANT!! CLASS AND SUBFUNCTIONS SHOULD JUST DO PYTHON STUFF.
FUNCTIONS BELOW THE CLASS THAT CALL THE CLASS FNS ARE FOR PLAYING WITH CLICK
"""
import click... | [
"pickle.dump",
"click.edit",
"click.argument",
"click.option",
"click.launch",
"click.command",
"click.Choice",
"pickle.load",
"numpy.array",
"csv.DictWriter",
"matplotlib.pyplot.subplots",
"click.prompt"
] | [((428, 443), 'click.command', 'click.command', ([], {}), '()\n', (441, 443), False, 'import click\n'), ((445, 471), 'click.argument', 'click.argument', (['"""filename"""'], {}), "('filename')\n", (459, 471), False, 'import click\n'), ((804, 819), 'click.command', 'click.command', ([], {}), '()\n', (817, 819), False, '... |
import tensorflow as tf
import numpy as np
import cv2
import random
# Metodos para Data Augmentation siguiendo el Dataset API
# de tensorflow, donde
# x, y in dataset:
# x: tensor con la imagen de shape [w, h, 3]
# y: tenosr con one_hot encoding de las classes
# Realiza un flip aleatorio a la image
def random_fli... | [
"random.uniform",
"tensorflow.image.random_flip_up_down",
"tensorflow.image.random_contrast",
"tensorflow.convert_to_tensor",
"tensorflow.image.random_hue",
"tensorflow.image.random_flip_left_right",
"numpy.mean",
"numpy.array",
"tensorflow.image.random_saturation",
"tensorflow.image.random_bright... | [((337, 371), 'tensorflow.image.random_flip_left_right', 'tf.image.random_flip_left_right', (['x'], {}), '(x)\n', (368, 371), True, 'import tensorflow as tf\n'), ((380, 411), 'tensorflow.image.random_flip_up_down', 'tf.image.random_flip_up_down', (['x'], {}), '(x)\n', (408, 411), True, 'import tensorflow as tf\n'), ((5... |
# -*- coding: utf-8 -*-
# Copyright 2021 Zegami Ltd
"""Annotation functionality."""
import base64
import io
import os
import numpy as np
from PIL import Image
class _Annotation():
"""Base (abstract) class for annotations."""
# Define the string annotation TYPE in child classes
TYPE = None
UPLOADAB... | [
"io.BytesIO",
"os.path.exists",
"numpy.expand_dims",
"base64.b64decode",
"PIL.Image.open",
"numpy.any",
"os.path.isfile",
"numpy.where",
"base64.b64encode",
"numpy.array",
"PIL.Image.fromarray"
] | [((4971, 4983), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (4981, 4983), False, 'import io\n'), ((5097, 5124), 'base64.b64encode', 'base64.b64encode', (['byte_data'], {}), '(byte_data)\n', (5113, 5124), False, 'import base64\n'), ((6042, 6074), 'PIL.Image.fromarray', 'Image.fromarray', (['self.mask_uint8'], {}), '(s... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 14:55:35 2019
@author: hindesa
"""
import random
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
# Random resource network
# Using ecological subsystem only version of TSL
#Assume n,m same for both social networks
#total no. agents
n = 20
#nu... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.floor",
"numpy.zeros",
"networkx.draw_networkx",
"numpy.linspace",
"networkx.get_node_attributes",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"networkx.gnm_random_graph"
] | [((611, 636), 'networkx.gnm_random_graph', 'nx.gnm_random_graph', (['n', 'm'], {}), '(n, m)\n', (630, 636), True, 'import networkx as nx\n'), ((1280, 1327), 'networkx.draw_networkx', 'nx.draw_networkx', (['G'], {'pos': 'None', 'node_size': 'stocks'}), '(G, pos=None, node_size=stocks)\n', (1296, 1327), True, 'import net... |
import requests
import pandas as pd
import numpy as np
import io
from nltk.corpus import stopwords
stop = stopwords.words('english')
def remove_stopwords(df, column: str):
df[column +"_without_stopwords"] = df[column].apply(lambda x: ' '.join([word for word in x.split() if word not in stop]))
return df
# url = "... | [
"numpy.stack",
"pandas.read_csv",
"numpy.zeros",
"numpy.nonzero",
"itertools.combinations",
"numpy.min",
"nltk.corpus.stopwords.words"
] | [((106, 132), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (121, 132), False, 'from nltk.corpus import stopwords\n'), ((505, 561), 'pandas.read_csv', 'pd.read_csv', (['"""plagiarism.csv"""'], {'encoding': '"""unicode_escape"""'}), "('plagiarism.csv', encoding='unicode_esca... |
import random
import numpy as np
import copy
import sys
import pickle as pkl
import torch
from torch import nn
class BatchBucket():
def __init__(self, max_h, max_w, max_l, max_img_size, max_batch_size, feature_file, label_file, dictionary,
use_all=True):
self._max_img_size = max_img_size
... | [
"torch.ones",
"numpy.log",
"random.shuffle",
"torch.nn.init.xavier_uniform_",
"numpy.transpose",
"numpy.zeros",
"copy.copy",
"numpy.max",
"pickle.load",
"numpy.array",
"torch.nn.init.constant_",
"numpy.tile",
"numpy.arange",
"torch.zeros",
"sys.exit",
"torch.from_numpy"
] | [((6755, 6772), 'numpy.max', 'np.max', (['heights_x'], {}), '(heights_x)\n', (6761, 6772), True, 'import numpy as np\n'), ((6791, 6807), 'numpy.max', 'np.max', (['widths_x'], {}), '(widths_x)\n', (6797, 6807), True, 'import numpy as np\n'), ((6824, 6842), 'numpy.max', 'np.max', (['lengths_ly'], {}), '(lengths_ly)\n', (... |
import numpy as np
import pandas as pd
import unittest
from Eir.DTMC.spatialModel.Hub.HubSEIRD import HubSEIRD
import Eir.exceptions as e
# keep this seed when running test so that outputs can be checked
np.random.seed(7363817)
class Test_HubSEIRD(unittest.TestCase):
def __init__(self):
self.test = H... | [
"pandas.read_csv",
"numpy.random.seed",
"Eir.DTMC.spatialModel.Hub.HubSEIRD.HubSEIRD"
] | [((205, 228), 'numpy.random.seed', 'np.random.seed', (['(7363817)'], {}), '(7363817)\n', (219, 228), True, 'import numpy as np\n'), ((319, 442), 'Eir.DTMC.spatialModel.Hub.HubSEIRD.HubSEIRD', 'HubSEIRD', ([], {'S0': '(999)', 'E0': '(1)', 'I0': '(1)', 'R0': '(0)', 'pss': '(0.23)', 'rho': '(0.2)', 'gamma': '(0.15)', 'mu'... |
#!/usr/bin/env python
"""Graphs the progress of various technologies."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
__author__ = "<NAME>"
import os
import numpy as np
import pylab as plt
import matplotlib.ticker as ticker
from astropy.table import Tabl... | [
"pylab.subplot",
"pylab.figure",
"matplotlib.ticker.FormatStrFormatter",
"pylab.text",
"numpy.log10",
"os.path.join",
"astropy.table.Table.read"
] | [((734, 770), 'astropy.table.Table.read', 'Table.read', (['filename'], {'format': '"""ascii"""'}), "(filename, format='ascii')\n", (744, 770), False, 'from astropy.table import Table\n'), ((1062, 1088), 'pylab.figure', 'plt.figure', ([], {'figsize': '(8, 5)'}), '(figsize=(8, 5))\n', (1072, 1088), True, 'import pylab as... |
import numpy as np
import math
import scipy.io as scio
from CreateHSP import CreateHSP
dataFile = './data/FDK_proj_curve.mat'
data = scio.loadmat(dataFile)
ScanR = data['ScanR']
DistD = data['StdDis']
Radius = data['ObjR']
ProjData = data['Proj']
ProjScale = int(data['ProjScale'])
DecFanAng = data['DecAngle']
Dgy = ... | [
"numpy.fft.ifft",
"scipy.io.loadmat",
"numpy.fft.fft",
"numpy.zeros",
"CreateHSP.CreateHSP",
"scipy.io.savemat",
"numpy.ones",
"numpy.array"
] | [((135, 157), 'scipy.io.loadmat', 'scio.loadmat', (['dataFile'], {}), '(dataFile)\n', (147, 157), True, 'import scipy.io as scio\n'), ((320, 356), 'numpy.array', 'np.array', (['ProjData'], {'dtype': 'np.float32'}), '(ProjData, dtype=np.float32)\n', (328, 356), True, 'import numpy as np\n'), ((954, 979), 'CreateHSP.Crea... |
"""
Eigenvalue analyses tools for mechnical system:
mass matrix M, stiffness matrix K and possibly damping matrix C
"""
import pandas as pd
import numpy as np
from scipy import linalg
def polyeig(*A):
"""
Solve the polynomial eigenvalue problem:
(A0 + e A1 +...+ e**p Ap)x = 0
Return the... | [
"numpy.set_printoptions",
"numpy.abs",
"numpy.isreal",
"numpy.eye",
"numpy.zeros",
"scipy.linalg.eig",
"numpy.argsort",
"numpy.imag",
"numpy.array",
"numpy.real",
"numpy.column_stack",
"numpy.dot",
"numpy.diag",
"numpy.sqrt"
] | [((1229, 1245), 'scipy.linalg.eig', 'linalg.eig', (['C', 'D'], {}), '(C, D)\n', (1239, 1245), False, 'from scipy import linalg\n'), ((3822, 3837), 'numpy.diag', 'np.diag', (['Lambda'], {}), '(Lambda)\n', (3829, 3837), True, 'import numpy as np\n'), ((4107, 4116), 'numpy.abs', 'np.abs', (['v'], {}), '(v)\n', (4113, 4116... |
import numpy as np
# from ..lane_detection.lane_detector import LaneDetector
# from ..lane_detection.camera_geometry import CameraGeometry
import sys
sys.path.append('../../code')
from solutions.lane_detection.lane_detector import LaneDetector
from solutions.lane_detection.camera_geometry import CameraGeometry
... | [
"sys.path.append",
"numpy.poly1d",
"numpy.sum",
"numpy.polyfit",
"numpy.nonzero",
"numpy.linalg.norm",
"numpy.linalg.inv",
"numpy.array",
"solutions.lane_detection.camera_geometry.CameraGeometry"
] | [((154, 183), 'sys.path.append', 'sys.path.append', (['"""../../code"""'], {}), "('../../code')\n", (169, 183), False, 'import sys\n'), ((555, 571), 'numpy.linalg.inv', 'np.linalg.inv', (['K'], {}), '(K)\n', (568, 571), True, 'import numpy as np\n'), ((651, 668), 'numpy.linalg.norm', 'np.linalg.norm', (['x'], {}), '(x)... |
# encoding=utf8
"""Implementations of Weierstrass functions."""
import numpy as np
from niapy.problems.problem import Problem
__all__ = ['Weierstrass']
class Weierstrass(Problem):
r"""Implementations of Weierstrass functions.
Date: 2018
Author: <NAME>
License: MIT
Function:
**Weierstrass... | [
"numpy.cos"
] | [((3029, 3066), 'numpy.cos', 'np.cos', (['(2 * np.pi * self.b ** k * 0.5)'], {}), '(2 * np.pi * self.b ** k * 0.5)\n', (3035, 3066), True, 'import numpy as np\n'), ((2867, 2915), 'numpy.cos', 'np.cos', (['(2.0 * np.pi * self.b ** k * (x[i] + 0.5))'], {}), '(2.0 * np.pi * self.b ** k * (x[i] + 0.5))\n', (2873, 2915), Tr... |
import warnings
from typing import Optional
import cv2
import numpy as np
from utils.tools import TimerBlock
class VideoData:
def __init__(self, frames, fps, is_rgb=True):
self.frames = np.array(frames)
self.fps = fps
self.height, self.width = self.frames.shape[-2:] if self.is_nchw else ... | [
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"cv2.VideoCapture",
"numpy.array",
"cv2.VideoWriter",
"warnings.warn",
"utils.tools.TimerBlock",
"numpy.concatenate"
] | [((1688, 1716), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video_path'], {}), '(video_path)\n', (1704, 1716), False, 'import cv2\n'), ((3008, 3039), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'DIVX'"], {}), "(*'DIVX')\n", (3030, 3039), False, 'import cv2\n'), ((3059, 3161), 'cv2.VideoWriter', 'cv2.VideoWri... |
#!/usr/bin/python3 -d
import numpy as np
import simpleaudio as sa
class Didah:
FS = 44100 # samples per second
NUM_CHANNELS = 1
BYTES_PER_SAMPLE = 2
dit_sound = None
dah_sound = None
space_sound = None
letter_space_sound = None
word_space_sound = None
def generate_tone(self, du... | [
"numpy.abs",
"numpy.sin",
"simpleaudio.play_buffer"
] | [((527, 555), 'numpy.sin', 'np.sin', (['(freq * t * 2 * np.pi)'], {}), '(freq * t * 2 * np.pi)\n', (533, 555), True, 'import numpy as np\n'), ((996, 1071), 'simpleaudio.play_buffer', 'sa.play_buffer', (['audio', 'Didah.NUM_CHANNELS', 'Didah.BYTES_PER_SAMPLE', 'Didah.FS'], {}), '(audio, Didah.NUM_CHANNELS, Didah.BYTES_P... |
"""
INTERFACE
- movies with shape (#number of movies, #features(title, year, genres, ...))
- user_item_matrix with shape (#number of users, #number of movies)
- top_list with shape (#number of movies, 2)
- item-item matrix with shape (#number of popular movies, #number of popular movies)
- nmf_model: trained sklearn N... | [
"pandas.DataFrame",
"pandas.Series",
"requests.get",
"bs4.BeautifulSoup",
"fuzzywuzzy.process.extract",
"numpy.nanmean"
] | [((886, 935), 'fuzzywuzzy.process.extract', 'process.extract', (['movie_title', 'movie_list'], {'limit': '(3)'}), '(movie_title, movie_list, limit=3)\n', (901, 935), False, 'from fuzzywuzzy import process\n'), ((1128, 1168), 'pandas.Series', 'pd.Series', (['np.nan'], {'index': "movies['title']"}), "(np.nan, index=movie... |
import math
import numpy as np
def complexSignal(f1, f2, a1, a2, data_points = 3000, dT = 0.01,noisy = True,
mean = 0, std = 10,separate_signals = False):
if noisy:
noise = np.random.normal(mean, std, size=data_points)
else:
noise = np.zeros(shape=(data_points))
... | [
"numpy.zeros",
"math.sin",
"numpy.array",
"math.cos",
"numpy.random.normal"
] | [((373, 405), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2, data_points)'}), '(shape=(2, data_points))\n', (381, 405), True, 'import numpy as np\n'), ((209, 254), 'numpy.random.normal', 'np.random.normal', (['mean', 'std'], {'size': 'data_points'}), '(mean, std, size=data_points)\n', (225, 254), True, 'import numpy as... |
import cv2
import numpy as np
from math import sqrt, log, pi, sin, cos, floor
def populate_canvas(canvas, A, b):
B = np.array([[1, cos(pi/3.)], [0, sin(pi/3.)]])
T = np.linalg.inv(B)
B1 = B[:,0]
B2 = B[:,1]
for i in range(canvas.shape[0]):
y = (i*1./canvas.shape[0] - 0.5) * -H
for j... | [
"cv2.imwrite",
"numpy.zeros",
"math.floor",
"math.sin",
"numpy.array",
"numpy.linalg.inv",
"math.cos",
"numpy.dot"
] | [((896, 935), 'numpy.zeros', 'np.zeros', (['(400, 400, 3)'], {'dtype': 'np.uint8'}), '((400, 400, 3), dtype=np.uint8)\n', (904, 935), True, 'import numpy as np\n'), ((175, 191), 'numpy.linalg.inv', 'np.linalg.inv', (['B'], {}), '(B)\n', (188, 191), True, 'import numpy as np\n'), ((1064, 1084), 'numpy.array', 'np.array'... |
import numpy as np
import torch
import tensorflow as tf
# from tflib.inception_score import get_inception_score
from .inception_tf13 import get_inception_score
import tflib.fid as fid
BATCH_SIZE = 100
N_CHANNEL = 3
RESOLUTION = 64
NUM_SAMPLES = 50000
def cal_inception_score(G, device, z_dim):
all_samples = []
... | [
"tflib.fid.check_or_download_inception",
"numpy.load",
"numpy.multiply",
"tflib.fid.calculate_activation_statistics",
"tensorflow.global_variables_initializer",
"tflib.fid.calculate_frechet_distance",
"tensorflow.Session",
"torch.randn",
"tensorflow.ConfigProto",
"tflib.fid.create_inception_graph"... | [((332, 363), 'torch.randn', 'torch.randn', (['NUM_SAMPLES', 'z_dim'], {}), '(NUM_SAMPLES, z_dim)\n', (343, 363), False, 'import torch\n'), ((593, 628), 'numpy.concatenate', 'np.concatenate', (['all_samples'], {'axis': '(0)'}), '(all_samples, axis=0)\n', (607, 628), True, 'import numpy as np\n'), ((953, 984), 'torch.ra... |
"""
Test support for HuggingFace models.
"""
import numpy as np
import pytest
import lm_zoo as Z
from syntaxgym import compute_surprisals, evaluate
from syntaxgym.suite import Suite
zoo = Z.get_registry()
def huggingface_model_fixture(request):
"""
Defines a generic HF model fixture to be parameterized in... | [
"syntaxgym.compute_surprisals",
"numpy.testing.assert_almost_equal",
"pytest.fixture",
"lm_zoo.get_registry",
"syntaxgym.suite.Suite.from_dict"
] | [((192, 208), 'lm_zoo.get_registry', 'Z.get_registry', ([], {}), '()\n', (206, 208), True, 'import lm_zoo as Z\n'), ((713, 844), 'pytest.fixture', 'pytest.fixture', (['huggingface_model_fixture'], {'scope': '"""module"""', 'params': '(huggingface_model_word_refs + huggingface_model_subword_refs)'}), "(huggingface_model... |
import numpy as np
import torch
import torch.nn as nn
import src.net as net
def get_device():
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
print('Device State:', device)
return device
class DL_Config(object):
def __init__(self) -> None:
self.basic_config()
self.net_conf... | [
"src.net.Net04",
"torch.nn.MSELoss",
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed_all",
"torch.cuda.is_available"
] | [((121, 146), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (144, 146), False, 'import torch\n'), ((565, 590), 'numpy.random.seed', 'np.random.seed', (['self.SEED'], {}), '(self.SEED)\n', (579, 590), True, 'import numpy as np\n'), ((599, 627), 'torch.manual_seed', 'torch.manual_seed', (['self.... |
if __name__ == '__main__':
import numpy as np
import pandas as pd
import os
print('\n Memory Pressure Test Starts...\n')
for i in os.listdir():
if 'mprofile_' in i:
df = pd.read_csv(i, sep=' ', error_bad_lines=False)
df.columns = ['null', 'memory', 'time']
df.drop('nu... | [
"pandas.read_csv",
"numpy.array",
"os.listdir"
] | [((153, 165), 'os.listdir', 'os.listdir', ([], {}), '()\n', (163, 165), False, 'import os\n'), ((403, 436), 'numpy.array', 'np.array', (['df.memory.values[1500:]'], {}), '(df.memory.values[1500:])\n', (411, 436), True, 'import numpy as np\n'), ((213, 259), 'pandas.read_csv', 'pd.read_csv', (['i'], {'sep': '""" """', 'e... |
#!/usr/bin/python3
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import cv2
import pytesseract
import json
import sys
import os
import re
# the setrecursionlimit function is
# used to modify the default recursion
# limit set by python. Using this,
# we can increase the recursion limit
... | [
"matplotlib.pyplot.title",
"json.load",
"cv2.cvtColor",
"matplotlib.pyplot.close",
"cv2.threshold",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"matplotlib.pyplot.imshow",
"pytesseract.image_to_string",
"PIL.Image.open",
"cv2.bilateralFilter",
"os.path.isfile",
"matplotlib.pyplot.figure",
"... | [((346, 376), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 6)'], {}), '(10 ** 6)\n', (367, 376), False, 'import sys\n'), ((11401, 11468), 'pytesseract.image_to_string', 'pytesseract.image_to_string', (['image'], {'lang': '"""eng"""', 'config': 'customConfig'}), "(image, lang='eng', config=customConfig)\n... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
print("start")
# Data sets
IRIS_TRAINING = "iris_training.csv"
IRIS_TEST = "iris_test.csv"
# Load datasets.
print("load")
training_set = tf.contrib.learn.datasets.bas... | [
"tensorflow.contrib.layers.real_valued_column",
"tensorflow.contrib.learn.datasets.base.load_csv",
"numpy.array",
"tensorflow.contrib.learn.DNNClassifier"
] | [((291, 379), 'tensorflow.contrib.learn.datasets.base.load_csv', 'tf.contrib.learn.datasets.base.load_csv', ([], {'filename': 'IRIS_TRAINING', 'target_dtype': 'np.int'}), '(filename=IRIS_TRAINING,\n target_dtype=np.int)\n', (330, 379), True, 'import tensorflow as tf\n'), ((442, 527), 'tensorflow.contrib.learn.datase... |
import dask
import dask.array as da
import dask.dataframe as dd
import numpy as np
import sklearn.base
from sklearn.utils.validation import check_is_fitted
from ..base import ClassifierMixin, RegressorMixin
from ..utils import check_array
class BlockwiseBase(sklearn.base.BaseEstimator):
def __init__(self, estima... | [
"numpy.stack",
"dask.delayed",
"numpy.dtype",
"dask.array.stack",
"sklearn.utils.validation.check_is_fitted",
"numpy.apply_along_axis",
"numpy.array",
"dask.compute",
"numpy.bincount",
"numpy.vstack"
] | [((9580, 9616), 'numpy.apply_along_axis', 'np.apply_along_axis', (['_vote', '(1)', 'block'], {}), '(_vote, 1, block)\n', (9599, 9616), True, 'import numpy as np\n'), ((10020, 10037), 'numpy.stack', 'np.stack', (['batches'], {}), '(batches)\n', (10028, 10037), True, 'import numpy as np\n'), ((660, 688), 'dask.delayed', ... |
import numpy as np
import pandas as pd
from definitions import ROOT_DIR
import logging.config
import helpers
from data_handler import DataHandler
from knn_user import KNNUser
DS_PATH = ROOT_DIR + "/datasets/ml-latest-small"
class SimpleKNNFederator:
logging.config.fileConfig(ROOT_DIR + "/logging.conf", disable_... | [
"helpers.convert_np_to_pandas",
"knn_user.KNNUser",
"data_handler.DataHandler",
"helpers.pretty_print_results",
"numpy.concatenate"
] | [((762, 816), 'data_handler.DataHandler', 'DataHandler', ([], {'filename': 'ds_path', 'dtype': 'np.uint32', 'cols': '(4)'}), '(filename=ds_path, dtype=np.uint32, cols=4)\n', (773, 816), False, 'from data_handler import DataHandler\n'), ((1192, 1266), 'helpers.pretty_print_results', 'helpers.pretty_print_results', (['se... |
import json
import urllib.parse
import boto3
print('Loading function')
s3 = boto3.client('s3')
import os
def lambda_handler(event, context):
# Get the object from the event and show its content type
bucket = event['Records'][0]['s3']['bucket']['name']
key = urllib.parse.unquote_plus(event['Record... | [
"os.listdir",
"cv2.GaussianBlur",
"numpy.uint8",
"boto3.client",
"cv2.copyMakeBorder",
"numpy.percentile",
"cv2.imread",
"cv2.convertScaleAbs",
"cv2.imencode",
"cv2.Sobel",
"cv2.resize"
] | [((78, 96), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (90, 96), False, 'import boto3\n'), ((1731, 1753), 'cv2.resize', 'cv2.resize', (['src', 'dsize'], {}), '(src, dsize)\n', (1741, 1753), False, 'import cv2\n'), ((1825, 1874), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['src', '(3, 3)', 'cv2.BORDER... |
"""gpmap.py: Defines layers representing G-P maps."""
# Standard imports
import numpy as np
from collections.abc import Iterable
import pdb
# Tensorflow imports
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.initializers import Constant
from tensorflow.keras.layers import Layer, Den... | [
"tensorflow.keras.backend.sum",
"numpy.random.randn",
"tensorflow.keras.layers.Dense",
"tensorflow.gather",
"tensorflow.reshape",
"tensorflow.concat",
"tensorflow.keras.regularizers.L2",
"numpy.array",
"numpy.reshape",
"tensorflow.keras.initializers.Constant",
"numpy.arange",
"numpy.sqrt"
] | [((1045, 1096), 'tensorflow.keras.regularizers.L2', 'tf.keras.regularizers.L2', (['self.theta_regularization'], {}), '(self.theta_regularization)\n', (1069, 1096), True, 'import tensorflow as tf\n'), ((4346, 4384), 'tensorflow.reshape', 'tf.reshape', (['x_lc', '[-1, self.L, self.C]'], {}), '(x_lc, [-1, self.L, self.C])... |
import pandas as pd
import numpy as np
import tqdm
import datetime
import os
import random
import FAB.models.RL_brain_fab as td3
import sklearn.preprocessing as pre
import tqdm
import torch
import torch.nn as nn
import torch.utils.data
from itertools import islice
from FAB.config import config
import logging
import... | [
"os.mkdir",
"numpy.random.seed",
"numpy.sum",
"pandas.read_csv",
"logging.getLogger",
"numpy.arange",
"torch.device",
"pandas.DataFrame",
"os.path.exists",
"random.seed",
"datetime.datetime.now",
"torch.manual_seed",
"logging.StreamHandler",
"FAB.models.RL_brain_fab.TD3_Model",
"numpy.se... | [((326, 348), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (335, 348), True, 'import numpy as np\n'), ((377, 400), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (394, 400), False, 'import torch\n'), ((405, 437), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_se... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.nddata import reshape_as_blocks, block_reduce, block_replicate
class TestReshapeAsBlocks:
def test_1d(self):
data = np.arange(16)
reshaped = reshape_as_blocks(data, 2)
assert res... | [
"numpy.ones",
"astropy.nddata.reshape_as_blocks",
"pytest.raises",
"numpy.array",
"numpy.arange",
"astropy.nddata.block_reduce",
"astropy.nddata.block_replicate",
"numpy.all"
] | [((242, 255), 'numpy.arange', 'np.arange', (['(16)'], {}), '(16)\n', (251, 255), True, 'import numpy as np\n'), ((275, 301), 'astropy.nddata.reshape_as_blocks', 'reshape_as_blocks', (['data', '(2)'], {}), '(data, 2)\n', (292, 301), False, 'from astropy.nddata import reshape_as_blocks, block_reduce, block_replicate\n'),... |
"""
<NAME> -- Student ID: 919519311
Assignment 3 -- February 2020
Implemented here is the low-level functionality of the
naive Bayes classifier. Defined below are four functions:
estimatePrior() computes the probability of each class
occurring in the validation set.... | [
"numpy.size",
"numpy.std",
"numpy.square",
"numpy.zeros",
"numpy.append",
"numpy.mean",
"numpy.array",
"numpy.exp",
"collections.Counter",
"numpy.sqrt"
] | [((1159, 1174), 'numpy.size', 'np.size', (['labels'], {}), '(labels)\n', (1166, 1174), True, 'import numpy as np\n'), ((1218, 1233), 'collections.Counter', 'Counter', (['labels'], {}), '(labels)\n', (1225, 1233), False, 'from collections import Counter\n'), ((1614, 1637), 'numpy.array', 'np.array', (['[]'], {'dtype': '... |
# Copyright 2020 The PEGASUS Authors..
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
"numpy.any",
"numpy.where",
"numpy.union1d",
"numpy.split"
] | [((782, 793), 'numpy.any', 'np.any', (['eos'], {}), '(eos)\n', (788, 793), True, 'import numpy as np\n'), ((753, 771), 'numpy.where', 'np.where', (['(ids == 1)'], {}), '(ids == 1)\n', (761, 771), True, 'import numpy as np\n'), ((842, 870), 'numpy.where', 'np.where', (['(ids < num_reserved)'], {}), '(ids < num_reserved)... |
# -*- coding: utf-8 -*-
"""
Setup file for copa_map.
Use setup.cfg to configure your project.
This file was generated with PyScaffold 3.3.1.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""
import sys
from pkg_resources import Ver... | [
"pkg_resources.require",
"Cython.Build.cythonize",
"numpy.get_include",
"sys.exit"
] | [((707, 734), 'pkg_resources.require', 'require', (['"""setuptools>=38.3"""'], {}), "('setuptools>=38.3')\n", (714, 734), False, 'from pkg_resources import VersionConflict, require\n'), ((825, 836), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (833, 836), False, 'import sys\n'), ((909, 931), 'Cython.Build.cythonize'... |
import os
import struct
import numpy as np
import cv2
def readPfm(filename):
f = open(filename, 'rb')
line = f.readline()
#assert line.strip() == "Pf" # one sample per pixel
line = f.readline()
items = line.strip().split()
width = int(items[0])
height = int(items[1])
line = f.readline(... | [
"os.mkdir",
"os.path.join",
"os.path.isdir",
"cv2.imwrite",
"struct.unpack",
"struct.pack",
"numpy.exp",
"numpy.ndarray",
"numpy.sqrt"
] | [((431, 476), 'numpy.ndarray', 'np.ndarray', (['[height, width]'], {'dtype': 'np.float32'}), '([height, width], dtype=np.float32)\n', (441, 476), True, 'import numpy as np\n'), ((1327, 1363), 'cv2.imwrite', 'cv2.imwrite', (['filename', 'disparity_map'], {}), '(filename, disparity_map)\n', (1338, 1363), False, 'import c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.