how to calculate mape
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Image Analyst
2021 年 5 月 31 日
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
2021 年 5 月 31 日
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.
回答 (2 件)
Omega
2024 年 11 月 20 日 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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Financial Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!