Absolute error instead of Mean Square Error - NN
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Amith
el 13 de Oct. de 2024
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 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!