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

Last change on this file since 676 was 675, checked in by Jari Häkkinen, 15 years ago

References #83. Changing project name to yat. Compilation will fail in this revision.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.1 KB
Line 
1#ifndef _theplu_classifier_supervisedclassifier_
2#define _theplu_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 {
30
31  namespace utility {
32    class matrix;
33  }
34
35namespace classifier { 
36
37  class DataLookup2D;
38  class Target;
39
40  ///
41  /// Interface class for supervised classifiers
42  ///
43
44  class SupervisedClassifier
45  {
46   
47  public:
48    ///
49    /// Constructor. Taking a Target object.
50    ///
51    SupervisedClassifier(const Target&);
52   
53
54    ///
55    /// Destructor
56    ///
57    virtual ~SupervisedClassifier();
58
59    ///
60    /// An interface for making new classifier objects. This function
61    /// allows for specification at run-time of which classifier to
62    /// instatiate (see 'Prototype' in Design Patterns).
63    ///
64    /// @Note Returns a dynamically allocated SupervisedClassifier, which has
65    /// to be deleted by the caller to avoid memory leaks.
66    ///
67    virtual SupervisedClassifier* 
68    make_classifier(const DataLookup2D&, const Target&) const =0;
69   
70
71    ///
72    /// Train the classifier.
73    ///
74    virtual bool train()=0;
75
76    ///
77    /// Generate output values for a data set
78    ///
79    virtual void predict(const DataLookup2D&, utility::matrix&) const =0;   
80
81   
82  protected:
83   
84    /// Target to train on.
85    const Target& target_;
86    /// true if classifier successfully trained
87    bool trained_;
88   
89   
90  }; 
91 
92}} // of namespace classifier and namespace theplu
93
94#endif
Note: See TracBrowser for help on using the repository browser.