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

Last change on this file since 1706 was 1487, checked in by Jari Häkkinen, 13 years ago

Addresses #436. GPL license copy reference should also be updated.

  • 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 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2008 Peter Johansson
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 <vector>
28
29namespace theplu {
30namespace yat {
31namespace statistics {
32  class Score;
33}
34namespace classifier { 
35
36  class MatrixLookup;
37  class MatrixLookupWeighted;
38  class Target;
39
40  ///
41  /// @brief Class for ranking rows in a matrix, using a Score and a
42  /// target vector.
43  ///   
44  class InputRanker
45  {
46
47  public:
48    ///
49    /// Constructor taking data, target, a Score
50    /// object and vector defining what samples to use (default is to
51    /// use all samples)
52    ///
53    InputRanker(const MatrixLookup&, const Target&, const statistics::Score&); 
54
55    ///
56    /// Constructor taking data, target, a Score
57    /// object and vector defining what samples to use (default is to
58    /// use all samples)
59    ///
60    InputRanker(const MatrixLookupWeighted&, const Target&, 
61                const statistics::Score&); 
62
63    ///
64    /// highest ranked gene is ranked as number zero @return id
65    /// (index) of input ranked as number \a i
66    ///
67    const std::vector<size_t>& id(void) const;
68
69    ///
70    /// highest ranked gene is ranked as number zero @return rank for
71    /// id (row) \a i
72    ///
73    const std::vector<size_t>& rank(void) const;
74
75    ///
76    /// @param rank should be a number in range [0,N-1] where N is number
77    /// of inputs in data matrix. "score(0)" will gives the score of
78    /// the feature that had the highest score.
79    ///
80    /// @return score of the input that has been been ranked as
81    /// number @a rank.
82    ///
83    double score(size_t rank) const;
84
85  private:
86    std::vector<size_t> id_;
87    std::vector<size_t> rank_;
88    std::vector<double> score_;
89  };
90
91
92}}} // of namespace classifier, yat, and theplu
93
94#endif
Note: See TracBrowser for help on using the repository browser.