code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Color based K-means""" import numpy as np import cv2 import os import glob from glob import glob from PIL import Image from matplotlib import pyplot as plt from skimage import morphology import pdb def color_quantization(image, k): """Performs color quantization using K-means clustering algorithm""" # Tra...
[ "numpy.dstack", "numpy.uint8", "matplotlib.pyplot.show", "cv2.bitwise_and", "os.path.basename", "cv2.cvtColor", "matplotlib.pyplot.imshow", "cv2.threshold", "numpy.float32", "cv2.connectedComponentsWithStats", "cv2.imread", "skimage.morphology.remove_small_objects", "cv2.kmeans", "glob.glo...
[((2118, 2153), 'glob.glob', 'glob', (["(heatMap_image_path + '/*.png')"], {}), "(heatMap_image_path + '/*.png')\n", (2122, 2153), False, 'from glob import glob\n'), ((757, 823), 'cv2.kmeans', 'cv2.kmeans', (['data', 'k', 'None', 'criteria', '(10)', 'cv2.KMEANS_RANDOM_CENTERS'], {}), '(data, k, None, criteria, 10, cv2....
import skimage.io as io import skimage.transform as skt import numpy as np from PIL import Image from src.models.class_patcher import patcher from src.utils.imgproc import * from skimage.color import rgb2hsv, hsv2rgb, rgb2gray from skimage.filters import gaussian class patcher(patcher): def __init__(self, body='....
[ "numpy.dstack", "PIL.Image.new", "numpy.uint8", "skimage.color.hsv2rgb", "numpy.copy", "skimage.io.imread", "skimage.color.rgb2hsv", "numpy.float32", "numpy.clip", "PIL.Image.open", "numpy.mean", "numpy.array", "skimage.transform.resize", "PIL.Image.fromarray", "numpy.concatenate" ]
[((456, 496), 'PIL.Image.open', 'Image.open', (['"""./material/mimino_skin.png"""'], {}), "('./material/mimino_skin.png')\n", (466, 496), False, 'from PIL import Image\n'), ((1372, 1387), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (1380, 1387), True, 'import numpy as np\n'), ((1639, 1677), 'skimage.color....
# Import libraries import numpy as np import tensorflow as tf import os from PIL import Image import matplotlib.pyplot as plt import math # Set global values ROWS = 224 COLS = 224 lr = 0.001 # pkeep = 0.5 window = 5 tf.set_random_seed(0) # Functions go here def read_from_folder(filename): a = so...
[ "numpy.argmax", "tensorflow.reshape", "tensorflow.matmul", "numpy.random.randint", "numpy.mean", "tensorflow.nn.conv2d", "os.path.join", "tensorflow.truncated_normal", "tensorflow.nn.softmax", "tensorflow.one_hot", "tensorflow.nn.relu", "numpy.std", "tensorflow.set_random_seed", "tensorflo...
[((231, 252), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(0)'], {}), '(0)\n', (249, 252), True, 'import tensorflow as tf\n'), ((4823, 4867), 'numpy.zeros', 'np.zeros', ([], {'shape': '(L9 + number, ROWS, COLS, 3)'}), '(shape=(L9 + number, ROWS, COLS, 3))\n', (4831, 4867), True, 'import numpy as np\n'), ((48...
# -*- coding: utf-8 -*- """Annotation object. Annotation object is optional metadata for slide. This object can handle ASAP or WSIViewer style annotation. By adding annotationparser, you can process annotation data from other types of annotation tools. Example: Loading annotation data:: python import ws...
[ "cv2.bitwise_xor", "cv2.bitwise_and", "cv2.cvtColor", "cv2.threshold", "numpy.zeros", "pathlib.Path", "cv2.bitwise_or", "numpy.array", "numpy.int32", "cv2.resize" ]
[((6434, 6483), 'numpy.zeros', 'np.zeros', (['(wsi_height, wsi_width)'], {'dtype': 'np.uint8'}), '((wsi_height, wsi_width), dtype=np.uint8)\n', (6442, 6483), True, 'import numpy as np\n'), ((10333, 10372), 'cv2.cvtColor', 'cv2.cvtColor', (['thumb', 'cv2.COLOR_RGB2GRAY'], {}), '(thumb, cv2.COLOR_RGB2GRAY)\n', (10345, 10...
""" Create betagal simulation with 200 particles. """ import os import numpy as np import isdbeads as isd from csb.io import load from csb.bio.io import mrc from gibbs import set_params # settings n_particles = 200 n_atoms = 32500 diameter = 1.83 * (float(n_atoms)/n_particles)**0.42 k_forcefield = 175. / diameter*...
[ "isdbeads.ChromosomeSimulation", "isdbeads.random_sphere", "os.path.exists", "isdbeads.PosteriorCoordinates", "numpy.random.standard_normal", "gibbs.set_params", "csb.bio.io.mrc.DensityMapReader", "csb.io.load" ]
[((403, 512), 'isdbeads.ChromosomeSimulation', 'isd.ChromosomeSimulation', (['n_particles'], {'forcefield': '"""prolsq"""', 'diameter': 'diameter', 'k_forcefield': 'k_forcefield'}), "(n_particles, forcefield='prolsq', diameter=\n diameter, k_forcefield=k_forcefield)\n", (427, 512), True, 'import isdbeads as isd\n'),...
#Gaussian Mixture Model tools for radar wetlands project, including some generic plotting code #<NAME> 2019 from sklearn.mixture import GaussianMixture from sklearn.cluster import KMeans, Birch, AgglomerativeClustering, MiniBatchKMeans import xarray as xr import itertools from scipy import linalg import matplotlib as...
[ "matplotlib.pyplot.title", "sklearn.cluster.MiniBatchKMeans", "numpy.empty", "sklearn.mixture.GaussianMixture", "numpy.isnan", "numpy.shape", "itertools.cycle", "numpy.unique", "sklearn.cluster.KMeans", "numpy.place", "scipy.linalg.eigh", "sklearn.cluster.AgglomerativeClustering", "numpy.sta...
[((402, 472), 'itertools.cycle', 'itertools.cycle', (["['navy', 'c', 'cornflowerblue', 'gold', 'darkorange']"], {}), "(['navy', 'c', 'cornflowerblue', 'gold', 'darkorange'])\n", (417, 472), False, 'import itertools\n'), ((641, 669), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(1)', '(1 + index)'], {}), '(2, 1...
# -*- coding: utf-8 -*- import os import sys import re import logging from gensim.models import word2vec from sklearn.manifold import TSNE from matplotlib.font_manager import FontProperties from ckiptagger import data_utils, WS import numpy as np import matplotlib.pyplot as plt os.environ["CUDA_VISIBLE_DEV...
[ "ckiptagger.WS", "matplotlib.font_manager.FontProperties", "sklearn.manifold.TSNE", "logging.basicConfig", "matplotlib.pyplot.scatter", "matplotlib.pyplot.annotate", "numpy.asarray", "logging.info", "matplotlib.pyplot.figure", "gensim.models.word2vec.LineSentence", "gensim.models.word2vec.Word2V...
[((387, 434), 'matplotlib.font_manager.FontProperties', 'FontProperties', ([], {'fname': '"""./NotoSansCJK-Light.ttc"""'}), "(fname='./NotoSansCJK-Light.ttc')\n", (401, 434), False, 'from matplotlib.font_manager import FontProperties\n'), ((441, 469), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(16, 16)...
""" Model interface for the HYDrodynamics and RADiation (HYDRAD) code """ import os import numpy as np from scipy.interpolate import splrep, splev import astropy.units as u import astropy.constants as const import sunpy.sun.constants as sun_const from pydrad.configure import Configure from pydrad.parse import Strand ...
[ "scipy.interpolate.splev", "pydrad.configure.Configure", "numpy.zeros", "os.path.join" ]
[((3891, 3908), 'pydrad.configure.Configure', 'Configure', (['config'], {}), '(config)\n', (3900, 3908), False, 'from pydrad.configure import Configure\n'), ((4765, 4780), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (4773, 4780), True, 'import numpy as np\n'), ((4807, 4822), 'numpy.zeros', 'np.zeros', (['s...
import sys import numpy as np import gumpy sys.path.append('../../gumpy') # First specify the location of the data and some # identifier that is exposed by the dataset (e.g. subject) base_dir = '../Data/NST-EMG' subject = 'S1' # The next line first initializes the data structure. # Note that this ...
[ "sys.path.append", "gumpy.data.NST_EMG", "numpy.concatenate", "numpy.zeros", "numpy.ones", "numpy.hstack", "gumpy.features.sequential_feature_selector", "numpy.linalg.norm", "numpy.array", "gumpy.utils.getTrials", "gumpy.signal.rms", "gumpy.signal.butter_bandpass", "numpy.vstack", "gumpy.s...
[((52, 82), 'sys.path.append', 'sys.path.append', (['"""../../gumpy"""'], {}), "('../../gumpy')\n", (67, 82), False, 'import sys\n'), ((506, 550), 'gumpy.data.NST_EMG', 'gumpy.data.NST_EMG', (['base_dir', 'subject', '"""low"""'], {}), "(base_dir, subject, 'low')\n", (524, 550), False, 'import gumpy\n'), ((564, 609), 'g...
import demomodel.config as config import sklearn.metrics import multiprocessing import numpy as np import subprocess import itertools import tempfile import pathlib import torch import json import tqdm import sys def read_ct(path, number=0): bases = [] pairings = [] with open(path) as f: # deal w...
[ "subprocess.run", "tempfile.NamedTemporaryFile", "json.load", "tqdm.tqdm", "json.dump", "multiprocessing.Pool", "pathlib.Path", "numpy.linspace", "itertools.product", "torch.no_grad", "numpy.nanmean" ]
[((2494, 2534), 'subprocess.run', 'subprocess.run', (['cmd'], {'capture_output': '(True)'}), '(cmd, capture_output=True)\n', (2508, 2534), False, 'import subprocess\n'), ((3300, 3329), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (3327, 3329), False, 'import tempfile\n'), ((3780, 3814...
""" Error Analysis """ import numpy as np from quantumnetworks.systems.base import SystemSolver from typing import Any, Dict from abc import abstractmethod, ABCMeta from quantumnetworks.systems.multimode import MultiModeSystem from quantumnetworks.utils.visualization import plot_full_evolution from tqdm import tqdm ...
[ "quantumnetworks.utils.visualization.plot_full_evolution", "tqdm.tqdm", "numpy.std", "quantumnetworks.systems.multimode.MultiModeSystem", "numpy.array", "numpy.random.normal" ]
[((3151, 3186), 'numpy.array', 'np.array', (["self.solves['with_error']"], {}), "(self.solves['with_error'])\n", (3159, 3186), True, 'import numpy as np\n'), ((3216, 3249), 'numpy.std', 'np.std', (['solves_with_error'], {'axis': '(0)'}), '(solves_with_error, axis=0)\n', (3222, 3249), True, 'import numpy as np\n'), ((39...
import sys import os import ctypes import ctypes.util import numpy as np _API = { 'FreeImage_AllocateT': ( ctypes.c_void_p, [ctypes.c_int, # type ctypes.c_int, # width ctypes.c_int, # height ctypes.c_int, # bpp ctypes.c_uint, # red_mask ctypes.c_u...
[ "numpy.dstack", "numpy.ctypeslib.load_library", "locale.getdefaultlocale", "ctypes.util.find_library", "os.path.join", "ctypes.c_int", "ctypes.string_at", "ctypes.byref", "os.path.dirname", "numpy.dtype", "os.environ.get", "ctypes.c_void_p", "numpy.array", "numpy.dot", "ctypes.CDLL", "...
[((5786, 5823), 'ctypes.util.find_library', 'ctypes.util.find_library', (['"""freeimage"""'], {}), "('freeimage')\n", (5810, 5823), False, 'import ctypes\n'), ((16111, 16125), 'ctypes.c_int', 'ctypes.c_int', ([], {}), '()\n', (16123, 16125), False, 'import ctypes\n'), ((23385, 23410), 'locale.getdefaultlocale', 'locale...
import os import os.path as op import shutil import numpy as np import numpy.testing as npt import nibabel as nib import nibabel.tmpdirs as nbtmp from dipy.core.geometry import vector_norm import dipy.core.gradients as dpg import dipy.data as dpd from dipy.io.gradients import read_bvals_bvecs import AFQ.utils.model...
[ "dipy.core.gradients.gradient_table", "AFQ.utils.testing.make_dti_data", "dipy.io.gradients.read_bvals_bvecs", "numpy.ones", "AFQ._fixes.in_place_norm", "os.path.join", "numpy.testing.assert_almost_equal", "AFQ.models.dti.predict", "os.path.exists", "numpy.testing.assert_equal", "AFQ.utils.model...
[((1321, 1349), 'dipy.data.get_fnames', 'dpd.get_fnames', (['"""small_101D"""'], {}), "('small_101D')\n", (1335, 1349), True, 'import dipy.data as dpd\n'), ((1379, 1407), 'dipy.data.get_fnames', 'dpd.get_fnames', (['"""small_101D"""'], {}), "('small_101D')\n", (1393, 1407), True, 'import dipy.data as dpd\n'), ((3678, 3...
from __future__ import division import numpy as np from auxiliary import rotation_matrix2 as rotation_matrix import time def compute_S_matrix_fast(zdir, xtal): ''' Computes the compliance and stiffness matrices S and C a given z-direction. The x- and y-directions are determined automatically '...
[ "numpy.trapz", "numpy.outer", "numpy.tensordot", "auxiliary.rotation_matrix2", "numpy.zeros", "numpy.sin", "numpy.linalg.inv", "numpy.array", "numpy.linspace", "numpy.cos", "numpy.dot" ]
[((698, 720), 'numpy.zeros', 'np.zeros', (['(3, 3, 3, 3)'], {}), '((3, 3, 3, 3))\n', (706, 720), True, 'import numpy as np\n'), ((1173, 1194), 'auxiliary.rotation_matrix2', 'rotation_matrix', (['zdir'], {}), '(zdir)\n', (1188, 1194), True, 'from auxiliary import rotation_matrix2 as rotation_matrix\n'), ((1349, 1363), '...
#necessary imports from numpy.random import normal import numpy as np from dolfin import * from mesh_generation import sphere_mesh from utils import solve_problem from field_sfem import problem_const L = 100 #number of terms in KL-expansion beta = 0.51 #smoothness parameter kappa = 1.0 #length scale parameter k =...
[ "mesh_generation.sphere_mesh", "field_sfem.problem_const", "numpy.random.normal" ]
[((387, 422), 'field_sfem.problem_const', 'problem_const', (['L', 'beta', 'kappa', 'k', 'h'], {}), '(L, beta, kappa, k, h)\n', (400, 422), False, 'from field_sfem import problem_const\n'), ((521, 535), 'mesh_generation.sphere_mesh', 'sphere_mesh', (['h'], {}), '(h)\n', (532, 535), False, 'from mesh_generation import sp...
import numpy as np def cost_1parameter_example(theta,psi): """ Example cost function where theta is one parameter and psi is one parameter. Inputs ------- theta : numpy.ndarray(n), or numpy.ndarray([n_grid,n_grid]) psi : numpy.ndarray(n), or numpy.ndarray([n_grid,n_grid]) Outputs ...
[ "numpy.shape", "numpy.size", "numpy.array", "numpy.maximum" ]
[((708, 719), 'numpy.array', 'np.array', (['c'], {}), '(c)\n', (716, 719), True, 'import numpy as np\n'), ((1749, 1760), 'numpy.array', 'np.array', (['c'], {}), '(c)\n', (1757, 1760), True, 'import numpy as np\n'), ((496, 509), 'numpy.shape', 'np.shape', (['psi'], {}), '(psi)\n', (504, 509), True, 'import numpy as np\n...
#!/usr/bin/env python # coding: utf-8 import sys import os from datetime import datetime, timedelta import urllib import matplotlib as mpl # mpl.use("Agg") import matplotlib.pyplot as plt import numpy as np import scipy.stats from scipy.integrate import odeint import scipy.signal import pandas as pd import seaborn as ...
[ "numpy.load", "pandas.read_csv", "inference.get_last_NPI_date", "numpy.arange", "inference.find_start_day", "click_spinner.spinner", "os.path.exists", "inference.get_first_NPI_date", "datetime.timedelta", "numpy.random.choice", "matplotlib.pyplot.subplots", "seaborn.set_context", "sklearn.me...
[((324, 364), 'seaborn.set_context', 'sns.set_context', (['"""paper"""'], {'font_scale': '(1.3)'}), "('paper', font_scale=1.3)\n", (339, 364), True, 'import seaborn as sns\n'), ((384, 412), 'seaborn.color_palette', 'sns.color_palette', (['"""Set1"""', '(3)'], {}), "('Set1', 3)\n", (401, 412), True, 'import seaborn as s...
# # IMPORT MODULES # import numpy as np import time from odbAccess import openOdb from abaqusConstants import * from contextlib import closing import os import sys # # OPEN ODB AND GET INFO # filename = 'Job-3-HIP-SS-Pulse.odb' odb = openOdb(filename,readOnly=True) i = 0 allSteps = odb.steps.keys() thisStep = odb....
[ "numpy.asarray", "numpy.savetxt", "odbAccess.openOdb" ]
[((236, 268), 'odbAccess.openOdb', 'openOdb', (['filename'], {'readOnly': '(True)'}), '(filename, readOnly=True)\n', (243, 268), False, 'from odbAccess import openOdb\n'), ((2129, 2203), 'numpy.savetxt', 'np.savetxt', (["(filename + '.csv')", 'allHistory'], {'header': 'headertxt', 'delimiter': '""","""'}), "(filename +...
#!/usr/bin/env python from __future__ import print_function from __future__ import division from __future__ import absolute_import # Workaround for segmentation fault for some versions when ndimage is imported after tensorflow. import scipy.ndimage as nd import os import argparse import file_helpers import numpy as ...
[ "tensorflow.train.Coordinator", "argparse.ArgumentParser", "pybh.log_utils.get_logger", "pybh.attribute_dict.AttributeDict.convert_deep", "configuration.get_config_from_cmdline", "pybh.lmdb_utils.LMDB", "file_helpers.input_filename_generator_hdf5", "numpy.set_printoptions", "traceback.print_exc", ...
[((732, 790), 'pybh.log_utils.get_logger', 'log_utils.get_logger', (['"""reward_learning/write_data_to_lmdb"""'], {}), "('reward_learning/write_data_to_lmdb')\n", (752, 790), False, 'from pybh import log_utils\n'), ((1114, 1167), 'file_helpers.input_filename_generator_hdf5', 'file_helpers.input_filename_generator_hdf5'...
#!/usr/bin/env python """ Matrix Variation """ import pickle from datetime import datetime as dt import numpy as np import torch import sinkhorn_torch as sk import stability_testers as st import equi_roc_mat_perturb as er import prior_variation as pv PV = pv.PriorVariation FL = torch.float64 class MatrixVariation: ...
[ "torch.ones", "pickle.dump", "equi_roc_mat_perturb.generate_single", "datetime.datetime.today", "torch.zeros_like", "torch.any", "stability_testers.StabilityTester", "pickle.load", "torch.max", "numpy.linspace", "torch.zeros", "torch.linspace", "torch.from_numpy" ]
[((911, 1014), 'torch.zeros', 'torch.zeros', (['[density * (r_inner + r_outer) * (r_outer - r_inner + 1) // 2, n_row, n_col]'], {'dtype': 'FL'}), '([density * (r_inner + r_outer) * (r_outer - r_inner + 1) // 2,\n n_row, n_col], dtype=FL)\n', (922, 1014), False, 'import torch\n'), ((2223, 2281), 'torch.linspace', 'to...
import numpy as np import cv2 import utils class Homography(object): def __init__(self, data=None): self.H = None self._trans1 = None self._trans2 = None if data is not None: self.fit(data) @property def min_sample_size(self): return 4 def fit(self...
[ "numpy.atleast_2d", "numpy.dot", "numpy.power", "utils.normalize_2d" ]
[((620, 651), 'utils.normalize_2d', 'utils.normalize_2d', (['data[:, :3]'], {}), '(data[:, :3])\n', (638, 651), False, 'import utils\n'), ((686, 717), 'utils.normalize_2d', 'utils.normalize_2d', (['data[:, 3:]'], {}), '(data[:, 3:])\n', (704, 717), False, 'import utils\n'), ((1020, 1047), 'numpy.dot', 'np.dot', (['pts1...
import numpy as np import cv2 from skimage.measure import compare_ssim as ssim def computePRvalues(simMat, mskMat, threshs): thresholds = threshs[:] # thresholds = [0.2,0.4,0.6,0.8] precision = np.zeros((len(thresholds),1)) recall = np.zeros((len(thresholds),1)) dx = int(mskMat.shape[1]/simMat.sh...
[ "skimage.measure.compare_ssim", "numpy.sum", "numpy.logical_and", "numpy.log2", "numpy.zeros", "numpy.isnan", "numpy.max", "numpy.min" ]
[((5929, 5966), 'numpy.zeros', 'np.zeros', (['(num_samples, num_y, num_x)'], {}), '((num_samples, num_y, num_x))\n', (5937, 5966), True, 'import numpy as np\n'), ((858, 873), 'numpy.sum', 'np.sum', (['mask_gt'], {}), '(mask_gt)\n', (864, 873), True, 'import numpy as np\n'), ((3704, 3719), 'numpy.sum', 'np.sum', (['mask...
import copy import torch import torch.nn as nn import torch.nn.functional as F import numpy as np # Implementation of the Deep Deterministic Policy Gradient algorithm (DDPG) # Paper: https://arxiv.org/abs/1509.02971 class Actor(nn.Module): def __init__(self, state_dim, action_dim, M, N, K, power_t, device, max...
[ "copy.deepcopy", "numpy.trace", "torch.load", "torch.nn.BatchNorm1d", "torch.nn.functional.mse_loss", "torch.cat", "torch.nn.Linear", "torch.abs", "numpy.sqrt" ]
[((588, 620), 'torch.nn.Linear', 'nn.Linear', (['state_dim', 'hidden_dim'], {}), '(state_dim, hidden_dim)\n', (597, 620), True, 'import torch.nn as nn\n'), ((639, 672), 'torch.nn.Linear', 'nn.Linear', (['hidden_dim', 'hidden_dim'], {}), '(hidden_dim, hidden_dim)\n', (648, 672), True, 'import torch.nn as nn\n'), ((691, ...
# -*- coding: utf-8 -*- """ Created on Tue Mar 17 18:55:37 2020 @author: Mehul """ import numpy as np import pandas as pd import matplotlib.pyplot as plt #importing the dataset dataset=pd.read_csv("Social_Network_Ads.csv") ''' for X we are using only two factors , age and salary to apply kernel SVM a...
[ "matplotlib.pyplot.title", "sklearn.preprocessing.StandardScaler", "matplotlib.pyplot.show", "pandas.read_csv", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "sklearn.svm.SVC", "sklearn.metrics.confusion_matrix", "matplotlib.pyplot.xlabel", "...
[((200, 237), 'pandas.read_csv', 'pd.read_csv', (['"""Social_Network_Ads.csv"""'], {}), "('Social_Network_Ads.csv')\n", (211, 237), True, 'import pandas as pd\n'), ((586, 640), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.25)', 'random_state': '(0)'}), '(X, y, test_size...
# -*- coding: utf-8 -*- """ This is a script file intend to read MNIST dataset. """ import numpy as np def read_data(label_file,img_file,dummy=True): with open(label_file,'rb') as file: magic_number = int.from_bytes(file.read(4),byteorder='big'); if magic_number == 2049: Nca...
[ "numpy.frombuffer", "numpy.zeros", "os.chdir" ]
[((1341, 1365), 'os.chdir', 'os.chdir', (['"""d:/workspace"""'], {}), "('d:/workspace')\n", (1349, 1365), False, 'import os\n'), ((530, 570), 'numpy.zeros', 'np.zeros', ([], {'shape': '(Ncases, 10)', 'dtype': 'bool'}), '(shape=(Ncases, 10), dtype=bool)\n', (538, 570), True, 'import numpy as np\n'), ((1181, 1215), 'nump...
""" Implementation of a 1-dimensional multi-modal likelihood problem and its sampling using an implementation of classic Nested Sampling via Gleipnir. Adapted from Example1 of the PyMultiNest tutorial: http://johannesbuchner.github.io/pymultinest-tutorial/example1.html """ import numpy as np from scipy.stats import u...
[ "gleipnir.nestedsampling.stopping_criterion.NumberOfIterations", "gleipnir.nestedsampling.NestedSampling", "matplotlib.pyplot.show", "numpy.isnan", "scipy.stats.uniform", "gleipnir.nestedsampling.samplers.MetropolisComponentWiseHardNSRejection", "numpy.array", "numpy.exp", "seaborn.distplot" ]
[((700, 741), 'numpy.array', 'np.array', (['[0.1, 0.2, 0.5, 0.55, 0.9, 1.1]'], {}), '([0.1, 0.2, 0.5, 0.55, 0.9, 1.1])\n', (708, 741), True, 'import numpy as np\n'), ((1034, 1052), 'numpy.isnan', 'np.isnan', (['log_like'], {}), '(log_like)\n', (1042, 1052), True, 'import numpy as np\n'), ((1682, 1768), 'gleipnir.nested...
import matplotlib matplotlib.use("Agg") import os import numpy as np from ssd512_train import training_preprocessing, val_preprocessing from configparser import ConfigParser, ExtendedInterpolation from matplotlib import pyplot as plt from json import loads from keras.models import load_model from keras_loss_function...
[ "keras.models.load_model", "numpy.set_printoptions", "json.loads", "ssd512_train.val_preprocessing", "matplotlib.pyplot.gca", "matplotlib.pyplot.imshow", "matplotlib.pyplot.Rectangle", "keras_loss_function.keras_ssd_loss.SSDLoss", "matplotlib.use", "matplotlib.pyplot.figure", "data_generator.obj...
[((19, 40), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (33, 40), False, 'import matplotlib\n'), ((744, 778), 'os.listdir', 'os.listdir', (['"""saved_figures/custom"""'], {}), "('saved_figures/custom')\n", (754, 778), False, 'import os\n'), ((975, 1010), 'keras_loss_function.keras_ssd_loss.SSD...
# Hyppopy - A Hyper-Parameter Optimization Toolbox # # Copyright (c) German Cancer Research Center, # Division of Medical Image Computing. # All rights reserved. # # This software is distributed WITHOUT ANY WARRANTY; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. # # See L...
[ "pprint.pformat", "numpy.flip", "numpy.log", "hyppopy.solvers.HyppopySolver.HyppopySolver.__init__", "os.path.basename", "scipy.stats.norm.cdf", "numpy.append", "numpy.exp", "numpy.linspace", "itertools.product", "numpy.concatenate" ]
[((616, 642), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (632, 642), False, 'import os\n'), ((1718, 1738), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'N'], {}), '(0, 1, N)\n', (1729, 1738), True, 'import numpy as np\n'), ((1893, 1912), 'numpy.flip', 'np.flip', (['y2'], {'axis': '(...
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "tensorflow.split", "tensorflow.logging.info", "tensorflow.contrib.layers.l2_regularizer", "tensorflow.nn.dynamic_rnn", "tensorflow.concat", "sonnet.Linear", "sonnet.LSTM", "tensorflow.truncated_normal_initializer", "tensorflow.nn.dropout", "numpy.sqrt" ]
[((999, 1086), 'tensorflow.truncated_normal_initializer', 'tf.truncated_normal_initializer', ([], {'mean': '(displace * stddev)', 'stddev': 'stddev', 'dtype': 'dtype'}), '(mean=displace * stddev, stddev=stddev,\n dtype=dtype)\n', (1030, 1086), True, 'import tensorflow as tf\n'), ((967, 989), 'numpy.sqrt', 'numpy.sqr...
""" Implements a Tasked Q-Network (Value function approximator, Critic in actor-critic) """ import math import random import numpy as np import keras as ks import sacx.generic_tasked_q_network as generic from sacx.tasked_dual_neural_net import TaskedDualNeuralNet from sacx.tasked_p_network import PolicyNetwork fr...
[ "numpy.sum", "random.randint", "sacx.tasked_p_network.PolicyNetwork", "keras.optimizers.Adam", "keras.layers.Dense", "numpy.array", "numpy.random.normal", "math.log" ]
[((8953, 9084), 'sacx.tasked_p_network.PolicyNetwork', 'PolicyNetwork', (['(3,)', '[0, 1, 2]', '[0, 1]', 'shared_net', 'individual_net', '(lambda x: x)'], {'entropy_regularization': '(100000)', 'q_network': 'q_net'}), '((3,), [0, 1, 2], [0, 1], shared_net, individual_net, lambda x:\n x, entropy_regularization=100000...
# Measure ACF rotation periods for each star in KTGAS. import numpy as np import matplotlib.pyplot as plt import pandas as pd import os import h5py import kplr import simple_acf as sa import kepler_data as kd def get_lc(id, KPLR_DIR="/Users/ruthangus/.kplr/data/lightcurves"): """ Downloads the kplr light c...
[ "matplotlib.pyplot.subplot", "os.makedirs", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "simple_acf.simple_acf", "numpy.random.randn", "os.path.exists", "matplotlib.pyplot.ylabel", "numpy.shape", "kplr.API", "matplotlib.pyplot.xlabel", "os.path.join" ]
[((1780, 1805), 'simple_acf.simple_acf', 'sa.simple_acf', (['x[m]', 'y[m]'], {}), '(x[m], y[m])\n', (1793, 1805), True, 'import simple_acf as sa\n'), ((453, 473), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (467, 473), False, 'import os\n'), ((492, 502), 'kplr.API', 'kplr.API', ([], {}), '()\n', (50...
import numpy as np from sklearn.linear_model import LogisticRegression from repro_lap_reg.constrained.utils import put_back class LogRegFixedSupport(LogisticRegression): def __init__(self, max_iter=1000, tol=1e-8, penalty='none', **kws): super().__init__(penalty=penalty, max_iter=max_iter, tol=tol, **kws...
[ "numpy.array" ]
[((631, 648), 'numpy.array', 'np.array', (['support'], {}), '(support)\n', (639, 648), True, 'import numpy as np\n')]
""" Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
[ "numpy.sum", "oneflow.ones_initializer", "oneflow.typing.Numpy.Placeholder", "tensorflow.keras.optimizers.SGD", "oneflow.gather", "oneflow.clear_default_session", "tensorflow.Variable", "oneflow.unittest.skip_unless_1n1d", "oneflow.unittest.env.eager_execution_enabled", "numpy.random.randint", "...
[((788, 839), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (832, 839), True, 'import tensorflow as tf\n'), ((31375, 31407), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (31405, 31407)...
import xarray as xr import numpy as np import dask.bag as db from time import time from scipy.interpolate import LinearNDInterpolator from ..core import Instrument, Model from .attenuation import calc_theory_beta_m from .psd import calc_mu_lambda from ..core.instrument import ureg, quantity def calc_total_alpha_beta...
[ "numpy.isin", "xarray.zeros_like", "numpy.arange", "numpy.tile", "numpy.exp", "numpy.interp", "numpy.round", "numpy.copy", "numpy.place", "numpy.stack", "numpy.trapz", "numpy.ones_like", "numpy.all", "numpy.flip", "numpy.logical_and", "numpy.zeros", "time.time", "numpy.where", "n...
[((2296, 2367), 'numpy.tile', 'np.tile', (["model.ds['sigma_180_vol'].values", '(model.num_subcolumns, 1, 1)'], {}), "(model.ds['sigma_180_vol'].values, (model.num_subcolumns, 1, 1))\n", (2303, 2367), True, 'import numpy as np\n'), ((2376, 2437), 'numpy.tile', 'np.tile', (["model.ds['tau'].values", '(model.num_subcolum...
import numpy as np from nengo import * from nengo_spa import * from utils import * D = 32 # Number of dimensions for each ensemble. N = 64 # Number of neurons per dimension. CLOCK_PERIOD = 0.25 # How many seconds a full clock cycle takes. SIM_TIME = 100 # How long to run the simulation. ...
[ "numpy.ones", "numpy.random.RandomState" ]
[((455, 482), 'numpy.random.RandomState', 'np.random.RandomState', (['SEED'], {}), '(SEED)\n', (476, 482), True, 'import numpy as np\n'), ((5795, 5824), 'numpy.ones', 'np.ones', (['(error.n_neurons, 1)'], {}), '((error.n_neurons, 1))\n', (5802, 5824), True, 'import numpy as np\n')]
import matplotlib.pyplot as plt import matplotlib.patches as patches import numpy as np from matplotlib.collections import LineCollection from Gridmap import Gridmap class Visualization(object): # Visualization tools def __init__(self): self.fig = plt.figure() self.ax = self.fig.add_subplot...
[ "matplotlib.collections.LineCollection", "matplotlib.patches.Rectangle", "matplotlib.pyplot.axis", "numpy.hstack", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "numpy.sin", "numpy.array", "numpy.cos", "matplotlib.pyplot.tight_layout" ]
[((269, 281), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (279, 281), True, 'import matplotlib.pyplot as plt\n'), ((371, 380), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (378, 380), True, 'import matplotlib.pyplot as plt\n'), ((389, 404), 'matplotlib.pyplot.axis', 'plt.axis', (['"""off"""'], ...
"""Functions for transforming ranges of values.""" import numpy as np __all__ = [ 'contract', 'shifted_reciprocal', 'truncated_complement', ] def contract(x, c: float = 1): """ Strictly order-preserving function from `[-∞, ∞]` to `[0, 1]` that sends `-∞, -c, 0, c, ∞` to `0, 0.25, 0.5, 0.75, 1`, resp...
[ "numpy.isneginf", "numpy.maximum", "numpy.isposinf" ]
[((1644, 1664), 'numpy.maximum', 'np.maximum', (['(0)', '(1 - x)'], {}), '(0, 1 - x)\n', (1654, 1664), True, 'import numpy as np\n'), ((672, 686), 'numpy.isneginf', 'np.isneginf', (['x'], {}), '(x)\n', (683, 686), True, 'import numpy as np\n'), ((711, 725), 'numpy.isposinf', 'np.isposinf', (['x'], {}), '(x)\n', (722, 7...
# Copyright 2021 Medical Imaging Center, Vingroup Big Data Insttitute (VinBigdata), Vietnam # # 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 ...
[ "numpy.stack", "numpy.log", "argparse.ArgumentParser", "spine.classification.ClassificationEvaluator", "spine.classification.add_classifier_config", "torch.load", "detectron2.data.DatasetCatalog.get", "numpy.clip", "detectron2.utils.logger.setup_logger", "collections.defaultdict", "detectron2.co...
[((1106, 1115), 'detectron2.config.get_cfg', 'get_cfg', ([], {}), '()\n', (1113, 1115), False, 'from detectron2.config import get_cfg\n'), ((1120, 1141), 'spine.config.add_spine_config', 'add_spine_config', (['cfg'], {}), '(cfg)\n', (1136, 1141), False, 'from spine.config import add_spine_config\n'), ((1214, 1240), 'sp...
""" A Stage to load data from a CSV datarelease format file into a PISA pi ContainerSet """ from __future__ import absolute_import, print_function, division import numpy as np import pandas as pd from pisa import FTYPE from pisa.core.pi_stage import PiStage from pisa.utils import vectorizer from pisa.utils.profiler ...
[ "numpy.logical_and", "pandas.read_csv", "pisa.utils.vectorizer.set", "numpy.ones", "pisa.core.container.Container" ]
[((2300, 2329), 'pandas.read_csv', 'pd.read_csv', (['self.events_file'], {}), '(self.events_file)\n', (2311, 2329), True, 'import pandas as pd\n'), ((2468, 2483), 'pisa.core.container.Container', 'Container', (['name'], {}), '(name)\n', (2477, 2483), False, 'from pisa.core.container import Container\n'), ((3196, 3240),...
from typing import Any, Tuple, List import torch.utils.data as data import numpy as np import json import os class TrajDataset(data.Dataset): curr_dir = os.path.dirname(__file__) metadata = json.load( open(os.path.join(curr_dir, '../dataset', 'metadata.json'))) """ Custom Dataset class fo...
[ "json.load", "os.path.dirname", "numpy.array", "torch.utils.data.dataloader.DataLoader", "os.path.join", "numpy.concatenate" ]
[((160, 185), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n'), ((3644, 3695), 'numpy.concatenate', 'np.concatenate', (['(state_norms, action_norms)'], {'axis': '(0)'}), '((state_norms, action_norms), axis=0)\n', (3658, 3695), True, 'import numpy as np\n'), ((4...
''' main model of HandGRaF-Net author: <NAME> date: 24/01/2022 ''' import torch import torch.nn as nn import math import numpy as np from pointutil import Conv1d, Conv2d, BiasConv1d, PointNetSetAbstraction, Mapping import torch.nn.functional as F graph = np.array([[1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, ...
[ "pointutil.Conv1d", "thop.profile", "torch.nn.Conv1d", "pointutil.PointNetSetAbstraction", "pointutil.Mapping", "torch.nn.MaxPool1d", "torch.cat", "thop.clever_format", "torch.randn", "numpy.array", "torch.nn.Softmax", "pointutil.BiasConv1d", "torch.from_numpy" ]
[((258, 1743), 'numpy.array', 'np.array', (['[[1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [1, 1, 1,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, \n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0, \n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
""" Functions for signal transformations __author__: <NAME> """ import numpy as np import matplotlib.pyplot as plt import os.path import os import pandas as pd import csv from sklearn.preprocessing import StandardScaler from typing import Iterable, List, Optional, Tuple from scipy import signal from scipy.signal impo...
[ "matplotlib.pyplot.show", "numpy.flip", "scipy.signal.sosfilt", "numpy.log", "scipy.signal.decimate", "numpy.random.rand", "matplotlib.pyplot.tight_layout", "scipy.signal.butter", "numpy.nanmean" ]
[((2351, 2369), 'numpy.flip', 'np.flip', (['signal', '(0)'], {}), '(signal, 0)\n', (2358, 2369), True, 'import numpy as np\n'), ((2658, 2676), 'numpy.nanmean', 'np.nanmean', (['signal'], {}), '(signal)\n', (2668, 2676), True, 'import numpy as np\n'), ((7673, 7744), 'scipy.signal.butter', 'butter', (['order', 'norm_cuto...
import wx from matplotlib.patches import FancyArrow from matplotlib.figure import Figure from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx import numpy as np class MplCanvasFrame(wx.Frame): def __init__(self, xlims=(-10e...
[ "numpy.radians", "wx.BoxSizer", "matplotlib.figure.Figure", "wx.Frame.__init__", "numpy.sin", "matplotlib.backends.backend_wxagg.FigureCanvasWxAgg", "numpy.linspace", "numpy.cos", "matplotlib.backends.backend_wx.NavigationToolbar2Wx" ]
[((339, 428), 'wx.Frame.__init__', 'wx.Frame.__init__', (['self', 'None', 'wx.ID_ANY'], {'title': '"""Spherical Mirrors"""', 'size': '(640, 480)'}), "(self, None, wx.ID_ANY, title='Spherical Mirrors', size=(\n 640, 480))\n", (356, 428), False, 'import wx\n'), ((507, 538), 'matplotlib.figure.Figure', 'Figure', ([], {...
import multiprocessing import numpy as np import pandas as pd from fuzzywuzzy import fuzz, process from .utils import pipeable def _apply_df(args): df, func, kwargs = args return df.apply(func, **kwargs) def _apply_by_multiprocessing(df, func, workers=4, **kwargs): """ Internal function to apply a...
[ "fuzzywuzzy.process.extractBests", "pandas.Series", "multiprocessing.Pool", "numpy.array_split", "pandas.concat" ]
[((811, 905), 'fuzzywuzzy.process.extractBests', 'process.extractBests', (['x', 'right_data'], {'limit': 'limit', 'score_cutoff': 'score_cutoff', 'scorer': 'scorer'}), '(x, right_data, limit=limit, score_cutoff=score_cutoff,\n scorer=scorer)\n', (831, 905), False, 'from fuzzywuzzy import fuzz, process\n'), ((424, 46...
# Helper code for creating simulated data from numeric fields, using MNIST. # For an example usage at the command line, try: # # $ python simulation.py --dir ~/Desktop/mnist/ --num 10 --speckle_noise --resize --underline_noise --data date # # or to try out name generation, try: # # $ python simulation.py --dir ~/Deskto...
[ "torch.ones", "numpy.abs", "argparse.ArgumentParser", "numpy.zeros", "numpy.expand_dims", "numpy.random.RandomState", "numpy.genfromtxt", "torch.clamp", "numpy.arange", "numpy.array", "torch.zeros", "os.path.join", "os.access", "torchvision.transforms.ToTensor" ]
[((944, 976), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': '(1234)'}), '(seed=1234)\n', (965, 976), True, 'import numpy as np\n'), ((4496, 4528), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': '(1234)'}), '(seed=1234)\n', (4517, 4528), True, 'import numpy as np\n'), ((6162, 618...
import numpy as np import pandas as pd from scipy.sparse import coo from vital_sqi.preprocess.band_filter import BandpassFilter from vital_sqi.common.rpeak_detection import PeakDetector import vital_sqi.sqi as sq from hrvanalysis import get_time_domain_features,get_frequency_domain_features,\ get_nn_intervals,get_...
[ "vital_sqi.sqi.standard_sqi.mean_crossing_rate_sqi", "numpy.isnan", "numpy.mean", "pandas.Grouper", "numpy.copy", "numpy.std", "vital_sqi.sqi.standard_sqi.signal_to_noise_sqi", "hrvanalysis.get_time_domain_features", "hrvanalysis.get_nn_intervals", "vital_sqi.sqi.rpeaks_sqi.correlogram_sqi", "vi...
[((3600, 3652), 'vital_sqi.preprocess.band_filter.BandpassFilter', 'BandpassFilter', ([], {'band_type': '"""butter"""', 'fs': 'sampling_rate'}), "(band_type='butter', fs=sampling_rate)\n", (3614, 3652), False, 'from vital_sqi.preprocess.band_filter import BandpassFilter\n'), ((3968, 3982), 'vital_sqi.common.rpeak_detec...
import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler from sklearn.linear_model import Lasso from sklearn.metrics import mean_squared_error, r2_score class Pipeline: ''' When we call the FeaturePreprocessor for the first time we initi...
[ "numpy.log", "sklearn.model_selection.train_test_split", "sklearn.preprocessing.MinMaxScaler", "sklearn.metrics.r2_score", "numpy.exp", "sklearn.linear_model.Lasso" ]
[((1102, 1116), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {}), '()\n', (1114, 1116), False, 'from sklearn.preprocessing import MinMaxScaler\n'), ((1139, 1184), 'sklearn.linear_model.Lasso', 'Lasso', ([], {'alpha': '(0.005)', 'random_state': 'random_state'}), '(alpha=0.005, random_state=random_state)\n'...
from collections import defaultdict import numpy as np import torch import torch.nn.functional as f from torch import nn from nets import EVNet from nets import RELNet from nets.NERNet import NestedNERModel from utils import utils cpu_device = torch.device("cpu") class DeepEM(nn.Module): """ Network archit...
[ "numpy.pad", "nets.EVNet.EVModel", "nets.RELNet.RELModel", "torch.stack", "nets.NERNet.NestedNERModel.from_pretrained", "torch.cat", "torch.full", "utils.utils.get_max_entity_id", "collections.defaultdict", "torch.device", "torch.zeros", "torch.sum", "torch.tensor", "torch.nn.functional.pa...
[((247, 266), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (259, 266), False, 'import torch\n'), ((504, 571), 'nets.NERNet.NestedNERModel.from_pretrained', 'NestedNERModel.from_pretrained', (["params['bert_model']"], {'params': 'params'}), "(params['bert_model'], params=params)\n", (534, 571), Fals...
import sys import numpy as np from buzzard._a_source import ASource, ABackSource from buzzard._a_source_raster_remap import ABackSourceRasterRemapMixin from buzzard._footprint import Footprint from buzzard import _tools class ASourceRaster(ASource): """Base abstract class defining the common behavior of all rast...
[ "numpy.array_equal", "buzzard._tools.deprecation_pool.wrap_property", "buzzard._tools.deprecation_pool.handle_param_renaming_with_kwargs", "numpy.asarray" ]
[((7962, 8021), 'buzzard._tools.deprecation_pool.wrap_property', '_tools.deprecation_pool.wrap_property', (['"""fp_stored"""', '"""0.4.4"""'], {}), "('fp_stored', '0.4.4')\n", (7999, 8021), False, 'from buzzard import _tools\n'), ((8063, 8128), 'buzzard._tools.deprecation_pool.wrap_property', '_tools.deprecation_pool.w...
import cv2 import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix from sklearn.utils.multiclass import unique_labels from utils.commons import * class Drawer: def __init__(self, draw_points=True, draw_numbers=False, color='green', thickness=1): self.draw_points = ...
[ "cv2.line", "cv2.circle", "cv2.putText", "cv2.getTextSize", "numpy.zeros", "numpy.hstack", "sklearn.utils.multiclass.unique_labels", "numpy.array", "numpy.arange", "cv2.rectangle", "sklearn.metrics.confusion_matrix", "matplotlib.pyplot.subplots", "numpy.vstack" ]
[((5677, 5709), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (5693, 5709), False, 'from sklearn.metrics import confusion_matrix\n'), ((6045, 6059), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (6057, 6059), True, 'import matplotlib.pyplot a...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import numpy.ma as ma from netCDF4 import Dataset import sys sys.path.append("..") from data_prepro...
[ "sys.path.append", "data_preprocessing.rescaling.rescale_utils.get_lat_lon_bins", "netCDF4.Dataset", "numpy.ma.masked_equal", "numpy.searchsorted", "numpy.ma.mean", "numpy.array" ]
[((281, 302), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (296, 302), False, 'import sys\n'), ((417, 464), 'netCDF4.Dataset', 'Dataset', (['"""../../raw_data/elevation/90m.nc"""', '"""r"""'], {}), "('../../raw_data/elevation/90m.nc', 'r')\n", (424, 464), False, 'from netCDF4 import Dataset\n')...
# coding: utf-8 # Distributed under the terms of the MIT License. """ This submodule contains functions to plot chemical shifts and chemical shieldings from NMR calculations. """ from typing import List, Optional, Dict, Union, Tuple import numpy as np from matador.crystal import Crystal from matador.plotting.plotti...
[ "matador.crystal.Crystal", "matador.fingerprints.Fingerprint._broadening_unrolled", "numpy.zeros_like", "numpy.abs", "matplotlib.pyplot.show", "matplotlib.pyplot.figure", "numpy.histogram", "numpy.array", "numpy.max", "numpy.linspace", "numpy.min", "matplotlib.pyplot.rcParams.get", "matplotl...
[((4046, 4117), 'numpy.linspace', 'np.linspace', (['(min_shielding - _buffer)', '(max_shielding + _buffer)'], {'num': '(1000)'}), '(min_shielding - _buffer, max_shielding + _buffer, num=1000)\n', (4057, 4117), True, 'import numpy as np\n'), ((2513, 2555), 'matplotlib.pyplot.rcParams.get', 'plt.rcParams.get', (['"""figu...
"""Code taken from https://github.com/devsisters/DQN-tensorflow/blob/master/dqn/history.py""" import numpy as np from config_mods import * class History: '''Experiance buffer of the behaviour policy of the agent''' def __init__(self, logger, config): self.logger = logger batch_size, history...
[ "numpy.zeros" ]
[((480, 543), 'numpy.zeros', 'np.zeros', (['[history_length, self.num_channels]'], {'dtype': 'np.float32'}), '([history_length, self.num_channels], dtype=np.float32)\n', (488, 543), True, 'import numpy as np\n')]
import random import numpy as np # <codecell> def shuffle_array(array): shuffled_array = np.random.permutation(array) return shuffled_array def shuffle_two_arrays_in_unison(a,b): assert len(a) == len(b) p = np.random.permutation(len(a)) return a[p], b[p] def sample_from_array(A, ...
[ "numpy.random.permutation", "numpy.random.choice" ]
[((103, 131), 'numpy.random.permutation', 'np.random.permutation', (['array'], {}), '(array)\n', (124, 131), True, 'import numpy as np\n'), ((411, 460), 'numpy.random.choice', 'np.random.choice', (['A.shape[0]', 'prop'], {'replace': '(False)'}), '(A.shape[0], prop, replace=False)\n', (427, 460), True, 'import numpy as ...
#!/usr/bin/env python import os import sys import math import argparse import numpy as np import numpy.random as npr import matplotlib matplotlib.use("agg") import matplotlib.pyplot as plt from mpi4py import MPI # Global communicator comm = MPI.COMM_WORLD # Process rank and communicator size rank = comm.Get_rank() siz...
[ "argparse.ArgumentParser", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "matplotlib.use", "numpy.random.poisson", "numpy.random.rand", "math.log", "matplotlib.pyplot.savefig" ]
[((135, 156), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (149, 156), False, 'import matplotlib\n'), ((1177, 1244), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute induction of a gene."""'}), "(description='Compute induction of a gene.')\n", (1200, 1244),...
import os import probvis.general.general as pvg import numpy as np def plot_pdf(save_dir, **args): n_samples = args['n'] if 'n' in args else 1000 mu = args['mean'] if 'mean' in args else 3 sigma = args['sigma'] if 'sigma' in args else 1 s = np.random.lognormal(mu, sigma, n_samples) x = np.linsp...
[ "probvis.general.general.simple_plot", "numpy.log", "numpy.min", "numpy.max", "numpy.random.lognormal", "numpy.sqrt" ]
[((262, 303), 'numpy.random.lognormal', 'np.random.lognormal', (['mu', 'sigma', 'n_samples'], {}), '(mu, sigma, n_samples)\n', (281, 303), True, 'import numpy as np\n'), ((497, 614), 'probvis.general.general.simple_plot', 'pvg.simple_plot', ([], {'save_dir': 'save_dir', 'y': 'pdf', 'x': 'x', 'name': 'name', 'title': '"...
import cv2 import matplotlib.pyplot as plt import numpy as np noise_img1 = cv2.imread("edificio_ruido.jpg",0) plt.subplot(1,2,1) plt.imshow(noise_img1, cmap='gray') noise_img = noise_img1.astype(np.double) m = np.size(noise_img, 0) n = np.size(noise_img, 1) result_image = np.zeros(noise_img.shape,noise_img.dtype) ...
[ "matplotlib.pyplot.subplot", "numpy.size", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "cv2.imread" ]
[((76, 111), 'cv2.imread', 'cv2.imread', (['"""edificio_ruido.jpg"""', '(0)'], {}), "('edificio_ruido.jpg', 0)\n", (86, 111), False, 'import cv2\n'), ((111, 131), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(2)', '(1)'], {}), '(1, 2, 1)\n', (122, 131), True, 'import matplotlib.pyplot as plt\n'), ((130, 165), ...
import numbers import random import cv2 import numpy as np import skimage.transform from torchvision.transforms import functional as F class CenterCrop(object): """Like tf.CenterCrop, but works works on numpy arrays instead of PIL images.""" def __init__(self, size): if isinstance(size, numbers.Numb...
[ "random.randint", "torchvision.transforms.functional.to_tensor", "random.uniform", "numpy.deg2rad", "numpy.ones", "cv2.blur", "cv2.warpAffine", "random.random", "numpy.random.randint", "numpy.fliplr", "numpy.array", "torchvision.transforms.functional.normalize", "cv2.resize" ]
[((22115, 22181), 'cv2.warpAffine', 'cv2.warpAffine', (['img', 'M', 'img.shape[:2][::-1]'], {'flags': 'cv2.INTER_CUBIC'}), '(img, M, img.shape[:2][::-1], flags=cv2.INTER_CUBIC)\n', (22129, 22181), False, 'import cv2\n'), ((22401, 22478), 'cv2.warpAffine', 'cv2.warpAffine', (['img', 'M.params[:2]', 'img.shape[:2][::-1]'...
"""Create tfrecord for pretraining.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import os import random from absl import flags import absl.logging as _logging import numpy as np import tensorflow.compat.v1 as tf import data_utils import...
[ "tensorflow.compat.v1.io.gfile.glob", "numpy.random.seed", "numpy.sum", "data_utils.format_filename", "tensorflow.compat.v1.io.gfile.exists", "numpy.histogram", "tokenization.get_tokenizer", "os.path.join", "tensorflow.compat.v1.app.run", "tensorflow.compat.v1.io.gfile.GFile", "tensorflow.compat...
[((335, 359), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (357, 359), True, 'import tensorflow.compat.v1 as tf\n'), ((382, 461), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""min_doc_len"""', '(1)'], {'help': '"""Minimum document length allowed."""'}), "('min_doc...
from typing import List import numpy as np from CubicEquationsOfState.AdachiEtAl1983 import Adachi1983 from CubicEquationsOfState.AdachiEtAl1985 import Adachi1985 from CubicEquationsOfState.AhlersGmehling2001 import AG2001 from CubicEquationsOfState.Coquelet2004 import Coquelet2004 from CubicEquationsOfState.GasemEtA...
[ "CubicEquationsOfState.PengAndRobinson1976.PR1976", "CubicEquationsOfState.AdachiEtAl1983.Adachi1983", "CubicEquationsOfState.Soave1984.Soave1984", "CubicEquationsOfState.GasemEtAl2001.Gasem2001", "CubicEquationsOfState.Wilson1964.Wilson1964", "CubicEquationsOfState.Twu1995.Twu1995", "CubicEquationsOfSt...
[((1520, 1554), 'numpy.zeros', 'np.zeros', (['(n, n)'], {'dtype': 'np.float64'}), '((n, n), dtype=np.float64)\n', (1528, 1554), True, 'import numpy as np\n'), ((1606, 1636), 'CubicEquationsOfState.vanderWaals1890.vanderWaals1890', 'vanderWaals1890', (['substances', 'k'], {}), '(substances, k)\n', (1621, 1636), False, '...
# Copyright 2017 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
[ "csv.reader", "_testhelper.string_io", "camog._cfastcsv.parse_csv", "numpy.array", "_testhelper.string", "logging.getLogger" ]
[((690, 717), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (707, 717), False, 'import logging\n'), ((835, 856), '_testhelper.string_io', 'th.string_io', (['csv_str'], {}), '(csv_str)\n', (847, 856), True, 'import _testhelper as th\n'), ((870, 901), 'csv.reader', 'csv.reader', (['fp'], {...
# -*- coding: utf-8 -*- """ 'Getting started' with scikit-image library scikit-image demo: open RGB image / translate it to uint8 gray image / get its normalized histogram @author: ssklykov """ # %% Maybe for future (TODO): Specifying dependecies outside the file from skimage.color import rgb2gray from skimage.util imp...
[ "matplotlib.pyplot.tight_layout", "skimage.color.rgb2gray", "matplotlib.pyplot.plot", "os.getcwd", "matplotlib.pyplot.imshow", "skimage.io.imread", "numpy.asarray", "matplotlib.pyplot.axes", "matplotlib.pyplot.yticks", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.rc", "matp...
[((508, 519), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (517, 519), False, 'import os\n'), ((1043, 1065), 'skimage.io.imread', 'io.imread', (['overallPath'], {}), '(overallPath)\n', (1052, 1065), False, 'from skimage import io\n'), ((1335, 1348), 'matplotlib.pyplot.figure', 'plt.figure', (['(2)'], {}), '(2)\n', (1345...
import numpy as np import scipy.ndimage from Functions.grdient import * def horn_schunk_flow(img0,img2,lambada,max_iter,epsilon): """ :param img0: first frame :param img2: second frame :param lambada: hyper parameter :param max_iter: threshold for iterations :param epsilon: decay rate :re...
[ "numpy.array", "numpy.zeros" ]
[((522, 542), 'numpy.zeros', 'np.zeros', (['img0.shape'], {}), '(img0.shape)\n', (530, 542), True, 'import numpy as np\n'), ((551, 571), 'numpy.zeros', 'np.zeros', (['img0.shape'], {}), '(img0.shape)\n', (559, 571), True, 'import numpy as np\n'), ((415, 458), 'numpy.array', 'np.array', (['[[0, 1, 0], [1, 0, 1], [0, 1, ...
import os from mvs_cluster import Cluster import utils as ut import random import numpy as np import imageio import time import json import logging import tensorflow as tf from tensorflow.python.lib.io import file_io logging.basicConfig() """ Copyright 2019, <NAME>, Ubiquity6. """ class ClusterGenerator: def __i...
[ "numpy.stack", "utils.scale_mvs_camera", "json.load", "utils.crop_mvs_input", "utils.flip_cams", "logging.basicConfig", "tensorflow.gfile.ListDirectory", "random.shuffle", "random.Random", "utils.scale_mvs_input", "utils.set_log_level", "time.time", "utils.scale_and_reshape_depth", "utils....
[((217, 238), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (236, 238), False, 'import logging\n'), ((616, 653), 'logging.getLogger', 'logging.getLogger', (['"""ClusterGenerator"""'], {}), "('ClusterGenerator')\n", (633, 653), False, 'import logging\n'), ((662, 691), 'utils.set_log_level', 'ut.set_log...
import numpy n, m = map(int, input().split()) arr = numpy.array([input().split() for _ in range(n)], dtype=int) print(numpy.max(numpy.min(arr, axis=1)))
[ "numpy.min" ]
[((129, 151), 'numpy.min', 'numpy.min', (['arr'], {'axis': '(1)'}), '(arr, axis=1)\n', (138, 151), False, 'import numpy\n')]
import numpy as np import os import tensorflow as tf from time import sleep from experience import ReplayMemory from summary import Summary from tqdm import tqdm class DeepQAgent: def __init__(self, env, sess, config): self.env = env self.sess = sess self.discount_factor = config.discount...
[ "os.mkdir", "tensorflow.clip_by_value", "numpy.argmax", "tensorflow.get_collection", "summary.Summary", "tensorflow.train.RMSPropOptimizer", "tensorflow.reshape", "tensorflow.matmul", "os.path.isfile", "tensorflow.Variable", "numpy.random.randint", "tensorflow.nn.conv2d", "os.path.join", "...
[((1340, 1399), 'summary.Summary', 'Summary', (['config.test_freq', 'self.sess', 'config.checkpoint_dir'], {}), '(config.test_freq, self.sess, config.checkpoint_dir)\n', (1347, 1399), False, 'from summary import Summary\n'), ((1431, 1474), 'os.path.join', 'os.path.join', (['config.checkpoint_dir', '"""ckpt"""'], {}), "...
import numpy as np class Permutation (object): secure = False # additional checks during init print_cyclic = False # cyclic notation for printing (slow!) def __init__(self, permlist=None, size=None): """Two valid inits: (1) permlist = [idx_0, idx_1, idx_2, .. idx_(N-1)] ...
[ "numpy.array", "numpy.sort", "sympy.combinatorics.Permutation", "numpy.arange" ]
[((2930, 2949), 'sympy.combinatorics.Permutation', 'SympyPermutation', (['l'], {}), '(l)\n', (2946, 2949), True, 'from sympy.combinatorics import Permutation as SympyPermutation\n'), ((3053, 3070), 'numpy.arange', 'np.arange', (['(10)', '(15)'], {}), '(10, 15)\n', (3062, 3070), True, 'import numpy as np\n'), ((3235, 32...
import cv2 import numpy as np import serial import time import threading cap = cv2.VideoCapture(1) kernel = np.ones((5,5),np.uint8) class Arduino(threading.Thread): def __init__(self, xval, radius, colorval): threading.Thread.__init__(self) self.isRunning = True self.colorval = colorval ...
[ "cv2.GaussianBlur", "cv2.bitwise_and", "numpy.ones", "cv2.bilateralFilter", "numpy.arange", "cv2.erode", "cv2.imshow", "cv2.inRange", "serial.Serial", "threading.Thread.__init__", "cv2.dilate", "cv2.cvtColor", "cv2.LUT", "cv2.getTrackbarPos", "cv2.destroyAllWindows", "cv2.createTrackba...
[((80, 99), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(1)'], {}), '(1)\n', (96, 99), False, 'import cv2\n'), ((109, 134), 'numpy.ones', 'np.ones', (['(5, 5)', 'np.uint8'], {}), '((5, 5), np.uint8)\n', (116, 134), True, 'import numpy as np\n'), ((2052, 2080), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Red Value"""'], ...
import math import os import struct import ModernGL import pygame, sys from pygame.locals import * from PIL import Image import time import numpy as np import glm import json import m_shaders def local(*path): return os.path.join(os.path.dirname(__file__), *path) def calculate_2d_vertices_square(pos_x, pos_y, sc...
[ "m_shaders.Build_Button_Shader", "m_shaders.BuildShader", "pygame.font.Font", "m_shaders.Build_Frame_Shader", "json.loads", "math.radians", "pygame.display.set_mode", "os.path.dirname", "glm.mat4", "math.cos", "pygame.display.set_caption", "math.sqrt", "ModernGL.create_context", "pygame.in...
[((2821, 3227), 'numpy.array', 'np.array', (['[start_x / screen_x - 1.0, start_y / screen_y - 1.0, (start_x + width) /\n screen_x - 1.0, start_y / screen_y - 1.0, (start_x + width) / screen_x -\n 1.0, (start_y + height) / screen_y - 1.0, start_x / screen_x - 1.0, \n start_y / screen_y - 1.0, (start_x + width) ...
# -*- coding: UTF-8 -*- """ sequential_funcs ================ Script: sequential_funcs.py Author: <EMAIL> Modified: 2018-12-28 Purpose : Calculating sequential values for fields in geodatabase tables Useage : References ---------- `<http://pro.arcgis.com/en/pro-app/arcpy/data-access/nump...
[ "numpy.ma.sum", "arcpytools.fc_info", "numpy.sum", "numpy.nanmedian", "arcpy.DeleteField_management", "numpy.ones", "numpy.isnan", "numpy.iinfo", "arcpy.ListFields", "arcpy.ValidateFieldName", "numpy.unique", "numpy.nanmean", "numpy.set_printoptions", "numpy.ma.masked_print_option.set_disp...
[((720, 827), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'edgeitems': '(5)', 'linewidth': '(80)', 'precision': '(2)', 'suppress': '(True)', 'threshold': '(100)', 'formatter': 'ft'}), '(edgeitems=5, linewidth=80, precision=2, suppress=True,\n threshold=100, formatter=ft)\n', (739, 827), True, 'import nump...
# -*- coding: utf-8 -*- ''' Implements the the cube with hole benchmark problem ''' import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from pyevtk.hl import gridToVTK import scipy.io import matplotlib as mpl mpl.rcParams['figure.dpi'] = 200 import tim...
[ "numpy.random.seed", "numpy.arctan2", "numpy.resize", "tensorflow.reset_default_graph", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.zeros_like", "tensorflow.concat", "tensorflow.set_random_seed", "numpy.int", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "numpy....
[((322, 346), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (344, 346), True, 'import tensorflow as tf\n'), ((418, 438), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (432, 438), True, 'import numpy as np\n'), ((439, 463), 'tensorflow.set_random_seed', 'tf.set_rand...
#!/usr/bin/python # -*- coding: utf-8 -*- """ function related to numerai tournament data current features * data fetching, loading in parquet format * pytorch dataloader using era-batch * load data subset using eras * load riskiest features, multiple targets * feature selection """ import os import pickle from tqdm ...
[ "pickle.dump", "numpy.random.seed", "numpy.argsort", "pathlib.Path", "pickle.load", "os.path.isfile", "os.path.join", "torch.utils.data.DataLoader", "os.path.exists", "numpy.random.shuffle", "tqdm.tqdm", "utils.get_biggest_change_features", "utils.create_api", "numerapi.NumerAPI", "numpy...
[((1256, 1407), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'shuffle': 'rand', 'batch_size': 'cfg.SOLVER.ERA_BATCH_SIZE', 'num_workers': 'cfg.SOLVER.NUM_WORKERS', 'collate_fn': 'collate_fn', 'pin_memory': '(True)'}), '(dataset, shuffle=rand, batch_size=cfg.SOLVER.ERA_BATCH_SIZE,\n num_workers=cfg.SOL...
import numpy as np from scipy.spatial import distance import random from matplotlib.pyplot import * # i = 0 # perfectDay = np.zeros((96,18)) # realDay = perfectDay # while i<10: # p = random.choice(Mindex) # q = random.choice(Mindex) # realDay[p][q] = 1 # i = i+1 # # # #Mwindow = np.zeros((18,4)) # Mw...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "sklearn.cluster.bicluster.SpectralBiclustering", "sklearn.datasets.samples_generator._shuffle", "matplotlib.pyplot.matshow", "numpy.zeros", "sklearn.metrics.consensus_score", "sklearn.datasets.make_checkerboard", "random.choice", "numpy.argsort...
[((1343, 1360), 'numpy.zeros', 'np.zeros', (['(4, 18)'], {}), '((4, 18))\n', (1351, 1360), True, 'import numpy as np\n'), ((1365, 1382), 'numpy.zeros', 'np.zeros', (['(4, 18)'], {}), '((4, 18))\n', (1373, 1382), True, 'import numpy as np\n'), ((1387, 1404), 'numpy.zeros', 'np.zeros', (['(4, 18)'], {}), '((4, 18))\n', (...
from keras.callbacks import LambdaCallback from keras.layers import Dense, LSTM, TimeDistributed, LayerNormalization from keras import Sequential import numpy as np import tensorflow as tf import pickle import os from PIL import Image, ImageChops import matplotlib.pyplot as plt import numpy as np from PIL import Image,...
[ "os.mkdir", "numpy.sum", "matplotlib.pyplot.clf", "imageio.mimsave", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "char_map.get_coords", "PIL.ImageDraw.Draw", "matplotlib.pyplot.xticks", "tensorflow.keras.models.load_model", "imageio.imread", "numpy.asarray", "PIL.ImageChops.darke...
[((2370, 2400), 'PIL.Image.open', 'Image.open', (['"""obj/keyboard.png"""'], {}), "('obj/keyboard.png')\n", (2380, 2400), False, 'from PIL import Image, ImageFont, ImageDraw\n'), ((936, 969), 'numpy.zeros', 'np.zeros', (['(1, max_char, char_dim)'], {}), '((1, max_char, char_dim))\n', (944, 969), True, 'import numpy as ...
import numpy as np from sklearn.metrics import adjusted_rand_score ''' ari in [-1,1], clustering is better when closing to 1 ''' #Adjusted Rand Index def eval_ari(labels, assignments): result_ARI = adjusted_rand_score(labels, assignments) return result_ARI def test(): labels_true = np.array([0, 0, 0,...
[ "sklearn.metrics.adjusted_rand_score", "numpy.array" ]
[((208, 248), 'sklearn.metrics.adjusted_rand_score', 'adjusted_rand_score', (['labels', 'assignments'], {}), '(labels, assignments)\n', (227, 248), False, 'from sklearn.metrics import adjusted_rand_score\n'), ((302, 330), 'numpy.array', 'np.array', (['[0, 0, 0, 1, 1, 1]'], {}), '([0, 0, 0, 1, 1, 1])\n', (310, 330), Tru...
import numpy as np import torch from torch import nn class MergeLayer(torch.nn.Module): def __init__(self, dim1, dim2, dim3, dim4): super().__init__() self.fc1 = torch.nn.Linear(dim1 + dim2, dim3) self.fc2 = torch.nn.Linear(dim3, dim4) self.act = torch.nn.ReLU() torch.nn.init.xavier_normal_(sel...
[ "torch.nn.Dropout", "torch.nn.ReLU", "numpy.abs", "torch.nn.init.xavier_normal_", "torch.cat", "numpy.random.RandomState", "torch.nn.Linear", "numpy.unique" ]
[((174, 208), 'torch.nn.Linear', 'torch.nn.Linear', (['(dim1 + dim2)', 'dim3'], {}), '(dim1 + dim2, dim3)\n', (189, 208), False, 'import torch\n'), ((224, 251), 'torch.nn.Linear', 'torch.nn.Linear', (['dim3', 'dim4'], {}), '(dim3, dim4)\n', (239, 251), False, 'import torch\n'), ((267, 282), 'torch.nn.ReLU', 'torch.nn.R...
import random import torch import datasets from typing import Union, List, Tuple, Dict from dataclasses import dataclass from torch.utils.data import Dataset from transformers import PreTrainedTokenizer, BatchEncoding from transformers import DataCollatorWithPadding import numpy as np from tqdm import tqdm ...
[ "datasets.Value", "numpy.array" ]
[((4084, 4106), 'numpy.array', 'np.array', (['input_ids_3d'], {}), '(input_ids_3d)\n', (4092, 4106), True, 'import numpy as np\n'), ((4139, 4166), 'numpy.array', 'np.array', (['token_type_ids_3d'], {}), '(token_type_ids_3d)\n', (4147, 4166), True, 'import numpy as np\n'), ((4199, 4226), 'numpy.array', 'np.array', (['at...
import numpy as np import pytest from jina.executors.evaluators.embedding.cosine import CosineEvaluator @pytest.mark.parametrize( 'doc_embedding, gt_embedding, expected', [ ([0, 1], [0, 1], 0.0), ([0, 1], [1, 0], 1.0), ([1, 0], [0, 1], 1.0), ([1, 0], [1, 0], 0.0), ([0,...
[ "pytest.mark.parametrize", "numpy.array", "jina.executors.evaluators.embedding.cosine.CosineEvaluator", "numpy.testing.assert_almost_equal" ]
[((108, 298), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""doc_embedding, gt_embedding, expected"""', '[([0, 1], [0, 1], 0.0), ([0, 1], [1, 0], 1.0), ([1, 0], [0, 1], 1.0), ([1, \n 0], [1, 0], 0.0), ([0, -1], [0, 1], 2.0)]'], {}), "('doc_embedding, gt_embedding, expected', [([0, 1],\n [0, 1], 0.0),...
import numpy as np import pandas as pd global epsilon def createData(): X = pd.DataFrame([['youth', False, False, 0], ['youth', False, False, 1], ['youth', True, False, 1], ['youth', True, True, 0], ['youth', False, False, 0], ['mid', False, False, 0], ['mid', False, False, 1], ['mid', True, True, 1], ['mid', Fal...
[ "pandas.DataFrame", "numpy.log", "numpy.argmax", "numpy.zeros", "numpy.array", "pandas.Series" ]
[((82, 510), 'pandas.DataFrame', 'pd.DataFrame', (["[['youth', False, False, 0], ['youth', False, False, 1], ['youth', True, \n False, 1], ['youth', True, True, 0], ['youth', False, False, 0], ['mid',\n False, False, 0], ['mid', False, False, 1], ['mid', True, True, 1], [\n 'mid', False, True, 2], ['mid', Fals...
from models.triq_model import create_triq_model import numpy as np from PIL import Image def predict_image_quality(model_weights_path, image_path): image = Image.open(image_path) image = np.asarray(image, dtype=np.float32) image /= 127.5 image -= 1. model = create_triq_model(n_quality_levels=5) ...
[ "numpy.multiply", "numpy.asarray", "numpy.expand_dims", "PIL.Image.open", "models.triq_model.create_triq_model", "numpy.array" ]
[((162, 184), 'PIL.Image.open', 'Image.open', (['image_path'], {}), '(image_path)\n', (172, 184), False, 'from PIL import Image\n'), ((197, 232), 'numpy.asarray', 'np.asarray', (['image'], {'dtype': 'np.float32'}), '(image, dtype=np.float32)\n', (207, 232), True, 'import numpy as np\n'), ((281, 318), 'models.triq_model...
#----------------------------- scalar_losses.py file ----------------------------------# """ This file contains the definition of the loss functions that are employed in the TBNN-s class, between predicted and truth u'c' vector """ import numpy as np import tensorflow as tf def lossLog(uc, uc_predicted, tf_f...
[ "tensorflow.math.log", "tensorflow.abs", "tensorflow.reduce_sum", "numpy.log", "numpy.sum", "numpy.abs", "tensorflow.math.squared_difference", "tensorflow.reduce_mean", "numpy.expand_dims", "numpy.mean", "numpy.linalg.norm", "tensorflow.norm" ]
[((1057, 1098), 'tensorflow.norm', 'tf.norm', (['(uc - uc_predicted)'], {'ord': '(2)', 'axis': '(1)'}), '(uc - uc_predicted, ord=2, axis=1)\n', (1064, 1098), True, 'import tensorflow as tf\n'), ((1125, 1151), 'tensorflow.norm', 'tf.norm', (['uc'], {'ord': '(2)', 'axis': '(1)'}), '(uc, ord=2, axis=1)\n', (1132, 1151), T...
import numpy as np # ************************************************ # Function : Generate random color in range of [0,255] def generate_random_color(): return (np.random.rand(1,3)[0]*255).astype(np.int32).tolist()
[ "numpy.random.rand" ]
[((164, 184), 'numpy.random.rand', 'np.random.rand', (['(1)', '(3)'], {}), '(1, 3)\n', (178, 184), True, 'import numpy as np\n')]
from flask import Flask, request, Response import jsonpickle import numpy as np import cv2 from DLPred import MakePrediction # Initialize the Flask application app = Flask(__name__) # route http posts to this method @app.route('/api/test', methods=['POST']) def test(): r = request # convert str...
[ "flask.Flask", "cv2.imdecode", "numpy.fromstring", "flask.Response", "DLPred.MakePrediction", "jsonpickle.encode" ]
[((176, 191), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (181, 191), False, 'from flask import Flask, request, Response\n'), ((360, 391), 'numpy.fromstring', 'np.fromstring', (['r.data', 'np.uint8'], {}), '(r.data, np.uint8)\n', (373, 391), True, 'import numpy as np\n'), ((403, 440), 'cv2.imdecode', 'c...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import numpy as np import pylab from nipy.modalities.fmri.utils import events, Symbol, lambdify_t from nipy.modalities.fmri.hrf import glover # Symbol for amplitude a = Symbol('a') # Some event onsets re...
[ "nipy.modalities.fmri.utils.Symbol", "nipy.modalities.fmri.utils.lambdify_t", "nipy.modalities.fmri.utils.events", "pylab.show", "numpy.linspace", "pylab.plot" ]
[((285, 296), 'nipy.modalities.fmri.utils.Symbol', 'Symbol', (['"""a"""'], {}), "('a')\n", (291, 296), False, 'from nipy.modalities.fmri.utils import events, Symbol, lambdify_t\n'), ((344, 365), 'numpy.linspace', 'np.linspace', (['(0)', '(50)', '(6)'], {}), '(0, 50, 6)\n', (355, 365), True, 'import numpy as np\n'), ((5...
import numpy as np import os import re import csv import time import pickle import logging import torch from torchvision import datasets, transforms import torchvision.utils from torch.utils import data import torch.nn.functional as F from options import HiDDenConfiguration, TrainingOptions from model.hidden import H...
[ "torch.cat", "numpy.clip", "time.strftime", "pickle.load", "torchvision.transforms.Normalize", "os.path.join", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "torch.Tensor", "torchvision.transforms.CenterCrop", "re.split", "csv.writer", "torchvision.datasets.ImageFolder", ...
[((597, 616), 'torch.Tensor', 'torch.Tensor', (['image'], {}), '(image)\n', (609, 616), False, 'import torch\n'), ((2169, 2215), 'torch.cat', 'torch.cat', (['[images, watermarked_images]'], {'dim': '(0)'}), '([images, watermarked_images], dim=0)\n', (2178, 2215), False, 'import torch\n'), ((2775, 2806), 'os.path.join',...
""" Functions and objects to work with mzML data and tabular data obtained from third party software used to process Mass Spectrometry data. Objects ------- MSData: reads raw MS data in the mzML format. Manages Chromatograms and MSSpectrum creation. Performs feature detection on centroid data. Functions ---...
[ "os.path.expanduser", "os.makedirs", "pandas.read_csv", "numpy.zeros", "os.path.exists", "numpy.diff", "pickle.load", "pandas.Series", "requests.get", "os.path.join" ]
[((1677, 1712), 'pandas.read_csv', 'pd.read_csv', (['path'], {'low_memory': '(False)'}), '(path, low_memory=False)\n', (1688, 1712), True, 'import pandas as pd\n'), ((3770, 3787), 'pandas.read_csv', 'pd.read_csv', (['data'], {}), '(data)\n', (3781, 3787), True, 'import pandas as pd\n'), ((3804, 3825), 'pandas.Series', ...
import numpy as np import h5py from glob import glob def open_batch(fs,batch_size): inp_array = np.zeros((batch_size,256,256,1)) lab_array = np.zeros((batch_size,256,256,1)) for k in range(batch_size): fname = fs[k] f = h5py.File(fname, "r") inp,lab = f['lim'][:],f['...
[ "numpy.random.permutation", "h5py.File", "numpy.zeros", "glob.glob" ]
[((107, 142), 'numpy.zeros', 'np.zeros', (['(batch_size, 256, 256, 1)'], {}), '((batch_size, 256, 256, 1))\n', (115, 142), True, 'import numpy as np\n'), ((156, 191), 'numpy.zeros', 'np.zeros', (['(batch_size, 256, 256, 1)'], {}), '((batch_size, 256, 256, 1))\n', (164, 191), True, 'import numpy as np\n'), ((265, 286), ...
# Copyright (C) 2020 GreenWaves Technologies, SAS # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This progr...
[ "numpy.maximum", "numpy.tanh", "quantization.kernels.kernel_base.qrec_type", "quantization.kernels.kernel_base.params_type", "numpy.exp", "quantization.new_qrec.AllFloatQRec" ]
[((1165, 1204), 'quantization.kernels.kernel_base.params_type', 'params_type', (['HSwishActivationParameters'], {}), '(HSwishActivationParameters)\n', (1176, 1204), False, 'from quantization.kernels.kernel_base import KernelBase, params_type, qrec_type\n'), ((1206, 1224), 'quantization.kernels.kernel_base.qrec_type', '...
from tensorflow import keras import numpy as np from sklearn.ensemble import RandomForestRegressor import tensorflow as tf from tensorflow.keras import layers def residual_block(x, dilation, n_filters, kernel_size, l2): x_in = x x = layers.Conv1D(filters=n_filters, kernel_size=kernel_size, dilation_rate=dilat...
[ "tensorflow.maximum", "tensorflow.reduce_max", "tensorflow.keras.callbacks.EarlyStopping", "tensorflow.keras.regularizers.l2", "tensorflow.abs", "tensorflow.keras.layers.BatchNormalization", "tensorflow.subtract", "tensorflow.cast", "tensorflow.keras.layers.Activation", "tensorflow.keras.layers.In...
[((877, 930), 'tensorflow.keras.layers.Input', 'layers.Input', ([], {'shape': "(P['time_steps_in'], P['n_vars'])"}), "(shape=(P['time_steps_in'], P['n_vars']))\n", (889, 930), False, 'from tensorflow.keras import layers\n'), ((1353, 1404), 'tensorflow.keras.Model', 'keras.Model', ([], {'inputs': '[x_in]', 'outputs': '[...
from swspt.helpers import remapper_gen, progress_bar, load_source_frame, out_frame_name import numpy as np from functools import lru_cache import util import os from collections import Counter import cv2 as cv2 import shutil def block_name(ids, temp_dir): # fixme: debug stuff!! temp_dir = 'example/t' # if...
[ "util.get_file_name", "cv2.imwrite", "util.chunks", "numpy.zeros", "swspt.helpers.progress_bar", "cv2.imread", "numpy.swapaxes", "functools.lru_cache", "swspt.helpers.remapper_gen" ]
[((471, 522), 'util.get_file_name', 'util.get_file_name', (['ident', 'temp_dir', '"""block"""', '"""png"""'], {}), "(ident, temp_dir, 'block', 'png')\n", (489, 522), False, 'import util\n'), ((650, 679), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'batch_size'}), '(maxsize=batch_size)\n', (659, 679), False, 'f...
""" modules.segmentation.py Summary ------- This module contains the classes which are necessary for the graph-based image segmentation algorithm proposed by Felzenszwalb et. al. ([paper](http://cs.brown.edu/people/pfelzens/papers/seg-ijcv.pdf)). Classes ------- DisjointSetForest implements the base data struc...
[ "PIL.ImageFilter.GaussianBlur", "numpy.pad", "numpy.uint8", "numpy.vectorize", "math.ceil", "numpy.random.rand", "numpy.zeros", "PIL.ImageEnhance.Contrast", "PIL.Image.open", "PIL.Image.fromarray", "numpy.array", "PIL.ImageDraw.Draw" ]
[((8037, 8050), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (8045, 8050), True, 'import numpy as np\n'), ((15555, 15600), 'numpy.zeros', 'np.zeros', (['(self.height, self.width)', 'np.uint8'], {}), '((self.height, self.width), np.uint8)\n', (15563, 15600), True, 'import numpy as np\n'), ((16254, 16302), 'numpy...
import numpy as np def poly_to_polycr(line_fit, ploty, ym_per_pix, xm_per_pix): ### Calc both polynomials using ploty, left_fit and right_fit ### if line_fit is None: return None line_fitx = line_fit[0] * ploty ** 2 + line_fit[1] * ploty + line_fit[2] line_fit_cr = np.polyfit(ploty * ym_per_p...
[ "numpy.absolute", "numpy.max", "numpy.mean", "numpy.polyfit" ]
[((293, 350), 'numpy.polyfit', 'np.polyfit', (['(ploty * ym_per_pix)', '(line_fitx * xm_per_pix)', '(2)'], {}), '(ploty * ym_per_pix, line_fitx * xm_per_pix, 2)\n', (303, 350), True, 'import numpy as np\n'), ((708, 721), 'numpy.max', 'np.max', (['ploty'], {}), '(ploty)\n', (714, 721), True, 'import numpy as np\n'), ((2...
import numpy as np import copy import operator class Firefly: """ Esta es la clase base Firefly que crea vectores de posición y valor de una función en esta posición. Atrributes: intensidad: Arreglo numpy de valores flotantes que corresponde a la función objetivo evaluada en el ar...
[ "numpy.random.random_sample", "copy.copy", "numpy.clip", "operator.attrgetter", "numpy.linalg.norm", "numpy.exp" ]
[((6095, 6120), 'copy.copy', 'copy.copy', (['self.poblacion'], {}), '(self.poblacion)\n', (6104, 6120), False, 'import copy\n'), ((2566, 2604), 'numpy.random.random_sample', 'np.random.random_sample', (['self.dim_fire'], {}), '(self.dim_fire)\n', (2589, 2604), True, 'import numpy as np\n'), ((8884, 8917), 'operator.att...
import math import sys import os import time import numpy as np import scipy from skimage.measure import compare_ssim as ssim from skimage.measure import compare_nrmse as nrmse import cv2 import warnings from skimage.measure import compare_ssim from skimage.transform import resize from scipy.stats import wasserstein_di...
[ "numpy.absolute", "matplotlib.rc", "os.mkdir", "skimage.transform.resize", "numpy.linalg.norm", "numpy.zeros_like", "cv2.imwrite", "cv2.BFMatcher", "os.path.exists", "cv2.resize", "numpy.dstack", "skimage.measure.compare_nrmse", "numpy.uint8", "skimage.measure.compare_ssim", "numpy.min",...
[((421, 442), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (435, 442), False, 'import matplotlib\n'), ((561, 590), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **font)\n", (574, 590), False, 'import matplotlib\n'), ((608, 641), 'warnings.filterwarnings', 'warnings.filterwar...
import torch import torch.nn as nn import numpy as np import torch.nn.functional as F import torch.optim as optim from deeprobust.graph.defense import GCN from deeprobust.graph.utils import * from deeprobust.graph.data import Dataset from deeprobust.graph.global_attack import DICE, Random, Metattack, PGDAttack, MinMax...
[ "numpy.random.seed", "argparse.ArgumentParser", "structack.structack.StructackDegreeRandomLinking", "pandas.read_csv", "structack.structack.StructackDegreeDistance", "structack.structack.StructackDistance", "structack.structack.StructackCommunity", "torch.cuda.device_count", "gc.collect", "deeprob...
[((5133, 5141), 'deeprobust.graph.global_attack.Random', 'Random', ([], {}), '()\n', (5139, 5141), False, 'from deeprobust.graph.global_attack import DICE, Random, Metattack, PGDAttack, MinMax\n'), ((5237, 5243), 'deeprobust.graph.global_attack.DICE', 'DICE', ([], {}), '()\n', (5241, 5243), False, 'from deeprobust.grap...
from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from django.contrib.auth.models import User from django.db import IntegrityError from django.contrib.auth import login, logout, authenticate from .models import Report, database, d...
[ "io.BytesIO", "sklearn.naive_bayes.GaussianNB", "numpy.ravel", "pandas.read_csv", "django.http.FileResponse", "sklearn.metrics.accuracy_score", "django.shortcuts.redirect", "django.contrib.auth.login", "django.contrib.auth.models.User.objects.create_user", "django.contrib.auth.forms.Authentication...
[((575, 695), 'django.shortcuts.render', 'render', (['request', '"""predict/report.html"""', "{'details': personal_details, 'symptoms': symptoms, 'outputs': final_output}"], {}), "(request, 'predict/report.html', {'details': personal_details,\n 'symptoms': symptoms, 'outputs': final_output})\n", (581, 695), False, '...
#!/usr/bin/evn python # _*_ coding: utf-8 _*_ import os import argparse import copy import datetime import subprocess import numpy as np import matplotlib.pyplot as plt from pymatflow.abinit.post.dfpt import dfpt_elastic_piezo_dielec_anaddb_out if __name__ == "__main__": parser = argparse.Argum...
[ "argparse.ArgumentParser", "pymatflow.abinit.post.dfpt.dfpt_elastic_piezo_dielec_anaddb_out", "numpy.transpose", "os.system", "numpy.mat", "os.chdir" ]
[((306, 331), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (329, 331), False, 'import argparse\n'), ((527, 551), 'os.chdir', 'os.chdir', (['args.directory'], {}), '(args.directory)\n', (535, 551), False, 'import os\n'), ((567, 605), 'pymatflow.abinit.post.dfpt.dfpt_elastic_piezo_dielec_anaddb...
#!/usr/bin/env python import os import sys import argparse import json import shutil import time import ast import numpy as np import torch import skvideo.io from .io import IO import tools import tools.utils as utils # TODO import HRNet_model from pose_estimator.simple_HRNet.SimpleHRNet import SimpleHRNet import cv2...
[ "argparse.ArgumentParser", "os.makedirs", "numpy.zeros", "os.path.exists", "numpy.expand_dims", "time.time", "cv2.VideoCapture", "numpy.array", "tools.utils.visualization.stgcn_visualize", "ast.literal_eval", "pose_estimator.simple_HRNet.SimpleHRNet.SimpleHRNet", "numpy.concatenate", "torch....
[((380, 391), 'time.time', 'time.time', ([], {}), '()\n', (389, 391), False, 'import time\n'), ((874, 885), 'time.time', 'time.time', ([], {}), '()\n', (883, 885), False, 'import time\n'), ((1267, 1278), 'time.time', 'time.time', ([], {}), '()\n', (1276, 1278), False, 'import time\n'), ((1379, 1407), 'torch.from_numpy'...
#!/usr/bin/python2.7 # -*- coding=utf-8 -*- # Project: eaglemine # norm_extras.py # some useful sub-routines for Aderson-Darling Test, multi-variate normal CDF # Version: 1.0 # Goal: Routine scripts # Created by @wenchieh on <11/30/2017> __author__ = 'wenchieh' # third-party lib imp...
[ "numpy.sum", "numpy.ones", "numpy.argsort", "numpy.around", "numpy.arange", "numpy.diag", "numpy.isposinf", "numpy.atleast_2d", "scipy.stats.distributions.norm.logsf", "scipy.stats.mvn.mvndst", "numpy.putmask", "numpy.tril_indices", "statsmodels.stats.weightstats.DescrStatsW", "numpy.asarr...
[((717, 762), 'numpy.array', 'np.array', (['[0.576, 0.656, 0.787, 0.918, 1.092]'], {}), '([0.576, 0.656, 0.787, 0.918, 1.092])\n', (725, 762), True, 'import numpy as np\n'), ((781, 869), 'collections.namedtuple', 'namedtuple', (['"""AndersonResult"""', "('statistic', 'critical_values', 'significance_level')"], {}), "('...
import json from pprint import pprint import random import numpy as np import pandas as pd import csv import sys import os import matplotlib.pyplot as plt; plt.rcdefaults() import Paths from Print import Print #pylint: disable=E0401 print = Print() np.random.seed(1337) #prevent plt.show() making terminal hang plt.int...
[ "matplotlib.pyplot.title", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.interactive", "matplotlib.pyplot.bar", "matplotlib.pyplot.close", "matplotlib.pyplot.rcdefaults", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.ylabel", "os.path.join", "Print.Print" ]
[((156, 172), 'matplotlib.pyplot.rcdefaults', 'plt.rcdefaults', ([], {}), '()\n', (170, 172), True, 'import matplotlib.pyplot as plt\n'), ((241, 248), 'Print.Print', 'Print', ([], {}), '()\n', (246, 248), False, 'from Print import Print\n'), ((250, 270), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\...