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

Function nmse

smallthinker/tests/test-backend-ops.cpp:177–190  ·  view source on GitHub ↗

normalized mean squared error = mse(a, b) / mse(a, 0)

Source from the content-addressed store, hash-verified

175
176// normalized mean squared error = mse(a, b) / mse(a, 0)
177static double nmse(const float * a, const float * b, size_t n) {
178 double mse_a_b = 0.0;
179 double mse_a_0 = 0.0;
180
181 for (size_t i = 0; i < n; i++) {
182 float a_i = a[i];
183 float b_i = b[i];
184
185 mse_a_b += (a_i - b_i) * (a_i - b_i);
186 mse_a_0 += a_i * a_i;
187 }
188
189 return mse_a_b / mse_a_0;
190}
191
192// maximum absolute asymmetry between a and b
193// asymmetry: (a - b) / (a + b)

Callers 1

evalMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected