Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EM yields NaN after some iterations #316

Open
atlaie opened this issue May 17, 2023 · 0 comments
Open

EM yields NaN after some iterations #316

atlaie opened this issue May 17, 2023 · 0 comments

Comments

@atlaie
Copy link

atlaie commented May 17, 2023

Hi,

I'm currently using Dynamax to implement a Switching Linear Regression (LinearRegressionHMM in Dynamax) and I wanted to know a bit more about the fit_em function. Particularly, I'd like to train the SLR on some data that looks like this:

Screenshot 2023-05-16 at 20 21 25

i.e., in part of its domain, it's constant. Here's a link with the .npz file containing this data (called "target" in that npz file), as well as the predictors ("predictors" in the npz) that I'm trying to use to call fit_em.

Also, I've tried adding some small noise so that the variance is non-null, but still, after some steps, the EM algorithm blows up:

LogLikelihood

Notice how after the 4th iteration (out of 100) it's just full of NaNs. When I try with SGD (fit_sgd) it works and converges to reasonable predictions.

Let me know if any further details are needed,

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant