Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 Jan 24;15(2):11.
doi: 10.3390/ejihpe15020011.

Explanatory AI Predicts the Diet Adopted Based on Nutritional and Lifestyle Habits in the Spanish Population

Affiliations

Explanatory AI Predicts the Diet Adopted Based on Nutritional and Lifestyle Habits in the Spanish Population

Elena Sandri et al. Eur J Investig Health Psychol Educ. .

Abstract

This study used Explainable Artificial Intelligence (XAI) with SHapley Additive exPlanations (SHAP) to examine dietary and lifestyle habits in the Spanish population and identify key diet predictors. A cross-sectional design was used, employing the validated NutSo-HH scale to gather data on nutrition, lifestyle, and socio-demographic factors. The CatBoost method combined with SHAP was applied. The sample included 22,181 Spanish adults: 17,573 followed the Mediterranean diet, 1425 were vegetarians, 365 were vegans, and 1018 practiced intermittent fasting. Fish consumption was the strongest dietary indicator, with vegans abstaining and some vegetarians consuming it occasionally. Age influenced diet: younger individuals preferred vegan/vegetarian diets, while older adults adhered to the Mediterranean diet. Vegans and vegetarians consumed less junk food, and intermittent fasters were more physically active. The model effectively predicts the Mediterranean diet but struggles with others due to sample imbalance, highlighting the need for larger studies on plant-based and intermittent fasting diets.

Keywords: Spain; and nutrition; deep learning; diet; food; healthy lifestyle; machine learning.

PubMed Disclaimer

Conflict of interest statement

The authors declare no conflicts of interest.

Figures

Figure 3
Figure 3
(a) Summary plot for Mediterranean diet class. (b) Summary plot for intermittent fasting diet class. (c) Summary plot for vegan diet class. (d) Summary plot for vegetarian diet class.
Figure 3
Figure 3
(a) Summary plot for Mediterranean diet class. (b) Summary plot for intermittent fasting diet class. (c) Summary plot for vegan diet class. (d) Summary plot for vegetarian diet class.
Figure 6
Figure 6
(a) Decision plot for instance 845. (b) Decision plot for instance 702. (c) Decision plot for instance 546. (d) Decision plot for instance 837.
Figure 6
Figure 6
(a) Decision plot for instance 845. (b) Decision plot for instance 702. (c) Decision plot for instance 546. (d) Decision plot for instance 837.
Figure 8
Figure 8
(a) IASE and fish interaction for class 0. (b) IASE and fish interaction for class 1. (c) IASE and fish interaction for class 2. (d) IASE and fish interaction for class 3.
Figure 8
Figure 8
(a) IASE and fish interaction for class 0. (b) IASE and fish interaction for class 1. (c) IASE and fish interaction for class 2. (d) IASE and fish interaction for class 3.
Figure 1
Figure 1
Classes distribution with respect to IASE classification.
Figure 2
Figure 2
SMOTENC confusion matrix.
Figure 4
Figure 4
Top 10 feature importance for classifying IASE score.
Figure 5
Figure 5
(a) ICE plot for soft drinks. (b) ICE plot for special diet. (c) ICE plot for fish. (d) ICE plot for BMI. (e) ICE plot for age.
Figure 5
Figure 5
(a) ICE plot for soft drinks. (b) ICE plot for special diet. (c) ICE plot for fish. (d) ICE plot for BMI. (e) ICE plot for age.
Figure 5
Figure 5
(a) ICE plot for soft drinks. (b) ICE plot for special diet. (c) ICE plot for fish. (d) ICE plot for BMI. (e) ICE plot for age.
Figure 7
Figure 7
(a) Typical prediction path for a correct prediction of class 2. (b) Typical prediction path for a correct prediction of class 3. (c) Typical prediction path for a correct prediction of class 4. (d) Typical prediction path for a wrong prediction of class 1.
Figure 7
Figure 7
(a) Typical prediction path for a correct prediction of class 2. (b) Typical prediction path for a correct prediction of class 3. (c) Typical prediction path for a correct prediction of class 4. (d) Typical prediction path for a wrong prediction of class 1.

References

    1. Abellán Alemán J., Zafrilla Rentero M. P., Montoro-García S., Mulero J., Pérez Garrido A., Leal M., Guerrero L., Ramos E., Ruilope L. M. Adherence to the Mediterranean diet in Spain and its relationship with cardiovascular risk (DIMERICA study) Nutrients. 2016;8(11):680. doi: 10.3390/nu8110680. - DOI - PMC - PubMed
    1. Acevedo Cantero P., Ortega Santos C. P., López-Ejeda N. Vegetarian diets in Spain: Temporal evolution through national health surveys and their association with healthy lifestyles. Endocrinología, Diabetes y Nutrición. 2023;70((Suppl. 2)):1–8. doi: 10.1016/j.endinu.2022.02.005. - DOI - PubMed
    1. Ali A., Wei S., Ali A., Khan I., Sun Q., Xia Q., Wang Z., Han Z., Liu Y., Liu S. Research progress on nutritional value, preservation and processing of fish: A review. Foods. 2022;11(22):3669. doi: 10.3390/foods11223669. - DOI - PMC - PubMed
    1. Arija V., Pérez C., Serra-Majem L., Aranceta J. Gastronomy and nutrition in Catalonia. Nutricion Hospitalaria. 2019;36:78–85. doi: 10.20960/NH.02699. - DOI - PubMed
    1. Arik S. Ö., Pfister T. TabNet: Attentive interpretable tabular learning [Conference session]; AAAI Conference on Artificial Intelligence; February 2–9; Virtual Event. 2021. pp. 6679–6687. No. 8.

LinkOut - more resources