From my understanding, Gaussian Mixture Models are an unsupervised method and can perform clustering similar to k-means. In the scitkit-learn implementation of GMM, the .fit() function (and .fit_predict()) has a parameter for y, which is set to None by default. Whereas this parameter is in the code, it is not listed in the documentation table of parameters, or mentioned at all (aside from appearing the function parameters).

With the scitkit-learn implementation of k-means, it also has a y parameter, but says that it is ignored and simply there for API consistency.

I would presume it is also ignored in GMM, but didn't see this when I was trying to understand the base code on the scikit-learn github repo. From my (little) knowledge of GMM, I know that you should initialise means for each component if you have some sort of understanding beforehand of data separations (i.e. you have some labelled data), so wondered if having knowledge of the y would cause the model to re-evaluate the parameters. I have ran with and without the y, and see some minor results, but I'm not sure if this is because the random initialisation of some parameters or the learning process.

My question is - does adding a y to the model fit impact how it learns, or is it simply there for API consistency like it is in k-means?


1 Answer 1


Parameter y seems to be indeed ignored for the GMM model. There is however an example in which means of the GMM model are initialized in a supervised manner, that should be what you are looking for: https://scikit-learn.org/stable/auto_examples/mixture/plot_gmm_covariances.html#sphx-glr-auto-examples-mixture-plot-gmm-covariances-py


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.