# Module: scenarioplanner.converters.mmm

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google/meridian/blob/v2.2.2/scenarioplanner/converters/mmm.py) |

Provides wrappers for the `Mmm` proto.

This module defines a set of dataclasses that act as high-level wrappers around
the `Mmm` protocol buffer and its nested messages. The primary goal is to offer
a more intuitive API for accessing and manipulating MMM data, abstracting away
the verbosity of the raw protobuf structures.

The main entry point is the `Mmm` class, which wraps the top-level `mmm_pb2.Mmm`
proto. From an instance of this class, you can navigate through the model's
different components, such as marketing data, model fit results, and various
analyses, using simple properties and methods.

#### Typical Usage:

```python
from mmm.v1 import mmm_pb2
from lookerstudio.converters import mmm

# Assume `mmm_proto` is a populated instance of the Mmm proto
mmm_proto = mmm_pb2.Mmm()
# ...

# Create the main wrapper instance
mmm_wrapper = mmm.Mmm(mmm_proto)

# Access marketing data and calculate total spends for a given period
marketing_data = mmm_wrapper.marketing_data
total_spends = marketing_data.all_channel_spends(
    date_interval=('2025-01-01', '2025-03-31')
)

# Access budget optimization results
for budget_result in mmm_wrapper.budget_optimization_results:
  print(f"Name: {budget_result.name}, Max: {budget_result.spec.max_budget}")
```

## Classes

[`class BudgetOptimizationResult`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/BudgetOptimizationResult.md.txt): A wrapper for `BudgetOptimizationResult` proto with derived properties.

[`class BudgetOptimizationSpec`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/BudgetOptimizationSpec.md.txt): A wrapper for `BudgetOptimizationSpec` proto with derived properties.

[`class DateInterval`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/DateInterval.md.txt): A dataclass wrapper around a tuple of `(start, end)` dates.

[`class FrequencyOutcomeGrid`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/FrequencyOutcomeGrid.md.txt): A wrapper for `FrequencyOutcomeGrid` proto with derived properties.

[`class IncrementalOutcomeGrid`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/IncrementalOutcomeGrid.md.txt): A wrapper for `IncrementalOutcomeGrid` proto with derived properties.

[`class MarketingAnalysis`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/MarketingAnalysis.md.txt): A wrapper for `MarketingAnalysis` proto with derived properties.

[`class MarketingData`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/MarketingData.md.txt): A wrapper for `MarketingData` proto with derived properties.

[`class MediaAnalysis`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/MediaAnalysis.md.txt): A wrapper for `MediaAnalysis` proto with derived properties.

[`class Mmm`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/Mmm.md.txt): A wrapper for `Mmm` proto with derived properties.

[`class NonMediaAnalysis`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/NonMediaAnalysis.md.txt): A wrapper for `NonMediaAnalysis` proto with derived properties.

[`class Outcome`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/Outcome.md.txt): A wrapper for `Outcome` proto with derived properties.

[`class ReachFrequencyOptimizationResult`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/ReachFrequencyOptimizationResult.md.txt): A wrapper for `ReachFrequencyOptimizationResult` proto with derived properties.

[`class ResponseCurve`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/ResponseCurve.md.txt): A wrapper for `ResponseCurve` proto with derived properties.

[`class RfOptimizationSpec`](https://developers.google.com/meridian/reference/api/scenarioplanner/converters/mmm/RfOptimizationSpec.md.txt): A wrapper for `ReachFrequencyOptimizationSpec` proto with derived properties.