Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Unified Diff: components/dom_distiller/content/renderer/distillability_agent.cc

Issue 2021643002: Record scores of distillability and long article in UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@distillability-dev
Patch Set: add comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/content/renderer/distillability_agent.cc
diff --git a/components/dom_distiller/content/renderer/distillability_agent.cc b/components/dom_distiller/content/renderer/distillability_agent.cc
index f0ae4b511a4b0d86e8ea6bc99f5709f17e4d8d03..221cee904aa7bc595f8aaafa98d0ec23ecc26d59 100644
--- a/components/dom_distiller/content/renderer/distillability_agent.cc
+++ b/components/dom_distiller/content/renderer/distillability_agent.cc
@@ -93,10 +93,36 @@ bool IsDistillablePageAdaboost(WebDocument& doc,
features.mozScoreAllSqrt,
features.mozScoreAllLinear
);
- bool distillable = detector->Classify(derived);
- bool long_article = long_page->Classify(derived);
+ double score = detector->Score(derived) - detector->GetThreshold();
+ double long_score = long_page->Score(derived) - long_page->GetThreshold();
+ bool distillable = score > 0;
+ bool long_article = long_score > 0;
bool blacklisted = IsBlacklisted(parsed_url);
+ if (!features.isMobileFriendly) {
+ int score_int = std::round(score * 100);
+ if (score > 0) {
+ UMA_HISTOGRAM_COUNTS_1000("DomDistiller.DistillabilityScoreNMF.Positive",
+ score_int);
+ } else {
+ UMA_HISTOGRAM_COUNTS_1000("DomDistiller.DistillabilityScoreNMF.Negative",
+ -score_int);
+ }
+ if (distillable) {
+ // The long-article model is trained with pages that are
+ // non-mobile-friendly, and distillable (deemed by the first model), so
+ // only record on that type of pages.
+ int long_score_int = std::round(long_score * 100);
+ if (long_score > 0) {
+ UMA_HISTOGRAM_COUNTS_1000("DomDistiller.LongArticleScoreNMF.Positive",
+ long_score_int);
+ } else {
+ UMA_HISTOGRAM_COUNTS_1000("DomDistiller.LongArticleScoreNMF.Negative",
+ -long_score_int);
+ }
+ }
+ }
+
int bucket = static_cast<unsigned>(features.isMobileFriendly) |
(static_cast<unsigned>(distillable) << 1);
if (is_last) {
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698