stepmix icon indicating copy to clipboard operation
stepmix copied to clipboard

ValueError: array must not contain infs or NaNs

Open tsryo opened this issue 1 year ago • 1 comments

https://github.com/Labo-Lacourse/stepmix/blob/4fdc222b6eabf6962b1146c9df778f7cc530df44/stepmix/emission/categorical.py#L82

Seems to happen for me intermittently, depending on what random state I start with. Happens when fitting a one-step model with full gaussian measurement model and binary_nan structural. When occurring it seems that a certain element in pis[i] (and its corresponding elemnt from resp_i ) , are equal to zero, causing 0/0 -> nan. Current workaround I used was setting pis[i] with nan_to_num, where all nans are changed to zeroes. Not sure if this is valid to do, or just treating the symptom instead of the root cause.

tsryo avatar Nov 14 '24 10:11 tsryo

Thanks for reporting this. Any chance you could share a dataset (e.g., via email) and a random_state to reproduce this?

sachaMorin avatar Nov 14 '24 14:11 sachaMorin