% % Take Home Exam: Problem 1 % load MenAndWomen2; %This loads the data into matrix Y % % Separate the data into training and testing sets. % Women=Y(:,1:13); Men=Y(:,14:26); % % Randomly select 7 columns from Women, 7 columns from Men for training, % and the remaining 6 in each class for testing (4 sets in all). % % % Compute the mean "face" for women, men separately, then mean-subtract % (like you did in the movie data). % % Find the SVD of each, and keep the first three columns of the appropriate % matrix for your basis vectors. % % Test the classifier: misclassW=0; misclassM=0; for j=1:6 %Testing the 6 columns of women (one at a time) x= %Mean subtract the women's mean. xhat= %Projection to the col space for women d1=norm(x-xhat); x= %Mean subtract the men's mean xhat= %Projection to the col space for men d2=norm(x-xhat); if d1>d2 misclassW=misclassW+1; end %Testing the 6 columns of men (one at a time) x= %Mean subtract the women's mean xhat= %Projection to the col space for women d1=norm(x-xhat); x= %Mean subtract the men's mean xhat= %Projection to the col space for men d2=norm(x-xhat); if d1