class_docstr: General-purpose sampler for dense continuous data, based on univariate
  kernel density estimation. It estimates a separate probability
  distribution for each input dimension.
  
  The limitation is that variable interactions are not taken in account.
  
  Unlike KernelDensitySampler it uses different bandwidths for different
  dimensions; because of that it can handle one-hot encoded features somehow
  (make sure to at least tune the default ``sigma`` parameter).
  Also, at sampling time it replaces only random subsets
  of the features instead of generating totally new examples.
class_docstr_tok: ["General-purpose","sampler","for","dense","continuous","data",",","based","on","univariate","kernel","density","estimation",".","It","estimates","a","separate","probability","distribution","for","each","input","dimension",".","The","limitation","is","that","variable","interactions","are","not","taken","in","account",".","Unlike","KernelDensitySampler","it","uses","different","bandwidths","for","different","dimensions",";","because","of","that","it","can","handle","one-hot","encoded","features","somehow","(","make","sure","to","at","least","tune","the","default","``","sigma","``","parameter",")",".","Also",",","at","sampling","time","it","replaces","only","random","subsets","of","the","features","instead","of","generating","totally","new","examples","."]
docstr: Sample near the document by replacing some of its features
  with values sampled from distribution found by KDE.
docstr_tok: ["Sample","near","the","document","by","replacing","some","of","its","features","with","values","sampled","from","distribution","found","by","KDE","."]
code: def sample_near(self, doc, n_samples=1):
      """
      Sample near the document by replacing some of its features
      with values sampled from distribution found by KDE.
      """
      doc = np.asarray(doc)
      num_features = len(self.kdes_)
      sizes = self.rng_.randint(
          low=1, high=num_features + 1, size=n_samples
      )
      samples = []
      for size in sizes:
          to_change = self.rng_.choice(
              num_features, size, replace=False
          )
          new_doc = doc.copy()
          for i in to_change:
              kde = self.kdes_[i]
              new_doc[i] = kde.sample(random_state=self.rng_).ravel()
          samples.append(new_doc)
      samples = np.asarray(samples)
      return samples, self._similarity(doc, samples)
  
imports: from __future__ import absolute_import
  import abc
  from functools import partial
  from typing import List, Tuple, Any, Union, Dict, Optional
  import six
  import numpy
  from scipy.stats import itemfreq
  from sklearn.base import BaseEstimator, clone
  from sklearn.neighbors import KernelDensity
  from sklearn.metrics import pairwise_distances
  from sklearn.model_selection import GridSearchCV, KFold
  from sklearn.utils import check_random_state
  from eli5.utils import vstack
  from eli5.lime.utils import rbf
  from .textutils import generate_samples, DEFAULT_TOKEN_PATTERN, TokenizedText
label_desc: Use image node_id 2 for calling the UnivariateKernelDensitySampler obj's underlying member method code with example usage: obj.sample_near(doc, n_samples) and returns: samples,  self