Skip to content

Lead buckets

The stratification grid. Every fitted parameter and every leaderboard row is keyed by one of these buckets; the tables are in Methods: notation.

Lead buckets: the single source of truth for fit/eval stratification.

Hourly edges sit on provider raggedness cliffs (24/48/168/240 h) with quasi-log spacing matching forecast error growth; 0-6 h isolates the anchoring regime. Buckets stratify fitting and evaluation only — lead_hours stays continuous for methods that want it.

LeadBucket dataclass

Left-closed interval [lo, hi) of lead values.

hourly_bucket

hourly_bucket(lead_hours: float) -> str | None

Bucket label for a lead in hours; None for negative leads.

daily_bucket

daily_bucket(lead_days: float) -> str | None

Bucket label for a lead in local calendar days; None if out of range.

lead_days counts local-date difference: 0 or 1 is D1 (today/tomorrow from the product's perspective), 10 is the last product day.

minutely_bucket

minutely_bucket(lead_hours: float) -> str | None

Bucket label for a sub-hourly lead in hours; None out of range.

buckets_for_product

buckets_for_product(
    product: Product,
) -> tuple[LeadBucket, ...]

Fit/evaluation buckets expressed in the matrix's hour lead unit.

hourly_bucket_expr

hourly_bucket_expr(lead_hours: Expr) -> pl.Expr

Vectorized :func:hourly_bucket as a polars expression.

daily_bucket_expr

daily_bucket_expr(lead_days: Expr) -> pl.Expr

Vectorized :func:daily_bucket as a polars expression.

minutely_bucket_expr

minutely_bucket_expr(lead_hours: Expr) -> pl.Expr

Vectorized :func:minutely_bucket as a polars expression.