dynamax icon indicating copy to clipboard operation
dynamax copied to clipboard

EM yields NaN after some iterations

Open atlaie opened this issue 2 years ago • 1 comments

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!

atlaie avatar May 17 '23 00:05 atlaie

maybe #404 is related

umeshksingla avatar Mar 06 '25 21:03 umeshksingla