| 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 #ifndef COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // the continuous utility function between two successive events (e.g. opening | 34 // the continuous utility function between two successive events (e.g. opening |
| 35 // a NTP) at times t1 < t2 is 1 / (t2-t1), i.e. intuitively the rate of this | 35 // a NTP) at times t1 < t2 is 1 / (t2-t1), i.e. intuitively the rate of this |
| 36 // event in this time interval. | 36 // event in this time interval. |
| 37 // See https://en.wikipedia.org/wiki/Exponential_discounting for more details. | 37 // See https://en.wikipedia.org/wiki/Exponential_discounting for more details. |
| 38 // We keep track of the following events. | 38 // We keep track of the following events. |
| 39 // NOTE: if you add any element, add it also in the static arrays in .cc and | 39 // NOTE: if you add any element, add it also in the static arrays in .cc and |
| 40 // create another histogram. | 40 // create another histogram. |
| 41 enum class Metric { | 41 enum class Metric { |
| 42 NTP_OPENED, // When the user opens a new NTP - this indicates potential | 42 NTP_OPENED, // When the user opens a new NTP - this indicates potential |
| 43 // use of content suggestions. | 43 // use of content suggestions. |
| 44 // TODO(jkrcal): Remove the following metric as for condensed NTP / Chrome |
| 45 // Home, this coincides with NTP_OPENED. |
| 44 SUGGESTIONS_SHOWN, // When the content suggestions are shown to the user - | 46 SUGGESTIONS_SHOWN, // When the content suggestions are shown to the user - |
| 45 // in the current implementation when the user scrolls | 47 // in the current implementation when the user scrolls |
| 46 // below the fold. | 48 // below the fold. |
| 47 SUGGESTIONS_USED, // When the user clicks on some suggestions or on some | 49 SUGGESTIONS_USED, // When the user clicks on some suggestions or on some |
| 48 // "More" button. | 50 // "More" button. |
| 49 COUNT // Keep this as the last element. | 51 COUNT // Keep this as the last element. |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 // The provided |pref_service| may be nullptr in unit-tests. | 54 // The provided |pref_service| may be nullptr in unit-tests. |
| 53 explicit UserClassifier(PrefService* pref_service); | 55 explicit UserClassifier(PrefService* pref_service); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void ClearMetricValue(Metric metric); | 93 void ClearMetricValue(Metric metric); |
| 92 | 94 |
| 93 PrefService* pref_service_; | 95 PrefService* pref_service_; |
| 94 | 96 |
| 95 // Params of the metric. | 97 // Params of the metric. |
| 96 const double discount_rate_per_hour_; | 98 const double discount_rate_per_hour_; |
| 97 const double min_hours_; | 99 const double min_hours_; |
| 98 const double max_hours_; | 100 const double max_hours_; |
| 99 | 101 |
| 100 // Params of the classification. | 102 // Params of the classification. |
| 101 const double active_consumer_scrolls_at_least_once_per_hours_; | 103 const double active_consumer_clicks_at_least_once_per_hours_; |
| 102 const double rare_user_opens_ntp_at_most_once_per_hours_; | 104 const double rare_user_opens_ntp_at_most_once_per_hours_; |
| 103 | 105 |
| 104 DISALLOW_COPY_AND_ASSIGN(UserClassifier); | 106 DISALLOW_COPY_AND_ASSIGN(UserClassifier); |
| 105 }; | 107 }; |
| 106 | 108 |
| 107 } // namespace ntp_snippets | 109 } // namespace ntp_snippets |
| 108 | 110 |
| 109 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ | 111 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ |
| OLD | NEW |