DateIndexedInput#

class pymc_marketing.mmm.counterfactual.DateIndexedInput(name: str, values: np.ndarray, dtype: str, dims: tuple[str, ...], date_axis: int)[source]#

A date-indexed pm.Data replaced by a batched evaluator input.

Parameters:
namestr

Name of the data variable in the model.

valuesnp.ndarray

Its fitted values, in the model’s own dimension order. Read from the model’s own shared variable rather than from fit_data, because an effect’s data need not appear there – the funnel example builds the model from an xr.Dataset carrying the mediator’s inputs, then fits from a frame that does not.

dtypestr

Dtype the compiled evaluator expects.

dimstuple of str

Its dimensions, in the model’s order.

date_axisint

Position of date within dims. Stored rather than assumed to be zero: an effect is free to declare its data as ("country", "date"), and cutting the wrong axis would either raise a misleading length error or, when the two lengths happen to coincide, quietly cut the panel up instead of the calendar.

Methods

DateIndexedInput.__init__(*args, **kwargs)

DateIndexedInput.count(value, /)

Return number of occurrences of value.

DateIndexedInput.cut(windows)

Cut this input into one padded window per period.

DateIndexedInput.index(value[, start, stop])

Return first index of value.

Attributes

date_axis

Alias for field number 4

dims

Alias for field number 3

dtype

Alias for field number 2

name

Alias for field number 0

values

Alias for field number 1