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

Method LoadMetrics

catboost/libs/loggers/catboost_logger_helpers.cpp:35–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35TMetricsAndTimeLeftHistory 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
58void TMetricsAndTimeLeftHistory::TryUpdateBestError(const IMetric& metric, double error, THashMap<TString, double>& bestError, bool updateBestIteration) {

Callers

nothing calls this directly

Calls 5

ReadFunction · 0.50
GetMapMethod · 0.45
atMethod · 0.45
containsMethod · 0.45
GetUIntegerSafeMethod · 0.45

Tested by

no test coverage detected