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

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: 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 based on the decay factor or counts specified
26 // in the corresponding bucket list. See comment on |buckets_| for details.
26 class ScoreBuckets { 27 class ScoreBuckets {
27 public: 28 public:
28 // (decayed_count, max_relevance) pair. 29 // Stores the max relevance at each count/decay factor threshold.
29 typedef std::pair<double, int> CountMaxRelevance; 30 typedef std::pair<double, int> CountMaxRelevance;
30 31
31 ScoreBuckets(); 32 ScoreBuckets();
32 ~ScoreBuckets(); 33 ~ScoreBuckets();
33 34
34 // Computes a half-life time decay given the |elapsed_time|. 35 // Computes a half-life time decay given the |elapsed_time|.
35 double HalfLifeTimeDecay(const base::TimeDelta& elapsed_time) const; 36 double HalfLifeTimeDecay(const base::TimeDelta& elapsed_time) const;
36 37
37 int relevance_cap() const { return relevance_cap_; } 38 int relevance_cap() const { return relevance_cap_; }
38 void set_relevance_cap(int relevance_cap) { 39 void set_relevance_cap(int relevance_cap) {
39 relevance_cap_ = relevance_cap; 40 relevance_cap_ = relevance_cap;
40 } 41 }
41 42
42 int half_life_days() const { return half_life_days_; } 43 int half_life_days() const { return half_life_days_; }
43 void set_half_life_days(int half_life_days) { 44 void set_half_life_days(int half_life_days) {
44 half_life_days_ = half_life_days; 45 half_life_days_ = half_life_days;
45 } 46 }
46 47
48 bool use_decay_factor() const { return use_decay_factor_; }
49 void set_use_decay_factor(bool use_decay_factor) {
50 use_decay_factor_ = use_decay_factor;
51 }
52
47 std::vector<CountMaxRelevance>& buckets() { return buckets_; } 53 std::vector<CountMaxRelevance>& buckets() { return buckets_; }
48 const std::vector<CountMaxRelevance>& buckets() const { return buckets_; } 54 const std::vector<CountMaxRelevance>& buckets() const { return buckets_; }
49 55
50 private: 56 private:
51 // History matches with relevance score greater or equal to |relevance_cap_| 57 // History matches with relevance score greater or equal to |relevance_cap_|
52 // are not affected by this experiment. 58 // are not affected by this experiment.
53 // Set to -1, if there is no relevance cap in place and all matches are 59 // Set to -1, if there is no relevance cap in place and all matches are
54 // subject to demotion. 60 // subject to demotion.
55 int relevance_cap_; 61 int relevance_cap_;
56 62
57 // Half life time for a decayed count as measured since the last visit. 63 // Half life time for a decayed count as measured since the last visit.
58 // Set to -1 if not used. 64 // Set to -1 if not used.
59 int half_life_days_; 65 int half_life_days_;
60 66
61 // The relevance score caps for given decayed count values. 67 // The relevance score caps at successively decreasing threshold values.
62 // Each pair (decayed_count, max_score) indicates what the maximum relevance 68 // The thresholds are either decayed counts or decay factors, depending on
63 // score is of a decayed count equal or greater than decayed_count. 69 // the value of |use_decay_factor_|.
64 // 70 //
65 // Consider this example: 71 // Consider this example specifying the decayed counts:
66 // [(1, 1000), (0.5, 500), (0, 100)] 72 // [(1, 1000), (0.5, 500), (0, 100)]
67 // If decayed count is 2 (which is >= 1), the corresponding match's maximum 73 // 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 74 // 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. 75 // at 500. Anything below 0.5 is capped at 100.
70 // 76 //
71 // This list is sorted by the pair's first element in descending order. 77 // This list is sorted by the pair's first element in descending order.
72 std::vector<CountMaxRelevance> buckets_; 78 std::vector<CountMaxRelevance> buckets_;
79
80 // True when the bucket thresholds are decay factors rather than counts.
81 bool use_decay_factor_;
73 }; 82 };
74 83
75 HUPScoringParams() : experimental_scoring_enabled(false) {} 84 HUPScoringParams() : experimental_scoring_enabled(false) {}
76 85
77 bool experimental_scoring_enabled; 86 bool experimental_scoring_enabled;
78 87
79 ScoreBuckets typed_count_buckets; 88 ScoreBuckets typed_count_buckets;
80 89
81 // Used only when the typed count is 0. 90 // Used only when the typed count is 0.
82 ScoreBuckets visited_count_buckets; 91 ScoreBuckets visited_count_buckets;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 current_page_classification, 212 current_page_classification,
204 DemotionMultipliers* demotions_by_type); 213 DemotionMultipliers* demotions_by_type);
205 214
206 // --------------------------------------------------------- 215 // ---------------------------------------------------------
207 // For the HistoryURL provider new scoring experiment that is part of the 216 // For the HistoryURL provider new scoring experiment that is part of the
208 // bundled omnibox field trial. 217 // bundled omnibox field trial.
209 218
210 // Initializes the HUP |scoring_params| based on the active HUP scoring 219 // Initializes the HUP |scoring_params| based on the active HUP scoring
211 // experiment. If there is no such experiment, this function simply sets 220 // experiment. If there is no such experiment, this function simply sets
212 // |scoring_params|->experimental_scoring_enabled to false. 221 // |scoring_params|->experimental_scoring_enabled to false.
222 static void GetDefaultHUPScoringParams(HUPScoringParams* scoring_params);
213 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params); 223 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params);
214 224
215 // For the HQPBookmarkValue experiment that's part of the 225 // For the HQPBookmarkValue experiment that's part of the
216 // bundled omnibox field trial. 226 // bundled omnibox field trial.
217 227
218 // Returns the value an untyped visit to a bookmark should receive. 228 // Returns the value an untyped visit to a bookmark should receive.
219 // Compare this value with the default of 1 for non-bookmarked untyped 229 // 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 230 // visits to pages and the default of 20 for typed visits. Returns
221 // 10 if the bookmark value experiment isn't active. 231 // 10 if the bookmark value experiment isn't active.
222 static int HQPBookmarkValue(); 232 static int HQPBookmarkValue();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 static const char kHQPFixFrequencyScoringBugsRule[]; 341 static const char kHQPFixFrequencyScoringBugsRule[];
332 static const char kHQPNumTitleWordsRule[]; 342 static const char kHQPNumTitleWordsRule[];
333 static const char kHQPAlsoDoHUPLikeScoringRule[]; 343 static const char kHQPAlsoDoHUPLikeScoringRule[];
334 static const char kPreventUWYTDefaultForNonURLInputsRule[]; 344 static const char kPreventUWYTDefaultForNonURLInputsRule[];
335 345
336 // Parameter names used by the HUP new scoring experiments. 346 // Parameter names used by the HUP new scoring experiments.
337 static const char kHUPNewScoringEnabledParam[]; 347 static const char kHUPNewScoringEnabledParam[];
338 static const char kHUPNewScoringTypedCountRelevanceCapParam[]; 348 static const char kHUPNewScoringTypedCountRelevanceCapParam[];
339 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[]; 349 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[];
340 static const char kHUPNewScoringTypedCountScoreBucketsParam[]; 350 static const char kHUPNewScoringTypedCountScoreBucketsParam[];
351 static const char kHUPNewScoringTypedCountUseDecayFactorParam[];
341 static const char kHUPNewScoringVisitedCountRelevanceCapParam[]; 352 static const char kHUPNewScoringVisitedCountRelevanceCapParam[];
342 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[]; 353 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[];
343 static const char kHUPNewScoringVisitedCountScoreBucketsParam[]; 354 static const char kHUPNewScoringVisitedCountScoreBucketsParam[];
355 static const char kHUPNewScoringVisitedCountUseDecayFactorParam[];
344 356
345 // Parameter names used by the HQP experimental scoring experiments. 357 // Parameter names used by the HQP experimental scoring experiments.
346 static const char kHQPExperimentalScoringEnabledParam[]; 358 static const char kHQPExperimentalScoringEnabledParam[];
347 static const char kHQPExperimentalScoringBucketsParam[]; 359 static const char kHQPExperimentalScoringBucketsParam[];
348 static const char kHQPExperimentalScoringTopicalityThresholdParam[]; 360 static const char kHQPExperimentalScoringTopicalityThresholdParam[];
349 361
350 // The amount of time to wait before sending a new suggest request after the 362 // The amount of time to wait before sending a new suggest request after the
351 // previous one unless overridden by a field trial parameter. 363 // previous one unless overridden by a field trial parameter.
352 // Non-const because some unittests modify this value. 364 // Non-const because some unittests modify this value.
353 static int kDefaultMinimumTimeBetweenSuggestQueriesMs; 365 static int kDefaultMinimumTimeBetweenSuggestQueriesMs;
(...skipping 17 matching lines...) Expand all
371 // prioritize different wildcard contexts, see the implementation. How to 383 // prioritize different wildcard contexts, see the implementation. How to
372 // interpret the value is left to the caller; this is rule-dependent. 384 // interpret the value is left to the caller; this is rule-dependent.
373 static std::string GetValueForRuleInContext( 385 static std::string GetValueForRuleInContext(
374 const std::string& rule, 386 const std::string& rule,
375 metrics::OmniboxEventProto::PageClassification page_classification); 387 metrics::OmniboxEventProto::PageClassification page_classification);
376 388
377 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); 389 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial);
378 }; 390 };
379 391
380 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ 392 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_
OLDNEW
« no previous file with comments | « components/omnibox/browser/history_url_provider.cc ('k') | components/omnibox/browser/omnibox_field_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698