pub trait RTreesTraitConst: DTreesTraitConst {
// Required method
fn as_raw_RTrees(&self) -> *const c_void;
// Provided methods
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: &impl ToInputArray,
results: &mut impl ToOutputArray,
flags: i32,
) -> Result<()> { ... }
fn get_oob_error(&self) -> Result<f64> { ... }
}
Expand description
Constant methods for crate::ml::RTrees
Required Methods§
fn as_raw_RTrees(&self) -> *const c_void
Provided Methods§
Sourcefn get_calculate_var_importance(&self) -> Result<bool>
fn get_calculate_var_importance(&self) -> Result<bool>
If true then variable importance will be calculated and then it can be retrieved by RTrees::getVarImportance. Default value is false.
§See also
setCalculateVarImportance
Sourcefn get_active_var_count(&self) -> Result<i32>
fn get_active_var_count(&self) -> Result<i32>
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
Sourcefn get_term_criteria(&self) -> Result<TermCriteria>
fn get_term_criteria(&self) -> Result<TermCriteria>
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
Sourcefn get_var_importance(&self) -> Result<Mat>
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.
Sourcefn get_votes(
&self,
samples: &impl ToInputArray,
results: &mut impl ToOutputArray,
flags: i32,
) -> Result<()>
fn get_votes( &self, samples: &impl ToInputArray, results: &mut impl ToOutputArray, 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.
fn get_oob_error(&self) -> Result<f64>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.