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

Last change on this file since 592 was 592, checked in by Peter, 15 years ago

added random_shuffle function in Target class

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