Preparing data for forecasting

Prev Next

Accurate forecasts depend on well-structured time series data. Before generating forecasts, the system standardizes input data to ensure all time series follow a consistent timeline.

This process creates a complete time grid for each series based on the expected time frequency (daily, weekly, monthly), allowing models to correctly detect trends and seasonality.

Understanding this process helps ensure your data is correctly structured before forecasting.

Time series alignment

Accurate forecasts require consistent and continuous time series data.

To achieve this, the forecasting engine generates a complete time grid for every series. This ensures that:

  • All time series share the same global date range

  • All expected timestamps are present

  • Models can correctly detect trends and seasonality.

Preprocessing

Before alignment, the system identifies:

  • Global first date. The earliest date across the file

  • Global last date. The latest date across the file

All series are then aligned to this global range.

Handling missing dates

The system fills missing timestamps to ensure a continuous timeline based on the expected time frequency. Two types of sparsity are handled:

Series that start late or end early

If a time series does not cover the full global date range:

  • Missing dates at the beginning or end are added

  • Target values are filled with 0

  • Attribute values (such as hierarchy fields) are forward- or backward-filled.

Example

Product A has data from 01/01/2026 to 01/08/2026

Product B has data from 01/03/2026 to 01/08/2026

After alignment, Product B is extended to match the global range:

Date

Product

Demand

1/1/2026

A

1

1/2/2026

A

2

1/3/2026

A

1

1/4/2026

A

1

1/5/2026

A

2

1/6/2026

A

3

1/7/2026

A

1

1/8/2026

A

2

1/1/2026

B

0

1/2/2026

B

0

1/3/2026

B

1

1/4/2026

B

0

1/5/2026

B

2

1/6/2026

B

3

1/7/2026

B

0

1/8/2026

B

0

Gaps within a series

If timestamps are missing within the expected frequency:

  • Missing dates are inserted

  • Target values are filled with 0

  • Attribute values (such as hierarchy fields) are forward- or backward-filled.

Example

A daily dataset is missing weekends. The system inserts the missing dates and fills them with 0:

Date

Product

Demand

1/1/2026

A

1

1/2/2026

A

2

1/3/2026

A

0

1/4/2026

A

0

1/5/2026

A

2

1/6/2026

A

3

1/7/2026

A

1

1/8/2026

A

2

1/1/2026

B

1

1/2/2026

B

2

1/3/2026

B

0

1/4/2026

B

0

1/5/2026

B

2

1/6/2026

B

3

1/7/2026

B

1

1/8/2026

B

2

Why this matters

Filling missing timestamps ensures that:

  • Time intervals remain consistent

  • Lag and rolling features are computed correctly

  • Forecasting models receive properly structured input.

Best practices

To achieve the best results:

  • Use a consistent time frequency (daily, weekly, or monthly)

  • Provide sufficient historical data for each time series

  • Avoid irregular or inconsistent timestamp spacing.