Files
FYS-STK4155/doc/src/week46/pca.do.txt
T
Morten Hjorth-Jensen e3034398b7 update
2022-11-18 05:37:13 +01:00

13 lines
863 B
Plaintext

!split
===== The Algorithm before the Theorem =====
Here's how we would proceed in setting up the algorithm for the PCA, see also discussion below here.
* Set up the datapoints for the design/feature matrix $\bm{X}$ with the predictors/features $p$ referring to the column numbers and the entries $n$ being the row elements.
* Center the data by subtracting the mean value for each column.
* Compute then the covariance/correlation matrix.
* Find the eigenpairs of the covariance matrix with eigenvalues $[\lambda_0,\lambda_1,\dots,\lambda_{p-1}]$ and eigenvectors $[\bm{s}_0,\bm{s}_1,\dots,\bm{s}_{p-1}]$.
* Order the eigenvalue (and the eigenvectors accordingly) in order of decreasing eigenvalues.
* Keep only those $l$ eigenvalues larger than a selected threshold value, discarding thus $p-l$ features since we expect small variations in the data here.