Commit 69656abe authored by Philippe Hamel's avatar Philippe Hamel Committed by Commit Bot

Rename TranslateRanker logistic regression.

This will allow to disambiguate between the translate-specific logistic regression model, and the generic model.

Bug: 759161
Change-Id: I2353e2d7dd97447ef8aad6a705d50a70502a8dcf
Reviewed-on: https://chromium-review.googlesource.com/724175Reviewed-by: default avatarRachel Blum <groby@chromium.org>
Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Commit-Queue: Philippe Hamel <hamelphi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513311}
parent 416c98ec
...@@ -17,7 +17,7 @@ message TranslateRankerModel { ...@@ -17,7 +17,7 @@ message TranslateRankerModel {
optional uint32 version = 1; optional uint32 version = 1;
// Defines the weights and bias of a Logistic Regression Model. // Defines the weights and bias of a Logistic Regression Model.
message LogisticRegressionModel { message TranslateLogisticRegressionModel {
// Decision threshold. If not defined, use 0.5. // Decision threshold. If not defined, use 0.5.
optional float threshold = 12; optional float threshold = 12;
...@@ -41,6 +41,6 @@ message TranslateRankerModel { ...@@ -41,6 +41,6 @@ message TranslateRankerModel {
} }
oneof model_revision { oneof model_revision {
LogisticRegressionModel logistic_regression_model = 2; TranslateLogisticRegressionModel translate_logistic_regression_model = 2;
} }
} }
...@@ -226,7 +226,7 @@ void RankerModelLoaderTest::InitModel(const GURL& model_url, ...@@ -226,7 +226,7 @@ void RankerModelLoaderTest::InitModel(const GURL& model_url,
auto* translate = model->mutable_proto()->mutable_translate(); auto* translate = model->mutable_proto()->mutable_translate();
translate->set_version(1); translate->set_version(1);
auto* logit = translate->mutable_logistic_regression_model(); auto* logit = translate->mutable_translate_logistic_regression_model();
logit->set_bias(0.1f); logit->set_bias(0.1f);
logit->set_accept_ratio_weight(0.2f); logit->set_accept_ratio_weight(0.2f);
logit->set_decline_ratio_weight(0.3f); logit->set_decline_ratio_weight(0.3f);
......
...@@ -36,7 +36,7 @@ std::unique_ptr<RankerModel> NewModel(const std::string& model_url, ...@@ -36,7 +36,7 @@ std::unique_ptr<RankerModel> NewModel(const std::string& model_url,
auto* translate = model->mutable_proto()->mutable_translate(); auto* translate = model->mutable_proto()->mutable_translate();
translate->set_version(1); translate->set_version(1);
auto* logit = translate->mutable_logistic_regression_model(); auto* logit = translate->mutable_translate_logistic_regression_model();
logit->set_bias(0.1f); logit->set_bias(0.1f);
logit->set_accept_ratio_weight(0.2f); logit->set_accept_ratio_weight(0.2f);
logit->set_decline_ratio_weight(0.3f); logit->set_decline_ratio_weight(0.3f);
......
...@@ -65,7 +65,7 @@ RankerModelStatus ValidateModel(const RankerModel& model) { ...@@ -65,7 +65,7 @@ RankerModelStatus ValidateModel(const RankerModel& model) {
return RankerModelStatus::VALIDATION_FAILED; return RankerModelStatus::VALIDATION_FAILED;
if (model.proto().translate().model_revision_case() != if (model.proto().translate().model_revision_case() !=
TranslateRankerModel::kLogisticRegressionModel) { TranslateRankerModel::kTranslateLogisticRegressionModel) {
return RankerModelStatus::INCOMPATIBLE; return RankerModelStatus::INCOMPATIBLE;
} }
...@@ -276,8 +276,8 @@ bool TranslateRankerImpl::GetModelDecision( ...@@ -276,8 +276,8 @@ bool TranslateRankerImpl::GetModelDecision(
// logic here. // logic here.
const TranslateRankerFeatures features(translate_event); const TranslateRankerFeatures features(translate_event);
const TranslateRankerModel::LogisticRegressionModel& lr_model = const TranslateRankerModel::TranslateLogisticRegressionModel& lr_model =
model_->proto().translate().logistic_regression_model(); model_->proto().translate().translate_logistic_regression_model();
double dot_product = double dot_product =
(features.accepted_count * lr_model.accept_count_weight()) + (features.accepted_count * lr_model.accept_count_weight()) +
......
...@@ -99,7 +99,7 @@ std::unique_ptr<TranslateRankerImpl> TranslateRankerImplTest::GetRankerForTest( ...@@ -99,7 +99,7 @@ std::unique_ptr<TranslateRankerImpl> TranslateRankerImplTest::GetRankerForTest(
model->mutable_proto()->mutable_translate()->set_version(kModelVersion); model->mutable_proto()->mutable_translate()->set_version(kModelVersion);
auto* details = model->mutable_proto() auto* details = model->mutable_proto()
->mutable_translate() ->mutable_translate()
->mutable_logistic_regression_model(); ->mutable_translate_logistic_regression_model();
if (threshold > 0.0) { if (threshold > 0.0) {
details->set_threshold(threshold); details->set_threshold(threshold);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment