source: trunk/yat/classifier/SupervisedClassifier.h @ 722

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

Closes #129

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.3 KB
Line 
1#ifndef _theplu_yat_classifier_supervisedclassifier_
2#define _theplu_yat_classifier_supervisedclassifier_
3
4// $Id$
5
6/*
7  Copyright (C) The authors contributing to this file.
8
9  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include <stddef.h>
28
29namespace theplu {
30namespace yat {
31
32  namespace utility {
33    class matrix;
34  }
35
36namespace classifier { 
37
38  class DataLookup2D;
39  class Target;
40
41  ///
42  /// Interface class for supervised classifiers
43  ///
44
45  class SupervisedClassifier
46  {
47   
48  public:
49    ///
50    /// @brief Constructor taking a Target object.
51    ///
52    SupervisedClassifier(const Target&);
53   
54
55    ///
56    /// @brief Destructor
57    ///
58    virtual ~SupervisedClassifier(void);
59
60    ///
61    /// @brief Access to the training data
62    ///
63    virtual const DataLookup2D& data(void) const =0;
64
65
66    ///
67    /// An interface for making new classifier objects. This function
68    /// allows for specification at run-time of which classifier to
69    /// instatiate (see 'Prototype' in Design Patterns).
70    ///
71    /// @Note Returns a dynamically allocated SupervisedClassifier, which has
72    /// to be deleted by the caller to avoid memory leaks.
73    ///
74    virtual SupervisedClassifier* 
75    make_classifier(const DataLookup2D&, const Target&) const =0;
76   
77
78
79    ///
80    /// Generate output values for a data set
81    ///
82    virtual void predict(const DataLookup2D&, utility::matrix&) const =0;   
83
84
85    ///
86    /// Train the classifier.
87    ///
88    virtual bool train()=0;
89
90   
91  protected:
92   
93    /// Target to train on.
94    const Target& target_;
95    /// true if classifier successfully trained
96    bool trained_;
97   
98   
99  }; 
100 
101}}} // of namespace classifier, yat, and theplu
102
103#endif
Note: See TracBrowser for help on using the repository browser.