LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiRecognitionRateOfSubset.h

00001 /*
00002  * Copyright (C) 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  * 
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public 
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.  
00021  */ 
00022 
00023  
00024 /*--------------------------------------------------------------------
00025  * project ....: LTI-Lib: Image Processing and Computer Vision Library
00026  * file .......: ltiRecognitionRateOfSubset.h
00027  * authors ....: Jens Paustenbach
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 22.10.2002
00030  * revisions ..: $Id: ltiRecognitionRateOfSubset.h,v 1.7 2006/02/07 18:23:14 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_RECOGNITION_RATE_OF_SUBSET_H_
00034 #define _LTI_RECOGNITION_RATE_OF_SUBSET_H_
00035 
00036 #include "ltiCostFunction.h"
00037 #include "ltiCrossValidator.h"
00038 
00039 namespace lti {
00040   /**
00041    *  Computes the average recognition rate of a given subset of features
00042    *  from a data set. A cross validation is performed on the given subset
00043    *  of features. The average recognition rate of the used classifier, 
00044    *  is returned as the value of this cost function.
00045    */
00046   class recognitionRateOfSubset : public costFunction {
00047   public:
00048     /**
00049      * the parameters for the class recognitionRateOfSubset
00050      */
00051     class parameters : public costFunction::parameters {
00052     public:
00053       /**
00054        * default constructor
00055        */
00056       parameters();
00057 
00058       /**
00059        * copy constructor
00060        * @param other the parameters object to be copied
00061        */
00062       parameters(const parameters& other);
00063 
00064       /**
00065        * destructor
00066        */
00067       ~parameters();
00068 
00069       /**
00070        * returns name of this type
00071        */
00072       const char* getTypeName() const;
00073 
00074       /**
00075        * copy the contents of a parameters object
00076        * @param other the parameters object to be copied
00077        * @return a reference to this parameters object
00078        */
00079       parameters& copy(const parameters& other);
00080    
00081       /**
00082        * copy the contents of a parameters object
00083        * @param other the parameters object to be copied
00084        * @return a reference to this parameters object
00085        */
00086       parameters& operator=(const parameters& other);
00087 
00088 
00089       /**
00090        * returns a pointer to a clone of the parameters
00091        */
00092       virtual functor::parameters* clone() const;
00093 
00094       /**
00095        * write the parameters in the given ioHandler
00096        * @param handler the ioHandler to be used
00097        * @param complete if true (the default) the enclosing begin/end will
00098        *        be also written, otherwise only the data block will be written.
00099        * @return true if write was successful
00100        */
00101       virtual bool write(ioHandler& handler,const bool complete=true) const;
00102 
00103       /**
00104        * read the parameters from the given ioHandler
00105        * @param handler the ioHandler to be used
00106        * @param complete if true (the default) the enclosing begin/end will
00107        *        be also written, otherwise only the data block will be written.
00108        * @return true if write was successful
00109        */
00110       virtual bool read(ioHandler& handler,const bool complete=true);
00111 
00112 #     ifdef _LTI_MSC_6     
00113       /**
00114        * this function is required by MSVC only, as a workaround for a
00115        * very awful bug, which exists since MSVC V.4.0, and still by
00116        * V.6.0 with all bugfixes (so called "service packs") remains
00117        * there...  This method is also public due to another bug, so please
00118        * NEVER EVER call this method directly: use read() instead
00119        */
00120       bool readMS(ioHandler& handler,const bool complete=true);
00121 
00122       /**
00123        * this function is required by MSVC only, as a workaround for a
00124        * very awful bug, which exists since MSVC V.4.0, and still by
00125        * V.6.0 with all bugfixes (so called "service packs") remains
00126        * there...  This method is also public due to another bug, so please
00127        * NEVER EVER call this method directly: use write() instead
00128        */
00129       bool writeMS(ioHandler& handler,const bool complete=true) const;
00130 #     endif
00131 
00132       // ------------------------------------------------
00133       // the parameters
00134       // ------------------------------------------------
00135       
00136       /**
00137        * parameters class used for the internal cross validator
00138        */
00139       crossValidator::parameters cvParameter;
00140 
00141     };
00142 
00143     /**
00144      * default constructor
00145      */
00146     recognitionRateOfSubset();
00147 
00148 //     /**
00149 //      * 
00150 //      */
00151 //     recognitionRateOfSubset(const dmatrix& src,const ivector& srcIds);
00152 
00153     /**
00154      * copy constructor
00155      * @param other the object to be copied
00156      */
00157     recognitionRateOfSubset(const recognitionRateOfSubset& other);
00158 
00159     /**
00160      * destructor
00161      */
00162     virtual ~recognitionRateOfSubset();
00163 
00164     /**
00165      * returns the name of this type ("recognitionRateOfSubset")
00166      */
00167     virtual const char* getTypeName() const;
00168   
00169     /**
00170      * Set the src data, that is used in applies. This must be done before 
00171      * you call one of the apply methods. Later each feature can be adressed 
00172      * by its column number.
00173      */
00174     virtual void setSrc(const dmatrix& src, const ivector& srcIds);
00175 
00176     /**
00177      * computes the average recognition rate of the given feature subset
00178      * using cross validation
00179      * @param in std::list with the features that are included in this test.
00180      * @param value the resulting average recognition rate
00181      * @return true if apply successful or false otherwise.
00182      */
00183     virtual bool apply(const std::list<int>& in,double& value);
00184 
00185     /**
00186      * copy data of "other" functor.
00187      * @param other the functor to be copied
00188      * @return a reference to this functor object
00189      */
00190     recognitionRateOfSubset& copy(const recognitionRateOfSubset& other);
00191 
00192     /**
00193      * alias for copy member
00194      * @param other the functor to be copied
00195      * @return a reference to this functor object
00196      */
00197     recognitionRateOfSubset& operator=(const recognitionRateOfSubset& other);
00198 
00199     /**
00200      * returns a pointer to a clone of this functor.
00201      */
00202     virtual functor* clone() const;
00203 
00204     /**
00205      * returns used parameters
00206      */
00207     const parameters& getParameters() const;
00208 
00209   };
00210 }
00211 
00212 #endif

Generated on Sat Apr 10 15:26:03 2010 for LTI-Lib by Doxygen 1.6.1