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

Side by Side Diff: components/ntp_snippets/user_classifier.h

Issue 2358983003: Making UserClassifier configurable by variation parameters (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 12
13 class PrefRegistrySimple; 13 class PrefRegistrySimple;
14 class PrefService; 14 class PrefService;
15 15
16 namespace ntp_snippets { 16 namespace ntp_snippets {
17 17
18 // Collects data about user usage patterns of content suggestions, computes 18 // Collects data about user usage patterns of content suggestions, computes
19 // long-term user metrics locally using pref, and reports the metrics to UMA. 19 // long-term user metrics locally using pref, and reports the metrics to UMA.
20 // Based on these lon-term user metrics, it classifies the user in a UserClass. 20 // Based on these lon-term user metrics, it classifies the user in a UserClass.
Marc Treib 2016/09/22 12:29:06 s/lon-term/long-term/
jkrcal 2016/09/22 13:26:15 Done.
21 class UserClassifier { 21 class UserClassifier {
22 public: 22 public:
23 // Enumeration listing user classes 23 // Enumeration listing user classes
24 enum class UserClass { 24 enum class UserClass {
25 RARE_NTP_USER, 25 RARE_NTP_USER,
26 ACTIVE_NTP_USER, 26 ACTIVE_NTP_USER,
27 ACTIVE_SUGGESTIONS_CONSUMER, 27 ACTIVE_SUGGESTIONS_CONSUMER,
28 }; 28 };
29 29
30 // For estimating the average length of the intervals between two successive 30 // For estimating the average length of the intervals between two successive
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // return 0. 84 // return 0.
85 double GetHoursSinceLastTime(Metric metric) const; 85 double GetHoursSinceLastTime(Metric metric) const;
86 bool HasLastTime(Metric metric) const; 86 bool HasLastTime(Metric metric) const;
87 void SetLastTimeToNow(Metric metric); 87 void SetLastTimeToNow(Metric metric);
88 88
89 double GetMetricValue(Metric metric) const; 89 double GetMetricValue(Metric metric) const;
90 void SetMetricValue(Metric metric, double metric_value); 90 void SetMetricValue(Metric metric, double metric_value);
91 void ClearMetricValue(Metric metric); 91 void ClearMetricValue(Metric metric);
92 92
93 PrefService* pref_service_; 93 PrefService* pref_service_;
94
95 // Params of the metric.
94 const double discount_rate_per_hour_; 96 const double discount_rate_per_hour_;
97 const double min_hours_;
98 const double max_hours_;
99
100 // Params of the classification.
101 const double active_consumer_scrolls_at_least_once_per_hours_;
102 const double active_consumer_opens_ntp_at_least_once_per_hours_;
Marc Treib 2016/09/22 12:29:06 I first wanted to say "s/consumer/user/ to be cons
jkrcal 2016/09/22 13:26:15 Well, I wanted to be on the safe side and have mor
103 const double rare_user_opens_ntp_at_most_once_per_hours_;
95 104
96 DISALLOW_COPY_AND_ASSIGN(UserClassifier); 105 DISALLOW_COPY_AND_ASSIGN(UserClassifier);
97 }; 106 };
98 107
99 } // namespace ntp_snippets 108 } // namespace ntp_snippets
100 109
101 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_ 110 #endif // COMPONENTS_NTP_SNIPPETS_USER_CLASSIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/user_classifier.cc » ('j') | components/ntp_snippets/user_classifier.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698