gaurav-arya / StochasticAD.jl

Research package for automatic differentiation of programs containing discrete randomness.
MIT License
195 stars 15 forks source link

Different results inputing 0.4 and 0.40 #113

Closed AndresCenteno closed 6 months ago

AndresCenteno commented 6 months ago
using Distributions, StochasticAD
v = [-1; 10]
function X(p)
    u = rand(Bernoulli(p))
    return v[u+1]
end

derivative_estimate(X,0.4) # this is 0.0
derivative_estimate(X,0.40) # this is 18.333333333333336

don't really understand why it is different, don't want to bother anyone, I'm just messing around

AndresCenteno commented 6 months ago

so I just closed and opened Julia and it works now