Content

Board ID 1057
Writer 허진경
Write Date 2020-11-01 16:27:24
Subject SilhouetteVisualizer
Content from yellowbrick.cluster import SilhouetteVisualizer import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns sns.set() fig, ax = plt.subplots(2, 2, figsize=(15,8)) for i in [2, 3, 4, 5]: 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(X)