From 5e7513372b604784a3bfdf3e03acfbe34513d8b6 Mon Sep 17 00:00:00 2001 From: Davis King Date: Sun, 26 Aug 2012 22:25:50 -0400 Subject: [PATCH] Switched loss counting variables from integers to doubles so they can count real valued loss values correctly. --- .../cross_validate_graph_labeling_trainer.h | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dlib/svm/cross_validate_graph_labeling_trainer.h b/dlib/svm/cross_validate_graph_labeling_trainer.h index cc882c511..3fdf6a124 100644 --- a/dlib/svm/cross_validate_graph_labeling_trainer.h +++ b/dlib/svm/cross_validate_graph_labeling_trainer.h @@ -44,10 +44,10 @@ namespace dlib #endif std::vector temp; - unsigned long num_pos_correct = 0; - unsigned long num_pos = 0; - unsigned long num_neg_correct = 0; - unsigned long num_neg = 0; + double num_pos_correct = 0; + double num_pos = 0; + double num_neg_correct = 0; + double num_neg = 0; for (unsigned long i = 0; i < samples.size(); ++i) { @@ -76,11 +76,11 @@ namespace dlib matrix res; if (num_pos != 0) - res(0) = (double)num_pos_correct/(double)(num_pos); + res(0) = num_pos_correct/num_pos; else res(0) = 1; if (num_neg != 0) - res(1) = (double)num_neg_correct/(double)(num_neg); + res(1) = num_neg_correct/num_neg; else res(1) = 1; return res; @@ -152,10 +152,10 @@ namespace dlib long next_test_idx = 0; std::vector temp; - unsigned long num_pos_correct = 0; - unsigned long num_pos = 0; - unsigned long num_neg_correct = 0; - unsigned long num_neg = 0; + double num_pos_correct = 0; + double num_pos = 0; + double num_neg_correct = 0; + double num_neg = 0; graph_type gtemp; @@ -224,11 +224,11 @@ namespace dlib matrix res; if (num_pos != 0) - res(0) = (double)num_pos_correct/(double)(num_pos); + res(0) = num_pos_correct/num_pos; else res(0) = 1; if (num_neg != 0) - res(1) = (double)num_neg_correct/(double)(num_neg); + res(1) = num_neg_correct/num_neg; else res(1) = 1; return res;