Matrix Decomposition
摘要
In this chapter, we start by implementing eigendecomposition by employing the eig() function from NumPy. We then show how to implement principal component analysis (PCA) via the eigendecomposition of the covariance matrix, and singular value decomposition (SVD) via its own factorisation of the data matrix. Further, we demonstrate the relationship between PCA and SVD. We also present how to use the PCA class from scikit-learn to perform PCA, and how to apply the svd() function from NumPy’s linalg submodule to carry out a singular value decomposition. Finally, we present an image compression application using SVD.