
Dan Patiño
AI Strategy & Innovation at Coderhouse
Artificial Intelligence
Feature engineering is the process of turning raw data into the input variables, or features, that a machine learning model learns from. It covers choosing which columns to use, cleaning and transforming them, and creating new ones that make patterns easier for an algorithm to detect. A timestamp becomes “hour of day” and “is weekend”; a list of purchases becomes “orders in the last 30 days”; a city name becomes a set of numeric columns a model can read.
Why it matters now: large language models and AutoML tools have made it easy to train a model in minutes, but they haven’t removed the oldest rule in the field: a model is only as good as the data you feed it. In most real projects with tabular business data, thoughtful features still move accuracy more than switching algorithms, and they are what make a model reliable once it meets new data in production.
How feature engineering works, in plain language
Models don’t understand business context. They see numbers. Feature engineering is the translation layer between what you know about the problem and what the algorithm can use. A churn model, for example, gains little from a raw “signup date” column, but a lot from “days since last login” or “support tickets in the past month,” because those encode behavior that actually predicts cancellation.
Google’s Machine Learning Crash Course describes this work as a core step of preparing data and walks through how to transform numerical data into useful features.
The main feature engineering techniques
Scaling and normalization
Many algorithms, such as linear models, k-nearest neighbors, and neural networks, are sensitive to the scale of their inputs. If income ranges into the hundreds of thousands and age stays under 100, income can dominate. Standardization rescales a feature to a mean of 0 and a standard deviation of 1, while min-max scaling squeezes it into a 0–1 range. Tree-based models like random forests are much less affected.
Encoding categorical variables
Text categories like country or plan type must become numbers. One-hot encoding creates a yes/no column for each category; ordinal encoding maps ordered categories (small, medium, large) to ranked integers; target encoding replaces each category with an average outcome, which is powerful but must be done carefully to avoid leakage. Google covers these options in its module on working with categorical data.
Handling missing values
You can drop rows, fill gaps with the mean or median, use a constant like “unknown,” or add a flag column that says “this value was missing,” which is sometimes predictive on its own. Our step-by-step guide to data cleaning in Python with pandas shows these techniques in practice.
Creating new features
Date and time parts: day of week, month, hour, holiday flags, time since an event.
Aggregations: counts, sums, and averages per customer or product over a time window.
Ratios and interactions: price per square foot, clicks divided by impressions, or the product of two variables.
Binning: grouping a continuous value like age into ranges when the relationship isn’t linear.
Log transforms: taming long-tailed values such as revenue or session duration.
Feature selection
More features are not always better. Irrelevant or redundant columns add noise, slow training, and raise the risk of memorizing the training set. Selection methods, from simple correlation checks to model-based importance scores, help keep only what earns its place.
Feature engineering in a real workflow
In practice, analysts and ML engineers build features as a repeatable pipeline rather than one-off spreadsheet edits. Libraries like scikit-learn provide transformers for scaling, encoding, and imputing, documented in its preprocessing guide, and pipelines make sure the exact same steps run in training and in production. At larger companies, shared features often live in a central repository; if that’s new to you, read what a feature store is and why AI teams rely on it.
Deep learning automates part of this work for images, audio, and text, where networks learn their own representations. For the structured tables that power most business decisions, though, hand-crafted features remain a major source of model quality.
Common mistakes to avoid
Data leakage. Using information that wouldn’t be available at prediction time, like a “refund issued” flag in a fraud model, makes results look great in testing and fail in reality.
Fitting transformations on all the data. Scalers and encoders should learn their parameters from the training set only, then be applied to validation and test data. scikit-learn lists this among its common pitfalls.
Creating too many features. Hundreds of loosely related columns invite the model to learn noise. Learn more in our explainer on overfitting and why models fail on new data.
Ignoring domain knowledge. The best features usually come from understanding the business, not from blindly generating combinations.
Frequently asked questions
Is feature engineering still relevant with deep learning and LLMs?
Yes. Deep learning reduces manual work for unstructured data, but tabular problems like churn, pricing, credit risk, and demand forecasting still benefit heavily from well-designed features. Even LLM-based systems depend on carefully prepared inputs and metadata.
What’s the difference between feature engineering and data cleaning?
Data cleaning fixes errors, duplicates, and inconsistencies so the data is trustworthy. Feature engineering builds on clean data to create the variables a model learns from. In real projects the two steps overlap.
Which tools should I learn first?
Start with Python, pandas for transformations, and scikit-learn for pipelines and preprocessing. SQL is also essential, since many aggregation features are easiest to build in the database.
Keep learning
If you want to build features and train models on real datasets, from analysis to deployment, explore these programs:
I'm Dan Patiño, head of AI Strategy & Innovation at Coderhouse. My day-to-day work involves merging the tactical management of e-commerce (CRO, Email Marketing and SEO) with the development of disruptive solutions. I specialize in building internal AI-powered apps to automate tasks and boost innovation within the team. I firmly believe that technology is strategy's best ally. To dive deeper into my professional journey, I'll be waiting for you on my LinkedIn profile.