模型介绍
GMM(高斯混合模型,Gaussian misture model)是一个聚类模型,特点是可以得出概率值
$P(y\mid\theta)=\sum\limits_{k=1}^K \alpha_k \phi(y\mid \theta)$
其中,$\sum\limits_{k}^K \alpha_k = 1$
$\phi(y\mid \theta_k)=\dfrac{1}{\sqrt{2\pi}\sigma_k}\exp(-\dfrac{(y-u_k)^2}{2\sigma_k^2})$
参数计算
用MLE方法1
为求解MLE,引入EM算法2
Python实现
from sklearn.mixture import GaussianMixture
pca_scaled_data=PCA(n_components=2).fit_transform(data)
gm = GaussianMixture(n_components=3, n_init=3)
gm.fit(pca_scaled_data)
GaussianMixture(covariance_type=’full’, init_params=’kmeans’, max_iter=100, means_init=None, n_components=3, n_init=3, precisions_init=None, random_state=None, reg_covar=1e-06, tol=0.001, verbose=0, verbose_interval=10, warm_start=False, weights_init=None)
gm.predict(pca_scaled_data)
gm.predict_proba(pca_scaled_data)
gm.bic(pca_scaled_data)