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, terms, max_nterms, ...])Visualize the decomposition of a single prediction into contributions from each component term with plotnine.
terms(**kwargs)Extract term labels from the fitted model.
Attributes
breakdownpd.DataFrame containing the breakdown of the prediction.
datapd.DataFrame containing the predictor variable values used for the prediction.
interceptThe intercept of the MID model.
predictionThe predicted value from the MID model.