ROOT logo
// @(#)root/tmva $Id: MethodTMlpANN.h 31458 2009-11-30 13:58:20Z stelzer $ 
// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss 

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : MethodTMlpANN                                                         *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Implementation of interface for Root-integrated artificial neural         *
 *      network: TMultiLayerPerceptron, author: Christophe.Delaere@cern.ch        *
 *      for a manual, see                                                         *
 *      http://root.cern.ch/root/html/TMultiLayerPerceptron.html                  *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
 *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
 *      Kai Voss        <Kai.Voss@cern.ch>       - U. of Victoria, Canada         *
 *                                                                                *
 * Copyright (c) 2005:                                                            *
 *      CERN, Switzerland                                                         * 
 *      U. of Victoria, Canada                                                    * 
 *      MPI-K Heidelberg, Germany                                                 * 
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

#ifndef ROOT_TMVA_MethodTMlpANN
#define ROOT_TMVA_MethodTMlpANN

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// MethodTMlpANN                                                        //
//                                                                      //
// Implementation of interface for Root-integrated artificial neural    //
// network: TMultiLayerPerceptron                                       //  
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TMVA_MethodBase
#include "TMVA/MethodBase.h"
#endif

class TMultiLayerPerceptron;

namespace TMVA {

   class MethodTMlpANN : public MethodBase {
  
   public:

      MethodTMlpANN( const TString& jobName, 
                     const TString& methodTitle, 
                     DataSetInfo& theData,
                     const TString& theOption = "3000:N-1:N-2", 
                     TDirectory* theTargetDir = 0 );

      MethodTMlpANN( DataSetInfo& theData, 
                     const TString& theWeightFile,  
                     TDirectory* theTargetDir = NULL );

      virtual ~MethodTMlpANN( void );
    
      virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );

      // training method
      void Train( void );

      using MethodBase::ReadWeightsFromStream;

      // write weights to file
      void AddWeightsXMLTo( void* parent ) const;

      // read weights from file
      void ReadWeightsFromStream( istream& istr );
      void ReadWeightsFromXML(void* wghtnode);

      // calculate the MVA value ...
      // - here it is just a dummy, as it is done in the overwritten
      // - PrepareEvaluationtree... ugly but necessary due to the strucure 
      //   of TMultiLayerPercepton in ROOT grr... :-(
      Double_t GetMvaValue( Double_t* err = 0 );

      void SetHiddenLayer(TString hiddenlayer = "" ) { fHiddenLayer=hiddenlayer; }

      // ranking of input variables
      const Ranking* CreateRanking() { return 0; }

      // make ROOT-independent C++ class
      void MakeClass( const TString& classFileName = TString("") ) const;

   protected:

      // make ROOT-independent C++ class for classifier response (classifier-specific implementation)
      void MakeClassSpecific( std::ostream&, const TString& ) const;

      // get help message text
      void GetHelpMessage() const;

   private:

      // the option handling methods
      void DeclareOptions();
      void ProcessOptions();

      void CreateMLPOptions( TString );

      // option string
      TString fLayerSpec;          // Layer specification option

      TMultiLayerPerceptron* fMLP; // the TMLP
      TTree*                 fLocalTrainingTree; // local copy of training tree
     
      TString  fHiddenLayer;        // string containig the hidden layer structure
      Int_t    fNcycles;            // number of training cylcles
      Double_t fValidationFraction; // fraction of events in training tree used for cross validation
      TString  fMLPBuildOptions;    // option string to build the mlp

      TString  fLearningMethod;     // the learning method (given via option string)

      // default initialisation called by all constructors
      void Init( void );

      ClassDef(MethodTMlpANN,0) // Implementation of interface for TMultiLayerPerceptron
   };

} // namespace TMVA

