Skip to content

feat(Dataset): add fill_gaps method using utilsforecast - #31

Open
a11to1n3 wants to merge 3 commits into
mainfrom
gap-filling-utilsforecast
Open

feat(Dataset): add fill_gaps method using utilsforecast#31
a11to1n3 wants to merge 3 commits into
mainfrom
gap-filling-utilsforecast

Conversation

@a11to1n3

Copy link
Copy Markdown
Owner

Adds fill_gaps() method to Dataset class that:

  • Uses utilsforecast.preprocessing.fill_gaps to identify missing timestamps
  • Fills target column with 0 (default)
  • Fills covariate columns with backward fill (bfill)
  • Marks filled rows with not_for_sale=1.0

Features:

  • Auto-detects week start day for weekly datasets
  • Supports daily, weekly, monthly, quarterly, yearly frequencies
  • Preserves original data while adding missing timestamps

Example:
filled_dataset = dataset.fill_gaps()

@a11to1n3
a11to1n3 requested a review from moobeck December 11, 2025 11:04

@moobeck moobeck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d probably just use the fill_gaps method from utilsforecast ( from utilsforecast.preprocessing import fill_gaps). It works directly with Polars anyway.
I’d also sort the data before applying the backfill. Have you actually tested this function? Just from reading the code, I’m not really sure how well it handles the index, for example.

Adds fill_gaps() method to Dataset class that:
- Uses utilsforecast.preprocessing.fill_gaps to identify missing timestamps
- Fills target column with 0 (default)
- Fills covariate columns with backward fill (bfill)
- Marks filled rows with not_for_sale=1.0

Features:
- Auto-detects week start day for weekly datasets
- Supports daily, weekly, monthly, quarterly, yearly frequencies
- Preserves original data while adding missing timestamps

Example:
    filled_dataset = dataset.fill_gaps()
@a11to1n3
a11to1n3 force-pushed the gap-filling-utilsforecast branch from 65c9df4 to bb09a3a Compare December 11, 2025 12:50
moobeck and others added 2 commits December 11, 2025 14:51
- Filter pharmacy2 data by IDs from pharmacy_filtered_ids.csv (594 series)
- Shift all time series to align to common end date 2020-05-12
- Split processed data into Pharmacy2_features.parquet and Pharmacy2_targets.parquet
- Simplify load_pharmacy2 to only perform gap filling at runtime
- Add fill_time_series_gaps utility function
- Fix test_dataset_operations.py to handle numeric encoded IDs
@a11to1n3
a11to1n3 requested a review from moobeck December 11, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants