linear_predictor#
- pymc_marketing.mmm.spend_reach.linear_predictor(model)[source]#
Find the node the increment is assembled to reproduce.
The MMM registers its linear predictor as the
Deterministicmuunder both links, so thenamed_varslookup below finds it. The graph search is kept for models that do not register it, such as anything fitted beforemuwas registered under the identity link.- Parameters:
- model
MMM The fitted model to search.
- model
- Returns:
VariableorNoneThe linear predictor, or
Noneif this model does not expose one – in which caseSpendProbe.assert_increment_is_complete()has nothing to check against and says so.
- Raises:
ValueErrorIf the graph carries more than one node named
mu, which leaves the predictor impossible to identify by name. This only applies to models that reach the graph search: wheremuis registered, thenamed_varslookup below settles it first and PyMC has already enforced that the name is unique.