class_docstr: Shallow Decision Tree (low depth).
  
  Currently wrapper around DecisionTreeClassifier or DecisionTreeRegressor in scikit-learn.
  To keep the tree shallow, max depth is defaulted to 3.
  
  https://github.com/scikit-learn/scikit-learn
class_docstr_tok: ["Shallow","Decision","Tree","(","low","depth",")",".","Currently","wrapper","around","DecisionTreeClassifier","or","DecisionTreeRegressor","in","scikit-learn",".","To","keep","the","tree","shallow",",","max","depth","is","defaulted","to","3.","https",":","\/\/github.com\/scikit-learn\/scikit-learn"]
docstr: Provides local explanations for provided instances.
  
  Args:
      X: Numpy array for X to explain.
      y: Numpy vector for y to explain.
      name: User-defined explanation name.
  
  Returns:
      An explanation object.
docstr_tok: ["Provides","local","explanations","for","provided","instances",".","Args",":","X",":","Numpy","array","for","X","to","explain",".","y",":","Numpy","vector","for","y","to","explain",".","name",":","User-defined","explanation","name",".","Returns",":","An","explanation","object","."]
code: def explain_local(self, X, y=None, name=None):
      """Provides local explanations for provided instances.
  
      Args:
          X: Numpy array for X to explain.
          y: Numpy vector for y to explain.
          name: User-defined explanation name.
  
      Returns:
          An explanation object.
      """
  
      check_is_fitted(self, "has_fitted_")
  
      if name is None:
          name = gen_name_from_class(self)
  
      n_samples = None
      if y is not None:
          y = clean_dimensions(y, "y")
          if y.ndim != 1:
              raise ValueError("y must be 1 dimensional")
          n_samples = len(y)
  
          if is_classifier(self):
              y = typify_classification(y)
          else:
              y = y.astype(np.float64, copy=False)
  
      X, n_samples = preclean_X(
          X, self.feature_names_in_, self.feature_types_in_, n_samples
      )
  
      if n_samples == 0:
          # TODO: we could probably handle this case
          raise ValueError("X has zero samples")
  
      # Extract decision tree structure
      nodes, edges = self._graph_from_tree(
          self._model(), self.feature_names_in_
      )
  
      X, _, _ = unify_data(
          X,
          n_samples,
          self.feature_names_in_,
          self.feature_types_in_,
          False,
          0,
      )
  
      decisions = [
          self._model()
          .decision_path(instance.reshape(1, -1))
          .nonzero()[1]
          + 1
          for instance in X
      ]
  
      classes = None
      is_classification = is_classifier(self)
      if is_classification:
          classes = self.classes_
          predictions = self.predict_proba(X)
          if len(self.classes_) == 2:
              predictions = predictions[:, 1]
      else:
          predictions = self.predict(X)
  
      perf_dicts = gen_perf_dicts(
          predictions, y, is_classification, classes
      )
      data_dicts = [
          {
              "type": "tree",
              "features": self.feature_names_in_,
              "nodes": nodes,
              "edges": edges,
              "decision": decision,
              "perf": None if perf_dicts is None else perf_dicts[i],
          }
          for i, decision in enumerate(decisions)
      ]
  
      internal_obj = {"overall": None, "specific": data_dicts}
  
      selector = gen_local_selector(
          data_dicts, is_classification=is_classification
      )
      return TreeExplanation(
          "local",
          internal_obj,
          feature_names=self.feature_names_in_,
          feature_types=self.feature_types_in_,
          name=name,
          selector=selector,
      )
  
imports: from ..api.base import ExplainerMixin, ExplanationMixin
  from ..utils._explanation import gen_name_from_class, gen_local_selector, gen_global_selector, gen_perf_dicts
  from sklearn.base import ClassifierMixin, RegressorMixin
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.base import is_classifier
  from sklearn.utils.validation import check_is_fitted
  import numpy
  from abc import abstractmethod
  from sklearn.tree import _tree
  from copy import deepcopy
  from ..utils._clean_x import preclean_X
  from ..utils._clean_simple import clean_dimensions, typify_classification
  from ..utils._unify_data import unify_data
  import logging
label_desc: Use image node_id 6 for calling the BaseShallowDecisionTree obj's underlying member method code with example usage: obj.explain_local(X, y, name) and returns: TreeExplanation