As we have already seen, the PCA process can be described in two steps:
- Calculate the covariance matrix of the original data.
- Choose the eigenvalues to construct the projection matrix.
Let's remind ourselves how the covariance matrix is expressed. It is the multiplication of the difference between the data points and their mean value:
The mean of each dimension of the original data is provided by the mean operation:
const batch = xs.shape[0];const meanValues = xs.mean(0);
The argument of reduction operations, such as mean = axis, specifies the dimensions where the reduction happens. Axis=0 means the row-wise ...