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

Method Load

catboost/private/libs/options/class_label_options.cpp:11–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9}
10
11void TClassLabelOptions::Load(const NJson::TJsonValue& options) {
12 NCatboostOptions::CheckedLoad(options, &ClassLabelType, &ClassToLabel, &ClassLabels, &ClassesCount);
13
14 if (!ClassLabels.Get().empty()) {
15 // compatibility with old "multiclass_params" without "class_label_type"
16 if (ClassLabelType == NCB::ERawTargetType::None) {
17 ClassLabelType = NCB::ERawTargetType::String;
18 } else if (ClassLabelType == NCB::ERawTargetType::Float) {
19 /* float values can be deserialized as JSON_INTEGER if they have 0 fractional part
20 * because JSON format does not distinguish between integer and float numeric types
21 * , fix this
22 */
23 for (NJson::TJsonValue& classLabel : ClassLabels.Get()) {
24 if (classLabel.GetType() == NJson::JSON_INTEGER) {
25 classLabel = NJson::TJsonValue(double(classLabel.GetInteger()));
26 }
27 }
28 }
29 }
30
31 Validate();
32}
33
34void TClassLabelOptions::Save(NJson::TJsonValue* options) const {
35 NCatboostOptions::SaveFields(options, ClassLabelType, ClassToLabel, ClassLabels, ClassesCount);

Callers

nothing calls this directly

Calls 7

CheckedLoadFunction · 0.85
TJsonValueClass · 0.70
ValidateFunction · 0.50
emptyMethod · 0.45
GetMethod · 0.45
GetTypeMethod · 0.45
GetIntegerMethod · 0.45

Tested by

no test coverage detected