class_docstr: Calibration curve (also known as reliability diagram) visualization.
  
  It is recommended to use
  :func:`~sklearn.calibration.CalibrationDisplay.from_estimator` or
  :func:`~sklearn.calibration.CalibrationDisplay.from_predictions`
  to create a `CalibrationDisplay`. All parameters are stored as attributes.
  
  Read more about calibration in the :ref:`User Guide <calibration>` and
  more about the scikit-learn visualization API in :ref:`visualizations`.
  
  .. versionadded:: 1.0
  
  Parameters
  ----------
  prob_true : ndarray of shape (n_bins,)
      The proportion of samples whose class is the positive class (fraction
      of positives), in each bin.
  
  prob_pred : ndarray of shape (n_bins,)
      The mean predicted probability in each bin.
  
  y_prob : ndarray of shape (n_samples,)
      Probability estimates for the positive class, for each sample.
  
  estimator_name : str, default=None
      Name of estimator. If None, the estimator name is not shown.
  
  pos_label : int, float, bool or str, default=None
      The positive class when computing the calibration curve.
      By default, `estimators.classes_[1]` is considered as the
      positive class.
  
      .. versionadded:: 1.1
  
  Attributes
  ----------
  line_ : matplotlib Artist
      Calibration curve.
  
  ax_ : matplotlib Axes
      Axes with calibration curve.
  
  figure_ : matplotlib Figure
      Figure containing the curve.
  
  See Also
  --------
  calibration_curve : Compute true and predicted probabilities for a
      calibration curve.
  CalibrationDisplay.from_predictions : Plot calibration curve using true
      and predicted labels.
  CalibrationDisplay.from_estimator : Plot calibration curve using an
      estimator and data.
  
  Examples
  --------
  >>> from sklearn.datasets import make_classification
  >>> from sklearn.model_selection import train_test_split
  >>> from sklearn.linear_model import LogisticRegression
  >>> from sklearn.calibration import calibration_curve, CalibrationDisplay
  >>> X, y = make_classification(random_state=0)
  >>> X_train, X_test, y_train, y_test = train_test_split(
  ...     X, y, random_state=0)
  >>> clf = LogisticRegression(random_state=0)
  >>> clf.fit(X_train, y_train)
  LogisticRegression(random_state=0)
  >>> y_prob = clf.predict_proba(X_test)[:, 1]
  >>> prob_true, prob_pred = calibration_curve(y_test, y_prob, n_bins=10)
  >>> disp = CalibrationDisplay(prob_true, prob_pred, y_prob)
  >>> disp.plot()
  <...>
docstr: Plot calibration curve using true labels and predicted probabilities.
  
  Calibration curve, also known as reliability diagram, uses inputs
  from a binary classifier and plots the average predicted probability
  for each bin against the fraction of positive classes, on the
  y-axis.
  
  Extra keyword arguments will be passed to
  :func:`matplotlib.pyplot.plot`.
  
  Read more about calibration in the :ref:`User Guide <calibration>` and
  more about the scikit-learn visualization API in :ref:`visualizations`.
  
  .. versionadded:: 1.0
  
  Parameters
  ----------
  y_true : array-like of shape (n_samples,)
      True labels.
  
  y_prob : array-like of shape (n_samples,)
      The predicted probabilities of the positive class.
  
  n_bins : int, default=5
      Number of bins to discretize the [0, 1] interval into when
      calculating the calibration curve. A bigger number requires more
      data.
  
  strategy : {'uniform', 'quantile'}, default='uniform'
      Strategy used to define the widths of the bins.
  
      - `'uniform'`: The bins have identical widths.
      - `'quantile'`: The bins have the same number of samples and depend
        on predicted probabilities.
  
  pos_label : int, float, bool or str, default=None
      The positive class when computing the calibration curve.
      By default, `estimators.classes_[1]` is considered as the
      positive class.
  
      .. versionadded:: 1.1
  
  name : str, default=None
      Name for labeling curve.
  
  ref_line : bool, default=True
      If `True`, plots a reference line representing a perfectly
      calibrated classifier.
  
  ax : matplotlib axes, default=None
      Axes object to plot on. If `None`, a new figure and axes is
      created.
  
  **kwargs : dict
      Keyword arguments to be passed to :func:`matplotlib.pyplot.plot`.
  
  Returns
  -------
  display : :class:`~sklearn.calibration.CalibrationDisplay`.
      Object that stores computed values.
  
  See Also
  --------
  CalibrationDisplay.from_estimator : Plot calibration curve using an
      estimator and data.
  
  Examples
  --------
  >>> import matplotlib.pyplot as plt
  >>> from sklearn.datasets import make_classification
  >>> from sklearn.model_selection import train_test_split
  >>> from sklearn.linear_model import LogisticRegression
  >>> from sklearn.calibration import CalibrationDisplay
  >>> X, y = make_classification(random_state=0)
  >>> X_train, X_test, y_train, y_test = train_test_split(
  ...     X, y, random_state=0)
  >>> clf = LogisticRegression(random_state=0)
  >>> clf.fit(X_train, y_train)
  LogisticRegression(random_state=0)
  >>> y_prob = clf.predict_proba(X_test)[:, 1]
  >>> disp = CalibrationDisplay.from_predictions(y_test, y_prob)
  >>> plt.show()
