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

Last change on this file since 1437 was 1437, checked in by Peter, 13 years ago

merge patch release 0.4.2 to trunk. Delta 0.4.2-0.4.1

  • 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) 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 2 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 this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26  02111-1307, USA.
27*/
28
29#include <vector>
30
31namespace theplu {
32namespace yat {
33namespace statistics {
34  class Score;
35}
36namespace classifier { 
37
38  class MatrixLookup;
39  class MatrixLookupWeighted;
40  class Target;
41
42  ///
43  /// @brief Class for ranking rows in a matrix, using a Score and a
44  /// target vector.
45  ///   
46  class InputRanker
47  {
48
49  public:
50    ///
51    /// Constructor taking data, target, a Score
52    /// object and vector defining what samples to use (default is to
53    /// use all samples)
54    ///
55    InputRanker(const MatrixLookup&, const Target&, const statistics::Score&); 
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                const statistics::Score&); 
64
65    ///
66    /// highest ranked gene is ranked as number zero @return id
67    /// (index) of input ranked as number \a i
68    ///
69    const std::vector<size_t>& id(void) const;
70
71    ///
72    /// highest ranked gene is ranked as number zero @return rank for
73    /// id (row) \a i
74    ///
75    const std::vector<size_t>& rank(void) const;
76
77    ///
78    /// @param rank should be a number in range [0,N-1] where N is number
79    /// of inputs in data matrix. "score(0)" will gives the score of
80    /// the feature that had the highest score.
81    ///
82    /// @return score of the input that has been been ranked as
83    /// number @a rank.
84    ///
85    double score(size_t rank) const;
86
87  private:
88    std::vector<size_t> id_;
89    std::vector<size_t> rank_;
90    std::vector<double> score_;
91  };
92
93
94}}} // of namespace classifier, yat, and theplu
95
96#endif
Note: See TracBrowser for help on using the repository browser.