- 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 ビュー (過去 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!