Class OCIMultiLabelConverter

java.lang.Object
org.tribuo.interop.oci.OCIMultiLabelConverter
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, OCIOutputConverter<MultiLabel>

public final class OCIMultiLabelConverter extends Object implements OCIOutputConverter<MultiLabel>
A converter for DenseMatrix and DenseVector into MultiLabel Predictions.

The threshold is user determined, but defaults to 0.5.

See Also:
  • Field Details

    • DEFAULT_THRESHOLD

      public static final double DEFAULT_THRESHOLD
      The default threshold for conversion into a label.
      See Also:
  • Constructor Details

    • OCIMultiLabelConverter

      public OCIMultiLabelConverter(double threshold, boolean generatesProbabilities)
      Constructs an OCILabelConverter with the specified parameters.
      Parameters:
      threshold - Threshold for emitting a MultiLabel dimension.
      generatesProbabilities - Does this converter emit probabilities?
  • Method Details

    • postConfig

      public void postConfig()
      Used by the OLCUT configuration system, and should not be called by external code.
      Specified by:
      postConfig in interface com.oracle.labs.mlrg.olcut.config.Configurable
    • convertOutput

      public Prediction<MultiLabel> convertOutput(DenseVector scores, int numValidFeature, Example<MultiLabel> example, ImmutableOutputInfo<MultiLabel> outputIDInfo)
      Description copied from interface: OCIOutputConverter
      Converts a dense vector into a single prediction of the appropriate type.
      Specified by:
      convertOutput in interface OCIOutputConverter<MultiLabel>
      Parameters:
      scores - The score vector.
      numValidFeature - The number of valid features (stored in the prediction).
      example - The example (stored in the prediction).
      outputIDInfo - The output information.
      Returns:
      A prediction representing the value of this score vector.
    • convertOutput

      public List<Prediction<MultiLabel>> convertOutput(DenseMatrix scores, int[] numValidFeatures, List<Example<MultiLabel>> examples, ImmutableOutputInfo<MultiLabel> outputIDInfo)
      Description copied from interface: OCIOutputConverter
      Converts a dense matrix into a list of predictions of the appropriate type.
      Specified by:
      convertOutput in interface OCIOutputConverter<MultiLabel>
      Parameters:
      scores - The score matrix.
      numValidFeatures - The number of valid features in each example (stored in the prediction).
      examples - The examples (stored in the prediction).
      outputIDInfo - The output information.
      Returns:
      A list of predictions representing the value of this score matrix.
    • generatesProbabilities

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

      public double getThreshold()
      Returns the threshold this converter uses to emit labels.
      Returns:
      The threshold.
    • toString

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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>