The idea of this repository is to provide some examples to better understand what is the Singular Value Decomposition (SVD) and how to work with it.
In this journey, until we totally understand this topic, we distinguish three steps:
In the first section, we just want to show how some matrices work and their effects to different 2D and 3D shapes. It would work the same for images.
The matrices that we work with are:
- Identity matrix.
- Scalar matrix.
- Off-one matrix.
- Reflection matrix.
- Diagonal matrix.
- Shear matrix.
- Orthogonal matrix.
In the second section, we show what the Spectral Decomposition is and the effect that the different parts of the decomposition apply to different 2D and 3D shapes.
Showing these effects help to understand what we are doing with each matrix.
Finally, in last section is where we work with the SVD.
We show the effects of the different parts of the decomposition, as we did for the Spectral Decomposition, which helps to show what is going on.
Also, we provide a couple of examples of how the SVD can be used to solve other problems:
- Least Squares.
- Decomposition of an image in its eigen vectors.
In the PDF called "Understanding SVD" we added some explanations for the different parts of this repository and where we dig deeper into the theory behind the different concepts that have been used here.
Clone the repo:
git clone https://github.com/alvarofdzg/understanding_svd.git
cd understanding_svd
Create environment:
conda env create -f environment.yml
python setup.py
Run all the scripts from the main directory.
Example:
python 1_visualize_different_matrices/ex_1.py