Cross-View Heterogeneous Graph Contrastive Learning Method for Healthy Food Recommendation
Abstract
1. Introduction
- We propose a combined view pair for a contrastive learning framework that utilizes the graph’s structural information to guide the model in learning embeddings from different views. In this framework, we bring similar features closer and push other nodes away, thereby assisting supervised learning in developing more discriminative node embeddings, especially in the context of limited labeled data.
- We design a local aggregation mechanism in the heterogeneous context of GAT. This mechanism focuses on local nodes that significantly impact the mining results of user preferences and extracts high-order information related to food ingredients and nutrition to capture a user’s dietary preferences.
- We conduct extensive experiments on a real-world food dataset, and the results demonstrate the superiority of our model compared to various state-of-the-art benchmark methods.
2. Related Work
2.1. Food Recommendation
2.2. Graph Neural Networks
2.3. Contrastive Learning
Authors | Recommendation Approaches | Contributions |
---|---|---|
Sun et al. [10] | CF | Establishing user behavior modeling with self-attention mechanisms for benchmark-leading recommendation performance. |
Ngo et al. [26] | Bayesian Networks | Mitigating glycemic risks through Bayesian neural networks for activity-adaptive food recommendations in diabetes. |
Gao et al. [14] | GCN | Proposing graph convolutional networks with triple propagation for multi-relational representation learning. |
Ouyang et al. [43] | GNNs | Enabling precise user–recipe matching through unified feature granularity and graph semantic modeling. |
Wang et al. [44] | GNNs | Achieving personalized health recipe recommendations via heterogeneous-to-homogeneous conversion. |
Chen et al. [49] | GNNs, Contrastive learning | Leveraging adaptive contrastive augmentation and personalized knowledge transfer for recommendation. |
3. Methods
3.1. Graph Construction
3.1.1. Construction of Feature Relation Graph
3.1.2. Construction of Heterogeneous Information Connection Graph
3.2. Cross-View Contrastive Learning Network
3.2.1. Feature Transformation
3.2.2. Feature Relation Graph Embedding
3.2.3. Heterogeneous Connection Graph Embedding
3.2.4. Nutritional Health Score
3.2.5. Cross-View Contrastive Learning
3.3. Multi-Task Training
4. Experiment
4.1. Dataset
4.2. Experimental Settings
4.3. Evaluation Metrics
4.4. Comparison with Existing Methods
- BPR: This method maximizes the user’s preference for liked items over disliked items, providing high-precision recommendations in sparse data environments [56].
- NGCF: This method constructs a graph structure for users and foods, models users and foods as nodes, and interaction behaviors as edges. It employs graph convolution operations to iteratively aggregate node features, capturing higher-order associations between users and foods [57].
- RGCN: This method constructs a heterogeneous graph to represent entities and their interactions. It uses the information propagation mechanism of graph convolutional networks (GCNs) and multi-layer embedding propagation layers to learn higher-order connectivity between users and foods [58].
- KGAT: This method models the relations between users, foods, and other related entities (e.g., ingredients, attributes) as a collaborative knowledge graph. It introduces an attention mechanism to differentiate the relevance of various neighbors to user preferences [52].
- HAN: This method uses a heterogeneous network model to capture the complex relations between users and items, extracting latent features from heterogeneous information and learning rich embedding representations [20].
- HAFR: This method integrates a hierarchical attention mechanism to capture fine-grained and global preferences by hierarchically modeling the multi-level relations among users, foods, and ingredients [13].
- SCHGCN: This method explicitly models the interactions between ingredients, foods, and users by constructing a heterogeneous graph. It employs an attention mechanism to capture the similarity between the user’s calorie perception and foods for recommendations [22].
- HFRS-DA: This method combines a dual attention network to identify popular and healthy recipes and recommends them to users based on their behavioral information [59].
4.5. Ablation Study and Parameter Analysis
- (1)
- CGHFnoR ignores the food–ingredient and food–nutrient association information in the heterogeneous connection graph, retaining only the user–food association information.
- (2)
- CGHFnoC disregards the contrastive learning task and retains only the supervised learning component to train our model.
- (3)
- CGHFnoP ignores the local aggregation of node-level attention, aggregating all neighbors in the graph generated based on meta-paths.
5. Conclusions
6. Discussion
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Ford, N.D.; Patel, S.A.; Narayan, K.V. Obesity in low-and middle-income countries: Burden, drivers, and emerging challenges. Annu. Rev. Public Health 2017, 38, 145–164. [Google Scholar] [CrossRef]
- Lachat, C.; Otchere, S.; Roberfroid, D.; Abdulai, A.; Seret, F.M.A.; Milesevic, J.; Xuereb, G.; Candeias, V.; Kolsteren, P.; Cobiac, L.J. Diet and physical activity for the prevention of noncommunicable diseases in low-and middle-income countries: A systematic policy review. PLoS Med. 2013, 10, e1001465. [Google Scholar] [CrossRef] [PubMed]
- Popkin, B.M. Global nutrition dynamics: The world is shifting rapidly toward a diet linked with noncommunicable diseases. Am. J. Clin. Nutr. 2006, 84, 289–298. [Google Scholar] [CrossRef] [PubMed]
- Afshin, A.; Sur, P.J.; Fay, K.A.; Cornaby, L.; Ferrara, G.; Salama, J.S.; Mullany, E.C.; Abate, K.H.; Abbafati, C.; Abebe, Z.; et al. Health effects of dietary risks in 195 countries, 1990–2017: A systematic analysis for the Global Burden of Disease Study 2017. Lancet 2019, 393, 1958–1972. [Google Scholar] [CrossRef] [PubMed]
- Ge, M.; Elahi, M.; Fernaández-Tobías, I.; Ricci, F.; Massimo, D. Using tags and latent factors in a food recommender system. In Proceedings of the 5th International Conference on Digital Health 2015, Florence, Italy, 18–20 May 2015; pp. 105–112. [Google Scholar]
- Trattner, C.; Elsweiler, D. Food recommender systems: Important contributions, challenges and future research directions. arXiv 2017, arXiv:1711.02760. [Google Scholar] [CrossRef]
- Marcuzzo, M.; Zangari, A.; Albarelli, A.; Gasparetto, A. Recommendation systems: An insight into current development and future research challenges. IEEE Access 2022, 10, 86578–86623. [Google Scholar] [CrossRef]
- Koren, Y.; Bell, R.; Volinsky, C. Matrix Factorization Techniques for Recommender Systems. Computer 2009, 42, 30–37. [Google Scholar] [CrossRef]
- Sarwar, B.; Karypis, G.; Konstan, J.; Riedl, J. Item-based collaborative filtering recommendation algorithms. In Proceedings of the 10th International Conference on World Wide Web, Hong Kong, China, 1–5 May 2001; pp. 285–295. [Google Scholar]
- Sun, F.; Liu, J.; Wu, J.; Pei, C.; Lin, X.; Ou, W.; Jiang, P. BERT4Rec: Sequential recommendation with bidirectional encoder representations from transformer. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, Beijing, China, 3–7 November 2019; pp. 1441–1450. [Google Scholar]
- Steck, H. Embarrassingly shallow autoencoders for sparse data. In Proceedings of the World Wide Web Conference, San Francisco, CA, USA, 13–17 May 2019; pp. 3251–3257. [Google Scholar]
- Hu, Y.; Koren, Y.; Volinsky, C. Collaborative filtering for implicit feedback datasets. In Proceedings of the 2008 Eighth IEEE International Conference on Data Mining, Pisa, Italy, 15–19 December 2008; pp. 263–272. [Google Scholar]
- Gao, X.; Feng, F.; He, X.; Huang, H.; Guan, X.; Feng, C.; Ming, Z.; Chua, T.-S. Hierarchical attention network for visually-aware food recommendation. IEEE Trans. Multimed. 2019, 22, 1647–1659. [Google Scholar] [CrossRef]
- Gao, X.; Feng, F.; Huang, H.; Mao, X.-L.; Lan, T.; Chi, Z. Food recommendation with graph convolutional network. Inf. Sci. 2022, 584, 170–183. [Google Scholar] [CrossRef]
- Wang, W.; Duan, L.-Y.; Jiang, H.; Jing, P.; Song, X.; Nie, L. Market2Dish: Health-aware food recommendation. ACM Trans. Multimed. Comput. Commun. Appl. (TOMM) 2021, 17, 1–19. [Google Scholar] [CrossRef]
- Fan, S.; Zhu, J.; Han, X.; Shi, C.; Hu, L.; Ma, B.; Li, Y. Metapath-guided heterogeneous graph neural network for intent recommendation. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, Anchorage, AK, USA, 4–8 August 2019; pp. 2478–2486. [Google Scholar]
- Fang, Y.; Yang, Y.; Zhang, W.; Lin, X.; Cao, X. Effective and efficient community search over large heterogeneous information networks. Proc. VLDB Endow. 2020, 13, 854–867. [Google Scholar] [CrossRef]
- Forouzandeh, S.; Berahmand, K.; Sheikhpour, R.; Li, Y. A new method for recommendation based on embedding spectral clustering in heterogeneous networks (RESCHet). Expert Syst. Appl. 2023, 231, 120699. [Google Scholar] [CrossRef]
- Li, X.; Sun, L.; Ling, M.; Peng, Y. A survey of graph neural network based recommendation in social networks. Neurocomputing 2023, 549, 126441. [Google Scholar] [CrossRef]
- Wang, X.; Ji, H.; Shi, C.; Wang, B.; Ye, Y.; Cui, P.; Yu, P.S. Heterogeneous graph attention network. In Proceedings of the World Wide Web Conference, San Francisco, CA, USA, 13–17 May 2019; pp. 2022–2032. [Google Scholar]
- Tan, L.; Gong, D.; Xu, J.; Li, Z.; Liu, F. Meta-path fusion based neural recommendation in heterogeneous information networks. Neurocomputing 2023, 529, 236–248. [Google Scholar] [CrossRef]
- Song, Y.; Yang, X.; Xu, C. Self-supervised calorie-aware heterogeneous graph networks for food recommendation. ACM Trans. Multimed. Comput. Commun. Appl. 2023, 19, 1–23. [Google Scholar] [CrossRef]
- Yang, Y.; Huang, C.; Xia, L.; Li, C. Knowledge graph contrastive learning for recommendation. In Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval, Madrid, Spain, 11–15 July 2022; pp. 1434–1443. [Google Scholar]
- Min, W.; Jiang, S.; Jain, R. Food recommendation: Framework, existing solutions, and challenges. IEEE Trans. Multimed. 2019, 22, 2659–2671. [Google Scholar] [CrossRef]
- Shi, J.; Komamizu, T.; Doman, K.; Kyutoku, H.; Ide, I. RecipeMeta: Metapath-enhanced Recipe Recommendation on Heterogeneous Recipe Network. In Proceedings of the 5th ACM International Conference on Multimedia in Asia, Tainan, China, 6–8 December 2023; pp. 1–7. [Google Scholar]
- Ngo, P.; Tejedor, M.; Tayefi, M.; Chomutare, T.; Godtliebsen, F. Risk-averse food recommendation using bayesian feedforward neural networks for patients with type 1 diabetes doing physical activities. Appl. Sci. 2020, 10, 8037. [Google Scholar] [CrossRef]
- Chen, L.; Xie, T.; Li, J.; Zheng, Z. Graph enhanced neural interaction model for recommendation. Knowl.-Based Syst. 2022, 246, 108616. [Google Scholar] [CrossRef]
- Sookrah, R.; Dhowtal, J.D.; Nagowah, S.D. A DASH diet recommendation system for hypertensive patients using machine learning. In Proceedings of the 2019 7th International Conference on Information and Communication Technology (ICoICT), Kuala Lumpur, Malaysia, 24–26 July 2019; pp. 1–6. [Google Scholar]
- Zioutos, K.; Kondylakis, H.; Stefanidis, K. Healthy Personalized Recipe Recommendations for Weekly Meal Planning. Computers 2023, 13, 1. [Google Scholar] [CrossRef]
- Jia, X.; Jiang, M.; Dong, Y.; Zhu, F.; Lin, H.; Xin, Y.; Chen, H. Multimodal heterogeneous graph attention network. Neural Comput. Appl. 2023, 35, 3357–3372. [Google Scholar] [CrossRef]
- Yang, W.; Li, J.; Tan, S.; Tan, Y.; Lu, X. A heterogeneous graph neural network model for list recommendation. Knowl.-Based Syst. 2023, 277, 110822. [Google Scholar] [CrossRef]
- Li, M.; Li, L.; Tao, X.; Xie, Z.; Xie, Q.; Yuan, J. Boosting healthiness exposure in category-constrained meal recommendation using nutritional standards. ACM Trans. Intell. Syst. Technol. 2024, 15, 1–28. [Google Scholar] [CrossRef]
- Rostami, M.; Farrahi, V.; Ahmadian, S.; Jalali, S.M.J.; Oussalah, M. A novel healthy and time-aware food recommender system using attributed community detection. Expert Syst. Appl. 2023, 221, 119719. [Google Scholar] [CrossRef]
- Ma, W.; Li, M.; Dai, J.; Ding, J.; Chu, Z.; Chen, H. Nutrition-Related Knowledge Graph Neural Network for Food Recommendation. Foods 2024, 13, 2144. [Google Scholar] [CrossRef]
- Tang, J.; Huang, B.; Xie, M. Anticancer Recipe Recommendation Based on Cancer Dietary Knowledge Graph. Eur. J. Cancer Care 2023, 2023, 8816960. [Google Scholar] [CrossRef]
- Hu, B.; Shi, C.; Zhao, W.X.; Yu, P.S. Leveraging meta-path based context for top-n recommendation with a neural co-attention model. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, London, UK, 19–23 August 2018; pp. 1531–1540. [Google Scholar]
- Jin, J.; Qin, J.; Fang, Y.; Du, K.; Zhang, W.; Yu, Y.; Zhang, Z.; Smola, A.J. An efficient neighborhood-based interaction model for recommendation on heterogeneous graph. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, Virtual Event, CA, USA, 6–10 July 2020; pp. 75–84. [Google Scholar]
- Zhao, H.; Yao, Q.; Li, J.; Song, Y.; Lee, D.L. Meta-graph based recommendation fusion over heterogeneous information networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Halifax, NS, Canada, 13–17 August 2017; pp. 635–644. [Google Scholar]
- Wang, H.; Zhao, M.; Xie, X.; Li, W.; Guo, M. Knowledge graph convolutional networks for recommender systems. In Proceedings of the World Wide Web Conference, San Francisco, CA, USA, 13–17 May 2019; pp. 3307–3313. [Google Scholar]
- Chen, L.; Cao, J.; Wang, Y.; Liang, W.; Zhu, G. Multi-view graph attention network for travel recommendation. Expert Syst. Appl. 2022, 191, 116234. [Google Scholar] [CrossRef]
- Wang, X.; He, X.; Cao, Y.; Liu, M.; Chua, T.-S. Kgat: Knowledge graph attention network for recommendation. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, Anchorage, AK, USA, 4–8 August 2019; pp. 950–958. [Google Scholar]
- Chang, Y.; Zhou, W.; Wen, J. IHG4MR: Interest-oriented heterogeneous graph for multirelational recommendation. Expert Syst. Appl. 2023, 228, 120321. [Google Scholar] [CrossRef]
- Ouyang, R.; Huang, H.; Ou, W.; Liu, Q. Multimodal Recipe Recommendation with Heterogeneous Graph Neural Networks. Electronics 2024, 13, 3283. [Google Scholar] [CrossRef]
- Wang, J.; Zhou, J.; Aksoy, M.; Sharma, N.; Rahman, A.; Zain, J.M.; Alenazi, M.J.; Aminzadeh, A. Improving healthy food recommender systems through heterogeneous hypergraph learning. Egypt. Inform. J. 2024, 28, 100570. [Google Scholar] [CrossRef]
- Khasahmadi, K.H.A.H. Contrastive multi-view representation learning on graphs. In Proceedings of the International Conference on Machine Learning, Vienna, Austria, 13–18 July 2020; pp. 4116–4126. [Google Scholar]
- Yu, J.; Yin, H.; Gao, M.; Xia, X.; Zhang, X.; Hung, N.Q.V. Socially-aware self-supervised tri-training for recommendation. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, Virtual Event, Singapore, 14–18 August 2021; pp. 2084–2092. [Google Scholar]
- Wang, X.; Liu, N.; Han, H.; Shi, C. Self-supervised heterogeneous graph neural network with co-contrastive learning. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, Virtual Event, Singapore, 14–18 August 2021; pp. 1726–1736. [Google Scholar]
- Wu, J.; Wang, X.; Feng, F.; He, X.; Chen, L.; Lian, J.; Xie, X. Self-supervised graph learning for recommendation. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, Virtual Event, Canada, 11–15 July 2021; pp. 726–735. [Google Scholar]
- Chen, M.; Huang, C.; Xia, L.; Wei, W.; Xu, Y.; Luo, R. Heterogeneous graph contrastive learning for recommendation. In Proceedings of the Sixteenth ACM International Conference on Web Search and Data Mining, Singapore, Singapore, 27 February–3 March 2023; pp. 544–552. [Google Scholar]
- Dong, Y.; Chawla, N.V.; Swami, A. metapath2vec: Scalable representation learning for heterogeneous networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Halifax, NS, Canada, 13–17 August 2017; pp. 135–144. [Google Scholar]
- Sun, Y.; Han, J.; Yan, X.; Yu, P.S.; Wu, T. Pathsim: Meta path-based top-k similarity search in heterogeneous information networks. Proc. VLDB Endow. 2011, 4, 992–1003. [Google Scholar] [CrossRef]
- Veličković, P.; Cucurull, G.; Casanova, A.; Romero, A.; Lio, P.; Bengio, Y. Graph attention networks. arXiv 2017, arXiv:1710.10903. [Google Scholar]
- Nishida, C.; Uauy, R.; Kumanyika, S.; Shetty, P. The joint WHO/FAO expert consultation on diet, nutrition and the prevention of chronic diseases: Process, product and policy implications. Public Health Nutr. 2004, 7, 245–250. [Google Scholar] [CrossRef] [PubMed]
- Trattner, C.; Elsweiler, D. Investigating the healthiness of internet-sourced recipes: Implications for meal planning and recommender systems. In Proceedings of the 26th International Conference on World Wide Web, Perth, Australia, 3–7 April 2017; pp. 489–498. [Google Scholar]
- Rendle, S. Factorization machines with libfm. ACM Trans. Intell. Syst. Technol. (TIST) 2012, 3, 1–22. [Google Scholar] [CrossRef]
- Rendle, S.; Freudenthaler, C.; Gantner, Z.; Schmidt-Thieme, L. BPR: Bayesian personalized ranking from implicit feedback. arXiv 2012, arXiv:1205.2618. [Google Scholar] [CrossRef]
- Wang, X.; He, X.; Wang, M.; Feng, F.; Chua, T.-S. Neural graph collaborative filtering. In Proceedings of the 42nd International ACM SIGIR Conference on RESEARCH and Development in Information Retrieval, Paris, France, 21–25 July 2019; pp. 165–174. [Google Scholar]
- Schlichtkrull, M.; Kipf, T.N.; Bloem, P.; Van Den Berg, R.; Titov, I.; Welling, M. Modeling relational data with graph convolutional networks. In The Semantic Web: 15th International Conference, ESWC 2018, Heraklion, Crete, Greece, 3–7 June 2018; Springer: Berlin/Heidelberg, Germany, 2018; pp. 593–607. [Google Scholar]
- Forouzandeh, S.; Rostami, M.; Berahmand, K.; Sheikhpour, R. Health-aware food recommendation system with dual attention in heterogeneous graphs. Comput. Biol. Med. 2024, 169, 107882. [Google Scholar] [CrossRef] [PubMed]
Edge Types | User | Food | Ingredient | Nutrition |
---|---|---|---|---|
UF | 31,518 | 25,663 | - | - |
FI | - | 25,683 | 17,847 | - |
FN | - | 25,683 | - | 179,781 |
Number of Ratings | Number of Users | Percentage of Users |
---|---|---|
1–5 | 18,807 | 59.7% |
6–10 | 4064 | 12.9% |
11–15 | 1980 | 6.3% |
16–20 | 1210 | 3.8% |
20 or more | 5457 | 17.3% |
Methods | NDCG@10 | Recall@10 | Precision@10 | F1@10 | Health@10 | AUC |
---|---|---|---|---|---|---|
LDA | 0.0379 | 0.0601 | 0.0584 | 0.0592 | - | 0.5154 |
FM | 0.0396 | 0.0607 | 0.0585 | 0.0596 | - | 0.5710 |
BPR | 0.0296 | 0.0431 | 0.0430 | 0.0431 | - | 0.5808 |
NGCF | 0.0269 | 0.0386 | 0.0377 | 0.0381 | - | 0.5828 |
RGCN | 0.0238 | 0.0416 | 0.0706 | 0.0524 | 0.0320 | 0.6435 |
KGAT | 0.0287 | 0.0518 | - | - | 0.0382 | 0.6481 |
HAN | 0.0362 | 0.0587 | - | - | - | 0.6528 |
HAFR | 0.0455 | 0.0674 | 0.0624 | 0.0648 | 0.0425 | 0.6562 |
SCHGCN | 0.0569 | 0.0883 | 0.0853 | 0.0868 | - | 0.7212 |
HFRS-DA | 0.1890 | 0.1437 | 0.0614 | 0.0860 | 0.0638 | 0.7589 |
CGHF | 0.1726 | 0.1648 | 0.0568 | 0.0845 | 0.1827 | 0.7683 |
NDCG@10 | Recall@10 | Precision@10 | F1@10 | Health@10 | AUC | |
---|---|---|---|---|---|---|
CGHFnoR | 0.1137 | 0.1223 | 0.0458 | 0.0666 | 0.0516 | 0.6406 |
CGHFnoC | 0.0982 | 0.1105 | 0.0426 | 0.0615 | 0.0412 | 0.6217 |
CGHFnoP | 0.1253 | 0.1329 | 0.0373 | 0.0582 | 0.1263 | 0.6892 |
CGHF | 0.1726 | 0.1648 | 0.0568 | 0.0855 | 0.1827 | 0.7683 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhao, H.; Chen, H.; Wang, J.; Wang, Y. Cross-View Heterogeneous Graph Contrastive Learning Method for Healthy Food Recommendation. Computation 2025, 13, 197. https://doi.org/10.3390/computation13080197
Zhao H, Chen H, Wang J, Wang Y. Cross-View Heterogeneous Graph Contrastive Learning Method for Healthy Food Recommendation. Computation. 2025; 13(8):197. https://doi.org/10.3390/computation13080197
Chicago/Turabian StyleZhao, Huacheng, Hao Chen, Jianxin Wang, and Yeru Wang. 2025. "Cross-View Heterogeneous Graph Contrastive Learning Method for Healthy Food Recommendation" Computation 13, no. 8: 197. https://doi.org/10.3390/computation13080197
APA StyleZhao, H., Chen, H., Wang, J., & Wang, Y. (2025). Cross-View Heterogeneous Graph Contrastive Learning Method for Healthy Food Recommendation. Computation, 13(8), 197. https://doi.org/10.3390/computation13080197