CalculateModel

Declaration: TRndForest.CalculateModel const Cube: TMat4D; TimeSlot: integer; const MetaData: TMetaData; InitTrnData: boolean): integer;
The method CalculateModel trains the classifier using the parameters as defined by the following properties: RPar, NTrees, SpdcSet and TrnData.

The training is performed using the data set which is specified by the parameters Cube, TimeSlot and MetaData. The parameter InitTrnData controls whether the training data have to be copied into the internal data buffer. In general InitTrnData must be set to TRUE for the very first call of CalculateModel. Further calls to CalculateModel without changing the training data or the spectral descriptors can be called with InitTrnData set to FALSE. This speeds up the training considerably (see the RPar parameter for an example code).

The function returns the following error codes:

 0 ... everything is OK, the random forest model has been created
-1 ... invalid RPar (valid range 0.05 to 0.66)
-2 ... invalid number of trees (valid range: 1..500)
-3 ... set of descriptors not yet loaded
-4 ... training data not yet loaded