ConvergenceTest.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: ConvergenceTest.h 29122 2009-06-22 06:51:30Z brun $
00002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : ConvergenceTest                                                             *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      Contains all the data information                                         *
00012  *                                                                                *
00013  * Authors (alphabetical):                                                        *
00014  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
00015  *      Peter Speckmayer <Peter.Speckmayer@cern.ch>  - CERN, Switzerland          *
00016  *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
00017  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
00018  *                                                                                *
00019  * Copyright (c) 2006:                                                            *
00020  *      CERN, Switzerland                                                         *
00021  *      U. of Victoria, Canada                                                    *
00022  *      MPI-K Heidelberg, Germany                                                 *
00023  *                                                                                *
00024  * Redistribution and use in source and binary forms, with or without             *
00025  * modification, are permitted according to the terms listed in LICENSE           *
00026  * (http://tmva.sourceforge.net/LICENSE)                                          *
00027  **********************************************************************************/
00028 
00029 #ifndef ROOT_TMVA_ConvergenceTest
00030 #define ROOT_TMVA_ConvergenceTest
00031 
00032 //////////////////////////////////////////////////////////////////////////
00033 //                                                                      //
00034 // ConvergenceTest                                                      //
00035 //                                                                      //
00036 // check for convergence                                                //
00037 //                                                                      //
00038 //////////////////////////////////////////////////////////////////////////
00039 
00040 #include <deque>
00041 
00042 #ifndef ROOT_Rtypes
00043 #include "Rtypes.h"
00044 #endif
00045 
00046 namespace TMVA {
00047    
00048    class ConvergenceTest {
00049 
00050    public:
00051       
00052       ConvergenceTest();
00053       ~ConvergenceTest();
00054 
00055       // setters
00056       void                       SetConvergenceParameters(  Int_t steps, Double_t improvement )  
00057                                                                   { fSteps = steps; fImprovement = improvement; }
00058       void                       SetCurrentValue(  Float_t value )  { fCurrentValue = value; }
00059       Float_t                    GetCurrentValue()                  { return fCurrentValue; }
00060       void                       ResetConvergenceCounter()  { fCounter = -1; fMaxCounter = 0; }
00061 
00062       // getters
00063       Bool_t                     HasConverged( Bool_t withinConvergenceBand = kFALSE );
00064       Float_t                    Progress();          // from 0 (just started) to 1 (finished)
00065       Float_t                    SpeedControl( UInt_t ofSteps );  
00066 
00067 
00068    protected:
00069 
00070       Float_t                    fCurrentValue;      //! current value
00071 
00072       Float_t                    fImprovement;       //! minimum improvement which counts as improvement
00073       Int_t                      fSteps;             //! number of steps without improvement required for convergence
00074 
00075    private:
00076       
00077       Int_t                      fCounter;           //! counts the number of steps without improvement 
00078       Float_t                    fConvValue;         //! the best "fitness" value
00079       Int_t                      fMaxCounter;        //! maximum value for the counter so far 
00080 
00081       // speed-control (gives back the learning speed = improvement-rate in the last N steps)
00082       // successList keeps track of the improvements to be able
00083       Float_t                    fBestResult;        // 
00084       Float_t                    fLastResult;        // 
00085       std::deque<Short_t>        fSuccessList;       // to calculate the improvement-speed
00086 
00087    };
00088 }
00089 
00090 #endif

Generated on Tue Jul 5 14:27:24 2011 for ROOT_528-00b_version by  doxygen 1.5.1