code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from sklearn.cluster import DBSCAN import numpy as np states = ["INITIAL","login","View_Items","home","logout","View_Items_quantity","Add_to_Cart","shoppingcart", "remove","deferorder","purchasecart","inventory","sellinventory","clearcart","cancelorder","$"] # Data imports PATH = "../data/raw/" sessions_fi...
[ "numpy.mean", "sklearn.cluster.DBSCAN", "numpy.unique" ]
[((725, 762), 'numpy.unique', 'np.unique', (['labels'], {'return_counts': '(True)'}), '(labels, return_counts=True)\n', (734, 762), True, 'import numpy as np\n'), ((1101, 1118), 'numpy.unique', 'np.unique', (['labels'], {}), '(labels)\n', (1110, 1118), True, 'import numpy as np\n'), ((587, 618), 'sklearn.cluster.DBSCAN...
# Author: <NAME> # email: <EMAIL> import numpy as np import init_paths from bbox_transform import bbox_TLWH2TLBR from xinshuo_miscellaneous import CHECK_EQ_NUMPY def test_bbox_TLWH2TLBR(): print('check basic') bbox = [1, 1, 10, 10] clipped = bbox_TLWH2TLBR(bbox) print(clipped) assert CHECK_EQ_NUMPY(clipped, np.a...
[ "bbox_transform.bbox_TLWH2TLBR", "numpy.array" ]
[((247, 267), 'bbox_transform.bbox_TLWH2TLBR', 'bbox_TLWH2TLBR', (['bbox'], {}), '(bbox)\n', (261, 267), False, 'from bbox_transform import bbox_TLWH2TLBR\n'), ((439, 459), 'bbox_transform.bbox_TLWH2TLBR', 'bbox_TLWH2TLBR', (['bbox'], {}), '(bbox)\n', (453, 459), False, 'from bbox_transform import bbox_TLWH2TLBR\n'), (...
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "unittest.main", "functools.partial", "program_config.OpConfig", "numpy.zeros", "hypothesis.strategies.sampled_from", "numpy.random.random", "hypothesis.strategies.integers" ]
[((3485, 3500), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3498, 3500), False, 'import unittest\n'), ((2284, 2438), 'program_config.OpConfig', 'OpConfig', ([], {'type': '"""prelu"""', 'inputs': "{'X': ['input_data'], 'Alpha': ['alpha_weight']}", 'outputs': "{'Out': ['output_data']}", 'attrs': "{'mode': kwargs...
import sounddevice as sd import librosa import numpy as np from keras.models import load_model from sklearn.preprocessing import LabelEncoder import os import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) model_file = os.path.join(os.path.dirname(__file__), '..', 'train', 'saved_mode...
[ "keras.models.load_model", "numpy.pad", "numpy.load", "os.path.dirname", "sklearn.preprocessing.LabelEncoder", "tensorflow.compat.v1.logging.set_verbosity", "librosa.feature.mfcc" ]
[((177, 239), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity', (['tf.compat.v1.logging.ERROR'], {}), '(tf.compat.v1.logging.ERROR)\n', (211, 239), True, 'import tensorflow as tf\n'), ((364, 386), 'keras.models.load_model', 'load_model', (['model_file'], {}), '(model_file)\n', (374, 38...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 24 00:59:55 2020 @author: nemo """ from copy import deepcopy import os import random import numpy as np import nibabel as nib os.chdir('../90.template') os.makedirs('rand_parc') mni_img = nib.load('MNI152_T1_1mm_GM_resamp_2.5mm.nii.gz') # Extract ...
[ "copy.deepcopy", "os.makedirs", "nibabel.load", "random.choices", "os.chdir", "numpy.prod" ]
[((199, 225), 'os.chdir', 'os.chdir', (['"""../90.template"""'], {}), "('../90.template')\n", (207, 225), False, 'import os\n'), ((226, 250), 'os.makedirs', 'os.makedirs', (['"""rand_parc"""'], {}), "('rand_parc')\n", (237, 250), False, 'import os\n'), ((261, 309), 'nibabel.load', 'nib.load', (['"""MNI152_T1_1mm_GM_res...
# -*- coding: utf-8 -*- import datetime import numpy as np import pandas as pd from ..signal import signal_period def benchmark_ecg_preprocessing(function, ecg, rpeaks=None, sampling_rate=1000): """Benchmark ECG preprocessing pipelines. Parameters ---------- function : function Must be a Py...
[ "numpy.abs", "pandas.read_csv", "datetime.datetime.now", "pandas.concat", "numpy.concatenate" ]
[((3492, 3510), 'pandas.concat', 'pd.concat', (['results'], {}), '(results)\n', (3501, 3510), True, 'import pandas as pd\n'), ((3619, 3642), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (3640, 3642), False, 'import datetime\n'), ((1904, 1934), 'pandas.read_csv', 'pd.read_csv', (["(ecg + '/ECGs.cs...
import torch import numpy as np from mean_average_precision import MetricBuilder from .utils import masks_to_bboxes from functools import partial class MeanAveragePrecision: def __init__( self, num_classes: int, out_img_size: int = 64, threshold_iou: float = 0.5, ...
[ "numpy.array", "functools.partial", "mean_average_precision.MetricBuilder.build_evaluation_metric" ]
[((480, 573), 'mean_average_precision.MetricBuilder.build_evaluation_metric', 'MetricBuilder.build_evaluation_metric', (['"""map_2d"""'], {'async_mode': '(True)', 'num_classes': 'num_classes'}), "('map_2d', async_mode=True,\n num_classes=num_classes)\n", (517, 573), False, 'from mean_average_precision import MetricB...
from matplotlib import cm, rcParams import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib as matplotlib from matplotlib import patheffects import numpy as np import math as math import random as rand import os, sys, csv import pandas as pd #matplotlib.pyplot.xkcd(scale=.5, length=100, ra...
[ "numpy.random.seed", "matplotlib.pyplot.show", "math.sqrt", "numpy.random.randn", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((424, 440), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (438, 440), True, 'import numpy as np\n'), ((2740, 2803), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {'figsize': '(12, 5)', 'sharey': '"""row"""', 'sharex': '"""col"""'}), "(2, 1, figsize=(12, 5), sharey='row', sharex='col')\n", ...
import argparse import os import matplotlib.pyplot as plt import librosa from tqdm import tqdm import numpy as np SILENCE_THRESHOLD = 60 FRAME_LENGTH = 2048 WIN_LENGTH = 1024 HOP_LENGTH = 512 HOP_LENGTH_2 = 256 N_FFT = 1024 NUM_MELS = 80 FMIN = 0 FMAX = 8000 def wav_to_mel(path, output_path, sample_rate): wav =...
[ "os.listdir", "numpy.save", "numpy.abs", "argparse.ArgumentParser", "numpy.log", "os.makedirs", "librosa.effects.trim", "numpy.clip", "librosa.load", "os.path.join", "librosa.stft" ]
[((590, 675), 'librosa.stft', 'librosa.stft', ([], {'y': 'wav', 'n_fft': 'N_FFT', 'hop_length': 'HOP_LENGTH_2', 'win_length': 'WIN_LENGTH'}), '(y=wav, n_fft=N_FFT, hop_length=HOP_LENGTH_2, win_length=WIN_LENGTH\n )\n', (602, 675), False, 'import librosa\n'), ((815, 850), 'numpy.clip', 'np.clip', (['S'], {'a_min': '(...
import os import random import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn from pytorch_pretrained_bert.modeling import WEIGHTS_NAME, CONFIG_NAME, BertConfig from pytorch_pretrained_bert.optimization import BertAdam from model import HLG from train_evaluate import train, evalua...
[ "numpy.random.seed", "utils.get_device", "os.makedirs", "pytorch_pretrained_bert.optimization.BertAdam", "model.HLG.from_pretrained", "torch.manual_seed", "torch.load", "torch.nn.CrossEntropyLoss", "os.path.exists", "pytorch_pretrained_bert.modeling.BertConfig", "train_evaluate.evaluate", "tor...
[((720, 775), 'os.path.join', 'os.path.join', (['config.output_dir', 'model_id', 'WEIGHTS_NAME'], {}), '(config.output_dir, model_id, WEIGHTS_NAME)\n', (732, 775), False, 'import os\n'), ((801, 855), 'os.path.join', 'os.path.join', (['config.output_dir', 'model_id', 'CONFIG_NAME'], {}), '(config.output_dir, model_id, C...
import argparse import json import logging import os import random import shutil import sys from argparse import Namespace from datetime import datetime from itertools import chain, combinations import torch import numpy as np from tools.config import Config logger = logging.getLogger(__name__) def set_seed(args: ...
[ "numpy.random.seed", "argparse.ArgumentParser", "logging.getLogger", "logging.Formatter", "rankers.chain_ranker.set_up_experiment", "shutil.rmtree", "os.path.join", "matplotlib.pyplot.close", "datasets.factory.DatasetFactory.load_and_cache_dataset", "random.seed", "rankers.utils.mean_average_pre...
[((271, 298), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (288, 298), False, 'import logging\n'), ((333, 355), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (344, 355), False, 'import random\n'), ((360, 385), 'numpy.random.seed', 'np.random.seed', (['args.seed'], ...
from pandas import date_range, Series, DatetimeIndex, concat from pandas.core.generic import NDFrame from pandas.tseries.frequencies import to_offset from numpy import array from numpy.random import choice, seed from irradiance_synth.ts_bootstrap.stitch import stitch from irradiance_synth.ts_bootstrap.pool_selector im...
[ "irradiance_synth.ts_bootstrap.pool_selector.NullPoolSelector", "irradiance_synth.ts_bootstrap.stitch.stitch", "numpy.random.seed", "pandas.date_range", "numpy.random.choice", "pandas.concat" ]
[((2152, 2200), 'pandas.date_range', 'date_range', (['index[0]', 'index[-1]'], {'freq': 'chunk_size'}), '(index[0], index[-1], freq=chunk_size)\n', (2162, 2200), False, 'from pandas import date_range, Series, DatetimeIndex, concat\n'), ((3358, 3382), 'pandas.concat', 'concat', (['reindexed_chunks'], {}), '(reindexed_ch...
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt plt.style.use('seaborn-white') import numpy as np #from sklearn import datasets from sklearn.decomposition import PCA from sklearn.manifold import TSNE import matplotlib.cm as cm import argparse from .Format import formdata import os def run(parse...
[ "matplotlib.pyplot.subplot", "argparse.ArgumentParser", "sklearn.manifold.TSNE", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "os.path.exists", "numpy.transpose", "matplotlib.pyplot.style.use", "matplotlib.use", "matplotlib.pyplot.figure", "sklearn.decomposition.PCA", "numpy.min", ...
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((72, 102), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-white"""'], {}), "('seaborn-white')\n", (85, 102), True, 'import matplotlib.pyplot as plt\n'), ((1636, 1648), 'matplotlib.p...
import torch import torch.nn as nn import torchx as tx from torchx.nn.hyper_scheduler import * import numpy as np from .base import Learner from .aggregator import MultistepAggregatorWithInfo from surreal.model.ppo_net import PPOModel, DiagGauss from surreal.model.reward_filter import RewardFilter from surreal.session...
[ "torchx.device_scope", "surreal.model.ppo_net.PPOModel", "surreal.model.reward_filter.RewardFilter", "torch.var", "surreal.model.ppo_net.DiagGauss", "torch.cat", "numpy.mean", "torch.clamp", "torch.cuda.is_available", "torch.pow", "torch.zeros", "torch.sum", "torch.tensor" ]
[((3142, 3167), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (3165, 3167), False, 'import torch\n'), ((10327, 10396), 'torch.clamp', 'torch.clamp', (['prob_ratio', '(1 - self.clip_epsilon)', '(1 + self.clip_epsilon)'], {}), '(prob_ratio, 1 - self.clip_epsilon, 1 + self.clip_epsilon)\n', (1033...
"""nyquist_test.py - test Nyquist plots RMM, 30 Jan 2021 This set of unit tests covers various Nyquist plot configurations. Because much of the output from these tests are graphical, this file can also be run from ipython to generate plots interactively. """ import pytest import numpy as np import matplotlib.pyplo...
[ "matplotlib.pyplot.title", "control.drss", "pytest.warns", "numpy.testing.assert_array_equal", "matplotlib.pyplot.close", "numpy.testing.assert_allclose", "control.tf", "numpy.all", "numpy.logspace", "control.rss", "control.pade", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "pytes...
[((364, 401), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""mplcleanup"""'], {}), "('mplcleanup')\n", (387, 401), False, 'import pytest\n'), ((5106, 5176), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""arrows"""', '[None, 1, 2, 3, 4, [0.1, 0.5, 0.9]]'], {}), "('arrows', [None, 1, 2, 3, 4, [0...
import pandas as pd import numpy as np import string def create_predictive_table(): index = pd.Index(['S', 'bloco', 'declaracao', 'tipo', 'comandos', 'condicao', 'expressao', 'expressao\'', 'termo', 'relop', 'artop', 'atrop'], 'rows') columns = pd.Index(['programa', 'inicio', 'fim', 'id', ';', 'int', 'cha...
[ "pandas.DataFrame", "numpy.arange", "pandas.Index" ]
[((97, 242), 'pandas.Index', 'pd.Index', (['[\'S\', \'bloco\', \'declaracao\', \'tipo\', \'comandos\', \'condicao\', \'expressao\',\n "expressao\'", \'termo\', \'relop\', \'artop\', \'atrop\']', '"""rows"""'], {}), '([\'S\', \'bloco\', \'declaracao\', \'tipo\', \'comandos\', \'condicao\',\n \'expressao\', "expres...
""" Basic data visualization (using PlenOctree's volrend) Usage: python view_data.py <data_root> default output: data_vis.html. You can open this in your browser. (bash sensei/mkweb) """ # Copyright 2021 <NAME> import sys import os from os import path DIR_PATH = path.dirname(os.path.realpath(__file__)) sys.path.append...
[ "numpy.load", "numpy.sum", "argparse.ArgumentParser", "numpy.arctan2", "numpy.shape", "os.path.isfile", "numpy.mean", "numpy.linalg.norm", "numpy.diag", "os.path.join", "os.path.abspath", "numpy.multiply", "numpy.linalg.linalg.svd", "numpy.transpose", "numpy.identity", "math.cos", "n...
[((277, 303), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (293, 303), False, 'import os\n'), ((321, 346), 'os.path.join', 'path.join', (['DIR_PATH', '""".."""'], {}), "(DIR_PATH, '..')\n", (330, 346), False, 'from os import path\n'), ((1138, 1161), 'numpy.sqrt', 'np.sqrt', (['length', 'l...
import numpy as np import pandas as pd from soepy.shared.shared_constants import ( HOURS, DATA_LABLES_SIM, DATA_FORMATS_SIM, ) from soepy.shared.shared_auxiliary import draw_disturbances from soepy.shared.shared_auxiliary import calculate_utility_components from soepy.shared.shared_auxiliary import calcula...
[ "numpy.full", "numpy.random.seed", "numpy.random.binomial", "numpy.argmax", "numpy.zeros", "numpy.where", "numpy.arange", "numpy.array", "numpy.random.choice", "numpy.vstack", "soepy.shared.shared_auxiliary.calculate_utility_components", "soepy.shared.shared_auxiliary.calculate_employment_cons...
[((809, 844), 'numpy.random.seed', 'np.random.seed', (['model_spec.seed_sim'], {}), '(model_spec.seed_sim)\n', (823, 844), True, 'import numpy as np\n'), ((917, 1012), 'numpy.random.choice', 'np.random.choice', (['model_spec.num_educ_levels', 'model_spec.num_agents_sim'], {'p': 'prob_educ_level'}), '(model_spec.num_edu...
import os import unittest from typing import Optional from unittest.mock import MagicMock, patch, call import numpy as np import pandas as pd import xarray as xr from pywatts.wrapper.keras_wrapper import KerasWrapper stored_model = { "aux_models": [ [ "encoder", os.path.join("pipe...
[ "pywatts.wrapper.keras_wrapper.KerasWrapper", "pandas.date_range", "unittest.mock.MagicMock", "unittest.mock.patch", "numpy.array", "xarray.DataArray", "numpy.testing.assert_equal", "pywatts.wrapper.keras_wrapper.KerasWrapper.load", "os.path.join" ]
[((509, 547), 'os.path.join', 'os.path.join', (['"""pipe1"""', '"""SimpleAE_4.h5"""'], {}), "('pipe1', 'SimpleAE_4.h5')\n", (521, 547), False, 'import os\n'), ((6535, 6600), 'unittest.mock.patch', 'patch', (['"""pywatts.wrapper.keras_wrapper.tf.keras.models.load_model"""'], {}), "('pywatts.wrapper.keras_wrapper.tf.kera...
#!/usr/bin/env python from flask import Flask, request from flask_cors import CORS, cross_origin import tensorflow as tf import models_tf as models import utils import os import json import urllib import cv2 import PIL import uuid import numpy as np import imutils from birads_prediction_tf import inference def save_fi...
[ "flask.request.files.getlist", "flask_cors.CORS", "cv2.cvtColor", "flask.Flask", "cv2.imdecode", "json.dumps", "birads_prediction_tf.inference", "PIL.Image.fromarray", "numpy.fromstring" ]
[((872, 887), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (877, 887), False, 'from flask import Flask, request\n'), ((888, 897), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (892, 897), False, 'from flask_cors import CORS, cross_origin\n'), ((353, 381), 'PIL.Image.fromarray', 'PIL.Image.fromarra...
from sgan import SGAN import sys import numpy as np from data_io import save_tensor if len(sys.argv) <= 1: print ("please give model filename") raise Exception('no filename specified') name = sys.argv[1] print ("using stored model", name) ##sample a periodically tiling texture def mosaic_tile(sgan, NZ1=12, ...
[ "numpy.random.uniform", "sgan.SGAN", "numpy.zeros", "numpy.abs" ]
[((2736, 2751), 'sgan.SGAN', 'SGAN', ([], {'name': 'name'}), '(name=name)\n', (2740, 2751), False, 'from sgan import SGAN\n'), ((572, 631), 'numpy.random.uniform', 'np.random.uniform', (['(-1.0)', '(1.0)', '(1, sgan.config.nz, NZ1, NZ2)'], {}), '(-1.0, 1.0, (1, sgan.config.nz, NZ1, NZ2))\n', (589, 631), True, 'import n...
import numpy as np import pytest from starfish import ImageStack from starfish.core.imagestack.test.factories import unique_tiles_imagestack from starfish.core.test.factories import ( two_spot_informative_blank_coded_data_factory, two_spot_one_hot_coded_data_factory, two_spot_sparse_coded_data_factory, ) f...
[ "starfish.core.test.factories.two_spot_sparse_coded_data_factory", "starfish.core.imagestack.test.factories.unique_tiles_imagestack", "numpy.zeros", "starfish.core.test.factories.two_spot_one_hot_coded_data_factory", "starfish.core.test.factories.two_spot_informative_blank_coded_data_factory", "pytest.mar...
[((701, 738), 'starfish.core.test.factories.two_spot_one_hot_coded_data_factory', 'two_spot_one_hot_coded_data_factory', ([], {}), '()\n', (736, 738), False, 'from starfish.core.test.factories import two_spot_informative_blank_coded_data_factory, two_spot_one_hot_coded_data_factory, two_spot_sparse_coded_data_factory\n...
## for data import numpy as np import pandas as pd ## for geospatial import folium import geopy ## for machine learning from sklearn import preprocessing ## for statistical tests import scipy ## for plotting import matplotlib.pyplot as plt import seaborn as sns ## for deep learning import minisom ''' Fit a Self...
[ "sklearn.preprocessing.StandardScaler", "scipy.cluster.vq.vq", "sklearn.preprocessing.MinMaxScaler", "folium.Element", "numpy.random.randint", "folium.Map", "folium.Icon", "numpy.sqrt", "folium.CircleMarker" ]
[((872, 902), 'sklearn.preprocessing.StandardScaler', 'preprocessing.StandardScaler', ([], {}), '()\n', (900, 902), False, 'from sklearn import preprocessing\n'), ((1620, 1672), 'scipy.cluster.vq.vq', 'scipy.cluster.vq.vq', (['cluster_centers', 'X_preprocessed'], {}), '(cluster_centers, X_preprocessed)\n', (1639, 1672)...
from abc import abstractmethod import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import griddata class Model: def __init__(self): super().__init__() self.X = [] self.y = [] @abstractmethod def predict(self, X): ''' Return a tuple of the mean and unce...
[ "matplotlib.pyplot.xlim", "numpy.meshgrid", "scipy.interpolate.griddata", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "numpy.zeros", "numpy.ones", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "matplotlib.pyplot.contourf", "numpy.linspace", "matplotlib.pyplot.gca" ]
[((975, 999), 'numpy.zeros', 'np.zeros', ([], {'shape': '(N, dim)'}), '(shape=(N, dim))\n', (983, 999), True, 'import numpy as np\n'), ((1083, 1112), 'numpy.linspace', 'np.linspace', (['*bounds[axis]', 'N'], {}), '(*bounds[axis], N)\n', (1094, 1112), True, 'import numpy as np\n'), ((1698, 1744), 'numpy.linspace', 'np.l...
# -*- coding: utf-8 -*- """Implements Calibrated Camera processor. Uses camera intrinsic parameters transforms the image. """ import cv2 import numpy as np from .base import * class PinholeCamera(namedtuple('PinholeCamera', ['size', 'matrix', 'distortion', 'rectify', 'projection'])): """Pinhole Camera model for...
[ "cv2.findChessboardCorners", "cv2.cvtColor", "numpy.zeros", "cv2.cornerSubPix", "cv2.remap", "numpy.prod", "numpy.indices", "cv2.calibrateCamera", "numpy.float64", "cv2.drawChessboardCorners", "cv2.imshow", "cv2.initUndistortRectifyMap" ]
[((3613, 3641), 'numpy.zeros', 'np.zeros', (['(3, 3)', 'np.float64'], {}), '((3, 3), np.float64)\n', (3621, 3641), True, 'import numpy as np\n'), ((3821, 3849), 'numpy.zeros', 'np.zeros', (['(1, 5)', 'np.float64'], {}), '((1, 5), np.float64)\n', (3829, 3849), True, 'import numpy as np\n'), ((9681, 9741), 'cv2.calibrate...
# The majority of the present code originally comes from # https://github.com/liyaguang/DCRNN/blob/master/lib/utils.py import numpy as np import tensorflow as tf import scipy.sparse as sp from scipy.sparse import linalg def calculate_normalized_laplacian(adj): """ # L = D^-1/2 (D-A) D^-1/2 = I - D...
[ "scipy.sparse.diags", "numpy.power", "numpy.transpose", "numpy.isinf", "scipy.sparse.linalg.eigsh", "scipy.sparse.coo_matrix", "scipy.sparse.csr_matrix", "scipy.sparse.identity", "tensorflow.sparse.reorder", "tensorflow.SparseTensor", "numpy.column_stack", "numpy.maximum.reduce", "scipy.spar...
[((407, 425), 'scipy.sparse.coo_matrix', 'sp.coo_matrix', (['adj'], {}), '(adj)\n', (420, 425), True, 'import scipy.sparse as sp\n'), ((567, 587), 'scipy.sparse.diags', 'sp.diags', (['d_inv_sqrt'], {}), '(d_inv_sqrt)\n', (575, 587), True, 'import scipy.sparse as sp\n'), ((797, 818), 'scipy.sparse.coo_matrix', 'sp.coo_m...
""" Test adding an image with a range one dimensions. There should be no slider shown for the axis corresponding to the range one dimension. """ import numpy as np from skimage import data import napari with napari.gui_qt(): np.random.seed(0) # image = 2 * np.random.random((20, 20, 3)) - 1.0 image = 20 ...
[ "numpy.random.seed", "napari.gui_qt", "numpy.clip", "numpy.random.random", "napari.view" ]
[((212, 227), 'napari.gui_qt', 'napari.gui_qt', ([], {}), '()\n', (225, 227), False, 'import napari\n'), ((233, 250), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (247, 250), True, 'import numpy as np\n'), ((405, 425), 'numpy.clip', 'np.clip', (['image', '(0)', '(1)'], {}), '(image, 0, 1)\n', (412, 42...
"""The implementation for a neighborhood based recommender.""" import heapq import numpy as np import scipy.sparse import scipy.sparse.linalg from . import recommender class KNNRecommender(recommender.PredictRecommender): """A neighborhood based collaborative filtering algorithm. The class supports both us...
[ "numpy.fill_diagonal", "numpy.zeros_like", "numpy.ones_like", "numpy.average", "numpy.empty", "numpy.isclose", "numpy.array", "numpy.tile" ]
[((1525, 1536), 'numpy.empty', 'np.empty', (['(0)'], {}), '(0)\n', (1533, 1536), True, 'import numpy as np\n'), ((1571, 1587), 'numpy.empty', 'np.empty', (['(0, 0)'], {}), '((0, 0))\n', (1579, 1587), True, 'import numpy as np\n'), ((1619, 1635), 'numpy.empty', 'np.empty', (['(0, 0)'], {}), '((0, 0))\n', (1627, 1635), T...
import numpy as np from numpy.lib.arraysetops import isin from sympy import Matrix, flatten, Rational from .. import (_LieAlgebraBackend) def _annotate(M: Matrix, basis: str) -> Matrix: """Adds basis attribute to sympy.Matrix""" setattr(M, "basis", basis) return M def _to_rational_tuple(obj): """Co...
[ "sympy.flatten", "numpy.array", "sympy.Matrix", "sympy.Rational" ]
[((724, 736), 'sympy.flatten', 'flatten', (['obj'], {}), '(obj)\n', (731, 736), False, 'from sympy import Matrix, flatten, Rational\n'), ((2303, 2331), 'sympy.Matrix', 'Matrix', (['*shape', 'plain_values'], {}), '(*shape, plain_values)\n', (2309, 2331), False, 'from sympy import Matrix, flatten, Rational\n'), ((540, 55...
####################################################################### # Copyright (C) # # 2016-2018 <NAME>(<EMAIL>) # # 2016 <NAME>(<EMAIL>) # # Permission given to modify the code as long as you keep this # # declaration...
[ "numpy.random.binomial", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.copy", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "numpy.argmax", "numpy.zeros", "numpy.max", "matplotlib.use", "numpy.arange", "numpy.random.choice", "matplotlib.pyplot.ylabel", "matplotlib.pyp...
[((489, 510), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (503, 510), False, 'import matplotlib\n'), ((6040, 6058), 'numpy.zeros', 'np.zeros', (['episodes'], {}), '(episodes)\n', (6048, 6058), True, 'import numpy as np\n'), ((6084, 6102), 'numpy.zeros', 'np.zeros', (['episodes'], {}), '(episod...
# Copyright 2015 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...
[ "os.mkdir", "numpy.load", "tensorflow.reduce_sum", "argparse.ArgumentParser", "tensorflow.trainable_variables", "tensorflow.reshape", "tensorflow.matmul", "tensorflow.assign", "tensorflow.Variable", "numpy.exp", "reader3.ptb_iterator", "reader3.ptb_raw_data", "tensorflow.get_variable", "te...
[((9304, 9315), 'time.time', 'time.time', ([], {}), '()\n', (9313, 9315), False, 'import time\n'), ((9423, 9492), 'reader3.ptb_iterator', 'rdr.ptb_iterator', (['data', "m.config['batch_size']", "m.config['num_steps']"], {}), "(data, m.config['batch_size'], m.config['num_steps'])\n", (9439, 9492), True, 'import reader3 ...
# -*- coding: utf-8 -*- """ Created on 2020.04.11 @author: MiniUFO Copyright 2018. All rights reserved. Use is subject to license terms. """ import os import numpy as np import xarray as xr import dask.array as dsa from dask.base import tokenize from glob import glob from pathlib import Path from .core import CtlDescr...
[ "dask.array.Array", "dask.delayed", "dask.base.tokenize", "numpy.fromfile", "os.path.getsize", "functools.reduce", "xarray.concat", "xarray.merge", "xarray.DataArray", "numpy.linspace", "dask.compute", "glob.glob", "numpy.memmap", "numpy.concatenate" ]
[((2023, 2054), 'xarray.concat', 'xr.concat', (['datasets'], {'dim': '"""time"""'}), "(datasets, dim='time')\n", (2032, 2054), True, 'import xarray as xr\n'), ((7744, 7763), 'xarray.merge', 'xr.merge', (['variables'], {}), '(variables)\n', (7752, 7763), True, 'import xarray as xr\n'), ((1620, 1649), 'dask.delayed', 'da...
import inspect import os import time import h5py import shutil import logging import subprocess import numpy as np from romshake.simulators.reorder_elements import run_reordering imt = 'PGV' mask_file = 'mask.npy' h5_gm_cor_file = 'loh1-GME_corrected.h5' remote_dir = '<EMAIL>:/hppfs/scratch/0B/di46bak/' sleepy_time =...
[ "numpy.load", "numpy.arange", "numpy.exp", "shutil.rmtree", "os.path.join", "numpy.savetxt", "os.path.exists", "numpy.save", "os.rename", "subprocess.check_output", "romshake.simulators.reorder_elements.run_reordering", "time.sleep", "inspect.getfile", "subprocess.call", "os.listdir", ...
[((994, 1023), 'logging.info', 'logging.info', (['"""Loading data."""'], {}), "('Loading data.')\n", (1006, 1023), False, 'import logging\n'), ((1066, 1097), 'os.path.join', 'os.path.join', (['folder', 'mask_file'], {}), '(folder, mask_file)\n', (1078, 1097), False, 'import os\n'), ((1109, 1134), 'os.path.exists', 'os....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 11 12:43:36 2021 @author: ziyi """ from utils import try_cuda, read_vocab, Tokenizer, vocab_pad_idx, vocab_eos_idx import numpy as np import json import networkx as nx import sys sys.path.append('build') import MatterSim import math import torch...
[ "sys.path.append", "numpy.load", "json.load", "numpy.sum", "numpy.flip", "networkx.set_node_attributes", "math.radians", "model.AttnDecoderLSTM", "utils.Tokenizer", "torch.cuda.is_available", "utils.read_vocab", "networkx.Graph", "follower.Seq2SeqAgent", "networkx.all_pairs_dijkstra_path_l...
[((254, 278), 'sys.path.append', 'sys.path.append', (['"""build"""'], {}), "('build')\n", (269, 278), False, 'import sys\n'), ((683, 706), 'utils.read_vocab', 'read_vocab', (['TRAIN_VOCAB'], {}), '(TRAIN_VOCAB)\n', (693, 706), False, 'from utils import try_cuda, read_vocab, Tokenizer, vocab_pad_idx, vocab_eos_idx\n'), ...
#!/usr/bin/env python """ Program for the regression of mlp about paramagnetic FCC Fe """ import argparse import copy # import time # import tqdm import random import numpy as np from mlptools.common.fileio import InputParams from mlptools.common.structure import Structure from mlptools.mlpgen.model import Terms fro...
[ "copy.deepcopy", "argparse.ArgumentParser", "random.choices", "numpy.hstack", "numpy.nonzero", "mlptools.mlpgen.model.Terms", "mlptools.mlpgen.regression.PotEstimation", "mlptools.common.fileio.InputParams", "mlptools.mlpgen.myIO.ReadFeatureParams", "mlptools.mlpgen.myIO.read_regression_params", ...
[((726, 758), 'numpy.delete', 'np.delete', (['array', 'index_array', '(1)'], {}), '(array, index_array, 1)\n', (735, 758), True, 'import numpy as np\n'), ((770, 810), 'numpy.hstack', 'np.hstack', (['(array[:, index_array], rest)'], {}), '((array[:, index_array], rest))\n', (779, 810), True, 'import numpy as np\n'), ((3...
from pathlib import Path import torch import re from torch.utils.data import Dataset from torch.utils.data import DataLoader from torch.utils.data.sampler import Sampler from torch.utils.data.distributed import DistributedSampler from dataclasses import dataclass from typing import Dict, Optional, Union, List, Tuple #...
[ "numpy.load", "json.load", "torch.stack", "torch.utils.data.DataLoader", "torch.utils.data.sampler.SequentialSampler", "torch.cat", "torch.utils.data.distributed.DistributedSampler", "pathlib.Path", "pickle.load", "torch.all", "torch.utils.data.sampler.RandomSampler", "torch.tensor", "re.com...
[((1841, 1971), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': 'batch_size', 'sampler': 'sampler', 'drop_last': 'is_train', 'num_workers': 'num_workers', 'collate_fn': 'collator'}), '(dataset, batch_size=batch_size, sampler=sampler, drop_last=\n is_train, num_workers=num_workers, collate_f...
import cv2 as cv import numpy as np feature_params=dict(maxCorners=300,qualityLevel=0.2,minDistance=2, blockSize=7) lk_params=dict(winSize = (15,15),maxLevel=2,criteria=(cv.TERM_CRITERIA_EPS|cv.TermCriteria_COUNT,10,0.03)) cap=cv.VideoCapture('../Assets/bees1.mp4') color=(0,255,0) ret,first_frame=cap.read() prev_gray...
[ "cv2.line", "numpy.zeros_like", "cv2.circle", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "cv2.goodFeaturesToTrack", "cv2.calcOpticalFlowPyrLK", "cv2.destroyAllWindows", "cv2.add" ]
[((228, 266), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""../Assets/bees1.mp4"""'], {}), "('../Assets/bees1.mp4')\n", (243, 266), True, 'import cv2 as cv\n'), ((321, 364), 'cv2.cvtColor', 'cv.cvtColor', (['first_frame', 'cv.COLOR_BGR2GRAY'], {}), '(first_frame, cv.COLOR_BGR2GRAY)\n', (332, 364), True, 'import cv2 as c...
# Copyright 2018-2020 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or...
[ "pennylane.numpy.tensordot", "pytest.importorskip", "autoray.numpy.array", "pennylane.math.dot", "pennylane.math.allequal", "numpy.array", "pennylane.numpy.array", "pennylane.math.multi_dispatch", "pytest.mark.parametrize" ]
[((815, 866), 'pytest.importorskip', 'pytest.importorskip', (['"""tensorflow"""'], {'minversion': '"""2.1"""'}), "('tensorflow', minversion='2.1')\n", (834, 866), False, 'import pytest\n'), ((875, 903), 'pytest.importorskip', 'pytest.importorskip', (['"""torch"""'], {}), "('torch')\n", (894, 903), False, 'import pytest...
import os, csv, six import numpy as np import pandas as pd from glob import glob from tqdm import tqdm from minepy import MINE from scipy import stats from itertools import permutations, combinations from sklearn import feature_selection from sklearn import ensemble from sklearn import linear_model from sklearn.decomp...
[ "os.remove", "sklearn.preprocessing.StandardScaler", "numpy.abs", "sklearn.preprocessing.MinMaxScaler", "scipy.stats.levene", "sklearn.feature_selection.SelectFromModel", "os.path.isfile", "radiomics.featureextractor.RadiomicsFeatureExtractor", "six.iteritems", "numpy.unique", "sklearn.impute.Si...
[((4215, 4270), 'sklearn.impute.SimpleImputer', 'SimpleImputer', ([], {'missing_values': 'np.nan', 'strategy': 'strategy'}), '(missing_values=np.nan, strategy=strategy)\n', (4228, 4270), False, 'from sklearn.impute import SimpleImputer\n'), ((4456, 4472), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {...
# nawiąż połączenie import psycopg2 from DB_connection_functions import * from DB_connection_parameters import user, password, host, port, database3 import numpy as np import pandas as pd import matplotlib.pyplot as plt try: # nawiązuje połączenie z bazą danych connection = psycopg2.connect(user=user, passwor...
[ "pandas.DataFrame", "matplotlib.pyplot.subplot", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "psycopg2.connect", "numpy.argmin", "matplotlib.pyplot.subplots", "matplotlib.pyplot.grid" ]
[((285, 377), 'psycopg2.connect', 'psycopg2.connect', ([], {'user': 'user', 'password': 'password', 'host': 'host', 'port': 'port', 'database': 'database3'}), '(user=user, password=password, host=host, port=port,\n database=database3)\n', (301, 377), False, 'import psycopg2\n'), ((4900, 4926), 'pandas.DataFrame', 'p...
import cv2 import numpy as np import sys import scipy.ndimage # import matplotlib.pyplot as plt def dodgeV2(image, mask): return cv2.divide(image, 255-mask, scale=256) def burnV2(image, mask): tmp = np.subtract(255, cv2.divide(255-image, 255-mask, scale=256)) return tmp def dodge(front,back): result=...
[ "numpy.stack", "numpy.sum", "numpy.copy", "numpy.logical_and", "cv2.cvtColor", "cv2.waitKey", "numpy.power", "cv2.imread", "numpy.max", "cv2.divide", "numpy.logical_or", "cv2.normalize", "numpy.dot", "cv2.imshow" ]
[((134, 174), 'cv2.divide', 'cv2.divide', (['image', '(255 - mask)'], {'scale': '(256)'}), '(image, 255 - mask, scale=256)\n', (144, 174), False, 'import cv2\n'), ((1223, 1273), 'numpy.dot', 'np.dot', (['marked_img[..., :3]', '[0.299, 0.587, 0.114]'], {}), '(marked_img[..., :3], [0.299, 0.587, 0.114])\n', (1229, 1273),...
""" Utils functions for main.py """ from datetime import timedelta import numpy as np def floor_30_minutes_dt(dt): """ Floor a datetime by 30 mins. For example: 2021-01-01 17:01:01 --> 2021-01-01 17:00:00 2021-01-01 17:35:01 --> 2021-01-01 17:30:00 :param dt: :return: """ approx...
[ "numpy.floor", "datetime.timedelta" ]
[((460, 485), 'datetime.timedelta', 'timedelta', ([], {'minutes': 'approx'}), '(minutes=approx)\n', (469, 485), False, 'from datetime import timedelta\n'), ((323, 349), 'numpy.floor', 'np.floor', (['(dt.minute / 30.0)'], {}), '(dt.minute / 30.0)\n', (331, 349), True, 'import numpy as np\n')]
import numpy as np import reaclib ip = 0 ihe4 = 1 ic12 = 2 ic13 = 3 in13 = 4 in14 = 5 in15 = 6 io14 = 7 io15 = 8 nnuc = 9 A = np.zeros((nnuc), dtype=np.int32) A[ip] = 1 A[ihe4] = 4 A[ic12] = 12 A[ic13] = 13 A[in13] = 13 A[in14] = 14 A[in15] = 15 A[io14] = 14 A[io15] = 15 def c12_pg_n13(tf): # p + c12 --> n13 ...
[ "numpy.zeros", "numpy.exp", "reaclib.Tfactors" ]
[((128, 158), 'numpy.zeros', 'np.zeros', (['nnuc'], {'dtype': 'np.int32'}), '(nnuc, dtype=np.int32)\n', (136, 158), True, 'import numpy as np\n'), ((362, 485), 'numpy.exp', 'np.exp', (['(17.1482 + -13.692 * tf.T913i + -0.230881 * tf.T913 + 4.44362 * tf.T9 + -\n 3.15898 * tf.T953 + -0.666667 * tf.lnT9)'], {}), '(17.1...
# Utilities for loading data from Stanford Dogs Dataset. # # <NAME>, 08/03/2021 import tensorflow as tf import tensorflow_datasets as tfds import numpy as np import matplotlib.pyplot as plt import datetime import os from PIL import Image def load_dataset(): """ Load stanford_dogs tensorflow dataset. :ret...
[ "matplotlib.pyplot.title", "tensorflow_datasets.load", "matplotlib.pyplot.xlabel", "os.path.abspath", "tensorflow.one_hot", "numpy.ndim", "tensorflow.keras.preprocessing.image.load_img", "tensorflow.cast", "tensorflow.keras.utils.get_file", "datetime.datetime.now", "matplotlib.pyplot.show", "t...
[((553, 687), 'tensorflow_datasets.load', 'tfds.load', (['"""stanford_dogs"""'], {'split': "['train', 'test']", 'shuffle_files': '(True)', 'as_supervised': '(False)', 'with_info': '(True)', 'data_dir': '"""data/tfds"""'}), "('stanford_dogs', split=['train', 'test'], shuffle_files=True,\n as_supervised=False, with_in...
""" Created on Mar 5, 2018 @author: lubo """ import logging import numpy as np from dae.genome.genomes_db import Genome from dae.variants.attributes import Sex, VariantDesc, VariantType logger = logging.getLogger(__name__) GENOTYPE_TYPE = np.int8 BEST_STATE_TYPE = np.int8 def mat2str(mat, col_sep="", row_sep="/...
[ "dae.variants.attributes.VariantDesc", "numpy.sum", "numpy.zeros", "logging.getLogger", "numpy.any", "numpy.logical_or", "numpy.all" ]
[((199, 226), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (216, 226), False, 'import logging\n'), ((894, 940), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2, cols)', 'dtype': 'GENOTYPE_TYPE'}), '(shape=(2, cols), dtype=GENOTYPE_TYPE)\n', (902, 940), True, 'import numpy as np\n'), ((980...
import matplotlib.pyplot as plt import numpy as np import satlas as s # Gather all information I = 1.0 J = [0.5, 0.5] ABC = [500, 200, 0, 0, 0, 0] df = 5000 np.random.seed(0) # Create the basemodel hfs = s.HFSModel(I, J, ABC, df, scale=3000, saturation=10) hfs.background = 200 constraintsDict = {'Au': {'min': None, '...
[ "numpy.random.seed", "numpy.random.randn", "satlas.HFSModel", "numpy.linspace", "satlas.chisquare_spectroscopic_fit", "numpy.sqrt" ]
[((159, 176), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (173, 176), True, 'import numpy as np\n'), ((206, 258), 'satlas.HFSModel', 's.HFSModel', (['I', 'J', 'ABC', 'df'], {'scale': '(3000)', 'saturation': '(10)'}), '(I, J, ABC, df, scale=3000, saturation=10)\n', (216, 258), True, 'import satlas as ...
#!/usr/bin/env python # _*_ coding: utf-8 _*_ import os import sys import numpy as np import matplotlib.pyplot as plt class PdosOut: """ """ def __init__(self): self.data = {} # contain the pdos data but not the tdos self.tdos = None self.energies = None ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.tight_layout", "os.path.join", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "os.path.exists", "os.system", "sys.exit", "numpy.loadtxt", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.ylabel", "matplotlib.p...
[((1280, 1299), 'os.chdir', 'os.chdir', (['directory'], {}), '(directory)\n', (1288, 1299), False, 'import os\n'), ((1309, 1377), 'os.system', 'os.system', (['("ls | grep \'%s.pdos_\' > projwfc-pdos-file.data" % filpdos)'], {}), '("ls | grep \'%s.pdos_\' > projwfc-pdos-file.data" % filpdos)\n', (1318, 1377), False, 'im...
# Copyright 2018 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
[ "cirq.resolve_parameters", "sympy.Symbol", "cirq.testing.EqualsTester", "numpy.complex128", "numpy.float32", "cirq.ParamResolver", "pytest.raises", "numpy.int32", "numpy.complex64", "pytest.mark.parametrize", "numpy.float64", "fractions.Fraction" ]
[((1073, 1204), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""val,resolved"""', '[(sympy.pi, np.pi), (sympy.S.NegativeOne, -1), (sympy.S.Half, 0.5), (sympy.\n S.One, 1)]'], {}), "('val,resolved', [(sympy.pi, np.pi), (sympy.S.\n NegativeOne, -1), (sympy.S.Half, 0.5), (sympy.S.One, 1)])\n", (1096, 120...
# %jupyter_snippet import import pinocchio as pin from utils.meshcat_viewer_wrapper import MeshcatVisualizer import time import numpy as np from numpy.linalg import inv,norm,pinv,svd,eig from scipy.optimize import fmin_bfgs,fmin_slsqp from utils.load_ur5_with_obstacles import load_ur5_with_obstacles,Target import matpl...
[ "matplotlib.pylab.colorbar", "pinocchio.updateGeometryPlacements", "pinocchio.framesForwardKinematics", "matplotlib.pylab.scatter", "matplotlib.pylab.subplot", "pinocchio.computeCollisions", "utils.meshcat_viewer_wrapper.MeshcatVisualizer", "time.sleep", "matplotlib.pylab.plot", "pinocchio.compute...
[((362, 371), 'matplotlib.pylab.ion', 'plt.ion', ([], {}), '()\n', (369, 371), True, 'import matplotlib.pylab as plt\n'), ((445, 482), 'utils.load_ur5_with_obstacles.load_ur5_with_obstacles', 'load_ur5_with_obstacles', ([], {'reduced': '(True)'}), '(reduced=True)\n', (468, 482), False, 'from utils.load_ur5_with_obstacl...
import algos_torch import numpy as np import common.object_factory import common.env_configurations as env_configurations import algos_torch.network_builder as network_builder import algos_torch.model_builder as model_builder import algos_torch.a2c_continuous as a2c_continuous import algos_torch.a2c_discrete as a2c_di...
[ "pymongo.MongoClient", "yaml.load", "pprint.pformat", "numpy.random.seed", "argparse.ArgumentParser", "utils.logging.Logger", "yaml.safe_load", "os.path.join", "os.path.abspath", "os.path.dirname", "algos_torch.a2c_continuous.A2CAgent", "utils.logging.get_logger", "common.experiment.Experime...
[((1013, 1025), 'utils.logging.get_logger', 'get_logger', ([], {}), '()\n', (1023, 1025), False, 'from utils.logging import get_logger, Logger\n'), ((1032, 1052), 'sacred.Experiment', 'Experiment', (['"""pymarl"""'], {}), "('pymarl')\n", (1042, 1052), False, 'from sacred import Experiment, SETTINGS\n'), ((7992, 8004), ...
# Simple CNN model for CIFAR-10 import numpy from keras.datasets import mnist from keras import backend as K K.set_image_dim_ordering('th') import utils as ut import numpy as np from keras.models import load_model import matplotlib.pyplot as plt # fix random seed for reproducibility seed = 7 numpy.random.seed(seed) #...
[ "keras.models.load_model", "numpy.load", "numpy.save", "numpy.random.seed", "keras.datasets.mnist.load_data", "numpy.zeros", "keras.backend.set_image_dim_ordering", "utils.evaluate_l2_norm_keras", "numpy.linspace", "utils.compute_thresholding_sparsification" ]
[((109, 139), 'keras.backend.set_image_dim_ordering', 'K.set_image_dim_ordering', (['"""th"""'], {}), "('th')\n", (133, 139), True, 'from keras import backend as K\n'), ((294, 317), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), '(seed)\n', (311, 317), False, 'import numpy\n'), ((370, 387), 'keras.datasets.m...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ..author:: <NAME>, ETH Zürich, Switzerland. ..date:: September 2017 Code for training a LSTM model on peptide sequences followed by sampling novel sequences through the model. Check the readme for possible flags to use with this script. """ import json import os import...
[ "sklearn.preprocessing.StandardScaler", "argparse.ArgumentParser", "tensorflow.keras.layers.Dense", "tensorflow.keras.callbacks.ModelCheckpoint", "numpy.mean", "numpy.random.randint", "numpy.exp", "tensorflow.keras.models.Sequential", "tensorflow.keras.regularizers.l2", "modlamp.descriptors.Peptid...
[((1103, 1128), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (1121, 1128), True, 'import matplotlib.pyplot as plt\n'), ((1137, 1162), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1160, 1162), False, 'import argparse\n'), ((5117, 5133), 'numpy.ar...
from typing import Optional, Sequence, Tuple, List, Dict import torch import torch.nn as nn import model.backbone as backbone import torch.nn.functional as F # from dalib.modules.classifier import Classifier as ClassifierBase # from dalib.modules.kernels import optimal_kernel_combinations from numpy import array, dot i...
[ "torch.nn.Dropout", "torch.nn.ReLU", "torch.nn.Sequential", "torch.nn.BatchNorm1d", "torch.nn.CrossEntropyLoss", "torch.cat", "numpy.zeros", "torch.exp", "torch.nn.Softmax", "numpy.array", "torch.nn.Linear", "torch.zeros", "numpy.eye", "torch.tensor", "numpy.all", "torch.nn.Sigmoid" ]
[((11514, 11546), 'numpy.all', 'np.all', (['(kernel_values_numpy <= 0)'], {}), '(kernel_values_numpy <= 0)\n', (11520, 11546), True, 'import numpy as np\n'), ((926, 968), 'torch.nn.Sequential', 'nn.Sequential', (['*self.bottleneck_layer_list'], {}), '(*self.bottleneck_layer_list)\n', (939, 968), True, 'import torch.nn ...
if __name__ == "__main__": import numpy as np array = np.zeros((32,32)) print(array.shape) array = array.reshape(1,32,32,1) print(array.shape) from readTrafficSigns import readTrafficSigns from matplotlib import pyplot as plt trainImages, trainLabels = readTrafficSigns( "./traf...
[ "readTrafficSigns.readTrafficSigns", "matplotlib.pyplot.imshow", "numpy.zeros", "matplotlib.pyplot.show" ]
[((62, 80), 'numpy.zeros', 'np.zeros', (['(32, 32)'], {}), '((32, 32))\n', (70, 80), True, 'import numpy as np\n'), ((287, 394), 'readTrafficSigns.readTrafficSigns', 'readTrafficSigns', (['"""./traffic-signs-data/GTSRB_Final_Training_Images/GTSRB/Final_Training/Images/"""'], {}), "(\n './traffic-signs-data/GTSRB_Fin...
import pytest import mplstereonet import numpy as np class TestParseStrikes: def test_parse_strike(self): data = [ [('N30E', '45NW'), (210, 45)], [('210', '45'), (210, 45)], [('E10N', '20NW'), (260, 20)], [('350', '40W'), (170, 40)], ...
[ "mplstereonet.parse_strike_dip", "mplstereonet.parse_azimuth", "numpy.allclose", "mplstereonet.parse_quadrant_measurement", "mplstereonet.parse_rake", "mplstereonet.parse_plunge_bearing", "pytest.raises" ]
[((484, 520), 'mplstereonet.parse_strike_dip', 'mplstereonet.parse_strike_dip', (['*test'], {}), '(*test)\n', (513, 520), False, 'import mplstereonet\n'), ((540, 568), 'numpy.allclose', 'np.allclose', (['result', 'correct'], {}), '(result, correct)\n', (551, 568), True, 'import numpy as np\n'), ((3025, 3055), 'mplstere...
# -*- coding: utf-8 -*- # # misc.py # # Copyright 2020 Amazon.com, Inc. or its affiliates. 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/l...
[ "os.mkdir", "json.dump", "json.load", "numpy.random.seed", "csv.reader", "os.makedirs", "math.ceil", "torch.manual_seed", "numpy.asarray", "os.path.exists", "glob.glob", "torch.device", "os.path.join", "os.listdir" ]
[((1887, 1930), 'os.path.join', 'os.path.join', (['args.save_path', '"""config.json"""'], {}), "(args.save_path, 'config.json')\n", (1899, 1930), False, 'import os\n'), ((6067, 6085), 'numpy.asarray', 'np.asarray', (['entity'], {}), '(entity)\n', (6077, 6085), True, 'import numpy as np\n'), ((6390, 6426), 'os.path.join...
## # @file electric_potential_unitest.py # @author <NAME> # @date Mar 2019 # import time import numpy as np import unittest import logging import torch from torch.autograd import Function, Variable import os import sys import gzip sys.path.append( os.path.dirname(os.path.dirname(os.path.dirname( os.p...
[ "sys.path.pop", "torch.cuda.synchronize", "matplotlib.pyplot.savefig", "torch.cuda.device_count", "matplotlib.pyplot.figure", "torch.set_num_threads", "numpy.arange", "numpy.mean", "unittest.main", "_pickle.load", "os.path.abspath", "numpy.meshgrid", "matplotlib.pyplot.close", "matplotlib....
[((505, 519), 'sys.path.pop', 'sys.path.pop', ([], {}), '()\n', (517, 519), False, 'import sys\n'), ((684, 705), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (698, 705), False, 'import matplotlib\n'), ((8795, 8807), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (8805, 8807), True,...
# -*- coding: utf-8 -*- """ Created on Mon Jan 24 17:01:16 2022 Determine optic flow given two images @author: guido """ import cv2 import numpy as np from matplotlib import pyplot as plt def determine_optic_flow(filename_1, filename_2, method='Harris', max_points = 100, graphics = True): # load the BGR color...
[ "numpy.random.choice", "cv2.drawKeypoints", "numpy.int0", "cv2.circle", "cv2.cvtColor", "numpy.float32", "numpy.zeros", "cv2.FastFeatureDetector_create", "cv2.imread", "cv2.goodFeaturesToTrack", "cv2.calcOpticalFlowPyrLK", "cv2.imshow", "cv2.cornerHarris" ]
[((340, 362), 'cv2.imread', 'cv2.imread', (['filename_1'], {}), '(filename_1)\n', (350, 362), False, 'import cv2\n'), ((416, 455), 'cv2.cvtColor', 'cv2.cvtColor', (['BGR_1', 'cv2.COLOR_BGR2GRAY'], {}), '(BGR_1, cv2.COLOR_BGR2GRAY)\n', (428, 455), False, 'import cv2\n'), ((501, 523), 'cv2.imread', 'cv2.imread', (['filen...
# imports import sys import matplotlib.pyplot as plt import numpy as np from pathlib import Path from scipy.signal import medfilt sys.path.append("./") from data.dbase.db_tables import Recording, LocomotionBouts from fcutils.plot.figure import clean_axes from analysis.ephys.utils import ( get_data, get_clea...
[ "analysis.ephys.viz.bouts_raster", "pathlib.Path", "matplotlib.pyplot.figure", "numpy.arange", "fcutils.plot.figure.clean_axes", "analysis.ephys.tuning_curves.get_tuning_curves", "sys.path.append", "matplotlib.pyplot.close", "scipy.signal.medfilt", "analysis.ephys.utils.get_data", "analysis.ephy...
[((131, 152), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (146, 152), False, 'import sys\n'), ((1145, 1213), 'pathlib.Path', 'Path', (['"""D:\\\\Dropbox (UCL)\\\\Rotation_vte\\\\Locomotion\\\\analysis\\\\ephys"""'], {}), "('D:\\\\Dropbox (UCL)\\\\Rotation_vte\\\\Locomotion\\\\analysis\\\\ephys...
# -*- coding: utf-8 -*- """Hw2.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1sygHqvk0q2joBLtaOA3NQILrUbrA54yI **Part A** **Load Data** """ # import necessary libraries import pandas as pd df = pd.read_csv('/content/drive/MyDrive/tree/Aga...
[ "numpy.argmax", "pandas.read_csv", "numpy.std", "sklearn.metrics.accuracy_score", "numpy.log2", "sklearn.model_selection.KFold", "sklearn.preprocessing.LabelEncoder", "sklearn.metrics.classification_report", "numpy.finfo", "numpy.mean", "pandas.Series", "numpy.unique" ]
[((276, 362), 'pandas.read_csv', 'pd.read_csv', (['"""/content/drive/MyDrive/tree/Agaricus-lepiota.data.txt"""'], {'header': 'None'}), "('/content/drive/MyDrive/tree/Agaricus-lepiota.data.txt', header\n =None)\n", (287, 362), True, 'import pandas as pd\n'), ((7140, 7154), 'sklearn.preprocessing.LabelEncoder', 'Label...
import os import argparse import json import torch import numpy as np from datasets.oxford import get_dataloaders from datasets.boreas import get_dataloaders_boreas from networks.under_the_radar import UnderTheRadar from networks.hero import HERO from utils.utils import get_lr from utils.losses import supervised_loss,...
[ "utils.losses.supervised_loss", "numpy.random.seed", "argparse.ArgumentParser", "utils.monitor.SteamMonitor", "os.path.isfile", "torch.set_num_threads", "datasets.boreas.get_dataloaders_boreas", "torch.device", "torch.no_grad", "os.path.join", "networks.under_the_radar.UnderTheRadar", "torch.m...
[((611, 631), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (628, 631), False, 'import torch\n'), ((632, 649), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (646, 649), True, 'import numpy as np\n'), ((650, 674), 'torch.set_num_threads', 'torch.set_num_threads', (['(8)'], {}), '(8)\...
import ReadData from matplotlib import pyplot as plt from collections import Counter import numpy as np def Flatten(l): return [item for sublist in l for item in sublist] #len_stat = [len(i) for i in short_data] #ttt = sum([i > 500 for i in len_stat]) + sum([i < 80 for i in len_stat]) #print(ttt/len(len_stat)) ...
[ "numpy.array" ]
[((1075, 1093), 'numpy.array', 'np.array', (['len_stat'], {}), '(len_stat)\n', (1083, 1093), True, 'import numpy as np\n'), ((1114, 1132), 'numpy.array', 'np.array', (['len_stat'], {}), '(len_stat)\n', (1122, 1132), True, 'import numpy as np\n'), ((1153, 1171), 'numpy.array', 'np.array', (['len_stat'], {}), '(len_stat)...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os.path as osp import os import tensorflow as tf import time import numpy as np import data_io.basepy as basepy import multiprocessing as mp def main(_): tags = tf.flags # Net config tags....
[ "numpy.load", "numpy.save", "data_io.basepy.check_or_create_path", "numpy.average", "os.remove", "os.path.basename", "numpy.argmax", "numpy.maximum", "time.time", "numpy.argsort", "data_io.basepy.get_1tier_file_path_list", "numpy.array", "multiprocessing.Pool", "data_io.basepy.read_txt_lin...
[((3613, 3630), 'numpy.load', 'np.load', (['npy_file'], {}), '(npy_file)\n', (3620, 3630), True, 'import numpy as np\n'), ((6101, 6139), 'numpy.save', 'np.save', (['npy_result_file', 'new_npy_data'], {}), '(npy_result_file, new_npy_data)\n', (6108, 6139), True, 'import numpy as np\n'), ((6666, 6692), 'numpy.array', 'np...
import random import numpy as np from collections import deque class ReplayBuffer: """ replay bufferstores and retrieves gameplay experiences """ def __init__(self): self.gameplay_experiences = deque(maxlen=1000000) def store_gameplay_experience(self, current_obs, next_obs, ...
[ "random.sample", "numpy.array", "collections.deque" ]
[((232, 253), 'collections.deque', 'deque', ([], {'maxlen': '(1000000)'}), '(maxlen=1000000)\n', (237, 253), False, 'from collections import deque\n'), ((1166, 1218), 'random.sample', 'random.sample', (['self.gameplay_experiences', 'batch_size'], {}), '(self.gameplay_experiences, batch_size)\n', (1179, 1218), False, 'i...
# coding: utf-8 # # Random Forest # # In this lab you will learn the most important aspects of the random forest learning method. # Completing this lab and analyzing the code will give you a deeper understanding of these type of models. # In our experiments we will mostly use the package sklearn from which we impor...
[ "sklearn.ensemble.RandomForestClassifier", "matplotlib.pyplot.show", "pandas.read_csv", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.legend", "matplotlib.pyplot.scatter", "sklearn.datasets.make_classification", "matplotlib.pyplot.contourf", "numpy.arange" ]
[((874, 999), 'sklearn.datasets.make_classification', 'make_classification', ([], {'n_samples': '(1000)', 'n_features': '(2)', 'n_redundant': '(0)', 'n_informative': '(2)', 'random_state': '(1)', 'n_clusters_per_class': '(1)'}), '(n_samples=1000, n_features=2, n_redundant=0,\n n_informative=2, random_state=1, n_clus...
""" CEASIOMpy: Conceptual Aircraft Design Software Developed for CFS ENGINEERING, 1015 Lausanne, Switzerland The script evaluates the centre of gravity coordinates in case of: * OEM = Operating empty mass; * MTOM = Maximum take off mass, with Max Payload: * ZFM = zero fuel mass; * ZPM = zero Payload mass * With a pe...
[ "numpy.amax", "numpy.zeros", "numpy.sum", "numpy.concatenate" ]
[((3712, 3741), 'numpy.zeros', 'np.zeros', (['(max_seg_n, tot_nb)'], {}), '((max_seg_n, tot_nb))\n', (3720, 3741), True, 'import numpy as np\n'), ((6427, 6498), 'numpy.concatenate', 'np.concatenate', (['(ag.fuse_center_seg_point, ag.wing_center_seg_point)', '(1)'], {}), '((ag.fuse_center_seg_point, ag.wing_center_seg_p...
# Lint as: python3 """Tests for epi_forecast_stat_mech.high_level.""" import collections import functools from absl.testing import absltest from absl.testing import parameterized from epi_forecast_stat_mech import high_level from epi_forecast_stat_mech import sir_sim from epi_forecast_stat_mech.evaluation import run...
[ "epi_forecast_stat_mech.sir_sim.generate_social_distancing_simulations", "functools.partial", "absl.testing.absltest.main", "numpy.random.seed", "epi_forecast_stat_mech.high_level.RtLiveEstimator", "epi_forecast_stat_mech.high_level.get_estimator_dict", "numpy.testing.assert_array_equal", "epi_forecas...
[((395, 425), 'jax.config.config.parse_flags_with_absl', 'config.parse_flags_with_absl', ([], {}), '()\n', (423, 425), False, 'from jax.config import config\n'), ((662, 682), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (676, 682), True, 'import numpy as np\n'), ((738, 856), 'functools.partial', '...
# Copyright (c) 2019 Toyota Research Institute. All rights reserved. """ This module contains basic campaign functionality. Objects and logic in this module should be very generic and not constrained to a particular mode of materials discovery. Furthermore, the "Campaign" logic should be kept as simple as possible....
[ "pandas.DataFrame", "numpy.random.seed", "os.getcwd", "camd.agent.base.RandomAgent", "os.path.exists", "camd.utils.data.s3_sync", "os.path.isfile", "os.chdir", "os.path.join", "os.listdir", "shutil.copy" ]
[((14269, 14291), 'os.listdir', 'os.listdir', (['source_dir'], {}), '(source_dir)\n', (14279, 14291), False, 'import os\n'), ((3069, 3083), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (3081, 3083), True, 'import pandas as pd\n'), ((3415, 3434), 'os.chdir', 'os.chdir', (['self.path'], {}), '(self.path)\n', (34...
import numpy as np import matplotlib.pyplot as plt import itertools from sklearn import metrics import pandas as pd import statsmodels.api as sm from corrplots import partialcorr from functools import partial from scipy import stats import cycluster as cy __all__ = ['compareClusters', 'alignClusters', ...
[ "numpy.sum", "numpy.abs", "numpy.argmax", "sklearn.metrics.adjusted_mutual_info_score", "numpy.argsort", "numpy.arange", "sklearn.metrics.adjusted_rand_score", "corrplots.partialcorr", "statsmodels.api.stats.multipletests", "numpy.unique", "pandas.DataFrame", "pandas.merge", "functools.parti...
[((831, 849), 'numpy.unique', 'np.unique', (['labelsA'], {}), '(labelsA)\n', (840, 849), True, 'import numpy as np\n'), ((3121, 3176), 'pandas.DataFrame', 'pd.DataFrame', (['out'], {'index': 'dfB.index', 'columns': 'dfB.columns'}), '(out, index=dfB.index, columns=dfB.columns)\n', (3133, 3176), True, 'import pandas as p...
import struct import uuid import asyncio import numpy as np from bleak import BleakClient from bleak import discover # from bleak import _logger as logger class TindeqProgressor(object): response_codes = { 'cmd_resp': 0, 'weight_measure': 1, 'low_pwr': 4 } cmds = dict( TARE_SCALE=0x64, ...
[ "struct.Struct", "asyncio.get_event_loop", "asyncio.sleep", "struct.unpack", "numpy.mean", "uuid.UUID", "bleak.BleakClient", "bleak.discover" ]
[((6359, 6383), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (6381, 6383), False, 'import asyncio\n'), ((1536, 1556), 'struct.Struct', 'struct.Struct', (['"""<bb"""'], {}), "('<bb')\n", (1549, 1556), False, 'import struct\n'), ((1584, 1604), 'struct.Struct', 'struct.Struct', (['"""<fl"""'], {})...
import numpy as np from datetime import datetime, timedelta from numpy import nanmean from get_kpap import get_kpap def get_apmsis(dn): """ Function: get_apmsis(dn) --------------------- returns an array of calculated ap indices suitable for MSIS. MSIS requires an array of ap values, described in ...
[ "get_kpap.get_kpap", "numpy.zeros", "numpy.isnan", "datetime.datetime", "datetime.timedelta", "numpy.nanmean" ]
[((1344, 1356), 'get_kpap.get_kpap', 'get_kpap', (['dn'], {}), '(dn)\n', (1352, 1356), False, 'from get_kpap import get_kpap\n'), ((1958, 1969), 'numpy.zeros', 'np.zeros', (['(8)'], {}), '(8)\n', (1966, 1969), True, 'import numpy as np\n'), ((2721, 2732), 'numpy.zeros', 'np.zeros', (['(8)'], {}), '(8)\n', (2729, 2732),...
import numpy as np import random import tensorflow as tf from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.layers import ( Input, Conv2D, Dense, Flatten, Embedding, Concatenate, GlobalMaxPool1D, Conv1...
[ "mlflow.tensorflow.autolog", "mlflow.tracking.MlflowClient", "tensorflow.keras.layers.Dense", "mlflow.get_artifact_uri", "mlflow.create_experiment", "mlflow.log_artifact", "os.path.isfile", "os.path.join", "tensorflow.keras.layers.Flatten", "mlflow.start_run", "tensorflow.keras.preprocessing.tex...
[((3441, 3474), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': 'text_model_inp_shape'}), '(shape=text_model_inp_shape)\n', (3446, 3474), False, 'from tensorflow.keras.layers import Input, Conv2D, Dense, Flatten, Embedding, Concatenate, GlobalMaxPool1D, Conv1D, MaxPooling1D\n'), ((3498, 3526), 'tensorflow.kera...
"""Test module for general class metafeatures.""" import pytest from pymfe.mfe import MFE from tests.utils import load_xy import numpy as np GNAME = "general" class TestGeneral: """TestClass dedicated to test general metafeatures.""" @pytest.mark.parametrize( "dt_id, ft_name, exp_value, precompute"...
[ "pytest.mark.parametrize", "tests.utils.load_xy", "pymfe.mfe.MFE", "numpy.allclose" ]
[((248, 2418), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dt_id, ft_name, exp_value, precompute"""', "[(0, 'attr_to_inst', 0.08, False), (0, 'cat_to_num', 1, False), (0,\n 'freq_class', [0.5, 0.0], False), (0, 'inst_to_attr', 12.5, False), (0,\n 'nr_attr', 4, False), (0, 'nr_bin', 0, False), (0, ...
# -*- coding: utf-8 -*- import numpy as np import pytest from sudoku.sudoku import Sudoku @pytest.fixture def sudoku_board(): s = Sudoku() # creates numpy array [[1 2 3] [4 5 6]]. s._matrix = np.arange(1, 7, 1).reshape([2, 3]) return s
[ "sudoku.sudoku.Sudoku", "numpy.arange" ]
[((138, 146), 'sudoku.sudoku.Sudoku', 'Sudoku', ([], {}), '()\n', (144, 146), False, 'from sudoku.sudoku import Sudoku\n'), ((208, 226), 'numpy.arange', 'np.arange', (['(1)', '(7)', '(1)'], {}), '(1, 7, 1)\n', (217, 226), True, 'import numpy as np\n')]
''' Sparse approximation using Smolyak's algorithm Usage: 1) Setup a function instance that computes elements in a multi-index decomposition (and possibly auxiliary information about work and contribution of the computed terms). Here, it can be helpful to use MixedDifferences from the module indices ...
[ "math.isinf", "swutil.validation.Function", "numpy.linalg.norm", "numpy.exp", "swutil.validation.NotPassed", "smolyak.indices.MultiIndex", "numpy.prod", "collections.deque", "smolyak.indices.get_bundle", "swutil.collections.DefaultDict", "smolyak.indices.get_bundles", "smolyak.indices.MultiInd...
[((1826, 1899), 'swutil.validation.validate_args', 'validate_args', (['"""multipliers>(~func,~dims) multipliers==n"""'], {'warnings': '(False)'}), "('multipliers>(~func,~dims) multipliers==n', warnings=False)\n", (1839, 1899), False, 'from swutil.validation import NotPassed, Positive, Integer, Float, validate_args, Non...
import numpy, sys, os, shutil templates = [(1, '%s*', 'q1'), (2, '%s %s*', 'q2'), (3, '%s %s* %s*', 'q3'), (2, '(%s | %s)*' , 'q4_2'), (3, '(%s | %s | %s)*', 'q4_3'), (4, '(%s | %s | %s | %s)*', 'q4_4'), (5, '(%s | %s | %s | %s | %s)*', 'q4_5'), (3, '%s %s* %s', 'q5'), (2, '%s* %s*', 'q6'),...
[ "os.mkdir", "os.path.exists", "numpy.random.permutation", "shutil.rmtree", "os.path.join" ]
[((892, 921), 'numpy.random.permutation', 'numpy.random.permutation', (['lst'], {}), '(lst)\n', (916, 921), False, 'import numpy, sys, os, shutil\n'), ((1305, 1334), 'os.path.join', 'os.path.join', (['root_dir', 'qd[0]'], {}), '(root_dir, qd[0])\n', (1317, 1334), False, 'import numpy, sys, os, shutil\n'), ((1346, 1366)...
import os import numpy as np import argparse import torch import time import librosa import pickle import preprocess from trainingDataset import trainingDataset from model_GLU import Generator, Discriminator def loadPickleFile(fileName): with open(fileName, 'rb') as f: return pickle.load(f) parser = ...
[ "torch.nn.MSELoss", "numpy.load", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "model_GLU.Discriminator", "trainingDataset.trainingDataset", "time.time", "model_GLU.Generator", "torch.optim.Adam", "pickle.load", "torch.cuda.is_available" ]
[((320, 418), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train CycleGAN using source dataset and target dataset"""'}), "(description=\n 'Train CycleGAN using source dataset and target dataset')\n", (343, 418), False, 'import argparse\n'), ((3183, 3212), 'numpy.load', 'np.load', ([...
from cv2 import cv2 import numpy as np import sys image_name = input("Enter the name of the input image: ") # reading the image img = cv2.imread(image_name) while img is None: image_name = input("Enter the name of the input image or Enter 'exit' to end program : ") # if end the program if im...
[ "cv2.cv2.destroyAllWindows", "cv2.cv2.blur", "cv2.cv2.waitKey", "cv2.cv2.bilateralFilter", "sys.exit", "cv2.cv2.resize", "cv2.cv2.divide", "cv2.cv2.imwrite", "cv2.cv2.GaussianBlur", "cv2.cv2.imread", "cv2.cv2.bitwise_not", "cv2.cv2.cvtColor", "numpy.concatenate", "cv2.cv2.imshow" ]
[((143, 165), 'cv2.cv2.imread', 'cv2.imread', (['image_name'], {}), '(image_name)\n', (153, 165), False, 'from cv2 import cv2\n'), ((486, 527), 'cv2.cv2.resize', 'cv2.resize', (['img', '(0, 0)', 'None', '(0.75)', '(0.75)'], {}), '(img, (0, 0), None, 0.75, 0.75)\n', (496, 527), False, 'from cv2 import cv2\n'), ((577, 61...
# encoding: utf-8 import operator import numpy as np import PIL from histolab.filters import image_filters as imf from ...unitutil import PILIMG, NpArrayMock, function_mock class DescribeImageFilters: def it_calls_invert_filter_functional(self, request): image = PILIMG.RGBA_COLOR_500X500_155_249_240 ...
[ "histolab.filters.image_filters.RgbToGrayscale", "histolab.filters.image_filters.GreenPenFilter", "histolab.filters.image_filters.OtsuThreshold", "histolab.filters.image_filters.RgbToHsv", "histolab.filters.image_filters.CannyEdges", "histolab.filters.image_filters.AdaptiveEqualization", "histolab.filte...
[((490, 502), 'histolab.filters.image_filters.Invert', 'imf.Invert', ([], {}), '()\n', (500, 502), True, 'from histolab.filters import image_filters as imf\n'), ((873, 893), 'histolab.filters.image_filters.RgbToGrayscale', 'imf.RgbToGrayscale', ([], {}), '()\n', (891, 893), True, 'from histolab.filters import image_fil...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Tests for comparing RDMs @author: heiko """ import unittest import numpy as np from numpy.testing import assert_array_almost_equal import pyrsa as rsa class TestCompareRDM(unittest.TestCase): def setUp(self): dissimilarities1 = np.random.rand(1, 15) ...
[ "numpy.sum", "pyrsa.rdm.compare.compare_correlation_cov_weighted", "numpy.ones", "pyrsa.rdm.compare._all_combinations", "numpy.mean", "pyrsa.rdm.compare.compare_cosine", "pyrsa.rdm.compare._cosine_cov_weighted", "numpy.testing.assert_array_almost_equal", "pyrsa.rdm.RDMs", "pyrsa.rdm.compare._parse...
[((296, 317), 'numpy.random.rand', 'np.random.rand', (['(1)', '(15)'], {}), '(1, 15)\n', (310, 317), True, 'import numpy as np\n'), ((384, 482), 'pyrsa.rdm.RDMs', 'rsa.rdm.RDMs', ([], {'dissimilarities': 'dissimilarities1', 'dissimilarity_measure': '"""test"""', 'descriptors': 'des1'}), "(dissimilarities=dissimilaritie...
#General Imports import numpy as np import random import collections import timeit import copy #Dice Imports from dice_ml.explainer_interfaces.explainer_base import ExplainerBase from dice_ml import diverse_counterfactuals as exp from dice_ml.utils.sample_architecture.vae_model import CF_VAE from dice_ml.utils.helpers...
[ "torch.mean", "torch.utils.data.DataLoader", "torch.sum", "torch.load", "dice_ml.diverse_counterfactuals.CounterfactualExamples", "torch.abs", "numpy.array", "numpy.reshape", "torch.nn.functional.sigmoid", "torch.zeros", "numpy.array_split", "torch.log", "torch.tensor", "dice_ml.utils.help...
[((1679, 1885), 'dice_ml.utils.helpers.get_base_gen_cf_initialization', 'get_base_gen_cf_initialization', (['self.data_interface', 'self.encoded_size', 'self.cont_minx', 'self.cont_maxx', 'self.margin', 'self.validity_reg', 'self.epochs', 'self.wm1', 'self.wm2', 'self.wm3', 'self.learning_rate'], {}), '(self.data_inter...
from TSP_utils import TSP_solver, TSP_plotter, TSP_generator, TSP_loader import numpy as np import networkx as nx import tqdm import tsplib95 import time import re import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm import statsmodels.formula.api as smf def get_cparams_from_lengths(cpara...
[ "statsmodels.api.OLS", "numpy.min", "numpy.max", "numpy.array", "time.strip", "statsmodels.api.add_constant", "numpy.round", "numpy.sqrt" ]
[((3922, 3938), 'numpy.array', 'np.array', (['x_list'], {}), '(x_list)\n', (3930, 3938), True, 'import numpy as np\n'), ((3947, 3965), 'statsmodels.api.add_constant', 'sm.add_constant', (['X'], {}), '(X)\n', (3962, 3965), True, 'import statsmodels.api as sm\n'), ((3974, 3990), 'numpy.array', 'np.array', (['y_list'], {}...
#构建可训练的分布式词向量 import tensorflow as tf import numpy as np import math class embedding: def __init__(self,vocabulary_size,embedding_size): ''' 构建embedding层 vocabulary_size:为词库大小 embedding_size:分布式词向量大小 ''' self.vocabulary_size=vocabulary_size self.embedding_size...
[ "tensorflow.reduce_sum", "tensorflow.random.uniform", "tensorflow.math.argmax", "tensorflow.reshape", "tensorflow.concat", "tensorflow.matmul", "numpy.sin", "tensorflow.zeros", "numpy.arange" ]
[((1453, 1476), 'tensorflow.concat', 'tf.concat', (['outputs_i', '(0)'], {}), '(outputs_i, 0)\n', (1462, 1476), True, 'import tensorflow as tf\n'), ((1709, 1727), 'tensorflow.zeros', 'tf.zeros', (['[pos, d]'], {}), '([pos, d])\n', (1717, 1727), True, 'import tensorflow as tf\n'), ((1916, 1936), 'numpy.sin', 'np.sin', (...
import os from abc import ABC, abstractmethod from collections import namedtuple from typing import List, Union from datetime import datetime import pandas as pd from pandas import Timestamp import numpy as np from fxqu4nt.market.symbol import Symbol from fxqu4nt.market.kdb import QuotesDB from fxqu4nt.utils.common i...
[ "fxqu4nt.logger.create_logger", "os.path.exists", "fxqu4nt.utils.common.q_dt_str", "collections.namedtuple", "numpy.int32", "os.path.join" ]
[((384, 522), 'collections.namedtuple', 'namedtuple', (['"""OHLC"""', "['OpenBid', 'HighBid', 'LowBid', 'CloseBid', 'OpenAsk', 'HighAsk', 'LowAsk',\n 'CloseAsk', 'Volume', 'Start', 'End']"], {}), "('OHLC', ['OpenBid', 'HighBid', 'LowBid', 'CloseBid', 'OpenAsk',\n 'HighAsk', 'LowAsk', 'CloseAsk', 'Volume', 'Start'...
import os import itertools import pandas as pd import geopandas as gpd import numpy as np import json from gisele.functions import line_to_points, distance_2d, nearest from gisele import dijkstra, lcoe_optimization from gisele.multi_obj_factor import emission_factor, reliability_grid, line_reliability def clusters_i...
[ "pandas.DataFrame", "os.remove", "json.load", "gisele.lcoe_optimization.cost_optimization", "gisele.functions.distance_2d", "pandas.read_csv", "gisele.multi_obj_factor.line_reliability", "numpy.npv", "gisele.dijkstra.dijkstra_connection_roads", "gisele.functions.line_to_points", "gisele.multi_ob...
[((678, 730), 'geopandas.read_file', 'gpd.read_file', (['"""Output/Datasets/Roads/gdf_roads.shp"""'], {}), "('Output/Datasets/Roads/gdf_roads.shp')\n", (691, 730), True, 'import geopandas as gpd\n'), ((751, 808), 'geopandas.read_file', 'gpd.read_file', (['"""Output/Datasets/Roads/roads_segments.shp"""'], {}), "('Output...
# 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 applicable law or agreed to...
[ "numpy.array" ]
[((1230, 1268), 'numpy.array', 'np.array', (["self._dataset_info['sigmas']"], {}), "(self._dataset_info['sigmas'])\n", (1238, 1268), True, 'import numpy as np\n'), ((2243, 2273), 'numpy.array', 'np.array', (['self.pose_link_color'], {}), '(self.pose_link_color)\n', (2251, 2273), True, 'import numpy as np\n'), ((4692, 4...
# -*- coding: utf-8 -*- # 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 # # Un...
[ "tensorflow.test.main", "os.remove", "numpy.random.seed", "tensorflow.compat.v1.enable_eager_execution", "tensorboard.plugins.histogram.summary.histogram", "tensorflow.compat.v1.train.summary_iterator", "tensorflow.compat.v1.placeholder", "tensorboard.util.tensor_util.make_ndarray", "tensorflow.name...
[((1282, 1319), 'tensorflow.compat.v1.enable_eager_execution', 'tf.compat.v1.enable_eager_execution', ([], {}), '()\n', (1317, 1319), True, 'import tensorflow as tf\n'), ((8448, 8462), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (8460, 8462), True, 'import tensorflow as tf\n'), ((1514, 1531), 'numpy.rando...
#!/user/bin/env python # -*- coding:utf-8 -*- import cv2 import numpy as np def edgeDetection(img, sobel): height, width, channels = img.shape filter_size = len(sobel) n = int((filter_size - 1) / 2) img_edge = np.zeros((height, width), np.uint8) for i in range(n, height - n): ...
[ "numpy.sum", "cv2.waitKey", "numpy.zeros", "numpy.clip", "cv2.imread", "cv2.imshow" ]
[((1243, 1275), 'cv2.imread', 'cv2.imread', (['"""../images/lena.jpg"""'], {}), "('../images/lena.jpg')\n", (1253, 1275), False, 'import cv2\n'), ((1277, 1301), 'cv2.imshow', 'cv2.imshow', (['"""image"""', 'img'], {}), "('image', img)\n", (1287, 1301), False, 'import cv2\n'), ((1342, 1370), 'cv2.imshow', 'cv2.imshow', ...
#!/usr/bin/env python import numpy as np import rospy as rp from sys import maxsize as infinity from geometry_msgs.msg import Transform from agv_as18.srv import Path, PathResponse, PathRequest robot = [0.0,0.0] # locations AS = ['AS',125.0,66.0] C1 = ['C1',200.0,210.0] C2 = ['C2',170.0,210.0] C3 = ['C3',140.0,210.0] ...
[ "rospy.Subscriber", "rospy.wait_for_message", "agv_as18.srv.PathResponse", "rospy.init_node", "rospy.spin", "rospy.Service", "numpy.sqrt" ]
[((496, 552), 'numpy.sqrt', 'np.sqrt', (['((AS[1] - MWP1[1]) ** 2 + (AS[2] - MWP1[2]) ** 2)'], {}), '((AS[1] - MWP1[1]) ** 2 + (AS[2] - MWP1[2]) ** 2)\n', (503, 552), True, 'import numpy as np\n'), ((555, 611), 'numpy.sqrt', 'np.sqrt', (['((AS[1] - MWP2[1]) ** 2 + (AS[2] - MWP2[2]) ** 2)'], {}), '((AS[1] - MWP2[1]) ** ...
import cv2 import time import numpy as np import pandas as pd import mediapipe as mp import plotly.express as px import plotly.graph_objects as go class poseDetector: def __init__( self, mode=False, complex=1, smooth_landmarks=True, segmentation=True, smooth_segmenta...
[ "cv2.line", "pandas.DataFrame", "cv2.circle", "numpy.abs", "numpy.arctan2", "cv2.cvtColor", "cv2.waitKey", "plotly.graph_objects.Scatter3d", "plotly.express.scatter_3d", "time.time", "cv2.VideoCapture", "cv2.imshow" ]
[((6951, 6997), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""./Hackathon_1st_Hitter.mp4"""'], {}), "('./Hackathon_1st_Hitter.mp4')\n", (6967, 6997), False, 'import cv2\n'), ((1166, 1202), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (1178, 1202), False, 'import cv2\...
import os from torch.utils.data import Dataset import cv2 import torch import numpy as np class ImageDataset(Dataset): def __init__(self, file_path): super(Dataset, self).__init__() self.images = [] self.labels = [] self.file_name = [] for root, sub_dir, files in os.walk(fi...
[ "os.walk", "numpy.array", "os.path.join", "cv2.resize", "torch.from_numpy" ]
[((310, 328), 'os.walk', 'os.walk', (['file_path'], {}), '(file_path)\n', (317, 328), False, 'import os\n'), ((751, 784), 'numpy.array', 'np.array', (['label'], {'dtype': 'np.float32'}), '(label, dtype=np.float32)\n', (759, 784), True, 'import numpy as np\n'), ((394, 418), 'os.path.join', 'os.path.join', (['root', 'fil...
import pickle import numpy as np, pandas as pd, matplotlib as mpl from matplotlib import dates as mdates # # Use environment rws_dev # from sys import path # for extra in ["C:/Users/mphum/GitHub/koolstof", "C:/Users/mphum/GitHub/calkulate"]: # if extra not in path: # path.append(extra) import koolstof as...
[ "pandas.DataFrame", "pickle.dump", "pandas.read_csv", "pandas.read_excel", "numpy.any", "pandas.to_datetime", "numpy.array", "matplotlib.dates.date2num", "numpy.unique" ]
[((420, 477), 'pandas.read_excel', 'pd.read_excel', (['"""data/Coordinaten_verzuring_20190429.xlsx"""'], {}), "('data/Coordinaten_verzuring_20190429.xlsx')\n", (433, 477), True, 'import numpy as np, pandas as pd, matplotlib as mpl\n'), ((732, 837), 'pandas.read_csv', 'pd.read_csv', (['"""data/bottle_files/Bottlefile_NI...
#!/usr/bin/env python """ Python implementation of common model fitting operations to analyse protein folding data. Simply automates some fitting and value calculation. Will be extended to include phi-value analysis and other common calculations. Allows for quick model evaluation and plotting. Also tried to make thi...
[ "numpy.sum", "numpy.log", "inspect.getfullargspec", "numpy.random.randn", "numpy.std", "numpy.ones", "numpy.argmin", "scipy.optimize.curve_fit", "numpy.max", "numpy.mean", "numpy.array", "numpy.linspace", "IPython.display.Math", "collections.OrderedDict", "scipy.stats.t.pdf", "os.path....
[((33927, 33954), 'numpy.linspace', 'np.linspace', (['(0.0)', '(10.0)', '(100)'], {}), '(0.0, 10.0, 100)\n', (33938, 33954), True, 'import numpy as np\n'), ((1552, 1585), 'os.path.join', 'os.path.join', (['directory', 'filename'], {}), '(directory, filename)\n', (1564, 1585), False, 'import os\n'), ((2015, 2048), 'os.p...
#!/usr/bin/env python3 # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import binascii from test_framework.mininode import * from test_framework.test_framework import BitcoinTestFramework from test_framework.util import *...
[ "numpy.ma.testutils.assert_equal" ]
[((4725, 4755), 'numpy.ma.testutils.assert_equal', 'assert_equal', (['got_txid', 'tx1_id'], {}), '(got_txid, tx1_id)\n', (4737, 4755), False, 'from numpy.ma.testutils import assert_equal\n'), ((5603, 5654), 'numpy.ma.testutils.assert_equal', 'assert_equal', (["tx2parentsignresult['complete']", '(True)'], {}), "(tx2pare...
# RUN: %PYTHON %s # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
[ "jax.tree_flatten", "absl.testing.absltest.main", "numpy.random.seed", "jax.numpy.zeros", "jax.tree_util.register_pytree_node_class", "jax.numpy.matmul", "numpy.random.normal", "numpy.testing.assert_allclose", "jax.numpy.sqrt", "jax.tree_map" ]
[((3819, 3869), 'jax.tree_util.register_pytree_node_class', 'jax.tree_util.register_pytree_node_class', (['SqrtNode'], {}), '(SqrtNode)\n', (3859, 3869), False, 'import jax\n'), ((3872, 3924), 'jax.tree_util.register_pytree_node_class', 'jax.tree_util.register_pytree_node_class', (['SquareNode'], {}), '(SquareNode)\n',...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
[ "logging.basicConfig", "numpy.asarray", "json.dumps", "collections.defaultdict", "numpy.argsort", "numpy.mean", "numpy.where", "numpy.array", "numpy.argwhere", "logging.getLogger" ]
[((733, 874), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=loggi...
import scipy.spatial import numpy import PIL.Image import PIL.ImageDraw # Change to desired values width_px = 1920 height_px = 1080 sample_file = "sample.png" result_file = "result.png" triangle_frequency = 800 resample_filter = PIL.Image.BILINEAR # Generate random 2D coordinates with range 0 to 1 and scale/translate...
[ "numpy.random.rand" ]
[((335, 375), 'numpy.random.rand', 'numpy.random.rand', (['triangle_frequency', '(2)'], {}), '(triangle_frequency, 2)\n', (352, 375), False, 'import numpy\n')]
# 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 # # Unless required by applica...
[ "numpy.float64", "mock.Mock", "official.resnet.keras.keras_common.build_stats", "tensorflow.logging.set_verbosity" ]
[((960, 1002), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (984, 1002), True, 'import tensorflow as tf\n'), ((1362, 1408), 'official.resnet.keras.keras_common.build_stats', 'keras_common.build_stats', (['history', 'eval_output'], {}), '(history, ev...
#hps_test.py import numpy as np import scipy.signal as sigpy import matplotlib.pyplot as plt from pyhelpertool.HelpersSignal import PitchDetechtion fs = 2e6 fn = 19e3 N = 4096 dt = 1/fs df = fs/N t = np.linspace ( 0, N * dt, N) # Ampltude weights w = np.array ( [ .1, 1, 1, 1, 1, 1, 1] ) # Frequency multiplier fr = ...
[ "pyhelpertool.HelpersSignal.PitchDetechtion", "numpy.abs", "numpy.zeros", "numpy.sin", "numpy.array", "numpy.arange", "numpy.linspace" ]
[((203, 228), 'numpy.linspace', 'np.linspace', (['(0)', '(N * dt)', 'N'], {}), '(0, N * dt, N)\n', (214, 228), True, 'import numpy as np\n'), ((254, 287), 'numpy.array', 'np.array', (['[0.1, 1, 1, 1, 1, 1, 1]'], {}), '([0.1, 1, 1, 1, 1, 1, 1])\n', (262, 287), True, 'import numpy as np\n'), ((320, 353), 'numpy.array', '...
import Image import numpy as np import os import scipy from scipy import misc from scipy.misc import imsave def load_image( infilename ) : img = Image.open( infilename ) img.load() data = np.asarray( img, dtype="int32" ) return data train_data = [] base = "/home/ubuntu/work/github/rajdeepd/neuralnetwork...
[ "numpy.asarray", "scipy.misc.imresize", "scipy.misc.imsave", "Image.open", "os.listdir" ]
[((451, 472), 'os.listdir', 'os.listdir', (['base_path'], {}), '(base_path)\n', (461, 472), False, 'import os\n'), ((149, 171), 'Image.open', 'Image.open', (['infilename'], {}), '(infilename)\n', (159, 171), False, 'import Image\n'), ((200, 230), 'numpy.asarray', 'np.asarray', (['img'], {'dtype': '"""int32"""'}), "(img...