AlexanderFabisch / gmr

Gaussian Mixture Regression
https://alexanderfabisch.github.io/gmr/
BSD 3-Clause "New" or "Revised" License
168 stars 49 forks source link

GMM.means and GMM.covariances have different number of components #2

Closed rocreguant closed 9 years ago

rocreguant commented 9 years ago

Once the model is trained GMM.means has the number of components (n_components, n_features) but GMM.covariances seem to have the number of training points (n_training_points, n_features, n_features). Can it be that even though the len(covariance) == n_training_points, the first points belong to the n_components? Because after reading the code it seems that works but the algorithms take only the first points ignoring the rest.

AlexanderFabisch commented 9 years ago

Hi,

I can't see how this could happen. Can you give me a simple example?

rocreguant commented 9 years ago

Through the training, not on the class creation

AlexanderFabisch commented 9 years ago

That should not happen, see here

rocreguant commented 9 years ago

Agree, it does not make any sense to me. Thanks! :)

rocreguant commented 9 years ago

One quick question. Is there a quick way to get the standard deviation/variance from the prediction?

AlexanderFabisch commented 9 years ago

You cannot directly get the variance from the prediction. This is not really straightforward. However, you can call GMM.condition to get the conditional GMM p(y|x). Than you could compute the responsibilities for the prediction for each component and take the covariance of the Gaussian distribution with the highest responsibility.

rocreguant commented 9 years ago

Thanks! It worked wonders!