24 #ifndef ROOT_TMVA_TNeuron
25 #define ROOT_TMVA_TNeuron
49 class TNeuron :
public TObject {
57 void ForceValue(Double_t value);
60 void CalculateValue();
63 void CalculateActivationValue();
66 void CalculateDelta();
69 void SetActivationEqn(TActivation* activation);
72 void SetInputCalculator(TNeuronInput* calculator);
75 void AddPreLink(TSynapse* pre);
78 void AddPostLink(TSynapse* post);
81 void DeletePreLinks();
84 void SetError(Double_t error);
88 void UpdateSynapsesBatch();
91 void UpdateSynapsesSequential();
95 void AdjustSynapseWeights();
98 void InitSynapseDeltas();
101 void PrintActivationEqn();
104 Double_t GetValue()
const {
return fValue; }
105 Double_t GetActivationValue()
const {
return fActivationValue; }
106 Double_t GetDelta()
const {
return fDelta; }
107 Double_t GetDEDw()
const {
return fDEDw; }
108 Int_t NumPreLinks()
const {
return NumLinks(fLinksIn); }
109 Int_t NumPostLinks()
const {
return NumLinks(fLinksOut); }
110 TSynapse* PreLinkAt ( Int_t index )
const {
return (TSynapse*)fLinksIn->At(index); }
111 TSynapse* PostLinkAt( Int_t index )
const {
return (TSynapse*)fLinksOut->At(index); }
112 void SetInputNeuron() { NullifyLinks(fLinksIn); }
113 void SetOutputNeuron() { NullifyLinks(fLinksOut); }
114 void SetBiasNeuron() { NullifyLinks(fLinksIn); }
115 void SetDEDw( Double_t DEDw ) { fDEDw = DEDw; }
116 Bool_t IsInputNeuron()
const {
return fLinksIn == NULL; }
117 Bool_t IsOutputNeuron()
const {
return fLinksOut == NULL; }
118 void PrintPreLinks()
const { PrintLinks(fLinksIn);
return; }
119 void PrintPostLinks()
const { PrintLinks(fLinksOut);
return; }
121 virtual void Print(Option_t* =
"")
const {
122 std::cout << fValue << std::endl;
130 void DeleteLinksArray( TObjArray*& links );
131 void PrintLinks ( TObjArray* links )
const;
132 void PrintMessage ( EMsgType, TString message );
135 Int_t NumLinks(TObjArray* links)
const {
136 if (links ==
nullptr)
return 0;
137 else return links->GetEntriesFast();
139 void NullifyLinks(TObjArray*& links) {
140 if (links !=
nullptr) {
delete links; links =
nullptr; }
145 TObjArray* fLinksOut;
147 Double_t fActivationValue;
152 TActivation* fActivation;
153 TNeuronInput* fInputCalculator;
155 MsgLogger& Log()
const;