Revert "Update abs diff rule to 0 at non-differentiable point"#100
Revert "Update abs diff rule to 0 at non-differentiable point"#100
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #100 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 3 3
Lines 187 187
=======================================
Hits 183 183
Misses 4 4
☔ View full report in Codecov by Sentry. |
|
@devmotion My apologies for the delay. Given the downstream issues caused, I see no reason why not to revert #98. |
|
this seems fine, would be good to fix the comment though. The hessian coming out at zero is just a special case of the derivative being computered as zero for right? To which this is not a satisfying solution but it is better than breaking actual code, for conceptual improvements |
|
I guess the comment is correct but possibly should be clarified: the |
|
I agree, it's not very satisfying that we run into problems when defining the derivative at 0 as 0. Maybe it's generally safer to take the left or right limit, as long as such special branches lead to zero derivatives in e.g. ForwardDiff? |
|
BTW I checked and the problem shows up also with ForwardDiff#master. |
Reverts #98, due to the problem explained in #98 (comment).
Maybe this issue explains why the "derivative" at 0 was defined as 1 originally (first in ForwardDiff, and then in DiffRules when thw rule was moved here) - but unfortunately neither DiffRules nor ForwardDiff tests it.
In principle, it seems that one could argue for any subderivative, ie., any number in [-1, 1], as the "derivative" at 0. The
absfunction is also discussed in the ChainRules docs, where it is arfued for taking the subderivative 0 and against -1 or 1. However, yhe example in #98 (comment) provides an argument for taking 1.