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

Function GetPlainJsonWithAllOptions

catboost/libs/model/utils.cpp:8–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <catboost/private/libs/options/plain_options_helper.h>
7
8NJson::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}

Callers 1

CatBoostGetPlainParams_RFunction · 0.85

Calls 6

ReadTJsonValueFunction · 0.85
GetCatFeaturesMethod · 0.80
GetTextFeaturesMethod · 0.80
GetEmbeddingFeaturesMethod · 0.80
atMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected