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

Class for penalty function 2 for AIC. More...

+ Inheritance diagram for subpavings::PenAIC2:
+ Collaboration diagram for subpavings::PenAIC2:

List of all members.

Public Member Functions

 PenAIC2 (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 2 for AIC.


Member Function Documentation

real subpavings::PenAIC2::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);
    size_t counter = adh->getRootCounter(); // total number points
    accumulate(penalty, c, logCatk); // pen = c*logCatk

    real s = adh->getRootSumLeafCountOverVol();

    accumulate(penalty, s/(1.0*counter), alpha);
    //now pen = c*logCatk + (alpha/counter)*sum(leaf counts/vols)
    accumulate(penalty, 2*r, log(k+1));
    //now pen = c*logCatk + (alpha/counter)*sum(leaf counts/vols) + 2*r*log(k+1)

    return rnd(penalty);
  }

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