Absolute error instead of Mean Square Error - NN
2 ビュー (過去 30 日間)
古いコメントを表示
It is possible to change the MSE performance to a simple Error performance? So, considering the minimization of the (maximum) error in a neural network?
Thanks in advance!
0 件のコメント
回答 (1 件)
Amith
2024 年 10 月 13 日
Hi Francesco,
It is possible to change the performance function in MATLAB to minimize the maximum error instead of the mean squared error (MSE). You can achieve this by creating a custom performance function. Here’s a general approach to do this:
1. Define the Custom Performance Function: Create a new function that calculates the maximum error. Save this function as a .m file.
function perf = max_error(t, y)
% t: targets
% y: outputs
% Calculate the maximum absolute error
perf = max(abs(t - y));
end
2. Set the Custom Performance Function in Your Neural Network: Assign this custom performance function to your neural network.
% Create a feedforward neural network
net = feedforwardnet(10);
% Set the custom performance function
net.performFcn = 'max_error';
% Train the network
[x, t] = bodyfat_dataset;
% Example dataset
net = train(net, x, t);
% Evaluate the performance
y = net(x);
perf = perform(net, t, y);
This approach allows you to customize the performance evaluation to focus on minimizing the maximum error rather than the mean squared error.
Hope this helps!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!