Using TMVA for PCA alone

Hi all,

I was wondering if it is possible to use TMVA to perform a PCA transform on a set of input variables without training a classifier. If I were starting from scratch, I would just use the TPrincipal class; however, I have a lot of code that feeds my data into TMVA and I am thinking that just extracting the transformed data could be easier. Anyone have any advice?

Thanks,
Alex

Hi Alex,

We have not foreseen this - but I agree it would be interesting to allow users to only perform the preprocessing and retrieve this in an analysis. We’ll put thin in our todo list.

If you are ready to hack, the following might work:

  1. Train a very simple classifier, eg, “LD” (linear discrimination) - it doesn’t take any time. Apply the PCA transform via the booking option.

  2. Use the Reader to return the LD response in the event loop (via reader->EvaluateMVA( “myLD” ))

  3. Before the event loop, get the pointer to your method from the Reader:

    TMVA::IMethod* myLD = reader->FindMVA( “myLD” );

  4. In the event loop, after calling EvaluateMVA, do:

    const TMVA::Event* ev = myLD->GetEvent();

This should return the transformed event. Get your values vie ev->GetValue(index);

No guarantee that this works - I didn’t try myself.

Cheers,
Andreas

Thanks for the idea, I’ll see what I can come up with.

-Alex