-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Labels
Description
I think it would be nice to have something like
def plot_calibration_curve(y_true, prob_y_pred, n_bins=5, ax=None):
prop_true, prop_pred = calibration_curve(y_true, prob_y_pred, n_bins=n_bins)
if ax is None:
ax = plt.gca()
ax.plot([0, 1], [0, 1], ':', c='k')
ax.plot(prop_pred, prop_true)
ax.set_xlabel("predicted probability")
ax.set_ylabel("fraction of positive samples")
ax.set_aspect("equal")
I got confused for a bit because the order of the return arguments is not the order of the arguments to plot. I think a plot function even just labeling the axes right would decrease mental effort (yes, I'm lazy).