Principal Components Analysis (PCA) example
Example of using TPrincipal as a stand alone class.
We create n-dimensional data points, where c = trunc(n / 5) + 1 are correlated with the rest n - c randomly distributed variables.
*************************************************
* Principal Component Analysis *
* *
* Number of variables: 10 *
* Number of data points: 10000 *
* Number of dependent variables: 3 *
* *
*************************************************
Variable # | Mean Value | Sigma | Eigenvalue
-------------+------------+------------+------------
0 | 5.008 | 1.005 | 0.3851
1 | 7.998 | 2.861 | 0.1107
2 | 1.967 | 1.956 | 0.1036
3 | 5.016 | 1.005 | 0.1015
4 | 8.009 | 2.839 | 0.1008
5 | 2.013 | 1.973 | 0.09962
6 | 4.992 | 1.014 | 0.09864
7 | 35 | 5.156 | 6.481e-16
8 | 30.01 | 5.049 | 2.202e-16
9 | 28 | 4.649 | 5.497e-16
Writing on file "pca.C" ... done
{
cout << "*************************************************" << endl;
cout << "* Principal Component Analysis *" << endl;
cout << "* *" << endl;
cout <<
"* Number of variables: " << setw(4) <<
n
<< " *" << endl;
cout <<
"* Number of data points: " << setw(8) <<
m
<< " *" << endl;
cout <<
"* Number of dependent variables: " << setw(4) <<
c
<< " *" << endl;
cout << "* *" << endl;
cout << "*************************************************" << endl;
for (
Int_t i = 0; i <
m; i++) {
for (
Int_t j = 0; j <
n -
c; j++) {
if (j % 3 == 0)
data[j] = randomNum->
Gaus(5,1);
}
for (
Int_t j = 0 ; j <
c; j++) {
}
}
}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Using a TBrowser one can browse all ROOT objects.
Principal Components Analysis (PCA)
This is the base class for the ROOT Random number generators.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual ULong64_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
virtual Double_t Exp(Double_t tau)
Returns an exponential deviate.
- Authors
- Rene Brun, Christian Holm Christensen
Definition in file principal.C.