arviz.plot_separation — ArviZ dev documentation (original) (raw)
arviz.plot_separation(idata=None, y=None, y_hat=None, y_hat_line=False, expected_events=False, figsize=None, textsize=None, color='C0', legend=True, ax=None, plot_kwargs=None, y_hat_line_kwargs=None, exp_events_kwargs=None, backend=None, backend_kwargs=None, show=None)[source]#
Separation plot for binary outcome models.
Model predictions are sorted and plotted using a color code according to the observed data.
Parameters:
idataInferenceData
arviz.InferenceData object.
Observed data. If str, idata
must be present and contain the observed data group
Posterior predictive samples for y
. It must have the same shape as y
. If str or None, idata
must contain the posterior predictive group.
y_hat_linebool, optional
Plot the sorted y_hat
predictions.
expected_eventsbool, optional
Plot the total number of expected events.
figsizefigure
size
tuple, optional
If None, size is (8 + numvars, 8 + numvars)
textsize: int, optional
Text size for labels. If None it will be autoscaled based on figsize
.
colorstr, optional
Color to assign to the positive class. The negative class will be plotted using the same color and an alpha=0.3
transparency.
legendbool, optional
Show the legend of the figure.
ax: axes, optional
Matplotlib axes or bokeh figures.
plot_kwargsdict, optional
Additional keywords passed to matplotlib.axes.Axes.bar() orbokeh:bokeh.plotting.Figure.vbar()
for separation plot.
y_hat_line_kwargsdict, optional
Additional keywords passed to ax.plot for y_hat
line.
exp_events_kwargsdict, optional
Additional keywords passed to ax.scatter for expected_events
marker.
backend: str, optional
Select plotting backend {“matplotlib”,”bokeh”}. Default “matplotlib”.
backend_kwargs: bool, optional
These are kwargs specific to the backend being used, passed tomatplotlib.pyplot.subplots() orbokeh.plotting.figure()
.
showbool, optional
Call backend show function.
Returns:
axesmatplotlib axes
or bokeh figures
See also
Plot for posterior/prior predictive checks.
References
Examples
Separation plot for a logistic regression model.
import arviz as az idata = az.load_arviz_data('classification10d') az.plot_separation(idata=idata, y='outcome', y_hat='outcome', figsize=(8, 1))