class_docstr: Test the InterclusterDistance visualizer
class_docstr_tok: ["Test","the","InterclusterDistance","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_nfl()
  
      model = Pipeline(
          [
              (
                  "imputer",
                  SimpleImputer(missing_values=np.nan, strategy="mean"),
              ),
              (
                  "icdm",
                  InterclusterDistance(
                      KMeans(5, random_state=42), random_state=42
                  ),
              ),
          ]
      )
  
      model.fit(X)
      model["icdm"].finalize()
      self.assert_images_similar(model["icdm"], tol=2.0)
  
imports: import pytest
  import matplotlib
  import numpy
  from yellowbrick.cluster.icdm import *
  from yellowbrick.datasets import load_nfl
  from yellowbrick.exceptions import YellowbrickValueError
  from unittest import mock
  from tests.fixtures import Dataset
  from tests.base import IS_WINDOWS_OR_CONDA, VisualTestCase
  from sklearn.datasets import make_blobs
  from sklearn.cluster import Birch, AgglomerativeClustering
  from sklearn.decomposition import LatentDirichletAllocation
  from sklearn.cluster import KMeans, AffinityPropagation, MiniBatchKMeans
  from sklearn.pipeline import Pipeline
  from sklearn.impute import SimpleImputer
label_desc: Use image node_id 12 for calling the TestInterclusterDistance obj's underlying member method code with example usage: obj.test_within_pipeline() without return types