create_calibration_curve()
Creates a Calibration Curve.
Usage
create_calibration_curve(
probs,
reals,
calibration_type="discrete",
size=600,
color_values=["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#07004D", "#E6AB02", "#FE5F55", "#54494B", "#006E90", "#BC96E6", "#52050A", "#1F271B", "#BE7C4D", "#63768D", "#08A045", "#320A28", "#82FF9E", "#2176FF", "#D1603D", "#585123"],
*,
n_bins=10
)This function generates a calibration curve, which evaluates how well the predicted probabilities from one or more models align with the observed binary outcomes. It can plot either discrete binned calibration (10 bins by default) or a smoothed calibration curve.
Parameters
probs: Dict[str, np.ndarray]-
A dictionary mapping model or dataset names to 1-D numpy arrays of predicted probabilities.
reals: Union[np.ndarray, Dict[str, np.ndarray]]-
The true binary labels (0 or 1). Can be a single array or a dictionary mapping names to label arrays.
calibration_type: str = "discrete"-
The type of calibration curve to plot. Options are
"discrete"(binned) or"smooth"(smoothed lowess). Defaults to"discrete". size: int = 600-
The width and height of the plot in pixels. Defaults to 600.
color_values: List[str] = [
"#1b9e77",
"#d95f02",
"#7570b3",
"#e7298a",
"#07004D",
"#E6AB02",
"#FE5F55",
"#54494B",
"#006E90",
"#BC96E6",
"#52050A",
"#1F271B",
"#BE7C4D",
"#63768D",
"#08A045",
"#320A28",
"#82FF9E",
"#2176FF",
"#D1603D",
"#585123",
]-
A list of hex color strings for the plot lines/markers.
n_bins: int = 10- Number of bins for discrete calibration curves. Defaults to 10.
Returns
Figure-
A Plotly
Figureobject representing the calibration curve.