[−][src]Trait opencv::ml::DTrees
The class represents a single decision tree or a collection of decision trees.
The current public interface of the class allows user to train only a single decision tree, however the class is capable of storing multiple decision trees and using them for prediction (by summing responses or using a voting schemes), and the derived from DTrees classes (such as RTrees and Boost) use this capability to implement decision tree ensembles.
See also
@ref ml_intro_trees
Required methods
fn as_raw_DTrees(&self) -> *mut c_void
Provided methods
fn get_max_categories(&self) -> Result<i32>
@see setMaxCategories
fn set_max_categories(&mut self, val: i32) -> Result<()>
@copybrief getMaxCategories @see getMaxCategories
fn get_max_depth(&self) -> Result<i32>
@see setMaxDepth
fn set_max_depth(&mut self, val: i32) -> Result<()>
@copybrief getMaxDepth @see getMaxDepth
fn get_min_sample_count(&self) -> Result<i32>
@see setMinSampleCount
fn set_min_sample_count(&mut self, val: i32) -> Result<()>
@copybrief getMinSampleCount @see getMinSampleCount
fn get_cv_folds(&self) -> Result<i32>
@see setCVFolds
fn set_cv_folds(&mut self, val: i32) -> Result<()>
@copybrief getCVFolds @see getCVFolds
fn get_use_surrogates(&self) -> Result<bool>
@see setUseSurrogates
fn set_use_surrogates(&mut self, val: bool) -> Result<()>
@copybrief getUseSurrogates @see getUseSurrogates
fn get_use1_se_rule(&self) -> Result<bool>
@see setUse1SERule
fn set_use1_se_rule(&mut self, val: bool) -> Result<()>
@copybrief getUse1SERule @see getUse1SERule
fn get_truncate_pruned_tree(&self) -> Result<bool>
@see setTruncatePrunedTree
fn set_truncate_pruned_tree(&mut self, val: bool) -> Result<()>
@copybrief getTruncatePrunedTree @see getTruncatePrunedTree
fn get_regression_accuracy(&self) -> Result<f32>
@see setRegressionAccuracy
fn set_regression_accuracy(&mut self, val: f32) -> Result<()>
@copybrief getRegressionAccuracy @see getRegressionAccuracy
fn get_priors(&self) -> Result<Mat>
@see setPriors
fn set_priors(&mut self, val: &Mat) -> Result<()>
@copybrief getPriors @see getPriors
fn get_roots(&self) -> Result<VectorOfint>
Returns indices of root nodes
fn get_nodes(&self) -> Result<VectorOfNode>
Returns all the nodes
all the node indices are indices in the returned vector
fn get_splits(&self) -> Result<VectorOfSplit>
Returns all the splits
all the split indices are indices in the returned vector
fn get_subsets(&self) -> Result<VectorOfint>
Returns all the bitsets for categorical splits
Split::subsetOfs is an offset in the returned vector
Methods
impl<'_> dyn DTrees + '_
[src]
pub fn create() -> Result<PtrOfDTrees>
[src]
Creates the empty model
The static method creates empty decision tree with the specified parameters. It should be then trained using train method (see StatModel::train). Alternatively, you can load the model from file using Algorithm::load<DTrees>(filename).
pub fn load(filepath: &str, node_name: &str) -> Result<PtrOfDTrees>
[src]
Loads and creates a serialized DTrees from a file
Use DTree::save to serialize and store an DTree to disk. Load the DTree 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 DTree
- nodeName: name of node containing the classifier
C++ default parameters
- node_name: String()