class_docstr: Test FeatureImportances visualizer
docstr: Test that visualizer can be accessed within a sklearn pipeline
docstr_tok: ["Test","that","visualizer","can","be","accessed","within","a","sklearn","pipeline"]
code: def test_within_pipeline(self):
      """
      Test that visualizer can be accessed within a sklearn pipeline
      """
      dataset = load_concrete(return_dataset=True)
      X, y = dataset.to_data()
      features = dataset.meta["features"]
      features = list(map(lambda s: s.title(), features))
  
      model = Pipeline(
          [
              (
                  "imputer",
                  SimpleImputer(missing_values=np.nan, strategy="mean"),
              ),
              (
                  "fi",
                  FeatureImportances(
                      Lasso(random_state=42),
                      labels=features,
                      relative=False,
                  ),
              ),
          ]
      )
  
      model.fit(X, y)
      model["fi"].finalize()
      self.assert_images_similar(model["fi"], tol=17.5)
  
imports: import pytest
  import numpy
  import numpy.testing
  import matplotlib.pyplot
  from yellowbrick.exceptions import NotFitted
  from yellowbrick.model_selection.importances import *
  from yellowbrick.datasets import load_occupancy, load_concrete
  from sklearn.datasets import load_iris
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.ensemble import GradientBoostingClassifier
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.linear_model import LogisticRegression, Lasso
  from sklearn.impute import SimpleImputer
  from sklearn.pipeline import Pipeline
  from unittest import mock
  from tests.base import VisualTestCase
label_desc: Use image node_id 27 for calling the TestFeatureImportancesVisualizer obj's underlying member method code with example usage: obj.test_within_pipeline() without return types