What are interaction features?
Interaction features are new features created by combining two or more existing features so a model can capture how they affect the target together.
They are useful when the effect of one feature depends on the value of another.
Simple example
Suppose a house-price model contains:
- house size
- location quality
House size may affect price differently depending on the location.
An interaction feature could be:
size × location_scoreThis gives the model a way to represent their combined effect.
Why interaction features are useful
Some relationships cannot be represented well by looking at each feature independently.
For example:
- advertising spend may work differently across customer segments
- discount percentage may have a different effect for expensive and inexpensive products
- temperature may affect energy usage differently depending on the hour of day
Interaction features make these combined relationships explicit.
Common ways to create interactions
Interactions can be created using:
- multiplication:
feature_a × feature_b - ratios:
feature_a / feature_b - differences:
feature_a - feature_b - combinations of categorical variables
The exact form should reflect the problem and domain.
Example with categorical features
Suppose a model contains:
device_type
countryA combined feature such as:
device_type + countrycan help capture patterns specific to particular device-country combinations.
Interaction features can increase complexity
Creating many interactions can rapidly increase the number of features.
This can:
- increase training time
- introduce noisy or irrelevant features
- increase the risk of overfitting
Interactions should therefore be created selectively and validated.
Some models learn interactions automatically
Tree-based models can often learn feature interactions naturally through multiple splits.
Linear models, on the other hand, usually need explicit interaction terms if the relationship is not additive.
In short, interaction features combine existing variables so the model can learn relationships where the effect of one feature depends on another.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.