pub trait DTreesTrait: DTreesTraitConst + StatModelTrait {
// Required method
fn as_raw_mut_DTrees(&mut self) -> *mut c_void;
// Provided methods
fn set_max_categories(&mut self, val: i32) -> Result<()> { ... }
fn set_max_depth(&mut self, val: i32) -> Result<()> { ... }
fn set_min_sample_count(&mut self, val: i32) -> Result<()> { ... }
fn set_cv_folds(&mut self, val: i32) -> Result<()> { ... }
fn set_use_surrogates(&mut self, val: bool) -> Result<()> { ... }
fn set_use1_se_rule(&mut self, val: bool) -> Result<()> { ... }
fn set_truncate_pruned_tree(&mut self, val: bool) -> Result<()> { ... }
fn set_regression_accuracy(&mut self, val: f32) -> Result<()> { ... }
fn set_priors(&mut self, val: &impl MatTraitConst) -> Result<()> { ... }
}
Expand description
Mutable methods for crate::ml::DTrees
Required Methods§
fn as_raw_mut_DTrees(&mut self) -> *mut c_void
Provided Methods§
Sourcefn set_max_categories(&mut self, val: i32) -> Result<()>
fn set_max_categories(&mut self, val: i32) -> Result<()>
Cluster possible values of a categorical variable into K<=maxCategories clusters to find a suboptimal split. If a discrete variable, on which the training procedure tries to make a split, takes more than maxCategories values, the precise best subset estimation may take a very long time because the algorithm is exponential. Instead, many decision trees engines (including our implementation) try to find sub-optimal split in this case by clustering all the samples into maxCategories clusters that is some categories are merged together. The clustering is applied only in n > 2-class classification problems for categorical variables with N > max_categories possible values. In case of regression and 2-class classification the optimal split can be found efficiently without employing clustering, thus the parameter is not used in these cases. Default value is 10.
§See also
setMaxCategories getMaxCategories
Sourcefn set_max_depth(&mut self, val: i32) -> Result<()>
fn set_max_depth(&mut self, val: i32) -> Result<()>
The maximum possible depth of the tree. That is the training algorithms attempts to split a node while its depth is less than maxDepth. The root node has zero depth. The actual depth may be smaller if the other termination criteria are met (see the outline of the training procedure [ml_intro_trees] “here”), and/or if the tree is pruned. Default value is INT_MAX.
§See also
setMaxDepth getMaxDepth
Sourcefn set_min_sample_count(&mut self, val: i32) -> Result<()>
fn set_min_sample_count(&mut self, val: i32) -> Result<()>
If the number of samples in a node is less than this parameter then the node will not be split.
Default value is 10.
§See also
setMinSampleCount getMinSampleCount
Sourcefn set_cv_folds(&mut self, val: i32) -> Result<()>
fn set_cv_folds(&mut self, val: i32) -> Result<()>
If CVFolds > 1 then algorithms prunes the built decision tree using K-fold cross-validation procedure where K is equal to CVFolds. Default value is 10.
§See also
setCVFolds getCVFolds
Sourcefn set_use_surrogates(&mut self, val: bool) -> Result<()>
fn set_use_surrogates(&mut self, val: bool) -> Result<()>
If true then surrogate splits will be built. These splits allow to work with missing data and compute variable importance correctly. Default value is false.
Note: currently it’s not implemented.
§See also
setUseSurrogates getUseSurrogates
Sourcefn set_use1_se_rule(&mut self, val: bool) -> Result<()>
fn set_use1_se_rule(&mut self, val: bool) -> Result<()>
If true then a pruning will be harsher. This will make a tree more compact and more resistant to the training data noise but a bit less accurate. Default value is true.
§See also
setUse1SERule getUse1SERule
Sourcefn set_truncate_pruned_tree(&mut self, val: bool) -> Result<()>
fn set_truncate_pruned_tree(&mut self, val: bool) -> Result<()>
If true then pruned branches are physically removed from the tree. Otherwise they are retained and it is possible to get results from the original unpruned (or pruned less aggressively) tree. Default value is true.
§See also
setTruncatePrunedTree getTruncatePrunedTree
Sourcefn set_regression_accuracy(&mut self, val: f32) -> Result<()>
fn set_regression_accuracy(&mut self, val: f32) -> Result<()>
Termination criteria for regression trees. If all absolute differences between an estimated value in a node and values of train samples in this node are less than this parameter then the node will not be split further. Default value is 0.01f
§See also
setRegressionAccuracy getRegressionAccuracy
Sourcefn set_priors(&mut self, val: &impl MatTraitConst) -> Result<()>
fn set_priors(&mut self, val: &impl MatTraitConst) -> Result<()>
The array of a priori class probabilities, sorted by the class label value.
The parameter can be used to tune the decision tree preferences toward a certain class. For example, if you want to detect some rare anomaly occurrence, the training base will likely contain much more normal cases than anomalies, so a very good classification performance will be achieved just by considering every case as normal. To avoid this, the priors can be specified, where the anomaly probability is artificially increased (up to 0.5 or even greater), so the weight of the misclassified anomalies becomes much bigger, and the tree is adjusted properly.
You can also think about this parameter as weights of prediction categories which determine relative weights that you give to misclassification. That is, if the weight of the first category is 1 and the weight of the second category is 10, then each mistake in predicting the second category is equivalent to making 10 mistakes in predicting the first category. Default value is empty Mat.
§See also
setPriors getPriors
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.