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

ltiCrispDecisionTree.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 .......: ltiCrispDecisionTree.h
00027  * authors ....: Peter Doerfler
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 20.2.2002
00030  * revisions ..: $Id: ltiCrispDecisionTree.h,v 1.6 2006/02/07 18:15:54 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_CRISP_DECISION_TREE_H_
00034 #define _LTI_CRISP_DECISION_TREE_H_
00035 
00036 
00037 #include "ltiMatrix.h"
00038 #include "ltiVector.h"
00039 #include "ltiObjectFactory.h"
00040 
00041 #include "ltiDecisionTree.h"
00042 
00043 namespace lti {
00044   /**
00045    * Base class for all crisp decision trees. A crisp decision tree
00046    * has the following properties:
00047    * <ul>
00048    * <li> Each node has zero, one or two children.</li>
00049    * <li> Propagation of a %vector results in one (or zero) leaf nodes
00050    *      being activated</li>
00051    * <li> The exact type of the node as well as the condition in the
00052    *      decision function can be chosen for each node individually.</li>
00053    * </ul>
00054    */
00055   class crispDecisionTree : public decisionTree {
00056   public:
00057     /**
00058      * the parameters for the class crispDecisionTree
00059      */
00060     class parameters : public decisionTree::parameters {
00061     public:
00062       /**
00063        * default constructor
00064        */
00065       parameters();
00066 
00067       /**
00068        * copy constructor
00069        * @param other the parameters object to be copied
00070        */
00071       parameters(const parameters& other);
00072 
00073       /**
00074        * destructor
00075        */
00076       ~parameters();
00077 
00078       /**
00079        * returns name of this type
00080        */
00081       const char* getTypeName() const;
00082 
00083       /**
00084        * copy the contents of a parameters object
00085        * @param other the parameters object to be copied
00086        * @return a reference to this parameters object
00087        */
00088       parameters& copy(const parameters& other);
00089 
00090       /**
00091        * copy the contents of a parameters object
00092        * @param other the parameters object to be copied
00093        * @return a reference to this parameters object
00094        */
00095       parameters& operator=(const parameters& other);
00096 
00097 
00098       /**
00099        * returns a pointer to a clone of the parameters
00100        */
00101       virtual classifier::parameters* clone() const;
00102 
00103       /**
00104        * write the parameters in 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 write(ioHandler& handler,const bool complete=true) const;
00111 
00112       /**
00113        * read the parameters from the given ioHandler
00114        * @param handler the ioHandler to be used
00115        * @param complete if true (the default) the enclosing begin/end will
00116        *        be also written, otherwise only the data block will be written.
00117        * @return true if write was successful
00118        */
00119       virtual bool read(ioHandler& handler,const bool complete=true);
00120 
00121 #     ifdef _LTI_MSC_6
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 read() instead
00128        */
00129       bool readMS(ioHandler& handler,const bool complete=true);
00130 
00131       /**
00132        * this function is required by MSVC only, as a workaround for a
00133        * very awful bug, which exists since MSVC V.4.0, and still by
00134        * V.6.0 with all bugfixes (so called "service packs") remains
00135        * there...  This method is also public due to another bug, so please
00136        * NEVER EVER call this method directly: use write() instead
00137        */
00138       bool writeMS(ioHandler& handler,const bool complete=true) const;
00139 #     endif
00140 
00141       // ------------------------------------------------
00142       // the parameters
00143       // ------------------------------------------------
00144 
00145       //TODO: comment the parameters of your classifier
00146       // If you add more parameters manually, do not forget to do following:
00147       // 1. indicate in the default constructor the default values
00148       // 2. make sure that the copy member also copy your new parameters
00149       // 3. make sure that the read and write members also read and
00150       //    write your parameters
00151 
00152 
00153     };
00154 
00155     /**
00156      * Base class for decision functions of crispNode. The decision
00157      * function implements a condition which can either be true or
00158      * false. Usually in the tree, the left node will represent true
00159      * and the right node false.
00160      */
00161     class crispDecisionFunction : public ioObject {
00162     public:
00163       /**
00164        * default constructor
00165        */
00166       crispDecisionFunction();
00167 
00168       /**
00169        * copy constructor
00170        * @param other the crispDecisionFunction object to be copied
00171        */
00172       crispDecisionFunction(const crispDecisionFunction& other);
00173 
00174       /**
00175        * destructor
00176        */
00177       ~crispDecisionFunction();
00178 
00179       /**
00180        * returns name of this type
00181        */
00182       const char* getTypeName() const;
00183 
00184       /**
00185        * copy the contents of a crispDecisionFunction object
00186        * @param other the crispDecisionFunction object to be copied
00187        * @return a reference to this crispDecisionFunction object
00188        */
00189       crispDecisionFunction& copy(const crispDecisionFunction& other);
00190 
00191       /**
00192        * copy the contents of a crispDecisionFunction object
00193        * @param other the crispDecisionFunction object to be copied
00194        * @return a reference to this crispDecisionFunction object
00195        */
00196       crispDecisionFunction& operator=(const crispDecisionFunction& other);
00197 
00198       /**
00199        * returns a pointer to a clone of the crispDecisionFunction
00200        */
00201       virtual crispDecisionFunction* clone() const=0;
00202 
00203       /**
00204        * Evaluate the condition implemented in the cdf.
00205        * @param data value to be evaluated
00206        * @return true if it meets the condition (left), false if not
00207        */
00208       virtual bool apply(const dvector& data) const=0;
00209 
00210       /**
00211        * write the crispDecisionFunction in the given ioHandler
00212        * @param handler the ioHandler to be used
00213        * @param complete if true (the default) the enclosing begin/end will
00214        *        be also written, otherwise only the data block will be written.
00215        * @return true if write was successful
00216        */
00217       virtual bool write(ioHandler& handler,const bool complete=true) const;
00218 
00219       /**
00220        * read the crispDecisionFunction from the given ioHandler
00221        * @param handler the ioHandler to be used
00222        * @param complete if true (the default) the enclosing begin/end will
00223        *        be also written, otherwise only the data block will be written.
00224        * @return true if write was successful
00225        */
00226       virtual bool read(ioHandler& handler,const bool complete=true);
00227 
00228 #     ifdef _LTI_MSC_6
00229       /**
00230        * this function is required by MSVC only, as a workaround for a
00231        * very awful bug, which exists since MSVC V.4.0, and still by
00232        * V.6.0 with all bugfixes (so called "service packs") remains
00233        * there...  This method is public due to another bug!, so please
00234        * NEVER EVER call this method directly
00235        */
00236       bool readMS(ioHandler& handler,const bool complete=true);
00237 
00238       /**
00239        * this function is required by MSVC only, as a workaround for a
00240        * very awful bug, which exists since MSVC V.4.0, and still by
00241        * V.6.0 with all bugfixes (so called "service packs") remains
00242        * there...  This method is public due to another bug!, so please
00243        * NEVER EVER call this method directly
00244        */
00245       bool writeMS(ioHandler& handler,const bool complete=true) const;
00246 #     endif
00247 
00248       // ------------------------------------------------
00249       // the crispDecisionFunction
00250       // ------------------------------------------------
00251 
00252       //TODO: comment the crispDecisionFunction of your DT
00253       // If you add more crispDecisionFunction manually, do not forget to do following:
00254       // 1. indicate in the default constructor the default values
00255       // 2. make sure that the copy member also copy your new crispDecisionFunction
00256       // 3. make sure that the read and write members also read and
00257       //    write your crispDecisionFunction
00258 
00259     };
00260 
00261     /**
00262      * This class implements the most common decision function: Each
00263      * node has a real-valued threshold in one dimension only.
00264      */
00265     class univariateCrispDecisionFunction : public crispDecisionFunction {
00266     public:
00267       /**
00268        * default constructor
00269        */
00270       univariateCrispDecisionFunction();
00271 
00272       /**
00273        * Sets the condition of the decision function.
00274        * @param dim dimension for the decision
00275        * @param thresh the threshold
00276        */
00277       univariateCrispDecisionFunction(const int& dim,
00278                                       const double& thresh);
00279 
00280       /**
00281        * copy constructor
00282        * @param other the univariateCrispDecisionFunction object to be copied
00283        */
00284       univariateCrispDecisionFunction
00285         (const univariateCrispDecisionFunction& other);
00286 
00287       /**
00288        * destructor
00289        */
00290       ~univariateCrispDecisionFunction();
00291 
00292       /**
00293        * returns name of this type
00294        */
00295       const char* getTypeName() const;
00296 
00297       /**
00298        * copy the contents of a univariateCrispDecisionFunction object
00299        * @param other the univariateCrispDecisionFunction object to be copied
00300        * @return a reference to this univariateCrispDecisionFunction object
00301        */
00302       univariateCrispDecisionFunction& copy
00303         (const univariateCrispDecisionFunction& other);
00304 
00305       /**
00306        * copy the contents of a univariateCrispDecisionFunction object
00307        * @param other the univariateCrispDecisionFunction object to be copied
00308        * @return a reference to this univariateCrispDecisionFunction object
00309        */
00310       univariateCrispDecisionFunction& operator=
00311         (const univariateCrispDecisionFunction& other);
00312 
00313       /**
00314        * returns a pointer to a clone of the univariateCrispDecisionFunction
00315        */
00316       virtual crispDecisionFunction* clone() const;
00317 
00318       /**
00319        * Evaluate the condition implemented in the cdf.
00320        * @param data value to be evaluated
00321        * @return true if it meets the condition (left), false if not
00322        */
00323       virtual bool apply(const dvector& data) const;
00324 
00325       /**
00326        * Sets the condition to be tested.
00327        * @param dim the dimension to be tested.
00328        * @param thresh the threshold in that dimension
00329        */
00330       void setCondition(const int& dim, const double& thresh);
00331 
00332       /**
00333        * write the univariateCrispDecisionFunction in the given ioHandler
00334        * @param handler the ioHandler to be used
00335        * @param complete if true (the default) the enclosing begin/end will
00336        *        be also written, otherwise only the data block will be written.
00337        * @return true if write was successful
00338        */
00339       virtual bool write(ioHandler& handler,const bool complete=true) const;
00340 
00341       /**
00342        * read the univariateCrispDecisionFunction from the given ioHandler
00343        * @param handler the ioHandler to be used
00344        * @param complete if true (the default) the enclosing begin/end will
00345        *        be also written, otherwise only the data block will be written.
00346        * @return true if write was successful
00347        */
00348       virtual bool read(ioHandler& handler,const bool complete=true);
00349 
00350 #     ifdef _LTI_MSC_6
00351       /**
00352        * this function is required by MSVC only, as a workaround for a
00353        * very awful bug, which exists since MSVC V.4.0, and still by
00354        * V.6.0 with all bugfixes (so called "service packs") remains
00355        * there...  This method is also public due to another bug, so please
00356        * NEVER EVER call this method directly: use read() instead
00357        */
00358       bool readMS(ioHandler& handler,const bool complete=true);
00359 
00360       /**
00361        * this function is required by MSVC only, as a workaround for a
00362        * very awful bug, which exists since MSVC V.4.0, and still by
00363        * V.6.0 with all bugfixes (so called "service packs") remains
00364        * there...  This method is also public due to another bug, so please
00365        * NEVER EVER call this method directly: use write() instead
00366        */
00367       bool writeMS(ioHandler& handler,const bool complete=true) const;
00368 #     endif
00369 
00370       // ------------------------------------------------
00371       // the univariateCrispDecisionFunction
00372       // ------------------------------------------------
00373 
00374       //TODO: comment the univariateCrispDecisionFunction of your DT
00375       // If you add more univariateCrispDecisionFunction manually, do not forget to do following:
00376       // 1. indicate in the default constructor the default values
00377       // 2. make sure that the copy member also copy your new univariateCrispDecisionFunction
00378       // 3. make sure that the read and write members also read and
00379       //    write your univariateCrispDecisionFunction
00380 
00381     protected:
00382 
00383       /**
00384        * The dimension to be tested
00385        */
00386       int dimension;
00387 
00388       /**
00389        * Threshold against which the data is tested in the given dimension.
00390        */
00391       double threshold;
00392 
00393     };
00394 
00395     /**
00396      * This class implements a multivariate decision. The apply method is
00397      * true, if the following condition is met.<p>
00398      * \f$\mathbf{x}\cdot\mathbf{a} < c \f$ with \f$\mathbf{x}\f$ the data,
00399      * \f$\mathbf{a}\f$ a weighting vector and \f$c\f$ the threshold.<p>
00400      * Thus, each node performs an arbitrary linear seperation of the
00401      * remaining feature space.
00402      */
00403     class multivariateCrispDecisionFunction : public crispDecisionFunction {
00404     public:
00405       /**
00406        * default constructor
00407        */
00408       multivariateCrispDecisionFunction();
00409 
00410       /**
00411        * New decision function with the given parameters.
00412        * @param w the weighting vector for the data.
00413        * @param thresh the threshold for the weighted sum
00414        */
00415       multivariateCrispDecisionFunction(const dvector& w,
00416                                         const double& thresh);
00417 
00418       /**
00419        * copy constructor
00420        * @param other the multivariateCrispDecisionFunction object to be copied
00421        */
00422       multivariateCrispDecisionFunction
00423         (const multivariateCrispDecisionFunction& other);
00424 
00425       /**
00426        * destructor
00427        */
00428       ~multivariateCrispDecisionFunction();
00429 
00430       /**
00431        * returns name of this type
00432        */
00433       const char* getTypeName() const;
00434 
00435       /**
00436        * copy the contents of a multivariateCrispDecisionFunction object
00437        * @param other the multivariateCrispDecisionFunction object to be copied
00438        * @return a reference to this multivariateCrispDecisionFunction object
00439        */
00440       multivariateCrispDecisionFunction& copy
00441         (const multivariateCrispDecisionFunction& other);
00442 
00443       /**
00444        * copy the contents of a multivariateCrispDecisionFunction object
00445        * @param other the multivariateCrispDecisionFunction object to be copied
00446        * @return a reference to this multivariateCrispDecisionFunction object
00447        */
00448       multivariateCrispDecisionFunction& operator=
00449         (const multivariateCrispDecisionFunction& other);
00450 
00451       /**
00452        * returns a pointer to a clone of the multivariateCrispDecisionFunction
00453        */
00454       virtual crispDecisionFunction* clone() const;
00455 
00456       /**
00457        * Evaluate the condition implemented in the cdf.
00458        * @param data value to be evaluated
00459        * @return true if it meets the condition (left), false if not
00460        */
00461       virtual bool apply(const dvector& data) const;
00462 
00463       /**
00464        * Sets the condition to be tested.
00465        * @param w the weighting vector for the data.
00466        * @param thresh the threshold for the weightes sum
00467        */
00468       void setCondition(const dvector& w, const double& thresh);
00469 
00470       /**
00471        * write the multivariateCrispDecisionFunction in the given ioHandler
00472        * @param handler the ioHandler to be used
00473        * @param complete if true (the default) the enclosing begin/end will
00474        *        be also written, otherwise only the data block will be written.
00475        * @return true if write was successful
00476        */
00477       virtual bool write(ioHandler& handler,const bool complete=true) const;
00478 
00479       /**
00480        * read the multivariateCrispDecisionFunction from the given ioHandler
00481        * @param handler the ioHandler to be used
00482        * @param complete if true (the default) the enclosing begin/end will
00483        *        be also written, otherwise only the data block will be written.
00484        * @return true if write was successful
00485        */
00486       virtual bool read(ioHandler& handler,const bool complete=true);
00487 
00488 #     ifdef _LTI_MSC_6
00489       /**
00490        * this function is required by MSVC only, as a workaround for a
00491        * very awful bug, which exists since MSVC V.4.0, and still by
00492        * V.6.0 with all bugfixes (so called "service packs") remains
00493        * there...  This method is also public due to another bug, so please
00494        * NEVER EVER call this method directly: use read() instead
00495        */
00496       bool readMS(ioHandler& handler,const bool complete=true);
00497 
00498       /**
00499        * this function is required by MSVC only, as a workaround for a
00500        * very awful bug, which exists since MSVC V.4.0, and still by
00501        * V.6.0 with all bugfixes (so called "service packs") remains
00502        * there...  This method is also public due to another bug, so please
00503        * NEVER EVER call this method directly: use write() instead
00504        */
00505       bool writeMS(ioHandler& handler,const bool complete=true) const;
00506 #     endif
00507 
00508       // ------------------------------------------------
00509       // the multivariateCrispDecisionFunction
00510       // ------------------------------------------------
00511 
00512       //TODO: comment the multivariateCrispDecisionFunction of your DT
00513       // If you add more multivariateCrispDecisionFunction manually, do not forget to do following:
00514       // 1. indicate in the default constructor the default values
00515       // 2. make sure that the copy member also copy your new multivariateCrispDecisionFunction
00516       // 3. make sure that the read and write members also read and
00517       //    write your multivariateCrispDecisionFunction
00518 
00519     protected:
00520 
00521       /**
00522        * the weighting vector
00523        */
00524       dvector weights;
00525 
00526       /**
00527        * Threshold against which the data is tested in the given dimension.
00528        */
00529       double threshold;
00530 
00531     };
00532 
00533 
00534     /**
00535      * A crisp decision tree node. Its main difference to the dtNode is
00536      * that it contains a crispDecisionFunction. The propagate method uses
00537      * this function to determine which child node to return: left node if
00538      * the condition is true, right node if it is false.
00539      */
00540     class crispNode : public decisionTree::dtNode {
00541     public:
00542       /**
00543        * default constructor
00544        */
00545       crispNode();
00546 
00547       /**
00548        * Constructor. Sets the nodes id.
00549        * @param theId the nodes id
00550        */
00551       crispNode(const int& theId);
00552 
00553       /**
00554        * Conveniance Constructor. New node with
00555        * univariateCrispDecisionFunction with the given parameters.
00556        * @param dim the dimension to be tested.
00557        * @param thresh the threshold in that dimension
00558        * @param theId the nodes id
00559        */
00560       crispNode(const int& dim, const double& thresh, const int& theId=-1);
00561 
00562       /**
00563        * Conveniance Constructor. New node with
00564        * multivariateCrispDecisionFunction with the given parameters.
00565        * @param w the weighting vector for the data.
00566        * @param thresh the threshold.
00567        * @param theId the nodes id
00568        */
00569       crispNode(const dvector& w, const double& thresh, const int& theId=-1);
00570 
00571 
00572       /**
00573        * copy constructor
00574        * @param other the crispNode object to be copied
00575        */
00576       crispNode(const crispNode& other);
00577 
00578       /**
00579        * destructor
00580        */
00581       ~crispNode();
00582 
00583       /**
00584        * returns name of this type
00585        */
00586       const char* getTypeName() const;
00587 
00588       /**
00589        * copy the contents of a crispNode object
00590        * @param other the crispNode object to be copied
00591        * @return a reference to this crispNode object
00592        */
00593       crispNode& copy(const crispNode& other);
00594 
00595       /**
00596        * copy the contents of a crispNode object
00597        * @param other the crispNode object to be copied
00598        * @return a reference to this crispNode object
00599        */
00600       crispNode& operator=(const crispNode& other);
00601 
00602 
00603       /**
00604        * returns a pointer to a clone of the crispNode
00605        */
00606       virtual decisionTree::dtNode* clone() const;
00607 
00608       /**
00609        * Sets the crispDecisionFunction for this node
00610        * @param cdf the new %crispDecisionFunction
00611        */
00612       void setDecisionFunction(const crispDecisionFunction* cdf);
00613 
00614       /**
00615        * Gets the crispDecisionFunction this node uses.
00616        * @returns const pointer to the %crispDecisionFunction
00617        */
00618       const crispDecisionFunction*
00619       getDecisionFunction(const crispDecisionFunction* cdf);
00620 
00621       /**
00622        * Propagates the given value through the node. If the
00623        * crispDecisionFunction is true for this value, the left
00624        * child node is returned, else the right.
00625        * @param data value to be propagated
00626        * @returns left or right child node
00627        */
00628       const crispNode* propagate(const dvector& data) const;
00629 
00630       /**
00631        * write the crispNode in the given ioHandler
00632        * @param handler the ioHandler to be used
00633        * @param complete if true (the default) the enclosing begin/end will
00634        *        be also written, otherwise only the data block will be written.
00635        * @return true if write was successful
00636        */
00637       virtual bool write(ioHandler& handler,const bool complete=true) const;
00638 
00639       /**
00640        * read the crispNode from the given ioHandler
00641        * @param handler the ioHandler to be used
00642        * @param complete if true (the default) the enclosing begin/end will
00643        *        be also written, otherwise only the data block will be written.
00644        * @return true if write was successful
00645        */
00646       virtual bool read(ioHandler& handler,const bool complete=true);
00647 
00648 #     ifdef _LTI_MSC_6
00649       /**
00650        * this function is required by MSVC only, as a workaround for a
00651        * very awful bug, which exists since MSVC V.4.0, and still by
00652        * V.6.0 with all bugfixes (so called "service packs") remains
00653        * there...  This method is also public due to another bug, so please
00654        * NEVER EVER call this method directly: use read() instead
00655        */
00656       bool readMS(ioHandler& handler,const bool complete=true);
00657 
00658       /**
00659        * this function is required by MSVC only, as a workaround for a
00660        * very awful bug, which exists since MSVC V.4.0, and still by
00661        * V.6.0 with all bugfixes (so called "service packs") remains
00662        * there...  This method is also public due to another bug, so please
00663        * NEVER EVER call this method directly: use write() instead
00664        */
00665       bool writeMS(ioHandler& handler,const bool complete=true) const;
00666 #     endif
00667 
00668       // ------------------------------------------------
00669       // the crispNode
00670       // ------------------------------------------------
00671 
00672     protected:
00673 
00674       /**
00675        * The objectFactory for all crispDecisionFunctions.
00676        */
00677       static const objectFactory<crispDecisionFunction>
00678       crispDecisionFunctionFactory;
00679 
00680       /**
00681        * The array of all crispDecisionFunctions.
00682        */
00683       static const crispDecisionFunction* cdfArray[];
00684 
00685       /**
00686        * The crispDecisionFunction used for this node
00687        */
00688       crispDecisionFunction* decisionF;
00689 
00690     };
00691 
00692 
00693     /**
00694      * default constructor
00695      */
00696     crispDecisionTree();
00697 
00698     /**
00699      * copy constructor
00700      * @param other the object to be copied
00701      */
00702     crispDecisionTree(const crispDecisionTree& other);
00703 
00704     /**
00705      * destructor
00706      */
00707     virtual ~crispDecisionTree();
00708 
00709     /**
00710      * returns the name of this type ("crispDecisionTree")
00711      */
00712     virtual const char* getTypeName() const;
00713 
00714     /**
00715      * copy data of "other" classifier.
00716      * @param other the classifier to be copied
00717      * @return a reference to this functor object
00718      */
00719     crispDecisionTree& copy(const crispDecisionTree& other);
00720 
00721     /**
00722      * alias for copy member
00723      * @param other the classifier to be copied
00724      * @return a reference to this classifier object
00725      */
00726     crispDecisionTree& operator=(const crispDecisionTree& other);
00727 
00728     /**
00729      * returns used parameters
00730      */
00731     const parameters& getParameters() const;
00732 
00733     /**
00734      * Classification.
00735      * Classifies the feature and returns the outputVector with
00736      * the classification result.
00737      * @param feature the %vector to be classified
00738      * @param result the result of the classification
00739      * @return false if an error occurred during classification else true
00740      */
00741     virtual bool
00742       classify(const dvector& feature, outputVector& result) const;
00743 
00744     /**
00745      * write the parameters in the given ioHandler
00746      * @param handler the ioHandler to be used
00747      * @param complete if true (the default) the enclosing begin/end will
00748      *        be also written, otherwise only the data block will be written.
00749      * @return true if write was successful
00750      */
00751      virtual bool write(ioHandler& handler,const bool complete=true) const;
00752 
00753     /**
00754      * read the parameters from the given ioHandler
00755      * @param handler the ioHandler to be used
00756      * @param complete if true (the default) the enclosing begin/end will
00757      *        be also written, otherwise only the data block will be written.
00758      * @return true if write was successful
00759      */
00760     virtual bool read(ioHandler& handler,const bool complete=true);
00761 
00762   protected:
00763 
00764     crispNode* root;
00765 
00766   };
00767 }
00768 
00769 #endif

Generated on Sat Apr 10 15:25:18 2010 for LTI-Lib by Doxygen 1.6.1