41 #include "TStringLong.h"
50 #include "StPmdDiscriminatorMaker.h"
70 Float_t fLowerInitWeight;
71 Float_t fUpperInitWeight;
86 void GetArrayEvt(Int_t iEvent)
89 for(l=0;l<fNUnits[0];l++)fValues[0][l]=fArrayIn[iEvent][l];
90 for(l=0;l<fNUnits[fNHiddL+1];l++)fTeach[l]=fArrayOut[iEvent][l];
96 void Error(
const char*,
const char*, ...)
const{}
99 void AllocateVW(Int_t nInput,
const Text_t *hidden, Int_t nOutput);
100 void SetHidden(
const Text_t *ttext);
105 virtual Double_t Sigmoide(Double_t x)
107 if(x> 10.)
return 0.99999;
108 if(x<-10.)
return 0.;
109 return (1./(1.+exp(-x)));
111 virtual Double_t SigPrim(Double_t x){
return (x*(1.-x));};
116 StPmdNeuNet(
const Text_t *name, Int_t nInput=5,
const Text_t *hidden=
"6:7:8", Int_t nOutput=4);
119 virtual void SetKernel(Int_t nInput,
const Text_t *hidden, Int_t nOutput);
120 virtual void SetLearnParam(Double_t learnParam=0.2,Double_t fse=0.,Double_t mu=0.);
121 virtual void SetInitParam(Float_t lowerInitWeight=-1., Float_t upperInitWeight=1.);
126 virtual void ResetCycles(){fNTrainCycles=0;};
127 virtual void Export(
const Text_t *fileName=
"exportNN.dat");
128 virtual void Import(
const Text_t *fileName=
"exportNN.dat");
129 virtual void SetUseBiases(Bool_t trueForUse=1){fUseBiases=(Double_t)trueForUse;};
130 virtual void SetRandomSeed(UInt_t seed=0){fRandom.SetSeed(seed);};
131 virtual UInt_t GetRandomSeed(){
return fRandom.GetSeed();};
132 virtual Bool_t IsTrained(){
return fNTrainCycles;};
133 virtual Int_t GetNTrainCycles(){
return fNTrainCycles;};
134 virtual Int_t GetNTrainEvents(){
return fNTrainEvents;};
135 virtual void SetNTrainEvents(Int_t nevt){fNTrainEvents = nevt;};
136 virtual Int_t GetNValidEvents(){
return fNValidEvents;};
137 virtual void SetArraySize(Int_t s=0);
138 virtual void FillArray(Int_t,Int_t,Float_t);
139 virtual void Fill(Int_t iev=0)
142 for(i=0;i<fNUnits[0];i++)fArrayIn[iev][i]=fValues[0][i];
143 for(i=0;i<fNUnits[fNHiddL+1];i++)fArrayOut[iev][i]=fTeach[i];
145 virtual Float_t* GetInputAdr(){
return fValues[0];};
146 virtual void SetInput(Float_t v,Int_t i){fValues[0][i]=v;};
147 virtual Int_t GetNInput(){
return fNUnits[0];};
148 virtual Int_t GetNOutput(){
return fNUnits[fNHiddL+1];};
149 virtual Float_t GetOutput(Int_t unit=0){
return fValues[fNHiddL+1][unit];};
150 virtual Float_t* GetOutputAdr(){
return fValues[fNHiddL+1];};
151 virtual Float_t* GetTeachAdr(){
return fTeach;};
152 virtual void SetTeach(Float_t v,Int_t i){fTeach[i]=v;};
153 virtual void fillArrayOut(Float_t v,Int_t i,Int_t l){fArrayOut[i][l]=v;};
154 virtual Double_t GoThrough(){Forward();
return ErrorO();};
155 virtual Float_t GetSumO()
157 Int_t i; Float_t s=0.;
158 for(i=0;i<fNUnits[fNHiddL+1];i++)s+=fValues[fNHiddL+1][i];
164 cout<<
"Units** "<<fNUnits[fNHiddL+1]<<endl;
167 for(l=0;l<fNUnits[fNHiddL+1];l++){
168 cout<<
"teach "<<fTeach[l]<<
"Value "<<fValues[fNHiddL+1][l]<<endl;
174 virtual Double_t
Valid();
177 virtual Int_t GetNWeights()
179 if(!fNUnits)
return 0;
181 for(Int_t i=0;i<fNHiddL+1;i++)
183 n+=fNUnits[i]*fNUnits[i+1];
virtual Double_t ApplyWeights(Float_t *, Float_t *)
virtual void SetLearnParam(Double_t learnParam=0.2, Double_t fse=0., Double_t mu=0.)
StPmdNeuNet()
Constructor with no parameter . Purpose ??
virtual void SetInitParam(Float_t lowerInitWeight=-1., Float_t upperInitWeight=1.)
Sets the initialisation parameters : max and min weights.
virtual void TrainNCycles(Int_t nCycles=10)
virtual void Export(const Text_t *fileName="exportNN.dat")
virtual void Import(const Text_t *fileName="exportNN.dat")
virtual void PrintS()
prints structure of network on screen
virtual Double_t TrainOneCycle()