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
While investigating #108, I came across some more discrepancies between differentiation modes.
>>> import Numeric.AD.Mode.Forward as F>>> import Numeric.AD.Mode.Reverse as R>>>F.diff cos0>>>R.diff cos0-0.00.0
>>> import Numeric.AD.Mode.Forward as F>>> import Numeric.AD.Mode.Reverse as R>>>let f x =log (1-exp x)
>>>F.diff (F.diff f) 0>>>R.diff (R.diff f) 0-InfinityNaN
These examples may be somewhat contrived, but given the nature of algebra, I feel like any discrepancy could probably be amplified to yield significantly different results given the right circumstances.
The text was updated successfully, but these errors were encountered:
It seems like Numeric.AD.Mode.Forward and Numeric.AD.Mode.Forward.Double also yield different results sometimes:
>>> import Numeric.AD.Mode.Forward as F>>> import Numeric.AD.Mode.Forward.Double as FD>>> f [x, y] = x ** y
>>> xs = [0, 2]
>>>F.grad f xs
>>>FD.grad f xs
[0.0,NaN]
[0.0,0.0]
I have not looked into this too much, but I have a hunch there are some simplification rules in Forward.Double that rely on the identity forall a. 0 * a = 0, which unfortunately does not hold in the presence of IEEE floating point special values (angry).
While investigating #108, I came across some more discrepancies between differentiation modes.
These examples may be somewhat contrived, but given the nature of algebra, I feel like any discrepancy could probably be amplified to yield significantly different results given the right circumstances.
The text was updated successfully, but these errors were encountered: