Package biz.k11i.xgboost.gbm
Class GBTree
- java.lang.Object
-
- biz.k11i.xgboost.gbm.GBTree
-
- All Implemented Interfaces:
GradBooster
,Serializable
- Direct Known Subclasses:
Dart
public class GBTree extends Object
Gradient boosted tree implementation.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface biz.k11i.xgboost.gbm.GradBooster
GradBooster.Factory
-
-
Field Summary
Fields Modifier and Type Field Description protected int
num_class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
loadModel(ModelReader reader, boolean with_pbuffer)
Loads model from stream.float[]
predict(FVec feat, int ntree_limit)
Generates predictions for given feature vector.int[]
predictLeaf(FVec feat, int ntree_limit)
Predicts the leaf index of each tree.float
predictSingle(FVec feat, int ntree_limit)
Generates a prediction for given feature vector.void
setNumClass(int num_class)
-
-
-
Method Detail
-
loadModel
public void loadModel(ModelReader reader, boolean with_pbuffer) throws IOException
Description copied from interface:GradBooster
Loads model from stream.- Parameters:
reader
- input streamwith_pbuffer
- whether the incoming data contains pbuffer- Throws:
IOException
- If an I/O error occurs
-
predict
public float[] predict(FVec feat, int ntree_limit)
Description copied from interface:GradBooster
Generates predictions for given feature vector.- Parameters:
feat
- feature vectorntree_limit
- limit the number of trees used in prediction- Returns:
- prediction result
-
predictSingle
public float predictSingle(FVec feat, int ntree_limit)
Description copied from interface:GradBooster
Generates a prediction for given feature vector.This method only works when the model outputs single value.
- Parameters:
feat
- feature vectorntree_limit
- limit the number of trees used in prediction- Returns:
- prediction result
-
predictLeaf
public int[] predictLeaf(FVec feat, int ntree_limit)
Description copied from interface:GradBooster
Predicts the leaf index of each tree. This is only valid in gbtree predictor.- Parameters:
feat
- feature vectorntree_limit
- limit the number of trees used in prediction- Returns:
- predicted leaf indexes
-
setNumClass
public void setNumClass(int num_class)
- Specified by:
setNumClass
in interfaceGradBooster
-
-