An example of ridge regression method.
Uses MtxExp, Regress; procedure Example; var y,b: Vector; A : Matrix; begin y.SetIt(false,[-2.5, 0.1, 6.1]); A.SetIt(3,2,false,[1.0, 2.5, 3.2, -1.5, 0.4, 0.7]); RidgeRegress(y, A, 0.0, b); // b = (-6.8889789853, -6.450976395) end;
#include "MtxExpr.hpp" #include "Regress.hpp" #include "Math387.hpp" void __fastcall Example() { sVector y,b; sMatrix A; y.SetIt(false,OPENARRAY(double,(-2.5, 0.1, 6.1))); A.SetIt(3,2,false,OPENARRAY(double,(1.0, 2.5, 3.2, -1.5, 0.4, 0.7))); RidgeRegress(y,A,0.0,b); // b = (-6.8889789853, -6.450976395) }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|