Principal Component Analysis
- In the context of this project, I applied Principal Component Analysis (PCA) in order to create a model that reduces data dimensions and resises images.
Initially, PCA was tested in a 2D dataset, which is shown in Figure1.

Figure 1: 2-dimensional dataset
The first step is to compute the principal components of the input data. These components can be seen in Figure 2.

Figure 2: Principal components of 2D dataset
Now, input 2D dataset can be projected to the principal components in one dimension, as Figure 3 illustrates.

Figure 3: Projected data
In the next part of the project, PCA was applied in face images, 100 of which can be seen in Figure 4.

Figure 4: Input face dataset
Based on this dataset, PCA generated principal components, the top 36 of whom are presented in Figure 5.

Figure 5: Top 36 principal components
Now, images dimensions can be reduced by using only 100 principal components. From the projected face images, initial images can be retrieved again, as shown in Figure 6.

Figure 6: Original and reconstructed images
We can see that the reconstructed images are not so clear as the original ones. However, most of the faces characteristics are still presented.
At the last part, PCA was applied in a RGB image in order to reduce data dimensions and enable data visualisation. In Figure 7, K-means is applied in order to group image pixels in 3D.

Figure 7: 3D Dataset
Then, projected data were reduced from 3D to 2D, and were clustered again with K-means.

Figure 8: 2D scatter plot
A more detailed description of this project’s implentation in Matlab can be seen in this github repository: Link to Github repository