Logo ROOT  
Reference Guide
MethodTMlpANN.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : MethodTMlpANN *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Implementation of interface for Root-integrated artificial neural *
12  * network: TMultiLayerPerceptron, author: Christophe.Delaere@cern.ch *
13  * for a manual, see *
14  * http://root.cern.ch/root/html/TMultiLayerPerceptron.html *
15  * *
16  * Authors (alphabetical): *
17  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
18  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
19  * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
20  * *
21  * Copyright (c) 2005: *
22  * CERN, Switzerland *
23  * U. of Victoria, Canada *
24  * MPI-K Heidelberg, Germany *
25  * *
26  * Redistribution and use in source and binary forms, with or without *
27  * modification, are permitted according to the terms listed in LICENSE *
28  * (http://tmva.sourceforge.net/LICENSE) *
29  **********************************************************************************/
30 
31 #ifndef ROOT_TMVA_MethodTMlpANN
32 #define ROOT_TMVA_MethodTMlpANN
33 
34 //////////////////////////////////////////////////////////////////////////
35 // //
36 // MethodTMlpANN //
37 // //
38 // Implementation of interface for Root-integrated artificial neural //
39 // network: TMultiLayerPerceptron //
40 // //
41 //////////////////////////////////////////////////////////////////////////
42 
43 #include "TMVA/MethodBase.h"
44 
46 
47 namespace TMVA {
48 
49  class MethodTMlpANN : public MethodBase {
50 
51  public:
52 
53  MethodTMlpANN( const TString& jobName,
54  const TString& methodTitle,
55  DataSetInfo& theData,
56  const TString& theOption = "3000:N-1:N-2");
57 
58  MethodTMlpANN( DataSetInfo& theData,
59  const TString& theWeightFile);
60 
61  virtual ~MethodTMlpANN( void );
62 
63  virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );
64 
65  // training method
66  void Train( void );
67 
69 
70  // write weights to file
71  void AddWeightsXMLTo( void* parent ) const;
72 
73  // read weights from file
74  void ReadWeightsFromStream( std::istream& istr );
75  void ReadWeightsFromXML(void* wghtnode);
76 
77  // calculate the MVA value ...
78  // - here it is just a dummy, as it is done in the overwritten
79  // - PrepareEvaluationtree... ugly but necessary due to the structure
80  // of TMultiLayerPercepton in ROOT grr... :-(
81  Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
82 
83  void SetHiddenLayer(TString hiddenlayer = "" ) { fHiddenLayer=hiddenlayer; }
84 
85  // ranking of input variables
86  const Ranking* CreateRanking() { return 0; }
87 
88  // make ROOT-independent C++ class
89  void MakeClass( const TString& classFileName = TString("") ) const;
90 
91  protected:
92 
93  // make ROOT-independent C++ class for classifier response (classifier-specific implementation)
94  void MakeClassSpecific( std::ostream&, const TString& ) const;
95 
96  // get help message text
97  void GetHelpMessage() const;
98 
99  private:
100 
101  // the option handling methods
102  void DeclareOptions();
103  void ProcessOptions();
104 
105  void CreateMLPOptions( TString );
106 
107  // option string
108  TString fLayerSpec; // Layer specification option
109 
111  TTree* fLocalTrainingTree; // local copy of training tree
112 
113  TString fHiddenLayer; // string containing the hidden layer structure
114  Int_t fNcycles; // number of training cycles
115  Double_t fValidationFraction; // fraction of events in training tree used for cross validation
116  TString fMLPBuildOptions; // option string to build the mlp
117 
118  TString fLearningMethod; // the learning method (given via option string)
119 
120  // default initialisation called by all constructors
121  void Init( void );
122 
123  ClassDef(MethodTMlpANN,0); // Implementation of interface for TMultiLayerPerceptron
124  };
125 
126 } // namespace TMVA
127 
128 #endif
TMVA::MethodTMlpANN::fLearningMethod
TString fLearningMethod
Definition: MethodTMlpANN.h:118
TMVA::MethodTMlpANN::HasAnalysisType
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
TMlpANN can handle classification with 2 classes.
Definition: MethodTMlpANN.cxx:114
TMVA::MethodTMlpANN::CreateRanking
const Ranking * CreateRanking()
Definition: MethodTMlpANN.h:86
TMultiLayerPerceptron
This class describes a neural network.
Definition: TMultiLayerPerceptron.h:26
TMVA::MethodBase::ReadWeightsFromStream
virtual void ReadWeightsFromStream(std::istream &)=0
TMVA::MethodTMlpANN::DeclareOptions
void DeclareOptions()
define the options (their key words) that can be set in the option string
Definition: MethodTMlpANN.cxx:195
TMVA::Ranking
Ranking for variables in method (implementation)
Definition: Ranking.h:48
TMVA::MethodTMlpANN::ReadWeightsFromXML
void ReadWeightsFromXML(void *wghtnode)
rebuild temporary textfile from xml weightfile and load this file into MLP
Definition: MethodTMlpANN.cxx:378
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TMVA::MethodTMlpANN::GetHelpMessage
void GetHelpMessage() const
get help message text
Definition: MethodTMlpANN.cxx:501
MethodBase.h
TString
Basic string class.
Definition: TString.h:136
bool
TMVA::MethodTMlpANN::fLocalTrainingTree
TTree * fLocalTrainingTree
Definition: MethodTMlpANN.h:111
TMVA::MethodTMlpANN::MethodTMlpANN
MethodTMlpANN(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="3000:N-1:N-2")
standard constructor
Definition: MethodTMlpANN.cxx:84
TMVA::MethodTMlpANN::MakeClass
void MakeClass(const TString &classFileName=TString("")) const
create reader class for classifier -> overwrites base class function create specific class for TMulti...
Definition: MethodTMlpANN.cxx:473
TMVA::MethodTMlpANN::Init
void Init(void)
default initialisations
Definition: MethodTMlpANN.cxx:125
TMVA::DataSetInfo
Class that contains all the data information.
Definition: DataSetInfo.h:62
TMVA::MethodTMlpANN::GetMvaValue
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
calculate the value of the neural net for the current event
Definition: MethodTMlpANN.cxx:230
TMVA::Types::EAnalysisType
EAnalysisType
Definition: Types.h:128
TMVA::MethodTMlpANN::fHiddenLayer
TString fHiddenLayer
Definition: MethodTMlpANN.h:113
TMVA::MethodTMlpANN::fMLP
TMultiLayerPerceptron * fMLP
Definition: MethodTMlpANN.h:110
TMVA::MethodTMlpANN::fLayerSpec
TString fLayerSpec
Definition: MethodTMlpANN.h:108
TMVA::MethodTMlpANN::MakeClassSpecific
void MakeClassSpecific(std::ostream &, const TString &) const
write specific classifier response nothing to do here - all taken care of by TMultiLayerPerceptron
Definition: MethodTMlpANN.cxx:491
TMVA::MethodTMlpANN::ProcessOptions
void ProcessOptions()
builds the neural network as specified by the user
Definition: MethodTMlpANN.cxx:215
TMVA::MethodBase
Virtual base Class for all MVA method.
Definition: MethodBase.h:111
TMVA::MethodTMlpANN::ReadWeightsFromStream
virtual void ReadWeightsFromStream(std::istream &)=0
unsigned int
TMVA::MethodTMlpANN::CreateMLPOptions
void CreateMLPOptions(TString)
translates options from option string into TMlpANN language
Definition: MethodTMlpANN.cxx:140
TMVA::MethodTMlpANN::~MethodTMlpANN
virtual ~MethodTMlpANN(void)
destructor
Definition: MethodTMlpANN.cxx:132
Double_t
double Double_t
Definition: RtypesCore.h:59
TMVA::MethodTMlpANN::fNcycles
Int_t fNcycles
Definition: MethodTMlpANN.h:114
TMVA::MethodTMlpANN::fMLPBuildOptions
TString fMLPBuildOptions
Definition: MethodTMlpANN.h:116
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMVA::MethodTMlpANN
This is the TMVA TMultiLayerPerceptron interface class.
Definition: MethodTMlpANN.h:49
TMVA::MethodTMlpANN::AddWeightsXMLTo
void AddWeightsXMLTo(void *parent) const
write weights to xml file
Definition: MethodTMlpANN.cxx:342
TMVA::MethodTMlpANN::Train
void Train(void)
performs TMlpANN training available learning methods:
Definition: MethodTMlpANN.cxx:260
type
int type
Definition: TGX11.cxx:121
TMVA
create variable transformations
Definition: GeneticMinimizer.h:22
int
TMVA::MethodTMlpANN::SetHiddenLayer
void SetHiddenLayer(TString hiddenlayer="")
Definition: MethodTMlpANN.h:83
TMVA::MethodTMlpANN::fValidationFraction
Double_t fValidationFraction
Definition: MethodTMlpANN.h:115