Closed jamesonquinn closed 8 years ago
The consensus AFAIK is that you should be using ForwardDiff instead of DualNumbers for this use case.
I think I can get better performance with DualNumbers.
I think that Dual <: Real would be nice. If I'm the only one, ignore me.
I think I can get better performance with DualNumbers.
Why do you think that? ForwardDiff is supposed to be a faster DualNumbers.
I didn't know that FD was supposed to be faster. My thinking was that using DN I could get the value and the gradient together. But thinking about that further, it's a trivial advantage in high-dimensional cases. So I guess you're right.
What number type does FD use?
You can get both the derivative and the value with ForwardDiff http://www.juliadiff.org/ForwardDiff.jl/lower_order_results.html#the-right-way
I'm aware that DualNumbers are not mathematically a kind of real number; they are more like first-degree approximations of hyperreal numbers (or surreal numbers). But in practice, they are useful in places where a Real number is expected. If https://github.com/JuliaStats/Distributions.jl/pull/475 is going to become the new form of Distributions, parameterized by Real, then we definitely want to be able to find the log density gradients using dualNumbers, which means that Dual should be a subtype of Real, not of Number.
(This seems to be the general consensus at https://github.com/JuliaStats/Distributions.jl/pull/430 , by the way; but I came to this issue separately, as somebody who hopes to a GSoC project on Mamba.)