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

Function ClassLabelToString

catboost/private/libs/labels/helpers.cpp:26–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 }
25
26 TString ClassLabelToString(const NJson::TJsonValue& classLabel) {
27 static TString trueStr("true");
28 static TString falseStr("false");
29
30 switch (classLabel.GetType()) {
31 case NJson::JSON_BOOLEAN:
32 return classLabel.GetBoolean() ? trueStr : falseStr;
33 case NJson::JSON_INTEGER:
34 return ToString(classLabel.GetInteger());
35 case NJson::JSON_DOUBLE:
36 return ToString(classLabel.GetDouble());
37 case NJson::JSON_STRING:
38 return classLabel.GetString();
39 default:
40 CB_ENSURE_INTERNAL(false, "bad class label type: " << classLabel.GetType());
41 }
42 Y_UNREACHABLE();
43 }
44
45 TVector<TString> ClassLabelsToStrings(TConstArrayRef<NJson::TJsonValue> classLabels) {
46 TVector<TString> result;

Callers 2

ClassLabelsToStringsFunction · 0.85
GetClassLabelsImplFunction · 0.85

Calls 6

ToStringFunction · 0.50
GetTypeMethod · 0.45
GetBooleanMethod · 0.45
GetIntegerMethod · 0.45
GetDoubleMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected