Package org.tribuo.common.xgboost
Interface XGBoostOutputConverter<T extends Output<T>>
- All Superinterfaces:
ProtoSerializable<org.tribuo.common.xgboost.protos.XGBoostOutputConverterProto>
,Serializable
- All Known Implementing Classes:
XGBoostClassificationConverter
,XGBoostRegressionConverter
public interface XGBoostOutputConverter<T extends Output<T>>
extends ProtoSerializable<org.tribuo.common.xgboost.protos.XGBoostOutputConverterProto>, Serializable
Converts the output of XGBoost into the appropriate prediction type.
-
Field Summary
Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Method Summary
Modifier and TypeMethodDescriptionList<Prediction<T>>
convertBatchOutput
(ImmutableOutputInfo<T> info, List<float[][]> probabilities, int[] numValidFeatures, Example<T>[] examples) Converts a list of float arrays from XGBoost Boosters into a TribuoPrediction
.convertOutput
(ImmutableOutputInfo<T> info, List<float[]> probabilities, int numValidFeatures, Example<T> example) Converts a list of float arrays from XGBoost Boosters into a TribuoPrediction
.boolean
Does this converter produce probabilities?Gets the type witness for the output this converter uses.Methods inherited from interface org.tribuo.protos.ProtoSerializable
serialize
-
Method Details
-
generatesProbabilities
boolean generatesProbabilities()Does this converter produce probabilities?- Returns:
- True if it produces probabilities.
-
convertOutput
Prediction<T> convertOutput(ImmutableOutputInfo<T> info, List<float[]> probabilities, int numValidFeatures, Example<T> example) Converts a list of float arrays from XGBoost Boosters into a TribuoPrediction
.- Parameters:
info
- The output info.probabilities
- The XGBoost output.numValidFeatures
- The number of valid features used in the prediction.example
- The example this prediction was generated from.- Returns:
- The prediction object.
-
convertBatchOutput
List<Prediction<T>> convertBatchOutput(ImmutableOutputInfo<T> info, List<float[][]> probabilities, int[] numValidFeatures, Example<T>[] examples) Converts a list of float arrays from XGBoost Boosters into a TribuoPrediction
.- Parameters:
info
- The output info.probabilities
- The XGBoost output, list dimension is across models, first array dimension is across examples, second array dimension is across outputs.numValidFeatures
- The number of valid features used in each prediction.examples
- The examples these predictions were generated from.- Returns:
- The prediction object.
-
getTypeWitness
Gets the type witness for the output this converter uses.The default implementation throws
UnsupportedOperationException
for compatibility with subclasses which don't support protobuf serialization.- Returns:
- The class of the output.
-