What is feature engineering? Feature engineering is the process of using domain knowledge to select, transform and create input variables, called features, from raw data so that machine learning models can learn from them more effectively. Raw data such as timestamps, text, transactions and logs rarely arrives in a form models can use. Feature engineering turns it into informative signals, such as days since last purchase, average order value or the ratio of support tickets to licences. It often improves model performance more than choosing a fancier algorithm. This guide explains the main techniques, a practical workflow, how feature stores help and the pitfalls, including data leakage.
Short answer: Feature engineering converts raw data into meaningful model inputs by cleaning, transforming, combining and selecting variables. Good features, built with domain knowledge and without leakage, usually matter more than the choice of algorithm.
What is feature engineering?
The feature engineering article on Wikipedia describes it as extracting features from raw data to improve model performance. It is a core step in machine learning and data science, relies on clean inputs from data cleansing and feeds predictive analytics. In deep learning, networks learn some features automatically, yet engineered features still matter for tabular business data.
Core feature engineering techniques

| Technique | What it does | Example |
|---|---|---|
| Imputation | Fills missing values | Median income where blank |
| Encoding | Converts categories to numbers | One hot encoding of country |
| Scaling and normalisation | Puts numbers on comparable ranges | Standardising age and income |
| Binning | Groups continuous values | Age bands |
| Aggregation | Summarises history | Orders in the last 90 days |
| Date and time features | Extracts patterns | Day of week, month, days since signup |
| Interaction features | Combines variables | Price multiplied by quantity |
| Text features | Turns text into numbers | TF-IDF or embeddings. See what is an embedding |
| Log and power transforms | Reduce skew | Log of transaction value |
Feature selection and dimensionality reduction
| Approach | How it works | Use when |
|---|---|---|
| Filter methods | Rank features by statistics such as correlation | Quick screening |
| Wrapper methods | Test subsets by model performance | Smaller feature sets |
| Embedded methods | Model selects features while training, such as L1 regularisation | Efficient, built in |
| PCA and similar | Compress correlated features into components | Many correlated inputs |
| Domain review | Experts remove irrelevant or risky variables | Always |
A practical feature engineering workflow
- Define the prediction target and decision. Know what is predicted, when, and what data exists at that moment.
- Explore and profile data. Check distributions, missing values, outliers and relationships.
- Create candidate features. Use domain knowledge to build aggregates, ratios and time windows.
- Prevent leakage. Only use information available at prediction time.
- Select and validate. Test features with cross validation and watch stability over time.
- Productionise. Use the same code or a feature store for training and serving.
- Monitor. Track feature drift, missing rates and importance in production.
Feature stores and reuse
A feature store is a shared system that defines, computes, stores and serves features consistently for training and real time inference. It prevents training serving skew, where a model sees different calculations in production than in training, and it lets teams reuse proven features instead of rebuilding them. It records definitions, owners and lineage, linking to wider data governance.
Common pitfalls
- Data leakage: using future information, such as a cancellation flag, to predict cancellation.
- Different logic in training and production code.
- Too many weak features, which cause overfitting and slow models.
- Encoding high cardinality categories naively.
- Ignoring time ordering when validating.
- Using sensitive attributes or proxies that create unfair outcomes. See what is responsible AI
Our AI and machine learning service builds feature pipelines and stores, and our data analytics service prepares the underlying data.
A worked example: predicting customer churn
A subscription business wants to predict which customers will cancel within 60 days. Raw data includes sign up dates, invoices, support tickets and product events. The team builds features as of each snapshot date: tenure in months, number of active users in the last 30 days compared with the prior 30, share of key features used, number of open tickets, days since last login and whether the last invoice was paid late.
They exclude any field created after the snapshot date, such as cancellation reasons, to avoid leakage, and validate on later months than they train on. The usage trend and late payment features become the strongest signals, which also gives account managers clear reasons to act. The same feature code runs nightly in production through a feature store, so scores in the CRM match what was tested.
Handling time, windows and leakage
Time is the most common source of silent errors. Define a snapshot date for every training row and compute features only from data before it. Use rolling windows such as 7, 30 and 90 days, and compare recent windows with older ones to capture trends. Split data by time rather than randomly, so evaluation reflects real use. Review every feature with the question: would this value truly be known at the moment of prediction? If the answer is unclear, remove it.
Documentation and governance of features
Features are business logic, and they deserve documentation. Record each feature with a clear definition, data sources, owner, refresh schedule and known limitations. Review sensitive features for fairness and legal risk, and set retention rules for the underlying data. Version feature definitions so that a model can always be traced to the exact logic that produced its inputs, which is essential for audits and for debugging unexpected predictions.
Feature engineering for different data types
| Data type | Typical features | Notes |
|---|---|---|
| Transactions | Recency, frequency, monetary value, basket size | Classic RFM style features |
| Time series | Lags, rolling means, seasonality flags | Respect time order |
| Text | Length, keywords, topic scores, embeddings | Clean and normalise first |
| Geographic | Distance, region, density | Check privacy impact |
| Logs and events | Counts per window, sequences, time between events | Aggregate by entity |
| Customer records | Tenure, segment, plan, support history | Join carefully to avoid duplicates |
Start from the entity you predict for, such as a customer, account or device, and build features at that grain. Aggregate events into windows, join dimensions carefully so rows are not duplicated and keep a single, documented definition of each metric across teams.
Automated feature engineering and its limits
Automated tools can generate large numbers of candidate features by combining columns, applying transforms and aggregating related tables. They speed up exploration and sometimes surface surprising signals, but they also create many weak or redundant features and raise the risk of leakage. Treat automation as a source of ideas, then apply the same discipline as for hand built features: confirm each one is available at prediction time, test stability across periods, check explainability and remove anything that cannot be defended to a business owner or auditor.
The best results usually come from collaboration. Data scientists bring technique, while sales, finance and operations specialists know which behaviours actually precede churn, fraud or demand spikes. A short workshop with domain experts before modelling often produces better features than days of automated search.
Key takeaways
- Feature engineering turns raw data into informative inputs for machine learning models.
- Common techniques include imputation, encoding, scaling, aggregation, time features and interactions.
- Avoid data leakage by using only information available at prediction time.
- Feature stores keep training and serving logic consistent and enable reuse.
- Document, version and monitor features like any other business logic.
Quick glossary
| Term | Meaning |
|---|---|
| Feature | An input variable used by a model |
| Data leakage | Using information unavailable at prediction time |
| Feature store | A shared system to define and serve features |
| Training serving skew | Mismatch between training and production calculations |
| Encoding | Converting categories into numbers |
Read next: What Is Fine-Tuning? Methods, Data and Costs · What Is Explainable AI? Methods, SHAP and LIME · What Is an Embedding? Vectors, Similarity, Use Cases
Frequently asked questions
What is feature engineering in simple terms?
It is preparing and creating useful input variables from raw data so a machine learning model can learn patterns more accurately.
Why is feature engineering important?
Good features give models clearer signals, often improving accuracy more than switching algorithms, and they make results easier to explain.
What are examples of features?
Days since last purchase, average order value, number of logins in 30 days, ratio of tickets to licences and day of week of an order.
What is data leakage?
Leakage happens when a feature contains information not available at prediction time, which inflates test results and fails in production.
Is feature engineering needed for deep learning?
Less for images, text and audio, where networks learn features, but still important for tabular business data and for domain specific signals.
What is a feature store?
A system that defines, stores and serves features consistently for training and real time prediction, enabling reuse and preventing skew.
What is the difference between feature selection and feature engineering?
Engineering creates and transforms features. Selection chooses which features to keep, based on usefulness, stability and risk.
How do I validate engineered features?
Use time based cross validation, compare against a baseline, check stability across periods and review each feature with domain experts.
