Class DedupeUtil

java.lang.Object
com.ssgllc.fish.service.util.registered.DedupeUtil

@Component public class DedupeUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    projectMaxScore(double d, double pm, double m, double notMatchThreshold, double matchThreshold)
    Projects a 3-class softmax output (Different / Possible Match / Match) into a single scalar score in the range [0,1].
    The highest probability class is selected (argmax), and its probability is then linearly interpolated into the corresponding threshold band: Different[0, notMatchThreshold] Possible Match[notMatchThreshold, matchThreshold] Match[matchThreshold, 1]
    static double
    scale(double startRange, double endRange, double fraction)
    Linearly interpolates a fractional value in [0,1] into the range [startRange, endRange].
    The returned value is computed as: startRange + (endRange - startRange) * fraction.
    static LocalDate
    Transpose day and month

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DedupeUtil

      public DedupeUtil()
  • Method Details

    • transposeMonthAndDay

      public static LocalDate transposeMonthAndDay(LocalDate date)
      Transpose day and month
      Parameters:
      date -
      Returns:
    • projectMaxScore

      public static double projectMaxScore(double d, double pm, double m, double notMatchThreshold, double matchThreshold)
      Projects a 3-class softmax output (Different / Possible Match / Match) into a single scalar score in the range [0,1].
      The highest probability class is selected (argmax), and its probability is then linearly interpolated into the corresponding threshold band:
      • Different[0, notMatchThreshold]
      • Possible Match[notMatchThreshold, matchThreshold]
      • Match[matchThreshold, 1]
      Parameters:
      d - The softmax probability for the Different class.
      pm - The softmax probability for the Possible Match class.
      m - The softmax probability for the Match class.
      notMatchThreshold - The upper bound for scores classified as Different.
      matchThreshold - The lower bound for scores classified as Match.
      Returns:
      A scalar score between 0 and 1 representing the projected confidence within the appropriate threshold band.

      Groovy example:
      return matchUtil.projectMaxScore(0.1, 0.7, 0.2, 0.3, 0.8)

      Returns:
      0.65

      SpEL example:
      #projectMaxScore(0.1, 0.7, 0.2, 0.3, 0.8)

      Returns:
      0.65
      Note: This method assumes the input probabilities are already normalized (e.g., produced by a softmax function) and typically sum to 1.0.
    • scale

      public static double scale(double startRange, double endRange, double fraction)
      Linearly interpolates a fractional value in [0,1] into the range [startRange, endRange].
      The returned value is computed as: startRange + (endRange - startRange) * fraction.
      Parameters:
      startRange - The lower bound of the target range.
      endRange - The upper bound of the target range.
      fraction - A value typically in [0,1] representing the relative position within the target range.
      Returns:
      The interpolated value within [startRange, endRange].

      Groovy example:
      return matchUtil.scale(0.3, 0.8, 0.5)

      Returns:
      0.55

      SpEL example:
      #scale(0.3, 0.8, 0.5)

      Returns:
      0.55
      Note: If fraction is outside [0,1], the result will be linearly extrapolated beyond the specified range.