Small projects for understanding concepts

This note will always be updated.

🔅 Image compression using K-Means -- Open in HTML -- Open in Colab.

  • Load and write an image from/to Google Drive.
  • Change the image's size from (height, weight, channels) to (height x weight, channels)
  • Reduce the image's quality using smaller number of clusters.

🔅 Example to understand the idea of PCA -- Open in HTML -- Open in Colab.

  • Plot points with 2 lines which are corresponding to 2 eigenvectors.
  • Plot & choose Principal Components.
  • An example of choosing n_components KK.
  • Visualization hand-written digits (the case of all digits and the case of only 2 digits -- 1 & 8).
  • Using SVM to classifier data in the case of 1 & 8 and visualize the decision boundaries.

🔅 Image compression using PCA -- Open in HTML -- Open in Colab.

  • When input is an image, the values of adjacent pixels are highly correlated.
  • Import images from scipy and Google Drive or Github (with git).
  • Compress grayscale images and colored ones.
  • Plot a grayscale version of a colorful images.
  • Save output to file (Google Drive).
  • Fix warning Lossy conversion from float64 to uint8. Range [...,...]. Convert image to uint8 prior to saving to suppress this warning.
  • Fix warning Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).
  • Calculate a size (in KB) of a image file.

🔅 PCA without scikit-learn -- Open in HTML -- Open in Colab.

🔅 Face Recognition using SVM -- Open in HTML -- Open in Colab.

  • Using PCA to extract 150 fundamental components to feed into our SVG classifier.
  • Grid search cross-validation to explore combinations of parameters (gamma and C).
  • Classification report: precision, recall, f1-score, support.
  • Confusion matrix.
  • An example of using pipeline.

🔅 XOR problem using SVM to see the effect of gamma and C in the case of using RBF kernel -- Open in HTML -- Open in Colab.

This is a draft note.