Class AlphaEnsemble
SignalEngine.alpha, OnlineAlphaLearner.normalizedPrediction,
a lead-lag echo, a bespoke signal), and the blending question is the
same trust problem the learner solves for its weights: how much
should each component be trusted, on evidence it could not have
memorized?
The ensemble runs one prequential IC per component: each interval,
onObservation(double[], double) scores the component values snapshotted at the
previous call against the return just realized (values now would
contain the move — the same nowcast trap OnlineAlphaLearner
closes), then snapshots the current values for the next round.
combined(double[]) weights each component by its IC shrunk toward zero
by z standard errors, max(0, IC − z·SE) (see
IcSignificance; z = 2 by default). Gating on IC > 0
alone would hand weight to a true-zero component half the time, since
with icAlpha = 0.01 the EWMA IC has an effective sample of about
200 and a standard error near 0.07. The weights are the sizing and are
not renormalised to sum to 1: renormalising would let a lone component
with a marginal IC emit at full strength. While the track record spans
less than one IC memory the ensemble emits 0 outright. Output is clamped to [-1, 1]: drop-in for
BenchmarkExecutor.MarketState.alpha.
Same caveat as every learned signal here: the live IC is a
tripwire, not a validation. Run any blend you intend to trade through
the alpha package's walk-forward machinery. Components must be
dimensionless (~[-1, 1]); non-finite inputs are handled per component
(see onObservation(double[], double)). Zero allocation per event (caller-owned
arrays), single writer, one instance per symbol. The IC evidence persists via
persist.Checkpoint: restored trust is earned trust.
-
Constructor Summary
ConstructorsConstructorDescriptionAlphaEnsemble(int components) 1% IC weight (≈ a few-hundred-observation memory).AlphaEnsemble(int components, double icAlpha) AlphaEnsemble(int components, double icAlpha, double significanceZ) -
Method Summary
Modifier and TypeMethodDescriptiondoublecombined(double[] values) The blended alpha in [-1, 1]:clamp(Σ max(0, ICᶜ − z·SE) × valueᶜ).doublecomponentIC(int c) The prequential (out-of-sample) IC of one component — the trust diagnostic per signal. 0 before enough variance exists.intvoidonObservation(double[] values, double realizedReturn) One interval: the current component values and the return realized since the previous call.voidRestores the IC evidence; the snapshot (intraday alignment state) resets.longsamples()voidwriteState(DataOutput out) Persists the per-component IC evidence — seepersist.Checkpoint.
-
Constructor Details
-
AlphaEnsemble
public AlphaEnsemble(int components, double icAlpha) - Parameters:
components- number of component signals (fixed order — the caller owns the mapping)icAlpha- EWMA weight of the IC statistics, e.g. 0.01
-
AlphaEnsemble
public AlphaEnsemble(int components, double icAlpha, double significanceZ) - Parameters:
significanceZ- standard errors subtracted from each component IC before it earns weight (0 reproduces the ungatedmax(0, IC)weighting)
-
AlphaEnsemble
public AlphaEnsemble(int components) 1% IC weight (≈ a few-hundred-observation memory).
-
-
Method Details
-
onObservation
public void onObservation(double[] values, double realizedReturn) One interval: the current component values and the return realized since the previous call. Scores the previous snapshot against the return (no look-ahead), then snapshotsvalues. The first call only snapshots. Non-finite handling is per-component: a NaN component skips its scoring (each component's moments stay conditioned on exactly the returns its covariance saw) while finite siblings still score — but an observation where nothing scored (NaN return, or every snapshot value non-finite) does not count toward the track record: the gate must never open on evidence that scored nothing. -
combined
public double combined(double[] values) The blended alpha in [-1, 1]:clamp(Σ max(0, ICᶜ − z·SE) × valueᶜ). The weights are the size of the signal, not just its mix. 0 while the track record spans less than one IC memory or no component's IC clears its standard-error band. -
componentIC
public double componentIC(int c) The prequential (out-of-sample) IC of one component — the trust diagnostic per signal. 0 before enough variance exists. -
components
public int components() -
samples
public long samples() -
writeState
Persists the per-component IC evidence — seepersist.Checkpoint.- Throws:
IOException
-
readState
Restores the IC evidence; the snapshot (intraday alignment state) resets. Throws on a component-count or version mismatch.- Throws:
IOException
-