Skip to main content

What is feature engineering?

The AI Glossary

In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.

Feature engineering means deciding how to turn available information into useful inputs for a model. A feature is an input characteristic, such as age, time since the last appointment or the number of referrals awaiting a document. Engineering may involve choosing existing measurements, transforming them or constructing new ones.

For a house-price model, the original record might contain a construction year. A more useful feature could be the building’s age at the time of sale. For appointment planning, a timestamp might become day of the week, time of day or days remaining before the visit. These transformations make particular relationships easier for the model to use.

Other choices are less visible but equally important. Categories may need a numerical representation. Measurements recorded in different units need reconciliation. Missing values need an explicit treatment. Replacing a missing value with an average is a methodological choice, not the recovery of a fact that was never observed.

Deep-learning models can learn useful representations from images, text or sound, reducing some manual feature design. They do not eliminate decisions about which information to collect, how to prepare it or what should be available at prediction time. Supplying an entire clinical note rather than selected fields is itself an input-design decision.

Timing is crucial. A feature recorded after an outcome occurred must not be used in a model presented as predicting that outcome beforehand. Data leakage is the name for such inappropriate access to information. Likewise, a transformation learned from data should generally be fitted using development data, not by quietly examining the test set.

In a chronic-disease outreach model, “days since the last documented contact” might help identify patients who have fallen out of regular care. But it could also reflect differences in how clinic teams record telephone calls. Before treating it as patient behavior, ask staff what the field actually means. Feature engineering is one of the points where domain knowledge changes the mathematics: the model only sees the representation it is given, not the operational explanation behind it.

Sources: scikit-learn — Preprocessing Data; scikit-learn — Common Pitfalls and Recommended Practices

Further reading from Harvard Chan: Public Health Perspectives — How Health Care Leaders Can Build Effective, Bias free AI (2022).

To learn more, take a look at the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.


I’m a doctor, not a statistician. I teach the AI in Health Care Certificate of Specialization with Dr. Heather Mattie, a statistician and co-director of Harvard Chan’s Health Data Science master’s program. For more on data science and statistics, see Harvard Chan’s Health Data Science resources.

AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.

For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.

Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy

Lead with AI in Health Care

The AI Pragmatist is a monthly newsletter from ALA faculty, with new explainers & essays from the Advanced Learning Academy