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:
python3 TMVA_SOFIE_Keras_HiggsModel.py
root TMVA_SOFIE_RDataFrame.C
#include "HiggsModel.hxx"
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->DrawClone();
}
#define R__ADD_INCLUDE_PATH(PATH)
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
auto SofieFunctor(unsigned int nslots=0, const std::string &weightsFile="") -> SofieFunctorHelper< std::make_index_sequence< N >, Session_t, float >
SofieFunctor : used to wrap the infer function of the generated model by SOFIE in a RDF compatible si...
- Author
- Lorenzo Moneta
Definition in file TMVA_SOFIE_RDataFrame.C.