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 |
// $Id$ |
616 |
31 Aug 06 |
jari |
5 |
|
675 |
10 Oct 06 |
jari |
6 |
/* |
831 |
27 Mar 07 |
peter |
Copyright (C) 2004, 2005 Peter Johansson |
2119 |
12 Dec 09 |
peter |
Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2007 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
98 |
10 Jun 04 |
peter |
11 |
|
1437 |
25 Aug 08 |
peter |
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 |
The yat library is free software; you can redistribute it and/or |
675 |
10 Oct 06 |
jari |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
675 |
10 Oct 06 |
jari |
License, or (at your option) any later version. |
675 |
10 Oct 06 |
jari |
18 |
|
675 |
10 Oct 06 |
jari |
The yat library is distributed in the hope that it will be useful, |
675 |
10 Oct 06 |
jari |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
675 |
10 Oct 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
675 |
10 Oct 06 |
jari |
General Public License for more details. |
675 |
10 Oct 06 |
jari |
23 |
|
675 |
10 Oct 06 |
jari |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
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 |
/// @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 |
/// @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 |
/// @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 |
/// @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 |
/// Function calculating the score. In absolute mode, also the |
410 |
30 Nov 05 |
peter |
/// score using negated class labels is calculated, and the |
779 |
05 Mar 07 |
peter |
/// 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 |
/// Function calculating the score. In absolute mode, also the |
475 |
22 Dec 05 |
peter |
/// score using negated class labels is calculated, and the |
4200 |
19 Aug 22 |
peter |
/// largest of the two scores are calculated. |
4200 |
19 Aug 22 |
peter |
75 |
/// |
779 |
05 Mar 07 |
peter |
/// @a value is copied to a utility::vector and that operator is |
779 |
05 Mar 07 |
peter |
/// called. If speed is important this operator should be |
779 |
05 Mar 07 |
peter |
/// implemented in inherited class to avoid copying. |
475 |
22 Dec 05 |
peter |
79 |
/// |
779 |
05 Mar 07 |
peter |
/// @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 |
/// Function calculating the score in a weighted fashion. In |
623 |
05 Sep 06 |
peter |
/// absolute mode, also the score using negated class labels is |
623 |
05 Sep 06 |
peter |
/// calculated, and the largest of the two scores are |
623 |
05 Sep 06 |
peter |
/// calculated. Absolute mode should be used when two-tailed test |
623 |
05 Sep 06 |
peter |
/// is wanted. |
623 |
05 Sep 06 |
peter |
91 |
/// |
779 |
05 Mar 07 |
peter |
/// @a value is copied to two utility::vector and that operator is |
779 |
05 Mar 07 |
peter |
/// called. If speed is important this operator should be |
779 |
05 Mar 07 |
peter |
/// 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 |
/// Function calculating the weighted version of score. In |
410 |
30 Nov 05 |
peter |
/// absolute mode, also the score using negated class labels is |
410 |
30 Nov 05 |
peter |
/// calculated, and the largest of the two scores are |
410 |
30 Nov 05 |
peter |
/// calculated. Absolute mode should be used when two-tailed test |
410 |
30 Nov 05 |
peter |
/// 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 |
/// Function calculating the weighted version of score. In |
475 |
22 Dec 05 |
peter |
/// absolute mode, also the score using negated class labels is |
475 |
22 Dec 05 |
peter |
/// calculated, and the largest of the two scores are |
475 |
22 Dec 05 |
peter |
/// calculated. Absolute mode should be used when two-tailed test |
475 |
22 Dec 05 |
peter |
/// is wanted. |
295 |
29 Apr 05 |
peter |
118 |
/// |
966 |
11 Oct 07 |
peter |
/// \a value and \a weight are copied to utility::vector and the |
779 |
05 Mar 07 |
peter |
/// corresponding operator is called. If speed is important this |
779 |
05 Mar 07 |
peter |
/// operator should be implemented in inherited class to avoid |
779 |
05 Mar 07 |
peter |
/// 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 |
/// true if method is absolute, which means if score is below |
779 |
05 Mar 07 |
peter |
/// 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 |