class_docstr: Test the AlphaSelection visualizer
class_docstr_tok: ["Test","the","AlphaSelection","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
      """
      X, y = load_concrete()
  
      # Create a list of alphas to cross-validate against
      alphas = np.logspace(-10, 1, 400)
  
      model = Pipeline(
          [
              (
                  "imputer",
                  SimpleImputer(missing_values=np.nan, strategy="mean"),
              ),
              (
                  "alpha",
                  AlphaSelection(
                      LassoCV(random_state=42, alphas=alphas)
                  ),
              ),
          ]
      )
  
      model.fit(X, y)
      model["alpha"].finalize()
      self.assert_images_similar(model["alpha"], tol=2.0)
  
imports: import sys
  import pytest
  import numpy
  from tests.base import VisualTestCase
  from numpy.testing import assert_array_equal
  from yellowbrick.datasets import load_energy, load_concrete
  from yellowbrick.exceptions import YellowbrickTypeError
  from yellowbrick.exceptions import YellowbrickValueError
  from yellowbrick.regressor.alphas import AlphaSelection, alphas
  from yellowbrick.regressor.alphas import ManualAlphaSelection, manual_alphas
  from sklearn.svm import SVR, SVC
  from sklearn.cluster import KMeans
  from sklearn.decomposition import PCA
  from sklearn.impute import SimpleImputer
  from sklearn.pipeline import Pipeline
  from sklearn.datasets import make_regression
  from sklearn.linear_model import Ridge, RidgeCV
  from sklearn.linear_model import Lasso, LassoCV
  from sklearn.linear_model import LassoLars, LassoLarsCV
  from sklearn.linear_model import ElasticNet, ElasticNetCV
label_desc: Use image node_id 11 for calling the TestAlphaSelection obj's underlying member method code with example usage: obj.test_within_pipeline() without return types