Gaussian Mixed Model(GMMs)
A GMMs module written in Python
Features
Two typpes of initialization:
- Randomly initializing
- K-means clustering initializing
Basic usage
gmms = GMMs(data,k) # data [n_sample,n_var], k gaussian component number
model.EM(is_k_mean=False,N_iter_max=2000,
is_plot=False,fig_fpath=path1,
is_gif,gif_fpath=fpath2)
Example
from sklearn.datasets.samples_generator import make_blobs
X,Y = make_blobs(cluster_std=2,random_state=np.random.randint(100),
n_samples=500,centers=3)
gmms = GMMs(x=X,k=3,max_iter=100,lh_theta=1e-30)
gmms.EM(is_k_mean=False,
is_plot=True,fig_fpath='images/example.png',
is_gif=True,gif_fpath='images/example.gif')
Result: