code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from __future__ import generators
import abc
import json
import os
import sys
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from wrn.utils import data_parallel
import torch.backends.cudnn as cudnn
from sklearn.metrics import accuracy_score
impo... | [
"wrn.wideResNet.WideResNet",
"peleeNet.peleeNet",
"torch.nn.functional.dropout",
"json.dumps",
"numpy.mean",
"numpy.arange",
"os.path.join",
"mobilenetv2.mobilenetv2",
"torch.nn.functional.avg_pool2d",
"torch.load",
"torch.nn.Linear",
"customResnet50.CustomResNet50",
"torchvision.models.vgg1... | [((1775, 2014), 'wrn.wideResNet.WideResNet', 'WideResNet', (["self.opt['wrn_depth']", "self.opt['wrn_width']"], {'ninputs': "self.opt['nchannels']", 'num_groups': "self.opt['wrn_groups']", 'num_classes': "(None if fully_convolutional else self.opt['wrn_num_classes'])", 'dropout': "self.opt['dropout']"}), "(self.opt['wr... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"unittest.main",
"functools.partial",
"program_config.OpConfig",
"hypothesis.strategies.sampled_from",
"numpy.random.random",
"hypothesis.strategies.integers"
] | [((3975, 3990), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3988, 3990), False, 'import unittest\n'), ((1806, 1996), 'program_config.OpConfig', 'OpConfig', ([], {'type': '"""im2sequence"""', 'inputs': "{'X': ['input_data']}", 'outputs': "{'Out': ['seq_out']}", 'attrs': "{'kernels': [6, 1], 'out_stride': [1, 1]... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
Conve... | [
"onnxconverter_common.registration.register_converter",
"numpy.log"
] | [((8545, 8637), 'onnxconverter_common.registration.register_converter', 'register_converter', (['"""SklearnGradientBoostingClassifier"""', 'convert_sklearn_gbdt_classifier'], {}), "('SklearnGradientBoostingClassifier',\n convert_sklearn_gbdt_classifier)\n", (8563, 8637), False, 'from onnxconverter_common.registratio... |
#=======================================================================
# quadrature weight/location for numerical integration along one dimension
#=======================================================================
import numpy
def gaussian(NG):
xg = numpy.zeros(NG)
wg = numpy.zero... | [
"numpy.zeros_like",
"numpy.zeros",
"numpy.cos"
] | [((274, 289), 'numpy.zeros', 'numpy.zeros', (['NG'], {}), '(NG)\n', (285, 289), False, 'import numpy\n'), ((310, 330), 'numpy.zeros_like', 'numpy.zeros_like', (['xg'], {}), '(xg)\n', (326, 330), False, 'import numpy\n'), ((625, 676), 'numpy.cos', 'numpy.cos', (['(numpy.pi * (i + 1.0 - 0.25) / (NG + 0.5))'], {}), '(nump... |
# Copyright (c) 2015-2019 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
import os
import numpy as np
from ..utils import Logger, memreport
from ..timing import function_timer, Timer
from ..op im... | [
"pickle.dump",
"numpy.arctan2",
"numpy.amin",
"numpy.sum",
"os.path.isfile",
"numpy.arange",
"os.path.join",
"toast.qarray.to_position",
"numpy.meshgrid",
"numpy.degrees",
"numpy.linspace",
"numpy.cos",
"os.makedirs",
"numpy.logical_and",
"numpy.ptp",
"numpy.zeros",
"numpy.amax",
"... | [((13522, 13578), 'numpy.linspace', 'np.linspace', (['azmin', 'azmax', '((azmax - azmin) // azstep + 1)'], {}), '(azmin, azmax, (azmax - azmin) // azstep + 1)\n', (13533, 13578), True, 'import numpy as np\n'), ((13596, 13652), 'numpy.linspace', 'np.linspace', (['elmin', 'elmax', '((elmax - elmin) // elstep + 1)'], {}),... |
#! /usr/bin/env python
'''
The clean_photometry.py script uses recursive outlier rejection
to identify stars from noisy astronomical catalogs containing stars,
galaxies and noise from many different sources.
With all dependencies installed (python3, Pandas, NumPy,
SciPy, AstroPy, Matplotlib etc.) the simplest use c... | [
"astropy.io.ascii.read",
"argparse.ArgumentParser",
"numpy.amin",
"numpy.argmax",
"numpy.sum",
"numpy.empty",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.contourf",
"scipy.spatial.cKDTree",
"pandas.DataFrame",
"numpy.meshgrid",
"numpy.zeros_like",
"matp... | [((757, 778), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (771, 778), False, 'import time, argparse, concurrent.futures, matplotlib\n'), ((842, 852), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (850, 852), True, 'from matplotlib import pyplot as plt\n'), ((1613, 1663), 'numpy.array... |
import numpy as np
import os
import torch
import json
import nltk
from torch import nn
from torchtext import vocab
from collections import defaultdict
from modules.Utils import utils
class IO:
UNKNOWN = '**UNK**'
PADDING = '**PAD**'
# it's called "GO" but actually serves as a null alignment
GO = '**... | [
"numpy.random.uniform",
"torchtext.vocab.GloVe",
"nltk.Tree.fromstring",
"json.loads",
"torch.nn.Embedding",
"torch.load",
"torch.cat",
"torch.save",
"collections.defaultdict",
"modules.Utils.utils.normalize_embeddings",
"os.path.join"
] | [((502, 536), 'numpy.random.uniform', 'np.random.uniform', (['(-0.1)', '(0.1)', 'size'], {}), '(-0.1, 0.1, size)\n', (519, 536), True, 'import numpy as np\n'), ((800, 845), 'os.path.join', 'os.path.join', (['dirname', '"""extra-embeddings.npy"""'], {}), "(dirname, 'extra-embeddings.npy')\n", (812, 845), False, 'import ... |
import numpy as np
import tempfile
from qtree.voronoi import ParticleVoronoiMesh
def test_voronoi():
np.random.seed(0x4d3d3d3)
input_npart = 1000
positions = np.random.normal(loc=0.5, scale=0.1, size=(input_npart, 2))
positions = np.clip(positions, 0, 1.0)
masses = np.ones(input_npart)
mesh... | [
"tempfile.NamedTemporaryFile",
"numpy.random.seed",
"numpy.ones",
"numpy.clip",
"qtree.voronoi.ParticleVoronoiMesh",
"numpy.random.normal"
] | [((108, 132), 'numpy.random.seed', 'np.random.seed', (['(80991187)'], {}), '(80991187)\n', (122, 132), True, 'import numpy as np\n'), ((173, 232), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0.5)', 'scale': '(0.1)', 'size': '(input_npart, 2)'}), '(loc=0.5, scale=0.1, size=(input_npart, 2))\n', (189, 232),... |
# -*- coding: utf-8 -*-
# This file is part of RRMPG.
#
# RRMPG is free software with the aim to provide a playground for experiments
# with hydrological rainfall-runoff-models while achieving competitive
# performance results.
#
# You should have received a copy of the MIT License along with RRMPG. If not,
# see <http... | [
"rrmpg.tools.monte_carlo.monte_carlo",
"numpy.random.random",
"rrmpg.models.ABCModel",
"unittest.TestCase.setUp"
] | [((609, 619), 'rrmpg.models.ABCModel', 'ABCModel', ([], {}), '()\n', (617, 619), False, 'from rrmpg.models import ABCModel\n'), ((640, 661), 'numpy.random.random', 'np.random.random', (['(100)'], {}), '(100)\n', (656, 661), True, 'import numpy as np\n'), ((670, 699), 'unittest.TestCase.setUp', 'unittest.TestCase.setUp'... |
#!/usr/bin/env python3
"""This uses PyGame to visualize a COVID-19 outbreak in a population of 1000
people living relatively close and with a high rate of interaction. The
simulation is run until there are no more infectious people.
"""
import sys
from time import perf_counter
import pygame
import numpy as np
import i... | [
"pygame.quit",
"numpy.ndindex",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.draw.rect",
"infect_sim.Environment",
"time.perf_counter",
"pygame.init",
"pygame.display.flip",
"pygame.time.delay",
"numpy.where",
"sys.exit"
] | [((1280, 1310), 'infect_sim.Environment', 'infect.Environment', (['env_params'], {}), '(env_params)\n', (1298, 1310), True, 'import infect_sim as infect\n'), ((1343, 1356), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1354, 1356), False, 'import pygame\n'), ((1813, 1862), 'pygame.display.set_mode', 'pygame.display.... |
import logging
import random
import numpy as np
import math
from argparse import ArgumentParser
from itertools import chain
from pprint import pformat
import warnings
import json
import torch
import torch.nn.functional as F
from transformers import Model2Model, BertTokenizer, BertConfig, BertJapaneseTokenizer
from trai... | [
"pprint.pformat",
"torch.multinomial",
"argparse.ArgumentParser",
"numpy.mean",
"torch.no_grad",
"utils.get_dataset",
"transformers.BertJapaneseTokenizer.from_pretrained",
"torch.load",
"os.path.exists",
"random.seed",
"itertools.chain",
"torch.topk",
"torch.random.manual_seed",
"torch.cud... | [((467, 509), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {'ignore_index': '(-1)'}), '(ignore_index=-1)\n', (492, 509), False, 'import torch\n'), ((7189, 7205), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (7203, 7205), False, 'from argparse import ArgumentParser\n'), ((8892, 8931),... |
"""
This module is designed to generate trials for our task with the
correct statistics
Example usage:
>>>> trials = Trials(prob_cp=0.8, num_trials=204, marginal_tolerance=0.02)
>>>> trials.attempt_number
>>>> trials.save_to_csv('/foo/bar.csv') # a .json file gets created for meta data
>>>> reloaded_trials = ... | [
"pandas.DataFrame",
"json.dump",
"hashlib.md5",
"numpy.random.seed",
"json.load",
"pandas.read_csv",
"numpy.random.randint",
"numpy.random.random"
] | [((1772, 1785), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (1783, 1785), False, 'import hashlib\n'), ((12344, 12362), 'pandas.read_csv', 'pd.read_csv', (['fname'], {}), '(fname)\n', (12355, 12362), True, 'import pandas as pd\n'), ((13158, 13176), 'pandas.DataFrame', 'pd.DataFrame', (['rows'], {}), '(rows)\n', (131... |
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# TOOLBOX.ELLIPSE
# <NAME> [<EMAIL>]
# -----------------------------------------------------------------------------
from __future__ import division, print_function
import numpy as np
def ellipse(a, b, xc=0., yc=0.,... | [
"numpy.sin",
"numpy.cos",
"numpy.linspace"
] | [((867, 899), 'numpy.linspace', 'np.linspace', (['(0.0)', '(2.0 * np.pi)', 'n'], {}), '(0.0, 2.0 * np.pi, n)\n', (878, 899), True, 'import numpy as np\n'), ((948, 959), 'numpy.cos', 'np.cos', (['rot'], {}), '(rot)\n', (954, 959), True, 'import numpy as np\n'), ((975, 986), 'numpy.sin', 'np.sin', (['rot'], {}), '(rot)\n... |
import math as m
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans
from collections import Counter, namedtuple
import scipy as sp
import numpy as np
import regex
def create_clusters(tweetsSrs):
freqcutoff = int(m.log(len(tweetsSrs))/2)
word_vectorizer = TfidfVectorize... | [
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.cluster.KMeans",
"regex.findall",
"numpy.where",
"scipy.linalg.norm",
"collections.namedtuple",
"collections.Counter",
"numpy.in1d"
] | [((306, 447), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'ngram_range': '(1, 2)', 'lowercase': '(False)', 'norm': '"""l2"""', 'min_df': 'freqcutoff', 'token_pattern': '"""\\\\b\\\\w+\\\\b|[\\\\U00010000-\\\\U0010ffff]"""'}), "(ngram_range=(1, 2), lowercase=False, norm='l2', min_df=\n ... |
import tensorflow as tf
import parallax
import argparse
import os
import random
import numpy as np
import sys
import time
import nmt
import attention_model
import gnmt_model
import model as nmt_model
import parallax_config
import model_helper
from utils import misc_utils as utils
import train
FLAGS = None
def add_argum... | [
"tensorflow.gfile.Exists",
"numpy.random.seed",
"argparse.ArgumentParser",
"train.process_stats",
"time.ctime",
"os.path.dirname",
"model_helper.create_train_model",
"nmt.create_hparams",
"random.seed",
"train._get_best_results",
"parallax_config.build_config",
"train.update_stats",
"nmt.add... | [((1119, 1137), 'train.init_stats', 'train.init_stats', ([], {}), '()\n', (1135, 1137), False, 'import train\n'), ((1321, 1332), 'time.time', 'time.time', ([], {}), '()\n', (1330, 1332), False, 'import time\n'), ((1495, 1570), 'utils.misc_utils.print_out', 'utils.print_out', (["('# Init train iterator, skipping %d elem... |
"""Crank-Nicholson (implicit) finite difference method for Burger's equation. Code written by <NAME>. Implicit finite
difference method derived by <NAME>, <NAME>, <NAME>, and <NAME>.
2018-12-04
"""
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
# TODO: Turn this into a more ... | [
"numpy.ones_like",
"numpy.tanh",
"matplotlib.pyplot.plot",
"numpy.isscalar",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linalg.norm",
"numpy.linspace",
"numpy.cosh",
"numpy.diag",
"numpy.concatenate"
] | [((2726, 2805), 'numpy.concatenate', 'np.concatenate', (['([h * h_aj - a_condition], lhs - rhs, [h * h_bj - b_condition])'], {}), '(([h * h_aj - a_condition], lhs - rhs, [h * h_bj - b_condition]))\n', (2740, 2805), True, 'import numpy as np\n'), ((4687, 4732), 'numpy.diag', 'np.diag', (['(1 + K1 * (U1[2:] - U1[:-2]) + ... |
import numpy as np
import os
import urllib.request
import gzip
import tkinter as tk
from PIL import Image, ImageDraw, ImageOps
import idx2numpy
""" Functions necessary to set up neural network for digit recognition
and run associated GUI.
Contents
--------
NeuralNetwork: class
Defines functions necessary to set... | [
"os.mkdir",
"tkinter.Text",
"PIL.Image.new",
"numpy.sum",
"numpy.load",
"numpy.argmax",
"numpy.argsort",
"os.path.isfile",
"numpy.arange",
"numpy.exp",
"tkinter.Frame",
"numpy.diag",
"tkinter.Label",
"os.chdir",
"tkinter.Button",
"numpy.asfarray",
"os.path.exists",
"PIL.ImageOps.in... | [((11332, 11357), 'os.path.exists', 'os.path.exists', (['"""DR_Data"""'], {}), "('DR_Data')\n", (11346, 11357), False, 'import os\n'), ((12582, 12601), 'os.chdir', 'os.chdir', (['"""DR_Data"""'], {}), "('DR_Data')\n", (12590, 12601), False, 'import os\n'), ((13006, 13020), 'os.chdir', 'os.chdir', (['""".."""'], {}), "(... |
import base64
import json
import os
import pickle
from typing import List
from docarray import Document, DocumentArray
from docarray.document.mixins.multimodal import AttributeType
from docarray.types.multimodal import Text, Image, Audio, Field, JSON
from docarray.types.multimodal import dataclass
import pytest
import... | [
"pickle.loads",
"os.path.abspath",
"docarray.types.multimodal.Field",
"json.dumps",
"docarray.Document.from_protobuf",
"PIL.Image.open",
"pytest.raises",
"docarray.DocumentArray.empty",
"base64.b64encode",
"numpy.array",
"numpy.random.rand",
"pytest.mark.parametrize",
"docarray.Document.from... | [((400, 442), 'os.path.join', 'os.path.join', (['cur_dir', '"""toydata/hello.wav"""'], {}), "(cur_dir, 'toydata/hello.wav')\n", (412, 442), False, 'import os\n'), ((455, 496), 'os.path.join', 'os.path.join', (['cur_dir', '"""toydata/test.png"""'], {}), "(cur_dir, 'toydata/test.png')\n", (467, 496), False, 'import os\n'... |
from pathlib import Path
import shutil
import unittest
from Cryptodome import Random
import numpy as np
import pandas as pd
import torch
import yaml
import siml.inferer as inferer
import siml.prepost as prepost
import siml.setting as setting
import siml.trainer as trainer
torch.autograd.set_detect_anomaly(True)
d... | [
"yaml.load",
"numpy.load",
"siml.inferer.Inferer",
"pandas.read_csv",
"pathlib.Path",
"numpy.mean",
"torch.autograd.set_detect_anomaly",
"numpy.arange",
"siml.trainer.Trainer",
"shutil.rmtree",
"numpy.testing.assert_array_almost_equal",
"siml.prepost.normalize_adjacency_matrix",
"numpy.testi... | [((277, 316), 'torch.autograd.set_detect_anomaly', 'torch.autograd.set_detect_anomaly', (['(True)'], {}), '(True)\n', (310, 316), False, 'import torch\n'), ((484, 523), 'siml.prepost.normalize_adjacency_matrix', 'prepost.normalize_adjacency_matrix', (['adj'], {}), '(adj)\n', (518, 523), True, 'import siml.prepost as pr... |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.layers import Dense
from tensorflow.keras import Sequential
from tensorflow.keras.optimizers import Adam
data = np.loadtxt("../../data/cross-entropy.txt", dtype=np.float32)
x_data = data[:, 1:3]
y_data = data[:, 3:]
pri... | [
"tensorflow.keras.layers.Dense",
"tensorflow.keras.optimizers.Adam",
"numpy.array",
"numpy.loadtxt",
"tensorflow.keras.Sequential"
] | [((211, 271), 'numpy.loadtxt', 'np.loadtxt', (['"""../../data/cross-entropy.txt"""'], {'dtype': 'np.float32'}), "('../../data/cross-entropy.txt', dtype=np.float32)\n", (221, 271), True, 'import numpy as np\n'), ((363, 422), 'tensorflow.keras.layers.Dense', 'Dense', ([], {'units': '(3)', 'input_shape': '[2]', 'activatio... |
import logging
import os
import lightkurve as lk
import numpy as np
import pandas as pd
from tess_atlas.utils import NOTEBOOK_LOGGER_NAME
from .data_object import DataObject
from ..utils import get_cache_dir
logger = logging.getLogger(NOTEBOOK_LOGGER_NAME)
class LightCurveData(DataObject):
"""Stores Light Cur... | [
"pandas.read_csv",
"numpy.ascontiguousarray",
"lightkurve.search_lightcurve",
"numpy.argsort",
"numpy.where",
"numpy.array",
"os.path.join",
"logging.getLogger"
] | [((221, 260), 'logging.getLogger', 'logging.getLogger', (['NOTEBOOK_LOGGER_NAME'], {}), '(NOTEBOOK_LOGGER_NAME)\n', (238, 260), False, 'import logging\n'), ((1088, 1145), 'lightkurve.search_lightcurve', 'lk.search_lightcurve', ([], {'target': 'f"""TIC {tic}"""', 'mission': '"""TESS"""'}), "(target=f'TIC {tic}', mission... |
import numpy as np
import pandas as pd
from typing import List
from .util import (
assert_pandas_dtypes,
get_upper_matrix,
set_pair_ids,
get_available_eval_metrics,
get_available_similarity_metrics,
)
available_pairwise_similarity_metrics = get_available_similarity_metrics()
available_evaluation_m... | [
"numpy.fill_diagonal"
] | [((1986, 2021), 'numpy.fill_diagonal', 'np.fill_diagonal', (['df.values', 'np.nan'], {}), '(df.values, np.nan)\n', (2002, 2021), True, 'import numpy as np\n')] |
# This code takes the Radiosonde data from the website http://weather.uwyo.edu/upperair/sounding.html
# For any issue contact kvng vikram
year = 2018
month = 9
day = 27
time = 00
code = 43371
ask = False # set true if you want program to ask for a date to look at
mintemp = -100 # C
maxtemp = 40 # C
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.figure",
"numpy.max",
"numpy.array",
"numpy.exp",
"requests.get",
"numpy.linspace",
"bs4.BeautifulSoup",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"m... | [((1480, 1504), 'requests.get', 'requests.get', (['webaddress'], {}), '(webaddress)\n', (1492, 1504), False, 'import requests\n'), ((1600, 1629), 'bs4.BeautifulSoup', 'mbs', (['page.text', '"""html.parser"""'], {}), "(page.text, 'html.parser')\n", (1603, 1629), True, 'from bs4 import BeautifulSoup as mbs\n'), ((2263, 2... |
from typing import Dict
import numpy as np
from PIL import Image
from plyfile import PlyData
def load_model_points(path: str) -> np.ndarray:
"""
Load the model points from given path. The given path must be .xyz file of the object, the .ply file does not work here.
:param path: given path
:return: the loaded poin... | [
"numpy.stack",
"numpy.float32",
"plyfile.PlyData.read",
"PIL.Image.open"
] | [((525, 540), 'numpy.float32', 'np.float32', (['xyz'], {}), '(xyz)\n', (535, 540), True, 'import numpy as np\n'), ((670, 688), 'plyfile.PlyData.read', 'PlyData.read', (['path'], {}), '(path)\n', (682, 688), False, 'from plyfile import PlyData\n'), ((772, 800), 'numpy.stack', 'np.stack', (['[x, y, z]'], {'axis': '(-1)'}... |
import cv2
import gym
import gym_ple # NOQA
import numpy as np
from skimage.transform import rescale as sk_rescale
def create_env(env_hparams):
env = gym.make(env_hparams['env_id'])
env = PreprocessedEnv(env, **env_hparams)
return env
def rgb2gray(rgb):
return np.dot(rgb[..., :3], [0.299, 0.587, 0.... | [
"numpy.ones_like",
"gym.make",
"numpy.copy",
"skimage.transform.rescale",
"cv2.calcOpticalFlowFarneback",
"numpy.dot"
] | [((157, 188), 'gym.make', 'gym.make', (["env_hparams['env_id']"], {}), "(env_hparams['env_id'])\n", (165, 188), False, 'import gym\n'), ((282, 325), 'numpy.dot', 'np.dot', (['rgb[..., :3]', '[0.299, 0.587, 0.114]'], {}), '(rgb[..., :3], [0.299, 0.587, 0.114])\n', (288, 325), True, 'import numpy as np\n'), ((382, 401), ... |
import numpy as np
import os
import wget
import zipfile
import logging
import pandas as pd
from scipy.stats import bernoulli
from sklearn.preprocessing import OneHotEncoder
from mskernel import util
class MeanShift():
def __init__(self, n_dim, n_change=10):
self.n_dim = n_dim
self.n_change = n_ch... | [
"numpy.isin",
"numpy.load",
"numpy.sum",
"pandas.read_csv",
"numpy.ones",
"mskernel.util.NumpySeedContext",
"numpy.diag",
"os.path.join",
"numpy.round",
"numpy.random.randn",
"logging.warning",
"numpy.random.choice",
"shutil.copyfileobj",
"numpy.stack",
"scipy.stats.bernoulli.rvs",
"sk... | [((345, 360), 'numpy.zeros', 'np.zeros', (['n_dim'], {}), '(n_dim)\n', (353, 360), True, 'import numpy as np\n'), ((1076, 1090), 'numpy.ones', 'np.ones', (['n_dim'], {}), '(n_dim)\n', (1083, 1090), True, 'import numpy as np\n'), ((2271, 2288), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (2282, 2288), ... |
"""
NAM: Data Reduction (module)
DES: contains the Data analysis methods for the MDAP pipeline.
"""
# ----------------------------------------------------------------------------------
# ----- Import ---------------------------------------------------------------------
# -----------------------------------------------... | [
"matplotlib.pyplot.title",
"pickle.dump",
"astropy.io.ascii.read",
"Utilities.work_pca",
"numpy.ones",
"numpy.shape",
"pickle.load",
"numpy.arange",
"numpy.mean",
"numpy.exp",
"numpy.ma.masked_array",
"numpy.ma.getmask",
"numpy.prod",
"astropy.stats.sigma_clip",
"scipy.signal.argrelextre... | [((1772, 1779), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1777, 1779), True, 'import tkinter as tk\n'), ((1825, 1854), 'tkinter.filedialog.askopenfilenames', 'filedialog.askopenfilenames', ([], {}), '()\n', (1852, 1854), False, 'from tkinter import filedialog\n'), ((2080, 2100), 'astropy.io.ascii.read', 'ascii.read', (... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from matplotlib_scalebar.scalebar import ScaleBar, ANGULAR
delta = 0.025
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-(X ** 2) - Y ** 2)
Z2 = np.exp(-((X - 1) ** 2) - (Y - 1) ** 2)
Z = (Z1 - Z2) * 2
fig, a... | [
"numpy.meshgrid",
"numpy.arange",
"numpy.exp",
"matplotlib_scalebar.scalebar.ScaleBar",
"matplotlib.pyplot.subplots"
] | [((166, 193), 'numpy.arange', 'np.arange', (['(-3.0)', '(3.0)', 'delta'], {}), '(-3.0, 3.0, delta)\n', (175, 193), True, 'import numpy as np\n'), ((201, 218), 'numpy.meshgrid', 'np.meshgrid', (['x', 'y'], {}), '(x, y)\n', (212, 218), True, 'import numpy as np\n'), ((224, 248), 'numpy.exp', 'np.exp', (['(-X ** 2 - Y ** ... |
"""
Created by: <NAME>
Sep 21
IEEE Fraud Detection Model
- FE009
- Adding raddar user level features
- Add first, second, third digit of addr1 and addr2 features
- Drop only DOY features with low importance
- Different Parameters
"""
import numpy as np # linear algebra
import pandas as pd # data processing, CSV fil... | [
"lightgbm.LGBMClassifier",
"pandas.read_csv",
"logging.Formatter",
"gc.collect",
"numpy.mean",
"catboost.CatBoostClassifier",
"pandas.DataFrame",
"logging.FileHandler",
"numpy.std",
"datetime.datetime.now",
"pandas.concat",
"time.tzset",
"os.path.basename",
"logging.StreamHandler",
"skle... | [((668, 675), 'timeit.default_timer', 'timer', ([], {}), '()\n', (673, 675), True, 'from timeit import default_timer as timer\n'), ((3685, 3752), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'N_FOLDS', 'random_state': 'RANDOM_STATE', 'shuffle': 'SHUFFLE'}), '(n_splits=N_FOLDS, random_state=RANDOM_STATE, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides :class:`TimeSeries` class.
"""
import copy
import os
from collections import OrderedDict
from datetime import datetime, timedelta
import numpy as np
from scipy.interpolate import interp1d
from scipy.stats import kurtosis, skew, tstd
import matplotlib.pyplot as ... | [
"scipy.stats.tstd",
"numpy.allclose",
"matplotlib.pyplot.bar",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"scipy.interpolate.interp1d",
"os.path.join",
"datetime.timedelta",
"numpy.linspace",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"matplotlib.py... | [((4337, 4357), 'copy.copy', 'copy.copy', (['self.name'], {}), '(self.name)\n', (4346, 4357), False, 'import copy\n'), ((4370, 4387), 'copy.copy', 'copy.copy', (['self.t'], {}), '(self.t)\n', (4379, 4387), False, 'import copy\n'), ((4400, 4417), 'copy.copy', 'copy.copy', (['self.x'], {}), '(self.x)\n', (4409, 4417), Fa... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import warnings
import numpy as np
import pandas as pd
import scipy.ndimage as ndi
from matplotlib import cm
from matplotlib import pyplot as plt... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.cm.get_cmap",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.imshow",
"scipy.ndimage.gaussian_filter",
"numpy.zeros",
"matplotlib.pyplot.axis",
"numpy.ones",
"matplotlib.path.Path",
"matplotlib.pyplot.figure",
"numpy.array",
... | [((3018, 3046), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (3028, 3046), True, 'from matplotlib import pyplot as plt\n'), ((3144, 3247), 'matplotlib.pyplot.scatter', 'plt.scatter', (["pixels['x_pixel']", "pixels['y_pixel']"], {'c': 'colors', 's': '(width / 40)', 'li... |
""" Read stock data from 163
"""
from six import iteritems
from six import string_types
from six import StringIO
from pandas import DataFrame
from china_stock_data_api.cn_stock_util import DAILY_K_LINE_COLUMNS, \
NETEASE_STOCK_INFO_COLUMNS
from china_stock_data_api.cn_stock_base import CnStockBase
import j... | [
"pandas.DataFrame",
"int_date.to_int_date",
"six.StringIO",
"re.findall",
"numpy.array",
"re.search",
"re.compile"
] | [((2544, 2645), 're.search', 're.search', (['"""<div class="col_r" style="">(.*?)</div>"""', 'body', '(re.MULTILINE | re.DOTALL | re.UNICODE)'], {}), '(\'<div class="col_r" style="">(.*?)</div>\', body, re.MULTILINE |\n re.DOTALL | re.UNICODE)\n', (2553, 2645), False, 'import re\n'), ((2870, 2903), 're.compile', 're... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
def exhaustive_loss(encoders, decoders, batch, device, alpha=0.1, margin=1.0):
# Translation loss.
embeddings = {}
for source_feature in batch.keys():
source_descriptors = batch[source_feature]
embedding... | [
"torch.nn.functional.binary_cross_entropy",
"torch.norm",
"torch.diag",
"torch.full",
"numpy.array",
"torch.nn.functional.relu",
"torch.tensor",
"torch.min",
"numpy.random.shuffle"
] | [((4464, 4489), 'numpy.array', 'np.array', (['source_features'], {}), '(source_features)\n', (4472, 4489), True, 'import numpy as np\n'), ((4494, 4528), 'numpy.random.shuffle', 'np.random.shuffle', (['target_features'], {}), '(target_features)\n', (4511, 4528), True, 'import numpy as np\n'), ((2775, 2837), 'torch.nn.fu... |
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence, pad_packed_sequence
import numpy as np
class SelfAttn(nn.Module):
'''
self-attention with learnable parameters
make a single continuous representation for a sentence.
... | [
"torch.nn.Dropout",
"torch.nn.init.uniform_",
"torch.nn.LSTMCell",
"torch.cat",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.Tensor",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LSTM",
"numpy.random.binomial",
"torch.zeros_like",
"torch.nn.Conv2... | [((406, 424), 'torch.nn.Linear', 'nn.Linear', (['dhid', '(1)'], {}), '(dhid, 1)\n', (415, 424), False, 'from torch import nn\n'), ((1495, 1522), 'torch.nn.functional.softmax', 'F.softmax', (['raw_score'], {'dim': '(1)'}), '(raw_score, dim=1)\n', (1504, 1522), True, 'from torch.nn import functional as F\n'), ((2231, 225... |
import torch
import torch.nn as nn
import numpy as np
import math
from scipy.linalg import block_diag
import pdb
class SparseAttentionStrided(nn.Module):
def __init__(self):
super().__init__()
def forward(self, qk):
batch_size, n_heads, seq_len, dim, device = *qk.shape, qk.device
... | [
"torch.ones",
"math.ceil",
"scipy.linalg.block_diag",
"torch.fmod",
"torch.unsqueeze",
"math.floor",
"torch.cat",
"numpy.ones",
"torch.arange",
"torch.triu",
"torch.zeros",
"torch.tensor"
] | [((324, 350), 'math.floor', 'math.floor', (['(seq_len ** 0.5)'], {}), '(seq_len ** 0.5)\n', (334, 350), False, 'import math\n'), ((372, 415), 'torch.ones', 'torch.ones', (['seq_len', 'seq_len'], {'device': 'device'}), '(seq_len, seq_len, device=device)\n', (382, 415), False, 'import torch\n'), ((499, 525), 'torch.triu'... |
# This code can be used for ploting shape functions of linear element in 1D.
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 11)
def basisf(x,i):
n = len(x) - 1
phi = np.zeros((n+1,1))
if i == 0:
phi[0] = 1
elif i == n:
phi[n] = 1
else:
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.zeros",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid"
] | [((135, 157), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(11)'], {}), '(0, 10, 11)\n', (146, 157), True, 'import numpy as np\n'), ((633, 648), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""x"""'], {}), "('x')\n", (643, 648), True, 'import matplotlib.pyplot as plt\n'), ((649, 676), 'matplotlib.pyplot.ylabel', ... |
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from itertools import product
from ml_novel_nonexp_nce import *
from amazon_utils import *
from multiprocessing import Pool
## Load pre-trained models for the amazon data and perform product
## recommendation
import co... | [
"numpy.random.seed",
"numpy.argsort",
"numpy.sort",
"multiprocessing.Pool",
"itertools.product",
"os.path.join",
"numpy.delete"
] | [((447, 480), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""models"""'], {}), "(DATA_PATH, 'models')\n", (459, 480), False, 'import os\n'), ((496, 535), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""ranking_test"""'], {}), "(DATA_PATH, 'ranking_test')\n", (508, 535), False, 'import os\n'), ((1219, 1237), 'num... |
import numpy as np
from scipy import pi
import matplotlib.pyplot as plt
import cPickle
#Sine wave
N = 128
def get_sine_wave():
x_sin = np.array([0.0 for i in range(N)])
# print(x_sin)
for i in range(N):
# print("h")
x_sin[i] = np.sin(2.0*pi*i/16.0)
plt.plot(x_sin)
plt.title('Sine wave')
plt.show()
#... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.fromfile",
"cPickle.load",
"numpy.sin"
] | [((265, 280), 'matplotlib.pyplot.plot', 'plt.plot', (['x_sin'], {}), '(x_sin)\n', (273, 280), True, 'import matplotlib.pyplot as plt\n'), ((282, 304), 'matplotlib.pyplot.title', 'plt.title', (['"""Sine wave"""'], {}), "('Sine wave')\n", (291, 304), True, 'import matplotlib.pyplot as plt\n'), ((306, 316), 'matplotlib.py... |
from collections import defaultdict
import os
import numpy as np
from ding.utils.data.collate_fn import default_collate, default_decollate
from easydict import EasyDict
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from torch.optim import Adam
from co... | [
"tqdm.tqdm",
"core.policy.CILRSPolicy",
"tqdm.tqdm.write",
"os.makedirs",
"torch.utils.data.DataLoader",
"os.path.isdir",
"collections.defaultdict",
"torch.save",
"core.data.CILRSDataset",
"numpy.mean",
"easydict.EasyDict",
"torch.no_grad",
"os.path.join",
"os.listdir"
] | [((1250, 1266), 'easydict.EasyDict', 'EasyDict', (['config'], {}), '(config)\n', (1258, 1266), False, 'from easydict import EasyDict\n'), ((1354, 1371), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1365, 1371), False, 'from collections import defaultdict\n'), ((1434, 1446), 'tqdm.tqdm', 'tqdm'... |
import pandas
from random import randint
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
from sklearn import preprocessing
from helper import svm,sgd,knn,dtree,lda
import numpy as np
setlist = [['a','m','n','s','t','g','q','x',... | [
"helper.lda.find_accuracy",
"sklearn.preprocessing.scale",
"pandas.read_csv",
"helper.knn.find_accuracy",
"helper.sgd.find_accuracy",
"helper.dtree.find_accuracy",
"numpy.add",
"helper.svm.find_accuracy"
] | [((418, 462), 'pandas.read_csv', 'pandas.read_csv', (['"""../CSV_Data/dataset_6.csv"""'], {}), "('../CSV_Data/dataset_6.csv')\n", (433, 462), False, 'import pandas\n'), ((539, 566), 'sklearn.preprocessing.scale', 'preprocessing.scale', (['matrix'], {}), '(matrix)\n', (558, 566), False, 'from sklearn import preprocessin... |
import itertools
import re
import pandas as pd
import numpy as np
from catboost import Pool, FeaturesData
from constants import SCHOOLS_REVERSED, TARGET_LABELS
def _parse_str_nums(num_string):
"""
parse strings of numbers and take averages if there are multiple
:param num_string: a string of numbers ... | [
"pandas.DataFrame",
"constants.SCHOOLS_REVERSED.keys",
"numpy.asarray",
"re.findall",
"numpy.array",
"itertools.chain.from_iterable"
] | [((777, 807), 're.findall', 're.findall', (['"""\\\\d+"""', 'num_string'], {}), "('\\\\d+', num_string)\n", (787, 807), False, 'import re\n'), ((955, 1002), 're.findall', 're.findall', (['"""[+-]?\\\\d+(?:\\\\.\\\\d+)?"""', 'num_string'], {}), "('[+-]?\\\\d+(?:\\\\.\\\\d+)?', num_string)\n", (965, 1002), False, 'import... |
import os
import argparse
import numpy as np
import open3d as o3d
parser = argparse.ArgumentParser()
parser.add_argument('--data_root', type=str, default='./ModelNet40')
parser.add_argument('--store_dir', type=str, default='./data')
args = parser.parse_args()
if __name__ == '__main__':
os.makedirs(args.store_dir,... | [
"numpy.save",
"os.makedirs",
"argparse.ArgumentParser",
"open3d.io.read_triangle_mesh",
"numpy.asarray",
"os.path.exists",
"os.path.join",
"os.listdir"
] | [((76, 101), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (99, 101), False, 'import argparse\n'), ((293, 335), 'os.makedirs', 'os.makedirs', (['args.store_dir'], {'exist_ok': '(True)'}), '(args.store_dir, exist_ok=True)\n', (304, 335), False, 'import os\n'), ((356, 382), 'os.listdir', 'os.lis... |
import sys
import numpy as np
from collections import Counter
from sklearn.metrics import label_ranking_average_precision_score
from sklearn.metrics import coverage_error, label_ranking_loss, hamming_loss, accuracy_score
def patk(labels, predictions):
pak = np.zeros(3)
K = np.array([1, 3, 5])
for i in rang... | [
"numpy.sum",
"numpy.argmax",
"numpy.asarray",
"sklearn.metrics.accuracy_score",
"numpy.zeros",
"sklearn.metrics.label_ranking_average_precision_score",
"numpy.argsort",
"sklearn.metrics.coverage_error",
"sklearn.metrics.label_ranking_loss",
"numpy.array",
"collections.Counter"
] | [((263, 274), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (271, 274), True, 'import numpy as np\n'), ((283, 302), 'numpy.array', 'np.array', (['[1, 3, 5]'], {}), '([1, 3, 5])\n', (291, 302), True, 'import numpy as np\n'), ((995, 1004), 'collections.Counter', 'Counter', ([], {}), '()\n', (1002, 1004), False, 'fro... |
import os.path as op
import warnings
import mne
import numpy as np
import pandas as pd
from jumeg.jumeg_volume_plotting import plot_vstc_sliced_old
from tqdm import tqdm
import config
from config import fname
from utils import set_directory
warnings.filterwarnings('ignore', category=DeprecationWarning)
############... | [
"mne.VolSourceEstimate",
"config.fname.lcmv_results",
"jumeg.jumeg_volume_plotting.plot_vstc_sliced_old",
"warnings.filterwarnings",
"mne.pick_types",
"numpy.zeros",
"mne.pick_types_forward",
"utils.set_directory",
"mne.io.read_info",
"mne.read_forward_solution",
"os.path.join",
"pandas.concat... | [((244, 306), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (267, 306), False, 'import warnings\n'), ((503, 537), 'mne.io.read_info', 'mne.io.read_info', (['fname.sample_raw'], {}), '(fname.sample_raw)\n', (519,... |
from gym import Env
import gym.spaces
import numpy as np
class DummyEnv(Env):
def __init__(self, image_shape = (64, 64, 3), state_shape=(3,)) -> None:
super().__init__()
self.image_shape = image_shape
self.state_shape = state_shape
self.action_shape = (4,)
self.observation... | [
"numpy.zeros"
] | [((856, 882), 'numpy.zeros', 'np.zeros', (['self.state_shape'], {}), '(self.state_shape)\n', (864, 882), True, 'import numpy as np\n'), ((690, 716), 'numpy.zeros', 'np.zeros', (['self.state_shape'], {}), '(self.state_shape)\n', (698, 716), True, 'import numpy as np\n'), ((797, 823), 'numpy.zeros', 'np.zeros', (['self.i... |
import numpy
''''
print(numpy.identity(3)) # 3 is for dimension 3 X 3
print(numpy.eye(8, 7, k=1)) # 8 X 7 Dimensional array with first upper diagonal 1.
'''
numpy.set_printoptions(legacy='1.13')
def process(line):
dimns = numpy.array(line, int)
# dimns = tuple(dimns)
print(numpy.eye(dimns[0], dimn... | [
"numpy.eye",
"numpy.set_printoptions",
"numpy.array"
] | [((166, 203), 'numpy.set_printoptions', 'numpy.set_printoptions', ([], {'legacy': '"""1.13"""'}), "(legacy='1.13')\n", (188, 203), False, 'import numpy\n'), ((236, 258), 'numpy.array', 'numpy.array', (['line', 'int'], {}), '(line, int)\n', (247, 258), False, 'import numpy\n'), ((296, 330), 'numpy.eye', 'numpy.eye', (['... |
import pytest
def test_VerticalCut():
import numpy as np
from qtpy.QtWidgets import QApplication
app = QApplication([])
from xicam.SAXS.operations.verticalcuts import VerticalCutPlugin
t1 = VerticalCutPlugin()
t1.data.value = np.ones((10, 10))
t1.qz.value = np.tile(np.arange(10), (1, 10))... | [
"numpy.sum",
"numpy.ones",
"numpy.arange",
"xicam.SAXS.operations.verticalcuts.VerticalCutPlugin",
"qtpy.QtWidgets.QApplication"
] | [((118, 134), 'qtpy.QtWidgets.QApplication', 'QApplication', (['[]'], {}), '([])\n', (130, 134), False, 'from qtpy.QtWidgets import QApplication\n'), ((213, 232), 'xicam.SAXS.operations.verticalcuts.VerticalCutPlugin', 'VerticalCutPlugin', ([], {}), '()\n', (230, 232), False, 'from xicam.SAXS.operations.verticalcuts im... |
# coding: utf-8
import cv2
from cv2 import aruco
import numpy as np
import math
import yaml
import sys
import os
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.optimize import least_squares
import python_scale_ezxr.lie_algebra as la
from python_scale_ezxr.io_tool import load_b... | [
"numpy.diag",
"numpy.outer",
"numpy.multiply",
"numpy.argmax",
"numpy.std",
"numpy.zeros",
"numpy.linalg.eigh",
"scipy.optimize.least_squares",
"numpy.linalg.svd",
"numpy.array",
"numpy.mean",
"numpy.matmul",
"numpy.linalg.norm",
"numpy.linalg.det",
"numpy.eye",
"numpy.loadtxt",
"os.... | [((1575, 1591), 'numpy.zeros', 'np.zeros', (['(m, m)'], {}), '((m, m))\n', (1583, 1591), True, 'import numpy as np\n'), ((1698, 1729), 'numpy.multiply', 'np.multiply', (['(1.0 / n)', 'outer_sum'], {}), '(1.0 / n, outer_sum)\n', (1709, 1729), True, 'import numpy as np\n'), ((1782, 1803), 'numpy.linalg.svd', 'np.linalg.s... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import numpy as np
import tensorflow as tf
tf1 = tf.compat.v1
from tflib.data.dataset import batch_dataset, Dataset
_N_CPU = multiprocessing.cpu_count()
def memory_data_batch_datase... | [
"tflib.data.dataset.batch_dataset",
"numpy.array",
"multiprocessing.cpu_count"
] | [((262, 289), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (287, 289), False, 'import multiprocessing\n'), ((1118, 1257), 'tflib.data.dataset.batch_dataset', 'batch_dataset', (['dataset', 'batch_size', 'prefetch_batch', 'drop_remainder', 'filter', 'map_func', 'num_threads', 'shuffle', 'sh... |
# Import Required Modules
import os
import json
import random
import numpy as np
from skimage.io import imshow
import matplotlib.pyplot as plt
import keras.callbacks as callbacks
from Mask_Integer_Encoding import RGBs_to_Integers
##############################################################################
hight, ... | [
"Mask_Integer_Encoding.RGBs_to_Integers",
"matplotlib.pyplot.show",
"random.randint",
"numpy.resize",
"numpy.argmax",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.zeros",
"os.path.exists",
"numpy.expand_dims",
"json.dumps",
"matplotlib.pyplot.style.... | [((649, 686), 'random.randint', 'random.randint', (['(0)', '(hight - patch_size)'], {}), '(0, hight - patch_size)\n', (663, 686), False, 'import random\n'), ((700, 737), 'random.randint', 'random.randint', (['(0)', '(width - patch_size)'], {}), '(0, width - patch_size)\n', (714, 737), False, 'import random\n'), ((478, ... |
import numpy as np
from numpy.random import uniform, randn
import matplotlib.pyplot as plt
from scipy import stats
def create_uniform_particles(x_range, y_range, heading_range, N):
particles = np.empty((N, 3))
particles[:, 0] = uniform(x_range[0], x_range[1], size=N)
particles[:, 1] = uniform(y_range[0], ... | [
"numpy.random.seed",
"numpy.empty",
"numpy.allclose",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.linalg.norm",
"numpy.arange",
"scipy.stats.norm",
"numpy.random.randn",
"numpy.cumsum",
"numpy.average",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyp... | [((199, 215), 'numpy.empty', 'np.empty', (['(N, 3)'], {}), '((N, 3))\n', (207, 215), True, 'import numpy as np\n'), ((238, 277), 'numpy.random.uniform', 'uniform', (['x_range[0]', 'x_range[1]'], {'size': 'N'}), '(x_range[0], x_range[1], size=N)\n', (245, 277), False, 'from numpy.random import uniform, randn\n'), ((300,... |
import sys
import numpy as np
from scipy.sparse import csc_matrix, csr_matrix
import os
from math import factorial
from itertools import product
from representability.config import DATA_DIRECTORY
from openfermionpsi4 import run_psi4
from openfermion.hamiltonians import MolecularData
from openfermion.transforms import ... | [
"numpy.conj",
"numpy.trace",
"numpy.zeros_like",
"numpy.abs",
"representability.fermions.basis_utils.generate_parity_permutations",
"numpy.testing.assert_almost_equal",
"numpy.allclose",
"numpy.zeros",
"numpy.einsum",
"openfermion.transforms.jordan_wigner",
"numpy.linalg.eigh",
"numpy.isclose"... | [((1113, 1147), 'openfermion.transforms.jordan_wigner', 'jordan_wigner', (['fermion_hamiltonian'], {}), '(fermion_hamiltonian)\n', (1126, 1147), False, 'from openfermion.transforms import jordan_wigner\n'), ((1337, 1356), 'numpy.linalg.eigh', 'np.linalg.eigh', (['ham'], {}), '(ham)\n', (1351, 1356), True, 'import numpy... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import scipy.io as sio
import measurement
import echo
import distance
import image
import argparse
parser = argparse.ArgumentParser(description='Estimate the shape of a room from room impulse response data')
parser.add_argument('dataset', help='... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"scipy.io.loadmat",
"matplotlib.pyplot.scatter",
"distance.DistanceData",
"image.ImageSourceData",
"numpy.hstack",
"measurement.squared_distance_matrix",
"numpy.vstack",
"numpy.sqrt"
] | [((183, 287), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Estimate the shape of a room from room impulse response data"""'}), "(description=\n 'Estimate the shape of a room from room impulse response data')\n", (206, 287), False, 'import argparse\n'), ((781, 806), 'scipy.io.loadmat... |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"dm_env.transition",
"dm_env.specs.Array",
"absl.testing.absltest.main",
"dm_env.TimeStep",
"meltingpot.python.utils.substrates.wrappers.multiplayer_wrapper.Wrapper",
"unittest.mock.Mock",
"numpy.ones",
"dm_env.specs.BoundedArray",
"dm_env.restart",
"numpy.testing.assert_equal"
] | [((832, 904), 'dm_env.specs.BoundedArray', 'dm_env.specs.BoundedArray', ([], {'shape': '()', 'minimum': '(0)', 'maximum': '(4)', 'dtype': 'np.int8'}), '(shape=(), minimum=0, maximum=4, dtype=np.int8)\n', (857, 904), False, 'import dm_env\n'), ((917, 943), 'numpy.ones', 'np.ones', (['[]'], {'dtype': 'np.int8'}), '([], d... |
'''
This script performs an A/B test on two groups, where the groups are
evaluated by some metric = distinct(devices that passed) / distinct(total devices)
where `bool passed` is a binomial random variable. The outcomes of both groups
in the experiment are simulated with some noise factor in order to be able to
observe... | [
"numpy.random.binomial",
"numpy.average",
"random.random",
"numpy.array",
"seaborn.distplot",
"seaborn.set_palette",
"matplotlib.pyplot.subplots"
] | [((1044, 1052), 'random.random', 'random', ([], {}), '()\n', (1050, 1052), False, 'from random import random\n'), ((1615, 1633), 'numpy.array', 'np.array', (['set_cont'], {}), '(set_cont)\n', (1623, 1633), True, 'import numpy as np\n'), ((2043, 2061), 'numpy.array', 'np.array', (['set_test'], {}), '(set_test)\n', (2051... |
import time
import numpy as np
from typing import List, Dict, Union
from mot.utils import Config
from mot.structures import Tracklet
from .metric import Metric, METRIC_REGISTRY, build_metric
@METRIC_REGISTRY.register()
class CombinedMetric(Metric):
def __init__(self, metrics: List[Config], name: str = 'combined'... | [
"numpy.product",
"numpy.zeros_like",
"numpy.array",
"numpy.sum"
] | [((818, 836), 'numpy.array', 'np.array', (['matrices'], {}), '(matrices)\n', (826, 836), True, 'import numpy as np\n'), ((854, 880), 'numpy.zeros_like', 'np.zeros_like', (['matrices[0]'], {}), '(matrices[0])\n', (867, 880), True, 'import numpy as np\n'), ((1535, 1553), 'numpy.product', 'np.product', (['scores'], {}), '... |
import time
import re
import warnings
import nltk
import tweepy
import csv
import sys
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
import requests
import json
from nltk.stem.porter import *
from wordcloud import WordCloud, STOPWORDS
from vaderSentiment.vaderSentiment im... | [
"wordcloud.WordCloud",
"matplotlib.pyplot.figure",
"googletrans.Translator",
"pandas.DataFrame",
"matplotlib.pyplot.imshow",
"re.findall",
"numpy.core.defchararray.replace",
"seaborn.set",
"re.sub",
"numpy.vectorize",
"tweepy.API",
"csv.writer",
"tweepy.OAuthHandler",
"warnings.filterwarni... | [((432, 494), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (455, 494), False, 'import warnings\n'), ((506, 534), 'vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer', 'SentimentIntensityAnalyzer', ([], {}... |
import numpy as np
from state import *
count_in_center=0
index_diff_block=-1
opposite_block=-1
def eval(cur_state:State):
global_point=np.zeros(9)
i=0
for block in cur_state.blocks:
point=0
countX_row=-np.count_nonzero(block==1, axis=1)
countX_col=-np.count_nonzero(block==1, axis=... | [
"numpy.count_nonzero",
"numpy.zeros"
] | [((142, 153), 'numpy.zeros', 'np.zeros', (['(9)'], {}), '(9)\n', (150, 153), True, 'import numpy as np\n'), ((342, 379), 'numpy.count_nonzero', 'np.count_nonzero', (['(block == -1)'], {'axis': '(1)'}), '(block == -1, axis=1)\n', (358, 379), True, 'import numpy as np\n'), ((397, 434), 'numpy.count_nonzero', 'np.count_no... |
import torch
import numpy as np
from torchvision.datasets import ImageFolder
from transformers.models.vit.feature_extraction_vit import ViTFeatureExtractor
from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor
class SimMIMDataset(ImageFolder):
def __init_... | [
"transformers.models.vit.feature_extraction_vit.ViTFeatureExtractor",
"numpy.ceil",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.Normalize",
"numpy.zeros",
"numpy.random.permutation",
"torchvision.transforms.RandomResizedCrop",
"torchvision.transforms.ToTensor"
] | [((486, 507), 'transformers.models.vit.feature_extraction_vit.ViTFeatureExtractor', 'ViTFeatureExtractor', ([], {}), '()\n', (505, 507), False, 'from transformers.models.vit.feature_extraction_vit import ViTFeatureExtractor\n'), ((2605, 2642), 'numpy.zeros', 'np.zeros', (['self.token_count'], {'dtype': 'int'}), '(self.... |
# -*- coding: utf-8 -*-
import cv2
import cv2.cv as cv
import numpy as np
def logpolar(src, center, magnitude_scale = 40):
mat1 = cv.fromarray(np.float64(src))
mat2 = cv.CreateMat(src.shape[0], src.shape[1], mat1.type)
cv.LogPolar(mat1, mat2, center, magnitude_scale, \
cv.CV_INTER_CUBIC+... | [
"numpy.float64",
"numpy.asarray",
"cv2.cv.LogPolar",
"cv2.cv.CreateMat"
] | [((178, 229), 'cv2.cv.CreateMat', 'cv.CreateMat', (['src.shape[0]', 'src.shape[1]', 'mat1.type'], {}), '(src.shape[0], src.shape[1], mat1.type)\n', (190, 229), True, 'import cv2.cv as cv\n'), ((235, 334), 'cv2.cv.LogPolar', 'cv.LogPolar', (['mat1', 'mat2', 'center', 'magnitude_scale', '(cv.CV_INTER_CUBIC + cv.CV_WARP_F... |
import numpy as np
def beta_binomial_prior_distribution(phoneme_count, mel_count, scaling_factor=1.0):
from scipy.stats import betabinom
x = np.arange(0, phoneme_count)
mel_text_probs = []
for i in range(1, mel_count + 1):
a, b = scaling_factor * i, scaling_factor * (mel_count + 1 - i)
... | [
"numpy.zeros_like",
"numpy.log",
"numpy.argmax",
"numpy.array",
"numpy.arange",
"scipy.stats.betabinom"
] | [((152, 179), 'numpy.arange', 'np.arange', (['(0)', 'phoneme_count'], {}), '(0, phoneme_count)\n', (161, 179), True, 'import numpy as np\n'), ((426, 450), 'numpy.array', 'np.array', (['mel_text_probs'], {}), '(mel_text_probs)\n', (434, 450), True, 'import numpy as np\n'), ((516, 539), 'numpy.zeros_like', 'np.zeros_like... |
import tvm
from tvm import te, topi,autotvm
from tvm.topi import nn
import tvm.testing
from tvm import te
import numpy
import numpy as np
import timeit
from tvm.topi.mali import mali_winograd as tune_winograd
from tvm.topi.testing import conv2d_nchw_python
from tvm.contrib.utils import tempdir
# The size of the matrix... | [
"numpy.arange",
"tvm.autotvm.measure.request_remote",
"numpy.ndarray",
"numpy.prod",
"tvm.te.placeholder",
"tvm.topi.nn.winograd_util.winograd_transform_matrices",
"tvm.contrib.utils.tempdir",
"tvm.nd.array",
"tvm.te.create_schedule",
"tvm.topi.testing.conv2d_nchw_python",
"tvm.context",
"tvm.... | [((792, 814), 'tvm.context', 'tvm.context', (['target', '(0)'], {}), '(target, 0)\n', (803, 814), False, 'import tvm\n'), ((886, 956), 'tvm.topi.nn.winograd_util.winograd_transform_matrices', 'tvm.topi.nn.winograd_util.winograd_transform_matrices', (['m', 'r', '"""float32"""'], {}), "(m, r, 'float32')\n", (939, 956), F... |
import sys
from typing import List, Optional, Tuple, Union
import numpy as np
import torch
import torch.nn as nn
from constants import BATCH_FIRST, EMBED_DIM
from torch.functional import Tensor
sys.path.append("../..")
from utils.helper import custom_logistic, mult_normal_sample, phi_u_fn, sse_x
class SkipLSTM(nn.M... | [
"numpy.random.seed",
"torch.multinomial",
"torch.nn.LSTMCell",
"torch.randn",
"torch.nn.init.constant_",
"torch.arange",
"torch.no_grad",
"sys.path.append",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LSTM",
"torch.log",
"torch.logsumexp",
"utils.helper.mult_normal_sample",
"torch.zeros_... | [((196, 220), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (211, 220), False, 'import sys\n'), ((8660, 8675), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (8673, 8675), False, 'import torch\n'), ((10874, 10889), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (10887, 10889), Fa... |
import numpy as np
def compute_min_max(data_path, first_col_index=1, last_col_index=23):
"""
Get the minimum and maximum value for each column in a range of a pd datframe.
Parameters:
data_path (string): The data path
first_col_index (int): T... | [
"numpy.loadtxt"
] | [((542, 608), 'numpy.loadtxt', 'np.loadtxt', (['data_path'], {'delimiter': '""","""', 'dtype': 'np.float32', 'skiprows': '(1)'}), "(data_path, delimiter=',', dtype=np.float32, skiprows=1)\n", (552, 608), True, 'import numpy as np\n')] |
#coding=utf-8
# Copyright 2017 - 2018 Baidu Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"numpy.random.random_sample",
"paddle.fluid.layers.data",
"paddle.fluid.layers.tanh",
"paddle.fluid.program_guard",
"tutorials.mnist_model.mnist_cnn_model",
"paddle.fluid.io.load_vars",
"paddle.fluid.layers.elementwise_sub",
"paddle.fluid.Executor",
"paddle.fluid.layers.reduce_sum",
"paddle.fluid.... | [((1510, 1526), 'paddle.fluid.CPUPlace', 'fluid.CPUPlace', ([], {}), '()\n', (1524, 1526), True, 'import paddle.fluid as fluid\n'), ((1601, 1627), 'paddle.fluid.Executor', 'fluid.Executor', (['self.place'], {}), '(self.place)\n', (1615, 1627), True, 'import paddle.fluid as fluid\n'), ((1724, 1739), 'paddle.fluid.Progra... |
from sklearn.model_selection import cross_val_score, cross_validate
from sklearn.model_selection import cross_val_predict
from sklearn.model_selection import StratifiedShuffleSplit, StratifiedKFold, train_test_split
from sklearn import datasets
import sklearn
import statistics
import pandas as pd
import copy
from skle... | [
"imblearn.under_sampling.RandomUnderSampler",
"math.ceil",
"openpyxl.load_workbook",
"sklearn.metrics.classification_report",
"sklearn.metrics.make_scorer",
"sklearn.model_selection.StratifiedKFold",
"numpy.array",
"sklearn.metrics.confusion_matrix",
"pandas.concat"
] | [((2356, 2383), 'sklearn.metrics.make_scorer', 'make_scorer', (['accuracy_score'], {}), '(accuracy_score)\n', (2367, 2383), False, 'from sklearn.metrics import make_scorer, accuracy_score, precision_score, recall_score, f1_score, confusion_matrix, classification_report\n'), ((2413, 2479), 'sklearn.metrics.make_scorer',... |
# ===========================================================================
# segmentation.py ---------------------------------------------------------
# ===========================================================================
import rsvis.utils.imgtools as imgtools
import cv2
import numpy as np
from skimage... | [
"numpy.invert",
"numpy.mean",
"skimage.future.graph.rag_mean_color",
"numpy.unique",
"skimage.color.rgb2lab",
"skimage.segmentation.find_boundaries",
"numpy.full",
"numpy.meshgrid",
"numpy.std",
"sklearn.cluster.KMeans",
"numpy.reshape",
"numpy.linspace",
"cv2.resize",
"skimage.future.grap... | [((3664, 3684), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'h'], {}), '(0, 1, h)\n', (3675, 3684), True, 'import numpy as np\n'), ((3697, 3717), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'w'], {}), '(0, 1, w)\n', (3708, 3717), True, 'import numpy as np\n'), ((3735, 3752), 'numpy.meshgrid', 'np.meshgrid', (... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import colors
from keras.models import load_model
import matplotlib.lines as mlines
def adjust_spines(ax, spines):
for loc, spine in ax.spines.items():
if loc in spines:
spine.set_position(('outward', 10)) # outward ... | [
"keras.models.load_model",
"numpy.load",
"numpy.average",
"matplotlib.pyplot.show",
"matplotlib.lines.Line2D",
"numpy.polyfit",
"matplotlib.colors.BoundaryNorm",
"matplotlib.pyplot.subplots",
"numpy.arange",
"numpy.sign",
"numpy.cosh",
"matplotlib.colors.ListedColormap"
] | [((1763, 1804), 'matplotlib.colors.ListedColormap', 'colors.ListedColormap', (["['black', 'white']"], {}), "(['black', 'white'])\n", (1784, 1804), False, 'from matplotlib import colors\n'), ((1834, 1869), 'matplotlib.colors.BoundaryNorm', 'colors.BoundaryNorm', (['bounds', 'cmap.N'], {}), '(bounds, cmap.N)\n', (1853, 1... |
####################
# This file consist of different edge enhancement methods.
# It serves as the edge enhancement componenet in our pipeline
import numpy as np
import cv2
import os
import sys
import glob
import logging
from detect import main as detect
IMAGE_PATH = './input/nyc.png'
CARTOON_PATH = './output/shink... | [
"cv2.GaussianBlur",
"numpy.load",
"cv2.bitwise_and",
"cv2.medianBlur",
"numpy.ones",
"cv2.adaptiveThreshold",
"logging.getLogger",
"logging.Formatter",
"cv2.absdiff",
"cv2.erode",
"os.path.join",
"cv2.dilate",
"cv2.cvtColor",
"os.path.exists",
"cv2.Canny",
"logging.StreamHandler",
"o... | [((403, 432), 'logging.getLogger', 'logging.getLogger', (['"""Enhancer"""'], {}), "('Enhancer')\n", (420, 432), False, 'import logging\n'), ((666, 764), 'logging.Formatter', 'logging.Formatter', (['"""[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s"""', '"""%Y-%m-%d %H:%M:%S"""'], {}), "('[%(asctime)s] [%(name)s] ... |
import numpy as np
np.set_printoptions(edgeitems=30, linewidth=100000, formatter=dict(float=lambda x: "\t%5.3g" % x))
import pdb
class MatrixHandler:
def transform_H_to_G_indentity(self, H_orig, info_bits_position):
H = H_orig.copy()
n_rows = H.shape[0]
n_cols = H.shape[1]
... | [
"numpy.ones"
] | [((1508, 1518), 'numpy.ones', 'np.ones', (['K'], {}), '(K)\n', (1515, 1518), True, 'import numpy as np\n')] |
import gym
import gym_panda
from gym_panda.wrapper_env.VAE import VAE
import torch
import tensorflow as tf
import numpy as np
import copy
import pickle
import gym_panda
from gym_panda.wrapper_env.wrapper import *
import pdb
import argparse
from itertools import count
import scipy.optimize
from models import *
from repl... | [
"numpy.zeros",
"pybullet.addUserDebugLine",
"gym.make",
"numpy.array"
] | [((3346, 3370), 'gym.make', 'gym.make', (['"""realpanda-v0"""'], {}), "('realpanda-v0')\n", (3354, 3370), False, 'import gym\n'), ((3674, 3778), 'pybullet.addUserDebugLine', 'p.addUserDebugLine', (['[i * 0.1, 0, 0.1]', '[(i + 1) * 0.1, 0, 0.1]', '[1, 0, 0]'], {'lineWidth': '(3.0)', 'lifeTime': '(0)'}), '([i * 0.1, 0, 0... |
import typing as tp
import numpy as np
import core
# Units and constants
# Astronomical unit
AU = 1.495978707e11
# Gravitational constant
G = 6.67430e-11
# Time
YEAR_IN_D = 365.25
YEAR_IN_S = 31557600
# Scaling
M_SUN = 1.9885e30
M_EARTH = 5.97234e24
ORBIT_R_EARTH = 149598023e3
V_EARTH = 29.78e3
class Celestial:
... | [
"numpy.abs",
"core.core.iterate",
"numpy.zeros_like",
"numpy.array"
] | [((2027, 2077), 'numpy.array', 'np.array', (['[cel.m for cel in celestials]'], {'order': '"""F"""'}), "([cel.m for cel in celestials], order='F')\n", (2035, 2077), True, 'import numpy as np\n'), ((2095, 2116), 'numpy.zeros_like', 'np.zeros_like', (['self.x'], {}), '(self.x)\n', (2108, 2116), True, 'import numpy as np\n... |
# ParseDM3File reads in a DM3 file and translates it into a dictionary
# this module treats that dictionary as an image-file and extracts the
# appropriate image data as numpy arrays.
# It also tries to create files from numpy arrays that DM can read.
#
# Some notes:
# Only complex64 and complex128 types are converted ... | [
"copy.deepcopy",
"numpy.moveaxis",
"numpy.frombuffer",
"numpy.asarray",
"numpy.empty",
"nion.data.DataAndMetadata.new_data_and_metadata",
"numpy.expand_dims",
"numpy.dtype",
"datetime.datetime.strptime",
"numpy.array",
"pprint.pprint",
"nion.data.Calibration.Calibration",
"nion.data.DataAndM... | [((5463, 5481), 'copy.deepcopy', 'copy.deepcopy', (['tag'], {}), '(tag)\n', (5476, 5481), False, 'import copy\n'), ((5681, 5704), 'pprint.pprint', 'pprint.pprint', (['tag_copy'], {}), '(tag_copy)\n', (5694, 5704), False, 'import pprint\n'), ((10741, 10806), 'nion.data.Calibration.Calibration', 'Calibration.Calibration'... |
from collections import Counter
import numpy as np
class FeatureDictionary:
"""
A simple feature dictionary that can convert features (ids) to
their textual representation and vice-versa.
"""
def __init__(self, add_unk=True):
self.next_id = 0
self.token_to_id = {}
self.id... | [
"collections.Counter",
"numpy.sum"
] | [((1636, 1651), 'collections.Counter', 'Counter', (['tokens'], {}), '(tokens)\n', (1643, 1651), False, 'from collections import Counter\n'), ((2506, 2536), 'numpy.sum', 'np.sum', (['empirical_distribution'], {}), '(empirical_distribution)\n', (2512, 2536), True, 'import numpy as np\n')] |
'''
This sample creates a sample signal and uses this package to create a periodogram power spectral density plot.
This example requires certain Python packages. To check for and install if needed,
open the Script Window (Shift+Alt+3), type the following and press Enter:
pip -chk scipy numpy
'''
import numpy as np... | [
"originpro.new_sheet",
"originpro.new_graph",
"numpy.sin",
"numpy.arange",
"scipy.signal.periodogram",
"numpy.sqrt"
] | [((626, 651), 'scipy.signal.periodogram', 'signal.periodogram', (['x', 'fs'], {}), '(x, fs)\n', (644, 651), False, 'from scipy import signal\n'), ((689, 747), 'originpro.new_sheet', 'op.new_sheet', ([], {'type': '"""w"""', 'lname': '"""Periodogram Power Spectral"""'}), "(type='w', lname='Periodogram Power Spectral')\n"... |
# -*- coding: utf-8 -*-
# @Author: Ruban
# @License: Apache Licence
# @File: inference_util.py
import cv2
import math
import numpy as np
def getDetBoxes_core(text_map, link_map, text_threshold, link_threshold, low_text):
# prepare data
link_map = link_map.copy()
text_map = text_map.copy()
... | [
"numpy.logical_and",
"cv2.dilate",
"numpy.roll",
"cv2.getStructuringElement",
"cv2.threshold",
"numpy.zeros",
"numpy.clip",
"cv2.boxPoints",
"numpy.max",
"numpy.array",
"numpy.linalg.norm",
"numpy.where",
"cv2.minAreaRect"
] | [((407, 446), 'cv2.threshold', 'cv2.threshold', (['text_map', 'low_text', '(1)', '(0)'], {}), '(text_map, low_text, 1, 0)\n', (420, 446), False, 'import cv2\n'), ((470, 515), 'cv2.threshold', 'cv2.threshold', (['link_map', 'link_threshold', '(1)', '(0)'], {}), '(link_map, link_threshold, 1, 0)\n', (483, 515), False, 'i... |
from itertools import product
import numpy as np
import torch
from alphazero.game import Game
class TicTacToe(Game):
"""Squares are numbered 0-8 from top-left corner to bottom right corner."""
NUM_ACTIONS = 9
WINNING_POSITIONS = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3,... | [
"numpy.zeros",
"itertools.product"
] | [((770, 814), 'itertools.product', 'product', (['(0, 1)', 'TicTacToe.WINNING_POSITIONS'], {}), '((0, 1), TicTacToe.WINNING_POSITIONS)\n', (777, 814), False, 'from itertools import product\n'), ((1328, 1362), 'numpy.zeros', 'np.zeros', (['(2, 9)'], {'dtype': 'np.float32'}), '((2, 9), dtype=np.float32)\n', (1336, 1362), ... |
#!/usr/bin/python3
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import sys
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import posthoc_learn.banalg as banalg
from posthoc_learn.config import posthoc_config as config
from po... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.amin",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.cumsum",
"posthoc_learn.banalg.EpsilonGreedy",
"numpy.arange",
"numpy.linalg.inv",
"numpy.random.normal",
"numpy.random.rand",
"matplotlib... | [((640, 656), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (649, 656), True, 'import matplotlib.pyplot as plt\n'), ((665, 691), 'numpy.arange', 'np.arange', (['regret.shape[0]'], {}), '(regret.shape[0])\n', (674, 691), True, 'import numpy as np\n'), ((805, 819), 'matplotlib.pyplot.xlim', 'plt.x... |
import numpy as np
import os
import tensorflow as tf
from lsct.utils.frame_features_video_folders import CalculateFrameQualityFeatures
from lsct.ablations.frame_features_video_folders_resnet50 import CalculateFrameQualityFeaturesResnet50
FFMPEG = r'..\\ffmpeg\ffmpeg.exe'
FFPROBE = r'..\\ffmpeg\ffprobe.exe'
"""
This... | [
"numpy.save",
"os.path.join",
"tensorflow.config.experimental.set_visible_devices",
"lsct.utils.frame_features_video_folders.CalculateFrameQualityFeatures",
"os.path.exists",
"lsct.ablations.frame_features_video_folders_resnet50.CalculateFrameQualityFeaturesResnet50",
"numpy.array",
"numpy.reshape",
... | [((554, 623), 'lsct.utils.frame_features_video_folders.CalculateFrameQualityFeatures', 'CalculateFrameQualityFeatures', (['phinqnet_weights_path', 'FFPROBE', 'FFMPEG'], {}), '(phinqnet_weights_path, FFPROBE, FFMPEG)\n', (583, 623), False, 'from lsct.utils.frame_features_video_folders import CalculateFrameQualityFeature... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import Point
from sensor_msgs.msg import LaserScan
from nav_msgs.msg import Odometry,OccupancyGrid
from visualization_msgs.msg import Marker
from visualization_msgs.msg import Mark... | [
"Laser.Laser",
"rospy.Subscriber",
"os.path.isfile",
"rospy.Duration",
"geometry_msgs.msg.PoseStamped",
"rospy.Time.now",
"Laser.Map",
"rospy.Rate",
"rospy.is_shutdown",
"math.cos",
"rospy.init_node",
"numpy.reshape",
"nav_msgs.msg.Odometry",
"nav_msgs.msg.OccupancyGrid",
"keras.optimize... | [((745, 800), 'keras.optimizers.Adam', 'Adam', ([], {'lr': '(1e-05)', 'beta_1': '(0.9)', 'beta_2': '(0.999)', 'epsilon': '(1e-08)'}), '(lr=1e-05, beta_1=0.9, beta_2=0.999, epsilon=1e-08)\n', (749, 800), False, 'from keras.optimizers import Adam\n'), ((2925, 2940), 'nav_msgs.msg.OccupancyGrid', 'OccupancyGrid', ([], {})... |
import matplotlib.pyplot as plt
import numpy as np
import pytest
import torch
from src import datamodules
from src.augmentations.seg_aug import get_composed_augmentations
from src.datamodules.cityscapes import Cityscapes
from src.datamodules.dadatamodule import DADataModule
from src.datamodules.gta5 import GTA5
from s... | [
"src.augmentations.seg_aug.get_composed_augmentations",
"torch.utils.data.DataLoader",
"numpy.transpose",
"src.datamodules.dadatamodule.DADataModule",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((548, 579), 'src.augmentations.seg_aug.get_composed_augmentations', 'get_composed_augmentations', (['aug'], {}), '(aug)\n', (574, 579), False, 'from src.augmentations.seg_aug import get_composed_augmentations\n'), ((670, 732), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dst'], {'batch_size': 'bs'... |
import torch
import torch.utils.data
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
from torchvision.utils import save_image
import numpy as np
from torch.autograd.variable import Variable
from src.Models.loss import losses_joint
from src.Models.models impo... | [
"src.utils.learn_utils.LearningRate",
"src.utils.read_config.Config",
"src.utils.train_utils.chamfer",
"torch.from_numpy",
"numpy.sum",
"numpy.logical_and",
"ws_infer.infer_programs",
"src.utils.train_utils.prepare_input_op",
"torch.load",
"src.Models.loss.losses_joint",
"matplotlib.use",
"num... | [((774, 795), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (788, 795), False, 'import matplotlib\n'), ((1358, 1400), 'src.utils.read_config.Config', 'read_config.Config', (['"""config_synthetic.yml"""'], {}), "('config_synthetic.yml')\n", (1376, 1400), False, 'from src.utils import read_config\... |
# python peripherals
import numpy
# torch
import torch
# Taken from https://github.com/vsitzmann/siren
class Sine(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
# See paper sec. 3.2, final paragraph, and supplement Sec. 1.5 for discussion of factor 30
... | [
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.nn.BatchNorm1d",
"torch.nn.GELU",
"torch.nn.Linear",
"torch.no_grad",
"torch.sin",
"numpy.sqrt"
] | [((331, 347), 'torch.sin', 'torch.sin', (['input'], {}), '(input)\n', (340, 347), False, 'import torch\n'), ((425, 440), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (438, 440), False, 'import torch\n'), ((767, 782), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (780, 782), False, 'import torch\n'), ((2265... |
from PIL import Image
import cv2
import numpy as np
import sys
from sklearn.linear_model import LinearRegression, LogisticRegression, Ridge
from sklearn.neighbors import KNeighborsRegressor
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestClassifier
import pickle
WIDTH = 310/2
HE... | [
"pickle.dump",
"sklearn.linear_model.Ridge",
"train_label.train_label.keys",
"cv2.imread",
"pickle.load",
"numpy.array",
"train_label.test_label.keys",
"sys.exit"
] | [((1211, 1228), 'numpy.array', 'np.array', (['inp_arr'], {}), '(inp_arr)\n', (1219, 1228), True, 'import numpy as np\n'), ((2626, 2644), 'train_label.train_label.keys', 'train_label.keys', ([], {}), '()\n', (2642, 2644), False, 'from train_label import train_label, test_label\n'), ((2820, 2837), 'train_label.test_label... |
# Copyright (c) 2020, Xilinx
# 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 follow... | [
"finn.custom_op.registry.getCustomOp",
"onnx.helper.make_node",
"numpy.abs",
"finn.transformation.infer_shapes.InferShapes",
"finn.transformation.infer_datatypes.InferDataTypes",
"numpy.sign",
"finn.util.basic.get_by_name",
"warnings.warn",
"finn.core.datatype.DataType.get_smallest_possible",
"num... | [((4719, 4735), 'finn.transformation.infer_datatypes.InferDataTypes', 'InferDataTypes', ([], {}), '()\n', (4733, 4735), False, 'from finn.transformation.infer_datatypes import InferDataTypes\n'), ((17588, 17604), 'finn.transformation.infer_datatypes.InferDataTypes', 'InferDataTypes', ([], {}), '()\n', (17602, 17604), F... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 5 15:33:27 2019
@author: gptshubham595
"""
import cv2
import matplotlib.pyplot as plot
import numpy as np
import time
def main():
imgp1="C:\\opencv learn machin\\misc\\4.2.01.tiff"
imgp2="C:\\opencv learn machin\\misc\\4.2.05.tiff"
#1-by preserving sa... | [
"cv2.waitKey",
"cv2.imshow",
"cv2.addWeighted",
"time.sleep",
"cv2.imread",
"numpy.linspace",
"cv2.destroyAllWindows"
] | [((369, 389), 'cv2.imread', 'cv2.imread', (['imgp1', '(1)'], {}), '(imgp1, 1)\n', (379, 389), False, 'import cv2\n'), ((398, 418), 'cv2.imread', 'cv2.imread', (['imgp2', '(1)'], {}), '(imgp2, 1)\n', (408, 418), False, 'import cv2\n'), ((597, 618), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(50)'], {}), '(0, 1, 5... |
import random
import numpy as np
from service import stats
def test_get_values_stats():
"""stats - get values stats"""
random.seed(42)
values = [random.uniform(0,10) for _ in range(105)]
median, mad, q1, q3 = stats.get_values_stats(values)
assert median == np.median(values)
assert 1 < mad < 4
... | [
"random.uniform",
"numpy.median",
"numpy.percentile",
"random.seed",
"service.stats.get_values_stats"
] | [((129, 144), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (140, 144), False, 'import random\n'), ((227, 257), 'service.stats.get_values_stats', 'stats.get_values_stats', (['values'], {}), '(values)\n', (249, 257), False, 'from service import stats\n'), ((599, 614), 'random.seed', 'random.seed', (['(42)'], {... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Datasets imported
#dataset_train for training
#dataset_test for testing
dataset_train = pd.read_csv(path_train)
dataset_test = pd.read_csv(path_test)
#X consists of 3 features
#Y consists of a single output feature
#creates X datafr... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"pandas.read_csv",
"numpy.std",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.array"
] | [((168, 191), 'pandas.read_csv', 'pd.read_csv', (['path_train'], {}), '(path_train)\n', (179, 191), True, 'import pandas as pd\n'), ((208, 230), 'pandas.read_csv', 'pd.read_csv', (['path_test'], {}), '(path_test)\n', (219, 230), True, 'import pandas as pd\n'), ((822, 855), 'numpy.array', 'np.array', (['dataset_train.x1... |
# Standard library
import os, abc
import pickle
import numpy as np
from copy import deepcopy
# Third-party
from scipy.integrate import quad
from scipy.interpolate import interp1d
from astropy.table import Table
from astropy import units as u
# Project
from .. import MIST_PATH
from ..util import check_random_state, ch... | [
"copy.deepcopy",
"pickle.dump",
"astropy.table.Table",
"numpy.sum",
"numpy.ones_like",
"pickle.load",
"numpy.array",
"numpy.log10",
"numpy.concatenate"
] | [((2085, 2105), 'astropy.table.Table', 'Table', (['self.abs_mags'], {}), '(self.abs_mags)\n', (2090, 2105), False, 'from astropy.table import Table\n'), ((2331, 2343), 'astropy.table.Table', 'Table', (['_mags'], {}), '(_mags)\n', (2336, 2343), False, 'from astropy.table import Table\n'), ((2478, 2505), 'pickle.dump', '... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 31 19:26:41 2018
@author: damodara
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 24 12:31:33 2018
@author: damodara
"""
import numpy as np
import utilstransport
import importlib
importlib.reload(utilstransport)
import pylab as pl
import matplotli... | [
"matplotlib.pyplot.title",
"dnn.K.set_value",
"numpy.random.seed",
"dnn.K.sum",
"numpy.argmax",
"numpy.ones",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.sin",
"pylab.figure",
"dnn.K.square",
"dnn.K.transpose",
"utilstransport.get_dataset",
"numpy.unique",
"pylab.title",
"numpy.z... | [((249, 281), 'importlib.reload', 'importlib.reload', (['utilstransport'], {}), '(utilstransport)\n', (265, 281), False, 'import importlib\n'), ((416, 436), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (430, 436), True, 'import numpy as np\n'), ((538, 580), 'utilstransport.get_dataset', 'utilstran... |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | [
"unittest.main",
"tempfile.NamedTemporaryFile",
"io.StringIO",
"skbio.SequenceCollection",
"collections.defaultdict",
"skbio.DNA",
"skbio.Alignment",
"skbio.alignment.StockholmAlignment",
"numpy.finfo",
"collections.OrderedDict",
"collections.Counter",
"skbio.alignment.StockholmAlignment.from_... | [((41986, 41992), 'unittest.main', 'main', ([], {}), '()\n', (41990, 41992), False, 'from unittest import TestCase, main\n'), ((1026, 1063), 'skbio.DNA', 'DNA', (['"""GATTACA"""'], {'metadata': "{'id': 'd1'}"}), "('GATTACA', metadata={'id': 'd1'})\n", (1029, 1063), False, 'from skbio import Sequence, DNA, RNA, Distance... |
#!/usr/bin/python
'''Takes a database file as an argument, compares localfiles and esgffiles,
and creates a table "failed_dl" that contains files that did not show
up in the local storage tree.'''
import sys
import apsw
import numpy as np
#dbname = sys.argv[1]
def connect(dbname):
conn = apsw.Connection(dbnam... | [
"apsw.Connection",
"numpy.array",
"numpy.in1d"
] | [((299, 322), 'apsw.Connection', 'apsw.Connection', (['dbname'], {}), '(dbname)\n', (314, 322), False, 'import apsw\n'), ((1174, 1207), 'numpy.array', 'np.array', (['[x[0] for x in resesgf]'], {}), '([x[0] for x in resesgf])\n', (1182, 1207), True, 'import numpy as np\n'), ((1239, 1263), 'numpy.in1d', 'np.in1d', (['set... |
from __future__ import annotations
import copy
import attr
import torch
import numpy as np
import typing
from evocraft_ga.nn.linear import Linear
from evocraft_ga.nn.cppn import CPPN
model_dict = {"linear": Linear, "cppn": CPPN}
@attr.s
class Genome:
noise_dims: int = attr.ib()
cube_dims: int = attr.ib()
... | [
"copy.deepcopy",
"attr.ib",
"numpy.random.RandomState",
"numpy.random.randint",
"torch.from_numpy"
] | [((277, 286), 'attr.ib', 'attr.ib', ([], {}), '()\n', (284, 286), False, 'import attr\n'), ((308, 317), 'attr.ib', 'attr.ib', ([], {}), '()\n', (315, 317), False, 'import attr\n'), ((348, 367), 'attr.ib', 'attr.ib', ([], {'default': '[]'}), '(default=[])\n', (355, 367), False, 'import attr\n'), ((393, 413), 'attr.ib', ... |
"""
University of Minnesota
Aerospace Engineering and Mechanics - UAV Lab
Copyright 2019 Regents of the University of Minnesota
See: LICENSE.md for complete license details
Author: <NAME>
Analysis for Huginn (mAEWing2) FLT 03-06
"""
#%%
# Import Libraries
import numpy as np
import matplotlib.pyplot as plt
# Hack to... | [
"numpy.abs",
"numpy.mean",
"os.path.dirname",
"Core.FreqTrans.OptSpect",
"Core.FreqTrans.FreqRespFuncEstNoise",
"numpy.empty_like",
"Core.FreqTrans.DistCritCirc",
"Core.OpenData.Segment",
"Core.FreqTrans.Sigma",
"numpy.log10",
"Core.FreqTrans.PlotBode",
"numpy.ones_like",
"Core.FreqTrans.Plo... | [((806, 863), 'sys.path.join', 'path.join', (['"""/home"""', '"""rega0051"""', '"""FlightArchive"""', '"""Huginn"""'], {}), "('/home', 'rega0051', 'FlightArchive', 'Huginn')\n", (815, 863), False, 'from sys import path, argv\n'), ((1054, 1113), 'sys.path.join', 'path.join', (['pathBase', "('Huginn' + flt)", "('Huginn' ... |
import numpy as np
def iou(box, clusters):
"""
Calculates the Intersection over Union (IoU) between a box and k clusters.
:param box: tuple or array, shifted to the origin (i. e. width and height)
:param clusters: numpy array of shape (k, 2) where k is the number of clusters
:return: numpy array o... | [
"numpy.minimum",
"numpy.random.seed",
"numpy.abs",
"numpy.count_nonzero",
"numpy.empty",
"numpy.zeros",
"numpy.argmin",
"numpy.mean",
"numpy.random.choice",
"numpy.delete"
] | [((385, 419), 'numpy.minimum', 'np.minimum', (['clusters[:, 0]', 'box[0]'], {}), '(clusters[:, 0], box[0])\n', (395, 419), True, 'import numpy as np\n'), ((428, 462), 'numpy.minimum', 'np.minimum', (['clusters[:, 1]', 'box[1]'], {}), '(clusters[:, 1], box[1])\n', (438, 462), True, 'import numpy as np\n'), ((1616, 1652)... |
import functools
import flowws
from flowws import Argument as Arg
import numpy as np
@flowws.add_stage_arguments
class EvaluateEmbedding(flowws.Stage):
"""Evaluate the embedding model on all input data"""
ARGS = [
Arg('batch_size', '-b', int, 32, help='Batch size of calculations'),
Arg(
... | [
"flowws.Argument",
"numpy.sum",
"numpy.add.reduceat",
"numpy.clip",
"numpy.insert",
"numpy.any",
"numpy.concatenate",
"numpy.repeat"
] | [((234, 301), 'flowws.Argument', 'Arg', (['"""batch_size"""', '"""-b"""', 'int', '(32)'], {'help': '"""Batch size of calculations"""'}), "('batch_size', '-b', int, 32, help='Batch size of calculations')\n", (237, 301), True, 'from flowws import Argument as Arg\n'), ((311, 419), 'flowws.Argument', 'Arg', (['"""average_b... |
# coding: utf-8
"""
Name: train_with_constrain.py
Desc: This script contains the training and testing code of Unwrap Film.
Notations:
||rgb
Mean: The original render image in color space.
Shape: [batch_size, 3, 256, 256]
Range: 0 ~ 255 -----> -1 ~ 1
||threeD_map :
Mean: Three coo... | [
"os.mkdir",
"torch.optim.lr_scheduler.StepLR",
"numpy.abs",
"evaluater.eval_batches.uvbw_loss_np_batch",
"dataloader.load_data_2.filmDataset_old",
"torch.device",
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"numpy.std",
"torch.load",
"os.path.exists",
"numpy.max",
"numpy.average",
"... | [((15276, 15295), 'models3.UnwarpNet', 'models3.UnwarpNet', ([], {}), '()\n', (15293, 15295), False, 'import models3\n'), ((15309, 15337), 'models3.Conf_Discriminator', 'models3.Conf_Discriminator', ([], {}), '()\n', (15335, 15337), False, 'import models3\n'), ((15448, 15491), 'torch.device', 'torch.device', (["('cuda'... |
# Linear Regression using Tensorflow
# Code from https://www.geeksforgeeks.org/linear-regression-using-tensorflow/
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
np.random.seed(101)
tf.set_random_seed(101)
# Genrating... | [
"matplotlib.pyplot.title",
"numpy.random.uniform",
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"tensorflow.global_variables_initializer",
"matplotlib.pyplot.legend",
"tensorflow.Session",
"tensorflow.pow",
"tensorflow.set_random_seed",
"tensor... | [((259, 278), 'numpy.random.seed', 'np.random.seed', (['(101)'], {}), '(101)\n', (273, 278), True, 'import numpy as np\n'), ((281, 304), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(101)'], {}), '(101)\n', (299, 304), True, 'import tensorflow as tf\n'), ((400, 422), 'numpy.linspace', 'np.linspace', (['(0)', ... |
from __future__ import annotations
import numpy as np
import pandas as pd
from sklearn import datasets
import IMLearn.metrics
from IMLearn.metrics import mean_square_error
from IMLearn.utils import split_train_test
from IMLearn.model_selection import cross_validate
from IMLearn.learners.regressors import PolynomialFit... | [
"pandas.DataFrame",
"numpy.random.seed",
"IMLearn.learners.regressors.RidgeRegression",
"sklearn.datasets.load_diabetes",
"IMLearn.learners.regressors.PolynomialFitting",
"numpy.array",
"pandas.Series",
"numpy.linspace",
"plotly.graph_objects.Layout",
"IMLearn.learners.regressors.LinearRegression"... | [((1091, 1122), 'numpy.linspace', 'np.linspace', (['(-1.2)', '(2)', 'n_samples'], {}), '(-1.2, 2, n_samples)\n', (1102, 1122), True, 'import numpy as np\n'), ((4086, 4140), 'sklearn.datasets.load_diabetes', 'datasets.load_diabetes', ([], {'return_X_y': '(True)', 'as_frame': '(True)'}), '(return_X_y=True, as_frame=True)... |
import cv2 as cv
import numpy as np
titleWindow = 'Introduction_to_svm.py'
print("Takes a moment to compute resulting image...")
# Set up training data
## [setup1]
labels = np.array([1, -1, -1, -1])
trainingData = np.matrix([[501, 10], [255, 10], [501, 255], [10, 501]], dtype=np.float32)
## [setup1]
# Train the SVM
##... | [
"numpy.matrix",
"cv2.circle",
"cv2.waitKey",
"numpy.zeros",
"cv2.ml.SVM_create",
"numpy.array",
"cv2.imshow"
] | [((173, 198), 'numpy.array', 'np.array', (['[1, -1, -1, -1]'], {}), '([1, -1, -1, -1])\n', (181, 198), True, 'import numpy as np\n'), ((214, 288), 'numpy.matrix', 'np.matrix', (['[[501, 10], [255, 10], [501, 255], [10, 501]]'], {'dtype': 'np.float32'}), '([[501, 10], [255, 10], [501, 255], [10, 501]], dtype=np.float32)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.