code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#!/usr/bin/env python # coding: utf-8 # In[1]: import streamlit as st # To make things easier later, we're also importing numpy and pandas for # working with sample data. import numpy as np import pandas as pd import joblib import lime import lime.lime_tabular # In[2]: st.cache() preprocessor = joblib.load('reint...
[ "pandas.DataFrame", "streamlit.subheader", "streamlit.sidebar.number_input", "streamlit.sidebar.subheader", "streamlit.set_option", "streamlit.cache", "numpy.log", "streamlit.header", "pandas.read_feather", "streamlit.title", "streamlit.write", "numpy.array", "lime.lime_tabular.LimeTabularEx...
[((276, 286), 'streamlit.cache', 'st.cache', ([], {}), '()\n', (284, 286), True, 'import streamlit as st\n'), ((302, 350), 'joblib.load', 'joblib.load', (['"""reintubate_preprocessor_strip.sav"""'], {}), "('reintubate_preprocessor_strip.sav')\n", (313, 350), False, 'import joblib\n'), ((357, 398), 'joblib.load', 'jobli...
''' ARTI is a dataset created by <NAME> (@liuliu66) ''' import numpy as np from math import pi ,sin, cos import itertools from matplotlib import pyplot as plt def get_3d_bbox(scale, shift = 0): """ Input: scale: [3] or scalar shift: [3] or scalar Return bbox_3d: [3, N] """ ...
[ "numpy.trace", "numpy.sum", "numpy.abs", "numpy.nan_to_num", "numpy.ones", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linalg.svd", "numpy.linalg.norm", "numpy.mean", "numpy.random.randint", "numpy.zeros_like", "numpy.linalg.eig", "numpy.reshape", "numpy.linspace", "itertools.produ...
[((2074, 2109), 'numpy.linspace', 'np.linspace', (['bmin[0]', 'bmax[0]', 'nres'], {}), '(bmin[0], bmax[0], nres)\n', (2085, 2109), True, 'import numpy as np\n'), ((2119, 2154), 'numpy.linspace', 'np.linspace', (['bmin[1]', 'bmax[1]', 'nres'], {}), '(bmin[1], bmax[1], nres)\n', (2130, 2154), True, 'import numpy as np\n'...
import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas import networkx as nx import numpy as np import sklearn.metrics as metrics import torch import torch.nn as nn from torch.autograd import Variable from tensorboardX import SummaryWriter import argparse import os ...
[ "numpy.random.seed", "argparse.ArgumentParser", "torch.argmax", "torch.cat", "matplotlib.pyplot.figure", "numpy.mean", "torch.nn.Softmax", "numpy.std", "matplotlib.pyplot.close", "matplotlib.pyplot.rcParams.update", "torch.Tensor", "torch.matmul", "matplotlib.pyplot.subplots", "networkx.sp...
[((3627, 3646), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (3641, 3646), True, 'import numpy as np\n'), ((3660, 3682), 'torch.nn.BCEWithLogitsLoss', 'nn.BCEWithLogitsLoss', ([], {}), '()\n', (3680, 3682), True, 'import torch.nn as nn\n'), ((683, 699), 'argparse.ArgumentParser', 'ArgumentParser',...
# -*- coding: utf-8 -*- """ Sandwich demo ============= Sandwich demo based on code from http://nbviewer.ipython.org/6576096 """ ###################################################################### # .. note:: # # In order to show the charts of the examples you need a graphical # ``matplotlib`` backend inst...
[ "matplotlib.pyplot.subplot", "metric_learn.LSML_Supervised", "matplotlib.pyplot.show", "sklearn.metrics.pairwise_distances", "numpy.zeros", "metric_learn.SDML_Supervised", "metric_learn.LMNN", "numpy.argsort", "metric_learn.ITML_Supervised", "sklearn.neighbors.NearestNeighbors", "numpy.arange", ...
[((778, 798), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(3)', '(1)', '(1)'], {}), '(3, 1, 1)\n', (789, 798), True, 'from matplotlib import pyplot as plt\n'), ((1514, 1524), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1522, 1524), True, 'from matplotlib import pyplot as plt\n'), ((1615, 1636), 'matplot...
import functools import operator from math import pi import advbench.lib.manifool.functions.helpers.general as g import numpy as np import torch from torch.autograd import Variable def manitest(input_image, net, mode, maxIter=50000, lim = None, hs = None, cuda_on = True, stop_when_found=None, verbose=Tr...
[ "advbench.lib.manifool.functions.helpers.general.para2tfm", "torch.stack", "advbench.lib.manifool.functions.helpers.general.init_param", "numpy.asarray", "numpy.zeros", "numpy.argmin", "torch.Tensor", "torch.max", "numpy.array", "advbench.lib.manifool.functions.helpers.general.jacobian", "torch....
[((5625, 5643), 'advbench.lib.manifool.functions.helpers.general.init_param', 'g.init_param', (['mode'], {}), '(mode)\n', (5637, 5643), True, 'import advbench.lib.manifool.functions.helpers.general as g\n'), ((6531, 6556), 'torch.max', 'torch.max', (['output.data', '(1)'], {}), '(output.data, 1)\n', (6540, 6556), False...
import argparse import tensorflow as tf import numpy as np import time from shared_functions import make_matmul, measure_tf2_gpu # tf.config.run_functions_eagerly(False) # # config = tf.compat.v1.ConfigProto() # config.gpu_options.allow_growth = True # session = tf.compat.v1.Session(config=config) def attention(input...
[ "numpy.random.uniform", "shared_functions.measure_tf2_gpu", "argparse.ArgumentParser", "tensorflow.reshape", "tensorflow.transpose", "tensorflow.matmul", "shared_functions.make_matmul", "tensorflow.function" ]
[((1302, 1341), 'tensorflow.function', 'tf.function', ([], {'experimental_compile': '(False)'}), '(experimental_compile=False)\n', (1313, 1341), True, 'import tensorflow as tf\n'), ((1431, 1469), 'tensorflow.function', 'tf.function', ([], {'experimental_compile': '(True)'}), '(experimental_compile=True)\n', (1442, 1469...
""" These are the basic black box tests for the doNd functions. """ from qdev_wrappers.dataset.doNd import do0d, do1d, do2d from typing import Tuple, List, Optional from qcodes.instrument.parameter import Parameter from qcodes import config, new_experiment, load_by_id from qcodes.utils import validators import pytest...
[ "qdev_wrappers.dataset.doNd.do2d", "pytest.fixture", "numpy.ones", "qcodes.instrument.parameter.Parameter", "qcodes.utils.validators.ComplexNumbers", "qdev_wrappers.dataset.doNd.do0d", "numpy.array", "qcodes.load_by_id", "pytest.mark.parametrize", "qcodes.new_experiment", "qdev_wrappers.dataset....
[((405, 458), 'qcodes.new_experiment', 'new_experiment', (['"""doNd-tests"""'], {'sample_name': '"""no sample"""'}), "('doNd-tests', sample_name='no sample')\n", (419, 458), False, 'from qcodes import config, new_experiment, load_by_id\n'), ((462, 478), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (476, 478), ...
# Compatibility Python 2/3 from __future__ import division, print_function, absolute_import # ---------------------------------------------------------------------------------------------------------------------- from dotmap import DotMap import numpy as np import h5py import sys sys.path.insert(0, '/home/manu/ros_ws...
[ "RGB2video.RGB2video", "h5py.File", "numpy.asarray", "sys.path.insert", "dotmap.DotMap", "os.listdir" ]
[((283, 389), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/manu/ros_ws/src/Research/manu_sawyer/src/tensorflow_model_is_gripping"""'], {}), "(0,\n '/home/manu/ros_ws/src/Research/manu_sawyer/src/tensorflow_model_is_gripping'\n )\n", (298, 389), False, 'import sys\n'), ((2379, 2395), 'os.listdir', 'os....
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import numpy as np import chumpy as ch import scipy.sparse as sp from chumpy.utils import col class sp_dot(ch.Ch): terms = 'a', dterms = 'b', def compute_r(self): return self.a.dot(self.b.r) def compute(self): # To stay consistent wit...
[ "chumpy.utils.col", "numpy.sum", "scipy.sparse.eye" ]
[((536, 549), 'chumpy.utils.col', 'col', (['self.b.r'], {}), '(self.b.r)\n', (539, 549), False, 'from chumpy.utils import col\n'), ((730, 762), 'scipy.sparse.eye', 'sp.eye', (['br.shape[1]', 'br.shape[1]'], {}), '(br.shape[1], br.shape[1])\n', (736, 762), True, 'import scipy.sparse as sp\n'), ((473, 498), 'numpy.sum', ...
"""Process SSURGO soil database to create site-specific soil files.""" import numpy as np import pandas as pd from collections import Counter from itertools import compress def bin_depth(df_soils): """ Bin soil into 5 depth categories. Parameters ---------- df_soils : pd.DataFrame """ d...
[ "pandas.DataFrame", "numpy.arange", "itertools.compress", "collections.Counter", "numpy.sqrt" ]
[((985, 1016), 'numpy.arange', 'np.arange', (['df_textures.shape[0]'], {}), '(df_textures.shape[0])\n', (994, 1016), True, 'import numpy as np\n'), ((4090, 4140), 'pandas.DataFrame', 'pd.DataFrame', (['dist'], {'columns': "['rownum', 'distance']"}), "(dist, columns=['rownum', 'distance'])\n", (4102, 4140), True, 'impor...
import theano import numpy import os from theano import tensor as T from collections import OrderedDict class model(object): def __init__(self, nh, nc, ne, de, cs): ''' nh :: dimension of the hidden layer nc :: number of classes ne :: number of word embeddings in the vocabular...
[ "numpy.random.uniform", "theano.tensor.log", "theano.tensor.iscalar", "os.path.join", "theano.function", "theano.tensor.dot", "numpy.zeros", "theano.tensor.imatrix", "theano.scan", "theano.tensor.grad", "theano.tensor.argmax", "theano.tensor.scalar" ]
[((1444, 1455), 'theano.tensor.imatrix', 'T.imatrix', ([], {}), '()\n', (1453, 1455), True, 'from theano import tensor as T\n'), ((1602, 1616), 'theano.tensor.iscalar', 'T.iscalar', (['"""y"""'], {}), "('y')\n", (1611, 1616), True, 'from theano import tensor as T\n'), ((1863, 1956), 'theano.scan', 'theano.scan', ([], {...
import io import numpy as np import six from typing import Dict, List, Optional, Union class WordEmbedder: """ splits one or more texts into words, maps words to word indexes and maps word indexes to word embedding vectors. Although, the task of embedding words could also be accomplished ...
[ "numpy.full", "numpy.empty", "numpy.asarray", "numpy.zeros", "numpy.max", "io.open", "numpy.issubdtype" ]
[((2159, 2212), 'numpy.zeros', 'np.zeros', ([], {'shape': 'self.__embedding_dim', 'dtype': '"""float32"""'}), "(shape=self.__embedding_dim, dtype='float32')\n", (2167, 2212), True, 'import numpy as np\n'), ((4429, 4455), 'numpy.asarray', 'np.asarray', (['[token_vector]'], {}), '([token_vector])\n', (4439, 4455), True, ...
import numpy as np from PIL import Image, ImageEnhance def prepare_image(path, width, brightness): img = Image.open(path).convert('L') enhancer = ImageEnhance.Brightness(img) img_out = enhancer.enhance(brightness) w, h = img_out.size height = int(h * (width / w)) new_img = img_out.resize((...
[ "PIL.ImageEnhance.Brightness", "numpy.array", "PIL.Image.open" ]
[((157, 185), 'PIL.ImageEnhance.Brightness', 'ImageEnhance.Brightness', (['img'], {}), '(img)\n', (180, 185), False, 'from PIL import Image, ImageEnhance\n'), ((349, 366), 'numpy.array', 'np.array', (['new_img'], {}), '(new_img)\n', (357, 366), True, 'import numpy as np\n'), ((111, 127), 'PIL.Image.open', 'Image.open',...
import numpy as np import sys from gym import Env, spaces from io import StringIO import numpy import random import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap as cmap COMPLEXITY = 1. DENSITY = 1. def build_maze(width=81, height=51, complexity=.75, density=.75, seed=42): ...
[ "io.StringIO", "random.Random", "matplotlib.pyplot.close", "numpy.zeros", "gym.spaces.Discrete", "matplotlib.pyplot.subplots", "matplotlib.pyplot.pause", "numpy.prod" ]
[((390, 409), 'random.Random', 'random.Random', (['seed'], {}), '(seed)\n', (403, 409), False, 'import random\n'), ((757, 786), 'numpy.zeros', 'numpy.zeros', (['shape'], {'dtype': 'int'}), '(shape, dtype=int)\n', (768, 786), False, 'import numpy\n'), ((2763, 2777), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n',...
from gluonts_forecasts.training_session import TrainingSession from dku_constants import METRICS_DATASET from datetime import datetime import pandas as pd import numpy as np class TestCrossValidation: def setup_class(self): self.df = pd.DataFrame( { "date": [ ...
[ "pandas.DataFrame", "gluonts_forecasts.training_session.TrainingSession", "datetime.datetime.utcnow", "pandas.to_datetime", "numpy.array_equal" ]
[((248, 786), 'pandas.DataFrame', 'pd.DataFrame', (["{'date': ['2020-01-12 00:00:00', '2020-01-12 06:00:00',\n '2020-01-12 12:00:00', '2020-01-12 18:00:00', '2020-01-13 00:00:00',\n '2020-01-13 06:00:00', '2020-01-13 12:00:00', '2020-01-13 18:00:00',\n '2020-01-12 00:00:00', '2020-01-12 06:00:00', '2020-01-12 ...
""" $lic$ Copyright (c) 2016-2021, <NAME> This program is free software: you can redistribute it and/or modify it under the terms of the Modified BSD-3 License as published by the Open Source Initiative. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied...
[ "matplotlib.font_manager.weight_dict.pop", "matplotlib.style.use", "matplotlib.units.registry.copy", "matplotlib.pyplot.figure", "numpy.sin", "os.path.join", "matplotlib.units.registry.clear", "matplotlib.pyplot.close", "matplotlib.rcParams.update", "matplotlib.font_manager._rebuild", "os.path.e...
[((1159, 1192), 'matplotlib.ticker.NullFormatter', 'matplotlib.ticker.NullFormatter', ([], {}), '()\n', (1190, 1192), False, 'import matplotlib\n'), ((2959, 3019), 'unittest.SkipTest', 'unittest.SkipTest', (['"""Skip because Tex is not in this system."""'], {}), "('Skip because Tex is not in this system.')\n", (2976, 3...
# adpated from http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.signal.correlate2d.html import matplotlib.pyplot as plt import numpy as np from scipy import signal from scipy import misc face = misc.face() - misc.face().mean() face = face.sum(-1) template = np.copy(face[700:800, 310:380]) # right eye...
[ "numpy.copy", "numpy.argmax", "numpy.random.randn", "scipy.signal.correlate2d", "scipy.misc.face", "matplotlib.pyplot.subplots" ]
[((277, 308), 'numpy.copy', 'np.copy', (['face[700:800, 310:380]'], {}), '(face[700:800, 310:380])\n', (284, 308), True, 'import numpy as np\n'), ((421, 490), 'scipy.signal.correlate2d', 'signal.correlate2d', (['noisyface', 'template'], {'boundary': '"""symm"""', 'mode': '"""same"""'}), "(noisyface, template, boundary=...
import time import sqlite3 import pandas as pd import numpy as np import scipy as sp from scipy import stats import matplotlib.mlab as mlab import matplotlib.pyplot as plt ''' from sklearn.datasets import make_classification from sklearn.linear_model import LogisticRegression from sklearn.ensemble import (RandomTreesE...
[ "pandas.DataFrame", "numpy.sum", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "numpy.mean", "numpy.array", "pandas.Series", "sqlite3.connect", "pandas.read_sql", "numpy.dot", "matplotlib.pyplot.subplots" ]
[((2700, 2718), 'numpy.array', 'np.array', (['features'], {}), '(features)\n', (2708, 2718), True, 'import numpy as np\n'), ((3853, 3869), 'numpy.array', 'np.array', (['frames'], {}), '(frames)\n', (3861, 3869), True, 'import numpy as np\n'), ((4556, 4579), 'pandas.Series', 'pd.Series', (['cost_history'], {}), '(cost_h...
import numpy as np import matplotlib.pyplot as plt import pandas as pd from Eir.DTMC.spatialModel.HubModel import Hub from Eir.DTMC.spatialModel.simul_details import Simul_Details from Eir.utility import Person, dist, randEvent class HubSEIR(Hub): """ Object that represents the Hub Model with comp...
[ "numpy.stack", "pandas.DataFrame", "Eir.DTMC.spatialModel.simul_details.Simul_Details", "matplotlib.pyplot.show", "Eir.utility.Person", "numpy.zeros", "numpy.random.random", "numpy.linspace", "Eir.utility.randEvent", "matplotlib.pyplot.subplots" ]
[((5114, 5132), 'numpy.zeros', 'np.zeros', (['(days + 1)'], {}), '(days + 1)\n', (5122, 5132), True, 'import numpy as np\n'), ((5173, 5191), 'numpy.zeros', 'np.zeros', (['(days + 1)'], {}), '(days + 1)\n', (5181, 5191), True, 'import numpy as np\n'), ((5336, 5395), 'Eir.DTMC.spatialModel.simul_details.Simul_Details', '...
import re import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd from mpl_toolkits.axes_grid1 import make_axes_locatable from nilearn.plotting import cm from scipy.stats.mstats import zscore from scipy.stats import percentileofscore import seaborn as sns from src.data_cleaning impo...
[ "matplotlib.backends.backend_pdf.PdfPages", "matplotlib.rc", "numpy.abs", "seaborn.heatmap", "pandas.read_csv", "numpy.isnan", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.arange", "src.utils.unflatten", "pandas.DataFrame", "matplotlib.pyplot.close", "numpy.max", "re.findall", "ma...
[((1579, 1591), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1589, 1591), True, 'import matplotlib.pyplot as plt\n'), ((1708, 1731), 'mpl_toolkits.axes_grid1.make_axes_locatable', 'make_axes_locatable', (['ax'], {}), '(ax)\n', (1727, 1731), False, 'from mpl_toolkits.axes_grid1 import make_axes_locatable...
import os from IPython.display import clear_output import time import datetime import numpy as np import pickle # Printer: def print_average_score(total_scores, ratio=10): # Calculate and print the average score per a number of episodes (tick) scores_per_tick_episodes = np.split(np.array(total_scores), rati...
[ "pickle.dump", "numpy.zeros_like", "os.makedirs", "numpy.std", "numpy.zeros", "os.path.exists", "time.sleep", "numpy.mean", "numpy.array", "pickle.load", "numpy.exp", "IPython.display.clear_output", "datetime.datetime.now" ]
[((3212, 3253), 'numpy.zeros_like', 'np.zeros_like', (['memory_r'], {'dtype': 'np.float32'}), '(memory_r, dtype=np.float32)\n', (3225, 3253), True, 'import numpy as np\n'), ((3635, 3658), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (3656, 3658), False, 'import datetime\n'), ((3678, 3696), 'numpy...
#!/usr/bin/python # -*- coding:utf8 -*- import numpy as np import math import Control_Exp1001 as CE import os import json from Control_Exp1001.demo.thickener_noise_chinese.thickener_chinese import Thickener from Control_Exp1001.common.replay.replay_buffer import ReplayBuffer from Control_Exp1001.common.action_noise.no...
[ "os.mkdir", "Control_Exp1001.demo.thickener_noise_chinese.controllers.value_iterate.VI", "numpy.random.seed", "random.randint", "Control_Exp1001.demo.thickener_noise_chinese.thickener_chinese.Thickener", "torch.manual_seed", "Control_Exp1001.demo.thickener_noise_chinese.common.one_round_exp.OneRoundExp"...
[((1211, 1245), 'Control_Exp1001.demo.thickener_noise_chinese.common.exp_name.set_exp_name', 'exp_name.set_exp_name', (['"""VI_Replay"""'], {}), "('VI_Replay')\n", (1232, 1245), False, 'from Control_Exp1001.demo.thickener_noise_chinese.common import exp_name\n'), ((1257, 1280), 'Control_Exp1001.demo.thickener_noise_chi...
import numpy as np from gym.spaces import Box from metaworld.envs.asset_path_utils import full_v2_path_for from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import ( SawyerXYZEnv, _assert_task_is_set, ) from pyquaternion import Quaternion from metaworld.envs.mujoco.utils.rotation import euler2quat class ...
[ "numpy.abs", "numpy.tanh", "numpy.linalg.norm", "numpy.array", "metaworld.envs.asset_path_utils.full_v2_path_for" ]
[((1485, 1533), 'metaworld.envs.asset_path_utils.full_v2_path_for', 'full_v2_path_for', (['"""sawyer_xyz/sawyer_hammer.xml"""'], {}), "('sawyer_xyz/sawyer_hammer.xml')\n", (1501, 1533), False, 'from metaworld.envs.asset_path_utils import full_v2_path_for\n'), ((2549, 2577), 'numpy.array', 'np.array', (['[-0.24, 0.85, 0...
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "tensorflow.compat.v1.zeros", "tensorflow.compat.v1.keras.constraints.non_neg", "tensorflow.compat.v1.Print", "tensorflow.compat.v1.log", "tensorflow.compat.v1.transpose", "tensorflow.compat.v1.summary.histogram", "tensorflow.compat.v1.global_variables_initializer", "tensorflow.compat.v1.nn.softmax_cr...
[((1779, 1845), 'collections.namedtuple', 'collections.namedtuple', (['"""SeqTensor"""', "['tensor', 'sequence_length']"], {}), "('SeqTensor', ['tensor', 'sequence_length'])\n", (1801, 1845), False, 'import collections\n'), ((55462, 55513), 'tensorflow.compat.v1.sequence_mask', 'tf.sequence_mask', (['sequence_length'],...
# Lint as: python3 # Copyright 2019 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
[ "reverb.item_selectors.Fifo", "numpy.ones", "tensorflow.compat.v1.disable_eager_execution", "tensorflow.compat.v1.print", "tensorflow.python.framework.tensor_spec.BoundedTensorSpec", "tensorflow.compat.v1.constant", "tensorflow.compat.v1.TensorShape", "tensorflow.compat.v1.test.main", "socket.gethos...
[((5295, 6587), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["{'testcase_name': 'default_values'}", "{'testcase_name': 'num_workers_per_iterator_is_0',\n 'num_workers_per_iterator': 0, 'want_error': ValueError}", "{'testcase_name': 'num_workers_per_iterator_is_1',\n 'num_work...
import rqalpha from rqalpha.api import * import numpy as np from strategy.RL.DoubleDQN import config from algorithm.RL.DoubleDQN import Algorithm from base.env.trader import ActionCode from sklearn.preprocessing import StandardScaler # 在这个方法中编写任何的初始化逻辑。context对象将会在你的算法策略的任何方法之间做传递。 def init(context): # context....
[ "rqalpha.run_func", "numpy.array", "strategy.RL.DoubleDQN.config.get" ]
[((2715, 2845), 'rqalpha.run_func', 'rqalpha.run_func', ([], {'init': 'init', 'before_trading': 'before_trading', 'handle_bar': 'handle_bar', 'after_trading': 'after_trading', 'config': 'config'}), '(init=init, before_trading=before_trading, handle_bar=\n handle_bar, after_trading=after_trading, config=config)\n', (...
from collections import defaultdict from unittest.case import TestCase from numpy.random import permutation from numpy.random.mtrand import RandomState from pandas import Series from survey.questions import RankedChoiceQuestion class TestRankedChoiceQuestion(TestCase): def setUp(self) -> None: RandomSt...
[ "collections.defaultdict", "numpy.random.mtrand.RandomState", "survey.questions.RankedChoiceQuestion", "numpy.random.permutation" ]
[((312, 326), 'numpy.random.mtrand.RandomState', 'RandomState', (['(0)'], {}), '(0)\n', (323, 326), False, 'from numpy.random.mtrand import RandomState\n'), ((492, 508), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (503, 508), False, 'from collections import defaultdict\n'), ((729, 852), 'survey....
""" Shared utilities for models.py and test_run.py. """ import os import random import numpy as np import pickle import torch from torch.autograd import Variable __author__ = "<NAME>" def bool_ext(rbool): """ Solve the problem that raw bool type is always True. Parameters ---------- rbool: str should ...
[ "torch.LongTensor", "random.shuffle", "numpy.asarray", "random.Random", "torch.FloatTensor", "numpy.around", "numpy.mean", "numpy.reshape", "numpy.dot", "os.path.join" ]
[((1212, 1259), 'numpy.asarray', 'np.asarray', (['[[x + 1] for x in can_r]'], {'dtype': 'int'}), '([[x + 1] for x in can_r], dtype=int)\n', (1222, 1259), True, 'import numpy as np\n'), ((5021, 5043), 'numpy.reshape', 'np.reshape', (['labels', '(-1)'], {}), '(labels, -1)\n', (5031, 5043), True, 'import numpy as np\n'), ...
""" Copyright 2021 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
[ "pandas.DataFrame", "numpy.ceil", "impetuous.clustering.absolute_coordinates_to_distance_matrix", "impetuous.clustering.connectivity", "pandas.read_csv", "numpy.zeros", "numpy.shape", "impetuous.quantification.group_significance", "numpy.max", "numpy.mean", "numpy.where", "numpy.random.rand", ...
[((3260, 3294), 'numpy.max', 'np.max', (['df[dag_level_label].values'], {}), '(df[dag_level_label].values)\n', (3266, 3294), True, 'import numpy as np\n'), ((6940, 6965), 'numpy.shape', 'np.shape', (['distance_matrix'], {}), '(distance_matrix)\n', (6948, 6965), True, 'import numpy as np\n'), ((9128, 9147), 'pandas.Data...
#Ref: <NAME> """ This code normalizes staining appearance of H&E stained images. It also separates the hematoxylin and eosing stains in to different images. Workflow based on the following papers: A method for normalizing histology slides for quantitative analysis. M. Macenko et al., ISBI 2009 http://wwwx.cs.un...
[ "numpy.divide", "numpy.arctan2", "numpy.linalg.lstsq", "cv2.cvtColor", "numpy.expand_dims", "numpy.percentile", "cv2.imread", "numpy.any", "numpy.sin", "numpy.array", "matplotlib.pyplot.imsave", "numpy.reshape", "numpy.cos", "numpy.cov" ]
[((1697, 1734), 'cv2.imread', 'cv2.imread', (['"""images/HnE_Image.jpg"""', '(1)'], {}), "('images/HnE_Image.jpg', 1)\n", (1707, 1734), False, 'import cv2\n'), ((1741, 1777), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (1753, 1777), False, 'import cv2\n'), ((2300, 2...
from flask import Flask app = Flask(__name__,static_folder="myCSS") #,template_folder="/content/COVID-Brain-Tumour-Project/project folder") import numpy as np from keras.preprocessing import image from keras.models import load_model from flask import redirect, url_for, request, render_template, Response, jsonify, redir...
[ "keras.models.load_model", "numpy.argmax", "flask_cors.CORS", "flask.Flask", "numpy.expand_dims", "werkzeug.utils.secure_filename", "keras.preprocessing.image.img_to_array", "keras.preprocessing.image.load_img", "flask.render_template" ]
[((30, 68), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""myCSS"""'}), "(__name__, static_folder='myCSS')\n", (35, 68), False, 'from flask import Flask\n'), ((536, 581), 'flask_cors.CORS', 'CORS', (['app'], {'resources': "{'/*': {'origins': '*'}}"}), "(app, resources={'/*': {'origins': '*'}})\n", (540, 5...
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import unittest import numpy as np from extensions.front.broadcast_with_range import ExpandRangeConstant from mo.utils.ir_engine.compare_graphs import compare_graphs from mo.utils.unittest.graph import build_graph, result, regular_op_w...
[ "mo.utils.ir_engine.compare_graphs.compare_graphs", "mo.utils.unittest.graph.regular_op_with_shaped_data", "mo.utils.unittest.graph.connect", "numpy.array", "numpy.arange", "mo.utils.unittest.graph.result", "mo.utils.unittest.graph.connect_data", "mo.utils.unittest.graph.regular_op_with_empty_data", ...
[((2430, 2493), 'mo.utils.ir_engine.compare_graphs.compare_graphs', 'compare_graphs', (['graph', 'graph_ref', '"""output"""'], {'check_op_attrs': '(True)'}), "(graph, graph_ref, 'output', check_op_attrs=True)\n", (2444, 2493), False, 'from mo.utils.ir_engine.compare_graphs import compare_graphs\n'), ((563, 627), 'mo.ut...
# -*- coding: utf-8 -*- """ Use this file for your answers. This file should been in the root of the repository (do not move it or change the file name) """ import numpy as np from numpy.linalg import inv def lml(alpha, beta, Phi, Y): """ 4 marks :param alpha: float :param beta: float :param ...
[ "numpy.trace", "numpy.log", "numpy.identity", "numpy.array", "numpy.linalg.inv", "numpy.dot", "numpy.linalg.det" ]
[((1487, 1505), 'numpy.trace', 'np.trace', (['common.T'], {}), '(common.T)\n', (1495, 1505), True, 'import numpy as np\n'), ((1518, 1545), 'numpy.array', 'np.array', (['[d_alpha, d_bete]'], {}), '([d_alpha, d_bete])\n', (1526, 1545), True, 'import numpy as np\n'), ((530, 547), 'numpy.log', 'np.log', (['(2 * np.pi)'], {...
import numpy as np import h5py def group_name(norm_fn, residual_fn): if norm_fn not in ['normal_dist', 'percent_change', 'zero_one', '']: raise ValueError('Invalid norm function') if residual_fn not in ['exp_residual', 'gdp_residual', 'linear_residual', 'none', '']: raise ValueError('Invalid r...
[ "numpy.min" ]
[((1968, 1981), 'numpy.min', 'np.min', (['array'], {}), '(array)\n', (1974, 1981), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ Created on Tue Apr 27 20:40:39 2021 @author:AlanMWatson Napari plugin for reading imaris files as a multiresolution series. NOTE: Currently "File/Preferences/Render Images Asynchronously" must be turned on for this plugin to work *** Issues remain with indexing and the shape of retu...
[ "dask.array.from_array", "imaris_ims_file_reader.ims.ims", "numpy.dtype", "os.path.splitext" ]
[((2137, 2146), 'imaris_ims_file_reader.ims.ims', 'ims', (['path'], {}), '(path)\n', (2140, 2146), False, 'from imaris_ims_file_reader.ims import ims\n'), ((2178, 2196), 'numpy.dtype', 'np.dtype', (['"""uint16"""'], {}), "('uint16')\n", (2186, 2196), True, 'import numpy as np\n'), ((3173, 3336), 'dask.array.from_array'...
import pandas as pd import numpy as np import os from IPython.display import display pd.set_option('display.max_rows', 1200) pd.set_option('display.max_columns', 20) data = pd.read_csv('data.csv') #1 display(data[data.budget == data.budget.max()]) #answer - 4 #2 display(data[data.runtime == data.runtime.max()]) #ans...
[ "pandas.read_csv", "pandas.set_option", "numpy.array", "IPython.display.display" ]
[((86, 125), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(1200)'], {}), "('display.max_rows', 1200)\n", (99, 125), True, 'import pandas as pd\n'), ((126, 166), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(20)'], {}), "('display.max_columns', 20)\n", (139, 166), True, 'im...
import argparse import os from pathlib import Path import librosa import numpy as np import tqdm import ruamel.yaml from preprocessing.text import Pipeline from utils.audio import Audio parser = argparse.ArgumentParser() parser.add_argument('--config', dest='CONFIG', type=str, required=True) parser.add_argument('--d...
[ "numpy.load", "numpy.save", "numpy.random.seed", "argparse.ArgumentParser", "os.makedirs", "preprocessing.text.Pipeline.default_training_pipeline", "os.path.exists", "numpy.expand_dims", "pathlib.Path", "utils.audio.Audio", "numpy.array", "librosa.load", "os.path.join", "numpy.random.shuff...
[((198, 223), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (221, 223), False, 'import argparse\n'), ((903, 959), 'os.path.join', 'os.path.join', (['args.DATA_DIR', "config['metadata_filename']"], {}), "(args.DATA_DIR, config['metadata_filename'])\n", (915, 959), False, 'import os\n'), ((975, ...
import numpy as np from pyticle.particle import Particle class SwarmOptimization: def __init__( self, cost_func: object, particle_num: int, omega_start: float, omega_end: float, coef: list, low_bound: float, high_bound: float, boundary_strat...
[ "numpy.random.uniform", "numpy.abs", "numpy.linspace", "pyticle.particle.Particle", "numpy.concatenate", "numpy.sqrt" ]
[((1376, 1440), 'numpy.linspace', 'np.linspace', (['omega_start', 'omega_end', 'max_iter_num'], {'endpoint': '(True)'}), '(omega_start, omega_end, max_iter_num, endpoint=True)\n', (1387, 1440), True, 'import numpy as np\n'), ((2664, 2696), 'numpy.concatenate', 'np.concatenate', (['pos_list'], {'axis': '(0)'}), '(pos_li...
from __future__ import print_function from pandas import DataFrame from .magrittr import import_methods import_methods(obj=DataFrame(), namespace=globals(), strict=True) if __name__=='__main__': import numpy as np df = DataFrame(np.arange(9).reshape((3,3)), columns=list('abc')) print('>>> df') pri...
[ "pandas.DataFrame", "numpy.arange" ]
[((127, 138), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (136, 138), False, 'from pandas import DataFrame\n'), ((1130, 1141), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (1139, 1141), False, 'from pandas import DataFrame\n'), ((243, 255), 'numpy.arange', 'np.arange', (['(9)'], {}), '(9)\n', (252, 255), T...
import numpy as np from random import expovariate, choice from math import comb hashpowers = [0.1, 0.2, 0.3, 0.4] voter_depth_k = [1, 2, 3, 4] num_voter_chains = [10, 20, 30, 40] success_prob = {} for beta in hashpowers: nsamples = 100000 nblocks = 200 # Simulate block mining times adv_wt = np.zer...
[ "random.expovariate", "math.comb", "numpy.zeros", "numpy.any", "numpy.cumsum", "numpy.isclose" ]
[((314, 361), 'numpy.zeros', 'np.zeros', (['(nsamples, nblocks)'], {'dtype': 'np.float64'}), '((nsamples, nblocks), dtype=np.float64)\n', (322, 361), True, 'import numpy as np\n'), ((378, 425), 'numpy.zeros', 'np.zeros', (['(nsamples, nblocks)'], {'dtype': 'np.float64'}), '((nsamples, nblocks), dtype=np.float64)\n', (3...
#!/usr/bin/env python """ Calculates the Lambertian, BRDF corrected and BRDF + Terrain corrected ---------------------------------------------------------------------- reflectance ----------- """ from __future__ import absolute_import, print_function import numpy import h5py from wagl.constants import DatasetName, ...
[ "wagl.data.as_array", "wagl.hdf5.find", "h5py.File", "wagl.hdf5.attach_image_attributes", "numpy.zeros", "wagl.metadata.create_ard_yaml", "wagl.hdf5.create_external_link" ]
[((10579, 10621), 'wagl.hdf5.attach_image_attributes', 'attach_image_attributes', (['lmbrt_dset', 'attrs'], {}), '(lmbrt_dset, attrs)\n', (10602, 10621), False, 'from wagl.hdf5 import H5CompressionFilter, attach_image_attributes\n'), ((10734, 10775), 'wagl.hdf5.attach_image_attributes', 'attach_image_attributes', (['nb...
""" Tests geometry routines """ from builtins import range import random import itertools import pytest import numpy as np import moldesign as mdt from moldesign import units as u from . import helpers registered_types = {} __PYTEST_MARK__ = 'internal' # mark all tests in this module with this label (see ./conft...
[ "moldesign.set_distance", "numpy.sum", "moldesign.distance", "pytest.mark.parametrize", "builtins.range", "moldesign.DihedralMonitor", "pytest.raises", "numpy.testing.assert_allclose", "moldesign.set_dihedral", "pytest.fixture", "random.random", "moldesign.set_angle", "moldesign.AngleMonitor...
[((8556, 8624), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""objkey"""', "registered_types['atomcontainer']"], {}), "('objkey', registered_types['atomcontainer'])\n", (8579, 8624), False, 'import pytest\n'), ((1433, 1441), 'builtins.range', 'range', (['(3)'], {}), '(3)\n', (1438, 1441), False, 'from buil...
import cv2 import numpy as np import torch import os import time from .opts import opts from .tracker_trt import FairTracker from .fairmot.utils.transformation import * from .fairmot.tracking_utils import visualization as vis from .fairmot.tracking_utils.log import logger from .test_utils import write_results """ Th...
[ "numpy.ascontiguousarray", "numpy.array", "numpy.expand_dims", "time.time" ]
[((1440, 1454), 'numpy.array', 'np.array', (['img0'], {}), '(img0)\n', (1448, 1454), True, 'import numpy as np\n'), ((1659, 1702), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['img'], {'dtype': 'np.float32'}), '(img, dtype=np.float32)\n', (1679, 1702), True, 'import numpy as np\n'), ((1918, 1929), 'time.time', ...
# -*- coding: utf-8 -*- """ Methods for loading and saving fiber_bundles objects into .dat and .h5 files """ import os import numpy as np import h5py from .. import objects def load(file_name, group_name='/'): """ Load fiberbundles configurations from a text file oder hdf5 file Parameters ---------...
[ "h5py.File", "numpy.array", "os.path.splitext" ]
[((587, 614), 'os.path.splitext', 'os.path.splitext', (['file_name'], {}), '(file_name)\n', (603, 614), False, 'import os\n'), ((3078, 3105), 'os.path.splitext', 'os.path.splitext', (['file_name'], {}), '(file_name)\n', (3094, 3105), False, 'import os\n'), ((1946, 1961), 'numpy.array', 'np.array', (['fiber'], {}), '(fi...
# Copyright 2021 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...
[ "mindspore.context.set_context", "scipy.optimize.linesearch.line_search_wolfe2", "numpy.array", "mindspore.numpy.array", "pytest.mark.parametrize", "mindspore.scipy.optimize.line_search.line_search" ]
[((979, 1023), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE'}), '(mode=context.GRAPH_MODE)\n', (998, 1023), False, 'from mindspore import context\n'), ((1616, 1765), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""maxiter, func, x, p"""', '[(10, _scalar_func_1, 0...
""" Computes the reflectance curves in figures 7 and 8 """ import os import imageio import numpy as np import matplotlib.pyplot as plt from utils.uhi import UHIData def fig_reflectance(sample_dir, mask_dir, model_path=None, median_centered=True): """ Create reflectance figures from samples and masks containe...
[ "matplotlib.pyplot.show", "numpy.median", "utils.uhi.UHIData", "matplotlib.pyplot.scatter", "matplotlib.pyplot.figure", "numpy.mean", "numpy.min", "os.path.splitext", "numpy.max", "matplotlib.pyplot.ylabel", "numpy.broadcast_to", "matplotlib.pyplot.xlabel", "os.path.join", "os.listdir" ]
[((2789, 2799), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2797, 2799), True, 'import matplotlib.pyplot as plt\n'), ((1003, 1026), 'os.path.splitext', 'os.path.splitext', (['fname'], {}), '(fname)\n', (1019, 1026), False, 'import os\n'), ((1313, 1322), 'utils.uhi.UHIData', 'UHIData', ([], {}), '()\n', (13...
#!/usr/bin/python3 """Training and Validation On Segmentation Task.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import math import random import shutil import argparse import importlib import data_utils import numpy as np import ...
[ "argparse.ArgumentParser", "tensorflow.reshape", "numpy.ones", "tensorflow.local_variables_initializer", "tensorflow.train.latest_checkpoint", "numpy.arange", "sys.path.append", "numpy.random.randn", "os.path.dirname", "tensorflow.placeholder", "datetime.datetime.now", "numpy.save", "importl...
[((448, 473), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (471, 473), False, 'import argparse\n'), ((1098, 1133), 'importlib.import_module', 'importlib.import_module', (['args.model'], {}), '(args.model)\n', (1121, 1133), False, 'import importlib\n'), ((1209, 1238), 'sys.path.append', 'sys.p...
""" Compute cross-spectral density (CSD) matrices """ from __future__ import print_function import warnings import argparse import numpy as np import mne from mne.time_frequency import csd_morlet from config import fname, n_jobs, csd_tmin, csd_tmax, freq_bands, conditions # Be verbose mne.set_log_level('INFO') # Ha...
[ "config.fname.csd", "config.fname.epo", "warnings.simplefilter", "argparse.ArgumentParser", "mne.set_log_level", "config.fname.report_html", "mne.time_frequency.csd_morlet", "numpy.arange", "config.fname.report" ]
[((289, 314), 'mne.set_log_level', 'mne.set_log_level', (['"""INFO"""'], {}), "('INFO')\n", (306, 314), False, 'import mne\n'), ((357, 401), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (380, 401), False, 'import argparse\n'), ((711, 742), 'warnings....
import sys import os import numpy as np import scipy.io import scipy.sparse import numba import random import multiprocessing as mp import subprocess import cytoolz as toolz import collections from itertools import chain import regex as re import yaml import logging import time import gzip import pandas as pd from func...
[ "os.remove", "pandas.HDFStore", "numpy.sum", "pandas.read_csv", "numpy.floor", "collections.defaultdict", "numpy.arange", "yaml.safe_load", "collections.deque", "multiprocessing.cpu_count", "pandas.DataFrame", "pandas.read_hdf", "regex.compile", "cytoolz.partition_all", "numpy.cumsum", ...
[((622, 716), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s: %(levelname)s: %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s: %(levelname)s: %(message)s')\n", (641, 716), False, 'import logging\n'), ((730, 757), 'logging.getLogger', 'logging.get...
import pymysql import pandas as pd import numpy as np HOST = '172.16.17.32' USER = 'guest' PASSWORD = '<PASSWORD>' DATABASE = 'PTTData' def LoadDataList(): def execute_sql2(sql): conn = ( pymysql.connect(host = HOST, port = 3306, user = USER, ...
[ "pandas.DataFrame", "pymysql.connect", "numpy.concatenate" ]
[((767, 794), 'numpy.concatenate', 'np.concatenate', (['tem'], {'axis': '(0)'}), '(tem, axis=0)\n', (781, 794), True, 'import numpy as np\n'), ((203, 309), 'pymysql.connect', 'pymysql.connect', ([], {'host': 'HOST', 'port': '(3306)', 'user': 'USER', 'password': 'PASSWORD', 'database': 'DATABASE', 'charset': '"""utf8"""...
#!/bin/python # -*- coding: utf-8 -*- #import ImFEATbox #from PIL import Image import Image import numpy as np import ImFEATbox from ImFEATbox.__helperCommands import rgb2grayscale import csv import matplotlib.pyplot as plt #print(ImFEATbox.getFeatureNames()) # load test image with open('testimg.csv', 'r') as csvfil...
[ "numpy.abs", "matplotlib.pyplot.show", "csv.reader", "ImFEATbox.GlobalFeatures.Intensity.gradient.cFeatures", "numpy.shape", "numpy.max", "numpy.min" ]
[((436, 492), 'ImFEATbox.GlobalFeatures.Intensity.gradient.cFeatures', 'ImFEATbox.GlobalFeatures.Intensity.gradient.cFeatures', (['I'], {}), '(I)\n', (489, 492), False, 'import ImFEATbox\n'), ((1594, 1612), 'numpy.max', 'np.max', (['out_matlab'], {}), '(out_matlab)\n', (1600, 1612), True, 'import numpy as np\n'), ((162...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 16 14:53:58 2020 @author: ggleizer """ import graph_tool.all as gt import numpy as np import scipy.sparse.linalg as sla import scipy.sparse as sparse import scipy.linalg as la from scipy.sparse.linalg.eigen.arpack import ArpackNoConvergence class...
[ "graph_tool.all.all_circuits", "graph_tool.all.Graph", "graph_tool.all.dfs_search", "graph_tool.all.condensation_graph", "graph_tool.all.label_components", "graph_tool.all.graph_draw", "numpy.zeros", "numpy.ones", "numpy.argmin", "numpy.isinf", "graph_tool.all.adjacency", "numpy.array" ]
[((11263, 11281), 'graph_tool.all.adjacency', 'gt.adjacency', (['G', 'w'], {}), '(G, w)\n', (11275, 11281), True, 'import graph_tool.all as gt\n'), ((13488, 13508), 'numpy.zeros', 'np.zeros', (['(n, n + 1)'], {}), '((n, n + 1))\n', (13496, 13508), True, 'import numpy as np\n'), ((14806, 14826), 'numpy.zeros', 'np.zeros...
import os import datetime import json import tensorflow as tf import tensorflow.contrib.slim as slim import numpy as np import scipy class Namespace(dict): """A dict subclass that exposes its items as attributes. Warning: Namespace instances do not have direct access to the dict methods. Taken from:...
[ "scipy.misc.toimage", "json.dump", "json.load", "os.makedirs", "tensorflow.trainable_variables", "os.path.exists", "datetime.datetime.now", "tensorflow.contrib.slim.model_analyzer.analyze_vars", "numpy.squeeze", "os.path.join" ]
[((2218, 2242), 'tensorflow.trainable_variables', 'tf.trainable_variables', ([], {}), '()\n', (2240, 2242), True, 'import tensorflow as tf\n'), ((2247, 2308), 'tensorflow.contrib.slim.model_analyzer.analyze_vars', 'slim.model_analyzer.analyze_vars', (['model_vars'], {'print_info': '(True)'}), '(model_vars, print_info=T...
import os import os.path import tempfile import shutil import numpy as np import yt from yt.testing import \ assert_equal from yt.utilities.lib.api import add_rgba_points_to_image def setup(): """Test specific setup.""" from yt.config import ytcfg ytcfg["yt", "__withintesting"] = "True" def test_spl...
[ "os.remove", "yt.utilities.lib.api.add_rgba_points_to_image", "os.getcwd", "numpy.zeros", "yt.testing.assert_equal", "numpy.random.RandomState", "os.path.exists", "tempfile.mkdtemp", "shutil.rmtree", "os.chdir", "yt.write_bitmap" ]
[((394, 412), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (410, 412), False, 'import tempfile\n'), ((426, 437), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (435, 437), False, 'import os\n'), ((442, 458), 'os.chdir', 'os.chdir', (['tmpdir'], {}), '(tmpdir)\n', (450, 458), False, 'import os\n'), ((471, 502)...
from typing import List, Union from pathlib import Path import warnings import numpy as np from probeinterface import Probe, ProbeGroup, write_probeinterface, read_probeinterface from .base import BaseExtractor, BaseSegment from .core_tools import write_binary_recording, write_memory_recording from warnings import ...
[ "numpy.load", "spikeinterface.FrameSliceRecording", "numpy.argsort", "pathlib.Path", "numpy.arange", "numpy.unique", "numpy.max", "probeinterface.write_probeinterface", "spikeinterface.ChannelSliceRecording", "numpy.save", "probeinterface.ProbeGroup.from_numpy", "probeinterface.Probe", "prob...
[((937, 952), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (945, 952), True, 'import numpy as np\n'), ((9459, 9471), 'pathlib.Path', 'Path', (['folder'], {}), '(folder)\n', (9463, 9471), False, 'from pathlib import Path\n'), ((10752, 10764), 'probeinterface.ProbeGroup', 'ProbeGroup', ([], {}), '()\n', (1076...
from __future__ import division import numpy as np import pandas as pd import plotly.graph_objs as go from plotly.offline import plot from cea.plots.variable_naming import LOGO, COLOR def thermal_storage_activation_curve(data_frame, analysis_fields_charging, analysis_fields_discharging, ...
[ "plotly.graph_objs.Figure", "numpy.append", "pandas.to_datetime", "plotly.offline.plot" ]
[((1538, 1581), 'plotly.graph_objs.Figure', 'go.Figure', ([], {'data': 'traces_graph', 'layout': 'layout'}), '(data=traces_graph, layout=layout)\n', (1547, 1581), True, 'import plotly.graph_objs as go\n'), ((1586, 1634), 'plotly.offline.plot', 'plot', (['fig'], {'auto_open': '(False)', 'filename': 'output_path'}), '(fi...
# Copyright (c) 2020 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...
[ "paddle.jit.to_static", "numpy.random.seed", "argparse.ArgumentParser", "paddle.amp.GradScaler", "os.path.join", "paddlenlp.data.Stack", "numpy.full", "random.Random", "os.path.exists", "random.seed", "paddle.DataParallel", "paddle.set_device", "concurrent.futures.ThreadPoolExecutor", "pad...
[((1405, 1459), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': 'FORMAT'}), '(level=logging.INFO, format=FORMAT)\n', (1424, 1459), False, 'import logging\n'), ((1469, 1496), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1486, 1496), False, 'import ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import os import sys import pytest import six from plotille import Canvas try: import numpy as np have_numpy = True except ImportError: have_numpy = False try: from PIL import Image have_p...
[ "plotille.Canvas", "six.text_type", "PIL.Image.open", "pytest.raises", "pytest.mark.skipif", "numpy.random.random", "os.linesep.join", "pytest.mark.parametrize" ]
[((380, 444), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not have_numpy)'], {'reason': '"""No numpy installed."""'}), "(not have_numpy, reason='No numpy installed.')\n", (398, 444), False, 'import pytest\n'), ((3019, 3066), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""color"""', "[None, 'red']"], {}...
# Learning to rank with the Galerkin method from sys import argv import numpy as np import numpy.linalg import scipy.linalg import time import sys import pprCommon defaultParam = np.array([0.34, 0.33, 1.0, 0.33, 0.75, 0.25, 1.0]) LearnLambda = 1000.0 LearnRate = 1e-4 LossB = 0.2 if len(argv) != 5: print >> sy...
[ "pprCommon.ReadTrainRank", "numpy.load", "numpy.zeros", "pprCommon.ReadBinCscMat", "time.time", "numpy.array", "sys.stdout.flush", "pprCommon.ProjectGradient", "numpy.eye", "sys.exit" ]
[((183, 233), 'numpy.array', 'np.array', (['[0.34, 0.33, 1.0, 0.33, 0.75, 0.25, 1.0]'], {}), '([0.34, 0.33, 1.0, 0.33, 0.75, 0.25, 1.0])\n', (191, 233), True, 'import numpy as np\n'), ((781, 792), 'numpy.eye', 'np.eye', (['dim'], {}), '(dim)\n', (787, 792), True, 'import numpy as np\n'), ((1212, 1223), 'numpy.zeros', '...
""" Class and script for fitting microlensing model using MulensModel. All the settings are read from a YAML file. """ import sys import time from os import path, sep import tempfile import shutil import warnings from multiprocessing import Pool import math import numpy as np from scipy.interpolate import interp1d from...
[ "numpy.logical_not", "MulensModel.Model", "numpy.sum", "numpy.abs", "pymultinest.analyse.Analyzer", "numpy.isnan", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "numpy.exp", "yaml.safe_load", "os.path.isfile", "MulensModel.Utils.get_mag_and_err_from_flux", "m...
[((42163, 42179), 'os.path.isdir', 'path.isdir', (['root'], {}), '(root)\n', (42173, 42179), False, 'from os import path, sep\n'), ((42653, 42669), 'os.path.isdir', 'path.isdir', (['root'], {}), '(root)\n', (42663, 42669), False, 'from os import path, sep\n'), ((46312, 46332), 'numpy.array', 'np.array', (['min_values']...
# encoding=utf8 import logging import multiprocessing import threading import numpy as np from numpy.random import default_rng from niapy.util.array import objects_to_array logging.basicConfig() logger = logging.getLogger('niapy.util.utility') logger.setLevel('INFO') __all__ = [ 'Algorithm', 'Individual', ...
[ "multiprocessing.current_process", "logging.basicConfig", "numpy.asarray", "numpy.argmin", "numpy.random.default_rng", "numpy.apply_along_axis", "numpy.array_equal", "threading.main_thread", "threading.current_thread", "logging.getLogger" ]
[((176, 197), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (195, 197), False, 'import logging\n'), ((207, 246), 'logging.getLogger', 'logging.getLogger', (['"""niapy.util.utility"""'], {}), "('niapy.util.utility')\n", (224, 246), False, 'import logging\n'), ((1044, 1082), 'numpy.apply_along_axis', 'n...
"""Functions for calculating properties of prisms. Common definitions: * lamb: wavelength in m * omega: frequency in rad/s * n: refractive index * nlamb: refractive index function of wavelength * theta_1: incident angle w.r.t. first face normal, increasing away from apex. * thetap_1: internal refracted angle w.r.t fi...
[ "numpy.sin", "numpy.cos", "scipy.misc.derivative" ]
[((1557, 1570), 'numpy.sin', 'np.sin', (['alpha'], {}), '(alpha)\n', (1563, 1570), True, 'import numpy as np\n'), ((2043, 2078), 'scipy.misc.derivative', 'derivative', (['nlamb', 'lamb', '(lamb / 100)'], {}), '(nlamb, lamb, lamb / 100)\n', (2053, 2078), False, 'from scipy.misc import derivative\n'), ((2435, 2450), 'num...
import os import json import random import codecs import logging import numpy as np from sklearn.externals import joblib from typing import List from google.cloud import storage, bigquery def download_from_gcs(bucket_dir_name: str, file_name: str): GCS_BUCKET_NAME = "recsys2020-challenge-wantedly" PROJECT_ID ...
[ "tensorflow.random.set_seed", "json.dump", "sklearn.externals.joblib.dump", "numpy.random.seed", "codecs.open", "logging.FileHandler", "os.path.basename", "torch.manual_seed", "os.path.dirname", "logging.StreamHandler", "torch.cuda.manual_seed", "logging.Formatter", "google.cloud.storage.Cli...
[((366, 400), 'google.cloud.storage.Client', 'storage.Client', ([], {'project': 'PROJECT_ID'}), '(project=PROJECT_ID)\n', (380, 400), False, 'from google.cloud import storage, bigquery\n'), ((837, 871), 'google.cloud.storage.Client', 'storage.Client', ([], {'project': 'PROJECT_ID'}), '(project=PROJECT_ID)\n', (851, 871...
""" example cmdline: python test/optimizer/mo/benchmark_mo_gpflowopt_lightgbm.py --datasets spambase --n 200 --rep 1 --start_id 0 """ import os import sys import time from functools import partial import numpy as np import argparse import pickle as pkl import gpflow import gpflowopt sys.path.insert(0, os.getcwd())...
[ "gpflowopt.design.LatinHyperCube", "pickle.dump", "numpy.random.seed", "argparse.ArgumentParser", "sklearn.model_selection.train_test_split", "test.test_utils.timeit", "os.path.join", "test.test_utils.load_data", "numpy.atleast_2d", "mo_benchmark_function.LightGBM", "os.path.exists", "mo_bench...
[((654, 679), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (677, 679), False, 'import argparse\n'), ((1107, 1145), 'test.test_utils.check_datasets', 'check_datasets', (['dataset_list', 'data_dir'], {}), '(dataset_list, data_dir)\n', (1121, 1145), False, 'from test.test_utils import check_data...
from datetime import date from numpy import shape from matplotlib.dates import MonthLocator, DateFormatter class YearPlotter: def __init__(self): start=365*1+1 self.dates=[date.fromordinal(i) for i in range(start,start+365)] self.monthsFmt = DateFormatter("%b") self.months = MonthLoc...
[ "numpy.shape", "matplotlib.dates.DateFormatter", "datetime.date.fromordinal" ]
[((270, 289), 'matplotlib.dates.DateFormatter', 'DateFormatter', (['"""%b"""'], {}), "('%b')\n", (283, 289), False, 'from matplotlib.dates import MonthLocator, DateFormatter\n'), ((519, 527), 'numpy.shape', 'shape', (['T'], {}), '(T)\n', (524, 527), False, 'from numpy import shape\n'), ((192, 211), 'datetime.date.fromo...
# Princeton University licenses this file to You 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 writin...
[ "psyneulink.core.components.functions.userdefinedfunction.UserDefinedFunction", "psyneulink.core.globals.utilities.prune_unused_args", "psyneulink.core.globals.utilities.convert_all_elements_to_np_array", "psyneulink.core.globals.log.Log", "psyneulink.core.components.functions.function.FunctionError", "co...
[((28164, 28191), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (28181, 28191), False, 'import logging\n'), ((85013, 85038), 'psyneulink.core.globals.context.handle_external_context', 'handle_external_context', ([], {}), '()\n', (85036, 85038), False, 'from psyneulink.core.globals.contex...
import numpy as np import gensim import string import re import collections import logging from matplotlib import pyplot as plt from sklearn.manifold import TSNE import time ae_size = 250 #logging setup logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) #load 20 newsgroups d...
[ "re.split", "logging.basicConfig", "sklearn.manifold.TSNE", "numpy.empty", "gensim.models.Word2Vec", "matplotlib.pyplot.subplots", "time.time", "re.findall", "collections.Counter", "re.sub", "matplotlib.pyplot.savefig" ]
[((206, 301), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.INFO)\n", (225, 301), False, 'import logging\n'), ((759, 792), 're.sub', 're.sub', (['"""-|\\...
from collections import defaultdict import numpy as np import torch from sklearn.metrics import confusion_matrix from terminaltables import AsciiTable from torchreid.utils import get_model_attr def score_extraction(data_loader, model, use_gpu, labelmap=[], head_id=0): with torch.no_grad(): out_scores, gt...
[ "numpy.sum", "numpy.maximum", "numpy.argmax", "numpy.ones", "torch.cat", "numpy.argsort", "collections.defaultdict", "numpy.mean", "numpy.exp", "torch.no_grad", "torchreid.utils.get_model_attr", "numpy.unique", "numpy.zeros_like", "numpy.logical_not", "numpy.cumsum", "numpy.size", "t...
[((1306, 1335), 'numpy.concatenate', 'np.concatenate', (['out_scores', '(0)'], {}), '(out_scores, 0)\n', (1320, 1335), True, 'import numpy as np\n'), ((1594, 1610), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (1602, 1610), True, 'import numpy as np\n'), ((1688, 1705), 'numpy.unique', 'np.unique', (['labe...
# # 1. 1.9.2020 Managed to convert ODE models for economic extension to transition model ready for stochastic simulation, using separate birth death list # See section on SC2UIR model. Not done for other two economic extensions yet # 2. 1.9.2020 Implemented stochastic simulation (Tau-leap method) using PyG...
[ "pygom.DeterministicOde", "pickle.dump", "sympy.zeros", "os.getcwd", "pygom.SimulateOde", "numpy.zeros", "pandas.plotting.register_matplotlib_converters", "pygom.Transition", "pickle.load", "numpy.array", "ipywidgets.widgets.Layout", "IPython.display.HTML" ]
[((1221, 1253), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (1251, 1253), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((5369, 5388), 'ipywidgets.widgets.Layout', 'Layout', ([], {'width': '"""99%"""'}), "(width='99%')\n", (5375, 5388),...
import os import warnings import numpy as np from torch import nn import torch import math import torch.optim as optim from sklearn.exceptions import UndefinedMetricWarning from sklearn.preprocessing import LabelEncoder from sklearn.utils import compute_class_weight from sklearn.metrics import accuracy_score from skle...
[ "dataloading.SentenceDataset", "models.BaselineDNN", "sklearn.metrics.accuracy_score", "matplotlib.pyplot.figure", "numpy.mean", "sklearn.metrics.f1_score", "training.eval_dataset", "os.path.join", "numpy.unique", "torch.utils.data.DataLoader", "sklearn.preprocessing.LabelEncoder", "utils.load...
[((1647, 1713), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UndefinedMetricWarning'}), "('ignore', category=UndefinedMetricWarning)\n", (1670, 1713), False, 'import warnings\n'), ((2036, 2078), 'os.path.join', 'os.path.join', (['EMB_PATH', '"""glove.6B.50d.txt"""'], {}), "(EMB...
import numpy as np def scale_img(img: np.ndarray, new_min: int = 0, new_max: int = 1) -> np.ndarray: """ Scale an image by the absolute max and min in the array to have dynamic range new_min to new_max. Useful for visualization. Parameters ---------- img : np.ndarr...
[ "numpy.nanmax", "numpy.nanmin", "numpy.clip" ]
[((491, 505), 'numpy.nanmin', 'np.nanmin', (['img'], {}), '(img)\n', (500, 505), True, 'import numpy as np\n'), ((518, 532), 'numpy.nanmax', 'np.nanmax', (['img'], {}), '(img)\n', (527, 532), True, 'import numpy as np\n'), ((647, 677), 'numpy.clip', 'np.clip', (['img', 'new_min', 'new_max'], {}), '(img, new_min, new_ma...
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fixe is no longer needed. """ # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> # # License: BSD 3 clause from fu...
[ "numpy.moveaxis", "numpy.empty", "scipy.sparse.issparse", "numpy.asanyarray", "functools.update_wrapper", "numpy.arange", "numpy.linspace", "functools.wraps", "numpy.take_along_axis", "numpy.issubdtype" ]
[((6125, 6150), 'functools.wraps', 'functools.wraps', (['function'], {}), '(function)\n', (6140, 6150), False, 'import functools\n'), ((4886, 4941), 'numpy.take_along_axis', 'np.take_along_axis', ([], {'arr': 'arr', 'indices': 'indices', 'axis': 'axis'}), '(arr=arr, indices=indices, axis=axis)\n', (4904, 4941), True, '...
# -*- coding: utf-8 -*- """ Created on Sat Mar 24 00:16:07 2020 @author: tranl """ import time, sys, math import numpy as np import pandas as pd from tqdm import tqdm from binancepy import MarketData from indicators import Bbands, average_true_range from utility import timestr, print_ ###TRADING RULES QUANTPRE = { '...
[ "pandas.DataFrame", "indicators.Bbands", "numpy.zeros", "time.time", "utility.timestr" ]
[((16587, 16737), 'pandas.DataFrame', 'pd.DataFrame', (['market_data'], {'columns': "['_t', '_o', '_h', '_l', '_c', '_v', 'close_time', 'quote_av', 'trades',\n 'tb_base_av', 'tb_quote_av', 'ignore']"}), "(market_data, columns=['_t', '_o', '_h', '_l', '_c', '_v',\n 'close_time', 'quote_av', 'trades', 'tb_base_av',...
import numpy as np from . import base class ClassicMLP(object): def __init__(self, num_inputs, num_hidden, num_outputs): # initialize layers and activations self.layer_hidden = base.BiasLayer(num_neurons=num_hidden, num_inputs=num_inputs) ...
[ "numpy.zeros_like" ]
[((2367, 2401), 'numpy.zeros_like', 'np.zeros_like', (['self.layer_output.w'], {}), '(self.layer_output.w)\n', (2380, 2401), True, 'import numpy as np\n'), ((2430, 2464), 'numpy.zeros_like', 'np.zeros_like', (['self.layer_hidden.w'], {}), '(self.layer_hidden.w)\n', (2443, 2464), True, 'import numpy as np\n')]
''' Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ''' import os import datetime import argparse import numpy as np import pandas as pd import torch torch.backends.cudnn.deterministic = True import utils parser = argparse.ArgumentParser(description='X-ray embedding script')...
[ "numpy.maximum", "argparse.ArgumentParser", "pandas.read_csv", "utils.get_histogram_intensities", "numpy.mean", "utils.get_raw_covidx_images", "tensorflow.get_default_graph", "os.path.join", "os.path.exists", "utils.run_densenet_model", "utils.transform_to_standardized", "datetime.datetime.now...
[((259, 320), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""X-ray embedding script"""'}), "(description='X-ray embedding script')\n", (282, 320), False, 'import argparse\n'), ((1589, 1646), 'numpy.zeros', 'np.zeros', (['(num_samples, embedding_size)'], {'dtype': 'np.float32'}), '((num_s...
from typing import Tuple, List, Dict, TextIO import pickle import os import copy import sqlite3 from multiprocessing import Pool import numpy as np from functools import partial from mrnet.core.mol_entry import MoleculeEntry from mrnet.utils.visualization import ( visualize_molecule_entry, visualize_molecule_c...
[ "os.mkdir", "numpy.sum", "mrnet.utils.visualization.visualize_molecules", "mrnet.stochastic.serialize.rate", "numpy.mean", "mrnet.utils.visualization.visualize_molecule_count_histogram", "numpy.copy", "numpy.std", "mrnet.utils.visualization.generate_latex_footer", "mrnet.utils.visualization.latex_...
[((1461, 1485), 'sqlite3.connect', 'sqlite3.connect', (['db_path'], {}), '(db_path)\n', (1476, 1485), False, 'import sqlite3\n'), ((2688, 2742), 'sqlite3.connect', 'sqlite3.connect', (['(self.network_folder + self.db_postfix)'], {}), '(self.network_folder + self.db_postfix)\n', (2703, 2742), False, 'import sqlite3\n'),...
import numpy as np # Global Model Assumptions HORIZON = 20 # years, length of time the model covers. year = np.arange(1,HORIZON+1) # an index for temporal calculations. SAMPSIZE = 1000 # the number of iterations in the Monte Carlo simulation. run = np.arange(1, SAMPSIZE+1) # the iteration index. TAXRATE = 38 # % DISCO...
[ "numpy.arange" ]
[((109, 134), 'numpy.arange', 'np.arange', (['(1)', '(HORIZON + 1)'], {}), '(1, HORIZON + 1)\n', (118, 134), True, 'import numpy as np\n'), ((250, 276), 'numpy.arange', 'np.arange', (['(1)', '(SAMPSIZE + 1)'], {}), '(1, SAMPSIZE + 1)\n', (259, 276), True, 'import numpy as np\n')]
"""This module contains auxiliary functions for RD predictions used in the main notebook.""" import json import matplotlib as plt import pandas as pd import numpy as np import statsmodels as sm from auxiliary.auxiliary_predictions import * from auxiliary.auxiliary_plots import * from auxiliary.auxiliary_tables import...
[ "pandas.DataFrame", "numpy.isnan", "numpy.percentile", "statsmodels.regression.linear_model.OLS", "numpy.arange", "numpy.array", "pandas.concat" ]
[((2753, 2780), 'numpy.arange', 'np.arange', (['(-1.2)', '(1.25)', '(0.05)'], {}), '(-1.2, 1.25, 0.05)\n', (2762, 2780), True, 'import numpy as np\n'), ((2802, 2818), 'pandas.DataFrame', 'pd.DataFrame', (['[]'], {}), '([])\n', (2814, 2818), True, 'import pandas as pd\n'), ((4655, 4671), 'pandas.DataFrame', 'pd.DataFram...
import torch import torch.nn as nn import torch.nn.utils import torch.nn.functional as F from torch.autograd import Variable import torch.nn.functional as F import numpy as np from torch.nn.init import xavier_normal_ from transformers import RobertaModel import random class RelationExtractor(nn.Module): def __ini...
[ "torch.nn.Dropout", "numpy.random.uniform", "torch.bmm", "torch.stack", "torch.nn.LogSoftmax", "torch.norm", "torch.nn.KLDivLoss", "torch.nn.BatchNorm1d", "torch.cat", "transformers.RobertaModel.from_pretrained", "torch.sigmoid", "torch.nn.functional.log_softmax", "torch.nn.Linear", "torch...
[((925, 1010), 'transformers.RobertaModel.from_pretrained', 'RobertaModel.from_pretrained', (['"""/sdb/xmh/Projects/Pytorch/EmbedKGQA/roberta-base"""'], {}), "('/sdb/xmh/Projects/Pytorch/EmbedKGQA/roberta-base'\n )\n", (953, 1010), False, 'from transformers import RobertaModel\n'), ((2551, 2576), 'torch.nn.Dropout',...
import numpy as np from .base import AbstractABC from .utils import get_random_other_index class ABC(AbstractABC): """ Artificial Bee Colony (ABC) implementation as defined in [1]. [1] Karaboga, Dervis. An idea based on honey bee swarm for numerical optimization. Vol. 200. Technical report-tr06,...
[ "numpy.stack", "numpy.random.uniform", "numpy.copy", "numpy.ndim", "numpy.clip", "numpy.random.randint", "numpy.array" ]
[((3158, 3198), 'numpy.array', 'np.array', (['[m[0] for m in enforce_bounds]'], {}), '([m[0] for m in enforce_bounds])\n', (3166, 3198), True, 'import numpy as np\n'), ((3228, 3268), 'numpy.array', 'np.array', (['[m[1] for m in enforce_bounds]'], {}), '([m[1] for m in enforce_bounds])\n', (3236, 3268), True, 'import nu...
import numpy as np from .model import Model from ..util import add_intersect, sigmoid class LogisticRegression(Model): ''' used when dependent variable (y)is categorical ''' #no regularization def __init__(self, epochs=1000, alph=0.3): super(LogisticRegression, self).__init__() self...
[ "numpy.full", "numpy.log", "numpy.zeros", "numpy.hstack", "numpy.dot" ]
[((928, 939), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (936, 939), True, 'import numpy as np\n'), ((1340, 1359), 'numpy.hstack', 'np.hstack', (['([1], X)'], {}), '(([1], X))\n', (1349, 1359), True, 'import numpy as np\n'), ((1371, 1393), 'numpy.dot', 'np.dot', (['self.theta', '_x'], {}), '(self.theta, _x)\n', (...
import os import time import sys import argparse import logging import numpy as np import yaml from attrdict import AttrDict from pprint import pprint import paddle import paddle.distributed.fleet as fleet import paddle.distributed as dist from paddlenlp.transformers import TransformerModel, CrossEntropyCriterion s...
[ "argparse.ArgumentParser", "paddle.enable_static", "paddle.distributed.fleet.DistributedStrategy", "paddle.static.program_guard", "paddle.static.ExecutionStrategy", "yaml.safe_load", "pprint.pprint", "paddle.static.BuildStrategy", "paddlenlp.transformers.CrossEntropyCriterion", "os.path.join", "...
[((319, 341), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (334, 341), False, 'import sys\n'), ((450, 504), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': 'FORMAT'}), '(level=logging.INFO, format=FORMAT)\n', (469, 504), False, 'import logging\n'), ((514...
import tensorflow as tf import tensornets as nets import cv2 import numpy as np import time inputs = tf.placeholder(tf.float32, [None, 416, 416, 3]) model = nets.YOLOv3COCO(inputs, nets.Darknet19) #model = nets.YOLOv2(inputs, nets.Darknet19) #frame=cv2.imread("D://pyworks//yolo//truck.jpg",1) classes={'0':'person',...
[ "cv2.putText", "cv2.waitKey", "tensorflow.Session", "cv2.imshow", "time.time", "cv2.VideoCapture", "tensorflow.placeholder", "cv2.namedWindow", "numpy.array", "cv2.rectangle", "cv2.resizeWindow", "cv2.destroyAllWindows", "tensornets.YOLOv3COCO", "cv2.resize" ]
[((103, 150), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, 416, 416, 3]'], {}), '(tf.float32, [None, 416, 416, 3])\n', (117, 150), True, 'import tensorflow as tf\n'), ((159, 198), 'tensornets.YOLOv3COCO', 'nets.YOLOv3COCO', (['inputs', 'nets.Darknet19'], {}), '(inputs, nets.Darknet19)\n', (174, 1...
from __future__ import print_function import sys, pdb sys.path.insert(0, '.') import vgg, time import tensorflow as tf, numpy as np, os import stylenet from argparse import ArgumentParser from vgg import read_img, list_files vgg_path = 'vgg19.mat' def build_parser(): parser = ArgumentParser(description='Real-...
[ "argparse.ArgumentParser", "vgg.list_files", "vgg.read_img", "vgg.preprocess", "vgg.total_variation_regularization", "os.path.isfile", "os.path.join", "vgg.total_content_loss", "os.path.exists", "tensorflow.placeholder", "stylenet.net", "tensorflow.train.Saver", "tensorflow.global_variables_...
[((54, 77), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (69, 77), False, 'import sys, pdb\n'), ((287, 341), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Real-time style transfer"""'}), "(description='Real-time style transfer')\n", (301, 341), False, 'from argpa...
""" Collection of MXNet general functions, wrapped to fit Ivy syntax and signature. """ # global import ivy _round = round import logging import mxnet as _mx import numpy as _np import math as _math from numbers import Number from operator import mul as _mul from functools import reduce as _reduce import multiprocessi...
[ "mxnet.nd.tile", "multiprocessing.get_context", "mxnet.nd.concat", "mxnet.np.meshgrid", "mxnet.nd.transpose", "mxnet.nd.batch_dot", "mxnet.nd.shape_array", "logging.warning", "mxnet.nd.squeeze", "mxnet.nd.eye", "mxnet.nd.argmin", "mxnet.nd.broadcast_to", "ivy.functional.ivy.default_dtype", ...
[((876, 893), 'numpy.dtype', '_np.dtype', (['"""int8"""'], {}), "('int8')\n", (885, 893), True, 'import numpy as _np\n'), ((919, 937), 'numpy.dtype', '_np.dtype', (['"""int16"""'], {}), "('int16')\n", (928, 937), True, 'import numpy as _np\n'), ((964, 982), 'numpy.dtype', '_np.dtype', (['"""int32"""'], {}), "('int32')\...
import nltk import numpy as np import tensorflow as tf from nltk.tokenize import sent_tokenize from tensorflow.keras import backend as K from transformers import BertTokenizer, TFBertModel NB_OF_SENTS = 30 nltk.download("punkt") tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') bert = TFBertModel.from_pr...
[ "tensorflow.keras.layers.multiply", "tensorflow.keras.layers.Dense", "transformers.TFBertModel.from_pretrained", "tensorflow.keras.layers.dot", "nltk.download", "tensorflow.keras.layers.Concatenate", "tensorflow.keras.layers.Activation", "tensorflow.keras.optimizers.Adam", "tensorflow.keras.layers.I...
[((208, 230), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (221, 230), False, 'import nltk\n'), ((243, 293), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-uncased"""'], {}), "('bert-base-uncased')\n", (272, 293), False, 'from transformers impor...
""" Sea Ice Diagnostics. ==================== Diagnostic to produce a series of images which are useful for evaluating the behaviour of the a sea ice model. There are three kinds of plots shown here. 1. Sea ice Extent maps plots with a stereoscoic projection. 2. Maps plots of individual models ice fracrtion. 3. Time ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.savefig", "matplotlib.colors.LinearSegmentedColormap", "numpy.sum", "esmvaltool.diag_scripts.ocean.diagnostic_tools.cube_time_to_float", "matplotlib.pyplot.figure", "iris.load_cube", "iris.coord_categorisation.add_year", "matplotlib.pyplot.gca", "carto...
[((2619, 2645), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (2635, 2645), False, 'import os\n'), ((2678, 2711), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (2699, 2711), False, 'import logging\n'), ((3500, 3568), 'matplotlib.colors.LinearSegm...
import numpy as np try: def downsample_axis(myarr, factor, axis, estimator=np.nanmean, truncate=False): """ Downsample an ND array by averaging over *factor* pixels along an axis. Crops right side if the shape is not a multiple of factor. This code is pure np and should be fast. ...
[ "warnings.warn", "numpy.concatenate", "numpy.empty" ]
[((2242, 2352), 'warnings.warn', 'warnings.warn', (['"""Numpy doesn\'t have a nanmean attribute; a more recent version of numpy is required."""'], {}), '(\n "Numpy doesn\'t have a nanmean attribute; a more recent version of numpy is required."\n )\n', (2255, 2352), False, 'import warnings\n'), ((1559, 1604), 'num...
import json import numpy as np import pandas as pd from dypro.dynamic import NormalMeanVarChart, NormalMeanSChart, NormalMeanRChart from dypro.config import Parameters, AdjConf, PlotConf from dypro.create_csv import ( create_proposed_cpk, created_proposed_yeild, create_previous_cpk, ) from dypro.dynamic.opt...
[ "json.load", "dypro._decorator.RunTime", "pandas.read_csv", "dypro.dynamic.optimize.BrenthOptimizer", "dypro.dynamic.NormalMeanSChart", "dypro.dynamic.NormalMeanRChart", "dypro.create_csv.create_proposed_cpk", "dypro.dynamic.NormalMeanVarChart", "numpy.arange", "dypro.plot.PlotGraph", "dypro.con...
[((768, 777), 'dypro._decorator.RunTime', 'RunTime', ([], {}), '()\n', (775, 777), False, 'from dypro._decorator import RunTime\n'), ((434, 454), 'dypro.dynamic.NormalMeanVarChart', 'NormalMeanVarChart', ([], {}), '()\n', (452, 454), False, 'from dypro.dynamic import NormalMeanVarChart, NormalMeanSChart, NormalMeanRCha...
# -*- coding: utf-8 -*- # Copyright 2018 The Texar 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...
[ "tensorflow.test.main", "tempfile.NamedTemporaryFile", "texar.tf.data.embedding.Embedding", "numpy.testing.assert_array_equal", "texar.tf.data.embedding.load_word2vec", "numpy.zeros", "texar.tf.data.embedding.load_glove", "numpy.array", "tensorflow.compat.as_bytes" ]
[((2970, 2984), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (2982, 2984), True, 'import tensorflow as tf\n'), ((1261, 1299), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'mode': '"""w+"""'}), "(mode='w+')\n", (1288, 1299), False, 'import tempfile\n'), ((1541, 1557), 'numpy.zeros', '...
import numpy as np import subprocess as sp from threading import Thread n_samples = 44100 proc = sp.Popen(['cat'], stdin=sp.PIPE, stdout=sp.PIPE) out_arr = np.ones(n_samples, dtype=np.int16) def reader(): in_arr = np.fromfile(proc.stdout, np.int16, n_samples) assert np.all(np.equal(in_arr, out_arr)) reader_...
[ "threading.Thread", "subprocess.Popen", "numpy.fromfile", "numpy.ones", "numpy.equal" ]
[((99, 147), 'subprocess.Popen', 'sp.Popen', (["['cat']"], {'stdin': 'sp.PIPE', 'stdout': 'sp.PIPE'}), "(['cat'], stdin=sp.PIPE, stdout=sp.PIPE)\n", (107, 147), True, 'import subprocess as sp\n'), ((158, 192), 'numpy.ones', 'np.ones', (['n_samples'], {'dtype': 'np.int16'}), '(n_samples, dtype=np.int16)\n', (165, 192), ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for the simulation subpackage """ #pylint: disable=import-outside-toplevel, no-self-use import unittest import numpy as np from scipy.spatial.distance import squareform import rsatoolbox import rsatoolbox.model as model class TestSimulation(unittest.TestCase): ...
[ "unittest.main", "rsatoolbox.simulation.sim.make_dataset", "numpy.abs", "rsatoolbox.util.matrix.centering", "scipy.spatial.distance.squareform", "rsatoolbox.simulation.sim.make_signal", "numpy.array", "rsatoolbox.simulation.sim.make_design" ]
[((1377, 1392), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1390, 1392), False, 'import unittest\n'), ((453, 474), 'rsatoolbox.simulation.sim.make_design', 'sim.make_design', (['(4)', '(8)'], {}), '(4, 8)\n', (468, 474), True, 'import rsatoolbox.simulation.sim as sim\n'), ((736, 751), 'scipy.spatial.distance.s...
import cv2 import numpy as np import matplotlib.pyplot as plt def color_to_grayscale(color_array: np.ndarray) -> np.ndarray: return cv2.cvtColor(color_array, cv2.COLOR_BGR2GRAY) def calcPSD(input_image, output_image, flag): # Complex input image with zero imaginary component X = np.fft.rfft2(input_ima...
[ "cv2.magnitude", "matplotlib.pyplot.show", "numpy.log", "cv2.cvtColor", "numpy.power", "matplotlib.pyplot.imshow", "numpy.zeros", "cv2.imread", "cv2.dft", "numpy.fft.rfft2", "cv2.pow" ]
[((139, 184), 'cv2.cvtColor', 'cv2.cvtColor', (['color_array', 'cv2.COLOR_BGR2GRAY'], {}), '(color_array, cv2.COLOR_BGR2GRAY)\n', (151, 184), False, 'import cv2\n'), ((333, 354), 'numpy.power', 'np.power', (['X', '(2)'], {'out': 'X'}), '(X, 2, out=X)\n', (341, 354), True, 'import numpy as np\n'), ((499, 585), 'numpy.ze...
import glob import os from typing import Any, Dict, List, Tuple import subprocess import numpy as np from rasterio.windows import Window import srem from constants import OLI_BAND_ID, REFLECTANCE_SCALING_FACTOR def get_band_id(path: str) -> int: band_name = os.path.splitext(os.path.basename(path))[0].split('_')...
[ "subprocess.run", "os.path.abspath", "os.path.basename", "os.getcwd", "numpy.expand_dims", "srem.srem", "os.path.join", "os.chdir" ]
[((545, 556), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (554, 556), False, 'import os\n'), ((574, 601), 'os.path.abspath', 'os.path.abspath', (['angle_file'], {}), '(angle_file)\n', (589, 601), False, 'import os\n'), ((606, 626), 'os.chdir', 'os.chdir', (['output_dir'], {}), '(output_dir)\n', (614, 626), False, 'impo...
import itertools import random import hashlib import yaml from typing import Any, List, Optional, Union import numpy as np from .config.cfg import SweepConfig from .run import SweepRun from .params import HyperParameter, HyperParameterSet def yaml_hash(value: Any) -> str: return hashlib.md5( yaml.dump(v...
[ "random.shuffle", "yaml.dump", "numpy.arange", "itertools.product" ]
[((3870, 3902), 'itertools.product', 'itertools.product', (['*param_hashes'], {}), '(*param_hashes)\n', (3887, 3902), False, 'import itertools\n'), ((3936, 3968), 'random.shuffle', 'random.shuffle', (['all_param_hashes'], {}), '(all_param_hashes)\n', (3950, 3968), False, 'import random\n'), ((309, 366), 'yaml.dump', 'y...
# 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", "deepspeech.modules.mask.make_pad_mask", "deepspeech.modules.mask.make_non_pad_mask", "numpy.array", "paddle.set_device", "paddle.to_tensor" ]
[((1870, 1885), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1883, 1885), False, 'import unittest\n'), ((834, 858), 'paddle.set_device', 'paddle.set_device', (['"""cpu"""'], {}), "('cpu')\n", (851, 858), False, 'import paddle\n'), ((882, 909), 'paddle.to_tensor', 'paddle.to_tensor', (['[5, 3, 2]'], {}), '([5, 3...
import numpy as np import unittest import warnings from context import lir from lir.calibration import IsotonicCalibrator from lir.util import Xn_to_Xy, Xy_to_Xn import math warnings.simplefilter("error") def _cllr(lr0, lr1): with np.errstate(divide='ignore'): cllr0 = np.mean(np.log2(1 + lr0)) ...
[ "unittest.main", "lir.calibration.IsotonicCalibrator", "warnings.simplefilter", "math.sqrt", "numpy.testing.assert_almost_equal", "numpy.log2", "numpy.power", "numpy.errstate", "lir.util.Xn_to_Xy", "numpy.arange", "numpy.array", "numpy.random.normal", "numpy.concatenate" ]
[((178, 208), 'warnings.simplefilter', 'warnings.simplefilter', (['"""error"""'], {}), "('error')\n", (199, 208), False, 'import warnings\n'), ((2554, 2569), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2567, 2569), False, 'import unittest\n'), ((241, 269), 'numpy.errstate', 'np.errstate', ([], {'divide': '"""i...
import numpy as np import random # Part I def get_order(n_samples): try: with open(str(n_samples) + '.txt') as fp: line = fp.readline() return list(map(int, line.split(','))) except FileNotFoundError: random.seed(1) indices = list(range(n_samples)) rand...
[ "random.shuffle", "numpy.zeros", "random.seed", "numpy.dot", "numpy.sqrt" ]
[((4317, 4335), 'numpy.zeros', 'np.zeros', (['features'], {}), '(features)\n', (4325, 4335), True, 'import numpy as np\n'), ((5954, 5972), 'numpy.zeros', 'np.zeros', (['features'], {}), '(features)\n', (5962, 5972), True, 'import numpy as np\n'), ((5989, 6007), 'numpy.zeros', 'np.zeros', (['features'], {}), '(features)...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[ "numpy.linalg.eigvals", "tensorflow.python.ops.array_ops.constant", "numpy.sum", "numpy.random.seed", "tensorflow.python.framework.random_seed.set_random_seed", "numpy.ones", "tensorflow.python.framework.constant_op.constant", "numpy.arange", "tensorflow.contrib.kfac.python.ops.fisher_factors.NaiveD...
[((1563, 1606), 'tensorflow.contrib.kfac.python.ops.fisher_blocks._package_func', 'fb._package_func', (['(lambda : damping)', 'damping'], {}), '(lambda : damping, damping)\n', (1579, 1606), True, 'from tensorflow.contrib.kfac.python.ops import fisher_blocks as fb\n'), ((33008, 33019), 'tensorflow.python.platform.test.m...
import numpy as np from matplotlib.colors import ListedColormap, LinearSegmentedColormap import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D import pandas import os directory = r'/root/PycharmProjects/earth-rover/' names = ['spectrometer', 'odometery',] for filename in os...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.cm.get_cmap", "pandas.read_csv", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.colors.ListedColormap", "os.listdir" ]
[((318, 339), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (328, 339), False, 'import os\n'), ((481, 506), 'pandas.read_csv', 'pandas.read_csv', (['filename'], {}), '(filename)\n', (496, 506), False, 'import pandas\n'), ((521, 533), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (531, ...