Feature Decomposition
Understanding a complex ML model is hard — not unlike reading a restaurant bill that includes a base price, individual add-ons, and combinations that carry their own surcharge. Functional decomposition is the strategy of breaking the model into simpler, constituent parts so each part can be analyzed separately.
We split an ML model's prediction function into three types of components:
- Main effects — how each feature affects the prediction, independent of all other features
- Interaction effects — the joint effect of two or more features acting together
- Intercept — the baseline prediction when all feature effects are set to zero
Two well-known methods that implement this idea are Functional ANOVA and Accumulated Local Effects (ALE). We will cover ALE later in this module. Here we focus on Functional ANOVA.
Functional ANOVA (Analysis of Variance) decomposes the prediction function into a sum of simpler functions — one for the overall constant, one for each individual feature, and one for each combination of features that interact:
Additive decomposition
- — the intercept: the baseline prediction
- — the main effect of feature , capturing its individual contribution
- — the interaction effect between features and : behavior that cannot be explained by adding the two main effects
Three properties make this decomposition interpretable:
- Additive decomposition — the prediction is a sum of terms, so each term's contribution is readable on its own
- Individual contributions — by isolating each component, we can measure exactly how much each feature (and each interaction) drives the model's output
- Interaction quantification — the framework distinguishes between a feature that matters alone and a feature that matters only in combination with another
Functional ANOVA uses an orthogonal basis for this decomposition: each component function is statistically independent of the others, so the parts do not overlap and variance can be attributed cleanly.
Variance decomposition
The key insight of ANOVA is that total variance can be partitioned:
- Calculate the total variance of across the input space
- Calculate the variance explained by each main-effect component
- Attribute any remaining variance to the interaction terms
This tells us not just that a feature matters, but how much of the model's variability it accounts for — individually and through interactions.
Decompose a Car Price
Turn main effects on and off. The synchronized equation shows when the joint electric-luxury interaction adds value beyond the two features separately.
$30k base
+ $20k electric
+ $40k luxury
+ $10k interaction
$100,000
In practice, the component functions are not known in closed form — they have to be estimated from data. Common approaches include:
- Smoothing splines — fit smooth curves to represent each component
- Kernel methods — use kernel functions to capture local structure in each component
- Fourier or wavelet decomposition — useful when the prediction function has periodic or oscillating patterns
The estimation is typically done iteratively: start with an initial estimate of every component, then fix all but one and re-estimate that one from the residuals. Repeat for each component and cycle until the estimates converge.
One practical caveat: high-order interactions (three or more features) grow combinatorially — the number of terms explodes and each becomes harder to estimate reliably. In most applied work, the decomposition is truncated at pairwise interactions.
ALE later in this module
Accumulated Local Effects is another method for functional decomposition. Unlike Functional ANOVA, ALE is designed to handle correlated features without introducing unrealistic data combinations. We will cover it in Section 5.
What does a nonzero fⱼₖ term tell you about the model?