I’m new to ROOT and extremely new to TMVA. I want to make a PCA transform on my data. The data consists of 6 TTrees, each with around 7 entries in a 48-variable space (so 48 leaves per tree). Is there a way to do this with TMVA? I don’t want to do any classifier training, just find the principal components to be able to plot the data in the transformed space. Since I’m unexperienced I’d be grateful for some example piece of code.
see class TPrincipal and example in $ROOTSYS/tutorials/math/principal.C
Ah, so I don’t need TMVA. But, from what I can see, there is no way to keep track of from where the data points came once they’ve been added, is there? The reason I want to use a PCA is that I would like to see if different samples (i.e. some number of data points) may be separated by looking at them along the principal components instead of the original components. Therefore, I want to keep track of each data point added by TPrincipal::AddRow(data). (Let’s say, for example, that one row of data was coloured yellow, and another red, so that even after the transformation, I can still see which data came from where.)
see TPrincipal::X2P(const Double_t *x, Double_t *p).
This function converts your original point to PCA coordinates.
It is up to you to run the loop on your data points and make any correlation that you want.