Class Predictor
java.lang.Object
biz.k11i.xgboost.Predictor
- All Implemented Interfaces:
Serializable
Predicts using the Xgboost model.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPredictor(InputStream in) Predictor(InputStream in, PredictorConfiguration configuration) Instantiates with the Xgboost model -
Method Summary
Modifier and TypeMethodDescriptionfloatintReturns number of class.float[]Generates predictions for given feature vector.float[]Generates predictions for given feature vector.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.String[]predictLeafPath(FVec feat) Predicts path to leaf of each tree.String[]predictLeafPath(FVec feat, int ntree_limit) Predicts path to leaf of each tree.floatpredictSingle(FVec feat) Generates a prediction for given feature vector.floatpredictSingle(FVec feat, boolean output_margin) Generates a prediction for given feature vector.floatpredictSingle(FVec feat, boolean output_margin, int ntree_limit) Generates a prediction for given feature vector.
-
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
-
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 vectorbase_margin- predict with base margin for each prediction- Returns:
- prediction values
-
predict
Generates predictions for given feature vector.- Parameters:
feat- feature vectorbase_margin- predict with base margin for each predictionntree_limit- limit the number of trees used in 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
-
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
-
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, 0 for all- Returns:
- leaf indexes
-
predictLeafPath
-
predictLeafPath
-
getSparkModelParam
-
getNumClass
public int getNumClass()Returns number of class.- Returns:
- number of class
-
getBooster
-
getObjName
-
getBaseScore
public float getBaseScore()
-