Package biz.k11i.xgboost
Class Predictor
java.lang.Object
biz.k11i.xgboost.Predictor
- All Implemented Interfaces:
Serializable
Predicts using the Xgboost model.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate GradBooster
private Predictor.ModelParam
private String
private String
private ObjFunction
private SparkModelParam
-
Constructor Summary
ConstructorsConstructorDescriptionPredictor
(InputStream in) Predictor
(InputStream in, PredictorConfiguration configuration) Instantiates with the Xgboost model -
Method Summary
Modifier and TypeMethodDescriptionint
Returns number of class.(package private) void
initObjFunction
(PredictorConfiguration configuration) (package private) void
float[]
Generates predictions for given feature vector.float[]
Generates predictions for given feature vector.float[]
Generates predictions for given feature vector.int[]
predictLeaf
(FVec feat) Predicts leaf index of each tree.int[]
predictLeaf
(FVec feat, int ntree_limit) Predicts leaf index of each tree.(package private) float[]
predictRaw
(FVec feat, int ntree_limit) float
predictSingle
(FVec feat) Generates a prediction for given feature vector.float
predictSingle
(FVec feat, boolean output_margin) Generates a prediction for given feature vector.float
predictSingle
(FVec feat, boolean output_margin, int ntree_limit) Generates a prediction for given feature vector.(package private) float
predictSingleRaw
(FVec feat, int ntree_limit) (package private) void
readParam
(ModelReader reader)
-
Field Details
-
mparam
-
sparkModelParam
-
name_obj
-
name_gbm
-
obj
-
gbm
-
-
Constructor Details
-
Predictor
- Throws:
IOException
-
Predictor
Instantiates with the Xgboost model- Parameters:
in
- input streamconfiguration
- configuration- Throws:
IOException
- If an I/O error occurs
-
-
Method Details
-
readParam
- Throws:
IOException
-
initObjFunction
-
initObjGbm
void initObjGbm() -
predict
Generates predictions for given feature vector.- Parameters:
feat
- feature vector- Returns:
- prediction values
-
predict
Generates predictions for given feature vector.- Parameters:
feat
- feature vectoroutput_margin
- whether to only predict margin value instead of transformed prediction- Returns:
- prediction values
-
predict
Generates predictions for given feature vector.- Parameters:
feat
- feature vectoroutput_margin
- whether to only predict margin value instead of transformed predictionntree_limit
- limit the number of trees used in prediction- Returns:
- prediction values
-
predictRaw
-
predictSingle
Generates a prediction for given feature vector.This method only works when the model outputs single value.
- Parameters:
feat
- feature vector- Returns:
- prediction value
-
predictSingle
Generates a prediction for given feature vector.This method only works when the model outputs single value.
- Parameters:
feat
- feature vectoroutput_margin
- whether to only predict margin value instead of transformed prediction- Returns:
- prediction value
-
predictSingle
Generates a prediction for given feature vector.This method only works when the model outputs single value.
- Parameters:
feat
- feature vectoroutput_margin
- whether to only predict margin value instead of transformed predictionntree_limit
- limit the number of trees used in prediction- Returns:
- prediction value
-
predictSingleRaw
-
predictLeaf
Predicts leaf index of each tree.- Parameters:
feat
- feature vector- Returns:
- leaf indexes
-
predictLeaf
Predicts leaf index of each tree.- Parameters:
feat
- feature vectorntree_limit
- limit- Returns:
- leaf indexes
-
getSparkModelParam
-
getNumClass
public int getNumClass()Returns number of class.- Returns:
- number of class
-