# source:trunk/lib/statistics/Score.h@532

Last change on this file since 532 was 532, checked in by Peter, 16 years ago

modified implementation of Parson weighted - now in line with other weighted statistics.

• Property svn:eol-style set to `native`
• Property svn:keywords set to `Author Date Id Revision`
File size: 2.5 KB
Line
1// \$Id: Score.h 532 2006-03-02 17:44:48Z peter \$
2
3#ifndef _theplu_statistics_score_
4#define _theplu_statistics_score_
5
6#include <c++_tools/gslapi/vector.h>
7
8namespace theplu {
9namespace classifier {
10  class Target;
11  class DataLookup1D;
12}
13
14namespace statistics {
15
16  ///
17  /// Abstract Base Class defining the interface for the score classes.
18  ///
19  class Score
20  {
21
22  public:
23    ///
24    ///   Constructor
25    ///
26    Score(bool absolute=true) ;
27
28    ///
29    ///   Destructor
30    ///
31    virtual ~Score(void) {};
32
33    ///
34    ///  Function changing mode of Score
35    ///
36    inline void absolute(bool absolute) {absolute_=absolute;}
37
38    ///
39    /// Function calculating the score. In absolute mode, also the
40    /// score using negated class labels is calculated, and the
41    /// largest of the two scores are calculated. Absolute mode should
42    /// be used when two-tailed test is wanted.
43    ///
44    virtual double
45    score(const classifier::Target& target,
46          const gslapi::vector& value) = 0;
47
48    ///
49    /// Function calculating the score. In absolute mode, also the
50    /// score using negated class labels is calculated, and the
51    /// largest of the two scores are calculated. Absolute mode should
52    /// be used when two-tailed test is wanted.
53    ///
54    /// @return statistica.
55    ///
56    /// @param target vector of targets (most often +1 -1)
57    /// @param value vector of the values
58    ///
59    inline double
60    score(const classifier::Target& target,
61          const classifier::DataLookup1D& value)
62    { return score(target,gslapi::vector(value)); }
63
64    ///
65    /// Function calculating the weighted version of score. In
66    /// absolute mode, also the score using negated class labels is
67    /// calculated, and the largest of the two scores are
68    /// calculated. Absolute mode should be used when two-tailed test
69    /// is wanted.
70    ///
71    virtual double
72    score(const classifier::Target& target,
73          const gslapi::vector& value,
74          const gslapi::vector& weight) = 0;
75
76    ///
77    /// Function calculating the weighted version of score. In
78    /// absolute mode, also the score using negated class labels is
79    /// calculated, and the largest of the two scores are
80    /// calculated. Absolute mode should be used when two-tailed test
81    /// is wanted.
82    ///
83    inline double
84    score(const classifier::Target& target,
85          const classifier::DataLookup1D& value,
86          const classifier::DataLookup1D& weight)
87    { return score(target, gslapi::vector(value), gslapi::vector(weight)); }
88
89  protected:
90    inline bool weighted(void) const { return weighted_; }
91
92    bool absolute_;
93    bool weighted_;
94
95  }; // class Score
96
97}} // of namespace statistics and namespace theplu
98
99#endif
Note: See TracBrowser for help on using the repository browser.