Package com.tibco.patterns.learn.rlink

## Class RLinkOut

- java.lang.Object
- - com.tibco.patterns.learn.rlink.RLinkOut

-     public final class RLinkOut
      extends java.lang.Object

  Stores the result of RLink model prediction. Immutable class.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static double` | `RLINK_THRESHOLD` | The threshold between "true" and "false" labels used to train models

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RLinkOut​(double score, double confidence)` | Creates object that stores the given score and confidence.
    `RLinkOut​(double score, double confidence, double[] significance)` | Creates object that stores the given score, confidence and feature significance values.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `correctPrediction​(boolean actualLabel)` |
    `boolean` | `correctPrediction​(boolean actualLabel, double threshold)` | Do not use custom thresholds for model training!
    `double` | `getConfidence()` | Gets the prediction confidence.
    `boolean` | `getLabel()` |
    `static boolean` | `getLabel​(double rlinkScore)` |
    `double` | `getScore()` |
    `double[]` | `getSignificance()` | Gets the significance of each model feature value.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### RLINK_THRESHOLD

          public static final double RLINK_THRESHOLD

      The threshold between "true" and "false" labels used to train models
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RLinkOut

          public RLinkOut​(double score,
                          double confidence)

      Creates object that stores the given score and confidence.
      Parameters:
        `score` - - prediction score.
        `confidence` - - prediction confidence.

    - #### RLinkOut

          public RLinkOut​(double score,
                          double confidence,
                          double[] significance)

      Creates object that stores the given score, confidence and feature significance values.
      Parameters:
        `score` - - prediction score.
        `confidence` - - prediction confidence.
        `significance` - - significance of each feature. May be empty or null if significance values have not been calculated.

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getScore

          public double getScore()

      Returns:
        prediction score

    - #### getLabel

          public static boolean getLabel​(double rlinkScore)

      Returns:
        the predicted label (according to natural RLink threshold)

    - #### getLabel

          public boolean getLabel()

      Returns:
        the predicted label (according to natural RLink threshold)

    - #### correctPrediction

          public boolean correctPrediction​(boolean actualLabel)

      Returns:
        if the predicted label matches the actualLabel

    - #### correctPrediction

          public boolean correctPrediction​(boolean actualLabel,
                                           double threshold)

      Do not use custom thresholds for model training!
      Returns:
        if the predicted label (determined according to specified threshold) matches the actualLabel.

    - #### getConfidence

          public double getConfidence()

      Gets the prediction confidence. It indicates how well the model was trained for the given feature values.
      Returns:
        prediction confidence. The value is in the range of [0; 1]. If no confidence was requested, or if the requested confidence measure is not supported by the model, the value is `RLink.NO_CONFIDENCE_MEASURE`.

    - #### getSignificance

          public double[] getSignificance()

      Gets the significance of each model feature value. Each significance value (between 0.0 and 1.0) is the relative importance of the model feature value in determining the prediction score and label. Feature values with high significance were considered relevant in making the decision, querylets with low scores were not relevant. The sum of all significance values is 1.0.
      Returns:
        the significance of each feature value in making the prediction. The returned array is empty if significance values have not been calculated (the predicted label is false).