class_docstr: Base linear model.
  
  Currently wrapper around linear models in scikit-learn.
  
  https://github.com/scikit-learn/scikit-learn
class_docstr_tok: ["Base","linear","model",".","Currently","wrapper","around","linear","models","in","scikit-learn",".","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, visualizing feature-value pairs
      for each instance as horizontal bar charts.
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",",","visualizing","feature-value","pairs","for","each","instance","as","horizontal","bar","charts","."]
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, visualizing feature-value pairs
          for each instance as horizontal bar charts.
      """
  
      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")
  
      X, _, _ = unify_data(
          X,
          n_samples,
          self.feature_names_in_,
          self.feature_types_in_,
          False,
          0,
      )
  
      model = self._model()
  
      classes = None
      is_classification = is_classifier(self)
      intercept = model.intercept_
      coef = model.coef_
      if is_classification:
          classes = self.classes_
          predictions = self.predict_proba(X)
          if len(classes) == 2:
              predictions = predictions[:, 1]
              intercept = intercept[0]
              coef = coef[0]
      else:
          predictions = self.predict(X)
  
      data_dicts = []
      scores_list = []
      perf_list = []
      perf_dicts = gen_perf_dicts(
          predictions, y, is_classification, classes
      )
      for i, instance in enumerate(X):
          scores = list(coef * instance)
          scores_list.append(scores)
          data_dict = {}
          data_dict["data_type"] = "univariate"
  
          # Performance related (conditional)
          perf_dict_obj = None if perf_dicts is None else perf_dicts[i]
          data_dict["perf"] = perf_dict_obj
          perf_list.append(perf_dict_obj)
  
          # Names/scores
          data_dict["names"] = self.feature_names_in_
          data_dict["scores"] = scores
  
          # Values
          data_dict["values"] = instance
  
          data_dict["extra"] = {
              "names": ["Intercept"],
              "scores": [intercept],
              "values": [1],
          }
          data_dicts.append(data_dict)
  
      internal_obj = {
          "overall": None,
          "specific": data_dicts,
          "mli": [
              {
                  "explanation_type": "local_feature_importance",
                  "value": {
                      "scores": scores_list,
                      "intercept": intercept,
                      "perf": perf_list,
                  },
              }
          ],
      }
      internal_obj["mli"].append(
          {
              "explanation_type": "evaluation_dataset",
              "value": {"dataset_x": X, "dataset_y": y},
          }
      )
  
      selector = gen_local_selector(
          data_dicts, is_classification=is_classification
      )
  
      return FeatureValueExplanation(
          "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
  from ..api.templates import FeatureValueExplanation
  from ..utils._explanation import gen_name_from_class, gen_global_selector, gen_local_selector
  from ..utils._explanation import gen_perf_dicts
  from abc import abstractmethod
  from sklearn.base import is_classifier
  from sklearn.utils.validation import check_is_fitted
  import numpy
  from sklearn.base import ClassifierMixin, RegressorMixin
  from sklearn.linear_model import LogisticRegression
  from sklearn.linear_model import LinearRegression
  from ..utils._clean_x import preclean_X
  from ..utils._clean_simple import clean_dimensions, typify_classification
  from ..utils._unify_data import unify_data
label_desc: Use image node_id 5 for calling the BaseLinear obj's underlying member method code with example usage: obj.explain_local(X, y, name) and returns: FeatureValueExplanation