From 34bc6f18e82e1772d79d602790deebbbc3512a57 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Fri, 20 Oct 2017 15:16:03 +0200 Subject: [PATCH] Bugfix: prevent classification cost from going negative --- .../CGAL/Classification/ETHZ_random_forest_classifier.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h b/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h index 3283dd277e5..c9cb3ac5d88 100644 --- a/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h +++ b/Classification/include/CGAL/Classification/ETHZ_random_forest_classifier.h @@ -147,7 +147,11 @@ public: m_rfc->evaluate (ft.data(), prob.data()); for (std::size_t i = 0; i < out.size(); ++ i) + { out[i] = - std::log (prob[i]); + if (out[i] < 0.f) + out[i] = -out[i]; + } } void save_configuration (const char* filename)