MODULE REFERENCE

plotting

anomx.metrics.plotting

Native metric visualizations with optional Matplotlib dependencies.

plot_tolerance_curve

plot_tolerance_curve(actual_series: TimeSeriesLike, pred_series: TimeSeriesLike, intersect: bool = True, min_tolerance: float = 0.0, max_tolerance: float = 1.0, step: float = 0.01, q: float | list[float] | None = None, n_jobs: int = 1, verbose: bool = False, fig_size: tuple[int, int] | None = None, axis: Axes | None = None) -> Axes

Plots the Tolerance Curve for evaluating forecast alignment.

The tolerance curve shows, for each tolerance level (as a percentage of the actual series range), what fraction of prediction points fall within that tolerance. The scale is half the observed range, matching the AUTC metric.

For multivariate series, one curve is plotted per component.

The Area Under Tolerance Curve (AUTC) can be computed using anomx.metrics.metrics.autc.

Parameters

actual_series

The (sequence of) actual series.

pred_series

The (sequence of) predicted series.

intersect

For time series that are overlapping in time without having the same time index, setting True will consider the values only over their common time interval (intersection in time).

min_tolerance

The minimum tolerance level as a fraction of the series half-range. Default is 0.0 (0%).

max_tolerance

The maximum tolerance level as a fraction of the series half-range. Default is 1.0 (100%).

step

The step size between tolerance levels. Default is 0.01 (1%). For example, with defaults, tolerances are [0.0, 0.01, 0.02, ..., 1.0].

q

Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.

n_jobs

The number of jobs to run in parallel. Parallel jobs are created only when a Sequence[TimeSeries] is passed as input, parallelising operations regarding different TimeSeries. Defaults to 1 (sequential). Setting the parameter to -1 means using all the available processors.

verbose

Optionally, whether to print operations progress.

fig_size

The size of the figure to be displayed.

axis

Optionally, an axis object to plot on.

Returns

matplotlib.axes.Axes

The populated axes, suitable for further styling or saving its figure.

See Also

anomx.metrics.metrics.autc : Compute the Area Under Tolerance Curve as a single score.

Signature parameters
ParameterTypeDefault
actual_seriesTimeSeriesLikerequired
pred_seriesTimeSeriesLikerequired
intersectboolTrue
min_tolerancefloat0.0
max_tolerancefloat1.0
stepfloat0.01
qfloat | list[float] | NoneNone
n_jobsint1
verboseboolFalse
fig_sizetuple[int, int] | NoneNone
axisAxes | NoneNone

Returns Axes