DOC Add example in docstring calibration_curve
@@ -620,6 +620,18 @@ def calibration_curve(y_true, y_prob, *, normalize=False, n_bins=5,
Probabilities With Supervised Learning, in Proceedings of the 22nd
International Conference on Machine Learning (ICML).
See section 4 (Qualitative Analysis of Predictions).
+
+ Examples
+ --------
+ >>> import numpy as np
+ >>> from sklearn.calibration import calibration_curve
+ >>> y_true = np.array([0, 0, 0, 0, 1, 1, 1, 1, 1])
+ >>> y_pred = np.array([0.1, 0.2, 0.3, 0.4, 0.65, 0.7, 0.8, 0.9, 1.])
+ >>> prob_true, prob_pred = calibration_curve(y_true, y_pred, n_bins=3)
+ >>> prob_true
+ array([0. , 0.5, 1. ])
+ >>> prob_pred
+ array([0.2 , 0.525, 0.85 ])
"""
y_true = column_or_1d(y_true)
y_prob = column_or_1d(y_prob)
