def _mean_absolute_error ( y , y_pred , w ) : return np . average ( np . abs ( y_pred - y ) , weights = w )
standard deviation and average in python
Calculate the mean absolute error .
def _mean_absolute_error(y, y_pred, w):
    """Calculate the mean absolute error."""
    return np.average(np.abs(y_pred - y), weights=w)