19 Double_t theUnknownFunction(Double_t x, Double_t y) {
20 return sin((1.7+x)*(x-0.3)-2.3*(y+0.7));
23 void mlpRegression() {
27 TNtuple* t=
new TNtuple(
"tree",
"tree",
"x:y:f");
29 for (Int_t i=0; i<1000; i++) {
35 t->Fill(x,y,theUnknownFunction(x,y));
39 TMultiLayerPerceptron* mlp=
new TMultiLayerPerceptron(
"x,y:10:8:f",t,
40 "Entry$%2",
"(Entry$%2)==0");
41 mlp->Train(150,
"graph update=10");
44 TMLPAnalyzer* mlpa=
new TMLPAnalyzer(mlp);
45 mlpa->GatherInformations();
50 TCanvas* cIO=
new TCanvas(
"TruthDeviation",
"TruthDeviation");
55 mlpa->DrawTruthDeviations();
60 mlpa->DrawTruthDeviationInsOut();
64 mlpa->GetIOTree()->Draw(
"Out.Out0-True.True0:True.True0>>hDelta",
"",
"goff");
65 TH2F* hDelta=(TH2F*)gDirectory->Get(
"hDelta");
66 hDelta->SetTitle(
"Difference between ANN output and truth vs. truth");
76 for (Int_t ix=0; ix<15; ix++) {
78 for (Int_t iy=0; iy<15; iy++) {
83 delta[idx]=mlp->Evaluate(0, v)-theUnknownFunction(v[0],v[1]);
86 TGraph2D* g2Extrapolate=
new TGraph2D(
"ANN extrapolation",
87 "ANN extrapolation, ANN output - truth",
90 g2Extrapolate->Draw(
"TRI2");