mirror of https://github.com/davisking/dlib.git
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.
This commit is contained in:
parent
10829e4d69
commit
cbcb80bfd2
|
@ -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
|
||||
!*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue