ResolvedPriceResponse#

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

A price response bound to one decision variable’s cell layout.

Built by PriceResponse.resolve() and held by MediaVariable. How a family stores its coefficients is its own business; what the optimizer reads is per cell over dims (a family whose parameters vary by date reduces over it): money_scale, in money, below 1e-12 * money_scale of which a cell is reported as having bought nothing; curved, boolean, where the map bends money (u'' != 0), equal to PriceResponse.curved_cells() on the same layout and read before warning about a cell its bounds pin at zero; and is_identity, which keeps the constant-price graph operation for operation.

Every map takes spend, per-period money as an XTensorVariable with dims (date_dim, *dims), and base_price, the optimizer’s cost_per_unit tensor over the same dims or None for a base price of 1. A family implements to_delivery() and implied_marginal_price(); implied_price() follows.

Contract: to_delivery() is non-decreasing and concave in money with u(0) = 0, and it and implied_marginal_price() are finite, in value and gradient, on every cell including those outside the mask and those the map leaves unbent. where evaluates both of its branches, so a nan or inf in a branch that is not selected is harmless on the C backend and poisons the gradient under JAX. implied_price() is reported only, never differentiated, and is nan where nothing is delivered.

Methods

ResolvedPriceResponse.__init__(*args, **kwargs)

ResolvedPriceResponse.implied_marginal_price(spend)

Money the next delivered unit costs at spend: the reciprocal slope of to_delivery.

ResolvedPriceResponse.implied_price(spend[, ...])

Average price of a delivered unit at spend: spend / to_delivery(spend).

ResolvedPriceResponse.to_delivery(spend[, ...])

Delivered units bought with spend.

Attributes