autocast.metrics.coverage#
- class Coverage(coverage_level=0.95, **kwargs)[source]#
Bases:
BTSCMMetricCoverage probability for a fixed coverage level.
Calculates the proportion of true values that fall within the symmetric prediction interval defined by the coverage level.
- Parameters:
coverage_level (float)
- class MultiCoverage(coverage_levels=None)[source]#
Bases:
MetricComputes coverage for multiple coverage levels at once.
This is a wrapper around multiple Coverage metrics. It inherits from Metric to integrate with PyTorch Lightning and TorchMetrics.
- update(y_pred, y_true)[source]#
Override this method to update the state variables of your metric class.
- compute_detailed()[source]#
Return a dict of results, keys formatted as ‘coverage_{coverage_level}’.
- plot(save_path=None, title='Coverage Plot', cmap_str='viridis', save_csv=True)[source]#
Plot reliability diagram showing expected vs observed coverage.
- Parameters:
save_path (Path | str | None) – Path to save the plot (PNG). If provided and save_csv=True, a CSV file with the same name will also be saved.
title (str) – Plot title.
cmap_str (str) – Color map string from matplotlib.
save_csv (bool) – If True and save_path is provided, save plot data as CSV before creating the plot.
- Returns:
matplotlib.figure.Figure