how to calculate mape
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
andrew moisidi
el 31 de Mayo de 2021
Respondida: Steven Lord
el 20 de Nov. de 2024 a las 7:00
hey guys i want help how i can calculate mape and how to calculate which calculates the linear product for the product with price values f
function [a,b,MAPE] = getLinearModel(f)
n = length(f);
A = zeros(1,length(f)-1);
b = zeros(1,length(f)-1);
for i=2:n
if f(i-1) ~= 0
A(i-1) = f(i)/f(i-1);
else
A(i-1) = 1;
end
end
a = median(A); %more robust than mean function
for i=1:length(f)-1
b (i) = f(i)/a*i+b;
end
g0 = median(b);%more robust than mean function
2 comentarios
Image Analyst
el 31 de Mayo de 2021
What is mape? Do you have some definition or formula for it? You never assigned the output variable MAPE in your function so it can't return it.
What does this have to do with image analysis (you tagged it as such)?
What is f? Evidently a vector, not an image.
DGM
el 31 de Mayo de 2021
To calculate MAPE, you'd have to know what any of these variables mean conceptually. Single-letter nondescriptive variable names cannot communicate that information. You'll have to figure that out because you're the only one who can know what your code means without an impractical amount of guessing.
I don't know what this has to do with images either.
Respuestas (2)
Omega
el 20 de Nov. de 2024 a las 6:06
Hi,
MAPE (Mean Absolute Percentage Error) is calculated using the formula:
where () are the actual values, and ( ) are the predicted values.
It's difficult to understand what your variables mean because of the acronym names. You can use the following formula by plugging in the values for y_true and y_pred:
% Calculate MAPE
mape = mean(abs((y_true - y_pred) ./ y_true)) * 100;
fprintf('Mean Absolute Percentage Error (MAPE): %.2f%%\n', mape);
Hope it helps!
0 comentarios
Ver también
Categorías
Más información sobre Financial Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!