Overview | Package | Class | Tree | Index | Help

OpenCV 2.4.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.opencv.ml
Class CvDTree

    java.lang.Object
      org.opencv.ml.CvStatModel
          org.opencv.ml.CvDTree

    public class CvDTree

extends CvStatModel

The class implements a decision tree as described in the beginning of this section.

See Also:
  org.opencv.ml.CvDTree : public CvStatModel

Field Summary

Fields inherited from class org.opencv.ml.CvStatModel
`nativeObj`

Constructor Summary
`` | `CvDTree()`
`protected` | `CvDTree(long addr)`

Method Summary
`void` | `clear()`
`protected void` | `finalize()`
`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.

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

### CvDTree

    public CvDTree()

### CvDTree

    protected CvDTree(long addr)

Method Detail

### clear

    public void clear()

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  Overrides:
    `finalize` in class `CvStatModel`
  Throws:
    `java.lang.Throwable`

### getVarImportance

    public Mat getVarImportance()

  Returns the variable importance array.

  See Also:
    org.opencv.ml.CvDTree.getVarImportance

### train

    public boolean train(Mat trainData,
                         int tflag,
                         Mat responses)

  Trains a decision tree.

  There are four `train` methods in "CvDTree":

  - The first two methods follow the generic "CvStatModel.train" conventions. It is the most complete form. Both data layouts (`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).
  - The third method uses "CvMLData" to pass training data to a decision tree.
  - The last method `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.

  Parameters:
    `trainData` - a trainData
    `tflag` - a tflag
    `responses` - a responses
  See Also:
    org.opencv.ml.CvDTree.train

### train

    public 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":

  - The first two methods follow the generic "CvStatModel.train" conventions. It is the most complete form. Both data layouts (`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).
  - The third method uses "CvMLData" to pass training data to a decision tree.
  - The last method `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.

  Parameters:
    `trainData` - a trainData
    `tflag` - a tflag
    `responses` - a responses
    `varIdx` - a varIdx
    `sampleIdx` - a sampleIdx
    `varType` - a varType
    `missingDataMask` - a missingDataMask
    `params` - a params
  See Also:
    org.opencv.ml.CvDTree.train

Overview | Package | Class | Tree | Index | Help

Official OpenCV 2.4 Documentation
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD