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

Function ToJson

library/cpp/histogram/simple/histogram.h:107–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106 template <typename T>
107 NJson::TJsonValue ToJson(const THistogram<T>& hist, const TVector<double>& percentiles) {
108 NJson::TJsonValue json;
109
110 for (double percentile : percentiles) {
111 TStringBuilder name;
112 name << "Q" << Prec(percentile * 100, PREC_POINT_DIGITS_STRIP_ZEROES, 2);
113 json[name] = hist.ValueAtPercentile(percentile);
114 }
115
116 json["RecordCount"] = hist.TotalCount();
117
118 return json;
119 }
120
121 template <typename T>
122 NJson::TJsonValue ToJson(const THashMap<TString, THistogram<T>>& hists, const TVector<double>& percentiles) {

Callers 5

ToJsonStrFunction · 0.70
AsJsonMethod · 0.50
ToJsonMethod · 0.50
ToJsonMethod · 0.50
Y_UNIT_TESTFunction · 0.50

Calls 3

ValueAtPercentileMethod · 0.80
PrecFunction · 0.50
TotalCountMethod · 0.45

Tested by

no test coverage detected