midlearn.MIDConditional
- class midlearn.MIDConditional(estimator: MIDRegressor | MIDExplainer, variable: str, pred_type: str = 'response', **kwargs)[source]
MID Conditional Expectations.
This object is returned by the MIDRegressor.conditional() method and contains data for plotting conditional dependence.
- __init__(estimator: MIDRegressor | MIDExplainer, variable: str, pred_type: str = 'response', **kwargs)[source]
Initialize the MIDConditional object.
- Parameters:
estimator (MIDRegressor or MIDExplainer) – The fitted MID model instance to use.
variable (str) – The name of the feature for which to calculate conditional dependence.
pred_type (str) – The scale on which to calculate and plot the conditional expectations.
**kwargs (dict) – Additional keyword arguments passed to the midr::mid.conditional() function in R.
Methods
__init__(estimator, variable[, pred_type])Initialize the MIDConditional object.
plot([style, theme, var_color, dots, reference])Visualize Individual Conditional Expectation (ICE) plots or Centered ICE (c-ICE) plots with plotnine.
terms(**kwargs)Extract term labels from the fitted model.
Attributes
conditionalpd.DataFrame of the hypothetical observations and their corresponding predictions.
observedpd.DataFrame of the original observations used.
valuesA vector or the sample points for the 'variable' used in the ICE calculation.