Gmm.FoleyGmm#
FoleyGmm.py.
- adapted from:
https://towardsdatascience.com/gaussian-mixture-modelling-gmm-833c88587c7f https://www.kaggle.com/dfoly1/gaussian-mixture-model
Copyright (c) 2020, SAXS Team, KEK-PF
- class GMM(C, n_runs)#
Bases:
object
Gaussian Mixture Model
- Parameters:
k (int , number of gaussian distributions)
seed (int, will be randomly set if None)
max_iter (int, number of iterations to run algorithm, default: 200)
- centroids#
- Type:
array, k, number_features
- cluster_labels#
- Type:
label for each data point
- calculate_mean_covariance(X, prediction)#
- Calculate means and covariance of different
clusters from k-means prediction
Parameters:#
prediction: cluster labels from k-means X: N*d numpy array data points
Returns:#
intial_means: for E-step of EM algorithm intial_cov: for E-step of EM algorithm
- fit(X)#
- Compute the E-step and M-step and
Calculates the lowerbound
Parameters:#
X: (N x d), data
Returns:#
instance of GMM
- get_params()#