midlearn.MIDBreakdown

class midlearn.MIDBreakdown(estimator: MIDRegressor | MIDExplainer, row: int | None = None, **kwargs)[source]

MID Breakdown.

This object is returned by the MIDRegressor.breakdown() method and provides a detailed breakdown of a single prediction.

__init__(estimator: MIDRegressor | MIDExplainer, row: int | None = None, **kwargs)[source]

Initialize the MIDBreakdown object.

Parameters:
  • estimator (MIDRegressor or MIDExplainer) – The fitted MID model instance to use for the breakdown.

  • row (int, optional) – The specific row index (observation) in the data for which to create the breakdown. If None (the default), the breakdown for the first instance is calculated.

  • **kwargs (dict) – Additional keyword arguments passed to the midr::mid.breakdown() function in R.

Methods

__init__(estimator[, row])

Initialize the MIDBreakdown object.

plot([style, theme, max_nterms, catchall, ...])

Visualize the decomposition of a single prediction into contributions from each component term with plotnine.

terms(**kwargs)

Attributes

breakdown

data

intercept

prediction