# 2. Средняя абсолютная ошибка

Вторым инструментом, который мы рассмотрим, будет **средняя абсолютная ошибка (Mean Absolute Error, MAE)**. MAE представляет собой среднее значение абсолютных отклонений фактических значений от прогнозируемых значений модели.

Диапазон значений MAE также теоретически может быть от 0 до бесконечности. Как и в случае с MSE, чем меньше значение MAE, тем лучше модель.

Пример вызова и получения MAE на Python может выглядеть так:

```python
from sklearn.metrics import mean_absolute_error

# Предположим, что y_true - это фактические значения, а y_pred - прогнозируемые значения модели
y_true = [3, -0.5, 2, 7]
y_pred = [2.5, 0.0, 2, 8]

# Вычисляем MAE
mae = mean_absolute_error(y_true, y_pred)

print("Mean Absolute Error (MAE):", mae)

# Mean Absolute Error (MAE): 0.5
```

Этот код выведет значение MAE для приведенных фактических и прогнозируемых значений.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bemind.gitbook.io/neural/instrumenty-ocenki/instrumenty-ocenki-modeli-lineinoi-regressii/2.-srednyaya-absolyutnaya-oshibka.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
