Class LabelTransformer
java.lang.Object
org.tribuo.interop.tensorflow.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 a
Label into a Tensor containing a 32-bit integer and
can convert a vector of 32-bit floats into a Prediction or a Label.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDoes this OutputTransformer generate probabilities.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenancetoString()org.tensorflow.Tensor<?> Converts a list ofExampleinto aTensorrepresenting all the outputs in the list.org.tensorflow.Tensor<?> transform(Label example, ImmutableOutputInfo<Label> outputIDInfo) Converts anOutputinto aTensorrepresenting it's output.transformToBatchOutput(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo) Converts aTensorcontaining multiple outputs into a list ofOutputs.transformToBatchPrediction(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo, int[] numValidFeatures, List<Example<Label>> examples) Converts aTensorcontaining multiple outputs into a list ofPredictions.transformToOutput(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo) Converts aTensorinto the specified output type.transformToPrediction(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo, int numValidFeatures, Example<Label> example) Converts aTensorinto 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(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo, int numValidFeatures, Example<Label> example) Description copied from interface:OutputTransformerConverts aTensorinto aPrediction.- Specified by:
transformToPredictionin interfaceOutputTransformer<Label>- Parameters:
tensor- The tensor 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(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo) Description copied from interface:OutputTransformerConverts aTensorinto the specified output type.- Specified by:
transformToOutputin interfaceOutputTransformer<Label>- Parameters:
tensor- The tensor to convert.outputIDInfo- The output info to use to identify the outputs.- Returns:
- A output.
-
transformToBatchPrediction
public List<Prediction<Label>> transformToBatchPrediction(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo, int[] numValidFeatures, List<Example<Label>> examples) Description copied from interface:OutputTransformerConverts aTensorcontaining multiple outputs into a list ofPredictions.- Specified by:
transformToBatchPredictionin interfaceOutputTransformer<Label>- Parameters:
tensor- The tensor 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(org.tensorflow.Tensor<?> tensor, ImmutableOutputInfo<Label> outputIDInfo) Description copied from interface:OutputTransformerConverts aTensorcontaining multiple outputs into a list ofOutputs.- Specified by:
transformToBatchOutputin interfaceOutputTransformer<Label>- Parameters:
tensor- The tensor to convert.outputIDInfo- The output info to use to identify the outputs.- Returns:
- A list of outputs.
-
transform
Description copied from interface:OutputTransformerConverts anOutputinto aTensorrepresenting it's output.- Specified by:
transformin interfaceOutputTransformer<Label>- Parameters:
example- The output to convert.outputIDInfo- The output info to use to identify the outputs.- Returns:
- A Tensor representing this output.
-
transform
public org.tensorflow.Tensor<?> transform(List<Example<Label>> examples, ImmutableOutputInfo<Label> outputIDInfo) Description copied from interface:OutputTransformerConverts a list ofExampleinto aTensorrepresenting all the outputs in the list. It accepts a list of Example rather than a list of Output for efficiency reasons.- Specified by:
transformin interfaceOutputTransformer<Label>- Parameters:
examples- The examples to convert.outputIDInfo- The output info to use to identify the outputs.- Returns:
- A Tensor representing all the supplied 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>
-