This project contains 2 scripts. The first is a K-means clustering algorithm that is used to compress an image. The second uses principal component analysis to find a low-dimensional representation of face images.
Files included in this exercise
ex7.m - Octave/MATLAB script for the first exercise on K-means
ex7 pca.m - Octave/MATLAB script for the second exercise on PCA
ex7data1.mat - Example Dataset for PCA
ex7data2.mat - Example Dataset for K-means
ex7faces.mat - Faces Dataset
bird small.png - Example Image
displayData.m - Displays 2D data stored in a matrix
drawLine.m - Draws a line over an exsiting figure
plotDataPoints.m - Initialization for K-means centroids
plotProgresskMeans.m - Plots each step of K-means as it proceeds
runkMeans.m - Runs the K-means algorithm
submit.m - Submission script that sends your solutions to our servers
[⋆] pca.m - Perform principal component analysis
[⋆] projectData.m - Projects a data set into a lower dimensional space
[⋆] recoverData.m - Recovers the original data from the projection
[⋆] findClosestCentroids.m-Findclosestcentroids(usedinK-means)
[⋆] computeCentroids.m - Compute centroid means (used in K-means)
[⋆] kMeansInitCentroids.m - Initialization for K-means centroids
⋆ indicates files with code I have written
Run the script ex7.m in Matlab/Octave to execute the K-Cluster algorithm, run ex7 pca.m to execuite the PCA algorithm.