A recipe information push method based on knowledge graph and deep learning

By building a recipe knowledge graph and deep learning-based method, we can integrate the features of the recipe description text information with the recipe knowledge graph, thus solving the problem of inaccurate recipe recommendations in the existing technology and achieving more efficient recipe recommendation results.

CN117009646BActive Publication Date: 2025-10-03ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310555565.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-17
Publication Date
2025-10-03
Estimated Expiration
2043-05-17

AI Technical Summary

Technical Problem

When existing technologies obtain user-preferred recipe information from the Internet, the recommendation effect is not accurate enough and a large amount of effective information is lost.

Method used

A method based on knowledge graph and deep learning is used to construct a recipe knowledge graph and recipe specific description text information. Feature fusion is performed through a dynamic weight layer, and combined with scene vector features, a recipe recommendation system is built. The recipe knowledge graph and recipe description text information are used to introduce additional information into the recommendation system, thereby improving the interpretability and accuracy of the recommendation system.

Benefits of technology

The interpretability and recommendation accuracy of the recipe recommendation system are improved, the recipe feature fusion effect is enhanced, and more accurate recipe recommendations are provided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117009646B_ABST
    Figure CN117009646B_ABST
Patent Text Reader

Abstract

The present invention discloses a recipe information push method based on knowledge graph and deep learning. The method constructs a recipe knowledge graph by collecting recipe-related information, obtains recipe-specific description text information, and performs vectorized extraction on each of them; performs matrix decomposition on the user-recipe interaction matrix to obtain user scenario vectors and recipe scenario vectors, and splices them to obtain scenario vectors; combines the recipe-specific description text information vector features and the recipe knowledge graph vector features with the scenario vector features to obtain recipe features; converts user category information and recipe category information into vector features through embedding; normalizes user numerical features and recipe numerical features; performs feature processing on user favorite recipe ID features and recipe ID features to be exposed; and constructs and trains a recommendation system to make recipe recommendations. This method effectively improves the interpretability, accuracy, and generalization ability of the recommendation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of information extraction and push, and specifically to a recipe information push method based on knowledge graph and deep learning. Background Art

[0002] As living standards continue to improve in modern society, food plays an increasingly important role in family life and social activities. With the rapid development of the internet, obtaining recipe information online has become a daily habit. However, the amount of data on the internet is enormous and continues to grow rapidly. Finding valuable and user-friendly recipes from this vast amount of data has become a challenge.

[0003] Currently, many software on the market recommend recipes that users may like based on the collected user and recipe data. They mostly use collaborative filtering or simple machine learning models. Although the implementation is simple, a lot of effective information is lost, and the recommendation effect needs to be further improved. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of the existing technology and propose a recipe information push method based on knowledge graph and deep learning to capture users' relevant preferences and recipe-related information, and recommend recipes and recipe-related information to users.

[0005] In order to achieve the above object, the technical solution adopted by the present invention includes the following steps:

[0006] S1: Collect recipe-related information to build a recipe knowledge graph and obtain the recipe description text information;

[0007] S2: Vectorize and extract the recipe description text information to obtain the recipe description text information vector features;

[0008] S3: Vectorize and extract the recipe knowledge graph to obtain the recipe knowledge graph vector features;

[0009] S4: Perform matrix decomposition on the user-recipe interaction matrix to obtain user scenario vectors and recipe scenario vectors. Concatenate the user scenario vectors and recipe scenario vectors to obtain a scenario vector, which represents the scenario bias between the user and the recipe. Combine the recipe description text information vector features and the recipe knowledge graph vector features with the scenario vector features through a dynamic weight layer to perform dynamic weight assignment and feature fusion.

[0010] The attention function of the dynamic weight layer is:

[0011] f(x_kg, s)=x_kgWS, f(x_wd, s)=x_wdWS

[0012] Where x_kg is the vector of the recipe knowledge graph, W is the weight matrix, S is the scene vector, and x_wd is the feature vector of the recipe description text information;

[0013] Weight Weight

