Chromium Code Reviews| 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 SUGGESTIONS_SHOWN, // When the content suggestions are shown to the user - | 44 SUGGESTIONS_SHOWN, // When the content suggestions are shown to the user - |
|
Marc Treib
2017/03/09 10:14:35
Is this metric still useful at all? If not, since
jkrcal
2017/03/09 12:33:38
Added the todo.
| |
| 45 // in the current implementation when the user scrolls | 45 // in the current implementation when the user scrolls |
| 46 // below the fold. | 46 // below the fold. |
| 47 SUGGESTIONS_USED, // When the user clicks on some suggestions or on some | 47 SUGGESTIONS_USED, // When the user clicks on some suggestions or on some |
| 48 // "More" button. | 48 // "More" button. |
| 49 COUNT // Keep this as the last element. | 49 COUNT // Keep this as the last element. |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // The provided |pref_service| may be nullptr in unit-tests. | 52 // The provided |pref_service| may be nullptr in unit-tests. |
| 53 explicit UserClassifier(PrefService* pref_service); | 53 explicit UserClassifier(PrefService* pref_service); |
| 54 ~UserClassifier(); | 54 ~UserClassifier(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 void ClearMetricValue(Metric metric); | 91 void ClearMetricValue(Metric metric); |
| 92 | 92 |
| 93 PrefService* pref_service_; | 93 PrefService* pref_service_; |
| 94 | 94 |
| 95 // Params of the metric. | 95 // Params of the metric. |
| 96 const double discount_rate_per_hour_; | 96 const double discount_rate_per_hour_; |
| 97 const double min_hours_; | 97 const double min_hours_; |
| 98 const double max_hours_; | 98 const double max_hours_; |
| 99 | 99 |
| 100 // Params of the classification. | 100 // Params of the classification. |
| 101 const double active_consumer_scrolls_at_least_once_per_hours_; | 101 const double active_consumer_clicks_at_least_once_per_hours_; |
| 102 const double rare_user_opens_ntp_at_most_once_per_hours_; | 102 const double rare_user_opens_ntp_at_most_once_per_hours_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(UserClassifier); | 104 DISALLOW_COPY_AND_ASSIGN(UserClassifier); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace ntp_snippets | 107 } // namespace ntp_snippets |
| 108 | 108 |
| 109 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ | 109 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ |
| OLD | NEW |