function plotFaces(X, closest, y, yPred)
% plot X(closest(i),:) as an image
% If yPred(i) ~= y(i), mark the image with a small white box in the top left

%h = 112; w = 92; % Olivetti images
h = 64; w = 64;
N = length(y);
XX = zeros(h,w,N);
nr = ceil(sqrt(N)); nc = nr;
for i = 1:N
  img = reshape(X(closest(i),:), [h w]);
  if yPred(i) ~= y(i)
    img(1:25,1:25) = 1.0;
  end
  XX(:,:,i) = img;
  subplot(nr,nc,i)
  imagesc(img); colormap(gray); axis off
end
%montageKPM(XX); 
%montage(reshape(XX, [size(XX,1) size(XX,2), 1, size(XX,3)]))