[0014] Where α is the weight of the recipe knowledge graph vector x_kg, and β is the weight of the recipe description text feature vector x_wd;

[0015] The fused recipe feature vector is:

[0016] y = x_kg T α+x_wd T β;

[0017] S5: Build and train a recipe recommendation system to recommend recipes. The specific steps are as follows:

[0018] S5.1: Convert user category information and recipe category information into vector features through embedding;

[0019] S5.2: Normalize the user numerical features and recipe numerical features;

[0020] S5.3: Perform feature crossover on the fused recipe feature vector, user category information vector feature, recipe category information vector feature, normalized user numerical feature, and recipe numerical feature;

[0021] S5.4: Input the crossed features into the Attention Net to obtain the weights of different features and pass the weighted features into the next layer of the neural network;

[0022] S5.5: Perform feature processing on the ID features of user’s favorite recipes and the ID features of the recipes to be exposed; input and output the vectors output by the Attention Net to perform model training; obtain the trained recipe recommendation system for recipe recommendation.

[0023] Furthermore, the specific steps described in S1 are as follows: the researchers select the recipe field as the knowledge scope, define the ontology in the recipe field, define its relevant attribute information and value range based on the data description of the ontology, define the relationship between ontologies and add constraints, and then generate and store the knowledge graph records, and at the same time obtain the text information of the specific steps of the recipe.

[0024] Furthermore, the recipe specific description text information in S2 is vectorized and extracted using a Word2vec model.

[0025] Furthermore, the vectorized extraction of the recipe knowledge graph in S3 is specifically performed using the TransR model.

[0026] Furthermore, the user category information in S5 includes occupation and city, and the recipe category information includes recipe category.

[0027] Furthermore, the user numerical characteristics in S5 include user age; the recipe numerical characteristics include the number of likes and collections of the recipe.

[0028] Furthermore, the recipe recommendation system in S5 is divided into two parts, a left cross-product transformation layer and a right part; the left cross-product transformation layer part is used to improve the memory ability of the model, and the right part is used to improve the generalization ability of the model.

[0029] Furthermore, the user's favorite recipe id features and the to-be-exposed recipe id features are feature processed through a cross-product transformation layer.

[0030] Furthermore, the right side of the model is used to:

[0031] Convert user category information and recipe category information into vector features through Embedding;

[0032] Normalize various numerical features such as user age and recipe likes and favorites;

[0033] Perform feature crossover on the fused recipe feature vector, user category information vector features, recipe category information vector features, normalized user numerical features, and recipe numerical features.

[0034] Furthermore, the recipe recommendation step in S5 is specifically as follows: traverse all recipes to be recommended, input the relevant identity information of the user to be predicted, user-recipe interaction information and recipe corresponding information into the recommendation system model, sort them according to the scores, limit the number of recommended recipes, and recommend the top n recipes with higher scores.

[0035] Beneficial effects:

[0036] (1) Compared with existing techniques for recommending recipe information based on collaborative filtering of users or items, the recipe information recommendation method based on knowledge graph and deep learning provided by the present invention introduces additional information into the recommendation system by utilizing the recipe knowledge graph and recipe-related description information, which effectively improves the interpretability of the recommendation system.

[0037] (2) The present invention provides a method for dynamically assigning weights to recipe description text information features and recipe knowledge graph vector features in combination with scene vector features, thereby enhancing the feature fusion effect of recipe description text information features and recipe knowledge graph vector features in the recipe field;

[0038] (2) The present invention proposes a recommendation system model, which introduces the features of the effective combination of recipe description text information and recipe knowledge graph into the proposed recommendation system model, effectively improving the accuracy of the recommendation system. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A flowchart of a recipe information push method based on knowledge graph and deep learning provided by the present invention;

[0040] Figure 2 The model architecture of a recipe information push method based on knowledge graph and deep learning provided by the present invention; DETAILED DESCRIPTION

[0041] The specific embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0042] like Figure 1 The figure shows a flow chart of a recipe information push method based on knowledge graph and deep learning provided by an example of this application. In this embodiment, the recipe information push method may include the following steps.

