gaurav-arya / StochasticAD.jl

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

Prevent chance of wrong floating point comparison in Categorical logic #39

Closed gaurav-arya closed 1 year ago

gaurav-arya commented 1 year ago

Resolves #38: the issue was because of a comparison like 1e-17 < 0 holding true when we wanted it to be false (specifically in the comparison right_sum < 0 in the logic for the Categorical variable). This fix sidesteps the issue by computing right_sum in a different way that shouldn't have this problem