Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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 * (see tmva/doc/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//////////////////////////////////////////////////////////////////////////
35#include "TObject.h"
36
37namespace TMVA {
39 class TNeuron;
40 class MsgLogger;
41
42 class TSynapse : public TObject {
43
44 public:
45
46 TSynapse();
47 virtual ~TSynapse();
48
49 // set the weight of the synapse
50 void SetWeight(Double_t weight);
51
52 // get the weight of the synapse
54
55 // set the learning rate
56 void SetLearningRate(Double_t rate) { fLearnRate = rate; }
57
58 // get the learning rate
60
61 // decay the learning rate
62 void DecayLearningRate(Double_t rate){ fLearnRate *= (1-rate); }
63
64 // set the pre-neuron
65 void SetPreNeuron(TNeuron* pre) { fPreNeuron = pre; }
66
67 // set the post-neuron
68 void SetPostNeuron(TNeuron* post) { fPostNeuron = post; }
69
70 // get the weighted output of the pre-neuron
72
73 // get the weighted error field of the post-neuron
75
76 // force the synapse to adjust its weight according to its error field
77 void AdjustWeight();
78
79 // calculate the error field of the synapse
80 void CalculateDelta();
81
82 // initialize the error field of the synapse to 0
83 void InitDelta() { fDelta = 0.0; fCount = 0; }
84
85 void SetDEDw(Double_t DEDw) { fDEDw = DEDw; }
86 Double_t GetDEDw() { return fDEDw; }
87 Double_t GetDelta() { return fDelta; }
88
89 private:
90
91 Double_t fWeight; ///< weight of the synapse
92 Double_t fLearnRate; ///< learning rate parameter
93 Double_t fDelta; ///< local error field
94 Double_t fDEDw; ///< sum of deltas
95 Int_t fCount; ///< number of updates contributing to error field
96 TNeuron* fPreNeuron; ///< pointer to pre-neuron
97 TNeuron* fPostNeuron; ///< pointer to post-neuron
98
99 MsgLogger& Log() const;
100
101 ClassDef(TSynapse,0); // Synapse class used by MethodANNBase and derivatives
102 };
103
104} // namespace TMVA
105
106#endif
double Double_t
Definition RtypesCore.h:59
#define ClassDef(name, id)
Definition Rtypes.h:342
ostringstream derivative to redirect and format output
Definition MsgLogger.h:57
Neuron class used by TMVA artificial neural network methods.
Definition TNeuron.h:49
Synapse class used by TMVA artificial neural network methods.
Definition TSynapse.h:42
TNeuron * fPostNeuron
pointer to post-neuron
Definition TSynapse.h:97
void SetWeight(Double_t weight)
set synapse weight
Definition TSynapse.cxx:68
Double_t fDelta
local error field
Definition TSynapse.h:93
Double_t fWeight
weight of the synapse
Definition TSynapse.h:91
Double_t GetWeight()
Definition TSynapse.h:53
Double_t GetWeightedValue()
get output of pre-neuron weighted by synapse weight
Definition TSynapse.cxx:76
Double_t GetLearningRate()
Definition TSynapse.h:59
Int_t fCount
number of updates contributing to error field
Definition TSynapse.h:95
Double_t fDEDw
sum of deltas
Definition TSynapse.h:94
Double_t GetWeightedDelta()
get error field of post-neuron weighted by synapse weight
Definition TSynapse.cxx:87
void SetPostNeuron(TNeuron *post)
Definition TSynapse.h:68
virtual ~TSynapse()
destructor
Definition TSynapse.cxx:61
void SetDEDw(Double_t DEDw)
Definition TSynapse.h:85
void SetLearningRate(Double_t rate)
Definition TSynapse.h:56
TNeuron * fPreNeuron
pointer to pre-neuron
Definition TSynapse.h:96
Double_t GetDEDw()
Definition TSynapse.h:86
void InitDelta()
Definition TSynapse.h:83
Double_t fLearnRate
learning rate parameter
Definition TSynapse.h:92
TSynapse()
constructor
Definition TSynapse.cxx:46
void AdjustWeight()
adjust the weight based on the error field all ready calculated by CalculateDelta
Definition TSynapse.cxx:98
Double_t GetDelta()
Definition TSynapse.h:87
void SetPreNeuron(TNeuron *pre)
Definition TSynapse.h:65
MsgLogger & Log() const
Definition TSynapse.cxx:116
void DecayLearningRate(Double_t rate)
Definition TSynapse.h:62
void CalculateDelta()
calculate/adjust the error field for this synapse
Definition TSynapse.cxx:108
This class describes an elementary neuron, which is the basic element for a Neural Network.
Definition TNeuron.h:25
Mother of all ROOT objects.
Definition TObject.h:41
create variable transformations