# Predicting diet quality and food consumption at eating occasions using contextual factors: an application of machine learning models

**Authors:** Nancy R. Tran, Yuxin Zhang, Rebecca M. Leech, Sarah A. McNaughton

PMC · DOI: 10.1186/s12966-025-01818-4 · The International Journal of Behavioral Nutrition and Physical Activity · 2025-11-04

## TL;DR

This study uses machine learning to predict food consumption and diet quality based on contextual factors during eating occasions.

## Contribution

The novel use of machine learning models to predict food consumption and diet quality at eating occasions using contextual factors.

## Key findings

- Machine learning models predicted food consumption with low error rates across various food groups.
- Diet quality predictions deviated by 11.86 DGI points from actual scores.
- Factors like cooking confidence and food availability were most influential in predicting diet quality.

## Abstract

Eating occasions (EOs) are important moments for dietary decision-making. Tailoring nutrition interventions to individuals’ behaviours and environmental contexts offers a promising way to modify eating habits at EOs and enhance diet quality. While machine learning (ML) is a useful tool for predicting behaviours, its potential in understanding food choices at EOs remains underexplored. This study uses ML to investigate whether contextual factors can predict food consumption at EOs and overall daily diet quality.

Cross-sectional data from the Measuring Eating in Everyday Life Study (MEALS) were analysed. Participants (18-30y, n = 675) recorded intakes for 3–4 non-consecutive days using a Smartphone food diary app. EO-level contextual factors at each EO were recorded via the app while person-level contextual factors were collected via an online survey. Intakes were calculated as servings of vegetables, fruits, grains, meat, dairy, and discretionary foods, in accordance with the Australian Dietary Guideline. Diet quality was assessed via Dietary Guideline Index (DGI, 0-120). Gradient boost decision tree and random forest algorithms were used for hurdle prediction models, with lowest mean absolute error (MAE) as best performing. Mean absolute SHapley Additive exPlanations (SHAP) values were used to interpret the impact of each factor in explaining food consumption predictions.

Predictive models performed robustly, with MAE below half a serving for various food groups: 0.3 servings for vegetables, 0.75 for fruit, 0.28 for dairy, 0.55 for grains, 0.4 for meat, and 0.68 for discretionary foods per EO. This indicates small deviations between the model’s predictions and actual intakes. For overall daily diet quality, the model predictions deviated by 11.86 DGI points from the actual score. From mean absolute SHAP values, the importance of predictive factors varied across the six food groups, while for diet quality, the most influential factors were cooking confidence, self-efficacy, food availability, perceived time scarcity, and activity during consumption.

ML provided valuable insights into predicting food consumption based on contextual factors. Future research should explore how ML can assist identify key factors that, when adjusted for individual behaviour patterns, encourage healthier eating habits.

The online version contains supplementary material available at 10.1186/s12966-025-01818-4.

## Full-text entities

- **Genes:** MUC1 (mucin 1, cell surface associated) [NCBI Gene 4582] {aka ADMCKD, ADMCKD1, ADTKD2, CA 15-3, CD227, Ca15-3}, SHROOM4 (shroom family member 4) [NCBI Gene 57477] {aka MRXSSDS, SHAP, shrm4}
- **Diseases:** ID (MESH:C537985), obesity (MESH:D009765), smoking (MESH:D015208), ML (MESH:D007859), non-communicable diseases (MESH:D000073296), death (MESH:D003643), hypertension (MESH:D006973), cardiovascular diseases (MESH:D002318), MEALS (MESH:D001068), chronic diseases (MESH:D002908)
- **Chemicals:** EO (-)
- **Species:** Mus musculus (house mouse, species) [taxon 10090], Homo sapiens (human, species) [taxon 9606]

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12584291/full.md

## Figures

2 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12584291/full.md

## References

12 references — full list in the complete paper: https://tomesphere.com/paper/PMC12584291/full.md

---
Source: https://tomesphere.com/paper/PMC12584291