[0043] S1: Collect recipe-related information to build a recipe knowledge graph and obtain the recipe description text information;

[0044] S2: Vectorize and extract the recipe description text information to obtain the recipe description text information vector features;

[0045] S3: Vectorize and extract the recipe knowledge graph to obtain the recipe knowledge graph vector features;

[0046] S4: Perform matrix decomposition on the user-recipe interaction matrix to obtain user scenario vectors and recipe scenario vectors. Concatenate the user scenario vectors and recipe scenario vectors to obtain a scenario vector, which represents the scenario bias between the user and the recipe. Combine the recipe description text information vector features and the recipe knowledge graph vector features with the scenario vector features through a dynamic weight layer to perform dynamic weight assignment and feature fusion.

[0047] The attention function of the dynamic weight layer is:

[0048] f(x_kg, s)=x_kgWS, f(x_wd, s)=x_wdWS

[0049] Where x_kg is the vector of the recipe knowledge graph, W is the weight matrix, S is the scene vector, and x_wd is the feature vector of the recipe description text information;

[0050] Weight Weight

[0051] Where α is the weight of the recipe knowledge graph vector x_kg, and β is the weight of the recipe description text feature vector x_wd;

[0052] The fused recipe feature vector is:

[0053] y = x_kg T α+x_wd T β;

[0054] S5: Build and train a recipe recommendation system to recommend recipes. The specific steps are as follows:

[0055] S5.1: Convert user category information and recipe category information into vector features through embedding;

[0056] S5.2: Normalize the user numerical features and recipe numerical features;

[0057] S5.3: Perform feature crossover on the fused recipe feature vector, user category information vector feature, recipe category information vector feature, normalized user numerical feature, and recipe numerical feature;

[0058] S5.4: Input the crossed features into the Attention Net to obtain the weights of different features and pass the weighted features into the next layer of the neural network;

[0059] S5.5: Perform feature processing on the ID features of user’s favorite recipes and the ID features of the recipes to be exposed; input and output the vectors output by the Attention Net to perform model training; obtain the trained recipe recommendation system for recipe recommendation.

[0060] The specific steps described in S1 are as follows: the researchers selected the recipe field as the knowledge scope, defined the ontology in the recipe field, defined its relevant attribute information and value range based on the data description of the ontology, defined the relationship between ontologies and added constraints, and then generated and stored the knowledge graph records, while obtaining the text information of the specific steps of the recipe.

[0061] The recipe specific description text information in S2 is vectorized and extracted using the Word2vec model.

[0062] The recipe knowledge graph vectorization extraction in S3 is specifically performed using the TransR model.

[0063] The user category information in S5 includes occupation and city, and the recipe category information includes recipe category.

[0064] The user numerical features in S5 include the user's age; the recipe numerical features include the number of likes and collections of the recipe.

[0065] The recipe recommendation system in S5 is divided into two parts, the cross-product transformation layer on the left and the right part; the cross-product transformation layer on the left is used to improve the memory ability of the model, and the right part is used to improve the generalization ability of the model.

[0066] The user's favorite recipe ID features and the to-be-exposed recipe ID features are processed through a cross-product transformation layer.

[0067] The right side of the model is used to:

[0068] Convert user category information and recipe category information into vector features through Embedding;

[0069] Normalize various numerical features such as user age and recipe likes and favorites;

[0070] Perform feature crossover on the fused recipe feature vector, user category information vector features, recipe category information vector features, normalized user numerical features, and recipe numerical features.

[0071] The recipe recommendation step in S5 is specifically as follows: traverse all recipes to be recommended, input the relevant identity information of the user to be predicted, user-recipe interaction information and recipe corresponding information into the recommendation system model, sort them according to the scores, limit the number of recommended recipes, and recommend the top n recipes with higher scores.

[0072] Example:

[0073] like Figure 2 As shown, the present invention provides a model of a recipe information push method based on knowledge graph and deep learning. The model consists of a dynamic weight layer, an embedding layer, a cross-product transformation layer, an Attention Net and an output layer, which is used to realize personalized recipe recommendation.

