Untitled

 avatar
unknown
plain_text
2 years ago
455 B
10
Indexable
def sMAPE(target, predictions):
    error1 = 0
    error2 = 0
    n = len(target)
    for i in range(n):
        error1 += ((abs(target[i][0] - predictions[i][0])) / ((abs(target[i][0]) + abs(predictions[i][0])) / 2)) * 100
        error2 += ((abs(target[i][1] - predictions[i][1])) / ((abs(target[i][1]) + abs(predictions[i][1])) / 2)) * 100
    smape1 = error1/n
    smape2 = error2/n
    smape = 0.25 * smape1 + 0.75 * smape2
    return smape
Editor is loading...