class_docstr: K-Elbow Visualizer Tests
class_docstr_tok: ["K-Elbow","Visualizer","Tests"]
docstr: Assert that valid values of K generate correct k_values_
code: def test_valid_k(self):
      """
      Assert that valid values of K generate correct k_values_
      """
      # if k is an int, k_values_ = range(2, k+1)
      # if k is a tuple of 2 ints, k_values = range(k[0], k[1])
      # if k is an iterable, k_values_ = list(k)
  
      # Generate a blobs data set
      X, y = make_blobs(
          n_samples=1000,
          n_features=12,
          centers=6,
          shuffle=True,
          random_state=42,
      )
  
      visualizer = KElbowVisualizer(KMeans(), k=8).fit(X)
      assert visualizer.k_values_ == list(np.arange(2, 8 + 1))
  
      visualizer = KElbowVisualizer(KMeans(), k=(4, 12)).fit(X)
      assert visualizer.k_values_ == list(np.arange(4, 12))
  
      visualizer = KElbowVisualizer(
          KMeans(), k=np.arange(10, 100, 10)
      ).fit(X)
      assert visualizer.k_values_ == list(np.arange(10, 100, 10))
  
      visualizer = KElbowVisualizer(
          KMeans(), k=[10, 20, 30, 40, 50, 60, 70, 80, 90]
      ).fit(X)
      assert visualizer.k_values_ == list(np.arange(10, 100, 10))
  
imports: import sys
  import pytest
  import numpy
  import matplotlib.pyplot
  from scipy.sparse import csc_matrix, csr_matrix
  from numpy.testing import assert_array_almost_equal
  from sklearn.datasets import make_blobs
  from sklearn.cluster import KMeans, MiniBatchKMeans
  from sklearn.feature_extraction.text import TfidfVectorizer
  from tests.fixtures import Dataset
  from tests.base import VisualTestCase
  from yellowbrick.datasets import load_hobbies
  from yellowbrick.cluster.elbow import distortion_score
  from yellowbrick.cluster.elbow import KElbowVisualizer, kelbow_visualizer
  from yellowbrick.exceptions import YellowbrickValueError, YellowbrickWarning
  from tests.base import IS_WINDOWS_OR_CONDA
label_desc: Use image node_id 5 for calling the TestKElbowVisualizer obj's underlying member method code with example usage: obj.test_valid_k() without return types