Package org.opencv.ml
Class RTrees
java.lang.Object
org.opencv.core.Algorithm
org.opencv.ml.StatModel
org.opencv.ml.DTrees
org.opencv.ml.RTrees
public class RTrees extends DTrees
The class implements the random forest predictor.
SEE: REF: ml_intro_rtrees
-
Field Summary
Fields inherited from class org.opencv.ml.DTrees
PREDICT_AUTO, PREDICT_MASK, PREDICT_MAX_VOTE, PREDICT_SUMFields inherited from class org.opencv.ml.StatModel
COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL -
Constructor Summary
Constructors Modifier Constructor Description protectedRTrees(long addr) -
Method Summary
Modifier and Type Method Description static RTrees__fromPtr__(long addr)static RTreescreate()Creates the empty model.protected voidfinalize()intgetActiveVarCount()SEE: setActiveVarCountbooleangetCalculateVarImportance()SEE: setCalculateVarImportancedoublegetOOBError()Returns the OOB error value, computed at the training stage when calcOOBError is set to true.TermCriteriagetTermCriteria()SEE: setTermCriteriaMatgetVarImportance()Returns the variable importance array.voidgetVotes(Mat samples, Mat results, int flags)Returns the result of each individual tree in the forest.static RTreesload(String filepath)Loads and creates a serialized RTree from a file Use RTree::save to serialize and store an RTree to disk.static RTreesload(String filepath, String nodeName)Loads and creates a serialized RTree from a file Use RTree::save to serialize and store an RTree to disk.voidsetActiveVarCount(int val)getActiveVarCount SEE: getActiveVarCountvoidsetCalculateVarImportance(boolean val)getCalculateVarImportance SEE: getCalculateVarImportancevoidsetTermCriteria(TermCriteria val)getTermCriteria SEE: getTermCriteriaMethods inherited from class org.opencv.ml.DTrees
getCVFolds, getMaxCategories, getMaxDepth, getMinSampleCount, getPriors, getRegressionAccuracy, getTruncatePrunedTree, getUse1SERule, getUseSurrogates, setCVFolds, setMaxCategories, setMaxDepth, setMinSampleCount, setPriors, setRegressionAccuracy, setTruncatePrunedTree, setUse1SERule, setUseSurrogatesMethods inherited from class org.opencv.ml.StatModel
calcError, empty, getVarCount, isClassifier, isTrained, predict, predict, predict, train, train, trainMethods inherited from class org.opencv.core.Algorithm
clear, getDefaultName, getNativeObjAddr, save
-
Constructor Details
-
Method Details
-
__fromPtr__
-
getCalculateVarImportance
SEE: setCalculateVarImportance- Returns:
- automatically generated
-
setCalculateVarImportance
getCalculateVarImportance SEE: getCalculateVarImportance- Parameters:
val- automatically generated
-
getActiveVarCount
SEE: setActiveVarCount- Returns:
- automatically generated
-
setActiveVarCount
getActiveVarCount SEE: getActiveVarCount- Parameters:
val- automatically generated
-
getTermCriteria
SEE: setTermCriteria- Returns:
- automatically generated
-
setTermCriteria
getTermCriteria SEE: getTermCriteria- Parameters:
val- automatically generated
-
getVarImportance
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:
- automatically generated
-
getVotes
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.
-
getOOBError
Returns the OOB error value, computed at the training stage when calcOOBError is set to true. If this flag was set to false, 0 is returned. The OOB error is also scaled by sample weighting.- Returns:
- automatically generated
-
create
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.- Returns:
- automatically generated
-
load
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 RTreenodeName- name of node containing the classifier- Returns:
- automatically generated
-
load
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- Returns:
- automatically generated
-
finalize
-