True and predicted data obtained from : https://community.wolfram.com/groups/-/m/t/3569104
In[]:=
DATA={{0.1049,0.1049},{0.11281,0.1047},{0.12713,0.1249},{0.11231,0.1129},{0.20345,0.2132},{0.09509,0.1032},{0.08027,0.0825},{0.09639,0.0958},{0.01995,0.0102},{0.08948,0.0828},{0.10695,0.097},{0.06766,0.0924},{0.11862,0.1253},{0.12037,0.1215},{0.01848,0.0129},{0.10515,0.1151},{0.08943,0.0883},{0.02101,0.0116},{0.23344,0.2087},{0.15512,0.1607},{0.18859,0.198}};
In[]:=
TableForm@DATA
Out[]//TableForm=
0.1049 | 0.1049 |
0.11281 | 0.1047 |
0.12713 | 0.1249 |
0.11231 | 0.1129 |
0.20345 | 0.2132 |
0.09509 | 0.1032 |
0.08027 | 0.0825 |
0.09639 | 0.0958 |
0.01995 | 0.0102 |
0.08948 | 0.0828 |
0.10695 | 0.097 |
0.06766 | 0.0924 |
0.11862 | 0.1253 |
0.12037 | 0.1215 |
0.01848 | 0.0129 |
0.10515 | 0.1151 |
0.08943 | 0.0883 |
0.02101 | 0.0116 |
0.23344 | 0.2087 |
0.15512 | 0.1607 |
0.18859 | 0.198 |
In[]:=
ytrue=(Transpose@DATA)[[2]]
Out[]=
{0.1049,0.1047,0.1249,0.1129,0.2132,0.1032,0.0825,0.0958,0.0102,0.0828,0.097,0.0924,0.1253,0.1215,0.0129,0.1151,0.0883,0.0116,0.2087,0.1607,0.198}
In[]:=
ypred=(Transpose@DATA)[[1]]
Out[]=
{0.1049,0.11281,0.12713,0.11231,0.20345,0.09509,0.08027,0.09639,0.01995,0.08948,0.10695,0.06766,0.11862,0.12037,0.01848,0.10515,0.08943,0.02101,0.23344,0.15512,0.18859}
Computing all eight metrics
n=Length[ytrue];
p=14;(*numberofpredictors;adjustasneeded*)
residuals=ytrue-ypred;
Compute metrics
mse=Mean[residuals^2];
rmse=Sqrt[mse];
stdRes=StandardDeviation[residuals];
percentAARD=100*Mean[Abs[residuals/(ytrue+10^-8)]];
r2=1-Total[residuals^2]/Total[(ytrue-Mean[ytrue])^2];
Simple estimate
r2Predicted=1-(1-r2)*(n-1)/(n-2);
r2Adjusted=1-(1-r2)*(n-1)/(n-p-1);
mae=Mean[Abs[residuals]];
Create table
metricsTable={{"Metric","Value"},{"MSE",mse},{"RMSE",rmse},{"STD Residuals",stdRes},{"%AARD",percentAARD},{"R²",r2},{"R² Predicted",r2Predicted},{"R² Adjusted",r2Adjusted},{"MAE",mae}};
Display table nicely
Text@Style[Grid[metricsTable,Frame->All,Background->{None,{Lighter[Blend[{Blue,Red}],.8],{Lighter[Blend[{Yellow,Darker@Green}],.2],Lighter[Green,.5]}}},ItemSize->{2.5{4.2,4.2,4.2,4.2,4.2},1.},Frame->Darker[Gray,.6],ItemStyle->14,Spacings->{8,1.5}]]
Out[]=
Conclusion : the model is moderately accurate, with predictions roughly within ± 15 % of actual values .
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Commonly used metrics for model evaluation
by Housam Binous and Ahmed Bellagi
Wolfram Community, STAFF PICKS, January 18, 2026
https://community.wolfram.com/groups/-/m/t/3609130
by Housam Binous and Ahmed Bellagi
Wolfram Community, STAFF PICKS, January 18, 2026
https://community.wolfram.com/groups/-/m/t/3609130