# TMVA compute Long64\_t

**URL:** <https://root-forum.cern.ch/t/tmva-compute-long64-t/43801>\
**Category:** TMVA\
**Created:** [March 3, 2021, 3:58pm UTC](https://root-forum.cern.ch/t/tmva-compute-long64-t/43801 "2021-03-03T15:58:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FLouyet](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@FLouyet](https://root-forum.cern.ch/u/FLouyet)\
**Post date:** [March 3, 2021, 3:58pm UTC](https://root-forum.cern.ch/t/tmva-compute-long64-t/43801/1 "2021-03-03T15:58:12Z")

</div>

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?

```auto
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.

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [March 3, 2021, 4:12pm UTC](https://root-forum.cern.ch/t/tmva-compute-long64-t/43801/2 "2021-03-03T16:12:42Z")

</div>

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

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 3, 2021, 5:20pm UTC](https://root-forum.cern.ch/t/tmva-compute-long64-t/43801/3 "2021-03-03T17:20:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![swunsch](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@swunsch](https://root-forum.cern.ch/u/swunsch)\
**Post date:** [March 3, 2021, 5:35pm UTC](https://root-forum.cern.ch/t/tmva-compute-long64-t/43801/4 "2021-03-03T17:35:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![FLouyet](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@FLouyet](https://root-forum.cern.ch/u/FLouyet)\
**Post date:** [March 5, 2021, 7:50am UTC](https://root-forum.cern.ch/t/tmva-compute-long64-t/43801/5 "2021-03-05T07:50:37Z")

</div>

Thank you very much it works perfectly!
