code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ # SPDX-FileCopyrightText: 2021 <NAME> # SPDX-License-Identifier: MIT # FIXME temporary workaround for newest Intel architectures import os os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE" from simpa.utils.path_manager import PathManager import nu...
[ "matplotlib.pyplot.title", "numpy.load", "os.remove", "numpy.random.seed", "matplotlib.pyplot.suptitle", "simpa.utils.path_manager.PathManager", "numpy.shape", "matplotlib.pyplot.figure", "numpy.rot90", "simpa.ModelBasedVolumeCreationAdapter", "matplotlib.pyplot.close", "simpa.core.simulation....
[((1488, 1501), 'simpa.utils.path_manager.PathManager', 'PathManager', ([], {}), '()\n', (1499, 1501), False, 'from simpa.utils.path_manager import PathManager\n'), ((1779, 1811), 'numpy.random.seed', 'np.random.seed', (['self.RANDOM_SEED'], {}), '(self.RANDOM_SEED)\n', (1793, 1811), True, 'import numpy as np\n'), ((24...
#!/usr/bin/env python import os import numpy as np import codecs from scipy.optimize import curve_fit from scipy.interpolate import interp1d import matplotlib.pyplot as plt from collections import defaultdict import thepipe as tp import h5py from .tools import ( gaussian, calculate_charges, bin_data, c...
[ "os.mkdir", "h5py.File", "numpy.sum", "numpy.argmax", "os.path.basename", "matplotlib.pyplot.close", "numpy.allclose", "scipy.optimize.curve_fit", "collections.defaultdict", "numpy.min", "numpy.mean", "numpy.array", "numpy.linspace", "scipy.interpolate.interp1d", "matplotlib.pyplot.subpl...
[((1417, 1461), 'scipy.interpolate.interp1d', 'interp1d', (['phd_qe[0]', 'phd_qe[1]'], {'kind': '"""cubic"""'}), "(phd_qe[0], phd_qe[1], kind='cubic')\n", (1425, 1461), False, 'from scipy.interpolate import interp1d\n'), ((1725, 1752), 'numpy.allclose', 'np.allclose', (['wl_pmt', 'wl_phd'], {}), '(wl_pmt, wl_phd)\n', (...
from __future__ import print_function import numpy as np import regreg.api as rr from ...tests.flags import SMALL_SAMPLES from selection.api import (randomization, split_glm_group_lasso) from ...tests.instance import logistic_instance from ...tests.decorators import (wait_for_return_value...
[ "numpy.sum", "numpy.random.binomial", "selection.api.split_glm_group_lasso", "numpy.zeros", "numpy.ones", "numpy.nonzero", "regreg.api.glm.logistic", "numpy.where", "numpy.arange", "numpy.diag" ]
[((1176, 1197), 'regreg.api.glm.logistic', 'rr.glm.logistic', (['X', 'y'], {}), '(X, y)\n', (1191, 1197), True, 'import regreg.api as rr\n'), ((1548, 1596), 'selection.api.split_glm_group_lasso', 'split_glm_group_lasso', (['loss', 'epsilon', 'm', 'penalty'], {}), '(loss, epsilon, m, penalty)\n', (1569, 1596), False, 'f...
import tiledb import concurrent.futures import progressbar import numpy from pathlib import Path import pandas array_uri = "/data/test/nyc_yellow_taxi_tiledb" header_2016_2020 = [ "VendorID", "tpep_pickup_datetime", "tpep_dropoff_datetime", "passenger_count", "trip_distance", "RatecodeID", ...
[ "tiledb.from_pandas", "numpy.datetime64", "progressbar.progressbar", "tiledb.Array.create", "tiledb.VFS", "pathlib.Path", "tiledb.ZstdFilter", "numpy.float64", "tiledb.FileIO" ]
[((1769, 1781), 'tiledb.VFS', 'tiledb.VFS', ([], {}), '()\n', (1779, 1781), False, 'import tiledb\n'), ((1797, 1836), 'tiledb.FileIO', 'tiledb.FileIO', (['vfs', 'csv_file'], {'mode': '"""rb"""'}), "(vfs, csv_file, mode='rb')\n", (1810, 1836), False, 'import tiledb\n'), ((2274, 2293), 'numpy.float64', 'numpy.float64', (...
#!/usr/bin/env python # coding=utf-8 """ Script to analyse domestic hot water profiles. Based on Annex 42 Substask A --> Assumtion for Germany: Around 64 Liters hot water per occupant and day (35 Kelvin temperatur split) --> 2.6 kWh / person and day Based on Canadian survey http://www.sciencedirect.com/science/articl...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.subplot", "pycity_base.functions.changeResolution.changeResolution", "pycity_calc.environments.timer.TimerExtended", "numpy.sum", "pycity_base.classes.demand.DomesticHotWater.DomesticHotWater", "numpy.argmax", "matplotlib.pyplot.show", "pycity_calc.toolbo...
[((1779, 1827), 'pycity_calc.environments.timer.TimerExtended', 'time.TimerExtended', ([], {'timestep': 'timestep', 'year': 'year'}), '(timestep=timestep, year=year)\n', (1797, 1827), True, 'import pycity_calc.environments.timer as time\n'), ((1874, 1947), 'pycity_base.classes.Weather.Weather', 'Weather.Weather', (['ti...
import numpy as np import os import matplotlib.pyplot as plt from sklearn.manifold import TSNE checkpoint_dir='' # folder where checkpoints and qn/passage tokens were saved embs_dir='' # folder where embeddings are stored # TSNE plt.rcParams.update({'font.size': 15}) ds=[] for i in range(12) : d=np.load(embs_dir+'/...
[ "numpy.load", "matplotlib.pyplot.annotate", "sklearn.manifold.TSNE", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "matplotlib.pyplot.rcParams.update", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.cm.get_cmap" ]
[((231, 269), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 15}"], {}), "({'font.size': 15})\n", (250, 269), True, 'import matplotlib.pyplot as plt\n'), ((437, 529), 'numpy.load', 'np.load', (["(checkpoint_dir + '/qn_and_doc_tokens.npy')"], {'encoding': '"""latin1"""', 'allow_pickle': '(T...
import numpy as np import torch from torch.utils.data import DataLoader import pytorch_lightning as pl from transformers import ( AdamW, get_linear_schedule_with_warmup, ) #emb_sz_rule from fastai: https://github.com/fastai/fastai/blob/master/fastai/tabular/data.py def emb_sz_rule(n_cat:int)->int: return min(...
[ "torch.nn.Dropout", "numpy.stack", "torch.nn.MSELoss", "torch.nn.BCEWithLogitsLoss", "torch.utils.data.DataLoader", "torch.cat", "transformers.get_linear_schedule_with_warmup", "transformers.AdamW", "torch.nn.Linear" ]
[((978, 1017), 'torch.nn.Dropout', 'torch.nn.Dropout', (['self.hparams.emb_drop'], {}), '(self.hparams.emb_drop)\n', (994, 1017), False, 'import torch\n'), ((1335, 1353), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (1351, 1353), False, 'import torch\n'), ((1496, 1515), 'torch.cat', 'torch.cat', (['cat_x',...
# import the necessary packages from keras.preprocessing.image import img_to_array from keras.models import load_model import numpy as np import imutils import pickle import cv2 import os import matplotlib.pyplot as plt image_path = os.path.join("..", "sample.png") model_path = os.path.join("..", "models" , "plant_dis...
[ "keras.models.load_model", "cv2.putText", "numpy.argmax", "cv2.waitKey", "cv2.destroyAllWindows", "numpy.expand_dims", "cv2.imread", "keras.preprocessing.image.img_to_array", "numpy.max", "cv2.imshow", "os.path.join", "cv2.resize" ]
[((234, 266), 'os.path.join', 'os.path.join', (['""".."""', '"""sample.png"""'], {}), "('..', 'sample.png')\n", (246, 266), False, 'import os\n'), ((280, 331), 'os.path.join', 'os.path.join', (['""".."""', '"""models"""', '"""plant_disease.model"""'], {}), "('..', 'models', 'plant_disease.model')\n", (292, 331), False,...
import numpy as np from sklearn.base import BaseEstimator from qpsolvers import solve_qp from scipy.integrate import trapz from pwass.spline import MonotoneQuadraticSplineBasis from pwass.distributions import Distribution class DistribOnDistribReg(BaseEstimator): def __init__(self, fit_intercept=True, nbasis=-1,...
[ "numpy.zeros_like", "numpy.sum", "numpy.eye", "numpy.std", "pwass.distributions.Distribution", "numpy.zeros", "numpy.ones", "numpy.mean", "numpy.kron", "numpy.matmul", "scipy.integrate.trapz", "numpy.linspace", "numpy.dot" ]
[((1016, 1056), 'numpy.zeros', 'np.zeros', (['(self.nbasis - 1, self.nbasis)'], {}), '((self.nbasis - 1, self.nbasis))\n', (1024, 1056), True, 'import numpy as np\n'), ((1210, 1238), 'numpy.zeros', 'np.zeros', (['(self.nbasis - 1,)'], {}), '((self.nbasis - 1,))\n', (1218, 1238), True, 'import numpy as np\n'), ((2257, 2...
def display_via_moviepy(images, title): """Display an animated sequence of images in the browser using moviepy.""" from moviepy.editor import ImageSequenceClip import numpy as np as_arrays = [np.array(image) for image in images] return ImageSequenceClip(as_arrays, fps=24).ipython_display()
[ "numpy.array", "moviepy.editor.ImageSequenceClip" ]
[((209, 224), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (217, 224), True, 'import numpy as np\n'), ((257, 293), 'moviepy.editor.ImageSequenceClip', 'ImageSequenceClip', (['as_arrays'], {'fps': '(24)'}), '(as_arrays, fps=24)\n', (274, 293), False, 'from moviepy.editor import ImageSequenceClip\n')]
import json import os import time import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from sklearn.model_selection import train_test_split from sklearn.utils import shuffle from tensorflow.keras.applications.inception_v3 import * from tensorflow.keras.layers import * from tensorflow.keras.losses...
[ "numpy.load", "os.remove", "tensorflow.reduce_sum", "numpy.resize", "sklearn.model_selection.train_test_split", "tensorflow.reshape", "matplotlib.pyplot.figure", "tensorflow.numpy_function", "matplotlib.pyplot.tight_layout", "tensorflow.keras.losses.SparseCategoricalCrossentropy", "os.path.abspa...
[((5864, 5884), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (5879, 5884), False, 'import os\n'), ((7536, 7583), 'sklearn.utils.shuffle', 'shuffle', (['captions', 'image_paths'], {'random_state': '(42)'}), '(captions, image_paths, random_state=42)\n', (7543, 7583), False, 'from sklearn.utils impo...
# -*- coding: utf-8 -*- """ File Name: reader Description : Author : mick.yi date: 2019/3/14 """ import numpy as np import os import glob def load_annotation(annotation_path, image_dir): """ 加载标注信息 :param annotation_path: :param image_dir: :return: ...
[ "os.path.basename", "numpy.asarray", "os.path.splitext", "os.sep.join", "os.path.split" ]
[((443, 473), 'os.path.split', 'os.path.split', (['annotation_path'], {}), '(annotation_path)\n', (456, 473), False, 'import os\n'), ((494, 521), 'os.path.splitext', 'os.path.splitext', (['base_name'], {}), '(base_name)\n', (510, 521), False, 'import os\n'), ((688, 732), 'os.sep.join', 'os.sep.join', (["[image_dir, bas...
import numpy as np import pandas as pd import os,sys,random from tqdm import tqdm from sklearn.metrics import roc_auc_score from sklearn.metrics import average_precision_score from sklearn.metrics import precision_recall_curve from sklearn.metrics import f1_score from sklearn.metrics import classification_report from...
[ "keras.models.load_model", "random.randint", "model.get_model", "keras.callbacks.ModelCheckpoint", "numpy.zeros", "sklearn.metrics.roc_auc_score", "keras.callbacks.EarlyStopping", "numpy.random.permutation", "sklearn.metrics.average_precision_score", "numpy.round", "numpy.concatenate" ]
[((5653, 5686), 'numpy.random.permutation', 'np.random.permutation', (['Y.shape[0]'], {}), '(Y.shape[0])\n', (5674, 5686), True, 'import numpy as np\n'), ((11557, 11584), 'sklearn.metrics.roc_auc_score', 'roc_auc_score', (['Y_test', 'pred'], {}), '(Y_test, pred)\n', (11570, 11584), False, 'from sklearn.metrics import r...
import numpy as np def gen_toy_data(samples, dim): rng = np.random.RandomState(37) x = rng.rand(samples, dim) y = 10 * x.dot(rng.random(dim)) + 3 * rng.rand(samples) return x, y
[ "numpy.random.RandomState" ]
[((63, 88), 'numpy.random.RandomState', 'np.random.RandomState', (['(37)'], {}), '(37)\n', (84, 88), True, 'import numpy as np\n')]
import logging from astropy import units as u import numpy as np import matplotlib.pyplot as plt from scipy import interpolate from astropy.coordinates import SkyCoord from astropy.coordinates import Angle try: from extinction import fm07 as extinction_law except ModuleNotFoundError: # Error handling pa...
[ "numpy.abs", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.sin", "numpy.mean", "scipy.interpolate.interp1d", "astropy.coordinates.Angle", "matplotlib.pyplot.tight_layout", "numpy.round", "statsmodels.api.robust.norms.HuberT", "logging.warning", "matplotlib.pyplot.close", "numpy.std", "...
[((723, 754), 'seaborn.color_palette', 'sns.color_palette', (['"""colorblind"""'], {}), "('colorblind')\n", (740, 754), True, 'import seaborn as sns\n'), ((5206, 5242), 'numpy.tan', 'np.tan', (["(data['GAL-LAT'].data * u.deg)"], {}), "(data['GAL-LAT'].data * u.deg)\n", (5212, 5242), True, 'import numpy as np\n'), ((920...
"""EmukitDesigner wraps emukit into Vizier Designer.""" import enum from typing import Optional, Sequence from absl import logging from emukit import core from emukit import model_wrappers from emukit.bayesian_optimization import acquisitions from emukit.bayesian_optimization import loops from emukit.core import init...
[ "GPy.kern.Matern52", "absl.logging.logging.getLogger", "numpy.ones", "absl.logging.info", "emukit.core.ParameterSpace", "numpy.float64", "GPy.util.linalg.pdinv", "absl.logging.exception", "vizier.pyvizier.converters.TrialToArrayConverter.from_study_config", "GPy.core.parameterization.priors.LogGau...
[((2027, 2084), 'GPy.kern.Matern52', 'kern.Matern52', (['features.shape[1]'], {'variance': '(0.04)', 'ARD': '(True)'}), '(features.shape[1], variance=0.04, ARD=True)\n', (2040, 2084), False, 'from GPy import kern\n'), ((2443, 2506), 'GPy.models.GPRegression', 'models.GPRegression', (['features', 'labels', 'kernel'], {'...
import os from matplotlib import pyplot as plt import numpy as np import seaborn as sns import torch sns.set(style='white') def stat_plot(x: np.array, y: np.array, mode: str=''): y_mean, y_std = np.transpose(np.mean(y, axis=0)), np.transpose(np.std(y, axis=0)) palette = sns.color_palette('husl', y_mean.shape[0...
[ "seaborn.lineplot", "matplotlib.pyplot.margins", "numpy.mean", "numpy.arange", "matplotlib.pyplot.tight_layout", "numpy.full_like", "matplotlib.pyplot.locator_params", "numpy.std", "matplotlib.pyplot.close", "torch.load", "matplotlib.pyplot.yticks", "matplotlib.pyplot.xticks", "seaborn.set",...
[((104, 126), 'seaborn.set', 'sns.set', ([], {'style': '"""white"""'}), "(style='white')\n", (111, 126), True, 'import seaborn as sns\n'), ((280, 322), 'seaborn.color_palette', 'sns.color_palette', (['"""husl"""', 'y_mean.shape[0]'], {}), "('husl', y_mean.shape[0])\n", (297, 322), True, 'import seaborn as sns\n'), ((72...
""" File: examples/model/multi_conditional_fit_model.py Author: <NAME> Date: 5 Oct 2020 Description: Example script showing a use of the MultiConditionalFitModel class. """ from __future__ import division import numpy as np import matplotlib.pyplot as pl from matplotlib.ticker import MultipleLocator from ...
[ "numpy.random.seed", "numpy.ones", "matplotlib.pyplot.figure", "pylinex.MultiConditionalFitModel", "numpy.isclose", "numpy.random.normal", "pylinex.LegendreBasis", "pylinex.SumModel", "distpy.DistributionSet", "numpy.linspace", "pylinex.FourierBasis", "matplotlib.ticker.MultipleLocator", "py...
[((583, 603), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (597, 603), True, 'import numpy as np\n'), ((712, 744), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', 'num_channels'], {}), '(-1, 1, num_channels)\n', (723, 744), True, 'import numpy as np\n'), ((804, 823), 'pylinex.LorentzianModel', '...
import numpy as np import sklearn sign_defaults = { "keep positive": 1, "keep negative": -1, "remove positive": -1, "remove negative": 1, "compute time": -1, "keep absolute": -1, # the absolute signs are defaults that make sense when scoring losses "remove absolute": 1, "explanation err...
[ "numpy.array" ]
[((954, 971), 'numpy.array', 'np.array', (['curve_y'], {}), '(curve_y)\n', (962, 971), True, 'import numpy as np\n')]
#!/usr/bin/env python """ tokio.timeseries.TimeSeries methods """ import datetime import random import pandas import nose import numpy import tokio from tokiotest import generate_timeseries, compare_timeseries START = datetime.datetime(2019, 5, 28, 1, 0, 0) END = datetime.datetime(2019, 5, 28, 2, 0, 0) DELTIM = date...
[ "numpy.full", "numpy.matrix", "numpy.set_printoptions", "random.shuffle", "tokiotest.compare_timeseries", "datetime.datetime", "numpy.isclose", "numpy.random.random", "datetime.timedelta", "random.seed", "numpy.random.randint", "datetime.datetime.fromtimestamp", "tokio.timeseries.timeseries_...
[((221, 260), 'datetime.datetime', 'datetime.datetime', (['(2019)', '(5)', '(28)', '(1)', '(0)', '(0)'], {}), '(2019, 5, 28, 1, 0, 0)\n', (238, 260), False, 'import datetime\n'), ((267, 306), 'datetime.datetime', 'datetime.datetime', (['(2019)', '(5)', '(28)', '(2)', '(0)', '(0)'], {}), '(2019, 5, 28, 2, 0, 0)\n', (284...
# -*- coding: utf-8 -*- """ Created on Thu Mar 02 15:59:36 2017 @author: <NAME>, <NAME> """ import math import numpy as np import h5py import inspect import dis from sklearn.model_selection import KFold import os from GUI.PyQt.DLArt_GUI import dlart import keras.backend as K def expecting(): """Return how many v...
[ "h5py.File", "os.makedirs", "os.path.isdir", "numpy.asarray", "math.floor", "numpy.transpose", "sklearn.model_selection.KFold", "numpy.where", "numpy.arange", "inspect.currentframe", "numpy.random.permutation", "numpy.delete", "numpy.unique" ]
[((361, 383), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (381, 383), False, 'import inspect\n'), ((32536, 32573), 'numpy.asarray', 'np.asarray', (['train_ref_fold'], {'dtype': '"""f"""'}), "(train_ref_fold, dtype='f')\n", (32546, 32573), True, 'import numpy as np\n'), ((32595, 32632), 'numpy.asar...
import json import os import re import shutil import numpy as np import nibabel as nb from itertools import chain from pathlib import Path from gzip import GzipFile from nipype import logging from nipype.utils.filemanip import copyfile from nipype.interfaces.base import ( BaseInterfaceInputSpec, TraitedSpec,...
[ "bids.layout.BIDSLayout.load", "numpy.isnan", "pathlib.Path", "nipype.interfaces.base.isdefined", "numpy.nanmean", "json.loads", "os.path.dirname", "os.path.exists", "nipype.interfaces.base.InputMultiPath", "nipype.interfaces.base.Directory", "nipype.interfaces.base.traits.List", "nipype.inter...
[((538, 575), 'nipype.logging.getLogger', 'logging.getLogger', (['"""nipype.interface"""'], {}), "('nipype.interface')\n", (555, 575), False, 'from nipype import logging\n'), ((1391, 1413), 'os.path.dirname', 'os.path.dirname', (['fname'], {}), '(fname)\n', (1406, 1413), False, 'import os\n'), ((1426, 1449), 'os.path.b...
# encoding: utf-8 # Created: 2021/10/13 import logging import math import os from collections import defaultdict from typing import Dict, List import numpy as np import torch import transformations import yaml try: from yaml import CLoader as Loader, CDumper as Dumper except ImportError: from yaml import Load...
[ "yaml.load", "numpy.load", "torch.eye", "src.utils.libcoord.coord_transform.apply_transform", "src.io.RasterIO.RasterReader", "src.utils.libpc.crop_pc_2d", "torch.cat", "collections.defaultdict", "numpy.arange", "os.path.join", "torch.median", "numpy.meshgrid", "transformations.reflection_ma...
[((731, 756), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0])\n', (739, 756), True, 'import numpy as np\n'), ((764, 789), 'numpy.array', 'np.array', (['[1.0, 0.0, 0.0]'], {}), '([1.0, 0.0, 0.0])\n', (772, 789), True, 'import numpy as np\n'), ((797, 822), 'numpy.array', 'np.array', (['[0.0, 1.0,...
#!/usr/bin/python #-*- coding: utf-8 -*- """ This script contains util functions """ import warnings warnings.filterwarnings('ignore') import sys import logging logger = logging.getLogger(__name__) logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) import numpy as np from os.pa...
[ "scipy.spatial.distance.cosine", "numpy.concatenate", "logging.basicConfig", "warnings.filterwarnings", "os.path.realpath", "sklearn.metrics.accuracy_score", "sklearn.metrics.euclidean_distances", "numpy.array", "numpy.loadtxt", "sys.exit", "sklearn.metrics.precision_recall_fscore_support", "l...
[((101, 134), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (124, 134), False, 'import warnings\n'), ((170, 197), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (187, 197), False, 'import logging\n'), ((198, 293), 'logging.basicConfig', 'log...
import numpy as np import itertools from copy import deepcopy from kimonet.utils import distance_vector_periodic from kimonet.utils import get_supercell_increments from kimonet.system.state import ground_state as _GS_ combinations_data = {} def distance_matrix(molecules_list, supercell, max_distance=1): # Set m...
[ "copy.deepcopy", "kimonet.system.molecule.Molecule", "kimonet.system.state.State", "numpy.ma.masked_where", "kimonet.utils.distance_vector_periodic", "itertools.combinations", "numpy.linalg.norm", "kimonet.utils.get_supercell_increments", "numpy.diag" ]
[((3586, 3630), 'itertools.combinations', 'itertools.combinations', (['molecules_list', 'size'], {}), '(molecules_list, size)\n', (3608, 3630), False, 'import itertools\n'), ((4235, 4280), 'kimonet.system.state.State', 'State', ([], {'label': '"""s1"""', 'energy': '(1.0)', 'multiplicity': '(1)'}), "(label='s1', energy=...
#%% import pandas as pd import os.path import numpy as np #%% DATA_DIR='Data' sr_1_fn = os.path.join(DATA_DIR, 'sr_1.csv') with open(sr_1_fn, encoding='cp950', errors='replace') as f: df = pd.read_csv(f, nrows=10000000, usecols=['CUST_NO', 'TXN_DESC']) #%% df.head() #%% TXN = df.TXN_DESC.str.extract(r'([^\s0-9(512...
[ "pandas.read_csv", "numpy.arange", "sklearn.neighbors.NearestNeighbors", "sklearn.decomposition.TruncatedSVD" ]
[((1191, 1221), 'sklearn.decomposition.TruncatedSVD', 'TruncatedSVD', ([], {'n_components': '(100)'}), '(n_components=100)\n', (1203, 1221), False, 'from sklearn.decomposition import TruncatedSVD\n'), ((1317, 1374), 'sklearn.neighbors.NearestNeighbors', 'NearestNeighbors', ([], {'metric': '"""correlation"""', 'algorith...
import pandas as pd import pygal from pygal.style import DefaultStyle import numpy as np from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures from iso3166 import countries from pygal.style import RotateStyle paths={'cw':'static/cases_worldwide.svg', 'ci':'stati...
[ "pygal.Pie", "pandas.date_range", "numpy.log", "pandas.read_csv", "pygal.HorizontalBar", "pygal.Line", "pygal.Bar", "sklearn.linear_model.LinearRegression", "pygal.style.RotateStyle", "numpy.array" ]
[((972, 1007), 'pandas.date_range', 'pd.date_range', (['start_date', 'end_date'], {}), '(start_date, end_date)\n', (985, 1007), True, 'import pandas as pd\n'), ((1359, 1463), 'pygal.Line', 'pygal.Line', ([], {'fill': '(True)', 'show_legend': '(True)', 'show_x_labels': '(True)', 'show_y_labels': '(True)', 'style': 'Defa...
import asyncio import sys import numpy as np import pytest import ucp async def shutdown(ep): await ep.close() @pytest.mark.asyncio async def test_server_shutdown(): """The server calls shutdown""" async def server_node(ep): msg = np.empty(10 ** 6) with pytest.raises(ucp.exceptions.UC...
[ "numpy.empty", "pytest.raises", "ucp.create_listener", "pytest.mark.skipif", "ucp.get_address", "numpy.arange" ]
[((699, 794), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(sys.version_info < (3, 7))'], {'reason': '"""test currently fails for python3.6"""'}), "(sys.version_info < (3, 7), reason=\n 'test currently fails for python3.6')\n", (717, 794), False, 'import pytest\n'), ((626, 658), 'ucp.create_listener', 'ucp.create_...
import os import random import numpy as np from scipy.ndimage import zoom from collections import defaultdict import cv2 DATA_MEAN = np.array([[[123.68, 116.779, 103.939]]]) def preprocess_img(img, input_shape): img = cv2.resize(img, input_shape) img = img - DATA_MEAN img = img[:, :, ::-1] img.astype...
[ "random.shuffle", "numpy.zeros", "os.path.exists", "scipy.ndimage.zoom", "collections.defaultdict", "numpy.array", "numpy.arange", "os.path.join", "os.listdir", "cv2.resize" ]
[((134, 174), 'numpy.array', 'np.array', (['[[[123.68, 116.779, 103.939]]]'], {}), '([[[123.68, 116.779, 103.939]]])\n', (142, 174), True, 'import numpy as np\n'), ((225, 253), 'cv2.resize', 'cv2.resize', (['img', 'input_shape'], {}), '(img, input_shape)\n', (235, 253), False, 'import cv2\n'), ((814, 831), 'collections...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import io from numpy.testing import assert_approx_equal, assert_allclose, assert_array_equal from nose.tools import assert_equal, assert_true, assert_false, assert_greater, assert_less import cv2 import cv_algorithms from cv_algorithms import Neighbours, Direction import n...
[ "cv_algorithms.Neighbours.is_southeast", "cv_algorithms.Neighbours.northwest_coords", "cv_algorithms.Neighbours.is_south", "cv_algorithms.Neighbours.is_northeast", "cv_algorithms.Neighbours.west_coords", "cv_algorithms.binary_neighbours", "cv_algorithms.Neighbours.east_coords", "cv_algorithms.Neighbou...
[((467, 500), 'numpy.zeros', 'np.zeros', (['(10, 8)'], {'dtype': 'np.uint8'}), '((10, 8), dtype=np.uint8)\n', (475, 500), True, 'import numpy as np\n'), ((613, 649), 'cv_algorithms.binary_neighbours', 'cv_algorithms.binary_neighbours', (['img'], {}), '(img)\n', (644, 649), False, 'import cv_algorithms\n'), ((684, 717),...
import numpy as np from stl import mesh # Define the 8 vertices of the cube # In total, 8 cubes must be defined, so this list will be expanded # Symbols will subsitute for the numbers here. The symbols will pick # numbers from the 4 dimensional points in the input cube. # the input file to the program merely co...
[ "numpy.zeros", "numpy.array" ]
[((468, 583), 'numpy.array', 'np.array', (['[[0, 0, 0], [+1, 0, 0], [+1, +1, 0], [0, +1, 0], [0, 0, +1], [+1, 0, +1], [\n +1, +1, +1], [0, +1, +1]]'], {}), '([[0, 0, 0], [+1, 0, 0], [+1, +1, 0], [0, +1, 0], [0, 0, +1], [+1, \n 0, +1], [+1, +1, +1], [0, +1, +1]])\n', (476, 583), True, 'import numpy as np\n'), ((82...
import logging import numpy as np from pextant.lib.geoshapely import GeoPolygon import pandas as pd logger = logging.getLogger() class TraversePath: def __init__(self, geopolygon, z, x,y,em=None, derived=None): self.geopolygon = geopolygon self.z = z self.x = x self.y = y s...
[ "matplotlib.pyplot.title", "numpy.arctan2", "numpy.empty", "numpy.sin", "numpy.degrees", "numpy.linspace", "numpy.piecewise", "matplotlib.pyplot.show", "pandas.DataFrame.from_dict", "numpy.ones_like", "numpy.square", "numpy.cos", "pextant.lib.geoshapely.GeoPolygon", "matplotlib.pyplot.ylab...
[((110, 129), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (127, 129), False, 'import logging\n'), ((11568, 11593), 'numpy.linspace', 'np.linspace', (['(-25)', '(25)', '(100)'], {}), '(-25, 25, 100)\n', (11579, 11593), True, 'import numpy as np\n'), ((11700, 11721), 'matplotlib.pyplot.plot', 'plt.plot', ...
import numpy as np __all__ = ['nd_pad', 'images_to_grid', 'grid_ground_truth'] def nd_pad(img: np.ndarray, pad_width: int, pad_value: float): w, h, c = img.shape w += 2 * pad_width h += 2 * pad_width padded_img = np.zeros((w, h, c), dtype='float32') for i in range(c): padded_img[...,...
[ "numpy.pad", "numpy.zeros", "numpy.ones" ]
[((235, 271), 'numpy.zeros', 'np.zeros', (['(w, h, c)'], {'dtype': '"""float32"""'}), "((w, h, c), dtype='float32')\n", (243, 271), True, 'import numpy as np\n'), ((794, 825), 'numpy.ones', 'np.ones', (['shape'], {'dtype': '"""float32"""'}), "(shape, dtype='float32')\n", (801, 825), True, 'import numpy as np\n'), ((326...
import random from collections import Counter import numpy as np import sys #from DTW import DTW import FeatureExtract from sklearn import neighbors import MyEval import dill import pickle import os.path def read_expanded(fname): ''' saved array should be read one by one, change manually example...
[ "numpy.load", "numpy.ceil", "FeatureExtract.GetQRSFeature", "random.uniform", "numpy.floor", "numpy.isneginf", "dill.load", "numpy.isnan", "pickle.load", "numpy.array", "random.seed", "numpy.isposinf" ]
[((764, 776), 'numpy.load', 'np.load', (['fin'], {}), '(fin)\n', (771, 776), True, 'import numpy as np\n'), ((799, 811), 'numpy.load', 'np.load', (['fin'], {}), '(fin)\n', (806, 811), True, 'import numpy as np\n'), ((831, 843), 'numpy.load', 'np.load', (['fin'], {}), '(fin)\n', (838, 843), True, 'import numpy as np\n')...
from models.yolov3.constants import PathConstants from tensorflow.keras.models import load_model from utils.non_max_suppression import classic_non_max_suppression import time import tensorflow.keras.backend as K import numpy as np import tensorflow as tf from typing import Tuple NUM_OF_CLASSES = 601 NUM_OF_BOX_PARAMS...
[ "tensorflow.keras.backend.arange", "tensorflow.keras.models.load_model", "tensorflow.keras.backend.sigmoid", "numpy.count_nonzero", "tensorflow.keras.backend.dtype", "tensorflow.keras.backend.tile", "tensorflow.keras.backend.reshape", "tensorflow.keras.backend.shape", "tensorflow.keras.backend.learn...
[((440, 465), 'tensorflow.keras.models.load_model', 'load_model', (['path_to_model'], {}), '(path_to_model)\n', (450, 465), False, 'from tensorflow.keras.models import load_model\n'), ((512, 534), 'tensorflow.keras.backend.arange', 'K.arange', (['(0)'], {'stop': 'cols'}), '(0, stop=cols)\n', (520, 534), True, 'import t...
#!/usr/bin/env python3 from pandas_datareader import data import matplotlib.pyplot as plt import pandas as pd import datetime as dt import urllib.request, json import os import numpy as np import tensorflow as tf from sklearn.preprocessing import MinMaxScaler from keras.models import Sequential from keras.layers impor...
[ "pandas.DataFrame", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "keras.layers.LSTM", "sklearn.preprocessing.MinMaxScaler", "os.path.exists", "datetime.datetime.strptime", "keras.layers.Dense", "pandas.to_datetime", "numpy.reshape", "numpy.array", "pandas_datareader...
[((1606, 1648), 'pandas.to_datetime', 'pd.to_datetime', (['df.Date'], {'format': '"""%Y-%m-%d"""'}), "(df.Date, format='%Y-%m-%d')\n", (1620, 1648), True, 'import pandas as pd\n'), ((2087, 2121), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (2099, ...
import numpy as np from .ising import IsingModel, IsingKernel from ._paths import potts_energy, potts_sample class PottsHistogram(object): def __init__(self, L): bins = range(-2*L**2, 1) for i in range(3): del bins[1] del bins[2] self.E = np.array(bins) self....
[ "numpy.append", "numpy.ascontiguousarray", "numpy.random.randint", "numpy.array" ]
[((292, 306), 'numpy.array', 'np.array', (['bins'], {}), '(bins)\n', (300, 306), True, 'import numpy as np\n'), ((328, 369), 'numpy.append', 'np.append', (['(self.E - 0.1)', '(self.E[-1] + 0.1)'], {}), '(self.E - 0.1, self.E[-1] + 0.1)\n', (337, 369), True, 'import numpy as np\n'), ((837, 889), 'numpy.random.randint', ...
# Packages import numpy as np import pandas as pd import random random.seed(100) #~~~~~TEAM FUNCTIONS~~~~~ def get_team_data(data, teamList): """ derives probability of player being selected to take free throw, 2 pointer, or three pointer returns a data frame of team stats and respectiv...
[ "pandas.read_csv", "random.random", "numpy.where", "random.seed", "numpy.random.normal", "pandas.concat" ]
[((72, 88), 'random.seed', 'random.seed', (['(100)'], {}), '(100)\n', (83, 88), False, 'import random\n'), ((1642, 1665), 'pandas.concat', 'pd.concat', (['[df1_, df2_]'], {}), '([df1_, df2_])\n', (1651, 1665), True, 'import pandas as pd\n'), ((2158, 2185), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma'], {}...
""" Hough Circle Transform - find circles in an image function: cv2.HoughCircles() circle represented mathematically as (x - x_center)^2 + (y - y_center)^2 = r^2 (x_center, y_center) is center of circle r is radius of circle 3 parameters -> need 3D accumulator for hough transform likely ineffective OpenCV ...
[ "cv2.HoughCircles", "cv2.circle", "cv2.medianBlur", "cv2.cvtColor", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.imread", "numpy.around", "cv2.imshow" ]
[((490, 522), 'cv2.imread', 'cv2.imread', (['"""opencv_logo.png"""', '(0)'], {}), "('opencv_logo.png', 0)\n", (500, 522), False, 'import cv2\n'), ((529, 551), 'cv2.medianBlur', 'cv2.medianBlur', (['img', '(5)'], {}), '(img, 5)\n', (543, 551), False, 'import cv2\n'), ((559, 596), 'cv2.cvtColor', 'cv2.cvtColor', (['img',...
import os import glob import regex import numpy as np import pandas as pd import nibabel as nib def find_targeted_files(path): ''' Find and save files of interest. In this case, we look for short-axis nifti files. ''' patt = ['cine_short_axis', 'cine_short_axis_6MM', 'CINE_EC*_apex', 'EC_*_FIL', '...
[ "nibabel.Nifti1Image", "numpy.sum", "nibabel.load", "numpy.asarray", "os.path.dirname", "numpy.greater", "numpy.expand_dims", "nibabel.save", "numpy.argsort", "regex.sub", "pandas.Series", "os.path.join", "numpy.concatenate" ]
[((1179, 1238), 'pandas.Series', 'pd.Series', (["[im.header.structarr['qoffset_z'] for im in ims]"], {}), "([im.header.structarr['qoffset_z'] for im in ims])\n", (1188, 1238), True, 'import pandas as pd\n'), ((4400, 4443), 'nibabel.Nifti1Image', 'nib.Nifti1Image', (['newim', 'None', 'ims[0].header'], {}), '(newim, None...
import numpy as np import math from scipy.special import erfc, erfcinv def phi(input): """Phi function. :param input: Float (scalar or array) value. :returns: phi(input). """ return 0.5 * erfc(-input/np.sqrt(2)) def invphi(input): """Inverse phi function. :param...
[ "scipy.special.erfcinv", "math.log", "numpy.sqrt" ]
[((443, 463), 'scipy.special.erfcinv', 'erfcinv', (['(input / 0.5)'], {}), '(input / 0.5)\n', (450, 463), False, 'from scipy.special import erfc, erfcinv\n'), ((430, 440), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (437, 440), True, 'import numpy as np\n'), ((1370, 1381), 'math.log', 'math.log', (['e'], {}), '(e)...
""" Script calculates Eurasian snow index for October-November following the methods of Peings et al. 2017 Notes ----- Author : <NAME> Date : 22 July 2019 """ ### Import modules import datetime import numpy as np import matplotlib.pyplot as plt import read_MonthlyData as MOM import calc_Utilities as UT imp...
[ "read_Reanalysis.readDataR", "numpy.meshgrid", "numpy.where", "numpy.arange", "read_MonthlyData.readDataM", "scipy.signal.detrend", "calc_Utilities.calc_weightedAve", "datetime.datetime.now", "numpy.vstack", "numpy.nanmean" ]
[((560, 583), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (581, 583), False, 'import datetime\n'), ((906, 936), 'numpy.arange', 'np.arange', (['year1', '(year2 + 1)', '(1)'], {}), '(year1, year2 + 1, 1)\n', (915, 936), True, 'import numpy as np\n'), ((2206, 2229), 'numpy.meshgrid', 'np.meshgrid'...
# # BLAS wrappers # from warnings import warn from info import __doc__ __all__ = ['fblas','cblas','get_blas_funcs'] import fblas import cblas from numpy import deprecate _use_force_cblas = 1 if hasattr(cblas,'empty_module'): cblas = fblas _use_force_cblas = 0 elif hasattr(fblas,'empty_module'): fblas =...
[ "numpy.testing.Tester" ]
[((2166, 2174), 'numpy.testing.Tester', 'Tester', ([], {}), '()\n', (2172, 2174), False, 'from numpy.testing import Tester\n')]
import numpy as np import dataset import os btch_sz = 200 lrn_rt = 1e-1 epoch_cnt = 10 class RNN: def __init__(self, hidden_size, sequence_length, vocab_size): self.hidden_size = hidden_size self.sequence_length = sequence_length self.vocab_size = vocab_size self.U = np.random.no...
[ "numpy.zeros_like", "numpy.random.seed", "numpy.sum", "numpy.log", "dataset.Dataset", "dataset.encode", "numpy.zeros", "numpy.clip", "numpy.max", "numpy.arange", "dataset.create_minibatches", "numpy.random.normal", "dataset.next_minibatch", "numpy.dot", "os.path.join", "numpy.sqrt" ]
[((8358, 8393), 'numpy.zeros', 'np.zeros', (['(batch_size, hidden_size)'], {}), '((batch_size, hidden_size))\n', (8366, 8393), True, 'import numpy as np\n'), ((9124, 9159), 'numpy.zeros', 'np.zeros', (['(batch_size, hidden_size)'], {}), '((batch_size, hidden_size))\n', (9132, 9159), True, 'import numpy as np\n'), ((105...
# Copyright 2022 The jax3d Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
[ "numpy.random.randn", "numpy.zeros", "jax.numpy.asarray", "numpy.random.randint", "numpy.linalg.norm", "numpy.random.rand", "numpy.all" ]
[((2323, 2355), 'numpy.all', 'np.all', (['(point_cloud.points >= -1)'], {}), '(point_cloud.points >= -1)\n', (2329, 2355), True, 'import numpy as np\n'), ((2365, 2396), 'numpy.all', 'np.all', (['(point_cloud.points <= 1)'], {}), '(point_cloud.points <= 1)\n', (2371, 2396), True, 'import numpy as np\n'), ((823, 845), 'j...
# translate_doctopics.py # This script takes the doctopics file produced by MALLET and turns it # into a form that is slightly easier to read. import sys import numpy as np outrows = [] ctr = 0 split_files = dict() with open('20thdoctopics.txt', encoding = 'utf-8') as f: for line in f: fields = line.str...
[ "numpy.sum" ]
[((1280, 1304), 'numpy.sum', 'np.sum', (['volparts'], {'axis': '(0)'}), '(volparts, axis=0)\n', (1286, 1304), True, 'import numpy as np\n'), ((1338, 1353), 'numpy.sum', 'np.sum', (['allvols'], {}), '(allvols)\n', (1344, 1353), True, 'import numpy as np\n')]
import numpy as np from sklearn import preprocessing, cross_validation, neighbors import pandas as pd import serial import pickle lis=[1,2,5,6,9,10,13,14] lis1=[] j=0 #ser=serial.Serial("COM9",115200) df=pd.read_csv('Database90.txt') #df=df.apply(pd.to_numeric) data = np.array(df) np.take(data,np.random.permutation(da...
[ "sklearn.cross_validation.train_test_split", "pickle.dump", "pandas.read_csv", "sklearn.neighbors.KNeighborsClassifier", "numpy.array", "numpy.random.permutation", "numpy.delete" ]
[((204, 233), 'pandas.read_csv', 'pd.read_csv', (['"""Database90.txt"""'], {}), "('Database90.txt')\n", (215, 233), True, 'import pandas as pd\n'), ((270, 282), 'numpy.array', 'np.array', (['df'], {}), '(df)\n', (278, 282), True, 'import numpy as np\n'), ((353, 373), 'numpy.array', 'np.array', (['data[:, 0]'], {}), '(d...
import tensorflow as tf import numpy as np import logging import matplotlib.pyplot as plt import json import os import rnn from reactions import QuadraticEval, ConstraintQuadraticEval, RealReaction from logger import get_handlers from collections import namedtuple from sklearn.metrics.pairwise import euclidean_distan...
[ "pandas.DataFrame", "tensorflow.train.get_checkpoint_state", "logger.get_handlers", "os.makedirs", "tensorflow.clip_by_value", "pandas.read_csv", "tensorflow.Session", "sklearn.metrics.pairwise.euclidean_distances", "numpy.zeros", "os.path.exists", "tensorflow.placeholder", "tensorflow.global_...
[((440, 459), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (457, 459), False, 'import logging\n'), ((475, 508), 'pandas.read_csv', 'pd.read_csv', (['"""EtNH3Istateset.csv"""'], {}), "('EtNH3Istateset.csv')\n", (486, 508), True, 'import pandas as pd\n'), ((5093, 5225), 'rnn.StochasticRNNCell', 'rnn.Stocha...
import numpy as np import pandas as pd from sklearn import preprocessing from sklearn import model_selection class DataPrep(object): """ Data preparation class for pre-processing input data and post-processing generated data Variables: 1) raw_df -> dataframe containing input data 2) categori...
[ "pandas.DataFrame", "numpy.log", "sklearn.model_selection.train_test_split", "sklearn.preprocessing.LabelEncoder", "numpy.min", "numpy.exp", "numpy.round" ]
[((1714, 1822), 'sklearn.model_selection.train_test_split', 'model_selection.train_test_split', (['X_real', 'y_real'], {'test_size': 'test_ratio', 'stratify': 'y_real', 'random_state': '(42)'}), '(X_real, y_real, test_size=test_ratio,\n stratify=y_real, random_state=42)\n', (1746, 1822), False, 'from sklearn import ...
#import necessary libraries import numpy as np from scipy.sparse import csr_matrix import sys sys.path.append("/users/rohan/news-classification/ranking-featured-writing/bert-approach") import pandas as pd import torch import collections import numpy as np import os import argparse from data_processing.articles import A...
[ "sys.path.append", "json.dump", "numpy.ones_like", "argparse.ArgumentParser", "data_processing.articles.Articles", "os.path.expandvars", "pathlib.Path", "scipy.sparse.csr_matrix", "transformers.BertTokenizer.from_pretrained", "numpy.array", "data_processing.dictionaries.load_dictionaries", "nu...
[((94, 189), 'sys.path.append', 'sys.path.append', (['"""/users/rohan/news-classification/ranking-featured-writing/bert-approach"""'], {}), "(\n '/users/rohan/news-classification/ranking-featured-writing/bert-approach')\n", (109, 189), False, 'import sys\n'), ((896, 987), 'argparse.ArgumentParser', 'argparse.Argumen...
from __future__ import ( division, absolute_import, with_statement, print_function, unicode_literals, ) import torch import torch.optim as optim import torch.nn as nn from torch.autograd import Variable,Function from torch.utils.data import DataLoader from torchvision import transforms import etw_py...
[ "argparse.ArgumentParser", "numpy.argmax", "torch.argmax", "pointnet2.models.Pointnet2FaceClsSSG", "pointnet2.train.layer.MarginCosineProduct", "os.path.join", "pointnet2.data.data_utils.PointcloudJitter", "torch.utils.data.DataLoader", "numpy.reshape", "torch.nn.Linear", "torch.nn.TripletMargin...
[((775, 900), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Arguments for cls training"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Arguments for cls training',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (798, 900), False, 'imp...
import numpy as np from torch.utils.data.dataset import Dataset import torch from utils import matrix_to_pixel_frame_target from torch import nn class MyDataset(Dataset): def __init__(self, dataset): self.__dataset = dataset def __getitem__(self, index): data = self.__dataset[index] ...
[ "torch.nn.Parameter", "torch.utils.data.DataLoader", "utils.matrix_to_pixel_frame_target", "numpy.isnan", "torch.sigmoid", "numpy.array", "torch.utils.data.random_split", "torch.tensor", "torch.from_numpy" ]
[((792, 830), 'utils.matrix_to_pixel_frame_target', 'matrix_to_pixel_frame_target', (['matrix2d'], {}), '(matrix2d)\n', (820, 830), False, 'from utils import matrix_to_pixel_frame_target\n'), ((332, 360), 'numpy.array', 'np.array', (['data[0]'], {'dtype': 'int'}), '(data[0], dtype=int)\n', (340, 360), True, 'import num...
import numpy as np import numpy.linalg as la import cupy as cp src_files = [ '../../xfields/src_autogenerated/linear_interpolators_cuda.cu'] src_content = 'extern "C"{' for ff in src_files: with open(ff, 'r') as fid: src_content += ('\n\n' + fid.read()) src_content += "}" module = cp.RawModule(code=...
[ "cupy.RawModule", "numpy.ceil", "cupy.array", "numpy.zeros", "time.time", "pickle.load", "numpy.array", "numpy.int32" ]
[((302, 332), 'cupy.RawModule', 'cp.RawModule', ([], {'code': 'src_content'}), '(code=src_content)\n', (314, 332), True, 'import cupy as cp\n'), ((1094, 1117), 'cupy.array', 'cp.array', (["ddd['x_test']"], {}), "(ddd['x_test'])\n", (1102, 1117), True, 'import cupy as cp\n'), ((1126, 1149), 'cupy.array', 'cp.array', (["...
import numpy as np from scipy.optimize import leastsq from .save_and_load import save_func, load_svA, load_hvdMdh from .param_dict import split_dict, get_keys, separate_params, generate_dict_with_fixed_params, split_dict_with_fixed_params from .residuals import As_residual, dMdh_residual from .residuals import Sigma_r...
[ "numpy.argmax", "scipy.optimize.leastsq", "numpy.array", "numpy.concatenate", "numpy.sqrt" ]
[((2702, 2744), 'scipy.optimize.leastsq', 'leastsq', (['residual_func', 'params0'], {'args': 'args'}), '(residual_func, params0, args=args)\n', (2709, 2744), False, 'from scipy.optimize import leastsq\n'), ((4512, 4532), 'numpy.array', 'np.array', (['[0.8, 1.0]'], {}), '([0.8, 1.0])\n', (4520, 4532), True, 'import nump...
import numpy as np def custom_print(context, log_file, mode): #custom print and log out function if mode == 'w': fp = open(log_file, mode) fp.write(context + '\n') fp.close() elif mode == 'a+': print(context) fp = open(log_file, mode) print(context, file=fp) ...
[ "numpy.std", "numpy.mean" ]
[((506, 519), 'numpy.mean', 'np.mean', (['pred'], {}), '(pred)\n', (513, 519), True, 'import numpy as np\n'), ((709, 722), 'numpy.mean', 'np.mean', (['pred'], {}), '(pred)\n', (716, 722), True, 'import numpy as np\n'), ((725, 737), 'numpy.std', 'np.std', (['pred'], {}), '(pred)\n', (731, 737), True, 'import numpy as np...
import tensorflow as tf import numpy as np import random # from tensorflow.python.ops import rnn from tensorflow.contrib import rnn from data_preprocessing import get_audio_dataset_features_labels, get_audio_test_dataset_filenames, get_audio_test_dataset_features_labels, normalize_training_dataset, normalize_test_data...
[ "random.shuffle", "tensorflow.reshape", "data_preprocessing.normalize_test_dataset", "data_preprocessing.get_audio_test_dataset_filenames", "tensorflow.matmul", "tensorflow.nn.softmax", "tensorflow.nn.softmax_cross_entropy_with_logits", "tensorflow.placeholder", "tensorflow.cast", "data_preprocess...
[((1209, 1286), 'data_preprocessing.get_audio_dataset_features_labels', 'get_audio_dataset_features_labels', (['DATASET_PATH', 'ALLOWED_LABELS'], {'type': '"""train"""'}), "(DATASET_PATH, ALLOWED_LABELS, type='train')\n", (1242, 1286), False, 'from data_preprocessing import get_audio_dataset_features_labels, get_audio_...
import pytest import numpy as np from utils import check_q @pytest.mark.kuka def test_kuka_kr6_r900(n_attempts): from ikfast_kuka_kr6_r900 import get_fk, get_ik, get_dof, get_free_dof print('*****************\n KUKA_KR6_R900 ikfast_pybind test') n_jts = get_dof() n_free_jts = get_free_dof() assert ...
[ "numpy.radians", "ikfast_kuka_kr6_r900.get_free_dof", "ikfast_kuka_kr6_r900.get_dof", "ikfast_kuka_kr6_r900.get_fk", "utils.check_q", "numpy.random.rand" ]
[((267, 276), 'ikfast_kuka_kr6_r900.get_dof', 'get_dof', ([], {}), '()\n', (274, 276), False, 'from ikfast_kuka_kr6_r900 import get_fk, get_ik, get_dof, get_free_dof\n'), ((294, 308), 'ikfast_kuka_kr6_r900.get_free_dof', 'get_free_dof', ([], {}), '()\n', (306, 308), False, 'from ikfast_kuka_kr6_r900 import get_fk, get_...
# # Author: <NAME> # import sys import unittest import numpy as np from scipy.spatial.distance import cityblock from machine_learning.neighbours import kNN data = np.ndarray([[1, 1], [2, 3], [4, 2]]) labels = np.ndarray(['a', 'a', 'b']) class kNNTest(unittest.TestCase): def setUp(self): self.knn = kNN...
[ "unittest.main", "numpy.ndarray", "numpy.array", "machine_learning.neighbours.kNN" ]
[((167, 203), 'numpy.ndarray', 'np.ndarray', (['[[1, 1], [2, 3], [4, 2]]'], {}), '([[1, 1], [2, 3], [4, 2]])\n', (177, 203), True, 'import numpy as np\n'), ((213, 240), 'numpy.ndarray', 'np.ndarray', (["['a', 'a', 'b']"], {}), "(['a', 'a', 'b'])\n", (223, 240), True, 'import numpy as np\n'), ((2187, 2202), 'unittest.ma...
#!/usr/bin/env python # Copyright (c) 2011, <NAME>, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, thi...
[ "rospy.Subscriber", "rospy.Publisher", "rospy.Rate", "rospy.on_shutdown", "rospy.is_shutdown", "rospy.init_node", "numpy.sign", "std_msgs.msg.UInt8" ]
[((1895, 1902), 'std_msgs.msg.UInt8', 'UInt8', ([], {}), '()\n', (1900, 1902), False, 'from std_msgs.msg import UInt8\n'), ((1914, 1921), 'std_msgs.msg.UInt8', 'UInt8', ([], {}), '()\n', (1919, 1921), False, 'from std_msgs.msg import UInt8\n'), ((1933, 1940), 'std_msgs.msg.UInt8', 'UInt8', ([], {}), '()\n', (1938, 1940...
import redisAI import numpy as np from concurrent.futures import ThreadPoolExecutor executor = None def execute_model(i, transaction_tensor, reference_tensor): modelRunner = redisAI.createModelRunner('model_'+str(i)) redisAI.modelRunnerAddInput(modelRunner, 'transaction', transaction_tensor) redisAI.mode...
[ "redisAI.tensorGetDims", "redisAI.tensorGetDataAsBlob", "numpy.random.randn", "redisAI.modelRunnerAddInput", "redisAI.modelRunnerRun", "redisAI.modelRunnerAddOutput", "concurrent.futures.ThreadPoolExecutor" ]
[((228, 303), 'redisAI.modelRunnerAddInput', 'redisAI.modelRunnerAddInput', (['modelRunner', '"""transaction"""', 'transaction_tensor'], {}), "(modelRunner, 'transaction', transaction_tensor)\n", (255, 303), False, 'import redisAI\n'), ((308, 379), 'redisAI.modelRunnerAddInput', 'redisAI.modelRunnerAddInput', (['modelR...
# Copyright 2019 The Vearch 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 applicable law ...
[ "cv2.imdecode", "torchvision.models.alexnet", "torch.cuda.is_available", "numpy.linalg.norm", "torch.nn.functional.max_pool2d", "torch.tensor", "cv2.resize" ]
[((1343, 1396), 'cv2.resize', 'cv2.resize', (['image', '(self.image_size, self.image_size)'], {}), '(image, (self.image_size, self.image_size))\n', (1353, 1396), False, 'import cv2\n'), ((1877, 1912), 'torch.nn.functional.max_pool2d', 'F.max_pool2d', (['x'], {'kernel_size': '(7, 7)'}), '(x, kernel_size=(7, 7))\n', (188...
# Copyright 2021 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[ "unittest.main", "unittest.mock.MagicMock", "tensorflow.compat.v1.placeholder", "numpy.allclose", "numpy.zeros", "numpy.ones", "tensorflow.compat.v1.global_variables_initializer", "tensorflow.compat.v1.keras.layers.Dense", "tensorflow.compat.v1.constant_initializer", "tensorflow.compat.v1.Session"...
[((4465, 4480), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4478, 4480), False, 'import unittest\n'), ((1033, 1043), 'tensorflow.compat.v1.Graph', 'tf.Graph', ([], {}), '()\n', (1041, 1043), True, 'import tensorflow.compat.v1 as tf\n'), ((3184, 3234), 'numpy.zeros', 'np.zeros', (['[INPUT_HEIGHT_WIDTH, INPUT_HE...
import numpy as np def results_updated_nobatchnorm(): accs = np.array([[[(33.52, (0, 0)), (35.4, (0, 10)), (38.14, (0, 20)), (38.98, (0, 30)), (41.08, (0, 40)), (43.26, (0, 50)), (43.98, (0, 60)), (42.84, (0, 70)), (43.56, (0, 80)), (43.66, (0, 90)), (45.5, (1, 0)), (...
[ "numpy.array" ]
[((67, 6431), 'numpy.array', 'np.array', (['[[[(33.52, (0, 0)), (35.4, (0, 10)), (38.14, (0, 20)), (38.98, (0, 30)), (\n 41.08, (0, 40)), (43.26, (0, 50)), (43.98, (0, 60)), (42.84, (0, 70)),\n (43.56, (0, 80)), (43.66, (0, 90)), (45.5, (1, 0)), (47.26, (2, 0)), (\n 50.36, (3, 0)), (50.48, (4, 0)), (48.84, (5,...
#!/usr/bin/python from tkinter import * from tkinter import filedialog from PIL import Image, ImageTk import cv2 import glob import numpy as np import tensorflow as tf from train import build_forward from utils import train_utils from utils.annolist import AnnotationLib as al from utils.stitch_wrapper im...
[ "PIL.ImageTk.PhotoImage", "tensorflow.train.Saver", "tkinter.filedialog.Open", "numpy.empty", "tensorflow.Session", "PIL.Image.open", "tkinter.filedialog.askdirectory", "cv2.imread", "tensorflow.initialize_all_variables", "glob.glob", "cv2.resize" ]
[((581, 606), 'cv2.resize', 'cv2.resize', (['f', '(640, 480)'], {}), '(f, (640, 480))\n', (591, 606), False, 'import cv2\n'), ((1067, 1096), 'cv2.resize', 'cv2.resize', (['citra', '(640, 480)'], {}), '(citra, (640, 480))\n', (1077, 1096), False, 'import cv2\n'), ((1295, 1328), 'glob.glob', 'glob.glob', (["(alamatFolder...
from __future__ import print_function, division import torch.utils.data as data from torch.utils.data import Dataset, DataLoader import torch import numpy as np import os import os.path import cv2 import scipy.io as scio def transformation_from_points(points1, scale): points = [[70, 112], [110, 112...
[ "cv2.resize", "numpy.std", "os.path.exists", "numpy.zeros", "cv2.imread", "cv2.warpAffine", "numpy.mean", "numpy.array", "numpy.random.randint", "numpy.matmul", "numpy.concatenate" ]
[((480, 504), 'numpy.mean', 'np.mean', (['points1'], {'axis': '(0)'}), '(points1, axis=0)\n', (487, 504), True, 'import numpy as np\n'), ((514, 538), 'numpy.mean', 'np.mean', (['points2'], {'axis': '(0)'}), '(points2, axis=0)\n', (521, 538), True, 'import numpy as np\n'), ((585, 600), 'numpy.std', 'np.std', (['points1'...
# encoding: utf-8 # Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
[ "numpy.min", "numpy.mean", "numpy.max" ]
[((3931, 3953), 'numpy.min', 'np.min', (['tracklet_stats'], {}), '(tracklet_stats)\n', (3937, 3953), True, 'import numpy as np\n'), ((3972, 3994), 'numpy.max', 'np.max', (['tracklet_stats'], {}), '(tracklet_stats)\n', (3978, 3994), True, 'import numpy as np\n'), ((4013, 4036), 'numpy.mean', 'np.mean', (['tracklet_stats...
import numpy as np import torch def pad(tensor, shape, value=0): if tensor.shape == shape: return tensor if isinstance(tensor, np.ndarray): padded = np.zeros(shape, dtype=tensor.dtype) else: padded = torch.zeros(shape) if value != 0: padded[:] = value padded[tuple(map(slice, tensor.shape))] = ...
[ "torch.zeros", "numpy.zeros" ]
[((160, 195), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'tensor.dtype'}), '(shape, dtype=tensor.dtype)\n', (168, 195), True, 'import numpy as np\n'), ((217, 235), 'torch.zeros', 'torch.zeros', (['shape'], {}), '(shape)\n', (228, 235), False, 'import torch\n')]
""" philoseismos: engineering seismologist's toolbox. author: <NAME> e-mail: <EMAIL> """ import struct import numpy as np import pandas as pd from philoseismos.segy import gfunc from philoseismos.segy import constants as const class Geometry: """ This object represents trace headers of a SEG-Y file. """ d...
[ "philoseismos.segy.gfunc.grab_endiannes", "numpy.empty", "philoseismos.segy.gfunc.grab_sample_format", "struct.unpack", "philoseismos.segy.gfunc.grab_trace_length", "philoseismos.segy.gfunc.grab_number_of_traces" ]
[((618, 643), 'philoseismos.segy.gfunc.grab_endiannes', 'gfunc.grab_endiannes', (['sgy'], {}), '(sgy)\n', (638, 643), False, 'from philoseismos.segy import gfunc\n'), ((661, 693), 'philoseismos.segy.gfunc.grab_number_of_traces', 'gfunc.grab_number_of_traces', (['sgy'], {}), '(sgy)\n', (688, 693), False, 'from philoseis...
input_names = {'TL': '../examples/large_deformation/hyperelastic.py', 'UL': '../examples/large_deformation/hyperelastic_ul.py', 'ULM': '../examples/large_deformation/hyperelastic_ul_up.py'} output_name_trunk = 'test_hyperelastic_' from sfepy.base.testing import TestCommon from tests_basic...
[ "sfepy.base.conf.get_standard_keywords", "sfepy.base.base.Struct", "sfepy.base.conf.ProblemConf.from_file", "os.path.dirname", "sfepy.applications.solve_pde", "numpy.linalg.norm", "sfepy.applications.assign_standard_hooks", "tests_basic.NLSStatus" ]
[((871, 894), 'sfepy.base.conf.get_standard_keywords', 'get_standard_keywords', ([], {}), '()\n', (892, 894), False, 'from sfepy.base.conf import ProblemConf, get_standard_keywords\n'), ((987, 1037), 'sfepy.base.conf.ProblemConf.from_file', 'ProblemConf.from_file', (['input_name', 'required', 'other'], {}), '(input_nam...
import datetime import glob import json import multiprocessing import os import pickle import sys import warnings from collections import Counter, defaultdict from string import digits import matplotlib.pyplot as plt from joblib import Parallel, delayed import numpy as np import pandas as pd from dateutil import parser...
[ "nltk.tokenize.RegexpTokenizer", "dateutil.parser.parse", "numpy.average", "nltk.sentiment.vader.SentimentIntensityAnalyzer", "nltk.stem.WordNetLemmatizer", "os.path.dirname", "json.dumps", "joblib.Parallel", "datetime.timedelta", "nltk.corpus.stopwords.words", "glob.glob", "nltk.corpus.wordne...
[((641, 668), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (666, 668), False, 'import multiprocessing\n'), ((763, 782), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (780, 782), False, 'from nltk.stem import WordNetLemmatizer\n'), ((1263, 1291), 'nltk.sentiment.vad...
"""Functional tests for Unpack Op.""" import tensorflow.python.platform import numpy as np import tensorflow as tf from tensorflow.python.kernel_tests import gradient_checker class UnpackOpTest(tf.test.TestCase): def testSimple(self): np.random.seed(7) for use_gpu in False, True: with self.test_ses...
[ "tensorflow.test.main", "tensorflow.unpack", "numpy.random.seed", "numpy.random.randn", "tensorflow.constant", "tensorflow.placeholder", "tensorflow.python.kernel_tests.gradient_checker.ComputeGradientError" ]
[((1825, 1839), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (1837, 1839), True, 'import tensorflow as tf\n'), ((246, 263), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (260, 263), True, 'import numpy as np\n'), ((1641, 1667), 'tensorflow.placeholder', 'tf.placeholder', (['np.float32'], {...
import os.path as osp from typing import Callable, Optional import numpy as np import torch from torch_geometric.data import Data, InMemoryDataset, download_url class GemsecDeezer(InMemoryDataset): r"""The Deezer User Network datasets introduced in the `"GEMSEC: Graph Embedding with Self Clustering" <ht...
[ "numpy.load", "torch.load", "torch_geometric.data.Data", "os.path.join", "torch.from_numpy" ]
[((1648, 1683), 'torch.load', 'torch.load', (['self.processed_paths[0]'], {}), '(self.processed_paths[0])\n', (1658, 1683), False, 'import torch\n'), ((1744, 1781), 'os.path.join', 'osp.join', (['self.root', 'self.name', '"""raw"""'], {}), "(self.root, self.name, 'raw')\n", (1752, 1781), True, 'import os.path as osp\n'...
#!/usr/bin/env python3 import math import re import sys import subprocess import numpy as np from PIL import Image, ImageOps # 1x icons are 32x28 in dimension ICON_ASPECT = 32/28 class IconGrid: def __init__(self, specfile): self.groups = self.read_spec(specfile) def read_spec(self, ...
[ "numpy.dstack", "subprocess.run", "PIL.Image.new", "math.sqrt", "math.ceil", "PIL.Image.open", "numpy.array", "PIL.Image.fromarray", "re.search", "sys.exit" ]
[((1680, 1697), 'PIL.Image.open', 'Image.open', (['fname'], {}), '(fname)\n', (1690, 1697), False, 'from PIL import Image, ImageOps\n'), ((1713, 1726), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (1721, 1726), True, 'import numpy as np\n'), ((1797, 1822), 'numpy.dstack', 'np.dstack', (['(255 - rgb, a)'], {}), ...
# -*- coding: utf-8 -*- """ Created on Sun Dec 1 13:43:31 2019 @author: Mateo """ import numpy as np import HARK.ConsumptionSaving.ConsPortfolioModel as cpm # Plotting tools import matplotlib.pyplot as plt import seaborn # %% Set up figure path import sys,os # Determine if this is being run as a standalone scrip...
[ "sys.path.append", "os.path.abspath", "seaborn.heatmap", "matplotlib.pyplot.ioff", "HARK.ConsumptionSaving.ConsPortfolioModel.PortfolioConsumerType", "numpy.zeros", "matplotlib.pyplot.subplots", "seaborn.despine", "matplotlib.pyplot.draw", "numpy.max", "numpy.loadtxt", "numpy.linspace", "mat...
[((590, 628), 'os.path.join', 'os.path.join', (['my_file_path', '"""Figures/"""'], {}), "(my_file_path, 'Figures/')\n", (602, 628), False, 'import sys, os\n'), ((653, 682), 'sys.path.append', 'sys.path.append', (['my_file_path'], {}), '(my_file_path)\n', (668, 682), False, 'import sys, os\n'), ((791, 832), 'os.path.joi...
""" Written by <NAME> <<EMAIL>> 2017-2018 """ import json import os from PIL import Image, ImageDraw, ImageFont import imageio import numpy as np import progressbar from skimage.transform import resize import torch from torch import nn from torch.autograd import Variable import matplotlib # Disable Xwindows backend b...
[ "matplotlib.pyplot.title", "numpy.abs", "numpy.argmax", "matplotlib.pyplot.bar", "numpy.ones", "numpy.argmin", "numpy.argsort", "torch.nn.NLLLoss", "matplotlib.pyplot.figure", "numpy.mean", "skimage.transform.resize", "numpy.exp", "os.path.join", "data.pixel_permutation", "numpy.copy", ...
[((354, 375), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (368, 375), False, 'import matplotlib\n'), ((485, 508), 'numpy.argsort', 'np.argsort', (['PERMUTATION'], {}), '(PERMUTATION)\n', (495, 508), True, 'import numpy as np\n'), ((707, 719), 'torch.nn.NLLLoss', 'nn.NLLLoss', ([], {}), '()\n',...
#coding=utf-8 import cv2 import numpy as np import mvsdk import time import threading class Camera2: def __init__(self): DevList = mvsdk.CameraEnumerateDevice() nDev = len(DevList) if nDev < 1: print("No camera was found!") return for i, DevInfo in enumerate(DevList): print("{}: {} {}".format(i, De...
[ "mvsdk.CameraSetGain", "mvsdk.CameraSetTriggerMode", "mvsdk.CameraUnInit", "mvsdk.CameraGetCapability", "mvsdk.CameraImageProcess", "mvsdk.CameraSetIspOutFormat", "cv2.destroyAllWindows", "cv2.resize", "cv2.waitKey", "numpy.frombuffer", "mvsdk.CameraGetImageBuffer", "mvsdk.CameraInit", "mvsd...
[((137, 166), 'mvsdk.CameraEnumerateDevice', 'mvsdk.CameraEnumerateDevice', ([], {}), '()\n', (164, 166), False, 'import mvsdk\n'), ((792, 832), 'mvsdk.CameraGetCapability', 'mvsdk.CameraGetCapability', (['self.hCamera0'], {}), '(self.hCamera0)\n', (817, 832), False, 'import mvsdk\n'), ((847, 887), 'mvsdk.CameraGetCapa...
import numpy as np import scipy.optimize as opt import matplotlib.pyplot as plt from scipy.integrate import quad # Best-fit Planck values arXiv:1807.06209 #H0 = 67.66 #OM = 0.3111 #OL = 0.6889 #OK = 0 c = 299792.458 f = open("QSO_data.txt", "r") l = f.readlines() z = [] mu = [] sigma = [] for x in l: z.append(fl...
[ "numpy.sum", "numpy.log", "scipy.integrate.quad", "numpy.asarray", "numpy.linspace", "numpy.log10", "numpy.sqrt" ]
[((423, 436), 'numpy.asarray', 'np.asarray', (['z'], {}), '(z)\n', (433, 436), True, 'import numpy as np\n'), ((442, 456), 'numpy.asarray', 'np.asarray', (['mu'], {}), '(mu)\n', (452, 456), True, 'import numpy as np\n'), ((465, 482), 'numpy.asarray', 'np.asarray', (['sigma'], {}), '(sigma)\n', (475, 482), True, 'import...
from winning.normaldist import normcdf, normpdf import numpy as np import math from collections import Counter ######################################################################################### # Operations on univariate atomic distributions supported on evenly spaced points # ###########################...
[ "numpy.sum", "numpy.ones", "numpy.inner", "numpy.convolve", "numpy.ndarray", "numpy.multiply", "numpy.random.randn", "numpy.insert", "numpy.cumsum", "numpy.linspace", "math.ceil", "numpy.flip", "math.floor", "numpy.zeros", "winning.normaldist.normpdf", "numpy.diff", "numpy.array", ...
[((1583, 1601), 'math.floor', 'math.floor', (['offset'], {}), '(offset)\n', (1593, 1601), False, 'import math\n'), ((1610, 1627), 'math.ceil', 'math.ceil', (['offset'], {}), '(offset)\n', (1619, 1627), False, 'import math\n'), ((2728, 2750), 'numpy.inner', 'np.inner', (['density', 'pts'], {}), '(density, pts)\n', (2736...
""" The :mod:`Chapter01.my_neuron` module contains the :class:`MyNeuron` class. The :class:`MyNeuron` class will be the building blocks for the neural network layers I want to create. """ # ============================================================================== # Imported Modules # ============================...
[ "numpy.dot", "numpy.random.uniform" ]
[((1266, 1355), 'numpy.random.uniform', 'uniform', ([], {'size': 'number_of_inputs', 'low': 'self.low_weight_bias', 'high': 'self.high_weight_bias'}), '(size=number_of_inputs, low=self.low_weight_bias, high=self.\n high_weight_bias)\n', (1273, 1355), False, 'from numpy.random import uniform\n'), ((1754, 1823), 'nump...
import numpy as np import pandas as pd from scipy.sparse import issparse from .scatters import scatters from .utils import ( quiver_autoscaler, default_quiver_args, save_fig, set_arrow_alpha, set_stream_line_alpha, ) from ..tools.dimension_reduction import reduceDimension from ..tools.cell_vectors ...
[ "numpy.range", "numpy.maximum", "numpy.empty", "numpy.isnan", "matplotlib.pyplot.figure", "yt.SlicePlot", "numpy.arange", "matplotlib.colors.to_hex", "matplotlib.pyplot.tight_layout", "numpy.unique", "pandas.DataFrame", "matplotlib.pyplot.imshow", "numpy.reshape", "yt.load_uniform_grid", ...
[((1957, 1988), 'numpy.empty', 'np.empty', (['(M, N, 4)', 'np.float32'], {}), '((M, N, 4), np.float32)\n', (1965, 1988), True, 'import numpy as np\n'), ((2154, 2166), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2164, 2166), True, 'import matplotlib.pyplot as plt\n'), ((2171, 2190), 'matplotlib.pyplot.i...
#This code can only train with M==1, because when M=1, lower bound and the true object are same #from __future__ import absolute_import from __future__ import division from __future__ import print_function import matplotlib matplotlib.use('Agg') import numpy as np import os import sys import seaborn as sns import sci...
[ "tensorflow.reduce_sum", "tensorflow.get_collection", "tensorflow.reset_default_graph", "numpy.empty", "tensorflow.reshape", "matplotlib.pyplot.figure", "numpy.mean", "tensorflow.InteractiveSession", "matplotlib.pyplot.tight_layout", "tensorflow.nn.relu", "matplotlib.pyplot.imshow", "matplotli...
[((225, 246), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (239, 246), False, 'import matplotlib\n'), ((3004, 3028), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (3026, 3028), True, 'import tensorflow as tf\n'), ((3179, 3198), 'tensorflow.constant', 'tf.constant...
""" http://arxiv.org/abs/1412.7449 and https://arxiv.org/abs/1508.04025 (mostly the latter) TODO: embed start symbol at test time - GET WORKING read from model path if provided attention real prediction/output probabilities isntead of logits """ import tensorflow as tf import numpy as np class ...
[ "tensorflow.contrib.layers.xavier_initializer", "tensorflow.reduce_sum", "tensorflow.add_check_numerics_ops", "numpy.argmax", "tensorflow.get_variable_scope", "tensorflow.nn.rnn_cell.DropoutWrapper", "tensorflow.matmul", "tensorflow.Variable", "tensorflow.get_variable", "numpy.full", "tensorflow...
[((997, 1042), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '()', 'name': '"""lr"""'}), "(tf.int32, shape=(), name='lr')\n", (1011, 1042), True, 'import tensorflow as tf\n'), ((1069, 1148), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[self.batch_size, self.max_source_len]'], {'nam...
import numpy as np import pandas as pd import scipy.sparse as sp import matchzoo import collections from setting_keywords import KeyWordSettings from handlers.output_handler import FileHandler def _laplacian_normalize(adj): """Symmetrically normalize adjacency matrix.""" adj = sp.coo_matrix(adj) rowsum =...
[ "scipy.sparse.diags", "numpy.power", "handlers.output_handler.FileHandler.myprint", "numpy.isinf", "collections.defaultdict", "scipy.sparse.coo_matrix", "numpy.array", "numpy.arange" ]
[((289, 307), 'scipy.sparse.coo_matrix', 'sp.coo_matrix', (['adj'], {}), '(adj)\n', (302, 307), True, 'import scipy.sparse as sp\n'), ((455, 475), 'scipy.sparse.diags', 'sp.diags', (['d_inv_sqrt'], {}), '(d_inv_sqrt)\n', (463, 475), True, 'import scipy.sparse as sp\n'), ((407, 427), 'numpy.isinf', 'np.isinf', (['d_inv_...
''' Wrapper for all FeatureExtraction algorithm ''' import numpy as np from python_speech_features import mfcc import rasta ''' Leave the data as raw ''' class Raw: def __call__(self, X, rate): return X ''' FeatureExtraction using Mfcc https://medium.com/@jonathan_hui/speech-recognition-feature-extractio...
[ "python_speech_features.mfcc", "numpy.array" ]
[((669, 682), 'numpy.array', 'np.array', (['ret'], {}), '(ret)\n', (677, 682), True, 'import numpy as np\n'), ((916, 929), 'numpy.array', 'np.array', (['ret'], {}), '(ret)\n', (924, 929), True, 'import numpy as np\n'), ((528, 546), 'python_speech_features.mfcc', 'mfcc', (['signal', 'rate'], {}), '(signal, rate)\n', (53...
import numpy as np class RLS: def __init__(self): """ RLS initialisation """ self.P = np.eye(2) # state matrix, 2x2 self.w = np.zeros( (2, 1) ) # weights (coefficients of the linear model including constant, 2x1) self.error = 0 def update...
[ "numpy.eye", "numpy.zeros", "numpy.reshape", "numpy.abs" ]
[((125, 134), 'numpy.eye', 'np.eye', (['(2)'], {}), '(2)\n', (131, 134), True, 'import numpy as np\n'), ((173, 189), 'numpy.zeros', 'np.zeros', (['(2, 1)'], {}), '((2, 1))\n', (181, 189), True, 'import numpy as np\n'), ((514, 540), 'numpy.reshape', 'np.reshape', (['[1, x]', '(1, 2)'], {}), '([1, x], (1, 2))\n', (524, 5...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Problem 038 Transpose and Flatten Source : https://www.hackerrank.com/challenges/np-transpose-and-flatten/problem """ import numpy as np n, m = map(int, input().split()) ar = np.array([input().split() for _ in range(n)], int) print(np.transpose(ar)) print(ar.flatten...
[ "numpy.transpose" ]
[((286, 302), 'numpy.transpose', 'np.transpose', (['ar'], {}), '(ar)\n', (298, 302), True, 'import numpy as np\n')]
#!/usr/bin/env python3 # NDCG scoring function adapted from: https://github.com/kmbnw/rank_metrics/blob/master/python/ndcg.py import json import logging import warnings from collections import OrderedDict from typing import Dict, List, Iterable import numpy as np import pandas as pd try: from tqdm import tqdm ex...
[ "numpy.pad", "logging.error", "json.load", "numpy.flip", "argparse.ArgumentParser", "logging.basicConfig", "tqdm.tqdm", "pandas.read_csv", "numpy.power", "numpy.zeros", "collections.OrderedDict.fromkeys", "numpy.array", "collections.OrderedDict", "warnings.warn", "argparse.FileType" ]
[((419, 459), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (438, 459), False, 'import logging\n'), ((813, 903), 'pandas.read_csv', 'pd.read_csv', (['filepath_or_buffer'], {'sep': 'sep', 'names': "('question', 'explanation')", 'dtype': 'str'}), "(filepath_or_...
#!/usr/bin/env python """ This is a demo, showing how to work with a "tree" structure It demonstrates moving objects around, etc, etc. """ import wx #ver = 'local' ver = 'installed' if ver == 'installed': ## import the installed version from wx.lib.floatcanvas import NavCanvas, Resources from wx.lib.float...
[ "sys.path.append", "floatcanvas.FloatCanvas.DrawObject.__init__", "floatcanvas.FloatCanvas.Polygon.__init__", "floatcanvas.FloatCanvas.ScaledText", "numpy.asarray", "floatcanvas.NavCanvas.NavCanvas", "floatcanvas.FloatCanvas.Group.__init__", "wx.Frame.__init__", "wx.App", "numpy.array", "wx.Clie...
[((11412, 11421), 'wx.App', 'wx.App', (['(0)'], {}), '(0)\n', (11418, 11421), False, 'import wx\n'), ((546, 567), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (561, 567), False, 'import sys\n'), ((1224, 1325), 'numpy.array', 'N.array', (['((BB[0, 0], BB[0, 1]), (BB[0, 0], BB[1, 1]), (BB[1, 0], ...
from slm_lab.experiment.control import make_agent_env from slm_lab.lib import util from slm_lab.spec import spec_util import numpy as np import pandas as pd import pytest @pytest.fixture(scope='session') def test_spec(): spec = spec_util.get('experimental/misc/base.json', 'base_case_openai') spec_util.tick(sp...
[ "pandas.DataFrame", "slm_lab.spec.spec_util.tick", "numpy.asarray", "slm_lab.spec.spec_util.override_test_spec", "pytest.fixture", "slm_lab.spec.spec_util.get", "slm_lab.experiment.control.make_agent_env" ]
[((174, 205), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (188, 205), False, 'import pytest\n'), ((234, 298), 'slm_lab.spec.spec_util.get', 'spec_util.get', (['"""experimental/misc/base.json"""', '"""base_case_openai"""'], {}), "('experimental/misc/base.json', 'base_case...
from mmdet.apis import init_detector, inference_detector, show_result_pyplot, show_result import mmcv import cv2 import numpy as np import torch import os import time def bboxSelect(result, select_cls, CLASSES, score_thr=0.3): if isinstance(result, tuple): bbox_result, segm_result = result else: ...
[ "numpy.full", "os.mkdir", "cv2.waitKey", "mmdet.apis.init_detector", "os.path.exists", "mmdet.apis.inference_detector", "cv2.imshow", "cv2.imread", "numpy.vstack", "cv2.destroyAllWindows", "os.path.join", "numpy.concatenate" ]
[((1569, 1629), 'mmdet.apis.init_detector', 'init_detector', (['config_file', 'checkpoint_file'], {'device': '"""cuda:0"""'}), "(config_file, checkpoint_file, device='cuda:0')\n", (1582, 1629), False, 'from mmdet.apis import init_detector, inference_detector, show_result_pyplot, show_result\n'), ((3486, 3509), 'cv2.des...
import itertools import numpy as np import tensorflow as tf import video_prediction as vp from video_prediction import ops from video_prediction.models import VideoPredictionModel, SAVPVideoPredictionModel from video_prediction.models import pix2pix_model, mocogan_model, spectral_norm_model from video_prediction.mode...
[ "tensorflow.reduce_sum", "tensorflow.nn.rnn_cell.LSTMStateTuple", "tensorflow.identity", "tensorflow.get_variable_scope", "tensorflow.reshape", "video_prediction.ops.flatten", "video_prediction.utils.tf_utils.flow_to_rgb", "video_prediction.models.VideoPredictionModel.__init__", "video_prediction.mo...
[((981, 1012), 'tensorflow.concat', 'tf.concat', (['image_pairs'], {'axis': '(-1)'}), '(image_pairs, axis=-1)\n', (990, 1012), True, 'import tensorflow as tf\n'), ((1217, 1411), 'video_prediction.models.savp_model.create_encoder', 'create_encoder', (['image_pairs'], {'e_net': 'hparams.e_net', 'use_e_rnn': 'hparams.use_...
r""" Solve Poisson equation in 2D with homogeneous Dirichlet bcs in one direction and periodic in the other. The domain is (-inf, inf) x [0, 2pi] .. math:: \nabla^2 u = f, The equation to solve for a Hermite x Fourier basis is .. math:: (\nabla u, \nabla v) = -(f, v) """ import os import sys from sympy i...
[ "matplotlib.pyplot.title", "numpy.allclose", "sympy.cos", "matplotlib.pyplot.figure", "numpy.linalg.norm", "matplotlib.pyplot.contourf", "sympy.hermite", "matplotlib.pyplot.colorbar", "shenfun.inner", "shenfun.grad", "sympy.exp", "shenfun.FunctionSpace", "numpy.squeeze", "shenfun.TestFunct...
[((676, 701), 'sympy.symbols', 'symbols', (['"""x,y"""'], {'real': '(True)'}), "('x,y', real=True)\n", (683, 701), False, 'from sympy import symbols, exp, hermite, cos\n'), ((856, 883), 'shenfun.FunctionSpace', 'FunctionSpace', (['N', '"""Hermite"""'], {}), "(N, 'Hermite')\n", (869, 883), False, 'from shenfun import in...
# Copyright 2017 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 # # Unless required by applica...
[ "tensorflow.test.main", "numpy.full", "object_detection.utils.visualization_utils.draw_bounding_box_on_image_array", "object_detection.utils.visualization_utils.draw_bounding_boxes_on_image", "numpy.asarray", "object_detection.utils.visualization_utils.draw_bounding_boxes_on_image_array", "numpy.array",...
[((5826, 5840), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (5838, 5840), True, 'import tensorflow as tf\n'), ((1350, 1393), 'numpy.full', 'np.full', (['[100, 200, 1]', '(255)'], {'dtype': 'np.uint8'}), '([100, 200, 1], 255, dtype=np.uint8)\n', (1357, 1393), True, 'import numpy as np\n'), ((1410, 1453), '...
# -*- coding: utf-8 -*- # context managers # import colorama # type: ignore import numpy as np # type: ignore import os import signal from datetime import datetime class RandomSeed: """ change random seed within contex...
[ "numpy.random.seed", "numpy.random.get_state", "os.getcwd", "numpy.random.set_state", "signal.setitimer", "signal.signal", "datetime.datetime.now", "os.chdir" ]
[((407, 428), 'numpy.random.get_state', 'np.random.get_state', ([], {}), '()\n', (426, 428), True, 'import numpy as np\n'), ((463, 488), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (477, 488), True, 'import numpy as np\n'), ((529, 560), 'numpy.random.set_state', 'np.random.set_state', (...
"""Script to run the NAF2 agent on the inverted pendulum. Includes also a visualisation of the environment and a video.""" import os import pickle import random import sys import gym import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from inverted_pendulum import PendulumEnv from naf2_new im...
[ "tensorflow.random.set_seed", "pickle.dump", "numpy.random.seed", "numpy.sum", "naf2_new.NAF", "gym.wrappers.Monitor", "numpy.clip", "numpy.mean", "numpy.random.randn", "os.path.exists", "inverted_pendulum.PendulumEnv", "numpy.cumsum", "random.seed", "matplotlib.pyplot.subplots", "gym.Wr...
[((366, 393), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(random_seed)\n', (380, 393), True, 'import numpy as np\n'), ((394, 418), 'random.seed', 'random.seed', (['random_seed'], {}), '(random_seed)\n', (405, 418), False, 'import random\n'), ((1225, 1243), 'matplotlib.pyplot.subplots', 'plt.subplots...
# stdlib from time import time # 3p import numpy as np import fbpca def norm2(X): return fbpca.pca(X, k=1, raw=True)[1][0] def cond1(M, L, S, eps1): return np.linalg.norm(M - L - S, ord='fro') <= eps1 * np.linalg.norm(M, ord='fro') def shrinkage_operator(X, tau): return np.sign(X) * np.max(np.abs(X) -...
[ "numpy.zeros_like", "numpy.abs", "fbpca.pca", "time.time", "numpy.min", "numpy.linalg.norm", "numpy.sign", "numpy.diag", "numpy.sqrt" ]
[((422, 440), 'fbpca.pca', 'fbpca.pca', (['X', 'rank'], {}), '(X, rank)\n', (431, 440), False, 'import fbpca\n'), ((660, 688), 'numpy.linalg.norm', 'np.linalg.norm', (['M'], {'ord': '"""fro"""'}), "(M, ord='fro')\n", (674, 688), True, 'import numpy as np\n'), ((1006, 1012), 'time.time', 'time', ([], {}), '()\n', (1010,...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Assembly QC plots, including general statistics, base and mate coverages, and scaffolding consistencies. """ from __future__ import print_function import sys import logging import os.path as op from jcvi.formats.fasta import Fasta from jcvi.formats.bed import Bed, Be...
[ "jcvi.formats.bed.mates", "numpy.sum", "jcvi.utils.iter.grouper", "jcvi.graphics.base.set_human_base_axis", "jcvi.assembly.coverage.Coverage", "numpy.mean", "jcvi.graphics.base.plt.gca", "pandas.DataFrame", "os.path.exists", "jcvi.formats.base.DictFile", "jcvi.graphics.base.plt.figure", "jcvi....
[((1010, 1035), 'jcvi.apps.base.ActionDispatcher', 'ActionDispatcher', (['actions'], {}), '(actions)\n', (1026, 1035), False, 'from jcvi.apps.base import OptionParser, ActionDispatcher, need_update\n'), ((1357, 1385), 'jcvi.apps.base.OptionParser', 'OptionParser', (['covlen.__doc__'], {}), '(covlen.__doc__)\n', (1369, ...
import numpy as np import matplotlib.pyplot as plt from sealrtc.utils import genpsd, fs plt.ion() def design_from_ol(y, dt=1/fs, nseg=4): """ Designs a filter for a time-series of open loop values. Arguments --------- y : np.ndarray The time-series. dt : float The time step in secon...
[ "matplotlib.pyplot.yscale", "numpy.abs", "numpy.sum", "sealrtc.utils.genpsd", "matplotlib.pyplot.figure", "numpy.arange", "numpy.random.normal", "numpy.fft.fft", "numpy.real", "numpy.fft.ifft", "numpy.vectorize", "matplotlib.pyplot.legend", "matplotlib.pyplot.ion", "numpy.fft.fftshift", ...
[((90, 99), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (97, 99), True, 'import matplotlib.pyplot as plt\n'), ((540, 584), 'sealrtc.utils.genpsd', 'genpsd', (['y'], {'dt': 'dt', 'nseg': 'nseg', 'remove_dc': '(False)'}), '(y, dt=dt, nseg=nseg, remove_dc=False)\n', (546, 584), False, 'from sealrtc.utils import ...
# Copyright 2021 Dakewe Biotech Corporation. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
[ "io.BytesIO", "imgproc.image2tensor", "imgproc.convert_rgb_to_ycbcr", "PIL.Image.open", "numpy.array", "lmdb.open", "torchvision.transforms.CenterCrop", "os.path.join", "os.listdir", "torchvision.transforms.RandomCrop", "torchvision.transforms.Resize" ]
[((2342, 2382), 'PIL.Image.open', 'Image.open', (['self.file_names[batch_index]'], {}), '(self.file_names[batch_index])\n', (2352, 2382), False, 'from PIL import Image\n'), ((2698, 2736), 'imgproc.convert_rgb_to_ycbcr', 'imgproc.convert_rgb_to_ycbcr', (['lr_image'], {}), '(lr_image)\n', (2726, 2736), False, 'import img...
# Imports import numpy as np # Utils def first(a_list): return a_list[0] def last(a_list): return a_list[-1] def group_by(a_list, a_func=lambda x: x): output_dict = {} for a_elem in a_list: key = a_func(a_elem) if key in output_dict: output_dict[key] = np.append(outp...
[ "numpy.append", "numpy.array" ]
[((306, 358), 'numpy.append', 'np.append', (['output_dict[key]', 'a_elem[None, :]'], {'axis': '(0)'}), '(output_dict[key], a_elem[None, :], axis=0)\n', (315, 358), True, 'import numpy as np\n'), ((404, 422), 'numpy.array', 'np.array', (['[a_elem]'], {}), '([a_elem])\n', (412, 422), True, 'import numpy as np\n')]