#ifndef ROOT_TMVA_MethodANNBase
#define ROOT_TMVA_MethodANNBase
#include "TString.h"
#include <vector>
#include "TTree.h"
#include "TObjArray.h"
#include "TRandom3.h"
#ifndef ROOT_TMVA_MethodBase
#include "TMVA/MethodBase.h"
#endif
#ifndef ROOT_TMVA_TActivation
#include "TMVA/TActivation.h"
#endif
#ifndef ROOT_TMVA_TNeuron
#include "TMVA/TNeuron.h"
#endif
#ifndef ROOT_TMVA_TNeuronInput
#include "TMVA/TNeuronInput.h"
#endif
namespace TMVA {
class MethodANNBase : public MethodBase {
public:
MethodANNBase( const TString& jobName, const TString& methodTitle, DataSet& theData,
const TString& theOption, TDirectory* theTargetDir );
MethodANNBase( DataSet& theData, const TString& theWeightFile,
TDirectory* theTargetDir );
virtual ~MethodANNBase();
void InitANNBase();
void SetActivation(TActivation* activation) {
if (fActivation != NULL) delete fActivation; fActivation = activation;
}
void SetNeuronInputCalculator(TNeuronInput* inputCalculator) {
if (fInputCalculator != NULL) delete fInputCalculator;
fInputCalculator = inputCalculator;
}
virtual void Train() = 0;
virtual void PrintNetwork();
using MethodBase::WriteWeightsToStream;
using MethodBase::ReadWeightsFromStream;
virtual void WriteWeightsToStream( ostream& o ) const;
virtual void ReadWeightsFromStream( istream& istr );
virtual Double_t GetMvaValue();
virtual void WriteMonitoringHistosToFile() const;
const Ranking* CreateRanking();
virtual void DeclareOptions();
virtual void ProcessOptions();
Bool_t Debug() const { return fgDEBUG; }
protected:
virtual void MakeClassSpecific( std::ostream&, const TString& ) const;
vector<Int_t>* ParseLayoutString(TString layerSpec);
virtual void BuildNetwork(vector<Int_t>* layout, vector<Double_t>* weights=NULL);
void ForceNetworkInputs(Int_t ignoreIndex=-1);
Double_t GetNetworkOutput() { return GetOutputNeuron()->GetActivationValue(); }
void PrintMessage(TString message, Bool_t force=kFALSE) const;
void ForceNetworkCalculations();
void WaitForKeyboard();
Int_t NumCycles() { return fNcycles; }
TNeuron* GetInputNeuron(Int_t index) { return (TNeuron*)fInputLayer->At(index); }
TNeuron* GetOutputNeuron() { return fOutputNeuron; }
TObjArray* fNetwork;
TObjArray* fSynapses;
TActivation* fActivation;
TActivation* fIdentity;
TRandom3* frgen;
TNeuronInput* fInputCalculator;
TH1F* fEstimatorHistTrain;
TH1F* fEstimatorHistTest;
private:
void BuildLayers(std::vector<Int_t>* layout);
void BuildLayer(Int_t numNeurons, TObjArray* curLayer, TObjArray* prevLayer,
Int_t layerIndex, Int_t numLayers);
void AddPreLinks(TNeuron* neuron, TObjArray* prevLayer);
void InitWeights();
void ForceWeights(std::vector<Double_t>* weights);
void DeleteNetwork();
void DeleteNetworkLayer(TObjArray*& layer);
void PrintLayer(TObjArray* layer);
void PrintNeuron(TNeuron* neuron);
Int_t fNcycles;
TString fNeuronType;
TString fNeuronInputType;
TObjArray* fInputLayer;
TNeuron* fOutputNeuron;
TString fLayerSpec;
static const Bool_t fgDEBUG = kTRUE;
static const Bool_t fgFIXED_SEED = kTRUE;
ClassDef(MethodANNBase,0)
};
}
#endif
Last change: Wed Jun 25 08:48:17 2008
Last generated: 2008-06-25 08:48
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.