Skip to content

Quickstart documentation in README #4

@BryanBaird

Description

@BryanBaird

Mostly would like to see:

  1. Installation instructions and troubleshooting (Colab and Docker versions)
  2. Conceptual explanation/diagram of the types of objects -- Tiles, TileSets, and Mozaics -- and how they relate to general top-line "forecast" nomenclature
  3. Example code snippets and/or built-in utility functions for default scenario runbook

For (3), here is an example of reference code I got in the notebook Brad shared with me. It does appear that some parts of it were not applicable to the case I was investigating (e.g., mobile usage was not a factor). But it would be helpful to better understand what these different objects are that are being created in a loop, how they relate to each other, and why certain function calls take the different objects as inputs (as opposed to being methods called on those objects by virtue of their class).

FORECAST_START_DATE = "2025-09-01"
forecast_end_date = "2026-06-30"
date_range = [FORECAST_START_DATE, FORECAST_START_DATE]
t_d = {}
metric_mozaics_d = {}
country_mozaics_d = {}
population_mozaics_d = {}

for i in pd.date_range(*date_range):
    first_forecast_date = str(i.date())
    print(first_forecast_date)

    # initialize collections to store relevant desktop forecasting components
    t_d[first_forecast_date] = TileSet()                                                  # all desktop tiles
    metric_mozaics_d[first_forecast_date] = {}                                            # all desktop metric mozaics
    country_mozaics_d[first_forecast_date] = defaultdict(lambda: defaultdict(Mozaic))     # all desktop country mozaics
    population_mozaics_d[first_forecast_date] = defaultdict(lambda: defaultdict(Mozaic))  # all desktop population mozaics

    print("Populating tiles and generating tile-level forecasts:")
    populate_tiles(
        datasets["desktop"],
        t_d[first_forecast_date],
        desktop_forecast_model,
        first_forecast_date,
        forecast_end_date
    )

    print("\n\nCurating mozaics and reconciling tile-level forecasts:\n")
    # note: holidays that do not appear in historical data but to appear in forecasted dates will generate a warning message
    curate_mozaics(
        datasets["desktop"],
        t_d[first_forecast_date],
        desktop_forecast_model,
        metric_mozaics_d[first_forecast_date],
        country_mozaics_d[first_forecast_date],
        population_mozaics_d[first_forecast_date],
    )

    for metric, data in metric_mozaics_d[first_forecast_date].items():
        mozaic_plot(data, use_moving_average=True, show_detrended=False, title=f"{metric}, Global")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions