1 | // $Id: ConsensusInputRanker.h 469 2005-12-19 14:58:29Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_classifier_consensusinputranker_ |
---|
4 | #define _theplu_classifier_consensusinputranker_ |
---|
5 | |
---|
6 | #include <c++_tools/classifier/InputRanker.h> |
---|
7 | |
---|
8 | namespace theplu { |
---|
9 | class statistics::Score; |
---|
10 | namespace classifier { |
---|
11 | |
---|
12 | class CrossSplitting; |
---|
13 | class DataView; |
---|
14 | class Target; |
---|
15 | |
---|
16 | /// |
---|
17 | /// Class for ranking rows in a data matrix versus a target vector |
---|
18 | /// in a cross validation manner. The rows are sorted with respect |
---|
19 | /// to median of their ranks. |
---|
20 | /// |
---|
21 | class ConsensusInputRanker |
---|
22 | { |
---|
23 | |
---|
24 | public: |
---|
25 | /// |
---|
26 | /// Constructor taking \a data, \a target, Score object. The |
---|
27 | /// constructor creates ranklists in a \a k fold crossvalidation |
---|
28 | /// manner, and in total there is \a n times \a k ranklists. |
---|
29 | /// |
---|
30 | ConsensusInputRanker(const DataView& data, |
---|
31 | const Target& target, |
---|
32 | statistics::Score&, CrossSplitting&, |
---|
33 | const size_t k = 3 ); |
---|
34 | |
---|
35 | /// |
---|
36 | /// Constructor taking \a data, \a target, \a weight and Score object. The |
---|
37 | /// constructor creates ranklists in a \a k fold crossvalidation |
---|
38 | /// manner, and in total there is \a n times \a k ranklists. |
---|
39 | /// |
---|
40 | ConsensusInputRanker(const DataView& data, |
---|
41 | const Target& target, |
---|
42 | const DataView& weight, |
---|
43 | statistics::Score&, |
---|
44 | CrossSplitting&, |
---|
45 | const size_t n = 1 ); |
---|
46 | |
---|
47 | /// |
---|
48 | /// Highest ranked row is ranked as number zero @return index of |
---|
49 | /// row ranked as number \a i |
---|
50 | /// |
---|
51 | inline size_t id(const size_t i) const {return id_[i];} |
---|
52 | |
---|
53 | /// |
---|
54 | /// Highest ranked row is ranked as number zero @return rank for |
---|
55 | /// row \a i |
---|
56 | /// |
---|
57 | inline size_t rank(const size_t i) const {return rank_[i];} |
---|
58 | |
---|
59 | |
---|
60 | private: |
---|
61 | std::vector<size_t> id_; |
---|
62 | std::vector<InputRanker> input_rankers_; |
---|
63 | u_int nof_rankers_; |
---|
64 | std::vector<size_t> rank_; |
---|
65 | }; |
---|
66 | |
---|
67 | }} // of namespace classifier and namespace theplu |
---|
68 | |
---|
69 | #endif |
---|
70 | |
---|