Open smith-garrett opened 1 year ago
Removing the dependence of uniformization() on the type TransitionRateMatrix seems to make AD with Forward/ReverseDiff.jl possible. Tests still needed.
Trying to fit parameters with Turing, got an error about trying to convert a Float to a dual number. Seems to be coming from the call to uniformization(), so there might be a problem/type instability somewhere in there. This error itself should become a test.
Error:
MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 6})
Line that caused the error:
pvec = fill(Categorical(p0), length(data))
pvec[2:end] = [Categorical(uniformize(T, probs(pvec[i-1]), 2^8, i * 0.001)) for i in 2:length(data)]
Partially covered by #19 with Dual types, but probably need more. Look at tests for ExponentialAction for inspiration.