RegressionModelBuilder.fit#

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

Fit a model using the data passed as a parameter.

Thin wrapper around ModelFitter.fit() supporting the X/y data convention. Sets attrs to inference data of the model.

Parameters:
Xarray_like | array, shape (n_obs, n_features)

The training input samples. If scikit-learn is available, array-like, otherwise array.

yarray_like | array, shape (n_obs,)

The target values (real numbers). If scikit-learn is available, array-like, otherwise array.

methodstr

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

progressbarbool, optional

Specifies whether the fit progress bar should be displayed. Defaults to True.

random_seedOptional[RandomState]

Provides sampler with initial random seed for obtaining reproducible samples.

sample_kwargsdict, optional

Only used by the variational methods; forwarded to Approximation.sample.

**kwargsAny

Custom sampler settings can be provided in form of keyword arguments.

Returns:
selfxr.DataTree

Returns inference data of the fitted model.

Examples

model = MyModel()
idata = model.fit(X, y)
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...