how to check RMSE of trained neural network?

6 views (last 30 days)
Saba Yousaf
Saba Yousaf on 16 Aug 2018
Answered: Purvaja on 20 Feb 2025
i want to check the error performance like errors like RMSE, mean Absolute Error, Mean Absolute percentage error of trained neural network?

Answers (1)

Purvaja
Purvaja on 20 Feb 2025
You can calculate Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE) using following functions available in MATLAB.
1. For calculating RMSE you use “rmseMetric”:
  • First create an object:
metric = rmseMetric(NormalizationFactor="batch-size")
  • Specify RMSE metric in training options:
options = trainingOptions("adam", ...
MaxEpochs=5, ...
Metrics=metric, ...
ValidationData={XTest,anglesTest}, ...
ValidationFrequency=50, ...
Plots="training-progress", ...
Verbose=true);
2. For MAE use “mae”:
  • in “trainnet()” function set the loss function by specifying “mae:
options = trainingOptions("adam", ...
MaxEpochs=10, ...
Metrics="mae", ... % Specify MAE as the metric
ValidationData={XTest, anglesTest}, ...
ValidationFrequency=50, ...
Plots="training-progress", ...
Verbose=true);
3. For MAPE use “mapeMetric”:
  • Similar to RMSE first create an object:
metric = mapeMetric(NormalizationFactor="batch-size")
  • Specify the MAPE metric in the training options.
options = trainingOptions("adam", ...
MaxEpochs=10, ...
Metrics=metric, ...
ValidationData={XTest,anglesTest}, ...
ValidationFrequency=50, ...
Plots="training-progress", ...
Verbose=true);
You can also go through following documentation link to know more about above function:
  1. RMSE: https://www.mathworks.com/help/deeplearning/ref/deep.metric.rmsemetric.html
  2. MAE: https://www.mathworks.com/help/deeplearning/ref/mae.html
  3. MAPE: https://www.mathworks.com/help/deeplearning/ref/deep.metric.mapemetric.html
You can also try this command in your MATLAB command window for specific release documentation respectively:
web(fullfile(docroot,'deeplearning/ref/deep.metric.rmsemetric.html'))
web(fullfile(docroot,'deeplearning/ref/mae.html'))
web(fullfile(docroot,'deeplearning/ref/deep.metric.mapemetric.html'))
Hope this helps you!

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!