# Limiting range of input variables in Multiclass

**URL:** <https://root-forum.cern.ch/t/limiting-range-of-input-variables-in-multiclass/35615>\
**Category:** TMVA\
**Created:** [August 13, 2019, 11:55am UTC](https://root-forum.cern.ch/t/limiting-range-of-input-variables-in-multiclass/35615 "2019-08-13T11:55:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcamacho](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/bbe5ce/32.png) [@gcamacho](https://root-forum.cern.ch/u/gcamacho)\
**Post date:** [August 13, 2019, 11:55am UTC](https://root-forum.cern.ch/t/limiting-range-of-input-variables-in-multiclass/35615/1 "2019-08-13T11:55:09Z")

</div>

ROOT version: 6.10/09  
platform: LxPlus

Hi  
I am trying to limit the range of a certain input variable so that it is not used when the value is outside of this range. I can’t add it as a cut on TCut because I dont read this variable from the trees. I have tried to use the “min” and “max” values on AddVariable as shown in: [https://root.cern.ch/doc/v606/classTMVA\_1\_1Factory.html#a821f2ef76c6ac29eebc059b19ee1df67](https://root.cern.ch/doc/v606/classTMVA_1_1Factory.html#a821f2ef76c6ac29eebc059b19ee1df67)  
Like this:  
`dataloader->AddVariable("jet1_qgl:=("+Jet1_qgl+">=0)*("+Jet1_qgl+"+1)-1", 'F', 0.0, 1.0);`  
However this doesnt have any effect, and the variable has several values of (-1), outside of the (0,1) range.  
Am I doing something wrong? Is there a different way of achieving this?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [August 13, 2019, 12:00pm UTC](https://root-forum.cern.ch/t/limiting-range-of-input-variables-in-multiclass/35615/2 "2019-08-13T12:00:54Z")

</div>

If I remember correctly, you have to load the variable yourself, as cuts only work during the training phase.

I invite @moneta, @kialbert or @sitong to confirm.

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [August 14, 2019, 4:26pm UTC](https://root-forum.cern.ch/t/limiting-range-of-input-variables-in-multiclass/35615/3 "2019-08-14T16:26:54Z")

</div>

Hi,

Is it possbile to use

```auto
dataloader->AddVariable("jet1_qgl:=(Jet1_qgl>=0)*(Jet1_qgl+1)-1");

TString cut = "((Jet1_qgl>=0)*(Jet1_qgl+1)-1)>0 && ((Jet1_qgl>=0)*(Jet1_qgl+1)-1)<1";
dataloader->PrepareTrainingAndTestSet(cut, ...);

```

?

Cheers,  
Kim
