| 219 | }; |
| 220 | |
| 221 | static TVector<double> GetMetricValues( |
| 222 | TConstArrayRef<THolder<IMetric>> metrics, |
| 223 | TConstArrayRef<bool> skipMetric, |
| 224 | const THashMap<TString, double>& iterationMetrics |
| 225 | ) { |
| 226 | TVector<double> result; |
| 227 | for (auto metricIdx : xrange(metrics.size())) { |
| 228 | const auto& metricDescription = metrics[metricIdx]->GetDescription(); |
| 229 | const auto isMetricAvailable = skipMetric.empty() || !skipMetric[metricIdx]; |
| 230 | const auto haveMetricValue = isMetricAvailable && iterationMetrics.contains(metricDescription); |
| 231 | if (haveMetricValue) { |
| 232 | result.push_back(iterationMetrics.at(metricDescription)); |
| 233 | } else { |
| 234 | result.push_back(std::numeric_limits<double>::quiet_NaN()); |
| 235 | } |
| 236 | } |
| 237 | return result; |
| 238 | } |
| 239 | |
| 240 | void Train( |
| 241 | const NCatboostOptions::TCatBoostOptions& catboostOption, |