npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
BandwidthGCVPseudoLogliND.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_BANDWIDTHGCVPSEUDOLOGLIND_HH_
2 #define NPSTAT_BANDWIDTHGCVPSEUDOLOGLIND_HH_
3 
4 /*!
5 // \file BandwidthGCVPseudoLogliND.hh
6 //
7 // \brief Cross-validating multivariate density estimates of grouped data
8 // by optimizing regularized pseudo log-likelihood
9 //
10 // Author: I. Volobouev
11 //
12 // June 2015
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 BandwidthGCVPseudoLogliND : public AbsBandwidthGCVND<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 BandwidthGCVPseudoLogliND(double regularizationPower=0.5)
35  : renormPow_(regularizationPower), nonZeroCount_(0), renormCount_(0) {}
36 
37  inline virtual ~BandwidthGCVPseudoLogliND() {}
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 Array& looEstimate,
47  const AbsPolyFilterND& filterUsed) const;
48 
49  // Weighted samples
50  virtual double operator()(
51  const HistoND<Num>& histo,
52  double effectiveSampleSize,
53  const Array& densityEstimate,
54  const Array& looEstimate,
55  const AbsPolyFilterND& filterUsed) const;
56 
57  private:
58  double renormPow_;
59  mutable unsigned long nonZeroCount_;
60  mutable unsigned long renormCount_;
61  };
62 }
63 
64 #include "npstat/stat/BandwidthGCVPseudoLogliND.icc"
65 
66 #endif // NPSTAT_BANDWIDTHGCVPSEUDOLOGLIND_HH_
Interface definitions for cross-validation with grouped data.
Definition: BandwidthGCVPseudoLogliND.hh:24
virtual double operator()(const HistoND< Num > &histo, const Array &densityEstimate, const Array &looEstimate, const AbsPolyFilterND &filterUsed) const
BandwidthGCVPseudoLogliND(double regularizationPower=0.5)
Definition: BandwidthGCVPseudoLogliND.hh:34
virtual double operator()(const HistoND< Num > &histo, double effectiveSampleSize, const Array &densityEstimate, const Array &looEstimate, const AbsPolyFilterND &filterUsed) const
Definition: HistoND.hh:46
Definition: AbsArrayProjector.hh:14
Definition: AbsBandwidthGCV.hh:118
Definition: AbsPolyFilterND.hh:27