yat/statistics/Score.h

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