emanueledellavalle / streaming-data-analytics

Apache License 2.0
30 stars 11 forks source link

error in MAPE metric #6

Closed VladMarianCimpeanu closed 1 year ago

VladMarianCimpeanu commented 1 year ago

I think there is an error in the implementation of the MAPE metric in the following notebooks:

It is defined as:

def mean_absolute_percentage_error(y_true, y_pred): 
    y_true, y_pred = np.array(y_true), np.array(y_pred)
    return np.mean(np.abs((y_true - y_pred) / y_true)) * 100 / len(y_true)

But I guess it should be (removed the division by the length of y):

def mean_absolute_percentage_error(y_true, y_pred): 
    y_true, y_pred = np.array(y_true), np.array(y_pred)
    return np.mean(np.abs((y_true - y_pred) / y_true)) * 100
gziffer commented 1 year ago

Yes, you are right! Thank you for the correction, I have updated both notebooks.