-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I'm performing Bayesian analysis on the parameters of a tree (with Turing.jl).
This requires calculating gradients with regards to these parameters.
Currently, I have to intercept the Dual numbers and manually construct the Jacobean, which is a bit cumbersome.
y_sim = if eltype(a_b_vals) == Float64
set_scalar_constants!(tree, a_b_vals, a_b_nodes)
eval_tree_array(tree, X, operators)[1]
else
set_scalar_constants!(tree, ForwardDiff.value.(a_b_vals), a_b_nodes)
val, grad = eval_grad_tree_array(tree, X, operators, variable=false)
[ForwardDiff.Dual{ForwardDiff.tagtype(a_b_vals[1])}(val[i], 0.0, grad[:, i]...) for i in eachindex(val)]
endMetadata
Metadata
Assignees
Labels
No labels