ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TSynapse.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Matt Jachowski
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : TMVA::TSynapse *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Synapse class for use in derivatives of MethodANNBase *
12  * *
13  * Authors (alphabetical): *
14  * Matt Jachowski <jachowski@stanford.edu> - Stanford University, USA *
15  * *
16  * Copyright (c) 2005: *
17  * CERN, Switzerland *
18  * *
19  * Redistribution and use in source and binary forms, with or without *
20  * modification, are permitted according to the terms listed in LICENSE *
21  * (http://tmva.sourceforge.net/LICENSE) *
22  **********************************************************************************/
23 
24 #ifndef ROOT_TMVA_TSynapse
25 #define ROOT_TMVA_TSynapse
26 
27 //////////////////////////////////////////////////////////////////////////
28 // //
29 // TSynapse //
30 // //
31 // Synapse used by derivatives of MethodANNBase //
32 // //
33 //////////////////////////////////////////////////////////////////////////
34 
35 #ifndef ROOT_TString
36 #include "TString.h"
37 #endif
38 #ifndef ROOT_TFormula
39 #include "TFormula.h"
40 #endif
41 
42 
43 namespace TMVA {
44 
45  class TNeuron;
46  class MsgLogger;
47 
48  class TSynapse : public TObject {
49 
50  public:
51 
53  virtual ~TSynapse();
54 
55  // set the weight of the synapse
56  void SetWeight(Double_t weight);
57 
58  // get the weight of the synapse
59  Double_t GetWeight() { return fWeight; }
60 
61  // set the learning rate
62  void SetLearningRate(Double_t rate) { fLearnRate = rate; }
63 
64  // get the learning rate
66 
67  // decay the learning rate
68  void DecayLearningRate(Double_t rate){ fLearnRate *= (1-rate); }
69 
70  // set the pre-neuron
71  void SetPreNeuron(TNeuron* pre) { fPreNeuron = pre; }
72 
73  // set hte post-neuron
74  void SetPostNeuron(TNeuron* post) { fPostNeuron = post; }
75 
76  // get the weighted output of the pre-neuron
78 
79  // get the weighted error field of the post-neuron
81 
82  // force the synapse to adjust its weight according to its error field
83  void AdjustWeight();
84 
85  // calulcate the error field of the synapse
86  void CalculateDelta();
87 
88  // initialize the error field of the synpase to 0
89  void InitDelta() { fDelta = 0.0; fCount = 0; }
90 
91  void SetDEDw(Double_t DEDw) { fDEDw = DEDw; }
92  Double_t GetDEDw() { return fDEDw; }
93  Double_t GetDelta() { return fDelta; }
94 
95  private:
96 
97  Double_t fWeight; // weight of the synapse
98  Double_t fLearnRate; // learning rate parameter
99  Double_t fDelta; // local error field
100  Double_t fDEDw; // sum of deltas
101  Int_t fCount; // number of updates contributing to error field
102  TNeuron* fPreNeuron; // pointer to pre-neuron
103  TNeuron* fPostNeuron; // pointer to post-neuron
104 
105  MsgLogger& Log() const;
106 
107  ClassDef(TSynapse,0) // Synapse class used by MethodANNBase and derivatives
108  };
109 
110 } // namespace TMVA
111 
112 #endif
TSynapse()
constructor
Definition: TSynapse.cxx:50
Int_t fCount
Definition: TSynapse.h:101
void DecayLearningRate(Double_t rate)
Definition: TSynapse.h:68
void SetDEDw(Double_t DEDw)
Definition: TSynapse.h:91
void SetPostNeuron(TNeuron *post)
Definition: TSynapse.h:74
Double_t GetDelta()
Definition: TSynapse.h:93
int Int_t
Definition: RtypesCore.h:41
void AdjustWeight()
adjust the weight based on the error field all ready calculated by CalculateDelta ...
Definition: TSynapse.cxx:103
TNeuron * fPostNeuron
Definition: TSynapse.h:103
virtual ~TSynapse()
destructor
Definition: TSynapse.cxx:66
#define ClassDef(name, id)
Definition: Rtypes.h:254
void CalculateDelta()
calculate/adjust the error field for this synapse
Definition: TSynapse.cxx:113
Double_t fWeight
Definition: TSynapse.h:97
MsgLogger & Log() const
Definition: TSynapse.cxx:121
Double_t GetDEDw()
Definition: TSynapse.h:92
void SetLearningRate(Double_t rate)
Definition: TSynapse.h:62
Double_t GetWeight()
Definition: TSynapse.h:59
double Double_t
Definition: RtypesCore.h:55
void InitDelta()
Definition: TSynapse.h:89
Double_t GetLearningRate()
Definition: TSynapse.h:65
void SetPreNeuron(TNeuron *pre)
Definition: TSynapse.h:71
void SetWeight(Double_t weight)
set synapse weight
Definition: TSynapse.cxx:73
Mother of all ROOT objects.
Definition: TObject.h:58
Double_t GetWeightedDelta()
get error field of post-neuron weighted by synapse weight
Definition: TSynapse.cxx:92
Double_t GetWeightedValue()
get output of pre-neuron weighted by synapse weight
Definition: TSynapse.cxx:81
Double_t fDEDw
Definition: TSynapse.h:100
Double_t fLearnRate
Definition: TSynapse.h:98
TNeuron * fPreNeuron
Definition: TSynapse.h:102
Double_t fDelta
Definition: TSynapse.h:99