rajeshrinet / pyross

PyRoss: inference, forecasts, and optimised control of epidemiological models in Python. github.com/rajeshrinet/pyross
https://pyross.readthedocs.io
MIT License
169 stars 57 forks source link

Negative values in sqdev? #44

Open rodlaje opened 2 years ago

rodlaje commented 2 years ago

Hi there again, I'm using the option least_squares_diff in latent_infer (nice one btw). I've noticed that, after doing xm = np.diff(xm,axis=0) in line 3654 of inference.pyx (function _obtain_square_dev_for_lat_traj_diff) the variable xm can end up with negative values which are added to sqdev when they are used in the denominator to normalize it. This is bad because sqdev could decrease towards minus infinity in search of a minimum. Shouldn't xm_red in the denominator of line 3658 be surrounded by np.abs() or something? Rodrigo