Last change
on this file since 120 was
120,
checked in by Peter, 18 years ago
|
modified to handle weights
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.5 KB
|
Line | |
---|
1 | // $Id: InputRanker.h 120 2004-07-20 16:25:29Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_cpptools_inputranker_ |
---|
4 | #define _theplu_cpptools_inputranker_ |
---|
5 | |
---|
6 | // C++ tools include |
---|
7 | ///////////////////// |
---|
8 | #include "vector.h" |
---|
9 | #include "matrix.h" |
---|
10 | #include "Score.h" |
---|
11 | |
---|
12 | // Standard C++ includes |
---|
13 | //////////////////////// |
---|
14 | |
---|
15 | |
---|
16 | namespace theplu { |
---|
17 | namespace cpptools { |
---|
18 | /// |
---|
19 | /// Class for ranking the columns in a matrix, using a Score and a |
---|
20 | /// target vector. |
---|
21 | /// |
---|
22 | class InputRanker |
---|
23 | { |
---|
24 | |
---|
25 | public: |
---|
26 | /// |
---|
27 | /// Constructor taking data, target, pointer to a Score |
---|
28 | /// object and vector defining what samples to use (default is to |
---|
29 | /// use all samples) |
---|
30 | /// |
---|
31 | InputRanker(const gslapi::matrix&, |
---|
32 | const gslapi::vector&, |
---|
33 | Score&, |
---|
34 | const std::vector<size_t>& = std::vector<size_t>()); |
---|
35 | |
---|
36 | /// |
---|
37 | /// Constructor taking data, target, weight, pointer to a Score |
---|
38 | /// object and vector defining what samples to use (default is to |
---|
39 | /// use all samples) |
---|
40 | /// |
---|
41 | InputRanker(const gslapi::matrix&, |
---|
42 | const gslapi::vector&, |
---|
43 | const gslapi::matrix&, |
---|
44 | Score&, |
---|
45 | const std::vector<size_t>& = std::vector<size_t>()); |
---|
46 | |
---|
47 | /// |
---|
48 | /// @return id of input ranked as number i |
---|
49 | /// |
---|
50 | inline size_t id(const size_t i) const {return id_[i];} |
---|
51 | |
---|
52 | /// |
---|
53 | /// @return rank for id i |
---|
54 | /// |
---|
55 | inline size_t rank(const size_t i) const {return rank_[i];} |
---|
56 | |
---|
57 | |
---|
58 | private: |
---|
59 | std::vector<size_t> train_set_; |
---|
60 | std::vector<size_t> id_; |
---|
61 | std::vector<size_t> rank_; |
---|
62 | |
---|
63 | |
---|
64 | }; |
---|
65 | |
---|
66 | }} // of namespace cpptools and namespace theplu |
---|
67 | |
---|
68 | #endif |
---|
69 | |
---|
Note: See
TracBrowser
for help on using the repository browser.