MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / find_quantile

Function find_quantile

examples/quantize-stats/quantize-stats.cpp:104–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static double find_quantile(const error_stats & stats, double quantile) {
105 double sum = std::accumulate(std::begin(stats.error_histogram), std::end(stats.error_histogram), 0.0);
106
107 double accum = 0;
108 for (size_t i = 0; i < HISTOGRAM_BUCKETS; i++) {
109 accum += stats.error_histogram[i];
110 if (accum >= sum*quantile) {
111 return (i+1) * HISTOGRAM_RANGE / HISTOGRAM_BUCKETS;
112 }
113 }
114 return INFINITY;
115}
116
117static void print_error_stats(const std::string & name, const error_stats & stats, bool print_histogram) {
118 double rmse = sqrt(stats.total_error / (double) stats.num_samples);

Callers 1

print_error_statsFunction · 0.70

Calls 2

beginFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected