source: trunk/yat/classifier/InputRanker.h @ 680

Last change on this file since 680 was 680, checked in by Jari Häkkinen, 16 years ago

Addresses #153. Introduced yat namespace. Removed alignment namespace. Clean up of code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.6 KB
Line 
1#ifndef _theplu_yat_classifier_inputranker_
2#define _theplu_yat_classifier_inputranker_
3
4// $Id$
5
6/*
7  Copyright (C) The authors contributing to this file.
8
9  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include <vector>
28
29namespace theplu {
30namespace yat {
31namespace statistics {
32  class Score;
33}
34namespace classifier { 
35
36  class DataLookup2D;
37  class MatrixLookup;
38  class MatrixLookupWeighted;
39  class Target;
40
41  ///
42  /// Class for ranking rows in a matrix, using a Score and a
43  /// target vector.
44  ///   
45  class InputRanker
46  {
47
48  public:
49    ///
50    /// Constructor taking data, target, a Score
51    /// object and vector defining what samples to use (default is to
52    /// use all samples)
53    ///
54    InputRanker(const MatrixLookup&, const Target&, statistics::Score&); 
55
56
57    ///
58    /// Constructor taking data, target, a Score
59    /// object and vector defining what samples to use (default is to
60    /// use all samples)
61    ///
62    InputRanker(const MatrixLookupWeighted&, const Target&, 
63                statistics::Score&); 
64
65
66    ///
67    /// highest ranked gene is ranked as number zero @return id
68    /// (index) of input ranked as number \a i
69    ///
70    inline const std::vector<size_t>& id(void) const {return id_;}
71
72    ///
73    /// highest ranked gene is ranked as number zero @return rank for
74    /// id (row) \a i
75    ///
76    inline const std::vector<size_t>& rank(void) const {return rank_;}
77
78    ///
79    /// @param should be a number in range [0,N-1] where N is number
80    /// of inputs in data matrix. "score(0)" will gives the score of
81    /// the feature that had the highest score.
82    ///
83    /// @return score of the input that have been been ranked as
84    /// number @a rank.
85    ///
86    inline double score(size_t rank) const { return score_[rank]; }
87
88
89  private:
90    std::vector<size_t> id_;
91    std::vector<size_t> rank_;
92    std::vector<double> score_;
93  };
94
95
96}}} // of namespace classifier, yat, and theplu
97
98#endif
Note: See TracBrowser for help on using the repository browser.