Machine LearningCategorical Data & Feature Engineering

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_score

This 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
country

A combined feature such as:

device_type + country

can 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.

#what are interaction features#interaction features machine learning#feature interaction machine learning#interaction terms machine learning#feature engineering interactions#machine-learning#interaction-features#feature-engineering#feature-interactions#data-preprocessing

Learning Sequence

Machine Learning Curriculum

34% Completed
Up NextMachine Learning

What are polynomial features?

Explore Related Questions

Deepen your understanding across related Machine Learning topics.

Machinoai Logo
Machinoai

Your edge in the AI era. Deep dives into machine learning concepts, paper explainers, verified industry jobs, and developer tools.

© 2026 Machinoai. All rights reserved.