You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I mentioned this already in #413 but then forgot about it. Consider the following case in _minimize_local_discrete:
The very first localized covariance matrix is singular and thus returns a negative loglikelyhood of inf.
Then current_min is still inf. res is also inf, a warning gets raised but we continue. res < current_min in this case becomes float("inf") < float("inf") and yields False. Thus we land at sel = i - 1 and sel = -1. We return sequence[-1]`, in this case the last localization radius, without ever checking its likelihood or if the resulting localized covariance matrix is not singular. In my opinion, this is a bug and we should fix it before releasing MESMER v1.0.
It can be fixed by actually skipping results that are inf (rather complicated) or raising an Error if the first element already results is inf if we think that once the localization radii return singular matrices the rest will also always return singular matrices. This is inuitively true when the radii are ordered (which we do not explicitly require) and higher radii lead to less localization and thus to "too little regularized" matrices. At the moment, we always stop when res == inf and return the element from the iteration before (NOTE: I think the comment in the code is misleading).
I mentioned this already in #413 but then forgot about it. Consider the following case in
_minimize_local_discrete
:The very first localized covariance matrix is singular and thus returns a negative loglikelyhood of
inf
.Then
current_min
is stillinf
.res
is alsoinf
, a warning gets raised but we continue.res < current_min
in this case becomesfloat("inf") < float("inf")
and yieldsFalse
. Thus we land atsel = i - 1
andsel = -1
. We return sequence[-1]`, in this case the last localization radius, without ever checking its likelihood or if the resulting localized covariance matrix is not singular. In my opinion, this is a bug and we should fix it before releasing MESMER v1.0.It can be fixed by actually skipping results that are
inf
(rather complicated) or raising an Error if the first element already results isinf
if we think that once the localization radii return singular matrices the rest will also always return singular matrices. This is inuitively true when the radii are ordered (which we do not explicitly require) and higher radii lead to less localization and thus to "too little regularized" matrices. At the moment, we always stop whenres == inf
and return the element from the iteration before (NOTE: I think the comment in the code is misleading).mesmer/mesmer/core/utils.py
Lines 54 to 80 in bd011cf
Also check the following test cases:
The text was updated successfully, but these errors were encountered: