Class DedupeUtil
java.lang.Object
com.ssgllc.fish.service.util.registered.DedupeUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleprojectMaxScore(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 doublescale(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 LocalDateTranspose day and month
-
Constructor Details
-
DedupeUtil
public DedupeUtil()
-
-
Method Details
-
transposeMonthAndDay
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 theDifferentclass.pm- The softmax probability for thePossible Matchclass.m- The softmax probability for theMatchclass.notMatchThreshold- The upper bound for scores classified asDifferent.matchThreshold- The lower bound for scores classified asMatch.- Returns:
- A scalar score between
0and1representing 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.65Note: 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.55Note: If
fractionis outside[0,1], the result will be linearly extrapolated beyond the specified range.
-