# CvDTree: Appending training data

This question relates specifically to the CvDTree decision tree class, but also to CvStatModel in general:

Is there a way to append additional training data to a model after the initial call to train() has been made?

According to the documentation, CvStatModel::clear() is generally called by the train() method. If this is the case, what is the most efficient strategy for updating the model with additional training examples? Does the model need to be retrained from scratch?

Thanks!

edit retag close merge delete

The current structure of the machine learning module indeed applies a clear() of the underlying CvStatModel class, which makes that if you want to add data to an existing model, you indeed need to retrain the whole bit. It would be a nice extension to see appending training, but for that you will need to adapt the source code :) If you would try to do so, please submit a pull request with the extra code.

However I have read this remark at the train of CvStatModel

 Usually, the previous model state is cleared by CvStatModel::clear() before running the training procedure. However, some algorithms may optionally update the model state with the new training data, instead of resetting it.


Which makes me believe that some functions already provide it,as far as I can see in documentation.

( 2013-08-28 02:38:49 -0500 )edit

However, I could not find any indication that the CvDTree supports this approach.

( 2013-08-28 02:40:57 -0500 )edit
1

Thanks Steven. I saw that same remark. I was sorta thinking that meant that different subclasses of CvStatModel would differ in this respect in their implementation of the train() method. I'll take a look at what it would take to extend/adapt the code. I'll post here if I make any progress.

( 2013-08-28 08:59:42 -0500 )edit