MCPcopy Create free account
hub / github.com/catboost/catboost / IsParamsCompatible

Method IsParamsCompatible

catboost/private/libs/options/catboost_options.cpp:1133–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1131}
1132
1133bool NCatboostOptions::IsParamsCompatible(
1134 const TStringBuf firstSerializedParams,
1135 const TStringBuf secondSerializedParams)
1136{
1137 //TODO:(noxoomo, nikitxskv): i don't think this way of checking compatible is good. We should parse params and comprare fields that are essential, not all
1138 const TStringBuf paramsToIgnore[] = {
1139 "system_options",
1140 "flat_params",
1141 "metadata",
1142 "model_based_eval_options"
1143 };
1144 const TStringBuf dataProcessingParamsToIgnore[] = {
1145 "ignored_features"
1146 };
1147 const TStringBuf boostingParamsToIgnore[] = {
1148 "iterations",
1149 "learning_rate",
1150 };
1151 NJson::TJsonValue firstParams, secondParams;
1152 ReadJsonTree(firstSerializedParams, &firstParams);
1153 ReadJsonTree(secondSerializedParams, &secondParams);
1154
1155 // Check ignored and MBE features
1156 const bool isSameMaybeIgnoredFeatures = GetMaybeIgnoredFeatures(firstParams) == GetMaybeIgnoredFeatures(secondParams);
1157
1158 for (const auto& paramName : paramsToIgnore) {
1159 firstParams.EraseValue(paramName);
1160 secondParams.EraseValue(paramName);
1161 }
1162 for (const auto& paramName : dataProcessingParamsToIgnore) {
1163 firstParams["data_processing_options"].EraseValue(paramName);
1164 secondParams["data_processing_options"].EraseValue(paramName);
1165 }
1166 for (const auto& paramName : boostingParamsToIgnore) {
1167 firstParams["boosting_options"].EraseValue(paramName);
1168 secondParams["boosting_options"].EraseValue(paramName);
1169 }
1170 return isSameMaybeIgnoredFeatures && firstParams == secondParams;
1171}
1172
1173NCatboostOptions::TCatBoostOptions::TCatBoostOptions(ETaskType taskType)
1174 : SystemOptions("system_options", TSystemOptions(taskType))

Callers

nothing calls this directly

Calls 3

GetMaybeIgnoredFeaturesFunction · 0.85
ReadJsonTreeFunction · 0.50
EraseValueMethod · 0.45

Tested by

no test coverage detected