| 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 | } |
no test coverage detected