geometric_mean_absolute_error(y_true, y_pred, horizon_weight=None, multioutput='uniform_average', **kwargs)[source]#

Geometric mean absolute error (GMAE).

GMAE output is non-negative floating point. The best value is approximately zero, rather than zero.

Like MAE and MdAE, GMAE is measured in the same units as the input data. Because GMAE takes the absolute value of the forecast error rather than squaring it, MAE penalizes large errors to a lesser degree than squared error variants like MSE, RMSE or GMSE or RGMSE.

y_truepd.Series, pd.DataFrame or np.array of shape (fh,) or (fh, n_outputs) where fh is the forecasting horizon

Ground truth (correct) target values.

y_predpd.Series, pd.DataFrame or np.array of shape (fh,) or (fh, n_outputs) where fh is the forecasting horizon

Forecasted values.

horizon_weightarray-like of shape (fh,), default=None

Forecast horizon weights.

multioutput{‘raw_values’, ‘uniform_average’} or array-like of shape (n_outputs,), default=’uniform_average’

Defines how to aggregate metric for multivariate (multioutput) data. If array-like, values used as weights to average the errors. If ‘raw_values’, returns a full set of errors in case of multioutput input. If ‘uniform_average’, errors of all outputs are averaged with uniform weight.


GMAE loss. If multioutput is ‘raw_values’, then GMAE is returned for each output separately. If multioutput is ‘uniform_average’ or an ndarray of weights, then the weighted average GMAE of all output errors is returned.


The geometric mean uses the product of values in its calculation. The presence of a zero value will result in the result being zero, even if all the other values of large. To partially account for this in the case where elements of y_true and y_pred are equal (zero error), the resulting zero error values are replaced in the calculation with a small value. This results in the smallest value the metric can take (when y_true equals y_pred) being close to but not exactly zero.


Hyndman, R. J and Koehler, A. B. (2006). “Another look at measures of forecast accuracy”, International Journal of Forecasting, Volume 22, Issue 4.


>>> import numpy as np
>>> from sktime.performance_metrics.forecasting import     geometric_mean_absolute_error
>>> y_true = np.array([3, -0.5, 2, 7, 2])
>>> y_pred = np.array([2.5, 0.0, 2, 8, 1.25])
>>> geometric_mean_absolute_error(y_true, y_pred)
>>> y_true = np.array([[0.5, 1], [-1, 1], [7, -6]])
>>> y_pred = np.array([[0, 2], [-1, 2], [8, -5]])
>>> geometric_mean_absolute_error(y_true, y_pred)
>>> geometric_mean_absolute_error(y_true, y_pred, multioutput='raw_values')
array([4.80621738e-06, 1.00000000e+00])
>>> geometric_mean_absolute_error(y_true, y_pred, multioutput=[0.3, 0.7])