MRS  1.0
A C++ Class Library for Statistical Set Processing
subpavings::PenAIC1 Class Reference

Class for penalty function 1 for AIC. More...

+ Inheritance diagram for subpavings::PenAIC1:
+ Collaboration diagram for subpavings::PenAIC1:

List of all members.

Public Member Functions

 PenAIC1 (double cc, double aa, double rr)
cxsc::real operator() (const AdaptiveHistogram *const adh, int deltaLeaf) const
 the penalty function.

Detailed Description

Class for penalty function 1 for AIC.


Member Function Documentation

real subpavings::PenAIC1::operator() ( const AdaptiveHistogram *const  adh,
int  deltaLeaf 
) const [virtual]

the penalty function.

Parameters:
adhis the histogram object to calculate the penalty on.
deltaLeafchange in number leaves to take into account.
Returns:
the penalty as a cxsc::real.

Implements subpavings::PenObj.

  {
    dotprecision penalty(0.0);

    int k = adh->getRootLeaves() + deltaLeaf - 1; // leaves-1
    double logCatk= lCk(k);

    accumulate(penalty, c, logCatk); // pen = c*logCatk
    accumulate(penalty, alpha, k); // pen = c*logCatk + alpha*k
    accumulate(penalty, c*r, log(k+1.0));
    // now pen = c*logCatk + alpha*k + c*r*log(k+1)

    dotprecision temp(0.0);
    accumulate(temp, c*alpha*k, logCatk);
    accumulate(temp, r, log(k+1.0));
    // temp = c*alpha*k*logCatk + r*log(k+1)

    return (rnd(penalty) + 2*sqrt(rnd(temp)));
    // return c*logCatk + alpha*k + c*r*log(k+1)
    //                          + 2*sqrt(c*alpha*k*logCatk + r*log(k+1))
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends