MethodCompositeBase.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: MethodCompositeBase.h 36966 2010-11-26 09:50:13Z evt $   
00002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss,Or Cohen 
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : MethodCompositeBase                                                   *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      Virtual base class for all MVA method                                     *
00012  *                                                                                *
00013  * Authors (alphabetical):                                                        *
00014  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
00015  *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
00016  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
00017  *      Kai Voss        <Kai.Voss@cern.ch>       - U. of Victoria, Canada         *
00018  *      Or Cohen        <orcohenor@gmail.com>    - Weizmann Inst., Israel         *
00019  *                                                                                *
00020  * Copyright (c) 2005:                                                            *
00021  *      CERN, Switzerland                                                         * 
00022  *      U. of Victoria, Canada                                                    * 
00023  *      MPI-K Heidelberg, Germany                                                 * 
00024  *      LAPP, Annecy, France                                                      *
00025  *                                                                                *
00026  * Redistribution and use in source and binary forms, with or without             *
00027  * modification, are permitted according to the terms listed in LICENSE           *
00028  * (http://tmva.sourceforge.net/LICENSE)                                          *
00029  **********************************************************************************/
00030 
00031 #ifndef ROOT_TMVA_MethodCompositeBase
00032 #define ROOT_TMVA_MethodCompositeBase
00033 
00034 //////////////////////////////////////////////////////////////////////////
00035 //                                                                      //
00036 // MethodCompositeBase                                                  //
00037 //                                                                      //
00038 // Virtual base class for combining several TMVA method                 //
00039 //                                                                      //
00040 //////////////////////////////////////////////////////////////////////////
00041 
00042 #include <iosfwd>
00043 #include <vector>
00044 
00045 #ifndef ROOT_TMVA_MethodBase
00046 #include "TMVA/MethodBase.h"
00047 #endif
00048 
00049 namespace TMVA {
00050    class IMethod;
00051 
00052    class MethodCompositeBase : public MethodBase {
00053 
00054    public :
00055       MethodCompositeBase( const TString& jobName,
00056                            Types::EMVA methodType,
00057                            const TString& methodTitle,
00058                            DataSetInfo& theData,
00059                            const TString& theOption = "",
00060                            TDirectory* theTargetDir = NULL );
00061 
00062 
00063       MethodCompositeBase( Types::EMVA methodType,
00064                            DataSetInfo& dsi,
00065                            const TString& weightFile,
00066                            TDirectory* theBaseDir = 0 );
00067 
00068       using MethodBase::ReadWeightsFromStream;
00069 
00070       // write weights to file
00071       void AddWeightsXMLTo( void* parent ) const;
00072       void ReadWeightsFromXML( void* wghtnode );
00073 
00074       // calculate the MVA value combining all classifiers according to thier fMethodWeight
00075       Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
00076 
00077       using MethodBase::GetMvaValue;
00078 
00079       // read weights from file
00080       void ReadWeightsFromStream( istream& istr );
00081 
00082       // performs classifier training
00083       virtual void Train() = 0;
00084 
00085       // create ranking
00086       virtual const Ranking* CreateRanking() = 0;
00087 
00088       virtual ~MethodCompositeBase( void );
00089 
00090       UInt_t GetMethodIndex() { return fMethodIndex; }
00091 
00092       IMethod* GetLastMethod() { return fMethods.back(); }
00093 
00094       IMethod* GetPreviousMethod() { return (fMethodIndex>0)?fMethods[fMethodIndex-1]:0; }
00095 
00096       IMethod* GetCurrentMethod()
00097       { return (fMethodIndex>0)?fMethods[fMethodIndex]:0; }
00098 
00099    protected:
00100 
00101       void DeclareOptions() = 0;
00102       void ProcessOptions() = 0;
00103 
00104       IMethod* GetMethod( const TString& title ) const;  // accessor by name
00105 
00106       IMethod* GetMethod( const Int_t index ) const;  // accessor by index in vector
00107 
00108       //the index of the classifier currently boosted
00109       Int_t          fMethodIndex;
00110 
00111       std::vector<IMethod*>      fMethods;          // vector of all classifiers
00112 
00113       //the weight of every classifier used in the GetMVA method
00114       std::vector<Double_t>      fMethodWeight;
00115 
00116       ClassDef(MethodCompositeBase,0)
00117 
00118    };
00119 }
00120 
00121 #endif
00122 

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