MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / lrrmserror

Function lrrmserror

src/linreg.cpp:489–511  ·  view source on GitHub ↗

RMS error on the test set INPUT PARAMETERS: LM - linear model XY - test set NPoints - test set size RESULT: root mean square error. -- ALGLIB -- Copyright 30.08.2008 by Bochkanov Sergey *************************************************************************/

Source from the content-addressed store, hash-verified

487 Copyright 30.08.2008 by Bochkanov Sergey
488*************************************************************************/
489double lrrmserror(const linearmodel& lm,
490 const ap::real_2d_array& xy,
491 int npoints)
492{
493 double result;
494 int i;
495 double v;
496 int offs;
497 int nvars;
498
499 ap::ap_error::make_assertion(ap::round_f(lm.w(1))==lrvnum, "LINREG: Incorrect LINREG version!");
500 nvars = ap::round_f(lm.w(2));
501 offs = ap::round_f(lm.w(3));
502 result = 0;
503 for(i = 0; i <= npoints-1; i++)
504 {
505 v = ap::vdotproduct(&xy(i, 0), 1, &lm.w(offs), 1, ap::vlen(0,nvars-1));
506 v = v+lm.w(offs+nvars);
507 result = result+ap::sqr(v-xy(i,nvars));
508 }
509 result = sqrt(result/npoints);
510 return result;
511}
512
513
514/*************************************************************************

Callers 1

lrinternalFunction · 0.85

Calls 2

round_fFunction · 0.85
vdotproductFunction · 0.85

Tested by

no test coverage detected