Variable transformation using TMVA

Hi all,

Does anyone face the problem when transforming some set of variables from the entire variable list? Eventually, I would like to apply Gaussian transformation on just some of the variables not for all, so following the instructions given in the TMVA user’s guide, I wrote the following line in my code:

factory.BookMethod(dataloader, TMVA.Types.kPyKeras, ‘PyKeras’, “H:!V:VarTransform=(names of the variables which I want to transform)”)

Unfortunalely, I get the following error:
: Dataset[TMVAb15_b1_sb] : Class 3Jets, not known for variable transformation (InvMass, please check.

Although, I added all the variables to the DataLoader.

Cheers,

Hi,
Can you please post your code and possibly also your input data (or a subset of it), so we can reproduce the issue you are having.
Normally it should work the transformation for individual variables if done as in the Users Guide, see paragraph 4.1.5, page 52.

Lorenzo

Hi,
Please find in the attachment my code.

Keras_dnn_with_correct_weights.py (4.4 KB)

I also tried to transform variables by their index as it’s written in the TMVA Users Guide:
VarTransform=N(V0, V3 , T3, etc.). However, the same error appeared.

Ultimately, I want to transform all my variables except lead_lep_charge.

Cheers,

Hi,
Thank you for your code example. Can you also please post a small snapshots of your data file (just few events), so I can try your script ?
I have tried similar code with PyKeras and it works for me.

Cheers

Lorenzo

Hi,

Yeap, sure. I’ve attached two root files, one is signal pp->tHbq, another one is background pp->tt. TransformedMiniNtuple_tHbq_SM_300K.root (799.9 KB)
TransformedMiniNtuple_tt_SM_300K.root (891.0 KB)

Just for the record: I tried to run my project on lxplus.

Thank you!

Cheers,

Hi,
Thank you for the data file. You script has an error, the last variable in the data file is called lead_lep_pid instead of lead_lep_charge.
Another problem is that you should remove the space when defining the transformation variables.
Do:

"....VarTransform=G(InvMass_3Jets,delta_eta_tH,....)"

After this I think it should work, if not please let me know

Cheers
Lorenzo

Hi Lorenzo,

It did work, thank you so much! I didn’t even think that the problem might be related to the spaces between variable names :slightly_smiling_face:

Thank you!

Cheers,