#endif
 MethodTMlpANN.h:1
 MethodTMlpANN.h:2
 MethodTMlpANN.h:3
 MethodTMlpANN.h:4
 MethodTMlpANN.h:5
 MethodTMlpANN.h:6
 MethodTMlpANN.h:7
 MethodTMlpANN.h:8
 MethodTMlpANN.h:9
 MethodTMlpANN.h:10
 MethodTMlpANN.h:11
 MethodTMlpANN.h:12
 MethodTMlpANN.h:13
 MethodTMlpANN.h:14
 MethodTMlpANN.h:15
 MethodTMlpANN.h:16
 MethodTMlpANN.h:17
 MethodTMlpANN.h:18
 MethodTMlpANN.h:19
 MethodTMlpANN.h:20
 MethodTMlpANN.h:21
 MethodTMlpANN.h:22
 MethodTMlpANN.h:23
 MethodTMlpANN.h:24
 MethodTMlpANN.h:25
 MethodTMlpANN.h:26
 MethodTMlpANN.h:27
 MethodTMlpANN.h:28
 MethodTMlpANN.h:29
 MethodTMlpANN.h:30
 MethodTMlpANN.h:31
 MethodTMlpANN.h:32
 MethodTMlpANN.h:33
 MethodTMlpANN.h:34
 MethodTMlpANN.h:35
 MethodTMlpANN.h:36
 MethodTMlpANN.h:37
 MethodTMlpANN.h:38
 MethodTMlpANN.h:39
 MethodTMlpANN.h:40
 MethodTMlpANN.h:41
 MethodTMlpANN.h:42
 MethodTMlpANN.h:43
 MethodTMlpANN.h:44
 MethodTMlpANN.h:45
 MethodTMlpANN.h:46
 MethodTMlpANN.h:47
 MethodTMlpANN.h:48
 MethodTMlpANN.h:49
 MethodTMlpANN.h:50
 MethodTMlpANN.h:51
 MethodTMlpANN.h:52
 MethodTMlpANN.h:53
 MethodTMlpANN.h:54
 MethodTMlpANN.h:55
 MethodTMlpANN.h:56
 MethodTMlpANN.h:57
 MethodTMlpANN.h:58
 MethodTMlpANN.h:59
 MethodTMlpANN.h:60
 MethodTMlpANN.h:61
 MethodTMlpANN.h:62
 MethodTMlpANN.h:63
 MethodTMlpANN.h:64
 MethodTMlpANN.h:65
 MethodTMlpANN.h:66
 MethodTMlpANN.h:67
 MethodTMlpANN.h:68
 MethodTMlpANN.h:69
 MethodTMlpANN.h:70
 MethodTMlpANN.h:71
 MethodTMlpANN.h:72
 MethodTMlpANN.h:73
 MethodTMlpANN.h:74
 MethodTMlpANN.h:75
 MethodTMlpANN.h:76
 MethodTMlpANN.h:77
 MethodTMlpANN.h:78
 MethodTMlpANN.h:79
 MethodTMlpANN.h:80
 MethodTMlpANN.h:81
 MethodTMlpANN.h:82
 MethodTMlpANN.h:83
 MethodTMlpANN.h:84
 MethodTMlpANN.h:85
 MethodTMlpANN.h:86
 MethodTMlpANN.h:87
 MethodTMlpANN.h:88
 MethodTMlpANN.h:89
 MethodTMlpANN.h:90
 MethodTMlpANN.h:91
 MethodTMlpANN.h:92
 MethodTMlpANN.h:93
 MethodTMlpANN.h:94
 MethodTMlpANN.h:95
 MethodTMlpANN.h:96
 MethodTMlpANN.h:97
 MethodTMlpANN.h:98
 MethodTMlpANN.h:99
 MethodTMlpANN.h:100
 MethodTMlpANN.h:101
 MethodTMlpANN.h:102
 MethodTMlpANN.h:103
 MethodTMlpANN.h:104
 MethodTMlpANN.h:105
 MethodTMlpANN.h:106
 MethodTMlpANN.h:107
 MethodTMlpANN.h:108
 MethodTMlpANN.h:109
 MethodTMlpANN.h:110
 MethodTMlpANN.h:111
 MethodTMlpANN.h:112
 MethodTMlpANN.h:113
 MethodTMlpANN.h:114
 MethodTMlpANN.h:115
 MethodTMlpANN.h:116
 MethodTMlpANN.h:117
 MethodTMlpANN.h:118
 MethodTMlpANN.h:119
 MethodTMlpANN.h:120
 MethodTMlpANN.h:121
 MethodTMlpANN.h:122
 MethodTMlpANN.h:123
 MethodTMlpANN.h:124
 MethodTMlpANN.h:125
 MethodTMlpANN.h:126
 MethodTMlpANN.h:127
 MethodTMlpANN.h:128
 MethodTMlpANN.h:129
 MethodTMlpANN.h:130
 MethodTMlpANN.h:131
 MethodTMlpANN.h:132