Class AlphaEnsemble
SignalEngine.alpha, OnlineAlphaLearner.normalizedPrediction,
a lead-lag echo, a bespoke signal), and the blending question is the
same honesty 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 max(0, IC) and the
weights ARE the sizing — deliberately NOT renormalized to sum to 1,
because renormalizing would let a lone component with IC 0.01 emit at
full strength: a barely-trusted blend must be a barely-sized signal.
A component that has not demonstrated live predictive power gets zero
weight, and 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) -
Method Summary
Modifier and TypeMethodDescriptiondoublecombined(double[] values) The blended alpha in [-1, 1]:clamp(Σ max(0, ICᶜ) × 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) 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 (honest alignment), 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ᶜ) × valueᶜ). The IC weights are the SIZE of the signal, not just its mix (see the class doc for why they are not renormalized). 0 while the track record spans less than one IC memory or no component has a positive IC — an unproven blend is silent, exactly like the learner it sits above. -
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
-