npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
AbsCompositeDistroBuilder.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_ABSCOMPOSITEDISTROBUILDER_HH_
2 #define NPSTAT_ABSCOMPOSITEDISTROBUILDER_HH_
3 
4 /*!
5 // \file AbsCompositeDistroBuilder.hh
6 //
7 // \brief Interface definition for classes which build composite distrubutions
8 //
9 // Author: I. Volobouev
10 //
11 // September 2010
12 */
13 
14 #include <vector>
15 #include <utility>
16 
17 #include "npstat/nm/BoxND.hh"
18 
21 
22 namespace npstat {
23  /**
24  // Interface definition for classes which build composite distrubutions
25  // out of data samples (typically, by fitting or smoothing) -- see header
26  // CompositeDistributionND.hh for more details on these distributions.
27  */
28  template <class Point>
30  {
31  public:
33 
34  // Second element of the pairs defined below is the weight
35  typedef std::pair<const Point*, double> WeightedPointPtr;
36  typedef std::vector<WeightedPointPtr> WeightedPtrVec;
37  typedef std::pair<typename Point::value_type, double> WeightedValue;
38  typedef std::vector<WeightedValue> WeightedValueVec;
39 
40  inline virtual ~AbsCompositeDistroBuilder() {}
41 
42  /**
43  // This method will build a CompositeDistributionND
44  // object on the heap using a sample of points. It is
45  // a responsibility of the user to delete such an object
46  // when it is no longer needed.
47  */
49  unsigned long uniqueId,
50  const double* predictorCoords, unsigned nPredictors,
51  const BoxND<double>& predictorBox,
52  std::vector<OrderedPointND<Point> >& data) const;
53 
54  /**
55  // This method will build a CompositeDistributionND
56  // object on the heap using a sample of weighted points.
57  // It is a responsibility of the user to delete such
58  // an object when it is no longer needed.
59  */
61  unsigned long uniqueId,
62  const double* predictorCoords, unsigned nPredictors,
63  const BoxND<double>& predictorBox, const WeightedPtrVec& data,
64  const unsigned* dimsToUse, unsigned nDimsToUse) const;
65 
66  private:
67  // The following two methods should simply return an empty
68  // box (constructed with the default constructor) in case
69  // the box is not needed
70  virtual BoxND<double> makeResponseBox(
71  unsigned long uniqueId,
72  const double* predictorCoords, unsigned nPredictors,
73  const BoxND<double>& predictorBox,
74  std::vector<OrderedPointND<Point> >& data) const = 0;
75 
76  virtual BoxND<double> makeResponseBoxW(
77  unsigned long uniqueId,
78  const double* predictorCoords, unsigned nPredictors,
79  const BoxND<double>& predictorBox, const WeightedPtrVec& data,
80  const unsigned* dimsToUse, unsigned nDimsToUse) const = 0;
81 
82  // The following methods should construct the relevant
83  // objects on the heap
84  virtual AbsDistribution1D* buildMarginal(
85  unsigned long uniqueId, unsigned dimNumber,
86  const Interval<double>& responseRange,
87  const std::vector<typename Point::value_type>&) const = 0;
88 
89  virtual AbsDistributionND* buildCopula(
90  unsigned long uniqueId,
91  std::vector<OrderedPointND<Point> >&) const = 0;
92 
93  virtual AbsDistribution1D* buildMarginalW(
94  unsigned long uniqueId, unsigned dimUsed,
95  unsigned dimNumber, const Interval<double>& responseRange,
96  const WeightedValueVec& data) const = 0;
97 
98  virtual AbsDistributionND* buildCopulaW(unsigned long uniqueId,
99  const WeightedPtrVec& data,
100  const unsigned* dimsToUse,
101  unsigned nDimsToUse) const = 0;
102  };
103 }
104 
105 #include "npstat/stat/AbsCompositeDistroBuilder.icc"
106 
107 #endif // NPSTAT_ABSCOMPOSITEDISTROBUILDER_HH_
Template to represent rectangles, boxes, and hyperboxes.
Multivariate statistical distributions decomposed into copula and marginals.
Multidimensional points which can be sorted according to multiple sorting criteria.
Definition: AbsCompositeDistroBuilder.hh:30
virtual CompositeDistributionND * build(unsigned long uniqueId, const double *predictorCoords, unsigned nPredictors, const BoxND< double > &predictorBox, std::vector< OrderedPointND< Point > > &data) const
virtual CompositeDistributionND * buildWeighted(unsigned long uniqueId, const double *predictorCoords, unsigned nPredictors, const BoxND< double > &predictorBox, const WeightedPtrVec &data, const unsigned *dimsToUse, unsigned nDimsToUse) const
Definition: AbsDistributionND.hh:26
Definition: CompositeDistributionND.hh:28
Definition: Interval.hh:29
Definition: OrderedPointND.hh:40
Definition: AbsArrayProjector.hh:14
Definition: AbsDistribution1D.hh:31