diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2018-09-05 12:58:17 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-09-05 13:13:50 +0300 |
commit | 3c31b8bcf3bc5f8b963516bc93137837972bd5eb (patch) | |
tree | db32bf4b45dbb24e4bed00d03dfd033c85a0fac4 /search | |
parent | b354bb8415da4cb0c67a810727cd279e32153ca2 (diff) |
[search] Add sanity checks, update ranking info coeffs.
Diffstat (limited to 'search')
-rw-r--r-- | search/ranking_info.cpp | 46 | ||||
-rwxr-xr-x | search/search_quality/scoring_model.py | 4 |
2 files changed, 28 insertions, 22 deletions
diff --git a/search/ranking_info.cpp b/search/ranking_info.cpp index 590a9aaf9d..7665a60b6d 100644 --- a/search/ranking_info.cpp +++ b/search/ranking_info.cpp @@ -12,30 +12,36 @@ namespace { // See search/search_quality/scoring_model.py for details. In short, // these coeffs correspond to coeffs in a linear model. -double const kDistanceToPivot = -1.0000000; -double const kRank = 1.0000000; +double constexpr kDistanceToPivot = -1.0000000; +double constexpr kRank = 1.0000000; // todo: (@t.yan) Adjust. -double const kPopularity = 0.0500000; -double const kFalseCats = -0.0839847; -double const kErrorsMade = 0.0066984; -double const kAllTokensUsed = 0.0000000; -double const kNameScore[NameScore::NAME_SCORE_COUNT] = { - -0.4027035 /* Zero */, - 0.1063430 /* Substring */, - 0.0661467 /* Prefix */, - 0.2302138 /* Full Match */ +double constexpr kPopularity = 0.0500000; +double constexpr kFalseCats = -0.3691859; +double constexpr kErrorsMade = -0.0579812; +double constexpr kAllTokensUsed = 0.0000000; +double constexpr kNameScore[NameScore::NAME_SCORE_COUNT] = { + -0.7245815 /* Zero */, + 0.1853727 /* Substring */, + 0.2046046 /* Prefix */, + 0.3346041 /* Full Match */ }; -double const kType[Model::TYPE_COUNT] = { - -0.3210718 /* POI */, - -0.3210718 /* Building */, - -0.2660116 /* Street */, - -0.3135561 /* Unclassified */, - -0.3071279 /* Village */, - 0.1013253 /* City */, - 0.3336005 /* State */, - 0.7728417 /* Country */ +double constexpr kType[Model::TYPE_COUNT] = { + -0.4458349 /* POI */, + -0.4458349 /* Building */, + -0.3001181 /* Street */, + -0.3299295 /* Unclassified */, + -0.3530548 /* Village */, + 0.4506418 /* City */, + 0.2889073 /* State */, + 0.6893882 /* Country */ }; +// Coeffs sanity checks. +static_assert(kDistanceToPivot <= 0, ""); +static_assert(kRank >= 0, ""); +static_assert(kPopularity >= 0, ""); +static_assert(kErrorsMade <= 0, ""); + double TransformDistance(double distance) { return min(distance, RankingInfo::kMaxDistMeters) / RankingInfo::kMaxDistMeters; diff --git a/search/search_quality/scoring_model.py b/search/search_quality/scoring_model.py index 9ccc36bf4e..bb1e49ab35 100755 --- a/search/search_quality/scoring_model.py +++ b/search/search_quality/scoring_model.py @@ -201,11 +201,11 @@ def raw_output(features, ws): def print_const(name, value): - print('double const k{} = {:.7f};'.format(name, value)) + print('double constexpr k{} = {:.7f};'.format(name, value)) def print_array(name, size, values): - print('double const {}[{}] = {{'.format(name, size)) + print('double constexpr {}[{}] = {{'.format(name, size)) print(',\n'.join(' {:.7f} /* {} */'.format(w, f) for (f, w) in values)) print('};') |