Skip to content
Snippets Groups Projects
Commit 618f2d30 authored by Antoine Regimbeau's avatar Antoine Regimbeau
Browse files

Merge branch '1952_dt_kfold_crash' into 'develop'

Remove CVFold parameter from decision tree classifier in OpenCV 3

See merge request orfeotoolbox/otb!572
parents 86d5552e 603a17df
No related branches found
No related tags found
3 merge requests!648Ci rcjob,!621Release 7.0 (master),!572Remove CVFold parameter from decision tree classifier in OpenCV 3
Pipeline #2412 passed
......@@ -75,17 +75,15 @@ LearningApplicationBase<TInputValue,TOutputValue>
"Cluster possible values of a categorical variable into K <= cat clusters to find a "
"suboptimal split.");
//CVFolds
//CVFolds: only exposed for OPENCV 2 because it crashes in OpenCV 3
#ifndef OTB_OPENCV_3
AddParameter(ParameterType_Int, "classifier.dt.f", "K-fold cross-validations");
#ifdef OTB_OPENCV_3
// disable cross validation by default (crash in opencv 3.2)
SetParameterInt("classifier.dt.f",0);
#else
SetParameterInt("classifier.dt.f",10);
#endif
SetParameterDescription("classifier.dt.f",
"If cv_folds > 1, then it prunes a tree with K-fold cross-validation where K "
"is equal to cv_folds.");
#endif
//Use1seRule
AddParameter(ParameterType_Bool, "classifier.dt.r", "Set Use1seRule flag to false");
......@@ -118,7 +116,10 @@ LearningApplicationBase<TInputValue,TOutputValue>
classifier->SetMinSampleCount(GetParameterInt("classifier.dt.min"));
classifier->SetRegressionAccuracy(GetParameterFloat("classifier.dt.ra"));
classifier->SetMaxCategories(GetParameterInt("classifier.dt.cat"));
//CVFolds is only exposed for OPENCV 2 because it crashes in OpenCV 3
#ifndef OTB_OPENCV_3
classifier->SetCVFolds(GetParameterInt("classifier.dt.f"));
#endif
if (GetParameterInt("classifier.dt.r"))
{
classifier->SetUse1seRule(false);
......
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