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

Side by Side Diff: components/omnibox/browser/omnibox_field_trial.h

Issue 1286093006: Launch HQP & HUP score changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Barts comments Created 5 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ 6 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "components/metrics/proto/omnibox_event.pb.h" 14 #include "components/metrics/proto/omnibox_event.pb.h"
15 #include "components/omnibox/browser/autocomplete_match_type.h" 15 #include "components/omnibox/browser/autocomplete_match_type.h"
16 16
17 namespace base { 17 namespace base {
18 class TimeDelta; 18 class TimeDelta;
19 } 19 }
20 20
21 // The set of parameters customizing the HUP scoring. 21 // The set of parameters customizing the HUP scoring.
22 struct HUPScoringParams { 22 struct HUPScoringParams {
23 // A set of parameters describing how to cap a given count score. First, 23 // A set of parameters describing how to cap a given count score. First,
24 // we apply a half-life based decay of the given count and then find the 24 // we apply a half-life based decay of the given count and then find the
25 // maximum relevance score in the corresponding bucket list. 25 // maximum relevance score in the corresponding bucket list.
Peter Kasting 2015/08/27 00:50:45 I think you should update this comment and the com
Ashok vardhan 2015/08/27 19:09:27 Done.
26 class ScoreBuckets { 26 class ScoreBuckets {
27 public: 27 public:
28 // (decayed_count, max_relevance) pair. 28 // (decayed_count, max_relevance) pair.
29 typedef std::pair<double, int> CountMaxRelevance; 29 typedef std::pair<double, int> CountMaxRelevance;
30 30
31 ScoreBuckets(); 31 ScoreBuckets();
32 ~ScoreBuckets(); 32 ~ScoreBuckets();
33 33
34 // Computes a half-life time decay given the |elapsed_time|. 34 // Computes a half-life time decay given the |elapsed_time|.
35 double HalfLifeTimeDecay(const base::TimeDelta& elapsed_time) const; 35 double HalfLifeTimeDecay(const base::TimeDelta& elapsed_time) const;
36 36
37 int relevance_cap() const { return relevance_cap_; } 37 int relevance_cap() const { return relevance_cap_; }
38 void set_relevance_cap(int relevance_cap) { 38 void set_relevance_cap(int relevance_cap) {
39 relevance_cap_ = relevance_cap; 39 relevance_cap_ = relevance_cap;
40 } 40 }
41 41
42 int half_life_days() const { return half_life_days_; } 42 int half_life_days() const { return half_life_days_; }
43 void set_half_life_days(int half_life_days) { 43 void set_half_life_days(int half_life_days) {
44 half_life_days_ = half_life_days; 44 half_life_days_ = half_life_days;
45 } 45 }
46 46
47 bool use_decay_factor() const { return use_decay_factor_; }
48 void set_use_decay_factor(bool use_decay_factor) {
49 use_decay_factor_ = use_decay_factor;
50 }
51
47 std::vector<CountMaxRelevance>& buckets() { return buckets_; } 52 std::vector<CountMaxRelevance>& buckets() { return buckets_; }
48 const std::vector<CountMaxRelevance>& buckets() const { return buckets_; } 53 const std::vector<CountMaxRelevance>& buckets() const { return buckets_; }
49 54
50 private: 55 private:
51 // History matches with relevance score greater or equal to |relevance_cap_| 56 // History matches with relevance score greater or equal to |relevance_cap_|
52 // are not affected by this experiment. 57 // are not affected by this experiment.
53 // Set to -1, if there is no relevance cap in place and all matches are 58 // Set to -1, if there is no relevance cap in place and all matches are
54 // subject to demotion. 59 // subject to demotion.
55 int relevance_cap_; 60 int relevance_cap_;
56 61
57 // Half life time for a decayed count as measured since the last visit. 62 // Half life time for a decayed count as measured since the last visit.
58 // Set to -1 if not used. 63 // Set to -1 if not used.
59 int half_life_days_; 64 int half_life_days_;
60 65
61 // The relevance score caps for given decayed count values. 66 // The relevance score caps for given decayed count values.
62 // Each pair (decayed_count, max_score) indicates what the maximum relevance 67 // Each pair (decayed_count, max_score) indicates what the maximum relevance
63 // score is of a decayed count equal or greater than decayed_count. 68 // score is of a decayed count equal or greater than decayed_count.
64 // 69 //
65 // Consider this example: 70 // Consider this example:
66 // [(1, 1000), (0.5, 500), (0, 100)] 71 // [(1, 1000), (0.5, 500), (0, 100)]
67 // If decayed count is 2 (which is >= 1), the corresponding match's maximum 72 // If decayed count is 2 (which is >= 1), the corresponding match's maximum
68 // relevance will be capped at 1000. In case of 0.5, the score is capped 73 // relevance will be capped at 1000. In case of 0.5, the score is capped
69 // at 500. Anything below 0.5 is capped at 100. 74 // at 500. Anything below 0.5 is capped at 100.
70 // 75 //
71 // This list is sorted by the pair's first element in descending order. 76 // This list is sorted by the pair's first element in descending order.
72 std::vector<CountMaxRelevance> buckets_; 77 std::vector<CountMaxRelevance> buckets_;
78
79 // Specify decay factor in buckets rather than actual score.
80 bool use_decay_factor_;
73 }; 81 };
74 82
75 HUPScoringParams() : experimental_scoring_enabled(false) {} 83 HUPScoringParams() : experimental_scoring_enabled(false) {}
76 84
77 bool experimental_scoring_enabled; 85 bool experimental_scoring_enabled;
78 86
79 ScoreBuckets typed_count_buckets; 87 ScoreBuckets typed_count_buckets;
80 88
81 // Used only when the typed count is 0. 89 // Used only when the typed count is 0.
82 ScoreBuckets visited_count_buckets; 90 ScoreBuckets visited_count_buckets;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 current_page_classification, 211 current_page_classification,
204 DemotionMultipliers* demotions_by_type); 212 DemotionMultipliers* demotions_by_type);
205 213
206 // --------------------------------------------------------- 214 // ---------------------------------------------------------
207 // For the HistoryURL provider new scoring experiment that is part of the 215 // For the HistoryURL provider new scoring experiment that is part of the
208 // bundled omnibox field trial. 216 // bundled omnibox field trial.
209 217
210 // Initializes the HUP |scoring_params| based on the active HUP scoring 218 // Initializes the HUP |scoring_params| based on the active HUP scoring
211 // experiment. If there is no such experiment, this function simply sets 219 // experiment. If there is no such experiment, this function simply sets
212 // |scoring_params|->experimental_scoring_enabled to false. 220 // |scoring_params|->experimental_scoring_enabled to false.
221 static void GetDefaultHUPScoringParams(HUPScoringParams* scoring_params);
213 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params); 222 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params);
214 223
215 // For the HQPBookmarkValue experiment that's part of the 224 // For the HQPBookmarkValue experiment that's part of the
216 // bundled omnibox field trial. 225 // bundled omnibox field trial.
217 226
218 // Returns the value an untyped visit to a bookmark should receive. 227 // Returns the value an untyped visit to a bookmark should receive.
219 // Compare this value with the default of 1 for non-bookmarked untyped 228 // Compare this value with the default of 1 for non-bookmarked untyped
220 // visits to pages and the default of 20 for typed visits. Returns 229 // visits to pages and the default of 20 for typed visits. Returns
221 // 10 if the bookmark value experiment isn't active. 230 // 10 if the bookmark value experiment isn't active.
222 static int HQPBookmarkValue(); 231 static int HQPBookmarkValue();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 static const char kHQPFixFrequencyScoringBugsRule[]; 340 static const char kHQPFixFrequencyScoringBugsRule[];
332 static const char kHQPNumTitleWordsRule[]; 341 static const char kHQPNumTitleWordsRule[];
333 static const char kHQPAlsoDoHUPLikeScoringRule[]; 342 static const char kHQPAlsoDoHUPLikeScoringRule[];
334 static const char kPreventUWYTDefaultForNonURLInputsRule[]; 343 static const char kPreventUWYTDefaultForNonURLInputsRule[];
335 344
336 // Parameter names used by the HUP new scoring experiments. 345 // Parameter names used by the HUP new scoring experiments.
337 static const char kHUPNewScoringEnabledParam[]; 346 static const char kHUPNewScoringEnabledParam[];
338 static const char kHUPNewScoringTypedCountRelevanceCapParam[]; 347 static const char kHUPNewScoringTypedCountRelevanceCapParam[];
339 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[]; 348 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[];
340 static const char kHUPNewScoringTypedCountScoreBucketsParam[]; 349 static const char kHUPNewScoringTypedCountScoreBucketsParam[];
350 static const char kHUPNewScoringTypedCountUseDecayFactorParam[];
341 static const char kHUPNewScoringVisitedCountRelevanceCapParam[]; 351 static const char kHUPNewScoringVisitedCountRelevanceCapParam[];
342 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[]; 352 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[];
343 static const char kHUPNewScoringVisitedCountScoreBucketsParam[]; 353 static const char kHUPNewScoringVisitedCountScoreBucketsParam[];
354 static const char kHUPNewScoringVisitedCountUseDecayFactorParam[];
344 355
345 // Parameter names used by the HQP experimental scoring experiments. 356 // Parameter names used by the HQP experimental scoring experiments.
346 static const char kHQPExperimentalScoringEnabledParam[]; 357 static const char kHQPExperimentalScoringEnabledParam[];
347 static const char kHQPExperimentalScoringBucketsParam[]; 358 static const char kHQPExperimentalScoringBucketsParam[];
348 static const char kHQPExperimentalScoringTopicalityThresholdParam[]; 359 static const char kHQPExperimentalScoringTopicalityThresholdParam[];
349 360
350 // The amount of time to wait before sending a new suggest request after the 361 // The amount of time to wait before sending a new suggest request after the
351 // previous one unless overridden by a field trial parameter. 362 // previous one unless overridden by a field trial parameter.
352 // Non-const because some unittests modify this value. 363 // Non-const because some unittests modify this value.
353 static int kDefaultMinimumTimeBetweenSuggestQueriesMs; 364 static int kDefaultMinimumTimeBetweenSuggestQueriesMs;
(...skipping 17 matching lines...) Expand all
371 // prioritize different wildcard contexts, see the implementation. How to 382 // prioritize different wildcard contexts, see the implementation. How to
372 // interpret the value is left to the caller; this is rule-dependent. 383 // interpret the value is left to the caller; this is rule-dependent.
373 static std::string GetValueForRuleInContext( 384 static std::string GetValueForRuleInContext(
374 const std::string& rule, 385 const std::string& rule,
375 metrics::OmniboxEventProto::PageClassification page_classification); 386 metrics::OmniboxEventProto::PageClassification page_classification);
376 387
377 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); 388 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial);
378 }; 389 };
379 390
380 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ 391 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698