I’m trying to use TMVA SOFIE to make inference starting from a keras (.h5) model.
My model is a multiclass DNN, and the output that I expect from the inference is a vector of dimension N for each event, where N is the number of classes. What I get when I call sofie_functor is a single number, that I think, looking at the line of the code TMVA/SOFIEHelpers.hxx#L49 is the first element of the vector. Is there a way to get all the numbers, or am I missing something here? Thanks a lot.
Technical details:
I’m using ROOT version 6.28, and TMVA SOFIE with python and RDataFrame.
To write the code I followed the tutorial root.cern/doc/master/TMVA__SOFIE__RDataFrame_8py.html without any relevant modifications.
Let me know if you need any additional information.
Thanks a lot,
Sofia
It is correct the corrent SOFIR functor implemented in TMVA/SOFIEHelper.hxx returns a single value. If you have a multiclass model and you need to return a vector of values, you can easly change it to return an std::vector by changing the signature of the operator(), function as following:
std::vector<T> operator()(unsigned slot, AlwaysT<N>... args) {
fInput[slot] = {args...};
auto y = fSessions[slot].infer(fInput[slot].data());
return y;
}
Please let me know if you have any issue using this modifies functor.