org.opencv.ml
public class CvDTree extends CvStatModel
The class implements a decision tree as described in the beginning of this section.
Constructor and Description |
---|
CvDTree() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Mat |
getVarImportance()
Returns the variable importance array.
|
boolean |
train(Mat trainData,
int tflag,
Mat responses)
Trains a decision tree.
|
boolean |
train(Mat trainData,
int tflag,
Mat responses,
Mat varIdx,
Mat sampleIdx,
Mat varType,
Mat missingDataMask,
CvDTreeParams params)
Trains a decision tree.
|
load, load, save, save
public void clear()
public Mat getVarImportance()
Returns the variable importance array.
public boolean train(Mat trainData, int tflag, Mat responses)
Trains a decision tree.
There are four train
methods in "CvDTree":
tflag=CV_ROW_SAMPLE
and tflag=CV_COL_SAMPLE
) are
supported, as well as sample and variable subsets, missing measurements,
arbitrary combinations of input and output variable types, and so on. The
last parameter contains all of the necessary training parameters (see the
"CvDTreeParams" description).
train
is mostly used for building tree
ensembles. It takes the pre-constructed "CvDTreeTrainData" instance and an
optional subset of the training set. The indices in subsampleIdx
are counted relatively to the _sample_idx
, passed to the
CvDTreeTrainData
constructor. For example, if _sample_idx=[1,
5, 7, 100]
, then subsampleIdx=[0,3]
means that the
samples [1, 100]
of the original training set are used.
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, CvDTreeParams params)
Trains a decision tree.
There are four train
methods in "CvDTree":
tflag=CV_ROW_SAMPLE
and tflag=CV_COL_SAMPLE
) are
supported, as well as sample and variable subsets, missing measurements,
arbitrary combinations of input and output variable types, and so on. The
last parameter contains all of the necessary training parameters (see the
"CvDTreeParams" description).
train
is mostly used for building tree
ensembles. It takes the pre-constructed "CvDTreeTrainData" instance and an
optional subset of the training set. The indices in subsampleIdx
are counted relatively to the _sample_idx
, passed to the
CvDTreeTrainData
constructor. For example, if _sample_idx=[1,
5, 7, 100]
, then subsampleIdx=[0,3]
means that the
samples [1, 100]
of the original training set are used.
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