docstr_tok: ["Plot","calibration","curve","using","true","labels","and","predicted","probabilities",".","Calibration","curve",",","also","known","as","reliability","diagram",",","uses","inputs","from","a","binary","classifier","and","plots","the","average","predicted","probability","for","each","bin","against","the","fraction","of","positive","classes",",","on","the","y-axis",".","Extra","keyword","arguments","will","be","passed","to",":","func",":","`","matplotlib.pyplot.plot","`",".","Read","more","about","calibration","in","the",":","ref",":","`","User","Guide","<","calibration",">","`","and","more","about","the","scikit-learn","visualization","API","in",":","ref",":","`","visualizations","`",".","..","versionadded",":",":","1.0","Parameters","--","--","--","--","--","y_true",":","array-like","of","shape","(","n_samples",",",")","True","labels",".","y_prob",":","array-like","of","shape","(","n_samples",",",")","The","predicted","probabilities","of","the","positive","class",".","n_bins",":","int",",","default=5","Number","of","bins","to","discretize","the","[","0",",","1","]","interval","into","when","calculating","the","calibration","curve",".","A","bigger","number","requires","more","data",".","strategy",":","{","'uniform","'",",","'quantile","'","}",",","default='uniform'","Strategy","used","to","define","the","widths","of","the","bins",".","-","`","'uniform","'","`",":","The","bins","have","identical","widths",".","-","`","'quantile","'","`",":","The","bins","have","the","same","number","of","samples","and","depend","on","predicted","probabilities",".","pos_label",":","int",",","float",",","bool","or","str",",","default=None","The","positive","class","when","computing","the","calibration","curve",".","By","default",",","`","estimators.classes_","[","1","]","`","is","considered","as","the","positive","class",".","..","versionadded",":",":","1.1","name",":","str",",","default=None","Name","for","labeling","curve",".","ref_line",":","bool",",","default=True","If","`","True","`",",","plots","a","reference","line","representing","a","perfectly","calibrated","classifier",".","ax",":","matplotlib","axes",",","default=None","Axes","object","to","plot","on",".","If","`","None","`",",","a","new","figure","and","axes","is","created",".","*","*","kwargs",":","dict","Keyword","arguments","to","be","passed","to",":","func",":","`","matplotlib.pyplot.plot","`",".","Returns","--","--","--","-","display",":",":","class",":","`","~sklearn.calibration.CalibrationDisplay","`",".","Object","that","stores","computed","values",".","See","Also","--","--","--","--","CalibrationDisplay.from_estimator",":","Plot","calibration","curve","using","an","estimator","and","data",".","Examples","--","--","--","--",">",">",">","import","matplotlib.pyplot","as","plt",">",">",">","from","sklearn.datasets","import","make_classification",">",">",">","from","sklearn.model_selection","import","train_test_split",">",">",">","from","sklearn.linear_model","import","LogisticRegression",">",">",">","from","sklearn.calibration","import","CalibrationDisplay",">",">",">","X",",","y","=","make_classification","(","random_state=0",")",">",">",">","X_train",",","X_test",",","y_train",",","y_test","=","train_test_split","(","...","X",",","y",",","random_state=0",")",">",">",">","clf","=","LogisticRegression","(","random_state=0",")",">",">",">","clf.fit","(","X_train",",","y_train",")","LogisticRegression","(","random_state=0",")",">",">",">","y_prob","=","clf.predict_proba","(","X_test",")","[",":",",","1","]",">",">",">","disp","=","CalibrationDisplay.from_predictions","(","y_test",",","y_prob",")",">",">",">","plt.show","(",")"]
code: def from_predictions(
      cls,
      y_true,
      y_prob,
      *,
      n_bins=5,
      strategy="uniform",
      pos_label=None,
      name=None,
      ref_line=True,
      ax=None,
      **kwargs,
  ):
      """Plot calibration curve using true labels and predicted probabilities.
  
      Calibration curve, also known as reliability diagram, uses inputs
      from a binary classifier and plots the average predicted probability
      for each bin against the fraction of positive classes, on the
      y-axis.
  
      Extra keyword arguments will be passed to
      :func:`matplotlib.pyplot.plot`.
  
      Read more about calibration in the :ref:`User Guide <calibration>` and
      more about the scikit-learn visualization API in :ref:`visualizations`.
  
      .. versionadded:: 1.0
  
      Parameters
      ----------
      y_true : array-like of shape (n_samples,)
          True labels.
  
      y_prob : array-like of shape (n_samples,)
          The predicted probabilities of the positive class.
  
      n_bins : int, default=5
          Number of bins to discretize the [0, 1] interval into when
          calculating the calibration curve. A bigger number requires more
          data.
  
      strategy : {'uniform', 'quantile'}, default='uniform'
          Strategy used to define the widths of the bins.
  
          - `'uniform'`: The bins have identical widths.
          - `'quantile'`: The bins have the same number of samples and depend
            on predicted probabilities.
  
      pos_label : int, float, bool or str, default=None
          The positive class when computing the calibration curve.
          By default, `estimators.classes_[1]` is considered as the
          positive class.
  
          .. versionadded:: 1.1
  
      name : str, default=None
          Name for labeling curve.
  
      ref_line : bool, default=True
          If `True`, plots a reference line representing a perfectly
          calibrated classifier.
  
      ax : matplotlib axes, default=None
          Axes object to plot on. If `None`, a new figure and axes is
          created.
  
      **kwargs : dict
          Keyword arguments to be passed to :func:`matplotlib.pyplot.plot`.
  
      Returns
      -------
      display : :class:`~sklearn.calibration.CalibrationDisplay`.
          Object that stores computed values.
  
      See Also
      --------
      CalibrationDisplay.from_estimator : Plot calibration curve using an
          estimator and data.
  
      Examples
      --------
      >>> import matplotlib.pyplot as plt
      >>> from sklearn.datasets import make_classification
      >>> from sklearn.model_selection import train_test_split
      >>> from sklearn.linear_model import LogisticRegression
      >>> from sklearn.calibration import CalibrationDisplay
      >>> X, y = make_classification(random_state=0)
      >>> X_train, X_test, y_train, y_test = train_test_split(
      ...     X, y, random_state=0)
      >>> clf = LogisticRegression(random_state=0)
      >>> clf.fit(X_train, y_train)
      LogisticRegression(random_state=0)
      >>> y_prob = clf.predict_proba(X_test)[:, 1]
      >>> disp = CalibrationDisplay.from_predictions(y_test, y_prob)
      >>> plt.show()
      """
      pos_label_validated, name = cls._validate_from_predictions_params(
          y_true,
          y_prob,
          sample_weight=None,
          pos_label=pos_label,
          name=name,
      )
  
      prob_true, prob_pred = calibration_curve(
          y_true,
          y_prob,
          n_bins=n_bins,
          strategy=strategy,
          pos_label=pos_label,
      )
  
      disp = cls(
          prob_true=prob_true,
          prob_pred=prob_pred,
          y_prob=y_prob,
          estimator_name=name,
          pos_label=pos_label_validated,
      )
      return disp.plot(ax=ax, ref_line=ref_line, **kwargs)
  
