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

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

improved doc in Score

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