[0074] The dynamic weight layer dynamically assigns weights and fuses the recipe description text information vector features and recipe knowledge graph vector features with the scene vector features, thereby better targeting the scene bias of a certain user and a certain recipe for recommendation and enhancing the recommendation effect.

[0075] The Embedding layer converts discrete input features into continuous, dense vector representations. It learns an embedding matrix to map each discrete feature into a low-dimensional vector space. These low-dimensional vectors can be viewed as a compression and extraction of the original features, better capturing similarities and differences between features.

[0076] The main function of the cross-product transformation layer is to realize the cross combination of input features, thereby improving the performance of the model on sparse data and enhancing the memory capacity of the model.

[0077] Attention Net is a neural network model built on the attention mechanism. Attention Mechanism is an algorithm used in natural language processing and machine learning that helps models better understand and process data. Attention Net's role is to give different weights to different features, allowing the model to focus more on certain specific parts, thereby improving the model's understanding and expression of input data. Specifically, Attention Net can automatically learn a weight vector while encoding the input, fusing different parts of information to varying degrees, thereby producing better output results.

[0078] The output layer is the last layer in the neural network. Its main function is to convert various data features of the model input into the final output results.

[0079] In order to subsequently extract features from the knowledge graph, it is necessary to first build a recipe knowledge graph.

[0080] When constructing the knowledge graph, the collected recipe-related data is stored in the form of triples. The specific recipe attribute information involves dishes (home-cooked dishes, quick dishes, dishes that go well with rice, etc.), effects (weight loss, beauty, moisturizing the lungs and resisting dryness, etc.), suitable groups of people (children, the elderly, pregnant women, etc.), cuisines (Shandong cuisine, Sichuan cuisine, Korean cuisine, etc.), utensils (oven, oven dishes, rice cookers, etc.), cooking methods (frying, steaming, stewing, braising, etc.), taste characteristics (spicy, curry, sweet and sour, garlic, original flavor, etc.), forms (sushi, candy, glutinous rice balls, juice, etc.), dining occasions (birthdays, picnics, dinners, work meals, etc.), meal times (breakfast, lunch, dinner, supper, etc.), main ingredients (meat, vegetables and fruits, seafood, etc.), and auxiliary ingredients (salt, vinegar, MSG, cooking wine, etc.); the attribute information such as dishes, effects, suitable groups of people, cuisines, utensils, cooking methods, taste characteristics, forms, dining occasions, meal times, main ingredients, and auxiliary ingredients are combined into a recipe attribute set. The specific method of constructing the attribute information of the recipe node is: according to the recipe attribute set, the information is extracted one by one according to the set elements, that is, the attribute name, and preprocessed. The above preprocessing includes missing value supplementation, etc.

[0081] Use the Word2Vec model to vectorize other relevant text descriptions of the recipe publisher;

[0082] The acquired knowledge graph is vectorized using the TransR model. For each triple (h, r, t), the entities in the entity space are vectorized by the matrix M. r Projected into the r relation space, they are h r and t r ,

[0083] h r =hM r , t r =tM r .

[0084] The scoring function is:

[0085]

[0086] The constraints are: ||h||2≤1, ||r||2≤1, ||t||2≤1, ||hM r ||2≤1,||tM r ||2≤1

[0087] The loss function is:

[0088]

[0089] Where γ is a hyperparameter;

[0090] Perform matrix decomposition on the user-recipe interaction graph. For example, the interaction matrix M(m*n) is decomposed into two matrices P(m*k) and Q(k*n). Then, the matrix is ​​transposed and concatenated into N((m+n)*k). At this time, the scene vector is obtained, which represents the scene bias of the user and the recipe.

