Reset model_shrink_rate to zero when baseline is present.
@@ -201,23 +201,24 @@ static void UpdateAndValidateMonotoneConstraints(
}
}
-static void WarnIfBaselineUsedWithModelShrinkage(
+static void DropModelShrinkageIfBaselineUsed(
const NCB::TDataMetaInfo& trainDataMetaInfo,
bool learningContinuation,
- const NCatboostOptions::TCatBoostOptions* catBoostOptions
+ NCatboostOptions::TCatBoostOptions* catBoostOptions
) {
- if (catBoostOptions->GetTaskType() == ETaskType::CPU) {
- if (catBoostOptions->BoostingOptions->ModelShrinkRate.Get() != 0.0f) {
- CB_ENSURE(
- trainDataMetaInfo.BaselineCount == 0,
- "Usage of model_shrink_rate option in combination with baseline column is not implemented yet."
- );
- CB_ENSURE(
- !learningContinuation,
- "Usage of model_shrink_rate option in combination with learning continuation is not implemented."
- );
+ if (catBoostOptions->GetTaskType() == ETaskType::CPU &&
+ catBoostOptions->BoostingOptions->ModelShrinkRate.Get() != 0.0f
+ ) {
+ if (trainDataMetaInfo.BaselineCount != 0) {
+ CATBOOST_WARNING_LOG << "Model shrinkage in combination with baseline column " <<
+ "is not implemented yet. Reset model_shrink_rate to 0." << Endl;
+ catBoostOptions->BoostingOptions->ModelShrinkRate.Set(0);
+ }
+ if (learningContinuation) {
+ CATBOOST_WARNING_LOG << "Model shrinkage in combination with learning continuation " <<
+ "is not implemented yet. Reset model_shrink_rate to 0." << Endl;
+ catBoostOptions->BoostingOptions->ModelShrinkRate.Set(0);
}
-
}
}
@@ -247,5 +248,5 @@ void SetDataDependentDefaults(
);
UpdateLeavesEstimationIterations(trainDataMetaInfo, catBoostOptions);
UpdateAndValidateMonotoneConstraints(*trainDataMetaInfo.FeaturesLayout.Get(), catBoostOptions);
- WarnIfBaselineUsedWithModelShrinkage(trainDataMetaInfo, learningContinuation, catBoostOptions);
+ DropModelShrinkageIfBaselineUsed(trainDataMetaInfo, learningContinuation, catBoostOptions);
}
