From 47cdb041f2a15030b10de9321622f136c84142a0 Mon Sep 17 00:00:00 2001 From: Amro Date: Thu, 14 Jan 2016 02:56:34 +0200 Subject: [PATCH] fix assignment of class labels by using the indices from the sorted distance vector of pairs. --- modules/ml/src/testset.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ml/src/testset.cpp b/modules/ml/src/testset.cpp index 8b8bba5456..48cd134154 100644 --- a/modules/ml/src/testset.cpp +++ b/modules/ml/src/testset.cpp @@ -104,7 +104,7 @@ void createConcentricSpheresTestSet( int num_samples, int num_features, int num_ max_dst = std::max( max_dst, dis[i].d ); for( ; i < num_samples && dis[i].d <= max_dst; ++i ) - responses.at(i) = cur_class; + responses.at(dis[i].i) = cur_class; } }