source: trunk/c++_tools/classifier/SupervisedClassifier.h @ 593

Last change on this file since 593 was 593, checked in by Markus Ringnér, 15 years ago

Fixed std includes to compile with g++ 4.1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1// $Id: SupervisedClassifier.h 593 2006-08-25 12:59:21Z markus $
2
3#ifndef _theplu_classifier_supervisedclassifier_
4#define _theplu_classifier_supervisedclassifier_
5
6#include <stddef.h>
7
8namespace theplu {
9
10  namespace gslapi {
11    class vector;
12    class matrix;
13  }
14
15  namespace statistics {
16    class Score;
17  }
18
19
20namespace classifier { 
21
22  class CrossSplitter;
23  class DataLookup2D;
24  class InputRanker;
25  class Target;
26
27  ///
28  /// Interface class for supervised classifiers
29  ///
30
31  class SupervisedClassifier
32  {
33   
34  public:
35    ///
36    /// Constructor. Taking a Target object.
37    ///
38    SupervisedClassifier(const Target&);
39   
40
41    ///
42    /// Constructor. Taking a vector of target values, a score used to
43    /// rank data inputs, and the number of top ranked inputs to use
44    /// in classification.
45    ///
46    SupervisedClassifier(const Target&, statistics::Score*, const size_t);
47
48    ///
49    /// Destructor
50    ///
51    virtual ~SupervisedClassifier();
52
53    ///
54    /// An interface for making new classifier objects. This function
55    /// allows for specification at run-time of which classifier to
56    /// instatiate (see 'Prototype' in Design Patterns).
57    ///
58    /// @Note Returns a dynamically allocated SupervisedClassifier, which has
59    /// to be deleted by the caller to avoid memory leaks.
60    ///
61    virtual SupervisedClassifier* 
62    make_classifier(const CrossSplitter&) const =0;
63   
64
65    //
66    // Train the classifier.
67    //
68    virtual bool train()=0;
69
70    ///
71    /// Generate output values for a data set
72    ///
73    virtual void predict(const DataLookup2D&, gslapi::matrix&) const =0;   
74
75   
76  protected:
77   
78    const Target& target_;
79    statistics::Score* score_;
80    classifier::InputRanker* ranker_;
81    size_t nof_inputs_;
82    bool trained_;
83   
84   
85  }; 
86 
87}} // of namespace classifier and namespace theplu
88
89#endif
Note: See TracBrowser for help on using the repository browser.