Package com.tibco.patterns.learn.api.project

## Class RecPair.ConfScoreComparator

- java.lang.Object
- - com.tibco.patterns.learn.api.project.RecPair.ConfScoreComparator

- All Implemented Interfaces:
    `java.io.Serializable`, `java.util.Comparator<RecPair>`
  Enclosing class:
    RecPair

      public static final class RecPair.ConfScoreComparator
      extends java.lang.Object
      implements java.util.Comparator<RecPair>, java.io.Serializable

  Provides ordering by a combination (weighted sum) of the prediction confidence (ascending) and the distance of the model score from the 0.5 threshold (ascending). The proportion (importance) of the two parts can be customized. The comparator is consistent with equals: pairs that have the same combination of confidence and score, or no model prediction are ordered by record keys.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConfScoreComparator​(double confProportion, double scoreDistFrom)` | Creates a ConfScoreComparator with given parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `compare​(RecPair pair1, RecPair pair2)` |

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

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

    - ### Methods inherited from interface java.util.Comparator

      `equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Constructor Detail

    - #### ConfScoreComparator

          public ConfScoreComparator​(double confProportion,
                                     double scoreDistFrom)

      Creates a ConfScoreComparator with given parameters.
      Parameters:
        `confProportion` - - the proportion (importance) of confidence for the overall ordering (the remaining proportion is model score distance from 0.5). If 1, sorting is by confidence only. If 0, sorting is by score distance only.
        `scoreDistFrom` - - the point from which the model score distance is calculated. If 0, the unmodified score is used. If RLinkOut.RLINK_THRESHOLD, the distance is a measure of how certain the model prediction is. Ignored if confProportion is 1.
      Throws:
        `java.lang.IllegalArgumentException` - if any parameter is not in [0; 1].

  - ### Method Detail

    - #### compare

          public int compare​(RecPair pair1,
                             RecPair pair2)

      Specified by:
        `compare` in interface `java.util.Comparator<RecPair>`