| 6 | #include <catboost/private/libs/options/plain_options_helper.h> |
| 7 | |
| 8 | NJson::TJsonValue GetPlainJsonWithAllOptions(const TFullModel& model) { |
| 9 | NJson::TJsonValue trainOptions = ReadTJsonValue(model.ModelInfo.at("params")); |
| 10 | NJson::TJsonValue outputOptions = ReadTJsonValue(model.ModelInfo.at("output_options")); |
| 11 | NJson::TJsonValue plainOptions; |
| 12 | NCatboostOptions::ConvertOptionsToPlainJson(trainOptions, outputOptions, &plainOptions); |
| 13 | CB_ENSURE(!plainOptions.GetMapSafe().empty(), "plainOptions should not be empty."); |
| 14 | NJson::TJsonValue cleanedOptions(plainOptions); |
| 15 | CB_ENSURE(!cleanedOptions.GetMapSafe().empty(), "problems with copy constructor."); |
| 16 | bool hasCatFeatures = !model.ModelTrees->GetCatFeatures().empty(); |
| 17 | bool hasTextFeatures = !model.ModelTrees->GetTextFeatures().empty(); |
| 18 | bool hasEmbeddingFeatures = !model.ModelTrees->GetEmbeddingFeatures().empty(); |
| 19 | NCatboostOptions::CleanPlainJson(hasCatFeatures, &cleanedOptions, hasTextFeatures, hasEmbeddingFeatures); |
| 20 | CB_ENSURE(!cleanedOptions.GetMapSafe().empty(), "cleanedOptions should not be empty."); |
| 21 | return cleanedOptions; |
| 22 | } |
no test coverage detected