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

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

fixes #268 - remove return value in SupervisedClassifier::train()

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.4 KB
Line 
1#ifndef _theplu_yat_classifier_supervisedclassifier_
2#define _theplu_yat_classifier_supervisedclassifier_
3
4// $Id$
5
6/*
7  Copyright (C) 2005 Markus Ringnér
8  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér, Peter Johansson
9  Copyright (C) 2007 Peter Johansson
10
11  This file is part of the yat library, http://trac.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 <stddef.h>
30
31namespace theplu {
32namespace yat {
33
34  namespace utility {
35    class matrix;
36  }
37
38namespace classifier { 
39
40  class DataLookup2D;
41  class Target;
42
43  ///
44  /// @brief Interface class for supervised classifiers
45  ///
46
47  class SupervisedClassifier
48  {
49   
50  public:
51    ///
52    /// @brief Constructor taking a Target object.
53    ///
54    SupervisedClassifier(const Target&);
55   
56
57    ///
58    /// @brief Destructor
59    ///
60    virtual ~SupervisedClassifier(void);
61
62    ///
63    /// @brief Access to the training data
64    ///
65    virtual const DataLookup2D& data(void) const =0;
66
67
68    ///
69    /// An interface for making new classifier objects. This function
70    /// allows for specification at run-time of which classifier to
71    /// instatiate (see 'Prototype' in Design Patterns).
72    ///
73    /// @Note Returns a dynamically allocated SupervisedClassifier, which has
74    /// to be deleted by the caller to avoid memory leaks.
75    ///
76    virtual SupervisedClassifier* 
77    make_classifier(const DataLookup2D&, const Target&) const =0;
78   
79
80
81    ///
82    /// Generate output values for a data set
83    ///
84    virtual void predict(const DataLookup2D&, utility::matrix&) const =0;   
85
86
87    ///
88    /// Train the classifier.
89    ///
90    virtual void train()=0;
91
92   
93  protected:
94   
95    /// Target to train on.
96    const Target& target_;
97    /// true if classifier successfully trained
98    bool trained_;
99   
100   
101  }; 
102 
103}}} // of namespace classifier, yat, and theplu
104
105#endif
Note: See TracBrowser for help on using the repository browser.