class_docstr: K-Elbow Visualizer Tests
class_docstr_tok: ["K-Elbow","Visualizer","Tests"]
docstr: Test that passing in sample weights correctly influences the clusterer's fit
code: def test_sample_weights(self):
      """
      Test that passing in sample weights correctly influences the clusterer's fit
      """
      seed = 1234
  
      # original data has 5 clusters
      X, y = make_blobs(
          n_samples=[5, 30, 30, 30, 30],
          n_features=5,
          random_state=seed,
          shuffle=False,
      )
  
      visualizer = KElbowVisualizer(
          KMeans(random_state=seed), k=(2, 12), timings=False
      )
      visualizer.fit(X)
      assert visualizer.elbow_value_ == 5
  
      # weights should push elbow down to 4
      weights = np.concatenate([np.ones(5) * 0.0001, np.ones(120)])
  
      visualizer.fit(X, sample_weight=weights)
      assert visualizer.elbow_value_ == 4
  
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 15 for calling the TestKElbowVisualizer obj's underlying member method code with example usage: obj.test_sample_weights() without return types