18 from ROOT
import TPrincipal, gRandom, TBrowser, vector
26 print (
"""************************************************* 27 * Principal Component Analysis * 29 * Number of variables: {0:4d} * 30 * Number of data points: {1:8d} * 31 * Number of dependent variables: {2:4d} * 33 *************************************************""".format(n, m, c))
47 data = vector(
'double')()
51 for j
in range(n - c):
53 data.push_back(randumNum.Gaus(5, 1))
55 data.push_back(randumNum.Poisson(8))
57 data.push_back(randumNum.Exp(2))
62 for k
in range(n - c - j):
63 data[n - c + j] += data[k]
66 principal.AddRow(data.data())
70 principal.MakePrincipals()
79 principal.MakeHistograms()
85 b =
TBrowser(
"principalBrowser", principal)
Principal Components Analysis (PCA)
Using a TBrowser one can browse all ROOT objects.