|
OpenCV 2.4.8 | |||||||
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.CvGBTrees
public class CvGBTrees
The class implements the Gradient boosted tree model as described in the beginning of this section.
Field Summary | |
---|---|
static int |
ABSOLUTE_LOSS
|
static int |
DEVIANCE_LOSS
|
static int |
HUBER_LOSS
|
static int |
SQUARED_LOSS
|
Constructor Summary | |
---|---|
CvGBTrees()
Default and training constructors. |
|
CvGBTrees(Mat trainData,
int tflag,
Mat responses)
Default and training constructors. |
|
CvGBTrees(Mat trainData,
int tflag,
Mat responses,
Mat varIdx,
Mat sampleIdx,
Mat varType,
Mat missingDataMask,
CvGBTreesParams params)
Default and training constructors. |
Method Summary | |
---|---|
void |
clear()
Clears the model. |
float |
predict(Mat sample)
Predicts a response for an input sample. |
float |
predict(Mat sample,
Mat missing,
Range slice,
int k)
Predicts a response for an input sample. |
boolean |
train(Mat trainData,
int tflag,
Mat responses)
Trains a Gradient boosted tree model. |
boolean |
train(Mat trainData,
int tflag,
Mat responses,
Mat varIdx,
Mat sampleIdx,
Mat varType,
Mat missingDataMask,
CvGBTreesParams params,
boolean update)
Trains a Gradient boosted tree model. |
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 |
---|
public static final int ABSOLUTE_LOSS
public static final int DEVIANCE_LOSS
public static final int HUBER_LOSS
public static final int SQUARED_LOSS
Constructor Detail |
---|
public CvGBTrees()
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
public CvGBTrees(Mat trainData, int tflag, Mat responses)
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
trainData
- a trainDatatflag
- a tflagresponses
- a responsespublic CvGBTrees(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvGBTreesParams params)
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
trainData
- a trainDatatflag
- a tflagresponses
- a responsesvarIdx
- a varIdxsampleIdx
- a sampleIdxvarType
- a varTypemissingDataMask
- a missingDataMaskparams
- a paramsMethod Detail |
---|
public void clear()
Clears the model.
The function deletes the data set information and all the weak models and sets all internal variables to the initial state. The function is called in "CvGBTrees.train" and in the destructor.
public float predict(Mat sample)
Predicts a response for an input sample.
The method predicts the response corresponding to the given sample (see "Predicting with GBT"). The result is either the class label or the estimated function value. The "CvGBTrees.predict" method enables using the parallel version of the GBT model prediction if the OpenCV is built with the TBB library. In this case, predictions of single trees are computed in a parallel fashion.
sample
- Input feature vector that has the same format as every training
set element. If not all the variables were actually used during training,
sample
contains forged values at the appropriate places.public float predict(Mat sample, Mat missing, Range slice, int k)
Predicts a response for an input sample.
The method predicts the response corresponding to the given sample (see "Predicting with GBT"). The result is either the class label or the estimated function value. The "CvGBTrees.predict" method enables using the parallel version of the GBT model prediction if the OpenCV is built with the TBB library. In this case, predictions of single trees are computed in a parallel fashion.
sample
- Input feature vector that has the same format as every training
set element. If not all the variables were actually used during training,
sample
contains forged values at the appropriate places.missing
- Missing values mask, which is a dimensional matrix of the same
size as sample
having the CV_8U
type.
1
corresponds to the missing value in the same position in the
sample
vector. If there are no missing values in the feature
vector, an empty matrix can be passed instead of the missing mask.slice
- Parameter defining the part of the ensemble used for prediction.
If slice = Range.all()
, all trees are used. Use this parameter
to get predictions of the GBT models with different ensemble sizes learning
only one model.
k
- Number of tree ensembles built in case of the classification problem
(see "Training GBT"). Use this parameter to change the output to sum of the
trees' predictions in the k
-th ensemble only. To get the total
GBT model prediction, k
value must be -1. For regression
problems, k
is also equal to -1.public boolean train(Mat trainData, int tflag, Mat responses)
Trains a Gradient boosted tree model.
The first train method follows the common template (see "CvStatModel.train").
Both tflag
values (CV_ROW_SAMPLE
, CV_COL_SAMPLE
)
are supported.
trainData
must be of the CV_32F
type.
responses
must be a matrix of type CV_32S
or
CV_32F
. In both cases it is converted into the CV_32F
matrix inside the training procedure. varIdx
and
sampleIdx
must be a list of indices (CV_32S
) or a
mask (CV_8U
or CV_8S
). update
is a
dummy parameter.
The second form of "CvGBTrees.train" function uses "CvMLData" as a data set
container. update
is still a dummy parameter.
All parameters specific to the GBT model are passed into the training function as a "CvGBTreesParams" structure.
trainData
- a trainDatatflag
- a tflagresponses
- a responsespublic boolean train(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvGBTreesParams params, boolean update)
Trains a Gradient boosted tree model.
The first train method follows the common template (see "CvStatModel.train").
Both tflag
values (CV_ROW_SAMPLE
, CV_COL_SAMPLE
)
are supported.
trainData
must be of the CV_32F
type.
responses
must be a matrix of type CV_32S
or
CV_32F
. In both cases it is converted into the CV_32F
matrix inside the training procedure. varIdx
and
sampleIdx
must be a list of indices (CV_32S
) or a
mask (CV_8U
or CV_8S
). update
is a
dummy parameter.
The second form of "CvGBTrees.train" function uses "CvMLData" as a data set
container. update
is still a dummy parameter.
All parameters specific to the GBT model are passed into the training function as a "CvGBTreesParams" structure.
trainData
- a trainDatatflag
- a tflagresponses
- a responsesvarIdx
- a varIdxsampleIdx
- a sampleIdxvarType
- a varTypemissingDataMask
- a missingDataMaskparams
- a paramsupdate
- a update
|
OpenCV 2.4.8 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |