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).
Mean Absolute Error (MAE) in Python
Install the Finance Toolkit 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
The function 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.