OpenCV 2.4.8

org.opencv.ml
Class CvBoost

java.lang.Object
  extended by org.opencv.ml.CvStatModel
      extended by org.opencv.ml.CvBoost

public class CvBoost
extends CvStatModel

Boosted tree classifier derived from "CvStatModel".

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

Field Summary
static int DEFAULT
           
static int DISCRETE
           
static int GENTLE
           
static int GINI
           
static int LOGIT
           
static int MISCLASS
           
static int REAL
           
static int SQERR
           
 
Constructor Summary
CvBoost()
          Default and training constructors.
CvBoost(Mat trainData, int tflag, Mat responses)
          Default and training constructors.
CvBoost(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvBoostParams params)
          Default and training constructors.
 
Method Summary
 void clear()
           
 float predict(Mat sample)
          Predicts a response for an input sample.
 float predict(Mat sample, Mat missing, Range slice, boolean rawMode, boolean returnSum)
          Predicts a response for an input sample.
 void prune(Range slice)
          Removes the specified weak classifiers.
 boolean train(Mat trainData, int tflag, Mat responses)
          Trains a boosted tree classifier.
 boolean train(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvBoostParams params, boolean update)
          Trains a boosted tree classifier.
 
Methods inherited from class org.opencv.ml.CvStatModel
load, load, save, save
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final int DEFAULT
See Also:
Constant Field Values

DISCRETE

public static final int DISCRETE
See Also:
Constant Field Values

GENTLE

public static final int GENTLE
See Also:
Constant Field Values

GINI

public static final int GINI
See Also:
Constant Field Values

LOGIT

public static final int LOGIT
See Also:
Constant Field Values

MISCLASS

public static final int MISCLASS
See Also:
Constant Field Values

REAL

public static final int REAL
See Also:
Constant Field Values

SQERR

public static final int SQERR
See Also:
Constant Field Values
Constructor Detail

CvBoost

public CvBoost()

Default and training constructors.

The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.

See Also:
org.opencv.ml.CvBoost.CvBoost

CvBoost

public CvBoost(Mat trainData,
               int tflag,
               Mat responses)

Default and training constructors.

The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.

Parameters:
trainData - a trainData
tflag - a tflag
responses - a responses
See Also:
org.opencv.ml.CvBoost.CvBoost

CvBoost

public CvBoost(Mat trainData,
               int tflag,
               Mat responses,
               Mat varIdx,
               Mat sampleIdx,
               Mat varType,
               Mat missingDataMask,
               CvBoostParams params)

Default and training constructors.

The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.

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.CvBoost.CvBoost
Method Detail

clear

public void clear()

predict

public float predict(Mat sample)

Predicts a response for an input sample.

The method runs the sample through the trees in the ensemble and returns the output class label based on the weighted voting.

Parameters:
sample - Input sample.
See Also:
org.opencv.ml.CvBoost.predict

predict

public float predict(Mat sample,
                     Mat missing,
                     Range slice,
                     boolean rawMode,
                     boolean returnSum)

Predicts a response for an input sample.

The method runs the sample through the trees in the ensemble and returns the output class label based on the weighted voting.

Parameters:
sample - Input sample.
missing - Optional mask of missing measurements. To handle missing measurements, the weak classifiers must include surrogate splits (see CvDTreeParams.use_surrogates).
slice - Continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used.
rawMode - Normally, it should be set to false.
returnSum - If true then return sum of votes instead of the class label.
See Also:
org.opencv.ml.CvBoost.predict

prune

public void prune(Range slice)

Removes the specified weak classifiers.

The method removes the specified weak classifiers from the sequence.

Note: Do not confuse this method with the pruning of individual decision trees, which is currently not supported.

Parameters:
slice - Continuous subset of the sequence of weak classifiers to be removed.
See Also:
org.opencv.ml.CvBoost.prune

train

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

Trains a boosted tree classifier.

The train method follows the common template of "CvStatModel.train". The responses must be categorical, which means that boosted trees cannot be built for regression, and there should be two classes.

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

train

public boolean train(Mat trainData,
                     int tflag,
                     Mat responses,
                     Mat varIdx,
                     Mat sampleIdx,
                     Mat varType,
                     Mat missingDataMask,
                     CvBoostParams params,
                     boolean update)

Trains a boosted tree classifier.

The train method follows the common template of "CvStatModel.train". The responses must be categorical, which means that boosted trees cannot be built for regression, and there should be two classes.

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
update - Specifies whether the classifier needs to be updated (true, the new weak tree classifiers added to the existing ensemble) or the classifier needs to be rebuilt from scratch (false).
See Also:
org.opencv.ml.CvBoost.train

OpenCV 2.4.8 Documentation