calibration_tests

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

calibration_tests(y_true: ndarray, y_prob: ndarray, n_groups: int = 10) → CalibrationResult[source]

Run both calibration tests HABIT reports for a binary model.

Parameters:
  • y_true – Binary outcomes (0/1).

  • y_prob – Predicted event probabilities, aligned to y_true.

  • n_groups – Number of quantile-based risk groups for the Hosmer-Lemeshow test (classically 10).

Returns:

The Hosmer-Lemeshow and Spiegelhalter statistics with p-values.