4200 |
19 Aug 22 |
peter |
1 |
#ifndef _theplu_yat_classifier_inputranker_ |
4200 |
19 Aug 22 |
peter |
2 |
#define _theplu_yat_classifier_inputranker_ |
89 |
28 May 04 |
peter |
3 |
|
675 |
10 Oct 06 |
jari |
// $Id$ |
675 |
10 Oct 06 |
jari |
5 |
|
675 |
10 Oct 06 |
jari |
6 |
/* |
831 |
27 Mar 07 |
peter |
Copyright (C) 2004 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2007 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
2986 |
18 Feb 13 |
peter |
Copyright (C) 2013 Jari Häkkinen |
675 |
10 Oct 06 |
jari |
12 |
|
1437 |
25 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
675 |
10 Oct 06 |
jari |
14 |
|
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 |
19 |
|
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 |
24 |
|
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 |
27 |
*/ |
675 |
10 Oct 06 |
jari |
28 |
|
2966 |
23 Jan 13 |
jari |
29 |
#include <cstddef> |
295 |
29 Apr 05 |
peter |
30 |
#include <vector> |
89 |
28 May 04 |
peter |
31 |
|
89 |
28 May 04 |
peter |
32 |
namespace theplu { |
680 |
11 Oct 06 |
jari |
33 |
namespace yat { |
295 |
29 Apr 05 |
peter |
34 |
namespace statistics { |
295 |
29 Apr 05 |
peter |
35 |
class Score; |
295 |
29 Apr 05 |
peter |
36 |
} |
4200 |
19 Aug 22 |
peter |
37 |
namespace classifier { |
475 |
22 Dec 05 |
peter |
38 |
|
475 |
22 Dec 05 |
peter |
39 |
class MatrixLookup; |
624 |
05 Sep 06 |
peter |
40 |
class MatrixLookupWeighted; |
475 |
22 Dec 05 |
peter |
41 |
class Target; |
475 |
22 Dec 05 |
peter |
42 |
|
89 |
28 May 04 |
peter |
43 |
/// |
767 |
22 Feb 07 |
peter |
/// @brief Class for ranking rows in a matrix, using a Score and a |
102 |
15 Jun 04 |
peter |
/// target vector. |
4200 |
19 Aug 22 |
peter |
46 |
/// |
89 |
28 May 04 |
peter |
47 |
class InputRanker |
89 |
28 May 04 |
peter |
48 |
{ |
420 |
02 Dec 05 |
jari |
49 |
|
89 |
28 May 04 |
peter |
50 |
public: |
89 |
28 May 04 |
peter |
51 |
/// |
134 |
16 Aug 04 |
peter |
/// Constructor taking data, target, a Score |
108 |
16 Jun 04 |
peter |
/// object and vector defining what samples to use (default is to |
108 |
16 Jun 04 |
peter |
/// use all samples) |
89 |
28 May 04 |
peter |
55 |
/// |
4200 |
19 Aug 22 |
peter |
56 |
InputRanker(const MatrixLookup&, const Target&, const statistics::Score&); |
89 |
28 May 04 |
peter |
57 |
|
89 |
28 May 04 |
peter |
58 |
/// |
624 |
05 Sep 06 |
peter |
/// Constructor taking data, target, a Score |
624 |
05 Sep 06 |
peter |
/// object and vector defining what samples to use (default is to |
624 |
05 Sep 06 |
peter |
/// use all samples) |
624 |
05 Sep 06 |
peter |
62 |
/// |
4200 |
19 Aug 22 |
peter |
63 |
InputRanker(const MatrixLookupWeighted&, const Target&, |
4200 |
19 Aug 22 |
peter |
64 |
const statistics::Score&); |
624 |
05 Sep 06 |
peter |
65 |
|
624 |
05 Sep 06 |
peter |
66 |
/// |
150 |
09 Sep 04 |
peter |
/// highest ranked gene is ranked as number zero @return id |
150 |
09 Sep 04 |
peter |
/// (index) of input ranked as number \a i |
89 |
28 May 04 |
peter |
69 |
/// |
720 |
26 Dec 06 |
jari |
70 |
const std::vector<size_t>& id(void) const; |
420 |
02 Dec 05 |
jari |
71 |
|
89 |
28 May 04 |
peter |
72 |
/// |
150 |
09 Sep 04 |
peter |
/// highest ranked gene is ranked as number zero @return rank for |
665 |
05 Oct 06 |
peter |
/// id (row) \a i |
89 |
28 May 04 |
peter |
75 |
/// |
720 |
26 Dec 06 |
jari |
76 |
const std::vector<size_t>& rank(void) const; |
89 |
28 May 04 |
peter |
77 |
|
665 |
05 Oct 06 |
peter |
78 |
/// |
1085 |
13 Feb 08 |
peter |
/// @param rank should be a number in range [0,N-1] where N is number |
665 |
05 Oct 06 |
peter |
/// of inputs in data matrix. "score(0)" will gives the score of |
4200 |
19 Aug 22 |
peter |
/// the feature that had the highest score. |
665 |
05 Oct 06 |
peter |
82 |
/// |
929 |
03 Oct 07 |
peter |
/// @return score of the input that has been been ranked as |
665 |
05 Oct 06 |
peter |
/// number @a rank. |
665 |
05 Oct 06 |
peter |
85 |
/// |
720 |
26 Dec 06 |
jari |
86 |
double score(size_t rank) const; |
89 |
28 May 04 |
peter |
87 |
|
89 |
28 May 04 |
peter |
88 |
private: |
89 |
28 May 04 |
peter |
89 |
std::vector<size_t> id_; |
89 |
28 May 04 |
peter |
90 |
std::vector<size_t> rank_; |
665 |
05 Oct 06 |
peter |
91 |
std::vector<double> score_; |
89 |
28 May 04 |
peter |
92 |
}; |
89 |
28 May 04 |
peter |
93 |
|
420 |
02 Dec 05 |
jari |
94 |
|
680 |
11 Oct 06 |
jari |
95 |
}}} // of namespace classifier, yat, and theplu |
89 |
28 May 04 |
peter |
96 |
|
89 |
28 May 04 |
peter |
97 |
#endif |