Feature Engineering: Better Inputs, Better Models
Feature engineering preps raw data for a model, like a chef preps ingredients. It transforms raw inputs into a more effective set of predictive signals. The footgun is creating irrelevant features, which can harm model performance more than using raw data.
WHY IT EXISTS Raw data is rarely in a format that machine learning models can directly or effectively use. Models need clean, relevant inputs to find patterns. Feature engineering exists to bridge the gap between messy, real-world data and the structured inputs a model requires to make accurate predictions.
THE MENTAL MODEL Think of feature engineering as a chef preparing ingredients. You don't just throw whole vegetables into a pot. You wash, peel, chop, and combine them to bring out the best flavors. Similarly, feature engineering takes raw data (the vegetables) and transforms it into features (prepped ingredients) that make it easier for the model (the cooking process) to produce an accurate prediction.
HOW IT WORKS As a preprocessing step, feature engineering involves creating new attributes from existing raw data. This isn't about gathering more data, but about being more creative with the data you have. The goal is to distill the raw information into a set of inputs that have a stronger, clearer relationship with the outcome you're trying to predict, thereby enhancing the model's decision-making capability.
WHEN TO USE IT Use feature engineering in almost any supervised machine learning or statistical modeling task. It is crucial when your raw data contains non-numerical values, timestamps, or complex structures that don't directly correlate with the target variable. It's often the most effective way to improve a model's predictive power without changing the model algorithm itself.
WHEN NOT TO USE IT While almost always beneficial, the extent of manual feature engineering can be reduced with certain models. Some deep learning models, for instance, can learn features automatically from vast amounts of raw data like image pixels. However, even in these cases, some initial data transformation is usually required. Over-engineering features can also introduce unnecessary noise and complexity.
ONE CANONICAL EXAMPLE Imagine predicting customer churn from user activity logs. A raw log might have timestamps and user IDs. A model can't use this directly. Feature engineering transforms this into useful inputs like "days since last login," "average session duration," or "number of purchases in the last 30 days." These engineered features provide much more predictive signal to the model than the raw logs.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.