code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
def suppressor(data, tolerance, pad=0): """Identify elements of data close to 0 Parameters ---------- data : array This can be either real or complex data. tolerance : float Data of absolute value below this tolerance will be set to zero. pad : int, optional The function...
[ "numpy.sum", "numpy.abs", "numpy.copy", "numpy.ones", "numpy.convolve" ]
[((566, 578), 'numpy.abs', 'np.abs', (['data'], {}), '(data)\n', (572, 578), True, 'import numpy as np\n'), ((717, 748), 'numpy.ones', 'np.ones', (['(2 * pad + 1)'], {'dtype': 'int'}), '(2 * pad + 1, dtype=int)\n', (724, 748), True, 'import numpy as np\n'), ((786, 831), 'numpy.convolve', 'np.convolve', (['suppressed', ...
import pytest import emgfit as emg import numpy as np class Test_spectrum: # Create simulated spectrum data from emgfit.sample import simulate_events true_sigma = 7.77901056381226e-05 true_theta = 0.6591808159640057 true_eta_m1 = 0.7393102752716145 true_eta_m2 = 0.2606897247283855 ...
[ "emgfit.spectrum", "emgfit.sample.simulate_events", "numpy.random.seed", "numpy.isclose" ]
[((1932, 1950), 'numpy.random.seed', 'np.random.seed', (['(12)'], {}), '(12)\n', (1946, 1950), True, 'import numpy as np\n'), ((1963, 2083), 'emgfit.sample.simulate_events', 'simulate_events', (['shape_pars', 'true_mus', 'true_amps', 'true_bkg_c', 'true_N_events', 'x_min', 'x_max'], {'out': '"""hist"""', 'N_bins': 'N_b...
import unittest import numpy as np from cosmogenic import parma from .TestBase import TestBase class TestParma(TestBase): def setUp(self): self.proton = parma.Proton() self.alpha = parma.Alpha() # force field potential, MV self.s = 1200 # atmospheric depths g/cm2 ...
[ "unittest.main", "cosmogenic.parma.Proton", "cosmogenic.parma.Alpha", "numpy.linspace" ]
[((957, 972), 'unittest.main', 'unittest.main', ([], {}), '()\n', (970, 972), False, 'import unittest\n'), ((170, 184), 'cosmogenic.parma.Proton', 'parma.Proton', ([], {}), '()\n', (182, 184), False, 'from cosmogenic import parma\n'), ((206, 219), 'cosmogenic.parma.Alpha', 'parma.Alpha', ([], {}), '()\n', (217, 219), F...
import numpy as np import pandas as pd import random import subprocess from termcolor import colored import matplotlib.pyplot as plt MIN_NUMBERS = 8 MAX_NUMBERS = 24 NUMBER_STEP = 1 TEST_REPEAT = 5 MIN_RANGE = 0 MAX_RANGE = 100 FLOAT_MIN = -3.40282e+38 def compute_angles(numbers): angles = [round(np.arctan( (numb...
[ "matplotlib.pyplot.show", "random.randint", "pandas.Series", "numpy.arctan", "matplotlib.pyplot.subplots" ]
[((448, 465), 'pandas.Series', 'pd.Series', (['angles'], {}), '(angles)\n', (457, 465), True, 'import pandas as pd\n'), ((2084, 2098), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2096, 2098), True, 'import matplotlib.pyplot as plt\n'), ((2501, 2511), 'matplotlib.pyplot.show', 'plt.show', ([], {}), ...
from graphviz import Digraph import pandas as pd import numpy as np import matplotlib.pyplot as plt # + # Split a dataset based on an attribute and an attribute value def test_split(index, value, dataset): return dataset[dataset[:, index] == value, ], dataset[dataset[:, index] != value, ] d...
[ "numpy.round", "graphviz.Digraph", "pandas.Series" ]
[((3159, 3179), 'graphviz.Digraph', 'Digraph', (['"""test_tree"""'], {}), "('test_tree')\n", (3166, 3179), False, 'from graphviz import Digraph\n'), ((1112, 1132), 'numpy.round', 'np.round', (['b_score', '(2)'], {}), '(b_score, 2)\n', (1120, 1132), True, 'import numpy as np\n'), ((623, 651), 'pandas.Series', 'pd.Series...
# Copyright 2021 ETH Zurich and the NPBench authors. All rights reserved. import numpy as np def initialize(N): from numpy.random import default_rng rng = default_rng(42) data = rng.integers(0, 256, size=(N, ), dtype=np.uint8) return data
[ "numpy.random.default_rng" ]
[((166, 181), 'numpy.random.default_rng', 'default_rng', (['(42)'], {}), '(42)\n', (177, 181), False, 'from numpy.random import default_rng\n')]
from qiskit import * from QMeasure import HadamardTest, HadamardTest_Analytical, state_backend from QAnsatz import Ansatze from QCircuit import MixedStateGenerationCircuit from QHamiltonian import Hamiltonian_in_Pauli_String import random import numpy as np class SubspaceEigSolverError(Exception): pass ...
[ "numpy.zeros", "numpy.array", "numpy.real" ]
[((3278, 3312), 'numpy.real', 'np.real', (['(1 / 2 * ppd - 1 / 2 * npd)'], {}), '(1 / 2 * ppd - 1 / 2 * npd)\n', (3285, 3312), True, 'import numpy as np\n'), ((3738, 3751), 'numpy.array', 'np.array', (['jac'], {}), '(jac)\n', (3746, 3751), True, 'import numpy as np\n'), ((5796, 5830), 'numpy.real', 'np.real', (['(1 / 2...
#=============================================================================# # exadata # # # # # ...
[ "numpy.zeros" ]
[((995, 1011), 'numpy.zeros', 'np.zeros', (['(3, 2)'], {}), '((3, 2))\n', (1003, 1011), True, 'import numpy as np\n'), ((1070, 1086), 'numpy.zeros', 'np.zeros', (['(3, 2)'], {}), '((3, 2))\n', (1078, 1086), True, 'import numpy as np\n'), ((1145, 1166), 'numpy.zeros', 'np.zeros', (['(var[2], 2)'], {}), '((var[2], 2))\n'...
from typing import Any, Dict, List, Optional, Union from copy import copy from random import randint import datetime as dt import re from lunchbox.enforce import Enforce from pandas import DataFrame, DatetimeIndex from schematics.exceptions import DataError import cufflinks as cf # noqa: F401 import lunchbox.tools a...
[ "pandas.DatetimeIndex", "lunchbox.enforce.Enforce", "shekels.core.config.PivotAction", "pyparsing.Optional", "random.randint", "pyparsing.Or", "shekels.core.config.COLOR_SCHEME.items", "re.search", "pandasql.sqldf", "rolling_pin.blob_etl.BlobETL", "re.split", "numpy.ceil", "shekels.enforce.e...
[((2609, 2633), 'pandas.DatetimeIndex', 'DatetimeIndex', (['data.date'], {}), '(data.date)\n', (2622, 2633), False, 'from pandas import DataFrame, DatetimeIndex\n'), ((4844, 4883), 'lunchbox.enforce.Enforce', 'Enforce', (['data', '"""instance of"""', 'DataFrame'], {}), "(data, 'instance of', DataFrame)\n", (4851, 4883)...
import numpy as np import random import math def set_seed(s=0): np.random.seed(s) random.seed(s) def create_tasks_arrivals(n_tasks=10, lam=1.): ''' Returns a list of samples of a Poisson distribution with lambda = lam parameter. The summatory of the resulting vector is n_tasks ''' result = [] acc_tas...
[ "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "random.sample", "matplotlib.pyplot.figure", "random.seed", "numpy.random.poisson", "matplotlib.pyplot.grid" ]
[((67, 84), 'numpy.random.seed', 'np.random.seed', (['s'], {}), '(s)\n', (81, 84), True, 'import numpy as np\n'), ((87, 101), 'random.seed', 'random.seed', (['s'], {}), '(s)\n', (98, 101), False, 'import random\n'), ((974, 986), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (984, 986), True, 'import matpl...
#!/usr/bin/env python # coding: utf-8 # In[1]: import meshio import pygalmesh import numpy as np import copy from mshr import * from dolfin import * from collections import Counter import matplotlib.pyplot as plt import os import sys import json import shutil import scipy.optimize as opt from EnergyMinimization impo...
[ "json.dump", "os.mkdir", "os.unlink", "os.getcwd", "os.path.isdir", "numpy.ones", "os.path.isfile", "numpy.mean", "numpy.arange", "os.path.islink", "shutil.copyfile", "shutil.rmtree", "os.path.join", "os.listdir" ]
[((1843, 1859), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1853, 1859), False, 'import os\n'), ((2451, 2473), 'json.dump', 'json.dump', (['datadict', 'f'], {}), '(datadict, f)\n', (2460, 2473), False, 'import json\n'), ((2556, 2620), 'shutil.copyfile', 'shutil.copyfile', (['ScriptName', '(DataFolder + Run...
# Reading the csv file import pandas as pd data = pd.read_csv("data.csv") # Splitting the data into X and y import numpy as np X = np.array(data[['x1', 'x2']]) y = np.array(data['y']) # Import statement for train_test_split from sklearn.cross_validation import train_test_split # TODO: Use the train_test_...
[ "pandas.read_csv", "sklearn.cross_validation.train_test_split", "numpy.array" ]
[((52, 75), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (63, 75), True, 'import pandas as pd\n'), ((138, 166), 'numpy.array', 'np.array', (["data[['x1', 'x2']]"], {}), "(data[['x1', 'x2']])\n", (146, 166), True, 'import numpy as np\n'), ((172, 191), 'numpy.array', 'np.array', (["data['...
import socketserver import pommerman from pommerman.constants import GameType from pommerman.envs.v0 import Pomme import time import numpy as np def evaluate(env: Pomme, episodes, verbose, visualize, stop=False): """ Evaluates the given pommerman environment (already includes the agents). :param episode...
[ "numpy.empty", "socketserver.TCPServer", "numpy.sum", "time.time" ]
[((836, 854), 'numpy.empty', 'np.empty', (['episodes'], {}), '(episodes)\n', (844, 854), True, 'import numpy as np\n'), ((869, 896), 'numpy.empty', 'np.empty', (['(episodes, 1 + 4)'], {}), '((episodes, 1 + 4))\n', (877, 896), True, 'import numpy as np\n'), ((910, 921), 'time.time', 'time.time', ([], {}), '()\n', (919, ...
import sys sys.path.append("../") import numpy as np from tools import RSE from tensorBasis import svd_thresholding, unfold, fold from decomposition.TR import TR_product ''' TRLRF(tensor ring low rank factors) algorithm for tensor completion: ADMM Tensor Ring Decomposition with Rank Minimization on Latent Space: An Ef...
[ "sys.path.append", "tensorBasis.fold", "tensorBasis.unfold", "numpy.zeros", "decomposition.TR.TR_product", "tools.RSE", "numpy.transpose", "numpy.mean", "numpy.random.rand", "numpy.eye", "numpy.prod" ]
[((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((586, 622), 'numpy.random.rand', 'np.random.rand', (['rank', 'shape[i]', 'rank'], {}), '(rank, shape[i], rank)\n', (600, 622), True, 'import numpy as np\n'), ((1895, 1905), 'tools.RSE', 'RSE', (['X', '...
from flask import Flask, flash, redirect, render_template, request, session, abort, url_for import os from pymongo import MongoClient import json from werkzeug import secure_filename # import csv # import subprocess import pandas as pd import numpy as np from util_nlp_2 import parseS from gcpParser import syntax_text f...
[ "pymongo.MongoClient", "os.getcwd", "pandas.read_csv", "flask.request.data.decode", "flask.Flask", "json.dumps", "pandas.read_json", "collections.defaultdict", "bson.code.Code", "werkzeug.secure_filename", "pandas.read_excel", "flask.url_for", "flask.render_template", "os.path.join", "nu...
[((405, 435), 'pymongo.MongoClient', 'MongoClient', (['"""localhost:27017"""'], {}), "('localhost:27017')\n", (416, 435), False, 'from pymongo import MongoClient\n'), ((489, 504), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (494, 504), False, 'from flask import Flask, flash, redirect, render_template, r...
import csv import cv2 import matplotlib matplotlib.use('Agg') # For AWS compatibility from matplotlib import pyplot as plt import random import numpy as np from keras.preprocessing.image import random_shift, flip_axis from sklearn.utils import shuffle ## DONE: Visualize normal distribution for steering angles ## TODO:...
[ "matplotlib.pyplot.title", "csv.reader", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.figure", "cv2.imshow", "random.randint", "cv2.cvtColor", "matplotlib.pyplot.imshow", "keras.layers.Flatten", "keras.layers.ELU", "cv2.resize", "matplotlib.pyplot.show", "keras.callbacks.Mo...
[((40, 61), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (54, 61), False, 'import matplotlib\n'), ((6897, 6968), 'sklearn.model_selection.train_test_split', 'train_test_split', (['images', 'measurerements'], {'test_size': '(0.2)', 'random_state': '(0)'}), '(images, measurerements, test_size=0.2...
import numpy as np import matplotlib.pyplot as plt a=np.loadtxt('EXAMPLE.txt') #Retrieves data from .txt file. b=np.linspace(0,len(a),len(a)) #Creates a variable for the data to be plotted against. ### FT1=np.fft.rfft(a)#Performs the real Fast Fourier Transform, argument: source data. FT2=np.fft.rfft(a) #The for loop...
[ "matplotlib.pyplot.title", "numpy.fft.rfft", "matplotlib.pyplot.show", "numpy.fft.irfft", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((54, 79), 'numpy.loadtxt', 'np.loadtxt', (['"""EXAMPLE.txt"""'], {}), "('EXAMPLE.txt')\n", (64, 79), True, 'import numpy as np\n'), ((207, 221), 'numpy.fft.rfft', 'np.fft.rfft', (['a'], {}), '(a)\n', (218, 221), True, 'import numpy as np\n'), ((291, 305), 'numpy.fft.rfft', 'np.fft.rfft', (['a'], {}), '(a)\n', (302, 3...
import pandas as pd from flask import Flask from paths import PATHS from flask_restful import Resource, Api, reqparse from data_processing.src.data_processor import DataProcessor import datetime import requests import numpy as np import lightgbm as lgb import os app = Flask(__name__) api = Api(app) BASE_URL = "http:/...
[ "flask_restful.Api", "numpy.abs", "os.path.join", "pandas.read_csv", "numpy.std", "flask.Flask", "flask_restful.reqparse.RequestParser", "lightgbm.Booster", "numpy.random.randint", "numpy.array", "numpy.mean", "requests.get", "data_processing.src.data_processor.DataProcessor.gen_proc_file_na...
[((270, 285), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (275, 285), False, 'from flask import Flask\n'), ((292, 300), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (295, 300), False, 'from flask_restful import Resource, Api, reqparse\n'), ((3527, 3575), 'data_processing.src.data_processor.Data...
""" Licensed Materials - Property of IBM Restricted Materials of IBM 20190891 © Copyright IBM Corp. 2021 All Rights Reserved. """ """ Module to where fusion algorithms are implemented. """ import logging import numpy as np from ibmfl.aggregator.fusion.fedavg_fusion_handler import FedAvgFusionHandler logger = logging...
[ "numpy.sum", "logging.getLogger" ]
[((313, 340), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (330, 340), False, 'import logging\n'), ((2112, 2123), 'numpy.sum', 'np.sum', (['n_k'], {}), '(n_k)\n', (2118, 2123), True, 'import numpy as np\n')]
import networkx as nx import numpy as np def property_graph(graph='g1'): """ Define the properties of the graph to generate :graph : type of desired graph. Options : ['g1','g2', 'g3', 'g4', 'g5'] """ if graph == 'g1': method = 'partition' sizes = [75, 75] probs = [[0.10, 0.0...
[ "numpy.sum", "networkx.set_node_attributes", "networkx.is_connected", "numpy.asarray", "numpy.zeros", "numpy.ones", "networkx.stochastic_block_model", "numpy.where", "numpy.random.choice", "numpy.random.shuffle" ]
[((2475, 2514), 'networkx.stochastic_block_model', 'nx.stochastic_block_model', (['sizes', 'probs'], {}), '(sizes, probs)\n', (2500, 2514), True, 'import networkx as nx\n'), ((2573, 2591), 'networkx.is_connected', 'nx.is_connected', (['g'], {}), '(g)\n', (2588, 2591), True, 'import networkx as nx\n'), ((2749, 2762), 'n...
import numpy as np from abc import ABC, abstractmethod from sklearn import metrics from . import functional as pwF class AbstractEvaluatorResults(ABC): """ Objects of derives classes encapsulate results of an evaluation metric. """ @abstractmethod def is_better_than(self, other_results_object):...
[ "numpy.array" ]
[((6665, 6688), 'numpy.array', 'np.array', (['self._outputs'], {}), '(self._outputs)\n', (6673, 6688), True, 'import numpy as np\n'), ((6725, 6748), 'numpy.array', 'np.array', (['self._targets'], {}), '(self._targets)\n', (6733, 6748), True, 'import numpy as np\n'), ((8033, 8056), 'numpy.array', 'np.array', (['self._ou...
import logging import os import numpy as np import vficredit.equations as eq class Economy(object): WAGE_PARAMS = ('z','k','l','alpha') INTEREST_PARAMS = ('z','k','l','alpha','delta') AGRID_PARAMS = ('minA','nA','nAneg','maxA') def __init__(self, name = None, **kwargs): """ ini...
[ "vficredit.equations.MPK", "logging.info", "numpy.linspace", "os.linesep.join", "vficredit.equations.MPL", "numpy.concatenate" ]
[((640, 681), 'logging.info', 'logging.info', (['"""Economy class initialized"""'], {}), "('Economy class initialized')\n", (652, 681), False, 'import logging\n'), ((1020, 1043), 'os.linesep.join', 'os.linesep.join', (['params'], {}), '(params)\n', (1035, 1043), False, 'import os\n'), ((1574, 1601), 'numpy.linspace', '...
"""Bla.""" import tempfile import subprocess import time import os import sys import zipfile from copy import deepcopy import numpy as np from Bio.Blast import NCBIXML from Bio.Seq import Seq from Bio import SeqIO from Bio.SeqFeature import SeqFeature, FeatureLocation PYTHON3 = (sys.version_info[0] == 3) if PYTHON3:...
[ "copy.deepcopy", "os.remove", "zipfile.ZipFile", "Bio.SeqIO.read", "tempfile.mkstemp", "Bio.Seq.Seq", "Bio.SeqFeature.FeatureLocation", "os.path.basename", "time.sleep", "numpy.cumsum", "Bio.Blast.NCBIXML.parse", "os.path.splitext", "os.fdopen", "numpy.choose" ]
[((2348, 2372), 'tempfile.mkstemp', 'tempfile.mkstemp', (['""".xml"""'], {}), "('.xml')\n", (2364, 2372), False, 'import tempfile\n'), ((2402, 2425), 'tempfile.mkstemp', 'tempfile.mkstemp', (['""".fa"""'], {}), "('.fa')\n", (2418, 2425), False, 'import tempfile\n'), ((5777, 5793), 'copy.deepcopy', 'deepcopy', (['record...
# Copyright 2019 Saarland University, Spoken Language Systems LSV # Author: <NAME>, <NAME>, <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...
[ "matplotlib.pyplot.title", "pickle.dump", "numpy.sum", "matplotlib.pyplot.yticks", "matplotlib.pyplot.matshow", "numpy.zeros", "matplotlib.pyplot.colorbar", "pickle.load", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gcf", "matplotlib.pyplot.savefig", "matplotli...
[((2368, 2455), 'matplotlib.pyplot.matshow', 'plt.matshow', (['matrix'], {'vmin': 'vmin', 'vmax': 'vmax', 'interpolation': '"""none"""', 'cmap': 'plt.cm.Blues'}), "(matrix, vmin=vmin, vmax=vmax, interpolation='none', cmap=plt.cm\n .Blues)\n", (2379, 2455), True, 'import matplotlib.pyplot as plt\n'), ((2459, 2477), '...
# Peak espectral analysis using Welch's modified periodogram # Author : <NAME> # Digital Signal Processing laboratory : University of São Paulo (SEL/EESC/USP) import pandas as pd import scipy.signal as sg import scipy.stats as ss import matplotlib.pyplot as plt import numpy as np # Setup sine N=1e5 A=10 f=60 Fs=5*f t...
[ "matplotlib.pyplot.show", "scipy.signal.welch", "numpy.random.randint", "numpy.sin", "numpy.arange" ]
[((1360, 1370), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1368, 1370), True, 'import matplotlib.pyplot as plt\n'), ((321, 333), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (330, 333), True, 'import numpy as np\n'), ((348, 373), 'numpy.sin', 'np.sin', (['(2 * np.pi * f * t)'], {}), '(2 * np.pi * f ...
#!/usr/bin/env python3 import collections import copy import glob import os import re import cv2 import numpy as np import pandas as pd import scipy.interpolate import torch import torch.nn.functional as F import yaml from PIL import Image from easydict import EasyDict as edict from inference.base_image_utils import...
[ "inference.base_image_utils.image2batch", "yaml.load", "cv2.VideoWriter_fourcc", "argparse.ArgumentParser", "numpy.clip", "collections.defaultdict", "inference.perspective.make_manual_homography_kornia", "cv2.VideoWriter", "glob.glob", "cv2.erode", "torch.no_grad", "os.path.join", "pandas.Da...
[((1178, 1200), 'copy.deepcopy', 'copy.deepcopy', (['latents'], {}), '(latents)\n', (1191, 1200), False, 'import copy\n'), ((2892, 2914), 'copy.deepcopy', 'copy.deepcopy', (['latents'], {}), '(latents)\n', (2905, 2914), False, 'import copy\n'), ((5301, 5332), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'MJP...
import sys sys.path.append("..") sys.path.append("D:/ml_from_scratch/") from recurrent_neural_network import RecurrentNeuralNetwork import numpy as np from keras.utils.np_utils import to_categorical from optimizations_algorithms.optimizers import SGD from rnn_keras import RNNKeras def main(use_keras=False): start...
[ "sys.path.append", "keras.optimizers.SGD", "argparse.ArgumentParser", "numpy.zeros", "keras.utils.np_utils.to_categorical", "optimizations_algorithms.optimizers.SGD", "recurrent_neural_network.RecurrentNeuralNetwork", "rnn_keras.RNNKeras" ]
[((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((33, 71), 'sys.path.append', 'sys.path.append', (['"""D:/ml_from_scratch/"""'], {}), "('D:/ml_from_scratch/')\n", (48, 71), False, 'import sys\n'), ((1654, 1691), 'numpy.zeros', 'np.zeros', ([], {'shape'...
import numpy as np class Vectorizer: unique_words = dict() cur_idx = 0 def fit(self, X): for x in X: for word in x: if word not in self.unique_words: self.unique_words[word] = self.cur_idx self.cur_idx += 1 return self ...
[ "numpy.array", "numpy.zeros" ]
[((1610, 1636), 'numpy.zeros', 'np.zeros', (['self.num_classes'], {}), '(self.num_classes)\n', (1618, 1636), True, 'import numpy as np\n'), ((3487, 3504), 'numpy.array', 'np.array', (['y_train'], {}), '(y_train)\n', (3495, 3504), True, 'import numpy as np\n'), ((1810, 1836), 'numpy.zeros', 'np.zeros', (['self.num_class...
# -*- coding: utf-8 -*- from sqpdfo.runtime import * import sqpdfo.sqpdfo_global_variables as glob from numpy import array, zeros, concatenate, zeros_like, inf def f_benchmark(x, prob): """ #----------------------------------------------------------------------- # Computation of f, ci, ce #-----------...
[ "sqpdfo.sqpdfo_global_variables.set_filename_f", "numpy.zeros", "sqpdfo.sqpdfo_global_variables.set_filename_cons", "numpy.array", "sqpdfo.sqpdfo_global_variables.get_prob_cuter", "numpy.concatenate" ]
[((3263, 3272), 'numpy.array', 'array', (['[]'], {}), '([])\n', (3268, 3272), False, 'from numpy import array, zeros, concatenate, zeros_like, inf\n'), ((3281, 3290), 'numpy.array', 'array', (['[]'], {}), '([])\n', (3286, 3290), False, 'from numpy import array, zeros, concatenate, zeros_like, inf\n'), ((10041, 10050), ...
import os import numpy import math import cv2 path = '/yyong119/Documents/image' gt_path = '/yyong119/Documents/label' out_path = 're_image' if not os.path.exists(out_path): os.makedirs(out_path) files = os.listdir(path) files.sort() files = files[:100] for file in files: _, basename = os.path.split(file) ...
[ "numpy.delete", "os.makedirs", "math.ceil", "os.path.exists", "numpy.zeros", "numpy.argsort", "cv2.imread", "numpy.min", "numpy.max", "numpy.arange", "os.path.splitext", "numpy.array", "numpy.where", "numpy.round", "os.path.split", "os.path.join", "os.listdir", "cv2.resize" ]
[((209, 225), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (219, 225), False, 'import os\n'), ((149, 173), 'os.path.exists', 'os.path.exists', (['out_path'], {}), '(out_path)\n', (163, 173), False, 'import os\n'), ((179, 200), 'os.makedirs', 'os.makedirs', (['out_path'], {}), '(out_path)\n', (190, 200), Fals...
import helpers import numpy as np import scipy import scipy.sparse import sys import math import configparser as cp import Visualize as vis import os def findclusters(U,cluster_center_vectors): legit = 0 cdict = [[] for i in range(len(cluster_center_vectors))] no_of_nodes = U.shape[0] for ii in range(n...
[ "numpy.full", "numpy.sum", "math.pow", "os.getcwd", "scipy.sparse.load_npz", "numpy.argsort", "numpy.random.randint", "numpy.array", "configparser.ConfigParser", "Visualize.showclusters", "numpy.sqrt" ]
[((3618, 3635), 'configparser.ConfigParser', 'cp.ConfigParser', ([], {}), '()\n', (3633, 3635), True, 'import configparser as cp\n'), ((3740, 3777), 'Visualize.showclusters', 'vis.showclusters', (['cluster_dict', 'dpath'], {}), '(cluster_dict, dpath)\n', (3756, 3777), True, 'import Visualize as vis\n'), ((932, 958), 'n...
from __future__ import division from __future__ import print_function import numpy as np import argparse import torch import random import torch.nn.functional as F import torch.nn as nn from utils import load_data parser = argparse.ArgumentParser() parser.add_argument('--no-cuda', action='store_true', default=Fals...
[ "torch.ones_like", "numpy.random.seed", "argparse.ArgumentParser", "utils.load_data", "torch.where", "torch.manual_seed", "torch.nn.init.xavier_uniform_", "torch.nn.functional.dropout", "torch.mm", "torch.cuda.mnual_seed", "torch.nn.functional.softmax", "random.seed", "torch.cuda.is_availabl...
[((228, 253), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (251, 253), False, 'import argparse\n'), ((1463, 1485), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (1474, 1485), False, 'import random\n'), ((1486, 1511), 'numpy.random.seed', 'np.random.seed', (['args.seed'],...
import os import pickle import numpy as np from tqdm import tqdm from useful_wsi import open_image, get_whole_image from train_umap import normalise_csv, drop_na_axis def options_parser(): import argparse parser = argparse.ArgumentParser( description='Creating heatmap') parser.add_argument('--um...
[ "numpy.save", "argparse.ArgumentParser", "os.path.basename", "numpy.zeros", "useful_wsi.open_image", "train_umap.drop_na_axis", "useful_wsi.get_whole_image", "numpy.mean", "os.path.join", "os.listdir", "train_umap.normalise_csv" ]
[((226, 281), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Creating heatmap"""'}), "(description='Creating heatmap')\n", (249, 281), False, 'import argparse\n'), ((1517, 1533), 'os.listdir', 'os.listdir', (['name'], {}), '(name)\n', (1527, 1533), False, 'import os\n'), ((4145, 4162), '...
import numpy as np import matplotlib.pyplot as plt import sys sys.path.append('./../..') from util import myfigure # Construct time series noise1 = np.random.randn(20,1) noise2 = np.random.randn(20,1) t11 = np.vstack([np.zeros([20,1]), 20+noise1, np.zeros([20,1]), 30+noise2, np.zeros([20,1])]) t12 = np.vstack([np.zer...
[ "sys.path.append", "util.myfigure", "numpy.random.randn", "numpy.std", "numpy.zeros", "numpy.ones", "numpy.mean", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefig" ]
[((62, 88), 'sys.path.append', 'sys.path.append', (['"""./../.."""'], {}), "('./../..')\n", (77, 88), False, 'import sys\n'), ((150, 172), 'numpy.random.randn', 'np.random.randn', (['(20)', '(1)'], {}), '(20, 1)\n', (165, 172), True, 'import numpy as np\n'), ((181, 203), 'numpy.random.randn', 'np.random.randn', (['(20)...
# OpenCV のインポート import cv2 import numpy as np import time import generate_char_img as gci # VideoCaptureのインスタンスを作成する。 # 引数でカメラを選べれる。 cap = cv2.VideoCapture(0) threshold = 0.52 # w, h = temp.shape[::-1] WIDTH = 1280 HEIGHT = 720 FPS = 30 cap.set(cv2.CAP_PROP_FPS, FPS) cap.set(cv2.CAP_PROP_FRAME_WIDTH, WI...
[ "generate_char_img.gen_char_imgs", "cv2.waitKey", "cv2.cvtColor", "cv2.imshow", "cv2.VideoCapture", "numpy.where", "cv2.rectangle", "cv2.destroyAllWindows", "cv2.matchTemplate" ]
[((148, 167), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (164, 167), False, 'import cv2\n'), ((571, 619), 'generate_char_img.gen_char_imgs', 'gci.gen_char_imgs', (['search_char', 'fonts', 'font_size'], {}), '(search_char, fonts, font_size)\n', (588, 619), True, 'import generate_char_img as gci\n'),...
import math import numpy as np def amounts(balance): return [ v['amount'] for k, v in balance.items() ] def getValueEachAsset(balance): valueList = [] for k, v in balance.items(): valueList.append(v['price'] * v['amount']) return valueList def getValue(balance): return sum(getValueEachAss...
[ "numpy.abs", "math.floor" ]
[((1334, 1365), 'math.floor', 'math.floor', (["(change / v['price'])"], {}), "(change / v['price'])\n", (1344, 1365), False, 'import math\n'), ((497, 511), 'numpy.abs', 'np.abs', (['assets'], {}), '(assets)\n', (503, 511), True, 'import numpy as np\n'), ((544, 558), 'numpy.abs', 'np.abs', (['ratios'], {}), '(ratios)\n'...
from scipy.special import gamma import numpy as np import math ''' We model the terminal depth as a random variable drawn i.i.d. from a negative binomial distribution d_i ~ NB(r, p) We know that in a negative binomial process, there must be at least r failures. For this reason, we can see that the largest possible v...
[ "scipy.special.gamma", "numpy.linspace" ]
[((830, 851), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(50)'], {}), '(0, 1, 50)\n', (841, 851), True, 'import numpy as np\n'), ((734, 742), 'scipy.special.gamma', 'gamma', (['r'], {}), '(r)\n', (739, 742), False, 'from scipy.special import gamma\n'), ((745, 757), 'scipy.special.gamma', 'gamma', (['(x + 1)'], {...
import numpy as np import ctypes as ct from typing import Tuple, List, Optional from .. import mathctypes from .. import bindingbase as bb from .. import plib from .indices import * class pMatrix(ct.Structure): _fields_ = [ ('data', bb.c_float_p), ('cols', bb.c_int), ('rows', bb.c_int) ...
[ "numpy.ctypeslib.as_array", "ctypes.POINTER" ]
[((340, 359), 'ctypes.POINTER', 'ct.POINTER', (['pMatrix'], {}), '(pMatrix)\n', (350, 359), True, 'import ctypes as ct\n'), ((682, 729), 'numpy.ctypeslib.as_array', 'np.ctypeslib.as_array', (['matrix.data'], {'shape': 'shape'}), '(matrix.data, shape=shape)\n', (703, 729), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ @author: 代码医生工作室 @公众号:xiangyuejiqiren (内有更多优秀文章及学习资料) @来源: <PyTorch深度学习和图神经网络(卷 1)——基础知识>配套代码 @配套代码技术支持:bbs.aianaconda.com Created on Sun Nov 3 15:36:39 2019 """ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import os from scip...
[ "numpy.random.seed", "os.makedirs", "numpy.argmax", "pandas.read_csv", "torch.manual_seed", "pandas.get_dummies", "torch.nn.CrossEntropyLoss", "torch.nn.Softmax", "code_02_moons_fun.plot_losses", "torch.nn.Linear", "torch.nn.functional.softplus", "torch.from_numpy" ]
[((376, 403), 'pandas.read_csv', 'pd.read_csv', (['"""titanic3.csv"""'], {}), "('titanic3.csv')\n", (387, 403), True, 'import pandas as pd\n'), ((1441, 1459), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (1455, 1459), True, 'import numpy as np\n'), ((2071, 2091), 'torch.manual_seed', 'torch.manual_s...
import numpy as np import inspect import os LOCATION = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) import sys sys.path.insert(0, LOCATION) from hmf.transfer import Transfer from hmf.transfer_models import EH_BAO def rms(a): print(a) print("RMS: ", np.sqrt(np.mean(np.square(a)))) ...
[ "numpy.abs", "numpy.square", "sys.path.insert", "numpy.isclose", "numpy.exp", "inspect.currentframe", "hmf.transfer.Transfer" ]
[((140, 168), 'sys.path.insert', 'sys.path.insert', (['(0)', 'LOCATION'], {}), '(0, LOCATION)\n', (155, 168), False, 'import sys\n'), ((692, 702), 'hmf.transfer.Transfer', 'Transfer', ([], {}), '()\n', (700, 702), False, 'from hmf.transfer import Transfer\n'), ((712, 722), 'hmf.transfer.Transfer', 'Transfer', ([], {}),...
#!/usr/bin/python # encoding: utf8 import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors def unison_shuffled(a, b): assert len(a) == len(b) p = np.random.permutation(len(a)) return zip(a[p], b[p]) def non_monotone(x, w, theta): wx = np.dot(w.T, x) - theta exp = n...
[ "matplotlib.pyplot.title", "numpy.random.uniform", "matplotlib.colors.LinearSegmentedColormap.from_list", "numpy.meshgrid", "numpy.sum", "matplotlib.pyplot.show", "numpy.amin", "matplotlib.pyplot.scatter", "numpy.square", "numpy.genfromtxt", "numpy.amax", "matplotlib.pyplot.figure", "numpy.a...
[((455, 514), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data/xor-y.csv"""'], {'dtype': 'float', 'delimiter': '""","""'}), "('data/xor-y.csv', dtype=float, delimiter=',')\n", (468, 514), True, 'import numpy as np\n'), ((600, 639), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-0.99)', 'high': '(0.99)'}), ...
#<NAME> #Settlers of Catan, 2020 #Imports from string import * import numpy as np from hexTile import * from hexLib import * from player import * #import networkx as nx #import matplotlib.pyplot as plt import pygame pygame.init() #Class to implement Catan board logic #Use a graph representation for the board class c...
[ "numpy.random.permutation", "pygame.init" ]
[((218, 231), 'pygame.init', 'pygame.init', ([], {}), '()\n', (229, 231), False, 'import pygame\n'), ((3276, 3363), 'numpy.random.permutation', 'np.random.permutation', (['[2, 3, 3, 4, 4, 5, 5, 6, 6, 8, 8, 9, 9, 10, 10, 11, 11, 12]'], {}), '([2, 3, 3, 4, 4, 5, 5, 6, 6, 8, 8, 9, 9, 10, 10, 11, \n 11, 12])\n', (3297, ...
# -*- coding: utf8 -*- import sys import os import warnings warnings.filterwarnings("ignore") # Add system path to use interactive tools my_path = os.path.join(os.getcwd(), "bin") if my_path not in sys.path: sys.path.append(my_path) with open("exchanges.ini", "r") as f: exchange_nodes = f.read().s...
[ "qtpy.QtGui.QIcon", "qtpy.QtCore.QSettings", "qtpy.QtWidgets.QTextEdit", "qtpy.QtWidgets.QApplication", "qtpy.QtWidgets.QMessageBox.information", "sys.path.append", "qtpy.QtWidgets.QHBoxLayout", "qtpy.QtWidgets.QLabel", "qtpy.QtWidgets.QSpacerItem", "qtpy.QtWidgets.QVBoxLayout", "visGraphHigh.Gr...
[((66, 99), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (89, 99), False, 'import warnings\n'), ((168, 179), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (177, 179), False, 'import os\n'), ((222, 246), 'sys.path.append', 'sys.path.append', (['my_path'], {}), '(my_path)\n'...
''' A matplotlib-based function to overplot an elliptical error contour from the covariance matrix. Copyright 2017 <NAME> (Flatiron). Citations: <NAME> (https://github.com/joferkington/oost_paper_code/blob/master/error_ellipse.py), <NAME> (http://www.visiondummy.com/2014/04/draw-error-ellipse-representing-c...
[ "matplotlib.pyplot.show", "numpy.arctan2", "numpy.linalg.eigh", "matplotlib.pyplot.figure", "numpy.mean", "numpy.random.multivariate_normal", "numpy.cov", "numpy.sqrt" ]
[((821, 840), 'numpy.linalg.eigh', 'np.linalg.eigh', (['cov'], {}), '(cov)\n', (835, 840), True, 'import numpy as np\n'), ((1354, 1440), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', ([], {'mean': '(1, 1)', 'cov': '[[5.0, 4.0], [4.0, 6.0]]', 'size': '(100)'}), '(mean=(1, 1), cov=[[5.0, 4.0], [4.0...
from tqdm import tqdm import random import os import numpy as np import argparse import subprocess import shlex import sys import torch from util import * RANDOM_SEED = 12345 random.seed(RANDOM_SEED) np.random.seed(RANDOM_SEED) torch.manual_seed(RANDOM_SEED) if torch.cuda.is_available(): torch.cuda.manual_seed...
[ "tqdm.tqdm", "numpy.random.seed", "argparse.ArgumentParser", "torch.manual_seed", "torch.load", "torch.argmax", "torch.save", "torch.cuda.manual_seed_all", "torch.cuda.is_available", "random.seed", "torch.cuda.empty_cache" ]
[((180, 204), 'random.seed', 'random.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (191, 204), False, 'import random\n'), ((205, 232), 'numpy.random.seed', 'np.random.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (219, 232), True, 'import numpy as np\n'), ((233, 263), 'torch.manual_seed', 'torch.manual_seed', (['...
# -*- coding: utf-8 -*- import numpy as np import copy import itertools from time import time import matplotlib.pyplot as plt from stochoptim.scengen.tree_structure import Node from stochoptim.scengen.scenario_tree import ScenarioTree Cartesian = itertools.product class TreeSearch: def __init__(self, scena...
[ "numpy.random.choice", "copy.deepcopy", "numpy.quantile", "matplotlib.pyplot.show", "stochoptim.scengen.scenario_tree.ScenarioTree", "time.time", "stochoptim.scengen.tree_structure.Node.from_bushiness", "numpy.minimum.accumulate", "numpy.array", "stochoptim.scengen.scenario_tree.ScenarioTree.from_...
[((1201, 1235), 'numpy.array', 'np.array', (['self._fod_sample[method]'], {}), '(self._fod_sample[method])\n', (1209, 1235), True, 'import numpy as np\n'), ((1472, 1501), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (1484, 1501), True, 'import matplotlib.pyplot as p...
import random import time import itertools from functools import partial import math import re import cachetools import numpy as np from scipy.stats import skew, moment from copy import deepcopy from deap import gp class SimpleParametrizedPrimitiveSet(gp.PrimitiveSet): def __init__(self, name, arity, variable_t...
[ "numpy.sum", "numpy.ones", "numpy.random.randint", "scipy.stats.moment", "cachetools.LRUCache", "numpy.power", "re.findall", "deap.gp.PrimitiveSet.__init__", "deap.gp.PrimitiveTree.__init__", "functools.partial", "copy.deepcopy", "re.split", "itertools.combinations", "numpy.concatenate", ...
[((15849, 15878), 're.findall', 're.findall', (['"""\\\\d+"""', 'node.name'], {}), "('\\\\d+', node.name)\n", (15859, 15878), False, 'import re\n'), ((372, 423), 'deap.gp.PrimitiveSet.__init__', 'gp.PrimitiveSet.__init__', (['self', 'name', 'arity', 'prefix'], {}), '(self, name, arity, prefix)\n', (396, 423), False, 'f...
# save coco_caption images: train & valid import os import torch import cv2 import matplotlib.pyplot as plt from tqdm import tqdm import numpy as np def __mk_idform__(id): if len(id) == 1: id = '00000' + f'{id}' elif len(id) == 2: id = '0000' + f'{id}' elif len(id) == 3: id = '000' + f'{id}' elif ...
[ "os.mkdir", "numpy.array", "cv2.imread", "torch.utils.data.DataLoader" ]
[((1260, 1400), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['save_train_cocoimage_dataset'], {'batch_size': '(1)', 'pin_memory': '(False)', 'drop_last': '(False)', 'shuffle': '(False)', 'num_workers': '(1)'}), '(save_train_cocoimage_dataset, batch_size=1,\n pin_memory=False, drop_last=False, shuf...
import numpy as np import tensorflow as tf import cv2 import tflearn from FaceProcessUtil import PreprocessImage as PPI MAPPING = {0:'neutral', 1:'anger', 2:'surprise', 3:'disgust', 4:'fear', 5:'happy', 6:'sadness'} MP = './models/' DEFAULT_PADDING = 'SAME' TypeThreshold=100 eye_p_shape=[None, 26, 64, 1] mi...
[ "tensorflow.InteractiveSession", "tflearn.fully_connected", "tensorflow.train.Saver", "numpy.argmax", "tensorflow.concat", "tflearn.dropout", "tensorflow.placeholder", "tflearn.conv_2d", "tensorflow.Graph", "tflearn.max_pool_2d" ]
[((565, 635), 'tflearn.conv_2d', 'tflearn.conv_2d', (['eyep', '(8)', '(3)'], {'activation': '"""relu"""', 'name': '"""eye_conv1_1_3x3"""'}), "(eyep, 8, 3, activation='relu', name='eye_conv1_1_3x3')\n", (580, 635), False, 'import tflearn\n'), ((646, 717), 'tflearn.conv_2d', 'tflearn.conv_2d', (['e_net', '(8)', '(3)'], {...
""" Place this file within the generatd data folder data_folder/ - data.csv - player.py <== Like such - images/ - 1589202544.57268.jpg - 1589202545.33127.jpg ... - 1589203451.23581.jpg """ import cv2 import os import numpy as np import traceback import time data = open("data.csv", "r") #data = o...
[ "cv2.bitwise_and", "cv2.fillPoly", "cv2.imshow", "cv2.line", "numpy.zeros_like", "traceback.print_exc", "numpy.copy", "cv2.cvtColor", "cv2.imwrite", "cv2.destroyAllWindows", "cv2.Canny", "cv2.waitKey", "cv2.addWeighted", "time.sleep", "os.listdir", "cv2.putText", "os.getcwd", "nump...
[((480, 500), 'os.listdir', 'os.listdir', (['"""images"""'], {}), "('images')\n", (490, 500), False, 'import os\n'), ((3733, 3756), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3754, 3756), False, 'import cv2\n'), ((587, 605), 'numpy.zeros_like', 'np.zeros_like', (['img'], {}), '(img)\n', (600, ...
import tensorflow as tf import numpy as np x= np.random.randn(4,5,20) input = tf.constant(x) x = tf.cast(input,'float32') con = tf.get_variable("weight",[20, 10]) z=tf.dot(x,con) # z=tf.nn.conv2d(tf.cast(input,'float32'),con,strides=[1,1,1,1],padding="VALID") sess=tf.Session() sess.run(tf.global_variables_initializ...
[ "tensorflow.dot", "numpy.random.randn", "tensorflow.global_variables_initializer", "tensorflow.Session", "tensorflow.constant", "tensorflow.cast", "tensorflow.get_variable" ]
[((47, 72), 'numpy.random.randn', 'np.random.randn', (['(4)', '(5)', '(20)'], {}), '(4, 5, 20)\n', (62, 72), True, 'import numpy as np\n'), ((79, 93), 'tensorflow.constant', 'tf.constant', (['x'], {}), '(x)\n', (90, 93), True, 'import tensorflow as tf\n'), ((98, 123), 'tensorflow.cast', 'tf.cast', (['input', '"""float3...
from os import system import numpy as np import pandas as pd from sklearn.model_selection import train_test_split import time import concurrent from pebble import ProcessPool np.warnings.filterwarnings('ignore', 'overflow') #disabled warnings for the sigmoid function CPU_PROCESSES = 12 #CPU processes, reduce this if ...
[ "pebble.ProcessPool", "numpy.sum", "pandas.read_csv", "sklearn.model_selection.train_test_split", "time.time", "numpy.array", "numpy.exp", "concurrent.futures.wait", "numpy.dot", "numpy.warnings.filterwarnings" ]
[((176, 224), 'numpy.warnings.filterwarnings', 'np.warnings.filterwarnings', (['"""ignore"""', '"""overflow"""'], {}), "('ignore', 'overflow')\n", (202, 224), True, 'import numpy as np\n'), ((11906, 11917), 'time.time', 'time.time', ([], {}), '()\n', (11915, 11917), False, 'import time\n'), ((12329, 12340), 'time.time'...
# MIT License # # Copyright (c) 2018 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
[ "neural_net.NeuralNetworkWrapper", "copy.deepcopy", "evaluate.Evaluate", "mcts.MonteCarloTreeSearch", "numpy.rot90", "numpy.reshape", "mcts.TreeNode" ]
[((1816, 1842), 'neural_net.NeuralNetworkWrapper', 'NeuralNetworkWrapper', (['game'], {}), '(game)\n', (1836, 1842), False, 'from neural_net import NeuralNetworkWrapper\n'), ((4048, 4078), 'mcts.MonteCarloTreeSearch', 'MonteCarloTreeSearch', (['self.net'], {}), '(self.net)\n', (4068, 4078), False, 'from mcts import Mon...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np from src.YachtMod import Yacht, Keel, Rudder from src.SailMod import Main, Jib, Kite from src.VPPMod import VPP from src.UtilsMod import VPPResults YD41 = Yacht(Name="YD41", Lwl=11.90, Vol=6.05, Bwl=3.18, ...
[ "src.SailMod.Main", "src.SailMod.Kite", "src.VPPMod.VPP", "src.YachtMod.Rudder", "numpy.arange", "src.YachtMod.Keel", "numpy.linspace", "src.SailMod.Jib" ]
[((835, 850), 'src.VPPMod.VPP', 'VPP', ([], {'Yacht': 'YD41'}), '(Yacht=YD41)\n', (838, 850), False, 'from src.VPPMod import VPP\n'), ((879, 904), 'numpy.arange', 'np.arange', (['(4.0)', '(18.0)', '(4.0)'], {}), '(4.0, 18.0, 4.0)\n', (888, 904), True, 'import numpy as np\n'), ((931, 959), 'numpy.linspace', 'np.linspace...
import numpy as np import cv2 as cv from matplotlib import pyplot as plt from mpl_toolkits import mplot3d def plot(nparray, scale=1, title="Plot"): # Scale the image as specified nparray = cv.resize(nparray, None, fx=scale, fy=scale, interpolation=cv.INTER_CUBIC) # Define the axis bas...
[ "numpy.meshgrid", "matplotlib.pyplot.axes", "matplotlib.pyplot.figure", "numpy.linspace", "cv2.resize" ]
[((199, 273), 'cv2.resize', 'cv.resize', (['nparray', 'None'], {'fx': 'scale', 'fy': 'scale', 'interpolation': 'cv.INTER_CUBIC'}), '(nparray, None, fx=scale, fy=scale, interpolation=cv.INTER_CUBIC)\n', (208, 273), True, 'import cv2 as cv\n'), ((380, 406), 'numpy.linspace', 'np.linspace', (['(0)', 'xlen', 'xlen'], {}), ...
import os import psutil import math import numpy as np import tensorflow as tf import tracemalloc import argparse import logging from tensorflow import keras from pathlib import Path from time import strftime LOG_DIR = 'logdir' LOGGER_FORMAT = '%(asctime)s %(message)s' logging.basicConfig(format=LOGGER_FORMAT, datefm...
[ "tracemalloc.start", "os.path.abspath", "math.isnan", "argparse.ArgumentParser", "logging.basicConfig", "tensorflow.print", "tracemalloc.take_snapshot", "os.path.dirname", "time.strftime", "numpy.isnan", "numpy.isinf", "os.environ.get", "os.path.splitext", "psutil.cpu_count", "numpy.ma.i...
[((272, 335), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'LOGGER_FORMAT', 'datefmt': '"""[%H:%M:%S]"""'}), "(format=LOGGER_FORMAT, datefmt='[%H:%M:%S]')\n", (291, 335), False, 'import logging\n'), ((342, 361), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (359, 361), False, 'import logg...
from datetime import time import torch import torch.nn as nn import torch.nn.functional as F import copy import math import numpy as np from libcity.model.abstract_traffic_state_model import AbstractTrafficStateModel def clones(module, N): """ Produce N identical layers. :param module: nn.Module :par...
[ "torch.nn.Dropout", "numpy.sum", "torch.nn.Embedding", "torch.nn.init.uniform_", "torch.cat", "numpy.ones", "torch.arange", "torch.device", "numpy.identity", "torch.nn.LayerNorm", "math.cos", "torch.nn.Linear", "torch.zeros", "torch.matmul", "copy.deepcopy", "math.sqrt", "torch.nn.in...
[((1188, 1200), 'numpy.dot', 'np.dot', (['D', 'W'], {}), '(D, W)\n', (1194, 1200), True, 'import numpy as np\n'), ((10628, 10653), 'torch.nn.functional.softmax', 'F.softmax', (['scores'], {'dim': '(-1)'}), '(scores, dim=-1)\n', (10637, 10653), True, 'import torch.nn.functional as F\n'), ((49376, 49414), 'torch.nn.Linea...
import cv2 from PIL import Image, ImageDraw import os.path as osp import os import numpy as np import matplotlib.pyplot as plt import random import OpenEXR, Imath import open3d as o3d import matplotlib.pyplot as plt from mathutils import Vector, Matrix, Quaternion class Label: def draw_bboxes(self, syn_images_fold...
[ "os.remove", "numpy.ones", "open3d.geometry.PointCloud.create_from_rgbd_image", "os.path.join", "cv2.dilate", "cv2.imwrite", "open3d.io.write_point_cloud", "numpy.max", "PIL.ImageDraw.Draw", "cv2.boundingRect", "numpy.fromstring", "Imath.PixelType", "numpy.uint8", "numpy.hypot", "cv2.bit...
[((2730, 2797), 'os.path.join', 'osp.join', (['syn_images_folder', "('image_%05d/rgb/image.png' % scene_num)"], {}), "(syn_images_folder, 'image_%05d/rgb/image.png' % scene_num)\n", (2738, 2797), True, 'import os.path as osp\n'), ((2827, 2921), 'os.path.join', 'osp.join', (['syn_images_folder', "('image_%05d/depth/imag...
#!/usr/bin/env python3 """ Mit den Funktionen in dieser Datei können Eingabedaten mit Hilfe von neuronalen Netzen klassifiziert/erzeugt/verändert werden. """ import sys from collections import namedtuple import numpy as np import keras from keras import backend as K import skimage num_classes = 43 def normalizeTenso...
[ "numpy.argmax", "keras.backend.epsilon", "numpy.mean", "skimage.transform.resize", "keras.layers.Flatten", "numpy.max", "skimage.io.imsave", "keras.layers.MaxPooling2D", "skimage.io.imread", "keras.utils.to_categorical", "keras.backend.gradients", "keras.layers.Dropout", "keras.backend.funct...
[((911, 934), 'numpy.random.random', 'np.random.random', (['shape'], {}), '(shape)\n', (927, 934), True, 'import numpy as np\n'), ((949, 989), 'keras.backend.function', 'K.function', (['[model.input]', '[loss, grads]'], {}), '([model.input], [loss, grads])\n', (959, 989), True, 'from keras import backend as K\n'), ((16...
from keras.layers import Input,LSTM,Dense from keras.models import Model,load_model from keras.utils import plot_model import pandas as pd import numpy as np import os os.environ["PATH"] += os.pathsep + "E:/AAA/graphviz-2.38/release/bin" #我的graphviz环境没配好,为了后面的Plot_model def create_model(n_input, n_output, n_units): ...
[ "numpy.argmax", "keras.layers.LSTM", "numpy.zeros", "keras.models.Model", "pandas.read_table", "keras.utils.plot_model", "keras.layers.Dense", "keras.layers.Input" ]
[((448, 476), 'keras.layers.Input', 'Input', ([], {'shape': '(None, n_input)'}), '(shape=(None, n_input))\n', (453, 476), False, 'from keras.layers import Input, LSTM, Dense\n'), ((576, 608), 'keras.layers.LSTM', 'LSTM', (['n_units'], {'return_state': '(True)'}), '(n_units, return_state=True)\n', (580, 608), False, 'fr...
import face_recognition import cv2 import numpy as np video_capture = cv2.VideoCapture(0) #loading the first criminal image who is me enock criminal1_image = face_recognition.load_image_file("enock.jpg") criminal1_face_encoding = face_recognition.face_encodings(criminal1_image)[0] # Loading the second criminal image...
[ "cv2.putText", "face_recognition.face_distance", "face_recognition.compare_faces", "cv2.waitKey", "face_recognition.face_encodings", "face_recognition.load_image_file", "cv2.imshow", "numpy.argmin", "cv2.VideoCapture", "cv2.rectangle", "face_recognition.face_locations", "cv2.destroyAllWindows"...
[((71, 90), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (87, 90), False, 'import cv2\n'), ((160, 205), 'face_recognition.load_image_file', 'face_recognition.load_image_file', (['"""enock.jpg"""'], {}), "('enock.jpg')\n", (192, 205), False, 'import face_recognition\n'), ((369, 414), 'face_recognition...
"""Mujoco CartPole environment from https://github.com/kchua/handful-of-trials.""" import os import numpy as np import torch from gym import utils from rllib.reward.state_action_reward import StateActionReward class CartPoleReward(StateActionReward): r"""A cart-pole reward model implementation. The reward ...
[ "gym.envs.mujoco.mujoco_env.MujocoEnv.__init__", "torch.stack", "numpy.concatenate", "os.path.realpath", "torch.square", "numpy.shape", "torch.cos", "torch.sin", "gym.utils.EzPickle.__init__" ]
[((1299, 1388), 'torch.stack', 'torch.stack', (['[x0 - self.pendulum_length * sin, -self.pendulum_length * (1 + cos)]', '(-1)'], {}), '([x0 - self.pendulum_length * sin, -self.pendulum_length * (1 +\n cos)], -1)\n', (1310, 1388), False, 'import torch\n'), ((1249, 1265), 'torch.sin', 'torch.sin', (['theta'], {}), '(t...
from math import sqrt from networkx import DiGraph, draw_networkx_edges, draw_networkx_nodes import numpy as np from pandas import read_csv import sys import matplotlib.pyplot sys.path.append("../../") sys.path.append("../../../cspy") from vrpy.main import VehicleRoutingProblem import logging logger = logging.getLog...
[ "sys.path.append", "numpy.uint32", "networkx.draw_networkx_edges", "math.sqrt", "vrpy.main.VehicleRoutingProblem", "pandas.read_csv", "networkx.draw_networkx_nodes", "numpy.array", "numpy.float64", "networkx.DiGraph", "logging.getLogger" ]
[((177, 202), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (192, 202), False, 'import sys\n'), ((203, 235), 'sys.path.append', 'sys.path.append', (['"""../../../cspy"""'], {}), "('../../../cspy')\n", (218, 235), False, 'import sys\n'), ((306, 333), 'logging.getLogger', 'logging.getLogge...
import tensorflow as tf import numpy as np from tensorflow.keras.layers import Dense from tensorflow.keras.models import Sequential from pget import Agent tf.enable_eager_execution() model = Sequential([ Dense(32, input_shape=[8], activation="relu"), Dense(32, activation="relu"), Dense(4, activation="softmax"...
[ "tensorflow.keras.layers.Dense", "numpy.random.random", "pget.Agent", "tensorflow.enable_eager_execution" ]
[((158, 185), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (183, 185), True, 'import tensorflow as tf\n'), ((335, 371), 'pget.Agent', 'Agent', (['model'], {'action_type': '"""discrete"""'}), "(model, action_type='discrete')\n", (340, 371), False, 'from pget import Agent\n'), ((399...
# AUTOGENERATED! DO NOT EDIT! File to edit: 42-wav-embedding-preprocess.ipynb (unless otherwise specified). __all__ = ['to_millseconds', 'short_warning', 'preprocess_audio_segments_csv', 'add_audio_embeddings_info', 'check_label', 'write_nd_parquet', 'get_fixed_length_segments', 'short_embedding_csv_load'] ...
[ "pandas.DataFrame", "torch.mean", "soundfile.read", "re.split", "numpy.argmax", "pyarrow.Table.from_pandas", "warnings.warn_explicit", "pandas.read_parquet", "pandas.Series", "pyarrow.parquet.write_table", "re.compile" ]
[((1145, 1182), 're.compile', 're.compile', (['"""\\\\d{2}:\\\\d{2}\\\\.\\\\d{1,}"""'], {}), "('\\\\d{2}:\\\\d{2}\\\\.\\\\d{1,}')\n", (1155, 1182), False, 'import re\n'), ((1368, 1391), 're.split', 're.split', (['""":|\\\\."""', 'time'], {}), "(':|\\\\.', time)\n", (1376, 1391), False, 'import re\n'), ((1755, 1806), 'w...
""" iNLTK public marathi headlines dataset """ import pandas as pd import numpy as np from datasets import load_metric from datasets import Dataset from datasets import ClassLabel from transformers import TrainingArguments, Trainer, AutoConfig from transformers import AutoTokenizer, AutoModelForSequenceClassification ...
[ "transformers.AutoConfig.from_pretrained", "transformers.TrainingArguments", "numpy.argmax", "pandas.read_csv", "transformers.AutoTokenizer.from_pretrained", "datasets.load_metric", "datasets.ClassLabel", "transformers.AutoModelForSequenceClassification.from_pretrained", "datasets.Dataset.from_panda...
[((394, 435), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['MODEL_NAME'], {}), '(MODEL_NAME)\n', (423, 435), False, 'from transformers import AutoTokenizer, AutoModelForSequenceClassification\n'), ((446, 469), 'datasets.load_metric', 'load_metric', (['"""accuracy"""'], {}), "('accura...
import pyclesperanto_prototype as cle import numpy as np def test_reduce_labels_to_centroids(): test = np.asarray([ [0,0,0, 1,1,1], [0,2,0, 1,1,1], [0,0,0, 1,1,1], [3,3,3, 4,4,4], [3,3,3, 4,4,4], [3,3,3, 4,4,4], ]) reference = np.asarray([ [0, 0, 0, ...
[ "numpy.asarray", "pyclesperanto_prototype.reduce_labels_to_centroids", "numpy.allclose" ]
[((108, 244), 'numpy.asarray', 'np.asarray', (['[[0, 0, 0, 1, 1, 1], [0, 2, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1], [3, 3, 3, 4, 4,\n 4], [3, 3, 3, 4, 4, 4], [3, 3, 3, 4, 4, 4]]'], {}), '([[0, 0, 0, 1, 1, 1], [0, 2, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1], [3,\n 3, 3, 4, 4, 4], [3, 3, 3, 4, 4, 4], [3, 3, 3, 4, 4, 4]])\n', (118,...
""" Mapping between Ternary and Cartesian Coordinates. Functions for converting ternary coordinates into cartesian system used in Matplotlib and vice-versa. All the values will be scaled so that the side length of the triangle is equal to one. """ import numpy as np # Define constants to avoid code repetitions _sqrt...
[ "numpy.array", "numpy.sqrt" ]
[((324, 336), 'numpy.sqrt', 'np.sqrt', (['(3.0)'], {}), '(3.0)\n', (331, 336), True, 'import numpy as np\n'), ((974, 1053), 'numpy.array', 'np.array', (['[coordinates[1] + coordinates[2] / 2.0, _half_sqrt3 * coordinates[2]]'], {}), '([coordinates[1] + coordinates[2] / 2.0, _half_sqrt3 * coordinates[2]])\n', (982, 1053)...
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score from seglearn.transform import Segment import plotly.express as px import plotly.graph_objects as go from plotly.subplots import make_subplots from ...
[ "numpy.abs", "sklearn.model_selection.train_test_split", "keras.backend.epsilon", "sklearn.metrics.r2_score", "sklearn.metrics.mean_absolute_error", "numpy.sin", "seglearn.transform.Segment", "pandas.DataFrame", "sklearn.metrics.mean_squared_error", "pandas.concat", "holidays.DE", "numpy.stack...
[((377, 390), 'holidays.DE', 'holidays.DE', ([], {}), '()\n', (388, 390), False, 'import holidays\n'), ((730, 900), 'sklearn.model_selection.train_test_split', 'train_test_split', (['df.iloc[:, :window_size * feature_len]', 'df.iloc[:, window_size * feature_len:-1]'], {'test_size': 'split_pct_1', 'shuffle': '(True)', '...
import numpy as np def iec_calc(prod_df, prod_col_dict, meta_df, meta_col_dict, gi_ref=1000.0): """ Calculates expected energy using measured irradiance based on IEC calculations Parameters ---------- prod_df: DataFrame A data frame corresponding to the production data ...
[ "numpy.timedelta64" ]
[((3157, 3179), 'numpy.timedelta64', 'np.timedelta64', (['(1)', '"""h"""'], {}), "(1, 'h')\n", (3171, 3179), True, 'import numpy as np\n')]
import rospy import move_base_msgs.msg as ros_mb_msg import geometry_msgs.msg as ros_geom_msg import std_msgs.msg as ros_std_msg import tf import actionlib import numpy as np from collections import Counter ############################################################## # HELPER FUNCTIONS ############################...
[ "rospy.logerr", "rospy.Subscriber", "move_base_msgs.msg.MoveBaseGoal", "actionlib.SimpleActionClient", "numpy.sin", "rospy.Duration.from_sec", "geometry_msgs.msg.PoseStamped", "rospy.Time.now", "numpy.math.sqrt", "numpy.max", "numpy.math.sin", "collections.Counter", "geometry_msgs.msg.Pose",...
[((388, 400), 'collections.Counter', 'Counter', (['lst'], {}), '(lst)\n', (395, 400), False, 'from collections import Counter\n'), ((1243, 1353), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/gallery_detection_vector"""', 'ros_std_msg.Float32MultiArray', 'self.neural_network_callback'], {}), "('/gallery_detection_vect...
""" Copyright 2016 <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 writing, software distrib...
[ "csv.reader", "csv.writer", "argparse.ArgumentParser", "math.floor", "numpy.cumsum" ]
[((1632, 1658), 'numpy.cumsum', 'np.cumsum', (['bins_duplicates'], {}), '(bins_duplicates)\n', (1641, 1658), True, 'import numpy as np\n'), ((1684, 1714), 'numpy.cumsum', 'np.cumsum', (['bins_non_duplicates'], {}), '(bins_non_duplicates)\n', (1693, 1714), True, 'import numpy as np\n'), ((2523, 2595), 'argparse.Argument...
""" This library contains functions to process image data used by GenDist """ import jax import numpy as np import jax.numpy as jnp from multiprocessing import Pool from augly import image # DataAugmentationFactory class Factory: """ This is a base library to process / transform the elements of a numpy ar...
[ "numpy.stack", "jax.flatten_util.ravel_pytree", "multiprocessing.Pool", "numpy.array_split", "numpy.concatenate" ]
[((3015, 3060), 'jax.flatten_util.ravel_pytree', 'jax.flatten_util.ravel_pytree', (['params_hist[0]'], {}), '(params_hist[0])\n', (3044, 3060), False, 'import jax\n'), ((1443, 1466), 'numpy.stack', 'np.stack', (['X_out'], {'axis': '(0)'}), '(X_out, axis=0)\n', (1451, 1466), True, 'import numpy as np\n'), ((2149, 2187),...
# import the necessary packages import numpy as np import cv2 from ..convenience import is_cv2 from . import factories class RootSIFT: def __init__(self): # initialize the SIFT feature extractor self.extractor = factories.DescriptorExtractor_create("SIFT") def compute(self, image, kps, eps=1e-7): # compute SI...
[ "numpy.sqrt" ]
[((802, 816), 'numpy.sqrt', 'np.sqrt', (['descs'], {}), '(descs)\n', (809, 816), True, 'import numpy as np\n')]
#!/bin/usr/env python from adpred import ADpred import sys import numpy as np HELP = ''' using adpred version {} list of arguments ----------------- -h | --help -id | --uniprot-id -s | --sequence -l | --local-psipred <path_to_"run_psipred"> -...
[ "sys.stderr.write", "numpy.arange", "numpy.ones", "adpred.ADpred.protein" ]
[((2423, 2488), 'sys.stderr.write', 'sys.stderr.write', (['"""calculating secondary structure and adpred..."""'], {}), "('calculating secondary structure and adpred...')\n", (2439, 2488), False, 'import sys\n'), ((2185, 2211), 'adpred.ADpred.protein', 'ADpred.protein', ([], {'prot_id': 'Id'}), '(prot_id=Id)\n', (2199, ...
""" ============================ Trade Strategy ============================ A class that holds information pertaining to the trade strategy and makes use of the given CryptoSignals Author: <NAME> GitHub: gbledt Version: 0.1 TODO: - All of it """ import numpy as np import datetime from TextColors import ...
[ "numpy.mean", "numpy.array" ]
[((6341, 6361), 'numpy.array', 'np.array', (['coin.H_vec'], {}), '(coin.H_vec)\n', (6349, 6361), True, 'import numpy as np\n'), ((6362, 6382), 'numpy.array', 'np.array', (['coin.L_vec'], {}), '(coin.L_vec)\n', (6370, 6382), True, 'import numpy as np\n'), ((7332, 7352), 'numpy.array', 'np.array', (['coin.H_vec'], {}), '...
import torch import numpy as np from model.stg2_generator import Generator from model.stg2_discriminator import Discriminator if __name__ == "__main__": from my_utils.graph_writer import graph_writer img_size = 256 generator = Generator(img_size, 512, 8, channel_multiplier=2) # from my_utils.print_m...
[ "model.stg2_generator.Generator", "torch.zeros", "model.stg2_discriminator.Discriminator", "numpy.prod" ]
[((242, 291), 'model.stg2_generator.Generator', 'Generator', (['img_size', '(512)', '(8)'], {'channel_multiplier': '(2)'}), '(img_size, 512, 8, channel_multiplier=2)\n', (251, 291), False, 'from model.stg2_generator import Generator\n'), ((824, 869), 'model.stg2_discriminator.Discriminator', 'Discriminator', (['img_siz...
import argparse import os import numpy as np from scipy import sparse import pickle import timeit class PBGENA(object): def __init__(self,graph,p,N,alpha,b_t,b_a,l_t=1,l_a=1,f_t=2,f_a=2,f=1): print('\nSetting up PBGENA...') assert os.path.isdir('../../Datasets/'+graph),'Folder for {0} netwo...
[ "numpy.load", "numpy.save", "os.remove", "argparse.ArgumentParser", "os.path.isdir", "scipy.sparse.load_npz", "timeit.default_timer", "os.path.isfile", "numpy.arange", "numpy.array", "numpy.delete" ]
[((4901, 4946), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PBGENA"""'}), "(description='PBGENA')\n", (4924, 4946), False, 'import argparse\n'), ((260, 300), 'os.path.isdir', 'os.path.isdir', (["('../../Datasets/' + graph)"], {}), "('../../Datasets/' + graph)\n", (273, 300), False, 'i...
# Author: <NAME>, 2019 # License: BSD from itertools import product import numpy as np def _vectorize(func, theta): theta = np.array(theta) flat = len(theta.shape) == 1 if flat: return func(theta) else: n_samples = theta.shape[0] ret = [func(theta[i]) for i in range(n_sample...
[ "numpy.sum", "numpy.maximum", "numpy.abs", "numpy.ravel", "numpy.argmax", "numpy.ones", "numpy.argsort", "numpy.arange", "numpy.exp", "ot.NegEntropy", "ot.get_plan_from_semi_dual", "simplex.constrained_softmax", "numpy.zeros_like", "numpy.max", "itertools.product", "ot.SquaredL2", "s...
[((132, 147), 'numpy.array', 'np.array', (['theta'], {}), '(theta)\n', (140, 147), True, 'import numpy as np\n'), ((339, 352), 'numpy.array', 'np.array', (['ret'], {}), '(ret)\n', (347, 352), True, 'import numpy as np\n'), ((2611, 2626), 'numpy.array', 'np.array', (['theta'], {}), '(theta)\n', (2619, 2626), True, 'impo...
# coding: utf-8 import matplotlib.pyplot as plt import numpy as np img_1=plt.imread("test_1.jpg") img_1.ndim img_1.shape img_2=img_1[1:1080:2,1:1920:2] img_2.ndim,img_2.shape plt.imshow(img_2) plt.show() img_2 plt.imshow(img_1,plt.cm.gray) plt.show() img_3=np.zeros((img_2.shape[0:2])) img_3.shape img_4=np.zeros((img...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "matplotlib.pyplot.imread" ]
[((74, 98), 'matplotlib.pyplot.imread', 'plt.imread', (['"""test_1.jpg"""'], {}), "('test_1.jpg')\n", (84, 98), True, 'import matplotlib.pyplot as plt\n'), ((176, 193), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img_2'], {}), '(img_2)\n', (186, 193), True, 'import matplotlib.pyplot as plt\n'), ((194, 204), 'matplotli...
from tqdm import tqdm import numpy as np # For featurizer import itertools from matplotlib import pyplot as plt from sklearn import decomposition from time import time from sklearn.preprocessing import StandardScaler class Featurizer(): def __init__(self, data, n_components=9): ''' Takes a length-...
[ "numpy.stack", "matplotlib.pyplot.subplot", "sklearn.decomposition.FastICA", "sklearn.preprocessing.StandardScaler", "numpy.ceil", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.yticks", "time.time", "matplotlib.pyplot.figure", "sklearn.decomposition.FactorAnalysis", "sklearn.decomposition.PCA...
[((1570, 1602), 'numpy.stack', 'np.stack', (['self._raw_data'], {'axis': '(0)'}), '(self._raw_data, axis=0)\n', (1578, 1602), True, 'import numpy as np\n'), ((1809, 1825), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (1823, 1825), False, 'from sklearn.preprocessing import StandardScaler\n...
import cv2 import numpy as np import tensorflow as tf from keras.layers import Dense, Conv2D, Dropout, Flatten, MaxPooling2D from keras.models import Sequential from keras_preprocessing.image import ImageDataGenerator mnist = tf.keras.datasets.mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() cv2.imsho...
[ "cv2.waitKey", "keras.layers.Dropout", "keras.layers.Flatten", "numpy.ones", "keras_preprocessing.image.ImageDataGenerator", "keras.layers.Dense", "keras.layers.Conv2D", "keras.models.Sequential", "cv2.imshow", "keras.layers.MaxPooling2D" ]
[((311, 341), 'cv2.imshow', 'cv2.imshow', (['"""out3"""', 'x_train[4]'], {}), "('out3', x_train[4])\n", (321, 341), False, 'import cv2\n'), ((341, 355), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (352, 355), False, 'import cv2\n'), ((572, 602), 'cv2.imshow', 'cv2.imshow', (['"""out3"""', 'x_train[4]'], {}), ...
# -*- coding: utf-8 -*- import logging import numpy as np import torch as th import torch.nn as nn from leibniz.nn.conv import DepthwiseSeparableConv1d, DepthwiseSeparableConv2d, DepthwiseSeparableConv3d from leibniz.nn.layer.hyperbolic import Bottleneck logger = logging.getLogger() logger.setLevel(logging.INFO) ...
[ "torch.ones_like", "torch.nn.BatchNorm3d", "torch.nn.ReLU", "torch.nn.ReLU6", "torch.nn.Tanh", "numpy.power", "torch.nn.BatchNorm1d", "torch.cos", "leibniz.nn.layer.hyperbolic.Bottleneck", "torch.nn.BatchNorm2d", "numpy.array", "torch.nn.Softmax", "torch.sin", "logging.getLogger", "torch...
[((268, 287), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (285, 287), False, 'import logging\n'), ((545, 576), 'numpy.array', 'np.array', (['spatial'], {'dtype': 'np.int'}), '(spatial, dtype=np.int)\n', (553, 576), True, 'import numpy as np\n'), ((648, 666), 'numpy.power', 'np.power', (['(2)', 'ratio'],...
import json import pickle import numpy as np from bedrock_client.bedrock.model import BaseModel from typing import Any, AnyStr, BinaryIO, List, Mapping, Optional, Union # Ordered list of model features FEATURES = [ 'LIMIT_BAL', 'SEX', 'EDUCATION', 'MARRIAGE', 'AGE', 'PAY_1', 'PAY_2', ...
[ "pickle.load", "numpy.array", "json.loads" ]
[((1071, 1092), 'json.loads', 'json.loads', (['http_body'], {}), '(http_body)\n', (1081, 1092), False, 'import json\n'), ((696, 710), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (707, 710), False, 'import pickle\n'), ((1295, 1313), 'numpy.array', 'np.array', (['features'], {}), '(features)\n', (1303, 1313), Tru...
######################### perform optimization ############################## import torch from scipy.optimize import minimize import numpy as np import time import sys import os sys.path.append(os.path.abspath("../IO")) from import_export_vtk import export_momenta from keops_utils import TestCuda import pickle pa...
[ "numpy.stack", "os.mkdir", "os.path.abspath", "pickle.dump", "numpy.hstack", "time.time", "keops_utils.TestCuda", "torch.optim.LBFGS", "torch.from_numpy" ]
[((503, 513), 'keops_utils.TestCuda', 'TestCuda', ([], {}), '()\n', (511, 513), False, 'from keops_utils import TestCuda\n'), ((197, 221), 'os.path.abspath', 'os.path.abspath', (['"""../IO"""'], {}), "('../IO')\n", (212, 221), False, 'import os\n'), ((1414, 1468), 'torch.optim.LBFGS', 'torch.optim.LBFGS', (['[p0]'], {'...
import numpy as np class Task(object): def __init__(self, bullet_client, offset=(0, 0, 0), max_steps=100, parameter_distributions=None, gravity=(0, 0, 0)): if parameter_distributions is None: parameter_distri...
[ "numpy.random.normal" ]
[((1171, 1198), 'numpy.random.normal', 'np.random.normal', (['mean', 'std'], {}), '(mean, std)\n', (1187, 1198), True, 'import numpy as np\n')]
""" desitarget.targets ================== Presumably this defines targets. .. _`DocDB 2348`: https://desi.lbl.gov/DocDB/cgi-bin/private/RetrieveFile?docid=2348 """ import numpy as np import healpy as hp import numpy.lib.recfunctions as rfn from importlib import import_module from astropy.table import Table from des...
[ "numpy.maximum", "numpy.sum", "healpy.ang2pix", "desitarget.targetmask.scnd_mask.names", "numpy.int8", "desiutil.log.get_logger", "desitarget.io.desitarget_resolve_dec", "numpy.degrees", "desitarget.targetmask.bgs_mask.names", "desitarget.geomask.is_in_gal_box", "desitarget.io.release_to_photsys...
[((564, 576), 'desiutil.log.get_logger', 'get_logger', ([], {}), '()\n', (574, 576), False, 'from desiutil.log import get_logger\n'), ((3475, 3496), 'desitarget.targetmask.targetid_mask.names', 'targetid_mask.names', ([], {}), '()\n', (3494, 3496), False, 'from desitarget.targetmask import scnd_mask, targetid_mask\n'),...
# -*- coding: utf-8 -*- """Benchmark performance of different Minhash implementations. Results: minhash_ref : 6187.46 ms runtime minhash_ref_opt : 3317.13 ms runtime minhash_ref_np : 614.44 ms runtime minhash_ref_numba : 86.77 ms runtime minhash_xor_192 : 11.97 ms runtime minhash_ref_192 : 131.68 ms ru...
[ "numpy.uint32", "numpy.uint64", "numpy.bitwise_xor", "numpy.ones", "iscc_bench.utils.load_text_file", "statistics.variance", "numpy.full", "xxhash.xxh64_intdigest", "numpy.random.RandomState", "xxhash.xxh32_intdigest", "iscc_bench.algos.slide.sliding_window", "numpy.minimum", "iscc_bench.rea...
[((970, 1000), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': '(28)'}), '(seed=28)\n', (991, 1000), True, 'import numpy as np\n'), ((2729, 2822), 'numpy.array', 'np.array', (['[MINHASH_PERMUTATIONS[0][:128], MINHASH_PERMUTATIONS[1][:128]]'], {'dtype': 'np.uint64'}), '([MINHASH_PERMUTATIONS[0][:128],...
import datetime import logging import MySQLdb as mysql import numpy as np from api.infrastructure.mysql import connection logger = logging.getLogger(__name__) def getInsights(username='username', account='all', raw=False, local=False): ''' Reads result's database, manipulate the data and returns it. ''' ...
[ "logging.debug", "MySQLdb.connect", "json.dumps", "datetime.datetime", "api.infrastructure.mysql.connection.MySQLConnection", "datetime.datetime.now", "logging.getLogger", "numpy.busday_count" ]
[((134, 161), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (151, 161), False, 'import logging\n'), ((17917, 17940), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (17938, 17940), False, 'import datetime\n'), ((17951, 18005), 'datetime.datetime', 'datetime.datetime',...
import autoarray as aa import numpy as np import pytest class TestWTildeImaging: def test__w_tilde_imaging_from(self): noise_map_2d = np.array( [ [0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 2.0, 0.0], [0.0, 2.0, 4.0, 0.0], [0.0...
[ "autoarray.util.linear_eqn.curvature_matrix_preload_from", "autoarray.util.mapper.data_slim_to_pixelization_unique_from", "autoarray.Mask2D.circular", "autoarray.util.linear_eqn.w_tilde_curvature_preload_imaging_from", "autoarray.util.linear_eqn.mapped_reconstructed_data_via_mapping_matrix_from", "autoarr...
[((157, 259), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 2.0, 0.0], [0.0, 2.0, 4.0, 0.0], [0.0, \n 0.0, 0.0, 0.0]]'], {}), '([[0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 2.0, 0.0], [0.0, 2.0, 4.0, 0.0],\n [0.0, 0.0, 0.0, 0.0]])\n', (165, 259), True, 'import numpy as np\n'), ((384, 445), 'numpy.array', '...
import os import math import numpy as np from common.realtime import sec_since_boot, DT_MDL from common.numpy_fast import interp from selfdrive.swaglog import cloudlog from selfdrive.controls.lib.lateral_mpc import libmpc_py from selfdrive.controls.lib.drive_helpers import MPC_COST_LAT, MPC_N, CAR_ROTATION_RADIUS from ...
[ "math.isnan", "common.params.Params", "selfdrive.controls.lib.lane_planner.LanePlanner", "math.radians", "common.numpy_fast.interp", "numpy.zeros", "selfdrive.controls.lib.lateral_mpc.libmpc_py.ffi.new", "common.realtime.sec_since_boot", "os.environ.get", "numpy.arange", "numpy.array", "numpy....
[((652, 684), 'os.environ.get', 'os.environ.get', (['"""LOG_MPC"""', '(False)'], {}), "('LOG_MPC', False)\n", (666, 684), False, 'import os\n'), ((1755, 1768), 'selfdrive.controls.lib.lane_planner.LanePlanner', 'LanePlanner', ([], {}), '()\n', (1766, 1768), False, 'from selfdrive.controls.lib.lane_planner import LanePl...
import numpy as np def softmax_loss_naive(W, X, y, reg): """ Softmax loss function, naive implementation (with loops) Inputs have dimension D, there are C classes, and we operate on minibatches of N examples. Inputs: - W: A numpy array of shape (D, C) containing weights. - X: A numpy arr...
[ "numpy.zeros_like", "numpy.sum", "numpy.zeros", "numpy.max", "numpy.arange", "numpy.exp" ]
[((743, 759), 'numpy.zeros_like', 'np.zeros_like', (['W'], {}), '(W)\n', (756, 759), True, 'import numpy as np\n'), ((2281, 2297), 'numpy.zeros_like', 'np.zeros_like', (['W'], {}), '(W)\n', (2294, 2297), True, 'import numpy as np\n'), ((3000, 3021), 'numpy.exp', 'np.exp', (['stable_scores'], {}), '(stable_scores)\n', (...
import matplotlib.pyplot as plt import numpy as np import pandas as pd path = '/Users/mac/Downloads/frametest/csv/Coming.Home/' df = pd.read_csv(path + 'palette_array_cr.csv') percentage = np.array(df.loc[:, 'percentage1'].fillna(1.)) c = df.hex1.fillna('#000000') # percentage = np.array(df.loc[:, 'percentage1']) #...
[ "numpy.sum", "matplotlib.pyplot.ylim", "pandas.read_csv", "matplotlib.pyplot.yticks", "matplotlib.pyplot.xticks", "matplotlib.pyplot.savefig" ]
[((135, 177), 'pandas.read_csv', 'pd.read_csv', (["(path + 'palette_array_cr.csv')"], {}), "(path + 'palette_array_cr.csv')\n", (146, 177), True, 'import pandas as pd\n'), ((890, 910), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(0, 0.475)'], {}), '((0, 0.475))\n', (898, 910), True, 'import matplotlib.pyplot as plt\n'), (...
# coding: utf-8 """ Defines the DEQATN class and sub-functions. The capitalization of the sub-functions is important. """ from __future__ import annotations from typing import TYPE_CHECKING import numpy as np from numpy import ( cos, sin, tan, log, log10, mean, exp, sqrt, square, mod, abs, sum, arcsin as asin...
[ "numpy.log", "numpy.square", "pyNastran.bdf.cards.deqatn.lines_to_eqs", "numpy.mean", "numpy.linalg.norm" ]
[((851, 861), 'numpy.linalg.norm', 'norm', (['args'], {}), '(args)\n', (855, 861), False, 'from numpy.linalg import norm\n'), ((908, 921), 'numpy.mean', 'np.mean', (['args'], {}), '(args)\n', (915, 921), True, 'import numpy as np\n'), ((1049, 1063), 'numpy.log', 'np.log', (['(y ** x)'], {}), '(y ** x)\n', (1055, 1063),...
import matplotlib.pyplot as plt import numpy as np y = np.array([35, 25, 25, 15]) mylabels = ["Apples 35%", "Bananas 25%", "Cherries 25%", "Dates 15%"] mycolors = ["black", "hotpink", "b", "#4CAF50"] plt.pie(y, labels = mylabels, colors = mycolors) plt.show()
[ "matplotlib.pyplot.pie", "numpy.array", "matplotlib.pyplot.show" ]
[((56, 82), 'numpy.array', 'np.array', (['[35, 25, 25, 15]'], {}), '([35, 25, 25, 15])\n', (64, 82), True, 'import numpy as np\n'), ((202, 246), 'matplotlib.pyplot.pie', 'plt.pie', (['y'], {'labels': 'mylabels', 'colors': 'mycolors'}), '(y, labels=mylabels, colors=mycolors)\n', (209, 246), True, 'import matplotlib.pypl...
#!/usr/bin/env python """ GUI Frame for XRF display, reading larch MCA group """ import sys import os import time import copy from functools import partial import wx import wx.lib.mixins.inspection import wx.lib.scrolledpanel as scrolled import wx.dataview as dv import wx.lib.colourselect as csel try: from wx._...
[ "wx.Menu", "wxutils.Check", "wxutils.SimpleText", "wx.ToggleButton", "numpy.ones", "wx.GridBagSizer", "wx.CallAfter", "wxutils.FileSave", "numpy.arange", "os.path.join", "wx.Colour", "wx.App.__init__", "wxutils.Choice", "wx.Panel", "wxutils.pack", "wx.ListBox", "wx.TextCtrl", "wx.d...
[((1714, 1783), 'wxutils.SimpleText', 'SimpleText', (['panel', 'label'], {'size': '(size, -1)', 'colour': 'colour', 'style': 'style'}), '(panel, label, size=(size, -1), colour=colour, style=style)\n', (1724, 1783), False, 'from wxutils import SimpleText, EditableListBox, Font, pack, Popup, get_icon, SetTip, Button, Che...
# Lint as: python2, python3 # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
[ "platform.python_implementation", "ctypes.pydll.LoadLibrary", "tflite_runtime.interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromBuffer", "tensorflow.python.util.tf_export.tf_export", "sys.getrefcount", "numpy.array", "ctypes.CFUNCTYPE", "tflite_runtime.interpreter_wrapper.InterpreterWrapper_C...
[((5313, 5358), 'tensorflow.python.util.tf_export.tf_export', '_tf_export', (['"""lite.experimental.load_delegate"""'], {}), "('lite.experimental.load_delegate')\n", (5323, 5358), True, 'from tensorflow.python.util.tf_export import tf_export as _tf_export\n'), ((6357, 6387), 'tensorflow.python.util.tf_export.tf_export'...
# Importing Libraries import cv2 import numpy as np from matplotlib import pyplot as plt #Capturing video cap = cv2.VideoCapture(0) while True: _,frame = cap.read() img_size = 680 # Plotting four circles on the video of the object you want to see the transformation of. cv2.circle(frame,(143,...
[ "cv2.warpPerspective", "cv2.circle", "cv2.HoughCircles", "cv2.bitwise_and", "cv2.medianBlur", "cv2.getPerspectiveTransform", "cv2.cvtColor", "numpy.float32", "cv2.destroyAllWindows", "cv2.waitKey", "cv2.VideoCapture", "numpy.array", "cv2.rectangle", "numpy.round", "cv2.imshow", "cv2.in...
[((114, 133), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (130, 133), False, 'import cv2\n'), ((298, 346), 'cv2.circle', 'cv2.circle', (['frame', '(143, 93)', '(5)', '(0, 0, 255)', '(-5)'], {}), '(frame, (143, 93), 5, (0, 0, 255), -5)\n', (308, 346), False, 'import cv2\n'), ((345, 393), 'cv2.circle'...
import tensorflow as tf import numpy as np ################################################################################## # Initialization ################################################################################## # Xavier : tf.contrib.layers.xavier_initializer() # He : tf.contrib.layers.variance_scaling_...
[ "tensorflow.nn.batch_normalization", "tensorflow.reduce_sum", "tensorflow.image.resize_nearest_neighbor", "tensorflow.contrib.layers.l2_regularizer", "tensorflow.clip_by_value", "tensorflow.constant_initializer", "tensorflow.reshape", "tensorflow.nn.l2_normalize", "tensorflow.zeros_like", "tensorf...
[((907, 961), 'tensorflow.truncated_normal_initializer', 'tf.truncated_normal_initializer', ([], {'mean': '(0.0)', 'stddev': '(0.02)'}), '(mean=0.0, stddev=0.02)\n', (938, 961), True, 'import tensorflow as tf\n'), ((983, 1023), 'tensorflow.contrib.layers.l2_regularizer', 'tf.contrib.layers.l2_regularizer', (['(0.0001)'...
### # A simple polarising michelson inteferometer model. # # This script produces Figure 5 in "Polarisation-sensitive transfer matrix # modelling for displacement measuring interferometry", <NAME>, <NAME>, # <NAME> and <NAME>. # # Last updated by <NAME>, 24/03/2020. ### import numpy as np import matplotlib a...
[ "pyctmm.create_stack", "matplotlib.pyplot.show", "pyctmm.set_d", "numpy.empty", "pyctmm.set_ind", "matplotlib.pyplot.figure", "numpy.linspace", "strapy.Model", "matplotlib.pyplot.tight_layout", "numpy.sqrt" ]
[((406, 416), 'strapy.Model', 'ts.Model', ([], {}), '()\n', (414, 416), True, 'import strapy as ts\n'), ((2918, 2961), 'pyctmm.create_stack', 'pyctmm.create_stack', (['(2)', 'model.wavelength', '(0)'], {}), '(2, model.wavelength, 0)\n', (2937, 2961), False, 'import pyctmm\n'), ((2962, 2992), 'pyctmm.set_ind', 'pyctmm.s...