reject_unknown_coords#

pymc_marketing.mmm.optimization_variables.reject_unknown_coords(da, coords, *, label)[source]#

Refuse coordinate labels the model does not have.

Split out of align_to_model_coords() because the two halves of that function are wanted separately: every consumer must reject unknown labels, since reindex drops them silently and the input is then consumed positionally against a tensor that never saw them, but only some consumers can demand full coverage. MediaVariable.pack() is one exception – a plan may legitimately omit a cell that is masked out of the optimization, so it scopes its own missing-value check to the mask – and PowerPriceResponse.reference_spend another: a cell it leaves out takes the reference derived from the fitted model.

Parameters:
  • da (DataArray | Dataset) – User-supplied input carrying some or all of the budget dims.

  • coords (Mapping[str, list]) – The model’s coordinates for the budget dims.

  • label (str) – Name of the input, used in the error message.

Raises:

ValueError – If the input carries coordinates the model does not have.