Mean Absolute Error (MAE)
Calculate the Mean Absolute Error (MAE) between every unordered pair of tickers’ series in the Toolkit instance.
Also known as: MAD (Mean Absolute Deviation).
See forecast_evaluation_model.get_mae for the formula, and get_rmse’s docstring for why this controller method compares two ASSETS directly (rather than an asset against an actual forecasting model’s output – see get_out_of_sample_validation for that).
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Mean Absolute Error (MAE) for you. Just ask in plain English.
Calculate the Mean Absolute Error (MAE) in Python
The Mean Absolute Error (MAE) is available in the Econometrics module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_mae as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "MSFT"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.econometrics.get_mae(period="quarterly")
Which returns:
| Ticker A | Ticker B | MAE |
|---|---|---|
| AAPL | MSFT | 0.0887 |
Parameters
get_mae accepts the following parameters:
- period (str, optional): The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”.
- column (str, optional): The historical data column to compare. Defaults to “Return”.
- include_benchmark (bool, optional): Whether to include “Benchmark” among the tickers paired up. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
Related Forecast Evaluation
The Econometrics module page introduces the module, and the sidebar lists all of its functions.