class_docstr: Args:
      class_names: list of strings
      feature_names: list of strings
      train_data: used to sample (bootstrap)
      categorical_names: map from integer to list of strings, names for each
          value of the categorical features. Every feature that is not in
          this map will be considered as ordinal or continuous, and thus discretized.
class_docstr_tok: ["Args",":","class_names",":","list","of","strings","feature_names",":","list","of","strings","train_data",":","used","to","sample","(","bootstrap",")","categorical_names",":","map","from","integer","to","list","of","strings",",","names","for","each","value","of","the","categorical","features",".","Every","feature","that","is","not","in","this","map","will","be","considered","as","ordinal","or","continuous",",","and","thus","discretized","."]
code: def get_sample_fn(self, data_row, classifier_fn, desired_label=None):
      def predict_fn(x):
          return classifier_fn(self.encoder_fn(x))
  
      true_label = desired_label
      if true_label is None:
          true_label = predict_fn(data_row.reshape(1, -1))[0]
      # must map present here to include categorical features (for conditions_eq), and numerical features for geq and leq
      mapping = {}
      data_row = self.disc.discretize(data_row.reshape(1, -1))[0]
      for f in self.categorical_features:
          if f in self.ordinal_features:
              for v in range(len(self.categorical_names[f])):
                  idx = len(mapping)
                  if (
                      data_row[f] <= v
                      and v != len(self.categorical_names[f]) - 1
                  ):
                      mapping[idx] = (f, "leq", v)
                      # names[idx] = '%s <= %s' % (self.feature_names[f], v)
                  elif data_row[f] > v:
                      mapping[idx] = (f, "geq", v)
                      # names[idx] = '%s > %s' % (self.feature_names[f], v)
          else:
              idx = len(mapping)
              mapping[idx] = (f, "eq", data_row[f])
          # names[idx] = '%s = %s' % (
          #     self.feature_names[f],
          #     self.categorical_names[f][int(data_row[f])])
  
      def sample_fn(present, num_samples, compute_labels=True):
          conditions_eq = {}
          conditions_leq = {}
          conditions_geq = {}
          for x in present:
              f, op, v = mapping[x]
              if op == "eq":
                  conditions_eq[f] = v
              if op == "leq":
                  if f not in conditions_leq:
                      conditions_leq[f] = v
                  conditions_leq[f] = min(conditions_leq[f], v)
              if op == "geq":
                  if f not in conditions_geq:
                      conditions_geq[f] = v
                  conditions_geq[f] = max(conditions_geq[f], v)
          # conditions_eq = dict([(x, data_row[x]) for x in present])
          raw_data = self.sample_from_train(
              conditions_eq,
              {},
              conditions_geq,
              conditions_leq,
              num_samples,
          )
          d_raw_data = self.disc.discretize(raw_data)
          data = np.zeros((num_samples, len(mapping)), int)
          for i in mapping:
              f, op, v = mapping[i]
              if op == "eq":
                  data[:, i] = (d_raw_data[:, f] == data_row[f]).astype(
                      int
                  )
              if op == "leq":
                  data[:, i] = (d_raw_data[:, f] <= v).astype(int)
              if op == "geq":
                  data[:, i] = (d_raw_data[:, f] > v).astype(int)
          # data = (raw_data == data_row).astype(int)
          labels = []
          if compute_labels:
              labels = (predict_fn(raw_data) == true_label).astype(int)
          return raw_data, data, labels
  
      return sample_fn, mapping
  
imports: from .None import anchor_base
  from .None import anchor_explanation
  from .None import utils
  import lime
  import lime.lime_tabular
  import collections
  import sklearn
  import numpy
  import os
  import copy
  import string
  from io import open
  import json
label_desc: Use image node_id 6 for calling the AnchorTabularExplainer obj's underlying member method code with example usage: obj.get_sample_fn(data_row, classifier_fn, desired_label) and returns: sample_fn,  mapping, classifier_fn, raw_data,  data,  labels