OnlineAggregator
Bases: ArrayModel, ABC
Online expert aggregator for AgACI and similar methods.
Maintains per-expert cumulative losses and exposes normalized weights.
Subclasses differ in how they convert losses to weights.
The panel shape (n_experts, n_series, horizon) is unknown at
construction time — it is only known once the caller sees the
calibration arrays — so it is bound via :meth:initialize, not
__init__. Call :meth:initialize once before :meth:weights or
:meth:update.
OnlineAggregator.initialize
cumulative_losses_.
Parameters
n_experts : int Number of experts being aggregated. n_series : int Number of series in the panel. horizon : int Forecast horizon length.Raises
ValueError If any argument is < 1.OnlineAggregator.update
Parameters
losses : NDArray, shape (n_experts, n_series, horizon)Raises
CalibrationError If called before :meth:initialize.
ValueError
If losses does not have the expected shape.
OnlineAggregator.weights
Returns
NDArray, shape (n_experts, n_series, horizon) Sum along axis 0 equals 1 for every (series, horizon) cell.Raises
CalibrationError If called before :meth:initialize.
EWA
Bases: OnlineAggregator
Exponentially Weighted Average aggregator (Vovk 1990).
Weights are proportional to exp(-eta * cumulative_loss). Larger eta
converges faster to the best expert but is noisier.
Call :meth:initialize with the panel shape before :meth:weights or
:meth:update.
EWA.initialize
cumulative_losses_.
Parameters
n_experts : int Number of experts being aggregated. n_series : int Number of series in the panel. horizon : int Forecast horizon length.Raises
ValueError If any argument is < 1.EWA.update
Parameters
losses : NDArray, shape (n_experts, n_series, horizon)Raises
CalibrationError If called before :meth:initialize.
ValueError
If losses does not have the expected shape.
EWA.weights
Returns
NDArray, shape (n_experts, n_series, horizon) Numerically stable softmax along axis 0. Sums to 1 along axis 0.Raises
CalibrationError If called before :meth:initialize.
