uqlm.calibration.score_calibrator.ScoreCalibrator#
- class uqlm.calibration.score_calibrator.ScoreCalibrator(method='platt')#
Bases:
objectA class for calibrating confidence scores using Platt Scaling or Isotonic Regression.
Confidence scores from uncertainty quantification methods may not be well-calibrated probabilities. This class provides methods to transform raw scores into calibrated probabilities that better reflect the true likelihood of correctness.
- Parameters:
method ({'platt', 'isotonic'}, default='platt') – The calibration method to use: - ‘platt’: Platt scaling using logistic regression - ‘isotonic’: Isotonic regression (non-parametric, monotonic)
- method#
The calibration method used.
- Type:
str
- calibrator_#
The fitted calibration model.
- Type:
sklearn estimator
- is_fitted_#
Whether the calibrator has been fitted.
- Type:
bool
- __init__(method='platt')#
Methods
__init__([method])fit(uq_result, correct_indicators)Fit the calibration model using scores and binary correctness labels.
fit_transform(uq_result, correct_indicators)Fit the calibrator and transform the scores in one step.
transform(uq_result)Transform raw scores into calibrated probabilities.
- fit(uq_result, correct_indicators)#
Fit the calibration model using scores and binary correctness labels.
- Return type:
None- Parameters:
uq_result (UQResult) – The UQResult object to fit the calibrator on.
correct_indicators (array-like of shape (n_samples,)) – Binary labels indicating correctness (True/False or 1/0).
- Returns:
self – The fitted calibrator instance.
- Return type:
- fit_transform(uq_result, correct_indicators)#
Fit the calibrator and transform the scores in one step.
- Return type:
None- Parameters:
uq_result (UQResult) – The UQResult object to fit and transform.
correct_indicators (array-like of shape (n_samples,)) – Binary labels indicating correctness (True/False or 1/0).
- Return type:
None
References