Commit 3a35d2fa authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

Fixes an error in the frecency formula used for the local history zps

Frequency component must be multiplied by recency decay in numerator.

See: http://shortn/_bW5Qq2zTHM

Bug: 1096615
Change-Id: I5138dce685607c44289dcab8b42a22968fc8ea0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2419533
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Justin Donnelly <jdonnelly@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Auto-Submit: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808618}
parent 370f8ae7
......@@ -95,15 +95,18 @@ bool AllowLocalHistoryZeroSuggestSuggestions(const AutocompleteInput& input) {
}
// Helper function for calculating frecency of a visit based on this formula:
// frecency = (frequency ^ 1.15 + 60) / (recency_in_seconds + 60)
//            (frequency ^ frequency_exponent) * recency_decay_unit_in_seconds
// frecency = ————————————————————————————————————————————————————————————————
//                   recency_in_seconds + recency_decay_unit_in_seconds
// a frecency score combines frequency and recency of occurrences favoring ones
// that are more frequent and more recent (see go/local-zps-frecency-ranking).
double CalculateFrecency(const history::NormalizedKeywordSearchTermVisit& visit,
base::Time now) {
double recency_in_secs =
const double recency_sec =
base::TimeDelta(now - visit.most_recent_visit_time).InSeconds();
double frequency_powered = pow(visit.visits, 1.15);
return (frequency_powered + 60) / (recency_in_secs + 60);
const double recency_decayed = 60 / (recency_sec + 60);
const double frequency_powered = pow(visit.visits, 1.15);
return frequency_powered * recency_decayed;
}
} // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment