source: trunk/lib/statistics/Score.h @ 509

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

added test for target
redesign crossSplitter
added two class function in Target

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1// $Id: Score.h 509 2006-02-18 13:47:32Z 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    /// @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    /// @train_set defining which values to use (number of values used
82    /// in the calculation is equal to size of \a train_set)
83    ///
84    virtual double 
85    score(const classifier::Target& target, 
86          const gslapi::vector& value,
87          const gslapi::vector& weight) = 0; 
88
89    ///
90    /// Function calculating the weighted version of score. In
91    /// absolute mode, also the score using negated class labels is
92    /// calculated, and the largest of the two scores are
93    /// calculated. Absolute mode should be used when two-tailed test
94    /// is wanted.
95    ///
96    /// @return statistica (weighted version)
97    ///
98    /// @param target is +1 or -1
99    /// @param value vector of the values
100    /// @param weight vector of accompanied weight to the values
101    /// @train_set defining which values to use (number of values used
102    /// in the calculation is equal to size of \a train_set)
103    ///
104    inline double 
105    score(const classifier::Target& target, 
106          const classifier::DataLookup1D& value,
107          const classifier::DataLookup1D& weight) 
108    { return score(target, gslapi::vector(value), gslapi::vector(weight)); }
109
110  protected:
111    inline bool weighted(void) const { return weighted_; }
112
113    bool absolute_;
114    bool weighted_;
115
116  }; // class Score
117
118}} // of namespace statistics and namespace theplu
119
120#endif
Note: See TracBrowser for help on using the repository browser.