Class RegressorTransformer

java.lang.Object
org.tribuo.interop.onnx.RegressorTransformer
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<Regressor>, ProtoSerializable<org.tribuo.interop.onnx.protos.OutputTransformerProto>

public class RegressorTransformer extends Object implements OutputTransformer<Regressor>
Can convert an OnnxValue into a Prediction or Regressor.
See Also:
  • Field Details

    • CURRENT_VERSION

      public static final int CURRENT_VERSION
      Protobuf serialization version.
      See Also:
  • Constructor Details

    • RegressorTransformer

      public RegressorTransformer()
      Constructs a RegressorTransformer.
  • Method Details

    • deserializeFromProto

      public static RegressorTransformer deserializeFromProto(int version, String className, com.google.protobuf.Any message)
      Deserialization factory.
      Parameters:
      version - The serialized object version.
      className - The class name.
      message - The serialized data.
      Returns:
      The deserialized object.
    • transformToPrediction

      public Prediction<Regressor> transformToPrediction(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Regressor> outputIDInfo, int numValidFeatures, Example<Regressor> example)
      Description copied from interface: OutputTransformer
      Converts a OnnxValue into a Prediction.
      Specified by:
      transformToPrediction in interface OutputTransformer<Regressor>
      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 Regressor transformToOutput(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Regressor> outputIDInfo)
      Description copied from interface: OutputTransformer
      Converts a OnnxValue into the specified output type.
      Specified by:
      transformToOutput in interface OutputTransformer<Regressor>
      Parameters:
      tensor - The value to convert.
      outputIDInfo - The output info to use to identify the outputs.
      Returns:
      A output.
    • transformToBatchPrediction

      public List<Prediction<Regressor>> transformToBatchPrediction(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Regressor> outputIDInfo, int[] numValidFeatures, List<Example<Regressor>> examples)
      Description copied from interface: OutputTransformer
      Converts a OnnxValue containing multiple outputs into a list of Predictions.
      Specified by:
      transformToBatchPrediction in interface OutputTransformer<Regressor>
      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<Regressor> transformToBatchOutput(List<ai.onnxruntime.OnnxValue> tensor, ImmutableOutputInfo<Regressor> outputIDInfo)
      Description copied from interface: OutputTransformer
      Converts a OnnxValue containing multiple outputs into a list of Outputs.
      Specified by:
      transformToBatchOutput in interface OutputTransformer<Regressor>
      Parameters:
      tensor - The value to convert.
      outputIDInfo - The output info to use to identify the outputs.
      Returns:
      A list of outputs.
    • generatesProbabilities

      public boolean generatesProbabilities()
      Description copied from interface: OutputTransformer
      Does this OutputTransformer generate probabilities.
      Specified by:
      generatesProbabilities in interface OutputTransformer<Regressor>
      Returns:
      True if it produces a probability distribution in the Prediction.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTypeWitness

      public Class<Regressor> getTypeWitness()
      Description copied from interface: OutputTransformer
      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.

      Specified by:
      getTypeWitness in interface OutputTransformer<Regressor>
      Returns:
      The output class this object produces.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • serialize

      public org.tribuo.interop.onnx.protos.OutputTransformerProto serialize()
      Description copied from interface: ProtoSerializable
      Serializes this object to a protobuf.
      Specified by:
      serialize in interface ProtoSerializable<org.tribuo.interop.onnx.protos.OutputTransformerProto>
      Returns:
      The protobuf.
    • getProvenance

      public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
      Specified by:
      getProvenance in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>