code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# 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 applicab...
[ "tensorflow.tile", "tensorflow.NotDifferentiable", "tensorflow.shape", "tensorflow.get_variable", "tensorflow.boolean_mask", "tensorflow.transpose", "tensorflow.reduce_sum", "tensorflow.gradients", "numpy.array", "tensorflow.nn.dropout", "tensorflow.reverse_sequence", "copy.deepcopy", "tenso...
[((741, 770), 'tensorflow.NotDifferentiable', 'tf.NotDifferentiable', (['"""Spans"""'], {}), "('Spans')\n", (761, 770), True, 'import tensorflow as tf\n'), ((771, 806), 'tensorflow.NotDifferentiable', 'tf.NotDifferentiable', (['"""Antecedents"""'], {}), "('Antecedents')\n", (791, 806), True, 'import tensorflow as tf\n'...
#!/usr/bin/env python # ------------------------------------------------------------------------------------------------------% # Created by "Thieu" at 17:12, 09/07/2021 % # ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "numpy.arange", "pathlib.Path", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "platform.system", "re.sub", "matplotlib.pyplot.subplots", "matplotlib.pyplot.legend", "matplot...
[((1732, 1769), 're.sub', 're.sub', (['regular_expression', '""""""', 'fname'], {}), "(regular_expression, '', fname)\n", (1738, 1769), False, 'import re\n'), ((2541, 2557), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (2550, 2557), True, 'from matplotlib import pyplot as plt\n'), ((2562, 2581)...
#encoding: UTF-8 # Copyright (C) 2016 <NAME> # This file is distributed under the terms of the # MIT License. # See the file `License' in the root directory of the present distribution. """ An earlier and now oblosete implementation of functions for computing the thermal expansion tensor as a function of temperatur...
[ "math.pow", "numpy.array", "math.exp", "numpy.zeros" ]
[((1910, 1922), 'math.exp', 'math.exp', (['(-x)'], {}), '(-x)\n', (1918, 1922), False, 'import math\n'), ((1953, 1967), 'math.pow', 'math.pow', (['x', '(2)'], {}), '(x, 2)\n', (1961, 1967), False, 'import math\n'), ((2399, 2411), 'math.exp', 'math.exp', (['(-x)'], {}), '(-x)\n', (2407, 2411), False, 'import math\n'), (...
from __future__ import division import numpy as np from sklearn.utils import shuffle from sklearn.metrics import * """ Module with different fitness functions implemented to be used by the CRO algorithm. The functions' only argument must be an individual (coral) and return its fitness, a number. The fitness might re...
[ "sklearn.utils.shuffle", "numpy.multiply" ]
[((1584, 1623), 'sklearn.utils.shuffle', 'shuffle', (['X', 'y'], {'random_state': 'random_seed'}), '(X, y, random_state=random_seed)\n', (1591, 1623), False, 'from sklearn.utils import shuffle\n'), ((1633, 1655), 'numpy.multiply', 'np.multiply', (['Xs', 'coral'], {}), '(Xs, coral)\n', (1644, 1655), True, 'import numpy ...
import numpy as np from ..local_interpolation import ThirdOrderHermitePolynomialInterpolation from .runge_kutta import AbstractESDIRK, ButcherTableau γ = 0.26 a21 = γ a31 = 0.13 a32 = 0.84033320996790809 a41 = 0.22371961478320505 a42 = 0.47675532319799699 a43 = -0.06470895363112615 a51 = 0.16648564323248321 a52 = 0....
[ "numpy.array" ]
[((1729, 1760), 'numpy.array', 'np.array', (['[0, γ, γ, γ, γ, γ, γ]'], {}), '([0, γ, γ, γ, γ, γ, γ])\n', (1737, 1760), True, 'import numpy as np\n'), ((2016, 2059), 'numpy.array', 'np.array', (['[a71, a72, a73, a74, a75, a76, γ]'], {}), '([a71, a72, a73, a74, a75, a76, γ])\n', (2024, 2059), True, 'import numpy as np\n'...
import unittest import torch import numpy as np from spectralgp.samplers import MeanEllipticalSlice class TestMeanEllipticalSlice(unittest.TestCase): def test_m_ess(self, nsamples=10000): pmean = torch.zeros(2) pmean[0] = -2. prior_dist = torch.distributions.MultivariateNormal(pmean, covar...
[ "numpy.mean", "spectralgp.samplers.MeanEllipticalSlice", "torch.eye", "unittest.main", "numpy.cov", "torch.zeros", "torch.inverse" ]
[((2193, 2208), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2206, 2208), False, 'import unittest\n'), ((210, 224), 'torch.zeros', 'torch.zeros', (['(2)'], {}), '(2)\n', (221, 224), False, 'import torch\n'), ((372, 386), 'torch.zeros', 'torch.zeros', (['(2)'], {}), '(2)\n', (383, 386), False, 'import torch\n'),...
"""Steps up and down""" import calendar import numpy as np from pandas.io.sql import read_sql from pyiem import network from pyiem.plot.use_agg import plt from pyiem.util import get_autoplot_context, get_dbconn PDICT = {'spring': '1 January - 30 June', 'fall': '1 July - 31 December'} def get_description():...
[ "pyiem.network.Table", "pandas.io.sql.read_sql", "pyiem.util.get_dbconn", "numpy.array", "pyiem.plot.use_agg.plt.subplots" ]
[((1072, 1090), 'pyiem.util.get_dbconn', 'get_dbconn', (['"""coop"""'], {}), "('coop')\n", (1082, 1090), False, 'from pyiem.util import get_autoplot_context, get_dbconn\n'), ((1256, 1299), 'pyiem.network.Table', 'network.Table', (["('%sCLIMATE' % (station[:2],))"], {}), "('%sCLIMATE' % (station[:2],))\n", (1269, 1299),...
"""An environment to skip k frames and return a max between the last two.""" import gym import numpy as np class MaxFrameskipEnv(gym.Wrapper): """An environment to skip k frames and return a max between the last two.""" def __init__(self, env, skip: int=4) -> None: """ Initialize a new max fr...
[ "numpy.zeros", "gym.Wrapper.__init__" ]
[((557, 588), 'gym.Wrapper.__init__', 'gym.Wrapper.__init__', (['self', 'env'], {}), '(self, env)\n', (577, 588), False, 'import gym\n'), ((691, 750), 'numpy.zeros', 'np.zeros', (['(2, *env.observation_space.shape)'], {'dtype': 'np.uint8'}), '((2, *env.observation_space.shape), dtype=np.uint8)\n', (699, 750), True, 'im...
"""Script containing the DeepLoco environments.""" import gym import numpy as np import os import sys import cv2 try: sys.path.append(os.path.join(os.environ["TERRAINRL_PATH"], "simAdapter")) import terrainRLSim # noqa: F401 except (KeyError, ImportError, ModuleNotFoundError): pass class BipedalSoccer(g...
[ "numpy.flip", "terrainRLSim.getEnv", "os.path.join", "gym.spaces.Box", "cv2.imshow", "numpy.array", "cv2.waitKey", "gym.make" ]
[((139, 195), 'os.path.join', 'os.path.join', (["os.environ['TERRAINRL_PATH']", '"""simAdapter"""'], {}), "(os.environ['TERRAINRL_PATH'], 'simAdapter')\n", (151, 195), False, 'import os\n'), ((1016, 1077), 'terrainRLSim.getEnv', 'terrainRLSim.getEnv', (['"""PD-Biped3D-HLC-Soccer-v1"""'], {'render': '(False)'}), "('PD-B...
import numpy as np class Loss(): def output_gradient(self): return class MSE(Loss): def __call__(self, predicted, labels): return 0.5 * np.square(predicted - labels) def output_gradient(self, predicted, labels): return predicted - labels class BinaryCrossEntropy(Loss): def _...
[ "numpy.log", "numpy.nan_to_num", "numpy.square" ]
[((512, 581), 'numpy.nan_to_num', 'np.nan_to_num', (['(-(labels / predicted) + (1 - labels) / (1 - predicted))'], {}), '(-(labels / predicted) + (1 - labels) / (1 - predicted))\n', (525, 581), True, 'import numpy as np\n'), ((163, 192), 'numpy.square', 'np.square', (['(predicted - labels)'], {}), '(predicted - labels)\...
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
[ "numpy.sqrt", "torch.full_like", "torch.nn.functional.softplus", "torch.randn_like", "torch_utils.ops.conv2d_gradfix.no_weight_gradients", "torch.autograd.profiler.record_function", "torch.no_grad", "torch_utils.training_stats.report", "torch.linspace", "torch_utils.misc.ddp_sync", "torch.empty"...
[((1718, 1748), 'torch.zeros', 'torch.zeros', (['[]'], {'device': 'device'}), '([], device=device)\n', (1729, 1748), False, 'import torch\n'), ((2130, 2165), 'torch_utils.misc.ddp_sync', 'misc.ddp_sync', (['self.G_mapping', 'sync'], {}), '(self.G_mapping, sync)\n', (2143, 2165), False, 'from torch_utils import misc, tr...
import numpy as np import pandas as pd import seaborn as sns from nninst.backend.tensorflow.model import AlexNet from nninst.backend.tensorflow.trace.alexnet_imagenet_inter_class_similarity import ( alexnet_imagenet_inter_class_similarity_frequency, ) from nninst.op import Conv2dOp, DenseOp np.random.seed(0) sns....
[ "seaborn.set", "nninst.backend.tensorflow.model.AlexNet.graph", "numpy.eye", "nninst.backend.tensorflow.trace.alexnet_imagenet_inter_class_similarity.alexnet_imagenet_inter_class_similarity_frequency", "numpy.around", "numpy.random.seed", "pandas.DataFrame", "numpy.tri" ]
[((298, 315), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (312, 315), True, 'import numpy as np\n'), ((316, 325), 'seaborn.set', 'sns.set', ([], {}), '()\n', (323, 325), True, 'import seaborn as sns\n'), ((3070, 3184), 'pandas.DataFrame', 'pd.DataFrame', (["{'Same Class': same_class_similarity, 'Diff...
import sys import os import argparse import numpy as np parser = argparse.ArgumentParser( description="""Command-line bin abundance estimator. Print the median RPKM abundance for each bin in each sample to STDOUT. Will read the RPKM file into memory - beware.""", formatter_class=argparse.RawDescriptionHelpForm...
[ "numpy.median", "argparse.ArgumentParser", "vamb.vambtools.read_npz", "vamb.vambtools.read_clusters", "os.path.isfile", "sys.exit", "sys.path.append" ]
[((66, 343), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Command-line bin abundance estimator.\nPrint the median RPKM abundance for each bin in each sample to STDOUT.\nWill read the RPKM file into memory - beware."""', 'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'add_he...
import numpy as np from numpy import linalg as LA import pickle from collections import Counter import csv class Vocabulary(object): def __init__(self, vocab_file, emb_file='', dim_emb=0): with open(vocab_file, 'rb') as f: self.size, self.word2id, self.id2word = pickle.load(f) self.dim_emb = dim_emb ...
[ "csv.DictWriter", "pickle.dump", "numpy.random.random_sample", "pickle.load", "collections.Counter", "numpy.linalg.norm" ]
[((1050, 1064), 'collections.Counter', 'Counter', (['words'], {}), '(words)\n', (1057, 1064), False, 'from collections import Counter\n'), ((1271, 1342), 'pickle.dump', 'pickle.dump', (['(vocab_size, word2id, id2word)', 'f', 'pickle.HIGHEST_PROTOCOL'], {}), '((vocab_size, word2id, id2word), f, pickle.HIGHEST_PROTOCOL)\...
import os import numpy as np import csv import matplotlib.pyplot as plt from moviepy.editor import * from matplotlib.image import imsave import matplotlib matplotlib.use('Agg') # import tensorflow as tf # from stable_baselines.common.callbacks import BaseCallback, EvalCallback # from stable_baselines.common.vec_env im...
[ "numpy.mean", "matplotlib.pyplot.savefig", "numpy.ones", "os.makedirs", "matplotlib.use", "matplotlib.pyplot.cm.tab20", "numpy.std", "os.path.join", "matplotlib.pyplot.cm.tab20c", "matplotlib.image.imsave", "numpy.max", "matplotlib.pyplot.close", "numpy.sum", "matplotlib.pyplot.figure", ...
[((155, 176), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (169, 176), False, 'import matplotlib\n'), ((1675, 1710), 'os.path.join', 'os.path.join', (['log_dir', '"""best_model"""'], {}), "(log_dir, 'best_model')\n", (1687, 1710), False, 'import os\n'), ((4490, 4504), 'matplotlib.pyplot.close',...
import logging import signal import gevent import msgpack from zerorpc import Publisher, Puller, Pusher, Server import numpy as np import jsonpickle from .store import store from .data import Data from .operations.operation import Operation from .utils.singleton import Singleton __all__ = ['ServerAPI'] class Serve...
[ "zerorpc.Publisher", "gevent.signal", "numpy.linspace", "numpy.random.sample", "astropy.io.registry.get_formats", "logging.info", "gevent.spawn" ]
[((2766, 2777), 'zerorpc.Publisher', 'Publisher', ([], {}), '()\n', (2775, 2777), False, 'from zerorpc import Publisher, Puller, Pusher, Server\n'), ((2984, 3087), 'logging.info', 'logging.info', (['"""Server is now listening on %s and sending on %s."""', 'server_address', 'publisher_address'], {}), "('Server is now li...
import numpy as np from GeneralUtils import list_to_sum class Fourier: def __init__(self,amp=[1],freq=[1],ph=[0]): self.amp = amp self.freq = freq self.ph = ph def __str__(self): out = [] for i in range(len(self.amp)): if self.amp[i] != 1: ...
[ "numpy.sin", "numpy.zeros_like", "GeneralUtils.list_to_sum" ]
[((966, 982), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (979, 982), True, 'import numpy as np\n'), ((740, 756), 'GeneralUtils.list_to_sum', 'list_to_sum', (['out'], {}), '(out)\n', (751, 756), False, 'from GeneralUtils import list_to_sum\n'), ((1095, 1112), 'numpy.sin', 'np.sin', (['(x * f + p)'], {}),...
import numpy as np import moch import soch import os import sys import scipy.io import thorns def main(parseID): parseIn = parseID + 'In.mat' parseOut = parseID + 'Out.mat' parse = scipy.io.loadmat(parseIn) os.remove(parseIn) lagSpace = 1. * parse['lagSpace'] / 1000 parsStruct =...
[ "moch.peripheral", "moch.peripheralSpikes", "thorns.show", "soch.createStimulus", "thorns.plot_raster", "moch.subcortical", "numpy.arange", "os.remove" ]
[((234, 252), 'os.remove', 'os.remove', (['parseIn'], {}), '(parseIn)\n', (243, 252), False, 'import os\n'), ((2726, 2777), 'numpy.arange', 'np.arange', ([], {'start': 'dti', 'stop': '(duration + dti)', 'step': 'dti'}), '(start=dti, stop=duration + dti, step=dti)\n', (2735, 2777), True, 'import numpy as np\n'), ((3065,...
# (C) British Crown Copyright 2011 - 2018, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option)...
[ "cartopy.io.img_tiles.MapboxStyleTiles", "numpy.testing.assert_array_almost_equal", "cartopy.io.img_tiles.GoogleTiles", "cartopy.io.img_tiles.MapQuestOpenAerial", "shapely.geometry.box", "cartopy.io.img_tiles.MapboxTiles", "cartopy.crs.PlateCarree", "cartopy.io.img_tiles.QuadtreeTiles", "numpy.array...
[((3086, 3105), 'cartopy.io.img_tiles.GoogleTiles', 'cimgt.GoogleTiles', ([], {}), '()\n', (3103, 3105), True, 'import cartopy.io.img_tiles as cimgt\n'), ((3209, 3242), 'cartopy.io.img_tiles.GoogleTiles', 'cimgt.GoogleTiles', ([], {'style': '"""street"""'}), "(style='street')\n", (3226, 3242), True, 'import cartopy.io....
import numpy as np x = np.array([0,1]) w = np.array([0.5,0.5]) b = -0.7 print(w*x) print(np.sum(w*x)) print(np.sum(w*x)+b) def AND(x1,x2): x = np.array([x1,x2]) w = np.array([0.5,0.5]) b = -0.7 tmp = np.sum(w*x)+b if tmp <= 0: return 0 else: return 1 def NAND(x1,x2): x = n...
[ "numpy.array", "numpy.sum" ]
[((23, 39), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (31, 39), True, 'import numpy as np\n'), ((43, 63), 'numpy.array', 'np.array', (['[0.5, 0.5]'], {}), '([0.5, 0.5])\n', (51, 63), True, 'import numpy as np\n'), ((90, 103), 'numpy.sum', 'np.sum', (['(w * x)'], {}), '(w * x)\n', (96, 103), True, 'impo...
print("From python: Within python module") import os,sys HERE = os.getcwd() sys.path.insert(0,HERE) import numpy as np import tensorflow as tf import matplotlib.pyplot as plt data_array = np.zeros(shape=(2001,258)) # Very important that this matches the number of timesteps in the main solver x = np.arange(start=0,st...
[ "sys.path.insert", "matplotlib.pyplot.savefig", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "os.getcwd", "matplotlib.pyplot.close", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.matmul", "numpy.linalg.svd", "matplotlib.pyplot.title", "numpy.shape", ...
[((65, 76), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (74, 76), False, 'import os, sys\n'), ((77, 101), 'sys.path.insert', 'sys.path.insert', (['(0)', 'HERE'], {}), '(0, HERE)\n', (92, 101), False, 'import os, sys\n'), ((191, 218), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2001, 258)'}), '(shape=(2001, 258))\n', (1...
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[ "imperative.Env", "tensorflow.python.ops.math_ops.round", "pdb.post_mortem", "tensorflow.python.ops.math_ops.reduce_sum", "tensorflow.python.framework.constant_op.constant", "tensorflow.python.ops.math_ops.squared_difference", "numpy.array", "sys.exc_info", "tensorflow.python.platform.googletest.mai...
[((1291, 1309), 'imperative.Env', 'imperative.Env', (['tf'], {}), '(tf)\n', (1305, 1309), False, 'import imperative\n'), ((3592, 3609), 'tensorflow.python.platform.googletest.main', 'googletest.main', ([], {}), '()\n', (3607, 3609), False, 'from tensorflow.python.platform import googletest\n'), ((1439, 1487), 'numpy.ar...
import matplotlib.pyplot as plt import numpy.random as rnd from matplotlib.patches import Ellipse NUM = 250 ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360) for i in range(NUM)] fig = plt.figure(0) ax = fig.add_subplot(111, aspect='equal') for e in ells: ax.ad...
[ "matplotlib.pyplot.figure", "numpy.random.rand", "matplotlib.pyplot.show" ]
[((240, 253), 'matplotlib.pyplot.figure', 'plt.figure', (['(0)'], {}), '(0)\n', (250, 253), True, 'import matplotlib.pyplot as plt\n'), ((461, 471), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (469, 471), True, 'import matplotlib.pyplot as plt\n'), ((376, 386), 'numpy.random.rand', 'rnd.rand', ([], {}), '()...
""" Core implementation of :mod:`sklearndf.transformation.wrapper` """ import logging from abc import ABCMeta, abstractmethod from typing import Any, Generic, List, Optional, TypeVar, Union import numpy as np import pandas as pd from sklearn.base import TransformerMixin from sklearn.compose import ColumnTransformer f...
[ "logging.getLogger", "pandas.Series", "pandas.Index", "numpy.argwhere", "numpy.isnan", "numpy.all", "typing.TypeVar" ]
[((679, 706), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (696, 706), False, 'import logging\n'), ((1360, 1408), 'typing.TypeVar', 'TypeVar', (['"""T_Transformer"""'], {'bound': 'TransformerMixin'}), "('T_Transformer', bound=TransformerMixin)\n", (1367, 1408), False, 'from typing impor...
import numpy as np import pandas as pd from pandas import DataFrame, Series import matplotlib.pyplot as plt num = np.array(['3.14','-2.7','30'], dtype=np.string_) #코드 이해 쉽게 : dtype=np.string_ # num=num.astype(int) # print(num) # ValueError: invalid literal for int() with base 10: '3.14' num=num.astype(float)....
[ "pandas.Series", "pandas.isnull", "numpy.exp", "numpy.array", "pandas.DataFrame", "random.randint", "numpy.arange" ]
[((115, 165), 'numpy.array', 'np.array', (["['3.14', '-2.7', '30']"], {'dtype': 'np.string_'}), "(['3.14', '-2.7', '30'], dtype=np.string_)\n", (123, 165), True, 'import numpy as np\n'), ((1457, 1478), 'pandas.Series', 'Series', (['[1, 2, -3, 4]'], {}), '([1, 2, -3, 4])\n', (1463, 1478), False, 'from pandas import Data...
#! -*- coding: utf-8 -*- # SimBERT_v2预训练代码stage2,把simbert的相似度蒸馏到roformer-sim上 # 官方项目:https://github.com/ZhuiyiTechnology/roformer-sim import json import numpy as np import torch from torch import nn, optim from torch.utils.data import DataLoader import torch.nn.functional as F from bert4torch.models import build_trans...
[ "jieba.initialize", "torch.max", "bert4torch.tokenizers.Tokenizer", "torch.cuda.is_available", "torch.sum", "bert4torch.snippets.AutoRegressiveDecoder.wraps", "jieba.lcut", "torch.mean", "numpy.random.random", "torch.matmul", "torch.ones_like", "json.loads", "numpy.random.choice", "bert4to...
[((533, 551), 'jieba.initialize', 'jieba.initialize', ([], {}), '()\n', (549, 551), False, 'import jieba\n'), ((1057, 1097), 'bert4torch.tokenizers.Tokenizer', 'Tokenizer', (['dict_path'], {'do_lower_case': '(True)'}), '(dict_path, do_lower_case=True)\n', (1066, 1097), False, 'from bert4torch.tokenizers import Tokenize...
# Copyright 2021 Fedlearn authors. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
[ "pandas.read_csv", "numpy.random.choice", "sklearn.model_selection.train_test_split", "pandas.merge", "sklearn.datasets.fetch_20newsgroups", "numpy.array", "numpy.vstack", "pandas.DataFrame", "numpy.arange", "matplotlib.pyplot.show" ]
[((4240, 4277), 'pandas.DataFrame', 'pd.DataFrame', (['newsgroups.target_names'], {}), '(newsgroups.target_names)\n', (4252, 4277), True, 'import pandas as pd\n'), ((4320, 4377), 'pandas.merge', 'pd.merge', (['df', 'targets'], {'left_on': '"""target"""', 'right_index': '(True)'}), "(df, targets, left_on='target', right...
from apps.quiver.models import AnalyticsService, AnalyticsServiceExecution from django.shortcuts import render, HttpResponseRedirect from django.core.exceptions import PermissionDenied from django.views.generic import FormView, CreateView, ListView, DetailView, UpdateView from django.contrib.auth.mixins import LoginRe...
[ "django.shortcuts.render", "apps.quiver.models.AnalyticsService.objects.get", "django.core.exceptions.PermissionDenied", "apps.projects.models.Datarow.objects.filter", "numpy.transpose", "apps.quiver.models.AnalyticsService.objects.filter", "random.randrange", "django.http.JsonResponse", "apps.proje...
[((3445, 3477), 'django.shortcuts.HttpResponseRedirect', 'HttpResponseRedirect', (['"""/quiver/"""'], {}), "('/quiver/')\n", (3465, 3477), False, 'from django.shortcuts import render, HttpResponseRedirect\n'), ((6457, 6508), 'django.shortcuts.render', 'render', (['request', '"""quiver/index.html"""', 'dataForRender'], ...
import cv2 import numpy as np from .augmentor import DataAugment import math class Rotate(DataAugment): """ Continuous rotatation. The sample size for x- and y-axes should be at least sqrt(2) times larger than the input size to make sure there is no non-valid region after center-crop. Args: ...
[ "numpy.copy", "cv2.warpAffine", "numpy.asarray", "math.cos", "numpy.array", "numpy.dot", "numpy.moveaxis", "cv2.getRotationMatrix2D", "math.sin", "numpy.random.RandomState" ]
[((1025, 1038), 'numpy.copy', 'np.copy', (['imgs'], {}), '(imgs)\n', (1032, 1038), True, 'import numpy as np\n'), ((1960, 1976), 'numpy.asarray', 'np.asarray', (['axis'], {}), '(axis)\n', (1970, 1976), True, 'import numpy as np\n'), ((2086, 2107), 'math.cos', 'math.cos', (['(theta / 2.0)'], {}), '(theta / 2.0)\n', (209...
import numpy as np import random import pandas as pd import sqlalchemy from sqlalchemy.orm import sessionmaker from sqlalchemy.sql import select from sqlalchemy import and_ from sqlalchemy import between from sqlalchemy.sql import exists from sqlalchemy import desc from datetime import datetime, timezone, timedelta ...
[ "sqlalchemy.orm.sessionmaker", "random.shuffle", "sqlalchemy.create_engine", "datetime.datetime.now", "numpy.zeros", "numpy.vstack", "pandas.read_sql" ]
[((2315, 2329), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2327, 2329), False, 'from datetime import datetime, timezone, timedelta\n'), ((2468, 2522), 'pandas.read_sql', 'pd.read_sql', (['self._df.statement', 'self._df.session.bind'], {}), '(self._df.statement, self._df.session.bind)\n', (2479, 2522), ...
from self_organising_systems.texture_ca.config import cfg from self_organising_systems.shared.util import imread import tensorflow as tf import numpy as np style_layers = ['block%d_conv1'%i for i in range(1, 6)] content_layer = 'block4_conv2' class StyleModel: def __init__(self, input_texture_path): vgg = tf....
[ "tensorflow.shape", "tensorflow.io.gfile.GFile", "tensorflow.einsum", "tensorflow.concat", "tensorflow.sqrt", "tensorflow.clip_by_value", "tensorflow.import_graph_def", "tensorflow.keras.applications.vgg16.VGG16", "tensorflow.keras.Model", "tensorflow.reduce_mean", "self_organising_systems.share...
[((317, 389), 'tensorflow.keras.applications.vgg16.VGG16', 'tf.keras.applications.vgg16.VGG16', ([], {'include_top': '(False)', 'weights': '"""imagenet"""'}), "(include_top=False, weights='imagenet')\n", (350, 389), True, 'import tensorflow as tf\n'), ((543, 578), 'tensorflow.keras.Model', 'tf.keras.Model', (['[vgg.inp...
import numpy as np import os import traceback import yaml from edflow.hooks.hook import Hook from edflow.util import walk, retrieve, contains_key from edflow.custom_logging import get_logger class RuntimeInputHook(Hook): """Given a textfile reads that at each step and passes the results to a callback functio...
[ "os.path.exists", "traceback.format_exc", "edflow.custom_logging.get_logger", "edflow.util.walk", "numpy.any", "edflow.util.contains_key", "edflow.util.retrieve" ]
[((708, 724), 'edflow.custom_logging.get_logger', 'get_logger', (['self'], {}), '(self)\n', (718, 724), False, 'from edflow.custom_logging import get_logger\n'), ((842, 868), 'os.path.exists', 'os.path.exists', (['self.ufile'], {}), '(self.ufile)\n', (856, 868), False, 'import os\n'), ((1856, 1906), 'edflow.util.walk',...
import json import sys # import matplotlib.pyplot as plt import copy import numpy as np import tensorflow as tf from sklearn.model_selection import StratifiedShuffleSplit from sklearn.utils import class_weight from collections import Counter import random from tensorflow.keras.callbacks import Callback from sklearn.met...
[ "sklearn.model_selection.StratifiedShuffleSplit", "sklearn.metrics.classification_report", "bert.load_bert_weights", "tensorflow.python.keras.utils.layer_utils.count_params", "numpy.array", "tensorflow.keras.layers.Dense", "nltk.tokenize.sent_tokenize", "BertModel.BertModel", "copy.deepcopy", "sys...
[((3640, 3659), 'copy.deepcopy', 'copy.deepcopy', (['data'], {}), '(data)\n', (3653, 3659), False, 'import copy\n'), ((7818, 7867), 'sklearn.model_selection.StratifiedShuffleSplit', 'StratifiedShuffleSplit', ([], {'n_splits': '(1)', 'test_size': '(0.1)'}), '(n_splits=1, test_size=0.1)\n', (7840, 7867), False, 'from skl...
from sysu_dataset import SYSU import numpy as np import scipy import itertools import cv2 import torch from torch.utils.data import Dataset import torchvision.transforms as transforms from config import * vox_size=54 all_tups = np.array(list(itertools.product(range(vox_size), repeat=2))) rot_array = np.arange(vox_...
[ "numpy.radians", "torchvision.transforms.functional.to_tensor", "torchvision.transforms.RandomRotation.get_params", "torchvision.transforms.functional.to_pil_image", "torch.stack", "torch.from_numpy", "numpy.zeros", "numpy.random.randint", "torchvision.transforms.functional.rotate", "torchvision.t...
[((6173, 6298), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': 'DATA_BATCH_SIZE', 'shuffle': '(True)', 'num_workers': 'NUM_WORKERS', 'pin_memory': '(True)'}), '(dataset, batch_size=DATA_BATCH_SIZE, shuffle=\n True, num_workers=NUM_WORKERS, pin_memory=True)\n', (6200, 6298)...
import sys sys.path.append('/home/jwalker/dynamics/python/atmos-tools') sys.path.append('/home/jwalker/dynamics/python/atmos-read') import xray import numpy as np from datetime import datetime import matplotlib.pyplot as plt import pandas as pd import atmos as atm import precipdat import merra # ---------------------...
[ "numpy.radians", "numpy.gradient", "atmos.gradient", "atmos.homedir", "matplotlib.pyplot.plot", "atmos.pres_convert", "atmos.get_coord", "xray.open_dataset", "atmos.moisture_flux_conv", "numpy.cos", "merra.merra_urls", "sys.path.append", "atmos.precip_convert", "atmos.subset" ]
[((11, 71), 'sys.path.append', 'sys.path.append', (['"""/home/jwalker/dynamics/python/atmos-tools"""'], {}), "('/home/jwalker/dynamics/python/atmos-tools')\n", (26, 71), False, 'import sys\n'), ((72, 131), 'sys.path.append', 'sys.path.append', (['"""/home/jwalker/dynamics/python/atmos-read"""'], {}), "('/home/jwalker/d...
import os import json import numpy as np import matplotlib.pyplot as plt def compute_iou(box_1, box_2): ''' This function takes a pair of bounding boxes and returns intersection-over- union (IoU) of two bounding boxes. ''' intersection = 0 tlr1, tlc1, brr1, brc1 = box_1[0], box_1[1], box_1[2], ...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "os.path.join", "numpy.array", "matplotlib.pyplot.figure", "json.load", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((4004, 4058), 'matplotlib.pyplot.plot', 'plt.plot', (['recall', 'precision'], {'color': '"""black"""', 'marker': '"""o"""'}), "(recall, precision, color='black', marker='o')\n", (4012, 4058), True, 'import matplotlib.pyplot as plt\n'), ((4059, 4116), 'matplotlib.pyplot.plot', 'plt.plot', (['recall_l', 'precision_l'],...
# grasp.py # This script implements the GRASP heuristic for the dynamic bin packing # problem. # Author: <NAME> from __future__ import print_function import numpy as np import random import solutions_dynamic as solmaker import sys from copy import deepcopy from itertools import combinations from math import ceil...
[ "numpy.less_equal", "math.sqrt", "numpy.argsort", "numpy.array", "copy.deepcopy", "numpy.divide", "numpy.multiply", "numpy.where", "numpy.subtract", "numpy.max", "random.random", "numpy.setxor1d", "numpy.argmin", "random.randint", "operator.attrgetter", "random.sample", "numpy.allclo...
[((62326, 62343), 'numpy.allclose', 'np.allclose', (['u', 'v'], {}), '(u, v)\n', (62337, 62343), True, 'import numpy as np\n'), ((62506, 62525), 'numpy.less_equal', 'np.less_equal', (['u', 'v'], {}), '(u, v)\n', (62519, 62525), True, 'import numpy as np\n'), ((62537, 62552), 'numpy.all', 'np.all', (['domtest'], {}), '(...
import os.path import numpy as np import itertools import Tools # Those patterns are used for tests and benchmarks. # For tests, there is the need to add tests for saturation def writeTests(config): NBSAMPLES=128 inputsA=np.random.randn(NBSAMPLES) inputsB=np.random.randn(NBSAMPLES) inputsA = inpu...
[ "Tools.Config", "numpy.random.randn" ]
[((624, 665), 'Tools.Config', 'Tools.Config', (['PATTERNDIR', 'PARAMDIR', '"""f32"""'], {}), "(PATTERNDIR, PARAMDIR, 'f32')\n", (636, 665), False, 'import Tools\n'), ((674, 715), 'Tools.Config', 'Tools.Config', (['PATTERNDIR', 'PARAMDIR', '"""q31"""'], {}), "(PATTERNDIR, PARAMDIR, 'q31')\n", (686, 715), False, 'import ...
from genericpath import exists import math import numpy as np import os import re from PIL import Image import matplotlib.pyplot as plt from matplotlib import cm # append line to log file def log(file, line, doPrint=True): f = open(file, "a+") f.wrtite(line + "\n") f.close() if doPrint: print(l...
[ "numpy.copy", "os.path.exists", "PIL.Image.fromarray", "numpy.mean", "numpy.abs", "os.makedirs", "numpy.arange", "math.pow", "PIL.Image.new", "matplotlib.cm.magma", "numpy.asarray", "numpy.max", "matplotlib.pyplot.figure", "numpy.min", "matplotlib.pyplot.legend", "matplotlib.pyplot.sho...
[((460, 482), 'numpy.asarray', 'np.asarray', (['history_L1'], {}), '(history_L1)\n', (470, 482), True, 'import numpy as np\n'), ((496, 521), 'numpy.asarray', 'np.asarray', (['history_L1val'], {}), '(history_L1val)\n', (506, 521), True, 'import numpy as np\n'), ((527, 539), 'matplotlib.pyplot.figure', 'plt.figure', ([],...
# -*- coding: utf-8 -*- """ Created on 2017-8-24 @author: cheng.li """ import bisect import datetime as dt from typing import Iterable from typing import Union import numpy as np import pandas as pd from simpleutils.asserts import require from PyFin.DateUtilities import Period from PyFin.api import BizDayConventions...
[ "alphamind.data.processing.factor_processing", "numpy.unique", "pandas.DataFrame", "datetime.datetime.strptime", "pandas.DatetimeIndex", "pandas.merge", "PyFin.api.makeSchedule", "PyFin.DateUtilities.Period", "bisect.bisect_right", "alphamind.utilities.alpha_logger.info", "PyFin.api.advanceDateB...
[((1853, 1874), 'numpy.unique', 'np.unique', (['date_label'], {}), '(date_label)\n', (1862, 1874), True, 'import numpy as np\n'), ((2571, 2728), 'PyFin.api.makeSchedule', 'makeSchedule', (['start_date', 'end_date', 'frequency'], {'calendar': '"""china.sse"""', 'dateRule': 'BizDayConventions.Following', 'dateGenerationR...
#TODO: use only one (RGB) channel import numpy as np import pandas as pd import os from torch.utils import data from torch.utils.data.dataloader import DataLoader as DataLoader import torch from torchvision import transforms from natsort import natsorted, ns import cv2 from PIL import Image import matplotlib.pyplot as ...
[ "torch.nn.MSELoss", "torch.cuda.is_available", "torch.nn.init.xavier_uniform_", "torch.utils.data.dataloader.DataLoader", "torchvision.transforms.ToTensor", "torch.utils.data.random_split", "numpy.floor", "torch.transpose", "torch.is_tensor", "torchvision.transforms.Resize", "torch.nn.BCEWithLog...
[((647, 672), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (670, 672), False, 'import torch\n'), ((5829, 5894), 'torch.utils.data.random_split', 'torch.utils.data.random_split', (['dataset', '[train_split, test_split]'], {}), '(dataset, [train_split, test_split])\n', (5858, 5894), False, 'imp...
import re import numpy as np import pandas as pd import scipy.stats as stats R_REGEX = re.compile('(.*):(.*)-(.*)') R_REGEX_STRAND = re.compile('(.*):(.*)-(.*):(.*)') def chunks(l, n): """Yield successive n-sized chunks from l.""" # https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-even...
[ "StringIO.StringIO", "pandas.Series", "zlib.decompressobj", "re.compile", "scipy.stats.norm.ppf", "urllib2.Request", "numpy.array", "scipy.stats.beta", "pandas.DataFrame", "urllib2.build_opener" ]
[((89, 117), 're.compile', 're.compile', (['"""(.*):(.*)-(.*)"""'], {}), "('(.*):(.*)-(.*)')\n", (99, 117), False, 'import re\n'), ((135, 168), 're.compile', 're.compile', (['"""(.*):(.*)-(.*):(.*)"""'], {}), "('(.*):(.*)-(.*):(.*)')\n", (145, 168), False, 'import re\n'), ((2426, 2448), 'urllib2.build_opener', 'urllib2...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Created on Mon Aug 17 11:31:32 2020 Distance-Controlled Boundaries Coefficient (DCBC) evaluation for a functional parcellation of brain cortex INPUTS: sn: The return subject number hems: Hemisphere to test. 'L' - left hemisphere; 'R'...
[ "numpy.abs", "numpy.sqrt", "numpy.reshape", "nibabel.load", "numpy.where", "numpy.delete", "scipy.io.loadmat", "numpy.floor", "numpy.square", "numpy.append", "numpy.sum", "numpy.zeros", "numpy.count_nonzero", "numpy.nanmean", "pandas.read_table", "scipy.sparse.find" ]
[((1943, 2009), 'pandas.read_table', 'pd.read_table', (['"""DCBC/sc1_sc2_taskConds.txt"""'], {'delim_whitespace': '(True)'}), "('DCBC/sc1_sc2_taskConds.txt', delim_whitespace=True)\n", (1956, 2009), True, 'import pandas as pd\n'), ((2028, 2056), 'numpy.floor', 'np.floor', (['(maxDist / binWidth)'], {}), '(maxDist / bin...
import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import functional import numpy as np class Rotate(nn.Module): """ Rotate the image by random angle between -degrees and degrees. """ def __init__(self, degrees, interpolation_method='nearest'): super(Rotate, self...
[ "torchvision.transforms.functional.rotate", "numpy.random.uniform" ]
[((488, 534), 'numpy.random.uniform', 'np.random.uniform', (['(-self.degrees)', 'self.degrees'], {}), '(-self.degrees, self.degrees)\n', (505, 534), True, 'import numpy as np\n'), ((608, 655), 'torchvision.transforms.functional.rotate', 'functional.rotate', (['noised_image', 'rotation_angle'], {}), '(noised_image, rota...
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import time import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter import copy # In[22]: # helps from: https://www.geeksforgeeks.org/merge-sort/ def RecursiveMergeSort(input_array, is_first = True): time_start = time.time(...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "numpy.savetxt", "copy.deepcopy", "matplotlib.pyplot.title", "numpy.loadtxt", "time.time", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((3620, 3656), 'numpy.loadtxt', 'np.loadtxt', (['"""./data/data0.1024"""', 'int'], {}), "('./data/data0.1024', int)\n", (3630, 3656), True, 'import numpy as np\n'), ((3672, 3708), 'numpy.loadtxt', 'np.loadtxt', (['"""./data/data0.2048"""', 'int'], {}), "('./data/data0.2048', int)\n", (3682, 3708), True, 'import numpy ...
from ibapi.client import EClient from ibapi.wrapper import EWrapper from ibapi.contract import Contract from ibapi.order import Order from ibapi.scanner import ScannerSubscription from ibapi.ticktype import TickTypeEnum from ibapi.common import * from ibapi.tag_value import TagValue from ibapi.execution import Executio...
[ "numpy.abs", "ibapi.client.EClient.__init__", "time.sleep", "ibapi.tag_value.TagValue", "ibapi.contract.Contract", "ibapi.order.Order", "pandas.DataFrame", "ibapi.execution.ExecutionFilter", "pandas.to_datetime" ]
[((1277, 1293), 'time.sleep', 'sleep', (['sleeptime'], {}), '(sleeptime)\n', (1282, 1293), False, 'from time import sleep, strftime, localtime, time\n'), ((1517, 1527), 'ibapi.contract.Contract', 'Contract', ([], {}), '()\n', (1525, 1527), False, 'from ibapi.contract import Contract\n'), ((1725, 1732), 'ibapi.order.Ord...
# -*- coding: utf-8 -*- """ Created on Mon Nov 30 21:25:24 2015 @author: Konrad """ import copy import numpy as np import matplotlib.pyplot as plt import scipy.special as sc_p def gen_clusters(means, num_each): tup = (); for m in means: tup = tup + (np.random.multivariate_normal(m, np....
[ "numpy.sqrt", "numpy.ones", "matplotlib.pyplot.show", "scipy.special.gamma", "numpy.concatenate", "copy.deepcopy", "matplotlib.pyplot.subplots", "numpy.random.shuffle" ]
[((10939, 10949), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (10947, 10949), True, 'import matplotlib.pyplot as plt\n'), ((362, 381), 'numpy.concatenate', 'np.concatenate', (['tup'], {}), '(tup)\n', (376, 381), True, 'import numpy as np\n'), ((388, 411), 'numpy.random.shuffle', 'np.random.shuffle', (['data...
# # Copyright 2020 Logical Clocks AB # # 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 ag...
[ "random.uniform", "random.choice", "numpy.minimum", "numpy.maximum", "random.randint", "numpy.round" ]
[((15258, 15281), 'numpy.minimum', 'np.minimum', (['(1.0)', 'scalar'], {}), '(1.0, scalar)\n', (15268, 15281), True, 'import numpy as np\n'), ((15299, 15322), 'numpy.maximum', 'np.maximum', (['(0.0)', 'scalar'], {}), '(0.0, scalar)\n', (15309, 15322), True, 'import numpy as np\n'), ((16816, 16827), 'numpy.round', 'np.r...
import numpy as np from sklearn.kernel_ridge import KernelRidge from sklearn.model_selection import GridSearchCV from sklearn.gaussian_process import GaussianProcessRegressor import sklearn.gaussian_process.kernels as Kernels from scipy.optimize import minimize from numpy.linalg import norm import tensorflow as tf fr...
[ "scipy.optimize.minimize", "numpy.array", "numpy.random.randint", "numpy.zeros", "sklearn.kernel_ridge.KernelRidge", "numpy.logspace" ]
[((479, 513), 'numpy.array', 'np.array', (['[[1, 2], [2, 3], [3, 4]]'], {}), '([[1, 2], [2, 3], [3, 4]])\n', (487, 513), True, 'import numpy as np\n'), ((513, 538), 'numpy.array', 'np.array', (['[[1], [2], [3]]'], {}), '([[1], [2], [3]])\n', (521, 538), True, 'import numpy as np\n'), ((2240, 2263), 'numpy.zeros', 'np.z...
import numpy as np from gym import spaces from agents import SimpleAgentClass # Create agents for the CMA-ES, NEAT and WANN agents # defined in the weight-agnostic paper repo: # https://github.com/google/brain-tokyo-workshop/tree/master/WANNRelease/ # ---------------------------------------------------------------...
[ "numpy.multiply", "numpy.reshape", "numpy.maximum", "numpy.min", "numpy.ndim", "numpy.tanh", "numpy.sum", "numpy.zeros", "numpy.dot", "numpy.isnan", "numpy.cos", "numpy.random.uniform", "numpy.sin", "numpy.cumsum", "numpy.shape", "numpy.load" ]
[((644, 659), 'numpy.min', 'np.min', (['weights'], {}), '(weights)\n', (650, 659), True, 'import numpy as np\n'), ((727, 745), 'numpy.cumsum', 'np.cumsum', (['weights'], {}), '(weights)\n', (736, 745), True, 'import numpy as np\n'), ((757, 789), 'numpy.random.uniform', 'np.random.uniform', (['(0)', 'cumVal[-1]'], {}), ...
import os import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torchvision import transforms from PIL import Image class Anime_Dataset(Dataset): def __init__(self, config, transform): self.config = config self.transform = transform self.lines = open(config....
[ "torchvision.transforms.Scale", "os.path.join", "torch.Tensor", "torchvision.transforms.RandomHorizontalFlip", "numpy.random.randint", "torchvision.transforms.Normalize", "torch.utils.data.DataLoader", "torchvision.transforms.ToTensor" ]
[((3071, 3158), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset', 'config.batch_size'], {'shuffle': '(True)', 'num_workers': '(4)', 'drop_last': '(True)'}), '(dataset, config.batch_size, shuffle=True, num_workers=4,\n drop_last=True)\n', (3081, 3158), False, 'from torch.utils.data import Dataset, DataLoader\...
import matplotlib.pyplot as plt from skimage import measure, morphology from mpl_toolkits.mplot3d.art3d import Poly3DCollection import numpy as np import pandas as pd def plot_slice(img, slice=80): # Show some slice in the middle plt.imshow(img[slice]) plt.show() def plot_3d(image, threshold=-100): #...
[ "matplotlib.pyplot.imshow", "mpl_toolkits.mplot3d.art3d.Poly3DCollection", "matplotlib.pyplot.savefig", "pandas.read_csv", "numpy.random.permutation", "matplotlib.pyplot.figure", "skimage.measure.marching_cubes", "numpy.savez_compressed", "numpy.load", "matplotlib.pyplot.show" ]
[((239, 261), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img[slice]'], {}), '(img[slice])\n', (249, 261), True, 'import matplotlib.pyplot as plt\n'), ((266, 276), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (274, 276), True, 'import matplotlib.pyplot as plt\n'), ((481, 517), 'skimage.measure.marching_cube...
import os import torch import numpy as np from tqdm import tqdm import json from torch.utils.data import Dataset, DataLoader from arcface.resnet import ResNet from arcface.googlenet import GoogLeNet from arcface.inception_v4 import InceptionV4 from arcface.inceptionresnet_v2 import InceptionResNetV2 from arcface.densen...
[ "autoaugment.rand_augment_transform", "numpy.random.rand", "torch.from_numpy", "numpy.array", "arcface.inception_v4.InceptionV4", "os.listdir", "arcface.inceptionresnet_v2.InceptionResNetV2", "config.get_args_arcface", "random.randint", "random.sample", "random.choice", "torch.Tensor", "arcf...
[((47781, 47799), 'config.get_args_arcface', 'get_args_arcface', ([], {}), '()\n', (47797, 47799), False, 'from config import get_args_arcface\n'), ((989, 1034), 'torch.utils.data.DataLoader', 'DataLoader', (['arcfaceDataset'], {}), '(arcfaceDataset, **training_params)\n', (999, 1034), False, 'from torch.utils.data imp...
# -*- coding: utf-8 -*- """ Created on Fri Nov 30 13:44:34 2018 @author: Moha-Thinkpad """ from tensorflow.keras import optimizers from tensorflow.keras.models import Model import datetime import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import tensorflow.keras import argpa...
[ "matplotlib.pyplot.grid", "numpy.array", "tensorflow.keras.models.load_model", "scipy.ndimage.gaussian_filter", "tensorflow.set_random_seed", "numpy.genfromtxt", "matplotlib.pyplot.imshow", "os.path.exists", "os.listdir", "argparse.ArgumentParser", "matplotlib.pyplot.plot", "numpy.max", "mat...
[((228, 249), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (242, 249), False, 'import matplotlib\n'), ((1462, 1508), 'tensorflow.keras.layers.Lambda', 'Lambda', (['lrelu'], {'output_shape': 'lrelu_output_shape'}), '(lrelu, output_shape=lrelu_output_shape)\n', (1468, 1508), False, 'from tensorfl...
"""This file contains functions for converting and storing jupyter notebooks.""" import nbformat import pickle import numpy as np import os from nbconvert import PythonExporter from pathlib import Path # for windows-Unix compatibility def nbconvert_python(path): """Use nbconvert to convert jupyter notebook to py...
[ "os.path.exists", "pickle.dump", "pathlib.Path", "pickle.dumps", "nbformat.read", "numpy.asanyarray", "nbconvert.PythonExporter", "numpy.savez_compressed" ]
[((4025, 4045), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (4039, 4045), False, 'import os\n'), ((5177, 5211), 'pathlib.Path', 'Path', (['"""docs/getting_started.ipynb"""'], {}), "('docs/getting_started.ipynb')\n", (5181, 5211), False, 'from pathlib import Path\n'), ((5307, 5364), 'pathlib.Path', '...
# -*- coding: utf-8 -*- from datetime import datetime, timedelta import pytest import numpy as np import pandas.util.testing as tm from pandas.compat import long from pandas.tseries import offsets from pandas import Timestamp, Timedelta class TestTimestampArithmetic(object): def test_overflow_offset(self): ...
[ "datetime.datetime", "pandas.Timestamp", "pandas.compat.long", "datetime.timedelta", "pytest.raises", "numpy.timedelta64", "pandas.tseries.offsets.Day", "pandas.util.testing.assert_produces_warning" ]
[((469, 511), 'pandas.Timestamp', 'Timestamp', (['"""2017-01-13 00:00:00"""'], {'freq': '"""D"""'}), "('2017-01-13 00:00:00', freq='D')\n", (478, 511), False, 'from pandas import Timestamp, Timedelta\n'), ((1005, 1027), 'datetime.datetime', 'datetime', (['(2013)', '(10)', '(12)'], {}), '(2013, 10, 12)\n', (1013, 1027),...
import json from pathlib import Path import numpy as np from matplotlib import path current_dir = Path(__file__).parent __all__ = list(p.stem for p in current_dir.glob("*.json")) def __getattr__(name: str) -> path.Path: file_path = current_dir / (name + ".json") if file_path.exists(): data = json.lo...
[ "numpy.array", "pathlib.Path" ]
[((100, 114), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (104, 114), False, 'from pathlib import Path\n'), ((418, 451), 'numpy.array', 'np.array', (["data['codes']", 'np.uint8'], {}), "(data['codes'], np.uint8)\n", (426, 451), True, 'import numpy as np\n')]
# Top of main python script import os os.environ["PYOPENGL_PLATFORM"] = "egl" import sys import random import argparse import numpy as np import trimesh import imageio import open3d as o3d from mathutils import Matrix import h5py import json from mesh_to_sdf import get_surface_point_cloud import pyrender import uti...
[ "numpy.sqrt", "util.look_at", "numpy.array", "util.cv_cam2world_to_bcam2world", "numpy.sin", "util.sample_spherical", "os.path.exists", "pyrender.IntrinsicsCamera", "os.listdir", "argparse.ArgumentParser", "numpy.stack", "util.depth_2_normal", "util.get_world2cam_from_blender_cam", "numpy....
[((324, 345), 'numpy.random.seed', 'np.random.seed', (['(12433)'], {}), '(12433)\n', (338, 345), True, 'import numpy as np\n'), ((346, 364), 'random.seed', 'random.seed', (['(12433)'], {}), '(12433)\n', (357, 364), False, 'import random\n'), ((1295, 1393), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'de...
# ======================================================================= # # Copyright (C) 2018, Hisilicon Technologies Co., Ltd. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1 Redistrib...
[ "logging.getLogger", "common.presenter_message_pb2.OpenChannelRequest", "facial_recognition.src.facial_recognition_handler.FacialRecognitionHandler", "common.app_manager.AppManager", "numpy.array", "numpy.linalg.norm", "facial_recognition.src.facial_recognition_message_pb2.RegisterApp", "logging.info"...
[((26636, 26650), 'facial_recognition.src.config_parser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (26648, 26650), False, 'from facial_recognition.src.config_parser import ConfigParser\n'), ((26689, 26748), 'os.path.join', 'os.path.join', (['ConfigParser.root_path', '"""config/logging.conf"""'], {}), "(ConfigPars...
import numpy as np import pandas as pd import xarray as xr import matplotlib.pyplot as plt import geocat.viz.util as gvutil path = r'H:\Python project 2021\climate_data_analysis_with_python\data\sst.mnmean.nc' ds= xr.open_dataset(path) # time slicing sst = ds.sst.sel(time=slice('1920-01-01','2020-12-01')) # anomaly wi...
[ "matplotlib.pyplot.savefig", "geocat.viz.util.add_major_minor_ticks", "pandas.Timestamp", "pandas.to_datetime", "matplotlib.pyplot.figure", "xarray.corr", "numpy.deg2rad", "matplotlib.pyplot.subplots", "matplotlib.pyplot.tight_layout", "numpy.linspace", "matplotlib.pyplot.draw", "xarray.open_d...
[((215, 236), 'xarray.open_dataset', 'xr.open_dataset', (['path'], {}), '(path)\n', (230, 236), True, 'import xarray as xr\n'), ((509, 529), 'numpy.arange', 'np.arange', (['time.size'], {}), '(time.size)\n', (518, 529), True, 'import numpy as np\n'), ((1330, 1356), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsi...
# -*- coding: utf-8 -*- """ Created on Sun Jul 5 06:34:04 2015 @author: tanay """ from lasagne.layers import InputLayer, DropoutLayer, DenseLayer from lasagne.updates import nesterov_momentum from lasagne.objectives import binary_crossentropy from nolearn.lasagne import NeuralNet import theano from theano import tens...
[ "sklearn.utils.shuffle", "numpy.float32", "sklearn.metrics.roc_auc_score" ]
[((1809, 1843), 'sklearn.utils.shuffle', 'shuffle', (['Xtrh', 'y'], {'random_state': '(123)'}), '(Xtrh, y, random_state=123)\n', (1816, 1843), False, 'from sklearn.utils import shuffle\n'), ((479, 494), 'numpy.float32', 'np.float32', (['(0.1)'], {}), '(0.1)\n', (489, 494), True, 'import numpy as np\n'), ((1986, 2024), ...
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.feature_selection import VarianceThreshold from sklearn.preprocessing import PolynomialFeatures, StandardScaler from sklearn import metrics from sklearn.bas...
[ "sklearn.model_selection.GridSearchCV", "sklearn.preprocessing.PolynomialFeatures", "matplotlib.pyplot.hist", "sklearn.feature_selection.VarianceThreshold", "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "numpy.array", "sklearn.decomposition.PCA", "numpy.where", "matplotlib.pyplot.xlabel", ...
[((491, 508), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (505, 508), True, 'import numpy as np\n'), ((1217, 1240), 'numpy.array', 'np.array', (['X', 'np.float64'], {}), '(X, np.float64)\n', (1225, 1240), True, 'import numpy as np\n'), ((1250, 1273), 'numpy.array', 'np.array', (['y', 'np.float64'], {...
"""Test ImageNet pretrained DenseNet""" import cv2 import numpy as np from tensorflow.keras.optimizers import SGD import tensorflow.keras.backend as K # We only test DenseNet-121 in this script for demo purpose from densenet121 import DenseNet im = cv2.resize(cv2.imread('resources/cat.jpg'), (224, 224)).astype(np.f...
[ "numpy.argmax", "tensorflow.keras.optimizers.SGD", "densenet121.DenseNet", "numpy.expand_dims", "cv2.imread", "tensorflow.keras.backend.image_data_format" ]
[((822, 848), 'numpy.expand_dims', 'np.expand_dims', (['im'], {'axis': '(0)'}), '(im, axis=0)\n', (836, 848), True, 'import numpy as np\n'), ((882, 946), 'densenet121.DenseNet', 'DenseNet', ([], {'reduction': '(0.5)', 'classes': '(1000)', 'weights_path': 'weights_path'}), '(reduction=0.5, classes=1000, weights_path=wei...
import cv2 import math import numpy as np import os import matplotlib.pyplot as plt from scipy import ndimage from utils import ValueInvert # TO-DO: Refactor this with np.nonzero?? def find_center_image(img): left = 0 right = img.shape[1] - 1 empty_left = True empty_right = True for col in rang...
[ "cv2.warpAffine", "math.ceil", "math.floor", "cv2.threshold", "utils.ValueInvert", "numpy.lib.pad", "scipy.ndimage.measurements.center_of_mass", "cv2.resize", "numpy.float32", "numpy.round" ]
[((1339, 1379), 'scipy.ndimage.measurements.center_of_mass', 'ndimage.measurements.center_of_mass', (['img'], {}), '(img)\n', (1374, 1379), False, 'from scipy import ndimage\n'), ((1590, 1626), 'numpy.float32', 'np.float32', (['[[1, 0, sx], [0, 1, sy]]'], {}), '([[1, 0, sx], [0, 1, sy]])\n', (1600, 1626), True, 'import...
import numpy as np from collections import namedtuple, deque import random Transition = namedtuple('Transition', ('state', 'action', 'next_state', 'reward', 'not_done')) class ReplayBuffer(object): def __init__(self, capacity): self.memory = deque([], maxlen=capacity) def push(self, *ar...
[ "random.sample", "collections.namedtuple", "collections.deque", "numpy.vstack" ]
[((93, 178), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', "('state', 'action', 'next_state', 'reward', 'not_done')"], {}), "('Transition', ('state', 'action', 'next_state', 'reward',\n 'not_done'))\n", (103, 178), False, 'from collections import namedtuple, deque\n'), ((268, 294), 'collections.deque...
import os import csv import librosa import numpy as np import pandas as pd from spider.featurization.audio_featurization import AudioFeaturization # Read the test data csv csv_file='data/testAudioData.csv' df = pd.read_csv(csv_file) # Read in the audio data specified by the csv data = [] for idx, row in df.iterrows()...
[ "pandas.read_csv", "os.path.join", "numpy.savetxt", "spider.featurization.audio_featurization.AudioFeaturization", "librosa.load" ]
[((212, 233), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {}), '(csv_file)\n', (223, 233), True, 'import pandas as pd\n'), ((616, 711), 'spider.featurization.audio_featurization.AudioFeaturization', 'AudioFeaturization', ([], {'sampling_rate': 'sampling_rate', 'frame_length': 'frame_length', 'overlap': 'overlap'})...
import scipy.io as sio import numpy as np class MatWrapper(object): def __init__(self,mat_file): self.mat_fp = mat_file self.data = None class NeuroSurgMat(MatWrapper): def __init__(self, mat_file): self.mat_fp = mat_file self.data = None self._clfp = None se...
[ "scipy.io.loadmat", "numpy.empty", "numpy.arange", "numpy.squeeze" ]
[((492, 516), 'scipy.io.loadmat', 'sio.loadmat', (['self.mat_fp'], {}), '(self.mat_fp)\n', (503, 516), True, 'import scipy.io as sio\n'), ((567, 611), 'numpy.empty', 'np.empty', (["(3, self.data['CLFP_01'].shape[1])"], {}), "((3, self.data['CLFP_01'].shape[1]))\n", (575, 611), True, 'import numpy as np\n'), ((632, 644)...
# Copyright 2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
[ "nnabla.functions.transpose", "nnabla.functions.one_hot", "nnabla.parametric_functions.convolution", "nnabla.functions.log", "nnabla.parametric_functions.deconvolution", "nnabla.parametric_functions.batch_normalization", "nnabla.parameter_scope", "nnabla.functions.sum", "numpy.random.seed", "nnabl...
[((774, 791), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (788, 791), True, 'import numpy as np\n'), ((1222, 1233), 'nnabla.functions.relu', 'F.relu', (['out'], {}), '(out)\n', (1228, 1233), True, 'import nnabla.functions as F\n'), ((2692, 2720), 'nnabla.functions.transpose', 'F.transpose', (['x', '(...
import time import numpy as np import torch class Profiler: def __init__(self, dummy=False, device=None): self.events = [] self.dummy = dummy self.device = device if device != torch.device('cpu') else None self.log('start') def log(self, name): if self.dummy: ...
[ "numpy.diff", "torch.cuda.synchronize", "numpy.argsort", "torch.is_tensor", "gc.get_objects", "time.time", "torch.cuda.memory_summary", "torch.device" ]
[((1863, 1879), 'gc.get_objects', 'gc.get_objects', ([], {}), '()\n', (1877, 1879), False, 'import gc\n'), ((853, 873), 'numpy.diff', 'np.diff', (['event_times'], {}), '(event_times)\n', (860, 873), True, 'import numpy as np\n'), ((437, 472), 'torch.cuda.synchronize', 'torch.cuda.synchronize', (['self.device'], {}), '(...
""" WLS filter: Edge-preserving smoothing based onthe weightd least squares optimization framework, as described in Farbman, Fattal, Lischinski, and Szeliski, "Edge-Preserving Decompositions for Multi-Scale Tone and Detail Manipulation", ACM Transactions on Graphics, 27(3), August 2008. Given an input image IN, we see...
[ "numpy.abs", "numpy.reshape", "numpy.log", "numpy.diff", "cv2.imshow", "numpy.max", "numpy.array", "cv2.waitKey", "numpy.concatenate", "cv2.cvtColor", "numpy.pad", "scipy.sparse.spdiags", "cv2.imread" ]
[((1124, 1142), 'numpy.log', 'np.log', (['(IN + 1e-22)'], {}), '(IN + 1e-22)\n', (1130, 1142), True, 'import numpy as np\n'), ((1353, 1376), 'numpy.diff', 'np.diff', (['L'], {'n': '(1)', 'axis': '(0)'}), '(L, n=1, axis=0)\n', (1360, 1376), True, 'import numpy as np\n'), ((1468, 1508), 'numpy.pad', 'np.pad', (['dy', '((...
import numpy as np def place_mirror(im, x1, x2, y1, y2, mr): """ Place an image mr in specified locations of an image im. The edge locations in im where mr is to be placed are (x1,y1) and (x2,y2) Programmer --------- <NAME> (JHU/APL, 10/12/05) """ nxa = np.zeros(2) nya = np.zeros...
[ "numpy.flip", "numpy.zeros", "numpy.float", "numpy.min" ]
[((290, 301), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (298, 301), True, 'import numpy as np\n'), ((312, 323), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (320, 323), True, 'import numpy as np\n'), ((474, 485), 'numpy.min', 'np.min', (['nxa'], {}), '(nxa)\n', (480, 485), True, 'import numpy as np\n'), ...
# -*- coding: utf-8 -*- # # Testing module for ACME's `ParallelMap` interface # # Builtin/3rd party package imports from multiprocessing import Value import os import sys import pickle import shutil import inspect import subprocess import getpass import time import itertools import logging from typing import Type impo...
[ "acme.esi_cluster_setup", "scipy.signal.filtfilt", "acme.cluster_cleanup", "time.sleep", "numpy.array", "numpy.sin", "getpass.getuser", "acme.shared.is_slurm_node", "subprocess.Popen", "os.path.split", "numpy.linspace", "os.unlink", "pytest.mark.skipif", "os.path.expanduser", "numpy.roun...
[((663, 739), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(sys.platform == 'win32')"], {'reason': '"""Not running in Windows"""'}), "(sys.platform == 'win32', reason='Not running in Windows')\n", (681, 739), False, 'import pytest\n'), ((1951, 1966), 'acme.shared.is_slurm_node', 'is_slurm_node', ([], {}), '()\n', (19...
import numpy as np from numpy import log #Se define la función a integrar def f(x): return 1 / log(x) #Implementación del método de Simpson #Parámetros: #f es la función a integrar #a el límite inferior de la integral #b el límite superior de la integral #n el número de intervalos def simpson (f, a...
[ "numpy.log" ]
[((105, 111), 'numpy.log', 'log', (['x'], {}), '(x)\n', (108, 111), False, 'from numpy import log\n')]
from typing import List, Tuple import mlflow import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from interpret.glassbox import ExplainableBoostingClassifier, ExplainableBoostingRegressor from ..OEA_model import OEAModelInterface, ModelType, ExplanationType from ..modeling_ut...
[ "interpret.glassbox.ExplainableBoostingRegressor", "sklearn.model_selection.train_test_split", "interpret.glassbox.ExplainableBoostingClassifier", "numpy.concatenate", "pandas.concat", "mlflow.pyfunc.load_model", "mlflow.pyfunc.save_model", "mlflow.pyfunc.log_model" ]
[((8051, 8096), 'pandas.concat', 'pd.concat', (['[self.X_train, self.X_val]'], {'axis': '(0)'}), '([self.X_train, self.X_val], axis=0)\n', (8060, 8096), True, 'import pandas as pd\n'), ((8119, 8169), 'numpy.concatenate', 'np.concatenate', (['[self.y_train, self.y_val]'], {'axis': '(0)'}), '([self.y_train, self.y_val], ...
""" This module contains utility functions used in the example scripts. They are implemented separately because they use scipy and numpy and we want to remove external dependencies from within the core library. """ from __future__ import print_function from __future__ import unicode_literals from __future__ impo...
[ "numpy.clip", "numpy.abs", "numpy.ceil", "numpy.mean", "scipy.stats.t._ppf", "numpy.ones", "scipy.linalg.solve", "numpy.array", "numpy.zeros", "concept_formation.utils.mean", "numpy.sum", "scipy.stats.sem", "numpy.cumsum" ]
[((703, 728), 'numpy.cumsum', 'np.cumsum', (['a'], {'dtype': 'float'}), '(a, dtype=float)\n', (712, 728), True, 'import numpy as np\n'), ((1840, 1851), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1848, 1851), True, 'import numpy as np\n'), ((1865, 1875), 'numpy.ones', 'np.ones', (['n'], {}), '(n)\n', (1872, 1875)...
# -*- coding: UTF-8 -*- import numpy as np from numpy.testing import assert_array_almost_equal from spectral_clustering.spectral_embedding_ import spectral_embedding def assert_first_col_equal(maps): constant_vec = [1] * maps.shape[0] assert_array_almost_equal(maps[:, 0] / maps[0, 0], constant_vec) def test...
[ "spectral_clustering.spectral_embedding_.spectral_embedding", "numpy.array", "numpy.testing.assert_array_almost_equal" ]
[((245, 309), 'numpy.testing.assert_array_almost_equal', 'assert_array_almost_equal', (['(maps[:, 0] / maps[0, 0])', 'constant_vec'], {}), '(maps[:, 0] / maps[0, 0], constant_vec)\n', (270, 309), False, 'from numpy.testing import assert_array_almost_equal\n'), ((414, 516), 'numpy.array', 'np.array', (['[[0.0, 0.8, 0.9,...
"""Transformer from 'Attention is all you need' (Vaswani et al., 2017)""" # Reference: https://www.tensorflow.org/text/tutorials/transformer # Reference: https://keras.io/examples/nlp/text_classification_with_transformer/ import numpy as np import tensorflow as tf class Transformer(tf.keras.Model): def __init__(...
[ "tensorflow.shape", "tensorflow.transpose", "tensorflow.keras.layers.Dense", "tensorflow.nn.softmax", "numpy.sin", "tensorflow.cast", "numpy.arange", "tensorflow.math.minimum", "tensorflow.math.sqrt", "tensorflow.matmul", "tensorflow.math.equal", "tensorflow.maximum", "tensorflow.keras.layer...
[((11454, 11481), 'numpy.sin', 'np.sin', (['angle_rads[:, 0::2]'], {}), '(angle_rads[:, 0::2])\n', (11460, 11481), True, 'import numpy as np\n'), ((11558, 11585), 'numpy.cos', 'np.cos', (['angle_rads[:, 1::2]'], {}), '(angle_rads[:, 1::2])\n', (11564, 11585), True, 'import numpy as np\n'), ((11645, 11684), 'tensorflow....
""" Script for analyzing model's performance """ import argparse import sys import collections import yaml import tensorflow as tf import tqdm import numpy as np import net.data import net.ml import net.utilities def report_iou_results(categories_intersections_counts_map, categories_unions_counts_map): """ ...
[ "numpy.mean", "argparse.ArgumentParser", "numpy.logical_and", "tensorflow.keras.backend.get_session", "numpy.logical_or", "yaml.safe_load", "numpy.sum", "collections.defaultdict" ]
[((3250, 3279), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (3273, 3279), False, 'import collections\n'), ((3315, 3344), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (3338, 3344), False, 'import collections\n'), ((4322, 4347), 'argparse.Argument...
import os import numpy as np import tensorflow as tf from PIL import Image def modcrop(im, modulo): if len(im.shape) == 3: size = np.array(im.shape) size = size - (size % modulo) im = im[0 : size[0], 0 : size[1], :] elif len(im.shape) == 2: size = np.array(im.shape) size = size - (size % modulo) im = im...
[ "numpy.log10", "numpy.asfarray", "numpy.array", "numpy.arange", "numpy.mean", "os.listdir", "tensorflow.placeholder", "tensorflow.Session", "numpy.asarray", "tensorflow.GraphDef", "tensorflow.ConfigProto", "numpy.maximum", "tensorflow.device", "numpy.squeeze", "tensorflow.import_graph_de...
[((971, 989), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (981, 989), False, 'import os\n'), ((1021, 1081), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[1, None, None, 3]'], {'name': '"""im_input"""'}), "('float', [1, None, None, 3], name='im_input')\n", (1035, 1081), True, 'import ten...
import sql as sql import streamlit as st from streamlit_folium import folium_static import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import json import sys import folium import requests from bs4 import BeautifulSoup import csv from tqdm import tqdm import webbrowser import os.path as osp import...
[ "pandas.read_csv", "zipfile.ZipFile", "streamlit.echo", "matplotlib.pyplot.ylabel", "streamlit.button", "numpy.array", "streamlit.title", "matplotlib.pyplot.xlabel", "folium.Map", "folium.plugins.MarkerCluster", "csv.reader", "streamlit.write", "requests.get", "seaborn.lineplot", "stream...
[((438, 468), 'streamlit.echo', 'st.echo', ([], {'code_location': '"""below"""'}), "(code_location='below')\n", (445, 468), True, 'import streamlit as st\n'), ((503, 563), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""2019-20-fullyr-data_sa_crime.csv.zip"""', '"""r"""'], {}), "('2019-20-fullyr-data_sa_crime.csv.zip', 'r'...
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Created by <NAME> (<EMAIL>) Anisotropy data analysis The equation for the curve as published by Marchand et al. in Nature Cell Biology in 2001 is as follows: y = a + (b-a) / [(c(x+K)/K*d)+1], where a is the anisotropy without protein, b...
[ "scipy.optimize.curve_fit", "pathlib.Path", "inspect.currentframe", "matplotlib.pyplot.close", "numpy.array", "numpy.linspace", "matplotlib.pyplot.subplots" ]
[((1092, 1143), 'numpy.array', 'np.array', (['[100, 50, 25, 12.5, 6.25, 3.125, 1.56, 0]'], {}), '([100, 50, 25, 12.5, 6.25, 3.125, 1.56, 0])\n', (1100, 1143), True, 'import numpy as np\n'), ((1153, 1216), 'numpy.array', 'np.array', (['[0.179, 0.186, 0.19, 0.195, 0.2, 0.212, 0.222, 0.248]'], {}), '([0.179, 0.186, 0.19, ...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "numpy.clip", "common.actor_critic.ActorNetwork", "common.replay_buffer.ReplayBuffer", "common.actor_critic.CriticNetwork", "numpy.random.randn" ]
[((1489, 1747), 'common.actor_critic.ActorNetwork', 'ActorNetwork', ([], {'sess': 'sess', 'state_dim': 'state_dim', 'action_dim': 'self.action_dim', 'action_high': 'self.action_high', 'action_low': 'self.action_low', 'learning_rate': 'config.actor_lr', 'grad_norm_clip': 'config.grad_norm_clip', 'tau': 'config.tau', 'ba...
import numpy as np import GPy from .GP_interface import GPInterface, convert_lengthscale, convert_2D_format class GPyWrapper(GPInterface): def __init__(self): # GPy settings GPy.plotting.change_plotting_library("matplotlib") # use matpoltlib for drawing super().__init__() self.cen...
[ "numpy.clip", "numpy.sqrt", "numpy.isscalar", "numpy.ones", "GPy.kern.RBF", "GPy.plotting.change_plotting_library", "numpy.square", "numpy.array", "GPy.models.GPClassification", "GPy.kern.Matern52", "GPy.kern.Bias", "numpy.stack", "numpy.concatenate", "GPy.priors.Gamma.from_EV", "numpy.l...
[((10112, 10136), 'numpy.isscalar', 'np.isscalar', (['lengthscale'], {}), '(lengthscale)\n', (10123, 10136), True, 'import numpy as np\n'), ((10773, 10792), 'numpy.square', 'np.square', (['(X / 10.0)'], {}), '(X / 10.0)\n', (10782, 10792), True, 'import numpy as np\n'), ((197, 247), 'GPy.plotting.change_plotting_librar...
from numpy import zeros, ones, dot, sum, abs, max, argmax, clip, \ random, prod, asarray, set_printoptions, unravel_index # Generate a random uniform number (array) in range [0,1]. def zero(*shape): return zeros(shape) def randnorm(*shape): return random.normal(size=shape) def randuni(*shape): return random.ran...
[ "numpy.random.normal", "numpy.prod", "numpy.abs", "numpy.ones", "numpy.random.random", "itertools.product", "numpy.asarray", "numpy.argmax", "numpy.max", "numpy.sum", "numpy.dot", "numpy.zeros", "numpy.random.randint", "numpy.unravel_index", "numpy.random.seed", "util.plot.Plot", "nu...
[((214, 226), 'numpy.zeros', 'zeros', (['shape'], {}), '(shape)\n', (219, 226), False, 'from numpy import zeros, ones, dot, sum, abs, max, argmax, clip, random, prod, asarray, set_printoptions, unravel_index\n'), ((256, 281), 'numpy.random.normal', 'random.normal', ([], {'size': 'shape'}), '(size=shape)\n', (269, 281),...
''' Algorithm for matching the model to image points. Based on (Cootes et al. 2000, p.9) and (Blanz et al., p.4). ''' import numpy as np from utils.structure import Shape from utils.align import Aligner class Fitter(object): def __init__(self, pdmodel): self.pdmodel = pdmodel self.aligner = Align...
[ "utils.align.Aligner", "numpy.diag", "utils.structure.Shape", "numpy.linalg.svd", "numpy.zeros_like" ]
[((315, 324), 'utils.align.Aligner', 'Aligner', ([], {}), '()\n', (322, 324), False, 'from utils.align import Aligner\n'), ((1480, 1548), 'numpy.linalg.svd', 'np.linalg.svd', (['self.pdmodel.scaled_eigenvectors'], {'full_matrices': '(False)'}), '(self.pdmodel.scaled_eigenvectors, full_matrices=False)\n', (1493, 1548), ...
import matplotlib matplotlib.use('Agg') # this lets us do some headless stuff import matplotlib.pylab as plt import numpy as np x = np.asarray([0,5,2]) y = np.asarray([0,1,3]) f = plt.figure() ax = f.add_subplot(111) ax.plot(x,y) #plt.show() # we have a headless display, can't do this! f.savefig('basicplot.eps',format...
[ "matplotlib.use", "numpy.asarray", "matplotlib.pylab.figure" ]
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((133, 154), 'numpy.asarray', 'np.asarray', (['[0, 5, 2]'], {}), '([0, 5, 2])\n', (143, 154), True, 'import numpy as np\n'), ((157, 178), 'numpy.asarray', 'np.asarray', (['[0, 1, 3]'], {}), '([0, 1...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from itertools import product from pathlib import Path import numpy as np import tensorflow as tf from dotenv import load_dotenv from annotation.direction import (Direction, get_diagonal_directions, get_cross_directions) from ...
[ "annotation.direction.get_cross_directions", "pathlib.Path", "tensorflow.placeholder", "os.environ.get", "numpy.squeeze", "annotation.piece.Piece", "numpy.empty", "annotation.direction.get_diagonal_directions", "numpy.all", "tensorflow.squeeze" ]
[((639, 668), 'os.environ.get', 'os.environ.get', (['"""DATA_FORMAT"""'], {}), "('DATA_FORMAT')\n", (653, 668), False, 'import os\n'), ((1280, 1311), 'numpy.empty', 'np.empty', (['shape'], {'dtype': 'np.int32'}), '(shape, dtype=np.int32)\n', (1288, 1311), True, 'import numpy as np\n'), ((1332, 1369), 'tensorflow.placeh...
import numpy as np import random as random def move_to_sample(Rover): delX = 0; delY = 0; if len(Rover.rock_angles) > 0: dist_to_rock = np.mean(np.abs(Rover.rock_dist)) angle_to_rock = np.mean(Rover.rock_angles); Rover.steer = np.clip(angle_to_rock* 180/np.pi, -15, 15) if Rove...
[ "numpy.clip", "numpy.mean", "numpy.abs", "numpy.diff", "numpy.random.randint" ]
[((211, 237), 'numpy.mean', 'np.mean', (['Rover.rock_angles'], {}), '(Rover.rock_angles)\n', (218, 237), True, 'import numpy as np\n'), ((261, 306), 'numpy.clip', 'np.clip', (['(angle_to_rock * 180 / np.pi)', '(-15)', '(15)'], {}), '(angle_to_rock * 180 / np.pi, -15, 15)\n', (268, 306), True, 'import numpy as np\n'), (...
######################################## # CS/CNS/EE 155 2018 # Problem Set 1 # # Author: <NAME> # Description: Set 1 Perceptron helper ######################################## import numpy as np import matplotlib.pyplot as plt def predict(x, w, b): ''' The method takes the weight vector and bias of a...
[ "numpy.dot" ]
[((663, 675), 'numpy.dot', 'np.dot', (['w', 'x'], {}), '(w, x)\n', (669, 675), True, 'import numpy as np\n')]
from models import StandardHMM, DenseHMM, HMMLoggingMonitor from utils import prepare_data, check_random_state, create_directories, dict_get, Timer, timestamp_msg, check_dir, is_multinomial, compute_stationary, check_sequences from data import penntreebank_tag_sequences, protein_sequences, train_test_split from datet...
[ "data.penntreebank_tag_sequences", "numpy.sqrt", "utils.is_multinomial", "copy.deepcopy", "models.HMMLoggingMonitor", "numpy.save", "utils.Timer", "numpy.max", "utils.compute_stationary", "utils.check_sequences", "data.protein_sequences", "numpy.ones", "data.train_test_split", "numpy.aroun...
[((571, 578), 'utils.Timer', 'Timer', ([], {}), '()\n', (576, 578), False, 'from utils import prepare_data, check_random_state, create_directories, dict_get, Timer, timestamp_msg, check_dir, is_multinomial, compute_stationary, check_sequences\n'), ((627, 648), 'utils.prepare_data', 'prepare_data', (['train_X'], {}), '(...
import sys sys.path.append('./train_model') import torch import torch.nn as nn import torch.nn.functional as F import torchvision import torchvision.transforms as transforms import numpy as np import os import argparse parser = argparse.ArgumentParser(description='Adaptive Network Slimming') parser.add_argument('-n...
[ "numpy.ones", "argparse.ArgumentParser", "torch.load", "numpy.sort", "torch.max", "numpy.floor", "torch.from_numpy", "numpy.count_nonzero", "torchvision.datasets.CIFAR10", "numpy.zeros", "torchvision.transforms.Normalize", "torch.utils.data.DataLoader", "torch.no_grad", "torchvision.transf...
[((12, 44), 'sys.path.append', 'sys.path.append', (['"""./train_model"""'], {}), "('./train_model')\n", (27, 44), False, 'import sys\n'), ((232, 296), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Adaptive Network Slimming"""'}), "(description='Adaptive Network Slimming')\n", (255, 296)...
## @class IntraCodec # Module designed for encoding and decoding YUV videos using the intra-frame method # That is considering adjacent pixels in the same frame and encoding their errors # @author <NAME> 89005 # @author <NAME> 89262 import numpy as np import math from Golomb import * from Bitstream import * class In...
[ "math.floor", "math.log", "numpy.zeros", "numpy.array_equal", "numpy.frombuffer", "numpy.seterr" ]
[((1042, 1066), 'numpy.seterr', 'np.seterr', ([], {'over': '"""ignore"""'}), "(over='ignore')\n", (1051, 1066), True, 'import numpy as np\n'), ((3174, 3203), 'math.log', 'math.log', (['self.golombParam', '(2)'], {}), '(self.golombParam, 2)\n', (3182, 3203), False, 'import math\n'), ((3503, 3545), 'numpy.zeros', 'np.zer...
import os import numpy as np import pytest from spectrum_overload import Spectrum from mingle.utilities.spectrum_utils import load_spectrum, select_observation @pytest.mark.parametrize("fname", ["HD30501-1-mixavg-tellcorr_1.fits", "HD30501-1-mixavg-h2otellcorr_1.fits"]) def test_load_spectrum(fname): fname = os...
[ "pytest.mark.xfail", "mingle.utilities.spectrum_utils.select_observation", "os.path.join", "mingle.utilities.spectrum_utils.load_spectrum", "pytest.mark.parametrize", "pytest.raises", "numpy.all" ]
[((165, 278), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""fname"""', "['HD30501-1-mixavg-tellcorr_1.fits', 'HD30501-1-mixavg-h2otellcorr_1.fits']"], {}), "('fname', ['HD30501-1-mixavg-tellcorr_1.fits',\n 'HD30501-1-mixavg-h2otellcorr_1.fits'])\n", (188, 278), False, 'import pytest\n'), ((803, 852), '...
import numpy as np from mldftdat.pyscf_utils import * from mldftdat.workflow_utils import safe_mem_cap_mb from pyscf.dft.numint import eval_ao, make_mask from mldftdat.density import LDA_FACTOR,\ contract21_deriv, contract21, GG_AMIN def dtauw(rho_data): return - get_gradient_magnitud...
[ "numpy.sqrt", "mldftdat.density.contract21_deriv", "numpy.exp", "numpy.zeros", "numpy.einsum", "mldftdat.density.contract21" ]
[((1313, 1345), 'numpy.zeros', 'np.zeros', (['(4, rho_data.shape[1])'], {}), '((4, rho_data.shape[1]))\n', (1321, 1345), True, 'import numpy as np\n'), ((2617, 2642), 'numpy.zeros', 'np.zeros', (['v_npalpha.shape'], {}), '(v_npalpha.shape)\n', (2625, 2642), True, 'import numpy as np\n'), ((3994, 4023), 'numpy.exp', 'np...
import numpy as np import WDRT.ESSC as ESSC import copy import matplotlib.pyplot as plt # Create buoy object, in this case for Station #46022 buoy46022 = ESSC.Buoy('46022', 'NDBC') # Read data from ndbc.noaa.gov #buoy46022.fetchFromWeb() #buoy46022.saveAsTxt(savePath = "./Data") #buoy46022.saveAsH5('NDBC46022.h5') #...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "WDRT.ESSC.ClaytonCopula", "numpy.array", "WDRT.ESSC.BivariateKDE", "copy.deepcopy", "WDRT.ESSC.NonParaGumbelCopula", "numpy.arange", "numpy.where", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "WDRT.ESSC.Buoy", "WDRT.ESSC.Gumbel...
[((155, 181), 'WDRT.ESSC.Buoy', 'ESSC.Buoy', (['"""46022"""', '"""NDBC"""'], {}), "('46022', 'NDBC')\n", (164, 181), True, 'import WDRT.ESSC as ESSC\n'), ((686, 705), 'WDRT.ESSC.PCA', 'ESSC.PCA', (['buoy46022'], {}), '(buoy46022)\n', (694, 705), True, 'import WDRT.ESSC as ESSC\n'), ((993, 1051), 'numpy.array', 'np.arra...
import numpy as np import matplotlib.pyplot as plt # colors corresponding to initial flight, stance, second flight colors = ['k', 'b', 'g'] ### The attributes of sol are: ## sol.t : series of time-points at which the solution was calculated ## sol.y : simulation results, size 6 x times ## sol.t_events : list of t...
[ "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.argmax", "matplotlib.pyplot.axhline", "matplotlib.pyplot.figure", "matplotlib.pyplot.scatter", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.axvline",...
[((835, 891), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x_com[0]', 'y_com[0]'], {'color': 'colors[0]', 's': 'size'}), '(x_com[0], y_com[0], color=colors[0], s=size)\n', (846, 891), True, 'import matplotlib.pyplot as plt\n'), ((941, 1033), 'matplotlib.pyplot.plot', 'plt.plot', (['[foot_x, x_com[0]]', '[foot_y, y_co...
import numpy as np class perceptron(object): #eta learning rata #n_iter times def __init__(self,eta,n_iter): self.eta=eta self.n_iter=n_iter def fit(self,x,y): ''' x=ndarray(n_samples,n_features),training data y=ndarray(n_samples),labels returns se...
[ "matplotlib.pyplot.ylabel", "numpy.where", "numpy.random.choice", "matplotlib.pyplot.xlabel", "numpy.dot", "matplotlib.pyplot.scatter", "numpy.random.uniform", "pandas.DataFrame", "numpy.shape", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((1308, 1340), 'numpy.random.uniform', 'np.random.uniform', (['(6.0)', '(7.0)', '(150)'], {}), '(6.0, 7.0, 150)\n', (1325, 1340), True, 'import numpy as np\n'), ((1341, 1373), 'numpy.random.uniform', 'np.random.uniform', (['(2.0)', '(4.0)', '(150)'], {}), '(2.0, 4.0, 150)\n', (1358, 1373), True, 'import numpy as np\n'...
import numpy as np from typing import Any, Tuple, Dict import logging class NotDescentDirection(Exception): pass class ZeroDescentProduct(Exception): pass class ZeroUpdate(Exception): pass class Newton: def __init__(self, obj_func : Any, gradient_func : Any, reg_inv_hessi...
[ "logging.getLogger", "numpy.dot", "logging.StreamHandler" ]
[((505, 528), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (526, 528), False, 'import logging\n'), ((593, 620), 'logging.getLogger', 'logging.getLogger', (['"""l-bfgs"""'], {}), "('l-bfgs')\n", (610, 620), False, 'import logging\n'), ((953, 969), 'numpy.dot', 'np.dot', (['p', 'grads'], {}), '(p, ...
# Transfer functions and derivatives # Note _all_ transfer functions and derivatives _must_ accept keyword arguments # and handle the output keyword argument out=z correctly. # <NAME> import numpy as np import scipy.special #------------------------------------------------------------------------------- """ def sigv...
[ "numpy.copyto", "numpy.multiply", "numpy.empty_like", "numpy.subtract" ]
[((852, 878), 'numpy.subtract', 'np.subtract', (['(1.0)', 'y'], {'out': 'z'}), '(1.0, y, out=z)\n', (863, 878), True, 'import numpy as np\n'), ((880, 904), 'numpy.multiply', 'np.multiply', (['z', 'y'], {'out': 'z'}), '(z, y, out=z)\n', (891, 904), True, 'import numpy as np\n'), ((1125, 1154), 'numpy.copyto', 'np.copyto...
#------testing the trained model and ensemble weights on the test data to get the final accuracy #importing required libraries and modules import os import sys import cv2 import numpy as np from preprocess import Preprocess from data_split import Load from conv_net import CNN from ensemble import Ensemble ...
[ "numpy.array", "numpy.load", "conv_net.CNN", "ensemble.Ensemble" ]
[((865, 870), 'conv_net.CNN', 'CNN', ([], {}), '()\n', (868, 870), False, 'from conv_net import CNN\n'), ((1051, 1061), 'ensemble.Ensemble', 'Ensemble', ([], {}), '()\n', (1059, 1061), False, 'from ensemble import Ensemble\n'), ((1526, 1536), 'ensemble.Ensemble', 'Ensemble', ([], {}), '()\n', (1534, 1536), False, 'from...