npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
MultiscaleEMUnfold1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_MULTISCALEEMUNFOLD1D_HH_
2 #define NPSTAT_MULTISCALEEMUNFOLD1D_HH_
3 
4 /*!
5 // \file MultiscaleEMUnfold1D.hh
6 //
7 // \brief Expectation-maximization unfolding with multiscale smoothing
8 //
9 // Author: I. Volobouev
10 //
11 // May 2014
12 */
13 
15 
18 
19 namespace npstat {
20  /**
21  // In the situations with narrow response matrix, this class might
22  // be able to speed up convergence of the expectation-maximization
23  // iterations (in comparison with SmoothedEMUnfold1D). This is done
24  // by performing initial iterations with filters that have wider
25  // bandwidth. The maximum bandwidth of such filters should be
26  // comparable with the size of typical structures in the unfolded
27  // distribution, while the minimum bandwidth should be just slightly
28  // above the bandwidth of the final filter. The bandwidth is
29  // progressively reduced in the iteration process.
30  //
31  // Note that construction of additional filters is itself rather
32  // CPU-intensive. Once constructed, the filters are memoized. It makes
33  // sense to use this code instead of SmoothedEMUnfold1D only if you
34  // plan to unfold multiple distributions.
35  */
37  {
38  public:
39  /**
40  // The constructor arguments are:
41  //
42  // responseMatrix -- Naturally, the problem response matrix.
43  //
44  // filter -- The filter to use for smoothing the
45  // unfolded values. This object will not
46  // make a copy of the filter. It is
47  // a responsibility of the caller to ensure
48  // that the argument filter exists while
49  // this object is in use.
50  //
51  // symbetaPower -- Before running the standard expectation
52  // maxDegree maximization iterations with the filter
53  // xMinUnfolded provided by the previous argument, the
54  // xMaxUnfolded code will run iterations with a family
55  // filterBoundaryMethod of filters created by the
56  // "symbetaLOrPEFilter1D" function. These
57  // parameters will be passed to the
58  // "symbetaLOrPEFilter1D" call.
59  //
60  // minBandwidth -- Minimum bandwidth for the extra filters.
61  //
62  // maxBandwidth -- Maximum bandwidth for the extra filters.
63  //
64  // nFilters -- Number of extra filters. Logarithms
65  // of the bandwidth values of these filters
66  // will be equidistant.
67  //
68  // itersPerFilter -- Number of expectation-maximization
69  // iterations to perform per extra filter.
70  // These additional filters will be used
71  // sequentially, in the order of decreasing
72  // bandwidth.
73  //
74  // useConvolutions -- If "true", the code will call the
75  // "convolve" method of the filter rather
76  // than its "filter" method.
77  //
78  // useMultinomialCovariance -- Specifies whether we should use
79  // multinomial distribution to estimate
80  // covariance of fitted observations
81  // (otherwise Poisson assumption is used).
82  //
83  // smoothLastIter -- If "false", smoothing will not be
84  // applied after the last iteration.
85  // Setting this parameter to "false" is
86  // not recommended for production results
87  // because it is unclear how to compare
88  // such results with models.
89  //
90  // convergenceEpsilon -- Convergence criterion parameter for
91  // various iterations.
92  //
93  // maxIterations -- Maximum number of iterations allowed
94  // (both for the expectation-maximization
95  // iterations and for the code estimating
96  // the error propagation matrix).
97  */
98  MultiscaleEMUnfold1D(const Matrix<double>& responseMatrix,
99  const LocalPolyFilter1D& filter,
100  int symbetaPower, double maxDegree,
101  double xMinUnfolded, double xMaxUnfolded,
102  const BoundaryHandling& filterBoundaryMethod,
103  double minBandwidth, double maxBandwidth,
104  unsigned nFilters, unsigned itersPerFilter,
105  bool useConvolutions,
106  bool useMultinomialCovariance = false,
107  bool smoothLastIter = true,
108  double convergenceEpsilon = 1.0e-10,
109  unsigned maxIterations = 100000U);
110 
111  inline virtual ~MultiscaleEMUnfold1D() {}
112 
113  private:
114  virtual unsigned preIterate(
115  const double* observed, unsigned lenObserved,
116  double** prev, double** next, unsigned lenUnfolded);
117 
118  double maxLOrPEDegree_;
119  double binwidth_;
120  int symbetaPower_;
121  unsigned itersPerFilter_;
122  BoundaryHandling filterBoundaryMethod_;
123  EquidistantInLogSpace bwset_;
124  MemoizingSymbetaFilterProvider filterProvider_;
125  };
126 }
127 
128 #endif // NPSTAT_MULTISCALEEMUNFOLD1D_HH_
Equidistant sequences of points in either linear or log space.
Builds symmetric beta LOrPE filters and remembers these filters when the user sets the corresponding ...
Expectation-maximization (a.k.a. D'Agostini) unfolding with smoothing.
virtual void useConvolutions(const bool b)
Definition: AbsUnfold1D.hh:89
Definition: BoundaryHandling.hh:21
Definition: EquidistantSequence.hh:55
Definition: LocalPolyFilter1D.hh:38
Definition: MemoizingSymbetaFilterProvider.hh:27
Definition: MultiscaleEMUnfold1D.hh:37
MultiscaleEMUnfold1D(const Matrix< double > &responseMatrix, const LocalPolyFilter1D &filter, int symbetaPower, double maxDegree, double xMinUnfolded, double xMaxUnfolded, const BoundaryHandling &filterBoundaryMethod, double minBandwidth, double maxBandwidth, unsigned nFilters, unsigned itersPerFilter, bool useConvolutions, bool useMultinomialCovariance=false, bool smoothLastIter=true, double convergenceEpsilon=1.0e-10, unsigned maxIterations=100000U)
Definition: SmoothedEMUnfold1D.hh:18
double convergenceEpsilon() const
Definition: SmoothedEMUnfold1D.hh:83
void useMultinomialCovariance(const bool b)
Definition: SmoothedEMUnfold1D.hh:72
Definition: AbsArrayProjector.hh:14