PriceResponse#

class pymc_marketing.mmm.price_response.PriceResponse[source]#

A non-decreasing, concave map from per-period money to delivered units, declared once and bound per variable.

The declaration is reusable across models and windows; resolve() binds it to one decision variable’s cell layout and returns the object the optimizer’s graph uses. Subclasses ship a closed, invertible parametric family so the implied delivery and clearing prices can be reported alongside the allocation.

Every map a family resolves to must be non-decreasing and concave in money with u(0) = 0 (see ResolvedPriceResponse): a convex map, such as a volume discount, makes the allocation non-convex. A family refuses a declaration that would break this when it is constructed, as PowerPriceResponse refuses elasticity < 0.

The optimizer asks three things of a family before resolving it, and keys on the answers rather than on the concrete type: where the map bends money (adds_curvature, curved_cells()), whether the user attests that the fitted data are in delivery units (attests_delivery_units, required wherever the map bends), and whether the declaration supplies no reference level of its own (needs_derived_reference). These are read before resolve(), because a refusal must name its cause rather than the missing reference spend that cause implies. Declarations are frozen: mutating one after construction would bypass its validators.

Methods

PriceResponse.__init__(**data)

Create a new model by parsing and validating input data from keyword arguments.

PriceResponse.construct([_fields_set])

PriceResponse.copy(*[, include, exclude, ...])

Returns a copy of the model.

PriceResponse.curved_cells(*, dims, coords, ...)

Boolean per cell of a layout, in dims order: where the resolved map would bend money.

PriceResponse.dict(*[, include, exclude, ...])

PriceResponse.from_orm(obj)

PriceResponse.json(*[, include, exclude, ...])

PriceResponse.model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

PriceResponse.parse_file(path, *[, ...])

PriceResponse.parse_obj(obj)

PriceResponse.parse_raw(b, *[, ...])

PriceResponse.resolve(*, dims, coords, mask, ...)

Bind the declaration to one variable's cell layout.

PriceResponse.schema([by_alias, ref_template])

PriceResponse.schema_json(*[, by_alias, ...])

PriceResponse.update_forward_refs(**localns)

PriceResponse.validate(value)

Attributes

PriceResponse.adds_curvature

True when the map bends money on some cell.

PriceResponse.attests_delivery_units

The user attests that the fitted data are in delivery units (or constant-price spend).

PriceResponse.model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

PriceResponse.needs_derived_reference

True when the declaration supplies no reference level, so a curved cell can only take a derived one.