Skip to content

Fix calibration_curve docstring for empty bins #12926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions sklearn/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,16 @@ def calibration_curve(y_true, y_prob, normalize=False, n_bins=5):
onto 0 and the largest one onto 1.

n_bins : int
Number of bins. A bigger number requires more data.
Number of bins. A bigger number requires more data. Bins with no data
points (i.e. without corresponding values in y_prob) will not be
returned, thus there may be fewer than n_bins in the return value.

Returns
-------
prob_true : array, shape (n_bins,)
prob_true : array, shape (n_bins,) or smaller
The true probability in each bin (fraction of positives).

prob_pred : array, shape (n_bins,)
prob_pred : array, shape (n_bins,) or smaller
The mean predicted probability in each bin.

References
Expand Down