OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/ntp_snippets/user_classifier.h" | 5 #include "components/ntp_snippets/user_classifier.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cfloat> | 8 #include <cfloat> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... | |
34 const double kMaxHours = 7 * 24; | 34 const double kMaxHours = 7 * 24; |
35 const char kMaxHoursParam[] = "user_classifier_max_hours"; | 35 const char kMaxHoursParam[] = "user_classifier_max_hours"; |
36 | 36 |
37 // Ignore events within |kMinHours| hours since the last event (|kMinHours| is | 37 // Ignore events within |kMinHours| hours since the last event (|kMinHours| is |
38 // the length of the browsing session where subsequent events of the same type | 38 // the length of the browsing session where subsequent events of the same type |
39 // do not count again). | 39 // do not count again). |
40 const double kMinHours = 0.5; | 40 const double kMinHours = 0.5; |
41 const char kMinHoursParam[] = "user_classifier_min_hours"; | 41 const char kMinHoursParam[] = "user_classifier_min_hours"; |
42 | 42 |
43 // Classification constants. | 43 // Classification constants. |
44 const double kActiveConsumerClicksAtLeastOncePerHours = 72; | 44 const double kActiveConsumerClicksAtLeastOncePerHours = 96; |
45 const char kActiveConsumerClicksAtLeastOncePerHoursParam[] = | 45 const char kActiveConsumerClicksAtLeastOncePerHoursParam[] = |
46 "user_classifier_active_consumer_clicks_at_least_once_per_hours"; | 46 "user_classifier_active_consumer_clicks_at_least_once_per_hours"; |
47 | 47 |
48 const double kRareUserOpensNTPAtMostOncePerHours = 96; | 48 const double kRareUserOpensNTPAtMostOncePerHours = 66; |
vitaliii
2017/04/26 14:25:50
Why 66? It does not look "even".
Probably add a co
jkrcal
2017/05/02 10:43:54
Done.
| |
49 const char kRareUserOpensNTPAtMostOncePerHoursParam[] = | 49 const char kRareUserOpensNTPAtMostOncePerHoursParam[] = |
50 "user_classifier_rare_user_opens_ntp_at_most_once_per_hours"; | 50 "user_classifier_rare_user_opens_ntp_at_most_once_per_hours"; |
51 | 51 |
52 // Histograms for logging the estimated average hours to next event. | 52 // Histograms for logging the estimated average hours to next event. |
53 const char kHistogramAverageHoursToOpenNTP[] = | 53 const char kHistogramAverageHoursToOpenNTP[] = |
54 "NewTabPage.UserClassifier.AverageHoursToOpenNTP"; | 54 "NewTabPage.UserClassifier.AverageHoursToOpenNTP"; |
55 const char kHistogramAverageHoursToShowSuggestions[] = | 55 const char kHistogramAverageHoursToShowSuggestions[] = |
56 "NewTabPage.UserClassifier.AverageHoursToShowSuggestions"; | 56 "NewTabPage.UserClassifier.AverageHoursToShowSuggestions"; |
57 const char kHistogramAverageHoursToUseSuggestions[] = | 57 const char kHistogramAverageHoursToUseSuggestions[] = |
58 "NewTabPage.UserClassifier.AverageHoursToUseSuggestions"; | 58 "NewTabPage.UserClassifier.AverageHoursToUseSuggestions"; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 | 375 |
376 void UserClassifier::SetMetricValue(Metric metric, double metric_value) { | 376 void UserClassifier::SetMetricValue(Metric metric, double metric_value) { |
377 pref_service_->SetDouble(kMetricKeys[static_cast<int>(metric)], metric_value); | 377 pref_service_->SetDouble(kMetricKeys[static_cast<int>(metric)], metric_value); |
378 } | 378 } |
379 | 379 |
380 void UserClassifier::ClearMetricValue(Metric metric) { | 380 void UserClassifier::ClearMetricValue(Metric metric) { |
381 pref_service_->ClearPref(kMetricKeys[static_cast<int>(metric)]); | 381 pref_service_->ClearPref(kMetricKeys[static_cast<int>(metric)]); |
382 } | 382 } |
383 | 383 |
384 } // namespace ntp_snippets | 384 } // namespace ntp_snippets |
OLD | NEW |