0

I'm new to python and really need help with this.Trying to use the SilhouetteVisualizer but its giving an error : AttributeError: 'NoneType' object has no attribute 'split'. Please tell me what should I do?

from sklearn.metrics import silhouette_score
from yellowbrick.cluster import SilhouetteVisualizer
import yellowbrick
import matplotlib.pyplot as plt

for i in range(2,10):
    km = KMeans(n_clusters=i,random_state=100)
    km.fit(df)
    sil_score = silhouette_score(df,km.labels_) # needs minimum 2 is required
    print('Silhouette score for ',i,' clusters :',sil_score)
    sil_km = SilhouetteVisualizer(km)
    sil_km.fit(df)
    plt.show()

enter image description here

tushar
  • 1
  • Does this answer your question? [Why do I get AttributeError: 'NoneType' object has no attribute 'something'?](https://stackoverflow.com/questions/8949252/why-do-i-get-attributeerror-nonetype-object-has-no-attribute-something) – Ulrich Eckhardt Jun 16 '22 at 14:57
  • Please don't put images of text like output or a complete backtrace of your program, copy'n'paste the text instead. As a new user here, also read [ask] and take the [tour]. – Ulrich Eckhardt Jun 16 '22 at 14:59

0 Answers0