vendredi 14 février 2020

Gaussian Mixture Model cross-validation

I'd like to cross-validate my gaussian mixture model. Currently I use sklearn's cross_validation method as below.

clf = GaussianMixture(n_components=len(np.unique(y)), covariance_type='full')
cv_ortho = cross_validate(clf, parameters_train, y, cv=10, n_jobs=-1, scoring=scorer)

I see that cross_validation is training my classifier with y_train making it a supervised classifier.

try:
    if y_train is None:
        estimator.fit(X_train, **fit_params)
    else:
        estimator.fit(X_train, y_train, **fit_params)

However, I wanted to cross-validate an unsupervised classifier clf.fit(parameters_train). I understand that the classifier then assigns its own class labels. Since, I have two distinguished clusters (see image) and y I can decipher the corresponding labels. Then cross-validate. Is there a routine in sklearn which does this?

A routine similar to this example: https://scikit-learn.org/stable/auto_examples/mixture/plot_gmm_covariances.html

enter image description here

Aucun commentaire:

Enregistrer un commentaire