Azzera filtri
Azzera filtri

How to get error bar in target vs predicted plots of regression?

7 visualizzazioni (ultimi 30 giorni)
How can we get error bar in target vs predicted plots of regression ? How to get the error bar using trainbr training algorithm

Risposte (1)

Sai Pavan
Sai Pavan il 12 Apr 2024
Hello Onkar,
I understand that you want to get the error bar in target vs predicted plots of regression trained using using trainbr training algorithm.
Although "trainbr" function does not directly provide error bars, we can estimate them by calculating the residuals between the predicted and actual values, then determining the standard error of these residuals. This standard error can serve as an approximation for the error bars in the plot.
Please refer to the below workflow to get the errorbar plot for the regression model:
  1. Train the network using the Bayesian Regularization backpropagation algorithm.
  2. Generate predictions on the validation or test dataset.
  3. Calculate residuals as the difference between actual and predicted values.
  4. Compute the standard error of the residuals.
  5. Plot the target vs. predicted values, incorporating the standard error as error bars using "errorbar" function.
Please refer to the below code snippet that illustrates the workflow mentioned above:
% Train the network
net = feedforwardnet(hiddenLayerSize, 'trainbr');
[net, tr] = train(net, X, T);
% Generate predictions
Y = net(Xval); % Xval: validation/test inputs
% Calculate residuals and standard error
residuals = Tval - Y; % Tval: actual target values for validation/test set
stderr = std(residuals) / sqrt(length(residuals));
% Plot with error bars
errorbar(Tval, Y, stderr, 'o');
xlabel('Actual Values');
ylabel('Predicted Values');
title('Target vs. Predicted with Error Bars');
Please refer to the below documentation to learn more about the "errorbar" function:
Hope it helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by