# `causalis.scenarios.unconfoundedness.refutation.overlap.reliability_plot`

Reliability diagram for propensity calibration diagnostics.

## Module Contents

### Functions

`plot_propensity_reliability` | Plot a propensity calibration reliability diagram.

### Data

`__all__` |

### API

causalis.scenarios.unconfoundedness.refutation.overlap.reliability_plot.plot_propensity_reliability(estimate: causalis.data_contracts.causal_estimate.CausalEstimate, data: Optional[causalis.dgp.causaldata.CausalData] = None, *, n_bins: int = 10, show_recalibration: bool = True, annotate_metrics: bool = True, ax: Optional[matplotlib.pyplot.Axes] = None, figsize: Tuple[float, float] = (7.2, 6.2), dpi: int = 220, font_scale: float = 1.1, point_color: Optional[Any] = None, diagonal_color: Any = '0.35', recalibration_color: Any = 'C1', min_marker_size: float = 35.0, marker_size_scale: float = 250.0, save: Optional[str] = None, save_dpi: Optional[int] = None, transparent: bool = False) → matplotlib.pyplot.Figure

  Plot a propensity calibration reliability diagram.

  The reliability plot groups observations into propensity bins and compares predicted treatment probability with observed treatment frequency. In a well-calibrated propensity model, points should stay near the diagonal:

  .. math::

      \mathbb{E}[D \mid m(X) \in b] \approx \mathbb{E}[m(X) \mid m(X) \in b].

  Parameters

  estimate : CausalEstimate Estimate with diagnostic data (`m_hat`; optionally `m_hat_raw`, `d`). data : CausalData, optional Optional fallback source for treatment `d` when not stored in diagnostic data. n_bins : int, default 10 Number of calibration bins used to build the reliability table. show_recalibration : bool, default True Overlay logistic recalibration curve `sigmoid(alpha + beta * logit(p))` when parameters are available. annotate_metrics : bool, default True Annotate ECE and logistic recalibration parameters on the figure. ax : matplotlib.axes.Axes, optional Existing axes to plot on. figsize : tuple, default (7.2, 6.2) Figure size. dpi : int, default 220 Dots per inch. font_scale : float, default 1.10 Font scaling factor. point_color : color, optional Marker color for binned reliability points. diagonal_color : color, default “0.35” Color for the perfect calibration diagonal. recalibration_color : color, default “C1” Color for the logistic recalibration curve. min_marker_size : float, default 35.0 Base marker area for non-empty bins. marker_size_scale : float, default 250.0 Additional marker area scaled by bin count share. save : str, optional Path to save the figure. save_dpi : int, optional DPI for saving. transparent : bool, default False Whether to save with transparency.

  Returns

  matplotlib.figure.Figure The generated figure.

  Examples

  > > > from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from causalis.dgp import obs_linear_26_dataset from causalis.scenarios.unconfoundedness.model import IRM data = obs_linear_26_dataset( … n=1000, … seed=3141, … include_oracle=False, … return_causal_data=True, … ) irm = IRM( … data=data, … ml_g=RandomForestRegressor( … n_estimators=200, … max_depth=6, … min_samples_leaf=5, … random_state=3141, … ), … ml_m=RandomForestClassifier( … n_estimators=200, … max_depth=6, … min_samples_leaf=5, … random_state=3141, … ), … n_folds=3, … random_state=3141, … ) estimate = irm.fit().estimate(score=”ATE”) fig = plot_propensity_reliability(estimate, data=data) # doctest: +SKIP

causalis.scenarios.unconfoundedness.refutation.overlap.reliability_plot.__all__

  [‘plot_propensity_reliability’]