In this repository, You can find the files which implement dimensionality reduction on the hyperspectral image(Indian Pines) with classification.
The prerequisites to better understand the code and concept are:
* Python
* MatLab
* Linear Algebra
* Numpy
* Sklearn
* Matplotlib
* Pandas
pip install numpy
pip install sklearn
pip install matplotlib
pip install pandas
import numpy
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import pandas as pd
The result of the indian_pines_pca.py is shown below:
Since, the initial two principal COmponents have high variance. so, we will select the initial two PC'S.
The result of the indian_pines_knnc.py is given below:
The result of the indian_pines_knnc_after_pca.py
Then the resultant classification accuracy of indian pines dataset after PCA is:
By performing PCA on the corrected indian pines dataset results 100 Principal Components(PC'S).
since, the initial two Principal Components(PC'S) has 92.01839071674918 variance ratio. we selected two only.
Initially the dataset contains the dimensions 21025 X 200 is drastically reduced to 21025 X 2 dimensions.
The time taken for classification before and after Principal Component Analysis(PCA) is:
Dataset | Accuracy | Time Taken |
---|---|---|
Before PCA | 72.748890 | 17.6010 |
After PCA | 60.098187 | 0.17700982 |
Hence, the time has been reduced with a lot of difference and the classification accuracy(C.A) also reduced but the C.A can increased little bit by varying the 'k' value.
This project is licensed under the MIT License - see the LICENSE.md file for details