# Interface of EvaluateMVA

**URL:** <https://root-forum.cern.ch/t/interface-of-evaluatemva/44950>\
**Category:** TMVA\
**Created:** [May 18, 2021, 4:38pm UTC](https://root-forum.cern.ch/t/interface-of-evaluatemva/44950 "2021-05-18T16:38:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Y.S.Zhang](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/cab0a1/32.png) [@Y.S.Zhang](https://root-forum.cern.ch/u/Y.S.Zhang)\
**Post date:** [May 18, 2021, 4:38pm UTC](https://root-forum.cern.ch/t/interface-of-evaluatemva/44950/1 "2021-05-18T16:38:33Z")

</div>

Dear experts,

After searching a bit, I could not find similar post for this question. I would like to post my question here.

I am currently working on the TMVA applications. Consulting the example code [TMVAClassificationApplication.C](https://root.cern.ch/doc/master/TMVAClassificationApplication_8C.html). It consists of several steps.

1. [AddVariable](https://root.cern.ch/doc/master/classTMVA_1_1Reader.html#adc31217830e7e66109505b672e6413ea)
2. [BookMVA](https://root.cern.ch/doc/master/classTMVA_1_1Reader.html#a9b12ddc2a1b307b1f5042e39ee73e067)
3. [EvaluateMVA](https://root.cern.ch/doc/master/classTMVA_1_1Reader.html#ad953007431a2eaab19e46381ecdf3e69)

In this example code, the interface `EvaluateMVA` with input `TString` is used. However, I can find another interface [EvaluateMVA](https://root.cern.ch/doc/master/classTMVA_1_1Reader.html#ac2ce4dbe08417da11bc010e95555073c) making using of `std::vector<double>`. I am wondering whether I need to call `AddVariable` if I use the interface with `std::vector`. How could I properly use this interface?

Many thanks in advance.

---

<div class="post-metadata">

**Author:** ![jblomer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/439d5e/32.png) [@jblomer](https://root-forum.cern.ch/u/jblomer)\
**Post date:** [May 19, 2021, 12:00pm UTC](https://root-forum.cern.ch/t/interface-of-evaluatemva/44950/2 "2021-05-19T12:00:09Z")

</div>

Perhaps @moneta can give more information.

---

<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:** [May 19, 2021, 1:53pm UTC](https://root-forum.cern.ch/t/interface-of-evaluatemva/44950/3 "2021-05-19T13:53:29Z")

</div>

Hi,  
It is correct you have another interface in the Reader for Evaluate the MVA, where you can pass an std::vector as input. But also in that case you need to call `Reader::AddVariable` in order to match the method with the saved one in the XML file.  
We have however a new class to perform a simple evaluation which internally will set the variables for you. The class is `TMVA::Experimental::RReader` see [ROOT: TMVA::Experimental::RReader Class Reference](https://root.cern.ch/doc/master/classTMVA_1_1Experimental_1_1RReader.html).

An example for using it is the tutorial [ROOT: tutorials/tmva/tmva003\_RReader.C File Reference](https://root.cern.ch/doc/master/tmva003__RReader_8C.html)

Lorenzo
