source: trunk/yat/statistics/Score.h

Last change on this file was 2119, checked in by Peter, 12 years ago

converted files to utf-8. fixes #577

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1#ifndef _theplu_yat_statistics_score_
2#define _theplu_yat_statistics_score_
3
4// $Id: Score.h 2119 2009-12-12 23:11:43Z peter $
5
6/*
7  Copyright (C) 2004, 2005 Peter Johansson
8  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
9  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
10
11  This file is part of the yat library, http://dev.thep.lu.se/yat
12
13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 3 of the
16  License, or (at your option) any later version.
17
18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with yat. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27namespace theplu {
28namespace yat {
29namespace classifier {
30  class Target;
31  class DataLookup1D;
32  class DataLookupWeighted1D;
33}
34namespace utility {
35  class VectorBase;
36}
37namespace statistics {
38
39  ///
40  /// @brief Interface Class for score classes.
41  ///
42  class Score
43  {
44
45  public:
46    ///
47    /// @brief Constructor
48    ///   
49    Score(bool) ;
50   
51    ///
52    /// @brief Destructor
53    ///
54    virtual ~Score(void);
55   
56    ///
57    /// @brief Function changing mode of Score
58    ///
59    void absolute(bool absolute);
60
61    ///
62    /// Function calculating the score. In absolute mode, also the
63    /// score using negated class labels is calculated, and the
64    /// largest of the two scores are returned.
65    ///
66    virtual double 
67    score(const classifier::Target& target, 
68          const utility::VectorBase& value) const = 0; 
69 
70    ///
71    /// Function calculating the score. In absolute mode, also the
72    /// score using negated class labels is calculated, and the
73    /// largest of the two scores are calculated.
74    ///
75    /// @a value is copied to a utility::vector and that operator is
76    /// called. If speed is important this operator should be
77    /// implemented in inherited class to avoid copying.
78    ///
79    /// @return score
80    ///
81    virtual double score(const classifier::Target& target, 
82                         const classifier::DataLookup1D& value) const;
83 
84    ///
85    /// Function calculating the score in a weighted fashion. In
86    /// absolute mode, also the score using negated class labels is
87    /// calculated, and the largest of the two scores are
88    /// calculated. Absolute mode should be used when two-tailed test
89    /// is wanted.
90    ///
91    /// @a value is copied to two utility::vector and that operator is
92    /// called. If speed is important this operator should be
93    /// implemented in inherited class to avoid copying.
94    ///
95    virtual double 
96    score(const classifier::Target& target, 
97          const classifier::DataLookupWeighted1D& value) const; 
98 
99    ///
100    /// Function calculating the weighted version of score. In
101    /// absolute mode, also the score using negated class labels is
102    /// calculated, and the largest of the two scores are
103    /// calculated. Absolute mode should be used when two-tailed test
104    /// is wanted.
105    ///
106    virtual double 
107    score(const classifier::Target& target, 
108          const utility::VectorBase& value,
109          const utility::VectorBase& weight) const = 0; 
110
111    ///
112    /// Function calculating the weighted version of score. In
113    /// absolute mode, also the score using negated class labels is
114    /// calculated, and the largest of the two scores are
115    /// calculated. Absolute mode should be used when two-tailed test
116    /// is wanted.
117    ///
118    /// \a value and \a weight are copied to utility::vector and the
119    /// corresponding operator is called. If speed is important this
120    /// operator should be implemented in inherited class to avoid
121    /// copying.
122    ///
123    double score(const classifier::Target& target, 
124                 const classifier::DataLookup1D& value,
125                 const classifier::DataLookup1D& weight) const;
126
127  protected:
128    /// true if method is absolute, which means if score is below
129    /// expected value (by chance) E, score returns E-score+E instead.
130    bool absolute_;
131
132  }; // class Score
133
134}}} // of namespace statistics, yat, and theplu
135
136#endif
Note: See TracBrowser for help on using the repository browser.