Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public ScoreTracker getScoreTracker(boolean pruneSearch, int rerankK, float thre

if (threshold > 0) {
if (twoPhaseTracker == null) {
twoPhaseTracker = new ScoreTracker.TwoPhaseTracker();
twoPhaseTracker = new ScoreTracker.TwoPhaseTracker(threshold);
} else {
twoPhaseTracker.reset(threshold);
}
scoreTracker = twoPhaseTracker;
} else {
if (pruneSearch) {
if (relaxedMonotonicityTracker == null) {
relaxedMonotonicityTracker = new ScoreTracker.RelaxedMonotonicityTracker();
relaxedMonotonicityTracker = new ScoreTracker.RelaxedMonotonicityTracker(rerankK);
} else {
relaxedMonotonicityTracker.reset(rerankK);
}
Expand Down Expand Up @@ -109,10 +109,6 @@ class TwoPhaseTracker implements ScoreTracker {
this.threshold = threshold;
}

TwoPhaseTracker() {
this(0);
}

void reset(double threshold) {
this.bestScores.clear();
this.observationCount = 0;
Expand Down Expand Up @@ -195,10 +191,6 @@ class RelaxedMonotonicityTracker implements ScoreTracker {
this.dSquared = 0;
}

RelaxedMonotonicityTracker() {
this(100);
}

private static int getRecentScoresSize(int bestScoresTracked) {
// A quick empirical study yields that the number of recent scores
// that we need to consider grows by a factor of ~sqrt(bestScoresTracked / 2)
Expand All @@ -211,7 +203,8 @@ void reset(int bestScoresTracked) {
if (this.recentScoresSize > recentScores.length) {
recentScores = ArrayUtil.grow(recentScores, this.recentScoresSize);
}
this.bestScores.clear();
bestScores.clear();
bestScores.setMaxSize(bestScoresTracked);
this.observationCount = 0;
this.mean = 0;
this.dSquared = 0;
Expand Down