code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#%% Import the libraries for SER; the librosa is the main one for audio analysis import pandas as pd import numpy as np import librosa import librosa.display import matplotlib.pyplot as plt import json from PyEMD import EMD import opensmile import warnings warnings.filterwarnings(action="ignore") #%% Prepare the down...
[ "numpy.abs", "pandas.read_csv", "librosa.filters.get_window", "librosa.power_to_db", "librosa.feature.mfcc", "librosa.feature.melspectrogram", "librosa.get_duration", "PyEMD.EMD", "librosa.util.fix_length", "pandas.concat", "json.dump", "librosa.util.frame", "opensmile.Smile", "librosa.loa...
[((258, 298), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""'}), "(action='ignore')\n", (281, 298), False, 'import warnings\n'), ((517, 592), 'pandas.read_csv', 'pd.read_csv', (['"""/Users/talen/Documents/Datasets/IEMOCAP/iemocap_metadata.csv"""'], {}), "('/Users/talen/Documents/Dat...
import os import numpy as np import SimpleITK as sitk from torch.utils.data.dataset import Dataset ROOT_DIR = "/pylon5/ac5616p/Data/HeartSegmentationProject/CAP_challenge/CAP_challenge_training_set/test2/" #ROOT_DIR = "/Users/yukeyi/Desktop/" trainFileName = "trainfiles.txt" testFileName = "testfiles.txt" os.chdir(ROO...
[ "os.remove", "SimpleITK.ReadImage", "os.walk", "os.path.exists", "SimpleITK.GetArrayFromImage", "SimpleITK.ReadParameterFile", "numpy.array", "SimpleITK.TransformixImageFilter", "os.chdir" ]
[((308, 326), 'os.chdir', 'os.chdir', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (316, 326), False, 'import os\n'), ((2898, 2918), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['path'], {}), '(path)\n', (2912, 2918), True, 'import SimpleITK as sitk\n'), ((3547, 3592), 'os.walk', 'os.walk', (["(ROOT_DIR + 'BrainParameterMapsTuned...
# -*- coding: utf-8 -*- # @author: Elie #%% ========================================================== # Import libraries set library params # ============================================================ import pandas as pd import numpy as np import os pd.options.mode.chained_assignment = None #Pandas warnings off #pl...
[ "pandas.read_csv", "scipy.stats.mannwhitneyu", "pandas.merge", "matplotlib.pyplot.close", "os.path.dirname", "seaborn.swarmplot", "seaborn.despine", "seaborn.boxplot", "numpy.array", "numpy.arange", "matplotlib.pyplot.gca", "matplotlib.pyplot.gcf", "os.path.join", "pandas.concat" ]
[((7272, 7312), 'os.path.join', 'os.path.join', (['rootdir', '"""figures"""', '"""fig1"""'], {}), "(rootdir, 'figures', 'fig1')\n", (7284, 7312), False, 'import os\n'), ((7323, 7352), 'os.path.join', 'os.path.join', (['rootdir', '"""data"""'], {}), "(rootdir, 'data')\n", (7335, 7352), False, 'import os\n'), ((7367, 740...
from blackmagic import app from blackmagic.blueprints import prediction from blackmagic.data import ceph from cytoolz import count from cytoolz import first from cytoolz import get from cytoolz import merge from cytoolz import reduce from datetime import date import json import numpy import os import pytest import ran...
[ "blackmagic.blueprints.prediction.group_data", "random.randint", "random.uniform", "random.random", "numpy.array", "blackmagic.data.ceph.Ceph", "blackmagic.app.app.test_client", "numpy.array_equal", "datetime.date.fromordinal", "blackmagic.blueprints.prediction.default_predictions", "blackmagic....
[((345, 363), 'blackmagic.data.ceph.Ceph', 'ceph.Ceph', (['app.cfg'], {}), '(app.cfg)\n', (354, 363), False, 'from blackmagic.data import ceph\n'), ((20823, 20852), 'blackmagic.blueprints.prediction.group_data', 'prediction.group_data', (['inputs'], {}), '(inputs)\n', (20844, 20852), False, 'from blackmagic.blueprints ...
#!/usr/bin/env python3 ## 16 Oct 2019 | EHU modifying BM's original code import sys,os import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.colors import LightSource, Normalize #from cpt_tools import cpt2python def main(datadic,skafta): data = Data(datadic,skafta) data.read_d...
[ "numpy.abs", "matplotlib.pyplot.get_cmap", "matplotlib.colors.Normalize", "numpy.fromfile", "numpy.float", "numpy.isnan", "numpy.linspace", "matplotlib.colors.LightSource", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((526, 559), 'matplotlib.colors.LightSource', 'LightSource', ([], {'azdeg': '(315)', 'altdeg': '(45)'}), '(azdeg=315, altdeg=45)\n', (537, 559), False, 'from matplotlib.colors import LightSource, Normalize\n'), ((2298, 2322), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""Spectral"""'], {}), "('Spectral')\n", (23...
"""Noise generators to simulate noise in sensor / actuator classes.""" import abc import gin import numpy as np class NoiseGenerator(metaclass=abc.ABCMeta): """Base class for noise generators.""" @abc.abstractmethod def _get_noise(self, shape, dtype=None): """Gets noise as a numpy array in the specified s...
[ "numpy.full", "numpy.random.uniform", "numpy.clip", "numpy.array", "numpy.random.normal" ]
[((1584, 1617), 'numpy.full', 'np.full', (['shape', 'self._bias', 'dtype'], {}), '(shape, self._bias, dtype)\n', (1591, 1617), True, 'import numpy as np\n'), ((1784, 1861), 'numpy.clip', 'np.clip', (['(data + noise)', 'self._clipping_lower_bound', 'self._clipping_upper_bound'], {}), '(data + noise, self._clipping_lower...
#=============================================================================== # Copyright (c) 2016, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code m...
[ "numpy.einsum" ]
[((2977, 3029), 'numpy.einsum', 'np.einsum', (['"""ijp,ijpq,ijq->ij"""', 'dM', 'mean_geometry', 'dM'], {}), "('ijp,ijpq,ijq->ij', dM, mean_geometry, dM)\n", (2986, 3029), True, 'import numpy as np\n')]
""" Author: <NAME> Date: 2021 Description: Class that contains different loss functions and their derivatives. """ import numpy as np class Loss: def __init__(self, loss_function) -> None: self.loss = loss_function # Finds the derivative of the given loss function which is used for calculating grad...
[ "numpy.multiply", "numpy.subtract" ]
[((744, 772), 'numpy.subtract', 'np.subtract', (['batch_labels', 'y'], {}), '(batch_labels, y)\n', (755, 772), True, 'import numpy as np\n'), ((789, 824), 'numpy.multiply', 'np.multiply', (['e_n', 'derivative_matrix'], {}), '(e_n, derivative_matrix)\n', (800, 824), True, 'import numpy as np\n'), ((957, 985), 'numpy.sub...
# neuronal network connection functions import numpy as np # def gid2pos (numc, startgid, gid): nrow = ncol = int(np.sqrt(numc)) y = int((gid - startgid) / nrow) x = (gid - startgid) % ncol return (x,y) def prob2conv (prob, npre): # probability to convergence; prob is connection probability, npre is number ...
[ "numpy.where", "numpy.zeros", "numpy.sqrt" ]
[((1372, 1402), 'numpy.zeros', 'np.zeros', (['(NBpreN_x, NBpreN_y)'], {}), '((NBpreN_x, NBpreN_y))\n', (1380, 1402), True, 'import numpy as np\n'), ((1421, 1453), 'numpy.zeros', 'np.zeros', (['(NBpostN_x, NBpostN_y)'], {}), '((NBpostN_x, NBpostN_y))\n', (1429, 1453), True, 'import numpy as np\n'), ((3657, 3687), 'numpy...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.naive_bayes import BernoulliNB from hmmlearn import hmm def nb_train(train_data): # for index_i, row_i in train_data.iterrows(): # prior[table.get(row_i["letter"])] += 1 # for i in range(128): # con_pro...
[ "numpy.sum", "numpy.average", "numpy.log", "numpy.argmax", "pandas.read_csv", "numpy.zeros", "numpy.array", "hmmlearn.hmm.MultinomialHMM", "sklearn.naive_bayes.BernoulliNB", "pandas.concat" ]
[((1351, 1363), 'numpy.zeros', 'np.zeros', (['(26)'], {}), '(26)\n', (1359, 1363), True, 'import numpy as np\n'), ((1560, 1581), 'numpy.argmax', 'np.argmax', (['result_pro'], {}), '(result_pro)\n', (1569, 1581), True, 'import numpy as np\n'), ((1896, 1914), 'numpy.zeros', 'np.zeros', (['(26, 26)'], {}), '((26, 26))\n',...
#!/usr/bin/env python # coding: utf-8 # In[26]: from scipy.io import loadmat import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns sns.axes_style('whitegrid'); from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from sklearn.s...
[ "matplotlib.pyplot.title", "seaborn.heatmap", "scipy.io.loadmat", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "sklearn.tree.DecisionTreeClassifier", "sklearn.metrics.classification_report", "matplotlib.pyplot.figure", "numpy.random.randint", "...
[((175, 202), 'seaborn.axes_style', 'sns.axes_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (189, 202), True, 'import seaborn as sns\n'), ((533, 560), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 6)'}), '(figsize=(12, 6))\n', (543, 560), True, 'import matplotlib.pyplot as plt\n'), ((569, 598...
"""Datasets for CosmoFlow.""" import pickle import os.path import functools import operator import glob import torch import numpy as np try: import h5py except: h5py = None class CosmoFlowDataset(torch.utils.data.Dataset): """Cosmoflow data.""" SUBDIR_FORMAT = '{:03d}' def __init__(self, data...
[ "h5py.File", "torch.randint", "pickle.dump", "numpy.fromfile", "torch.distributed.get_rank", "torch.distributed.barrier", "pickle.load", "torch.rand", "torch.cuda.current_stream", "torch.cuda.Stream", "torch.cuda.stream", "torch.from_numpy" ]
[((2896, 2915), 'torch.from_numpy', 'torch.from_numpy', (['x'], {}), '(x)\n', (2912, 2915), False, 'import torch\n'), ((2928, 2947), 'torch.from_numpy', 'torch.from_numpy', (['y'], {}), '(y)\n', (2944, 2947), False, 'import torch\n'), ((5318, 5337), 'torch.from_numpy', 'torch.from_numpy', (['x'], {}), '(x)\n', (5334, 5...
# Copyright 2019-2021, the MIDOSS project contributors, The University of British Columbia, # and Dalhousie University. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://ww...
[ "numpy.nansum", "numpy.asarray", "xarray.open_dataset", "numpy.zeros", "numpy.transpose" ]
[((2973, 3009), 'numpy.transpose', 'numpy.transpose', (['new_grid', '[2, 0, 1]'], {}), '(new_grid, [2, 0, 1])\n', (2988, 3009), False, 'import numpy\n'), ((784, 809), 'xarray.open_dataset', 'xarray.open_dataset', (['path'], {}), '(path)\n', (803, 809), False, 'import xarray\n'), ((1786, 1821), 'numpy.transpose', 'numpy...
""" ET Dataset from Informer Paper. Dataset: https://github.com/zhouhaoyi/ETDataset Dataloader: https://github.com/zhouhaoyi/Informer2020 """ from typing import List import os import numpy as np import pandas as pd from pandas.tseries import offsets from pandas.tseries.frequencies import to_offset import torch from to...
[ "torch.stack", "pandas.tseries.frequencies.to_offset", "warnings.filterwarnings", "os.path.join", "numpy.concatenate", "numpy.zeros", "numpy.ones", "pandas.to_datetime", "torch.tensor", "torch.is_tensor", "torch.utils.data.std", "torch.utils.data.mean", "torch.from_numpy" ]
[((408, 441), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (431, 441), False, 'import warnings\n'), ((3410, 3429), 'pandas.tseries.frequencies.to_offset', 'to_offset', (['freq_str'], {}), '(freq_str)\n', (3419, 3429), False, 'from pandas.tseries.frequencies import to_off...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import sklearn def split_data(X, y, train_frac=0.8, seed=1): # Reseed the random state np.random.seed(seed) # Perform a train/test split of the data num_examples = y.shape[0] num_train_examples = int(train_frac * num_example...
[ "sklearn.metrics.confusion_matrix", "numpy.outer", "numpy.random.seed", "numpy.sum", "numpy.log", "numpy.ones", "numpy.where", "numpy.exp", "numpy.random.permutation", "numpy.dot", "numpy.diag", "numpy.linalg.cholesky" ]
[((170, 190), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (184, 190), True, 'import numpy as np\n'), ((378, 413), 'numpy.random.permutation', 'np.random.permutation', (['num_examples'], {}), '(num_examples)\n', (399, 413), True, 'import numpy as np\n'), ((969, 986), 'numpy.sum', 'np.sum', (['(X *...
__author__ = 'jrx' import argparse import PIL.Image as Image import numpy as np from encoder.algorithms.xor_encoding import XorEncoding def instantiate_algorithm(args): """ Instantiate algorithm object from given args """ if args.algorithm == 'xor_encoding': return XorEncoding(block_size=args.block...
[ "argparse.ArgumentParser", "numpy.fromfile", "PIL.Image.open", "numpy.array", "PIL.Image.fromarray", "encoder.algorithms.xor_encoding.XorEncoding" ]
[((610, 633), 'PIL.Image.open', 'Image.open', (['args.infile'], {}), '(args.infile)\n', (620, 633), True, 'import PIL.Image as Image\n'), ((716, 728), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (724, 728), True, 'import numpy as np\n'), ((1361, 1384), 'PIL.Image.open', 'Image.open', (['args.infile'], {}), '(arg...
import sys import numpy as np from itertools import combinations def fwa(n, roads): delta = np.ones(shape=(n, n)) * np.inf pairs = list(combinations(range(n), 2)) for i in range(n): delta[i][i] = 0 for j in roads: delta[j[0]][j[1]] = 1 delta[j[1]][j[0]] = 1 for...
[ "numpy.ones", "numpy.array", "sys.stdin.readline" ]
[((1532, 1552), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1550, 1552), False, 'import sys\n'), ((1712, 1732), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1730, 1732), False, 'import sys\n'), ((104, 125), 'numpy.ones', 'np.ones', ([], {'shape': '(n, n)'}), '(shape=(n, n))\n', (111...
# -*- coding:utf8 -*- import threading import numpy as np # 每个exp由一个单独的线程运行 def exp_run_thread(exp, pos, res_list): print("%s begin" % exp.exp_name) res_list[pos]=exp.run() np.random.seed() print("%s end" % exp.exp_name) def exp_multi_thread_run(exp_list): res_list = [None for i in range(len(...
[ "threading.Thread", "numpy.random.seed" ]
[((190, 206), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (204, 206), True, 'import numpy as np\n'), ((419, 535), 'threading.Thread', 'threading.Thread', ([], {'name': "('task %s' % exp_list[i].exp_name)", 'target': 'exp_run_thread', 'args': '[exp_list[i], i, res_list]'}), "(name='task %s' % exp_list[i].ex...
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Dict import logging import numpy as np from .filter import Filter from ..data_objects import TrajectoryData ############################################################################### log = logging.getLogger(__name__) ###########################...
[ "numpy.amax", "numpy.zeros", "logging.getLogger" ]
[((264, 291), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (281, 291), False, 'import logging\n'), ((1597, 1632), 'numpy.zeros', 'np.zeros', (['(total_steps, max_agents)'], {}), '((total_steps, max_agents))\n', (1605, 1632), True, 'import numpy as np\n'), ((1653, 1706), 'numpy.zeros', '...
import os.path from tqdm import tqdm import numpy as np import pandas as pd from matplotlib import pyplot as plt import seaborn as sns def plot_change_region_2d(regional_change_stream, change_idx: int, binary_thresh: float, save: bool, path=None): region = regional_change_stream.approximate_change_...
[ "matplotlib.pyplot.tight_layout", "seaborn.heatmap", "matplotlib.pyplot.show", "pandas.read_csv", "pandas.merge", "numpy.min", "numpy.max", "pandas.to_datetime", "numpy.dot", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((530, 564), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(4, 2)'}), '(1, 2, figsize=(4, 2))\n', (542, 564), True, 'from matplotlib import pyplot as plt\n'), ((743, 814), 'seaborn.heatmap', 'sns.heatmap', (['region'], {'ax': 'axes[0]', 'cmap': '"""Greys"""', 'cbar_kws': "{'shrink': 0.5}"...
#%% import os import mne import re import sys import glob import pickle import logging mpl_logger = logging.getLogger('matplotlib') mpl_logger.setLevel(logging.WARNING) sys.path.append('/research/FGB-ETP-DVM/DvM') import numpy as np import seaborn as sns from scipy.interpolate import interp1d from IPython import emb...
[ "sys.path.append", "numpy.where", "numpy.linspace", "os.chdir", "logging.getLogger" ]
[((100, 131), 'logging.getLogger', 'logging.getLogger', (['"""matplotlib"""'], {}), "('matplotlib')\n", (117, 131), False, 'import logging\n'), ((169, 213), 'sys.path.append', 'sys.path.append', (['"""/research/FGB-ETP-DVM/DvM"""'], {}), "('/research/FGB-ETP-DVM/DvM')\n", (184, 213), False, 'import sys\n'), ((7034, 705...
# Copyright (2017-2020) # The Wormnet project # <NAME> (<EMAIL>) import numpy as np import tensorflow as tf import kerasncp as kncp from kerasncp.tf import LTCCell data_x = np.random.default_rng().normal(size=(100, 16, 10)) data_y = np.random.default_rng().normal(size=(100, 16, 1)) print("data_y.shape: ", str(data_y....
[ "tensorflow.keras.losses.MeanSquaredError", "tensorflow.keras.layers.Dense", "tensorflow.keras.Input", "tensorflow.keras.layers.RNN", "tensorflow.keras.Model", "tensorflow.stack", "numpy.random.default_rng", "tensorflow.zeros", "tensorflow.keras.optimizers.Adam", "kerasncp.wirings.FullyConnected",...
[((338, 372), 'kerasncp.wirings.FullyConnected', 'kncp.wirings.FullyConnected', (['(16)', '(8)'], {}), '(16, 8)\n', (365, 372), True, 'import kerasncp as kncp\n'), ((413, 428), 'kerasncp.tf.LTCCell', 'LTCCell', (['wiring'], {}), '(wiring)\n', (420, 428), False, 'from kerasncp.tf import LTCCell\n'), ((439, 483), 'tensor...
# coding: utf-8 # In[1]: import sympy as sp import numpy as np import matplotlib.pyplot as plt import sys sys.setrecursionlimit(25000) import mpmath as mp import scipy.fftpack from sympy import lambdify import mpmath as mpf # In[2]: # analytic expression for the symbol P(f) of B-L wavelet filter f=sp.symbols('f...
[ "sympy.symbols", "sympy.limit", "numpy.fft.fft", "sympy.cos", "numpy.zeros", "sympy.sqrt", "numpy.fft.fftshift", "sympy.exp", "sympy.sin", "sys.setrecursionlimit" ]
[((110, 138), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(25000)'], {}), '(25000)\n', (131, 138), False, 'import sys\n'), ((307, 322), 'sympy.symbols', 'sp.symbols', (['"""f"""'], {}), "('f')\n", (317, 322), True, 'import sympy as sp\n'), ((1875, 1890), 'sympy.symbols', 'sp.symbols', (['"""f"""'], {}), "('f')...
"""Deconvolution using CVXPY""" import warnings import numpy as np from scipy.sparse import issparse import cvxpy as cvx from .utils import convolution_output_size, convolution_matrix def least_squares(A, y, gamma_L2=0, gamma_L1=0): """Iterative solution to a least squares problem using CVXPY Returns argmi...
[ "cvxpy.Parameter", "scipy.sparse.issparse", "numpy.asarray", "cvxpy.hstack", "numpy.array", "cvxpy.Problem", "cvxpy.norm", "cvxpy.Variable", "cvxpy.conv", "cvxpy.sum_squares", "numpy.issubdtype", "cvxpy.Minimize" ]
[((846, 859), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (856, 859), True, 'import numpy as np\n'), ((1806, 1824), 'cvxpy.Minimize', 'cvx.Minimize', (['cost'], {}), '(cost)\n', (1818, 1824), True, 'import cvxpy as cvx\n'), ((1836, 1858), 'cvxpy.Problem', 'cvx.Problem', (['objective'], {}), '(objective)\n', (1...
# -*- coding: utf-8 -*- """ Created on Mon Dec 20 01:10:22 2021 @author: mohit """ #%% import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import stats from sklearn.decomposition import PCA import prince #%% df=pd.read_csv('stackoverflow_data.csv') col=d...
[ "scipy.stats.kstest", "pandas.read_csv", "scipy.stats.mannwhitneyu", "pandas.get_dummies", "numpy.corrcoef", "sklearn.preprocessing.OneHotEncoder" ]
[((276, 313), 'pandas.read_csv', 'pd.read_csv', (['"""stackoverflow_data.csv"""'], {}), "('stackoverflow_data.csv')\n", (287, 313), True, 'import pandas as pd\n'), ((1891, 1917), 'scipy.stats.mannwhitneyu', 'stats.mannwhitneyu', (['M1', 'M2'], {}), '(M1, M2)\n', (1909, 1917), False, 'from scipy import stats\n'), ((1922...
import tensorflow as tf import os import sys sys.path.insert(0, './scripts/') import tensorlayer as tl import numpy as np import random from utils import * from models import * import argparse parser = argparse.ArgumentParser(description='3D-GAN implementation for 32*32*32 voxel output') parser.add_argument('-o','...
[ "argparse.ArgumentParser", "tensorflow.global_variables_initializer", "tensorlayer.ops.set_gpu_fraction", "tensorflow.Session", "tensorflow.concat", "sys.path.insert", "tensorflow.placeholder", "tensorflow.ConfigProto", "numpy.array" ]
[((47, 79), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./scripts/"""'], {}), "(0, './scripts/')\n", (62, 79), False, 'import sys\n'), ((207, 298), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""3D-GAN implementation for 32*32*32 voxel output"""'}), "(description=\n '3D-GAN imp...
import re import numpy as np import pandas as pd import random as rd from sklearn import preprocessing from sklearn.cluster import KMeans from sklearn.ensemble import RandomForestRegressor from sklearn.decomposition import PCA # Print options np.set_printoptions(precision=4, threshold=10000, linewidth=160, edgeitems=9...
[ "sklearn.preprocessing.StandardScaler", "pandas.read_csv", "numpy.ones", "numpy.isnan", "pandas.set_option", "pandas.DataFrame", "numpy.set_printoptions", "pandas.qcut", "numpy.union1d", "pandas.concat", "re.sub", "re.split", "pandas.get_dummies", "sklearn.ensemble.RandomForestRegressor", ...
[((244, 343), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)', 'threshold': '(10000)', 'linewidth': '(160)', 'edgeitems': '(999)', 'suppress': '(True)'}), '(precision=4, threshold=10000, linewidth=160, edgeitems=\n 999, suppress=True)\n', (263, 343), True, 'import numpy as np\n'), ((339, 38...
# -*- coding: utf-8 -* import brica import tensorflow as tf import numpy as np import random import time import os #--Agent--------------------------------------------------------------------------- class Agent(object): def __init__(self, number, sess, gamma=0.9, params_update_iter=10): self.number = numbe...
[ "tensorflow.clip_by_value", "tensorflow.get_collection", "tensorflow.constant_initializer", "tensorflow.train.RMSPropOptimizer", "numpy.zeros_like", "tensorflow.subtract", "os.path.exists", "tensorflow.variable_scope", "brica.Timing", "tensorflow.placeholder", "numpy.append", "numpy.reshape", ...
[((613, 629), 'numpy.zeros_like', 'np.zeros_like', (['r'], {}), '(r)\n', (626, 629), True, 'import numpy as np\n'), ((1885, 1939), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.n_states]', '"""s"""'], {}), "(tf.float32, [None, self.n_states], 's')\n", (1899, 1939), True, 'import tensorflow as...
from basic import * from numpy import rnorm import random class Author(Player): def add_article(self, quality=None): self.article = Article(quality) if higher_is_smarter: self.track_article_to_prestige() self.article.author = self self.article.author_perceived_quality =...
[ "numpy.rnorm" ]
[((321, 351), 'numpy.rnorm', 'rnorm', (['self.article.quality', '(1)'], {}), '(self.article.quality, 1)\n', (326, 351), False, 'from numpy import rnorm\n')]
import matplotlib.pyplot as plt import numpy as np import pandas as pd ############################################################################### #Non-Standard Imports ############################################################################### import addpath import dunlin ...
[ "dunlin._utils_model.dun_file_reader.read_file", "pandas.read_csv", "matplotlib.pyplot.close", "dunlin._utils_model.ode_coder.make_ode_data", "matplotlib.pyplot.figure", "numpy.isclose", "numpy.array", "numpy.max", "numpy.linspace", "dunlin._utils_model.ivp.integrate", "numpy.concatenate" ]
[((555, 571), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (564, 571), True, 'import matplotlib.pyplot as plt\n'), ((1759, 1778), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (1767, 1778), True, 'import numpy as np\n'), ((1791, 1813), 'numpy.array', 'np.array', (['[0.01,...
import numpy as np def newton(f, x0, jac, hess, options): A = hess(x0) + np.eye(x0.shape[0]) * 1.0e-6 j = jac(x0) return x0 - np.dot(np.linalg.inv(A), j) def grad(f, x0, jac, hess, options): alpha = options['alpha'] j = jac(x0) return x0 - alpha * j def exp_fit(f, x0, jac, hess, options): s = options['...
[ "numpy.eye", "numpy.linalg.inv" ]
[((76, 95), 'numpy.eye', 'np.eye', (['x0.shape[0]'], {}), '(x0.shape[0])\n', (82, 95), True, 'import numpy as np\n'), ((140, 156), 'numpy.linalg.inv', 'np.linalg.inv', (['A'], {}), '(A)\n', (153, 156), True, 'import numpy as np\n')]
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np import texar as tx import random from texar.agents.episodic_agent_base import EpisodicAgentBase from texar.utils import utils from texar.core import optimization as o...
[ "tensorflow.reduce_sum", "texar.utils.utils.get_instance_kwargs", "texar.core.optimization.default_optimization_hparams", "numpy.argmax", "numpy.zeros", "texar.agents.episodic_agent_base.EpisodicAgentBase.__init__", "tensorflow.variable_scope", "texar.utils.utils.check_or_get_instance", "tensorflow....
[((803, 856), 'texar.agents.episodic_agent_base.EpisodicAgentBase.__init__', 'EpisodicAgentBase.__init__', (['self', 'env_config', 'hparams'], {}), '(self, env_config, hparams)\n', (829, 856), False, 'from texar.agents.episodic_agent_base import EpisodicAgentBase\n'), ((6877, 6925), 'numpy.array', 'np.array', (["[data[...
#!/usr/bin/env python # coding: utf-8 # # Project Statement # The Film Junky Union, a new edgy community for classic movie enthusiasts, is developing a system for filtering and categorizing movie reviews. The goal is to train a model to automatically detect negative reviews. You'll be using a dataset of IMBD movie re...
[ "lightgbm.LGBMClassifier", "seaborn.kdeplot", "numpy.abs", "numpy.argmax", "sklearn.feature_extraction.text.TfidfVectorizer", "pandas.read_csv", "sklearn.metrics.accuracy_score", "matplotlib.pyplot.style.use", "sklearn.metrics.f1_score", "numpy.arange", "torch.device", "nltk.download", "torc...
[((1034, 1058), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (1047, 1058), True, 'import matplotlib.pyplot as plt\n'), ((1322, 1335), 'tqdm.auto.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (1333, 1335), False, 'from tqdm.auto import tqdm\n'), ((2838, 2873), 'matplotlib.py...
import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import accuracy_score, confusion_matrix from sklearn.linear_model import LogisticRegression from sklearn.metrics import roc_curve, auc from sklearn.multicl...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.axes", "sklearn.metrics.accuracy_score", "sklearn.tree.DecisionTreeClassifier", "collections.defaultdict", "matplotlib.pyplot.figure", "numpy.arange", "sklearn.svm.SVC", "itertools.cycle", "matplotlib.pyplot.tight_layout", "numpy.unique", "numpy.ze...
[((827, 889), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick"""'], {'color': '"""k"""', 'labelsize': '"""medium"""', 'direction': '"""in"""'}), "('xtick', color='k', labelsize='medium', direction='in')\n", (833, 889), True, 'import matplotlib.pyplot as plt\n'), ((890, 927), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick....
import numpy as np from sympy import * from scipy.optimize import approx_fprime x = symbols('x') y = symbols('y') # first function f = 2 * x ** 2 * y ** 3 + 1 / x + y ** 2 * x + 7 f1x = diff(f, x) print(format(f1x)) f1y = diff(f, y) print(format(f1y)) # second function f = x ** 2 * y - sin(x * y) + cos(x ** 2) + 6 ...
[ "numpy.finfo", "scipy.optimize.approx_fprime" ]
[((560, 599), 'scipy.optimize.approx_fprime', 'approx_fprime', (['[1, 2]', 'func', '[eps, eps]'], {}), '([1, 2], func, [eps, eps])\n', (573, 599), False, 'from scipy.optimize import approx_fprime\n'), ((532, 547), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (540, 547), True, 'import numpy as np\n')]
import mmcv import numpy as np import torch from mmdet3d.core import Box3DMode, CameraInstance3DBoxes, LiDARInstance3DBoxes from mmdet3d.datasets import ObjectNoise, ObjectSample def test_remove_points_in_boxes(): points = np.array([[68.1370, 3.3580, 2.5160, 0.0000], [67.6970, 3.5500, 2.50...
[ "mmcv.ConfigDict", "numpy.random.seed", "mmcv.load", "mmdet3d.datasets.ObjectSample.remove_points_in_boxes", "mmdet3d.core.LiDARInstance3DBoxes", "torch.allclose", "numpy.fromfile", "numpy.concatenate", "pickle.load", "numpy.array", "numpy.linalg.inv", "torch.tensor", "mmdet3d.datasets.Objec...
[((230, 541), 'numpy.array', 'np.array', (['[[68.137, 3.358, 2.516, 0.0], [67.697, 3.55, 2.501, 0.0], [67.649, 3.76, \n 2.5, 0.0], [66.414, 3.901, 2.459, 0.0], [66.012, 4.085, 2.446, 0.0], [\n 65.834, 4.178, 2.44, 0.0], [65.841, 4.386, 2.44, 0.0], [65.745, 4.587, \n 2.438, 0.0], [65.551, 4.78, 2.432, 0.0], [65...
# -*- coding: utf-8 -*- """ Created on Tue May 14 13:21:11 2019 @author: Garnet """ import mido import numpy as np INPUT_SIZE = 10 ACCEPTED_MESSAGES = ['end_of_track', 'program_change', 'control_change', 'note_on'] def merge_tracks(track1, track2): merge_time = t1_time = t2_time = 0 #time in seco...
[ "mido.MidiFile", "mido.Message", "numpy.zeros", "mido.MetaMessage", "numpy.reshape", "mido.MidiTrack", "numpy.delete", "numpy.concatenate" ]
[((413, 429), 'mido.MidiTrack', 'mido.MidiTrack', ([], {}), '()\n', (427, 429), False, 'import mido\n'), ((442, 514), 'mido.MetaMessage', 'mido.MetaMessage', (['"""track_name"""'], {'name': "(track1.name + ' and ' + track2.name)"}), "('track_name', name=track1.name + ' and ' + track2.name)\n", (458, 514), False, 'impor...
import os from shutil import copyfile os.getcwd() copyfile('..\\x64\\Release\\qip.dll','qip.pyd') from datetime import datetime import numpy, pandas,uuid import qip # tmp = numpy.repeat(numpy.datetime64(datetime.now(),'D'),int(1e7)) nnows = dict(zip(["s","m","ms","ns"],[numpy.datetime64(datetime.now(),dtype0) for ...
[ "os.getcwd", "qip.open_connection", "qip.execute", "numpy.array", "shutil.copyfile", "datetime.datetime.now" ]
[((40, 51), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (49, 51), False, 'import os\n'), ((52, 100), 'shutil.copyfile', 'copyfile', (['"""..\\\\x64\\\\Release\\\\qip.dll"""', '"""qip.pyd"""'], {}), "('..\\\\x64\\\\Release\\\\qip.dll', 'qip.pyd')\n", (60, 100), False, 'from shutil import copyfile\n'), ((361, 386), 'qip....
import json import numpy as np import random from tqdm import tqdm saliency_ratio = 2 resolution = 100 noisy_label = "distractor_activity" noise_video_scan_stride = 10 * resolution # unit: sec noise_video_length_random = [10 * resolution, 180 * resolution] # unit: sec activity_minimal_sec = 3 * resolution data = js...
[ "json.dump", "numpy.sum", "numpy.zeros", "random.randint" ]
[((729, 752), 'numpy.zeros', 'np.zeros', (['(duration, 1)'], {}), '((duration, 1))\n', (737, 752), True, 'import numpy as np\n'), ((6233, 6265), 'json.dump', 'json.dump', (['video_segment_list', 'f'], {}), '(video_segment_list, f)\n', (6242, 6265), False, 'import json\n'), ((4624, 4698), 'random.randint', 'random.randi...
#-*- coding=utf-8 -*- import cv2 import sys import os import random sys.path.insert(0, '/home/remo/Desktop/remodet_repository_DJ/python') # print sys.path import caffe import numpy as np sys.path.append("../") import img_func as func sys.path.append("/home/remo/from_wdh") caffe.set_mode_gpu() caffe.set_device(0) clas...
[ "sys.path.append", "img_func.putImgsToOne", "caffe.set_mode_gpu", "cv2.putText", "cv2.copyMakeBorder", "sys.path.insert", "numpy.clip", "cv2.rectangle", "caffe.set_device", "img_func.get_pad169size", "caffe.Net", "os.path.join", "cv2.resize", "img_func.get_pad916size" ]
[((68, 137), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/remo/Desktop/remodet_repository_DJ/python"""'], {}), "(0, '/home/remo/Desktop/remodet_repository_DJ/python')\n", (83, 137), False, 'import sys\n'), ((187, 209), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (202, 209), False...
# python 3.7 # file: data.py """Functions/classes to load and clean data.""" # Standard Library Imports import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.optimize import least_squares, minimize # Third-part Imports import lmfit as lm # Local Imports / PATH changes # Authorship __autho...
[ "lmfit.Parameters", "scipy.optimize.least_squares", "lmfit.minimize", "numpy.array", "numpy.exp", "numpy.sin", "numpy.sqrt", "numpy.diagonal" ]
[((652, 697), 'numpy.array', 'np.array', (['[10 * (x[1] - x[0] ** 2), 1 - x[0]]'], {}), '([10 * (x[1] - x[0] ** 2), 1 - x[0]])\n', (660, 697), True, 'import numpy as np\n'), ((1863, 1878), 'lmfit.Parameters', 'lm.Parameters', ([], {}), '()\n', (1876, 1878), True, 'import lmfit as lm\n'), ((2085, 2148), 'lmfit.minimize'...
# -*- coding: utf-8 -*- """ Use torchMoji to score texts for emoji distribution. The resulting emoji ids (0-63) correspond to the mapping in emoji_overview.png file at the root of the torchMoji repo. Writes the result to a csv file. """ from __future__ import print_function, division, unicode_literals # import examp...
[ "torchmoji.model_def.torchmoji_emojis", "json.load", "numpy.argsort", "numpy.argpartition", "torchmoji.sentence_tokenizer.SentenceTokenizer", "numpy.mean" ]
[((1238, 1275), 'torchmoji.sentence_tokenizer.SentenceTokenizer', 'SentenceTokenizer', (['vocabulary', 'maxlen'], {}), '(vocabulary, maxlen)\n', (1255, 1275), False, 'from torchmoji.sentence_tokenizer import SentenceTokenizer\n'), ((1285, 1318), 'torchmoji.model_def.torchmoji_emojis', 'torchmoji_emojis', (['PRETRAINED_...
from __future__ import division, print_function import pytest import numpy as np from modelling import gaussian_ensemble from modelling import flared_disk_ensemble @pytest.fixture def gaussian_annulus(N=10): """Returns annulus with Gaussian lines.""" return gaussian_ensemble(vrot=1500., N=N, return_ensemble=...
[ "numpy.diff", "modelling.flared_disk_ensemble", "numpy.all", "modelling.gaussian_ensemble" ]
[((269, 326), 'modelling.gaussian_ensemble', 'gaussian_ensemble', ([], {'vrot': '(1500.0)', 'N': 'N', 'return_ensemble': '(True)'}), '(vrot=1500.0, N=N, return_ensemble=True)\n', (286, 326), False, 'from modelling import gaussian_ensemble\n'), ((435, 482), 'modelling.flared_disk_ensemble', 'flared_disk_ensemble', ([], ...
"""module containing the table interpolation function""" import numpy as np class NotInRangeError(ValueError): def __init__(self, var, num, range_): """Error for when value is not in the specified range :param str var: var assigned to :param float num: num to assign :param tuple r...
[ "numpy.interp", "numpy.array", "numpy.searchsorted" ]
[((1442, 1492), 'numpy.searchsorted', 'np.searchsorted', (['first_column', 'x_row'], {'side': '"""right"""'}), "(first_column, x_row, side='right')\n", (1457, 1492), True, 'import numpy as np\n'), ((1506, 1553), 'numpy.searchsorted', 'np.searchsorted', (['first_row', 'x_col'], {'side': '"""right"""'}), "(first_row, x_c...
import numpy as np from QR import QR orden = int(input("Introduce el orden de la matriz: ")) A = np.zeros((orden,orden), np.float64) for i in range(orden): for j in range(orden): A[i,j] = float(input(f"Elemento[{i+1}:{j+1}]: ")) finalA = QR(A) print("\nEigenvalores: ") for i in range(orden): for ...
[ "numpy.zeros", "QR.QR" ]
[((99, 135), 'numpy.zeros', 'np.zeros', (['(orden, orden)', 'np.float64'], {}), '((orden, orden), np.float64)\n', (107, 135), True, 'import numpy as np\n'), ((255, 260), 'QR.QR', 'QR', (['A'], {}), '(A)\n', (257, 260), False, 'from QR import QR\n')]
# -*- coding: utf-8 -*- # @Author: jadesauve # @Date: 2020-04-15 14:50:08 # @Last Modified by: jadesauve # @Last Modified time: 2020-04-15 14:51:12 """ code to compute the squared coherence between two variables avg over 21 frequency bands adapted from steve riser """ # file to read HOT T and S data from WHOTS mo...
[ "matplotlib.pyplot.title", "numpy.conj", "netCDF4.Dataset", "numpy.fft.rfft", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.zeros", "matplotlib.pyplot.text", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel...
[((3174, 3186), 'numpy.zeros', 'np.zeros', (['nn'], {}), '(nn)\n', (3182, 3186), True, 'import numpy as np\n'), ((3202, 3214), 'numpy.zeros', 'np.zeros', (['nn'], {}), '(nn)\n', (3210, 3214), True, 'import numpy as np\n'), ((3225, 3237), 'numpy.zeros', 'np.zeros', (['nn'], {}), '(nn)\n', (3233, 3237), True, 'import num...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module deals with hexagonal twin structure. """ from pprint import pprint import numpy as np from phonopy.structure.atoms import atom_data, symbol_map from twinpy.properties.hexagonal import (get_hcp_atom_positions, check_...
[ "twinpy.structure.lattice.CrystalLattice", "numpy.allclose", "numpy.transpose", "twinpy.properties.hexagonal.check_cell_is_hcp", "numpy.ones", "numpy.array", "numpy.testing.assert_allclose", "twinpy.properties.hexagonal.get_hcp_atom_positions", "twinpy.properties.twinmode.TwinIndices" ]
[((1330, 1383), 'numpy.allclose', 'np.allclose', (['first_cell[0]', 'second_cell[0]'], {'atol': 'atol'}), '(first_cell[0], second_cell[0], atol=atol)\n', (1341, 1383), True, 'import numpy as np\n'), ((1415, 1468), 'numpy.allclose', 'np.allclose', (['first_cell[1]', 'second_cell[1]'], {'atol': 'atol'}), '(first_cell[1],...
from math import * import matplotlib as mpl import matplotlib.animation as animation import matplotlib.cm as cm import matplotlib.pyplot as plt import numpy as np from .utils import get_activities_over_time_as_list from matplotlib.patches import RegularPolygon from matplotlib.collections import PatchCollection def _...
[ "matplotlib.pyplot.title", "numpy.radians", "matplotlib.pyplot.show", "matplotlib.pyplot.get_cmap", "matplotlib.colors.Normalize", "matplotlib.cm.ScalarMappable", "numpy.array", "matplotlib.pyplot.gca", "matplotlib.pyplot.subplots" ]
[((787, 809), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['colormap'], {}), '(colormap)\n', (799, 809), True, 'import matplotlib.pyplot as plt\n'), ((821, 863), 'matplotlib.colors.Normalize', 'mpl.colors.Normalize', ([], {'vmin': 'vmin', 'vmax': 'vmax'}), '(vmin=vmin, vmax=vmax)\n', (841, 863), True, 'import matplo...
import numpy as np import copy import itertools def horiz_next(loc): if loc[1] + 1 < WIDTH: return loc[0], loc[1] + 1 else: return None def horiz_prev(loc): if loc[1] - 1 >= 0: return loc[0], loc[1] - 1 else: return None def vert_next(loc): if loc[0] + 1 < HEIGH...
[ "copy.deepcopy", "numpy.array", "itertools.chain" ]
[((1522, 1557), 'numpy.array', 'np.array', (['([[True] * WIDTH] * HEIGHT)'], {}), '([[True] * WIDTH] * HEIGHT)\n', (1530, 1557), True, 'import numpy as np\n'), ((2761, 2780), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (2774, 2780), False, 'import copy\n'), ((4095, 4122), 'itertools.chain', 'itertools...
"""Cluster profiles plots.""" import numpy as np import matplotlib.pyplot as plt import xarray as xr import src.plot_utils.latex_style as lsty import src.plot_utils.colors as col import src.data_loading.xr_loader as xvl import src.plot_utils.gen_panels as gp import src.time_wrapper as twr import src.constants as cst ...
[ "matplotlib.pyplot.subplot", "numpy.asarray", "numpy.nanstd", "numpy.where", "numpy.array", "numpy.nanmean", "matplotlib.pyplot.gca", "src.plot_utils.gen_panels.label_subplots", "src.plot_utils.latex_style.mpl_params", "matplotlib.pyplot.tight_layout", "src.plot_utils.colors.cluster_colors", "...
[((551, 568), 'src.plot_utils.latex_style.mpl_params', 'lsty.mpl_params', ([], {}), '()\n', (566, 568), True, 'import src.plot_utils.latex_style as lsty\n'), ((784, 857), 'src.data_loading.xr_loader.order_indexes', 'xvl.order_indexes', (['ds.PCM_LABELS', '[cst.T_COORD, cst.Y_COORD, cst.X_COORD]'], {}), '(ds.PCM_LABELS,...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import glob import random from typing import Counter import numpy as np from PIL import Image from tqdm import tqdm import skimage.transform as transform import matplotlib.colors import matplotlib.pyplot as plt cmp = matplotlib.colors.ListedColormap( ["tan",...
[ "numpy.maximum", "random.randint", "os.getcwd", "numpy.asarray", "PIL.Image.open", "PIL.Image.fromarray", "numpy.random.randint", "typing.Counter", "numpy.random.random", "skimage.transform.warp", "glob.glob", "skimage.transform.AffineTransform", "numpy.all" ]
[((4773, 4782), 'typing.Counter', 'Counter', ([], {}), '()\n', (4780, 4782), False, 'from typing import Counter\n'), ((729, 819), 'skimage.transform.AffineTransform', 'transform.AffineTransform', ([], {'scale': '(zoom, zoom)', 'rotation': 'angle', 'translation': '(t_x, t_y)'}), '(scale=(zoom, zoom), rotation=angle, tra...
import cv2 import numpy as np from skimage.util import random_noise # Load the image img = cv2.imread("input/Lenna.png") # Add salt-and-pepper noise to the image. noise_img = random_noise(img, mode='s&p',amount=0.3) # The above function returns a floating-point image # on the range [0, 1], thus we changed it to '...
[ "cv2.waitKey", "cv2.imwrite", "skimage.util.random_noise", "cv2.imread", "numpy.array", "cv2.imshow" ]
[((93, 122), 'cv2.imread', 'cv2.imread', (['"""input/Lenna.png"""'], {}), "('input/Lenna.png')\n", (103, 122), False, 'import cv2\n'), ((179, 220), 'skimage.util.random_noise', 'random_noise', (['img'], {'mode': '"""s&p"""', 'amount': '(0.3)'}), "(img, mode='s&p', amount=0.3)\n", (191, 220), False, 'from skimage.util i...
import numpy as np import tensorflow as tf import scipy.optimize def linesearch1(f, x, fullstep, expected_improve_rate, kl_bound, max_backtracks=10, accept_ratio=.1): """ Backtracking linesearch, where expected_improve_rate is the slope dy/dx at the initial point """ fval = f(x)[0] for stepfrac in...
[ "numpy.zeros_like", "tensorflow.reshape", "numpy.arange", "tensorflow.gradients", "numpy.prod" ]
[((893, 909), 'numpy.zeros_like', 'np.zeros_like', (['b'], {}), '(b)\n', (906, 909), True, 'import numpy as np\n'), ((1468, 1486), 'tensorflow.gradients', 'tf.gradients', (['y', 'x'], {}), '(y, x)\n', (1480, 1486), True, 'import tensorflow as tf\n'), ((2451, 2480), 'tensorflow.gradients', 'tf.gradients', (['f', 'x'], {...
import numpy as np import os import tensorflow as tf import tensorflow_addons as tfa from tensorflow.keras import layers from kerascv.data.voc_segmentation import voc_segmentation_dataset_from_directory num_classes = 21 input_shape = (480, 480, 3) class MyIOUMetrics(tf.keras.metrics.MeanIoU): def __init__(self,...
[ "tensorflow.keras.models.load_model", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.Dropout", "tensorflow.argmax", "tensorflow.keras.callbacks.ReduceLROnPlateau", "tensorflow.keras.Input", "numpy.zeros", "tensorflow.distribute.MirroredStrategy", "tensorflow_addons.optimizers.AdamW", "...
[((1174, 1260), 'numpy.zeros', 'np.zeros', (['(kernel_size, kernel_size, out_channels, in_channels)'], {'dtype': 'np.float64'}), '((kernel_size, kernel_size, out_channels, in_channels), dtype=np.\n float64)\n', (1182, 1260), True, 'import numpy as np\n'), ((1467, 1516), 'tensorflow.keras.Input', 'tf.keras.Input', ([...
import logging import numpy as np from pylops import LinearOperator try: from numba import jit from ._Spread_numba import _matvec_numba_table, _rmatvec_numba_table, \ _matvec_numba_onthefly, _rmatvec_numba_onthefly except ModuleNotFoundError: jit = None jit_message = 'Numba not available, rever...
[ "numpy.sum", "logging.basicConfig", "logging.warning", "numpy.dtype", "numpy.zeros", "numpy.isnan", "numpy.any", "numpy.prod" ]
[((445, 524), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s: %(message)s"""', 'level': 'logging.WARNING'}), "(format='%(levelname)s: %(message)s', level=logging.WARNING)\n", (464, 524), False, 'import logging\n'), ((6088, 6103), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', ...
import numpy as np from flask import Flask, request, jsonify import werkzeug from keras.models import load_model from keras.preprocessing.image import load_img, img_to_array app = Flask(__name__) print('loading saved artifacts') classes = labels = ['Type 1', 'Type 2', 'Type 3'] model = load_model('cancer_screen_model...
[ "keras.models.load_model", "numpy.argmax", "flask.Flask", "werkzeug.utils.secure_filename", "keras.preprocessing.image.img_to_array", "keras.preprocessing.image.load_img" ]
[((181, 196), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (186, 196), False, 'from flask import Flask, request, jsonify\n'), ((289, 325), 'keras.models.load_model', 'load_model', (['"""cancer_screen_model.h5"""'], {}), "('cancer_screen_model.h5')\n", (299, 325), False, 'from keras.models import load_mod...
import numpy as np from sklearn.linear_model import LinearRegression a = np.array([1, 2, 3, 4, 5, 6]) b = np.array([10, 20, 30, 40, 50, 60]) test = np.array([8, 9, 10]) model = LinearRegression() model.fit(a.reshape(-1, 1), b) model.predict(test.reshape(-1, 1))
[ "sklearn.linear_model.LinearRegression", "numpy.array" ]
[((74, 102), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6]'], {}), '([1, 2, 3, 4, 5, 6])\n', (82, 102), True, 'import numpy as np\n'), ((107, 141), 'numpy.array', 'np.array', (['[10, 20, 30, 40, 50, 60]'], {}), '([10, 20, 30, 40, 50, 60])\n', (115, 141), True, 'import numpy as np\n'), ((149, 169), 'numpy.array', 'np...
import numpy as np import pytest from gl0learn import fit, synthetic from hypothesis import given, settings, assume from hypothesis.strategies import integers, floats, random_module, just, booleans from conftest import MAX_OVERLAPS from utils import ( random_penalty_values, random_penalty, overlap_covarian...
[ "utils.sample_from_cov", "gl0learn.fit", "numpy.ones", "hypothesis.strategies.floats", "numpy.linalg.eigvalsh", "hypothesis.strategies.just", "hypothesis.settings", "pytest.raises", "hypothesis.strategies.booleans", "numpy.exp", "gl0learn.synthetic.preprocess", "pytest.mark.parametrize", "hy...
[((760, 813), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""algorithm"""', "['CD', 'CDPSI']"], {}), "('algorithm', ['CD', 'CDPSI'])\n", (783, 813), False, 'import pytest\n'), ((1332, 1374), 'hypothesis.settings', 'settings', ([], {'max_examples': '(1000)', 'deadline': 'None'}), '(max_examples=1000, deadli...
#!/usr/bin/env python3 from network_128x4_64_64 import Network1 import numpy as np def drop_piece(board, col, piece): next_board = board.copy() for row in range(5, -1, -1): if next_board[row][col] == 0: break next_board[row][col] = piece return next_board def _build_board_state(piece, board): return list(m...
[ "numpy.array", "network_128x4_64_64.Network1" ]
[((2398, 2408), 'network_128x4_64_64.Network1', 'Network1', ([], {}), '()\n', (2406, 2408), False, 'from network_128x4_64_64 import Network1\n'), ((503, 669), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0,\n 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, ...
import numpy as np from gym import Env, spaces from gym.utils import seeding import sys from six import StringIO, b import copy from gym import utils from gym.envs.toy_text import discrete from scipy.misc import imresize RENDER_DIR = 'renderings/' LEFT = 0 DOWN = 1 RIGHT = 2 UP = 3 ACTIONS = [(-1, 0), (0, 1), (1, 0...
[ "numpy.argmax", "numpy.random.multinomial", "gym.spaces.Discrete", "numpy.ones", "numpy.clip", "numpy.random.randint", "glob.glob", "numpy.cumsum", "numpy.max", "numpy.repeat", "copy.deepcopy", "numpy.asarray", "os.path.realpath", "numpy.random.permutation", "numpy.zeros", "cv2.imread"...
[((1353, 1398), 'numpy.array', 'np.array', (['[0 / 255.0, 0 / 255.0, 255 / 255.0]'], {}), '([0 / 255.0, 0 / 255.0, 255 / 255.0])\n', (1361, 1398), True, 'import numpy as np\n'), ((1414, 1463), 'numpy.array', 'np.array', (['[211 / 255.0, 211 / 255.0, 211 / 255.0]'], {}), '([211 / 255.0, 211 / 255.0, 211 / 255.0])\n', (1...
# Copyright 2021, <NAME>. # # Developed as a thesis project at the TORSEC research group of the Polytechnic of Turin (Italy) under the supervision # of professor <NAME> and engineer <NAME> and with the support of engineer <NAME>. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this f...
[ "psutil.virtual_memory", "nets.Contrastive_Model_net.Net.detach_and_copy_array", "torch.argmax", "utils.ranking_metrics.min_reciprocal_rank", "torch.cat", "mlflow.log_artifact", "sys.stdout.flush", "torch.no_grad", "os.path.join", "utils.ranking_metrics.mean_average_precision", "mlflow.start_run...
[((2287, 2313), 'os.path.dirname', 'os.path.dirname', (['model_dir'], {}), '(model_dir)\n', (2302, 2313), False, 'import os\n'), ((2332, 2367), 'os.path.join', 'os.path.join', (['src_dir', '"""config.ini"""'], {}), "(src_dir, 'config.ini')\n", (2344, 2367), False, 'import os\n'), ((2427, 2454), 'configparser.ConfigPars...
# -*- coding: utf-8 -*- """Part 2 - Contact Networks.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1ogskk35uEbaZjwe0IgzGGn-qGJrt2AqG # COVID-19 Contact Networks ## Import Packages First we import all required Python packages that we need dur...
[ "matplotlib.pyplot.show", "networkx.draw_networkx_edges", "numpy.sum", "pandas.read_csv", "geopy.distance.geodesic", "numpy.zeros", "sklearn.preprocessing.LabelEncoder", "matplotlib.pyplot.colorbar", "datetime.datetime.strptime", "networkx.spring_layout", "networkx.Graph", "networkx.draw_netwo...
[((2236, 2279), 'pandas.read_csv', 'pd.read_csv', (['"""PeopleLocations.csv"""'], {'sep': '""";"""'}), "('PeopleLocations.csv', sep=';')\n", (2247, 2279), True, 'import pandas as pd\n'), ((2819, 2829), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (2827, 2829), True, 'import networkx as nx\n'), ((3003, 3031), 'sklear...
import os, subprocess import numpy as np import simtk.unit as unit from statistics import mean from scipy.stats import linregress from scipy import spatial import matplotlib.pyplot as plt from cg_openmm.utilities.random_builder import * from cg_openmm.utilities.iotools import write_pdbfile_without_topology kB = unit.M...
[ "numpy.abs", "numpy.shape", "matplotlib.pyplot.figure", "numpy.mean", "numpy.linalg.eig", "cg_openmm.utilities.iotools.write_pdbfile_without_topology", "matplotlib.pyplot.show", "numpy.cross", "statistics.mean", "matplotlib.pyplot.ylabel", "numpy.dot", "numpy.arctan", "subprocess.run", "nu...
[((1646, 1703), 'cg_openmm.utilities.iotools.write_pdbfile_without_topology', 'write_pdbfile_without_topology', (['cgmodel', '"""temp_pitch.pdb"""'], {}), "(cgmodel, 'temp_pitch.pdb')\n", (1676, 1703), False, 'from cg_openmm.utilities.iotools import write_pdbfile_without_topology\n'), ((2455, 2503), 'subprocess.run', '...
import numpy as np # compute sigmoid nonlinearity def sigmoid(x): output = 1/(1+np.exp(-x)) return output # convert output of sigmoid function to its derivative def sigmoid_output_to_derivative(output): return output*(1-output) # input dataset X = np.array([ [0,1], [0,1]...
[ "numpy.random.seed", "numpy.random.random", "numpy.array", "numpy.exp", "numpy.dot" ]
[((279, 321), 'numpy.array', 'np.array', (['[[0, 1], [0, 1], [1, 0], [1, 0]]'], {}), '([[0, 1], [0, 1], [1, 0], [1, 0]])\n', (287, 321), True, 'import numpy as np\n'), ((523, 540), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (537, 540), True, 'import numpy as np\n'), ((413, 437), 'numpy.array', 'np.a...
from setuptools import setup, find_packages, Extension from setuptools import dist dist.Distribution().fetch_build_eggs(['numpy==1.19.3', 'Cython==0.29.21']) import numpy #from Cython.Build import cythonize setup(name='sibreg', version='1.2.0a1', description='Functions for performing robust GWAS using sibpa...
[ "setuptools.dist.Distribution", "numpy.get_include" ]
[((83, 102), 'setuptools.dist.Distribution', 'dist.Distribution', ([], {}), '()\n', (100, 102), False, 'from setuptools import dist\n'), ((2168, 2187), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (2185, 2187), False, 'import numpy\n')]
#!/usr/bin/python # -*- coding: utf-8 -*- # These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import collections import math import numpy as np import os import random import tensorflow as tf import zipfile from itertools im...
[ "numpy.ndarray", "os.chdir", "collections.deque", "tensorflow.nn.nce_loss", "random.randint", "six.moves.range", "tensorflow.placeholder", "collections.Counter", "tensorflow.nn.embedding_lookup", "tensorflow.global_variables_initializer", "tensorflow.train.AdagradOptimizer", "tensorflow.Sessio...
[((10639, 10653), 'os.chdir', 'os.chdir', (['""".."""'], {}), "('..')\n", (10647, 10653), False, 'import os\n'), ((10658, 10678), 'os.chdir', 'os.chdir', (['"""Datasets"""'], {}), "('Datasets')\n", (10666, 10678), False, 'import os\n'), ((2303, 2313), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2311, 2313), True...
"""Convert Senate tweets from 2020 Democratic candidates to bag of words. This requires that a file containing the tweets called `tweets.csv` be stored in `data/candidate-tweets-2020/raw/`. """ import os import numpy as np import pandas as pd from scipy import sparse import setup_utils as utils from sklearn.feature...
[ "sklearn.feature_extraction.text.CountVectorizer", "numpy.sum", "os.makedirs", "setup_utils.remove_cooccurring_ngrams", "os.path.dirname", "os.path.exists", "scipy.sparse.csr_matrix", "numpy.array", "numpy.where", "pandas.to_datetime", "os.path.join" ]
[((460, 519), 'os.path.join', 'os.path.join', (['project_dir', '"""data/candidate-tweets-2020/raw"""'], {}), "(project_dir, 'data/candidate-tweets-2020/raw')\n", (472, 519), False, 'import os\n'), ((531, 592), 'os.path.join', 'os.path.join', (['project_dir', '"""data/candidate-tweets-2020/clean"""'], {}), "(project_dir...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Oct 7 10:56:28 2019 @author: rdamseh """ import os import sys # add VascGraph package to python path try: sys.path.append(os.getcwd()) except: pass import numpy as np from scipy import sparse class ReadVTrails: def __init__(self, fi...
[ "h5py.File", "os.getcwd", "scipy.sparse.csc_matrix", "numpy.array", "numpy.linalg.norm", "VascGraph.GeomGraph.Graph" ]
[((197, 208), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (206, 208), False, 'import os\n'), ((589, 613), 'h5py.File', 'h5py.File', (['filepath', '"""r"""'], {}), "(filepath, 'r')\n", (598, 613), False, 'import h5py\n'), ((1199, 1206), 'VascGraph.GeomGraph.Graph', 'Graph', ([], {}), '()\n', (1204, 1206), False, 'from V...
""" Utility functions for the neural network and tensor manipulation of run_mtqa.py """ from __future__ import absolute_import, division, print_function import os import sys if os.name == 'nt': root_path = "/".join(os.path.realpath(__file__).split("\\")[:-2]) else: root_path = "/".join(os.path.realpath(__file...
[ "sys.path.append", "torch.utils.data.DataLoader", "metrics.sequence_labeling.get_entities_with_names", "torch.utils.data.RandomSampler", "numpy.argmax", "os.path.realpath", "torch.cat", "data_processing.nn_output_to_indra.get_db_xrefs", "torch.utils.data.DistributedSampler", "data_processing.nn_ou...
[((1060, 1087), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1077, 1087), False, 'import logging\n'), ((375, 401), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (390, 401), False, 'import sys\n'), ((11753, 11798), 'sqlalchemy.create_engine', 'create_engine...
from numpy.random import RandomState import math from bblr.Utils import Utils class MainPatternGenerator(object): MAX_TRIES = 100 def __init__(self, properties, seedAddition): self.properties = properties # Validating the configuration. seed = properties.get('seed') ...
[ "bblr.Utils.Utils.assertInt", "bblr.Utils.Utils.transformDataSet", "math.sqrt", "numpy.random.RandomState", "bblr.Utils.Utils.generateDataSet", "bblr.Utils.Utils.distance" ]
[((574, 610), 'bblr.Utils.Utils.assertInt', 'Utils.assertInt', (['"""Random seed"""', 'seed'], {}), "('Random seed', seed)\n", (589, 610), False, 'from bblr.Utils import Utils\n'), ((619, 675), 'bblr.Utils.Utils.assertInt', 'Utils.assertInt', (['"""Pattern data set size"""', 'dataSetSize', '(1)'], {}), "('Pattern data ...
""" Copyright 2017 Neural Networks and Deep Learning lab, MIPT Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
[ "numpy.argsort", "random.shuffle", "deeppavlov.core.common.registry.register" ]
[((1836, 1868), 'deeppavlov.core.common.registry.register', 'register', (['"""morphotagger_dataset"""'], {}), "('morphotagger_dataset')\n", (1844, 1868), False, 'from deeppavlov.core.common.registry import register\n'), ((3049, 3068), 'numpy.argsort', 'np.argsort', (['lengths'], {}), '(lengths)\n', (3059, 3068), True, ...
import numpy as np from app.imagetoolbox.ImageConfigBase import ImageConfigBase from app.utilities.util_config import assign_raise, assign_fallback class NormalizeConfig(ImageConfigBase): SECTION = "IMAGE-PREPROCESSING" _normalize_mean = np.array([0.485, 0.456, 0.406]) _normalize_stdev = np.array([0.229...
[ "numpy.mean", "numpy.array" ]
[((250, 281), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (258, 281), True, 'import numpy as np\n'), ((305, 336), 'numpy.array', 'np.array', (['[0.229, 0.224, 0.225]'], {}), '([0.229, 0.224, 0.225])\n', (313, 336), True, 'import numpy as np\n'), ((1291, 1337), 'numpy.array',...
import random import numpy as np from modules import solver def make_random(): np_z_board = np.zeros([9,9], int) z_board = np_z_board.tolist() digits = [1,2,3,4,5,6,7,8,9] for i in range(0,9,3): for j in range(0,9,3): x = random.randint(i,i+2) y = rand...
[ "numpy.zeros", "random.randint", "modules.solver.solve_it" ]
[((97, 118), 'numpy.zeros', 'np.zeros', (['[9, 9]', 'int'], {}), '([9, 9], int)\n', (105, 118), True, 'import numpy as np\n'), ((437, 461), 'modules.solver.solve_it', 'solver.solve_it', (['z_board'], {}), '(z_board)\n', (452, 461), False, 'from modules import solver\n'), ((278, 302), 'random.randint', 'random.randint',...
import numpy as np from sklearn.linear_model import LogisticRegression from src.policy import BasePolicy from sklearn.ensemble import RandomForestClassifier class IPSEvaluator: def __init__(self, log_policy: BasePolicy, eval_policy: BasePolicy): self.log_policy = log_policy self.eval_policy = eva...
[ "sklearn.ensemble.RandomForestClassifier", "numpy.append", "numpy.array" ]
[((1222, 1273), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'max_depth': '(5)', 'random_state': '(0)'}), '(max_depth=5, random_state=0)\n', (1244, 1273), False, 'from sklearn.ensemble import RandomForestClassifier\n'), ((2297, 2348), 'sklearn.ensemble.RandomForestClassifier', 'RandomFores...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2019 <NAME> (Nagoya University) # based on PyTorch implementation for WaveNet vocoder by <NAME> (Nagoya University) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import division from __future__ import print_function import argpar...
[ "numpy.random.seed", "argparse.ArgumentParser", "numpy.sum", "utils.find_files", "torch.get_rng_state", "torch.cat", "numpy.random.set_state", "gru_vae.loss_vae", "dataset.padding", "os.path.isfile", "numpy.mean", "torch.no_grad", "logging.error", "torch.utils.data.DataLoader", "numpy.st...
[((7884, 7958), 'torch.save', 'torch.save', (['checkpoint', "(checkpoint_dir + '/checkpoint-%d.pkl' % iterations)"], {}), "(checkpoint, checkpoint_dir + '/checkpoint-%d.pkl' % iterations)\n", (7894, 7958), False, 'import torch\n'), ((8013, 8069), 'logging.info', 'logging.info', (["('%d-iter checkpoint created.' % itera...
import numpy as np from scipy.integrate.odepack import odeint def denbigh_rxn2(input_features, A=[.2, 0.01, 0.005, 0.005], E=[7000, 3000, 3000, 100]): ''' Returns output concentration for a batch reactor based on the denbigh reaction. Reaction parameters has been tuned to ensure variability within de...
[ "scipy.integrate.odepack.odeint", "numpy.zeros", "numpy.array", "numpy.linspace", "numpy.concatenate" ]
[((2137, 2152), 'numpy.array', 'np.array', (['c_out'], {}), '(c_out)\n', (2145, 2152), True, 'import numpy as np\n'), ((1749, 1785), 'numpy.zeros', 'np.zeros', (['(numel_row, 7 - numel_col)'], {}), '((numel_row, 7 - numel_col))\n', (1757, 1785), True, 'import numpy as np\n'), ((1812, 1873), 'numpy.concatenate', 'np.con...
import numpy as np import torch from pytorch_toolbelt.inference.tiles import ImageSlicer, CudaTileMerger from pytorch_toolbelt.utils.torch_utils import ( tensor_from_rgb_image, rgb_image_from_tensor, to_numpy, ) from torch import nn from torch.utils.data import DataLoader import pytest skip_if_no_cuda = p...
[ "pytorch_toolbelt.utils.torch_utils.rgb_image_from_tensor", "pytorch_toolbelt.inference.tiles.CudaTileMerger", "pytorch_toolbelt.inference.tiles.ImageSlicer", "numpy.random.random", "torch.cuda.is_available", "torch.max", "numpy.testing.assert_equal", "numpy.testing.assert_allclose", "pytorch_toolbe...
[((512, 579), 'pytorch_toolbelt.inference.tiles.ImageSlicer', 'ImageSlicer', (['image.shape'], {'tile_size': '(51)', 'tile_step': '(26)', 'weight': '"""mean"""'}), "(image.shape, tile_size=51, tile_step=26, weight='mean')\n", (523, 579), False, 'from pytorch_toolbelt.inference.tiles import ImageSlicer, CudaTileMerger\n...
import datetime import functools import multiprocessing as mp import os import sys import time from pprint import pprint from timeit import Timer import numpy as np import pandas as pd import psutil import pyarrow as pa import pyarrow.compute as pc # import ray from util import run_timer def get_sample_data_arrow(r...
[ "numpy.load", "numpy.save", "numpy.sum", "util.run_timer", "os.getpid", "pyarrow.OSFile", "pyarrow.ipc.open_file", "multiprocessing.Pool", "numpy.random.rand", "pyarrow.ipc.RecordBatchFileReader", "pyarrow.RecordBatchFileWriter", "pyarrow.memory_map", "pyarrow.compute.sum" ]
[((766, 791), 'numpy.random.rand', 'np.random.rand', (['rows', '(200)'], {}), '(rows, 200)\n', (780, 791), True, 'import numpy as np\n'), ((861, 902), 'numpy.load', 'np.load', (['"""/tmp/sample.npy"""'], {'mmap_mode': '"""r"""'}), "('/tmp/sample.npy', mmap_mode='r')\n", (868, 902), True, 'import numpy as np\n'), ((916,...
import pandas import gensim import re import json from gensim.test.utils import common_texts from gensim.models.doc2vec import Doc2Vec, TaggedDocument from translate import Translator from translate.providers import MyMemoryProvider from iccs_manager import ICCS, MatchedCategory from sortedcontainers import SortedList ...
[ "json.dump", "numpy.divide", "scipy.spatial.distance.cosine", "numpy.zeros", "iccs_manager.MatchedCategory", "numpy.array", "translate.Translator", "gensim.models.KeyedVectors.load_word2vec_format", "numpy.add", "re.sub" ]
[((851, 936), 'translate.Translator', 'Translator', ([], {'provider': '"""mymemory"""', 'from_lang': 'source', 'to_lang': 'dest', 'email': '"""<EMAIL>"""'}), "(provider='mymemory', from_lang=source, to_lang=dest, email='<EMAIL>'\n )\n", (861, 936), False, 'from translate import Translator\n'), ((1556, 1598), 'numpy....
import torch import numpy as np import paddle from models import convs2s_wmt_en_de path='ckpt/checkpoint_last.pt' out=np.load('fconv_dec.npy',allow_pickle=True)[0] # 1.1获取torch权重和键值 torch_weights = torch.load(path)['model'] torch_keys=[k for k in torch_weights.keys()] # 1.2获取paddle权重和键值 model=convs2s_wmt_en...
[ "numpy.load", "paddle.load", "torch.load", "torch.save", "models.convs2s_wmt_en_de", "torch.from_numpy" ]
[((306, 487), 'models.convs2s_wmt_en_de', 'convs2s_wmt_en_de', ([], {'is_test': '(False)', 'src_vocab_size': '(42243)', 'tgt_vocab_size': '(43676)', 'max_src_positions': '(1024)', 'max_tgt_positions': '(1024)', 'bos_id': '(2)', 'eos_id': '(2)', 'beam_size': '(5)', 'max_out_len': '(50)'}), '(is_test=False, src_vocab_siz...
from scipy.special import erfc import numpy as np from numpy import sqrt from scipy.optimize import minimize import pandas as pd def webers_prediction(w,smaller_number,larger_number,rt=np.array([])): if rt.size==0: x = ((larger_number-smaller_number)/(sqrt(2*w)*sqrt(smaller_number**2+larger_number**2))) ...
[ "pandas.DataFrame", "numpy.matrix", "scipy.optimize.minimize", "numpy.sum", "pandas.read_csv", "scipy.special.erfc", "numpy.hstack", "numpy.array", "numpy.round", "numpy.unique", "numpy.sqrt" ]
[((2093, 2108), 'pandas.read_csv', 'pd.read_csv', (['fn'], {}), '(fn)\n', (2104, 2108), True, 'import pandas as pd\n'), ((2298, 2316), 'numpy.unique', 'np.unique', (['ds[idx]'], {}), '(ds[idx])\n', (2307, 2316), True, 'import numpy as np\n'), ((3292, 3305), 'numpy.hstack', 'np.hstack', (['ws'], {}), '(ws)\n', (3301, 33...
# -*- coding: utf-8 -*- import numpy as np from configs import comission, PRICE_MAG class environment: def __init__(self, data_frame, leng): self.big_data = data_frame.values self.len = leng self.start_len = self.big_data.shape[0] - leng #print(self.start_len, leng) start_p...
[ "numpy.random.rand", "numpy.random.randint" ]
[((2346, 2369), 'numpy.random.randint', 'np.random.randint', (['(0)', '(3)'], {}), '(0, 3)\n', (2363, 2369), True, 'import numpy as np\n'), ((331, 347), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (345, 347), True, 'import numpy as np\n'), ((1991, 2007), 'numpy.random.rand', 'np.random.rand', ([], {}), '()...
import logging import math import numpy as np import sklearn.metrics from .config import METRIC_NULL log = logging.getLogger(__name__) class Metric(object): # metric class def __init__(self, name, function, problem_type, best_is_min, need_class=False, binary=False, average=False): self.name = name ...
[ "numpy.lexsort", "logging.getLogger", "numpy.argmax" ]
[((109, 136), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (126, 136), False, 'import logging\n'), ((1495, 1534), 'numpy.lexsort', 'np.lexsort', (['(all[:, 2], -1 * all[:, 1])'], {}), '((all[:, 2], -1 * all[:, 1]))\n', (1505, 1534), True, 'import numpy as np\n'), ((3698, 3723), 'numpy.a...
from netCDF4 import Dataset import numpy as np def compute_norms(lo,hi) : ny_hi = hi.shape[0] nx_hi = hi.shape[1] ny_lo = lo.shape[0] nx_lo = lo.shape[1] factor_y = int( hi.shape[0] / lo.shape[0] ) factor_x = int( hi.shape[1] / lo.shape[1] ) if (ny_hi == 1) : interp = np.mean( np.reshape(hi ,[nx_lo...
[ "netCDF4.Dataset", "numpy.abs", "numpy.log", "numpy.max", "numpy.min", "numpy.reshape" ]
[((794, 816), 'netCDF4.Dataset', 'Dataset', (['fname_hi', '"""r"""'], {}), "(fname_hi, 'r')\n", (801, 816), False, 'from netCDF4 import Dataset\n'), ((1058, 1079), 'netCDF4.Dataset', 'Dataset', (['fname_a', '"""r"""'], {}), "(fname_a, 'r')\n", (1065, 1079), False, 'from netCDF4 import Dataset\n'), ((1316, 1337), 'netCD...
# -*- coding: utf-8 -*- """ The :mod:`TensorClus.coclustering.tensorCoclusteringBernoulli` module provides an implementation of a tensor co-clustering algorithm for binary three-way tensor. """ # Author: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # License: BSD 3 clause from __future__ ...
[ "sklearn.utils.check_random_state", "numpy.sum", "numpy.abs", "numpy.argmax", "numpy.ones", "numpy.isnan", "numpy.iinfo", "numpy.mean", "numpy.arange", "numpy.exp", "numpy.multiply", "cupy.asnumpy", "numpy.asarray", "cupy.multiply", "cupy.asarray", "numpy.log", "numpy.zeros", "cupy...
[((3569, 3606), 'sklearn.utils.check_random_state', 'check_random_state', (['self.random_state'], {}), '(self.random_state)\n', (3587, 3606), False, 'from sklearn.utils import check_random_state\n'), ((6054, 6066), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (6063, 6066), True, 'import numpy as np\n'), ((6087, 6...
#!/usr/bin/env python3 from __future__ import print_function import sys, os import bz2, re import itertools import operator import marisa_trie import numpy as np from pathlib import Path from os.path import (expanduser) from math import sqrt # opens file checking whether it is bz2 compressed or not. import tarfile from...
[ "unittest.main", "numpy.partition", "numpy.load", "os.path.join", "os.makedirs", "os.path.basename", "os.path.exists", "re.match", "numpy.argsort", "numpy.savez_compressed", "marisa_trie.Trie", "numpy.random.randint", "numpy.tile", "numpy.random.choice", "os.path.expanduser" ]
[((679, 694), 'os.path.expanduser', 'expanduser', (['"""~"""'], {}), "('~')\n", (689, 694), False, 'from os.path import expanduser\n'), ((706, 740), 'os.path.join', 'os.path.join', (['home', '""".pypasswords"""'], {}), "(home, '.pypasswords')\n", (718, 740), False, 'import sys, os\n'), ((12248, 12263), 'unittest.main',...
import numpy as np from repeater.results_check.outliers_detection.outliers_detector_decorator import ( OutliersDetectionDecorator ) class Mad(OutliersDetectionDecorator): def __init__(self, outlier_detector, parameters): super().__init__(outlier_detector, __name__, parameters) def _find_outliers...
[ "numpy.median", "numpy.sum", "numpy.unique", "numpy.sqrt" ]
[((1435, 1460), 'numpy.median', 'np.median', (['points'], {'axis': '(0)'}), '(points, axis=0)\n', (1444, 1460), True, 'import numpy as np\n'), ((1514, 1553), 'numpy.sum', 'np.sum', (['((points - median) ** 2)'], {'axis': '(-1)'}), '((points - median) ** 2, axis=-1)\n', (1520, 1553), True, 'import numpy as np\n'), ((156...
#!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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, merg...
[ "numpy.radians", "anim_utils.utilities.log.write_log", "numpy.array", "numpy.linalg.norm", "numpy.dot" ]
[((7359, 7409), 'anim_utils.utilities.log.write_log', 'write_log', (['"""Warning: skip undefined control point"""'], {}), "('Warning: skip undefined control point')\n", (7368, 7409), False, 'from anim_utils.utilities.log import write_log, write_message_to_log, LOG_MODE_DEBUG, LOG_MODE_ERROR, LOG_MODE_INFO\n'), ((8173, ...
import matplotlib.pyplot as plt import numpy as np import glob from process_data.uniformization import uniformization, reducePoint from process_data.B_Spline_Approximation import BS_curve import math def plotMap(juncDir, traDir=None, segBegin=0, segEnd=0, tra_begin=0, tra_length=0): """ traDir: 轨迹路径 juncDi...
[ "process_data.B_Spline_Approximation.BS_curve", "matplotlib.pyplot.show", "numpy.average", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "numpy.polyfit", "matplotlib.pyplot.scatter", "math.sqrt", "numpy.hstack", "numpy.array", "numpy.loadtxt", "numpy.linspace", "process_data.uniformizat...
[((1633, 1643), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1641, 1643), True, 'import matplotlib.pyplot as plt\n'), ((1648, 1657), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (1655, 1657), True, 'import matplotlib.pyplot as plt\n'), ((1852, 1903), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'...
def captureRestofRow(s,r,c,header): #sheet row and col out = [] for col in range(c+header,s.ncols): x = s.cell(r,col) value = x.value try: value = str(float(value)) #Keep if string or number except: pass if value != "": out.append(value) return out def c...
[ "xlrd.open_workbook", "numpy.repeat" ]
[((2695, 2715), 'numpy.repeat', 'np.repeat', (['d0', 'nconc'], {}), '(d0, nconc)\n', (2704, 2715), True, 'import numpy as np\n'), ((2728, 2748), 'numpy.repeat', 'np.repeat', (['sr', 'nconc'], {}), '(sr, nconc)\n', (2737, 2748), True, 'import numpy as np\n'), ((4003, 4025), 'xlrd.open_workbook', 'xlrd.open_workbook', ([...
import numpy as np import pickle as pk import os import argparse import json from collections import OrderedDict import SimpleITK as sitk def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-p', '--preprocessed', help='nnunet preprocessed data dir', required=True, type=source_path) ...
[ "os.mkdir", "argparse.ArgumentParser", "numpy.argmax", "os.path.isdir", "numpy.amax", "os.path.splitext", "SimpleITK.GetImageFromArray", "os.path.join", "os.listdir", "argparse.ArgumentTypeError" ]
[((176, 201), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (199, 201), False, 'import argparse\n'), ((695, 714), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (708, 714), False, 'import os\n'), ((976, 995), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (989, 99...
import numpy as np import matplotlib.pyplot as plt from sklearn.svm import SVC from sklearn import svm, datasets from sklearn.metrics import accuracy_score def my_plot(x, y, name="temp.png"): plt.figure() plt.plot(range(1, len(x)+1), x, label='tilt') plt.plot(range(1, len(y)+1), y, label='non-tilt') pl...
[ "matplotlib.pyplot.title", "mlxtend.plotting.plot_decision_regions", "matplotlib.pyplot.close", "random.shuffle", "matplotlib.pyplot.legend", "sklearn.metrics.accuracy_score", "matplotlib.pyplot.scatter", "matplotlib.pyplot.figure", "numpy.array", "random.seed", "numpy.arange", "sklearn.svm.SV...
[((1149, 1160), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1157, 1160), True, 'import numpy as np\n'), ((1166, 1177), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (1174, 1177), True, 'import numpy as np\n'), ((1438, 1450), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1448, 1450), True, 'impor...
import os import random import sys import numpy as np path_list_file = sys.argv[1] path_to_label_file = sys.argv[2] with open(path_list_file, 'r') as f: path_list = list(map(str.strip, f.readlines())) path_to_label = np.load(path_to_label_file, allow_pickle=True).item() label_to_paths = dict() for path in pat...
[ "random.sample", "numpy.load" ]
[((225, 271), 'numpy.load', 'np.load', (['path_to_label_file'], {'allow_pickle': '(True)'}), '(path_to_label_file, allow_pickle=True)\n', (232, 271), True, 'import numpy as np\n'), ((625, 666), 'random.sample', 'random.sample', (['paths'], {'k': 'samples_per_class'}), '(paths, k=samples_per_class)\n', (638, 666), False...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 包含了一些简单的线性算法的模块,包括线性回归、逻辑回归和线性判别分析算法 """ from collections import OrderedDict from typing import Union, Tuple, List import numpy as np import scipy.optimize as opt from numpy import ndarray import _inner_tools as _t import data_processing as _dp import mlfunc as _mf...
[ "numpy.trace", "_inner_tools.match_x_y", "numpy.sum", "_inner_tools.convert_y", "numpy.argmax", "numpy.empty", "exception.StateError", "numpy.argsort", "_inner_tools.r2m", "numpy.mean", "numpy.isclose", "exception.DataNotMatchError", "_inner_tools.ret", "numpy.linalg.pinv", "numpy.real",...
[((2442, 2468), '_inner_tools.match_x_y', '_t.match_x_y', (['x_mat', 'y_row'], {}), '(x_mat, y_row)\n', (2454, 2468), True, 'import _inner_tools as _t\n'), ((3404, 3444), '_inner_tools.match_theta_x', '_t.match_theta_x', (['self._theta_row', 'x_mat'], {}), '(self._theta_row, x_mat)\n', (3420, 3444), True, 'import _inne...
# This file is generated from image_classification/dataset.md automatically through: # d2lbook build lib # Don't edit it directly #@save_all #@hide_all import pathlib import pandas as pd from matplotlib import pyplot as plt from typing import Union, Sequence, Callable, Optional import fnmatch import numpy as np imp...
[ "unittest.main", "pandas.DataFrame", "numpy.array", "mxnet.nd.array", "matplotlib.pyplot.subplots", "d8.core.create_reader" ]
[((5605, 5661), 'unittest.main', 'unittest.main', ([], {'argv': "['first-arg-is-ignored']", 'exit': '(False)'}), "(argv=['first-arg-is-ignored'], exit=False)\n", (5618, 5661), False, 'import unittest\n'), ((936, 979), 'matplotlib.pyplot.subplots', 'plt.subplots', (['nrows', 'ncols'], {'figsize': 'figsize'}), '(nrows, n...
import cv2 as cv import numpy as np import matplotlib.pyplot as plt from base import BaseDetector, DrawFlags from image import SuspiciousImage class Duplication(BaseDetector): """ Parameters ---------- min_kp : int, r : float, (default=0.60) min_match : int, (default=5) min_key_ratio : flo...
[ "numpy.full", "cv2.drawMatches", "cv2.cvtColor", "matplotlib.pyplot.close", "numpy.float32", "cv2.BFMatcher", "numpy.frombuffer", "numpy.hstack", "matplotlib.pyplot.figure", "numpy.array", "numpy.int32", "cv2.perspectiveTransform", "cv2.findHomography", "numpy.vstack" ]
[((3784, 3827), 'numpy.full', 'np.full', (['(H + gap * 2, W + gap * 2, C)', '(255)'], {}), '((H + gap * 2, W + gap * 2, C), 255)\n', (3791, 3827), True, 'import numpy as np\n'), ((4647, 4684), 'cv2.perspectiveTransform', 'cv.perspectiveTransform', (['pts', 'self.M_'], {}), '(pts, self.M_)\n', (4670, 4684), True, 'impor...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 11 11:10:17 2021 @author: nmei """ import os,gc,torch import numpy as np import pandas as pd from utils_deep import (data_loader, candidates, define_augmentations, createLoss...
[ "os.mkdir", "numpy.random.seed", "numpy.logspace", "utils_deep.simple_augmentations", "torch.cat", "gc.collect", "numpy.mean", "utils_deep.createLossAndOptimizer", "os.path.join", "pandas.DataFrame", "utils_deep.decode_hidden_layer", "numpy.std", "torch.load", "os.path.exists", "torch.nn...
[((2943, 2967), 'torch.manual_seed', 'torch.manual_seed', (['(12345)'], {}), '(12345)\n', (2960, 2967), False, 'import os, gc, torch\n'), ((2975, 3000), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2998, 3000), False, 'import os, gc, torch\n'), ((3607, 3672), 'os.path.join', 'os.path.join', ...
import numpy as np from scipy.optimize import least_squares class LineFromPlanes: """It is favorable to single out `z` as the parametrising variable. x, y behave equivalently, while z is anyways somewhat different: - z is not continuously read out, but per layer with gaps. - The range of z parameters...
[ "scipy.optimize.least_squares", "numpy.linspace" ]
[((707, 772), 'scipy.optimize.least_squares', 'least_squares', (['plane_lsq', 'init'], {'args': '(zi, yi, xi)', 'loss': '"""soft_l1"""'}), "(plane_lsq, init, args=(zi, yi, xi), loss='soft_l1')\n", (720, 772), False, 'from scipy.optimize import least_squares\n'), ((789, 854), 'scipy.optimize.least_squares', 'least_squar...
## Code to extract college names from video description of videos on nptel youtube channel. import json import numpy as np import statistics college_map = { "IITK": "IITK", "IIT Kanpur": "IITK", "Indian Institute of Technology Kanpur": "IITK", "IITB": "IITB", "IIT Bombay": "IITB", "Indian Instit...
[ "numpy.median", "json.dump", "json.load" ]
[((6194, 6241), 'json.dump', 'json.dump', (['college_to_videos', 'outfile'], {'indent': '(4)'}), '(college_to_videos, outfile, indent=4)\n', (6203, 6241), False, 'import json\n'), ((6301, 6352), 'json.dump', 'json.dump', (['college_dep_to_videos', 'outfile'], {'indent': '(4)'}), '(college_dep_to_videos, outfile, indent...
import os import sys import csv import numpy as np #returns array of file names def getAllFolderFiles(folderName): folderPath = os.path.join(r'C:\Users\jzhan\Desktop\piPACT', folderName) fileNames = os.listdir(folderPath) return sortDistance(fileNames) def getAllFileUUIDData(folderName, file): fileNam...
[ "csv.reader", "numpy.float32", "os.path.join", "os.listdir", "csv.DictWriter" ]
[((133, 194), 'os.path.join', 'os.path.join', (['"""C:\\\\Users\\\\jzhan\\\\Desktop\\\\piPACT"""', 'folderName'], {}), "('C:\\\\Users\\\\jzhan\\\\Desktop\\\\piPACT', folderName)\n", (145, 194), False, 'import os\n'), ((208, 230), 'os.listdir', 'os.listdir', (['folderPath'], {}), '(folderPath)\n', (218, 230), False, 'im...