18from ROOT
import TPrincipal, gRandom, TBrowser, vector
26print (
"""*************************************************
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))
47data = 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())
70principal.MakePrincipals()
79principal.MakeHistograms()
85b =
TBrowser(
"principalBrowser", principal)
Using a TBrowser one can browse all ROOT objects.
Principal Components Analysis (PCA)