function nn_accuracy_and_time

load ftrslabs;


ndim = [2:13]'; % 2 to 13 dimensions
time = zeros(length(ndim),1); % store the time
acc = zeros(length(ndim),1); %store the accuracy

for i=1:length(ndim)
    %    [net, acc, time] = trainnns(ftrs(:,[1 2]), labs, 5, 10);
    [net, acc(i), time(i)] = trainnns(ftrs(:,1:ndim(i)), labs, 5, 10);
end

figure
subplot(211);
plot(ndim,time);
title('Dimensions versus execution time');
ylabel('Time (s)');
subplot(212);
plot(ndim,acc*100);
axis([2 14 0 100]);
title('Dimensions versus accuracy')
ylabel('% responses correct')
xlabel('Number of dimensions used in neural network model');
