> For the complete documentation index, see [llms.txt](https://docs.seldon.ai/mpm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.seldon.ai/mpm/supported-metrics/regression-metrics.md).

# Regression Metrics

## MSE (Mean Squared Error)

Measures the average squared difference between predicted and actual values, penalizing larger errors:

$$
MSE = \frac{1}{N} \sum\_{i=1}^N (y\_i - \hat{y}\_i)^2
$$

## MAE (Mean Absolute Error)

Measures the average absolute difference between predicted and actual values, reflecting the magnitude of errors:

$$
MAE = \frac{1}{N} \sum\_{i=1}^N |y\_i - \hat{y}\_i|
$$

## RMSE (Root Mean Squared Error)

Represents the square root of MSE, interpretable in the same units as the target variable, highlighting larger errors:

$$
RMSE = \sqrt{MSE} = \sqrt{\frac{1}{N} \sum\_{i=1}^N (y\_i - \hat{y}\_i)^2}
$$

## Example

Below is an example of the regression metrics API usage:

{% code overflow="wrap" lineNumbers="true" %}

```python
import requests

url = f"http://{CLUSTER_IP}/metrics-server/api/v1/metrics/pipeline/regression"

params = {
    'namespace': 'seldon',
    'pipelineName': 'house-value-pipeline',
    'modelName': 'house-value-model',
    'startTime': '2025-02-25T16:02:28Z',
    'endTime': '2025-02-25T16:04:28Z',
    'interval': '5s'
}

response = requests.get(url, params=params)
```

{% endcode %}

<details>

<summary>Expand to see an example of the regression metrics API response</summary>

{% code overflow="wrap" lineNumbers="true" %}

```json
{
  "metrics": [
    {
      "endTime": "2025-02-25T16:02:33Z",
      "meanAbsoluteError": 3.5947158,
      "meanSquaredError": 12.921982,
      "rootMeanSquaredError": 3.5947158
    },
    {
      "endTime": "2025-02-25T16:02:38Z",
      "meanAbsoluteError": 3.5947158,
      "meanSquaredError": 12.921982,
      "rootMeanSquaredError": 3.5947158
    },
    {
      "endTime": "2025-02-25T16:02:43Z",
      "meanAbsoluteError": 3.5947158,
      "meanSquaredError": 12.921982,
      "rootMeanSquaredError": 3.5947158
    },
    {
      "endTime": "2025-02-25T16:02:48Z",
      "meanAbsoluteError": 1.9672309,
      "meanSquaredError": 5.618767,
      "rootMeanSquaredError": 2.3703938
    },
    {
      "endTime": "2025-02-25T16:02:53Z",
      "meanAbsoluteError": 1.8137174,
      "meanSquaredError": 4.2309737,
      "rootMeanSquaredError": 2.0569332
    },
    {
      "endTime": "2025-02-25T16:02:58Z",
      "meanAbsoluteError": 1.7597755,
      "meanSquaredError": 6.0277104,
      "rootMeanSquaredError": 2.4551396
    },
    {
      "endTime": "2025-02-25T16:03:03Z",
      "meanAbsoluteError": 2.8212993,
      "meanSquaredError": 14.908364,
      "rootMeanSquaredError": 3.861135
    },
    {
      "endTime": "2025-02-25T16:03:08Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:13Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:18Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:23Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:28Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:33Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:38Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:43Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:48Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:53Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:03:58Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:04:03Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:04:08Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:04:13Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:04:18Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:04:23Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    },
    {
      "endTime": "2025-02-25T16:04:28Z",
      "meanAbsoluteError": -1,
      "meanSquaredError": -1,
      "rootMeanSquaredError": -1
    }
  ]
}
```

{% endcode %}

</details>
