Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMLPAnalyzer.cxx
Go to the documentation of this file.
1// @(#)root/mlp:$Id$
2// Author: Christophe.Delaere@cern.ch 25/04/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2003, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TMLPAnalyzer
13
14This utility class contains a set of tests useful when developing
15a neural network.
16It allows you to check for unneeded variables, and to control
17the network structure.
18
19*/
20
21#include "TROOT.h"
22#include "TSynapse.h"
23#include "TNeuron.h"
25#include "TMLPAnalyzer.h"
26#include "TTree.h"
27#include "TTreeFormula.h"
28#include "TEventList.h"
29#include "TH1D.h"
30#include "TProfile.h"
31#include "THStack.h"
32#include "TLegend.h"
33#include "TVirtualPad.h"
34#include "TRegexp.h"
35#include "TMath.h"
36
37#include <cstdio>
38#include <iostream>
39#include <cstdlib>
40
41
42////////////////////////////////////////////////////////////////////////////////
43/// Destructor
44
46{
47 delete fAnalysisTree;
48 delete fIOTree;
49}
50
51////////////////////////////////////////////////////////////////////////////////
52/// Returns the number of layers.
53
55{
56 TString fStructure = fNetwork->GetStructure();
57 return fStructure.CountChar(':')+1;
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Returns the number of neurons in given layer.
62
64{
65 if(layer==1) {
66 TString fStructure = fNetwork->GetStructure();
67 TString input = TString(fStructure(0, fStructure.First(':')));
68 return input.CountChar(',')+1;
69 }
70 else if(layer==GetLayers()) {
71 TString fStructure = fNetwork->GetStructure();
72 TString output = TString(fStructure(fStructure.Last(':') + 1,
73 fStructure.Length() - fStructure.Last(':')));
74 return output.CountChar(',')+1;
75 }
76 else {
77 Int_t cnt=1;
78 TString fStructure = fNetwork->GetStructure();
79 TString hidden = TString(fStructure(fStructure.First(':') + 1,
80 fStructure.Last(':') - fStructure.First(':') - 1));
81 Int_t beg = 0;
82 Int_t end = hidden.Index(":", beg + 1);
83 Int_t num = 0;
84 while (end != -1) {
85 num = atoi(TString(hidden(beg, end - beg)).Data());
86 cnt++;
87 beg = end + 1;
88 end = hidden.Index(":", beg + 1);
89 if(layer==cnt) return num;
90 }
91 num = atoi(TString(hidden(beg, hidden.Length() - beg)).Data());
92 cnt++;
93 if(layer==cnt) return num;
94 }
95 return -1;
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Returns the formula used as input for neuron (idx) in
100/// the first layer.
101
103{
104 TString fStructure = fNetwork->GetStructure();
105 TString input = TString(fStructure(0, fStructure.First(':')));
106 Int_t beg = 0;
107 Int_t end = input.Index(",", beg + 1);
109 Int_t cnt = 0;
110 while (end != -1) {
111 brName = TString(input(beg, end - beg));
112 if (brName[0]=='@')
113 brName = brName(1,brName.Length()-1);
114 beg = end + 1;
115 end = input.Index(",", beg + 1);
116 if(cnt==idx) return brName;
117 cnt++;
118 }
119 brName = TString(input(beg, input.Length() - beg));
120 if (brName[0]=='@')
121 brName = brName(1,brName.Length()-1);
122 return brName;
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Returns the name of any neuron from the input layer
127
129{
130 TNeuron* neuron=(TNeuron*)fNetwork->fFirstLayer[in];
131 return neuron ? neuron->GetName() : "NO SUCH NEURON";
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// Returns the name of any neuron from the output layer
136
138{
139 TNeuron* neuron=(TNeuron*)fNetwork->fLastLayer[out];
140 return neuron ? neuron->GetName() : "NO SUCH NEURON";
141}
142
143////////////////////////////////////////////////////////////////////////////////
144/// Gives some information about the network in the terminal.
145
147{
148 TString fStructure = fNetwork->GetStructure();
149 std::cout << "Network with structure: " << fStructure.Data() << std::endl;
150 std::cout << "inputs with low values in the differences plot may not be needed" << std::endl;
151 // Checks if some input variable is not needed
152 char var[64], sel[64];
153 for (Int_t i = 0; i < GetNeurons(1); i++) {
154 snprintf(var,64,"diff>>tmp%d",i);
155 snprintf(sel,64,"inNeuron==%d",i);
156 fAnalysisTree->Draw(var, sel, "goff");
157 TH1F* tmp = (TH1F*)gDirectory->Get(Form("tmp%d",i));
158 if (!tmp) continue;
159 std::cout << GetInputNeuronTitle(i)
160 << " -> " << tmp->GetMean()
161 << " +/- " << tmp->GetRMS() << std::endl;
162 }
163}
164
165////////////////////////////////////////////////////////////////////////////////
166/// Collect information about what is useful in the network.
167/// This method has to be called first when analyzing a network.
168/// Fills the two analysis trees.
169
171{
172 Double_t shift = 0.1;
175 Int_t nEvents = test->GetN();
176 Int_t nn = GetNeurons(1);
177 Double_t* params = new Double_t[nn];
178 Double_t* rms = new Double_t[nn];
180 Int_t* index = new Int_t[nn];
182 TRegexp re("{[0-9]+}$");
183 Ssiz_t len = formula.Length();
184 Ssiz_t pos = -1;
185 Int_t i(0), j(0), k(0), l(0);
186 for(i=0; i<nn; i++){
188 pos = re.Index(formula,&len);
189 if(pos==-1 || len<3) {
190 formulas[i] = new TTreeFormula(Form("NF%zu",(size_t)this),formula,data);
191 index[i] = 0;
192 }
193 else {
195 TString val = formula(pos+1,len-2);
196 formulas[i] = new TTreeFormula(Form("NF%zu",(size_t)this),newformula,data);
198 index[i] = val.Atoi();
199 }
200 TH1D tmp("tmpb", "tmpb", 1, -FLT_MAX, FLT_MAX);
201 tmp.SetDirectory(gDirectory);
202 data->Draw(Form("%s>>tmpb",formula.Data()),"","goff");
203 rms[i] = tmp.GetRMS();
204 }
205 Int_t inNeuron = 0;
206 Double_t diff = 0.;
207 if(fAnalysisTree) delete fAnalysisTree;
208 fAnalysisTree = new TTree("result","analysis");
209 fAnalysisTree->SetDirectory(nullptr);
210 fAnalysisTree->Branch("inNeuron",&inNeuron,"inNeuron/I");
211 fAnalysisTree->Branch("diff",&diff,"diff/D");
215
216 delete fIOTree;
217 fIOTree=new TTree("MLP_iotree","MLP_iotree");
218 fIOTree->SetDirectory(nullptr);
220 for (i=0; i<nn; i++)
221 leaflist+=Form("In%d/D:",i);
222 leaflist.Remove(leaflist.Length()-1);
223 fIOTree->Branch("In", params, leaflist);
224
225 leaflist="";
226 for (i=0; i<numOutNodes; i++)
227 leaflist+=Form("Out%d/D:",i);
228 leaflist.Remove(leaflist.Length()-1);
229 fIOTree->Branch("Out", outVal, leaflist);
230
231 leaflist="";
232 for (i=0; i<numOutNodes; i++)
233 leaflist+=Form("True%d/D:",i);
234 leaflist.Remove(leaflist.Length()-1);
235 fIOTree->Branch("True", trueVal, leaflist);
236 Double_t v1 = 0.;
237 Double_t v2 = 0.;
238 // Loop on the events in the test sample
239 for(j=0; j< nEvents; j++) {
240 fNetwork->GetEntry(test->GetEntry(j));
241 // Loop on the neurons to evaluate
242 for(k=0; k<GetNeurons(1); k++) {
243 params[k] = formulas[k]->EvalInstance(index[k]);
244 }
245 for(k=0; k<GetNeurons(GetLayers()); k++) {
246 outVal[k] = fNetwork->Evaluate(k,params);
247 trueVal[k] = ((TNeuron*)fNetwork->fLastLayer[k])->GetBranch();
248 }
249 fIOTree->Fill();
250
251 // Loop on the input neurons
252 for (i = 0; i < GetNeurons(1); i++) {
253 inNeuron = i;
254 diff = 0;
255 // Loop on the neurons in the output layer
256 for(l=0; l<GetNeurons(GetLayers()); l++){
257 params[i] += shift*rms[i];
258 v1 = fNetwork->Evaluate(l,params);
259 params[i] -= 2*shift*rms[i];
260 v2 = fNetwork->Evaluate(l,params);
261 diff += (v1-v2)*(v1-v2);
262 // reset to original value
263 params[i] += shift*rms[i];
264 }
267 }
268 }
269 delete[] params;
270 delete[] rms;
271 delete[] outVal;
272 delete[] trueVal;
273 delete[] index;
274 for(i=0; i<GetNeurons(1); i++) delete formulas[i];
275 delete [] formulas;
278}
279
280////////////////////////////////////////////////////////////////////////////////
281/// Draws the distribution (on the test sample) of the
282/// impact on the network output of a small variation of
283/// the ith input.
284
286{
287 char sel[64];
288 snprintf(sel,64, "inNeuron==%d", i);
289 fAnalysisTree->Draw("diff", sel);
290}
291
292////////////////////////////////////////////////////////////////////////////////
293/// Draws the distribution (on the test sample) of the
294/// impact on the network output of a small variation of
295/// each input.
296/// DrawDInputs() draws something that approximates the distribution of the
297/// derivative of the NN w.r.t. each input. That quantity is recognized as
298/// one of the measures to determine key quantities in the network.
299///
300/// What is done is to vary one input around its nominal value and to see
301/// how the NN changes. This is done for each entry in the sample and produces
302/// a distribution.
303///
304/// What you can learn from that is:
305/// - is variable a really useful, or is my network insensitive to it ?
306/// - is there any risk of big systematic ? Is the network extremely sensitive
307/// to small variations of any of my inputs ?
308///
309/// As you might understand, this is to be considered with care and can serve
310/// as input for an "educated guess" when optimizing the network.
311
313{
314 THStack* stack = new THStack("differences","differences (impact of variables on ANN)");
315 TLegend* legend = new TLegend(0.75,0.75,0.95,0.95);
316 TH1F* tmp = nullptr;
317 char var[64], sel[64];
318 for(Int_t i = 0; i < GetNeurons(1); i++) {
319 snprintf(var,64, "diff>>tmp%d", i);
320 snprintf(sel,64, "inNeuron==%d", i);
321 fAnalysisTree->Draw(var, sel, "goff");
322 tmp = (TH1F*)gDirectory->Get(Form("tmp%d",i));
323 tmp->SetDirectory(nullptr);
324 tmp->SetLineColor(i+1);
325 stack->Add(tmp);
326 legend->AddEntry(tmp,GetInputNeuronTitle(i),"l");
327 }
328 stack->Draw("nostack");
329 legend->Draw();
330 gPad->SetLogy();
331}
332
333////////////////////////////////////////////////////////////////////////////////
334/// Draws the distribution of the neural network (using ith neuron).
335/// Two distributions are drawn, for events passing respectively the "signal"
336/// and "background" cuts. Only the test sample is used.
337
338void TMLPAnalyzer::DrawNetwork(Int_t neuron, const char* signal, const char* bg)
339{
342 TEventList* current = data->GetEventList();
343 data->SetEventList(test);
344 THStack* stack = new THStack("__NNout_TMLPA",Form("Neural net output (neuron %d)",neuron));
345 TH1F *bgh = new TH1F("__bgh_TMLPA", "NN output", 50, -0.5, 1.5);
346 TH1F *sigh = new TH1F("__sigh_TMLPA", "NN output", 50, -0.5, 1.5);
347 bgh->SetDirectory(nullptr);
348 sigh->SetDirectory(nullptr);
349 Int_t nEvents = 0;
350 Int_t j=0;
351 // build event lists for signal and background
352 TEventList* signal_list = new TEventList("__tmpSig_MLPA");
353 TEventList* bg_list = new TEventList("__tmpBkg_MLPA");
354 signal_list->SetDirectory(gDirectory);
355 bg_list->SetDirectory(gDirectory);
356 data->Draw(">>__tmpSig_MLPA",signal,"goff");
357 data->Draw(">>__tmpBkg_MLPA",bg,"goff");
358
359 // fill the background
360 nEvents = bg_list->GetN();
361 for(j=0; j< nEvents; j++) {
362 bgh->Fill(fNetwork->Result(bg_list->GetEntry(j),neuron));
363 }
364 // fill the signal
365 nEvents = signal_list->GetN();
366 for(j=0; j< nEvents; j++) {
367 sigh->Fill(fNetwork->Result(signal_list->GetEntry(j),neuron));
368 }
369 // draws the result
370 bgh->SetLineColor(kBlue);
371 bgh->SetFillStyle(3008);
372 bgh->SetFillColor(kBlue);
373 sigh->SetLineColor(kRed);
374 sigh->SetFillStyle(3003);
375 sigh->SetFillColor(kRed);
376 bgh->SetStats(false);
377 sigh->SetStats(false);
378 stack->Add(bgh);
379 stack->Add(sigh);
380 TLegend *legend = new TLegend(.75, .80, .95, .95);
381 legend->AddEntry(bgh, "Background");
382 legend->AddEntry(sigh,"Signal");
383 stack->Draw("nostack");
384 legend->Draw();
385 // restore the default event list
386 data->SetEventList(current);
387 delete signal_list;
388 delete bg_list;
389}
390
391////////////////////////////////////////////////////////////////////////////////
392/// Create a profile of the difference of the MLP output minus the
393/// true value for a given output node outnode, vs the true value for
394/// outnode, for all test data events. This method is mainly useful
395/// when doing regression analysis with the MLP (i.e. not classification,
396/// but continuous truth values).
397/// The resulting TProfile histogram is returned.
398/// It is not drawn if option "goff" is specified.
399/// Options are passed to TProfile::Draw
400
402 Option_t *option /*=""*/)
403{
405 TString pipehist=Form("MLP_truthdev_%d",outnode);
407 drawline.Form("Out.Out%d-True.True%d:True.True%d>>",
409 fIOTree->Draw(drawline+pipehist+"(20)", "", "goff prof");
411 h->SetDirectory(nullptr);
412 const char* title=GetOutputNeuronTitle(outnode);
413 if (title) {
414 h->SetTitle(Form("#Delta(output - truth) vs. truth for %s",
415 title));
416 h->GetXaxis()->SetTitle(title);
417 h->GetYaxis()->SetTitle(Form("#Delta(output - truth) for %s", title));
418 }
419 if (!strstr(option,"goff"))
420 h->Draw();
421 return h;
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// Creates TProfiles of the difference of the MLP output minus the
426/// true value vs the true value, one for each output, filled with the
427/// test data events. This method is mainly useful when doing regression
428/// analysis with the MLP (i.e. not classification, but continuous truth
429/// values).
430/// The returned THStack contains all the TProfiles. It is drawn unless
431/// the option "goff" is specified.
432/// Options are passed to TProfile::Draw.
433
435{
436 THStack *hs=new THStack("MLP_TruthDeviation",
437 "Deviation of MLP output from truth");
438
439 // leg!=0 means we're drawing
440 TLegend *leg=nullptr;
441 if (!option || !strstr(option,"goff"))
442 leg=new TLegend(.4,.85,.95,.95,"#Delta(output - truth) vs. truth for:");
443
444 const char* xAxisTitle=nullptr;
445
446 // create profile for each input neuron,
447 // adding them into the THStack and the TLegend
450 h->SetLineColor(1+outnode);
451 hs->Add(h, option);
452 if (leg) leg->AddEntry(h,GetOutputNeuronTitle(outnode));
453 if (!outnode)
454 // Xaxis title is the same for all, extract it from the first one.
455 xAxisTitle=h->GetXaxis()->GetTitle();
456 }
457
458 if (leg) {
459 hs->Draw("nostack");
460 leg->Draw();
461 // gotta draw before accessing the axes
462 hs->GetXaxis()->SetTitle(xAxisTitle);
463 hs->GetYaxis()->SetTitle("#Delta(output - truth)");
464 }
465
466 return hs;
467}
468
469////////////////////////////////////////////////////////////////////////////////
470/// Creates a profile of the difference of the MLP output outnode minus
471/// the true value of outnode vs the input value innode, for all test
472/// data events.
473/// The resulting TProfile histogram is returned.
474/// It is not drawn if option "goff" is specified.
475/// Options are passed to TProfile::Draw
476
478 Int_t outnode /*=0*/,
479 Option_t *option /*=""*/)
480{
482 TString pipehist=Form("MLP_truthdev_i%d_o%d", innode, outnode);
484 drawline.Form("Out.Out%d-True.True%d:In.In%d>>",
486 fIOTree->Draw(drawline+pipehist+"(50)", "", "goff prof");
488 h->SetDirectory(nullptr);
491 h->SetTitle(Form("#Delta(output - truth) of %s vs. input %s",
493 h->GetXaxis()->SetTitle(Form("%s", titleInNeuron));
494 h->GetYaxis()->SetTitle(Form("#Delta(output - truth) for %s",
496 if (!strstr(option,"goff"))
497 h->Draw(option);
498 return h;
499}
500
501////////////////////////////////////////////////////////////////////////////////
502/// Creates a profile of the difference of the MLP output outnode minus the
503/// true value of outnode vs the input value, stacked for all inputs, for
504/// all test data events.
505/// The returned THStack contains all the TProfiles. It is drawn unless
506/// the option "goff" is specified.
507/// Options are passed to TProfile::Draw.
508
510 Option_t *option /*=""*/)
511{
513 sName.Form("MLP_TruthDeviationIO_%d", outnode);
515 THStack *hs=new THStack(sName,
516 Form("Deviation of MLP output %s from truth",
518
519 // leg!=0 means we're drawing.
520 TLegend *leg=nullptr;
521 if (!option || !strstr(option,"goff"))
522 leg=new TLegend(.4,.75,.95,.95,
523 Form("#Delta(output - truth) of %s vs. input for:",
525
526 // create profile for each input neuron,
527 // adding them into the THStack and the TLegend
529 Int_t innode=0;
530 for (innode=0; innode<numInNodes; innode++) {
532 h->SetLineColor(1+innode);
533 hs->Add(h, option);
534 if (leg) leg->AddEntry(h,h->GetXaxis()->GetTitle());
535 }
536
537 if (leg) {
538 hs->Draw("nostack");
539 leg->Draw();
540 // gotta draw before accessing the axes
541 hs->GetXaxis()->SetTitle("Input value");
542 hs->GetYaxis()->SetTitle(Form("#Delta(output - truth) for %s",
544 }
545
546 return hs;
547}
#define h(i)
Definition RSha256.hxx:106
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
@ kRed
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gDirectory
Definition TDirectory.h:385
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2571
#define gPad
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
Definition TEventList.h:31
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:926
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:878
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
Definition TH1.cxx:9170
TObject * FindObject(const char *name) const override
Search object named name in the list of functions.
Definition TH1.cxx:4008
The Histogram stack class.
Definition THStack.h:40
virtual void Add(TH1 *h, Option_t *option="")
Add a new histogram to the list.
Definition THStack.cxx:364
void Draw(Option_t *chopt="") override
Draw this stack with its current attributes.
Definition THStack.cxx:451
This class displays a legend box (TPaveText) containing several legend entries.
Definition TLegend.h:23
TTree * fAnalysisTree
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 ...
TTree * fIOTree
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).
Double_t Evaluate(Int_t index, Double_t *params) const
Returns the Neural Net for a given set of input parameters #parameters must equal #input neurons.
TEventList * fTest
! EventList defining the events in the test dataset
TTree * fData
! pointer to the tree used as datasource
Double_t Result(Int_t event, Int_t index=0) const
Computes the output for a given event.
TObjArray fLastLayer
Collection of the output neurons; subset of fNetwork.
TObjArray fFirstLayer
Collection of the input neurons; subset of fNetwork.
void GetEntry(Int_t) const
Load an entry into the network.
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
This class describes an elementary neuron, which is the basic element for a Neural Network.
Definition TNeuron.h:25
Profile Histogram.
Definition TProfile.h:32
Regular expression class.
Definition TRegexp.h:31
Basic string class.
Definition TString.h:137
Ssiz_t Length() const
Definition TString.h:426
Int_t Atoi() const
Return integer value of string.
Definition TString.cxx:2069
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition TString.cxx:546
const char * Data() const
Definition TString.h:385
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition TString.cxx:939
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
Definition TString.cxx:523
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:661
Used to pass a selection expression to the Tree drawing routine.
A TTree represents a columnar dataset.
Definition TTree.h:89
virtual Int_t Fill()
Fill all branches.
Definition TTree.cxx:4674
void Draw(Option_t *opt) override
Default Draw method for all objects.
Definition TTree.h:486
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
Definition TTree.cxx:9363
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
Definition TTree.h:405
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
Definition TTree.cxx:8411
leg
Definition legend1.C:34
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:675
TLine l
Definition textangle.C:4