- https://www.mathworks.com/help/stats/assess-regression-neural-network-performance.html
- https://www.mathworks.com/matlabcentral/answers/57648-how-to-plot-mse-for-train-and-test
Plot of mse versus inputs over one epoch of neural network
    8 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
I have an input of 12 x 3624 (3624 samples of 12 input) and I want to graph how the mse changes over each epoch I have but showing the 3624 data points on the x axis and the mse on the y axis. With the current matlab nntool I can only get mse versus epochs and that is not want I want.
Thank you
0 Commenti
Risposte (1)
  Abhas
      
 il 6 Giu 2025
        To visualize how the Mean Squared Error (MSE) varies across your 3,624 samples during training, you'll need to compute the MSE for each individual sample at a specific epoch. The default training tools in MATLAB, such as "nntool", typically provide MSE per epoch, not per sample. Here's how you can achieve your goal:
% Assume: 
% X → input matrix (features × samples) e.g. 12×3624
% T → target matrix (outputs × samples) e.g. 1×3624
% Define your network (example: one hidden layer, 10 neurons)
net = feedforwardnet(10);
% Training settings
numEpochs = 50;
lr = 0.01;
% Prepare to record per-sample MSE
mseHistory = zeros(numEpochs, size(X,2));
for epoch = 1:numEpochs
    % Train one epoch
    net.trainParam.epochs = 1;
    net.trainParam.showWindow = false;
    net = train(net, X, T);
    % Get predictions on full dataset
    Y = net(X);  % 1×3624
    se = (T - Y).^2;  % 1×3624
    mseHistory(epoch, :) = se;
end
epochToPlot = numEpochs;
figure;
plot(1:size(X,2), mseHistory(epochToPlot, :));
xlabel('Sample Index');
ylabel('MSE (squared error)');
title(sprintf('Per-Sample MSE at Epoch %d', epochToPlot));
You may refer to the below documentation links to know more about the same:
I hope this helps!
0 Commenti
Vedere anche
Categorie
				Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

