ML 5
ML 5
CYCLE-5
Aim: Singular Value Decomposition (SVD)
Solution:
Singular Value Decomposition (SVD) is a powerful technique widely used in solving
dimensionality reduction problems. This algorithm works with a data matrix of the
form, m x n, i.e., a rectangular matrix.
The idea behind the SVD is that a rectangular matrix can be broken down into a
product of three other matrices that are easy to work with. This decomposition is of
the form as the one shown in the formula below:
A=UΣVT
Where:
Source Code:
51
Output:
Let us try this out and see if we obtain the same matrix upon multiplying the three
matrices of the SVD together.
Before we do this, it is essential to note that the S vector does not fit the rule of matrix
multiplication. Thus we first convert it into a diagonal matrix as follows.
Code:
Output:
We reconstruct our matrix A from its SVD. The code below will carry out this
operation.
52
Code: Output: