summaryrefslogtreecommitdiffstats
path: root/chrome/browser/omnibox/omnibox_field_trial.h
diff options
context:
space:
mode:
authorbartn@chromium.org <bartn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-26 22:41:34 +0000
committerbartn@chromium.org <bartn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-26 22:41:34 +0000
commitff34ad59ce2dd38e33ff85ed64a3b14f4a324a31 (patch)
treeacac6c2f65694afdb23ebabbedf0484626aa5efa /chrome/browser/omnibox/omnibox_field_trial.h
parentead51fead0f5832bf8167499ba9c58b20e49d992 (diff)
downloadchromium_src-ff34ad59ce2dd38e33ff85ed64a3b14f4a324a31.zip
chromium_src-ff34ad59ce2dd38e33ff85ed64a3b14f4a324a31.tar.gz
chromium_src-ff34ad59ce2dd38e33ff85ed64a3b14f4a324a31.tar.bz2
HUP Experimental Scoring framework.
High level summary: (a) Introduce a new set of Finch variation params and use it in the Omnibox bundled experiment (b) Group together HUP scoring params in a HUPScoringParams struct and initialize it based on the new experiment params (c) Modify HUP scoring by applying optional demotion This change is fairly safe because of the following reasons: (1) It is disabled by default (2) It never changes the relative order of HUP matches (3) It can only demote a HUP match (4) It is fairly isolated and unobtrusive BUG=295756 TESTS=OmniboxFieldTrialTest,HistoryURLProviderTest Review URL: https://codereview.chromium.org/23707058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242569 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/omnibox/omnibox_field_trial.h')
-rw-r--r--chrome/browser/omnibox/omnibox_field_trial.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/chrome/browser/omnibox/omnibox_field_trial.h b/chrome/browser/omnibox/omnibox_field_trial.h
index 9e9ee55..a75eccc 100644
--- a/chrome/browser/omnibox/omnibox_field_trial.h
+++ b/chrome/browser/omnibox/omnibox_field_trial.h
@@ -15,6 +15,74 @@
#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/common/autocomplete_match_type.h"
+namespace base {
+class TimeDelta;
+}
+
+// The set of parameters customizing the HUP scoring.
+struct HUPScoringParams {
+ // A set of parameters describing how to cap a given count score. First,
+ // we apply a half-life based decay of the given count and then find the
+ // maximum relevance score in the corresponding bucket list.
+ class ScoreBuckets {
+ public:
+ // (decayed_count, max_relevance) pair.
+ typedef std::pair<double, int> CountMaxRelevance;
+
+ ScoreBuckets();
+ ~ScoreBuckets();
+
+ // Computes a half-life time decay given the |elapsed_time|.
+ double HalfLifeTimeDecay(const base::TimeDelta& elapsed_time) const;
+
+ int relevance_cap() const { return relevance_cap_; }
+ void set_relevance_cap(int relevance_cap) {
+ relevance_cap_ = relevance_cap;
+ }
+
+ int half_life_days() const { return half_life_days_; }
+ void set_half_life_days(int half_life_days) {
+ half_life_days_ = half_life_days;
+ }
+
+ std::vector<CountMaxRelevance>& buckets() { return buckets_; }
+ const std::vector<CountMaxRelevance>& buckets() const { return buckets_; }
+
+ private:
+ // History matches with relevance score greater or equal to |relevance_cap_|
+ // are not affected by this experiment.
+ // Set to -1, if there is no relevance cap in place and all matches are
+ // subject to demotion.
+ int relevance_cap_;
+
+ // Half life time for a decayed count as measured since the last visit.
+ // Set to -1 if not used.
+ int half_life_days_;
+
+ // The relevance score caps for given decayed count values.
+ // Each pair (decayed_count, max_score) indicates what the maximum relevance
+ // score is of a decayed count equal or greater than decayed_count.
+ //
+ // Consider this example:
+ // [(1, 1000), (0.5, 500), (0, 100)]
+ // If decayed count is 2 (which is >= 1), the corresponding match's maximum
+ // relevance will be capped at 1000. In case of 0.5, the score is capped
+ // at 500. Anything below 0.5 is capped at 100.
+ //
+ // This list is sorted by the pair's first element in descending order.
+ std::vector<CountMaxRelevance> buckets_;
+ };
+
+ HUPScoringParams() : experimental_scoring_enabled(false) {}
+
+ bool experimental_scoring_enabled;
+
+ ScoreBuckets typed_count_buckets;
+
+ // Used only when the typed count is 0.
+ ScoreBuckets visited_count_buckets;
+};
+
// This class manages the Omnibox field trials.
class OmniboxFieldTrial {
public:
@@ -175,6 +243,14 @@ class OmniboxFieldTrial {
AutocompleteInput::PageClassification current_page_classification);
// ---------------------------------------------------------
+ // For the HistoryURL provider new scoring experiment that is part of the
+ // bundled omnibox field trial.
+
+ // Initializes the HUP |scoring_params| based on the active HUP scoring
+ // experiment. If there is no such experiment, this function simply sets
+ // |scoring_params|->experimental_scoring_enabled to false.
+ static void GetExperimentalHUPScoringParams(HUPScoringParams* scoring_params);
+
// For the HQPBookmarkValue experiment that's part of the
// bundled omnibox field trial.
@@ -228,6 +304,15 @@ class OmniboxFieldTrial {
// Rule values.
static const char kReorderForLegalDefaultMatchRuleEnabled[];
+ // Parameter names used by the HUP new scoring experiments.
+ static const char kHUPNewScoringEnabledParam[];
+ static const char kHUPNewScoringTypedCountRelevanceCapParam[];
+ static const char kHUPNewScoringTypedCountHalfLifeTimeParam[];
+ static const char kHUPNewScoringTypedCountScoreBucketsParam[];
+ static const char kHUPNewScoringVisitedCountRelevanceCapParam[];
+ static const char kHUPNewScoringVisitedCountHalfLifeTimeParam[];
+ static const char kHUPNewScoringVisitedCountScoreBucketsParam[];
+
private:
friend class OmniboxFieldTrialTest;