|
OpenCV 2.4.2 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opencv.ml.CvStatModel org.opencv.ml.CvRTrees
public class CvRTrees
The class implements the random forest predictor as described in the beginning of this section.
Field Summary |
---|
Fields inherited from class org.opencv.ml.CvStatModel |
---|
nativeObj |
Constructor Summary | |
---|---|
|
CvRTrees()
|
protected |
CvRTrees(long addr)
|
Method Summary | |
---|---|
void |
clear()
|
protected void |
finalize()
|
Mat |
getVarImportance()
Returns the variable importance array. |
float |
predict_prob(Mat sample)
Returns a fuzzy-predicted class label. |
float |
predict_prob(Mat sample,
Mat missing)
Returns a fuzzy-predicted class label. |
float |
predict(Mat sample)
Predicts the output for an input sample. |
float |
predict(Mat sample,
Mat missing)
Predicts the output for an input sample. |
boolean |
train(Mat trainData,
int tflag,
Mat responses)
Trains the Random Trees model. |
boolean |
train(Mat trainData,
int tflag,
Mat responses,
Mat varIdx,
Mat sampleIdx,
Mat varType,
Mat missingDataMask,
CvRTParams params)
Trains the Random Trees model. |
Methods inherited from class org.opencv.ml.CvStatModel |
---|
load, load, save, save |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CvRTrees()
protected CvRTrees(long addr)
Method Detail |
---|
public void clear()
protected void finalize() throws java.lang.Throwable
finalize
in class CvStatModel
java.lang.Throwable
public Mat getVarImportance()
Returns the variable importance array.
The method returns the variable importance vector, computed at the training
stage when CvRTParams.calc_var_importance
is set to true. If
this flag was set to false, the NULL
pointer is returned. This
differs from the decision trees where variable importance can be computed
anytime after the training.
public float predict_prob(Mat sample)
Returns a fuzzy-predicted class label.
The function works for binary classification problems only. It returns the number between 0 and 1. This number represents probability or confidence of the sample belonging to the second class. It is calculated as the proportion of decision trees that classified the sample to the second class.
sample
- Sample for classification.public float predict_prob(Mat sample, Mat missing)
Returns a fuzzy-predicted class label.
The function works for binary classification problems only. It returns the number between 0 and 1. This number represents probability or confidence of the sample belonging to the second class. It is calculated as the proportion of decision trees that classified the sample to the second class.
sample
- Sample for classification.missing
- Optional missing measurement mask of the sample.public float predict(Mat sample)
Predicts the output for an input sample.
The input parameters of the prediction method are the same as in "CvDTree.predict" but the return value type is different. This method returns the cumulative result from all the trees in the forest (the class that receives the majority of voices, or the mean of the regression function estimates).
sample
- Sample for classification.public float predict(Mat sample, Mat missing)
Predicts the output for an input sample.
The input parameters of the prediction method are the same as in "CvDTree.predict" but the return value type is different. This method returns the cumulative result from all the trees in the forest (the class that receives the majority of voices, or the mean of the regression function estimates).
sample
- Sample for classification.missing
- Optional missing measurement mask of the sample.public boolean train(Mat trainData, int tflag, Mat responses)
Trains the Random Trees model.
The method "CvRTrees.train" is very similar to the method "CvDTree.train"
and follows the generic method "CvStatModel.train" conventions. All the
parameters specific to the algorithm training are passed as a "CvRTParams"
instance. The estimate of the training error (oob-error
) is
stored in the protected class member oob_error
.
The function is parallelized with the TBB library.
trainData
- a trainDatatflag
- a tflagresponses
- a responsespublic boolean train(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvRTParams params)
Trains the Random Trees model.
The method "CvRTrees.train" is very similar to the method "CvDTree.train"
and follows the generic method "CvStatModel.train" conventions. All the
parameters specific to the algorithm training are passed as a "CvRTParams"
instance. The estimate of the training error (oob-error
) is
stored in the protected class member oob_error
.
The function is parallelized with the TBB library.
trainData
- a trainDatatflag
- a tflagresponses
- a responsesvarIdx
- a varIdxsampleIdx
- a sampleIdxvarType
- a varTypemissingDataMask
- a missingDataMaskparams
- a params
|
Official OpenCV 2.4 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |