RF variable importance in TrainVectorClassifier
In TrainVectorClassifier
, it is currently not possible to compute and output the variable importance. computing variable importance is an option for random forest in both version 2 and 3 of OpenCV, and it could be nice to expose it in the application
There is already a Boolean to activate this computation in the RandomForestLearningModel
and a method to output the variable importance as a cv::Mat
, so all we would have to do is add a parameter for variable importance in LearningApplicationBase
(in InitRandomForestsParams()
), and write the cv::Mat to a txt file.
In my opinion the purpose of TrainVectorClassifier
is to wrap openCV (and Shark) to make it easy to use with remote sensing data, so we should provide as many openCV algorithm parameters as possible, in particular for parameter available both in OpenCV 2 and 3.
Note the comment in otbTrainRandomForests.hxx:70 : "//CalculateVariableImportance not exposed", hinting that not providing this parameter might be a design choice, but I don't know why. Also, "prior" and "terminationCriteria" parameters are available in the Machine Learning model, but not in the application.