| 27 | |
| 28 | |
| 29 | static TVector<TString> GetFeatureNames( |
| 30 | const TVector<TString>& featureNamesFromColumnsDescription, |
| 31 | const NCB::TPathWithScheme& featureNamesPath |
| 32 | ) { |
| 33 | TVector<TString> externalFeatureNames = LoadFeatureNames(featureNamesPath); |
| 34 | |
| 35 | if (externalFeatureNames.empty()) { |
| 36 | return featureNamesFromColumnsDescription; |
| 37 | } else { |
| 38 | const size_t intersectionSize = Min( |
| 39 | featureNamesFromColumnsDescription.size(), |
| 40 | externalFeatureNames.size()); |
| 41 | |
| 42 | size_t featureIdx = 0; |
| 43 | for (; featureIdx < intersectionSize; ++featureIdx) { |
| 44 | CB_ENSURE( |
| 45 | featureNamesFromColumnsDescription[featureIdx].empty() |
| 46 | || (featureNamesFromColumnsDescription[featureIdx] == externalFeatureNames[featureIdx]), |
| 47 | "Feature #" << featureIdx << ": name from columns description (\"" |
| 48 | << featureNamesFromColumnsDescription[featureIdx] |
| 49 | << "\") is not equal to name from feature names file (\"" |
| 50 | << externalFeatureNames[featureIdx] << "\")" |
| 51 | ); |
| 52 | } |
| 53 | for (; featureIdx < featureNamesFromColumnsDescription.size(); ++featureIdx) { |
| 54 | CB_ENSURE( |
| 55 | featureNamesFromColumnsDescription[featureIdx].empty(), |
| 56 | "Feature #" << featureIdx << ": name specified in columns description (\"" |
| 57 | << featureNamesFromColumnsDescription[featureIdx] |
| 58 | << "\") but not present in feature names file" |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | return externalFeatureNames; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | |
| 67 | namespace NCB { |
no test coverage detected