Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA_SOFIE_RDataFrame.C File Reference

Detailed Description

View in nbviewer Open in SWAN
This macro provides an example of using a trained model with Keras and make inference using SOFIE and RDataFrame This macro uses as input a Keras model generated with the Python tutorial TMVA_SOFIE_Keras_HiggsModel.py You need to run that macro before to generate the trained Keras model and also the corresponding header file with SOFIE which can then be used for inference

Execute in this order:

using namespace TMVA::Experimental;
// need to add the current directory (from where we are running this macro)
// to the include path for Cling
#include "HiggsModel.hxx"
using namespace TMVA::Experimental;
void TMVA_SOFIE_RDataFrame(int nthreads = 2){
std::string inputFileName = "Higgs_data.root";
std::string inputFile = std::string{gROOT->GetTutorialDir()} + "/machine_learning/data/" + inputFileName;
int nslots = df1.GetNSlots();
std::cout << "Running using " << nslots << " threads" << std::endl;
{"m_jj", "m_jjj", "m_lv", "m_jlv", "m_bb", "m_wbb", "m_wwbb"})
.Histo1D({"h_sig", "", 100, 0, 1}, "DNN_Value");
nslots = df2.GetNSlots();
{"m_jj", "m_jjj", "m_lv", "m_jlv", "m_bb", "m_wbb", "m_wwbb"})
.Histo1D({"h_bkg", "", 100, 0, 1}, "DNN_Value");
h2->SetLineColor(kBlue);
auto c1 = new TCanvas();
h2->DrawClone();
h1->DrawClone("SAME");
c1->BuildLegend();
}
#define R__ADD_INCLUDE_PATH(PATH)
Definition Rtypes.h:475
@ kRed
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:67
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gROOT
Definition TROOT.h:414
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:42
The Canvas class.
Definition TCanvas.h:23
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
Definition TObject.cxx:319
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition TStyle.cxx:1641
return c1
Definition legend1.C:41
TH1F * h1
Definition legend1.C:5
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
Definition TROOT.cxx:544
Author
Lorenzo Moneta

Definition in file TMVA_SOFIE_RDataFrame.C.