Skip to content
Snippets Groups Projects
Commit c37bab88 authored by Charles Peyrega's avatar Charles Peyrega
Browse files

BUG: Handling a 2-class classification for the Boost classifier tests

parent 56591f09
No related branches found
No related tags found
No related merge requests found
......@@ -476,6 +476,15 @@ int otbBoostMachineLearningModel(int argc, char * argv[])
return EXIT_FAILURE;
}
// Since otb::BoostMachineLearningModel ONLY handles 2-class classifications, then the
// labels are split into 2 subsets: even (label = 1) and odd (label = 3) labels
TargetSampleType currentLabel;
for (unsigned itLabel = 0; itLabel < labels->Size(); ++itLabel)
{
currentLabel = labels->GetMeasurementVector(itLabel);
labels->SetMeasurementVector(itLabel, (2 * (currentLabel[0] % 2)) + 1);
}
BoostType::Pointer classifier = BoostType::New();
classifier->SetInputListSample(samples);
classifier->SetTargetListSample(labels);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment