public class Predictor
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
Predictor(java.io.InputStream in) |
Predictor(java.io.InputStream in,
PredictorConfiguration configuration)
Instantiates with the Xgboost model
|
| Modifier and Type | Method and Description |
|---|---|
int |
getNumClass()
Returns number of class.
|
SparkModelParam |
getSparkModelParam() |
double[] |
predict(FVec feat)
Generates predictions for given feature vector.
|
double[] |
predict(FVec feat,
boolean output_margin)
Generates predictions for given feature vector.
|
double[] |
predict(FVec feat,
boolean output_margin,
int ntree_limit)
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.
|
double |
predictSingle(FVec feat)
Generates a prediction for given feature vector.
|
double |
predictSingle(FVec feat,
boolean output_margin)
Generates a prediction for given feature vector.
|
double |
predictSingle(FVec feat,
boolean output_margin,
int ntree_limit)
Generates a prediction for given feature vector.
|
public Predictor(java.io.InputStream in)
throws java.io.IOException
java.io.IOExceptionpublic Predictor(java.io.InputStream in,
PredictorConfiguration configuration)
throws java.io.IOException
in - input streamconfiguration - configurationjava.io.IOException - If an I/O error occurspublic double[] predict(FVec feat)
feat - feature vectorpublic double[] predict(FVec feat, boolean output_margin)
feat - feature vectoroutput_margin - whether to only predict margin value instead of transformed predictionpublic double[] predict(FVec feat, boolean output_margin, int ntree_limit)
feat - feature vectoroutput_margin - whether to only predict margin value instead of transformed predictionntree_limit - limit the number of trees used in predictionpublic double predictSingle(FVec feat)
This method only works when the model outputs single value.
feat - feature vectorpublic double predictSingle(FVec feat, boolean output_margin)
This method only works when the model outputs single value.
feat - feature vectoroutput_margin - whether to only predict margin value instead of transformed predictionpublic double predictSingle(FVec feat, boolean output_margin, int ntree_limit)
This method only works when the model outputs single value.
feat - feature vectoroutput_margin - whether to only predict margin value instead of transformed predictionntree_limit - limit the number of trees used in predictionpublic int[] predictLeaf(FVec feat)
feat - feature vectorpublic int[] predictLeaf(FVec feat, int ntree_limit)
feat - feature vectorntree_limit - limitpublic SparkModelParam getSparkModelParam()
public int getNumClass()