Conditioning Variables and Interaction Features
How to let a model express that a signal's meaning changes depending on context — by explicitly building interaction features, or by letting a nonlinear model learn conditioning on its own — and why doing neither leaves real predictive power on the table.
Prerequisites: Feature Crosses for Tabular Models
A momentum signal that works well in calm markets can flip sign in a crash — the same raw number, "past 12-month return," means something different depending on the volatility environment it's measured in. A plain linear model treats momentum's effect as a single fixed number applied everywhere, blind to context. What you actually want is for the model to know that momentum's coefficient should shrink, or even reverse, when volatility is elevated. That "it depends on context" behavior is what conditioning variables and interaction features are for.
The idea: letting one variable modulate another
Think of a thermostat that adjusts a room's target temperature based on how many people are in it — the "how much heating to add" rule is not fixed, it depends on occupancy. An interaction feature does the analogous thing algebraically: instead of a feature (momentum) entering the model with one fixed weight, you multiply it by a conditioning variable (say, a volatility regime indicator) so the model can learn that 's effective influence changes with .
The simplest form is a multiplicative interaction term added alongside the original features:
In plain English: is momentum's average effect, is the volatility regime's own direct effect, and — the interaction coefficient — measures how much momentum's effect itself shifts as the volatility regime changes. If is negative and is a "high volatility" flag, the model has learned that momentum's payoff shrinks specifically in high-vol periods, something neither nor alone could express.
Nonlinear models like tree ensembles or neural networks can discover useful interactions automatically by splitting on one variable within a branch already conditioned on another, which is why they sometimes beat a plain linear model without any hand-built interaction terms — but only if there's enough data to estimate those extra degrees of freedom reliably.
Worked example: momentum conditioned on volatility regime
Say backtests show plain 12-month momentum earns an average monthly return of 0.6% across all periods, but broken out by regime: 0.9% in low-volatility months and −0.2% in high-volatility months (using a simple realized-vol median split as the conditioning variable ). A linear model using momentum alone can only report the blended 0.6% average — it has no way to express the sign flip. Adding the interaction term lets the model fit (the low-vol effect) and (the extra swing in high-vol months, since ), so a live prediction correctly discounts or reverses the momentum signal whenever the volatility flag is on — instead of always applying the same blended, and often wrong, average effect.
What this means in practice
Good conditioning variables are usually things a researcher already believes change the meaning of a signal — volatility regime, sector, market-cap bucket, macro state — rather than arbitrary pairwise crosses of every feature with every other feature, which multiplies the feature count and invites overfitting long before it finds anything real. Cross-validating interaction terms and checking whether they hold out-of-sample, exactly as with any other feature, is essential: an interaction fit on a handful of historical high-volatility episodes can look decisive and still be spurious.
An interaction feature () lets a model express that one variable's effect depends on the value of another, instead of forcing a single fixed coefficient to average over regimes where the true relationship is different or even opposite. Choose conditioning variables from domain knowledge about when a signal's meaning genuinely changes, not by crossing every feature pair mechanically.
Related concepts
Practice in interviews
Further reading
- Gu, Kelly, Xiu, 'Empirical Asset Pricing via Machine Learning', Review of Financial Studies (2020)