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

Last change on this file since 529 was 529, checked in by Markus Ringnér, 16 years ago

Added score for signal-to-noise ratio (Golub score). Fixed documentation. Improved weighted version of tScore

• Property svn:eol-style set to `native`
• Property svn:keywords set to `Author Date Id Revision`
File size: 3.0 KB
Line
1// \$Id: Score.h 529 2006-03-01 14:03:27Z markus \$
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    /// @return statistica.
45    ///
46    /// @param target vector of targets (most often +1 -1)
47    /// @param value vector of the values
48    ///
49    virtual double
50    score(const classifier::Target& target,
51          const gslapi::vector& value) = 0;
52
53    ///
54    /// Function calculating the score. In absolute mode, also the
55    /// score using negated class labels is calculated, and the
56    /// largest of the two scores are calculated. Absolute mode should
57    /// be used when two-tailed test is wanted.
58    ///
59    /// @return statistica.
60    ///
61    /// @param target vector of targets (most often +1 -1)
62    /// @param value vector of the values
63    ///
64    inline double
65    score(const classifier::Target& target,
66          const classifier::DataLookup1D& value)
67    { return score(target,gslapi::vector(value)); }
68
69    ///
70    /// Function calculating the weighted version of score. In
71    /// absolute mode, also the score using negated class labels is
72    /// calculated, and the largest of the two scores are
73    /// calculated. Absolute mode should be used when two-tailed test
74    /// is wanted.
75    ///
76    /// @return statistica (weighted version)
77    ///
78    /// @param target is +1 or -1
79    /// @param value vector of the values
80    /// @param weight vector of accompanied weight to the values
81    ///
82    virtual double
83    score(const classifier::Target& target,
84          const gslapi::vector& value,
85          const gslapi::vector& weight) = 0;
86
87    ///
88    /// Function calculating the weighted version of score. In
89    /// absolute mode, also the score using negated class labels is
90    /// calculated, and the largest of the two scores are
91    /// calculated. Absolute mode should be used when two-tailed test
92    /// is wanted.
93    ///
94    /// @return statistica (weighted version)
95    ///
96    /// @param target is +1 or -1
97    /// @param value vector of the values
98    /// @param weight vector of accompanied weight to the values
99    ///
100    inline double
101    score(const classifier::Target& target,
102          const classifier::DataLookup1D& value,
103          const classifier::DataLookup1D& weight)
104    { return score(target, gslapi::vector(value), gslapi::vector(weight)); }
105
106  protected:
107    inline bool weighted(void) const { return weighted_; }
108
109    bool absolute_;
110    bool weighted_;
111
112  }; // class Score
113
114}} // of namespace statistics and namespace theplu
115
116#endif
Note: See TracBrowser for help on using the repository browser.