[0091] The recipe description text information vector features and the recipe knowledge graph vector features are combined with the scene vector features through a dynamic weight layer to perform dynamic weight assignment and feature fusion. The purpose of dynamic weight assignment is to better make recommendations based on the scene bias of a certain user and a certain recipe, and to enhance the recommendation effect. For example, for a user who likes to try new dishes, the knowledge graph feature may be more important because it can provide more information such as ingredients and flavors to help users discover novel recipes; for a user who likes to cook step by step, the recipe description text information feature may be more important because it can provide more tips, precautions and other information to help users complete the recipe; for a user who cooks on holidays or special occasions, the knowledge graph feature and the recipe description text information feature may be more important because they can provide more information such as ingredient combinations, dish styles, cooking difficulty, etc. to help users choose suitable recipes.

[0092] The attention function of the dynamic weight layer is

[0093] f(x_kg, s)=x_kgWS, f(x_wd, s)=x_wdWS.

[0094] Where x_kg is the vector of the recipe knowledge graph, W is the weight matrix, S is the scene vector, and x_wd is the feature vector of the recipe's specific description text information.

[0095] Weight Weight

[0096] α is the weight of the recipe knowledge graph vector x_kg, and β is the weight of the recipe description text feature vector x_wd.

[0097] The fused recipe feature vector is

[0098] y = x_kg T α+x_wd T β.

[0099] For example, at this time, the recipe knowledge graph vector x_kg=[0.2, 0.4, 0.6, 0.8], the recipe specific description text information feature vector x_wd=[0.1, 0.3, 0.5, 0.7], the scene vector S=[[0.9, 0.8], [0.8, 0.9]], initialize a random weight matrix W=[[0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.7, 0.8]], the attention function f(x_kg, s)=x_kgWS and f(x_wd, s)=x_wdWS, the output of the former is [1.8600, 1.8800], the output of the latter is [1.5560, 1.5720], the weight of x_kg The value is [0.5445, 0.5446], the weight of x_wd The value is [0.4555, 0.4554], and the fused feature vector y = x_kg T α+x_wd T β, y are [[0.1544, 0.1545], [0.3544, 0.3545], [0.5544, 0.5545], [0.7544, 0.7545]].

[0100] Numerical features such as the user's age are normalized. Categorical features such as the user's city are encoded through the Embedding layer. Specifically, each discrete feature is mapped to a fixed-length, low-dimensional vector space to better represent the relationship between features.

[0101] The features output by the dynamic weight layer, the features output by the Embedding layer, and the normalized numerical features are cross-featured, and the resulting vectors are input into the Attention network to assign different weights; in the Attention layer, different features x i , x j The weight of the cross feature a ij The formula is as follows:

[0102] a′ ij =h T ReLU(W(V i ⊙V j )x i x j +b)

[0103]

[0104] Where h is the weight vector from the fully connected layer to the softmax output layer, ReLU is the activation function, V i and V j represents the latent vector of the i-th and j-th features, ⊙ represents the Hadamard product, which means the multiplication of elements at corresponding positions, W is the weight matrix from the feature cross layer to the fully connected layer of the attention network, and b is the bias vector;

[0105] Perform a cross-product transformation on the user's favorite recipe ID features and the recipe ID features to be exposed. The cross-product transformation layer is defined as follows:

[0106]

[0107] Among them, C ki is a bool variable that is 1 if the i-th feature is part of the k-th transformation, otherwise it is 0;

[0108] Each hidden layer on the right side of the model performs the following calculations:

[0109] a (l+1) =f(ω (l) a (l) +b (l) )

[0110] Where f is the activation function ReLU, ω (l) , a (l) , b (l) , are the weight matrix, activation value, and bias of the lth layer respectively;

[0111] The vectors output by the cross-product transformation layer and the attention network layer are combined and input into the output layer for training. The prediction value of the model is defined as follows:

[0112]

[0113] Among them, Y is the binary classification label, σ is the sigmoid function, is the cross-product transformation of the original feature X, b is the bias term, is the weight vector of the left model, is the weight vector of the right model, used for the final activation function a (lf) The weight of a (lf) Refers to the output vector of the attention network layer.

[0114] Input user and recipe related information into the trained recommendation system model, sort according to the model's output score, and recommend the top n recipes to the user;

[0115] The above embodiments are used to illustrate the present invention rather than to limit the present invention. Any modifications and changes made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.

Claims

