Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use Matlab PCA and LDA are two important linear dimensionality reduction methods

ID: 3801198 • Letter: U

Question

Use Matlab

PCA and LDA are two important linear dimensionality reduction methods. In this question, you will compare different implementations of PCA and LDA, given CMU PIE dataset. The CMU PIE dataset contains 68 people, and 21 images under different lightings for each person. The size of each image is 30×30.

a. Please implement PCA and LDA by yourself, and then use the provided CMU PIE dataset (PIE.mat) for evaluations. In this evaluation, we mainly focus on face recognition, and use nearest neighbor classifier. Please run with different training sets, i.e., trainNum = 5,10,15 per subject (rest for testing), and record the running time accordingly. In total, there will be 6 recognition accuracies and 6 running time for PCA and LDA. Use a table to summarize all the results.

b. Use the online code ‘PCA’ and ‘LDA’ provided in the package for the same tasks as last question. Use a table to summarize all the results. (Hint: a sample code has been provided in the package, SampleTest.m)

c. Both accuracy and running time may be different between your implementations and online code. Please compare and analyze the time complexity of different implementations (including the time complexity of major steps). For the online code and its algorithm’s details,please start from http://www.cad.zju.edu.cn/home/dengcai/Data/SR.html

[provided files list]: PCA.m, LDA.m, LGE.m, mySVD.m, SampleTest.m, PIE.mat

Files are provided in the following link https://drive.google.com/drive/folders/0B_W5TGttGNmzYlpEVTVJbVM0eTQ

Explanation / Answer

[coeff,lambda] = eig(BetweenSigma,WithinSigma,'chol');
[lambda,sorted] = sort(diag(lambda),'descend') % sort by eigenvalues
coeff = coeff(:,sorted);
coeff(:,[3 4]) = [] % get rid of zero eigenvalues

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote