Trait opencv::hub_prelude::RTreesConst[][src]

pub trait RTreesConst: DTreesConst {
    fn as_raw_RTrees(&self) -> *const c_void;

    fn get_calculate_var_importance(&self) -> Result<bool> { ... }
fn get_active_var_count(&self) -> Result<i32> { ... }
fn get_term_criteria(&self) -> Result<TermCriteria> { ... }
fn get_var_importance(&self) -> Result<Mat> { ... }
fn get_votes(
        &self,
        samples: &dyn ToInputArray,
        results: &mut dyn ToOutputArray,
        flags: i32
    ) -> Result<()> { ... }
fn get_oob_error(&self) -> Result<f64> { ... } }
Expand description

The class implements the random forest predictor.

See also

@ref ml_intro_rtrees

Required methods

Provided methods

If true then variable importance will be calculated and then it can be retrieved by RTrees::getVarImportance. Default value is false.

See also

setCalculateVarImportance

The size of the randomly selected subset of features at each tree node and that are used to find the best split(s). If you set it to 0 then the size will be set to the square root of the total number of features. Default value is 0.

See also

setActiveVarCount

The termination criteria that specifies when the training algorithm stops. Either when the specified number of trees is trained and added to the ensemble or when sufficient accuracy (measured as OOB error) is achieved. Typically the more trees you have the better the accuracy. However, the improvement in accuracy generally diminishes and asymptotes pass a certain number of trees. Also to keep in mind, the number of tree increases the prediction time linearly. Default value is TermCriteria(TermCriteria::MAX_ITERS + TermCriteria::EPS, 50, 0.1)

See also

setTermCriteria

Returns the variable importance array. The method returns the variable importance vector, computed at the training stage when CalculateVarImportance is set to true. If this flag was set to false, the empty matrix is returned.

Returns the result of each individual tree in the forest. In case the model is a regression problem, the method will return each of the trees’ results for each of the sample cases. If the model is a classifier, it will return a Mat with samples + 1 rows, where the first row gives the class number and the following rows return the votes each class had for each sample.

Parameters
  • samples: Array containing the samples for which votes will be calculated.
  • results: Array where the result of the calculation will be written.
  • flags: Flags for defining the type of RTrees.

Implementors