Commit cbcb80bf authored by Davis King's avatar Davis King

Changed the add_probability() method of joint_probability_table so

it does a saturating add rather than a normal add.  This ensures the
probability value stays exactly <= 1.  Previously, floating point
rounding error could cause it to be slightly above 1 and would therefore
cause some asserts to misfire during debugging mode.
parent 10829e4d
......@@ -333,6 +333,8 @@ namespace dlib
if (table.is_in_domain(a))
{
table[a] += p;
if (table[a] > 1.0)
table[a] = 1.0;
}
else
{
......
......@@ -294,7 +294,8 @@ namespace dlib
- #size() == size() + 1
- #probability(a) == p
- else
- #probability(a) == probability(a) + p
- #probability(a) == min(probability(a) + p, 1.0)
(i.e. does a saturating add)
- #has_entry_for(a) == true
!*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment