npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
BandwidthCVPseudoLogliND.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_BANDWIDTHCVPSEUDOLOGLIND_HH_
2 #define NPSTAT_BANDWIDTHCVPSEUDOLOGLIND_HH_
3 
4 /*!
5 // \file BandwidthCVPseudoLogliND.hh
6 //
7 // \brief Cross-validating multivariate density estimates by optimizing
8 // regularized pseudo log-likelihood
9 //
10 // Author: I. Volobouev
11 //
12 // September 2010
13 */
14 
16 
17 namespace npstat {
18  /**
19  // Class for calculating KDE or LOrPE cross-validation pseudo log
20  // likelihood, for multivariate density estimates
21  */
22  template<typename Num, class Array>
23  class BandwidthCVPseudoLogliND : public AbsBandwidthCVND<Num,Array>
24  {
25  public:
26  /**
27  // Parameter "regularizationPower" is used to limit the contributions
28  // into the overall pseudo log likelihood from points for which the
29  // "leaving one out" density is very low. For those points, instead
30  // of "leaving one out" density, we will use the density generated by
31  // that point itself divided by pow(N, regularizationPower). This
32  // method limits the effect of tails on bandwidth determination.
33  */
34  explicit BandwidthCVPseudoLogliND(double regularizationPower=0.5)
35  : renormPow_(regularizationPower), nonZeroCount_(0), renormCount_(0) {}
36 
37  inline virtual ~BandwidthCVPseudoLogliND() {}
38 
39  inline unsigned long getNonZeroCount() const {return nonZeroCount_;}
40  inline unsigned long getRenormCount() const {return renormCount_;}
41 
42  // Unweighted samples
43  virtual double operator()(
44  const HistoND<Num>& histo,
45  const Array& densityEstimate,
46  const AbsPolyFilterND& filterUsed) const;
47 
48  // Weighted samples
49  virtual double operator()(
50  const HistoND<Num>& histo,
51  double effectiveSampleSize,
52  const Array& densityEstimate,
53  const AbsPolyFilterND& filterUsed) const;
54 
55  private:
56  double renormPow_;
57  mutable unsigned long nonZeroCount_;
58  mutable unsigned long renormCount_;
59  };
60 }
61 
62 #include "npstat/stat/BandwidthCVPseudoLogliND.icc"
63 
64 #endif // NPSTAT_BANDWIDTHCVPSEUDOLOGLIND_HH_
Interface definitions for KDE or LOrPE cross-validation calculations.
Definition: BandwidthCVPseudoLogliND.hh:24
virtual double operator()(const HistoND< Num > &histo, const Array &densityEstimate, const AbsPolyFilterND &filterUsed) const
virtual double operator()(const HistoND< Num > &histo, double effectiveSampleSize, const Array &densityEstimate, const AbsPolyFilterND &filterUsed) const
BandwidthCVPseudoLogliND(double regularizationPower=0.5)
Definition: BandwidthCVPseudoLogliND.hh:34
Definition: HistoND.hh:46
Definition: AbsArrayProjector.hh:14
Definition: AbsBandwidthCV.hh:176
Definition: AbsPolyFilterND.hh:27