OLD | NEW |
---|---|
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> |
(...skipping 26 matching lines...) Expand all Loading... | |
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_ = false; | |
Bart N.
2015/08/26 23:01:25
= false will most likely not compile on some platf
Ashok vardhan
2015/08/27 00:30:46
Done.
| |
73 }; | 81 }; |
74 | 82 |
75 HUPScoringParams() : experimental_scoring_enabled(false) {} | 83 HUPScoringParams() : experimental_scoring_enabled(false), |
84 default_scoring_enabled(false) {} | |
76 | 85 |
77 bool experimental_scoring_enabled; | 86 bool experimental_scoring_enabled; |
87 bool default_scoring_enabled; | |
78 | 88 |
79 ScoreBuckets typed_count_buckets; | 89 ScoreBuckets typed_count_buckets; |
80 | 90 |
81 // Used only when the typed count is 0. | 91 // Used only when the typed count is 0. |
82 ScoreBuckets visited_count_buckets; | 92 ScoreBuckets visited_count_buckets; |
83 }; | 93 }; |
84 | 94 |
85 // This class manages the Omnibox field trials. | 95 // This class manages the Omnibox field trials. |
86 class OmniboxFieldTrial { | 96 class OmniboxFieldTrial { |
87 public: | 97 public: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 current_page_classification, | 213 current_page_classification, |
204 DemotionMultipliers* demotions_by_type); | 214 DemotionMultipliers* demotions_by_type); |
205 | 215 |
206 // --------------------------------------------------------- | 216 // --------------------------------------------------------- |
207 // For the HistoryURL provider new scoring experiment that is part of the | 217 // For the HistoryURL provider new scoring experiment that is part of the |
208 // bundled omnibox field trial. | 218 // bundled omnibox field trial. |
209 | 219 |
210 // Initializes the HUP |scoring_params| based on the active HUP scoring | 220 // Initializes the HUP |scoring_params| based on the active HUP scoring |
211 // experiment. If there is no such experiment, this function simply sets | 221 // experiment. If there is no such experiment, this function simply sets |
212 // |scoring_params|->experimental_scoring_enabled to false. | 222 // |scoring_params|->experimental_scoring_enabled to false. |
223 static void GetDefaultHUPScoringParams(HUPScoringParams* scoring_params); | |
213 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params); | 224 static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params); |
214 | 225 |
215 // For the HQPBookmarkValue experiment that's part of the | 226 // For the HQPBookmarkValue experiment that's part of the |
216 // bundled omnibox field trial. | 227 // bundled omnibox field trial. |
217 | 228 |
218 // Returns the value an untyped visit to a bookmark should receive. | 229 // Returns the value an untyped visit to a bookmark should receive. |
219 // Compare this value with the default of 1 for non-bookmarked untyped | 230 // 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 | 231 // visits to pages and the default of 20 for typed visits. Returns |
221 // 10 if the bookmark value experiment isn't active. | 232 // 10 if the bookmark value experiment isn't active. |
222 static int HQPBookmarkValue(); | 233 static int HQPBookmarkValue(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 static const char kHQPFixFrequencyScoringBugsRule[]; | 342 static const char kHQPFixFrequencyScoringBugsRule[]; |
332 static const char kHQPNumTitleWordsRule[]; | 343 static const char kHQPNumTitleWordsRule[]; |
333 static const char kHQPAlsoDoHUPLikeScoringRule[]; | 344 static const char kHQPAlsoDoHUPLikeScoringRule[]; |
334 static const char kPreventUWYTDefaultForNonURLInputsRule[]; | 345 static const char kPreventUWYTDefaultForNonURLInputsRule[]; |
335 | 346 |
336 // Parameter names used by the HUP new scoring experiments. | 347 // Parameter names used by the HUP new scoring experiments. |
337 static const char kHUPNewScoringEnabledParam[]; | 348 static const char kHUPNewScoringEnabledParam[]; |
338 static const char kHUPNewScoringTypedCountRelevanceCapParam[]; | 349 static const char kHUPNewScoringTypedCountRelevanceCapParam[]; |
339 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[]; | 350 static const char kHUPNewScoringTypedCountHalfLifeTimeParam[]; |
340 static const char kHUPNewScoringTypedCountScoreBucketsParam[]; | 351 static const char kHUPNewScoringTypedCountScoreBucketsParam[]; |
352 static const char kHUPNewScoringTypedCountUseDecayFactorParam[]; | |
341 static const char kHUPNewScoringVisitedCountRelevanceCapParam[]; | 353 static const char kHUPNewScoringVisitedCountRelevanceCapParam[]; |
342 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[]; | 354 static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[]; |
343 static const char kHUPNewScoringVisitedCountScoreBucketsParam[]; | 355 static const char kHUPNewScoringVisitedCountScoreBucketsParam[]; |
356 static const char kHUPNewScoringVisitedCountUseDecayFactorParam[]; | |
344 | 357 |
345 // Parameter names used by the HQP experimental scoring experiments. | 358 // Parameter names used by the HQP experimental scoring experiments. |
346 static const char kHQPExperimentalScoringEnabledParam[]; | 359 static const char kHQPExperimentalScoringEnabledParam[]; |
347 static const char kHQPExperimentalScoringBucketsParam[]; | 360 static const char kHQPExperimentalScoringBucketsParam[]; |
348 static const char kHQPExperimentalScoringTopicalityThresholdParam[]; | 361 static const char kHQPExperimentalScoringTopicalityThresholdParam[]; |
349 | 362 |
350 // The amount of time to wait before sending a new suggest request after the | 363 // The amount of time to wait before sending a new suggest request after the |
351 // previous one unless overridden by a field trial parameter. | 364 // previous one unless overridden by a field trial parameter. |
352 // Non-const because some unittests modify this value. | 365 // Non-const because some unittests modify this value. |
353 static int kDefaultMinimumTimeBetweenSuggestQueriesMs; | 366 static int kDefaultMinimumTimeBetweenSuggestQueriesMs; |
(...skipping 17 matching lines...) Expand all Loading... | |
371 // prioritize different wildcard contexts, see the implementation. How to | 384 // prioritize different wildcard contexts, see the implementation. How to |
372 // interpret the value is left to the caller; this is rule-dependent. | 385 // interpret the value is left to the caller; this is rule-dependent. |
373 static std::string GetValueForRuleInContext( | 386 static std::string GetValueForRuleInContext( |
374 const std::string& rule, | 387 const std::string& rule, |
375 metrics::OmniboxEventProto::PageClassification page_classification); | 388 metrics::OmniboxEventProto::PageClassification page_classification); |
376 | 389 |
377 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); | 390 DISALLOW_IMPLICIT_CONSTRUCTORS(OmniboxFieldTrial); |
378 }; | 391 }; |
379 | 392 |
380 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ | 393 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_FIELD_TRIAL_H_ |
OLD | NEW |