[][src]Trait opencv::ml::RTrees

pub trait RTrees: DTrees {
    fn as_raw_RTrees(&self) -> *mut c_void;

    fn get_calculate_var_importance(&self) -> Result<bool> { ... }
fn set_calculate_var_importance(&mut self, val: bool) -> Result<()> { ... }
fn get_active_var_count(&self) -> Result<i32> { ... }
fn set_active_var_count(&mut self, val: i32) -> Result<()> { ... }
fn get_term_criteria(&self) -> Result<TermCriteria> { ... }
fn set_term_criteria(&mut self, val: &TermCriteria) -> Result<()> { ... }
fn get_var_importance(&self) -> Result<Mat> { ... }
fn get_votes(
        &self,
        samples: &Mat,
        results: &mut Mat,
        flags: i32
    ) -> Result<()> { ... } }

The class implements the random forest predictor.

See also

@ref ml_intro_rtrees

Required methods

Loading content...

Provided methods

fn get_calculate_var_importance(&self) -> Result<bool>

@see setCalculateVarImportance

fn set_calculate_var_importance(&mut self, val: bool) -> Result<()>

@copybrief getCalculateVarImportance @see getCalculateVarImportance

fn get_active_var_count(&self) -> Result<i32>

@see setActiveVarCount

fn set_active_var_count(&mut self, val: i32) -> Result<()>

@copybrief getActiveVarCount @see getActiveVarCount

fn get_term_criteria(&self) -> Result<TermCriteria>

@see setTermCriteria

fn set_term_criteria(&mut self, val: &TermCriteria) -> Result<()>

@copybrief getTermCriteria @see getTermCriteria

fn get_var_importance(&self) -> Result<Mat>

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.

fn get_votes(&self, samples: &Mat, results: &mut Mat, flags: i32) -> Result<()>

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.
Loading content...

Methods

impl<'_> dyn RTrees + '_[src]

pub fn create() -> Result<PtrOfRTrees>[src]

Creates the empty model. Use StatModel::train to train the model, StatModel::train to create and train the model, Algorithm::load to load the pre-trained model.

pub fn load(filepath: &str, node_name: &str) -> Result<PtrOfRTrees>[src]

Loads and creates a serialized RTree from a file

Use RTree::save to serialize and store an RTree to disk. Load the RTree from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

Parameters

  • filepath: path to serialized RTree
  • nodeName: name of node containing the classifier

C++ default parameters

  • node_name: String()

Implementors

impl RTrees for PtrOfRTrees[src]

Loading content...