TDeriveProc Event

MulticastDelegateTDeriveProc

type TDeriveProc = procedure(RegressFun: TRegressFun; const X, Y: double; const Pars, Grad: TVec);

Defines derivatives of a function.

The type describes the procedure for calculating the derivatives of a regression function TRegressFun with respect to the regression parameters (B array), evaluated at (X,Y).

Examples

delphi
// y=b0*x*x + b1*x + b2
function SimpleParabola(const B: TVec; X: double): double;
begin
    SimpleParabola := b[0]*Sqr(x) + b[1]*x + b[2];
end;
// \grad\ _b function
procedure SimpleParabolaDeriv(RegressFun: TRegressFun; const X, Y: double; const Pars: TVec; const Grad: TVec);
begin
    Grad[0] := Sqr(x);
    Grad[1] := x;
    Grad[2] := 1;
end;