This repository provides a Pytorch implementation of FlavorGraph2Vec, trained on FlavorGraph, a large-scale food ingredient/chemical compound network of 8K nodes and 147K edges. As it is trained on not only food-food but also compound-compound relationships, our FlavorGraph2Vec is able to provide plausible food ingredient pairing recommendations based on chemical context.
FlavorGraph: Building and embedding a large-scale food graph to suggest better food pairing
Donghyeon Park*, Keonwoo Kim, Seoyoon Kim, Michael Spranger and Jaewoo Kang
Accepted and to be appear in [a publication or conference]
Our paper is available at:
[the link to the paper]
You can try our demo version of FlavorGraph:
[the link to the demo]For more details to find out what we do, please visit https://dmis.korea.ac.kr/
FlavorGraph
FlavorGraph2Vec Architecture
FlavorGraph2Vec Node Embeddings
Abstract
Food pairing is an area that has not yet been fully pioneered, despite our everyday experience and the large amount of data onfood. Such sophisticated and meticulous work so far has been determined by the intuition of the talented chefs. We introduceFlavorGraph that represents a large-scale food graph built on more than one million food recipes and information of 1,500flavor molecules. We analyze and extract sophisticated and meticulous relations of food both statistically and chemically so thatwe can give out a better hint of food pairing. Our graph embedding method based on deep learning surpasses other baselinemethods on food clustering. Food pairing suggestions from our model not only did it show better results, but it also showed thatseveral recommendations were possible depending on the situation. Our research offers a new reflection towards not only foodpairing techniques but also food science in general.
-
Python 3.5.2
-
PyTorch 1.0.0
-
Maybe there are more. If you get an error, please try
pip install "package_name"
. -
CUDA 9.0
-
Tested on NVIDIA GeForce Titan X Pascal 12GB
-
Generated pairing paths for training FlavorGraph2Vec (209MB)
To train the model with pre-generated pairing paths, download the above file containing user-specified paths and place it ininput/paths
folder -
[node2fp_revised_1120.pickle]https://drive.google.com/file/d/1MPZvz6PV5yisiu2cNPRsRzH-d0ZT57Ot/view?usp=sharing) (11MB)
To train the model with Chemical Structure Prediction Layer, download the above file containing food&drug-like compound fingerprints and place it ininput
folder
Train the model with default settings. If you haven't download the above pairing paths file and placed it in the input/paths
folder, the code will generate the pairing paths before running the model. The pairing paths are generated based on default settings.
python3 src/main.py --CSP_train --CSP_save
(You may remove the --CSP_train --CSP_save
argument to train the model without Chemical Structure Prediction.)
If you want try another variation of metapaths before training the model, you can specify the arguments for the MetapathWalker as follows,
python3 src/main.py --number_of_walks 100 \
--walk_length 50 \
--idx_metapath 'M11' \
--which_metapath 'CHC+CHNHC+NHCHN' \
--num_walks 100 \
--len_metapath 50 \
--CSP_train --CSP_save
After the model is trained, a pickle file containing node embeddings from FlavorGraph2Vec and their corresponding tSNE projections will be created in output
folder.
Donghyeon Park1, Keonwoo Kim2
- Assistant Professor, FNAI Labatory, Sejong University, Seoul South Korea
- Ph.D. Candidate, DMIS Labatory, Korea University, Seoul, South Korea
Please, report bugs and missing info to Donghyeon parkdh (at) sejong.ac.kr
.
@article{park2021flavorgraph,
title={FlavorGraph: a large-scale food-chemical graph for generating food representations and recommending food pairings},
author={Park, Donghyeon and Kim, Keonwoo and Kim, Seoyoon and Spranger, Michael and Kang, Jaewoo},
journal={Scientific reports},
volume={11},
number={1},
pages={1--13},
year={2021},
publisher={Nature Publishing Group}
}
Apache License 2.0