| 33 | } |
| 34 | |
| 35 | TMetricsAndTimeLeftHistory TMetricsAndTimeLeftHistory::LoadMetrics(const NJson::TJsonValue& rhs) { |
| 36 | const auto& rhsMap = rhs.GetMap(); |
| 37 | |
| 38 | auto loadFromJson = [&] (TStringBuf name, auto* field) { |
| 39 | TJsonFieldHelper<std::remove_reference_t<decltype(*field)>>::Read( |
| 40 | rhsMap.at(name), |
| 41 | field |
| 42 | ); |
| 43 | }; |
| 44 | |
| 45 | TMetricsAndTimeLeftHistory result; |
| 46 | loadFromJson("learn_metrics_history", &result.LearnMetricsHistory); |
| 47 | loadFromJson("test_metrics_history", &result.TestMetricsHistory); |
| 48 | if (rhsMap.contains("best_iteration")) { |
| 49 | result.BestIteration = rhsMap.at("best_iteration").GetUIntegerSafe(); |
| 50 | } |
| 51 | loadFromJson("learn_best_error", &result.LearnBestError); |
| 52 | loadFromJson("test_best_error", &result.TestBestError); |
| 53 | |
| 54 | return result; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | void TMetricsAndTimeLeftHistory::TryUpdateBestError(const IMetric& metric, double error, THashMap<TString, double>& bestError, bool updateBestIteration) { |
nothing calls this directly
no test coverage detected