Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Can I use historical averages as a baseline for comparison
    historical averages time series forecasting baseline methods Darts library Python example MAPE RNN model forecasting models


Can I use historical averages as a baseline for comparison


Yes, you can use historical averages as a baseline for comparison in time series forecasting. Historical averages are a common and simple baseline method that involves calculating the average value of the time series over a specific period. This baseline can be used to evaluate the performance of more complex forecasting models.

Example of Using Historical Averages as a Baseline

Here is an example of how you can use historical averages as a baseline in Python using the Darts library:

python
import darts
from darts import TimeSeries
from darts.metrics import mape

# Load and preprocess data
df = pd.read_csv('your_data.csv')
train_series = TimeSeries.from_dataframe(df, time_col='timestamp', value_cols='target')
test_series = train_series.split_before(0.8)

# Calculate historical mean
historical_mean = train_series.mean()

# Evaluate the historical mean baseline
historical_mean_mape = mape(historical_mean, test_series)
print("Historical Mean MAPE:", historical_mean_mape)

# Evaluate your RNN model
rnn_model = RNNModel(model="LSTM", hidden_dim=20, dropout=0.2, batch_size=16, n_epochs=300)
rnn_model.fit(train_series)

# Evaluate the RNN model
rnn_mape = mape(rnn_model.predict(test_series), test_series)
print("RNN Model MAPE:", rnn_mape)

# Compare the MAPE values
if rnn_mape < historical_mean_mape:
    print("RNN Model performed better than Historical Mean.")
else:
    print("Historical Mean performed better.")

Advantages of Using Historical Averages as a Baseline

1. Simple and Easy to Implement: Historical averages are straightforward to calculate and do not require complex modeling or data preprocessing.

2. Robust to Noise: Historical averages are less sensitive to noise in the data compared to more complex models.

3. Good for Short-Term Forecasts: Historical averages are effective for short-term forecasts (e.g., next few days or weeks) where the underlying patterns are relatively stable.

4. Can Be Used as a Lower Bound: Historical averages provide a lower bound for the performance of more complex models, helping to evaluate their effectiveness.

Limitations of Using Historical Averages as a Baseline

1. Assumes Stationarity: Historical averages assume that the time series is stationary, meaning its statistical properties do not change over time. If the series is non-stationary, historical averages may not be effective.

2. Does Not Capture Trends: Historical averages do not capture trends or seasonality in the data, which can lead to poor performance if these patterns are significant.

3. Not Suitable for Long-Term Forecasts: Historical averages are not suitable for long-term forecasts (e.g., months or years) where the underlying patterns may change significantly.

4. May Not Be Robust to Changes: Historical averages may not be robust to changes in the underlying patterns or external factors that affect the time series.

Conclusion

Using historical averages as a baseline for comparison is a simple and effective method for evaluating the performance of more complex forecasting models. However, it has its limitations and should be used in conjunction with other methods to ensure robustness and accuracy in your forecasting task.

Citations:
[1] https://www.researchgate.net/figure/Comparison-of-the-baseline-model-with-historical-data-for-September-2015-to-December-2015_tbl2_320055899
[2] https://datascience.stackexchange.com/questions/90175/comparing-ml-models-to-baselines
[3] https://www.researchgate.net/figure/A-comparison-of-the-baseline-data-with-the-historical-data-The-uncertainty-bars-are_fig5_272254797
[4] https://carpentries-incubator.github.io/python-modeling-power-consumption/02-baseline-forecasts.html
[5] https://www.sopact.com/guides/baseline-metrics