pymc_forecast.datasets#

Dataset helpers for the examples and docs.

load_bart_od() downloads and caches the complete hourly BART origin-destination panel. load_bart_weekly() and load_bart_weekly_by_origin() derive compact weekly examples from that source, while load_victoria_electricity() reads a small CSV bundled with the package. All loaders return labeled arrays.

pymc_forecast.datasets.load_bart_od()[source]#

Load complete hourly BART origin-destination ridership counts.

The four source shards are downloaded from the public Pyro dataset mirror, verified by SHA-256, and cached in the operating system’s user cache.

Returns:

xarray.DataArray – Integer counts with dims ("time", "origin", "destination"). The time coordinate is hourly from 2011-01-01, and station names label both origin and destination.

pymc_forecast.datasets.load_bart_weekly()[source]#

Load total weekly BART ridership on the log scale.

The series is derived at load time from the complete public BART origin-destination dataset used by the Pyro and NumPyro forecasting examples. Hourly counts are summed over all origin-destination pairs, aggregated into non-overlapping weeks, and log-transformed.

Returns:

xarray.DataArray – Log weekly totals with dims ("time",) and integer week coords.

pymc_forecast.datasets.load_bart_weekly_by_origin(num_series=8)[source]#

Load a weekly BART ridership panel grouped by origin station.

Counts are summed over destination stations and aggregated into non-overlapping weeks before applying log1p. Aggregation happens a shard at a time, avoiding materializing the much larger full origin-destination panel. By default only the eight busiest origins are returned, which keeps hierarchical examples quick; pass None for all stations.

Parameters:

num_series – Number of busiest origin stations to retain, or None for all.

Returns:

xarray.DataArray – Log weekly counts with dims ("time", "series") and station names on the "series" coordinate.

pymc_forecast.datasets.load_victoria_electricity()[source]#

Load hourly Victoria (Australia) electricity demand and temperature.

The series covers the first eight weeks of 2014, sampled hourly — the Victoria electricity demand data used in the TensorFlow Probability structural-time-series case study and in Hyndman & Athanasopoulos’ Forecasting: Principles and Practice (original half-hourly data downsampled to hourly). Bundled as a small CSV.

Returns:

  • demand (xarray.DataArray) – Hourly electricity demand (GW), dims ("time",) with an hourly DatetimeIndex coord.

  • temperature (xarray.DataArray) – Hourly temperature (°C), aligned with demand.