Feature engineering connects collected data to model training and inference. A feature is an input variable, while a label is the outcome a supervised model learns to predict. For a customer churn model, features might include subscription length, support requests, and recent usage; the label indicates whether the customer subsequently canceled. Feature engineering determines how those inputs represent the problem, rather than choosing the learning algorithm or adjusting its hyperparameters.
Within an AI/ML pipeline, data collection gathers records, and data preparation addresses issues such as invalid values, duplicates, and inconsistent formats. Feature engineering overlaps with preparation but focuses specifically on producing useful model inputs. Training learns model parameters from those inputs, evaluation measures performance on held-out data, and deployment makes the model available for inference. These stages are iterative: evaluation or production monitoring can reveal that different features are needed.
Typical transformations include filling missing values, encoding categories, scaling numeric values, extracting components from timestamps, and aggregating events. For example, raw transaction records can become transaction count over the previous hour, average purchase amount over the previous month, and time since the last purchase. A linear model may benefit from scaled numeric inputs, whereas tree-based models generally do not require scaling. The appropriate transformation depends on the data, algorithm, and prediction objective.
Data leakage is a major practical risk. A loan application model must not use information recorded only after the lending decision, even if that information strongly predicts repayment. Similarly, calculating imputation values or scaling statistics from the entire dataset can expose information from held-out records. Establish the evaluation split before fitting learned transformations, fit those transformations on training data, and apply the fitted versions to validation, test, and production inputs. Historical aggregates must use only information available at each prediction time.
In the cloud, teams commonly retain source data in object storage, run managed transformation jobs, and store reusable feature values for training or serving. Batch jobs can calculate daily customer summaries, while streaming applications can update rapidly changing signals. A feature store can organize reusable features and provide historical or low-latency access, but it does not automatically create useful features or prevent leakage. Historical training datasets still require correct event-time filtering and point-in-time joins.
Training and serving must use compatible feature definitions. If training computes purchase totals over thirty days but inference computes them over seven days, the model receives a different representation in production. Version transformation code, record feature definitions, test schemas, and reuse transformation artifacts where possible. Monitor missing values, category changes, feature freshness, and distribution shifts alongside predictive performance.
More features do not necessarily produce a better model. Redundant, noisy, or overly detailed inputs can increase overfitting, processing costs, and inference latency. Feature selection retains useful inputs, while feature extraction derives representations from existing data; both can contribute to feature engineering. Compare alternatives using validation results, then reserve the test dataset for final assessment. Deep learning can learn many representations automatically, but input preparation, data quality, leakage prevention, and operational consistency remain necessary. Sensitive attributes and their proxies also require review because technically predictive features can create privacy or fairness risks.