WMAPE Formula
Help · 5 Sep 2023, 12:27 · 3

Could you please clarify which is the correct formula of WMAPE in Python used for the final evaluation?

wmape1 is according to the page but when all weight is equal to 1, it is not equal to common MAPE formula. wmape2 is equal to common MAPE formula when all weight is equal to 1.

def wmape1(y_true, y_pred, weight): 
    return np.sum(weight * np.abs((y_true - y_pred))) / np.sum(weight * y_true) * 100  

def wmape2(y_true, y_pred, weight):     
    return np.sum(weight * np.abs((y_true - y_pred) / (y_true))) / sum(weight) * 100
Discussion 3 answers

Any update on this?

14 Sep 2023, 10:18
Upvotes 0

@nicolapiovesan could you please confirm?

19 Sep 2023, 14:16
Upvotes 0

The correct error metric is the one reported on the Info page.