> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mean absolute percentage error (MAPE)

> Learn how to use the mean absolute percentage error test

## Definition

The mean absolute percentage error (MAPE) test measures the average of the absolute percentage differences between the predicted values and the true values. MAPE expresses prediction accuracy as a percentage, making it scale-independent and easily interpretable.

## Taxonomy

* **Task types**: Tabular regression.
* **Availability**: <Tooltip tip="Continuously evaluate your models and datasets as you iterate on their versions.">development</Tooltip>
  and <Tooltip tip="Monitor a model in production, measure its health, check for drifts and set up alerts.">monitoring</Tooltip>.

## Why it matters

* MAPE provides a percentage-based measure of prediction accuracy that is easy to interpret and communicate to stakeholders.
* Being scale-independent, MAPE allows for comparison of model performance across different datasets and target variables.
* Lower MAPE values indicate better model performance, with 0% representing perfect predictions.
* MAPE is particularly useful when the relative size of errors is more important than their absolute magnitude.

## Required columns

To compute this metric, your dataset must contain the following columns:

* **Predictions**: The predicted values from your regression model
* **Ground truths**: The actual/true target values

<Note>
  MAPE is undefined when true values are zero, as this would result in division
  by zero. Consider using alternative metrics like MAE when your dataset
  contains zero values.
</Note>

## Test configuration examples

If you are writing a `tests.json`, here are a few valid configurations for the MAPE test:

<CodeGroup>
  ```json Development theme={null}
  [
    {
      "name": "MAPE below 10%",
      "description": "Ensure that the mean absolute percentage error is below 10%",
      "type": "performance",
      "subtype": "metricThreshold",
      "thresholds": [
        {
          "insightName": "metrics",
          "insightParameters": null,
          "measurement": "mape",
          "operator": "<",
          "value": 0.1
        }
      ],
      "subpopulationFilters": null,
      "mode": "development",
      "usesValidationDataset": true,
      "usesTrainingDataset": false,
      "usesMlModel": true,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
    }
  ]
  ```

  ```json Monitoring theme={null}
  [
    {
      "name": "MAPE below 10%",
      "description": "Ensure that the mean absolute percentage error is below 10%",
      "type": "performance",
      "subtype": "metricThreshold",
      "thresholds": [
        {
          "insightName": "metrics",
          "insightParameters": null,
          "measurement": "mape",
          "operator": "<",
          "value": 0.1
        }
      ],
      "subpopulationFilters": null,
      "mode": "monitoring",
      "usesProductionData": true,
      "evaluationWindow": 3600,
      "delayWindow": 0,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
    }
  ]
  ```
</CodeGroup>

## Related

* [MSE test](/tests/catalog/mse) - Mean squared error.
* [RMSE test](/tests/catalog/rmse) - Root mean squared error.
* [MAE test](/tests/catalog/mae) - Mean absolute error (alternative when zero values present).
* [R-squared test](/tests/catalog/r2) - Coefficient of determination.
* [Aggregate metrics](/tests/performance/aggregate-metrics) - Overview of all available metrics.