imports: import warnings
  from functools import partial
  from inspect import signature
  from math import log
  from numbers import Integral, Real
  import numpy
  from scipy.optimize import fmin_bfgs
  from scipy.special import expit, xlogy
  from sklearn.utils import Bunch
  from .base import BaseEstimator, ClassifierMixin, MetaEstimatorMixin, RegressorMixin, _fit_context, clone
  from .isotonic import IsotonicRegression
  from .model_selection import check_cv, cross_val_predict
  from .preprocessing import LabelEncoder, label_binarize
  from .svm import LinearSVC
  from .utils import _safe_indexing, column_or_1d, indexable
  from .utils._param_validation import HasMethods, Hidden, Interval, StrOptions, validate_params
  from .utils._plotting import _BinaryClassifierCurveDisplayMixin
  from .utils.metadata_routing import MetadataRouter, MethodMapping, _routing_enabled, process_routing
  from .utils.multiclass import check_classification_targets
  from .utils.parallel import Parallel, delayed
  from .utils.validation import _check_fit_params, _check_pos_label_consistency, _check_sample_weight, _num_samples, check_consistent_length, check_is_fitted
label_desc: Use image node_id 4 for calling the CalibrationDisplay obj's underlying member method code with example usage: obj.from_predictions(cls, y_true, y_prob) and returns: disp