AlexanderFabisch / gmr

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

Magnitude issue #9

Closed Labulitiolle closed 4 years ago

Labulitiolle commented 4 years ago

Hi @AlexanderFabisch , By going through your algorithm I have noticed that the model cannot predict GMMs when the magnitude of one variable exceeds 1000. In my case, this is not too much an issue as my variables can be scaled. But this may be interesting to take a look at.

Thanks again for your work, GMR should definitely be part of Sklearn...

AlexanderFabisch commented 4 years ago

Hi,

this is an issue that seems to be a bit difficult to fix on the algorithm's side. I would recommend to use sklearn.preprocessing.StandardScaler on your data if this is an issue.

Labulitiolle commented 4 years ago

All right, by curiosity what is causing this issue?

AlexanderFabisch commented 4 years ago

I did not fully understand it yet. Maybe it's numerical problem (for example, exp(small value) -> 0 or exp(large value) -> infinity). If you are interested and want to help you can take a look. I would be happy about any support.

AlexanderFabisch commented 4 years ago

OK, most likely the covariances have to be initialized differently. Means are already initialized to data points but the covariances are always identity matrices. Their variance should be set to something like (average distance / number of Gaussians) ** 2. I don't know if that will fix it though.

Labulitiolle commented 4 years ago

Great, I'll try to have a deeper look at it next weekend. It also seems like the Gaussians do not fit the data the same way as GMM goes it in the sklearn package.

AlexanderFabisch commented 4 years ago

@Labulitiolle Did you have a chance to look into the issue? Meanwhile I also tried some things. See #10

Labulitiolle commented 4 years ago

Hi @AlexanderFabisch , I am really sorry, it's been a bit of a rush lately. Your commit seems to bring great improvement. It is still on my todo list to go through the code. I can't give you a fixed date though...

AlexanderFabisch commented 4 years ago

No problem. I would appreciate any feedback before I merge it.

AlexanderFabisch commented 4 years ago

Thanks. I merged it just a few seconds ago.