0

I want to create a silhouette visualization with SilhouetteVisualizer (I use VSCode) but got this message:

AttributeError: 'NoneType' object has no attribute 'split'

Code is :

from yellowbrick.cluster import SilhouetteVisualizer from yellowbrick.cluster import silhouette_visualizer

fig, ax = plt.subplots(3, 2, figsize = (15,8))

for i in np.arange(2,8):

km = KMeans(n_clusters = i, init="k-means++", n_init = 10, max_iter = 100, random_state = 42)

q, mod = divmod(i,2)

visualizer = SilhouetteVisualizer(km, colors = 'yellowbrick', ax = ax[q-1][mod]) visualizer.fit(data_scaled_pca_df)

The data_scaled_pca_df is a dataframe of scaled values 6 columns total.

I googled and haven't found any answer, a colleague of mine tried this in Collab and it does work.

My goal is to create a silhouette like this :

The expected plot

Any clues? would be much appreciated

Arc Angel
  • 1
  • 1

0 Answers0