MMM.fit#

MMM.fit(X, y=None, *, method='mcmc', progressbar=None, random_seed=None, sample_kwargs=None, **kwargs)[source]#

Fit the model and inject cost_per_unit metadata if provided.

Delegates to the parent fit() and then injects the parsed cost_per_unit DataArray into idata.constant_data.

Parameters:
Xpd.DataFrame or xr.Dataset or xr.DataArray

Training input samples.

ypd.Series or xr.DataArray or np.ndarray or None

Target values.

methodstr

Method used to fit the model. One of "mcmc", "map", "demz", "advi" or "fullrank_advi".

progressbarbool, optional

Whether to show the progress bar.

random_seedRandomState, optional

Random seed for reproducibility.

sample_kwargsdict, optional

Only used by the variational methods; forwarded to Approximation.sample (e.g. {"draws": 1_000}).

**kwargsAny

Additional keyword arguments passed to the sampler.

Returns:
xr.DataTree

Inference data of the fitted model.