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

Last change on this file since 2986 was 2986, checked in by Peter, 10 years ago

merge 0.10-stable branch into trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.5 KB
Line 
1#ifndef _theplu_yat_classifier_inputranker_
2#define _theplu_yat_classifier_inputranker_
3
4// $Id$
5
6/*
7  Copyright (C) 2004 Peter Johansson
8  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2013 Jari Häkkinen
10
11  This file is part of the yat library, http://dev.thep.lu.se/yat
12
13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 3 of the
16  License, or (at your option) any later version.
17
18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with yat. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#include <cstddef>
28#include <vector>
29
30namespace theplu {
31namespace yat {
32namespace statistics {
33  class Score;
34}
35namespace classifier { 
36
37  class MatrixLookup;
38  class MatrixLookupWeighted;
39  class Target;
40
41  ///
42  /// @brief 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&, const statistics::Score&); 
55
56    ///
57    /// Constructor taking data, target, a Score
58    /// object and vector defining what samples to use (default is to
59    /// use all samples)
60    ///
61    InputRanker(const MatrixLookupWeighted&, const Target&, 
62                const statistics::Score&); 
63
64    ///
65    /// highest ranked gene is ranked as number zero @return id
66    /// (index) of input ranked as number \a i
67    ///
68    const std::vector<size_t>& id(void) const;
69
70    ///
71    /// highest ranked gene is ranked as number zero @return rank for
72    /// id (row) \a i
73    ///
74    const std::vector<size_t>& rank(void) const;
75
76    ///
77    /// @param rank should be a number in range [0,N-1] where N is number
78    /// of inputs in data matrix. "score(0)" will gives the score of
79    /// the feature that had the highest score.
80    ///
81    /// @return score of the input that has been been ranked as
82    /// number @a rank.
83    ///
84    double score(size_t rank) const;
85
86  private:
87    std::vector<size_t> id_;
88    std::vector<size_t> rank_;
89    std::vector<double> score_;
90  };
91
92
93}}} // of namespace classifier, yat, and theplu
94
95#endif
Note: See TracBrowser for help on using the repository browser.