Starting from:
$29.99

$23.99

K -means Clustering and Principal Component Analysis Solution

In this  exercise, you will implement  the  K -means clustering  algorithm  and apply  it  to compress an image.  In the  second part,  you will use principal component analysis to find a low-dimensional representation of face images. Before starting  on the programming  exercise, we strongly recommend watch- ing the video lectures and completing the review questions for the associated topics.

To get started with the  exercise, you will need to download the  starter code and unzip its contents  to the directory where you wish to complete the exercise.  If needed, use the cd command  in Octave/MATLAB to change to this directory  before starting  this exercise.

You can also find instructions  for installing Octave/MATLAB in the “En- vironment Setup Instructions” of the course website.

 

 

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 - Find closest centroids (used in K -means) [?] computeCentroids.m - Compute  centroid means (used in K -means) [?] kMeansInitCentroids.m - Initialization for K -means centroids

 

 

? indicates  files you will need to complete

 

Throughout the  first  part  of the  exercise, you will be using the  script ex7.m, for the second part  you will use ex7 pca.m. These scripts set up the dataset for the  problems  and  make  calls to  functions  that  you will write. You are  only required  to  modify functions  in other  files, by following the instructions  in this assignment.

 

Submission and Grading

 

After completing various parts  of the assignment,  be sure to use the submit function system to submit  your solutions to our servers.  The following is a breakdown of how each part  of this exercise is scored.

 

Part
Submitted File
Points
Find Closest Centroids

Compute  Centroid  Means
findClosestCentroids.m

computeCentroids.m
30 points

30 points
PCA

Project  Data

Recover Data
pca.m

projectData.m recoverData.m
20 points

10 points

10 points
Total  Points
 
100 points
You are allowed to submit your solutions multiple times, and we will take only the highest score into consideration.

More products