Class GBTree
java.lang.Object
biz.k11i.xgboost.gbm.GBTree
- All Implemented Interfaces:
GradBooster, Serializable
- Direct Known Subclasses:
Dart
-
Nested Class Summary
Nested classes/interfaces inherited from interface GradBooster
GradBooster.Factory -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRegTree[][]voidloadModel(PredictorConfiguration config, ModelReader reader, boolean with_pbuffer) Loads model from stream.float[]Generates predictions for given feature vector.int[]predictLeaf(FVec feat, int ntree_limit) Predicts the leaf index of each tree.String[]predictLeafPath(FVec feat, int ntree_limit) Predicts the path to leaf of each tree.floatpredictSingle(FVec feat, int ntree_limit, float base_score) Generates a prediction for given feature vector.voidsetNumClass(int numClass) voidsetNumFeature(int numFeature)
-
Field Details
-
num_class
protected int num_class -
num_feature
protected int num_feature -
num_output_group
protected int num_output_group
-
-
Constructor Details
-
GBTree
public GBTree()
-
-
Method Details
-
loadModel
public void loadModel(PredictorConfiguration config, ModelReader reader, boolean with_pbuffer) throws IOException Description copied from interface:GradBoosterLoads model from stream.- Parameters:
config- predictor configurationreader- input streamwith_pbuffer- whether the incoming data contains pbuffer- Throws:
IOException- If an I/O error occurs
-
predict
Description copied from interface:GradBoosterGenerates predictions for given feature vector.- Parameters:
feat- feature vectorntree_limit- limit the number of trees used in predictionbase_score- base score to initialize prediction- Returns:
- prediction result
-
predictSingle
Description copied from interface:GradBoosterGenerates 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 predictionbase_score- base score to initialize prediction- Returns:
- prediction result
-
predictLeaf
Description copied from interface:GradBoosterPredicts 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
-
predictLeafPath
Description copied from interface:GradBoosterPredicts the path to leaf 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 path to leaves
-
getGroupedTrees
- Returns:
- A two-dim array, with trees grouped into classes.
-
setNumClass
public void setNumClass(int numClass) - Specified by:
setNumClassin interfaceGradBooster
-
setNumFeature
public void setNumFeature(int numFeature) - Specified by:
setNumFeaturein interfaceGradBooster
-