Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-352

MAPE Percentage Error

Problem

The mean absolute percentage error is 100 * mean(|actual - predicted| / |actual|).

Given the actual and predicted values (actuals nonzero), return the MAPE.

Hint

Divide each error by the actual value, then average.

Test cases

case 1
in: [[100,50],[110,45]]
expected: 10
case 2
in: [[10],[10]]
expected: 0
case 3
in: [[2,4],[1,2]]
expected: 50
Starter codePython
def mape_percentage_error(actuals, preds):
    # Your code here
    pass

3 test cases · run your code against them in the editor