Commit 78591f12 authored by Ryan Sturm's avatar Ryan Sturm Committed by Commit Bot

Bucketing metrics for scoring in nav predictor

Metrics for training are bucketed, and this CL adds parity to bucket the
metrics before scoring each link.

TBR=tbansal@chromium.org

Bug: 999897
Change-Id: I8082e9bbaff0cb3aba75273e53ed00690f9c6c06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779843Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692389}
parent 5c1dffb2
...@@ -963,7 +963,8 @@ double NavigationPredictor::CalculateAnchorNavigationScore( ...@@ -963,7 +963,8 @@ double NavigationPredictor::CalculateAnchorNavigationScore(
// TODO(chelu): https://crbug.com/850624/. Experiment with other heuristic // TODO(chelu): https://crbug.com/850624/. Experiment with other heuristic
// algorithms for computing the anchor elements score. // algorithms for computing the anchor elements score.
double score = double score =
(ratio_area_scale_ * (metrics.ratio_area * 100.0)) + (ratio_area_scale_ * GetLinearBucketForRatioArea(
static_cast<int>(metrics.ratio_area * 100.0))) +
(metrics.is_in_iframe ? is_in_iframe_scale_ : 0.0) + (metrics.is_in_iframe ? is_in_iframe_scale_ : 0.0) +
(metrics.contains_image ? contains_image_scale_ : 0.0) + host_score + (metrics.contains_image ? contains_image_scale_ : 0.0) + host_score +
(metrics.is_url_incremented_by_one ? is_url_incremented_scale_ : 0.0) + (metrics.is_url_incremented_by_one ? is_url_incremented_scale_ : 0.0) +
...@@ -971,7 +972,8 @@ double NavigationPredictor::CalculateAnchorNavigationScore( ...@@ -971,7 +972,8 @@ double NavigationPredictor::CalculateAnchorNavigationScore(
(target_engagement_score_scale_ * target_engagement_score) + (target_engagement_score_scale_ * target_engagement_score) +
(area_rank_scale_ * area_rank_score) + (area_rank_scale_ * area_rank_score) +
(ratio_distance_root_top_scale_ * (ratio_distance_root_top_scale_ *
(metrics.ratio_distance_root_top * 100.0)); GetLinearBucketForLinkLocation(
static_cast<int>(metrics.ratio_distance_root_top * 100.0)));
if (normalize_navigation_scores_) { if (normalize_navigation_scores_) {
score = score / sum_link_scales_ * 100.0; score = score / sum_link_scales_ * 100.0;
...@@ -986,15 +988,24 @@ double NavigationPredictor::GetPageMetricsScore() const { ...@@ -986,15 +988,24 @@ double NavigationPredictor::GetPageMetricsScore() const {
return 0; return 0;
} else { } else {
DCHECK(!viewport_size_.IsEmpty()); DCHECK(!viewport_size_.IsEmpty());
return (link_total_scale_ * number_of_anchors_) + return (link_total_scale_ *
(iframe_link_total_scale_ * number_of_anchors_in_iframe_) + GetBucketMinForPageMetrics(number_of_anchors_)) +
(increment_link_total_scale_ * number_of_anchors_url_incremented_) + (iframe_link_total_scale_ *
(same_origin_link_total_scale_ * number_of_anchors_same_host_) + GetBucketMinForPageMetrics(number_of_anchors_in_iframe_)) +
(image_link_total_scale_ * number_of_anchors_contains_image_) + (increment_link_total_scale_ *
(clickable_space_scale_ * total_clickable_space_) + GetBucketMinForPageMetrics(number_of_anchors_url_incremented_)) +
(median_link_location_scale_ * median_link_location_) + (same_origin_link_total_scale_ *
(viewport_width_scale_ * viewport_size_.width()) + GetBucketMinForPageMetrics(number_of_anchors_same_host_)) +
(viewport_height_scale_ * viewport_size_.height()); (image_link_total_scale_ *
GetBucketMinForPageMetrics(number_of_anchors_contains_image_)) +
(clickable_space_scale_ *
GetBucketMinForPageMetrics(total_clickable_space_)) +
(median_link_location_scale_ *
GetLinearBucketForLinkLocation(median_link_location_)) +
(viewport_width_scale_ *
GetBucketMinForPageMetrics(viewport_size_.width())) +
(viewport_height_scale_ *
GetBucketMinForPageMetrics(viewport_size_.height()));
} }
} }
......
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