code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Copyright (c) 2018-2021 Intel 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 Unless required by applicable law or agreed to in wri...
[ "math.exp", "numpy.log", "numpy.argmax", "numpy.ndenumerate", "numpy.asarray", "numpy.argpartition", "numpy.finfo", "numpy.array", "itertools.groupby", "math.log" ]
[((18948, 18962), 'math.log', 'math.log', (['(10.0)'], {}), '(10.0)\n', (18956, 18962), False, 'import math\n'), ((26112, 26155), 'numpy.argpartition', 'np.argpartition', (['neg_scores', '(beam_width - 1)'], {}), '(neg_scores, beam_width - 1)\n', (26127, 26155), True, 'import numpy as np\n'), ((4126, 4140), 'numpy.log'...
import os import time import numpy as np import torch import torch.nn as nn from torch.autograd import Variable from . import logger as log from . import resnet as models from . import utils try: from apex.parallel import DistributedDataParallel as DDP from apex.fp16_utils import * from apex import amp exc...
[ "torch.distributed.is_initialized", "torch.cuda.synchronize", "torch.distributed.get_rank", "torch.autograd.Variable", "numpy.log2", "time.time", "apex.amp.scale_loss", "apex.parallel.DistributedDataParallel", "torch.distributed.get_world_size", "torch.zeros", "numpy.cos", "torch.no_grad", "...
[((7419, 7430), 'time.time', 'time.time', ([], {}), '()\n', (7428, 7430), False, 'import time\n'), ((10090, 10101), 'time.time', 'time.time', ([], {}), '()\n', (10099, 10101), False, 'import time\n'), ((1417, 1432), 'apex.parallel.DistributedDataParallel', 'DDP', (['self.model'], {}), '(self.model)\n', (1420, 1432), Tr...
import numpy as np import pandas as pd import matplotlib.pyplot as plt #task1 #Write a Python program to draw a line with suitable label in the x axis, y axis and a title. data=np.arange(12) plt.plot(data) plt.title("X and Y graph") plt.xlabel("X values") plt.ylabel("Y values") plt.show() #task2 #Write a Python prog...
[ "matplotlib.pyplot.title", "pandas.DataFrame", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.scatter", "numpy.arange", "pandas.Series", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid" ]
[((179, 192), 'numpy.arange', 'np.arange', (['(12)'], {}), '(12)\n', (188, 192), True, 'import numpy as np\n'), ((193, 207), 'matplotlib.pyplot.plot', 'plt.plot', (['data'], {}), '(data)\n', (201, 207), True, 'import matplotlib.pyplot as plt\n'), ((208, 234), 'matplotlib.pyplot.title', 'plt.title', (['"""X and Y graph"...
import logging import os import sys import tempfile from collections import OrderedDict import numpy as np import torch import torch.nn as nn import torch.optim as optim from torchnlp.encoders import LabelEncoder import mlprogram.nn import mlprogram.nn.nl2code as nl2code from mlprogram.builtins import Apply, Pick fro...
[ "mlprogram.nn.action_sequence.Loss", "mlprogram.utils.data.CollateOptions", "numpy.allclose", "torchnlp.encoders.LabelEncoder", "test_integration.nl2code_dummy_dataset.Parser", "os.path.join", "mlprogram.entrypoint.train.Epoch", "tempfile.TemporaryDirectory", "mlprogram.transforms.action_sequence.En...
[((1317, 1387), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'stream': 'sys.stdout', 'force': '(True)'}), '(level=logging.INFO, stream=sys.stdout, force=True)\n', (1336, 1387), False, 'import logging\n'), ((1481, 1509), 'mlprogram.utils.data.get_words', 'get_words', (['dataset', 'tokeniz...
#exercice de TD #EVITER LES ACCENTS DANS LES NOMS DES FONCTIONS ET DES VARIABLES #question 1 print("\n") ; print("question 1") ; print("\n") import random class Proie: def __init__(self): self.age = random.randint(1,2000) # gérère un entier aléatoire entre 1 et 2000 self.signal_reproductio...
[ "matplotlib.pyplot.show", "random.randint", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.array" ]
[((10220, 10246), 'numpy.array', 'np.array', (['self.liste_temps'], {}), '(self.liste_temps)\n', (10228, 10246), True, 'import numpy as np\n'), ((10711, 10732), 'numpy.array', 'np.array', (['Y_nb_proies'], {}), '(Y_nb_proies)\n', (10719, 10732), True, 'import numpy as np\n'), ((10754, 10779), 'numpy.array', 'np.array',...
import random import numpy as np from utils import mkdir, scan_folder, scan_file, cropImg, drawBoxes import os def get_train_test_list(dataset_path = "dataset_sorted_aug/", testdata_amount = 500): # dataset_path = "dataset_sorted/" # testdata_amount = 500 subfolder_list = scan_folder(dataset_path) sam...
[ "utils.scan_folder", "numpy.setdiff1d", "utils.scan_file", "os.path.exists", "numpy.arange", "random.seed", "numpy.array" ]
[((287, 312), 'utils.scan_folder', 'scan_folder', (['dataset_path'], {}), '(dataset_path)\n', (298, 312), False, 'from utils import mkdir, scan_folder, scan_file, cropImg, drawBoxes\n'), ((1224, 1243), 'numpy.array', 'np.array', (['indexList'], {}), '(indexList)\n', (1232, 1243), True, 'import numpy as np\n'), ((520, 5...
#Creates a UVJ diagram split by good, low, and bad measurements for specified lines import numpy as np import matplotlib.pyplot as plt from astropy.io import ascii import sys, os, string import pandas as pd from astropy.io import fits import collections from astropy.cosmology import WMAP9 as cosmo from astropy.stats im...
[ "numpy.logical_or.reduce", "astropy.io.ascii.read", "numpy.logical_and", "matplotlib.pyplot.close", "pandas.merge", "numpy.logical_not", "numpy.logical_and.reduce", "numpy.not_equal", "numpy.where", "matplotlib.pyplot.subplots", "astropy.cosmology.WMAP9.luminosity_distance" ]
[((1717, 1745), 'pandas.merge', 'pd.merge', (['fluxdata', 'sprop_df'], {}), '(fluxdata, sprop_df)\n', (1725, 1745), True, 'import pandas as pd\n'), ((2456, 2488), 'numpy.logical_and.reduce', 'np.logical_and.reduce', (['goodlines'], {}), '(goodlines)\n', (2477, 2488), True, 'import numpy as np\n'), ((2598, 2628), 'numpy...
import numpy as np from pandas import DataFrame from pandas.api.types import is_numeric_dtype def delete_outlier( df: DataFrame, lower_limit: float=0.01, upper_limit: float=0.99, random_noise_name: str='random_noise' ) -> DataFrame: '''Select data between the lower_limit (percentage) a...
[ "numpy.logical_and", "pandas.api.types.is_numeric_dtype" ]
[((416, 444), 'pandas.api.types.is_numeric_dtype', 'is_numeric_dtype', (['df[column]'], {}), '(df[column])\n', (432, 444), False, 'from pandas.api.types import is_numeric_dtype\n'), ((797, 875), 'numpy.logical_and', 'np.logical_and', (['(values >= lower_limits[column])', '(values <= upper_limits[column])'], {}), '(valu...
# -*- coding: utf-8 -*- """ make summary figures for within/between network connectivity vs expression - ultimately this was not used for the figures, but was used to make the inputs to the R program used for the figures (mk_bwcorr_expression_figure.R) Created on Sun Jun 21 18:03:58 2015 @author: poldrack """ import...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "numpy.zeros", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.text", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.tick_params", "os.path.join" ]
[((860, 881), 'numpy.zeros', 'numpy.zeros', (['(12, 63)'], {}), '((12, 63))\n', (871, 881), False, 'import numpy\n'), ((891, 912), 'numpy.zeros', 'numpy.zeros', (['(12, 63)'], {}), '((12, 63))\n', (902, 912), False, 'import numpy\n'), ((1339, 1360), 'numpy.zeros', 'numpy.zeros', (['(66, 63)'], {}), '((66, 63))\n', (135...
import numpy as np import torch import re alphabet = re.compile(r'^[a-zA-Z]+$') from copy import copy from collections import defaultdict def build_graph(matrix): graph = defaultdict(list) for idx in range(0, len(matrix)): for col in range(idx+1, len(matrix)): graph[idx].append((col, ma...
[ "copy.copy", "collections.defaultdict", "transformers.AutoTokenizer.from_pretrained", "numpy.array", "en_core_web_sm.load", "transformers.BertModel.from_pretrained", "re.compile" ]
[((54, 79), 're.compile', 're.compile', (['"""^[a-zA-Z]+$"""'], {}), "('^[a-zA-Z]+$')\n", (64, 79), False, 'import re\n'), ((178, 195), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (189, 195), False, 'from collections import defaultdict\n'), ((4099, 4119), 'numpy.array', 'np.array', (['new_matr...
from matplotlib import pyplot as plt import numpy as np import pandas as pd from multipledispatch import dispatch from .HubSIS import HubSIS from Eir.utility import Person import Eir.utility as u from Eir.DTMC.spatialModel.simul_details import Simul_Details class HubSIR(HubSIS): """ Hub Mode...
[ "numpy.stack", "pandas.DataFrame", "matplotlib.pyplot.show", "Eir.utility.Person", "numpy.zeros", "numpy.random.random", "numpy.linspace", "Eir.utility.randEvent", "matplotlib.pyplot.subplots" ]
[((3970, 3988), 'numpy.zeros', 'np.zeros', (['(days + 1)'], {}), '(days + 1)\n', (3978, 3988), True, 'import numpy as np\n'), ((9652, 9692), 'numpy.linspace', 'np.linspace', (['(0)', 'self.days', '(self.days + 1)'], {}), '(0, self.days, self.days + 1)\n', (9663, 9692), True, 'import numpy as np\n'), ((9725, 9760), 'mat...
#from dask_jobqueue import SLURMCluster from dask.distributed import Client from dask.distributed import wait import sys import dask import numpy as np import xarray as xr import glob import matplotlib.pyplot as plt import time from dask.distributed import as_completed def aggregateOneDayData(z): print("enter agg...
[ "matplotlib.pyplot.title", "dask.distributed.Client", "xarray.open_dataset", "numpy.zeros", "matplotlib.pyplot.colorbar", "time.time", "dask.distributed.as_completed", "matplotlib.pyplot.figure", "numpy.where", "numpy.array", "xarray.DataArray", "glob.glob", "matplotlib.pyplot.ylabel", "ma...
[((1237, 1257), 'numpy.zeros', 'np.zeros', (['(180, 360)'], {}), '((180, 360))\n', (1245, 1257), True, 'import numpy as np\n'), ((1274, 1294), 'numpy.zeros', 'np.zeros', (['(180, 360)'], {}), '((180, 360))\n', (1282, 1294), True, 'import numpy as np\n'), ((2283, 2299), 'xarray.DataArray', 'xr.DataArray', (['cf'], {}), ...
# -*- coding: utf-8 -*- """ Created on Wed Sep 11 01:26:31 2019 @author: f.divruno """ import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import os as os import astropy.units as u #%% Functions def import_data(directory,planes,sats,idx=0): files = os.listdir(directory) #...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.savefig", "numpy.load", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.zeros", "matplotlib.pyplot.draw", "matplotlib.pyplot.figure", "numpy.where", "numpy.array", "numpy.max", "numpy.mean", "matplotlib.tri.Triangulation", "matplotl...
[((297, 318), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (307, 318), True, 'import os as os\n'), ((1683, 1695), 'numpy.array', 'np.array', (['el'], {}), '(el)\n', (1691, 1695), True, 'import numpy as np\n'), ((1704, 1716), 'numpy.array', 'np.array', (['az'], {}), '(az)\n', (1712, 1716), True, 'im...
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
[ "numpy.zeros_like", "numpy.sum", "numpy.copy", "skimage.morphology.dilation", "multiprocessing.dummy.Pool", "skimage.io.imread", "SimpleITK.ReadImage", "SimpleITK.GetArrayFromImage", "skimage.morphology.erosion", "numpy.max", "skimage.transform.resize", "numpy.array", "SimpleITK.GetImageFrom...
[((1264, 1280), 'skimage.io.imread', 'imread', (['img_file'], {}), '(img_file)\n', (1270, 1280), False, 'from skimage.io import imread\n'), ((2029, 2123), 'skimage.transform.resize', 'resize', (['ball_iso', 'n', '(1)', '"""constant"""', '(0)'], {'clip': '(True)', 'anti_aliasing': '(False)', 'preserve_range': '(True)'})...
""" StarGAN v2 Copyright (c) 2020-present NAVER Corp. This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, US...
[ "munch.Munch", "copy.deepcopy", "torch.nn.ReLU", "torch.stack", "math.sqrt", "torch.nn.ModuleList", "torch.nn.Sequential", "torch.nn.functional.avg_pool2d", "numpy.log2", "torch.nn.Conv2d", "core.wing.FAN", "torch.nn.InstanceNorm2d", "torch.nn.functional.interpolate", "torch.cuda.is_availa...
[((9918, 9942), 'copy.deepcopy', 'copy.deepcopy', (['generator'], {}), '(generator)\n', (9931, 9942), False, 'import copy\n'), ((9969, 9999), 'copy.deepcopy', 'copy.deepcopy', (['mapping_network'], {}), '(mapping_network)\n', (9982, 9999), False, 'import copy\n'), ((10024, 10052), 'copy.deepcopy', 'copy.deepcopy', (['s...
""" Test the base_masker module """ import numpy as np from numpy.testing import assert_array_almost_equal import nibabel from nilearn.input_data.base_masker import filter_and_mask from nilearn import image from nilearn._utils.testing import assert_raises_regex def test_cropping_code_paths(): # Will mask data w...
[ "nibabel.Nifti1Image", "nilearn.input_data.base_masker.filter_and_mask", "numpy.zeros", "numpy.random.RandomState", "nilearn._utils.testing.assert_raises_regex", "numpy.eye", "numpy.testing.assert_array_almost_equal", "nilearn.image.crop_img" ]
[((423, 448), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (444, 448), True, 'import numpy as np\n'), ((460, 485), 'numpy.zeros', 'np.zeros', (['[20, 30, 40, 5]'], {}), '([20, 30, 40, 5])\n', (468, 485), True, 'import numpy as np\n'), ((562, 571), 'numpy.eye', 'np.eye', (['(4)'], {}), ...
# Filename: ops.py # License: LICENSES/LICENSE_UVIC_EPFL import numpy as np from tf_utils import gcn # From: https://github.com/shaohua0116/Group-Normalization-Tensorflow/blob/master/ops.py def norm(x, norm_type, is_train, G=32, esp=1e-5): # import tensorflow as tf with tf.variable_scope('{}_norm'.format(...
[ "tensorflow.nn.moments", "tensorflow.constant_initializer", "tensorflow.reshape", "tensorflow.variable_scope", "tensorflow.zeros_like", "numpy.mod", "tensorflow.stack", "tensorflow.transpose", "tensorflow.shape", "tensorflow.nn.conv2d", "tensorflow.zeros_initializer", "tensorflow.sqrt", "ten...
[((2124, 2146), 'tensorflow.zeros_like', 'tf.zeros_like', (['v[:, 0]'], {}), '(v[:, 0])\n', (2137, 2146), True, 'import tensorflow as tf\n'), ((2156, 2254), 'tensorflow.stack', 'tf.stack', (['[zero, -v[:, 2], v[:, 1], v[:, 2], zero, -v[:, 0], -v[:, 1], v[:, 0], zero]'], {'axis': '(1)'}), '([zero, -v[:, 2], v[:, 1], v[:...
#!/usr/bin/env python # coding: utf-8 # # Borehole Database # # # It is no surprise that the core of a data-driven project is data. Data which is organized in a specific manner, so that users can easily access, analyse, and manipulate data. Many different schemes exist, in which data can be organized, with a most ...
[ "sys.path.append", "seaborn.set_style", "numpy.abs", "matplotlib.cm.get_cmap", "matplotlib.pyplot.scatter", "db_access.connect", "db_access.get_columns", "scipy.stats.gaussian_kde", "seaborn.set_context", "sklearn.linear_model.LinearRegression", "matplotlib.pyplot.figure", "pandas.read_sql_que...
[((5108, 5131), 'seaborn.set_context', 'sns.set_context', (['"""talk"""'], {}), "('talk')\n", (5123, 5131), True, 'import seaborn as sns\n'), ((5132, 5154), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {}), "('ticks')\n", (5145, 5154), True, 'import seaborn as sns\n'), ((5286, 5323), 'sys.path.append', 'sys....
import sympy as sp # import scipy as scp import numpy as np import pylab as plt from sympy import cos, sin from sympy.physics.mechanics import dynamicsymbols from pydy.codegen.ode_function_generators import generate_ode_function from util import coordinate_limiting_force, coriolis_matrix, \ apply_generalized_force,...
[ "sympy.symbols", "sympy.physics.mechanics.dynamicsymbols", "util.coordinate_limiting_force", "logger.Logger", "sympy.Rational", "sympy.sin", "numpy.deg2rad", "sympy.diff", "sympy.cos", "sympy.trigsimp", "sympy.Matrix", "sympy.diag", "pylab.subplots", "numpy.random.random", "functools.red...
[((1928, 1946), 'logger.Logger', 'Logger', (['"""ArmModel"""'], {}), "('ArmModel')\n", (1934, 1946), False, 'from logger import Logger\n'), ((4233, 4248), 'sympy.symbols', 'sp.symbols', (['"""t"""'], {}), "('t')\n", (4243, 4248), True, 'import sympy as sp\n'), ((4284, 4299), 'sympy.symbols', 'sp.symbols', (['"""g"""'],...
#!/usr/bin/env python """Script to run partial correlation of arbitrary data and target RDMs""" import argparse import numpy as np import os import os.path as op import pandas as pd from mvpa2.datasets import niml, Dataset from famfaceangles.mvpa import pcorr, corr def make_symmetric(ds, correlation=True, diagonal=Fa...
[ "mvpa2.datasets.niml.write", "os.path.abspath", "mvpa2.datasets.Dataset", "numpy.arctanh", "argparse.ArgumentParser", "numpy.nan_to_num", "os.makedirs", "numpy.tanh", "pandas.read_csv", "os.path.dirname", "mvpa2.datasets.niml.read", "os.path.exists", "numpy.arange", "numpy.triu_indices_fro...
[((1840, 1864), 'pandas.concat', 'pd.concat', (['preds'], {'axis': '(1)'}), '(preds, axis=1)\n', (1849, 1864), True, 'import pandas as pd\n'), ((2017, 2033), 'mvpa2.datasets.niml.read', 'niml.read', (['ds_fn'], {}), '(ds_fn)\n', (2026, 2033), False, 'from mvpa2.datasets import niml, Dataset\n'), ((2444, 2474), 'mvpa2.d...
#!/usr/bin/env python3 # encoding: utf-8 """ @Funciton: 同态滤波 @Python Version: 3.8 @Author: <NAME> @Date: 2021-10-22 """ import sys import numpy as np import cv2 as cv def fft2Image(src): rows, cols = src.shape[:2] # 获取快速傅里叶变换的最优扩充 row_padding = cv.getOptimalDFTSize(rows) col_padding = cv.getOptimal...
[ "numpy.log", "numpy.copy", "cv2.waitKey", "numpy.power", "cv2.destroyAllWindows", "numpy.zeros", "cv2.getOptimalDFTSize", "cv2.imread", "numpy.min", "numpy.max", "cv2.dft", "numpy.exp", "cv2.minMaxLoc", "cv2.imshow", "sys.exit", "numpy.sqrt" ]
[((262, 288), 'cv2.getOptimalDFTSize', 'cv.getOptimalDFTSize', (['rows'], {}), '(rows)\n', (282, 288), True, 'import cv2 as cv\n'), ((307, 333), 'cv2.getOptimalDFTSize', 'cv.getOptimalDFTSize', (['cols'], {}), '(cols)\n', (327, 333), True, 'import cv2 as cv\n'), ((378, 429), 'numpy.zeros', 'np.zeros', (['(row_padding, ...
import sys import tensorflow as tf import skimage.transform from skimage.color import rgb2gray, gray2rgb from skimage.io import imsave, imread from matplotlib import pyplot as plt import numpy as np import glob filenames = sorted(glob.glob("pics/*.jpg")) def load_image(path): img = imread(path) # crop image f...
[ "skimage.color.rgb2gray", "numpy.zeros", "numpy.max", "matplotlib.pyplot.imsave", "glob.glob", "skimage.color.gray2rgb", "skimage.io.imread" ]
[((231, 254), 'glob.glob', 'glob.glob', (['"""pics/*.jpg"""'], {}), "('pics/*.jpg')\n", (240, 254), False, 'import glob\n'), ((289, 301), 'skimage.io.imread', 'imread', (['path'], {}), '(path)\n', (295, 301), False, 'from skimage.io import imsave, imread\n'), ((866, 882), 'numpy.max', 'np.max', (['[ha, hb]'], {}), '([h...
import timeit import numpy as np from ..image_util import gaussian_blur_gray_image_nz from .prob_abs_r import ProbAbsoluteReflectance from .prob_abs_s import ProbAbsoluteShading xrange=range class IntrinsicEnergy(object): def __init__(self, input, params): self.input = input self.params = params...
[ "numpy.abs", "numpy.log", "numpy.ones_like", "timeit.default_timer", "numpy.zeros", "numpy.clip" ]
[((843, 901), 'numpy.zeros', 'np.zeros', (['(self.input.mask_nnz, nlabels)'], {'dtype': 'np.float32'}), '((self.input.mask_nnz, nlabels), dtype=np.float32)\n', (851, 901), True, 'import numpy as np\n'), ((612, 634), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (632, 634), False, 'import timeit\n'),...
import torch import torch.nn as nn import torch.nn.functional as F from python import magent from torch.distributions.categorical import Categorical import numpy as np class SumTree(object): def __init__(self, r, v, alpha): """ data = array of priority :param data: pos 0 no ele; ele from ...
[ "numpy.sum", "torch.cat", "torch.no_grad", "torch.distributions.categorical.Categorical", "torch.load", "torch.exp", "torch.nn.functional.log_softmax", "numpy.random.choice", "torch.nn.Linear", "torch.as_tensor", "torch.nn.functional.relu", "numpy.random.shuffle", "torch.mean", "torch.sum"...
[((561, 581), 'numpy.zeros', 'np.zeros', (['(2 * self.N)'], {}), '(2 * self.N)\n', (569, 581), True, 'import numpy as np\n'), ((10000, 10029), 'numpy.random.shuffle', 'np.random.shuffle', (['all_agents'], {}), '(all_agents)\n', (10017, 10029), True, 'import numpy as np\n'), ((10653, 10696), 'numpy.sum', 'np.sum', (['(a...
import numpy as np from scipy import sparse from spinsys.utils import timer from hamiltonians.triangular_lattice_model import hamiltonian Nx = 4 Ny = 4 N = Nx * Ny nstates = 1000 neigs = 15 spectra = np.empty((neigs, nstates)) t = timer.Timer(20) for col, J_ppmm in enumerate(np.linspace(0, 10, nstates)): H = hami...
[ "numpy.save", "spinsys.utils.timer.Timer", "numpy.empty", "scipy.sparse.linalg.eigsh", "hamiltonians.triangular_lattice_model.hamiltonian", "numpy.linspace" ]
[((202, 228), 'numpy.empty', 'np.empty', (['(neigs, nstates)'], {}), '((neigs, nstates))\n', (210, 228), True, 'import numpy as np\n'), ((233, 248), 'spinsys.utils.timer.Timer', 'timer.Timer', (['(20)'], {}), '(20)\n', (244, 248), False, 'from spinsys.utils import timer\n'), ((473, 530), 'numpy.save', 'np.save', (['"""...
import numpy as np import scipy from fastdtw import fastdtw import librosa import librosa.feature import librosa.effects # import soundfile as sf from params.params import Params as hp def load(path): """Load a sound file into numpy array.""" # data, sample_rate = sf.read(path) data, sample_rate = libros...
[ "numpy.sum", "librosa.feature.mfcc", "librosa.feature.inverse.mel_to_stft", "scipy.signal.lfilter", "librosa.stft", "librosa.load", "librosa.db_to_amplitude", "librosa.amplitude_to_db", "fastdtw.fastdtw", "librosa.feature.melspectrogram", "librosa.effects.trim", "librosa.griffinlim", "libros...
[((314, 351), 'librosa.load', 'librosa.load', (['path'], {'sr': 'hp.sample_rate'}), '(path, sr=hp.sample_rate)\n', (326, 351), False, 'import librosa\n'), ((1014, 1087), 'librosa.effects.trim', 'librosa.effects.trim', (['data'], {'top_db': 'top_db', 'frame_length': 'wf', 'hop_length': 'hf'}), '(data, top_db=top_db, fra...
import nltk import pdb #import zinc_grammar import numpy as np import h5py #import molecule_vae import GrammarVAE_grammar as zinc_grammar #f = open('data/250k_rndm_zinc_drugs_clean.smi','r') #L = [] # #count = -1 #for line in f: # line = line.strip() # L.append(line) # The zinc data set #f.close() # NC...
[ "nltk.ChartParser", "numpy.array", "numpy.arange", "GrammarVAE_grammar.GCFG.productions" ]
[((331, 362), 'GrammarVAE_grammar.GCFG.productions', 'zinc_grammar.GCFG.productions', ([], {}), '()\n', (360, 362), True, 'import GrammarVAE_grammar as zinc_grammar\n'), ((1766, 1801), 'nltk.ChartParser', 'nltk.ChartParser', (['zinc_grammar.GCFG'], {}), '(zinc_grammar.GCFG)\n', (1782, 1801), False, 'import nltk\n'), ((...
from typing import Optional, Text, List import pytest import numpy as np import scipy.sparse from rasa.nlu.featurizers.featurizer import Features from rasa.nlu.constants import TEXT, FEATURE_TYPE_SEQUENCE, FEATURE_TYPE_SENTENCE from rasa.nlu.training_data import Message @pytest.mark.parametrize( "features, attr...
[ "rasa.nlu.training_data.Message", "numpy.array", "numpy.ndarray", "numpy.all" ]
[((1625, 1679), 'rasa.nlu.training_data.Message', 'Message', (['"""This is a test sentence."""'], {'features': 'features'}), "('This is a test sentence.', features=features)\n", (1632, 1679), False, 'from rasa.nlu.training_data import Message\n'), ((1805, 1857), 'numpy.all', 'np.all', (['(actual_sen_features == expecte...
from metaHeuristic.commom import Model, Solution1, Solution2 from metaHeuristic.commom import createModel, plotBestCost, createRandomSolution, plotSolution, myCost from helper.utils import distancia_rota import numpy as np import time class Wolf: def __init__(self, positionx, positiony, alfax, alfay, betax,...
[ "numpy.random.uniform", "helper.utils.distancia_rota", "metaHeuristic.commom.plotBestCost", "numpy.asarray", "numpy.zeros", "metaHeuristic.commom.createModel", "time.time", "metaHeuristic.commom.createRandomSolution", "metaHeuristic.commom.plotSolution", "numpy.linspace", "numpy.random.rand", ...
[((945, 956), 'time.time', 'time.time', ([], {}), '()\n', (954, 956), False, 'import time\n'), ((970, 1007), 'metaHeuristic.commom.createModel', 'createModel', (['vmx', 'vmy', 'startx', 'starty'], {}), '(vmx, vmy, startx, starty)\n', (981, 1007), False, 'from metaHeuristic.commom import createModel, plotBestCost, creat...
# Copyright 2020 The TensorFlow Probability 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 o...
[ "tensorflow.compat.v2.constant", "tensorflow_probability.python.internal.dtype_util.is_floating", "tensorflow_probability.python.bijectors.sigmoid.Sigmoid", "tensorflow_probability.python.internal.assert_util.assert_less_equal", "tensorflow.compat.v2.math.square", "tensorflow.compat.v2.math.sigmoid", "t...
[((13387, 13456), 'tensorflow_probability.python.distributions.kullback_leibler.RegisterKL', 'kullback_leibler.RegisterKL', (['ContinuousBernoulli', 'ContinuousBernoulli'], {}), '(ContinuousBernoulli, ContinuousBernoulli)\n', (13414, 13456), False, 'from tensorflow_probability.python.distributions import kullback_leibl...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class Flatten(nn.Module): def forward(self, input): return input.view(input.size(0), -1) class UnFlatten(nn.Module): def __init__(self,w): super().__init__() self.w = w def forward(self, in...
[ "torch.nn.ReLU", "torch.nn.ConvTranspose2d", "torch.nn.Conv2d", "numpy.setdiff1d", "torch.cat", "torch.nn.BatchNorm2d", "torch.nn.Linear", "torch.tensor", "numpy.random.shuffle", "torch.nn.Sigmoid" ]
[((1346, 1376), 'torch.nn.Linear', 'nn.Linear', (['h_dim', 'shooting_dim'], {}), '(h_dim, shooting_dim)\n', (1355, 1376), True, 'import torch.nn as nn\n'), ((1396, 1426), 'torch.nn.Linear', 'nn.Linear', (['shooting_dim', 'h_dim'], {}), '(shooting_dim, h_dim)\n', (1405, 1426), True, 'import torch.nn as nn\n'), ((4076, 4...
import numpy as np from scipy.optimize import approx_fprime from numpy.testing import assert_array_almost_equal from sklearn.datasets import make_regression from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF from ofdft_ml.statslib.GaussProcess import GaussPro...
[ "numpy.zeros_like", "ofdft_ml.statslib.GaussProcess.GaussProcessRegressor", "sklearn.gaussian_process.kernels.RBF", "sklearn.datasets.make_regression", "numpy.array", "numpy.testing.assert_array_almost_equal", "sklearn.gaussian_process.GaussianProcessRegressor" ]
[((431, 477), 'sklearn.datasets.make_regression', 'make_regression', ([], {'n_features': '(10)', 'random_state': '(0)'}), '(n_features=10, random_state=0)\n', (446, 477), False, 'from sklearn.datasets import make_regression\n'), ((549, 596), 'sklearn.gaussian_process.kernels.RBF', 'RBF', ([], {'length_scale': '(0.5)', ...
#!/usr/bin/env python #-*-coding:utf-8-*- """ Plotting the forecasted wave heights and calculating the relevant error along an isobath """ import numpy as np import matplotlib.pyplot as plt from os import listdir from os.path import isfile, join import glob from netCDF4 import MFDataset, Dataset from scipy import stats...
[ "sys.path.append", "matplotlib.pyplot.loglog", "numpy.load", "numpy.save", "matplotlib.pyplot.show", "matplotlib.pyplot.xscale", "matplotlib.pyplot.plot", "numpy.sum", "matplotlib.pyplot.legend", "numpy.shape", "numpy.array", "matplotlib.ticker.PercentFormatter", "matplotlib.pyplot.gca", "...
[((332, 358), 'sys.path.append', 'sys.path.append', (['"""../src/"""'], {}), "('../src/')\n", (347, 358), False, 'import sys\n'), ((1034, 1059), 'numpy.load', 'np.load', (['"""forecasted.npy"""'], {}), "('forecasted.npy')\n", (1041, 1059), True, 'import numpy as np\n'), ((1192, 1218), 'numpy.save', 'np.save', (['"""xlo...
from distutils.core import setup, Extension import numpy module1 = Extension('waveletsC', sources = ['waveletsC.c'], include_dirs=[numpy.get_include()]) setup (name = 'waveletsC', version = '1.0', description = 'oct2015', ext_modules = [module1])
[ "numpy.get_include", "distutils.core.setup" ]
[((155, 244), 'distutils.core.setup', 'setup', ([], {'name': '"""waveletsC"""', 'version': '"""1.0"""', 'description': '"""oct2015"""', 'ext_modules': '[module1]'}), "(name='waveletsC', version='1.0', description='oct2015', ext_modules=[\n module1])\n", (160, 244), False, 'from distutils.core import setup, Extension...
from transformers import BertTokenizerFast import torch from sklearn.metrics import accuracy_score import numpy as np from tqdm import tqdm from torch.utils.data import DataLoader from transformers import BertForSequenceClassification, AdamW import os import json import copy from adversarial import FGM, FGSM def fix_...
[ "numpy.random.seed", "adversarial.FGSM", "numpy.mean", "torch.device", "torch.no_grad", "transformers.BertForSequenceClassification.from_pretrained", "json.loads", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "transformers.BertTokenizerFast.from_pretrained", "random.seed", ...
[((1203, 1237), 'copy.deepcopy', 'copy.deepcopy', (['news_train_question'], {}), '(news_train_question)\n', (1216, 1237), False, 'import copy\n'), ((1469, 1514), 'transformers.BertTokenizerFast.from_pretrained', 'BertTokenizerFast.from_pretrained', (['model_path'], {}), '(model_path)\n', (1502, 1514), False, 'from tran...
######################################################################################################### #----------This class represents the nnUNet Multiple Head Trainer. Implementation-----------------------# #----------inspired by original implementation (--> nnUNetTrainerV2), copied code is marked as such.----# ##...
[ "nnunet_ext.run.default_configuration.get_default_configuration", "nnunet.training.data_augmentation.data_augmentation_moreDA.get_moreDA_augmentation", "numpy.sum", "os.path.realpath", "numpy.isnan", "numpy.mean", "os.path.normpath", "nnunet.training.dataloading.dataset_loading.load_dataset", "torch...
[((4678, 4714), 'os.path.normpath', 'os.path.normpath', (['self.output_folder'], {}), '(self.output_folder)\n', (4694, 4714), False, 'import os\n'), ((5912, 5997), 'nnunet_ext.utilities.helpful_functions.join_texts_with_char', 'join_texts_with_char', (['self.tasks_list_with_char[0]', 'self.tasks_list_with_char[1]'], {}...
import numpy as np from matplotlib import pyplot as plt x_max = 2 # Domain length in X x_points = 21 # Number of grid points in X t_points = 50 # Number of time steps c = 1 # Constant del_t = 0.01 # Delta t (time interval) del_x = x_max/float(x_points - 1) # Delta x (grid length) x = ...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.show", "numpy.ones", "numpy.linspace" ]
[((320, 351), 'numpy.linspace', 'np.linspace', (['(0)', 'x_max', 'x_points'], {}), '(0, x_max, x_points)\n', (331, 351), True, 'import numpy as np\n'), ((355, 372), 'numpy.ones', 'np.ones', (['x_points'], {}), '(x_points)\n', (362, 372), True, 'import numpy as np\n'), ((567, 584), 'numpy.ones', 'np.ones', (['x_points']...
""" demo_constrained_optimization_linear_constraints.py Minimize a (quadratic) function of two variables: Minimize f(X), where X = [x0, x1].T; X* is MIN; m = number of equality constraints; n = number of parameters; Objective function: Minimize a (quadratic) function of two variables: f(X); X = [x1, ..., xn]...
[ "matplotlib.pyplot.title", "projected_gradient_algorithm.projected_gradient_algorithm_linesearch", "projected_conjugate_gradient_algorithm.projected_conjugate_gradient_algorithm_linesearch", "matplotlib.pyplot.figure", "numpy.arange", "numpy.sqrt", "numpy.meshgrid", "print_report.print_report", "mat...
[((5342, 5362), 'numpy.array', 'np.array', (['[[3], [6]]'], {}), '([[3], [6]])\n', (5350, 5362), True, 'import numpy as np\n'), ((5599, 5623), 'numpy.array', 'np.array', (['[[-20], [-20]]'], {}), '([[-20], [-20]])\n', (5607, 5623), True, 'import numpy as np\n'), ((5654, 5676), 'numpy.array', 'np.array', (['[[20], [20]]...
import numpy as np import pandas as pd import xarray as xr import pytest from xeofs.models.eof import EOF from xeofs.pandas.eof import EOF as pdEOF from xeofs.xarray.eof import EOF as xrEOF @pytest.mark.parametrize('scaling', [0, 1, 2]) def test_wrapper_solutions(scaling, sample_array): # Solutions of numpy, pan...
[ "pandas.DataFrame", "xeofs.models.eof.EOF", "xeofs.pandas.eof.EOF", "numpy.testing.assert_allclose", "xarray.DataArray", "pytest.mark.parametrize", "xeofs.xarray.eof.EOF" ]
[((194, 239), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scaling"""', '[0, 1, 2]'], {}), "('scaling', [0, 1, 2])\n", (217, 239), False, 'import pytest\n'), ((3286, 3331), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scaling"""', '[0, 1, 2]'], {}), "('scaling', [0, 1, 2])\n", (3309, 3331)...
from multiprocessing import Process from apscheduler.schedulers.background import BackgroundScheduler import yaml import os import sys import subprocess import time import json import requests import numpy as np try: with open(os.path.join(os.getcwd(),"etc/config.yml")) as f: cfg = yaml.load(f, Loader=ya...
[ "apscheduler.schedulers.background.BackgroundScheduler", "yaml.load", "json.dump", "numpy.sum", "traceback.print_exc", "os.getcwd", "numpy.mean", "requests.post", "sys.exit" ]
[((298, 334), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.FullLoader'}), '(f, Loader=yaml.FullLoader)\n', (307, 334), False, 'import yaml\n'), ((1126, 1172), 'apscheduler.schedulers.background.BackgroundScheduler', 'BackgroundScheduler', ([], {'job_defaults': 'job_defaults'}), '(job_defaults=job_defaults)\n', (1...
import inspect import itertools import numpy as np from scipy.integrate import solve_ivp import xarray from scipy import interpolate as inter class DiscreteTimeModel: state_names = None parameter_names = None parameters_stratified_names = None stratification = None def __init__(self, states, par...
[ "numpy.asarray", "numpy.zeros", "xarray.Dataset", "xarray.concat", "numpy.append", "inspect.signature", "numpy.reshape", "numpy.arange", "xarray.DataArray", "numpy.array" ]
[((2588, 2621), 'inspect.signature', 'inspect.signature', (['self.integrate'], {}), '(self.integrate)\n', (2605, 2621), False, 'import inspect\n'), ((7535, 7548), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (7545, 7548), True, 'import numpy as np\n'), ((7611, 7637), 'numpy.reshape', 'np.reshape', (['y', '[y.si...
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from ..data import EventList from .background_estimate import BackgroundEstimate __all__ = ["PhaseBackgroundEstimator"] class PhaseBackgroundEstimator: """Background estimation with on and off phases. This class is responsibl...
[ "numpy.sum", "numpy.atleast_2d" ]
[((1318, 1341), 'numpy.atleast_2d', 'np.atleast_2d', (['on_phase'], {}), '(on_phase)\n', (1331, 1341), True, 'import numpy as np\n'), ((1367, 1391), 'numpy.atleast_2d', 'np.atleast_2d', (['off_phase'], {}), '(off_phase)\n', (1380, 1391), True, 'import numpy as np\n'), ((3327, 3373), 'numpy.sum', 'np.sum', (['[(_[1] - _...
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from google.colab.patches import cv2_imshow from keras.applications.inception_v3 import InceptionV3 from keras.applications.inception_v3 import preprocess_input from math import floor from keras.datasets import cifar10 import keras import tenso...
[ "numpy.stack", "cv2.GaussianBlur", "cv2.bitwise_not", "cv2.cvtColor", "cv2.divide", "cv2.resize" ]
[((2010, 2047), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (2022, 2047), False, 'import cv2\n'), ((2081, 2106), 'cv2.bitwise_not', 'cv2.bitwise_not', (['img_gray'], {}), '(img_gray)\n', (2096, 2106), False, 'import cv2\n'), ((2155, 2219), 'cv2.GaussianBlur', 'cv2...
""" Provides access to the flecs component. """ import numpy as np from numpy.typing import DTypeLike from ._entity import Entity from ._types import ShapeLike class Component(Entity): """ Wraps a flecs component """ def __init__(self, ptr, dtype: DTypeLike, shape: ShapeLike): super().__init_...
[ "numpy.prod" ]
[((503, 517), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n', (510, 517), True, 'import numpy as np\n')]
''' Code for processing custom image sequence fetched from video in youtube ''' import os import requests from bs4 import BeautifulSoup import urllib.request import numpy as np from imageio import imread from scipy.misc import imresize import hickle as hkl from monkey_setting import * import glob import re from time i...
[ "os.mkdir", "imageio.imread", "os.path.exists", "time.time", "numpy.round", "os.path.join", "os.listdir", "re.compile" ]
[((680, 704), 'os.path.exists', 'os.path.exists', (['DATA_DIR'], {}), '(DATA_DIR)\n', (694, 704), False, 'import os\n'), ((706, 724), 'os.mkdir', 'os.mkdir', (['DATA_DIR'], {}), '(DATA_DIR)\n', (714, 724), False, 'import os\n'), ((2844, 2873), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""RAW"""'], {}), "(DATA_DIR,...
# coding=utf-8 # Copyright 2019 The SEED 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 agre...
[ "tensorflow.reduce_sum", "tensorflow.reshape", "numpy.argsort", "tensorflow.nest.map_structure", "tensorflow.Variable", "tensorflow.distribute.experimental.TPUStrategy", "tensorflow.bitcast", "tensorflow.unique", "tensorflow.python.framework.tensor_conversion_registry.register_tensor_conversion_func...
[((1211, 1300), 'collections.namedtuple', 'collections.namedtuple', (['"""EnvOutput"""', '"""reward done observation abandoned episode_step"""'], {}), "('EnvOutput',\n 'reward done observation abandoned episode_step')\n", (1233, 1300), False, 'import collections\n'), ((1315, 1415), 'collections.namedtuple', 'collect...
import argparse import os import glob import sys import tqdm import random import warnings import tensorboardX import numpy as np import pandas as pd import time from datetime import datetime import cv2 import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.optim as optim import torch.nn.fu...
[ "os.remove", "numpy.random.seed", "argparse.ArgumentParser", "time.strftime", "torch.cat", "torch.distributed.all_gather", "kornia.create_meshgrid", "torch.optim.lr_scheduler.LambdaLR", "lietorch.SO3", "glob.glob", "torch.no_grad", "os.path.join", "torch.ones", "torch.cuda.amp.autocast", ...
[((656, 673), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (667, 673), False, 'import random\n'), ((723, 743), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (737, 743), True, 'import numpy as np\n'), ((748, 771), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (76...
""" This python file is to genereate hand detection data for PNet Training --crop into 12*12 pics and classifies into pos, neg, part """ import os import cv2 import numpy as np import numpy.random as npr from data_utils import IoU _anno_file = "annotation.txt" im_dir = "../XW-Dataset/Training" pos_save_dir = "../XW...
[ "os.mkdir", "cv2.imwrite", "data_utils.IoU", "os.path.exists", "numpy.max", "numpy.random.randint", "numpy.array", "os.path.join", "cv2.resize" ]
[((487, 511), 'os.path.exists', 'os.path.exists', (['save_dir'], {}), '(save_dir)\n', (501, 511), False, 'import os\n'), ((517, 535), 'os.mkdir', 'os.mkdir', (['save_dir'], {}), '(save_dir)\n', (525, 535), False, 'import os\n'), ((543, 571), 'os.path.exists', 'os.path.exists', (['pos_save_dir'], {}), '(pos_save_dir)\n'...
""" Line Chart with Points ---------------------- This chart shows a simple line chart with points marking each value. """ # category: line charts import altair as alt import numpy as np import pandas as pd x = np.arange(100) source = pd.DataFrame({ 'x': x, 'f(x)': np.sin(x / 5) }) alt.Chart(source).mark_line(poi...
[ "altair.Chart", "numpy.sin", "numpy.arange" ]
[((212, 226), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (221, 226), True, 'import numpy as np\n'), ((271, 284), 'numpy.sin', 'np.sin', (['(x / 5)'], {}), '(x / 5)\n', (277, 284), True, 'import numpy as np\n'), ((289, 306), 'altair.Chart', 'alt.Chart', (['source'], {}), '(source)\n', (298, 306), True, 'im...
import numpy as np import os from latency_encoding import * import pandas as pd import csv import torch.nn as nn import torch import torch.nn.functional as F import math from torch.utils.data import Dataset import torch.optim as optim from functools import partial import time import matplotlib.pyplot as plt from ray im...
[ "matplotlib.pyplot.title", "numpy.random.seed", "pandas.read_csv", "ray.tune.grid_search", "os.path.join", "pandas.DataFrame", "torch.nn.MSELoss", "torch.utils.data.DataLoader", "torch.load", "torch.nn.Linear", "functools.partial", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "ray...
[((403, 424), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (417, 424), True, 'import numpy as np\n'), ((2405, 2465), 'pandas.read_csv', 'pd.read_csv', (['dataset_path'], {'usecols': "['child_arch', 'latency']"}), "(dataset_path, usecols=['child_arch', 'latency'])\n", (2416, 2465), True, 'impor...
# Copyright(c) 2014, The LIMIX developers (<NAME>, <NAME>, <NAME>) # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applica...
[ "numpy.arange", "pylab.figure", "pylab.fill_between", "scipy.argsort", "scipy.log10", "pylab.ylabel", "pylab.plot", "pylab.xticks", "pylab.ylim", "scipy.zeros", "pylab.xlabel", "scipy.stats.beta.ppf", "pylab.hist", "scipy.arange", "pylab.annotate", "matplotlib.pylab.plot", "matplotli...
[((3182, 3197), 'pylab.ylim', 'pl.ylim', (['(0)', 'lim'], {}), '(0, lim)\n', (3189, 3197), True, 'import pylab as pl\n'), ((3199, 3225), 'pylab.ylabel', 'pl.ylabel', (['"""-log$_{10}$pv"""'], {}), "('-log$_{10}$pv')\n", (3208, 3225), True, 'import pylab as pl\n'), ((3339, 3361), 'matplotlib.pylab.set_xticks', 'plt.set_...
import numpy as np import torch from .metric_computer import MetricComputer from ..common_util.image import get_gt_frame, get_comp_frame from ..fid import calculate_frechet_distance, InceptionV3 from ..fid.util import extract_video_frame_features class FIDComputer(MetricComputer): def compute_metric(self): ...
[ "numpy.cov", "numpy.load", "numpy.mean", "torch.set_grad_enabled" ]
[((655, 684), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (677, 684), False, 'import torch\n'), ((1385, 1419), 'numpy.mean', 'np.mean', (['gt_frame_features'], {'axis': '(0)'}), '(gt_frame_features, axis=0)\n', (1392, 1419), True, 'import numpy as np\n'), ((1439, 1478), 'numpy.co...
from datetime import datetime from io import StringIO import numpy as np import pandas as pd from scipy.stats import skew from data_pipeline.dtype import dtype, reduction_dtype from data_pipeline.translate import translation from utils.handle_null import NullHandler from utils.logging import init_logger from utils.s3...
[ "utils.s3_manager.manage.S3Manager", "utils.logging.init_logger", "utils.handle_null.NullHandler", "datetime.datetime.strptime", "pandas.concat", "numpy.log1p" ]
[((460, 473), 'utils.logging.init_logger', 'init_logger', ([], {}), '()\n', (471, 473), False, 'from utils.logging import init_logger\n'), ((535, 566), 'datetime.datetime.strptime', 'datetime.strptime', (['date', '"""%Y%m"""'], {}), "(date, '%Y%m')\n", (552, 566), False, 'from datetime import datetime\n'), ((2113, 2152...
# -*- coding: utf-8 -*- # Copyright 2018 IBM. # # 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 agre...
[ "numpy.binary_repr", "qiskit_aqua.get_aer_backend", "json.load", "qiskit_aqua.run_algorithm", "qiskit_aqua.translators.ising.setpacking.check_disjoint", "numpy.count_nonzero", "qiskit_aqua.input.EnergyInput", "numpy.testing.assert_array_equal", "qiskit_aqua.translators.ising.setpacking.get_solution"...
[((2159, 2197), 'qiskit_aqua.run_algorithm', 'run_algorithm', (['params', 'self.algo_input'], {}), '(params, self.algo_input)\n', (2172, 2197), False, 'from qiskit_aqua import run_algorithm\n'), ((2309, 2335), 'qiskit_aqua.translators.ising.setpacking.get_solution', 'setpacking.get_solution', (['x'], {}), '(x)\n', (233...
from numpy import sin, cos import numpy as np import matplotlib.pyplot as plt import scipy.integrate as integrate import matplotlib.animation as animation from manimlib.imports import * class DouPandulumSim(object): def __init__(self,th1,th2): self.x1,self.x2,self.y1,self.y2 = DouPandulumSim.getSimulationRe...
[ "numpy.radians", "numpy.zeros_like", "scipy.integrate.odeint", "numpy.floor", "numpy.sin", "numpy.arange", "numpy.array", "numpy.cos" ]
[((633, 653), 'numpy.zeros_like', 'np.zeros_like', (['state'], {}), '(state)\n', (646, 653), True, 'import numpy as np\n'), ((1818, 1838), 'numpy.arange', 'np.arange', (['(0)', '(21)', 'dt'], {}), '(0, 21, dt)\n', (1827, 1838), True, 'import numpy as np\n'), ((2090, 2120), 'numpy.radians', 'np.radians', (['[th1, w1, th...
#!/usr/bin/env python import matplotlib matplotlib.use('agg') import sys import yt import numpy as np from yt.visualization.volume_rendering.api import \ Scene, \ VolumeSource # this is for the wdconvect problem def doit(plotfile): ds = yt.load(plotfile) ds.periodicity = (True, True, True) f...
[ "yt.visualization.volume_rendering.api.Scene", "yt.visualization.volume_rendering.api.VolumeSource", "matplotlib.use", "numpy.array", "yt.load", "sys.exit" ]
[((41, 62), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (55, 62), False, 'import matplotlib\n'), ((256, 273), 'yt.load', 'yt.load', (['plotfile'], {}), '(plotfile)\n', (263, 273), False, 'import yt\n'), ((405, 412), 'yt.visualization.volume_rendering.api.Scene', 'Scene', ([], {}), '()\n', (410...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 17 13:37:52 2020 Sparse GP Model. Uses inducing points for low-rank approximation. Uses GPytorch. Dependency is GPModels, a module full of classes defining models and kernels. @author: soper3 """ import torch import gpytorch import numpy as np ...
[ "gpytorch.mlls.ExactMarginalLogLikelihood", "gpytorch.settings.fast_pred_var", "gpytorch.constraints.GreaterThan", "numpy.random.random", "torch.no_grad", "torch.tensor" ]
[((8886, 8955), 'gpytorch.mlls.ExactMarginalLogLikelihood', 'gpytorch.mlls.ExactMarginalLogLikelihood', (['self.likelihood', 'self.model'], {}), '(self.likelihood, self.model)\n', (8926, 8955), False, 'import gpytorch\n'), ((5451, 5527), 'gpytorch.mlls.ExactMarginalLogLikelihood', 'gpytorch.mlls.ExactMarginalLogLikelih...
from collections import Counter import logging from django.db.models import BooleanField, Case, Count, Exists, Max, OuterRef, Value, When from django.db.models.fields import DecimalField from django.conf import settings import numpy as np from core.utils.common import conditional_atomic from tasks.models import Annot...
[ "django.db.models.Max", "django.db.models.fields.DecimalField", "django.db.models.Value", "django.db.models.When", "core.utils.common.conditional_atomic", "tasks.models.Task.objects.select_for_update", "django.db.models.BooleanField", "django.db.models.Exists", "numpy.random.permutation", "collect...
[((342, 369), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (359, 369), False, 'import logging\n'), ((600, 634), 'numpy.random.permutation', 'np.random.permutation', (['upper_limit'], {}), '(upper_limit)\n', (621, 634), True, 'import numpy as np\n'), ((4498, 4527), 'collections.Counter',...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pickle import numpy as np import matplotlib.pyplot as plt from scipy.linalg import eigvals from pyvib.helper.plotting import (phase, periodic, stability, configuration, nfrc) plot = False path = 'data/' nnm = pickle.load(open(pat...
[ "scipy.linalg.eigvals", "pyvib.helper.plotting.periodic", "pyvib.helper.plotting.configuration", "numpy.arange", "pyvib.helper.plotting.nfrc", "pyvib.helper.plotting.phase" ]
[((784, 797), 'scipy.linalg.eigvals', 'eigvals', (['PhiT'], {}), '(PhiT)\n', (791, 797), False, 'from scipy.linalg import eigvals\n'), ((941, 1009), 'pyvib.helper.plotting.nfrc', 'nfrc', ([], {'nnm': 'nnm', 'interactive': '(False)', 'xscale': '(1 / 2 / np.pi)', 'xunit': '"""(Hz)"""'}), "(nnm=nnm, interactive=False, xsc...
import networkx as nx import numpy as np from collections import defaultdict def node_type(g, node): node = g.nodes[node] path_split = node['data'][0]['python_path'].split('.') if (len(path_split) > 2): return path_split[2] else: return node['data'][0]['python_path'] def compute_edge_t...
[ "networkx.adjacency_matrix", "collections.defaultdict", "numpy.max", "numpy.dot", "networkx.set_edge_attributes", "networkx.DiGraph" ]
[((453, 465), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (463, 465), True, 'import networkx as nx\n'), ((1608, 1662), 'networkx.set_edge_attributes', 'nx.set_edge_attributes', (['pcg', 'edge_weight_map', '"""weight"""'], {}), "(pcg, edge_weight_map, 'weight')\n", (1630, 1662), True, 'import networkx as nx\n'),...
import pandas as pd import numpy as np from cluster import KMeans import time # start = time.time() df = pd.read_csv('data/data.csv', index_col=['PID']) data = np.array(df) n_samples, _ = data.shape kmeans = KMeans(n_init=1) kmeans.fit(data) out_df = pd.DataFrame(kmeans.labels_, columns=['category']) out_df.index.na...
[ "pandas.read_csv", "cluster.KMeans", "numpy.array", "pandas.DataFrame" ]
[((106, 153), 'pandas.read_csv', 'pd.read_csv', (['"""data/data.csv"""'], {'index_col': "['PID']"}), "('data/data.csv', index_col=['PID'])\n", (117, 153), True, 'import pandas as pd\n'), ((161, 173), 'numpy.array', 'np.array', (['df'], {}), '(df)\n', (169, 173), True, 'import numpy as np\n'), ((210, 226), 'cluster.KMea...
from Summarizer import Summarizer from absl import app, flags import numpy as np import re FLAGS = flags.FLAGS flags.DEFINE_string( "text_path", "texts/to_summarize.txt", "path to the text to summarize" ) flags.DEFINE_string( "model", "flaubert", "Use either 'camembert' or 'flaubert' for mod...
[ "absl.flags.DEFINE_bool", "absl.flags.DEFINE_string", "absl.app.run", "absl.flags.DEFINE_integer", "numpy.array", "Summarizer.Summarizer", "re.sub" ]
[((114, 209), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""text_path"""', '"""texts/to_summarize.txt"""', '"""path to the text to summarize"""'], {}), "('text_path', 'texts/to_summarize.txt',\n 'path to the text to summarize')\n", (133, 209), False, 'from absl import app, flags\n'), ((221, 315), 'absl.fl...
import glob import re from collections import OrderedDict from pathlib import Path from typing import Any, List import numpy as np import plaidrl.torch.pytorch_util as ptu from plaidrl.core import eval_util from plaidrl.core.logging import append_log from plaidrl.core.meta_rl_algorithm import MetaRLAlgorithm from pla...
[ "numpy.load", "numpy.square", "plaidrl.torch.pytorch_util.from_numpy", "pathlib.Path", "numpy.sin", "numpy.mean", "plaidrl.core.eval_util.get_average_returns", "numpy.cos", "plaidrl.util.io.load_local_or_remote_file", "collections.OrderedDict", "numpy.dot" ]
[((8233, 8253), 'pathlib.Path', 'Path', (['base_directory'], {}), '(base_directory)\n', (8237, 8253), False, 'from pathlib import Path\n'), ((10160, 10227), 'plaidrl.util.io.load_local_or_remote_file', 'load_local_or_remote_file', (['pretrain_buffer_path'], {'file_type': '"""joblib"""'}), "(pretrain_buffer_path, file_t...
import numpy as np from copy import deepcopy from warnings import warn import torch from disprcnn.utils.kitti_utils import Calibration class Calib: def __init__(self, calib: Calibration, image_size): # assert isinstance(calib, Calibration) self.calib = calib self.size = image_size @...
[ "torch.ones", "copy.deepcopy", "torch.cat", "numpy.ones", "torch.meshgrid", "torch.arange", "numpy.eye", "torch.inverse", "warnings.warn", "torch.tensor", "torch.from_numpy" ]
[((4288, 4320), 'torch.meshgrid', 'torch.meshgrid', (['x_range', 'y_range'], {}), '(x_range, y_range)\n', (4302, 4320), False, 'import torch\n'), ((6385, 6394), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (6391, 6394), True, 'import numpy as np\n'), ((1043, 1063), 'copy.deepcopy', 'deepcopy', (['self.calib'], {}), '...
## for data import json import pandas as pd import numpy as np ## for plotting import matplotlib.pyplot as plt import seaborn as sns ## for processing import re import nltk ## for bag-of-words from sklearn import feature_extraction, model_selection, naive_bayes, pipeline, manifold, preprocessing from sklearn.ensemble i...
[ "pandas.DataFrame", "sklearn.ensemble.RandomForestClassifier", "sklearn.feature_extraction.text.CountVectorizer", "sklearn.naive_bayes.MultinomialNB", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.model_selection.train_test_split", "timeit.default_timer", "preprocessing.utils_preprocess_...
[((657, 683), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (670, 683), False, 'import nltk\n'), ((684, 708), 'nltk.download', 'nltk.download', (['"""wordnet"""'], {}), "('wordnet')\n", (697, 708), False, 'import nltk\n'), ((878, 900), 'timeit.default_timer', 'timeit.default_timer', ([...
# Copyright (c) Facebook, Inc. and its affiliates. import torch import numpy as np from bodymocap.core import constants from torchvision.transforms import Normalize from bodymocap.models import hmr, SMPL, SMPLX from bodymocap.core import config from bodymocap.utils.imutils import crop,crop_bboxInfo, process_image_bbo...
[ "bodymocap.models.SMPL", "torch.load", "numpy.transpose", "bodymocap.utils.imutils.convert_bbox_to_oriIm", "bodymocap.utils.imutils.process_image_bbox", "torch.cuda.is_available", "bodymocap.utils.imutils.convert_smpl_to_bbox", "bodymocap.models.SMPLX", "torch.device", "torchvision.transforms.Norm...
[((562, 582), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (574, 582), False, 'import torch\n'), ((1238, 1291), 'torch.load', 'torch.load', (['regressor_checkpoint'], {'map_location': 'device'}), '(regressor_checkpoint, map_location=device)\n', (1248, 1291), False, 'import torch\n'), ((1439, 1506...
import os from pathlib import Path import numpy as np import pytest from dotenv import load_dotenv from gadget_tools.io import Snapshot from gadget_tools.io.snapshot import ( FileFormat, Header, header_dtype ) load_dotenv() @pytest.fixture def snapshot_path(): """Return the path of a testing snapshot file....
[ "numpy.random.random_sample", "os.getcwd", "os.path.exists", "pytest.skip", "dotenv.load_dotenv", "pytest.raises", "numpy.array", "gadget_tools.io.Snapshot", "os.path.expanduser", "os.getenv", "gadget_tools.io.snapshot.Header.from_data" ]
[((217, 230), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (228, 230), False, 'from dotenv import load_dotenv\n'), ((343, 372), 'os.getenv', 'os.getenv', (['"""ST_TEST_SNAPSHOT"""'], {}), "('ST_TEST_SNAPSHOT')\n", (352, 372), False, 'import os\n'), ((979, 1021), 'numpy.array', 'np.array', (['header_attrs'], {...
from googleapiclient import discovery, errors import pickle import numpy as np import time with open("../resources/test_faces.pickle", "rb") as handle: x_test = pickle.load(handle) ar = np.reshape(x_test[0], (1, 224, 224, 3)).tolist() service = discovery.build('ml', 'v1') name = 'projects/{}/models/{}'.format("inf...
[ "pickle.load", "googleapiclient.discovery.build", "numpy.reshape", "time.time" ]
[((250, 277), 'googleapiclient.discovery.build', 'discovery.build', (['"""ml"""', '"""v1"""'], {}), "('ml', 'v1')\n", (265, 277), False, 'from googleapiclient import discovery, errors\n'), ((457, 468), 'time.time', 'time.time', ([], {}), '()\n', (466, 468), False, 'import time\n'), ((569, 580), 'time.time', 'time.time'...
import numpy as np import spikeextractors as se import pytest from spiketoolkit.tests.utils import check_signal_power_signal1_below_signal2 from spiketoolkit.preprocessing import bandpass_filter, blank_saturation, clip_traces, common_reference, \ normalize_by_quantile, notch_filter, rectify, remove_artifacts, remov...
[ "spikeextractors.NumpyRecordingExtractor", "spikeextractors.example_datasets.toy_example", "spiketoolkit.preprocessing.transform_traces", "numpy.random.randn", "numpy.median", "spiketoolkit.preprocessing.resample", "spiketoolkit.preprocessing.bandpass_filter", "spiketoolkit.preprocessing.blank_saturat...
[((448, 508), 'spikeextractors.example_datasets.toy_example', 'se.example_datasets.toy_example', ([], {'duration': '(10)', 'num_channels': '(4)'}), '(duration=10, num_channels=4)\n', (479, 508), True, 'import spikeextractors as se\n'), ((524, 587), 'spiketoolkit.preprocessing.bandpass_filter', 'bandpass_filter', (['rec...
#!/usr/bin/env python3 -u # -*- coding: utf-8 -*- # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) __all__ = ["plot_series"] __author__ = ["<NAME>"] import numpy as np from sktime.utils.validation._dependencies import _check_soft_dependencies from sktime.utils.validation.forecasting import che...
[ "matplotlib.pyplot.figaspect", "matplotlib.ticker.MaxNLocator", "matplotlib.ticker.FuncFormatter", "numpy.arange", "sktime.utils.validation._dependencies._check_soft_dependencies", "seaborn.color_palette", "matplotlib.cbook.flatten", "sktime.utils.validation.forecasting.check_y" ]
[((667, 716), 'sktime.utils.validation._dependencies._check_soft_dependencies', '_check_soft_dependencies', (['"""matplotlib"""', '"""seaborn"""'], {}), "('matplotlib', 'seaborn')\n", (691, 716), False, 'from sktime.utils.validation._dependencies import _check_soft_dependencies\n'), ((1905, 1955), 'seaborn.color_palett...
# ------------------------------------------------------------------------ # UP-DETR # Copyright (c) Tencent, Inc. and its affiliates. All Rights Reserved. # ------------------------------------------------------------------------ """ pre-training dataset which implements random query patch detection. """ from torch.ut...
[ "numpy.load", "os.walk", "torchvision.transforms.transforms.ColorJitter", "numpy.random.randint", "numpy.arange", "cv2.ximgproc.segmentation.createSelectiveSearchSegmentation", "os.path.join", "datasets.transforms.Normalize", "datasets.transforms.RandomHorizontalFlip", "cv2.resize", "PIL.ImageFi...
[((5860, 5873), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (5868, 5873), True, 'import numpy as np\n'), ((5883, 5944), 'cv2.ximgproc.segmentation.createSelectiveSearchSegmentation', 'cv2.ximgproc.segmentation.createSelectiveSearchSegmentation', ([], {}), '()\n', (5942, 5944), False, 'import cv2\n'), ((878, 91...
import numpy as np from numpy import array from numpy import mean from numpy.linalg import eig C_1 = array([[1, 2], [2, 3], [3, 3], [4, 5], [5, 5]]) C_2 = array([[1, 0], [2, 1], [3, 1], [3, 2], [5, 3], [6, 5]]) print("We have the data:") print("Class C1:\n", C_1) print("Class C1:\n", C_2) M_1 = mean(C_1.T, axis=1) M_2...
[ "numpy.mean", "numpy.linalg.inv", "numpy.array", "numpy.matmul", "numpy.cov" ]
[((102, 149), 'numpy.array', 'array', (['[[1, 2], [2, 3], [3, 3], [4, 5], [5, 5]]'], {}), '([[1, 2], [2, 3], [3, 3], [4, 5], [5, 5]])\n', (107, 149), False, 'from numpy import array\n'), ((156, 211), 'numpy.array', 'array', (['[[1, 0], [2, 1], [3, 1], [3, 2], [5, 3], [6, 5]]'], {}), '([[1, 0], [2, 1], [3, 1], [3, 2], [...
"""Scoring measures.""" from evaluators import MemEvaluator from scipy.spatial.distance import cdist import numpy as np class Scorer: """Score the provided rules.""" def __init__(self, score='rrs', evaluator=None, oracle=None): """Scorer with hyperparameters given by kwargs. Arguments: ...
[ "scipy.spatial.distance.cdist", "numpy.sum", "numpy.savetxt", "numpy.isinf", "numpy.isnan", "numpy.percentile", "numpy.matmul", "evaluators.MemEvaluator" ]
[((2762, 2812), 'numpy.matmul', 'np.matmul', (['coverage_matrix', 'pattern_coverage_score'], {}), '(coverage_matrix, pattern_coverage_score)\n', (2771, 2812), True, 'import numpy as np\n'), ((7022, 7049), 'numpy.percentile', 'np.percentile', (['scores', 'beta'], {}), '(scores, beta)\n', (7035, 7049), True, 'import nump...
# coding=utf-8 # Copyright 2018 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "tensorflow.identity", "numpy.float32", "tensorflow.device", "tensorflow.constant", "numpy.prod" ]
[((3469, 3503), 'tensorflow.constant', 'tf.constant', (['obs'], {'dtype': 'tf.float32'}), '(obs, dtype=tf.float32)\n', (3480, 3503), True, 'import tensorflow as tf\n'), ((4350, 4368), 'numpy.float32', 'np.float32', (['reward'], {}), '(reward)\n', (4360, 4368), True, 'import numpy as np\n'), ((4638, 4652), 'tensorflow.d...
"""Train Pytorch Faster-RCNN on UMCD dataset. This script is highly inspired by https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html Usage: python train.py """ import os import glob import argparse import torch import numpy as np from matplotlib import pyplot as plt from core import utils from core.t...
[ "core.engine.train_one_epoch", "os.mkdir", "os.remove", "torch.optim.lr_scheduler.StepLR", "argparse.ArgumentParser", "core.model_factory.get_instance_segmentation_model", "numpy.arange", "torch.device", "os.path.join", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "matplotl...
[((921, 953), 'numpy.array', 'np.array', (['data'], {'dtype': 'np.float32'}), '(data, dtype=np.float32)\n', (929, 953), True, 'import numpy as np\n'), ((1172, 1214), 'matplotlib.pyplot.subplots', 'plt.subplots', (['rows', 'cols'], {'figsize': '(14, 14)'}), '(rows, cols, figsize=(14, 14))\n', (1184, 1214), True, 'from m...
from logging import debug import pytorch_lightning as pl import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import json from IPython import embed from .base import BaseLitModel from transformers.optimization import get_linear_schedule_with_warmup from functools import partial from ....
[ "torch.logsumexp", "torch.zeros_like", "torch.nn.CrossEntropyLoss", "torch.cat", "transformers.optimization.get_linear_schedule_with_warmup", "numpy.concatenate" ]
[((786, 819), 'torch.zeros_like', 'torch.zeros_like', (['y_pred[..., :1]'], {}), '(y_pred[..., :1])\n', (802, 819), False, 'import torch\n'), ((837, 875), 'torch.cat', 'torch.cat', (['[y_pred_neg, zeros]'], {'dim': '(-1)'}), '([y_pred_neg, zeros], dim=-1)\n', (846, 875), False, 'import torch\n'), ((893, 931), 'torch.ca...
# coding: utf-8 # In[1]: import numpy as np import pandas as pd import json from sklearn.preprocessing import MinMaxScaler from sklearn.metrics import confusion_matrix from sklearn.metrics import log_loss from sklearn.metrics import precision_score from sklearn.metrics import f1_score from sklearn.metrics import re...
[ "sklearn.ensemble.RandomForestClassifier", "numpy.std", "sklearn.metrics.accuracy_score", "sklearn.metrics.log_loss", "sklearn.metrics.classification_report", "numpy.argsort", "sklearn.metrics.confusion_matrix", "numpy.unique" ]
[((3049, 3067), 'numpy.unique', 'np.unique', (['Y_train'], {}), '(Y_train)\n', (3058, 3067), True, 'import numpy as np\n'), ((3118, 3255), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_estimators': 'n_estimators', 'criterion': 'criterion', 'max_features': 'max_features', 'max_depth': 'ma...
import numpy import pygame import random class Board: """ The board is represented by a matrix. The values of that matrix represent the following states: 0: Free cell. 1: First player's token. -1: Second player's token. """ cell_size = 80 turn = 1 game_over = False def __init_...
[ "pygame.quit", "numpy.count_nonzero", "argparse.ArgumentParser", "pygame.draw.circle", "random.randint", "pygame.draw.rect", "pygame.display.set_mode", "pygame.event.get", "numpy.zeros", "pygame.init", "numpy.nonzero", "numpy.fliplr", "pygame.display.update", "numpy.all" ]
[((5869, 5882), 'pygame.init', 'pygame.init', ([], {}), '()\n', (5880, 5882), False, 'import pygame\n'), ((7450, 7573), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Players take turns to try to connect 4 pieces of the same color in a line."""'}), "(description=\n 'Players take turns...
import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable from matplotlib.colors import LightSource from meshoid import GridSurfaceDensity as GridSurfaceDensity import aggdraw from PIL import Image, ImageDraw, ImageFont, ImageChops import matplotlib matplotlib.use('Agg') from matplotlib import pyplot a...
[ "os.mkdir", "numpy.load", "numpy.abs", "numpy.sum", "numpy.clip", "os.execv", "os.path.isfile", "numpy.savez_compressed", "numpy.sin", "matplotlib.colors.LogNorm", "matplotlib.pyplot.imread", "numpy.meshgrid", "numpy.zeros_like", "numpy.copy", "matplotlib.pyplot.close", "numpy.linspace...
[((267, 288), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (281, 288), False, 'import matplotlib\n'), ((506, 533), 'os.getenv', 'os.getenv', (['"""PYTHONHASHSEED"""'], {}), "('PYTHONHASHSEED')\n", (515, 533), False, 'import os\n'), ((594, 647), 'os.execv', 'os.execv', (['sys.executable', '([sys...
import json import zipfile import vtk import re import struct from .synchronizable_serializer import arrayTypesMapping METHODS_RENAME = { "AddTexture": "SetTexture", "SetUseGradientOpacity": None, "SetRGBTransferFunction": "SetColor", } WRAP_ID_RE = re.compile(r"instance:\${([^}]+)}") ARRAY_TYPES = { ...
[ "zipfile.ZipFile", "vtk.vtkPoints", "vtk.vtkIdTypeArray", "numpy.frombuffer", "struct.calcsize", "vtk.vtkPolyData", "vtk.vtkCellArray", "re.compile" ]
[((265, 300), 're.compile', 're.compile', (['"""instance:\\\\${([^}]+)}"""'], {}), "('instance:\\\\${([^}]+)}')\n", (275, 300), False, 'import re\n'), ((1049, 1074), 'struct.calcsize', 'struct.calcsize', (['dataType'], {}), '(dataType)\n', (1064, 1074), False, 'import struct\n'), ((2014, 2031), 'vtk.vtkPolyData', 'vtk....
import os import sys import json # Flask from flask import Flask, redirect, url_for, request, render_template, Response, jsonify, redirect from werkzeug.utils import secure_filename from gevent.pywsgi import WSGIServer # TensorFlow and tf.keras import tensorflow as tf from tensorflow import keras import tensorflow_hu...
[ "os.mkdir", "tensorflow.keras.models.load_model", "tensorflow.keras.applications.imagenet_utils.preprocess_input", "numpy.argmax", "tensorflow.keras.preprocessing.image.img_to_array", "flask.Flask", "cv2.imdecode", "datetime.date.today", "numpy.expand_dims", "urllib.request.urlopen", "os.path.ex...
[((685, 700), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (690, 700), False, 'from flask import Flask, redirect, url_for, request, render_template, Response, jsonify, redirect\n'), ((1358, 1427), 'tensorflow.keras.models.load_model', 'load_model', (['MODEL_PATH'], {'custom_objects': "{'KerasLayer': hub....
import pytest import numpy as np import os from distr_nmf.src import tasks_nmf from distr_nmf.src.exec_config import log_mpc_filename import luigi from matrixops.transform import normalize, tfidf from rri_nmf import nmf def _gen_random_mat(n, d, density, random_seed=0, nnz_per_row=1): np.random.seed(random_seed) ...
[ "numpy.load", "numpy.save", "numpy.random.seed", "os.remove", "distr_nmf.src.tasks_nmf.GetWeights", "distr_nmf.src.tasks_nmf.MultiWorkerNMF", "numpy.allclose", "numpy.zeros", "distr_nmf.src.tasks_nmf.GetTopics", "matrixops.transform.tfidf", "matrixops.transform.normalize", "numpy.random.choice...
[((2087, 2287), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('n', 'd', 'seed', 'M', 'n_iter', 'mode')", "[(100, 25, 0, 1, 2, 'local'), (100, 25, 0, 1, 2, 'mock_distr_MPC'), (20, 25,\n 0, 3, 2, 'local'), (21, 26, 1, 5, 2, 'local')]"], {}), "(('n', 'd', 'seed', 'M', 'n_iter', 'mode'), [(100, \n 25, 0, ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns dists = np.load('/node09_data//test_dist_cache.npy') ranks = np.load('/node09_data//test_rank_cache.npy') locality = np.load('/node09_data//test_locality_cache.npy') rank_filter_mask = ranks <= 100 dists = dists[rank_filter_...
[ "numpy.load", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((102, 146), 'numpy.load', 'np.load', (['"""/node09_data//test_dist_cache.npy"""'], {}), "('/node09_data//test_dist_cache.npy')\n", (109, 146), True, 'import numpy as np\n'), ((155, 199), 'numpy.load', 'np.load', (['"""/node09_data//test_rank_cache.npy"""'], {}), "('/node09_data//test_rank_cache.npy')\n", (162, 199), ...
""" Utility functions for observation spaces. """ from collections import defaultdict import copy import operator import numpy as np import benri.dict as dict_ops def select_from_batch(observation, batch_i): """ :param observations: List of observations. :return: """ selected = [] for obs...
[ "copy.deepcopy", "numpy.ones_like", "numpy.zeros", "numpy.expand_dims", "collections.defaultdict", "numpy.tile", "benri.dict.apply_fn", "operator.itemgetter", "numpy.all" ]
[((909, 931), 'numpy.all', 'np.all', (['(pointers == -1)'], {}), '(pointers == -1)\n', (915, 931), True, 'import numpy as np\n'), ((1096, 1112), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1107, 1112), False, 'from collections import defaultdict\n'), ((2074, 2096), 'numpy.zeros', 'np.zeros', ([...
""" An example that learns the optimal approximate uniform symmetric mid-even quantizer for a given data distribution. We use Stochastic gradient descent for optimization of the range. The #steps used for quantization is a fixed design parameter. We test it with: I) Normal distributed data II) Laplacian di...
[ "matplotlib.pyplot.title", "tensorflow.constant_initializer", "tensorflow.reset_default_graph", "matplotlib.pyplot.figure", "bayesian_dnn.misc.setup.config_tensorflow", "matplotlib.pyplot.axvline", "numpy.random.randn", "scipy.stats.laplace.pdf", "numpy.linspace", "matplotlib.pyplot.show", "tens...
[((1177, 1215), 'tensorflow.train.GradientDescentOptimizer', 'tf.train.GradientDescentOptimizer', (['(2.0)'], {}), '(2.0)\n', (1210, 1215), True, 'import tensorflow as tf\n'), ((1401, 1434), 'tensorflow.global_variables_initializer', 'tf.global_variables_initializer', ([], {}), '()\n', (1432, 1434), True, 'import tenso...
""" If you use this code, please the SynthSR paper in: https://github.com/BBillot/SynthSR/blob/master/bibtex.bib Copyright 2020 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apa...
[ "tensorflow.image.ssim", "keras.models.Model", "keras.backend.abs", "tensorflow.debugging.check_numerics", "keras.backend.permute_dimensions", "tensorflow.math.log", "ext.lab2im.layers.DiceLoss", "keras.backend.reverse", "tensorflow.concat", "tensorflow.stack", "tensorflow.cast", "tensorflow.e...
[((6380, 6433), 'keras.models.Model', 'Model', ([], {'inputs': 'input_model.inputs', 'outputs': 'loss_tensor'}), '(inputs=input_model.inputs, outputs=loss_tensor)\n', (6385, 6433), False, 'from keras.models import Model\n'), ((9319, 9375), 'ext.lab2im.utils.load_array_if_path', 'utils.load_array_if_path', (['segmentati...
## # 1) Make better random seed: https://discuss.pytorch.org/t/random-seed-initialization/7854 ## import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.utils.data import DataLoader import random import numpy as np import m...
[ "numpy.random.seed", "matplotlib.pyplot.margins", "torch.nn.functional.dropout", "torch.device", "torchvision.transforms.Normalize", "torch.no_grad", "torchvision.datasets.SVHN", "torch.utils.data.DataLoader", "random.seed", "torch.nn.functional.nll_loss", "torch.nn.functional.log_softmax", "t...
[((531, 551), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (545, 551), True, 'import numpy as np\n'), ((552, 569), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (563, 569), False, 'import random\n'), ((570, 593), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEED)\n', (58...
import pytest import numpy as np import astropy.units as u from gunagala.psf import PSF, MoffatPSF, PixellatedPSF @pytest.fixture(scope='module') def psf_moffat(): return make_moffat() def make_moffat(): psf = MoffatPSF(FWHM=1 / 30 * u.arcminute, shape=4.7) return psf @pytest.fixture(scope='module') ...
[ "pytest.fixture", "pytest.approx", "pytest.raises", "numpy.array", "gunagala.psf.PSF", "gunagala.psf.PixellatedPSF", "gunagala.psf.MoffatPSF" ]
[((118, 148), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (132, 148), False, 'import pytest\n'), ((289, 319), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (303, 319), False, 'import pytest\n'), ((223, 270), 'gunagala.psf.Moffat...
# -*- coding: utf-8 -*- import time import numpy as np from malib.backend.datapool.offline_dataset_server import Episode from malib.utils.metrics import get_metric def grf_simultaneous( trainable_pairs, agent_interfaces, env_desc, metric_type, max_iter, behavior_policy_mapping=None, role=...
[ "numpy.zeros_like", "numpy.asarray", "numpy.zeros", "numpy.expand_dims", "numpy.ones", "time.time", "malib.utils.metrics.get_metric", "numpy.reshape", "malib.backend.datapool.offline_dataset_server.Episode", "numpy.prod" ]
[((564, 575), 'time.time', 'time.time', ([], {}), '()\n', (573, 575), False, 'import time\n'), ((8002, 8013), 'time.time', 'time.time', ([], {}), '()\n', (8011, 8013), False, 'import time\n'), ((732, 755), 'malib.utils.metrics.get_metric', 'get_metric', (['metric_type'], {}), '(metric_type)\n', (742, 755), False, 'from...
import numpy as np import matplotlib.pyplot as plt from collections import Counter, defaultdict import random def plot(result_path, attack_data, mode): """ Plots the confidence histogram of the adversarial examples and draws the reading examples :param result_path: string / path to the attack results ...
[ "numpy.load", "random.shuffle", "collections.defaultdict", "collections.Counter", "matplotlib.pyplot.subplots" ]
[((3231, 3245), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3243, 3245), True, 'import matplotlib.pyplot as plt\n'), ((3945, 3959), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3957, 3959), True, 'import matplotlib.pyplot as plt\n'), ((5213, 5230), 'collections.defaultdict', 'de...
"""This file contains all functions related to the dataset.""" # pylint: disable=import-error import os import torch import numpy as np import torchvision.datasets as datasets from torch.utils.data import WeightedRandomSampler # Load and split training and validation dataset def find_classes(directory): """Find...
[ "torch.utils.data.ConcatDataset", "torch.utils.data.dataset.random_split", "os.path.join", "os.path.basename", "os.path.isdir", "os.walk", "torchvision.datasets.ImageFolder", "numpy.where", "numpy.array", "os.path.expanduser", "os.listdir", "numpy.unique" ]
[((544, 571), 'os.path.basename', 'os.path.basename', (['directory'], {}), '(directory)\n', (560, 571), False, 'import os\n'), ((1371, 1400), 'os.path.expanduser', 'os.path.expanduser', (['directory'], {}), '(directory)\n', (1389, 1400), False, 'import os\n'), ((4283, 4321), 'numpy.array', 'np.array', (['[weight[t] for...
#coding:utf-8 import glob import os import os.path as osp import random import numpy as np import cv2 import time import tensorflow as tf global cfg global is_training cfg, is_training=None, None def _get_num_frames(vid_data,boxes): boxes=boxes.tolist()*int(vid_data.shape[0]) box_ind=range(int(vid_data.shape[0]))...
[ "numpy.dstack", "tensorflow.one_hot", "tensorflow.py_func", "random.uniform", "tensorflow.TensorShape", "tensorflow.data.Dataset.from_tensor_slices", "tensorflow.image.crop_and_resize", "cv2.imread", "numpy.array", "os.path.join", "cv2.resize" ]
[((672, 716), 'random.uniform', 'random.uniform', (['(0.0)', '((256.0 - 224.0) / 256.0)'], {}), '(0.0, (256.0 - 224.0) / 256.0)\n', (686, 716), False, 'import random\n'), ((738, 782), 'random.uniform', 'random.uniform', (['(0.0)', '((340.0 - 224.0) / 340.0)'], {}), '(0.0, (340.0 - 224.0) / 340.0)\n', (752, 782), False,...
import numpy as np def cross_entropy_error(y, t): if y.ndim == 1: t = t.reshape(1, t.size) y = y.reshape(1, y.size) if t.size == y.size: t = t.argmax(axis=1) batch_size = y.shape[0] return -np.sum(np.log(y[np.arange(batch_size), t])) / batch_size def numerical_gradient(f, x)...
[ "numpy.nditer", "numpy.zeros_like", "numpy.arange" ]
[((346, 362), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (359, 362), True, 'import numpy as np\n'), ((373, 432), 'numpy.nditer', 'np.nditer', (['x'], {'flags': "['multi_index']", 'op_flags': "['readwrite']"}), "(x, flags=['multi_index'], op_flags=['readwrite'])\n", (382, 432), True, 'import numpy as np\...
# Copyright 2018 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the ho...
[ "unittest.main", "os.path.join", "numpy.array", "six.moves.range" ]
[((2513, 2528), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2526, 2528), False, 'import unittest\n'), ((1936, 1956), 'six.moves.range', 'six.moves.range', (['(120)'], {}), '(120)\n', (1951, 1956), False, 'import six\n'), ((2429, 2488), 'os.path.join', 'os.path.join', (["os.environ['TEST_SRCDIR']", '"""org_deep...
from pathlib import Path from tempfile import tempdir import numpy as np import pytest from numpy.testing import assert_allclose, assert_almost_equal, assert_equal from ross.bearing_seal_element import * from ross.disk_element import * from ross.materials import steel from ross.point_mass import * from ross.rotor_ass...
[ "numpy.zeros_like", "pathlib.Path.cwd", "numpy.testing.assert_almost_equal", "pytest.raises", "pathlib.Path", "numpy.array", "numpy.linspace", "numpy.testing.assert_allclose", "numpy.log10", "pytest.mark.skip" ]
[((19002, 19079), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""Needs investigation. It fails depending on system."""'}), "(reason='Needs investigation. It fails depending on system.')\n", (19018, 19079), False, 'import pytest\n'), ((46024, 46078), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '...
""" Usage Instructions: 5-way, 1-shot omniglot: python main.py --meta_train_iterations=15000 --meta_batch_size=25 --k_shot=1 --inner_update_lr=0.4 --num_inner_updates=1 --logdir=logs/omniglot5way/ 20-way, 1-shot omniglot: python main.py --meta_train_iterations=15000 --meta_batch_size=16 --k_shot=1 --n_way=20 --in...
[ "tensorflow.python.platform.flags.DEFINE_string", "pickle.dump", "numpy.random.seed", "tensorflow.get_collection", "tensorflow.ConfigProto", "numpy.mean", "tensorflow.train.latest_checkpoint", "tensorflow.python.platform.flags.DEFINE_float", "tensorflow.InteractiveSession", "models.maml.MAML", "...
[((750, 859), 'tensorflow.python.platform.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""n_way"""', '(5)', '"""number of classes used in classification (e.g. 5-way classification)."""'], {}), "('n_way', 5,\n 'number of classes used in classification (e.g. 5-way classification).')\n", (770, 859), False, 'from t...
import numpy as np import matplotlib.pyplot as plt from matplotlib import animation, rc from IPython.display import display import torch from .tools import prepare_ax, prepare_cloud, get_colorscale from ..global_variables import CMAP, PLOT_3D_ALPHA from ..global_variables import DEFAULT_3D_VIEW, PLOT_MAX_3D_POINTS ...
[ "matplotlib.rc", "numpy.abs", "matplotlib.pyplot.get_cmap", "matplotlib.pyplot.close", "numpy.expand_dims", "IPython.display.display", "matplotlib.animation.FuncAnimation", "matplotlib.pyplot.figure", "numpy.random.random", "numpy.arange", "numpy.log10" ]
[((846, 875), 'matplotlib.rc', 'rc', (['"""animation"""'], {'html': '"""html5"""'}), "('animation', html='html5')\n", (848, 875), False, 'from matplotlib import animation, rc\n'), ((891, 917), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(2, 2)'}), '(figsize=(2, 2))\n', (901, 917), True, 'import matplotl...
import cv2 as cv import argparse import numpy as np from common import * backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV) targets = (cv.dnn.DNN_TARGET_CPU, cv.dnn.DNN_TARGET_OPENCL, cv.dnn.DNN_TARGET_OPENCL_FP16, cv.dnn.DNN_TARGET_MYRIA...
[ "cv2.putText", "argparse.ArgumentParser", "numpy.argmax", "cv2.waitKey", "cv2.getTickFrequency", "cv2.dnn.blobFromImage", "cv2.dnn.readNet", "cv2.VideoCapture", "cv2.imshow", "cv2.namedWindow" ]
[((357, 396), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (380, 396), False, 'import argparse\n'), ((1950, 2147), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'parents': '[parser]', 'description': '"""Use this script to run classification dee...
from torch import nn import torch import torch.nn.functional as F from torch.autograd import Variable from core import resnet, densenet, resnext, vgg import numpy as np from core.anchors import generate_default_anchor_maps, hard_nms from config import CAT_NUM, PROPOSAL_NUM class ProposalNet(nn.Module): ...
[ "torch.from_numpy", "torch.nn.ReLU", "torch.stack", "torch.gather", "core.anchors.generate_default_anchor_maps", "torch.nn.Conv2d", "torch.cat", "numpy.array", "torch.nn.functional.log_softmax", "torch.nn.Linear", "torch.zeros", "torch.nn.functional.relu", "torch.nn.functional.interpolate", ...
[((5303, 5328), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['logits', '(-1)'], {}), '(logits, -1)\n', (5316, 5328), True, 'import torch.nn.functional as F\n'), ((5414, 5431), 'torch.stack', 'torch.stack', (['loss'], {}), '(loss)\n', (5425, 5431), False, 'import torch\n'), ((480, 508), 'torch.nn.Conv2d', 'nn.C...
from collections import OrderedDict import torch import torch.nn.functional as F import numpy as np class ConvEmbeddingModel(torch.nn.Module): def __init__(self, input_size, output_size, embedding_dims, hidden_size=128, num_layers=1, convolutional=False, num_conv=4, num_channels=...
[ "torch.mean", "torch.nn.GRU", "h5py.File", "numpy.stack", "torch.nn.ReLU", "torch.nn.functional.batch_norm", "torch.nn.Sequential", "torch.nn.ModuleList", "torch.nn.Conv2d", "torch.nn.functional.conv2d", "torch.cat", "torch.zeros", "torch.nn.BatchNorm2d", "torch.nn.Linear", "collections....
[((3889, 3910), 'torch.nn.ModuleList', 'torch.nn.ModuleList', ([], {}), '()\n', (3908, 3910), False, 'import torch\n'), ((1669, 1684), 'collections.OrderedDict', 'OrderedDict', (['[]'], {}), '([])\n', (1680, 1684), False, 'from collections import OrderedDict\n'), ((2420, 2450), 'torch.nn.Sequential', 'torch.nn.Sequenti...