Winning Kaggle the Reproducible Way

Chapter 53

Financial Competition Patterns

Whether to neutralize factor exposure depends on the target and the official metric.

Factor exposure is not leakage, and removing it is a modelling choice that depends on what is scored. One demonstration measures a model built on raw and on neutralized features against raw returns and against factor-neutral returns, while the factor premium after training changes.

Every example is constructed for teaching. Its numbers come from running the chapter activity's code, not from a competition result.

Demonstration 1 of 1

Raw and neutralized features, scored against raw and factor-neutral returns

When does removing factor exposure from the features help the score, and when does it cost correlation?

Raw features carry exposure to the factor, and the model learns that exposure pays because it did during training. While the premium persists, that exposure earns correlation on raw returns. When it fades or flips, the same exposure turns into a loss, and the daily correlation swings with the factor. Neutralized features give up the exposure bet in every regime and keep only the alpha signal, which is all a factor-neutral metric can reward.

Equation: the neutralized feature x star for asset i on date d equals the raw feature minus q times the date's fitted slope gamma hat d times the asset's exposure b i minus the mean exposure

Scroll sideways for the whole equation

x is a feature, b the asset's exposure to the factor, and the neutralized feature x* subtracts a fraction q of the day's regression of x on b. The score is the mean over dates of the Spearman correlation between a prediction and a target.

Predict first. If the factor premium flips sign after training, what happens to the raw-feature model's correlation with raw returns?

Your prediction

Choose an example

Scroll sideways for the whole figure

Figure: Raw and neutralized features, scored against raw and factor-neutral returns. Two panels of mean daily Spearman correlation for no, half and full removal of exposure at a premium of -0.50. On raw returns the scores are -0.186, -0.087 and 0.061; on factor-neutral returns 0.055, 0.067 and 0.072.
Mean factor return in the scored period (training period: 0.5): -0.5: premium flips sign
Constructed example: eight seeded synthetic markets of 120 assets and a Ridge model, measured by the chapter activity.

Calculated values

Raw features, raw returns
-0.186
Neutralized, raw returns
0.061
Raw features, neutral returns
0.055
Neutralized, neutral returns
0.072
Cost of neutralizing (raw returns)
-0.247

With a premium of -0.50 in the scored period (0.5 in training), raw features score -0.186 against raw returns and fully neutralized features 0.061, so 0.061 - (-0.186) = 0.247 is what neutralizing gains there. Against factor-neutral returns the scores are 0.055 and 0.072. The daily correlation on raw returns has a standard deviation of 0.230 with raw features and 0.082 with neutralized ones.

Worked steps

  1. Cost of full neutralization on raw returns: -0.186 - 0.061 = -0.247.
  2. Gain on factor-neutral returns: 0.072 - 0.055 = +0.017.
  3. Half neutralization on raw returns: -0.087, between the two ends.
  4. Daily swing on raw returns, raw features minus neutralized: 0.230 - 0.082 = +0.148.

Use the idea

Read the official metric before choosing a representation: score raw and neutralized versions of the same model on the exact target and compare them on later periods, not only on the training regime.

Where the conclusion applies

Constructed markets with one factor, a static beta per asset and an alpha signal that does not change; Ridge regression stands in for any model and eight markets give the means. Exposure here is observed without error, which is generous: with a noisy exposure estimate, neutralization would remove less. The premium in the scored period is set by hand to show the regimes. The result concerns the scoring target, and is not a claim about any real competition or about trading profit.

Check your understanding: Neutralization lowers the score on raw returns when the premium persists. Does that make it the wrong choice?
Not by itself. The score on raw returns at a persistent premium (0.274 for raw features, 0.063 for fully neutralized ones) rewards a bet on the factor, and whether the competition scores that bet is a property of the official metric, not of the recipe. On the factor-neutral target the neutralized model matches or beats the raw one in every regime. The choice follows the scored target and the plausibility that the premium persists.

Chapter 53 source: section "Feature Neutralization: Removing Market Exposure".