diff --git a/dlib/bayes_utils/bayes_utils.h b/dlib/bayes_utils/bayes_utils.h index 7cc617cd7..95529c26a 100644 --- a/dlib/bayes_utils/bayes_utils.h +++ b/dlib/bayes_utils/bayes_utils.h @@ -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 { diff --git a/dlib/bayes_utils/bayes_utils_abstract.h b/dlib/bayes_utils/bayes_utils_abstract.h index a7a22fd71..e5ac77332 100644 --- a/dlib/bayes_utils/bayes_utils_abstract.h +++ b/dlib/bayes_utils/bayes_utils_abstract.h @@ -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 !*/