Q:

How to find symmetric mean absolute error in python?

How can I calculate symmetric mean absolute error in python using numpy or pandas? Is there are metric present in scikit sklearn ?
Example data:
Actual value:   2,3,4,5,6,7,8,9
Forecast value: 1,3,5,4,6,7,10,7

Formula for SMAPE see screenshot below:

How can I do it in python using pandas or numpy and calculate SMAPE.
Note: More info about SMAPE: https://en.wikipedia.org/wiki/Symmetric_mean_absolute_percentage_error

A:

It's pretty straightforward to convert the equation to numpy
import numpy as np

def smape(A, F):
    return 100/len(A) * np.sum(2 * np.abs(F - A) / (np.abs(A) + np.abs(F)))

A = np.array([2,3,4,5,6,7,8,9])
F = np.array([1,3,5,4,6,7,10,7])
print(smape(A, F))

