Closed
Description
Now that PR #266 looks nearly complete, I'm hoping we can revisit issue #156 and a few other additions or changes I've been thinking about. I know @johnmyleswhite mentioned that he would like to change the API in the past (not sure if that was meant in a broader sense or not).
Minor / Low Priority:
- As I brought up in switch argument order for gradient and hessian evaluations? #156 - I think it would be nice to switch the order of the arguments so that
fg!(x, storage)
becomesfg!(storage, x)
(making the mutated argument come first seems more consistent with Julian conventions and autodiff packages). - I kind of like changing the names to
OnceDifferentiable
andTwiceDifferentiable
for brevity (and clarity in the case ofDifferentiableFunction
which is a bit ambiguous). This could be handled with a depwarn, but maybe isn't worth it. We could also consider merging these into a single type (see some options below)
Higher Priority:
DifferentiableFunction
andTwiceDifferentiableFunction
should know about each other somehow. Some ideas:
abstract AbstractDifferientiable
type OnceDifferentiable <: AbstractDifferentable ... end
type TwiceDifferentiable <: AbstractDifferentiable ... end
typealias Differentiable Union{OnceDifferentiable, TwiceDifferentiable}
# Merge OnceDifferentiable and TwiceDifferentiable ?
# This could be a problem for dispatching on one vs the other. But there are tricks to fix it.
type Differentiable
f::Function
g!::Function
fg!::Function
h!::Function
end
# Constructor for a once differentiable function
Differentiable(f, g!, fg!) = Differentiable(f, g!, fg!, (x,s)->error("Not implemented") )
- Specifying a differentiable function with autodiff options. The autodiff packages in Julia are coming along and I'd like the ability to do something along these lines:
f(x) = ... # my objective function
DifferentiableFunction(f, method=:autograd) # uses AutoGrad.jl
DifferentiableFunction(f, method=:forward) # uses ForwardDiff.jl
DifferentiableFunction(f, method=:central_diff) # uses finite central differencing
I'm not attached to using symbols - we could also dispatch on types if that is preferred.
Metadata
Metadata
Assignees
Labels
No labels
Activity