Home | News | Documentation | Download

TMVA compute Long64_t

Hello everyone.

I have a problem to compute my model. The .csv file I’m using has several types of data including Long64_t.
To use the model the “.Compute” function must have float.

How can I convert my long to float or use my long for compute?

RReader model("/home/meursault/Documents/ROOT/Perso/Kaggle/dataset/weights/TMVAClassification_BDT.weights.xml");
      auto variables = model.GetVariableNames();
       auto rdf2 = ROOT::RDF::MakeCsvDataFrame(
           "/home/meursault/Documents/ROOT/Perso/Kaggle/test.csv");
       auto rdf=rdf2.Define("Secu", "Age*Pclass");
   
       auto make_prediction = [&](const std::string &treename) {
             auto df=rdf;
             auto df2 = df.Define("y", Compute<9, float>(model), variables);
             return df2;
          };
       auto df2=make_prediction("test");
       df2.Display("y")->Print();

Thank you very much.

Hello @FLouyet; I am sure @moneta knows the answer to your question.

Cheers,
J.

Hi,
TMVA supports only float as input for the variables. I guess the Long64_t will be in this case automatically converted to float, loosing precision. Maybe @swunsch , author of the RReader interface, has further comments

Cheers

Lorenzo

Hi!

@moneta fully correct, the RReader only supports inputs of the same data type, here floats.

In your case, you would have to transform the input via a df.Define("x_float", "float(x)") node in the RDataFrame and then use this variable in place of the original column name.

Best
Stefan

Thank you very much it works perfectly!