How to get validation test and training errors of a neural network?
Mostrar comentarios más antiguos
I have created and trained a neural network using the following code .I want to know how to get the training testing and validation errors/mis-classifications the way we get using the matlab GUI.
trainFcn = 'trainscg'; % Scaled conjugate gradient backpropagation.
% Create a Pattern Recognition Network
hiddenLayerSize = 25;
net = patternnet(hiddenLayerSize);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = trainper/100;
net.divideParam.valRatio = valper/100;
net.divideParam.testRatio = testper/100;
% Train the Network
[net,tr] = train(net,x,t);
Respuesta aceptada
Más respuestas (1)
Greg Heath
el 31 de Jul. de 2016
clear all, clc
[ x, t ] = simplefit_dataset;
net = fitnet;
rng('default') % For reproducibility
[ net tr y e ] = train( net, x, t );
% y = net(x); e = t - y;
tr = tr % No semicolon: LOOK AT ALL OF THE GOODIES!!!
msetrn = tr.best_perf
mseval = tr.best_vperf
msetst = tr.best_tperf
Hope this helps
Thank you for formally accepting my answer
Greg
5 comentarios
Newman
el 31 de Jul. de 2016
Greg Heath
el 4 de Ag. de 2016
SORRY!!!
I didn't notice that your problem is classification instead of regression.
Will post more after I go upstairs and have a snack.
Greg
Newman
el 4 de Ag. de 2016
Mohamed Nedal
el 30 de Nov. de 2019
Editada: Mohamed Nedal
el 14 de Dic. de 2019
Dear @Greg,
Could you please elaporate on the difference between msetrn, mseval, and msetst?
If I want to assess the overall performance of the NN and want to find the MSE for the NN as a whole, Which one should I use?
Mohamed Nedal
el 30 de Nov. de 2019
If I wrote this:
rmse = sqrt(mean(e));
Does this give me the RMSE of the whole NN?
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!