79 fStructure.
Last(
':') - fStructure.
First(
':') - 1));
84 num = atoi(
TString(hidden(beg, end - beg)).Data());
87 end = hidden.
Index(
":", beg + 1);
88 if(layer==cnt)
return num;
92 if(layer==cnt)
return num;
110 brName =
TString(input(beg, end - beg));
112 brName = brName(1,brName.
Length()-1);
114 end = input.
Index(
",", beg + 1);
115 if(cnt==idx)
return brName;
120 brName = brName(1,brName.
Length()-1);
130 return neuron ? neuron->
GetName() :
"NO SUCH NEURON";
139 return neuron ? neuron->
GetName() :
"NO SUCH NEURON";
148 std::cout <<
"Network with structure: " << fStructure.
Data() << std::endl;
149 std::cout <<
"inputs with low values in the differences plot may not be needed" << std::endl;
151 char var[64], sel[64];
160 <<
" +/- " << tmp->
GetRMS() << std::endl;
184 Int_t i(0), j(0), k(0),
l(0);
187 pos = re.
Index(formula,&len);
188 if(pos==-1 || len<3) {
193 TString newformula(formula,pos);
194 TString val = formula(pos+1,len-2);
196 formula = newformula;
197 index[i] = val.
Atoi();
199 TH1D tmp(
"tmpb",
"tmpb", 1, -FLT_MAX, FLT_MAX);
201 data->Draw(
Form(
"%s>>tmpb",formula.
Data()),
"",
"goff");
217 fIOTree->SetDirectory(
nullptr);
220 leaflist+=
Form(
"In%d/D:",i);
222 fIOTree->Branch(
"In", params, leaflist);
225 for (i=0; i<numOutNodes; i++)
226 leaflist+=
Form(
"Out%d/D:",i);
228 fIOTree->Branch(
"Out", outVal, leaflist);
231 for (i=0; i<numOutNodes; i++)
232 leaflist+=
Form(
"True%d/D:",i);
234 fIOTree->Branch(
"True", trueVal, leaflist);
238 for(j=0; j< nEvents; j++) {
245 outVal[k] =
fNetwork->Evaluate(k,params);
256 params[i] += shift*rms[i];
258 params[i] -= 2*shift*rms[i];
262 params[i] += shift*rms[i];
273 for(i=0; i<
GetNeurons(1); i++)
delete formulas[i];
276 fIOTree->ResetBranchAddresses();
287 snprintf(sel,64,
"inNeuron==%d", i);
313 THStack* stack =
new THStack(
"differences",
"differences (impact of variables on ANN)");
316 char var[64], sel[64];
319 snprintf(sel,64,
"inNeuron==%d", i);
327 stack->
Draw(
"nostack");
342 data->SetEventList(test);
343 THStack* stack =
new THStack(
"__NNout_TMLPA",
Form(
"Neural net output (neuron %d)",neuron));
344 TH1F *bgh =
new TH1F(
"__bgh_TMLPA",
"NN output", 50, -0.5, 1.5);
345 TH1F *sigh =
new TH1F(
"__sigh_TMLPA",
"NN output", 50, -0.5, 1.5);
353 data->Draw(
">>__tmpSig_MLPA",signal,
"goff");
354 data->Draw(
">>__tmpBkg_MLPA",bg,
"goff");
357 nEvents = bg_list->
GetN();
358 for(j=0; j< nEvents; j++) {
362 nEvents = signal_list->
GetN();
363 for(j=0; j< nEvents; j++) {
378 legend->
AddEntry(bgh,
"Background");
380 stack->
Draw(
"nostack");
383 data->SetEventList(current);
404 drawline.
Form(
"Out.Out%d-True.True%d:True.True%d>>",
405 outnode, outnode, outnode);
406 fIOTree->Draw(drawline+pipehist+
"(20)",
"",
"goff prof");
408 h->SetDirectory(
nullptr);
411 h->SetTitle(
Form(
"#Delta(output - truth) vs. truth for %s",
413 h->GetXaxis()->SetTitle(title);
414 h->GetYaxis()->SetTitle(
Form(
"#Delta(output - truth) for %s", title));
416 if (!strstr(option,
"goff"))
434 "Deviation of MLP output from truth");
438 if (!option || !strstr(option,
"goff"))
439 leg=
new TLegend(.4,.85,.95,.95,
"#Delta(output - truth) vs. truth for:");
441 const char* xAxisTitle=
nullptr;
447 h->SetLineColor(1+outnode);
452 xAxisTitle=
h->GetXaxis()->GetTitle();
479 TString pipehist=
Form(
"MLP_truthdev_i%d_o%d", innode, outnode);
481 drawline.
Form(
"Out.Out%d-True.True%d:In.In%d>>",
482 outnode, outnode, innode);
483 fIOTree->Draw(drawline+pipehist+
"(50)",
"",
"goff prof");
485 h->SetDirectory(
nullptr);
488 h->SetTitle(
Form(
"#Delta(output - truth) of %s vs. input %s",
489 titleOutNeuron, titleInNeuron));
490 h->GetXaxis()->SetTitle(
Form(
"%s", titleInNeuron));
491 h->GetYaxis()->SetTitle(
Form(
"#Delta(output - truth) for %s",
493 if (!strstr(option,
"goff"))
510 sName.
Form(
"MLP_TruthDeviationIO_%d", outnode);
513 Form(
"Deviation of MLP output %s from truth",
518 if (!option || !strstr(option,
"goff"))
520 Form(
"#Delta(output - truth) of %s vs. input for:",
527 for (innode=0; innode<numInNodes; innode++) {
529 h->SetLineColor(1+innode);
531 if (
leg)
leg->AddEntry(
h,
h->GetXaxis()->GetTitle());
int Int_t
Signed integer 4 bytes (int).
int Ssiz_t
String size (currently int).
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char).
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
virtual Long64_t GetEntry(Int_t index) const
Return value of entry at index in the list.
virtual Int_t GetN() const
1-D histogram with a double per channel (see TH1 documentation)
1-D histogram with a float per channel (see TH1 documentation)
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Double_t GetRMS(Int_t axis=1) const
This function returns the Standard Deviation (Sigma) of the distribution not the Root Mean Square (RM...
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
virtual void Add(TH1 *h, Option_t *option="")
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
void Draw(Option_t *option="") override
Draw this box with its current attributes.
Int_t GetNeurons(Int_t layer)
Returns the number of neurons in given layer.
Int_t GetLayers()
Returns the number of layers.
TProfile * DrawTruthDeviation(Int_t outnode=0, Option_t *option="")
Create a profile of the difference of the MLP output minus the true value for a given output node out...
void DrawDInput(Int_t i)
Draws the distribution (on the test sample) of the impact on the network output of a small variation ...
const char * GetOutputNeuronTitle(Int_t out)
Returns the name of any neuron from the output layer.
~TMLPAnalyzer() override
Destructor.
void DrawDInputs()
Draws the distribution (on the test sample) of the impact on the network output of a small variation ...
THStack * DrawTruthDeviationInsOut(Int_t outnode=0, Option_t *option="")
Creates a profile of the difference of the MLP output outnode minus the true value of outnode vs the ...
void CheckNetwork()
Gives some information about the network in the terminal.
void GatherInformations()
Collect information about what is useful in the network.
THStack * DrawTruthDeviations(Option_t *option="")
Creates TProfiles of the difference of the MLP output minus the true value vs the true value,...
TProfile * DrawTruthDeviationInOut(Int_t innode, Int_t outnode=0, Option_t *option="")
Creates a profile of the difference of the MLP output outnode minus the true value of outnode vs the ...
const char * GetInputNeuronTitle(Int_t in)
Returns the name of any neuron from the input layer.
TMultiLayerPerceptron * fNetwork
TString GetNeuronFormula(Int_t idx)
Returns the formula used as input for neuron (idx) in the first layer.
void DrawNetwork(Int_t neuron, const char *signal, const char *bg)
Draws the distribution of the neural network (using ith neuron).
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
This class describes an elementary neuron, which is the basic element for a Neural Network.
Regular expression class.
Ssiz_t Index(const TString &str, Ssiz_t *len, Ssiz_t start=0) const
Find the first occurrence of the regexp in string and return the position, or -1 if there is no match...
Int_t Atoi() const
Return integer value of string.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
TString & Remove(Ssiz_t pos)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
Double_t Sqrt(Double_t x)
Returns the square root of x.