The DCFactor::evalProbs( ...) function implements "exp-normalization" where we attempt to normalize a set of (negative) log probabilities as exp(log p_i) / ( sum_i exp(log p_i) ). For exceptionally small values of log p_i, e.g. -10^6, this expression is susceptible to underflow. This can occur, for example, if the "continuous part" of a DCFactor for a particular discrete assignment has large error, even independent of the "discrete part." Rather than compute this expression naively as written, we should "shift" the exponents prior to normalizing to avoid numerical issues.
The
DCFactor::evalProbs( ...)
function implements "exp-normalization" where we attempt to normalize a set of (negative) log probabilities asexp(log p_i) / ( sum_i exp(log p_i) )
. For exceptionally small values oflog p_i
, e.g. -10^6, this expression is susceptible to underflow. This can occur, for example, if the "continuous part" of a DCFactor for a particular discrete assignment has large error, even independent of the "discrete part." Rather than compute this expression naively as written, we should "shift" the exponents prior to normalizing to avoid numerical issues.cc: @kurransingh