Absolute error instead of Mean Square Error - NN
5 次查看(过去 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!