- 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?
3 次查看(过去 30 天)
显示 更早的评论
How can we get error bar in target vs predicted plots of regression ? How to get the error bar using trainbr training algorithm
0 个评论
回答(1 个)
Sai Pavan
2024-4-12
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!