- Train the network using the Bayesian Regularization backpropagation algorithm.
- Generate predictions on the validation or test dataset.
- Calculate residuals as the difference between actual and predicted values.
- Compute the standard error of the residuals.
- Plot the target vs. predicted values, incorporating the standard error as error bars using "errorbar" function.
How to get error bar in target vs predicted plots of regression?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can we get error bar in target vs predicted plots of regression ? How to get the error bar using trainbr training algorithm
0 commentaires
Réponses (1)
Sai Pavan
le 12 Avr 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:
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
figure;
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: https://www.mathworks.com/help/matlab/ref/errorbar.html
Hope it helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!