code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
Apply cluster correction for independent-samples T-test based on spatial proximity and cluster size.
Inspired by MNE tutorial.
Created on Fri Feb 22 13:21:40 2019
@author: <NAME> <<EMAIL>>
"""
import numpy as np
from scipy import stats
from scipy.io import loadmat
import matplotlib.pyplot as plt
import os
from ... | [
"permutation_cluster_test_AT._permutation_cluster_test_AT",
"numpy.load",
"numpy.save",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.plot",
"scipy.io.loadmat",
"scipy.stats.gaussian_kde",
"os.path.isfile",
"matplotlib.pyplot.figure",
"numpy.max",
"numpy.where",
"numpy.int",
"matplotlib.pyplo... | [((700, 713), 'numpy.load', 'np.load', (['conn'], {}), '(conn)\n', (707, 713), True, 'import numpy as np\n'), ((1462, 1535), 'os.path.isfile', 'os.path.isfile', (["(read_dir + 'fake_t_vals_' + freq + window + cons + '.mat')"], {}), "(read_dir + 'fake_t_vals_' + freq + window + cons + '.mat')\n", (1476, 1535), False, 'i... |
"""Plotting function for birdsonganalysis."""
import numpy as np
import seaborn as sns
import matplotlib.patches as p
import matplotlib.pyplot as plt
from .songfeatures import spectral_derivs
from .constants import FREQ_RANGE
def spectral_derivs_plot(spec_der, contrast=0.1, ax=None, freq_range=None,
... | [
"numpy.flip",
"seaborn.heatmap",
"matplotlib.patches.Rectangle",
"numpy.nanmin",
"matplotlib.pyplot.subplots",
"numpy.nanmax"
] | [((1018, 1141), 'seaborn.heatmap', 'sns.heatmap', (['spec_der.T'], {'yticklabels': '(50)', 'xticklabels': '(50)', 'vmin': '(-contrast)', 'vmax': 'contrast', 'ax': 'ax', 'cmap': '"""Greys"""', 'cbar': '(False)'}), "(spec_der.T, yticklabels=50, xticklabels=50, vmin=-contrast,\n vmax=contrast, ax=ax, cmap='Greys', cbar... |
import numpy as np
test=np.load('/home/ubuntu/hzy/pythia/data/m4c_textvqa_ocr_en_frcn_features/train_images/f441f29812b385ad_info.npy',encoding = "latin1",allow_pickle=True) #加载文件
doc = open('contrast9.txt', 'a') #打开一个存储文件,并依次写入
print(test, file=doc) #将打印内容写入文件中 | [
"numpy.load"
] | [((24, 183), 'numpy.load', 'np.load', (['"""/home/ubuntu/hzy/pythia/data/m4c_textvqa_ocr_en_frcn_features/train_images/f441f29812b385ad_info.npy"""'], {'encoding': '"""latin1"""', 'allow_pickle': '(True)'}), "(\n '/home/ubuntu/hzy/pythia/data/m4c_textvqa_ocr_en_frcn_features/train_images/f441f29812b385ad_info.npy'\n... |
import os
import shutil
import zipfile
import networkx as nx
import numpy as np
import pandas as pd
import requests
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from spektral.utils import nx_to_numpy
DATASET_URL = 'https://ls11-www.cs.tu-dortmund.de/people/morris/graphkerneldatasets'
DATASET_CLEAN... | [
"os.remove",
"numpy.sum",
"sklearn.preprocessing.StandardScaler",
"shutil.rmtree",
"os.path.join",
"os.path.exists",
"requests.get",
"networkx.clustering",
"spektral.utils.nx_to_numpy",
"sklearn.preprocessing.OneHotEncoder",
"os.listdir",
"numpy.vstack",
"numpy.concatenate",
"pandas.read_h... | [((413, 456), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.spektral/datasets/"""'], {}), "('~/.spektral/datasets/')\n", (431, 456), False, 'import os\n'), ((3310, 3321), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (3318, 3321), True, 'import numpy as np\n'), ((4619, 4667), 'os.path.exists', 'os.path.exists... |
import os
import errno
import copy
import json
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
from .ccd import CCD
from Stele.processing.processing_hsg.helper_functions import gauss
from .helper_functions import calc_laser_frequencies
np.set_printoptions(linewidth=500)
class ... | [
"os.mkdir",
"numpy.sum",
"numpy.argmax",
"numpy.array_str",
"json.dumps",
"numpy.argsort",
"numpy.isclose",
"numpy.mean",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.gca",
"numpy.diag",
"os.path.join",
"numpy.set_printoptions",
"numpy.std",
"numpy.append",
"numpy.l... | [((277, 311), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(500)'}), '(linewidth=500)\n', (296, 311), True, 'import numpy as np\n'), ((3686, 3709), 'numpy.array', 'np.array', (['self.ccd_data'], {}), '(self.ccd_data)\n', (3694, 3709), True, 'import numpy as np\n'), ((4968, 4980), 'numpy.array', ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import os.path as osp
import argparse
import time
import numpy as np
from tqdm import tqdm
import json
import torch
import torch.backends.cudnn as cudnn
import cv2
import _init_paths
from ... | [
"sys.path.pop",
"argparse.ArgumentParser",
"utils.utilitys.plot_keypoint",
"config.update_config",
"cv2.imshow",
"detector.load_model",
"torch.no_grad",
"detector.yolo_human_det",
"torch.load",
"json.dump",
"cv2.waitKey",
"numpy.asarray",
"torch.cuda.is_available",
"track.sort.Sort",
"ut... | [((546, 561), 'sys.path.pop', 'sys.path.pop', (['(0)'], {}), '(0)\n', (558, 561), False, 'import sys\n'), ((626, 644), '_init_paths.get_path', 'get_path', (['__file__'], {}), '(__file__)\n', (634, 644), False, 'from _init_paths import get_path\n'), ((766, 794), 'sys.path.insert', 'sys.path.insert', (['(0)', 'lib_root']... |
import tensorflow as tf
import numpy as np
import gpflow
from gpflow.base import Parameter
from gpflow.utilities import positive
class ReLUKernel(gpflow.kernels.Kernel):
"""
Kernel such that the mean 0 GP with the corresponding covariance function is equal in distribution
to an infinitely wide BNN prior w... | [
"tensorflow.sin",
"gpflow.utilities.positive",
"numpy.ones",
"tensorflow.acos",
"tensorflow.matmul",
"tensorflow.square",
"tensorflow.sqrt",
"tensorflow.cos"
] | [((2614, 2651), 'tensorflow.sqrt', 'tf.sqrt', (['(KiX[:, None] * KiX2[None, :])'], {}), '(KiX[:, None] * KiX2[None, :])\n', (2621, 2651), True, 'import tensorflow as tf\n'), ((2698, 2749), 'tensorflow.acos', 'tf.acos', (['(jitter + (1 - 2 * jitter) * Ki / sqrt_term)'], {}), '(jitter + (1 - 2 * jitter) * Ki / sqrt_term)... |
def dir_name(config, method):
if config.game.kind == "Breakthrough":
return "{}-breakthrough-{}".format(method, config.game.size)
elif config.game.kind == "Gym":
return "{}-gym-{}".format(method, config.game.name)
else:
print("Unknown game in config file.")
exit(-1)
def get... | [
"numpy.abs",
"numpy.floor",
"numpy.zeros",
"numpy.clip",
"tensorflow.keras.losses.categorical_crossentropy",
"numpy.sign"
] | [((1394, 1438), 'numpy.clip', 'np.clip', (['scaled', '(-support_size)', 'support_size'], {}), '(scaled, -support_size, support_size)\n', (1401, 1438), True, 'import numpy as np\n'), ((1449, 1466), 'numpy.floor', 'np.floor', (['clamped'], {}), '(clamped)\n', (1457, 1466), True, 'import numpy as np\n'), ((1541, 1580), 'n... |
#!/usr/bin/env python3
"""
Python3 class to work with Aravis/GenICam cameras, subclass of sdss-basecam.
.. module:: araviscam
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import sys
import math
import asyncio
import numpy
import astropy
from basecam.mixins import ImageAreaMixIn
from basecam import (
CameraSystem,
... | [
"basecam.CameraConnectionError",
"math.radians",
"lvmcam.araviscam.aravis.Aravis.update_device_list",
"lvmcam.araviscam.aravis.Aravis.get_device_id",
"math.sin",
"math.cos",
"lvmcam.araviscam.aravis.Aravis.get_n_devices",
"astropy.io.fits.Card",
"numpy.ndarray",
"lvmcam.araviscam.aravis.Aravis.Cam... | [((4241, 4268), 'lvmcam.araviscam.aravis.Aravis.update_device_list', 'Aravis.update_device_list', ([], {}), '()\n', (4266, 4268), False, 'from lvmcam.araviscam.aravis import Aravis\n'), ((4284, 4306), 'lvmcam.araviscam.aravis.Aravis.get_n_devices', 'Aravis.get_n_devices', ([], {}), '()\n', (4304, 4306), False, 'from lv... |
import json
from collections import Counter
import re
from VQA.PythonHelperTools.vqaTools.vqa import VQA
import random
import numpy as np
from keras.preprocessing.image import load_img, img_to_array, ImageDataGenerator
from matplotlib import pyplot as plt
import os
import VQAModel
from keras.applications.xception impor... | [
"os.fsdecode",
"keras.applications.xception.preprocess_input",
"numpy.expand_dims",
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.load_img",
"os.fsencode",
"os.path.join",
"os.listdir",
"VQAModel.createModelXception"
] | [((1165, 1184), 'os.fsencode', 'os.fsencode', (['imgDir'], {}), '(imgDir)\n', (1176, 1184), False, 'import os\n'), ((1248, 1295), 'VQAModel.createModelXception', 'VQAModel.createModelXception', (['(size1, size2, 3)'], {}), '((size1, size2, 3))\n', (1276, 1295), False, 'import VQAModel\n'), ((1324, 1345), 'os.listdir', ... |
#!/usr/bin/env python
#https://docs.opencv.org/3.3.1/d7/d8b/tutorial_py_lucas_kanade.html
import numpy as np
import cv2
import sys
feature_params = dict( maxCorners = 100, #100, # params for ShiTomasi corner detection
qualityLevel = 0.2, #0.3,,#0.2,
minDistance = 7, #12, ... | [
"numpy.zeros_like",
"cv2.cvtColor",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.VideoCapture",
"numpy.random.randint",
"cv2.goodFeaturesToTrack",
"numpy.bitwise_and",
"sys.stdout.flush",
"cv2.calcOpticalFlowPyrLK",
"cv2.imshow",
"numpy.ndarray"
] | [((611, 646), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(100, 3)'], {}), '(0, 255, (100, 3))\n', (628, 646), True, 'import numpy as np\n'), ((822, 836), 'numpy.ndarray', 'np.ndarray', (['[]'], {}), '([])\n', (832, 836), True, 'import numpy as np\n'), ((1490, 1519), 'cv2.VideoCapture', 'cv2.VideoCa... |
#!/usr/bin/python
# This script predicts body part in test dataset
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
import tensorflow
from tensorflow import keras
from keras import optimizers
from keras.models import load_model
from keras.preprocessi... | [
"keras.models.load_model",
"csv.writer",
"numpy.expand_dims",
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.load_img",
"keras.optimizers.RMSprop",
"re.sub",
"os.listdir",
"numpy.vstack"
] | [((420, 439), 'csv.writer', 'csv.writer', (['csvFile'], {}), '(csvFile)\n', (430, 439), False, 'import csv\n'), ((480, 528), 'keras.models.load_model', 'load_model', (['"""inception_v3_0.9635416865348816.h5"""'], {}), "('inception_v3_0.9635416865348816.h5')\n", (490, 528), False, 'from keras.models import load_model\n'... |
import typing
import random
from pathlib import Path
import logging
from time import strftime, gmtime
from datetime import datetime
import os
import argparse
import contextlib
from collections import defaultdict
import numpy as np
import torch
from torch.utils.data import Dataset
import torch.distributed as dist
logg... | [
"os.remove",
"numpy.random.seed",
"collections.defaultdict",
"os.path.isfile",
"os.close",
"torch.distributed.get_world_size",
"argparse.ArgumentTypeError",
"random.seed",
"lmdb.open",
"pickle.dumps",
"torch.manual_seed",
"datetime.datetime",
"zipfile.ZipFile",
"tempfile.mkstemp",
"os.pa... | [((325, 352), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (342, 352), False, 'import logging\n'), ((2349, 2366), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (2360, 2366), False, 'import random\n'), ((2371, 2391), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(se... |
# Copyright 2019 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",
"tensorflow_addons.utils.test_utils.layer_test",
"numpy.random.seed",
"numpy.random.random_sample",
"numpy.expand_dims",
"numpy.apply_along_axis",
"numpy.where",
"numpy.linalg.norm"
] | [((2992, 3006), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3004, 3006), True, 'import tensorflow as tf\n'), ((1425, 1466), 'numpy.where', 'np.where', (['(norm > 1.0 - epsilon)', 'norm_x', 'x'], {}), '(norm > 1.0 - epsilon, norm_x, x)\n', (1433, 1466), True, 'import numpy as np\n'), ((1584, 1601), 'numpy... |
# Copyright 2019 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distribu... | [
"floris.tools.visualization.visualize_cut_plane",
"matplotlib.pyplot.show",
"numpy.linspace",
"floris.tools.floris_utilities.FlorisInterface",
"matplotlib.pyplot.subplots"
] | [((910, 969), 'floris.tools.floris_utilities.FlorisInterface', 'wfct.floris_utilities.FlorisInterface', (['"""example_input.json"""'], {}), "('example_input.json')\n", (947, 969), True, 'import floris.tools as wfct\n'), ((1658, 1672), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1670, 1672), True, '... |
import os
import numpy as np
import matplotlib.pyplot as plt
import yaml
from multiview_manipulation import plotting as plot_utils, utils as bc_viewag_plot_utils
# CONFIG
#-------------------------------------------------------------------------------
# plot options
wide_full_comp = True # wide is 2 rows by 5 cols, ... | [
"numpy.load",
"os.makedirs",
"matplotlib.pyplot.get_cmap",
"multiview_manipulation.utils.get_means_lowers_uppers",
"multiview_manipulation.plotting.setup_pretty_plotting",
"multiview_manipulation.utils.plot_four_conds",
"numpy.arange",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.ylabel",
"... | [((1169, 1203), 'multiview_manipulation.plotting.setup_pretty_plotting', 'plot_utils.setup_pretty_plotting', ([], {}), '()\n', (1201, 1203), True, 'from multiview_manipulation import plotting as plot_utils, utils as bc_viewag_plot_utils\n'), ((4194, 4282), 'matplotlib.pyplot.tick_params', 'plt.tick_params', ([], {'labe... |
"""
Clenshaw-Curtis quadrature method is a good all-around quadrature method
comparable to Gaussian quadrature, but typically limited to finite intervals
without a specific weight function. In addition to be quite accurate, the
weights and abscissas can be calculated quite fast.
Another thing to note is that Clenshaw-... | [
"numpy.sum",
"numpy.asarray",
"numpy.ones",
"numpy.where",
"numpy.array",
"numpy.arange",
"numpy.cos"
] | [((3598, 3617), 'numpy.array', 'numpy.array', (['domain'], {}), '(domain)\n', (3609, 3617), False, 'import numpy\n'), ((3471, 3489), 'numpy.sum', 'numpy.sum', (['weights'], {}), '(weights)\n', (3480, 3489), False, 'import numpy\n'), ((3768, 3794), 'numpy.ones', 'numpy.ones', (['dim'], {'dtype': 'int'}), '(dim, dtype=in... |
#data preparation utils
import numpy as np
import tensorflow as tf
def partitionByClass(X,y_true):
maxc = np.max(y_true+1)
ids = [[] for i in range(maxc)]
for i in range(np.shape(y_true)[0]):
ids[y_true[i]].append(i)
return ids
def prepareBatch(X,y_true,ids_by_class_train,N_classes = 10, N_su... | [
"tensorflow.reshape",
"tensorflow.Session",
"numpy.shape",
"numpy.max",
"numpy.mean",
"numpy.rot90",
"numpy.reshape",
"numpy.array",
"numpy.random.choice",
"numpy.random.permutation",
"numpy.concatenate",
"numpy.ndarray.flatten"
] | [((112, 130), 'numpy.max', 'np.max', (['(y_true + 1)'], {}), '(y_true + 1)\n', (118, 130), True, 'import numpy as np\n'), ((373, 387), 'numpy.max', 'np.max', (['y_true'], {}), '(y_true)\n', (379, 387), True, 'import numpy as np\n'), ((701, 745), 'numpy.ndarray.flatten', 'np.ndarray.flatten', (['ids_batch[:, :N_support]... |
#!/usr/bin/env python
# coding: utf-8
# # 02__trans_motifs
#
# in this notebook, i find motifs that are associated w/ trans effects using linear models and our RNA-seq data
# In[1]:
import warnings
warnings.filterwarnings('ignore')
import itertools
import pandas as pd
import numpy as np
import matplotlib as mpl
i... | [
"numpy.random.seed",
"numpy.abs",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.subplot2grid",
"numpy.isnan",
"matplotlib.pyplot.figure",
"statsmodels.api.qqplot",
"pandas.read_table",
"sys.path.append",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"numpy.max",
"statsmodels.fo... | [((203, 236), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (226, 236), False, 'import warnings\n'), ((779, 812), 'sys.path.append', 'sys.path.append', (['"""../../../utils"""'], {}), "('../../../utils')\n", (794, 812), False, 'import sys\n'), ((1029, 1052), 'seaborn.set'... |
import unittest
import numpy as np
import multipy
################################################################################
################################################################################
####
#### Class: Transform
####
########################################################################... | [
"numpy.random.rand",
"multipy.Transform",
"numpy.shape"
] | [((546, 568), 'numpy.random.rand', 'np.random.rand', (['(5)', '(100)'], {}), '(5, 100)\n', (560, 568), True, 'import numpy as np\n'), ((580, 602), 'numpy.random.rand', 'np.random.rand', (['(5)', '(100)'], {}), '(5, 100)\n', (594, 602), True, 'import numpy as np\n'), ((1015, 1037), 'numpy.random.rand', 'np.random.rand',... |
# SPDX-FileCopyrightText: 2022 UChicago Argonne, LLC
# SPDX-License-Identifier: MIT
from datetime import datetime
from pathlib import Path
import shutil
from typing import List, Optional
import numpy as np
import pandas as pd
from .fileutils import PathLike, run as run_proc
from .parameters import Parameters
from .p... | [
"pandas.read_csv",
"pathlib.Path",
"numpy.array",
"shutil.which"
] | [((3600, 3617), 'pathlib.Path', 'Path', (['"""moose-opt"""'], {}), "('moose-opt')\n", (3604, 3617), False, 'from pathlib import Path\n'), ((4083, 4092), 'pathlib.Path', 'Path', (['exe'], {}), '(exe)\n', (4087, 4092), False, 'from pathlib import Path\n'), ((1644, 1665), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {... |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import logging
import numpy as np
import copy
import coremltools
from coremltools import converters ... | [
"numpy.sum",
"numpy.abs",
"numpy.isclose",
"numpy.round",
"numpy.prod",
"logging.error",
"numpy.testing.assert_equal",
"coremltools.converters.mil.mil.Program",
"copy.deepcopy",
"coremltools.models.neural_network.printer.print_network_spec",
"numpy.issubdtype",
"numpy.all",
"coremltools.conv... | [((1597, 1665), 'coremltools.converters.mil.converter._convert', '_converter._convert', (['program'], {'convert_from': '"""mil"""', 'convert_to': 'backend'}), "(program, convert_from='mil', convert_to=backend)\n", (1616, 1665), True, 'from coremltools.converters.mil import converter as _converter\n'), ((1827, 1860), 'c... |
import os
import flopy
import pandas as pd
import numpy as np
def hdobj2data(hdsobj):
# convert usg hdsobj to array of shape (nper, nnodes)
hds = []
kstpkpers = hdsobj.get_kstpkper()
for kstpkper in kstpkpers:
data = hdsobj.get_data(kstpkper=kstpkper)
fdata = []
for lay in rang... | [
"pandas.DataFrame",
"numpy.array",
"os.path.join"
] | [((412, 425), 'numpy.array', 'np.array', (['hds'], {}), '(hds)\n', (420, 425), True, 'import numpy as np\n'), ((951, 1009), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['head', 'name', 'node', 'sp']"}), "(data, columns=['head', 'name', 'node', 'sp'])\n", (963, 1009), True, 'import pandas as pd\n'), ((48... |
import argparse
import network_utils
import helper_utils
import torch
import json
import numpy as np
def get_args():
parser = argparse.ArgumentParser(description="Predict flower classification with DNN")
parser.add_argument('input', default='./flowers/test/17/image_03911.jpg', type=str, help="input flower ima... | [
"helper_utils.str_to_bool",
"argparse.ArgumentParser",
"numpy.argmax",
"torch.exp",
"network_utils.loading_model",
"helper_utils.load_cat_to_name",
"torch.cuda.is_available",
"helper_utils.display_result",
"torch.unsqueeze",
"torch.no_grad",
"helper_utils.process_image",
"torch.from_numpy"
] | [((132, 209), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Predict flower classification with DNN"""'}), "(description='Predict flower classification with DNN')\n", (155, 209), False, 'import argparse\n'), ((1382, 1411), 'torch.unsqueeze', 'torch.unsqueeze', (['image'], {'dim': '(0)'})... |
import numpy as np
from eb_gridmaker import dtb, config
from eb_gridmaker.utils import aux, multiproc
from elisa import SingleSystem, BinarySystem, Observer, settings
from elisa.base.error import LimbDarkeningError, AtmosphereError, MorphologyError
def spotty_single_system_random_sampling(db_name=None, number_of_sam... | [
"eb_gridmaker.dtb.insert_observation",
"eb_gridmaker.dtb.search_for_breakpoint",
"numpy.random.seed",
"eb_gridmaker.utils.aux.draw_single_star_params",
"eb_gridmaker.utils.aux.assign_eccentric_system_params",
"eb_gridmaker.utils.aux.draw_inclination",
"elisa.SingleSystem.from_json",
"eb_gridmaker.util... | [((604, 660), 'numpy.linspace', 'np.linspace', (['(0)', '(1.0)'], {'num': 'config.N_POINTS', 'endpoint': '(False)'}), '(0, 1.0, num=config.N_POINTS, endpoint=False)\n', (615, 660), True, 'import numpy as np\n'), ((722, 767), 'numpy.arange', 'np.arange', (['(0)', 'number_of_samples'], {'dtype': 'np.int'}), '(0, number_o... |
#!/usr/bin/env python3
"""
This module should introduce you to basic plotting routines
using matplotlib.
We will be plotting quadratic equations since we already
have a module to calculate them.
"""
# Matplotlib is a module with routines to
# plot data and display them on the screen or save them to files.
# The prima... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"numpy.arange",
"quad_class.quadratic_Equation",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((1449, 1482), 'numpy.arange', 'np.arange', (['xlim[0]', 'xlim[1]', '(0.01)'], {}), '(xlim[0], xlim[1], 0.01)\n', (1458, 1482), True, 'import numpy as np\n'), ((1785, 1809), 'matplotlib.pyplot.plot', 'plt.plot', (['x_vals', 'y_vals'], {}), '(x_vals, y_vals)\n', (1793, 1809), True, 'import matplotlib.pyplot as plt\n'),... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
gnpy.core.request
=================
This module contains path request functionality.
This functionality allows the user to provide a JSON request
file in accordance with a Yang model for requesting path
computations and returns path results in terms of path
and feas... | [
"csv.writer",
"gnpy.core.info.create_input_spectral_information",
"networkx.dijkstra_path",
"numpy.mean",
"collections.namedtuple",
"gnpy.core.utils.lin2db",
"logging.getLogger"
] | [((959, 978), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (968, 978), False, 'from logging import getLogger, basicConfig, CRITICAL, DEBUG, INFO\n'), ((997, 1186), 'collections.namedtuple', 'namedtuple', (['"""RequestParams"""', "('request_id source destination trx_type' +\n ' trx_mode nodes... |
"""
----------------------------------------------------------------------
--- jumeg.jumeg_noise_reducer --------------------------------
----------------------------------------------------------------------
author : <NAME>
email : <EMAIL>
last update: 02.05.2019
version : 1.14
-----------------------... | [
"numpy.abs",
"numpy.polyfit",
"mne.pick_types",
"mne.io.Raw",
"numpy.allclose",
"mne.epochs._is_good",
"mne.find_events",
"matplotlib.pyplot.figure",
"numpy.linalg.svd",
"numpy.mean",
"numpy.arange",
"sys.stdout.flush",
"numpy.diag",
"builtins.range",
"mne.utils.logger.info",
"numpy.co... | [((4687, 4717), 'jumeg.jumeg_utils.get_files_from_list', 'get_files_from_list', (['fname_raw'], {}), '(fname_raw)\n', (4706, 4717), False, 'from jumeg.jumeg_utils import get_files_from_list\n'), ((5704, 5755), 'matplotlib.pyplot.figure', 'plt.figure', (['"""denoising"""'], {'figsize': '(16, 6 * n_xplots)'}), "('denoisi... |
import argparse
import os
import logging
import string
import sys
import json
import numpy as np
import pandas as pd
import tensorflow as tf
from sqlalchemy import create_engine
from .alphabet import ALPHABET_DNA
from .model import (
conv1d_densenet_regression_model,
compile_regression_model,
Denormalized... | [
"json.load",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.makedirs",
"os.getcwd",
"numpy.random.randint",
"sqlalchemy.create_engine",
"sys.exit",
"tensorflow.keras.callbacks.TensorBoard",
"os.path.join",
"logging.getLogger"
] | [((677, 704), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (694, 704), False, 'import logging\n'), ((723, 817), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s (%(levelname)s) %(message)s"""'}), "(level=logging.INFO, format=\n '%... |
import numpy
import xraylib
def transfocator_guess_configuration(focal_f_target, deltas=[0.999998], radii=[500e-4],
initial_focal_distance=None, verbose=0):
nn = len(radii)
ncombinations = 2**nn
Farray = numpy.zeros(ncombinations)
# Rarray = numpy.zeros(ncombina... | [
"numpy.binary_repr",
"numpy.zeros_like",
"numpy.abs",
"numpy.zeros",
"numpy.max",
"numpy.array",
"numpy.linspace",
"srxraylib.plot.gol.set_qt",
"srxraylib.plot.gol.plot",
"xraylib.Refractive_Index_Re"
] | [((258, 284), 'numpy.zeros', 'numpy.zeros', (['ncombinations'], {}), '(ncombinations)\n', (269, 284), False, 'import numpy\n'), ((2747, 2772), 'numpy.linspace', 'numpy.linspace', (['(2)', '(85)', '(50)'], {}), '(2, 85, 50)\n', (2761, 2772), False, 'import numpy\n'), ((3063, 3082), 'numpy.array', 'numpy.array', (['[42.2... |
'''
Copyright 2022 Airbus SAS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | [
"sos_trades_core.tools.post_processing.pareto_front_optimal_charts.instanciated_pareto_front_optimal_chart.InstantiatedParetoFrontOptimalChart",
"sos_trades_core.tools.post_processing.charts.chart_filter.ChartFilter",
"numpy.arange",
"sos_trades_core.tools.post_processing.charts.two_axes_instanciated_chart.Tw... | [((17569, 17697), 'sos_trades_core.tools.post_processing.charts.two_axes_instanciated_chart.TwoAxesInstanciatedChart', 'TwoAxesInstanciatedChart', (['x_axis_name', 'y_axis_name', '[min_x - 5, max_x + 5]', '[min_y - max_y * 0.05, max_y * 1.05]', 'chart_name'], {}), '(x_axis_name, y_axis_name, [min_x - 5, max_x + 5],\n ... |
"""
======================
CSA Histogram Approach
======================
Static Chemical Shift Powder Pattern using a Histogram Approach
The equation for the static powder pattern for a simple chemical shift anisotropy interation is given by the following equation
.. math::
H = \\delta_{iso} + \\frac {1}{2} ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"numpy.sin",
"numpy.cos",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"sys.exit"
] | [((1718, 1729), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1726, 1729), True, 'import numpy as np\n'), ((3505, 3565), 'matplotlib.pyplot.hist', 'plt.hist', (['omega'], {'bins': '(200)', 'weights': 'solid_angle', 'density': '(True)'}), '(omega, bins=200, weights=solid_angle, density=True)\n', (3513, 3565), True, ... |
import typing
import gettext
import numpy
from nion.data import Core
from nion.data import DataAndMetadata
from nion.swift.model import Symbolic
from nion.typeshed import API_1_0
_ = gettext.gettext
class AlignMultiDimensionalSequence:
label = _("Align multi-dimensional sequence")
inputs = {"si_sequence_dat... | [
"nion.swift.model.Symbolic.register_computation_type",
"nion.data.Core.function_sequence_measure_relative_translation",
"nion.data.DataAndMetadata.new_data_and_metadata",
"numpy.zeros",
"numpy.empty_like",
"numpy.unravel_index",
"numpy.product"
] | [((7815, 7915), 'nion.swift.model.Symbolic.register_computation_type', 'Symbolic.register_computation_type', (['"""nion.align_multi_d_sequence"""', 'AlignMultiDimensionalSequence'], {}), "('nion.align_multi_d_sequence',\n AlignMultiDimensionalSequence)\n", (7849, 7915), False, 'from nion.swift.model import Symbolic\... |
# Copyright (c) 2018-2019 <NAME>, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... | [
"numpy.conj",
"numpy.random.rand",
"numpy.zeros",
"numpy.mean",
"numpy.matmul",
"numpy.dot",
"numpy.eye",
"numpy.linalg.solve",
"numpy.sqrt"
] | [((3600, 3635), 'numpy.zeros', 'np.zeros', (['(n_src, n_freq, n_frames)'], {}), '((n_src, n_freq, n_frames))\n', (3608, 3635), True, 'import numpy as np\n'), ((3644, 3664), 'numpy.eye', 'np.eye', (['n_src', 'n_src'], {}), '(n_src, n_src)\n', (3650, 3664), True, 'import numpy as np\n'), ((3673, 3729), 'numpy.zeros', 'np... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | [
"nicos.core.Attach",
"numpy.radians",
"nicos_sinq.amor.devices.logical_motor.InterfaceLogicalMotorHandler.doPreinit",
"nicos.core.dictwith",
"nicos.core.Override",
"numpy.arctan",
"nicos.core.utils.multiStatus",
"nicos.core.oneof"
] | [((3633, 3649), 'numpy.arctan', 'arctan', (['(top / xs)'], {}), '(top / xs)\n', (3639, 3649), False, 'from numpy import arctan, radians, tan\n'), ((3656, 3675), 'numpy.arctan', 'arctan', (['(bottom / xs)'], {}), '(bottom / xs)\n', (3662, 3675), False, 'from numpy import arctan, radians, tan\n'), ((1957, 1996), 'nicos.c... |
import os
import numpy as np
import codecs
import pandas as pd
import json
from glob import glob
import cv2
import shutil
from sklearn.model_selection import train_test_split
#1.标签路径
csv_file = "annotations.csv"
saved_path = "./VOCdevkit/VOC2007/" #保存路径
image_save_path = "./JPEGImages/"
image_raw_parh ... | [
"os.makedirs",
"numpy.concatenate",
"codecs.open",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"os.path.exists",
"cv2.imread",
"numpy.array",
"glob.glob",
"shutil.copy"
] | [((3978, 4018), 'glob.glob', 'glob', (["(saved_path + './Annotations/*.xml')"], {}), "(saved_path + './Annotations/*.xml')\n", (3982, 4018), False, 'from glob import glob\n'), ((4220, 4251), 'glob.glob', 'glob', (["(image_raw_parh + '/*.jpg')"], {}), "(image_raw_parh + '/*.jpg')\n", (4224, 4251), False, 'from glob impo... |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
import argparse
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedKFold
def RF_Classifier(X, y, indep=None, fold=5, n_trees=100, out='RF_output'):
"""
Parameters:
----------
:... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.array",
"sklearn.model_selection.StratifiedKFold"
] | [((1023, 1035), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1031, 1035), True, 'import numpy as np\n'), ((1410, 1471), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_estimators': 'n_trees', 'bootstrap': '(False)'}), '(n_estimators=n_trees, bootstrap=False)\n', (1432, 1471), False,... |
import pytest
from gpmap import GenotypePhenotypeMap
import numpy as np
@pytest.fixture(scope="module")
def gpvolve_gpm():
wildtype = "AAA"
genotypes = [
"AAA",
"AAB",
"ABA",
"BAA",
"ABB",
"BAB",
"BBA",
"BBB"
]
mutations = {
0:... | [
"gpmap.GenotypePhenotypeMap",
"pytest.fixture",
"numpy.iinfo",
"numpy.finfo",
"numpy.arange"
] | [((75, 105), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (89, 105), False, 'import pytest\n'), ((605, 635), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (619, 635), False, 'import pytest\n'), ((791, 821), 'pytest.fixture', 'pyt... |
import os
import cv2
import torch
import time
import ujson as json
import numpy as np
from tqdm import tqdm
from torch.cuda.amp import autocast, GradScaler
from torchvision_models.segmentation import erfnet_resnet, deeplabv1_vgg16, deeplabv1_resnet18, deeplabv1_resnet34, \
deeplabv1_resnet50, deeplabv1_resnet101, e... | [
"numpy.argmax",
"torchvision_models.segmentation.deeplabv1_vgg16",
"utils.all_utils_semseg.save_checkpoint",
"torch.no_grad",
"torchvision_models.segmentation.erfnet_resnet",
"torch.cuda.amp.autocast",
"torch.utils.data.DataLoader",
"os.path.exists",
"utils.all_utils_semseg.ConfusionMatrix",
"ujso... | [((706, 881), 'torchvision_models.segmentation.erfnet_resnet', 'erfnet_resnet', ([], {'pretrained_weights': 'pretrained_weights', 'num_classes': 'num_classes', 'num_lanes': '(num_classes - 1)', 'dropout_1': '(0.3)', 'dropout_2': '(0.3)', 'flattened_size': '(4400)', 'scnn': 'scnn'}), '(pretrained_weights=pretrained_weig... |
import os.path as osp
from cytokit.ops.op import CytokitOp, get_tf_config
from cytokit.miq import prediction
from cytokit import data as cytokit_data
from cytokit import io as cytokit_io
import tensorflow as tf
import numpy as np
import logging
DEFAULT_PATCH_SIZE = 84
DEFAULT_N_CLASSES = 11
logger = logging.getLogger(... | [
"numpy.argmax",
"cytokit.data.initialize_best_focus_model",
"cytokit.io.get_best_focus_img_path",
"numpy.array",
"numpy.arange",
"tensorflow.Graph",
"cytokit.ops.op.get_tf_config",
"os.path.join",
"logging.getLogger"
] | [((302, 329), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (319, 329), False, 'import logging\n'), ((1594, 1636), 'cytokit.data.initialize_best_focus_model', 'cytokit_data.initialize_best_focus_model', ([], {}), '()\n', (1634, 1636), True, 'from cytokit import data as cytokit_data\n'), ... |
import torch
import numpy as np
class Uniform_Buffer:
def __init__(self, buffer_size, state_shape, action_shape, device, mix=1):
self._n = 0
self._p = 0
self.mix = mix
self.buffer_size = buffer_size
self.total_size = mix * buffer_size
self.states = torch.empty(
... | [
"numpy.random.randint",
"torch.empty",
"torch.from_numpy"
] | [((305, 383), 'torch.empty', 'torch.empty', (['(self.total_size, *state_shape)'], {'dtype': 'torch.float', 'device': 'device'}), '((self.total_size, *state_shape), dtype=torch.float, device=device)\n', (316, 383), False, 'import torch\n'), ((420, 499), 'torch.empty', 'torch.empty', (['(self.total_size, *action_shape)']... |
"""
Linear State Space Assembler
"""
from sharpy.utils.solver_interface import solver, BaseSolver
import sharpy.linear.utils.ss_interface as ss_interface
import sharpy.utils.settings as settings
import sharpy.utils.h5utils as h5
import warnings
@solver
class LinearAssembler(BaseSolver):
r"""
Warnings:
... | [
"numpy.log",
"sharpy.utils.settings.SettingsTable",
"sharpy.utils.settings.to_custom_types",
"numpy.linalg.eig",
"sharpy.linear.utils.ss_interface.initialise_system",
"numpy.argsort",
"sharpy.utils.h5utils.readh5"
] | [((2890, 2914), 'sharpy.utils.settings.SettingsTable', 'settings.SettingsTable', ([], {}), '()\n', (2912, 2914), True, 'import sharpy.utils.settings as settings\n'), ((3441, 3529), 'sharpy.utils.settings.to_custom_types', 'settings.to_custom_types', (['self.settings', 'self.settings_types', 'self.settings_default'], {}... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plot
import simpy, numpy
from mds_sim import *
from rvs import *
from patch import *
# ######################## Models ######################## #
def ar_ub_fj(n, X):
return float(1/moment_i_n_k(1, n, n, X) )
def E_T_fj(ar, n, X):
# def max_cdf... | [
"matplotlib.pyplot.legend",
"matplotlib.use",
"numpy.linspace",
"simpy.Environment",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.xlabel"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((2525, 2556), 'numpy.linspace', 'numpy.linspace', (['(0.05)', 'ar_ub', '(15)'], {}), '(0.05, ar_ub, 15)\n', (2539, 2556), False, 'import simpy, numpy\n'), ((3030, 3060), 'matplotlib.pyplot.legend'... |
# Copyright 2020 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.io.gfile.GFile",
"tensorflow_examples.lite.model_maker.third_party.recommendation.ml.model.recommendation_model_launcher.get_callbacks",
"numpy.zeros",
"tensorflow.__version__.split",
"tensorflow.compat.v1.logging.info",
"tensorflow_examples.lite.model_maker.core.api.mm_export",
"tensorflow_... | [((1620, 1662), 'tensorflow_examples.lite.model_maker.core.api.mm_export', 'mm_export', (['"""recommendation.Recommendation"""'], {}), "('recommendation.Recommendation')\n", (1629, 1662), False, 'from tensorflow_examples.lite.model_maker.core.api import mm_export\n'), ((5207, 5253), 'tensorflow_examples.lite.model_make... |
import time
import datetime
import itertools
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.autograd as autograd
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
import dataset
import utils
import sys
import networks.pwcnet as pwcnet
... | [
"utils.repackage_hidden",
"numpy.ones",
"utils.create_generator",
"utils.create_dataloader",
"utils.create_discriminator",
"networks.pwcnet.PWCEstimate",
"torch.nn.MSELoss",
"dataset.ColorizationDataset",
"torch.utils.data.DataLoader",
"torch.zeros",
"networks.pwcnet.PWCNetBackward",
"utils.te... | [((702, 729), 'utils.create_generator', 'utils.create_generator', (['opt'], {}), '(opt)\n', (724, 729), False, 'import utils\n'), ((750, 781), 'utils.create_discriminator', 'utils.create_discriminator', (['opt'], {}), '(opt)\n', (776, 781), False, 'import utils\n'), ((4021, 4062), 'dataset.ColorizationDataset', 'datase... |
# !!! Change: this is a new file
import os
import pathlib
import random
import time
import pprint
from torch.utils.tensorboard import SummaryWriter
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torch.utils.data.distri... | [
"torch.cuda.synchronize",
"utils.net_utils.set_model_prune_rate",
"utils.net_utils.freeze_model_weights",
"time.time",
"os.path.isfile",
"utils.logging.AverageMeter",
"torch.cuda.is_available",
"torch.device",
"torch.cuda.set_device",
"torch.nn.DataParallel",
"torch.no_grad",
"numpy.concatenat... | [((1274, 1304), 'utils.feature_extractor.FeatureExtractor', 'FeatureExtractor', (['model.module'], {}), '(model.module)\n', (1290, 1304), False, 'from utils.feature_extractor import FeatureExtractor\n'), ((1761, 1807), 'utils.logging.AverageMeter', 'AverageMeter', (['"""Time"""', '""":6.3f"""'], {'write_val': '(False)'... |
import networkx as nx
import numpy as np
from pyquil.api import QPUCompiler
from pyquil.gates import H, RY, CZ, CNOT, MEASURE
from pyquil.quil import Program
from pyquil.quilbase import Pragma
from forest.benchmarking.compilation import basic_compile
def create_ghz_program(tree: nx.DiGraph):
"""
Create a Bel... | [
"pyquil.quilbase.Pragma",
"pyquil.gates.CZ",
"pyquil.gates.MEASURE",
"numpy.asarray",
"pyquil.gates.H",
"networkx.topological_sort",
"pyquil.gates.RY",
"forest.benchmarking.compilation.basic_compile",
"pyquil.gates.CNOT",
"pyquil.quil.Program",
"networkx.is_tree",
"numpy.all"
] | [((495, 511), 'networkx.is_tree', 'nx.is_tree', (['tree'], {}), '(tree)\n', (505, 511), True, 'import networkx as nx\n'), ((1210, 1232), 'numpy.asarray', 'np.asarray', (['bitstrings'], {}), '(bitstrings)\n', (1220, 1232), True, 'import numpy as np\n'), ((2729, 2738), 'pyquil.quil.Program', 'Program', ([], {}), '()\n', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
conan.stacker was created on 2017/10/17.
Author: Charles_Lai
Email: <EMAIL>
"""
import numpy as np
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import roc_auc_score
from diego.ensemble_net.base import Ensemble
from diego.ensemble_net.combin... | [
"diego.ensemble_net.combination.Combiner",
"numpy.mean",
"numpy.zeros",
"sklearn.model_selection.StratifiedKFold"
] | [((3956, 3976), 'numpy.mean', 'np.mean', (['out'], {'axis': '(2)'}), '(out, axis=2)\n', (3963, 3976), True, 'import numpy as np\n'), ((2395, 2416), 'diego.ensemble_net.combination.Combiner', 'Combiner', ([], {'rule': '"""mean"""'}), "(rule='mean')\n", (2403, 2416), False, 'from diego.ensemble_net.combination import Com... |
import numpy as np
import astropy.units as u
from astropy.table import QTable
from jdaviz import Specviz
from specutils import Spectrum1D
def test_line_lists():
viz = Specviz()
spec = Spectrum1D(flux=np.random.rand(100)*u.Jy,
spectral_axis=np.arange(6000, 7000, 10)*u.AA)
viz.load_sp... | [
"astropy.units.Quantity",
"jdaviz.Specviz",
"astropy.table.QTable",
"numpy.arange",
"numpy.random.rand",
"numpy.all"
] | [((174, 183), 'jdaviz.Specviz', 'Specviz', ([], {}), '()\n', (181, 183), False, 'from jdaviz import Specviz\n'), ((343, 351), 'astropy.table.QTable', 'QTable', ([], {}), '()\n', (349, 351), False, 'from astropy.table import QTable\n'), ((449, 466), 'astropy.units.Quantity', 'u.Quantity', (['(0.046)'], {}), '(0.046)\n',... |
"""
Simple utils to save and load from disk.
"""
import joblib
import gzip
import pickle
import os
import tempfile
import tarfile
import zipfile
import logging
from urllib.request import urlretrieve
from typing import Any, Iterator, List, Optional, Tuple, Union, cast, IO
import pandas as pd
import numpy as np
import ... | [
"pickle.dump",
"numpy.load",
"pandas.read_csv",
"typing.cast",
"joblib.dump",
"os.path.isfile",
"pickle.load",
"rdkit.Chem.MolToSmiles",
"os.path.join",
"numpy.pad",
"pandas.DataFrame",
"os.path.exists",
"tarfile.open",
"pandas.concat",
"numpy.save",
"numpy.asarray",
"zipfile.ZipFile... | [((345, 372), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (362, 372), False, 'import logging\n'), ((1004, 1017), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1014, 1017), True, 'import numpy as np\n'), ((1351, 1404), 'numpy.pad', 'np.pad', (['x', 'pad'], {'mode': '"""constant"... |
import sys
sys.path.append('/usr/lib/python3.6/site-packages/')
import argparse
import base64
from datetime import datetime
import os
import shutil
import numpy as np
import socketio
import eventlet.wsgi
from PIL import Image
from flask import Flask
from io import BytesIO
from keras.models import load_model
from util... | [
"sys.path.append",
"keras.models.load_model",
"socketio.Middleware",
"utils.parse_position",
"numpy.load",
"argparse.ArgumentParser",
"os.makedirs",
"socketio.Server",
"flask.Flask",
"numpy.asarray",
"os.path.exists",
"base64.b64decode",
"datetime.datetime.utcnow",
"shutil.rmtree",
"util... | [((11, 63), 'sys.path.append', 'sys.path.append', (['"""/usr/lib/python3.6/site-packages/"""'], {}), "('/usr/lib/python3.6/site-packages/')\n", (26, 63), False, 'import sys\n'), ((369, 386), 'socketio.Server', 'socketio.Server', ([], {}), '()\n', (384, 386), False, 'import socketio\n'), ((393, 408), 'flask.Flask', 'Fla... |
# This file is used to configure the behavior of pytest when using the Astropy
# test infrastructure. It needs to live inside the package in order for it to
# get picked up when running the tests inside an interpreter using
# packagename.test
from copy import copy
import numpy as np
import pytest
from astropy import ... | [
"numpy.random.seed",
"astropy.modeling.models.Linear1D",
"numpy.random.randn",
"astropy.modeling.models.Gaussian1D",
"importlib.util.find_spec",
"specutils.spectra.Spectrum1D",
"copy.copy",
"numpy.random.random",
"numpy.linspace",
"pytest_astropy_header.display.PYTEST_HEADER_MODULES.pop"
] | [((845, 886), 'pytest_astropy_header.display.PYTEST_HEADER_MODULES.pop', 'PYTEST_HEADER_MODULES.pop', (['"""Pandas"""', 'None'], {}), "('Pandas', None)\n", (870, 886), False, 'from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS\n'), ((2986, 3013), 'numpy.linspace', 'np.linspace', (['(0.4)',... |
'''
Deep Q-learning approach to the cartpole problem
using OpenAI's gym environment.
As part of the basic series on reinforcement learning @
https://github.com/vmayoral/basic_reinforcement_learning
Inspired by https://github.com/VinF/deer
@author: <NAME> <<EMAIL>>
'''
import gym
import random
import pandas
... | [
"deer.experiment.base_controllers.LearningRateController",
"numpy.argmax",
"keras.models.Model",
"numpy.arange",
"keras.layers.Input",
"keras.layers.Reshape",
"deer.experiment.base_controllers.InterleavedTestEpochController",
"keras.optimizers.SGD",
"deer.experiment.base_controllers.TrainerControlle... | [((15309, 15348), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (15328, 15348), False, 'import logging\n'), ((15398, 15434), 'deer.default_parser.process_args', 'process_args', (['sys.argv[1:]', 'Defaults'], {}), '(sys.argv[1:], Defaults)\n', (15410, 15434), Fa... |
from Agent import Agent
from Gaussian_Reward import Gaussian_Reward
from erdos_renyl_model_without_duplicate import MAMAB
import matplotlib.pyplot as plt
import numpy as np
from math import sqrt, log
import networkx as nx
no_iterations = 20000
no_agents = 5
no_bandits = 20
#mean = [5.2, 4.1, 9.5, 2.... | [
"numpy.flip",
"networkx.erdos_renyi_graph",
"matplotlib.pyplot.close",
"numpy.argsort",
"Gaussian_Reward.Gaussian_Reward",
"matplotlib.pyplot.figure",
"numpy.array",
"erdos_renyl_model_without_duplicate.MAMAB",
"numpy.add",
"matplotlib.pyplot.subplots"
] | [((1089, 1105), 'numpy.argsort', 'np.argsort', (['mean'], {}), '(mean)\n', (1099, 1105), True, 'import numpy as np\n'), ((1119, 1145), 'numpy.flip', 'np.flip', (['maxi_mean'], {'axis': '(0)'}), '(maxi_mean, axis=0)\n', (1126, 1145), True, 'import numpy as np\n'), ((1387, 1423), 'matplotlib.pyplot.subplots', 'plt.subplo... |
import os
import glob
import pickle
import zipfile
import warnings
import numpy as np
import pandas as pd
from urllib import request
def trim_eol_whitespace(data_file):
with open(data_file, 'r') as f:
lines = f.readlines()
lines = [line.replace(' \n', '\n') for line in lines]
with open(data_file, ... | [
"numpy.random.uniform",
"os.mkdir",
"pickle.dump",
"numpy.abs",
"os.remove",
"zipfile.ZipFile",
"numpy.float32",
"os.path.exists",
"urllib.request.urlretrieve",
"numpy.sin",
"os.path.splitext",
"numpy.linspace",
"warnings.warn",
"os.path.join"
] | [((6613, 6655), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(10)'], {'size': 'num_samples'}), '(0, 10, size=num_samples)\n', (6630, 6655), True, 'import numpy as np\n'), ((6832, 6856), 'numpy.linspace', 'np.linspace', (['(-4)', '(14)', '(250)'], {}), '(-4, 14, 250)\n', (6843, 6856), True, 'import numpy as np... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.models import Sequential, Model
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# In[2]:
path_all_tfrecord = "fp56.tfrecord"
# In[3]:
dir_fro... | [
"numpy.fmax",
"fp_tensorflow.create_vgg_5y_model",
"numpy.argmax",
"pandas.read_csv",
"matplotlib.pyplot.axes",
"numpy.ones",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"floorplan_analysis.read_mono_from_image_unicode",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"numpy.cums... | [((598, 619), 'fp_tensorflow.create_vgg_5y_model', 'create_vgg_5y_model', ([], {}), '()\n', (617, 619), False, 'from fp_tensorflow import create_vgg_5y_model\n'), ((1659, 1693), 'numpy.loadtxt', 'np.loadtxt', (['"""biclust_col.txt"""', 'int'], {}), "('biclust_col.txt', int)\n", (1669, 1693), True, 'import numpy as np\n... |
from sklearn import linear_model as lm
import scipy
import numpy as np
import pandas as pd
from skorecard.utils import convert_sparse_matrix
from sklearn.utils.validation import check_is_fitted
class LogisticRegression(lm.LogisticRegression):
"""Extended Logistic Regression.
Extends [sklearn.linear_model.Log... | [
"pandas.DataFrame",
"numpy.ones",
"sklearn.utils.validation.check_is_fitted",
"numpy.product",
"numpy.linalg.inv",
"numpy.array",
"numpy.diag",
"skorecard.utils.convert_sparse_matrix"
] | [((4592, 4616), 'skorecard.utils.convert_sparse_matrix', 'convert_sparse_matrix', (['X'], {}), '(X)\n', (4613, 4616), False, 'from skorecard.utils import convert_sparse_matrix\n'), ((5146, 5175), 'numpy.product', 'np.product', (['predProbs'], {'axis': '(1)'}), '(predProbs, axis=1)\n', (5156, 5175), True, 'import numpy ... |
"""
Provides concrete tools for dealing with two of the most useful types of surfaces we have
"""
import numpy as np
from collections import namedtuple
from McUtils.GaussianInterface import GaussianLogReader, GaussianFChkReader
from McUtils.Zachary import Surface, MultiSurface, InterpolatedSurface, TaylorSeriesSurface... | [
"McUtils.GaussianInterface.GaussianFChkReader",
"numpy.asarray",
"numpy.floor",
"numpy.transpose",
"McUtils.Zachary.Surface",
"numpy.argsort",
"numpy.product",
"McUtils.GaussianInterface.GaussianLogReader",
"numpy.array",
"collections.namedtuple",
"numpy.diff",
"numpy.where"
] | [((1430, 1459), 'numpy.array', 'np.array', (['parse_data[keys[1]]'], {}), '(parse_data[keys[1]])\n', (1438, 1459), True, 'import numpy as np\n'), ((3252, 3279), 'numpy.floor', 'np.floor', (['(scan_coords / tol)'], {}), '(scan_coords / tol)\n', (3260, 3279), True, 'import numpy as np\n'), ((5657, 5679), 'numpy.asarray',... |
from whatthefood.graph.node import Node
from collections.abc import Sequence
import numpy as np
class Grad(Node):
def __init__(self, y, xs):
self.unwrap = False
if not isinstance(xs, Sequence):
xs = [xs]
self.unwrap = True
self.outputs_graph = self._build_outputs... | [
"numpy.ones_like"
] | [((805, 833), 'numpy.ones_like', 'np.ones_like', (['values[self.y]'], {}), '(values[self.y])\n', (817, 833), True, 'import numpy as np\n')] |
import datetime
import pandas as pd
import numpy as np
import subprocess
import pickle
from numpy import array
import seaborn as sn
import tensorflow as tf
import matplotlib.pyplot as plt
#combining predicitions and generating plot for pred. representation
def predict(data):
with open('rolf.pickle', 'rb') as hand... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"tensorflow.keras.models.load_model",
"pandas.DataFrame.from_dict",
"numpy.zeros",
"pickle.load",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.unique"
] | [((394, 422), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['data'], {}), '(data)\n', (416, 422), True, 'import pandas as pd\n'), ((634, 669), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""model"""'], {}), "('model')\n", (660, 669), True, 'import tensorflow as tf\n'), ((681, 709)... |
import ast
import argparse
import logging
import warnings
import os
import json
import glob
import subprocess
import sys
import boto3
import pickle
import pandas as pd
from collections import Counter
from timeit import default_timer as timer
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
impo... | [
"matplotlib.pyplot.title",
"sklearn.metrics.confusion_matrix",
"pickle.dump",
"seaborn.heatmap",
"argparse.ArgumentParser",
"autogluon.TabularPrediction.fit",
"pandas.read_csv",
"sklearn.metrics.classification_report",
"matplotlib.pyplot.figure",
"itertools.cycle",
"os.path.join",
"pandas.set_... | [((358, 383), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (381, 383), False, 'import warnings\n'), ((389, 451), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (412, 451), False, 'impor... |
'''
Adjusted Kapre Spectrogram and Melspectrogram classes which don't
apply range compression in the case that melgram=True
'''
from kapre.time_frequency import Spectrogram, Melspectrogram
#from __future__ import absolute_import
import numpy as np
from keras import backend as K
def amplitude_to_decibel(x, amin=... | [
"keras.backend.dot",
"keras.backend.sqrt",
"numpy.log",
"keras.backend.floatx",
"keras.backend.maximum",
"keras.backend.permute_dimensions"
] | [((2148, 2187), 'keras.backend.dot', 'K.dot', (['power_spectrogram', 'self.freq2mel'], {}), '(power_spectrogram, self.freq2mel)\n', (2153, 2187), True, 'from keras import backend as K\n'), ((636, 646), 'keras.backend.floatx', 'K.floatx', ([], {}), '()\n', (644, 646), True, 'from keras import backend as K\n'), ((1897, 1... |
import numpy
import joblib
import json
from azureml.core.model import Model
# from inference_schema.schema_decorators import input_schema, output_schema
def init():
# load the model from file into a global object
global model
# we assume that we have just one model
# AZUREML_MODEL_DIR is an environm... | [
"joblib.load",
"numpy.array",
"json.loads",
"azureml.core.model.Model.get_model_path"
] | [((464, 524), 'azureml.core.model.Model.get_model_path', 'Model.get_model_path', ([], {'model_name': '"""driver_training_model.pkl"""'}), "(model_name='driver_training_model.pkl')\n", (484, 524), False, 'from azureml.core.model import Model\n'), ((546, 569), 'joblib.load', 'joblib.load', (['model_path'], {}), '(model_p... |
'''
The whole reading model.
CNN + LSTM + A classifier with multinomial distribution.
'''
import torch
from torch import optim
from torch import nn
import torch.nn.functional as F
from torch.distributions import Bernoulli, Categorical
from torchtext import datasets
from torchtext import data
import os
import time
imp... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.distributions.Categorical",
"torchtext.datasets.IMDB.splits",
"torch.manual_seed",
"sklearn.metrics.accuracy_score",
"torch.cuda.manual_seed",
"torch.nn.CrossEntropyLoss",
"torch.nn.functional.softmax",
"torchtext.data.LabelField",
"torch.op... | [((795, 836), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'desc'}), '(description=desc)\n', (818, 836), False, 'import argparse\n'), ((1238, 1311), 'torchtext.data.Field', 'data.Field', ([], {'sequential': '(True)', 'tokenize': '"""spacy"""', 'lower': '(True)', 'fix_length': '(400)'}), "(... |
# DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited.
#
# This material is based upon work supported by the Assistant Secretary of Defense for Research and
# Engineering under Air Force Contract No. FA8721-05-C-0002 and/or FA8702-15-D-0001. Any opinions,
# findings, conclusions or recommendat... | [
"h5py.File",
"json.load",
"numpy.copy",
"numpy.asarray",
"numpy.expand_dims",
"pickle.load",
"numpy.array",
"numpy.concatenate",
"torch.from_numpy"
] | [((1444, 1456), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1453, 1456), False, 'import json\n'), ((2111, 2138), 'numpy.asarray', 'np.asarray', (['q_image_indices'], {}), '(q_image_indices)\n', (2121, 2138), True, 'import numpy as np\n'), ((3505, 3552), 'numpy.concatenate', 'np.concatenate', (['[scene_feat, node_f... |
import tensorflow as tf
import numpy as np
from tensorflow.python.ops.rnn import _transpose_batch_time
class Decoder:
def __init__(self, **kwargs):
self.encodings = None
self.num_sentence_characters = kwargs['num_sentence_characters']
self.dict_length = kwargs['dict_length']
self.m... | [
"tensorflow.einsum",
"tensorflow.reduce_sum",
"tensorflow.nn.tanh",
"tensorflow.reshape",
"numpy.shape",
"tensorflow.matmul",
"tensorflow.divide",
"tensorflow.nn.bidirectional_dynamic_rnn",
"tensorflow.split",
"tensorflow.get_variable",
"tensorflow.nn.softmax",
"tensorflow.nn.moments",
"tens... | [((831, 862), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['values'], {'axis': '(-1)'}), '(values, axis=-1)\n', (845, 862), True, 'import tensorflow as tf\n'), ((883, 958), 'tensorflow.layers.dense', 'tf.layers.dense', ([], {'inputs': 'mean_pool', 'activation': 'tf.nn.relu', 'units': 'units_dense'}), '(inputs=mean_poo... |
import numpy as np
### 1
def fib_matrix(n):
for i in range(n):
res = pow((np.matrix([[1, 1], [1, 0]], dtype='int64')), i) * np.matrix([[1], [0]])
print(int(res[0][0]))
# 调用
fib_matrix(100)
### 2
# 使用矩阵计算斐波那契数列
def Fibonacci_Matrix_tool(n):
Matrix = np.matrix("1 1;1 0", dtype='int64')
# ... | [
"numpy.matrix",
"numpy.linalg.matrix_power"
] | [((278, 313), 'numpy.matrix', 'np.matrix', (['"""1 1;1 0"""'], {'dtype': '"""int64"""'}), "('1 1;1 0', dtype='int64')\n", (287, 313), True, 'import numpy as np\n'), ((343, 376), 'numpy.linalg.matrix_power', 'np.linalg.matrix_power', (['Matrix', 'n'], {}), '(Matrix, n)\n', (365, 376), True, 'import numpy as np\n'), ((13... |
import argparse
import json
from multiprocessing.util import Finalize
from typing import Dict, List, Tuple
from multiprocessing import Pool as ProcessPool
import itertools
import pickle
import numpy as np
import os
from os.path import join
from tqdm import tqdm
from hotpot.data_handling.relevance_training_data import... | [
"json.dump",
"os.path.abspath",
"multiprocessing.util.Finalize",
"pickle.dump",
"argparse.ArgumentParser",
"json.load",
"hotpot.data_handling.dataset.QuestionAndParagraphsSpec",
"json.loads",
"hotpot.tokenizers.CoreNLPTokenizer",
"pickle.load",
"hotpot.utils.ResourceLoader",
"hotpot.data_handl... | [((800, 818), 'hotpot.tokenizers.CoreNLPTokenizer', 'CoreNLPTokenizer', ([], {}), '()\n', (816, 818), False, 'from hotpot.tokenizers import CoreNLPTokenizer\n'), ((823, 884), 'multiprocessing.util.Finalize', 'Finalize', (['PROCESS_TOK', 'PROCESS_TOK.shutdown'], {'exitpriority': '(100)'}), '(PROCESS_TOK, PROCESS_TOK.shu... |
import pytest
from numpy import allclose, array, asarray, add, ndarray, generic
from lightning import series, image
pytestmark = pytest.mark.usefixtures("eng")
def test_first(eng):
data = series.fromlist([array([1, 2, 3]), array([4, 5, 6])], engine=eng)
assert allclose(data.first(), [1, 2, 3])
data = im... | [
"numpy.asarray",
"numpy.allclose",
"numpy.array",
"lightning.image.fromlist",
"lightning.series.fromlist",
"pytest.mark.usefixtures"
] | [((131, 161), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""eng"""'], {}), "('eng')\n", (154, 161), False, 'import pytest\n'), ((569, 582), 'numpy.asarray', 'asarray', (['data'], {}), '(data)\n', (576, 582), False, 'from numpy import allclose, array, asarray, add, ndarray, generic\n'), ((595, 638), 'numpy... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 5 08:18:05 2022
https://thatascience.com/learn-machine-learning/pipeline-in-scikit-learn/
@author: qian.cao
"""
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sk... | [
"matplotlib.pyplot.title",
"numpy.load",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.figure",
"numpy.mean",
"sys.path.append",
"numpy.std",
"matplotlib.pyplot.close",
"matplotlib.pyplot.colorbar",
"numpy.max",
"numpy.linspace",
"nump... | [((528, 566), 'sys.path.append', 'sys.path.append', (['"""../bonebox/metrics/"""'], {}), "('../bonebox/metrics/')\n", (543, 566), False, 'import sys\n'), ((762, 796), 'os.makedirs', 'os.makedirs', (['outDir'], {'exist_ok': '(True)'}), '(outDir, exist_ok=True)\n', (773, 796), False, 'import os\n'), ((949, 974), 'numpy.l... |
#!/usr/bin/env python
# Python Standard Library
pass
# Third-Party Libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgb
# Local Library
import mivp
# ------------------------------------------------------------------------------
grey_4 = to_rgb("#ced4da")
# ----------... | [
"numpy.meshgrid",
"numpy.vectorize",
"matplotlib.pyplot.plot",
"mivp.generate_movie",
"matplotlib.pyplot.axis",
"matplotlib.colors.to_rgb",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"numpy.cos",
"numpy.sqrt"
] | [((289, 306), 'matplotlib.colors.to_rgb', 'to_rgb', (['"""#ced4da"""'], {}), "('#ced4da')\n", (295, 306), False, 'from matplotlib.colors import to_rgb\n'), ((858, 893), 'numpy.arange', 'np.arange', (['t_span[0]', 't_span[1]', 'dt'], {}), '(t_span[0], t_span[1], dt)\n', (867, 893), True, 'import numpy as np\n'), ((1544,... |
"""
Unit tests for the density class
"""
from unittest import TestCase
import sys
sys.path.append('../src')
import numpy as np
import unittest
import suftware as sw
import os
class Density1d(TestCase):
def setUp(self):
self.N = 5
self.data = sw.simulate_density_data(distribution_type='uniform'... | [
"sys.path.append",
"unittest.TextTestRunner",
"suftware.simulate_density_data",
"numpy.array",
"unittest.TestLoader",
"suftware.DensityEstimator"
] | [((84, 109), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (99, 109), False, 'import sys\n'), ((268, 339), 'suftware.simulate_density_data', 'sw.simulate_density_data', ([], {'distribution_type': '"""uniform"""', 'N': 'self.N', 'seed': '(1)'}), "(distribution_type='uniform', N=self.N, se... |
from typing import List, Dict
import matplotlib.pyplot as plt
import numpy as np
from mushroom_rl.algorithms.value.td.q_learning import QLearning
from mushroom_rl.core import Core, Agent, Environment
from mushroom_rl.policy import EpsGreedy
from mushroom_rl.utils.dataset import compute_J
from mushroom_rl.utils.paramet... | [
"matplotlib.pyplot.title",
"mdp.algo.model_free.env.deep_sea.DeepSea",
"numpy.random.seed",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.tight_layout",
"mushroom_rl.utils.dataset.compute_J",
"numpy.power",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.percentile",
"mushroo... | [((2804, 2819), 'numpy.array', 'np.array', (['steps'], {}), '(steps)\n', (2812, 2819), True, 'import numpy as np\n'), ((3081, 3130), 'matplotlib.pyplot.plot', 'plt.plot', (['steps', 'best_reward'], {'label': '"""Best reward"""'}), "(steps, best_reward, label='Best reward')\n", (3089, 3130), True, 'import matplotlib.pyp... |
# Copyright 2019 <NAME> and <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"warnings.simplefilter",
"heapq.heappush",
"math.ceil",
"pandas.read_csv",
"common.sender_obs.SenderMonitorInterval",
"heapq.heappop",
"random.random",
"common.sender_obs.SenderHistory",
"common.sender_obs.get_min_obs_vector",
"numpy.array",
"numpy.tile",
"numpy.mean",
"numpy.random.choice",... | [((680, 740), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'UserWarning'}), "(action='ignore', category=UserWarning)\n", (701, 740), False, 'import warnings\n'), ((24695, 24771), 'gym.envs.registration.register', 'register', ([], {'id': '"""PccNs-v0"""', 'entry_point': '... |
import numpy as np
from sklearn.model_selection._split import _BaseKFold, indexable, _num_samples
from sklearn.utils.validation import _deprecate_positional_args
# https://www.kaggle.com/marketneutral/purged-time-series-cv-xgboost-optuna/data
# modified code for group gaps; source
# https://github.com/getgaurav2/scik... | [
"sklearn.model_selection._split.indexable",
"numpy.concatenate",
"sklearn.model_selection._split._num_samples",
"numpy.argsort",
"numpy.arange",
"numpy.unique"
] | [((3291, 3314), 'sklearn.model_selection._split.indexable', 'indexable', (['X', 'y', 'groups'], {}), '(X, y, groups)\n', (3300, 3314), False, 'from sklearn.model_selection._split import _BaseKFold, indexable, _num_samples\n'), ((3335, 3350), 'sklearn.model_selection._split._num_samples', '_num_samples', (['X'], {}), '(... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 24 08:54:07 2018
@author: bwhe
"""
import ast
import numpy as np
import pandas as pd
import gc
import lightgbm as lgb
import pickle
import time
import w2v
from itertools import repeat
def remove_iteral(sentence):
return ast.literal_eval(sente... | [
"pandas.read_csv",
"time.time",
"w2v.build_artist_w2v",
"gc.collect",
"difflib.SequenceMatcher",
"pickle.load",
"numpy.mean",
"w2v.build_album_w2v",
"ast.literal_eval",
"gensim.models.Word2Vec.load",
"w2v.build_track_w2v",
"itertools.repeat"
] | [((419, 485), 'pandas.read_csv', 'pd.read_csv', (['readfile'], {'usecols': "['pid', 'pred', 'scores']", 'nrows': '(10)'}), "(readfile, usecols=['pid', 'pred', 'scores'], nrows=10)\n", (430, 485), True, 'import pandas as pd\n'), ((1086, 1098), 'gc.collect', 'gc.collect', ([], {}), '()\n', (1096, 1098), False, 'import gc... |
import logging
import torch.nn as nn
import torch.utils.checkpoint as cp
import torch
import numpy as np
from mmcv.cnn import constant_init, kaiming_init
from mmcv.runner import load_checkpoint
from ...registry import BACKBONES
from ..utils.resnet_r3d_utils import *
class BasicBlock(nn.Module):
def __init__(self,... | [
"torch.nn.BatchNorm3d",
"torch.nn.ReLU",
"numpy.multiply",
"mmcv.cnn.constant_init",
"mmcv.cnn.kaiming_init",
"mmcv.runner.load_checkpoint",
"torch.nn.MaxPool3d",
"logging.getLogger"
] | [((1424, 1433), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (1431, 1433), True, 'import torch.nn as nn\n'), ((4251, 4260), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (4258, 4260), True, 'import torch.nn as nn\n'), ((8206, 8215), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (8213, 8215), True, 'import torch.nn as ... |
from abc import ABC, abstractmethod
from hyperopt import STATUS_OK
import numpy as np
import logging
import pandas as pd
import shap
import matplotlib.pyplot as plt
import seaborn as sns
from crosspredict.iterator import Iterator
class CrossModelFabric(ABC):
def __init__(self,
iterator: Iterator,... | [
"pandas.DataFrame",
"numpy.abs",
"pandas.merge",
"seaborn.barplot",
"numpy.zeros",
"shap.TreeExplainer",
"matplotlib.pyplot.figure",
"numpy.max",
"pandas.Series",
"shap.summary_plot",
"pandas.concat",
"logging.getLogger"
] | [((1763, 1790), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1780, 1790), False, 'import logging\n'), ((7084, 7112), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (7094, 7112), True, 'import matplotlib.pyplot as plt\n'), ((7127, 7154),... |
#!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
An example to set OMP threads in FCI calculations. In old pyscf versions,
different number of OpenMP threads may lead to slightly different answers.
This issue was fixed. see github issue #249.
'''
from functools import reduce
import numpy
from pyscf import gt... | [
"h5py.File",
"pyscf.lib.num_threads",
"pyscf.fci.direct_spin0.FCI",
"pyscf.ao2mo.kernel",
"numpy.zeros",
"pyscf.fci.cistring.num_strings",
"functools.reduce",
"pyscf.lo.lowdin",
"pyscf.lib.unpack_tril"
] | [((485, 497), 'pyscf.lo.lowdin', 'lo.lowdin', (['s'], {}), '(s)\n', (494, 497), False, 'from pyscf import gto, lo, fci, ao2mo, scf, lib\n'), ((614, 649), 'functools.reduce', 'reduce', (['numpy.dot', '(orb.T, h1, orb)'], {}), '(numpy.dot, (orb.T, h1, orb))\n', (620, 649), False, 'from functools import reduce\n'), ((655,... |
#!/usr/bin/env python3
import sys
import numpy as np
from PySide6.QtCore import Qt, Slot
from PySide6.QtGui import QAction, QKeySequence
from PySide6.QtWidgets import (
QApplication, QHBoxLayout, QLabel,
QMainWindow, QPushButton, QSizePolicy,
QVBoxLayout, QWidget
)
from matplotlib.backends.backend_qt5agg i... | [
"matplotlib.colors.LinearSegmentedColormap.from_list",
"numpy.zeros_like",
"PySide6.QtGui.QAction",
"skimage.data.immunohistochemistry",
"PySide6.QtGui.QKeySequence",
"skimage.exposure.rescale_intensity",
"PySide6.QtWidgets.QVBoxLayout",
"PySide6.QtWidgets.QWidget",
"PySide6.QtWidgets.QPushButton",
... | [((3659, 3665), 'PySide6.QtCore.Slot', 'Slot', ([], {}), '()\n', (3663, 3665), False, 'from PySide6.QtCore import Qt, Slot\n'), ((4002, 4008), 'PySide6.QtCore.Slot', 'Slot', ([], {}), '()\n', (4006, 4008), False, 'from PySide6.QtCore import Qt, Slot\n'), ((4341, 4347), 'PySide6.QtCore.Slot', 'Slot', ([], {}), '()\n', (... |
from scipy.integrate import solve_ivp
import numpy as np
import matplotlib.pyplot as plt
# Milne-Simpson PC method
def milnePC(def_fn, xa, xb, ya, N):
f = def_fn # intakes function to method to approximate
h = (xb - xa) / N # creates step size based on input values of a, b, N
t = np.arange(xa, xb + ... | [
"matplotlib.pyplot.title",
"numpy.abs",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((301, 325), 'numpy.arange', 'np.arange', (['xa', '(xb + h)', 'h'], {}), '(xa, xb + h, h)\n', (310, 325), True, 'import numpy as np\n'), ((378, 396), 'numpy.zeros', 'np.zeros', (['(N + 1,)'], {}), '((N + 1,))\n', (386, 396), True, 'import numpy as np\n'), ((1381, 1405), 'numpy.arange', 'np.arange', (['xa', '(xb + h)',... |
#Load packages
import numpy as np
import pandas as pd
import torch
from tqdm.auto import tqdm
import pytorch_lightning as pl
from transformers import AutoTokenizer, AutoModel
#Import package for aspect sentiment prediction
import aspect_based_sentiment_analysis as absa
#Load the ABSA sentiment model
nlp = absa.load()... | [
"pandas.DataFrame",
"torch.nn.BCELoss",
"numpy.argmax",
"transformers.AutoModel.from_pretrained",
"transformers.AutoTokenizer.from_pretrained",
"torch.sigmoid",
"numpy.where",
"aspect_based_sentiment_analysis.load",
"numpy.array",
"torch.nn.Linear"
] | [((309, 320), 'aspect_based_sentiment_analysis.load', 'absa.load', ([], {}), '()\n', (318, 320), True, 'import aspect_based_sentiment_analysis as absa\n'), ((482, 554), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['"""vinai/bertweet-base"""'], {'normalization': '(True)'}), "('vinai/b... |
# encoding: utf-8
import os
import numpy as np
from histolab.slide import Slide
from histolab.tiler import GridTiler, RandomTiler, ScoreTiler
from histolab.scorer import NucleiScorer
from ..fixtures import SVS
from ..util import load_expectation
class DescribeRandomTiler:
def it_locates_tiles_on_the_slide(sel... | [
"histolab.tiler.RandomTiler",
"numpy.asarray",
"histolab.tiler.GridTiler",
"os.path.join",
"histolab.scorer.NucleiScorer"
] | [((482, 569), 'histolab.tiler.RandomTiler', 'RandomTiler', ([], {'tile_size': '(512, 512)', 'n_tiles': '(2)', 'level': '(0)', 'seed': '(42)', 'check_tissue': '(False)'}), '(tile_size=(512, 512), n_tiles=2, level=0, seed=42, check_tissue\n =False)\n', (493, 569), False, 'from histolab.tiler import GridTiler, RandomTi... |
import numpy
import cupy
from cupy import core
def place(arr, mask, vals):
"""Change elements of an array based on conditional and input values.
This function uses the first N elements of `vals`, where N is the number
of true values in `mask`.
Args:
arr (cupy.ndarray): Array to put data int... | [
"numpy.cumprod",
"cupy.isscalar",
"cupy.asarray",
"cupy.core.ElementwiseKernel",
"numpy.can_cast",
"numpy.diff",
"cupy.arange",
"cupy.diff"
] | [((2253, 2411), 'cupy.core.ElementwiseKernel', 'core.ElementwiseKernel', (['"""Q mask, raw S values, uint64 len_vals"""', '"""T out"""', '"""\n if (mask) out = (T) values[i % len_vals];\n """', '"""putmask_kernel"""'], {}), '(\'Q mask, raw S values, uint64 len_vals\', \'T out\',\n """\n if (mask) out = (T) ... |
from skimage.segmentation import slic
from skimage.util import img_as_float
from skimage import io
import datetime
from PIL import Image
import numpy as np
imgname="taili"
image = img_as_float(io.imread(imgname+".png"))
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+" Start.")
for numSegments ... | [
"skimage.segmentation.slic",
"datetime.datetime.now",
"numpy.array",
"skimage.io.imread"
] | [((202, 229), 'skimage.io.imread', 'io.imread', (["(imgname + '.png')"], {}), "(imgname + '.png')\n", (211, 229), False, 'from skimage import io\n'), ((461, 523), 'skimage.segmentation.slic', 'slic', (['image'], {'n_segments': 'numSegments', 'sigma': 'sig', 'compactness': 'cp'}), '(image, n_segments=numSegments, sigma=... |
# coding: utf-8
import copy
from functools import reduce
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from flearn.common.strategy import AVG
from flearn.common.trainer import Trainer
class AVGTrainer(Trainer):
def __init__(self, model, optimizer, criterion, device, displ... | [
"numpy.diag",
"numpy.divide",
"torch.nn.MSELoss",
"numpy.sum",
"torch.nn.KLDivLoss",
"numpy.square",
"torch.FloatTensor",
"torch.nn.functional.softmax",
"numpy.linalg.svd",
"numpy.reshape",
"torch.nn.functional.log_softmax",
"functools.reduce",
"model.ModelFedCon",
"torch.tensor"
] | [((6475, 6527), 'model.ModelFedCon', 'ModelFedCon', (['"""simple-cnn"""'], {'out_dim': '(256)', 'n_classes': '(10)'}), "('simple-cnn', out_dim=256, n_classes=10)\n", (6486, 6527), False, 'from model import ModelFedCon\n'), ((6657, 6697), 'numpy.linalg.svd', 'np.linalg.svd', (['fc_m'], {'full_matrices': '(False)'}), '(f... |
# -*- coding: utf-8 -*-
#%% NumPyの読み込み
import numpy as np
# SciPyのstatsモジュールの読み込み
import scipy.stats as st
# Pandasの読み込み
import pandas as pd
# PyMCの読み込み
import pymc3 as pm
# MatplotlibのPyplotモジュールの読み込み
import matplotlib.pyplot as plt
# tqdmからプログレスバーの関数を読み込む
from tqdm import trange
# 日本語フォントの設定
from matplotl... | [
"sys.platform.startswith",
"numpy.random.seed",
"scipy.stats.norm.rvs",
"numpy.empty",
"scipy.stats.invgamma.rvs",
"numpy.mean",
"scipy.stats.invgamma.pdf",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.font_manager.FontProperties",
"numpy.std",
"numpy.linspace",
"matplot... | [((372, 402), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (395, 402), False, 'import sys\n'), ((734, 764), 'matplotlib.font_manager.FontProperties', 'FontProperties', ([], {'fname': 'FontPath'}), '(fname=FontPath)\n', (748, 764), False, 'from matplotlib.font_manager import Fo... |
from __future__ import division, print_function, absolute_import
# noinspection PyUnresolvedReferences
from six.moves import range
from scipy.stats import rv_discrete
import numpy as np
__all__ = ['nonuniform', 'gibbs']
# noinspection PyMethodOverriding,PyPep8Naming
class nonuniform_gen(rv_discrete):
"""A nonun... | [
"numpy.sum",
"six.moves.range",
"numpy.asarray",
"numpy.zeros",
"numpy.finfo",
"numpy.exp",
"numpy.random.rand"
] | [((1104, 1120), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (1118, 1120), True, 'import numpy as np\n'), ((1211, 1247), 'numpy.zeros', 'np.zeros', (['self._size'], {'dtype': 'np.int32'}), '(self._size, dtype=np.int32)\n', (1219, 1247), True, 'import numpy as np\n'), ((2589, 2602), 'numpy.exp', 'np.exp', ([... |
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import networkx as nx
def calc_mean_std(x):
return (np.mean(x), np.std(x, ddof=1) / np.sqrt(len(x)))
def color_func(p):
if p > 0.2:
return 'dodgerblue'
elif p < 0.05:
re... | [
"pandas.read_csv",
"numpy.mean",
"numpy.std",
"warnings.filterwarnings"
] | [((16, 49), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (39, 49), False, 'import warnings\n'), ((553, 574), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (564, 574), True, 'import pandas as pd\n'), ((1402, 1423), 'pandas.read_csv', 'pd.read_csv',... |
from collections import OrderedDict
import pandas as pd
import numpy as np
from tia.analysis.model.interface import (
TxnColumns as TC,
MarketDataColumns as MC,
PlColumns as PL,
TxnPlColumns as TPL,
)
from tia.analysis.perf import periods_in_year, guess_freq
from tia.util.decorator import lazy_propert... | [
"pandas.DataFrame",
"tia.analysis.perf.guess_freq",
"tia.util.decorator.lazy_property",
"numpy.isscalar",
"pandas.expanding_max",
"pandas.rolling_sum",
"pandas.DatetimeIndex",
"tia.util.fmt.new_dynamic_formatter",
"tia.util.mplot.AxesFormat",
"numpy.array",
"pandas.DataFrame.from_records",
"co... | [((16498, 16567), 'tia.util.decorator.lazy_property', 'lazy_property', (['(lambda self: self.txn_details.weekly)', '"""weekly_details"""'], {}), "(lambda self: self.txn_details.weekly, 'weekly_details')\n", (16511, 16567), False, 'from tia.util.decorator import lazy_property\n'), ((16871, 16942), 'tia.util.decorator.la... |
import numpy as np
import os
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
import sys
stderr = sys.stderr
sys.stderr = open(os.devnull, 'w')
from keras.models import Sequential, load_model
from keras.layers import LSTM, Dropout, TimeDistributed, Dense, Activation, Embedding
sys.stderr = stde... | [
"keras.layers.Activation",
"warnings.filterwarnings",
"keras.layers.LSTM",
"keras.layers.Dropout",
"numpy.zeros",
"keras.layers.Dense",
"numpy.random.randint",
"keras.layers.Embedding",
"keras.models.Sequential"
] | [((45, 102), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (68, 102), False, 'import warnings\n'), ((464, 476), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (474, 476), False, 'from keras.models import Seque... |
import os
import random
import numpy as np
import cv2
from keras.utils import Sequence
# This vvvvv is for example_preprocess function and augs
# from albumentations import (
# HorizontalFlip, VerticalFlip, Flip, Transpose, Rotate, ShiftScaleRotate, RandomScale,
# RandomBrightness, RandomContrast, Rando... | [
"random.shuffle",
"numpy.empty",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((2673, 2700), 'random.shuffle', 'random.shuffle', (['self._files'], {}), '(self._files)\n', (2687, 2700), False, 'import random\n'), ((3604, 3711), 'numpy.empty', 'np.empty', (['(self._batch_size, self._in_shape[h], self._in_shape[w], self._in_shape[c])'], {'dtype': '"""float32"""'}), "((self._batch_size, self._in_sh... |
"""https://github.com/kujason/scene_vis"""
import os
import numpy as np
import vtk
class VtkImage:
"""Image
"""
def __init__(self):
self.vtk_actor = vtk.vtkImageActor()
# Need to keep reference to the image
self.image = None
self.vtk_image_data = None
def _save_im... | [
"vtk.vtkPNGReader",
"numpy.copy",
"vtk.vtkImageActor",
"os.path.splitext",
"vtk.vtkImageImport",
"numpy.ascontiguousarray"
] | [((175, 194), 'vtk.vtkImageActor', 'vtk.vtkImageActor', ([], {}), '()\n', (192, 194), False, 'import vtk\n'), ((738, 781), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['image'], {'dtype': 'np.uint8'}), '(image, dtype=np.uint8)\n', (758, 781), True, 'import numpy as np\n'), ((882, 902), 'vtk.vtkImageImport', 'vt... |
#!/usr/bin/env python
'''
Plot degree values for a given set of nodes in a simple circle plot.
'''
import numpy as np
import matplotlib.pyplot as plt
import mne
from jumeg import get_jumeg_path
from jumeg.connectivity import plot_degree_circle
import bct
orig_labels_fname = get_jumeg_path() + '/data/desikan_label_... | [
"jumeg.get_jumeg_path",
"numpy.load",
"mne.connectivity.degree",
"jumeg.connectivity.plot_degree_circle"
] | [((480, 498), 'numpy.load', 'np.load', (['con_fname'], {}), '(con_fname)\n', (487, 498), True, 'import numpy as np\n'), ((574, 623), 'mne.connectivity.degree', 'mne.connectivity.degree', (['con_'], {'threshold_prop': '(0.2)'}), '(con_, threshold_prop=0.2)\n', (597, 623), False, 'import mne\n'), ((635, 693), 'jumeg.conn... |
import sys
import setuptools
from distutils import sysconfig
cfg_vars = sysconfig.get_config_vars()
for key, value in cfg_vars.items():
if type(value) == str:
cfg_vars[key] = cfg_vars[key].replace("-Wstrict-prototypes", "")
cfg_vars[key] = cfg_vars[key].replace("-Wall", "-w")
cfg_vars[key] =... | [
"distutils.sysconfig.get_config_vars",
"distutils.sysconfig.get_python_lib",
"multiprocessing.log_to_stderr",
"numpy.get_include",
"multiprocessing.cpu_count"
] | [((72, 99), 'distutils.sysconfig.get_config_vars', 'sysconfig.get_config_vars', ([], {}), '()\n', (97, 99), False, 'from distutils import sysconfig\n'), ((1399, 1425), 'distutils.sysconfig.get_python_lib', 'sysconfig.get_python_lib', ([], {}), '()\n', (1423, 1425), False, 'from distutils import sysconfig\n'), ((58940, ... |
""" Line analysis tools
These are intended to be methods generic to emission and absorption
(e.g. Equivalent width)
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os
from astropy.modeling import models, fitting
def box_ew(spec):
""" Boxcar EW c... | [
"numpy.sum",
"numpy.roll",
"astropy.modeling.models.Gaussian1D",
"astropy.modeling.models.GaussianAbsorption1D",
"numpy.isfinite",
"astropy.modeling.fitting.LevMarLSQFitter",
"numpy.min",
"numpy.mean",
"numpy.max",
"numpy.sqrt"
] | [((697, 721), 'numpy.sum', 'np.sum', (['(dwv * (1.0 - fx))'], {}), '(dwv * (1.0 - fx))\n', (703, 721), True, 'import numpy as np\n'), ((736, 763), 'numpy.sum', 'np.sum', (['(dwv ** 2 * sig ** 2)'], {}), '(dwv ** 2 * sig ** 2)\n', (742, 763), True, 'import numpy as np\n'), ((774, 788), 'numpy.sqrt', 'np.sqrt', (['varEW'... |
import collections
import inspect
import typing
import numpy as np
import pandas as pd
import torch
from river import base
__all__ = ["PyTorch2RiverBase", "PyTorch2RiverRegressor", "PyTorch2RiverClassifier"]
class PyTorch2RiverBase(base.Estimator):
"""An estimator that integrates neural Networks from PyTorch."... | [
"pandas.DataFrame",
"torch.mean",
"numpy.random.seed",
"torch.nn.Sequential",
"torch.manual_seed",
"torch.Tensor",
"inspect.signature",
"torch.nn.Linear",
"collections.Counter",
"torch.no_grad",
"torch.nn.Sigmoid"
] | [((832, 855), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (849, 855), False, 'import torch\n'), ((864, 884), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (878, 884), True, 'import numpy as np\n'), ((2531, 2550), 'torch.Tensor', 'torch.Tensor', (['[[y]]'], {}), '([[y]])\n'... |
import numpy as np
import math
import matplotlib.pyplot as plt
import pickle
from time import time
from numpy.linalg import matrix_rank
from numpy.linalg import pinv,inv
from numpy.linalg import eig as eig
from numpy.linalg import eigh,lstsq
from numpy.linalg import matrix_power
from scipy.linalg import expm,pinvh,solv... | [
"numpy.load",
"numpy.random.seed",
"sklearn.model_selection.train_test_split",
"tqdm.notebook.trange",
"numpy.mean",
"numpy.arange",
"torch.no_grad",
"numpy.unique",
"numpy.max",
"sklearn.neighbors.NearestNeighbors",
"numpy.random.choice",
"torch.nn.Linear",
"sklearn.neighbors.NearestCentroi... | [((2683, 2707), 'types.SimpleNamespace', 'SimpleNamespace', ([], {}), '(**tasks)\n', (2698, 2707), False, 'from types import SimpleNamespace\n'), ((2958, 2995), 'numpy.load', 'np.load', (['f"""saved_models/CNTK-200.npy"""'], {}), "(f'saved_models/CNTK-200.npy')\n", (2965, 2995), True, 'import numpy as np\n'), ((6803, 6... |
from sampling import Sampler
import algos
import numpy as np
from simulation_utils import create_env, get_feedback, run_algo
import sys
def batch(task, method, N, M, b):
if N % b != 0:
print('N must be divisible to b')
exit(0)
B = 20*b
simulation_object = create_env(task)
d = simulatio... | [
"simulation_utils.get_feedback",
"numpy.mean",
"numpy.linalg.norm",
"simulation_utils.create_env",
"simulation_utils.run_algo",
"numpy.array",
"numpy.random.rand",
"sampling.Sampler"
] | [((286, 302), 'simulation_utils.create_env', 'create_env', (['task'], {}), '(task)\n', (296, 302), False, 'from simulation_utils import create_env, get_feedback, run_algo\n'), ((671, 681), 'sampling.Sampler', 'Sampler', (['d'], {}), '(d)\n', (678, 681), False, 'from sampling import Sampler\n'), ((1612, 1638), 'numpy.me... |
"""
Advances in Financial Machine Learning, <NAME>
Chapter 2: Financial Data Structures
This module contains the functions to help users create structured financial data from raw unstructured data,
in the form of time, tick, volume, and dollar bars.
These bars are used throughout the text book (Advances in Financial ... | [
"numpy.float",
"mlfinlab.data_structures.base_bars.BaseBars.__init__"
] | [((1508, 1568), 'mlfinlab.data_structures.base_bars.BaseBars.__init__', 'BaseBars.__init__', (['self', 'file_path_or_df', 'metric', 'batch_size'], {}), '(self, file_path_or_df, metric, batch_size)\n', (1525, 1568), False, 'from mlfinlab.data_structures.base_bars import BaseBars\n'), ((2513, 2529), 'numpy.float', 'np.fl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.