0
0
ML Pythonml~5 mins

Creating interaction features in ML Python - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What are interaction features in machine learning?
Interaction features are new features created by combining two or more existing features to capture relationships between them that might improve model performance.
Click to reveal answer
beginner
Why do we create interaction features?
We create interaction features to help the model learn complex patterns where the effect of one feature depends on another, improving prediction accuracy.
Click to reveal answer
beginner
Give an example of an interaction feature.
If you have features 'age' and 'income', an interaction feature could be 'age * income' which might capture how income effect changes with age.
Click to reveal answer
intermediate
How can interaction features be created in Python using pandas?
You can create interaction features by multiplying or combining columns, for example: df['age_income'] = df['age'] * df['income'].
Click to reveal answer
intermediate
What is a potential downside of creating many interaction features?
Creating many interaction features can increase the number of features a lot, which may cause the model to overfit or slow down training.
Click to reveal answer
What does an interaction feature represent?
AA feature that is always categorical
BA feature that is removed during preprocessing
CA feature that contains missing values
DA combination of two or more features to capture their joint effect
Which of these is an example of an interaction feature?
Aage + income
Bage - 5
Cage * income
Dincome / 2
What is a risk of adding too many interaction features?
AModel underfitting
BModel overfitting
CFaster training
DLoss of data
How can you create an interaction feature in pandas?
Adf['new'] = df['a'] * df['b']
Bdf['new'] = df['a'] + df['b']
Cdf['new'] = df['a'] / df['b']
Ddf['new'] = df['a'] - df['b']
When should you consider creating interaction features?
AWhen you suspect features influence the target together
BWhen you have only one feature
CWhen features are independent
DWhen data is categorical only
Explain what interaction features are and why they can help machine learning models.
Think about how two features together might tell a different story than alone.
You got /4 concepts.
    Describe how you would create an interaction feature in a dataset using Python.
    Remember pandas lets you do math directly on columns.
    You got /4 concepts.