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

Function UpdateClassLabelsFromBaselineFile

catboost/libs/data/baseline.cpp:158–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 }
157
158 void UpdateClassLabelsFromBaselineFile(
159 const TPathWithScheme& baselineFilePath,
160 TVector<NJson::TJsonValue>* classLabels
161 ) {
162 if (baselineFilePath.Inited()) {
163 CB_ENSURE_INTERNAL(classLabels != nullptr, "ClassLabels has not been specified");
164 THolder<IBaselineReader> reader = GetProcessor<IBaselineReader, TBaselineReaderArgs>(
165 baselineFilePath, TBaselineReaderArgs{baselineFilePath, {}}
166 );
167 TVector<TString> classNamesFromBaselineFile = reader->GetClassNames();
168 if (classLabels->empty()) {
169 classLabels->assign(classNamesFromBaselineFile.begin(), classNamesFromBaselineFile.end());
170 } else {
171 CB_ENSURE(
172 NCB::ClassLabelsToStrings(*classLabels) == classNamesFromBaselineFile,
173 "Inconsistent class names in baseline file"
174 );
175 }
176 }
177 }
178}

Callers 2

ReadDatasetFunction · 0.85

Calls 7

ClassLabelsToStringsFunction · 0.85
GetClassNamesMethod · 0.80
InitedMethod · 0.45
emptyMethod · 0.45
assignMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected