dims = 50;
nums = 100;

if ~exist('redo_mnist') || redo_mnist == 1
  load mnist
  D = reshape(permute(reshape(D(1:nums,:,:),[nums 28 28 10]),[3 2 1 4]),...
        [784 10*nums])/255;
  [U S Y] = svd(D,0);
  U = U*S(:,1:dims)/sqrt(10*nums/dims);
  X = Y(:,1:dims)'*sqrt(10*nums/dims); % data
  O = rand(dims,10*nums)<.8; % .8 prob observed
  V = inf*ones(dims,10*nums);
  V(O) = 0;
  C = reshape(repmat(1:10,nums,1),[1 10*nums]); % class labels
  L = ones(dims,1);
  % D = U*Y
  redo_mnist = 0;
end

tt = brownianpo_greedy(X,V,L);
t2 = brownian_greedy(X,diag(L),'smallest');

plot_puresubtrees(tt,C,2,1);
plot_puresubtrees(t2,C,2,2);
