%% GsNprtool
% 
%% load data

% Copyright 2015 The MathWorks, Inc.

[inputs,targets] = cancer_dataset;

%% create network
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);

%% data division
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio   = 15/100;
net.divideParam.testRatio  = 15/100;

%% train network
[net,tr] = train(net,inputs,targets);

%% calculate parameters
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)

%% evaluate test data
tInd = tr.testInd;
tstOutputs = net(inputs(:,tInd));
tstPerform = perform(net,targets(:,tInd),tstOutputs)

%% view network
view(net)

%% plot training
figure, plotperform(tr)

%% plot confusion
figure, plotconfusion(targets,outputs)

