Package org.tribuo.interop.onnx
Interface OutputTransformer<T extends Output<T>>
- All Superinterfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,ProtoSerializable<org.tribuo.interop.onnx.protos.OutputTransformerProto>
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,Serializable
- All Known Implementing Classes:
LabelOneVOneTransformer
,LabelTransformer
,MultiLabelTransformer
,RegressorTransformer
public interface OutputTransformer<T extends Output<T>>
extends com.oracle.labs.mlrg.olcut.config.Configurable, ProtoSerializable<org.tribuo.interop.onnx.protos.OutputTransformerProto>, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>, Serializable
Converts an
OnnxValue
into an Output
or a Prediction
.
N.B. ONNX support is experimental, and may change without a major version bump.
-
Field Summary
Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Does this OutputTransformer generate probabilities.The type witness used when deserializing the ONNX model from a protobuf.transformToBatchOutput
(List<ai.onnxruntime.OnnxValue> value, ImmutableOutputInfo<T> outputIDInfo) Converts aOnnxValue
containing multiple outputs into a list ofOutput
s.List<Prediction<T>>
transformToBatchPrediction
(List<ai.onnxruntime.OnnxValue> value, ImmutableOutputInfo<T> outputIDInfo, int[] numValidFeatures, List<Example<T>> examples) Converts aOnnxValue
containing multiple outputs into a list ofPrediction
s.transformToOutput
(List<ai.onnxruntime.OnnxValue> value, ImmutableOutputInfo<T> outputIDInfo) Converts aOnnxValue
into the specified output type.transformToPrediction
(List<ai.onnxruntime.OnnxValue> value, ImmutableOutputInfo<T> outputIDInfo, int numValidFeatures, Example<T> example) Converts aOnnxValue
into aPrediction
.Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
Methods inherited from interface org.tribuo.protos.ProtoSerializable
serialize
Methods inherited from interface com.oracle.labs.mlrg.olcut.provenance.Provenancable
getProvenance
-
Method Details
-
transformToPrediction
Prediction<T> transformToPrediction(List<ai.onnxruntime.OnnxValue> value, ImmutableOutputInfo<T> outputIDInfo, int numValidFeatures, Example<T> example) Converts aOnnxValue
into aPrediction
.- Parameters:
value
- The value to convert.outputIDInfo
- The output info to use to identify the outputs.numValidFeatures
- The number of valid features used by the prediction.example
- The example to insert into the prediction.- Returns:
- A prediction object.
-
transformToOutput
Converts aOnnxValue
into the specified output type.- Parameters:
value
- The value to convert.outputIDInfo
- The output info to use to identify the outputs.- Returns:
- A output.
-
transformToBatchPrediction
List<Prediction<T>> transformToBatchPrediction(List<ai.onnxruntime.OnnxValue> value, ImmutableOutputInfo<T> outputIDInfo, int[] numValidFeatures, List<Example<T>> examples) Converts aOnnxValue
containing multiple outputs into a list ofPrediction
s.- Parameters:
value
- The value to convert.outputIDInfo
- The output info to use to identify the outputs.numValidFeatures
- The number of valid features used by the prediction.examples
- The example to insert into the prediction.- Returns:
- A list of predictions.
-
transformToBatchOutput
List<T> transformToBatchOutput(List<ai.onnxruntime.OnnxValue> value, ImmutableOutputInfo<T> outputIDInfo) Converts aOnnxValue
containing multiple outputs into a list ofOutput
s.- Parameters:
value
- The value to convert.outputIDInfo
- The output info to use to identify the outputs.- Returns:
- A list of outputs.
-
generatesProbabilities
boolean generatesProbabilities()Does this OutputTransformer generate probabilities.- Returns:
- True if it produces a probability distribution in the
Prediction
.
-
getTypeWitness
The type witness used when deserializing the ONNX model from a protobuf.The default implementation throws
UnsupportedOperationException
for compatibility with implementations which don't use protobuf serialization. This implementation will be removed in the next major version of Tribuo.- Returns:
- The output class this object produces.
-