Bundled Datasets¶
Example datasets shipped with the package (load_example).
Bundled example datasets for a zero-effort first run.
>>> from mmm_framework.datasets import load_example
>>> panel = load_example("national")
load_example and list_examples are also re-exported from the top-level
package (from mmm_framework import load_example).
- class mmm_framework.datasets.ExampleSpec(key, csv, kpi, media, controls, geo, truth, description)[source]¶
Bases:
objectDeclarative description of a bundled example dataset.
- __init__(key, csv, kpi, media, controls, geo, truth, description)¶
- mmm_framework.datasets.list_examples()[source]¶
Return
{name: one-line description}for every bundled example.
- mmm_framework.datasets.load_example(name='national', *, as_frame=False)[source]¶
Load a bundled example dataset, ready to model.
- Return type:
Parameters¶
- name:
Which example to load —
"national"(default) or"geo". Seelist_examples().- as_frame:
If
True, return the raw long-format MFFpandas.DataFrameinstead of a builtPanelDataset(useful for building your own config).
Returns¶
- PanelDataset or pandas.DataFrame
A ready-to-fit panel (default), or the raw MFF frame when
as_frame=True.
Examples¶
>>> from mmm_framework import load_example, BayesianMMM, ModelConfigBuilder, TrendConfig >>> panel = load_example("national") >>> panel.n_channels 7