-
카테고리
-
세부 분야
딥러닝 · 머신러닝
-
해결 여부
미해결
GMM에서 최적의 n_component 도출 방법 문의
21.03.03 23:54 작성 조회수 349
0
안녕하세요. 강사님.
K-means에서는 최적의 클러스터 개수를 구하기 위해 elbow method나 강의에서 소개해주신 실루엣 계수를 사용하는데(물론 이 방법들로 최적의 클러스터 개수를 반드시 도출한다는 보장은 없지만),
GMM에서는 최적의 클러스터 개수를(n_component) 구하기 위해 어떻게 해야하나요?
답변을 작성해보세요.
0
권 철민
지식공유자2021.03.04
안녕하십니까,
일반적으로 GMM은 N_COMPONENT 최적화는
1. 실루엣 스코어도 GMM에서 사용할 수 있습니다.
2. Bayesian information criterion 을 사용합니다.(GMM이 확률 생성 모델이다 보니, BIC 방식을 적용할 수 있습니다)
사이킷런에 BIC가 내재 되어 있습니다. 아래코드로 수행해 보십시요. (https://jakevdp.github.io/PythonDataScienceHandbook/05.12-gaussian-mixtures.html 를 참조했습니다)
from sklearn.datasets import make_moons
Xmoon, ymoon = make_moons(200, noise=.05, random_state=0)
plt.scatter(Xmoon[:, 0], Xmoon[:, 1]);
n_components = np.arange(1, 21) models = [GMM(n, covariance_type='full', random_state=0).fit(Xmoon) for n in n_components] plt.plot(n_components, [m.bic(Xmoon) for m in models], label='BIC') #plt.plot(n_components, [m.aic(Xmoon) for m in models], label='AIC') plt.legend(loc='best') plt.xlabel('n_components');
답변 1