% ANDERS_EXP2 Example on Generalized Anderson's task
%

% Modiifcations:
% 25-aug-2004, VF

% load toy data
%-----------------------------------------
gauss_model = load('mars')

% solve the Generalized Anderson's task
%-----------------------------------------
andr_model = ganders( gauss_model );

% plot model (works for 2D data only)
figure; pandr(andr_model, gauss_model);


% evaluate minimax error
%----------------------------------------

Epsilon = [];
for i=1:length(gauss_model.y),
  
  Cov = gauss_model.Cov(:,:,i);
  Mean = gauss_model.Mean(:,i);
  
  X = gsamp(Mean,Cov,1000);
  
  ypred = linclass(X,andr_model);
  Epsilon(i) = length(find(ypred~= gauss_model.y(i)))/size(X,2);
end

Epsilon

mmerror = max(Epsilon)

% EOF