class_docstr: A sampler that uses an underlying training set to draw records that have a subset of features with
  values specified in an instance to be explained, `X`. 
class_docstr_tok: ["A","sampler","that","uses","an","underlying","training","set","to","draw","records","that","have","a","subset","of","features","with","values","specified","in","an","instance","to","be","explained",",","`","X","`","."]
docstr: Replaces unknown feature values with defaults. For categorical variables, the replacement value is
  the same as the value of the unknown feature. For continuous variables, a value is sampled uniformly
  at random from the feature range.
  
  Parameters
  ----------
  allowed_bins
      See :py:meth:`alibi.explainers.anchors.anchor_tabular.TabularSampler.get_features_index` method.
  num_samples
      Number of replacement values.
  samples
      Contains the samples whose values are to be replaced.
  unk_feature_values
      List of tuples where: [0] is original feature id, [1] feature type, [2] if var is categorical,
      replacement value, otherwise None
code: def handle_unk_features(
      self,
      allowed_bins: Dict[int, Set[int]],
      num_samples: int,
      samples: np.ndarray,
      unk_feature_values: List[Tuple[int, str, Union[Any, int]]],
  ) -> None:
      """
      Replaces unknown feature values with defaults. For categorical variables, the replacement value is
      the same as the value of the unknown feature. For continuous variables, a value is sampled uniformly
      at random from the feature range.
  
      Parameters
      ----------
      allowed_bins
          See :py:meth:`alibi.explainers.anchors.anchor_tabular.TabularSampler.get_features_index` method.
      num_samples
          Number of replacement values.
      samples
          Contains the samples whose values are to be replaced.
      unk_feature_values
          List of tuples where: [0] is original feature id, [1] feature type, [2] if var is categorical,
          replacement value, otherwise None
      """
  
      for feat, var_type, val in unk_feature_values:
          if var_type == "c":
              fmt = "WARNING: No data records have {} feature with value {}. Setting all samples' values to {}!"
              print(fmt.format(feat, val, val))
              samples[:, feat] = val
          else:
              fmt = (
                  "WARNING: For feature {}, no training data record had discretized values in bins {}."
                  " Sampling uniformly at random from the feature range!"
              )
              print(fmt.format(feat, allowed_bins[feat]))
              min_vals, max_vals = self.min[feat], self.max[feat]
              samples[:, feat] = np.random.uniform(
                  low=min_vals, high=max_vals, size=(num_samples,)
              )
  
imports: import copy
  from collections import OrderedDict, defaultdict
  from itertools import accumulate
  from typing import Any, Callable, DefaultDict, Dict, List, Optional, Set, Tuple, Type, Union
  import numpy
  from alibi.api.defaults import DEFAULT_DATA_ANCHOR, DEFAULT_META_ANCHOR
  from alibi.api.interfaces import Explainer, Explanation, FitMixin
  from alibi.exceptions import NotFittedError, PredictorCallError, PredictorReturnTypeError
  from alibi.utils.discretizer import Discretizer
  from alibi.utils.mapping import ohe_to_ord, ord_to_ohe
  from alibi.utils.wrappers import ArgmaxTransformer
  from .anchor_base import AnchorBaseBeam
  from .anchor_explanation import AnchorExplanation
label_desc: Use image node_id 12 for calling the TabularSampler obj's underlying member method code with example usage: obj.handle_unk_features(allowed_bins, num_samples, samples, unk_feature_values) without return types