Skip to content

Machine learning homework exploring image analysis and PCA dimensionality reduction.

License

Notifications You must be signed in to change notification settings

NikosMav/Image-Analysis-with-PCA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Machine Learning Image Processing and PCA

This repository contains the code and documentation for a machine learning homework assignment. The assignment involves tasks related to image preprocessing, dimensionality reduction using PCA (Principal Component Analysis), classification using k-Nearest Neighbors (k-NN), and Non-negative Matrix Factorization (NMF).

Introduction

This machine learning homework focuses on the following tasks:

  1. Image Preprocessing and Visualization: Load a set of images, resize them to a common dimension, reshape them into 1D arrays, and apply PCA for dimensionality reduction. Visualize the images in a 2D space.

  2. Explanation of PCA Results: Provide an explanation of the PCA results and the significance of image positions in the 2D space.

  3. Classification Using k-Nearest Neighbors (k-NN): Perform image classification using the k-NN algorithm in both the original image space and the reduced PCA space. Evaluate the classification accuracy using 5-fold cross-validation.

  4. Optimal Number of Principal Components for PCA: Experiment with different numbers of principal components in PCA and identify the optimal number that yields the best results.

  5. Non-negative Matrix Factorization (NMF): Implement NMF with regularization on a synthetic dataset. Explore different parameter settings and track the number of iterations required for convergence.

Prerequisites

Before running the code in this repository, make sure you have the following prerequisites:

  • Python (version specified in the code)
  • Required Python libraries (e.g., scikit-learn, NumPy, OpenCV, PIL)
  • Jupyter Notebook or an integrated development environment (IDE) for running Python scripts

Usage

  1. Clone this repository to your local machine:
git clone https://github.com/NikosMav/Image-Analysis-with-PCA.git
  1. Open the Jupyter Notebook or Python script provided in the repository.

  2. Follow the instructions in the notebook/script to run the code for each task.

  3. Examine the results and documentation provided in the notebook/script to understand the outcomes of each task.

Results

  • The results of the PCA visualization, k-NN classification, and NMF experiments can be found within the provided Jupyter Notebook or Python script.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.