Class LabelTransformer
java.lang.Object
org.tribuo.interop.onnx.LabelTransformer
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>,Serializable,OutputTransformer<Label>
Can convert an
OnnxValue into a Prediction or a Label.
Accepts both a tuple (tensor,sequence(map(long,float))) and a single tensor. The former is usually produced by scikit-learn or similar, the latter is produced by pytorch.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDoes this OutputTransformer generate probabilities.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenancetoString()transformToBatchOutput(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo) Converts aOnnxValuecontaining multiple outputs into a list ofOutputs.transformToBatchPrediction(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo, int[] numValidFeatures, List<Example<Label>> examples) Converts aOnnxValuecontaining multiple outputs into a list ofPredictions.transformToOutput(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo) Converts aOnnxValueinto the specified output type.transformToPrediction(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo, int numValidFeatures, Example<Label> example) Converts aOnnxValueinto aPrediction.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Constructor Details
-
LabelTransformer
public LabelTransformer()
-
-
Method Details
-
transformToPrediction
public Prediction<Label> transformToPrediction(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo, int numValidFeatures, Example<Label> example) Description copied from interface:OutputTransformerConverts aOnnxValueinto aPrediction.- Specified by:
transformToPredictionin interfaceOutputTransformer<Label>- Parameters:
tensor- 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
public Label transformToOutput(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo) Description copied from interface:OutputTransformerConverts aOnnxValueinto the specified output type.- Specified by:
transformToOutputin interfaceOutputTransformer<Label>- Parameters:
tensor- The value to convert.outputIDInfo- The output info to use to identify the outputs.- Returns:
- A output.
-
transformToBatchPrediction
public List<Prediction<Label>> transformToBatchPrediction(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo, int[] numValidFeatures, List<Example<Label>> examples) Description copied from interface:OutputTransformerConverts aOnnxValuecontaining multiple outputs into a list ofPredictions.- Specified by:
transformToBatchPredictionin interfaceOutputTransformer<Label>- Parameters:
tensor- 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
public List<Label> transformToBatchOutput(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Label> outputIDInfo) Description copied from interface:OutputTransformerConverts aOnnxValuecontaining multiple outputs into a list ofOutputs.- Specified by:
transformToBatchOutputin interfaceOutputTransformer<Label>- Parameters:
tensor- The value to convert.outputIDInfo- The output info to use to identify the outputs.- Returns:
- A list of outputs.
-
generatesProbabilities
Description copied from interface:OutputTransformerDoes this OutputTransformer generate probabilities.- Specified by:
generatesProbabilitiesin interfaceOutputTransformer<Label>- Returns:
- True if it produces a probability distribution in the
Prediction.
-
toString
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-