1. A recipe information push method based on knowledge graph and deep learning, characterized in that: The following steps are involved: S1: Collect recipe-related information to build a recipe knowledge graph and obtain the recipe description text information; S2: Vectorize and extract the recipe description text information to obtain the recipe description text information vector features; S3: Vectorize and extract the recipe knowledge graph to obtain the recipe knowledge graph vector features; S4: Perform matrix decomposition on the user-recipe interaction matrix to obtain user scenario vectors and recipe scenario vectors. Concatenate the user scenario vectors and recipe scenario vectors to obtain a scenario vector, which represents the scenario bias between the user and the recipe. Combine the recipe description text information vector features and the recipe knowledge graph vector features with the scenario vector features through a dynamic weight layer to perform dynamic weight assignment and feature fusion. The attention function of the dynamic weight layer is: f(x_kg,s)=x_kgWS, f(x_wd,s)=x_wdWS Where x_kg is the vector of the recipe knowledge graph, W is the weight matrix, S is the scene vector, and x_wd is the feature vector of the recipe description text information; Where α is the weight of the recipe knowledge graph vector x_kg, and β is the weight of the recipe description text feature vector x_wd; The fused recipe feature vector is: y=x_kg T α+x_wd T β; S5: Build and train a recipe recommendation system to recommend recipes. The specific steps are as follows: S5.1: Convert user category information and recipe category information into vector features through embedding; S5.2: Normalize the user numerical features and recipe numerical features; S5.3: Perform feature crossover on the fused recipe feature vector, user category information vector feature, recipe category information vector feature, normalized user numerical feature, and recipe numerical feature; S5.4: Input the crossed features into the Attention Net to obtain the weights of different features and pass the weighted features into the next layer of the neural network; S5.5: Perform feature processing on the user's favorite recipe ID features and the recipe ID features to be exposed; The vector output by Attentionnet is input into the output layer for model training; the trained recipe recommendation system is obtained for recipe recommendation.

2. The method according to claim 1, characterized in that The specific steps described in S1 are as follows: the researchers selected the recipe field as the knowledge scope, defined the ontology in the recipe field, defined its relevant attribute information and value range based on the data description of the ontology, defined the relationship between ontologies and added constraints, and then generated and stored the knowledge graph records, while obtaining the text information of the specific steps of the recipe.

3. The method according to claim 1, characterized in that The recipe specific description text information in S2 is vectorized and extracted using the Word2vec model.

4. The method according to claim 1, wherein The recipe knowledge graph vectorization extraction in S3 is specifically performed using the TransR model.

5. The method according to claim 1, wherein The user category information in S5 includes gender and occupation, and the recipe category information includes recipe category.

6. The method according to claim 1, characterized in that The user numerical features in S5 include the user's age; the recipe numerical features include the number of likes and collections of the recipe.

7. The method according to claim 1, characterized in that The recipe recommendation system in S5 is divided into two parts, the cross-product transformation layer on the left and the right part; the cross-product transformation layer on the left is used to improve the memory ability of the model, and the right part is used to improve the generalization ability of the model.

8. The method according to claim 7, characterized in that The user's favorite recipe ID features and the to-be-exposed recipe ID features are processed through a cross-product transformation layer.

9. The method according to claim 7, characterized in that The right side of the model is used to: Convert user category information and recipe category information into vector features through Embedding; Normalize the numerical features of user age, recipe likes, and favorites. Perform feature crossover on the fused recipe feature vector, user category information vector features, recipe category information vector features, normalized user numerical features, and recipe numerical features.

10. The method according to claim 1, characterized in that The recipe recommendation step in S5 is specifically as follows: traverse all recipes to be recommended, input the relevant identity information of the user to be predicted, user-recipe interaction information and recipe corresponding information into the recommendation system model, sort them according to the scores, limit the number of recommended recipes, and recommend the top n recipes with higher scores.

Citation Information

Patent Citations

  • Method and device for constructing recipe recommendation strategy based on knowledge graph

    CN110310721A

  • Knowledge graph recommendation method and system based on improved KGAT model

    CN114048331A