learning.calibrate#
- bartorch.learning.calibrate()#
The factor making
|error| <= factor * spreadhold with the given coverage.Split conformal calibration: over held-out reconstructions whose reference is known, the score
|error| / spreadis taken voxel by voxel, and the factor is itsceil((n + 1) coverage) / nempirical quantile. On a new reconstruction from the same distribution,factor * spreadis then an interval that contains the error at the stated rate, whether or not the spread was the error’s standard deviation. The guarantee is marginal, over voxels and subjects drawn alike, not voxel by voxel.- Parameters:
error (torch.Tensor) – Reconstruction minus reference, over the calibration voxels: every voxel of a few held-out subjects, or a mask of them.
spread (torch.Tensor) – The same voxels’ standard deviation, the square root of the variance
moments()returns.coverage (float, default=0.9) – Fraction of voxels the interval is to contain.
- Returns:
The factor; infinite when the calibration set is too small for the coverage asked.
- Return type:
float
References
Angelopoulos AN, Bates S. Conformal prediction: a gentle introduction. Found Trends Mach Learn 2023;16:494-591.