Menu recommendation method, menu recommendation device and electronic equipment
By combining the recipe recommendation method of knowledge graph and the double tower model, the problem that the existing system cannot recommend recipes based on the user's health status is solved, and more accurate and healthy recipe recommendations are achieved.
Patent Information
- Application Number
- CN202311027381.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2025-02-21
AI Technical Summary
The existing recipe recommendation system cannot make targeted recommendations based on the user's physical health, and only considers the user's taste preferences.
Using the combination method of knowledge graph and double tower model, the basic health status of users and current meal time are screened, preliminary recipes are selected, and then further screened and sorted through the double tower model to recommend the recipes that are most suitable for users.
It has achieved intelligent recommendation of recipes based on the user's physical health, improved the pertinence and accuracy of recipe recommendations, and helped users choose a healthy diet plan.
Smart Images

Figure CN119493814A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of health management technology, and in particular to a recipe recommendation method, a recipe recommendation device and an electronic device. Background Art
[0002] With the continuous progress of society and the continuous development of the economy, people are paying more and more attention to health, and a reasonable diet is closely related to people's health. Therefore, a large number of recipe recommendation systems have appeared on the market, but these recipe recommendation systems often only cater to the user's taste preferences, but cannot make targeted recipe recommendations for the user's physical health. Summary of the invention
[0003] The embodiments of the present invention provide a recipe recommendation method, a recipe recommendation device and an electronic device. The recipe recommendation method can intelligently recommend recipes to a user according to the user's physical health condition.
[0004] To achieve the above object, the embodiments of the present invention adopt the following technical solutions:
[0005] In a first aspect, the recipe recommendation method provided by the present invention includes: screening multiple recipes stored in a knowledge graph according to a first rule to obtain multiple preliminary recipes. The first rule includes: filtering out recipes that do not match the user's basic health status from multiple recipes based on the label information corresponding to the multiple recipes. Using a double tower model to screen multiple preliminary recipes to obtain multiple alternative recipes. Sorting multiple alternative recipes according to a second rule. The second rule includes: calculating the scores of the alternative recipes based on the recipe features of the multiple alternative recipes, and the recipe features are obtained through the label information.
[0006] The knowledge graph stores a large number of recipes. Each recipe is labeled with different information through the knowledge graph, and a network of connections between recipes, diseases, stoves, etc. is established through the knowledge graph, which makes it easy to preliminarily screen out recipes suitable for the user's health from a large number of recipes through label information and the established network of connections. The preliminarily screened recipes are then further screened through the dual-tower model to obtain multiple alternative recipes. These alternative recipes are fewer in number than the recipes obtained in the preliminary selection, but are more compatible with the user. Finally, a more accurate ranking is obtained by sorting multiple alternative recipes according to the second rule for user reference.
[0007] As a possible implementation, the step of filtering multiple recipes stored in the knowledge graph according to the first rule to obtain multiple preliminary recipes includes: obtaining the basic health status of the user and obtaining the food that the user avoids. Obtaining the current meal time of the user. According to the label information corresponding to the multiple recipes, filtering out the recipes in the knowledge graph that are different from the current meal time of the user and the recipes that contain the food that the user avoids, to obtain multiple preliminary recipes.
[0008] As a possible implementation, the step of using the dual-tower model to screen the multiple preliminary recipes to obtain n candidate recipes includes: for each preliminary recipe: inputting user features into the user tower to obtain a user vector. Inputting recipe features into the item tower to obtain an item vector. Calculating the cosine similarity between the item vector and the user vector of each preliminary recipe, obtaining the top n preliminary recipes ranked by cosine similarity as candidate recipes. Outputting multiple candidate recipes.
[0009] As a possible implementation, user characteristics include user age, user weight, user height, user systolic pressure, user diastolic pressure, user skeletal muscle rate and user gender. Recipe characteristics include meal time, recipe ingredients, nutritional ingredients and applicable population.
[0010] As a possible implementation, sorting multiple candidate recipes according to the second rule includes: roughly sorting multiple candidate recipes according to the first sub-rule in the second rule. Roughly sorting multiple candidate recipes according to the first sub-rule in the second rule includes: for the candidate recipes, performing weighted summation according to the feature value of the recipe feature and the weights corresponding to the multiple recipe features to obtain a first score of the candidate recipe. Sorting the multiple candidate recipes according to the sizes of the first scores corresponding to the multiple candidate recipes.
[0011] As a possible implementation method, scoring and sorting multiple alternative recipes according to the second rule also includes: finely sorting the multiple alternative recipes according to the second sub-rule in the second rule. Finely sorting multiple alternative recipes according to the second sub-rule in the second rule includes: tracking multiple alternative recipes, and the tracking data includes the number of collections, the number of cooking times and the first score. For the alternative recipes, a weighted sum is taken according to the tracking data and the weights corresponding to the multiple tracking data to obtain the second score of the alternative recipe. According to the size of the second scores corresponding to the multiple alternative recipes, the multiple alternative recipes are sorted.
[0012] In a second aspect, the recipe recommendation device provided by the present invention includes: a first screening module, the first screening module is configured to screen multiple recipes stored in the knowledge graph according to a first rule to obtain multiple preliminary recipes. A second screening module, the second screening module is configured to use a double tower model to screen the preliminary recipes to obtain multiple candidate recipes. A scoring and sorting module, the scoring and sorting module is configured to sort the multiple candidate recipes according to a second rule.
[0013] As a possible implementation, the first screening module is configured to screen multiple recipes stored in the knowledge graph according to the first rule to obtain multiple preliminary recipes, and is specifically configured to: obtain the basic health status of the user and obtain the food that the user avoids. Obtain the current meal time of the user. According to the label information corresponding to the multiple recipes, filter out the recipes in the knowledge graph that are different from the current meal time of the user and the recipes that contain the food that the user avoids, and obtain the preliminary recipes.
[0014] As a possible implementation, the second screening module is configured to use a dual-tower model to screen multiple preliminary recipes to obtain multiple candidate recipes, and is specifically configured as follows: for multiple preliminary recipes, input user features into a user tower to obtain a user vector. Input recipe features into an item tower to obtain an item vector. Calculate the cosine similarity between the item vectors and the user vectors of the multiple preliminary recipes, and according to the cosine similarity values of the multiple preliminary recipes, obtain the top n preliminary recipes ranked by cosine similarity as candidate recipes. Output multiple candidate recipes.
[0015] In a third aspect, the present application provides an electronic device, the electronic device comprising a processor and a memory, wherein the processor is configured to execute computer instructions stored in the memory to implement the method as mentioned in the first aspect and different implementations of the first aspect.
[0016] Among them, the technical effects brought about by the second aspect and any of its implementations and the third aspect can refer to the technical effects brought about by different implementations of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.
[0018] Figure 1 A flow chart of a recipe recommendation method provided in an embodiment of the present application;
[0019] Figure 2 A schematic diagram of the composition of a knowledge graph provided in an embodiment of the present application;
[0020] Figure 3A schematic diagram of a knowledge graph provided for an embodiment of the present application;
[0021] Figure 4 A schematic diagram of a recipe label provided in an embodiment of the present application;
[0022] Figure 5 A schematic diagram of a double-tower model structure provided in an embodiment of the present application;
[0023] Figure 6 A flow chart of another recipe recommendation method provided in an embodiment of the present application;
[0024] Figure 7 A flow chart of another recipe recommendation method provided in an embodiment of the present application;
[0025] Figure 8 A user characteristics diagram provided in an embodiment of the present application;
[0026] Fig. 9 A schematic diagram of recipe features provided in an embodiment of the present application;
[0027] Fig.10 A flow chart of another recipe recommendation method provided in an embodiment of the present application;
[0028] Fig.11 A schematic diagram of characteristic values and weights corresponding to a recipe characteristic provided in an embodiment of the present application;
[0029] Fig.12 A schematic diagram of a recipe recommendation device provided in an embodiment of the present application;
[0030] Fig.13 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0033] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0034] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances. In addition, when describing the pipeline, the "connected" and "connection" used in the present invention have the meaning of conduction. The specific meaning needs to be understood in conjunction with the context.
[0035] In the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0036] With the continuous progress of society and the continuous development of the economy, people's quality of life is getting higher and higher, and people are paying more and more attention to health. A reasonable diet is closely related to people's health. Therefore, people have changed from initially pursuing just "eating enough" to now not only pursuing "eating well", but also paying more attention to "eating healthily".
[0037] The variety of recipes also makes it difficult for people to choose, so many recipe recommendation systems have emerged. However, these recipe recommendation systems often only cater to the user's taste preferences, but do not take the user's health into consideration.
[0038] In order to intelligently recommend recipes to users based on their physical health conditions, the present application embodiment provides a recipe recommendation method, such as Figure 1 shown.
[0039] Reference Figure 1 , the recipe recommendation method provided by this application includes:
[0040] S-100: Filter multiple recipes stored in the knowledge graph according to the first rule to obtain multiple preliminary recipes.
[0041] A knowledge graph is a relational network that connects different types of information. It is essentially a semantic network that reveals the relationship between entities and is a graph-based data structure. Figure 2 As shown, Figure 2 The composition of the knowledge graph is shown. Figure 2 , the knowledge graph consists of multiple nodes 1 and edges 2, Figure 2 In this article, we only use a knowledge graph consisting of five nodes and four edges as an example. Each node represents an "entity" in the real world, and each edge represents a "relationship" between entities.
[0042] For example, Figure 3 As shown, Figure 3 A knowledge graph for recipe recommendation provided in an embodiment of the present application. Figure 3 , the knowledge graph includes multiple recipes 11 and multiple recipe attributes 12. The multiple recipes 11 include barbecued meat, BBQ, candied sweet potato, scallion oil abalone, and sweet and sour pork with pineapple; the multiple recipe attributes 12 include home cooking, lunch, dinner, recipes, meat dishes, regional specialties, salty and fresh, and smart oven. The relationship between the recipe 11 and the recipe attributes 12 includes Include, Belong, and Suitable.
[0043] Recipe attribute 12 is an abstract concept that has a certain property shared by multiple recipes. For example, a recipe can be divided into breakfast, lunch, and dinner according to the time period when the user is suitable for eating it. A recipe can be associated with multiple recipe attributes because recipe attributes reflect the characteristics of a recipe from multiple different dimensions. Figure 3 , taking BBQ as an example, the recipe attributes of BBQ in the knowledge graph are explained. BBQ is a home-cooked dish, BBQ is also a meat dish, BBQ has a salty and fresh taste, and if you want to cook BBQ, you need a smart oven. BBQ is suitable for dinner.
[0044] It should be noted that the above embodiment only shows several recipes and several recipe attributes for illustration. In fact, the knowledge graph in the recipe recommendation method provided in the embodiment of the present application stores a large number of recipes and a large number of recipe attributes, so that each recipe can constitute an interwoven association network, which reflects a series of attributes of the recipe.
[0045] Compared with traditional storage methods, using knowledge graphs to store recipe information makes data retrieval faster. Compared with traditional databases that use tables and fields to read the relationship between data, knowledge graphs can handle complex and diverse associations. Most importantly, recipes in the knowledge graph can be labeled, such as Figure 4 As shown, Figure 4 The label of the recipe is shown.
[0046] For example, refer to Figure 4 , Figure 4 Taking the colorful pepper chicken skewers as an example, the label information displayed for the colorful pepper chicken skewers includes the recipe name, energy, carbohydrate content, fat content, protein content, meal time, and meat and vegetable attributes. The energy, carbohydrate content, fat content, and protein content information of the recipe can be used to determine whether the recipe is beneficial to the user's dietary health.
[0047] It should be noted that the energy, carbohydrate content, fat content, and protein content in the label information are all measured under fixed weight. Figure 4 For example, the energy of 100g of colorful pepper chicken skewers is 889.4 calories, the carbohydrate content of 100g of colorful pepper chicken skewers is 25, the fat content of 100g of colorful pepper chicken skewers is 20, and the protein content of 100g of colorful pepper chicken skewers is 60.
[0048] It should be noted that the embodiments of the present application only use recipe name, energy, carbohydrate content, fat content, protein content, meal time period, and meat and vegetable attributes as examples of label content, and the actual label content may include more or less content.
[0049] By filtering according to the first rule, a large number of recipes that are not suitable for users can be filtered out from the massive recipes. The remaining recipes are called preliminary recipes. From the massive recipes stored in the knowledge graph to multiple preliminary recipes, the entire filtering process is fast and very efficient.
[0050] S-110: Use the double tower model to screen multiple preliminary recipes to obtain multiple candidate recipes.
[0051] Although a round of screening has been carried out according to the first rule, the number of recipes stored in the knowledge graph has been reduced a lot, but there are still a large number of recipes in the preliminary recipes. If the preliminary recipes are directly analyzed and recommended, it will be a heavy burden for the intelligent recommendation system, and the data processing time of the intelligent recommendation system will become longer. Therefore, after the first round of screening, multiple preliminary recipes need to be screened again.
[0052] The twin tower model is a widely used model in recommendation systems. It can encode the features of two fields into a vector and then recall them based on the similarity of the vectors. Since the twin tower model can use almost all features, it is more suitable for the same recipe with multiple recipe attributes compared to the recall algorithm that uses only ID or certain attribute features. In addition, the twin tower model has a simple principle, is easy to implement, and has a fast response speed, so it can be quickly screened.
[0053] For example, Figure 5 As shown, Figure 5 The double tower model structure is shown. Figure 5 , Figure 5 The left side of the figure is the user tower, and the right side is the item tower. The first layer of the user tower (user feature) indicates that the user feature is input into the user tower, and the second layer of the user tower (user feature encoding vector, user embedding) indicates that the input user feature is encoded into a vector, and the vector is output as a user feature vector after passing through the third layer of the user tower (DNN deep neural network). The first layer of the item tower (item feature) indicates that the item feature is input into the item tower, and the second layer of the item tower (item feature encoding into vector, user embedding) indicates that the input item feature is encoded into a vector, and an item feature vector is output after passing through the third layer of the item tower (DNN deep neural network). The top of the dual-tower model indicates that the cosine similarity is calculated through the user feature vector and the item feature vector. The cosine similarity can be used to screen out items that are more suitable for the user feature.
[0054] S-120: Sort the multiple candidate recipes according to the second rule.
[0055] After the double-tower model has screened again, the number of candidate recipes has been greatly reduced, but these candidate recipes are more suitable for users. Since there are a large number of recipe attributes in the knowledge graph, such as the flavors of the recipes include salty, spicy, sweet, etc., and the cooking tools of the recipes include ovens, pressure cookers, frying pans, etc. Users can make adaptive adjustments in the recommendation system according to various recipe attributes.
[0056] The multiple candidate recipes are scored and sorted according to the second rule, so that the user can obtain the recommended ranking of the candidate recipes at a glance. With reference to the recommended ranking, the user can more conveniently select the recipe of his or her choice from the candidate recipes. For example, the sorting results of the multiple candidate recipes can be displayed on the APP for the user to view.
[0057] It should be noted that the overall process of the recipe recommendation method is divided into two stages: recall and sorting, where S-100 and S-110 are the recall stage, and S-120 is the sorting stage.
[0058] A large number of recipes are stored in the knowledge graph, and each recipe is marked with different label information through the knowledge graph, and a connection network between recipes and diseases, stoves, etc. is established through the knowledge graph, so that it is convenient to preliminarily screen out recipes suitable for users from a large number of recipes through label information and the established connection network. After that, the recipes preliminarily screened out are further screened through the double tower model to obtain multiple alternative recipes. These alternative recipes are fewer in number than the recipes obtained by the preliminary selection, but have a higher degree of fit with the user. Finally, a more accurate ranking is obtained for user reference by scoring and sorting multiple alternative recipes according to the second rule, so as to facilitate users to choose the recipes that are most suitable for them and beneficial to their health. Some embodiments of the present application are aimed at the problem of healthy diet, and apply the knowledge graph, the double tower model and the setting rules to provide a method that can effectively make reasonable diet recommendations based on the user's physical health data. The recipe recommendation method can recommend recipes based on the physical health data and historical diet data of different users, so that users can maintain a healthy body and healthy diet rules.
[0059] As a possible implementation, Figure 6 As shown, Figure 6 S-100 is shown: a specific process of filtering multiple recipes stored in the knowledge graph according to the first rule to obtain multiple preliminary recipes, including:
[0060] S-101: Obtain the user's basic health status and the foods that the user should avoid.
[0061] Obtaining the user's basic health status includes obtaining the user's height, weight, age, gender, and blood pressure. The basic health status of the user can be used to determine whether the user has high blood pressure, obesity, or malnutrition. After knowing that the user has basic diseases such as high blood pressure, low blood pressure, high blood lipids, obesity, or malnutrition, the food that the user should avoid is obtained through the recipe attributes in the knowledge graph - the correlation with the disease.
[0062] S-102: Get the user's current meal time.
[0063] Obtaining the user's current meal time ensures that the user can have suitable menu recommendations at different time periods, and will not recommend overly greasy food such as roasted whole lamb when the user is empty stomach in the morning, which is also beneficial to the maintenance of the user's health to a great extent.
[0064] S-103: According to the label information corresponding to the multiple recipes, the recipes in the knowledge graph that are different from the user's current dining period and the recipes that contain the user's taboo foods are filtered out to obtain multiple preliminary recipes.
[0065] Steps S-101 and S-102 are used as screening conditions for the massive recipes in the knowledge graph. Recipes containing the user's taboo foods obtained in step S-101 are filtered out from the massive recipes, and then recipes with different meal times from those obtained in S-102 are filtered out. The remaining recipes are preliminary recipes.
[0066] It should be noted that the embodiment of the present application limits the conditions for the first round of screening to the user's taboo foods and the current meal period obtained based on the user's basic health status. In fact, any recipe attribute existing in the graph can be used as one of the restriction conditions, including but not limited to recipe flavors, cooking tools, etc.
[0067] It should be noted that this application does not restrict the method of obtaining the user's basic health status. The user can actively fill in the basic health status when logging into the app, or the app can automatically read the smart bracelet that can monitor the user's basic health status in real time through permission.
[0068] In some embodiments, Figure 7 As shown, Figure 7 The specific steps of S-110: using the double tower model to screen multiple preliminary recipes to obtain multiple candidate recipes are shown, including:
[0069] S-111: For each preliminary recipe, input the user features into the user tower to obtain the user vector.
[0070] For example, Figure 8 As shown, Figure 8 A user feature diagram provided in an embodiment of the present application. Figure 8 ,The user characteristics include user age, user weight, user height, user systolic pressure, user diastolic pressure, user skeletal muscle rate, and user gender.
[0071] S-112: Input recipe features into the item tower to obtain the item vector.
[0072] Recipe features include meal time, recipe ingredients, nutritional content, and applicable population. For example, Fig. 9 As shown, Fig. 9 A schematic diagram of a recipe feature provided in an embodiment of the present application. Fig. 9,The recipe features specifically include whether it is suitable for breakfast, whether it is suitable for lunch, whether it is suitable for dinner, whether it is meat, whether it is fruit, whether it is a staple food, whether it is a vegetable, the protein content, the fat content, the carbohydrate content, whether it is suitable for diabetes, and whether it is suitable for hypertension.
[0073] S-113: Calculate the cosine similarity between the item vector and the user vector of the preliminary recipe, and obtain the top n preliminary recipes ranked by cosine similarity according to the cosine similarity values of the plurality of preliminary recipes as candidate recipes.
[0074] S-114: Output multiple alternative recipes.
[0075] By calculating the cosine similarity value between the user vector and the item vector, we can know the degree of fit between the user characteristics and multiple preliminary recipes. The higher the cosine similarity value, the higher the degree of fit between the user characteristics and a preliminary recipe, and the more suitable the preliminary recipe is for the user. At the same time, some recipes that are obviously not in line with the user's diet can be filtered out. For example, in the process of screening according to the first rule, a hamburger that is not suitable for obese users belongs to one of the multiple preliminary recipes. Then the second round of screening through the double tower model will completely filter out such recipes. The preliminary recipes ranked in the top n by cosine similarity are obtained as candidate recipes, and the recipe with the highest degree of fit with the user is selected.
[0076] As a possible implementation, Fig.10 As shown, Fig.10 The specific steps of S-120: sorting multiple candidate recipes according to the second rule are shown, including:
[0077] S-121: Roughly sort multiple candidate recipes according to the first sub-rule in the second rule.
[0078] Specifically, the multiple candidate recipes are roughly sorted according to the first sub-rule in the second rule, including: for each candidate recipe, a weighted sum is performed according to the feature value of the recipe feature and the weight corresponding to each recipe feature to obtain a first score of the candidate recipe. The multiple candidate recipes are sorted according to the magnitude of the first scores corresponding to the multiple candidate recipes.
[0079] For example, Fig.11 As shown, Fig.11 The feature values and weights corresponding to the recipe features are shown. Fig.11, when the recipe is suitable for breakfast, the weight is 5%; when the recipe is not suitable for lunch, the weight is 5%; when the recipe is suitable for dinner, the weight is 5%; when the recipe is not meat, the weight is 10%; when the recipe is fruit, the weight is 10%; when the recipe is not vegetable, the weight is 10%; when the recipe is not a staple food, the weight is 10%; the protein content, fat content and carbohydrate content are all weighted 5%, when the recipe is suitable for diabetes, the weight is 15%, and when the recipe is suitable for high blood pressure, the weight is 15%.
[0080] by Fig.11 For example, the calculation process of the first score is
[0081] 1*0.05+0*0.05+1*0.05+0*0.1+1*0.1+0*0.1+0*0.1+0.1*0.05+0.1*0.05+0.3*0.05+1*0.15+1*0.15=0.52
[0082] It should be noted that, except for the protein content, fat content and carbohydrate content of the recipe features, the feature values corresponding to the other features are calculated as "1" if the recipe features are true, and "0" if the recipe features are false.
[0083] S-122: Arrange the multiple candidate recipes according to the second sub-rule in the second rule.
[0084] Specifically, multiple alternative recipes are finely sorted according to the second sub-rule in the second rule, including: tracking multiple alternative recipes, where the tracking data includes the number of collections, the number of cooking times, and the first score. For each alternative recipe, a weighted sum is performed based on the tracking data and the weight corresponding to each tracking data to obtain the second score of the alternative recipe. The multiple alternative recipes are sorted according to the size of the second scores corresponding to the multiple alternative recipes.
[0085] In order to more accurately reflect the popularity of multiple candidate recipes for the majority of users, the embodiment of the present application uses the number of collections, the number of cooking times and the first score as the basis for fine sorting. The number of collections largely reflects the majority of users' love for the collected recipes, and the number of cooking times truly reflects the final user's choice of recipes.
[0086] Exemplarily, when calculating the second score, the characteristic value of the number of user collections is first calculated based on the ratio of the number of user collections to the user base. For example, if the user base is 100 and the number of collections recorded in the buried point is 50, then the characteristic value is 0.5. The characteristic value of the number of user cooking times is calculated based on the ratio of the number of cooking times to the user base. For example, if the user base is 100 and the number of cooking times recorded in the buried point is 30, then the characteristic value is 0.3.
[0087] The second score is calculated by multiplying the characteristic value of the number of collections by the weight corresponding to the number of collections, the characteristic value of the number of cooking times by the weight corresponding to the number of cooking times, and the sum of the first score and the corresponding weight value. For example, if the weight values of the number of collections, the number of cooking times, and the first score are 50%, 30%, and 20% respectively, the second score is 0.5*0.5+0.3*0.3+0.52*0.2=0.444. After calculating the second score, the second score can be sorted according to the size of the second score, so that users can easily get the recipe recommendation ranking.
[0088] The present application also provides a recipe recommendation device. Fig.12 As shown, Fig.12 The composition of the recipe recommendation device is shown. The recipe recommendation device 10 includes a first screening module 3, a second screening module 4 and a scoring and sorting module 5. The first screening module 3 is configured to screen multiple recipes stored in the knowledge graph according to a first rule to obtain multiple preliminary recipes. The second screening module 4 is configured to use a double tower model to screen multiple preliminary recipes to obtain multiple candidate recipes. The scoring and sorting module 5 is configured to sort multiple candidate recipes according to a second rule.
[0089] As a possible implementation, the first screening module is configured to screen multiple recipes stored in the knowledge graph according to the first rule to obtain multiple preliminary recipes, and is specifically configured to: obtain the basic health status of the user and obtain the food that the user avoids. Obtain the current meal time of the user. According to the label information corresponding to the multiple recipes, filter out the recipes in the knowledge graph that are different from the current meal time of the user and the recipes that contain the food that the user avoids, and obtain multiple preliminary recipes.
[0090] As a possible implementation, the second screening module is configured to use a dual-tower model to screen multiple preliminary recipes to obtain multiple candidate recipes, and is specifically configured as follows: for each preliminary recipe: input the user feature into the user tower to obtain a user vector. Input the recipe feature into the item tower to obtain an item vector. Calculate the cosine similarity between the item vector and the user vector of each preliminary recipe, and according to the cosine similarity values of the multiple preliminary recipes, obtain the top n preliminary recipes ranked by cosine similarity as candidate recipes. Output multiple candidate recipes.
[0091] As a possible implementation, the scoring and sorting module is configured to sort multiple alternative recipes according to the second rule, and is specifically configured as follows: for each alternative recipe, a weighted sum is taken according to the characteristic value of the recipe feature and the weight corresponding to each recipe feature to obtain a first score for the alternative recipe. According to the size of the first scores corresponding to the multiple alternative recipes, the multiple alternative recipes are sorted. A tracking point is performed on the multiple alternative recipes, and the tracking point collected data includes the number of collections, the number of cooking times and the first score. For each alternative recipe, a weighted sum is taken according to the tracking point collected data and the weight corresponding to each tracking point collected data to obtain a second score for the alternative recipe. According to the size of the second scores corresponding to the multiple alternative recipes, the multiple alternative recipes are sorted.
[0092] The beneficial effects of the recipe recommendation device provided by some of the above-mentioned embodiments are the same as the beneficial effects of the above-mentioned recipe recommendation method. It can apply knowledge graphs, dual-tower models and set rules to the problem of healthy diet, and can effectively make reasonable diet recommendations based on the user's physical health data. Through the recipe recommendation device, recipe recommendations can be made based on the physical health data and historical diet data of different users, which can enable users to maintain a healthy body and healthy eating habits.
[0093] The recipe recommendation method provided in the embodiment of the present application can be applied to electronic devices, for example, Fig.13 , Fig.13 A schematic diagram of the structure of an electronic device 020 provided in an embodiment of the present application is shown in FIG. Fig.13 As shown, the electronic device 020 may include a processor 021 , a communication line 022 and a communication interface 023 .
[0094] Exemplarily, the electronic device 020 may further include a memory 024. The processor 021, the memory 024 and the communication interface 023 may be connected via a communication line 022. The processor 021 may be a central processing unit (CPU), a general processor, a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device or any combination thereof. The processor 021 may also be other devices with processing functions, such as circuits, devices or software modules.
[0095] The communication line 022 is used to transmit information between the various components of the electronic device 020.
[0096] The communication interface 023 is used to communicate with other devices or communication networks. The communication network can be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. The communication interface 023 can be an interface circuit, a pin, a radio frequency module, a transceiver or any device capable of achieving communication.
[0097] Memory 024 is used to store instructions. The instructions may be a computer program for executing the circuit manufacturing method provided in the embodiment of the present application. The memory 024 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact cisc read-only memory (CD-ROM) or other optical disk storage, optical disk storage, magnetic disk storage medium or other magnetic storage device, and the optical disk storage includes a compressed optical disk, a laser disk, an optical disk, a digital versatile disk, or a Blu-ray disk, etc.
[0098] It should be noted that the memory 024 can exist independently of the processor 021, or can be integrated with the processor 021. The memory 024 can be used to store instructions or program codes or some data, etc. The memory 024 can be located inside the electronic device 020, or outside the electronic device 020, without limitation. The processor 021 is used to execute the instructions stored in the memory 024 to implement the recipe recommendation method provided in the embodiment of the present application.
[0099] In one example, the processor 021 may include one or more CPUs, such as Fig.13 CPU0 and CPU1 in.
[0100] As an optional implementation, the electronic device 020 includes multiple processors, for example, Fig.13 In addition to the processor 021, a processor 027 may also be included.
[0101] As an optional implementation, the electronic device 020 further includes an output device 025 and an input device 026. For example, the input device 026 may be a keyboard, a mouse, a microphone, a joystick, etc., and the output device 025 may be a display screen, a speaker, etc. It should be noted that the electronic device 020 may be a desktop computer, a portable computer, a network server, a mobile phone, a tablet computer, a wireless terminal, an embedded device, a chip system, or a computer with a processor. Fig.13 In addition, Fig.13 The composition structure shown in the figure does not constitute a limitation on the processing device, except Fig.13 In addition to the components shown, the electronic device 020 may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0102] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A recipe recommendation method, characterized in that: The recipe recommendation method comprises: The plurality of recipes stored in the knowledge graph are screened according to a first rule to obtain a plurality of preliminary recipes; wherein the first rule includes: filtering out recipes that do not match the basic health condition of the user from the plurality of recipes according to tag information corresponding to the plurality of recipes; Using the double tower model to screen the multiple preliminary recipes to obtain multiple candidate recipes; The multiple candidate recipes are sorted according to a second rule; wherein the second rule includes: calculating scores of the candidate recipes according to recipe features of the multiple candidate recipes, wherein the recipe features are obtained through the label information.
2. The recipe recommendation method according to claim 1, characterized in that: The step of screening the multiple recipes stored in the knowledge graph according to the first rule to obtain multiple preliminary recipes includes: Obtain the user's basic health status and the foods that the user should avoid; Get the user's current meal time; According to the label information corresponding to the multiple recipes, the recipes in the knowledge graph that are different from the user's current dining period and the recipes containing the user's taboo foods are filtered out to obtain multiple preliminary recipes.
3. The recipe recommendation method according to claim 1, characterized in that: The step of using the double tower model to screen the plurality of preliminary recipes to obtain a plurality of candidate recipes comprises: For the preliminary recipe: input the user features into the user tower to obtain the user vector; input the recipe features into the item tower to obtain the item vector; Calculating the cosine similarity between the item vector of the preliminary recipe and the user vector; According to the cosine similarity values of the plurality of preliminary recipes, obtaining the top n preliminary recipes ranked by cosine similarity as candidate recipes; Output a plurality of the candidate recipes.
4. The recipe recommendation method according to claim 3, characterized in that: The user characteristics include user age, user weight, user height, user systolic pressure, user diastolic pressure, user skeletal muscle rate and user gender; The recipe features include meal time period, recipe ingredients, nutritional components and applicable population.
5. The recipe recommendation method according to claim 1, characterized in that: The sorting of the plurality of candidate recipes according to the second rule includes: roughly sorting the plurality of candidate recipes according to the first sub-rule in the second rule; The plurality of candidate recipes are roughly sorted according to the first sub-rule in the second rule, including: For the candidate recipe, a weighted sum is performed according to the feature value of the recipe feature and the weights corresponding to the multiple recipe features to obtain a first score of the candidate recipe; The plurality of candidate recipes are sorted according to the sizes of the first scores corresponding to the plurality of candidate recipes.
6. The recipe recommendation method according to claim 5, characterized in that: The scoring and sorting the plurality of candidate recipes according to the second rule further includes: sorting the plurality of candidate recipes according to the second sub-rule in the second rule; The multiple candidate recipes are carefully sorted according to the second sub-rule in the second rule, including: Tracking the multiple candidate recipes; collecting data including the number of collections, the number of cooking times and the first score; For the candidate recipe, a weighted sum is performed according to the embedded point collection data and the weights corresponding to the multiple embedded point collection data to obtain a second score of the candidate recipe; The plurality of candidate recipes are sorted according to the sizes of the second scores corresponding to the plurality of candidate recipes.
7. A recipe recommendation device, characterized in that: The recipe recommendation device comprises: A first screening module, the first screening module is configured to screen a plurality of recipes stored in the knowledge graph according to a first rule to obtain a plurality of preliminary recipes; wherein the first rule includes: filtering out recipes that do not match the basic health condition of the user from the plurality of recipes according to tag information corresponding to the plurality of recipes; a second screening module, the second screening module being configured to screen the plurality of preliminary recipes using a double-tower model to obtain a plurality of candidate recipes; A scoring and sorting module is configured to sort the multiple candidate recipes according to a second rule; wherein the second rule includes: calculating scores of the multiple candidate recipes according to recipe features of the multiple candidate recipes, wherein the recipe features are obtained through the label information.
8. The recipe recommendation device according to claim 7, characterized in that: The first screening module is configured to screen multiple recipes stored in the knowledge graph according to a first rule to obtain multiple preliminary recipes, and is specifically configured as follows: Obtain the user's basic health status and the foods that the user should avoid; Get the user's current meal time; According to the label information corresponding to the multiple recipes, the recipes in the knowledge graph that are different from the user's current dining period and the recipes containing the user's taboo foods are filtered out to obtain multiple preliminary recipes.
9. The recipe recommendation device according to claim 7, characterized in that: The second screening module is configured to use the double tower model to screen the multiple preliminary recipes to obtain multiple candidate recipes, and is specifically configured as follows: For the preliminary recipe: input the user features into the user tower to obtain the user vector; Input recipe features into the item tower to obtain the item vector; Calculating the cosine similarity between the item vectors of the plurality of preliminary recipes and the user vector, According to the cosine similarity values of the plurality of preliminary recipes, obtaining the top n preliminary recipes ranked by cosine similarity as candidate recipes; Output a plurality of the candidate recipes.
10. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is configured to execute computer instructions stored in the memory to implement the method according to any one of claims 1 to 6.